@cratis/chronicle 6.1.0 → 6.2.0

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 (77) hide show
  1. package/artifacts/DefaultClientArtifactsProvider.ts +5 -0
  2. package/artifacts/IClientArtifactsProvider.ts +3 -0
  3. package/dist/artifacts/DefaultClientArtifactsProvider.d.ts +2 -0
  4. package/dist/artifacts/DefaultClientArtifactsProvider.d.ts.map +1 -1
  5. package/dist/artifacts/DefaultClientArtifactsProvider.js +4 -0
  6. package/dist/artifacts/DefaultClientArtifactsProvider.js.map +1 -1
  7. package/dist/artifacts/IClientArtifactsProvider.d.ts +2 -0
  8. package/dist/artifacts/IClientArtifactsProvider.d.ts.map +1 -1
  9. package/dist/projections/GlobalHandlerPropertyNotOnVariant.d.ts +14 -0
  10. package/dist/projections/GlobalHandlerPropertyNotOnVariant.d.ts.map +1 -0
  11. package/dist/projections/GlobalHandlerPropertyNotOnVariant.js +19 -0
  12. package/dist/projections/GlobalHandlerPropertyNotOnVariant.js.map +1 -0
  13. package/dist/projections/Projections.d.ts +8 -0
  14. package/dist/projections/Projections.d.ts.map +1 -1
  15. package/dist/projections/Projections.js +81 -7
  16. package/dist/projections/Projections.js.map +1 -1
  17. package/dist/projections/VariantMustDeclareEntersOnEvent.d.ts +11 -0
  18. package/dist/projections/VariantMustDeclareEntersOnEvent.d.ts.map +1 -0
  19. package/dist/projections/VariantMustDeclareEntersOnEvent.js +16 -0
  20. package/dist/projections/VariantMustDeclareEntersOnEvent.js.map +1 -0
  21. package/dist/projections/VariantReclassifier.d.ts +63 -0
  22. package/dist/projections/VariantReclassifier.d.ts.map +1 -0
  23. package/dist/projections/VariantReclassifier.js +126 -0
  24. package/dist/projections/VariantReclassifier.js.map +1 -0
  25. package/dist/projections/declarative/IProjectionBuilderFor.d.ts +20 -0
  26. package/dist/projections/declarative/IProjectionBuilderFor.d.ts.map +1 -1
  27. package/dist/projections/declarative/ProjectionBuilderFor.d.ts +17 -1
  28. package/dist/projections/declarative/ProjectionBuilderFor.d.ts.map +1 -1
  29. package/dist/projections/declarative/ProjectionBuilderFor.js +34 -0
  30. package/dist/projections/declarative/ProjectionBuilderFor.js.map +1 -1
  31. package/dist/projections/index.d.ts +2 -0
  32. package/dist/projections/index.d.ts.map +1 -1
  33. package/dist/projections/index.js +2 -0
  34. package/dist/projections/index.js.map +1 -1
  35. package/dist/projections/modelBound/entersOn.d.ts +25 -0
  36. package/dist/projections/modelBound/entersOn.d.ts.map +1 -0
  37. package/dist/projections/modelBound/entersOn.js +28 -0
  38. package/dist/projections/modelBound/entersOn.js.map +1 -0
  39. package/dist/projections/modelBound/globalFor.d.ts +24 -0
  40. package/dist/projections/modelBound/globalFor.d.ts.map +1 -0
  41. package/dist/projections/modelBound/globalFor.js +31 -0
  42. package/dist/projections/modelBound/globalFor.js.map +1 -0
  43. package/dist/projections/modelBound/index.d.ts +6 -0
  44. package/dist/projections/modelBound/index.d.ts.map +1 -1
  45. package/dist/projections/modelBound/index.js +3 -0
  46. package/dist/projections/modelBound/index.js.map +1 -1
  47. package/dist/projections/modelBound/variantOf.d.ts +24 -0
  48. package/dist/projections/modelBound/variantOf.d.ts.map +1 -0
  49. package/dist/projections/modelBound/variantOf.js +27 -0
  50. package/dist/projections/modelBound/variantOf.js.map +1 -0
  51. package/dist/tsconfig.tsbuildinfo +1 -1
  52. package/dist/types/DecoratorType.d.ts +3 -1
  53. package/dist/types/DecoratorType.d.ts.map +1 -1
  54. package/dist/types/DecoratorType.js +2 -0
  55. package/dist/types/DecoratorType.js.map +1 -1
  56. package/events/for_EventContext/when_receiving/with_kernel_metadata.spec.ts +1 -1
  57. package/package.json +2 -2
  58. package/projections/GlobalHandlerPropertyNotOnVariant.ts +19 -0
  59. package/projections/Projections.childrenAndNested.spec.ts +2 -1
  60. package/projections/Projections.declarativeVariants.spec.ts +157 -0
  61. package/projections/Projections.modelBoundCompleteness.spec.ts +2 -1
  62. package/projections/Projections.operationalSurface.spec.ts +2 -1
  63. package/projections/Projections.spec.ts +2 -1
  64. package/projections/Projections.ts +98 -9
  65. package/projections/Projections.variants.spec.ts +253 -0
  66. package/projections/VariantMustDeclareEntersOnEvent.ts +16 -0
  67. package/projections/VariantReclassifier.ts +177 -0
  68. package/projections/declarative/IProjectionBuilderFor.ts +22 -0
  69. package/projections/declarative/ProjectionBuilderFor.ts +40 -1
  70. package/projections/index.ts +2 -0
  71. package/projections/modelBound/entersOn.ts +39 -0
  72. package/projections/modelBound/globalFor.ts +41 -0
  73. package/projections/modelBound/index.ts +6 -0
  74. package/projections/modelBound/variantOf.ts +38 -0
  75. package/readModels/ReadModels.spec.ts +2 -1
  76. package/reducers/Reducers.spec.ts +2 -1
  77. package/types/DecoratorType.ts +4 -1
@@ -1,3 +1,4 @@
1
+ import { PropertyAccessor } from '@cratis/fundamentals';
1
2
  import { IProjectionBuilder } from './IProjectionBuilder';
2
3
  /**
3
4
  * Defines the top-level projection builder for a specific read model type.
@@ -27,5 +28,24 @@ export interface IProjectionBuilderFor<TReadModel> extends IProjectionBuilder<TR
27
28
  * @returns This builder for fluent chaining.
28
29
  */
29
30
  passive(): IProjectionBuilderFor<TReadModel>;
31
+ /**
32
+ * Declares this projection to be one of several mutually exclusive representations of the
33
+ * same logical entity. Entering one variant removes the entity from every sibling variant
34
+ * of the same identity.
35
+ * @param identity - The type anchoring the logical identity shared by every variant. Does not need to be a read model itself.
36
+ * @param keyAccessor - Accessor for the property on this variant used as its own key.
37
+ * @returns This builder for fluent chaining.
38
+ */
39
+ variantOf(identity: Function, keyAccessor: PropertyAccessor<TReadModel>): IProjectionBuilderFor<TReadModel>;
40
+ /**
41
+ * Names an event that may create or resurrect this variant. Repeatable - a variant may enter
42
+ * on more than one event. Every other event this projection is built from is automatically
43
+ * reclassified into an update-only join: it can bring an already-active instance up to date,
44
+ * but it can never create or resurrect one.
45
+ * @param eventType - The event constructor.
46
+ * @param key - Optional event property name used as the key. Defaults to the event source identifier.
47
+ * @returns This builder for fluent chaining.
48
+ */
49
+ entersOn(eventType: Function, key?: string): IProjectionBuilderFor<TReadModel>;
30
50
  }
