@cratis/chronicle 6.71.0 → 6.71.2

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 (39) hide show
  1. package/dist/testing/for_ReadModelScenario/when_adding_with_children/given/compiled_projection.d.ts +142 -0
  2. package/dist/testing/for_ReadModelScenario/when_adding_with_children/given/compiled_projection.d.ts.map +1 -0
  3. package/dist/testing/for_ReadModelScenario/when_adding_with_children/given/compiled_projection.js +142 -0
  4. package/dist/testing/for_ReadModelScenario/when_adding_with_children/given/compiled_projection.js.map +1 -0
  5. package/dist/testing/for_ReadModelScenario/when_adding_with_children/given/lifecycle.d.ts +24 -0
  6. package/dist/testing/for_ReadModelScenario/when_adding_with_children/given/lifecycle.d.ts.map +1 -0
  7. package/dist/testing/for_ReadModelScenario/when_adding_with_children/given/lifecycle.js +34 -0
  8. package/dist/testing/for_ReadModelScenario/when_adding_with_children/given/lifecycle.js.map +1 -0
  9. package/dist/testing/for_ReadModelScenario/when_counting_with_children/given/compiled_projection.d.ts +42 -0
  10. package/dist/testing/for_ReadModelScenario/when_counting_with_children/given/compiled_projection.d.ts.map +1 -0
  11. package/dist/testing/for_ReadModelScenario/when_counting_with_children/given/compiled_projection.js +115 -0
  12. package/dist/testing/for_ReadModelScenario/when_counting_with_children/given/compiled_projection.js.map +1 -0
  13. package/dist/testing/for_ReadModelScenario/when_counting_with_children/given/lifecycle.d.ts +20 -0
  14. package/dist/testing/for_ReadModelScenario/when_counting_with_children/given/lifecycle.d.ts.map +1 -0
  15. package/dist/testing/for_ReadModelScenario/when_counting_with_children/given/lifecycle.js +20 -0
  16. package/dist/testing/for_ReadModelScenario/when_counting_with_children/given/lifecycle.js.map +1 -0
  17. package/dist/testing/projections/ProjectionArithmeticChildrenCapabilities.d.ts +17 -0
  18. package/dist/testing/projections/ProjectionArithmeticChildrenCapabilities.d.ts.map +1 -0
  19. package/dist/testing/projections/ProjectionArithmeticChildrenCapabilities.js +74 -0
  20. package/dist/testing/projections/ProjectionArithmeticChildrenCapabilities.js.map +1 -0
  21. package/dist/testing/projections/ProjectionRootCapabilities.d.ts.map +1 -1
  22. package/dist/testing/projections/ProjectionRootCapabilities.js +8 -3
  23. package/dist/testing/projections/ProjectionRootCapabilities.js.map +1 -1
  24. package/dist/tsconfig.tsbuildinfo +1 -1
  25. package/package.json +2 -2
  26. package/testing/for_ReadModelScenario/when_adding_with_children/given/compiled_projection.ts +71 -0
  27. package/testing/for_ReadModelScenario/when_adding_with_children/given/lifecycle.ts +38 -0
  28. package/testing/for_ReadModelScenario/when_adding_with_children/with_a_fluent_projection.spec.ts +64 -0
  29. package/testing/for_ReadModelScenario/when_adding_with_children/with_legacy_decorators.legacy.spec.ts +41 -0
  30. package/testing/for_ReadModelScenario/when_adding_with_children/with_standard_decorators.standard.spec.ts +42 -0
  31. package/testing/for_ReadModelScenario/when_counting_with_children/given/compiled_projection.ts +55 -0
  32. package/testing/for_ReadModelScenario/when_counting_with_children/given/lifecycle.ts +24 -0
  33. package/testing/for_ReadModelScenario/when_counting_with_children/with_a_fluent_projection.spec.ts +94 -0
  34. package/testing/for_ReadModelScenario/when_counting_with_children/with_legacy_decorators.legacy.spec.ts +39 -0
  35. package/testing/for_ReadModelScenario/when_counting_with_children/with_standard_decorators.standard.spec.ts +40 -0
  36. package/testing/projections/ProjectionArithmeticChildrenCapabilities.ts +82 -0
  37. package/testing/projections/ProjectionRootCapabilities.ts +6 -3
  38. package/testing/projections/for_ProjectionCapabilities/when_validating_add_with_children.spec.ts +91 -0
  39. package/testing/projections/for_ProjectionCapabilities/when_validating_count_with_children.spec.ts +97 -0
