@nizza/core 0.3.0-alpha.3 → 0.3.0-alpha.4
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/package.json +4 -2
- package/src/environments/{environment.js → development.js} +3 -3
- package/src/environments/{environment.js.map → development.js.map} +1 -1
- package/src/environments/index.d.ts +60 -0
- package/src/environments/index.js +11 -0
- package/src/environments/index.js.map +1 -0
- package/src/environments/{environment.prod.js → production.js} +3 -3
- package/src/environments/production.js.map +1 -0
- package/src/environments/{environment.staging.js → staging.js} +3 -3
- package/src/environments/staging.js.map +1 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/lib/domain/AggregateRoot.js +12 -23
- package/src/lib/domain/AggregateRoot.js.map +1 -1
- package/src/lib/domain/BaseMobxStore.js +2 -3
- package/src/lib/domain/BaseMobxStore.js.map +1 -1
- package/src/lib/domain/ValueObject.js +6 -14
- package/src/lib/domain/ValueObject.js.map +1 -1
- package/src/lib/domain/errors/DomainError.js +9 -17
- package/src/lib/domain/errors/DomainError.js.map +1 -1
- package/src/lib/domain/errors/api.js +4 -8
- package/src/lib/domain/errors/api.js.map +1 -1
- package/src/lib/domain/errors/app.js +8 -15
- package/src/lib/domain/errors/app.js.map +1 -1
- package/src/lib/providers/StoreProvider.js +14 -15
- package/src/lib/providers/StoreProvider.js.map +1 -1
- package/src/lib/stores/NizzaStore.js +10 -19
- package/src/lib/stores/NizzaStore.js.map +1 -1
- package/src/lib/types/api-graphql-types.js +1176 -1176
- package/src/lib/types/api-graphql-types.js.map +1 -1
- package/src/lib/types/utils.d.ts +1 -1
- package/src/lib/types/utils.js +2 -3
- package/src/lib/types/utils.js.map +1 -1
- package/src/lib/utils/Result.js +39 -54
- package/src/lib/utils/Result.js.map +1 -1
- package/src/lib/utils/apiCall.js +23 -52
- package/src/lib/utils/apiCall.js.map +1 -1
- package/src/lib/utils/customStorage/MemoryStorage.js +25 -34
- package/src/lib/utils/customStorage/MemoryStorage.js.map +1 -1
- package/src/lib/utils/customStorage/index.js +20 -30
- package/src/lib/utils/customStorage/index.js.map +1 -1
- package/src/lib/utils/customStorage/utils.js +3 -3
- package/src/lib/utils/customStorage/utils.js.map +1 -1
- package/src/lib/utils/fingerprint.js +3 -3
- package/src/lib/utils/fingerprint.js.map +1 -1
- package/src/lib/utils/helpers.js +8 -13
- package/src/lib/utils/helpers.js.map +1 -1
- package/src/lib/utils/lazyLoad.js +9 -16
- package/src/lib/utils/lazyLoad.js.map +1 -1
- package/src/environments/environment.d.js +0 -3
- package/src/environments/environment.d.js.map +0 -1
- package/src/environments/environment.prod.d.js +0 -3
- package/src/environments/environment.prod.d.js.map +0 -1
- package/src/environments/environment.prod.js.map +0 -1
- package/src/environments/environment.staging.d.js +0 -3
- package/src/environments/environment.staging.d.js.map +0 -1
- package/src/environments/environment.staging.js.map +0 -1
- /package/src/environments/{environment.d.ts → development.d.ts} +0 -0
- /package/src/environments/{environment.prod.d.ts → production.d.ts} +0 -0
- /package/src/environments/{environment.staging.d.ts → staging.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nizza/core",
|
|
3
|
-
"version": "0.3.0-alpha.
|
|
3
|
+
"version": "0.3.0-alpha.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
7
7
|
"types": "src/index.d.ts",
|
|
8
8
|
"source": "src/index.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@swc/helpers": "~0.4.14",
|
|
11
10
|
"dotenv": "^16.0.1",
|
|
12
11
|
"graphql": "^16.5.0",
|
|
13
12
|
"js-cookie": "^3.0.1",
|
|
@@ -15,6 +14,9 @@
|
|
|
15
14
|
"react": "^18.2.0",
|
|
16
15
|
"uuid": "^8.3.2"
|
|
17
16
|
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@swc/helpers": "~0.4.14"
|
|
19
|
+
},
|
|
18
20
|
"scripts": {
|
|
19
21
|
"clean": "rimraf dist/*"
|
|
20
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
const { NZ_AWS_REGION , NZ_BACKOFFICE_BACK_URL , NZ_CORE_SERVICES_GRAPHQL_URL , NZ_CORE_SERVICES_REST_URL } = import.meta.env;
|
|
2
2
|
// console.log('import.meta.env: ', import.meta.env);
|
|
3
|
-
export
|
|
3
|
+
export const environment = {
|
|
4
4
|
AWS: {
|
|
5
5
|
region: NZ_AWS_REGION,
|
|
6
6
|
cognito: {
|
|
@@ -25,4 +25,4 @@ export var environment = {
|
|
|
25
25
|
};
|
|
26
26
|
export default environment;
|
|
27
27
|
|
|
28
|
-
//# sourceMappingURL=
|
|
28
|
+
//# sourceMappingURL=development.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/environments/
|
|
1
|
+
{"version":3,"sources":["../../../src/environments/development.ts"],"sourcesContent":["const {\n NZ_AWS_REGION,\n NZ_BACKOFFICE_BACK_URL,\n NZ_CORE_SERVICES_GRAPHQL_URL,\n NZ_CORE_SERVICES_REST_URL,\n} = import.meta.env;\n\n// console.log('import.meta.env: ', import.meta.env);\n\nexport const environment = {\n AWS: {\n region: NZ_AWS_REGION,\n cognito: {\n userPoolId: 'us-east-1_knSlGEmJ0',\n userPoolWebClientId: '3hmbfhf7nl3kq20qr9i5lihf1p',\n },\n },\n\n // Back services\n apiUrls: {\n restV1:\n NZ_BACKOFFICE_BACK_URL ||\n 'https://pabprg32bj.execute-api.us-east-1.amazonaws.com',\n restV2:\n NZ_CORE_SERVICES_REST_URL || 'https://core-services-dev.nizza.com/api',\n graphql:\n NZ_CORE_SERVICES_GRAPHQL_URL ||\n 'https://core-services-dev.nizza.com/graphql',\n },\n\n publicUrls: {\n // Public app url\n platformSite: 'https://platformdev.nizza.com',\n\n // Nizza CDN\n nizzaCdn: 'https://cdn.nizza.com',\n\n // Bundle\n bundleSite: 'https://bundledev.nizza.com',\n },\n};\n\nexport default environment;\n"],"names":["NZ_AWS_REGION","NZ_BACKOFFICE_BACK_URL","NZ_CORE_SERVICES_GRAPHQL_URL","NZ_CORE_SERVICES_REST_URL","env","environment","AWS","region","cognito","userPoolId","userPoolWebClientId","apiUrls","restV1","restV2","graphql","publicUrls","platformSite","nizzaCdn","bundleSite"],"mappings":"AAAA,MAAM,EACJA,cAAa,EACbC,uBAAsB,EACtBC,6BAA4B,EAC5BC,0BAAyB,EAC1B,GAAG,YAAYC,GAAG;AAEnB,qDAAqD;AAErD,OAAO,MAAMC,cAAc;IACzBC,KAAK;QACHC,QAAQP;QACRQ,SAAS;YACPC,YAAY;YACZC,qBAAqB;QACvB;IACF;IAEA,iBAAiB;IACjBC,SAAS;QACPC,QACEX,0BACA;QACFY,QACEV,6BAA6B;QAC/BW,SACEZ,gCACA;IACJ;IAEAa,YAAY;QACV,kBAAkB;QAClBC,cAAc;QAEd,YAAY;QACZC,UAAU;QAEV,UAAU;QACVC,YAAY;IACd;AACF,EAAE;AAEF,eAAeb,YAAY"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export declare const env: {
|
|
2
|
+
dev: {
|
|
3
|
+
AWS: {
|
|
4
|
+
region: any;
|
|
5
|
+
cognito: {
|
|
6
|
+
userPoolId: string;
|
|
7
|
+
userPoolWebClientId: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
apiUrls: {
|
|
11
|
+
restV1: any;
|
|
12
|
+
restV2: any;
|
|
13
|
+
graphql: any;
|
|
14
|
+
};
|
|
15
|
+
publicUrls: {
|
|
16
|
+
platformSite: string;
|
|
17
|
+
nizzaCdn: string;
|
|
18
|
+
bundleSite: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
prod: {
|
|
22
|
+
AWS: {
|
|
23
|
+
region: any;
|
|
24
|
+
cognito: {
|
|
25
|
+
userPoolId: string;
|
|
26
|
+
userPoolWebClientId: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
apiUrls: {
|
|
30
|
+
restV1: any;
|
|
31
|
+
restV2: any;
|
|
32
|
+
graphql: any;
|
|
33
|
+
};
|
|
34
|
+
publicUrls: {
|
|
35
|
+
platformSite: string;
|
|
36
|
+
nizzaCdn: string;
|
|
37
|
+
bundleSite: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
staging: {
|
|
41
|
+
AWS: {
|
|
42
|
+
region: any;
|
|
43
|
+
cognito: {
|
|
44
|
+
userPoolId: string;
|
|
45
|
+
userPoolWebClientId: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
apiUrls: {
|
|
49
|
+
restV1: any;
|
|
50
|
+
restV2: any;
|
|
51
|
+
graphql: any;
|
|
52
|
+
};
|
|
53
|
+
publicUrls: {
|
|
54
|
+
platformSite: string;
|
|
55
|
+
nizzaCdn: string;
|
|
56
|
+
bundleSite: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export default env;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/environments/index.ts"],"sourcesContent":["import dev from './development';\nimport prod from './production';\nimport staging from './staging';\n\nexport const env = {\n dev,\n prod,\n staging,\n};\n\nexport default env;\n"],"names":["dev","prod","staging","env"],"mappings":"AAAA,OAAOA,SAAS,gBAAgB;AAChC,OAAOC,UAAU,eAAe;AAChC,OAAOC,aAAa,YAAY;AAEhC,OAAO,MAAMC,MAAM;IACjBH;IACAC;IACAC;AACF,EAAE;AAEF,eAAeC,IAAI"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
const { NZ_AWS_REGION , NZ_BACKOFFICE_BACK_URL , NZ_CORE_SERVICES_GRAPHQL_URL , NZ_CORE_SERVICES_REST_URL } = import.meta.env;
|
|
2
|
+
export const environment = {
|
|
3
3
|
AWS: {
|
|
4
4
|
region: NZ_AWS_REGION,
|
|
5
5
|
cognito: {
|
|
@@ -24,4 +24,4 @@ export var environment = {
|
|
|
24
24
|
};
|
|
25
25
|
export default environment;
|
|
26
26
|
|
|
27
|
-
//# sourceMappingURL=
|
|
27
|
+
//# sourceMappingURL=production.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/environments/production.ts"],"sourcesContent":["const {\n NZ_AWS_REGION,\n NZ_BACKOFFICE_BACK_URL,\n NZ_CORE_SERVICES_GRAPHQL_URL,\n NZ_CORE_SERVICES_REST_URL,\n} = import.meta.env;\n\nexport const environment = {\n AWS: {\n region: NZ_AWS_REGION,\n cognito: {\n userPoolId: 'us-east-1_EZ7wuZ4ig',\n userPoolWebClientId: '2jok7cst8ebf6ppscrhji57gvr',\n },\n },\n\n // Back services\n apiUrls: {\n restV1:\n NZ_BACKOFFICE_BACK_URL ||\n 'https://b133h34s56.execute-api.us-east-1.amazonaws.com',\n restV2:\n NZ_CORE_SERVICES_REST_URL || 'https://core-services-prod.nizza.com/api',\n graphql:\n NZ_CORE_SERVICES_GRAPHQL_URL ||\n 'https://core-services-prod.nizza.com/graphql',\n },\n\n publicUrls: {\n // Public app url\n platformSite: 'https://platform.nizza.com',\n\n // Nizza CDN\n nizzaCdn: 'https://cdn.nizza.com',\n\n // Bundle\n bundleSite: 'https://bundle.nizza.com',\n },\n};\n\nexport default environment;\n"],"names":["NZ_AWS_REGION","NZ_BACKOFFICE_BACK_URL","NZ_CORE_SERVICES_GRAPHQL_URL","NZ_CORE_SERVICES_REST_URL","env","environment","AWS","region","cognito","userPoolId","userPoolWebClientId","apiUrls","restV1","restV2","graphql","publicUrls","platformSite","nizzaCdn","bundleSite"],"mappings":"AAAA,MAAM,EACJA,cAAa,EACbC,uBAAsB,EACtBC,6BAA4B,EAC5BC,0BAAyB,EAC1B,GAAG,YAAYC,GAAG;AAEnB,OAAO,MAAMC,cAAc;IACzBC,KAAK;QACHC,QAAQP;QACRQ,SAAS;YACPC,YAAY;YACZC,qBAAqB;QACvB;IACF;IAEA,iBAAiB;IACjBC,SAAS;QACPC,QACEX,0BACA;QACFY,QACEV,6BAA6B;QAC/BW,SACEZ,gCACA;IACJ;IAEAa,YAAY;QACV,kBAAkB;QAClBC,cAAc;QAEd,YAAY;QACZC,UAAU;QAEV,UAAU;QACVC,YAAY;IACd;AACF,EAAE;AAEF,eAAeb,YAAY"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
const { NZ_AWS_REGION , NZ_BACKOFFICE_BACK_URL , NZ_CORE_SERVICES_GRAPHQL_URL , NZ_CORE_SERVICES_REST_URL } = import.meta.env;
|
|
2
|
+
export const environment = {
|
|
3
3
|
AWS: {
|
|
4
4
|
region: NZ_AWS_REGION,
|
|
5
5
|
cognito: {
|
|
@@ -24,4 +24,4 @@ export var environment = {
|
|
|
24
24
|
};
|
|
25
25
|
export default environment;
|
|
26
26
|
|
|
27
|
-
//# sourceMappingURL=
|
|
27
|
+
//# sourceMappingURL=staging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/environments/staging.ts"],"sourcesContent":["const {\n NZ_AWS_REGION,\n NZ_BACKOFFICE_BACK_URL,\n NZ_CORE_SERVICES_GRAPHQL_URL,\n NZ_CORE_SERVICES_REST_URL,\n} = import.meta.env;\n\nexport const environment = {\n AWS: {\n region: NZ_AWS_REGION,\n cognito: {\n userPoolId: 'us-east-1_EZ7wuZ4ig',\n userPoolWebClientId: '2jok7cst8ebf6ppscrhji57gvr',\n },\n },\n\n // Back services\n apiUrls: {\n restV1:\n NZ_BACKOFFICE_BACK_URL ||\n 'https://b133h34s56.execute-api.us-east-1.amazonaws.com',\n restV2:\n NZ_CORE_SERVICES_REST_URL || 'https://core-services-prod.nizza.com/api',\n graphql:\n NZ_CORE_SERVICES_GRAPHQL_URL ||\n 'https://core-services-prod.nizza.com/graphql',\n },\n\n publicUrls: {\n // Public app url\n platformSite: 'https://platformstaging.nizza.com',\n\n // Nizza CDN\n nizzaCdn: 'https://cdn.nizza.com',\n\n // Bundle\n bundleSite: 'https://bundle.nizza.com',\n },\n};\n\nexport default environment;\n"],"names":["NZ_AWS_REGION","NZ_BACKOFFICE_BACK_URL","NZ_CORE_SERVICES_GRAPHQL_URL","NZ_CORE_SERVICES_REST_URL","env","environment","AWS","region","cognito","userPoolId","userPoolWebClientId","apiUrls","restV1","restV2","graphql","publicUrls","platformSite","nizzaCdn","bundleSite"],"mappings":"AAAA,MAAM,EACJA,cAAa,EACbC,uBAAsB,EACtBC,6BAA4B,EAC5BC,0BAAyB,EAC1B,GAAG,YAAYC,GAAG;AAEnB,OAAO,MAAMC,cAAc;IACzBC,KAAK;QACHC,QAAQP;QACRQ,SAAS;YACPC,YAAY;YACZC,qBAAqB;QACvB;IACF;IAEA,iBAAiB;IACjBC,SAAS;QACPC,QACEX,0BACA;QACFY,QACEV,6BAA6B;QAC/BW,SACEZ,gCACA;IACJ;IAEAa,YAAY;QACV,kBAAkB;QAClBC,cAAc;QAEd,YAAY;QACZC,UAAU;QAEV,UAAU;QACVC,YAAY;IACd;AACF,EAAE;AAEF,eAAeb,YAAY"}
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './lib/constants';\nexport * from './lib/domain';\nexport * from './lib/providers';\nexport * from './lib/stores';\nexport * from './lib/types';\nexport * from './lib/utils';\n"],"names":[],"mappings":"AAAA,cAAc,kBAAkB;AAChC,cAAc,eAAe;AAC7B,cAAc,kBAAkB;AAChC,cAAc,eAAe;AAC7B,cAAc,cAAc;AAC5B,cAAc,cAAc"}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './environments';\nexport * from './lib/constants';\nexport * from './lib/domain';\nexport * from './lib/providers';\nexport * from './lib/stores';\nexport * from './lib/types';\nexport * from './lib/utils';\n"],"names":[],"mappings":"AAAA,cAAc,iBAAiB;AAC/B,cAAc,kBAAkB;AAChC,cAAc,eAAe;AAC7B,cAAc,kBAAkB;AAChC,cAAc,eAAe;AAC7B,cAAc,cAAc;AAC5B,cAAc,cAAc"}
|
|
@@ -1,31 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
"use strict";
|
|
5
|
-
function AggregateRoot(aggregate) {
|
|
6
|
-
this._numSetPropsApplied = 0;
|
|
7
|
-
this.aggregate = aggregate;
|
|
8
|
-
}
|
|
9
|
-
var _proto = AggregateRoot.prototype;
|
|
10
|
-
_proto.setProps = function setProps(props) {
|
|
11
|
-
for(var _i = 0, _Object_entries = Object.entries(props); _i < _Object_entries.length; _i++){
|
|
12
|
-
var _Object_entries__i = _sliced_to_array(_Object_entries[_i], 2), key = _Object_entries__i[0], value = _Object_entries__i[1];
|
|
1
|
+
export class AggregateRoot {
|
|
2
|
+
setProps(props) {
|
|
3
|
+
for (const [key, value] of Object.entries(props)){
|
|
13
4
|
if (key in this.aggregate) {
|
|
14
5
|
this.aggregate[key] = value;
|
|
15
6
|
}
|
|
16
7
|
}
|
|
17
8
|
this._numSetPropsApplied++;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return AggregateRoot;
|
|
28
|
-
}();
|
|
9
|
+
}
|
|
10
|
+
get isFirstSetProps() {
|
|
11
|
+
return this._numSetPropsApplied === 1;
|
|
12
|
+
}
|
|
13
|
+
constructor(aggregate){
|
|
14
|
+
this._numSetPropsApplied = 0;
|
|
15
|
+
this.aggregate = aggregate;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
29
18
|
export function createAggregateRoot(aggregate) {
|
|
30
19
|
return new AggregateRoot(aggregate);
|
|
31
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/domain/AggregateRoot.ts"],"sourcesContent":["export interface IAggregateRoot {\n toPrimitives: () => Record<string, any>;\n}\n\nexport class AggregateRoot<Aggregate, Props> {\n private aggregate: Aggregate;\n private _numSetPropsApplied = 0;\n\n constructor(aggregate: Aggregate) {\n this.aggregate = aggregate;\n }\n\n setProps(props: Partial<Props>) {\n for (const [key, value] of Object.entries(props)) {\n if (key in (this as any).aggregate) {\n (this.aggregate as any)[key] = value;\n }\n }\n\n this._numSetPropsApplied++;\n }\n\n get isFirstSetProps() {\n return this._numSetPropsApplied === 1;\n }\n}\n\nexport function createAggregateRoot<Props, Aggregate>(aggregate: Aggregate) {\n return new AggregateRoot<Aggregate, Props>(aggregate);\n}\n"],"names":["AggregateRoot","
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/domain/AggregateRoot.ts"],"sourcesContent":["export interface IAggregateRoot {\n toPrimitives: () => Record<string, any>;\n}\n\nexport class AggregateRoot<Aggregate, Props> {\n private aggregate: Aggregate;\n private _numSetPropsApplied = 0;\n\n constructor(aggregate: Aggregate) {\n this.aggregate = aggregate;\n }\n\n setProps(props: Partial<Props>) {\n for (const [key, value] of Object.entries(props)) {\n if (key in (this as any).aggregate) {\n (this.aggregate as any)[key] = value;\n }\n }\n\n this._numSetPropsApplied++;\n }\n\n get isFirstSetProps() {\n return this._numSetPropsApplied === 1;\n }\n}\n\nexport function createAggregateRoot<Props, Aggregate>(aggregate: Aggregate) {\n return new AggregateRoot<Aggregate, Props>(aggregate);\n}\n"],"names":["AggregateRoot","setProps","props","key","value","Object","entries","aggregate","_numSetPropsApplied","isFirstSetProps","constructor","createAggregateRoot"],"mappings":"AAIA,OAAO,MAAMA;IAQXC,SAASC,KAAqB,EAAE;QAC9B,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACJ,OAAQ;YAChD,IAAIC,OAAO,AAAC,IAAI,CAASI,SAAS,EAAE;gBACjC,IAAI,CAACA,SAAS,AAAQ,CAACJ,IAAI,GAAGC;YACjC,CAAC;QACH;QAEA,IAAI,CAACI,mBAAmB;IAC1B;IAEA,IAAIC,kBAAkB;QACpB,OAAO,IAAI,CAACD,mBAAmB,KAAK;IACtC;IAhBAE,YAAYH,SAAoB,CAAE;aAF1BC,sBAAsB;QAG5B,IAAI,CAACD,SAAS,GAAGA;IACnB;AAeF,CAAC;AAED,OAAO,SAASI,oBAAsCJ,SAAoB,EAAE;IAC1E,OAAO,IAAIP,cAAgCO;AAC7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/domain/BaseMobxStore.ts"],"sourcesContent":["export abstract class BaseMobxStore {}\n"],"names":["BaseMobxStore"],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/domain/BaseMobxStore.ts"],"sourcesContent":["export abstract class BaseMobxStore {}\n"],"names":["BaseMobxStore"],"mappings":"AAAA,OAAO,MAAeA;AAAe,CAAC"}
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export class ValueObject {
|
|
2
|
+
get value() {
|
|
3
|
+
return this._value;
|
|
4
|
+
}
|
|
5
|
+
constructor(value){
|
|
5
6
|
if (value !== undefined) {
|
|
6
7
|
this._value = value;
|
|
7
8
|
}
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
{
|
|
11
|
-
key: "value",
|
|
12
|
-
get: function get() {
|
|
13
|
-
return this._value;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
]);
|
|
17
|
-
return ValueObject;
|
|
18
|
-
}();
|
|
10
|
+
}
|
|
19
11
|
|
|
20
12
|
//# sourceMappingURL=ValueObject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/domain/ValueObject.ts"],"sourcesContent":["export abstract class ValueObject<T> {\n protected _value!: T;\n\n constructor(value?: T) {\n if (value !== undefined) {\n this._value = value;\n }\n }\n\n get value() {\n return this._value;\n }\n}\n"],"names":["ValueObject","value","
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/domain/ValueObject.ts"],"sourcesContent":["export abstract class ValueObject<T> {\n protected _value!: T;\n\n constructor(value?: T) {\n if (value !== undefined) {\n this._value = value;\n }\n }\n\n get value() {\n return this._value;\n }\n}\n"],"names":["ValueObject","value","_value","constructor","undefined"],"mappings":"AAAA,OAAO,MAAeA;IASpB,IAAIC,QAAQ;QACV,OAAO,IAAI,CAACC,MAAM;IACpB;IARAC,YAAYF,KAAS,CAAE;QACrB,IAAIA,UAAUG,WAAW;YACvB,IAAI,CAACF,MAAM,GAAGD;QAChB,CAAC;IACH;AAKF,CAAC"}
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export var DomainError = /*#__PURE__*/ function(Error1) {
|
|
5
|
-
"use strict";
|
|
6
|
-
_inherits(DomainError, Error1);
|
|
7
|
-
function DomainError(name, message, value) {
|
|
8
|
-
var _this;
|
|
9
|
-
_this = Error1.call(this, message) || this;
|
|
10
|
-
_this.value = value;
|
|
11
|
-
_this.name = name;
|
|
12
|
-
return _this;
|
|
13
|
-
}
|
|
14
|
-
var _proto = DomainError.prototype;
|
|
15
|
-
_proto.toDTO = function toDTO() {
|
|
2
|
+
export class DomainError extends Error {
|
|
3
|
+
toDTO() {
|
|
16
4
|
return _extends({
|
|
17
5
|
name: this.name,
|
|
18
6
|
message: this.message
|
|
19
7
|
}, this.value && {
|
|
20
8
|
value: this.value
|
|
21
9
|
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
10
|
+
}
|
|
11
|
+
constructor(name, message, value){
|
|
12
|
+
super(message);
|
|
13
|
+
this.value = value;
|
|
14
|
+
this.name = name;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
25
17
|
|
|
26
18
|
//# sourceMappingURL=DomainError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lib/domain/errors/DomainError.ts"],"sourcesContent":["interface DomainErrorDTO {\n name: string;\n message: string;\n value?: any;\n}\n\nexport class DomainError extends Error {\n constructor(name: string, message: string, public value?: any) {\n super(message);\n this.name = name;\n }\n\n toDTO(): DomainErrorDTO {\n return {\n name: this.name,\n message: this.message,\n ...(this.value && { value: this.value }),\n };\n }\n}\n"],"names":["DomainError","name","message","value","
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lib/domain/errors/DomainError.ts"],"sourcesContent":["interface DomainErrorDTO {\n name: string;\n message: string;\n value?: any;\n}\n\nexport class DomainError extends Error {\n constructor(name: string, message: string, public value?: any) {\n super(message);\n this.name = name;\n }\n\n toDTO(): DomainErrorDTO {\n return {\n name: this.name,\n message: this.message,\n ...(this.value && { value: this.value }),\n };\n }\n}\n"],"names":["DomainError","Error","toDTO","name","message","value","constructor"],"mappings":";AAMA,OAAO,MAAMA,oBAAoBC;IAM/BC,QAAwB;QACtB,OAAO;YACLC,MAAM,IAAI,CAACA,IAAI;YACfC,SAAS,IAAI,CAACA,OAAO;WACjB,IAAI,CAACC,KAAK,IAAI;YAAEA,OAAO,IAAI,CAACA,KAAK;QAAC;IAE1C;IAXAC,YAAYH,IAAY,EAAEC,OAAe,EAASC,MAAa;QAC7D,KAAK,CAACD;qBAD0CC;QAEhD,IAAI,CAACF,IAAI,GAAGA;IACd;AASF,CAAC"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { _ as _inherits } from "@swc/helpers/_/_inherits";
|
|
2
1
|
import { DomainError } from './DomainError';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function ResourceNotFoundError(id) {
|
|
7
|
-
return DomainError.call(this, 'RESOURCE_NOT_FOUND_ERROR', "Resource with id '" + id + "' not found.", id);
|
|
2
|
+
export class ResourceNotFoundError extends DomainError {
|
|
3
|
+
constructor(id){
|
|
4
|
+
super('RESOURCE_NOT_FOUND_ERROR', `Resource with id '${id}' not found.`, id);
|
|
8
5
|
}
|
|
9
|
-
|
|
10
|
-
}(DomainError);
|
|
6
|
+
}
|
|
11
7
|
|
|
12
8
|
//# sourceMappingURL=api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lib/domain/errors/api.ts"],"sourcesContent":["import { DomainError } from './DomainError';\n\nexport class ResourceNotFoundError extends DomainError {\n constructor(id: string) {\n super(\n 'RESOURCE_NOT_FOUND_ERROR',\n `Resource with id '${id}' not found.`,\n id,\n );\n }\n}\n"],"names":["DomainError","ResourceNotFoundError","id"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lib/domain/errors/api.ts"],"sourcesContent":["import { DomainError } from './DomainError';\n\nexport class ResourceNotFoundError extends DomainError {\n constructor(id: string) {\n super(\n 'RESOURCE_NOT_FOUND_ERROR',\n `Resource with id '${id}' not found.`,\n id,\n );\n }\n}\n"],"names":["DomainError","ResourceNotFoundError","constructor","id"],"mappings":"AAAA,SAASA,WAAW,QAAQ,gBAAgB;AAE5C,OAAO,MAAMC,8BAA8BD;IACzCE,YAAYC,EAAU,CAAE;QACtB,KAAK,CACH,4BACA,CAAC,kBAAkB,EAAEA,GAAG,YAAY,CAAC,EACrCA;IAEJ;AACF,CAAC"}
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import { _ as _inherits } from "@swc/helpers/_/_inherits";
|
|
2
1
|
import { DomainError } from './DomainError';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
_inherits(UnexpectedError, DomainError);
|
|
6
|
-
function UnexpectedError(error) {
|
|
2
|
+
export class UnexpectedError extends DomainError {
|
|
3
|
+
constructor(error){
|
|
7
4
|
var _error_message;
|
|
8
|
-
|
|
5
|
+
super('APP_UNEXPECTED_ERROR', (_error_message = error.message) != null ? _error_message : `An unexpected error occurred.`, error);
|
|
9
6
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
_inherits(AccountInvalidError, DomainError);
|
|
15
|
-
function AccountInvalidError() {
|
|
16
|
-
return DomainError.call(this, 'APP_ACCOUNT_INVALID_ERROR', "Account not defined");
|
|
7
|
+
}
|
|
8
|
+
export class AccountInvalidError extends DomainError {
|
|
9
|
+
constructor(){
|
|
10
|
+
super('APP_ACCOUNT_INVALID_ERROR', `Account not defined`);
|
|
17
11
|
}
|
|
18
|
-
|
|
19
|
-
}(DomainError);
|
|
12
|
+
}
|
|
20
13
|
|
|
21
14
|
//# sourceMappingURL=app.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lib/domain/errors/app.ts"],"sourcesContent":["import { DomainError } from './DomainError';\n\nexport class UnexpectedError extends DomainError {\n constructor(error: Error | unknown) {\n super(\n 'APP_UNEXPECTED_ERROR',\n (error as Error).message ?? `An unexpected error occurred.`,\n error,\n );\n }\n}\n\nexport class AccountInvalidError extends DomainError {\n constructor() {\n super('APP_ACCOUNT_INVALID_ERROR', `Account not defined`);\n }\n}\n"],"names":["DomainError","UnexpectedError","error","message","AccountInvalidError"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lib/domain/errors/app.ts"],"sourcesContent":["import { DomainError } from './DomainError';\n\nexport class UnexpectedError extends DomainError {\n constructor(error: Error | unknown) {\n super(\n 'APP_UNEXPECTED_ERROR',\n (error as Error).message ?? `An unexpected error occurred.`,\n error,\n );\n }\n}\n\nexport class AccountInvalidError extends DomainError {\n constructor() {\n super('APP_ACCOUNT_INVALID_ERROR', `Account not defined`);\n }\n}\n"],"names":["DomainError","UnexpectedError","constructor","error","message","AccountInvalidError"],"mappings":"AAAA,SAASA,WAAW,QAAQ,gBAAgB;AAE5C,OAAO,MAAMC,wBAAwBD;IACnCE,YAAYC,KAAsB,CAAE;YAGhC;QAFF,KAAK,CACH,wBACA,CAAA,iBAAA,AAACA,MAAgBC,OAAO,YAAxB,iBAA4B,CAAC,6BAA6B,CAAC,EAC3DD;IAEJ;AACF,CAAC;AAED,OAAO,MAAME,4BAA4BL;IACvCE,aAAc;QACZ,KAAK,CAAC,6BAA6B,CAAC,mBAAmB,CAAC;IAC1D;AACF,CAAC"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
2
1
|
import { createContext, useContext, useMemo } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var instance;
|
|
2
|
+
let globalStores = new Map();
|
|
3
|
+
const storeContext = /*#__PURE__*/ createContext(globalStores);
|
|
4
|
+
export const StoreProvider = ({ children , stores , instances })=>{
|
|
5
|
+
const parentContext = useContext(storeContext);
|
|
6
|
+
const context = useMemo(()=>{
|
|
7
|
+
const container = new Map();
|
|
8
|
+
stores.forEach((store)=>{
|
|
9
|
+
let instance;
|
|
12
10
|
try {
|
|
13
11
|
instance = store();
|
|
14
12
|
} catch (err) {
|
|
@@ -16,10 +14,11 @@ export var StoreProvider = function(param) {
|
|
|
16
14
|
}
|
|
17
15
|
container.set(store, instance);
|
|
18
16
|
});
|
|
19
|
-
instances == null ? void 0 : instances.forEach(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
instances == null ? void 0 : instances.forEach((instance_)=>container.set(instance_.constructor, instance_));
|
|
18
|
+
return globalStores = new Map([
|
|
19
|
+
...parentContext,
|
|
20
|
+
...container
|
|
21
|
+
]);
|
|
23
22
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
23
|
}, []);
|
|
25
24
|
return /*#__PURE__*/ React.createElement(storeContext.Provider, {
|
|
@@ -27,7 +26,7 @@ export var StoreProvider = function(param) {
|
|
|
27
26
|
}, children);
|
|
28
27
|
};
|
|
29
28
|
export function useStore(identifier) {
|
|
30
|
-
|
|
29
|
+
const context = useContext(storeContext);
|
|
31
30
|
return context.get(identifier);
|
|
32
31
|
}
|
|
33
32
|
export function getStore(identifier) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/providers/StoreProvider.tsx"],"sourcesContent":["import { createContext, FC, useContext, useMemo } from 'react';\nimport { BaseStore, StoreClass, StoreFactory } from '../types';\n\ninterface Props {\n instances?: BaseStore[];\n stores: (StoreClass | StoreFactory)[];\n children?: React.ReactNode;\n}\n\nlet globalStores = new Map<any, any>();\nconst storeContext = createContext<typeof globalStores>(globalStores);\n\nexport const StoreProvider: FC<Props> = ({ children, stores, instances }) => {\n const parentContext = useContext(storeContext);\n\n const context = useMemo(() => {\n const container = new Map();\n stores.forEach(store => {\n let instance;\n\n try {\n instance = (store as StoreFactory)();\n } catch (err) {\n instance = new (store as StoreClass)();\n }\n container.set(store, instance);\n });\n\n instances?.forEach(instance_ =>\n container.set(instance_.constructor, instance_),\n );\n\n return (globalStores = new Map([...parentContext, ...container]));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <storeContext.Provider value={context}>{children}</storeContext.Provider>\n );\n};\n\nexport function useStore<T>(identifier: StoreClass<T>): T {\n const context = useContext(storeContext);\n return context.get(identifier);\n}\n\nexport function getStore<T>(identifier: StoreClass<T>): T {\n return globalStores.get(identifier);\n}\n"],"names":["createContext","useContext","useMemo","globalStores","Map","storeContext","StoreProvider","children","stores","instances","parentContext","context","container","forEach","store","instance","err","set","instance_","constructor","Provider","value","useStore","identifier","get","getStore"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/providers/StoreProvider.tsx"],"sourcesContent":["import { createContext, FC, useContext, useMemo } from 'react';\nimport { BaseStore, StoreClass, StoreFactory } from '../types';\n\ninterface Props {\n instances?: BaseStore[];\n stores: (StoreClass | StoreFactory)[];\n children?: React.ReactNode;\n}\n\nlet globalStores = new Map<any, any>();\nconst storeContext = createContext<typeof globalStores>(globalStores);\n\nexport const StoreProvider: FC<Props> = ({ children, stores, instances }) => {\n const parentContext = useContext(storeContext);\n\n const context = useMemo(() => {\n const container = new Map();\n stores.forEach(store => {\n let instance;\n\n try {\n instance = (store as StoreFactory)();\n } catch (err) {\n instance = new (store as StoreClass)();\n }\n container.set(store, instance);\n });\n\n instances?.forEach(instance_ =>\n container.set(instance_.constructor, instance_),\n );\n\n return (globalStores = new Map([...parentContext, ...container]));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <storeContext.Provider value={context}>{children}</storeContext.Provider>\n );\n};\n\nexport function useStore<T>(identifier: StoreClass<T>): T {\n const context = useContext(storeContext);\n return context.get(identifier);\n}\n\nexport function getStore<T>(identifier: StoreClass<T>): T {\n return globalStores.get(identifier);\n}\n"],"names":["createContext","useContext","useMemo","globalStores","Map","storeContext","StoreProvider","children","stores","instances","parentContext","context","container","forEach","store","instance","err","set","instance_","constructor","Provider","value","useStore","identifier","get","getStore"],"mappings":"AAAA,SAASA,aAAa,EAAMC,UAAU,EAAEC,OAAO,QAAQ,QAAQ;AAS/D,IAAIC,eAAe,IAAIC;AACvB,MAAMC,6BAAeL,cAAmCG;AAExD,OAAO,MAAMG,gBAA2B,CAAC,EAAEC,SAAQ,EAAEC,OAAM,EAAEC,UAAS,EAAE,GAAK;IAC3E,MAAMC,gBAAgBT,WAAWI;IAEjC,MAAMM,UAAUT,QAAQ,IAAM;QAC5B,MAAMU,YAAY,IAAIR;QACtBI,OAAOK,OAAO,CAACC,CAAAA,QAAS;YACtB,IAAIC;YAEJ,IAAI;gBACFA,WAAW,AAACD;YACd,EAAE,OAAOE,KAAK;gBACZD,WAAW,IAAKD;YAClB;YACAF,UAAUK,GAAG,CAACH,OAAOC;QACvB;QAEAN,oBAAAA,KAAAA,IAAAA,UAAWI,OAAO,CAACK,CAAAA,YACjBN,UAAUK,GAAG,CAACC,UAAUC,WAAW,EAAED;QAGvC,OAAQf,eAAe,IAAIC,IAAI;eAAIM;eAAkBE;SAAU;IAC/D,uDAAuD;IACzD,GAAG,EAAE;IAEL,qBACE,oBAACP,aAAae,QAAQ;QAACC,OAAOV;OAAUJ;AAE5C,EAAE;AAEF,OAAO,SAASe,SAAYC,UAAyB,EAAK;IACxD,MAAMZ,UAAUV,WAAWI;IAC3B,OAAOM,QAAQa,GAAG,CAACD;AACrB,CAAC;AAED,OAAO,SAASE,SAAYF,UAAyB,EAAK;IACxD,OAAOpB,aAAaqB,GAAG,CAACD;AAC1B,CAAC"}
|
|
@@ -1,27 +1,18 @@
|
|
|
1
|
-
import { _ as _create_class } from "@swc/helpers/_/_create_class";
|
|
2
1
|
import { makeAutoObservable } from 'mobx';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export class NizzaStore {
|
|
3
|
+
configure(config) {
|
|
4
|
+
this._config = config;
|
|
5
|
+
}
|
|
6
|
+
get config() {
|
|
7
|
+
return this._config;
|
|
8
|
+
}
|
|
9
|
+
constructor(){
|
|
6
10
|
makeAutoObservable(this, {}, {
|
|
7
11
|
name: 'NizzaStore',
|
|
8
12
|
autoBind: true
|
|
9
13
|
});
|
|
10
14
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this._config = config;
|
|
14
|
-
};
|
|
15
|
-
_create_class(NizzaStore, [
|
|
16
|
-
{
|
|
17
|
-
key: "config",
|
|
18
|
-
get: function get() {
|
|
19
|
-
return this._config;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
]);
|
|
23
|
-
return NizzaStore;
|
|
24
|
-
}();
|
|
25
|
-
export var nizza = new NizzaStore();
|
|
15
|
+
}
|
|
16
|
+
export const nizza = new NizzaStore();
|
|
26
17
|
|
|
27
18
|
//# sourceMappingURL=NizzaStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/stores/NizzaStore.ts"],"sourcesContent":["import { NizzaConfiguration, NizzaGlobalObjet } from '../types';\nimport { makeAutoObservable } from 'mobx';\n\nexport class NizzaStore implements NizzaGlobalObjet {\n private _config!: NizzaConfiguration;\n\n constructor() {\n makeAutoObservable(this, {}, { name: 'NizzaStore', autoBind: true });\n }\n\n configure(config: NizzaConfiguration) {\n this._config = config;\n }\n\n get config() {\n return this._config;\n }\n}\n\nexport const nizza = new NizzaStore();\n"],"names":["makeAutoObservable","NizzaStore","
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/stores/NizzaStore.ts"],"sourcesContent":["import { NizzaConfiguration, NizzaGlobalObjet } from '../types';\nimport { makeAutoObservable } from 'mobx';\n\nexport class NizzaStore implements NizzaGlobalObjet {\n private _config!: NizzaConfiguration;\n\n constructor() {\n makeAutoObservable(this, {}, { name: 'NizzaStore', autoBind: true });\n }\n\n configure(config: NizzaConfiguration) {\n this._config = config;\n }\n\n get config() {\n return this._config;\n }\n}\n\nexport const nizza = new NizzaStore();\n"],"names":["makeAutoObservable","NizzaStore","configure","config","_config","constructor","name","autoBind","nizza"],"mappings":"AACA,SAASA,kBAAkB,QAAQ,OAAO;AAE1C,OAAO,MAAMC;IAOXC,UAAUC,MAA0B,EAAE;QACpC,IAAI,CAACC,OAAO,GAAGD;IACjB;IAEA,IAAIA,SAAS;QACX,OAAO,IAAI,CAACC,OAAO;IACrB;IAVAC,aAAc;QACZL,mBAAmB,IAAI,EAAE,CAAC,GAAG;YAAEM,MAAM;YAAcC,UAAU,IAAI;QAAC;IACpE;AASF,CAAC;AAED,OAAO,MAAMC,QAAQ,IAAIP,aAAa"}
|