@kumori/aurora-user-context
v1.0.0
Published
user context for the aurora project
Keywords
Readme
User Context
Table of Contents
Overview
This project provides the User Context used to store the data of the user in the aurora WUI.
Usage
To install this library ensure you have the following prerequisites installed:
Then you can install the package with the following command:
npm install @aurora-context/context@latestThis library gives acces to the lit context 'userContext' on which the data of the User will be stored.
Test
Installation
- Install dependencies:
npm installRunning Test
The project uses Jest as the testing framework with TypeScript support via ts-jest. To execute the tests, simply run:
npm run testCoverage
The coverage of the test will be shown on the console where the test have been executed but also in a coverage folder on the repository directory.
Architecture
Proposed Data Models
export class User {
id: string;
name: string;
surname: string;
email: string;
password: string;
notificationsEnabled: string;
organizations: Organization[];
tokens: Token[];
tenants: Tenant[];
axebowPlan: "freemium" | "premium";
companyName: string;
rol: string;
}
interface Organization {
id: string,
name: string,
usersIds: string[],
tenantsIds: string[],
billingInformation: {
legalName: string,
CIFNIF: string,
email: string,
language: string,
country: string,
region: string,
city: string,
address: string,
zipcode: string,
}
invoices: {
id: string,
name: string,
customer: string,
customerCIF: string,
cost: number,
date: string,
invoiceFile: string,
}[],
status?: string,
}
interface Token {
name: string;
tenant: string;
desciprion: string;
lastUsed: string;
expiration: string;
token: string;
}
interface Tenant {
id: string,
name: string,
organizationsIds: string[],
services: Service[],
accounts: Account[],
environments: Environment[],
marketplaceItems: MarketplaceItem[],
resources: Resource[],
role: string,
status: string,
users: number;
}
interface Service {
id: string;
tenant: string;
account: string;
environment: string;
name: string;
logo: string;
description: string;
revisions: string[];
status: string;
role: { name: string; instances: Instance[]; logo?: string, category?: string, version?: string, description?: string, resource?: Resource[] }[];
links: Link[];
resources: Resource[];
usage: Usage;
minReplicas?: number;
maxReplicas?: number;
lastDeployed?: string;
project: string;
registry: string;
imageName: string;
entrypoint: string;
cmd: string;
serverChannels: Channel[];
clientChannels: Channel[];
duplexChannels: Channel[];
cloudProvider: string;
currentRevision?: string;
startedAt?: string;
}
interface Instance {
id: string;
name: string;
status: string;
usage: Usage;
logs: string[];
conatiners: Container[];
}
interface Container {
name: string;
ready: boolean;
reestartCount: number;
metrics: {
cpu: number;
memory: number;
}
states: any;
}
interface Channel {
name: string;
from: string;
to: string;
protocol?: "http" | "tcp" | "https";
port?: number;
portNum?: number;
}
interface Account {
id: string;
name: string;
tenant: string;
cloudProvider: {
name: string;
region?: string;
interface?: string;
apiVersion?: string;
authType?: string;
authUrl?: string;
credentialId?: string;
credentialSecret?: string;
};
logo: string;
environments: string[];
services: string[];
domains: string[];
status: string;
usage: Usage;
flavors?: {
small: string;
medium: string;
large: string;
volatile: string;
nonReplicated: string;
persistent: string;
};
organization?: string;
}
interface Usage {
current: {
cpu: number;
memory: number;
storage: number;
volatileStorage: number;
nonReplicatedStorage: number;
persistentStorage: number;
};
limit: {
cpu: {
max: number;
min: number;
}
memory: {
max: number;
min: number;
}
storage: {
max: number;
min: number;
}
volatileStorage: {
max: number;
min: number;
}
nonReplicatedStorage: {
max: number;
min: number;
}
persistentStorage:{
max: number;
min: number;
}
};
cost: number;
}
interface Environment {
id: string;
name: string;
account: string;
tenant: string;
logo: string;
services: string[];
domains: string[];
status: string;
usage: Usage;
organization?: string;
cloudProvider?: string;
labels?: string[];
}
interface MarketplaceItem {
tenant: string,
name: string,
logo: string,
description: string,
version: string,
requirements: {
cpu: number,
memory: number,
}
status: string,
instances: Instance[],
links: Link[],
resources: Resource[],
domain?: string,
type?: string,
}
interface Resource {
type: 'clientChannel' | 'secret' | 'volume' | 'file' | 'string' | 'number' | 'boolean',
name: string,
value: string,
kind?: 'volatile' | 'nonReplicated' | 'persistent',
maxItems?: number,
}
interface Link {
name: string,
origin: string,
target: string,
}
Repository Tree
.
├── README.md
├── user-context.ts
├── user-context.test.ts
├── event-helper.ts
├── event-helper.test.ts
├── event-names.ts
├── jest.config.ts
├── package.lock.json
├── package.json
├── tsconfig.json
├── interfaces
│ ├── account-interface.ts
│ ├── channel-interface.ts
│ ├── container-interface.ts
│ ├── environment-interface.ts
│ ├── instance-interface.ts
│ ├── link-interface.ts
│ ├── marketplaceItem-interface.ts
│ ├── organization-interface.ts
│ ├── resource-interface.ts
│ ├── service-interface.ts
│ ├── tenant-interface.ts
│ ├── token-interface.ts
│ ├── usage-interface.ts
│ └── user-interface.ts
│
├── coverage
│ └── coverage data...
│
└── LICENSE