@@ -0,0 +1,142 @@
1
+ import type { IProjectionBuilderFor } from '../../../../projections/declarative/IProjectionBuilderFor.js';
2
+ export declare class Added {
3
+ readonly amount: number;
4
+ constructor(amount: number);
5
+ }
6
+ declare class TotalAdded {
7
+ readonly total: number;
8
+ constructor(total: number);
9
+ }
10
+ declare class UnderscoreAdded {
11
+ readonly _amount: number;
12
+ constructor(_amount: number);
13
+ }
14
+ export declare class ItemChanged {
15
+ readonly itemId: string;
16
+ readonly name: string;
17
+ constructor(itemId: string, name: string);
18
+ }
19
+ export declare class ItemRemoved {
20
+ readonly itemId: string;
21
+ constructor(itemId: string);
22
+ }
23
+ export declare class Removed {
24
+ }
25
+ export declare class Item {
26
+ itemId: string;
27
+ name: string;
28
+ }
29
+ export declare class Totals {
30
+ id: string;
31
+ total: number;
32
+ items: Item[];
33
+ }
34
+ export declare const variants: ({
35
+ name: string;
36
+ event: new (amount: number) => Added;
37
+ artifacts: {
38
+ readModels: (typeof Totals)[];
39
+ projections: {
40
+ new (): {
41
+ define(builder: IProjectionBuilderFor<Totals>): void;
42
+ };
43
+ }[];
44
+ eventTypes: (typeof ItemChanged | typeof ItemRemoved | typeof Removed | (new (amount: number) => Added))[];
45
+ globalForHandlers: never[];
46
+ reducers: never[];
47
+ reactors: never[];
48
+ seeders: never[];
49
+ constraints: never[];
50
+ webhooks: never[];
51
+ eventTypeMigrations: never[];
52
+ };
53
+ compile: () => import("../../../../projections/CompiledProjectionDefinitions.js").CompiledProjectionDefinitions;
54
+ } | {
55
+ name: string;
56
+ event: new (amount: number) => TotalAdded;
57
+ artifacts: {
58
+ readModels: (typeof Totals)[];
59
+ projections: {
60
+ new (): {
61
+ define(builder: IProjectionBuilderFor<Totals>): void;
62
+ };
63
+ }[];
64
+ eventTypes: (typeof ItemChanged | typeof ItemRemoved | typeof Removed | (new (amount: number) => TotalAdded))[];
65
+ globalForHandlers: never[];
66
+ reducers: never[];
67
+ reactors: never[];
68
+ seeders: never[];
69
+ constraints: never[];
70
+ webhooks: never[];
71
+ eventTypeMigrations: never[];
72
+ };
73
+ compile: () => import("../../../../projections/CompiledProjectionDefinitions.js").CompiledProjectionDefinitions;
74
+ } | {
75
+ name: string;
76
+ event: new (amount: number) => UnderscoreAdded;
77
+ artifacts: {
78
+ readModels: (typeof Totals)[];
79
+ projections: {
80
+ new (): {
81
+ define(builder: IProjectionBuilderFor<Totals>): void;
82
+ };
83
+ }[];
84
+ eventTypes: (typeof ItemChanged | typeof ItemRemoved | typeof Removed | (new (amount: number) => UnderscoreAdded))[];
85
+ globalForHandlers: never[];
86
+ reducers: never[];
87
+ reactors: never[];
88
+ seeders: never[];
89
+ constraints: never[];
90
+ webhooks: never[];
91
+ eventTypeMigrations: never[];
92
+ };
93
+ compile: () => import("../../../../projections/CompiledProjectionDefinitions.js").CompiledProjectionDefinitions;
94
+ })[];
95
+ export declare const artifacts: {
96
+ readModels: (typeof Totals)[];
97
+ projections: {
98
+ new (): {
99
+ define(builder: IProjectionBuilderFor<Totals>): void;
100
+ };
101
+ }[];
102
+ eventTypes: (typeof ItemChanged | typeof ItemRemoved | typeof Removed | (new (amount: number) => Added))[];
103
+ globalForHandlers: never[];
104
+ reducers: never[];
105
+ reactors: never[];
106
+ seeders: never[];
107
+ constraints: never[];
108
+ webhooks: never[];
109
+ eventTypeMigrations: never[];
110
+ } | {
111
+ readModels: (typeof Totals)[];
112
+ projections: {
113
+ new (): {
114
+ define(builder: IProjectionBuilderFor<Totals>): void;
115
+ };
116
+ }[];
117
+ eventTypes: (typeof ItemChanged | typeof ItemRemoved | typeof Removed | (new (amount: number) => TotalAdded))[];
118
+ globalForHandlers: never[];
119
+ reducers: never[];
120
+ reactors: never[];
121
+ seeders: never[];
122
+ constraints: never[];
123
+ webhooks: never[];
124
+ eventTypeMigrations: never[];
125
+ } | {
126
+ readModels: (typeof Totals)[];
127
+ projections: {
128
+ new (): {
129
+ define(builder: IProjectionBuilderFor<Totals>): void;
130
+ };
131
+ }[];
132
+ eventTypes: (typeof ItemChanged | typeof ItemRemoved | typeof Removed | (new (amount: number) => UnderscoreAdded))[];
133
+ globalForHandlers: never[];
134
+ reducers: never[];
135
+ reactors: never[];
136
+ seeders: never[];
137
+ constraints: never[];
138
+ webhooks: never[];
139
+ eventTypeMigrations: never[];
140
+ }, compile: (() => import("../../../../projections/CompiledProjectionDefinitions.js").CompiledProjectionDefinitions) | (() => import("../../../../projections/CompiledProjectionDefinitions.js").CompiledProjectionDefinitions) | (() => import("../../../../projections/CompiledProjectionDefinitions.js").CompiledProjectionDefinitions);
141
+ export {};
142
+ //# sourceMappingURL=compiled_projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiled_projection.d.ts","sourceRoot":"","sources":["../../../../../testing/for_ReadModelScenario/when_adding_with_children/given/compiled_projection.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8DAA8D,CAAC;AAI1G,qBACa,KAAK;IACC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACvC,YAAY,MAAM,EAAE,MAAM,EAA2B;CACxD;AACD,cACM,UAAU;IACG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACtC,YAAY,KAAK,EAAE,MAAM,EAAyB;CACrD;AACD,cACM,eAAe;IACF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACxC,YAAY,OAAO,EAAE,MAAM,EAA6B;CAC3D;AACD,qBACa,WAAW;IACL,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACrC,YAAY,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAA6C;CACxF;AACD,qBACa,WAAW;IACL,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACvC,YAAY,MAAM,EAAE,MAAM,EAA2B;CACxD;AACD,qBACa,OAAO;CAAG;AACvB,qBAAa,IAAI;IACE,MAAM,EAAG,MAAM,CAAC;IAChB,IAAI,EAAG,MAAM,CAAC;CAChC;AACD,qBAAa,MAAM;IACA,EAAE,EAAG,MAAM,CAAC;IACZ,KAAK,EAAG,MAAM,CAAC;IACc,KAAK,EAAG,IAAI,EAAE,CAAC;CAC9D;AAmBD,eAAO,MAAM,QAAQ;;wBAjBgD,MAAM;;;;;gCAEnD,qBAAqB,CAAC,MAAM,CAAC,GAAG,IAAI;;;;;;;;;;;;;;;wBAFS,MAAM;;;;;gCAEnD,qBAAqB,CAAC,MAAM,CAAC,GAAG,IAAI;;;;;;;;;;;;;;;wBAFS,MAAM;;;;;gCAEnD,qBAAqB,CAAC,MAAM,CAAC,GAAG,IAAI;;;;;;;;;;;;;IAmB3D,CAAC;AACF,eAAO,MAAQ,SAAS;;;;4BApBA,qBAAqB,CAAC,MAAM,CAAC,GAAG,IAAI;;;0FAFS,MAAM;;;;;;;;;;;;4BAEnD,qBAAqB,CAAC,MAAM,CAAC,GAAG,IAAI;;;0FAFS,MAAM;;;;;;;;;;;;4BAEnD,qBAAqB,CAAC,MAAM,CAAC,GAAG,IAAI;;;0FAFS,MAAM;;;;;;;;GAsBjD,OAAO,gUAAgB,CAAC"}
@@ -0,0 +1,142 @@
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
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
8
+ };
9
+ var __metadata = (this && this.__metadata) || function (k, v) {
10
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11
+ };
12
+ import { field } from '@cratis/fundamentals';
13
+ import { eventType } from '../../../../events/eventTypeDecorator.js';
14
+ import { projection } from '../../../../projections/declarative/projection.js';
15
+ import { ProjectionDefinitionCompiler } from '../../../../projections/ProjectionDefinitionCompiler.js';
16
+ let Added = class Added {
17
+ amount;
18
+ constructor(amount) { this.amount = amount; }
19
+ };
20
+ __decorate([
21
+ field(Number),
22
+ __metadata("design:type", Number)
23
+ ], Added.prototype, "amount", void 0);
24
+ Added = __decorate([
25
+ eventType('Added'),
26
+ __metadata("design:paramtypes", [Number])
27
+ ], Added);
28
+ export { Added };
29
+ let TotalAdded = class TotalAdded {
30
+ total;
31
+ constructor(total) { this.total = total; }
32
+ };
33
+ __decorate([
34
+ field(Number),
35
+ __metadata("design:type", Number)
36
+ ], TotalAdded.prototype, "total", void 0);
37
+ TotalAdded = __decorate([
38
+ eventType('TotalAdded'),
39
+ __metadata("design:paramtypes", [Number])
40
+ ], TotalAdded);
41
+ let UnderscoreAdded = class UnderscoreAdded {
42
+ _amount;
43
+ constructor(_amount) { this._amount = _amount; }
44
+ };
45
+ __decorate([
46
+ field(Number),
47
+ __metadata("design:type", Number)
48
+ ], UnderscoreAdded.prototype, "_amount", void 0);
49
+ UnderscoreAdded = __decorate([
50
+ eventType('UnderscoreAdded'),
51
+ __metadata("design:paramtypes", [Number])
52
+ ], UnderscoreAdded);
53
+ let ItemChanged = class ItemChanged {
54
+ itemId;
55
+ name;
56
+ constructor(itemId, name) { this.itemId = itemId; this.name = name; }
57
+ };
58
+ __decorate([
59
+ field(String),
60
+ __metadata("design:type", String)
61
+ ], ItemChanged.prototype, "itemId", void 0);
62
+ __decorate([
63
+ field(String),
64
+ __metadata("design:type", String)
65
+ ], ItemChanged.prototype, "name", void 0);
66
+ ItemChanged = __decorate([
67
+ eventType('ItemChanged'),
68
+ __metadata("design:paramtypes", [String, String])
69
+ ], ItemChanged);
70
+ export { ItemChanged };
71
+ let ItemRemoved = class ItemRemoved {
72
+ itemId;
73
+ constructor(itemId) { this.itemId = itemId; }
74
+ };
75
+ __decorate([
76
+ field(String),
77
+ __metadata("design:type", String)
78
+ ], ItemRemoved.prototype, "itemId", void 0);
79
+ ItemRemoved = __decorate([
80
+ eventType('ItemRemoved'),
81
+ __metadata("design:paramtypes", [String])
82
+ ], ItemRemoved);
83
+ export { ItemRemoved };
84
+ let Removed = class Removed {
85
+ };
86
+ Removed = __decorate([
87
+ eventType('Removed')
88
+ ], Removed);
89
+ export { Removed };
90
+ export class Item {
91
+ itemId;
92
+ name;
93
+ }
94
+ __decorate([
95
+ field(String),
96
+ __metadata("design:type", String)
97
+ ], Item.prototype, "itemId", void 0);
98
+ __decorate([
99
+ field(String),
100
+ __metadata("design:type", String)
101
+ ], Item.prototype, "name", void 0);
102
+ export class Totals {
103
+ id;
104
+ total;
105
+ items;
106
+ }
107
+ __decorate([
108
+ field(String),
109
+ __metadata("design:type", String)
110
+ ], Totals.prototype, "id", void 0);
111
+ __decorate([
112
+ field(Number),
113
+ __metadata("design:type", Number)
114
+ ], Totals.prototype, "total", void 0);
115
+ __decorate([
116
+ field(Array, { genericArguments: [Item] }),
117
+ __metadata("design:type", Array)
118
+ ], Totals.prototype, "items", void 0);
119
+ function variant(name, event, operand) {
120
+ class TotalsProjection {
121
+ define(builder) {
122
+ builder.from(event, from => from.add(model => model.total).with(operand))
123
+ .children(model => model.items, child => child.identifiedBy(item => item.itemId)
124
+ .from(ItemChanged, from => from.usingKey(value => value.itemId))
125
+ .removedWith(ItemRemoved, removal => removal.usingKey(value => value.itemId)))
126
+ .removedWith(Removed);
127
+ }
128
+ }
129
+ projection(name, Totals)(TotalsProjection);
130
+ const artifacts = {
131
+ readModels: [Totals], projections: [TotalsProjection], eventTypes: [event, ItemChanged, ItemRemoved, Removed],
132
+ globalForHandlers: [], reducers: [], reactors: [], seeders: [], constraints: [], webhooks: [], eventTypeMigrations: []
133
+ };
134
+ return { name, event, artifacts, compile: () => new ProjectionDefinitionCompiler(artifacts, 'test').compile([TotalsProjection], []) };
135
+ }
136
+ export const variants = [
137
+ variant('add-children-lifecycle', Added, event => event.amount),
138
+ variant('add-children-same-property', TotalAdded, event => event.total),
139
+ variant('add-children-leading-underscore', UnderscoreAdded, event => event._amount)
140
+ ];
141
+ export const { artifacts, compile } = variants[0];
142
+ //# sourceMappingURL=compiled_projection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiled_projection.js","sourceRoot":"","sources":["../../../../../testing/for_ReadModelScenario/when_adding_with_children/given/compiled_projection.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;;;;;;;;;;AAErG,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,mDAAmD,CAAC;AAC/E,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AAGhG,IAAM,KAAK,GAAX,MAAM,KAAK;IACU,MAAM,CAAS;IACvC,YAAY,MAAc,IAAI,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;CACxD,CAAA;AAF2B;IAAvB,KAAK,CAAC,MAAM,CAAC;;qCAAyB;AAD9B,KAAK;IADjB,SAAS,CAAC,OAAO,CAAC;;GACN,KAAK,CAGjB;;AACD,IACM,UAAU,GADhB,MACM,UAAU;IACY,KAAK,CAAS;IACtC,YAAY,KAAa,IAAI,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;CACrD,CAAA;AAF2B;IAAvB,KAAK,CAAC,MAAM,CAAC;;yCAAwB;AADpC,UAAU;IADf,SAAS,CAAC,YAAY,CAAC;;GAClB,UAAU,CAGf;AACD,IACM,eAAe,GADrB,MACM,eAAe;IACO,OAAO,CAAS;IACxC,YAAY,OAAe,IAAI,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;CAC3D,CAAA;AAF2B;IAAvB,KAAK,CAAC,MAAM,CAAC;;gDAA0B;AADtC,eAAe;IADpB,SAAS,CAAC,iBAAiB,CAAC;;GACvB,eAAe,CAGpB;AAEM,IAAM,WAAW,GAAjB,MAAM,WAAW;IACI,MAAM,CAAS;IACf,IAAI,CAAS;IACrC,YAAY,MAAc,EAAE,IAAY,IAAI,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,IAA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AAO,CAAC,wBAAwB,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;IAC/D,OAAO,CAAC,4BAA4B,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;IACvE,OAAO,CAAC,iCAAiC,EAAE,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;CACtF,CAAC;AACF,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { ReadModelScenario } from '../../../ReadModelScenario.js';
2
+ type AddedParent = {
3
+ id: string;
4
+ total: number;
5
+ items: Array<{
6
+ itemId: string;
7
+ name: string;
8
+ }>;
9
+ };
10
+ export declare function history(add?: (amount: number) => object): {
11
+ source: string;
12
+ event: object;
13
+ }[];
14
+ export declare function lifecycle<T extends AddedParent>(scenario: ReadModelScenario<T>): Promise<{
15
+ first: T;
16
+ other: T;
17
+ remaining: T;
18
+ removed: T | null;
19
+ surviving: T;
20
+ recreated: T;
21
+ repeated: T;
22
+ }>;
23
+ export {};
24
+ //# sourceMappingURL=lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../../../testing/for_ReadModelScenario/when_adding_with_children/given/lifecycle.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,KAAK,WAAW,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC;AAEjG,wBAAgB,OAAO,CAAC,GAAG,GAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAoC;;;IAUpF;AAED,wBAAsB,SAAS,CAAC,CAAC,SAAS,WAAW,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC;;;;;;;;GAiBpF"}
@@ -0,0 +1,34 @@
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 { Added, ItemChanged, ItemRemoved, Removed } from './compiled_projection.js';
4
+ export function history(add = amount => new Added(amount)) {
5
+ return [
6
+ { source: 'A', event: add(2.5) }, { source: 'A', event: add(-1) },
7
+ { source: 'A', event: new ItemChanged('one', 'first') }, { source: 'A', event: new ItemChanged('two', 'second') },
8
+ { source: 'A', event: new ItemChanged('one', 'updated') }, { source: 'A', event: add(0) },
9
+ { source: 'B', event: add(8) }, { source: 'B', event: new ItemChanged('one', 'independent') },
10
+ { source: 'A', event: new ItemRemoved('one') }, { source: 'A', event: new ItemRemoved('unknown') },
11
+ { source: 'A', event: new Removed() }, { source: 'A', event: add(4.5) },
12
+ { source: 'A', event: new ItemChanged('new', 'recreated') }
13
+ ];
14
+ }
15
+ export async function lifecycle(scenario) {
16
+ const events = history();
17
+ const seed = (start, end) => {
18
+ for (const { source, event } of events.slice(start, end))
19
+ scenario.given.forEventSource(source).events(event);
20
+ };
21
+ seed(0, 8);
22
+ const first = (await scenario.instanceForEventSourceId('A'));
23
+ const other = (await scenario.instanceForEventSourceId('B'));
24
+ seed(8, 10);
25
+ const remaining = (await scenario.instanceForEventSourceId('A'));
26
+ seed(10, 11);
27
+ const removed = await scenario.instanceForEventSourceId('A');
28
+ const surviving = (await scenario.instanceForEventSourceId('B'));
29
+ seed(11, 13);
30
+ const recreated = (await scenario.instanceForEventSourceId('A'));
31
+ const repeated = (await scenario.instanceForEventSourceId('A'));
32
+ return { first, other, remaining, removed, surviving, recreated, repeated };
33
+ }
34
+ //# sourceMappingURL=lifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.js","sourceRoot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Q,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAE,CAAC;IAClE,MAAM,QAAQ,GAAG,CAAC,MAAM,QAAQ,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAE,CAAC;IACjE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AAChF,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { IProjectionBuilderFor } from '../../../../projections/declarative/IProjectionBuilderFor.js';
2
+ export declare class Counted {
3
+ readonly total: number;
4
+ constructor(total: number);
5
+ }
6
+ export declare class ItemChanged {
7
+ readonly itemId: string;
8
+ readonly name: string;
9
+ constructor(itemId: string, name: string);
10
+ }
11
+ export declare class ItemRemoved {
12
+ readonly itemId: string;
13
+ constructor(itemId: string);
14
+ }
15
+ export declare class Removed {
16
+ }
17
+ export declare class Item {
18
+ itemId: string;
19
+ name: string;
20
+ }
21
+ export declare class Totals {
22
+ id: string;
23
+ total: number;
24
+ items: Item[];
25
+ }
26
+ export declare class TotalsProjection {
27
+ define(builder: IProjectionBuilderFor<Totals>): void;
28
+ }
29
+ export declare const artifacts: {
30
+ readModels: (typeof Totals)[];
31
+ projections: (typeof TotalsProjection)[];
32
+ eventTypes: (typeof Counted | typeof ItemChanged | typeof ItemRemoved | typeof Removed)[];
33
+ globalForHandlers: never[];
34
+ reducers: never[];
35
+ reactors: never[];
36
+ seeders: never[];
37
+ constraints: never[];
38
+ webhooks: never[];
39
+ eventTypeMigrations: never[];
40
+ };
41
+ export declare function compile(): import("../../../../projections/CompiledProjectionDefinitions.js").CompiledProjectionDefinitions;
42
+ //# sourceMappingURL=compiled_projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiled_projection.d.ts","sourceRoot":"","sources":["../../../../../testing/for_ReadModelScenario/when_counting_with_children/given/compiled_projection.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8DAA8D,CAAC;AAI1G,qBACa,OAAO;IACD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACtC,YAAY,KAAK,EAAE,MAAM,EAAyB;CACrD;AACD,qBACa,WAAW;IACL,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACrC,YAAY,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAA6C;CACxF;AACD,qBACa,WAAW;IACL,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACvC,YAAY,MAAM,EAAE,MAAM,EAA2B;CACxD;AACD,qBACa,OAAO;CAAG;AACvB,qBAAa,IAAI;IACE,MAAM,EAAG,MAAM,CAAC;IAChB,IAAI,EAAG,MAAM,CAAC;CAChC;AACD,qBAAa,MAAM;IACA,EAAE,EAAG,MAAM,CAAC;IACZ,KAAK,EAAG,MAAM,CAAC;IACc,KAAK,EAAG,IAAI,EAAE,CAAC;CAC9D;AACD,qBACa,gBAAgB;IACzB,MAAM,CAAC,OAAO,EAAE,qBAAqB,CAAC,MAAM,CAAC,GAAG,IAAI,CAMnD;CACJ;AACD,eAAO,MAAM,SAAS;;;;;;;;;;;CAGc,CAAC;AAErC,wBAAgB,OAAO,qGAEtB"}
@@ -0,0 +1,115 @@
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
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
8
+ };
9
+ var __metadata = (this && this.__metadata) || function (k, v) {
10
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11
+ };
12
+ import { field } from '@cratis/fundamentals';
13
+ import { eventType } from '../../../../events/eventTypeDecorator.js';
14
+ import { projection } from '../../../../projections/declarative/projection.js';
15
+ import { ProjectionDefinitionCompiler } from '../../../../projections/ProjectionDefinitionCompiler.js';
16
+ let Counted = class Counted {
17
+ total;
18
+ constructor(total) { this.total = total; }
19
+ };
20
+ __decorate([
21
+ field(Number),
22
+ __metadata("design:type", Number)
23
+ ], Counted.prototype, "total", void 0);
24
+ Counted = __decorate([
25
+ eventType('Counted'),
26
+ __metadata("design:paramtypes", [Number])
27
+ ], Counted);
28
+ export { Counted };
29
+ let ItemChanged = class ItemChanged {
30
+ itemId;
31
+ name;
32
+ constructor(itemId, name) { this.itemId = itemId; this.name = name; }
33
+ };
34
+ __decorate([
35
+ field(String),
36
+ __metadata("design:type", String)
37
+ ], ItemChanged.prototype, "itemId", void 0);
38
+ __decorate([
39
+ field(String),
40
+ __metadata("design:type", String)
41
+ ], ItemChanged.prototype, "name", void 0);
42
+ ItemChanged = __decorate([
43
+ eventType('ItemChanged'),
44
+ __metadata("design:paramtypes", [String, String])
45
+ ], ItemChanged);
46
+ export { ItemChanged };
47
+ let ItemRemoved = class ItemRemoved {
48
+ itemId;
49
+ constructor(itemId) { this.itemId = itemId; }
50
+ };
51
+ __decorate([
52
+ field(String),
53
+ __metadata("design:type", String)
54
+ ], ItemRemoved.prototype, "itemId", void 0);
55
+ ItemRemoved = __decorate([
56
+ eventType('ItemRemoved'),
57
+ __metadata("design:paramtypes", [String])
58
+ ], ItemRemoved);
59
+ export { ItemRemoved };
60
+ let Removed = class Removed {
61
+ };
62
+ Removed = __decorate([
63
+ eventType('Removed')
64
+ ], Removed);
65
+ export { Removed };
66
+ export class Item {
67
+ itemId;
68
+ name;
69
+ }
70
+ __decorate([
71
+ field(String),
72
+ __metadata("design:type", String)
73
+ ], Item.prototype, "itemId", void 0);
74
+ __decorate([
75
+ field(String),
76
+ __metadata("design:type", String)
77
+ ], Item.prototype, "name", void 0);
78
+ export class Totals {
79
+ id;
80
+ total;
81
+ items;
82
+ }
83
+ __decorate([
84
+ field(String),
85
+ __metadata("design:type", String)
86
+ ], Totals.prototype, "id", void 0);
87
+ __decorate([
88
+ field(Number),
89
+ __metadata("design:type", Number)
90
+ ], Totals.prototype, "total", void 0);
91
+ __decorate([
92
+ field(Array, { genericArguments: [Item] }),
93
+ __metadata("design:type", Array)
94
+ ], Totals.prototype, "items", void 0);
95
+ let TotalsProjection = class TotalsProjection {
96
+ define(builder) {
97
+ builder.from(Counted, from => from.count(model => model.total))
98
+ .children(model => model.items, child => child.identifiedBy(item => item.itemId)
99
+ .from(ItemChanged, from => from.usingKey(event => event.itemId))
100
+ .removedWith(ItemRemoved, removal => removal.usingKey(event => event.itemId)))
101
+ .removedWith(Removed);
102
+ }
103
+ };
104
+ TotalsProjection = __decorate([
105
+ projection('count-children', Totals)
106
+ ], TotalsProjection);
107
+ export { TotalsProjection };
108
+ export const artifacts = {
109
+ readModels: [Totals], projections: [TotalsProjection], eventTypes: [Counted, ItemChanged, ItemRemoved, Removed],
110
+ globalForHandlers: [], reducers: [], reactors: [], seeders: [], constraints: [], webhooks: [], eventTypeMigrations: []
111
+ };
112
+ export function compile() {
113
+ return new ProjectionDefinitionCompiler(artifacts, 'test').compile([TotalsProjection], []);
114
+ }
115
+ //# sourceMappingURL=compiled_projection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiled_projection.js","sourceRoot":"","sources":["../../../../../testing/for_ReadModelScenario/when_counting_with_children/given/compiled_projection.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;;;;;;;;;;AAErG,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,mDAAmD,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AE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,mBAAmB,EAAE,EAAE;CACtF,CAAC;AAErC,MAAM,UAAU,OAAO;IACnB,OAAO,IAAI,4BAA4B,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAAC,CAAC;AAC/F,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { ReadModelScenario } from '../../../ReadModelScenario.js';
2
+ type CountedParent = {
3
+ id: string;
4
+ total: number;
5
+ items: Array<{
6
+ itemId: string;
7
+ name: string;
8
+ }>;
9
+ };
10
+ export declare function lifecycle<T extends CountedParent>(scenario: ReadModelScenario<T>): Promise<{
11
+ first: T;
12
+ other: T;
13
+ remaining: T;
14
+ removed: T | null;
15
+ surviving: T;
16
+ recreated: T;
17
+ repeated: T;
18
+ }>;
19
+ export {};
20
+ //# sourceMappingURL=lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../../../testing/for_ReadModelScenario/when_counting_with_children/given/lifecycle.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,KAAK,aAAa,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC;AAEnG,wBAAsB,SAAS,CAAC,CAAC,SAAS,aAAa,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC;;;;;;;;GAetF"}
@@ -0,0 +1,20 @@
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 { Counted, ItemChanged, ItemRemoved, Removed } from './compiled_projection.js';
4
+ export async function lifecycle(scenario) {
5
+ scenario.given.forEventSource('A').events(new Counted(9000), new Counted(8000));
6
+ scenario.given.forEventSource('A').events(new ItemChanged('one', 'first'), new ItemChanged('two', 'second'), new ItemChanged('one', 'updated'), new Counted(7000));
7
+ scenario.given.forEventSource('B').events(new Counted(6000), new ItemChanged('one', 'independent'));
8
+ const first = (await scenario.instanceForEventSourceId('A'));
9
+ const other = (await scenario.instanceForEventSourceId('B'));
10
+ scenario.given.forEventSource('A').events(new ItemRemoved('one'), new ItemRemoved('unknown'));
11
+ const remaining = (await scenario.instanceForEventSourceId('A'));
12
+ scenario.given.forEventSource('A').events(new Removed());
13
+ const removed = await scenario.instanceForEventSourceId('A');
14
+ const surviving = (await scenario.instanceForEventSourceId('B'));
15
+ scenario.given.forEventSource('A').events(new Counted(5000), new ItemChanged('new', 'recreated'));
16
+ const recreated = (await scenario.instanceForEventSourceId('A'));
17
+ const repeated = (await scenario.instanceForEventSourceId('A'));
18
+ return { first, other, remaining, removed, surviving, recreated, repeated };
19
+ }
20
+ //# sourceMappingURL=lifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../../../../testing/for_ReadModelScenario/when_counting_with_children/given/lifecycle.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAGrG,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAItF,MAAM,CAAC,KAAK,UAAU,SAAS,CAA0B,QAA8B;IACnF,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAChF,QAAQ,CAAC,KAAK,CAAC,cAAc,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CAAC;IAClG,MAAM,SAAS,GAAG,CAAC,MAAM,QAAQ,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAE,CAAC;IAClE,MAAM,QAAQ,GAAG,CAAC,MAAM,QAAQ,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAE,CAAC;IACjE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AAChF,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { JsonSchema } from '../../schemas/JsonSchema.js';
2
+ import type { ProjectionEventSchemaResolver } from './ProjectionEventSchemaResolver.js';
3
+ /** The measured intersection of one root accumulator and independent typed children. */
4
+ export declare class ProjectionArithmeticChildrenCapabilities {
5
+ static supports(schema: JsonSchema, wire: Record<string, unknown>, require: ProjectionEventSchemaResolver['require']): boolean;
6
+ private static accumulator;
7
+ private static unformattedNumber;
8
+ private static rootShape;
9
+ private static exactRootMembers;
10
+ private static countTarget;
11
+ private static plainString;
12
+ private static childShape;
13
+ private static stringItems;
14
+ private static independentEvents;
15
+ private static noInteractions;
16
+ }
17
+ //# sourceMappingURL=ProjectionArithmeticChildrenCapabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProjectionArithmeticChildrenCapabilities.d.ts","sourceRoot":"","sources":["../../../testing/projections/ProjectionArithmeticChildrenCapabilities.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAExF,wFAAwF;AACxF,qBAAa,wCAAwC;IACjD,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,6BAA6B,CAAC,SAAS,CAAC,GAAG,OAAO,CAY7H;IAED,OAAO,CAAC,MAAM,CAAC,WAAW;IAQ1B,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAIhC,OAAO,CAAC,MAAM,CAAC,SAAS;IAMxB,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAM/B,OAAO,CAAC,MAAM,CAAC,WAAW;IAI1B,OAAO,CAAC,MAAM,CAAC,WAAW;IAI1B,OAAO,CAAC,MAAM,CAAC,UAAU;IAKzB,OAAO,CAAC,MAAM,CAAC,WAAW;IAM1B,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAShC,OAAO,CAAC,MAAM,CAAC,cAAc;CAIhC"}