31
51
  //# sourceMappingURL=IProjectionBuilderFor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IProjectionBuilderFor.d.ts","sourceRoot":"","sources":["../../../projections/declarative/IProjectionBuilderFor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,qBAAqB,CAAC,UAAU,CAC7C,SAAQ,kBAAkB,CAAC,UAAU,EAAE,qBAAqB,CAAC,UAAU,CAAC,CAAC;IACzE;;;;OAIG;IACH,iBAAiB,CAAC,eAAe,EAAE,MAAM,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAE9E;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAE/D;;;OAGG;IACH,aAAa,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAEnD;;;OAGG;IACH,OAAO,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC;CAChD"}
1
+ {"version":3,"file":"IProjectionBuilderFor.d.ts","sourceRoot":"","sources":["../../../projections/declarative/IProjectionBuilderFor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,qBAAqB,CAAC,UAAU,CAC7C,SAAQ,kBAAkB,CAAC,UAAU,EAAE,qBAAqB,CAAC,UAAU,CAAC,CAAC;IACzE;;;;OAIG;IACH,iBAAiB,CAAC,eAAe,EAAE,MAAM,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAE9E;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAE/D;;;OAGG;IACH,aAAa,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAEnD;;;OAGG;IACH,OAAO,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAE7C;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,CAAC,UAAU,CAAC,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAE5G;;;;;;;;OAQG;IACH,QAAQ,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;CAClF"}
@@ -2,7 +2,7 @@ import { PropertyAccessor } from '@cratis/fundamentals';
2
2
  import { IChildrenBuilder } from './IChildrenBuilder';
3
3
  import { INestedBuilder } from './INestedBuilder';
4
4
  import { IProjectionBuilderFor } from './IProjectionBuilderFor';
5
- import { ProjectionBuilderCore } from './ProjectionBuilderCore';
5
+ import { ContractEventType, ProjectionBuilderCore } from './ProjectionBuilderCore';
6
6
  /**
7
7
  * Concrete implementation of {@link IProjectionBuilderFor} that accumulates projection
8
8
  * configuration and produces a Chronicle-compatible projection definition payload.
@@ -13,6 +13,9 @@ export declare class ProjectionBuilderFor<TReadModel> extends ProjectionBuilderC
13
13
  private _containerName;
14
14
  private _rewindable;
15
15
  private _active;
16
+ private _variantIdentity;
17
+ private _variantKey;
18
+ private readonly _enteringEventTypes;
16
19
  constructor();
17
20
  /** @inheritdoc */
18
21
  fromEventSequence(eventSequenceId: string): this;
@@ -23,6 +26,19 @@ export declare class ProjectionBuilderFor<TReadModel> extends ProjectionBuilderC
23
26
  /** @inheritdoc */
24
27
  passive(): this;
25
28
  /** @inheritdoc */
29
+ variantOf(identity: Function, keyAccessor: PropertyAccessor<TReadModel>): this;
30
+ /** @inheritdoc */
31
+ entersOn(eventType: Function, key?: string): this;
32
+ /**
33
+ * Gets the variant declaration this builder accumulated, if any.
34
+ * @returns The variant declaration, or undefined when this projection is not a variant.
35
+ */
36
+ getVariantDeclaration(): {
37
+ identity: Function;
38
+ key: string;
39
+ enteringEventTypes: ContractEventType[];
40
+ } | undefined;
41
+ /** @inheritdoc */
26
42
  children<TChildModel>(targetPropertyAccessor: PropertyAccessor<TReadModel>, builderCallback: (builder: IChildrenBuilder<TReadModel, TChildModel>) => void): this;
27
43
  /** @inheritdoc */
28
44
  nested<TNestedModel>(targetPropertyAccessor: PropertyAccessor<TReadModel>, builderCallback: (builder: INestedBuilder<TReadModel, TNestedModel>) => void): this;
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectionBuilderFor.d.ts","sourceRoot":"","sources":["../../../projections/declarative/ProjectionBuilderFor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAoC,MAAM,sBAAsB,CAAC;AAG1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;GAIG;AACH,qBAAa,oBAAoB,CAAC,UAAU,CAAE,SAAQ,qBAAqB,CAAC,UAAU,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAE,YAAW,qBAAqB,CAAC,UAAU,CAAC;IAClK,OAAO,CAAC,gBAAgB,CAA0C;IAClE,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,WAAW,CAAiB;IACpC,OAAO,CAAC,OAAO,CAAiB;;IAOhC,kBAAkB;IAClB,iBAAiB,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI;IAKhD,kBAAkB;IAClB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKjC,kBAAkB;IAClB,aAAa,IAAI,IAAI;IAKrB,kBAAkB;IAClB,OAAO,IAAI,IAAI;IAKf,kBAAk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;;;OAIG;IACH,OAAO,CAAC,wBAAwB;CASnC"}
@@ -16,6 +16,9 @@ export class ProjectionBuilderFor extends ProjectionBuilderCore {
16
16
  _containerName;
17
17
  _rewindable = true;
18
18
  _active = true;
19
+ _variantIdentity;
20
+ _variantKey;
21
+ _enteringEventTypes = [];
19
22
  constructor() {
20
23
  super();
21
24
  this._autoMap = AutoMap.Enabled;
@@ -41,6 +44,37 @@ export class ProjectionBuilderFor extends ProjectionBuilderCore {
41
44
  return this;
42
45
  }
43
46
  /** @inheritdoc */
47
+ variantOf(identity, keyAccessor) {
48
+ const handler = new PropertyPathResolverProxyHandler();
49
+ const proxy = new Proxy({}, handler);
50
+ keyAccessor(proxy);
51
+ this._variantIdentity = identity;
52
+ this._variantKey = handler.property;
53
+ return this;
54
+ }
55
+ /** @inheritdoc */
56
+ entersOn(eventType, key) {
57
+ const contractType = this.toContractEventType(eventType);
58
+ this._enteringEventTypes.push(contractType);
59
+ if (key) {
60
+ const fromEntry = this._from.find(record => record.Key.Id === contractType.Id && record.Key.Generation === contractType.Generation);
61
+ if (fromEntry) {
62
+ fromEntry.Value.Key = key;
63
+ }
64
+ }
65
+ return this;
66
+ }
67
+ /**
68
+ * Gets the variant declaration this builder accumulated, if any.
69
+ * @returns The variant declaration, or undefined when this projection is not a variant.
70
+ */
71
+ getVariantDeclaration() {
72
+ if (!this._variantIdentity || !this._variantKey) {
73
+ return undefined;
74
+ }
75
+ return { identity: this._variantIdentity, key: this._variantKey, enteringEventTypes: this._enteringEventTypes };
76
+ }
77
+ /** @inheritdoc */
44
78
  children(targetPropertyAccessor, builderCallback) {
45
79
  const handler = new PropertyPathResolverProxyHandler();
46
80
  const proxy = new Proxy({}, handler);
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectionBuilderFor.js","sourceRoot":"","sources":["../../../projections/declarative/ProjectionBuilderFor.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,OAAO,EAAE,MAAM,6BA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
  export type { ProjectionState } from './ProjectionState';
5
5
  export type { ProjectionQueryResult } from './ProjectionQueryResult';
6
6
  export { UnableToQueryProjection } from './UnableToQueryProjection';
7
+ export { VariantMustDeclareEntersOnEvent } from './VariantMustDeclareEntersOnEvent';
8
+ export { GlobalHandlerPropertyNotOnVariant } from './GlobalHandlerPropertyNotOnVariant';
7
9
  export * from './declarative';
8
10
  export * from './modelBound';
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../projections/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../projections/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AACxF,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
@@ -3,6 +3,8 @@
3
3
  export { ProjectionId } from './ProjectionId';
4
4
  export { Projections } from './Projections';
5
5
  export { UnableToQueryProjection } from './UnableToQueryProjection';
6
+ export { VariantMustDeclareEntersOnEvent } from './VariantMustDeclareEntersOnEvent';
7
+ export { GlobalHandlerPropertyNotOnVariant } from './GlobalHandlerPropertyNotOnVariant';
6
8
  export * from './declarative';
7
9
  export * from './modelBound';
8
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../projections/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../projections/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AACxF,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,25 @@
1
+ import 'reflect-metadata';
2
+ /** Metadata stored by the entersOn class decorator. */
3
+ export interface EntersOnMetadata {
4
+ /** The event constructor that may create or resurrect the variant. */
5
+ readonly eventType: Function;
6
+ /** The event property name used as the key. Defaults to the event source identifier. */
7
+ readonly key?: string;
8
+ }
9
+ /**
10
+ * Class decorator that names an event that may create or resurrect a read model variant.
11
+ * Repeatable - a variant may enter on more than one event. Every event a variant projects
12
+ * from that is not named here is automatically reclassified into an update-only join: it
13
+ * can bring an already-active instance up to date, but it can never create or resurrect one.
14
+ * @param eventType - The event constructor.
15
+ * @param key - Optional event property name used as the key. Defaults to the event source identifier.
16
+ * @returns A class decorator.
17
+ */
18
+ export declare function entersOn(eventType: Function, key?: string): ClassDecorator;
19
+ /**
20
+ * Retrieves entersOn metadata stored on the given class constructor.
21
+ * @param target - The class constructor.
22
+ * @returns An array of entersOn metadata entries.
23
+ */
24
+ export declare function getEntersOnMetadata(target: Function): EntersOnMetadata[];
25
+ //# sourceMappingURL=entersOn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entersOn.d.ts","sourceRoot":"","sources":["../../../projections/modelBound/entersOn.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAE1B,uDAAuD;AACvD,MAAM,WAAW,gBAAgB;IAC7B,sEAAsE;IACtE,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC7B,wFAAwF;IACxF,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACzB;AAID;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,cAAc,CAK1E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,GAAG,gBAAgB,EAAE,CAExE"}
@@ -0,0 +1,28 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ import 'reflect-metadata';
4
+ const METADATA_KEY = 'chronicle:projection:entersOn';
5
+ /**
6
+ * Class decorator that names an event that may create or resurrect a read model variant.
7
+ * Repeatable - a variant may enter on more than one event. Every event a variant projects
8
+ * from that is not named here is automatically reclassified into an update-only join: it
9
+ * can bring an already-active instance up to date, but it can never create or resurrect one.
10
+ * @param eventType - The event constructor.
11
+ * @param key - Optional event property name used as the key. Defaults to the event source identifier.
12
+ * @returns A class decorator.
13
+ */
14
+ export function entersOn(eventType, key) {
15
+ return (target) => {
16
+ const existing = Reflect.getMetadata(METADATA_KEY, target) ?? [];
17
+ Reflect.defineMetadata(METADATA_KEY, [...existing, { eventType, key }], target);
18
+ };
19
+ }
20
+ /**
21
+ * Retrieves entersOn metadata stored on the given class constructor.
22
+ * @param target - The class constructor.
23
+ * @returns An array of entersOn metadata entries.
24
+ */
25
+ export function getEntersOnMetadata(target) {
26
+ return Reflect.getMetadata(METADATA_KEY, target) ?? [];
27
+ }
28
+ //# sourceMappingURL=entersOn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entersOn.js","sourceRoot":"","sources":["../../../projections/modelBound/entersOn.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAU1B,MAAM,YAAY,GAAG,+BAA+B,CAAC;AAErD;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CAAC,SAAmB,EAAE,GAAY;IACtD,OAAO,CAAC,MAAc,EAAE,EAAE;QACtB,MAAM,QAAQ,GAAuB,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;QACrF,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC,GAAG,QAAQ,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IACpF,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAgB;IAChD,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,24 @@
1
+ import 'reflect-metadata';
2
+ /** Metadata stored by the globalFor class decorator. */
3
+ export interface GlobalForMetadata {
4
+ /** The type anchoring the logical identity this shared handler applies its mappings to. */
5
+ readonly identity: Function;
6
+ }
7
+ /**
8
+ * Class decorator that declares a shared handler class whose mappings apply to every variant
9
+ * of the given identity, without repeating them on each variant type. A mapping that targets
10
+ * a member some variant lacks is a declaration error, not a silently skipped mapping.
11
+ *
12
+ * A class decorated only with globalFor is never registered as a projection on its own - it is
13
+ * merged into every variant of its identity before those variants are registered.
14
+ * @param identity - The type anchoring the logical identity this handler's mappings apply to.
15
+ * @returns A class decorator.
16
+ */
17
+ export declare function globalFor(identity: Function): ClassDecorator;
18
+ /**
19
+ * Retrieves globalFor metadata stored on the given class constructor.
20
+ * @param target - The class constructor.
21
+ * @returns The globalFor metadata, or undefined if the class is not a shared handler.
22
+ */
23
+ export declare function getGlobalForMetadata(target: Function): GlobalForMetadata | undefined;
24
+ //# sourceMappingURL=globalFor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globalFor.d.ts","sourceRoot":"","sources":["../../../projections/modelBound/globalFor.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAI1B,wDAAwD;AACxD,MAAM,WAAW,iBAAiB;IAC9B,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC/B;AAID;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,CAM5D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,QAAQ,GAAG,iBAAiB,GAAG,SAAS,CAEpF"}
@@ -0,0 +1,31 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ import 'reflect-metadata';
4
+ import { DecoratorType, TypeDiscoverer } from '../../types';
5
+ const METADATA_KEY = 'chronicle:projection:globalFor';
6
+ /**
7
+ * Class decorator that declares a shared handler class whose mappings apply to every variant
8
+ * of the given identity, without repeating them on each variant type. A mapping that targets
9
+ * a member some variant lacks is a declaration error, not a silently skipped mapping.
10
+ *
11
+ * A class decorated only with globalFor is never registered as a projection on its own - it is
12
+ * merged into every variant of its identity before those variants are registered.
13
+ * @param identity - The type anchoring the logical identity this handler's mappings apply to.
14
+ * @returns A class decorator.
15
+ */
16
+ export function globalFor(identity) {
17
+ return (target) => {
18
+ const constructor = target;
19
+ Reflect.defineMetadata(METADATA_KEY, { identity }, target);
20
+ TypeDiscoverer.default.register(DecoratorType.GlobalForHandler, constructor, constructor.name);
21
+ };
22
+ }
23
+ /**
24
+ * Retrieves globalFor metadata stored on the given class constructor.
25
+ * @param target - The class constructor.
26
+ * @returns The globalFor metadata, or undefined if the class is not a shared handler.
27
+ */
28
+ export function getGlobalForMetadata(target) {
29
+ return Reflect.getMetadata(METADATA_KEY, target);
30
+ }
31
+ //# sourceMappingURL=globalFor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globalFor.js","sourceRoot":"","sources":["../../../projections/modelBound/globalFor.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQ5D,MAAM,YAAY,GAAG,gCAAgC,CAAC;AAEtD;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAAC,QAAkB;IACxC,OAAO,CAAC,MAAc,EAAE,EAAE;QACtB,MAAM,WAAW,GAAG,MAAqB,CAAC;QAC1C,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;QAC3D,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,gBAAgB,EAAE,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IACnG,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAgB;IACjD,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC"}
@@ -36,4 +36,10 @@ export { fromAll, getFromAllMetadata } from './fromAll';
36
36
  export type { FromAllMetadata } from './fromAll';
37
37
  export { noAutoMap, isNoAutoMap, isPropertyNoAutoMap } from './noAutoMap';
38
38
  export { eventSequence, eventLog, getEventSequenceMetadata } from './eventSequence';
39
+ export { variantOf, getVariantOfMetadata } from './variantOf';
40
+ export type { VariantOfMetadata } from './variantOf';
41
+ export { entersOn, getEntersOnMetadata } from './entersOn';
42
+ export type { EntersOnMetadata } from './entersOn';
43
+ export { globalFor, getGlobalForMetadata } from './globalFor';
44
+ export type { GlobalForMetadata } from './globalFor';
39
45
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../projections/modelBound/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACpF,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,YAAY,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAC/C,YAAY,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;A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E,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC3D,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
@@ -21,4 +21,7 @@ export { fromEvery, getFromEveryMetadata } from './fromEvery';
21
21
  export { fromAll, getFromAllMetadata } from './fromAll';
22
22
  export { noAutoMap, isNoAutoMap, isPropertyNoAutoMap } from './noAutoMap';
23
23
  export { eventSequence, eventLog, getEventSequenceMetadata } from './eventSequence';
24
+ export { variantOf, getVariantOfMetadata } from './variantOf';
25
+ export { entersOn, getEntersOnMetadata } from './entersOn';
26
+ export { globalFor, getGlobalForMetadata } from './globalFor';
24
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../projections/modelBound/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGpF,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,kBAA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Y,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,24 @@
1
+ import 'reflect-metadata';
2
+ /** Metadata stored by the variantOf class decorator. */
3
+ export interface VariantOfMetadata {
4
+ /** The type anchoring the logical identity every variant of this group shares. */
5
+ readonly identity: Function;
6
+ /** The property name on this variant used as its own key, and as the correlation property for reclassified joins. */
7
+ readonly key: string;
8
+ }
9
+ /**
10
+ * Class decorator that declares a read model to be one of several mutually exclusive
11
+ * representations of the same logical entity. Entering one variant removes the entity
12
+ * from every sibling variant of the same identity.
13
+ * @param identity - The type anchoring the logical identity shared by every variant. Does not need to be a read model itself.
14
+ * @param key - The property name on this variant used as its own key.
15
+ * @returns A class decorator.
16
+ */
17
+ export declare function variantOf(identity: Function, key: string): ClassDecorator;
18
+ /**
19
+ * Retrieves variantOf metadata stored on the given class constructor.
20
+ * @param target - The class constructor.
21
+ * @returns The variantOf metadata, or undefined if the class is not a variant.
22
+ */
23
+ export declare function getVariantOfMetadata(target: Function): VariantOfMetadata | undefined;
24
+ //# sourceMappingURL=variantOf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variantOf.d.ts","sourceRoot":"","sources":["../../../projections/modelBound/variantOf.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAE1B,wDAAwD;AACxD,MAAM,WAAW,iBAAiB;IAC9B,kFAAkF;IAClF,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,qHAAqH;IACrH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACxB;AAID;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,cAAc,CAKzE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,QAAQ,GAAG,iBAAiB,GAAG,SAAS,CAEpF"}
@@ -0,0 +1,27 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ import 'reflect-metadata';
4
+ const METADATA_KEY = 'chronicle:projection:variantOf';
5
+ /**
6
+ * Class decorator that declares a read model to be one of several mutually exclusive
7
+ * representations of the same logical entity. Entering one variant removes the entity
8
+ * from every sibling variant of the same identity.
9
+ * @param identity - The type anchoring the logical identity shared by every variant. Does not need to be a read model itself.
10
+ * @param key - The property name on this variant used as its own key.
11
+ * @returns A class decorator.
12
+ */
13
+ export function variantOf(identity, key) {
14
+ return (target) => {
15
+ const metadata = { identity, key };
16
+ Reflect.defineMetadata(METADATA_KEY, metadata, target);
17
+ };
18
+ }
19
+ /**
20
+ * Retrieves variantOf metadata stored on the given class constructor.
21
+ * @param target - The class constructor.
22
+ * @returns The variantOf metadata, or undefined if the class is not a variant.
23
+ */
24
+ export function getVariantOfMetadata(target) {
25
+ return Reflect.getMetadata(METADATA_KEY, target);
26
+ }
27
+ //# sourceMappingURL=variantOf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variantOf.js","sourceRoot":"","sources":["../../../projections/modelBound/variantOf.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAU1B,MAAM,YAAY,GAAG,gCAAgC,CAAC;AAEtD;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,QAAkB,EAAE,GAAW;IACrD,OAAO,CAAC,MAAc,EAAE,EAAE;QACtB,MAAM,QAAQ,GAAsB,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;QACtD,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAgB;IACjD,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC"}
@@ -1 +1 @@
1
- {"root":["../ChronicleClient.ts","../ChronicleOptions.ts","../EventStore.ts","../EventStoreName.ts","../EventStoreNamespaceName.ts","../IChronicleClient.ts","../IEventStore.ts","../Metrics.ts","../Tracing.ts","../index.ts","../artifacts/DefaultClientArtifactsProvider.ts","../artifacts/IClientArtifactsProvider.ts","../artifacts/index.ts","../auditing/Causation.ts","../auditing/CausationManager.ts","../auditing/CausationType.ts","../auditing/ICausationManager.ts","../auditing/index.ts","../compliance/ComplianceContracts.ts","../compliance/ComplianceMetadata.ts","../compliance/ComplianceMetadataResolver.ts","../compliance/ComplianceMetadataType.ts","../compliance/IPIIManager.ts","../compliance/PIIManager.ts","../compliance/PIINotSupportedOnEventSourceId.ts","../compliance/index.ts","../compliance/pii.ts","../compliance/subject.ts","../connection/ChronicleConnection.ts","../connection/ChronicleConnectionString.ts","../connection/ChronicleServerAddressResolver.ts","../connection/ChronicleServices.ts","../connection/ChronicleSrvResolutionError.ts","../connection/ChronicleSrvResolver.ts","../connection/CompatibilityPreflight.ts","../connection/ConnectionLifecycle.ts","../connection/DateTimeOffset.ts","../connection/Guid.ts","../connection/ILoadBalancerStrategy.ts","../connection/IncompatibleChronicleServer.ts","../connection/KernelKeepAlive.ts","../connection/LeastConnectionsLoadBalancerStrategy.ts","../connection/LoadBalancerMode.ts","../connection/LoadBalancerStrategyFactory.ts","../connection/RandomLoadBalancerStrategy.ts","../connection/RoundRobinLoadBalancerStrategy.ts","../connection/TokenProvider.ts","../connection/callResults.ts","../connection/fetchOAuthAccessToken.ts","../connection/formatServerAddress.ts","../connection/index.ts","../correlation/CorrelationId.ts","../correlation/CorrelationIdManager.ts","../correlation/ICorrelationIdAccessor.ts","../correlation/ICorrelationIdSetter.ts","../correlation/index.ts","../eventSequences/AppendError.ts","../eventSequences/AppendOperationsBroadcaster.ts","../eventSequences/AppendOptions.ts","../eventSequences/AppendResult.ts","../eventSequences/AppendedEventWithResult.ts","../eventSequences/CompleteStreamError.ts","../eventSequences/CompleteStreamResult.ts","../eventSequences/ConcurrencyScope.ts","../eventSequences/ConcurrencyViolation.ts","../eventSequences/ConstraintViolation.ts","../eventSequences/EventForEventSourceId.ts","../eventSequences/EventLog.ts","../eventSequences/EventSequence.ts","../eventSequences/EventSequenceId.ts","../eventSequences/EventSequenceNumber.ts","../eventSequences/IEventLog.ts","../eventSequences/IEventSequence.ts","../eventSequences/ITransactionalEventSequence.ts","../eventSequences/TransactionalEventSequence.ts","../eventSequences/WaitForCompletionResult.ts","../eventSequences/index.ts","../eventStoreSubscriptions/EventStoreSubscriptionBuilder.ts","../eventStoreSubscriptions/EventStoreSubscriptionDefinition.ts","../eventStoreSubscriptions/EventStoreSubscriptionId.ts","../eventStoreSubscriptions/EventStoreSubscriptions.ts","../eventStoreSubscriptions/IEventStoreSubscriptionBuilder.ts","../eventStoreSubscriptions/IEventStoreSubscriptions.ts","../eventStoreSubscriptions/contracts.ts","../eventStoreSubscriptions/index.ts","../events/AppendedEvent.ts","../events/CausationEntry.ts","../events/EventContext.ts","../events/EventType.ts","../events/EventTypeGeneration.ts","../events/EventTypeId.ts","../events/EventTypes.ts","../events/IEventTypes.ts","../events/Tag.ts","../events/WireEventContext.ts","../events/eventTypeDecorator.ts","../events/filterEventsByTagDecorator.ts","../events/index.ts","../events/mergeTags.ts","../events/tagDecorator.ts","../events/toClientEventContext.ts","../events/constraints/ConstraintBuilder.ts","../events/constraints/ConstraintId.ts","../events/constraints/Constraints.ts","../events/constraints/IConstraint.ts","../events/constraints/IConstraintBuilder.ts","../events/constraints/IConstraints.ts","../events/constraints/IUniqueConstraintBuilder.ts","../events/constraints/UniqueConstraintBuilder.ts","../events/constraints/constraint.ts","../events/constraints/index.ts","../events/migrations/EventMigrationBuilder.ts","../events/migrations/EventMigrationPropertyBuilder.ts","../events/migrations/EventTypeMigrators.ts","../events/migrations/IEventMigrationBuilder.ts","../events/migrations/IEventMigrationPropertyBuilder.ts","../events/migrations/IEventTypeMigration.ts","../events/migrations/IEventTypeMigrators.ts","../events/migrations/InvalidMigrationGenerationGap.ts","../events/migrations/eventTypeMigration.ts","../events/migrations/index.ts","../externalServices/ExternalServiceBuilder.ts","../externalServices/ExternalServices.ts","../externalServices/ExternalServicesContracts.ts","../externalServices/IExternalServiceBuilder.ts","../externalServices/IExternalServices.ts","../externalServices/index.ts","../identities/IIdentityManager.ts","../identities/IdentityManager.ts","../identities/index.ts","../identity/IIdentityProvider.ts","../identity/Identity.ts","../identity/IdentityProvider.ts","../identity/index.ts","../jobs/IJobs.ts","../jobs/JobId.ts","../jobs/Jobs.ts","../jobs/index.ts","../observation/FailedPartition.ts","../observation/FailedPartitionAttempt.ts","../observation/FailedPartitions.ts","../observation/ICanBeNotifiedWhenPartitionReplayed.ts","../observation/ICanBeNotifiedWhenReplay.ts","../observation/IFailedPartitions.ts","../observation/ObserverId.ts","../observation/ObserverRunningState.ts","../observation/index.ts","../observation/notifyReplayLifecycle.ts","../observation/toClientFailedPartition.ts","../observation/toObserverRunningState.ts","../projections/IProjections.ts","../projections/ProjectionId.ts","../projections/ProjectionQueryResult.ts","../projections/ProjectionState.ts","../projections/Projections.ts","../projections/UnableToQueryProjection.ts","../projections/index.ts","../projections/declarative/AddBuilder.ts","../projections/declarative/AddChildBuilder.ts","../projections/declarative/AllSetBuilder.ts","../projections/declarative/ChildrenBuilder.ts","../projections/declarative/CompositeKeyBuilder.ts","../projections/declarative/FromBuilder.ts","../projections/declarative/FromEveryBuilder.ts","../projections/declarative/IAddBuilder.ts","../projections/declarative/IAddChildBuilder.ts","../projections/declarative/IAllSetBuilder.ts","../projections/declarative/IChildrenBuilder.ts","../projections/declarative/ICompositeKeyBuilder.ts","../projections/declarative/IFromBuilder.ts","../projections/declarative/IFromEveryBuilder.ts","../projections/declarative/IJoinBuilder.ts","../projections/declarative/INestedBuilder.ts","../projections/declarative/IProjectionBuilder.ts","../projections/declarative/IProjectionBuilderFor.ts","../projections/declarative/IProjectionFor.ts","../projections/declarative/IReadModelPropertiesBuilder.ts","../projections/declarative/IRemovedWithBuilder.ts","../projections/declarative/IRemovedWithJoinBuilder.ts","../projections/declarative/ISetBuilder.ts","../projections/declarative/ISubtractBuilder.ts","../projections/declarative/JoinBuilder.ts","../projections/declarative/NestedBuilder.ts","../projections/declarative/ProjectionBuilderCore.ts","../projections/declarative/ProjectionBuilderFor.ts","../projections/declarative/RemovedWithBuilder.ts","../projections/declarative/RemovedWithJoinBuilder.ts","../projections/declarative/SetBuilder.ts","../projections/declarative/SubtractBuilder.ts","../projections/declarative/index.ts","../projections/declarative/projection.ts","../projections/modelBound/FromEventMetadata.ts","../projections/modelBound/FromEventOptions.ts","../projections/modelBound/addFrom.ts","../projections/modelBound/childrenAndNestedBuilder.ts","../projections/modelBound/childrenFrom.ts","../projections/modelBound/clearWith.ts","../projections/modelBound/count.ts","../projections/modelBound/decrement.ts","../projections/modelBound/eventSequence.ts","../projections/modelBound/fromAll.ts","../projections/modelBound/fromEvent.ts","../projections/modelBound/fromEvery.ts","../projections/modelBound/increment.ts","../projections/modelBound/index.ts","../projections/modelBound/join.ts","../projections/modelBound/nested.ts","../projections/modelBound/noAutoMap.ts","../projections/modelBound/notRewindable.ts","../projections/modelBound/passive.ts","../projections/modelBound/removedWith.ts","../projections/modelBound/removedWithJoin.ts","../projections/modelBound/setFrom.ts","../projections/modelBound/setFromContext.ts","../projections/modelBound/setValue.ts","../projections/modelBound/subtractFrom.ts","../reactors/IReactors.ts","../reactors/ReactorId.ts","../reactors/ReactorSideEffects.ts","../reactors/Reactors.ts","../reactors/index.ts","../reactors/reactor.ts","../readModels/IMaterializedReadModels.ts","../readModels/IReadModels.ts","../readModels/MaterializedReadModels.ts","../readModels/ReadModelChangeset.ts","../readModels/ReadModelId.ts","../readModels/ReadModelSnapshot.ts","../readModels/ReadModelSubjectResolver.ts","../readModels/ReadModels.ts","../readModels/index.ts","../readModels/readModel.ts","../reducers/IReducers.ts","../reducers/ReducerId.ts","../reducers/Reducers.ts","../reducers/index.ts","../reducers/reducer.ts","../schemas/JsonSchema.ts","../schemas/JsonSchemaGenerator.ts","../schemas/index.ts","../schemas/jsonSchemaProperty.ts","../seeding/EventSeeding.ts","../seeding/ICanSeedEvents.ts","../seeding/IEventSeeding.ts","../seeding/IEventSeedingBuilder.ts","../seeding/IEventSeedingScopeBuilder.ts","../seeding/index.ts","../seeding/seeder.ts","../sinks/WellKnownSinks.ts","../sinks/index.ts","../transactions/IUnitOfWork.ts","../transactions/IUnitOfWorkManager.ts","../transactions/NoUnitOfWorkHasBeenStarted.ts","../transactions/UnitOfWork.ts","../transactions/UnitOfWorkManager.ts","../transactions/index.ts","../types/DecoratorType.ts","../types/TypeDiscoverer.ts","../types/TypeIntrospector.ts","../types/index.ts","../webhooks/IWebhook.ts","../webhooks/IWebhookDefinitionBuilder.ts","../webhooks/IWebhooks.ts","../webhooks/WebhookDefinitionBuilder.ts","../webhooks/WebhookId.ts","../webhooks/WebhookTargetUrl.ts","../webhooks/Webhooks.ts","../webhooks/index.ts","../webhooks/webhook.ts"],"version":"6.0.3"}
1
+ {"root":["../ChronicleClient.ts","../ChronicleOptions.ts","../EventStore.ts","../EventStoreName.ts","../EventStoreNamespaceName.ts","../IChronicleClient.ts","../IEventStore.ts","../Metrics.ts","../Tracing.ts","../index.ts","../artifacts/DefaultClientArtifactsProvider.ts","../artifacts/IClientArtifactsProvider.ts","../artifacts/index.ts","../auditing/Causation.ts","../auditing/CausationManager.ts","../auditing/CausationType.ts","../auditing/ICausationManager.ts","../auditing/index.ts","../compliance/ComplianceContracts.ts","../compliance/ComplianceMetadata.ts","../compliance/ComplianceMetadataResolver.ts","../compliance/ComplianceMetadataType.ts","../compliance/IPIIManager.ts","../compliance/PIIManager.ts","../compliance/PIINotSupportedOnEventSourceId.ts","../compliance/index.ts","../compliance/pii.ts","../compliance/subject.ts","../connection/ChronicleConnection.ts","../connection/ChronicleConnectionString.ts","../connection/ChronicleServerAddressResolver.ts","../connection/ChronicleServices.ts","../connection/ChronicleSrvResolutionError.ts","../connection/ChronicleSrvResolver.ts","../connection/CompatibilityPreflight.ts","../connection/ConnectionLifecycle.ts","../connection/DateTimeOffset.ts","../connection/Guid.ts","../connection/ILoadBalancerStrategy.ts","../connection/IncompatibleChronicleServer.ts","../connection/KernelKeepAlive.ts","../connection/LeastConnectionsLoadBalancerStrategy.ts","../connection/LoadBalancerMode.ts","../connection/LoadBalancerStrategyFactory.ts","../connection/RandomLoadBalancerStrategy.ts","../connection/RoundRobinLoadBalancerStrategy.ts","../connection/TokenProvider.ts","../connection/callResults.ts","../connection/fetchOAuthAccessToken.ts","../connection/formatServerAddress.ts","../connection/index.ts","../correlation/CorrelationId.ts","../correlation/CorrelationIdManager.ts","../correlation/ICorrelationIdAccessor.ts","../correlation/ICorrelationIdSetter.ts","../correlation/index.ts","../eventSequences/AppendError.ts","../eventSequences/AppendOperationsBroadcaster.ts","../eventSequences/AppendOptions.ts","../eventSequences/AppendResult.ts","../eventSequences/AppendedEventWithResult.ts","../eventSequences/CompleteStreamError.ts","../eventSequences/CompleteStreamResult.ts","../eventSequences/ConcurrencyScope.ts","../eventSequences/ConcurrencyViolation.ts","../eventSequences/ConstraintViolation.ts","../eventSequences/EventForEventSourceId.ts","../eventSequences/EventLog.ts","../eventSequences/EventSequence.ts","../eventSequences/EventSequenceId.ts","../eventSequences/EventSequenceNumber.ts","../eventSequences/IEventLog.ts","../eventSequences/IEventSequence.ts","../eventSequences/ITransactionalEventSequence.ts","../eventSequences/TransactionalEventSequence.ts","../eventSequences/WaitForCompletionResult.ts","../eventSequences/index.ts","../eventStoreSubscriptions/EventStoreSubscriptionBuilder.ts","../eventStoreSubscriptions/EventStoreSubscriptionDefinition.ts","../eventStoreSubscriptions/EventStoreSubscriptionId.ts","../eventStoreSubscriptions/EventStoreSubscriptions.ts","../eventStoreSubscriptions/IEventStoreSubscriptionBuilder.ts","../eventStoreSubscriptions/IEventStoreSubscriptions.ts","../eventStoreSubscriptions/contracts.ts","../eventStoreSubscriptions/index.ts","../events/AppendedEvent.ts","../events/CausationEntry.ts","../events/EventContext.ts","../events/EventType.ts","../events/EventTypeGeneration.ts","../events/EventTypeId.ts","../events/EventTypes.ts","../events/IEventTypes.ts","../events/Tag.ts","../events/WireEventContext.ts","../events/eventTypeDecorator.ts","../events/filterEventsByTagDecorator.ts","../events/index.ts","../events/mergeTags.ts","../events/tagDecorator.ts","../events/toClientEventContext.ts","../events/constraints/ConstraintBuilder.ts","../events/constraints/ConstraintId.ts","../events/constraints/Constraints.ts","../events/constraints/IConstraint.ts","../events/constraints/IConstraintBuilder.ts","../events/constraints/IConstraints.ts","../events/constraints/IUniqueConstraintBuilder.ts","../events/constraints/UniqueConstraintBuilder.ts","../events/constraints/constraint.ts","../events/constraints/index.ts","../events/migrations/EventMigrationBuilder.ts","../events/migrations/EventMigrationPropertyBuilder.ts","../events/migrations/EventTypeMigrators.ts","../events/migrations/IEventMigrationBuilder.ts","../events/migrations/IEventMigrationPropertyBuilder.ts","../events/migrations/IEventTypeMigration.ts","../events/migrations/IEventTypeMigrators.ts","../events/migrations/InvalidMigrationGenerationGap.ts","../events/migrations/eventTypeMigration.ts","../events/migrations/index.ts","../externalServices/ExternalServiceBuilder.ts","../externalServices/ExternalServices.ts","../externalServices/ExternalServicesContracts.ts","../externalServices/IExternalServiceBuilder.ts","../externalServices/IExternalServices.ts","../externalServices/index.ts","../identities/IIdentityManager.ts","../identities/IdentityManager.ts","../identities/index.ts","../identity/IIdentityProvider.ts","../identity/Identity.ts","../identity/IdentityProvider.ts","../identity/index.ts","../jobs/IJobs.ts","../jobs/JobId.ts","../jobs/Jobs.ts","../jobs/index.ts","../observation/FailedPartition.ts","../observation/FailedPartitionAttempt.ts","../observation/FailedPartitions.ts","../observation/ICanBeNotifiedWhenPartitionReplayed.ts","../observation/ICanBeNotifiedWhenReplay.ts","../observation/IFailedPartitions.ts","../observation/ObserverId.ts","../observation/ObserverRunningState.ts","../observation/index.ts","../observation/notifyReplayLifecycle.ts","../observation/toClientFailedPartition.ts","../observation/toObserverRunningState.ts","../projections/GlobalHandlerPropertyNotOnVariant.ts","../projections/IProjections.ts","../projections/ProjectionId.ts","../projections/ProjectionQueryResult.ts","../projections/ProjectionState.ts","../projections/Projections.ts","../projections/UnableToQueryProjection.ts","../projections/VariantMustDeclareEntersOnEvent.ts","../projections/VariantReclassifier.ts","../projections/index.ts","../projections/declarative/AddBuilder.ts","../projections/declarative/AddChildBuilder.ts","../projections/declarative/AllSetBuilder.ts","../projections/declarative/ChildrenBuilder.ts","../projections/declarative/CompositeKeyBuilder.ts","../projections/declarative/FromBuilder.ts","../projections/declarative/FromEveryBuilder.ts","../projections/declarative/IAddBuilder.ts","../projections/declarative/IAddChildBuilder.ts","../projections/declarative/IAllSetBuilder.ts","../projections/declarative/IChildrenBuilder.ts","../projections/declarative/ICompositeKeyBuilder.ts","../projections/declarative/IFromBuilder.ts","../projections/declarative/IFromEveryBuilder.ts","../projections/declarative/IJoinBuilder.ts","../projections/declarative/INestedBuilder.ts","../projections/declarative/IProjectionBuilder.ts","../projections/declarative/IProjectionBuilderFor.ts","../projections/declarative/IProjectionFor.ts","../projections/declarative/IReadModelPropertiesBuilder.ts","../projections/declarative/IRemovedWithBuilder.ts","../projections/declarative/IRemovedWithJoinBuilder.ts","../projections/declarative/ISetBuilder.ts","../projections/declarative/ISubtractBuilder.ts","../projections/declarative/JoinBuilder.ts","../projections/declarative/NestedBuilder.ts","../projections/declarative/ProjectionBuilderCore.ts","../projections/declarative/ProjectionBuilderFor.ts","../projections/declarative/RemovedWithBuilder.ts","../projections/declarative/RemovedWithJoinBuilder.ts","../projections/declarative/SetBuilder.ts","../projections/declarative/SubtractBuilder.ts","../projections/declarative/index.ts","../projections/declarative/projection.ts","../projections/modelBound/FromEventMetadata.ts","../projections/modelBound/FromEventOptions.ts","../projections/modelBound/addFrom.ts","../projections/modelBound/childrenAndNestedBuilder.ts","../projections/modelBound/childrenFrom.ts","../projections/modelBound/clearWith.ts","../projections/modelBound/count.ts","../projections/modelBound/decrement.ts","../projections/modelBound/entersOn.ts","../projections/modelBound/eventSequence.ts","../projections/modelBound/fromAll.ts","../projections/modelBound/fromEvent.ts","../projections/modelBound/fromEvery.ts","../projections/modelBound/globalFor.ts","../projections/modelBound/increment.ts","../projections/modelBound/index.ts","../projections/modelBound/join.ts","../projections/modelBound/nested.ts","../projections/modelBound/noAutoMap.ts","../projections/modelBound/notRewindable.ts","../projections/modelBound/passive.ts","../projections/modelBound/removedWith.ts","../projections/modelBound/removedWithJoin.ts","../projections/modelBound/setFrom.ts","../projections/modelBound/setFromContext.ts","../projections/modelBound/setValue.ts","../projections/modelBound/subtractFrom.ts","../projections/modelBound/variantOf.ts","../reactors/IReactors.ts","../reactors/ReactorId.ts","../reactors/ReactorSideEffects.ts","../reactors/Reactors.ts","../reactors/index.ts","../reactors/reactor.ts","../readModels/IMaterializedReadModels.ts","../readModels/IReadModels.ts","../readModels/MaterializedReadModels.ts","../readModels/ReadModelChangeset.ts","../readModels/ReadModelId.ts","../readModels/ReadModelSnapshot.ts","../readModels/ReadModelSubjectResolver.ts","../readModels/ReadModels.ts","../readModels/index.ts","../readModels/readModel.ts","../reducers/IReducers.ts","../reducers/ReducerId.ts","../reducers/Reducers.ts","../reducers/index.ts","../reducers/reducer.ts","../schemas/JsonSchema.ts","../schemas/JsonSchemaGenerator.ts","../schemas/index.ts","../schemas/jsonSchemaProperty.ts","../seeding/EventSeeding.ts","../seeding/ICanSeedEvents.ts","../seeding/IEventSeeding.ts","../seeding/IEventSeedingBuilder.ts","../seeding/IEventSeedingScopeBuilder.ts","../seeding/index.ts","../seeding/seeder.ts","../sinks/WellKnownSinks.ts","../sinks/index.ts","../transactions/IUnitOfWork.ts","../transactions/IUnitOfWorkManager.ts","../transactions/NoUnitOfWorkHasBeenStarted.ts","../transactions/UnitOfWork.ts","../transactions/UnitOfWorkManager.ts","../transactions/index.ts","../types/DecoratorType.ts","../types/TypeDiscoverer.ts","../types/TypeIntrospector.ts","../types/index.ts","../webhooks/IWebhook.ts","../webhooks/IWebhookDefinitionBuilder.ts","../webhooks/IWebhooks.ts","../webhooks/WebhookDefinitionBuilder.ts","../webhooks/WebhookId.ts","../webhooks/WebhookTargetUrl.ts","../webhooks/Webhooks.ts","../webhooks/index.ts","../webhooks/webhook.ts"],"version":"6.0.3"}
@@ -19,6 +19,8 @@ export declare enum DecoratorType {
19
19
  /** Webhook artifacts discovered through the webhook decorator. */
20
20
  Webhook = "webhook",
21
21
  /** Event type migration artifacts discovered through the eventTypeMigration decorator. */
22
- EventTypeMigration = "eventTypeMigration"
22
+ EventTypeMigration = "eventTypeMigration",
23
+ /** Global read model variant handler artifacts discovered through the globalFor decorator. */
24
+ GlobalForHandler = "globalForHandler"
23
25
  }
24
26
  //# sourceMappingURL=DecoratorType.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DecoratorType.d.ts","sourceRoot":"","sources":["../../types/DecoratorType.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,oBAAY,aAAa;IACrB,uEAAuE;IACvE,SAAS,cAAc;IAEvB,uEAAuE;IACvE,SAAS,cAAc;IAEvB,kEAAkE;IAClE,OAAO,YAAY;IAEnB,kEAAkE;IAClE,OAAO,YAAY;IAEnB,gEAAgE;IAChE,MAAM,WAAW;IAEjB,wEAAwE;IACxE,UAAU,eAAe;IAEzB,oFAAoF;IACpF,UAAU,eAAe;IAEzB,kEAAkE;IAClE,OAAO,YAAY;IAEnB,0FAA0F;IAC1F,kBAAkB,uBAAuB;CAC5C"}
1
+ {"version":3,"file":"DecoratorType.d.ts","sourceRoot":"","sources":["../../types/DecoratorType.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,oBAAY,aAAa;IACrB,uEAAuE;IACvE,SAAS,cAAc;IAEvB,uEAAuE;IACvE,SAAS,cAAc;IAEvB,kEAAkE;IAClE,OAAO,YAAY;IAEnB,kEAAkE;IAClE,OAAO,YAAY;IAEnB,gEAAgE;IAChE,MAAM,WAAW;IAEjB,wEAAwE;IACxE,UAAU,eAAe;IAEzB,oFAAoF;IACpF,UAAU,eAAe;IAEzB,kEAAkE;IAClE,OAAO,YAAY;IAEnB,0FAA0F;IAC1F,kBAAkB,uBAAuB;IAEzC,8FAA8F;IAC9F,gBAAgB,qBAAqB;CACxC"}
@@ -23,5 +23,7 @@ export var DecoratorType;
23
23
  DecoratorType["Webhook"] = "webhook";
24
24
  /** Event type migration artifacts discovered through the eventTypeMigration decorator. */
25
25
  DecoratorType["EventTypeMigration"] = "eventTypeMigration";
26
+ /** Global read model variant handler artifacts discovered through the globalFor decorator. */
27
+ DecoratorType["GlobalForHandler"] = "globalForHandler";
26
28
  })(DecoratorType || (DecoratorType = {}));
27
29
  //# sourceMappingURL=DecoratorType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DecoratorType.js","sourceRoot":"","sources":["../../types/DecoratorType.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG;;GAEG;AACH,MAAM,CAAN,IAAY,aA2BX;AA3BD,WAAY,aAAa;IACrB,uEAAuE;IACvE,wCAAuB,CAAA;IAEvB,uEAAuE;IACvE,wCAAuB,CAAA;IAEvB,kEAAkE;IAClE,oCAAmB,CAAA;IAEnB,kEAAkE;IAClE,oCAAmB,CAAA;IAEnB,gEAAgE;IAChE,kCAAiB,CAAA;IAEjB,wEAAwE;IACxE,0CAAyB,CAAA;IAEzB,oFAAoF;IACpF,0CAAyB,CAAA;IAEzB,kEAAkE;IAClE,oCAAmB,CAAA;IAEnB,0FAA0F;IAC1F,0DAAyC,CAAA;AAC7C,CAAC,EA3BW,aAAa,KAAb,aAAa,QA2BxB"}
1
+ {"version":3,"file":"DecoratorType.js","sourceRoot":"","sources":["../../types/DecoratorType.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG;;GAEG;AACH,MAAM,CAAN,IAAY,aA8BX;AA9BD,WAAY,aAAa;IACrB,uEAAuE;IACvE,wCAAuB,CAAA;IAEvB,uEAAuE;IACvE,wCAAuB,CAAA;IAEvB,kEAAkE;IAClE,oCAAmB,CAAA;IAEnB,kEAAkE;IAClE,oCAAmB,CAAA;IAEnB,gEAAgE;IAChE,kCAAiB,CAAA;IAEjB,wEAAwE;IACxE,0CAAyB,CAAA;IAEzB,oFAAoF;IACpF,0CAAyB,CAAA;IAEzB,kEAAkE;IAClE,oCAAmB,CAAA;IAEnB,0FAA0F;IAC1F,0DAAyC,CAAA;IAEzC,8FAA8F;IAC9F,sDAAqC,CAAA;AACzC,CAAC,EA9BW,aAAa,KAAb,aAAa,QA8BxB"}
@@ -69,7 +69,7 @@ async function receiveContext(kind: string): Promise<EventContext> {
69
69
  const connection = { reactors: { observe }, reducers: { observe }, readModels: { registerMany: async () => ({}) } } as unknown as ChronicleConnection;
70
70
  const artifacts = {
71
71
  eventTypes: [CanonicalMetadataRecorded], reactors: [CapturingReactor], reducers: [CapturingReducer],
72
- readModels: [], seeders: [], constraints: [], projections: [], webhooks: [], eventTypeMigrations: []
72
+ readModels: [], seeders: [], constraints: [], projections: [], webhooks: [], eventTypeMigrations: [], globalForHandlers: []
73
73
  } as IClientArtifactsProvider;
74
74
  const runtime = kind === 'reactor'
75
75
  ? new Reactors(artifacts, connection, 'store', 'tenant', lifecycle, {} as IEventLog)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/chronicle",
3
- "version": "6.1.0",
3
+ "version": "6.2.0",
4
4
  "description": "Event sourcing for TypeScript and Node.js — the idiomatic client for Cratis Chronicle, the open-source event-sourcing database",
5
5
  "author": "Cratis",
6
6
  "license": "MIT",
@@ -160,7 +160,7 @@
160
160
  },
161
161
  "dependencies": {
162
162
  "@bufbuild/protobuf": "^2.15.0",
163
- "@cratis/chronicle.contracts": "18.5.0",
163
+ "@cratis/chronicle.contracts": "19.0.1",
164
164
  "@grpc/grpc-js": "^1.14.4",
165
165
  "@opentelemetry/api": "^1.9.1",
166
166
  "nice-grpc": "^2.1.17",
@@ -0,0 +1,19 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+
4
+ /**
5
+ * Error thrown when a globalFor shared handler declares a mapping that targets a member a
6
+ * variant it applies to does not have.
7
+ */
8
+ export class GlobalHandlerPropertyNotOnVariant extends Error {
9
+ /**
10
+ * Creates a new {@link GlobalHandlerPropertyNotOnVariant}.
11
+ * @param globalHandlerName - The name of the shared handler type.
12
+ * @param variantName - The name of the variant type missing the property.
13
+ * @param propertyName - The property name the shared handler mapped to.
14
+ */
15
+ constructor(globalHandlerName: string, variantName: string, propertyName: string) {
16
+ super(`Shared handler '${globalHandlerName}' maps to property '${propertyName}', which does not exist on variant '${variantName}'.`);
17
+ this.name = 'GlobalHandlerPropertyNotOnVariant';
18
+ }
19
+ }
@@ -121,7 +121,8 @@ function createProjections(readModels: (new (...args: unknown[]) => unknown)[])
121
121
  constraints: [],
122
122
  projections: [],
123
123
  webhooks: [],
124
- eventTypeMigrations: []
124
+ eventTypeMigrations: [],
125
+ globalForHandlers: []
125
126
  };
126
127
 
127
128
  const projections = new Projections('test-store', 'test-namespace', connection, clientArtifacts, 'test-sink');