@quatrain/core 1.0.0-beta2 → 1.0.0-beta21
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/lib/Auth.d.ts +25 -0
- package/lib/Auth.js +9 -0
- package/lib/Backend.d.ts +7 -2
- package/lib/Backend.js +1 -0
- package/lib/Core.d.ts +14 -2
- package/lib/Core.js +40 -1
- package/lib/authentication/AbstractAuthAdapter.d.ts +18 -0
- package/lib/authentication/AbstractAuthAdapter.js +23 -0
- package/lib/authentication/AuthenticationError.d.ts +2 -0
- package/lib/authentication/AuthenticationError.js +6 -0
- package/lib/authentication/index.d.ts +4 -0
- package/lib/authentication/index.js +7 -0
- package/lib/authentication/middlewares/AbstractAuthMiddleware.d.ts +0 -0
- package/lib/authentication/middlewares/AbstractAuthMiddleware.js +1 -0
- package/lib/authentication/middlewares/AuthMiddleware.d.ts +5 -0
- package/lib/authentication/types/AuthInterface.d.ts +9 -0
- package/lib/backends/AbstractAdapter.d.ts +16 -5
- package/lib/backends/AbstractAdapter.js +27 -4
- package/lib/backends/Filters.d.ts +2 -1
- package/lib/backends/Query.d.ts +9 -5
- package/lib/backends/Query.js +13 -4
- package/lib/backends/index.d.ts +2 -1
- package/lib/backends/index.js +26 -1
- package/lib/backends/middlewares/InjectKeywordsMiddleware.d.ts +2 -2
- package/lib/backends/middlewares/InjectMetaMiddleware.d.ts +7 -6
- package/lib/backends/middlewares/InjectMetaMiddleware.js +7 -4
- package/lib/backends/middlewares/Middleware.d.ts +2 -2
- package/lib/backends/middlewares/types/MiddlewareParams.d.ts +3 -0
- package/lib/backends/middlewares/types/MiddlewareParams.js +2 -0
- package/lib/backends/types/BackendInterface.d.ts +1 -1
- package/lib/backends/types/CollectionHierarchy.d.ts +3 -0
- package/lib/backends/types/CollectionHierarchy.js +6 -0
- package/lib/components/AbstractObject.d.ts +3 -1
- package/lib/components/AbstractObject.js +1 -0
- package/lib/components/BaseObject.js +1 -0
- package/lib/components/BaseObjectCore.d.ts +10 -1
- package/lib/components/BaseObjectCore.js +15 -3
- package/lib/components/BaseRepository.d.ts +1 -0
- package/lib/components/BaseRepository.js +21 -3
- package/lib/components/DataObject.d.ts +12 -2
- package/lib/components/DataObject.js +44 -7
- package/lib/components/Entity.d.ts +3 -6
- package/lib/components/Entity.js +31 -31
- package/lib/components/EntityRepository.d.ts +2 -2
- package/lib/components/EntityRepository.js +1 -1
- package/lib/components/ObjectUri.d.ts +20 -1
- package/lib/components/ObjectUri.js +44 -14
- package/lib/components/User.d.ts +3 -3
- package/lib/components/User.js +16 -9
- package/lib/components/UserRepository.d.ts +3 -3
- package/lib/components/UserRepository.js +2 -2
- package/lib/components/index.d.ts +2 -2
- package/lib/components/index.js +4 -2
- package/lib/components/types/DataObjectClass.d.ts +4 -1
- package/lib/components/types/toJSONParams.d.ts +8 -0
- package/lib/components/types/toJSONParams.js +2 -0
- package/lib/index.d.ts +14 -3
- package/lib/index.js +14 -1
- package/lib/properties/ArrayProperty.d.ts +1 -1
- package/lib/properties/ArrayProperty.js +2 -2
- package/lib/properties/BaseProperty.d.ts +4 -1
- package/lib/properties/BaseProperty.js +15 -3
- package/lib/properties/BooleanProperty.d.ts +1 -1
- package/lib/properties/BooleanProperty.js +2 -2
- package/lib/properties/CollectionProperty.d.ts +1 -1
- package/lib/properties/CollectionProperty.js +4 -3
- package/lib/properties/DateTimeProperty.d.ts +1 -1
- package/lib/properties/DateTimeProperty.js +2 -2
- package/lib/properties/EnumProperty.d.ts +1 -1
- package/lib/properties/EnumProperty.js +2 -2
- package/lib/properties/HashProperty.d.ts +1 -1
- package/lib/properties/HashProperty.js +2 -2
- package/lib/properties/MapProperty.d.ts +1 -1
- package/lib/properties/MapProperty.js +2 -2
- package/lib/properties/NumberProperty.d.ts +1 -1
- package/lib/properties/NumberProperty.js +2 -2
- package/lib/properties/ObjectProperty.d.ts +1 -1
- package/lib/properties/ObjectProperty.js +5 -6
- package/lib/properties/StringProperty.d.ts +1 -1
- package/lib/properties/StringProperty.js +2 -2
- package/lib/properties/types/AbstractPropertyType.d.ts +1 -0
- package/lib/properties/types/PropertyClassType.d.ts +3 -1
- package/lib/storages/AbstractStorageAdapter.d.ts +17 -0
- package/lib/storages/AbstractStorageAdapter.js +7 -0
- package/lib/storages/StorageAdapterInterface.d.ts +19 -0
- package/lib/storages/StorageAdapterInterface.js +2 -0
- package/lib/storages/index.d.ts +8 -0
- package/lib/storages/index.js +5 -0
- package/lib/storages/types/BlobMediaType.d.ts +8 -0
- package/lib/storages/types/BlobMediaType.js +2 -0
- package/lib/storages/types/BlobType.d.ts +6 -0
- package/lib/storages/types/BlobType.js +2 -0
- package/lib/storages/types/FileResponseLink.d.ts +7 -0
- package/lib/storages/types/FileResponseLink.js +2 -0
- package/lib/storages/types/FileResponseUrl.d.ts +4 -0
- package/lib/storages/types/FileResponseUrl.js +2 -0
- package/lib/storages/types/FileType.d.ts +15 -0
- package/lib/storages/types/FileType.js +2 -0
- package/lib/storages/types.d.ts +5 -0
- package/lib/storages/types.js +2 -0
- package/lib/utils/DataGenerator.d.ts +2 -3
- package/lib/utils/DataGenerator.js +2 -1
- package/lib/wrappers/cloud/AbstractCloudWrapper.d.ts +4 -0
- package/lib/wrappers/cloud/AbstractCloudWrapper.js +9 -0
- package/lib/wrappers/cloud/types/DatabaseTriggerType.d.ts +8 -0
- package/lib/wrappers/cloud/types/DatabaseTriggerType.js +2 -0
- package/package.json +5 -3
- package/README.md +0 -124
- package/lib/backends/BackendInterface.d.ts +0 -13
- package/lib/backends/middlewares/InjectMetaMiddleware copy.d.ts +0 -12
- package/lib/backends/middlewares/InjectMetaMiddleware copy.js +0 -30
- package/lib/components/BaseObjectProperties.d.ts +0 -13
- package/lib/components/BaseObjectProperties.js +0 -87
- package/lib/components/EntityProperties.d.ts +0 -1
- package/lib/components/EntityProperties.js +0 -54
- package/lib/components/UserProperties.d.ts +0 -1
- package/lib/components/UserProperties.js +0 -103
- package/lib/components/types/UserClass.d.ts +0 -3
- /package/lib/{backends/BackendInterface.js → authentication/middlewares/AuthMiddleware.js} +0 -0
- /package/lib/{components/types/UserClass.js → authentication/types/AuthInterface.js} +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface FileType {
|
|
2
|
+
bucket: string;
|
|
3
|
+
ref: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
contentType?: string;
|
|
6
|
+
size?: number;
|
|
7
|
+
framerate?: number;
|
|
8
|
+
duration?: number;
|
|
9
|
+
bitrate?: number;
|
|
10
|
+
width?: number;
|
|
11
|
+
height?: number;
|
|
12
|
+
thumb128?: string;
|
|
13
|
+
thumb256?: string;
|
|
14
|
+
[x: string]: any;
|
|
15
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Proxy } from '../components/types/ProxyConstructor';
|
|
1
|
+
import { AbstractObject } from '../components';
|
|
3
2
|
/**
|
|
4
3
|
* Generate data from model of object and save it in default backend
|
|
5
4
|
* @param model
|
|
@@ -7,4 +6,4 @@ import { Proxy } from '../components/types/ProxyConstructor';
|
|
|
7
6
|
* @param forcedValues
|
|
8
7
|
* @returns
|
|
9
8
|
*/
|
|
10
|
-
export declare const DataGenerator: <T extends
|
|
9
|
+
export declare const DataGenerator: <T extends AbstractObject>(model: T, qty?: number, forcedValues?: any) => Promise<any>;
|
|
@@ -47,8 +47,9 @@ const DataGenerator = (model, qty = 5, forcedValues = {}) => __awaiter(void 0, v
|
|
|
47
47
|
const promises = [];
|
|
48
48
|
Core_1.Core.log(`Starting to create ${qty} ${model.constructor.name} records`);
|
|
49
49
|
for (let i = 0; i < qty; i++) {
|
|
50
|
-
const dao = yield model.
|
|
50
|
+
const dao = yield model.dataObject.clone();
|
|
51
51
|
Object.keys(dao.properties).forEach((key) => {
|
|
52
|
+
console.log(`Getting property for '${key}'`);
|
|
52
53
|
const property = dao.get(key);
|
|
53
54
|
if (forcedValues[key]) {
|
|
54
55
|
property.set(forcedValues[key]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quatrain/core",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-beta21",
|
|
4
4
|
"description": "Core objects for business apps",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@tsconfig/recommended": "^1.0.1",
|
|
15
15
|
"@types/jest": "^27.0.3",
|
|
16
|
+
"@types/node-persist": "^3.1.8",
|
|
16
17
|
"jest": "^27.4.7",
|
|
17
18
|
"jest-node-exports-resolver": "^1.1.6",
|
|
18
19
|
"trace-unhandled": "^2.0.1",
|
|
@@ -21,7 +22,8 @@
|
|
|
21
22
|
"typescript": "^5.1.5"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
|
-
"@faker-js/faker": "^7.6.0"
|
|
25
|
+
"@faker-js/faker": "^7.6.0",
|
|
26
|
+
"node-persist": "^4.0.3"
|
|
25
27
|
},
|
|
26
28
|
"scripts": {
|
|
27
29
|
"test": "tsc && jest --verbose",
|
|
@@ -30,4 +32,4 @@
|
|
|
30
32
|
"push": "yarn publish --access public",
|
|
31
33
|
"prepublish": "tsc"
|
|
32
34
|
}
|
|
33
|
-
}
|
|
35
|
+
}
|
package/README.md
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
# Quatrain Core
|
|
2
|
-
|
|
3
|
-
## Why
|
|
4
|
-
|
|
5
|
-
Quatrain Core is an abstraction layer designed to accelerate and simplify the development
|
|
6
|
-
of applications using many models and various data stores, being database or APIs.
|
|
7
|
-
|
|
8
|
-
With Quatrain Core and peer packages, one may develop robust applications based on
|
|
9
|
-
Oriented Object Programming with a clear separation of concerns between logic, data
|
|
10
|
-
and storage.
|
|
11
|
-
|
|
12
|
-
## How to install
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
yarn install @quatrain/core
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Quatrain Core comes with a built-in Mock backend adapter. Other adapters are available in
|
|
19
|
-
different packages. For example, a Google Firestore adapter is available:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
yarn install @quatrain/backend-firestore
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## How to use
|
|
26
|
-
|
|
27
|
-
### Setup
|
|
28
|
-
|
|
29
|
-
```ts
|
|
30
|
-
import { Core } from '@quatrain/core'
|
|
31
|
-
|
|
32
|
-
Core.addBackend(myAdapter, 'myDB', true)
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Create a model
|
|
36
|
-
|
|
37
|
-
```ts
|
|
38
|
-
import { BaseObjectCore } from '@quatrain/core'
|
|
39
|
-
|
|
40
|
-
export type Cat = {
|
|
41
|
-
name: string
|
|
42
|
-
color: `#${string}`
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export class CatCore extends BaseObjectCore {
|
|
46
|
-
static COLLECTION = 'cats'
|
|
47
|
-
|
|
48
|
-
static PROPERTIES = [
|
|
49
|
-
{
|
|
50
|
-
name: 'name',
|
|
51
|
-
type: Property.STRING,
|
|
52
|
-
minLength: 1,
|
|
53
|
-
maxLength: 32,
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
name: 'color',
|
|
57
|
-
type: Property.STRING,
|
|
58
|
-
minLength: 4,
|
|
59
|
-
maxLength: 7,
|
|
60
|
-
},
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Instantiate a model
|
|
66
|
-
|
|
67
|
-
```ts
|
|
68
|
-
const catData: Cat = {
|
|
69
|
-
name: 'Garfield',
|
|
70
|
-
color: '#ffa502',
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const garfield = CatCore.fromObject(catData)
|
|
74
|
-
|
|
75
|
-
console.log(garfield.name)
|
|
76
|
-
// > "Garfield"
|
|
77
|
-
console.log(garfield.color)
|
|
78
|
-
// > "#ffa502"
|
|
79
|
-
console.log(garfield.core)
|
|
80
|
-
// > CatCore { ... }
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Interact with backend
|
|
84
|
-
|
|
85
|
-
```ts
|
|
86
|
-
// Let's save Garfield in our database
|
|
87
|
-
garfield.core.save()
|
|
88
|
-
|
|
89
|
-
// Now, let's retrieve Garfield in the database
|
|
90
|
-
const persistedGarfield = await CatCore.fromBackend('garfield')
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Using repositories
|
|
94
|
-
|
|
95
|
-
You can use repositories as an alternative way to persist and retrieve models in your backend.
|
|
96
|
-
|
|
97
|
-
This module provides a BaseRepository class that you can extend and override to apply your business logic when doing backend operations.
|
|
98
|
-
|
|
99
|
-
Let's create a repository for our Cat model, that prevents us from deleting a cat.
|
|
100
|
-
|
|
101
|
-
```ts
|
|
102
|
-
import { Core, BackendInterface, BaseRepository } from '@quatrain/core'
|
|
103
|
-
|
|
104
|
-
export default class CatRepository extends BaseRepository<Cat> {
|
|
105
|
-
constructor(backendAdapter: BackendInterface = Core.getBackend()) {
|
|
106
|
-
super(CatCore, backendAdapter)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
async delete(uid: string) {
|
|
110
|
-
throw Error("Don't delete the cats!")
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Now, let's use our new CatRepository.
|
|
116
|
-
|
|
117
|
-
```ts
|
|
118
|
-
const repository = new CatRepository()
|
|
119
|
-
|
|
120
|
-
repository.create(garfield)
|
|
121
|
-
repository.read('garfield')
|
|
122
|
-
repository.update(persistedGarfield)
|
|
123
|
-
repository.delete('garfield') // Will throw "Don't delete the cats!"
|
|
124
|
-
```
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DataObjectClass } from '../components';
|
|
2
|
-
import { Filter } from './Filter';
|
|
3
|
-
import { Filters } from './Filters';
|
|
4
|
-
import { Query, QueryResultType } from './Query';
|
|
5
|
-
import { SortAndLimit } from './SortAndLimit';
|
|
6
|
-
export interface BackendInterface {
|
|
7
|
-
create(dataObject: DataObjectClass<any>, desiredUid: string | undefined): Promise<DataObjectClass<any>>;
|
|
8
|
-
read(param: string | DataObjectClass<any>): Promise<DataObjectClass<any>>;
|
|
9
|
-
update(dataObject: DataObjectClass<any>): Promise<DataObjectClass<any>>;
|
|
10
|
-
delete(dataObject: DataObjectClass<any>): Promise<DataObjectClass<any>>;
|
|
11
|
-
query(query: Query<any>): Promise<QueryResultType<DataObjectClass<any>>>;
|
|
12
|
-
find(dataObject: DataObjectClass<any>, filters: Filters | Filter[] | undefined, pagination: SortAndLimit | undefined): Promise<QueryResultType<DataObjectClass<any>>>;
|
|
13
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { DataObjectClass } from '../../components';
|
|
2
|
-
import { BackendAction } from '../../Backend';
|
|
3
|
-
import { UserCore } from '../../components/User';
|
|
4
|
-
import Middleware from './Middleware';
|
|
5
|
-
export interface InjectMetaMiddlewareParams {
|
|
6
|
-
user: UserCore;
|
|
7
|
-
}
|
|
8
|
-
export declare class InjectMetaMiddleware implements Middleware {
|
|
9
|
-
protected _user: UserCore;
|
|
10
|
-
constructor(params: InjectMetaMiddlewareParams);
|
|
11
|
-
execute(dataObject: DataObjectClass<any>, action: BackendAction): void;
|
|
12
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InjectMetaMiddleware = void 0;
|
|
4
|
-
const Backend_1 = require("../../Backend");
|
|
5
|
-
class InjectMetaMiddleware {
|
|
6
|
-
constructor(params) {
|
|
7
|
-
this._user = params.user;
|
|
8
|
-
}
|
|
9
|
-
execute(dataObject, action) {
|
|
10
|
-
switch (action) {
|
|
11
|
-
// add properties existence validation
|
|
12
|
-
case Backend_1.BackendAction.CREATE:
|
|
13
|
-
dataObject.set('createdBy', this._user);
|
|
14
|
-
dataObject.set('createdAt', Date.now());
|
|
15
|
-
break;
|
|
16
|
-
case Backend_1.BackendAction.UPDATE:
|
|
17
|
-
dataObject.set('updatedBy', this._user);
|
|
18
|
-
dataObject.set('updatedAt', Date.now());
|
|
19
|
-
break;
|
|
20
|
-
case Backend_1.BackendAction.DELETE:
|
|
21
|
-
dataObject.set('deletedBy', this._user);
|
|
22
|
-
dataObject.set('deletedAt', Date.now());
|
|
23
|
-
break;
|
|
24
|
-
default:
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.InjectMetaMiddleware = InjectMetaMiddleware;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { UserClass } from './types/UserClass';
|
|
2
|
-
import { ObjectUri } from './ObjectUri';
|
|
3
|
-
export interface BaseObjectType {
|
|
4
|
-
name: string;
|
|
5
|
-
status: string;
|
|
6
|
-
createdBy?: UserClass | ObjectUri;
|
|
7
|
-
createdAt?: number;
|
|
8
|
-
updatedBy?: UserClass | ObjectUri;
|
|
9
|
-
updatedAt?: number;
|
|
10
|
-
deletedBy?: UserClass | ObjectUri;
|
|
11
|
-
deletedAt?: number;
|
|
12
|
-
}
|
|
13
|
-
export declare const BaseObjectProperties: any;
|
|
@@ -1,87 +0,0 @@
|
|
|
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.BaseObjectProperties = void 0;
|
|
27
|
-
const statuses = __importStar(require("../statuses"));
|
|
28
|
-
const StringProperty_1 = require("../properties/StringProperty");
|
|
29
|
-
const ObjectProperty_1 = require("../properties/ObjectProperty");
|
|
30
|
-
const EnumProperty_1 = require("../properties/EnumProperty");
|
|
31
|
-
const DateTimeProperty_1 = require("../properties/DateTimeProperty");
|
|
32
|
-
const htmlType = __importStar(require("../properties/types/PropertyHTMLType"));
|
|
33
|
-
exports.BaseObjectProperties = [
|
|
34
|
-
{
|
|
35
|
-
name: 'name',
|
|
36
|
-
mandatory: true,
|
|
37
|
-
type: StringProperty_1.StringProperty.TYPE,
|
|
38
|
-
minLength: 1,
|
|
39
|
-
maxLength: 100,
|
|
40
|
-
htmlType: htmlType.NAME,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: 'status',
|
|
44
|
-
mandatory: true,
|
|
45
|
-
type: EnumProperty_1.EnumProperty.TYPE,
|
|
46
|
-
values: [
|
|
47
|
-
statuses.CREATED,
|
|
48
|
-
statuses.PENDING,
|
|
49
|
-
statuses.ACTIVE,
|
|
50
|
-
statuses.DELETED,
|
|
51
|
-
],
|
|
52
|
-
defaultValue: statuses.CREATED,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: 'createdBy',
|
|
56
|
-
type: ObjectProperty_1.ObjectProperty.TYPE,
|
|
57
|
-
instanceOf: 'User',
|
|
58
|
-
mandatory: true,
|
|
59
|
-
protected: true,
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: 'createdAt',
|
|
63
|
-
type: DateTimeProperty_1.DateTimeProperty.TYPE,
|
|
64
|
-
mandatory: true,
|
|
65
|
-
protected: true,
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
name: 'updatedBy',
|
|
69
|
-
type: ObjectProperty_1.ObjectProperty.TYPE,
|
|
70
|
-
instanceOf: 'User',
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: 'updatedAt',
|
|
74
|
-
type: DateTimeProperty_1.DateTimeProperty.TYPE,
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: 'deletedBy',
|
|
78
|
-
type: ObjectProperty_1.ObjectProperty.TYPE,
|
|
79
|
-
instanceOf: 'User',
|
|
80
|
-
protected: true,
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
name: 'deletedAt',
|
|
84
|
-
type: DateTimeProperty_1.DateTimeProperty.TYPE,
|
|
85
|
-
protected: true,
|
|
86
|
-
},
|
|
87
|
-
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const EntityProperties: any;
|
|
@@ -1,54 +0,0 @@
|
|
|
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.EntityProperties = void 0;
|
|
27
|
-
const CollectionProperty_1 = require("../properties/CollectionProperty");
|
|
28
|
-
const StringProperty_1 = require("../properties/StringProperty");
|
|
29
|
-
const htmlType = __importStar(require("../properties/types/PropertyHTMLType"));
|
|
30
|
-
const User_1 = require("./User");
|
|
31
|
-
exports.EntityProperties = [
|
|
32
|
-
{
|
|
33
|
-
// surcharge property minLength and htmlType
|
|
34
|
-
name: 'name',
|
|
35
|
-
type: StringProperty_1.StringProperty.TYPE,
|
|
36
|
-
mandatory: true,
|
|
37
|
-
minLength: 1,
|
|
38
|
-
htmlType: htmlType.ORG,
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: 'bogus',
|
|
42
|
-
type: StringProperty_1.StringProperty.TYPE,
|
|
43
|
-
mandatory: true,
|
|
44
|
-
minLength: 1,
|
|
45
|
-
htmlType: htmlType.ORG,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: 'users',
|
|
49
|
-
mandatory: true,
|
|
50
|
-
type: CollectionProperty_1.CollectionProperty.TYPE,
|
|
51
|
-
instanceOf: User_1.User,
|
|
52
|
-
parentKey: 'entity',
|
|
53
|
-
},
|
|
54
|
-
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const UserProperties: any;
|
|
@@ -1,103 +0,0 @@
|
|
|
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.UserProperties = void 0;
|
|
27
|
-
const properties_1 = require("../properties");
|
|
28
|
-
const HashProperty_1 = require("../properties/HashProperty");
|
|
29
|
-
const StringProperty_1 = require("../properties/StringProperty");
|
|
30
|
-
const Entity_1 = require("./Entity");
|
|
31
|
-
const htmlType = __importStar(require("../properties/types/PropertyHTMLType"));
|
|
32
|
-
/**
|
|
33
|
-
* Callback function to populate the 'name' property
|
|
34
|
-
* @param dao DataObject
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
const onChange = (dao) => dao.set('name', `${dao.val('firstname')} ${dao.val('lastname')}`);
|
|
38
|
-
exports.UserProperties = [
|
|
39
|
-
{
|
|
40
|
-
// change name property minLength
|
|
41
|
-
name: 'name',
|
|
42
|
-
type: StringProperty_1.StringProperty.TYPE,
|
|
43
|
-
minLength: 0,
|
|
44
|
-
fullSearch: true,
|
|
45
|
-
htmlType: htmlType.NAME,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: 'firstname',
|
|
49
|
-
mandatory: true,
|
|
50
|
-
type: StringProperty_1.StringProperty.TYPE,
|
|
51
|
-
minLength: 1,
|
|
52
|
-
maxLength: 100,
|
|
53
|
-
htmlType: htmlType.GIVEN_NAME,
|
|
54
|
-
onChange,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: 'lastname',
|
|
58
|
-
mandatory: true,
|
|
59
|
-
type: StringProperty_1.StringProperty.TYPE,
|
|
60
|
-
minLength: 1,
|
|
61
|
-
maxLength: 100,
|
|
62
|
-
htmlType: htmlType.FAMILY_NAME,
|
|
63
|
-
onChange,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: 'gender',
|
|
67
|
-
mandatory: false,
|
|
68
|
-
type: properties_1.EnumProperty.TYPE,
|
|
69
|
-
values: ['male', 'female', 'nonbinary'],
|
|
70
|
-
htmlType: htmlType.GENDER,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: 'birthday',
|
|
74
|
-
mandatory: false,
|
|
75
|
-
type: properties_1.DateTimeProperty.TYPE,
|
|
76
|
-
htmlType: htmlType.BIRTHDAY,
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: 'email',
|
|
80
|
-
mandatory: true,
|
|
81
|
-
type: StringProperty_1.StringProperty.TYPE,
|
|
82
|
-
minLength: 1,
|
|
83
|
-
maxLength: 100,
|
|
84
|
-
fullSearch: true,
|
|
85
|
-
htmlType: htmlType.EMAIL,
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
name: 'password',
|
|
89
|
-
mandatory: true,
|
|
90
|
-
type: HashProperty_1.HashProperty.TYPE,
|
|
91
|
-
algorithm: HashProperty_1.HashProperty.ALGORITHM_SHA256,
|
|
92
|
-
salt: '',
|
|
93
|
-
minLength: 5,
|
|
94
|
-
maxLength: 20,
|
|
95
|
-
htmlType: htmlType.PASSWORD,
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
name: 'entity',
|
|
99
|
-
mandatory: false,
|
|
100
|
-
type: properties_1.ObjectProperty.TYPE,
|
|
101
|
-
instanceof: Entity_1.Entity,
|
|
102
|
-
},
|
|
103
|
-
];
|
|
File without changes
|
|
File without changes
|