@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.
Files changed (61) hide show
  1. package/package.json +4 -2
  2. package/src/environments/{environment.js → development.js} +3 -3
  3. package/src/environments/{environment.js.map → development.js.map} +1 -1
  4. package/src/environments/index.d.ts +60 -0
  5. package/src/environments/index.js +11 -0
  6. package/src/environments/index.js.map +1 -0
  7. package/src/environments/{environment.prod.js → production.js} +3 -3
  8. package/src/environments/production.js.map +1 -0
  9. package/src/environments/{environment.staging.js → staging.js} +3 -3
  10. package/src/environments/staging.js.map +1 -0
  11. package/src/index.d.ts +1 -0
  12. package/src/index.js +1 -0
  13. package/src/index.js.map +1 -1
  14. package/src/lib/domain/AggregateRoot.js +12 -23
  15. package/src/lib/domain/AggregateRoot.js.map +1 -1
  16. package/src/lib/domain/BaseMobxStore.js +2 -3
  17. package/src/lib/domain/BaseMobxStore.js.map +1 -1
  18. package/src/lib/domain/ValueObject.js +6 -14
  19. package/src/lib/domain/ValueObject.js.map +1 -1
  20. package/src/lib/domain/errors/DomainError.js +9 -17
  21. package/src/lib/domain/errors/DomainError.js.map +1 -1
  22. package/src/lib/domain/errors/api.js +4 -8
  23. package/src/lib/domain/errors/api.js.map +1 -1
  24. package/src/lib/domain/errors/app.js +8 -15
  25. package/src/lib/domain/errors/app.js.map +1 -1
  26. package/src/lib/providers/StoreProvider.js +14 -15
  27. package/src/lib/providers/StoreProvider.js.map +1 -1
  28. package/src/lib/stores/NizzaStore.js +10 -19
  29. package/src/lib/stores/NizzaStore.js.map +1 -1
  30. package/src/lib/types/api-graphql-types.js +1176 -1176
  31. package/src/lib/types/api-graphql-types.js.map +1 -1
  32. package/src/lib/types/utils.d.ts +1 -1
  33. package/src/lib/types/utils.js +2 -3
  34. package/src/lib/types/utils.js.map +1 -1
  35. package/src/lib/utils/Result.js +39 -54
  36. package/src/lib/utils/Result.js.map +1 -1
  37. package/src/lib/utils/apiCall.js +23 -52
  38. package/src/lib/utils/apiCall.js.map +1 -1
  39. package/src/lib/utils/customStorage/MemoryStorage.js +25 -34
  40. package/src/lib/utils/customStorage/MemoryStorage.js.map +1 -1
  41. package/src/lib/utils/customStorage/index.js +20 -30
  42. package/src/lib/utils/customStorage/index.js.map +1 -1
  43. package/src/lib/utils/customStorage/utils.js +3 -3
  44. package/src/lib/utils/customStorage/utils.js.map +1 -1
  45. package/src/lib/utils/fingerprint.js +3 -3
  46. package/src/lib/utils/fingerprint.js.map +1 -1
  47. package/src/lib/utils/helpers.js +8 -13
  48. package/src/lib/utils/helpers.js.map +1 -1
  49. package/src/lib/utils/lazyLoad.js +9 -16
  50. package/src/lib/utils/lazyLoad.js.map +1 -1
  51. package/src/environments/environment.d.js +0 -3
  52. package/src/environments/environment.d.js.map +0 -1
  53. package/src/environments/environment.prod.d.js +0 -3
  54. package/src/environments/environment.prod.d.js.map +0 -1
  55. package/src/environments/environment.prod.js.map +0 -1
  56. package/src/environments/environment.staging.d.js +0 -3
  57. package/src/environments/environment.staging.d.js.map +0 -1
  58. package/src/environments/environment.staging.js.map +0 -1
  59. /package/src/environments/{environment.d.ts → development.d.ts} +0 -0
  60. /package/src/environments/{environment.prod.d.ts → production.d.ts} +0 -0
  61. /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",
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
- var _env = import.meta.env, NZ_AWS_REGION = _env.NZ_AWS_REGION, NZ_BACKOFFICE_BACK_URL = _env.NZ_BACKOFFICE_BACK_URL, NZ_CORE_SERVICES_GRAPHQL_URL = _env.NZ_CORE_SERVICES_GRAPHQL_URL, NZ_CORE_SERVICES_REST_URL = _env.NZ_CORE_SERVICES_REST_URL;
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 var environment = {
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=environment.js.map
28
+ //# sourceMappingURL=development.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/environments/environment.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":["env","NZ_AWS_REGION","NZ_BACKOFFICE_BACK_URL","NZ_CORE_SERVICES_GRAPHQL_URL","NZ_CORE_SERVICES_REST_URL","environment","AWS","region","cognito","userPoolId","userPoolWebClientId","apiUrls","restV1","restV2","graphql","publicUrls","platformSite","nizzaCdn","bundleSite"],"mappings":"AAAA,IAKI,OAAA,YAAYA,GAAG,EAJjBC,gBAIE,KAJFA,eACAC,yBAGE,KAHFA,wBACAC,+BAEE,KAFFA,8BACAC,4BACE,KADFA;AAGF,qDAAqD;AAErD,OAAO,IAAMC,cAAc;IACzBC,KAAK;QACHC,QAAQN;QACRO,SAAS;YACPC,YAAY;YACZC,qBAAqB;QACvB;IACF;IAEA,iBAAiB;IACjBC,SAAS;QACPC,QACEV,0BACA;QACFW,QACET,6BAA6B;QAC/BU,SACEX,gCACA;IACJ;IAEAY,YAAY;QACV,kBAAkB;QAClBC,cAAc;QAEd,YAAY;QACZC,UAAU;QAEV,UAAU;QACVC,YAAY;IACd;AACF,EAAE;AAEF,eAAeb,YAAY"}
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,11 @@
1
+ import dev from './development';
2
+ import prod from './production';
3
+ import staging from './staging';
4
+ export const env = {
5
+ dev,
6
+ prod,
7
+ staging
8
+ };
9
+ export default env;
10
+
11
+ //# sourceMappingURL=index.js.map
@@ -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
- var _env = import.meta.env, NZ_AWS_REGION = _env.NZ_AWS_REGION, NZ_BACKOFFICE_BACK_URL = _env.NZ_BACKOFFICE_BACK_URL, NZ_CORE_SERVICES_GRAPHQL_URL = _env.NZ_CORE_SERVICES_GRAPHQL_URL, NZ_CORE_SERVICES_REST_URL = _env.NZ_CORE_SERVICES_REST_URL;
2
- export var environment = {
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=environment.prod.js.map
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
- var _env = import.meta.env, NZ_AWS_REGION = _env.NZ_AWS_REGION, NZ_BACKOFFICE_BACK_URL = _env.NZ_BACKOFFICE_BACK_URL, NZ_CORE_SERVICES_GRAPHQL_URL = _env.NZ_CORE_SERVICES_GRAPHQL_URL, NZ_CORE_SERVICES_REST_URL = _env.NZ_CORE_SERVICES_REST_URL;
2
- export var environment = {
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=environment.staging.js.map
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
@@ -1,3 +1,4 @@
1
+ export * from './environments';
1
2
  export * from './lib/constants';
2
3
  export * from './lib/domain';
3
4
  export * from './lib/providers';
package/src/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './environments';
1
2
  export * from './lib/constants';
2
3
  export * from './lib/domain';
3
4
  export * from './lib/providers';
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
- import { _ as _create_class } from "@swc/helpers/_/_create_class";
2
- import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
3
- export var AggregateRoot = /*#__PURE__*/ function() {
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
- _create_class(AggregateRoot, [
20
- {
21
- key: "isFirstSetProps",
22
- get: function get() {
23
- return this._numSetPropsApplied === 1;
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","aggregate","_numSetPropsApplied","setProps","props","Object","entries","key","value","isFirstSetProps","createAggregateRoot"],"mappings":";;AAIA,OAAO,IAAA,AAAMA,8BAuBV,AAvBI;;aAAMA,cAICC,SAAoB;aAFxBC,sBAAsB;QAG5B,IAAI,CAACD,SAAS,GAAGA;;iBALRD;IAQXG,OAAAA,QAQC,GARDA,SAAAA,SAASC,KAAqB,EAAE;QAC9B,gBAA2BC,kBAAAA,OAAOC,OAAO,CAACF,aAAfC,6BAAuB;sDAAvBA,yBAAfE,6BAAKC;YACf,IAAID,OAAO,AAAC,IAAI,CAASN,SAAS,EAAE;gBACjC,IAAI,CAACA,SAAS,AAAQ,CAACM,IAAI,GAAGC;YACjC,CAAC;QACH;QAEA,IAAI,CAACN,mBAAmB;IAC1B;kBAhBWF;;YAkBPS,KAAAA;iBAAJ,eAAsB;gBACpB,OAAO,IAAI,CAACP,mBAAmB,KAAK;YACtC;;;WApBWF;IAqBZ;AAED,OAAO,SAASU,oBAAsCT,SAAoB,EAAE;IAC1E,OAAO,IAAID,cAAgCC;AAC7C,CAAC"}
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,5 +1,4 @@
1
- export var BaseMobxStore = function BaseMobxStore() {
2
- "use strict";
3
- };
1
+ export class BaseMobxStore {
2
+ }
4
3
 
5
4
  //# sourceMappingURL=BaseMobxStore.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/domain/BaseMobxStore.ts"],"sourcesContent":["export abstract class BaseMobxStore {}\n"],"names":["BaseMobxStore"],"mappings":"AAAA,OAAO,IAAA,AAAeA,gBAAf,SAAeA;;EAAgB"}
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
- import { _ as _create_class } from "@swc/helpers/_/_create_class";
2
- export var ValueObject = /*#__PURE__*/ function() {
3
- "use strict";
4
- function ValueObject(value) {
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
- _create_class(ValueObject, [
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","undefined","_value"],"mappings":";AAAA,OAAO,IAAA,AAAeA,4BAAf;;aAAeA,YAGRC,KAAS;QACnB,IAAIA,UAAUC,WAAW;YACvB,IAAI,CAACC,MAAM,GAAGF;QAChB,CAAC;;kBANiBD;;YAShBC,KAAAA;iBAAJ,eAAY;gBACV,OAAO,IAAI,CAACE,MAAM;YACpB;;;WAXoBH;IAYrB"}
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
- import { _ as _inherits } from "@swc/helpers/_/_inherits";
3
- import { _ as _wrap_native_super } from "@swc/helpers/_/_wrap_native_super";
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
- return DomainError;
24
- }(_wrap_native_super(Error));
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","toDTO","Error"],"mappings":";;;AAMA,OAAO,IAAA,AAAMA,4BANV,AAMI;;cAAMA;aAAAA,YACCC,IAAY,EAAEC,OAAe,EAASC;;kCAC1CD;sBAD0CC;QAEhD,MAAKF,IAAI,GAAGA;;;iBAHHD;IAMXI,OAAAA,KAMC,GANDA,SAAAA,QAAwB;QACtB,OAAO;YACLH,MAAM,IAAI,CAACA,IAAI;YACfC,SAAS,IAAI,CAACA,OAAO;WACjB,IAAI,CAACC,KAAK,IAAI;YAAEA,OAAO,IAAI,CAACA,KAAK;QAAC;IAE1C;WAZWH;qBAAoBK,QAahC"}
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 var ResourceNotFoundError = /*#__PURE__*/ function(DomainError) {
4
- "use strict";
5
- _inherits(ResourceNotFoundError, DomainError);
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
- return ResourceNotFoundError;
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":";AAAA,SAASA,WAAW,QAAQ,gBAAgB;AAE5C,OAAO,IAAA,AAAMC,sCAFV,AAEI;;cAAMA;aAAAA,sBACCC,EAAU;sCAElB,4BACA,AAAC,uBAAoBA,KAAG,gBACxBA;;WALOD;EAA8BD,aAQ1C"}
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 var UnexpectedError = /*#__PURE__*/ function(DomainError) {
4
- "use strict";
5
- _inherits(UnexpectedError, DomainError);
6
- function UnexpectedError(error) {
2
+ export class UnexpectedError extends DomainError {
3
+ constructor(error){
7
4
  var _error_message;
8
- return DomainError.call(this, 'APP_UNEXPECTED_ERROR', (_error_message = error.message) != null ? _error_message : "An unexpected error occurred.", error);
5
+ super('APP_UNEXPECTED_ERROR', (_error_message = error.message) != null ? _error_message : `An unexpected error occurred.`, error);
9
6
  }
10
- return UnexpectedError;
11
- }(DomainError);
12
- export var AccountInvalidError = /*#__PURE__*/ function(DomainError) {
13
- "use strict";
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
- return AccountInvalidError;
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":";AAAA,SAASA,WAAW,QAAQ,gBAAgB;AAE5C,OAAO,IAAA,AAAMC,gCAUV,AAVI;;cAAMA;aAAAA,gBACCC,KAAsB;YAG9B;sCADA,wBACA,CAAA,iBAAA,AAACA,MAAgBC,OAAO,YAAxB,iBAA6B,+BAA8B,EAC3DD;;WALOD;EAAwBD,aAQpC;AAED,OAAO,IAAA,AAAMI,oCAAN;;cAAMA;aAAAA;sCAEH,6BAA8B;;WAF3BA;EAA4BJ,aAIxC"}
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
- var globalStores = new Map();
4
- var storeContext = /*#__PURE__*/ createContext(globalStores);
5
- export var StoreProvider = function(param) {
6
- var children = param.children, stores = param.stores, instances = param.instances;
7
- var parentContext = useContext(storeContext);
8
- var context = useMemo(function() {
9
- var container = new Map();
10
- stores.forEach(function(store) {
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(function(instance_) {
20
- return container.set(instance_.constructor, instance_);
21
- });
22
- return globalStores = new Map(_to_consumable_array(parentContext).concat(_to_consumable_array(container)));
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
- var context = useContext(storeContext);
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":";AAAA,SAASA,aAAa,EAAMC,UAAU,EAAEC,OAAO,QAAQ,QAAQ;AAS/D,IAAIC,eAAe,IAAIC;AACvB,IAAMC,6BAAeL,cAAmCG;AAExD,OAAO,IAAMG,gBAA2B,gBAAqC;QAAlCC,iBAAAA,UAAUC,eAAAA,QAAQC,kBAAAA;IAC3D,IAAMC,gBAAgBT,WAAWI;IAEjC,IAAMM,UAAUT,QAAQ,WAAM;QAC5B,IAAMU,YAAY,IAAIR;QACtBI,OAAOK,OAAO,CAACC,SAAAA,OAAS;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,SAAAA;mBACjBN,UAAUK,GAAG,CAACC,UAAUC,WAAW,EAAED;;QAGvC,OAAQf,eAAe,IAAIC,IAAI,AAAC,qBAAGM,sBAAe,qBAAGE;IACrD,uDAAuD;IACzD,GAAG,EAAE;IAEL,qBACE,oBAACP,aAAae,QAAQ;QAACC,OAAOV;OAAUJ;AAE5C,EAAE;AAEF,OAAO,SAASe,SAAYC,UAAyB,EAAK;IACxD,IAAMZ,UAAUV,WAAWI;IAC3B,OAAOM,QAAQa,GAAG,CAACD;AACrB,CAAC;AAED,OAAO,SAASE,SAAYF,UAAyB,EAAK;IACxD,OAAOpB,aAAaqB,GAAG,CAACD;AAC1B,CAAC"}
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 var NizzaStore = /*#__PURE__*/ function() {
4
- "use strict";
5
- function NizzaStore() {
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
- var _proto = NizzaStore.prototype;
12
- _proto.configure = function configure(config) {
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","name","autoBind","configure","config","_config","nizza"],"mappings":";AACA,SAASA,kBAAkB,QAAQ,OAAO;AAE1C,OAAO,IAAA,AAAMC,2BAgBV,AAhBI;;aAAMA;QAITD,mBAAmB,IAAI,EAAE,CAAC,GAAG;YAAEE,MAAM;YAAcC,UAAU,IAAI;QAAC;;iBAJzDF;IAOXG,OAAAA,SAEC,GAFDA,SAAAA,UAAUC,MAA0B,EAAE;QACpC,IAAI,CAACC,OAAO,GAAGD;IACjB;kBATWJ;;YAWPI,KAAAA;iBAAJ,eAAa;gBACX,OAAO,IAAI,CAACC,OAAO;YACrB;;;WAbWL;IAcZ;AAED,OAAO,IAAMM,QAAQ,IAAIN,aAAa"}
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"}