@quatrain/core 1.1.23 → 1.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -8
- package/{lib → dist}/Core.d.ts +3 -17
- package/dist/Core.d.ts.map +1 -0
- package/dist/Core.js +105 -0
- package/dist/Core.js.map +1 -0
- package/dist/common/DataGenerator.d.ts +3 -0
- package/dist/common/DataGenerator.d.ts.map +1 -0
- package/dist/common/DataGenerator.js +86 -0
- package/dist/common/DataGenerator.js.map +1 -0
- package/{lib → dist}/common/ResourcesErrors.d.ts +1 -0
- package/dist/common/ResourcesErrors.d.ts.map +1 -0
- package/{lib → dist}/common/ResourcesErrors.js +1 -0
- package/dist/common/ResourcesErrors.js.map +1 -0
- package/{lib → dist}/common/statuses.d.ts +5 -0
- package/dist/common/statuses.d.ts.map +1 -0
- package/dist/common/statuses.js +24 -0
- package/dist/common/statuses.js.map +1 -0
- package/{lib → dist}/components/AbstractObject.d.ts +1 -5
- package/dist/components/AbstractObject.d.ts.map +1 -0
- package/{lib → dist}/components/AbstractObject.js +7 -10
- package/dist/components/AbstractObject.js.map +1 -0
- package/{lib → dist}/components/BaseObject.d.ts +4 -17
- package/dist/components/BaseObject.d.ts.map +1 -0
- package/dist/components/BaseObject.js +71 -0
- package/dist/components/BaseObject.js.map +1 -0
- package/dist/components/BaseObjectProperties.d.ts +2 -0
- package/dist/components/BaseObjectProperties.d.ts.map +1 -0
- package/{lib → dist}/components/BaseObjectProperties.js +1 -2
- package/dist/components/BaseObjectProperties.js.map +1 -0
- package/{lib → dist}/components/DataObject.d.ts +2 -51
- package/dist/components/DataObject.d.ts.map +1 -0
- package/{lib → dist}/components/DataObject.js +38 -111
- package/dist/components/DataObject.js.map +1 -0
- package/{lib → dist}/components/Entity.d.ts +1 -0
- package/dist/components/Entity.d.ts.map +1 -0
- package/dist/components/Entity.js +48 -0
- package/dist/components/Entity.js.map +1 -0
- package/{lib → dist}/components/ObjectUri.d.ts +1 -26
- package/dist/components/ObjectUri.d.ts.map +1 -0
- package/{lib → dist}/components/ObjectUri.js +13 -41
- package/dist/components/ObjectUri.js.map +1 -0
- package/{lib → dist}/components/User.d.ts +1 -0
- package/dist/components/User.d.ts.map +1 -0
- package/{lib → dist}/components/User.js +7 -26
- package/dist/components/User.js.map +1 -0
- package/dist/components/__test__/fixtures/dao.d.ts +37 -0
- package/dist/components/__test__/fixtures/dao.d.ts.map +1 -0
- package/dist/components/__test__/fixtures/dao.js +100 -0
- package/dist/components/__test__/fixtures/dao.js.map +1 -0
- package/{lib → dist}/components/index.d.ts +5 -2
- package/dist/components/index.d.ts.map +1 -0
- package/{lib → dist}/components/index.js +1 -0
- package/dist/components/index.js.map +1 -0
- package/{lib → dist}/components/types/AbstractObjectClass.d.ts +1 -0
- package/dist/components/types/AbstractObjectClass.d.ts.map +1 -0
- package/dist/components/types/AbstractObjectClass.js +3 -0
- package/dist/components/types/AbstractObjectClass.js.map +1 -0
- package/{lib → dist}/components/types/BaseObjectClass.d.ts +1 -0
- package/dist/components/types/BaseObjectClass.d.ts.map +1 -0
- package/{lib → dist}/components/types/BaseObjectClass.js +1 -0
- package/dist/components/types/BaseObjectClass.js.map +1 -0
- package/{lib → dist}/components/types/BaseObjectType.d.ts +2 -1
- package/dist/components/types/BaseObjectType.d.ts.map +1 -0
- package/{lib → dist}/components/types/BaseObjectType.js +1 -0
- package/dist/components/types/BaseObjectType.js.map +1 -0
- package/{lib → dist}/components/types/DataObjectClass.d.ts +1 -0
- package/dist/components/types/DataObjectClass.d.ts.map +1 -0
- package/{lib → dist}/components/types/DataObjectClass.js +1 -0
- package/dist/components/types/DataObjectClass.js.map +1 -0
- package/dist/components/types/DataObjectParams.d.ts +8 -0
- package/dist/components/types/DataObjectParams.d.ts.map +1 -0
- package/dist/components/types/DataObjectParams.js +3 -0
- package/dist/components/types/DataObjectParams.js.map +1 -0
- package/{lib → dist}/components/types/DataObjectType.d.ts +1 -0
- package/dist/components/types/DataObjectType.d.ts.map +1 -0
- package/{lib → dist}/components/types/DataObjectType.js +1 -0
- package/dist/components/types/DataObjectType.js.map +1 -0
- package/{lib → dist}/components/types/EntityClass.d.ts +1 -0
- package/dist/components/types/EntityClass.d.ts.map +1 -0
- package/{lib → dist}/components/types/EntityClass.js +1 -0
- package/dist/components/types/EntityClass.js.map +1 -0
- package/{lib → dist}/components/types/Payload.d.ts +1 -0
- package/dist/components/types/Payload.d.ts.map +1 -0
- package/{lib → dist}/components/types/Payload.js +1 -0
- package/dist/components/types/Payload.js.map +1 -0
- package/{lib → dist}/components/types/Persisted.d.ts +1 -0
- package/dist/components/types/Persisted.d.ts.map +1 -0
- package/{lib → dist}/components/types/Persisted.js +1 -0
- package/dist/components/types/Persisted.js.map +1 -0
- package/dist/components/types/Properties.d.ts +2 -0
- package/dist/components/types/Properties.d.ts.map +1 -0
- package/{lib/components/types/AbstractObjectClass.js → dist/components/types/Properties.js} +1 -0
- package/dist/components/types/Properties.js.map +1 -0
- package/{lib → dist}/components/types/ProxyConstructor.d.ts +1 -0
- package/dist/components/types/ProxyConstructor.d.ts.map +1 -0
- package/{lib → dist}/components/types/ProxyConstructor.js +1 -0
- package/dist/components/types/ProxyConstructor.js.map +1 -0
- package/{lib → dist}/components/types/toJSONParams.d.ts +1 -0
- package/dist/components/types/toJSONParams.d.ts.map +1 -0
- package/{lib → dist}/components/types/toJSONParams.js +1 -0
- package/dist/components/types/toJSONParams.js.map +1 -0
- package/{lib → dist}/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -0
- package/{lib → dist}/index.js +4 -1
- package/dist/index.js.map +1 -0
- package/{lib → dist}/properties/ArrayProperty.d.ts +1 -0
- package/dist/properties/ArrayProperty.d.ts.map +1 -0
- package/{lib → dist}/properties/ArrayProperty.js +5 -4
- package/dist/properties/ArrayProperty.js.map +1 -0
- package/{lib → dist}/properties/BaseProperty.d.ts +3 -2
- package/dist/properties/BaseProperty.d.ts.map +1 -0
- package/{lib → dist}/properties/BaseProperty.js +18 -11
- package/dist/properties/BaseProperty.js.map +1 -0
- package/{lib → dist}/properties/BooleanProperty.d.ts +1 -0
- package/dist/properties/BooleanProperty.d.ts.map +1 -0
- package/{lib → dist}/properties/BooleanProperty.js +2 -1
- package/dist/properties/BooleanProperty.js.map +1 -0
- package/{lib → dist}/properties/CollectionProperty.d.ts +1 -0
- package/dist/properties/CollectionProperty.d.ts.map +1 -0
- package/{lib → dist}/properties/CollectionProperty.js +6 -4
- package/dist/properties/CollectionProperty.js.map +1 -0
- package/{lib → dist}/properties/DateTimeProperty.d.ts +1 -0
- package/dist/properties/DateTimeProperty.d.ts.map +1 -0
- package/{lib → dist}/properties/DateTimeProperty.js +12 -5
- package/dist/properties/DateTimeProperty.js.map +1 -0
- package/{lib → dist}/properties/EnumProperty.d.ts +1 -0
- package/dist/properties/EnumProperty.d.ts.map +1 -0
- package/{lib → dist}/properties/EnumProperty.js +4 -3
- package/dist/properties/EnumProperty.js.map +1 -0
- package/{lib → dist}/properties/FileProperty.d.ts +1 -0
- package/dist/properties/FileProperty.d.ts.map +1 -0
- package/{lib → dist}/properties/FileProperty.js +3 -2
- package/dist/properties/FileProperty.js.map +1 -0
- package/{lib → dist}/properties/HashProperty.d.ts +2 -7
- package/dist/properties/HashProperty.d.ts.map +1 -0
- package/{lib → dist}/properties/HashProperty.js +15 -23
- package/dist/properties/HashProperty.js.map +1 -0
- package/{lib → dist}/properties/MapProperty.d.ts +1 -0
- package/dist/properties/MapProperty.d.ts.map +1 -0
- package/{lib → dist}/properties/MapProperty.js +2 -1
- package/dist/properties/MapProperty.js.map +1 -0
- package/{lib → dist}/properties/NumberProperty.d.ts +1 -0
- package/dist/properties/NumberProperty.d.ts.map +1 -0
- package/{lib → dist}/properties/NumberProperty.js +15 -14
- package/dist/properties/NumberProperty.js.map +1 -0
- package/{lib → dist}/properties/ObjectProperty.d.ts +1 -0
- package/dist/properties/ObjectProperty.d.ts.map +1 -0
- package/{lib → dist}/properties/ObjectProperty.js +4 -3
- package/dist/properties/ObjectProperty.js.map +1 -0
- package/{lib → dist}/properties/Property.d.ts +1 -0
- package/dist/properties/Property.d.ts.map +1 -0
- package/{lib → dist}/properties/Property.js +12 -11
- package/dist/properties/Property.js.map +1 -0
- package/{lib → dist}/properties/StringProperty.d.ts +3 -5
- package/dist/properties/StringProperty.d.ts.map +1 -0
- package/{lib → dist}/properties/StringProperty.js +20 -28
- package/dist/properties/StringProperty.js.map +1 -0
- package/{lib → dist}/properties/index.d.ts +4 -2
- package/dist/properties/index.d.ts.map +1 -0
- package/{lib → dist}/properties/index.js +1 -0
- package/dist/properties/index.js.map +1 -0
- package/{lib → dist}/properties/types/AbstractPropertyType.d.ts +1 -0
- package/dist/properties/types/AbstractPropertyType.d.ts.map +1 -0
- package/{lib → dist}/properties/types/AbstractPropertyType.js +1 -0
- package/dist/properties/types/AbstractPropertyType.js.map +1 -0
- package/{lib → dist}/properties/types/PropertyClassType.d.ts +1 -0
- package/dist/properties/types/PropertyClassType.d.ts.map +1 -0
- package/{lib → dist}/properties/types/PropertyClassType.js +1 -0
- package/dist/properties/types/PropertyClassType.js.map +1 -0
- package/{lib → dist}/properties/types/PropertyHTMLType.d.ts +1 -0
- package/dist/properties/types/PropertyHTMLType.d.ts.map +1 -0
- package/{lib → dist}/properties/types/PropertyHTMLType.js +1 -2
- package/dist/properties/types/PropertyHTMLType.js.map +1 -0
- package/{lib → dist}/properties/types/PropertyTypes.d.ts +1 -0
- package/dist/properties/types/PropertyTypes.d.ts.map +1 -0
- package/{lib → dist}/properties/types/PropertyTypes.js +1 -0
- package/dist/properties/types/PropertyTypes.js.map +1 -0
- package/package.json +47 -41
- package/src/Core.ts +145 -0
- package/src/common/DataGenerator.ts +81 -0
- package/src/common/ResourcesErrors.ts +17 -0
- package/src/common/statuses.ts +20 -0
- package/src/components/AbstractObject.ts +71 -0
- package/src/components/BaseObject.ts +123 -0
- package/src/components/BaseObjectProperties.ts +65 -0
- package/src/components/DataObject.ts +418 -0
- package/src/components/Entity.ts +38 -0
- package/src/components/ObjectUri.test.ts +74 -0
- package/src/components/ObjectUri.ts +174 -0
- package/src/components/User.ts +111 -0
- package/src/components/index.ts +19 -0
- package/src/components/types/AbstractObjectClass.ts +7 -0
- package/src/components/types/BaseObjectClass.ts +8 -0
- package/src/components/types/BaseObjectType.ts +10 -0
- package/src/components/types/DataObjectClass.ts +27 -0
- package/src/components/types/DataObjectParams.ts +8 -0
- package/src/components/types/DataObjectType.ts +27 -0
- package/src/components/types/EntityClass.ts +3 -0
- package/src/components/types/Payload.ts +11 -0
- package/src/components/types/Persisted.ts +7 -0
- package/src/components/types/Properties.ts +1 -0
- package/src/components/types/ProxyConstructor.ts +13 -0
- package/src/components/types/toJSONParams.ts +12 -0
- package/src/index.ts +97 -0
- package/src/properties/ArrayProperty.test.ts +46 -0
- package/src/properties/ArrayProperty.ts +87 -0
- package/src/properties/BaseProperty.test.ts +79 -0
- package/src/properties/BaseProperty.ts +140 -0
- package/src/properties/BooleanProperty.ts +11 -0
- package/src/properties/CollectionProperty.test.ts +22 -0
- package/src/properties/CollectionProperty.ts +43 -0
- package/src/properties/DateTimeProperty.ts +47 -0
- package/src/properties/EnumProperty.ts +36 -0
- package/src/properties/FileProperty.ts +14 -0
- package/src/properties/HashProperty.test.ts +108 -0
- package/src/properties/HashProperty.ts +70 -0
- package/src/properties/MapProperty.ts +19 -0
- package/src/properties/NumberProperty.test.ts +38 -0
- package/src/properties/NumberProperty.ts +110 -0
- package/src/properties/ObjectProperty.ts +118 -0
- package/src/properties/Property.ts +85 -0
- package/src/properties/StringProperty.test.ts +46 -0
- package/src/properties/StringProperty.ts +121 -0
- package/src/properties/index.ts +62 -0
- package/src/properties/types/AbstractPropertyType.ts +8 -0
- package/src/properties/types/PropertyClassType.ts +11 -0
- package/src/properties/types/PropertyHTMLType.ts +23 -0
- package/src/properties/types/PropertyTypes.ts +13 -0
- package/lib/Core.js +0 -133
- package/lib/common/statuses.js +0 -19
- package/lib/components/BaseObject.js +0 -103
- package/lib/components/BaseObjectProperties.d.ts +0 -1
- package/lib/components/Entity.js +0 -71
- package/lib/components/types/Properties.d.ts +0 -3
- package/lib/components/types/Properties.js +0 -1
package/README.md
CHANGED
|
@@ -4,34 +4,82 @@ The foundation of the Quatrain framework. This package provides the base compone
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
7
|
+
- **Base Objects**: `BaseObject`, `AbstractObject`, `DataObject` for in-memory object management
|
|
8
|
+
- **Built-in Models**: `User` and `Entity` models with full property definitions
|
|
9
|
+
- **Property System**: Strongly-typed properties with built-in validation
|
|
10
|
+
- **Object URI**: A unified resource identification system that works with or without a database
|
|
11
|
+
- **Status Management**: Built-in lifecycle statuses (`created`, `pending`, `active`, `deleted`)
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
npm install @quatrain/core
|
|
17
|
+
# or
|
|
18
|
+
yarn add @quatrain/core
|
|
17
19
|
```
|
|
18
20
|
|
|
19
|
-
##
|
|
21
|
+
## Quick Start
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
### Defining a Model
|
|
22
24
|
|
|
23
25
|
```typescript
|
|
24
|
-
import { BaseObject, StringProperty } from '@quatrain/core'
|
|
26
|
+
import { BaseObject, StringProperty, NumberProperty } from '@quatrain/core'
|
|
25
27
|
|
|
26
28
|
export class Product extends BaseObject {
|
|
27
29
|
static COLLECTION = 'products'
|
|
28
30
|
static PROPS_DEFINITION = [
|
|
29
31
|
{ name: 'name', type: StringProperty.TYPE, mandatory: true },
|
|
30
32
|
{ name: 'sku', type: StringProperty.TYPE, mandatory: true },
|
|
33
|
+
{ name: 'price', type: NumberProperty.TYPE, defaultValue: 0 },
|
|
31
34
|
]
|
|
32
35
|
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Creating and Using Objects
|
|
33
39
|
|
|
40
|
+
```typescript
|
|
34
41
|
const product = await Product.factory()
|
|
35
42
|
product._.name = 'My Awesome Product'
|
|
43
|
+
product._.sku = 'PROD-001'
|
|
44
|
+
product._.price = 29.99
|
|
45
|
+
|
|
36
46
|
console.log(product.isValid()) // true
|
|
47
|
+
console.log(product.toJSON()) // { name: 'My Awesome Product', sku: 'PROD-001', price: 29.99 }
|
|
37
48
|
```
|
|
49
|
+
|
|
50
|
+
## Property Types
|
|
51
|
+
|
|
52
|
+
| Property | Description | Example |
|
|
53
|
+
| ------------------ | --------------------------- | ------------------------- |
|
|
54
|
+
| `StringProperty` | Text values | Names, descriptions, SKUs |
|
|
55
|
+
| `NumberProperty` | Numeric values | Prices, quantities, ages |
|
|
56
|
+
| `BooleanProperty` | True/false values | Flags, toggles |
|
|
57
|
+
| `DateTimeProperty` | Timestamps | Created dates, due dates |
|
|
58
|
+
| `EnumProperty` | Predefined options | Status, category |
|
|
59
|
+
| `ArrayProperty` | Lists of values | Tags, related items |
|
|
60
|
+
| `ObjectProperty` | References to other objects | Author, parent |
|
|
61
|
+
| `FileProperty` | File references | Documents, images |
|
|
62
|
+
| `HashProperty` | Encrypted values | Passwords |
|
|
63
|
+
| `MapProperty` | Key-value pairs | Metadata, settings |
|
|
64
|
+
|
|
65
|
+
## Object Lifecycle
|
|
66
|
+
|
|
67
|
+
Objects follow a standard lifecycle with built-in status management:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
created → pending → active → deleted
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Access status via `object.status` and update using `object.set('status', statuses.ACTIVE)`.
|
|
74
|
+
|
|
75
|
+
## Architecture
|
|
76
|
+
|
|
77
|
+
This package is designed to be the base layer with no external dependencies except logging. For persistence, combine with backend adapters:
|
|
78
|
+
|
|
79
|
+
- `@quatrain/backend-postgres` - PostgreSQL/Supabase
|
|
80
|
+
- `@quatrain/backend-firestore` - Firebase Firestore
|
|
81
|
+
- `@quatrain/backend-sqlite` - SQLite
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
AGPL-3.0-only
|
package/{lib → dist}/Core.d.ts
RENAMED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { User } from './components/User';
|
|
2
|
-
import { DataObjectClass } from './components/types/DataObjectClass';
|
|
3
1
|
import { AbstractLoggerAdapter, LogLevel } from '@quatrain/log';
|
|
4
2
|
export declare class Core {
|
|
5
3
|
static readonly me: string;
|
|
@@ -10,7 +8,6 @@ export declare class Core {
|
|
|
10
8
|
};
|
|
11
9
|
static readonly logLevel = LogLevel.DEBUG;
|
|
12
10
|
static readonly logger: AbstractLoggerAdapter;
|
|
13
|
-
static userClass: typeof User;
|
|
14
11
|
static addLogger(alias?: string): any;
|
|
15
12
|
static setLogLevel(level: LogLevel): void;
|
|
16
13
|
static readonly timestamp: () => string;
|
|
@@ -24,23 +21,11 @@ export declare class Core {
|
|
|
24
21
|
static getConfig(key: string): Promise<any>;
|
|
25
22
|
static addClass(name: string, obj: any): void;
|
|
26
23
|
static getClass(name: string): any;
|
|
27
|
-
/**
|
|
28
|
-
* Execute an external command in a promise
|
|
29
|
-
* @see https://stackoverflow.com/questions/46289682/how-to-wait-for-child-process-spawn-execution-with-async-await
|
|
30
|
-
* @see https://dzone.com/articles/understanding-execfile-spawn-exec-and-fork-in-node
|
|
31
|
-
* @param string command
|
|
32
|
-
* @param array args
|
|
33
|
-
* @return Promise
|
|
34
|
-
*/
|
|
35
24
|
static readonly execPromise: (command: string, args?: any[], cwd?: string) => Promise<any>;
|
|
36
25
|
static readonly getSystemCommandPath: (command: string) => Promise<string>;
|
|
37
26
|
static sleep(seconds?: number): Promise<unknown>;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* This is currently just a stub that will be implemented from config in the future
|
|
41
|
-
* @returns DataObjectClass
|
|
42
|
-
*/
|
|
43
|
-
static getDataObjectClass(): DataObjectClass<any>;
|
|
27
|
+
static get userClass(): any;
|
|
28
|
+
static set userClass(cls: any);
|
|
44
29
|
static log(...message: any): void;
|
|
45
30
|
static debug(...message: any): void;
|
|
46
31
|
static warn(...message: any): void;
|
|
@@ -48,3 +33,4 @@ export declare class Core {
|
|
|
48
33
|
static error(...message: any): void;
|
|
49
34
|
static trace(...message: any): void;
|
|
50
35
|
}
|
|
36
|
+
//# sourceMappingURL=Core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Core.d.ts","sourceRoot":"","sources":["../src/Core.ts"],"names":[],"mappings":"AAAA,OAAO,EACJ,qBAAqB,EAGrB,QAAQ,EACV,MAAM,eAAe,CAAA;AAItB,qBAAa,IAAI;IACd,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAY;IAC9B,MAAM,CAAC,QAAQ,CAAC,OAAO,MAA0B;IACjD,MAAM,CAAC,QAAQ,CAAC,aAAa,UAAS;IACtC,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAK;IAC1D,MAAM,CAAC,QAAQ,CAAC,QAAQ,kBAAiB;IACzC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAmB;IAEhE,MAAM,CAAC,SAAS,CAAC,KAAK,GAAE,MAAkB;IAQ1C,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ;IAKlC,MAAM,CAAC,QAAQ,CAAC,SAAS,eAAiC;IAE1D,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;;;;;;WAShB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;WAOjC,SAAS,CAAC,GAAG,EAAE,MAAM;IAOlC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG;IAItC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAY5B,MAAM,CAAC,QAAQ,CAAC,WAAW,YACf,MAAM,SACT,GAAG,EAAE,mBAEX,QAAQ,GAAG,CAAC,CA6Bd;IAED,MAAM,CAAC,QAAQ,CAAC,oBAAoB,YAAa,MAAM,KAAG,QAAQ,MAAM,CAAC,CACxD;IAEjB,MAAM,CAAC,KAAK,CAAC,OAAO,GAAE,MAAU;IAIhC,MAAM,KAAK,SAAS,IAIM,GAAG,CAF5B;IAED,MAAM,KAAK,SAAS,CAAC,GAAG,EAAE,GAAG,EAE5B;IAED,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,EAAE,GAAG,GAAG,IAAI;IAIjC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,EAAE,GAAG,GAAG,IAAI;IAInC,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,EAAE,GAAG,GAAG,IAAI;IAIlC,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,EAAE,GAAG,GAAG,IAAI;IAIlC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,EAAE,GAAG,GAAG,IAAI;IAInC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,EAAE,GAAG,GAAG,IAAI;CAGrC"}
|
package/dist/Core.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Core = void 0;
|
|
7
|
+
const log_1 = require("@quatrain/log");
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
const which_1 = __importDefault(require("which"));
|
|
10
|
+
class Core {
|
|
11
|
+
static me = this.name;
|
|
12
|
+
static storage = require('node-persist');
|
|
13
|
+
static storagePrefix = 'core';
|
|
14
|
+
static classRegistry = {};
|
|
15
|
+
static logLevel = log_1.LogLevel.DEBUG;
|
|
16
|
+
static logger = this.addLogger();
|
|
17
|
+
static addLogger(alias = this.name) {
|
|
18
|
+
return log_1.Log.addLogger('@' + alias, new log_1.DefaultLoggerAdapter(alias, this.logLevel), true);
|
|
19
|
+
}
|
|
20
|
+
static setLogLevel(level) {
|
|
21
|
+
this.logger.logLevel(level);
|
|
22
|
+
}
|
|
23
|
+
static timestamp = () => new Date().toISOString();
|
|
24
|
+
static definition(key) {
|
|
25
|
+
return {
|
|
26
|
+
manifest: {
|
|
27
|
+
type: String,
|
|
28
|
+
mandatory: true,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
static async addConfig(key, value) {
|
|
33
|
+
if (!this.storage.set) {
|
|
34
|
+
await this.storage.init();
|
|
35
|
+
}
|
|
36
|
+
await this.storage.set(`${this.storagePrefix}_${key}`, value);
|
|
37
|
+
}
|
|
38
|
+
static async getConfig(key) {
|
|
39
|
+
if (!this.storage.get) {
|
|
40
|
+
await this.storage.init();
|
|
41
|
+
}
|
|
42
|
+
return await this.storage.get(`${this.storagePrefix}_${key}`);
|
|
43
|
+
}
|
|
44
|
+
static addClass(name, obj) {
|
|
45
|
+
Core.classRegistry[name] = obj;
|
|
46
|
+
}
|
|
47
|
+
static getClass(name) {
|
|
48
|
+
return Core.classRegistry[name];
|
|
49
|
+
}
|
|
50
|
+
static execPromise = (command, args = [], cwd = process.cwd()) => {
|
|
51
|
+
try {
|
|
52
|
+
Core.info(`Executing command ${command} in ${cwd} with arguments:`);
|
|
53
|
+
args.forEach((arg) => console.log(`\t${arg}`));
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
const child = (0, child_process_1.spawn)(command, args, { cwd });
|
|
56
|
+
child.stdout.on('data', (data) => Core.debug(data.toString()));
|
|
57
|
+
child.stderr.on('data', (data) => Core.debug(data.toString()));
|
|
58
|
+
child.on('close', (code) => {
|
|
59
|
+
if (code !== 0) {
|
|
60
|
+
Core.error(`Command execution failed with code: ${code}`);
|
|
61
|
+
reject(new Error(`Process failed and returned code: ${code}`));
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
Core.info(`Command execution completed with code: ${code}`);
|
|
65
|
+
resolve(undefined);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
Core.error(err.message);
|
|
72
|
+
throw err;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
static getSystemCommandPath = (command) => (0, which_1.default)(command);
|
|
76
|
+
static sleep(seconds = 1) {
|
|
77
|
+
return new Promise((resolve) => setTimeout(resolve, seconds * 1000));
|
|
78
|
+
}
|
|
79
|
+
static get userClass() {
|
|
80
|
+
return this.getClass('User');
|
|
81
|
+
}
|
|
82
|
+
static set userClass(cls) {
|
|
83
|
+
this.addClass('User', cls);
|
|
84
|
+
}
|
|
85
|
+
static log(...message) {
|
|
86
|
+
return this.logger.log(message);
|
|
87
|
+
}
|
|
88
|
+
static debug(...message) {
|
|
89
|
+
return this.logger.debug(message);
|
|
90
|
+
}
|
|
91
|
+
static warn(...message) {
|
|
92
|
+
return this.logger.warn(message);
|
|
93
|
+
}
|
|
94
|
+
static info(...message) {
|
|
95
|
+
return this.logger.info(message);
|
|
96
|
+
}
|
|
97
|
+
static error(...message) {
|
|
98
|
+
return this.logger.error(message);
|
|
99
|
+
}
|
|
100
|
+
static trace(...message) {
|
|
101
|
+
return this.logger.trace(message);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.Core = Core;
|
|
105
|
+
//# sourceMappingURL=Core.js.map
|
package/dist/Core.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Core.js","sourceRoot":"","sources":["../src/Core.ts"],"names":[],"mappings":";;;;;;AAAA,uCAKsB;AACtB,iDAAqC;AACrC,kDAAyB;AAEzB,MAAa,IAAI;IACd,MAAM,CAAU,EAAE,GAAG,IAAI,CAAC,IAAI,CAAA;IAC9B,MAAM,CAAU,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IACjD,MAAM,CAAU,aAAa,GAAG,MA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AAC,GAAG,OAAY;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACnC,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,GAAG,OAAY;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACnC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,OAAY;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,OAAY;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC;;AAtIJ,oBAuIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataGenerator.d.ts","sourceRoot":"","sources":["../../src/common/DataGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAY7D,eAAO,MAAM,aAAa,6CAElB,MAAM,iBACG,GAAG,KACjB,QAAQ,GAAG,CAgEb,CAAA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.DataGenerator = void 0;
|
|
27
|
+
const htmlType = __importStar(require("../properties/types/PropertyHTMLType"));
|
|
28
|
+
const faker_1 = require("@faker-js/faker");
|
|
29
|
+
const __1 = require("..");
|
|
30
|
+
const DataGenerator = async (model, qty = 5, forcedValues = {}) => {
|
|
31
|
+
const promises = [];
|
|
32
|
+
__1.Core.info(`Starting to create ${qty} ${model.constructor.name} records`);
|
|
33
|
+
for (let i = 0; i < qty; i++) {
|
|
34
|
+
const dao = await model.dataObject.clone();
|
|
35
|
+
Object.keys(dao.properties).forEach((key) => {
|
|
36
|
+
__1.Core.debug(`Getting property for '${key}'`);
|
|
37
|
+
const property = dao.get(key);
|
|
38
|
+
if (forcedValues[key]) {
|
|
39
|
+
property.set(forcedValues[key]);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
switch (property.constructor.name) {
|
|
43
|
+
case 'StringProperty':
|
|
44
|
+
switch (property.htmlType) {
|
|
45
|
+
case htmlType.GIVEN_NAME:
|
|
46
|
+
property.set(faker_1.faker.name.firstName());
|
|
47
|
+
break;
|
|
48
|
+
case htmlType.FAMILY_NAME:
|
|
49
|
+
property.set(faker_1.faker.name.lastName());
|
|
50
|
+
break;
|
|
51
|
+
case htmlType.EMAIL:
|
|
52
|
+
property.set(faker_1.faker.helpers.unique(faker_1.faker.internet.email));
|
|
53
|
+
break;
|
|
54
|
+
case htmlType.ORG:
|
|
55
|
+
property.set(faker_1.faker.company.name());
|
|
56
|
+
break;
|
|
57
|
+
default:
|
|
58
|
+
property.set(faker_1.faker.word.noun());
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
case 'EnumProperty':
|
|
63
|
+
property.set(faker_1.faker.helpers.arrayElement(property.values));
|
|
64
|
+
break;
|
|
65
|
+
case 'HashProperty':
|
|
66
|
+
property.set(faker_1.faker.random.alphaNumeric(16));
|
|
67
|
+
break;
|
|
68
|
+
case 'DateTimeProperty':
|
|
69
|
+
switch (property.htmlType) {
|
|
70
|
+
case htmlType.BIRTHDAY:
|
|
71
|
+
property.set(faker_1.faker.date.birthdate());
|
|
72
|
+
break;
|
|
73
|
+
default:
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
promises.push(dao);
|
|
82
|
+
}
|
|
83
|
+
return promises;
|
|
84
|
+
};
|
|
85
|
+
exports.DataGenerator = DataGenerator;
|
|
86
|
+
//# sourceMappingURL=DataGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataGenerator.js","sourceRoot":"","sources":["../../src/common/DataGenerator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+EAAgE;AAChE,2CAAuC;AACvC,0BAAyB;AASlB,MAAM,aAAa,GAAG,KAAK,EAC/B,KAAQ,EACR,MAAc,CAAC,EACf,eAAoB,EAAE,EACT,EAAE;IACf,MAAM,QAAQ,GAAQ,EAAE,CAAA;IACxB,QAAI,CAAC,IAAI,CAAC,sBAAsB,GAAG,IAAI,KAAK,CAAC,WAAW,CAAC,IAAI,UAAU,CAAC,CAAA;IACxE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QA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AER,KAAK,cAAc;oBAChB,QAAQ,CAAC,GAAG,CAAC,aAAK,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;oBACzD,MAAK;gBAER,KAAK,cAAc;oBAChB,QAAQ,CAAC,GAAG,CAAC,aAAK,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAA;oBAC3C,MAAK;gBAER,KAAK,kBAAkB;oBACpB,QAAQ,QAAQ,CAAC,QAAQ,EAAE,CAAC;wBACzB,KAAK,QAAQ,CAAC,QAAQ;4BACnB,QAAQ,CAAC,GAAG,CAAC,aAAK,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;4BACpC,MAAK;wBACR;4BAEG,MAAK;oBACX,CAAC;oBACD,MAAK;gBAER;oBACG,MAAK;YACX,CAAC;QACJ,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACrB,CAAC;IAED,OAAO,QAAQ,CAAA;AAClB,CAAC,CAAA;AApEY,QAAA,aAAa,iBAoEzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourcesErrors.d.ts","sourceRoot":"","sources":["../../src/common/ResourcesErrors.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;gBACzB,OAAO,EAAE,MAAM;CAK7B;AAED,qBAAa,eAAgB,SAAQ,aAAa;CAAG;AAErD,qBAAa,iBAAkB,SAAQ,aAAa;CAAG;AAEvD,qBAAa,cAAe,SAAQ,aAAa;CAAG;AAEpD,qBAAa,aAAc,SAAQ,aAAa;CAAG;AAEnD,qBAAa,SAAU,SAAQ,aAAa;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourcesErrors.js","sourceRoot":"","sources":["../../src/common/ResourcesErrors.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAc,SAAQ,KAAK;IACrC,YAAY,OAAe;QACxB,KAAK,CAAC,OAAO,CAAC,CAAA;QAEd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;IACpC,CAAC;CACH;AAND,sCAMC;AAED,MAAa,eAAgB,SAAQ,aAAa;CAAG;AAArD,0CAAqD;AAErD,MAAa,iBAAkB,SAAQ,aAAa;CAAG;AAAvD,8CAAuD;AAEvD,MAAa,cAAe,SAAQ,aAAa;CAAG;AAApD,wCAAoD;AAEpD,MAAa,aAAc,SAAQ,aAAa;CAAG;AAAnD,sCAAmD;AAEnD,MAAa,SAAU,SAAQ,aAAa;CAAG;AAA/C,8BAA+C"}
|
|
@@ -7,6 +7,7 @@ export declare const DISABLED = "disabled";
|
|
|
7
7
|
export declare const DONE = "done";
|
|
8
8
|
export declare const DOWNLOADING = "downloading";
|
|
9
9
|
export declare const DOWNLOADED = "downloaded";
|
|
10
|
+
export declare const DOWNLOAD_KO = "download_ko";
|
|
10
11
|
export declare const ERROR = "error";
|
|
11
12
|
export declare const KO = "ko";
|
|
12
13
|
export declare const PENDING = "pending";
|
|
@@ -14,3 +15,7 @@ export declare const PREPARING = "preparing";
|
|
|
14
15
|
export declare const PROCESSING = "processing";
|
|
15
16
|
export declare const QUEUED = "queued";
|
|
16
17
|
export declare const UNKNOWN = "unknown";
|
|
18
|
+
export declare const UPLOADING = "uploading";
|
|
19
|
+
export declare const UPLOADED = "uploaded";
|
|
20
|
+
export declare const UPLOAD_KO = "upload_ko";
|
|
21
|
+
//# sourceMappingURL=statuses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statuses.d.ts","sourceRoot":"","sources":["../../src/common/statuses.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,WAAW,CAAA;AAC9B,eAAO,MAAM,SAAS,cAAc,CAAA;AACpC,eAAO,MAAM,OAAO,YAAY,CAAA;AAChC,eAAO,MAAM,SAAS,cAAc,CAAA;AACpC,eAAO,MAAM,OAAO,YAAY,CAAA;AAChC,eAAO,MAAM,QAAQ,aAAa,CAAA;AAClC,eAAO,MAAM,IAAI,SAAS,CAAA;AAC1B,eAAO,MAAM,WAAW,gBAAgB,CAAA;AACxC,eAAO,MAAM,UAAU,eAAe,CAAA;AACtC,eAAO,MAAM,WAAW,gBAAgB,CAAA;AACxC,eAAO,MAAM,KAAK,UAAU,CAAA;AAC5B,eAAO,MAAM,EAAE,OAAO,CAAA;AACtB,eAAO,MAAM,OAAO,YAAY,CAAA;AAChC,eAAO,MAAM,SAAS,cAAc,CAAA;AACpC,eAAO,MAAM,UAAU,eAAe,CAAA;AACtC,eAAO,MAAM,MAAM,WAAW,CAAA;AAC9B,eAAO,MAAM,OAAO,YAAY,CAAA;AAChC,eAAO,MAAM,SAAS,cAAc,CAAA;AACpC,eAAO,MAAM,QAAQ,aAAa,CAAA;AAClC,eAAO,MAAM,SAAS,cAAc,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UPLOAD_KO = exports.UPLOADED = exports.UPLOADING = exports.UNKNOWN = exports.QUEUED = exports.PROCESSING = exports.PREPARING = exports.PENDING = exports.KO = exports.ERROR = exports.DOWNLOAD_KO = exports.DOWNLOADED = exports.DOWNLOADING = exports.DONE = exports.DISABLED = exports.DELETED = exports.DELETABLE = exports.CREATED = exports.COMPLETED = exports.ACTIVE = void 0;
|
|
4
|
+
exports.ACTIVE = 'active';
|
|
5
|
+
exports.COMPLETED = 'completed';
|
|
6
|
+
exports.CREATED = 'created';
|
|
7
|
+
exports.DELETABLE = 'deletable';
|
|
8
|
+
exports.DELETED = 'deleted';
|
|
9
|
+
exports.DISABLED = 'disabled';
|
|
10
|
+
exports.DONE = 'done';
|
|
11
|
+
exports.DOWNLOADING = 'downloading';
|
|
12
|
+
exports.DOWNLOADED = 'downloaded';
|
|
13
|
+
exports.DOWNLOAD_KO = 'download_ko';
|
|
14
|
+
exports.ERROR = 'error';
|
|
15
|
+
exports.KO = 'ko';
|
|
16
|
+
exports.PENDING = 'pending';
|
|
17
|
+
exports.PREPARING = 'preparing';
|
|
18
|
+
exports.PROCESSING = 'processing';
|
|
19
|
+
exports.QUEUED = 'queued';
|
|
20
|
+
exports.UNKNOWN = 'unknown';
|
|
21
|
+
exports.UPLOADING = 'uploading';
|
|
22
|
+
exports.UPLOADED = 'uploaded';
|
|
23
|
+
exports.UPLOAD_KO = 'upload_ko';
|
|
24
|
+
//# sourceMappingURL=statuses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statuses.js","sourceRoot":"","sources":["../../src/common/statuses.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG,QAAQ,CAAA;AACjB,QAAA,SAAS,GAAG,WAAW,CAAA;AACvB,QAAA,OAAO,GAAG,SAAS,CAAA;AACnB,QAAA,SAAS,GAAG,WAAW,CAAA;AACvB,QAAA,OAAO,GAAG,SAAS,CAAA;AACnB,QAAA,QAAQ,GAAG,UAAU,CAAA;AACrB,QAAA,IAAI,GAAG,MAAM,CAAA;AACb,QAAA,WAAW,GAAG,aAAa,CAAA;AAC3B,QAAA,UAAU,GAAG,YAAY,CAAA;AACzB,QAAA,WAAW,GAAG,aAAa,CAAA;AAC3B,QAAA,KAAK,GAAG,OAAO,CAAA;AACf,QAAA,EAAE,GAAG,IAAI,CAAA;AACT,QAAA,OAAO,GAAG,SAAS,CAAA;AACnB,QAAA,SAAS,GAAG,WAAW,CAAA;AACvB,QAAA,UAAU,GAAG,YAAY,CAAA;AACzB,QAAA,MAAM,GAAG,QAAQ,CAAA;AACjB,QAAA,OAAO,GAAG,SAAS,CAAA;AACnB,QAAA,SAAS,GAAG,WAAW,CAAA;AACvB,QAAA,QAAQ,GAAG,UAAU,CAAA;AACrB,QAAA,SAAS,GAAG,WAAW,CAAA"}
|
|
@@ -7,11 +7,6 @@ export declare abstract class AbstractObject {
|
|
|
7
7
|
static LABEL_KEY: string;
|
|
8
8
|
protected _dataObject: DataObjectClass<any>;
|
|
9
9
|
constructor(dao: DataObjectClass<any>);
|
|
10
|
-
/**
|
|
11
|
-
* Return property object matching key
|
|
12
|
-
* @param key string
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
10
|
get(key: string): any;
|
|
16
11
|
set(key: string, val: any): any;
|
|
17
12
|
val(key: string): any;
|
|
@@ -27,3 +22,4 @@ export declare abstract class AbstractObject {
|
|
|
27
22
|
label: string;
|
|
28
23
|
};
|
|
29
24
|
}
|
|
25
|
+
//# sourceMappingURL=AbstractObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractObject.d.ts","sourceRoot":"","sources":["../../src/components/AbstractObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAEpD,8BAAsB,cAAc;IACjC,MAAM,CAAC,gBAAgB,EAAE,oBAAoB,CAAK;IAGlD,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAGrC,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAGtC,MAAM,CAAC,SAAS,SAAS;IAEzB,SAAS,CAAC,WAAW,EAAE,eAAe,CAAC,GAAG,CAAC,CAAA;gBAE/B,GAAG,EAAE,eAAe,CAAC,GAAG,CAAC;IASrC,GAAG,CAAC,GAAG,EAAE,MAAM;IAIf,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG;IAIzB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG;IASrB,GAAG,CAAC,GAAG,EAAE,MAAM;IAIf,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,GAAG,QAEN;IAED,IAAI,UAAU,yBAEb;IAED,IAAI,CAAC,QAEJ;IAED,IAAI,GAAG,oCAEN;IAED,MAAM;;;;;CAGR"}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AbstractObject = void 0;
|
|
4
4
|
class AbstractObject {
|
|
5
|
+
static PROPS_DEFINITION = [];
|
|
6
|
+
static COLLECTION;
|
|
7
|
+
static PARENT_PROP;
|
|
8
|
+
static LABEL_KEY = 'name';
|
|
9
|
+
_dataObject;
|
|
5
10
|
constructor(dao) {
|
|
6
11
|
this._dataObject = dao;
|
|
7
12
|
}
|
|
8
|
-
/**
|
|
9
|
-
* Return property object matching key
|
|
10
|
-
* @param key string
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
13
|
get(key) {
|
|
14
14
|
return this._dataObject.get(key);
|
|
15
15
|
}
|
|
@@ -44,11 +44,8 @@ class AbstractObject {
|
|
|
44
44
|
return this._dataObject.uri;
|
|
45
45
|
}
|
|
46
46
|
toJSON() {
|
|
47
|
-
|
|
48
|
-
return typeof this.uri === 'string' ? this.uri : (_a = this.uri) === null || _a === void 0 ? void 0 : _a.toJSON();
|
|
47
|
+
return typeof this.uri === 'string' ? this.uri : this.uri?.toJSON();
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
exports.AbstractObject = AbstractObject;
|
|
52
|
-
AbstractObject.
|
|
53
|
-
// Which property's value to use in backend as label for object reference
|
|
54
|
-
AbstractObject.LABEL_KEY = 'name';
|
|
51
|
+
//# sourceMappingURL=AbstractObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractObject.js","sourceRoot":"","sources":["../../src/components/AbstractObject.ts"],"names":[],"mappings":";;;AAGA,MAAsB,cAAc;IACjC,MAAM,CAAC,gBAAgB,GAAyB,EAAE,CAAA;IAGlD,MAAM,CAAC,UAAU,CAAoB;IAGrC,MAAM,CAAC,WAAW,CAAoB;IAGtC,MAAM,CAAC,SAAS,GAAG,MAAM,CAAA;IAEf,WAAW,CAAsB;IAE3C,YAAY,GAA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@
|
|
|
1
|
-
import { ObjectUri
|
|
1
|
+
import { ObjectUri } from './ObjectUri';
|
|
2
|
+
import { DataObjectClass } from './types/DataObjectClass';
|
|
3
|
+
import { DataObject } from './DataObject';
|
|
2
4
|
import { BaseObjectType } from './types/BaseObjectType';
|
|
3
5
|
import { AbstractObject } from './AbstractObject';
|
|
4
6
|
import { DataObjectType } from './types/DataObjectType';
|
|
@@ -7,25 +9,10 @@ export declare class BaseObject extends AbstractObject {
|
|
|
7
9
|
static getProperty(key: string): any;
|
|
8
10
|
static fillProperties(child?: any): DataObject;
|
|
9
11
|
static daoFactory(src?: string | ObjectUri | DataObjectType | undefined, child?: any): Promise<DataObjectType>;
|
|
10
|
-
/**
|
|
11
|
-
* Instantiates from an object
|
|
12
|
-
* @param src
|
|
13
|
-
* @param child
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
12
|
static fromObject<T extends BaseObjectType>(src: T, child?: any): any;
|
|
17
13
|
static factory(src?: string | ObjectUri | BaseObjectType | undefined, child?: any): Promise<any>;
|
|
18
|
-
/**
|
|
19
|
-
* Fetches an object from its backend path
|
|
20
|
-
* @param path
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
23
14
|
static fromBackend<T>(path: string): Promise<T>;
|
|
24
|
-
/**
|
|
25
|
-
* Instantiates from a DataObject
|
|
26
|
-
* @param dao
|
|
27
|
-
* @returns
|
|
28
|
-
*/
|
|
29
15
|
static fromDataObject<T extends BaseObjectType>(dao: DataObjectClass<any>): any;
|
|
30
16
|
asReference(): any;
|
|
31
17
|
}
|
|
18
|
+
//# sourceMappingURL=BaseObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseObject.d.ts","sourceRoot":"","sources":["../../src/components/BaseObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEvD,qBAAa,UAAW,SAAQ,cAAc;IAE3C,MAAM,CAAC,gBAAgB,EAAE,GAAG,CAAgD;IAE5E,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM;IAI9B,MAAM,CAAC,cAAc,CAAC,KAAK,GAAE,GAAU;WAuB1B,UAAU,CACpB,GAAG,GAAE,MAAM,GAAG,SAAS,GAAG,cAAc,GAAG,SAAqB,EAChE,KAAK,GAAE,GAAU,GACjB,OAAO,CAAC,cAAc,CAAC;IAY1B,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,cAAc,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,GAAE,GAAU,GAAG,GAAG;WAiB9D,OAAO,CACjB,GAAG,GAAE,MAAM,GAAG,SAAS,GAAG,cAAc,GAAG,SAAqB,EAChE,KAAK,GAAE,GAAU,GACjB,OAAO,CAAC,GAAG,CAAC;WAyBF,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAYrD,MAAM,CAAC,cAAc,CAAC,CAAC,SAAS,cAAc,EAC3C,GAAG,EAAE,eAAe,CAAC,GAAG,CAAC,GACzB,GAAG;IAMN,WAAW;CAGb"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseObject = void 0;
|
|
4
|
+
const ObjectUri_1 = require("./ObjectUri");
|
|
5
|
+
const DataObject_1 = require("./DataObject");
|
|
6
|
+
const BaseObjectProperties_1 = require("./BaseObjectProperties");
|
|
7
|
+
const AbstractObject_1 = require("./AbstractObject");
|
|
8
|
+
class BaseObject extends AbstractObject_1.AbstractObject {
|
|
9
|
+
static PROPS_DEFINITION = BaseObjectProperties_1.BaseObjectProperties;
|
|
10
|
+
static getProperty(key) {
|
|
11
|
+
return BaseObject.PROPS_DEFINITION.find((prop) => prop.name === key);
|
|
12
|
+
}
|
|
13
|
+
static fillProperties(child = this) {
|
|
14
|
+
const base = [...BaseObject.PROPS_DEFINITION];
|
|
15
|
+
child.PROPS_DEFINITION.forEach((property) => {
|
|
16
|
+
const found = base.findIndex((el) => el.name === property.name);
|
|
17
|
+
if (found !== -1) {
|
|
18
|
+
base[found] = property;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
base.push(property);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const dao = DataObject_1.DataObject.factory({
|
|
25
|
+
properties: base,
|
|
26
|
+
parentProp: this.PARENT_PROP,
|
|
27
|
+
});
|
|
28
|
+
dao.uri.class = child;
|
|
29
|
+
return dao;
|
|
30
|
+
}
|
|
31
|
+
static async daoFactory(src = undefined, child = this) {
|
|
32
|
+
const dao = this.fillProperties(child);
|
|
33
|
+
return dao;
|
|
34
|
+
}
|
|
35
|
+
static fromObject(src, child = this) {
|
|
36
|
+
const dao = this.fillProperties(child);
|
|
37
|
+
dao.uri = new ObjectUri_1.ObjectUri(`${this.COLLECTION}${ObjectUri_1.ObjectUri.DEFAULT}`, Reflect.get(src, 'name'));
|
|
38
|
+
dao.uri.class = child;
|
|
39
|
+
dao.populateFromData(src);
|
|
40
|
+
const obj = new this(dao);
|
|
41
|
+
return obj;
|
|
42
|
+
}
|
|
43
|
+
static async factory(src = undefined, child = this) {
|
|
44
|
+
try {
|
|
45
|
+
if (typeof src == 'object' && !(src instanceof ObjectUri_1.ObjectUri)) {
|
|
46
|
+
return this.fromObject(src);
|
|
47
|
+
}
|
|
48
|
+
const dao = await this.daoFactory(src, child);
|
|
49
|
+
const constructedObject = Reflect.construct(this, [dao]);
|
|
50
|
+
return constructedObject;
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
throw new Error(`Unable to build instance for '${this.name}': ${err.message}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
static async fromBackend(path) {
|
|
57
|
+
if (!path.includes('/')) {
|
|
58
|
+
return this.factory(`${this.COLLECTION}/${path}`);
|
|
59
|
+
}
|
|
60
|
+
return this.factory(path);
|
|
61
|
+
}
|
|
62
|
+
static fromDataObject(dao) {
|
|
63
|
+
const obj = new this(dao);
|
|
64
|
+
return obj;
|
|
65
|
+
}
|
|
66
|
+
asReference() {
|
|
67
|
+
return this._dataObject.toReference();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.BaseObject = BaseObject;
|
|
71
|
+
//# sourceMappingURL=BaseObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseObject.js","sourceRoot":"","sources":["../../src/components/BaseObject.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AAEvC,6CAAyC;AAEzC,iEAA6D;AAC7D,qDAAiD;AAGjD,MAAa,UAAW,SAAQ,+BAAc;IAE3C,MAAM,CAAC,gBAAgB,GAAiC,2CAAoB,CAAA;IAE5E,MAAM,CAAC,WAAW,CAAC,GAAW;QAC3B,OAAO,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC,CAAA;IAC5E,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,QAAa,IAAI;QAEpC,MAAM,IAAI,GAAG,CAAC,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAA;QAE7C,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,QAAa,EAAE,EAAE;YAE9C,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAO,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAA;YACpE,IAAI,KAAK,KAAK,C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BAAS,CAAC,EAAE,CAAC;gBACzD,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;YAC9B,CAAC;YAED,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;YAE7C,MAAM,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;YAExD,OAAO,iBAAiB,CAAA;QAC3B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACZ,iCAAiC,IAAI,CAAC,IAAI,MACtC,GAAa,CAAC,OAClB,EAAE,CACJ,CAAA;QACJ,CAAC;IACJ,CAAC;IAOD,MAAM,CAAC,KAAK,CAAC,WAAW,CAAI,IAAY;QACrC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC,CAAA;QACpD,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC;IAOD,MAAM,CAAC,cAAc,CAClB,GAAyB;QAEzB,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAA;QAEzB,OAAO,GAAG,CAAA;IACb,CAAC;IAED,WAAW;QACR,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAA;IACxC,CAAC;;AAjHJ,gCAkHC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseObjectProperties.d.ts","sourceRoot":"","sources":["../../src/components/BaseObjectProperties.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,oBAAoB,EAAE,GAyDlC,CAAA"}
|
|
@@ -52,8 +52,6 @@ exports.BaseObjectProperties = [
|
|
|
52
52
|
],
|
|
53
53
|
defaultValue: statuses.CREATED,
|
|
54
54
|
},
|
|
55
|
-
// the following properties may be optionally
|
|
56
|
-
// populated with a backend middleware
|
|
57
55
|
{
|
|
58
56
|
name: 'createdBy',
|
|
59
57
|
type: ObjectProperty_1.ObjectProperty.TYPE,
|
|
@@ -88,3 +86,4 @@ exports.BaseObjectProperties = [
|
|
|
88
86
|
protected: true,
|
|
89
87
|
},
|
|
90
88
|
];
|
|
89
|
+
//# sourceMappingURL=BaseObjectProperties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseObjectProperties.js","sourceRoot":"","sources":["../../src/components/BaseObjectProperties.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA8C;AAC9C,iEAA6D;AAC7D,iEAA6D;AAC7D,6DAAyD;AACzD,qEAAiE;AACjE,+EAAgE;AAEnD,QAAA,oBAAoB,GAAQ;IACtC;QACG,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,IAAI;QACf,IAAI,EAAE,+BAAc,CAAC,IAAI;QACzB,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,GAAG;QACd,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,QAAQ,CAAC,IAAI;KACzB;IACD;QACG,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,IAAI;QACf,IAAI,EAAE,2BAAY,CAAC,IAAI;QACvB,MAAM,EAAE;YACL,QAAQ,CAAC,OAAO;YAChB,QAAQ,CAAC,OAAO;YAChB,QAAQ,CAAC,MAAM;YACf,QAAQ,CAAC,OAAO;SAClB;QACD,YAAY,EAAE,QAAQ,CAAC,OAAO;KAChC;IAGD;QACG,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,+BAAc,CAAC,IAAI;QACzB,UAAU,EAAE,MAAM;QAClB,SAAS,EAAE,IAAI;QACf,SAAS,EAAE,IAAI;KACjB;IACD;QACG,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,mCAAgB,CAAC,IAAI;QAC3B,SAAS,EA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