ngssm-data 20.3.2 → 20.3.3

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.
@@ -1,15 +1,27 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, Injectable, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';
3
- import { updateNgssmDataState, NgssmDataSourceValueStatus, NgssmDataStateSpecification, NGSSM_DATA_SOURCE } from 'ngssm-data';
3
+ import { updateNgssmDataState, NgssmDataSourceValueStatus, selectNgssmDataSourceValue, NgssmDataStateSpecification, NGSSM_DATA_SOURCE } from 'ngssm-data';
4
4
  import { Store, Logger } from 'ngssm-store';
5
5
  import { StoreMock } from 'ngssm-store/testing';
6
6
  import { TestBed } from '@angular/core/testing';
7
7
 
8
+ /**
9
+ * Utility service for setting and updating data source values, status, parameters, and additional properties
10
+ * in the StoreMock during tests. Provides methods for manipulating the test state of data sources.
11
+ */
8
12
  class NgssmDataSourceValueSetter {
9
13
  constructor() {
10
14
  this.store = inject(Store);
11
15
  }
16
+ /**
17
+ * Sets the status of a data source in the StoreMock.
18
+ * Throws an error if the data source is not found.
19
+ * @param datasourceKey The key of the data source.
20
+ * @param status The new status to set.
21
+ * @returns The NgssmDataSourceValueSetter instance for chaining.
22
+ */
12
23
  setDataSourceStatus(datasourceKey, status) {
24
+ this.checkDataSource(datasourceKey);
13
25
  this.store.stateValue = updateNgssmDataState(this.store.stateValue, {
14
26
  dataSourceValues: {
15
27
  [datasourceKey]: {
@@ -19,7 +31,15 @@ class NgssmDataSourceValueSetter {
19
31
  });
20
32
  return this;
21
33
  }
34
+ /**
35
+ * Sets the value of a data source in the StoreMock.
36
+ * Throws an error if the data source is not found.
37
+ * @param datasourceKey The key of the data source.
38
+ * @param value The value to set.
39
+ * @returns The NgssmDataSourceValueSetter instance for chaining.
40
+ */
22
41
  setDataSourceValue(datasourceKey, value) {
42
+ this.checkDataSource(datasourceKey);
23
43
  this.store.stateValue = updateNgssmDataState(this.store.stateValue, {
24
44
  dataSourceValues: {
25
45
  [datasourceKey]: {
@@ -29,7 +49,15 @@ class NgssmDataSourceValueSetter {
29
49
  });
30
50
  return this;
31
51
  }
52
+ /**
53
+ * Sets the parameter of a data source in the StoreMock.
54
+ * Throws an error if the data source is not found.
55
+ * @param datasourceKey The key of the data source.
56
+ * @param value The parameter value to set.
57
+ * @returns The NgssmDataSourceValueSetter instance for chaining.
58
+ */
32
59
  setDataSourceParameter(datasourceKey, value) {
60
+ this.checkDataSource(datasourceKey);
33
61
  this.store.stateValue = updateNgssmDataState(this.store.stateValue, {
34
62
  dataSourceValues: {
35
63
  [datasourceKey]: {
@@ -39,7 +67,17 @@ class NgssmDataSourceValueSetter {
39
67
  });
40
68
  return this;
41
69
  }
70
+ /**
71
+ * Sets an additional property for a data source in the StoreMock.
72
+ * Throws an error if the data source is not found.
73
+ * @param datasourceKey The key of the data source.
74
+ * @param additionalProperty The name of the additional property.
75
+ * @param value The value to set for the additional property.
76
+ * @param status The status to set for the additional property (defaults to loaded).
77
+ * @returns The NgssmDataSourceValueSetter instance for chaining.
78
+ */
42
79
  setAdditionalProperty(datasourceKey, additionalProperty, value, status = NgssmDataSourceValueStatus.loaded) {
80
+ this.checkDataSource(datasourceKey);
43
81
  this.store.stateValue = updateNgssmDataState(this.store.stateValue, {
44
82
  dataSourceValues: {
45
83
  [datasourceKey]: {
@@ -56,6 +94,17 @@ class NgssmDataSourceValueSetter {
56
94
  });
57
95
  return this;
58
96
  }
97
+ /**
98
+ * Checks if the specified data source is initialized in the StoreMock.
99
+ * Throws an error if the data source is not found.
100
+ * @param datasourceKey The key of the data source to check.
101
+ */
102
+ checkDataSource(datasourceKey) {
103
+ const dataSourceValue = selectNgssmDataSourceValue(this.store.stateValue, datasourceKey);
104
+ if (!dataSourceValue) {
105
+ throw new Error(`Data source '${datasourceKey}' is not initialized.`);
106
+ }
107
+ }
59
108
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: NgssmDataSourceValueSetter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
60
109
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: NgssmDataSourceValueSetter }); }
61
110
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ngssm-data-testing.mjs","sources":["../../../projects/ngssm-data/testing/src/ngssm-data-source-value-setter.ts","../../../projects/ngssm-data/testing/src/provide-ngssm-data-testing.ts","../../../projects/ngssm-data/testing/ngssm-data-testing.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { TestBed } from '@angular/core/testing';\nimport { NgssmDataSourceValueStatus, updateNgssmDataState } from 'ngssm-data';\n\nimport { Store } from 'ngssm-store';\nimport { StoreMock } from 'ngssm-store/testing';\n\n@Injectable()\nexport class NgssmDataSourceValueSetter {\n public readonly store = inject(Store) as unknown as StoreMock;\n\n public setDataSourceStatus(datasourceKey: string, status: NgssmDataSourceValueStatus): NgssmDataSourceValueSetter {\n this.store.stateValue = updateNgssmDataState(this.store.stateValue, {\n dataSourceValues: {\n [datasourceKey]: {\n status: { $set: status }\n }\n }\n });\n\n return this;\n }\n\n public setDataSourceValue<T>(datasourceKey: string, value?: T): NgssmDataSourceValueSetter {\n this.store.stateValue = updateNgssmDataState(this.store.stateValue, {\n dataSourceValues: {\n [datasourceKey]: {\n value: { $set: value }\n }\n }\n });\n\n return this;\n }\n\n public setDataSourceParameter<T>(datasourceKey: string, value?: T): NgssmDataSourceValueSetter {\n this.store.stateValue = updateNgssmDataState(this.store.stateValue, {\n dataSourceValues: {\n [datasourceKey]: {\n parameter: { $set: value }\n }\n }\n });\n\n return this;\n }\n\n public setAdditionalProperty<T>(\n datasourceKey: string,\n additionalProperty: string,\n value?: T,\n status: NgssmDataSourceValueStatus = NgssmDataSourceValueStatus.loaded\n ): NgssmDataSourceValueSetter {\n this.store.stateValue = updateNgssmDataState(this.store.stateValue, {\n dataSourceValues: {\n [datasourceKey]: {\n additionalProperties: {\n [additionalProperty]: {\n $set: {\n value,\n status\n }\n }\n }\n }\n }\n });\n\n return this;\n }\n}\n\nexport const ngssmDataSourceValueSetter = () => TestBed.inject(NgssmDataSourceValueSetter);\n","import { EnvironmentProviders, inject, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';\n\nimport {\n NGSSM_DATA_SOURCE,\n NgssmDataSource,\n NgssmDataSourceValueStatus,\n NgssmDataStateSpecification,\n updateNgssmDataState\n} from 'ngssm-data';\nimport { Logger, Store } from 'ngssm-store';\nimport { StoreMock } from 'ngssm-store/testing';\n\nimport { NgssmDataSourceValueSetter } from './ngssm-data-source-value-setter';\n\nexport const ngssmDataStateAndSourcesInitializer = () => {\n const logger = inject(Logger);\n logger.information('[ngssm-data-testing] Initialization of state and sources');\n const store = inject(Store);\n if (!(store instanceof StoreMock)) {\n throw new Error('StoreMock is not registered.');\n }\n\n store.stateValue = {\n ...store.stateValue,\n [NgssmDataStateSpecification.featureStateKey]: NgssmDataStateSpecification.initialState\n };\n\n const dataSources = (inject(NGSSM_DATA_SOURCE, { optional: true }) as unknown as NgssmDataSource[]) ?? [];\n store.stateValue = dataSources.reduce((previous, current) => {\n return updateNgssmDataState(previous, {\n dataSourceValues: {\n [current.key]: {\n $set: {\n status: NgssmDataSourceValueStatus.none,\n additionalProperties: {}\n }\n }\n }\n });\n }, store.stateValue);\n};\n\nexport const provideNgssmDataTesting = (): EnvironmentProviders => {\n return makeEnvironmentProviders([provideAppInitializer(ngssmDataStateAndSourcesInitializer), NgssmDataSourceValueSetter]);\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;MAQa,0BAA0B,CAAA;AADvC,IAAA,WAAA,GAAA;AAEkB,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,KAAK,CAAyB;AA6D9D,IAAA;IA3DQ,mBAAmB,CAAC,aAAqB,EAAE,MAAkC,EAAA;AAClF,QA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uBAAuB,GAAG,MAA2B;IAChE,OAAO,wBAAwB,CAAC,CAAC,qBAAqB,CAAC,mCAAmC,CAAC,EAAE,0BAA0B,CAAC,CAAC;AAC3H;;AC5CA;;AAEG;;;;"}
1
+ {"version":3,"file":"ngssm-data-testing.mjs","sources":["../../../projects/ngssm-data/testing/src/ngssm-data-source-value-setter.ts","../../../projects/ngssm-data/testing/src/provide-ngssm-data-testing.ts","../../../projects/ngssm-data/testing/ngssm-data-testing.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { TestBed } from '@angular/core/testing';\nimport { NgssmDataSourceValueStatus, selectNgssmDataSourceValue, updateNgssmDataState } from 'ngssm-data';\n\nimport { Store } from 'ngssm-store';\nimport { StoreMock } from 'ngssm-store/testing';\n\n/**\n * Utility service for setting and updating data source values, status, parameters, and additional properties\n * in the StoreMock during tests. Provides methods for manipulating the test state of data sources.\n */\n@Injectable()\nexport class NgssmDataSourceValueSetter {\n public readonly store = inject(Store) as unknown as StoreMock;\n\n /**\n * Sets the status of a data source in the StoreMock.\n * Throws an error if the data source is not found.\n * @param datasourceKey The key of the data source.\n * @param status The new status to set.\n * @returns The NgssmDataSourceValueSetter instance for chaining.\n */\n public setDataSourceStatus(datasourceKey: string, status: NgssmDataSourceValueStatus): NgssmDataSourceValueSetter {\n this.checkDataSource(datasourceKey);\n this.store.stateValue = updateNgssmDataState(this.store.stateValue, {\n dataSourceValues: {\n [datasourceKey]: {\n status: { $set: status }\n }\n }\n });\n\n return this;\n }\n\n /**\n * Sets the value of a data source in the StoreMock.\n * Throws an error if the data source is not found.\n * @param datasourceKey The key of the data source.\n * @param value The value to set.\n * @returns The NgssmDataSourceValueSetter instance for chaining.\n */\n public setDataSourceValue<T>(datasourceKey: string, value?: T): NgssmDataSourceValueSetter {\n this.checkDataSource(datasourceKey);\n this.store.stateValue = updateNgssmDataState(this.store.stateValue, {\n dataSourceValues: {\n [datasourceKey]: {\n value: { $set: value }\n }\n }\n });\n\n return this;\n }\n\n /**\n * Sets the parameter of a data source in the StoreMock.\n * Throws an error if the data source is not found.\n * @param datasourceKey The key of the data source.\n * @param value The parameter value to set.\n * @returns The NgssmDataSourceValueSetter instance for chaining.\n */\n public setDataSourceParameter<T>(datasourceKey: string, value?: T): NgssmDataSourceValueSetter {\n this.checkDataSource(datasourceKey);\n this.store.stateValue = updateNgssmDataState(this.store.stateValue, {\n dataSourceValues: {\n [datasourceKey]: {\n parameter: { $set: value }\n }\n }\n });\n\n return this;\n }\n\n /**\n * Sets an additional property for a data source in the StoreMock.\n * Throws an error if the data source is not found.\n * @param datasourceKey The key of the data source.\n * @param additionalProperty The name of the additional property.\n * @param value The value to set for the additional property.\n * @param status The status to set for the additional property (defaults to loaded).\n * @returns The NgssmDataSourceValueSetter instance for chaining.\n */\n public setAdditionalProperty<T>(\n datasourceKey: string,\n additionalProperty: string,\n value?: T,\n status: NgssmDataSourceValueStatus = NgssmDataSourceValueStatus.loaded\n ): NgssmDataSourceValueSetter {\n this.checkDataSource(datasourceKey);\n this.store.stateValue = updateNgssmDataState(this.store.stateValue, {\n dataSourceValues: {\n [datasourceKey]: {\n additionalProperties: {\n [additionalProperty]: {\n $set: {\n value,\n status\n }\n }\n }\n }\n }\n });\n\n return this;\n }\n\n /**\n * Checks if the specified data source is initialized in the StoreMock.\n * Throws an error if the data source is not found.\n * @param datasourceKey The key of the data source to check.\n */\n public checkDataSource(datasourceKey: string) {\n const dataSourceValue = selectNgssmDataSourceValue(this.store.stateValue, datasourceKey);\n if (!dataSourceValue) {\n throw new Error(`Data source '${datasourceKey}' is not initialized.`);\n }\n }\n}\n\nexport const ngssmDataSourceValueSetter = () => TestBed.inject(NgssmDataSourceValueSetter);\n","import { EnvironmentProviders, inject, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';\n\nimport {\n NGSSM_DATA_SOURCE,\n NgssmDataSource,\n NgssmDataSourceValueStatus,\n NgssmDataStateSpecification,\n updateNgssmDataState\n} from 'ngssm-data';\nimport { Logger, Store } from 'ngssm-store';\nimport { StoreMock } from 'ngssm-store/testing';\n\nimport { NgssmDataSourceValueSetter } from './ngssm-data-source-value-setter';\n\nexport const ngssmDataStateAndSourcesInitializer = () => {\n const logger = inject(Logger);\n logger.information('[ngssm-data-testing] Initialization of state and sources');\n const store = inject(Store);\n if (!(store instanceof StoreMock)) {\n throw new Error('StoreMock is not registered.');\n }\n\n store.stateValue = {\n ...store.stateValue,\n [NgssmDataStateSpecification.featureStateKey]: NgssmDataStateSpecification.initialState\n };\n\n const dataSources = (inject(NGSSM_DATA_SOURCE, { optional: true }) as unknown as NgssmDataSource[]) ?? [];\n store.stateValue = dataSources.reduce((previous, current) => {\n return updateNgssmDataState(previous, {\n dataSourceValues: {\n [current.key]: {\n $set: {\n status: NgssmDataSourceValueStatus.none,\n additionalProperties: {}\n }\n }\n }\n });\n }, store.stateValue);\n};\n\nexport const provideNgssmDataTesting = (): EnvironmentProviders => {\n return makeEnvironmentProviders([provideAppInitializer(ngssmDataStateAndSourcesInitializer), NgssmDataSourceValueSetter]);\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;AAOA;;;AAGG;MAEU,0BAA0B,CAAA;AADvC,IAAA,WAAA,GAAA;AAEkB,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,KAAK,CAAyB;AA2G9D,IAAA;AAzGC;;;;;;AAMG;IACI,mBAAmB,CAAC,aAAqB,EAAE,MAAkC,EAAA;AAClF,QAAA,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;AACnC,QAAA,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;AAClE,YAAA,gBAAgB,EAAE;gBAChB,CAAC,aAAa,GAAG;AACf,oBAAA,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM;AACvB;AACF;AACF,SAAA,CAAC;AAEF,QAAA,OAAO,IAAI;IACb;AAEA;;;;;;AA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AG,GAAG;AACb,oBAAA,IAAI,EAAE;wBACJ,MAAM,EAAE,0BAA0B,CAAC,IAAI;AACvC,wBAAA,oBAAoB,EAAE;AACvB;AACF;AACF;AACF,SAAA,CAAC;AACJ,IAAA,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;AACtB;AAEO,MAAM,uBAAuB,GAAG,MAA2B;IAChE,OAAO,wBAAwB,CAAC,CAAC,qBAAqB,CAAC,mCAAmC,CAAC,EAAE,0BAA0B,CAAC,CAAC;AAC3H;;AC5CA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngssm-data",
3
- "version": "20.3.2",
3
+ "version": "20.3.3",
4
4
  "description": "NgSsm - Library used to facilitate the management of data get from remote service or computed locally.",
5
5
  "author": "Lion Marc",
6
6
  "license": "MIT",
@@ -6,12 +6,52 @@ import { StoreMock } from 'ngssm-store/testing';
6
6
  declare const ngssmDataStateAndSourcesInitializer: () => void;
7
7
  declare const provideNgssmDataTesting: () => EnvironmentProviders;
8
8
 
9
+ /**
10
+ * Utility service for setting and updating data source values, status, parameters, and additional properties
11
+ * in the StoreMock during tests. Provides methods for manipulating the test state of data sources.
12
+ */
9
13
  declare class NgssmDataSourceValueSetter {
10
14
  readonly store: StoreMock;
15
+ /**
16
+ * Sets the status of a data source in the StoreMock.
17
+ * Throws an error if the data source is not found.
18
+ * @param datasourceKey The key of the data source.
19
+ * @param status The new status to set.
20
+ * @returns The NgssmDataSourceValueSetter instance for chaining.
21
+ */
11
22
  setDataSourceStatus(datasourceKey: string, status: NgssmDataSourceValueStatus): NgssmDataSourceValueSetter;
23
+ /**
24
+ * Sets the value of a data source in the StoreMock.
25
+ * Throws an error if the data source is not found.
26
+ * @param datasourceKey The key of the data source.
27
+ * @param value The value to set.
28
+ * @returns The NgssmDataSourceValueSetter instance for chaining.
29
+ */
12
30
  setDataSourceValue<T>(datasourceKey: string, value?: T): NgssmDataSourceValueSetter;
31
+ /**
32
+ * Sets the parameter of a data source in the StoreMock.
33
+ * Throws an error if the data source is not found.
34
+ * @param datasourceKey The key of the data source.
35
+ * @param value The parameter value to set.
36
+ * @returns The NgssmDataSourceValueSetter instance for chaining.
37
+ */
13
38
  setDataSourceParameter<T>(datasourceKey: string, value?: T): NgssmDataSourceValueSetter;
39
+ /**
40
+ * Sets an additional property for a data source in the StoreMock.
41
+ * Throws an error if the data source is not found.
42
+ * @param datasourceKey The key of the data source.
43
+ * @param additionalProperty The name of the additional property.
44
+ * @param value The value to set for the additional property.
45
+ * @param status The status to set for the additional property (defaults to loaded).
46
+ * @returns The NgssmDataSourceValueSetter instance for chaining.
47
+ */
14
48
  setAdditionalProperty<T>(datasourceKey: string, additionalProperty: string, value?: T, status?: NgssmDataSourceValueStatus): NgssmDataSourceValueSetter;
49
+ /**
50
+ * Checks if the specified data source is initialized in the StoreMock.
51
+ * Throws an error if the data source is not found.
52
+ * @param datasourceKey The key of the data source to check.
53
+ */
54
+ checkDataSource(datasourceKey: string): void;
15
55
  static ɵfac: i0.ɵɵFactoryDeclaration<NgssmDataSourceValueSetter, never>;
16
56
  static ɵprov: i0.ɵɵInjectableDeclaration<NgssmDataSourceValueSetter>;
17
57
  }