interaqt 1.5.7 → 1.5.9

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 (58) hide show
  1. package/agent/.claude/agents/bug-fix-handler.md +1 -0
  2. package/agent/.claude/agents/code-generation-handler.md +1 -0
  3. package/agent/.claude/agents/computation-generation-handler.md +2 -0
  4. package/agent/.claude/agents/error-check-handler.md +10 -9
  5. package/agent/.claude/agents/implement-design-handler.md +1 -0
  6. package/agent/agentspace/knowledge/generator/api-reference.md +59 -0
  7. package/agent/agentspace/knowledge/generator/computation-analysis.md +2 -1
  8. package/agent/agentspace/knowledge/generator/computation-implementation.md +48 -3
  9. package/agent/agentspace/knowledge/generator/data-analysis.md +1 -1
  10. package/agent/agentspace/knowledge/generator/test-implementation.md +7 -0
  11. package/agent/agentspace/knowledge/usage/04-reactive-computations.md +47 -1
  12. package/agent/agentspace/knowledge/usage/13-testing.md +8 -0
  13. package/agent/agentspace/knowledge/usage/14-api-reference.md +57 -0
  14. package/agent/agentspace/knowledge/usage/18-api-exports-reference.md +6 -2
  15. package/agent/agentspace/knowledge/usage/19-common-anti-patterns.md +38 -0
  16. package/agent/agentspace/knowledge/usage/20-postgresql-concurrency-migration.md +31 -0
  17. package/agent/agentspace/knowledge/usage/README.md +1 -1
  18. package/agent/skill/interaqt-migration.md +54 -1
  19. package/agent/skill/interaqt-patterns.md +47 -2
  20. package/agent/skill/interaqt-recipes.md +120 -0
  21. package/agent/skill/interaqt-reference.md +66 -3
  22. package/dist/core/ScopedSequence.d.ts +118 -0
  23. package/dist/core/ScopedSequence.d.ts.map +1 -0
  24. package/dist/core/index.d.ts +1 -0
  25. package/dist/core/index.d.ts.map +1 -1
  26. package/dist/core/init.d.ts.map +1 -1
  27. package/dist/core/types.d.ts +3 -2
  28. package/dist/core/types.d.ts.map +1 -1
  29. package/dist/drivers/PGLite.d.ts +9 -0
  30. package/dist/drivers/PGLite.d.ts.map +1 -1
  31. package/dist/drivers/PostgreSQL.d.ts +9 -0
  32. package/dist/drivers/PostgreSQL.d.ts.map +1 -1
  33. package/dist/drivers/SQLite.d.ts +9 -0
  34. package/dist/drivers/SQLite.d.ts.map +1 -1
  35. package/dist/index.js +7128 -6185
  36. package/dist/index.js.map +1 -1
  37. package/dist/runtime/Controller.d.ts.map +1 -1
  38. package/dist/runtime/MonoSystem.d.ts +4 -4
  39. package/dist/runtime/MonoSystem.d.ts.map +1 -1
  40. package/dist/runtime/Scheduler.d.ts +2 -1
  41. package/dist/runtime/Scheduler.d.ts.map +1 -1
  42. package/dist/runtime/System.d.ts +54 -4
  43. package/dist/runtime/System.d.ts.map +1 -1
  44. package/dist/runtime/computations/Computation.d.ts +1 -1
  45. package/dist/runtime/computations/Computation.d.ts.map +1 -1
  46. package/dist/runtime/computations/ScopedSequence.d.ts +20 -0
  47. package/dist/runtime/computations/ScopedSequence.d.ts.map +1 -0
  48. package/dist/runtime/computations/index.d.ts +2 -0
  49. package/dist/runtime/computations/index.d.ts.map +1 -1
  50. package/dist/runtime/migration.d.ts +88 -1
  51. package/dist/runtime/migration.d.ts.map +1 -1
  52. package/dist/runtime/scopedSequenceManifest.d.ts +32 -0
  53. package/dist/runtime/scopedSequenceManifest.d.ts.map +1 -0
  54. package/dist/runtime/scopedSequenceMatch.d.ts +8 -0
  55. package/dist/runtime/scopedSequenceMatch.d.ts.map +1 -0
  56. package/dist/runtime/scopedSequenceScope.d.ts +8 -0
  57. package/dist/runtime/scopedSequenceScope.d.ts.map +1 -0
  58. package/package.json +2 -1
@@ -53,7 +53,7 @@ The Klass pattern uses `generateUUID()` internally. Manual IDs risk collisions a
53
53
  - [ ] Entity name is PascalCase and singular (`User` not `users`)
54
54
  - [ ] No manual UUID assignment
55
55
  - [ ] Computed properties that depend only on the same record use `computed`, NOT Transform
56
- - [ ] Properties with reactive computations (Count, etc.) include `defaultValue`
56
+ - [ ] Properties with aggregate/state reactive computations include `defaultValue`; `ScopedSequence` does not
57
57
 
58
58
  ---
59
59
 
@@ -148,6 +148,7 @@ Without `type`, the framework cannot determine cardinality. ALWAYS explicitly se
148
148
  | Check ANY related record matches condition | `Any` |
149
149
  | Derive new entities from events or other entities | `Transform` (on Entity `computation`) |
150
150
  | Update a property value based on state transitions | `StateMachine` (on Property `computation`) |
151
+ | Allocate a per-scope serial number on create | `ScopedSequence` (on number Property `computation`) |
151
152
  | Simple computation from same-record fields | `computed` (on Property) |
152
153
 
153
154
  ```typescript
@@ -239,12 +240,56 @@ Property.create({
239
240
  ### WHY
240
241
  All computations are declared within the `computation` field of Entity, Relation, or Property. The `dict` parameter in Controller is for global Dictionary instances only.
241
242
 
243
+ ### CORRECT: Scoped atomic serial numbers
244
+ ```typescript
245
+ import { Entity, Property, ScopedSequence, UniqueConstraint } from 'interaqt'
246
+
247
+ const assetSerial = ScopedSequence.create({
248
+ name: 'projectAssetSerial',
249
+ scope: [
250
+ { name: 'project', type: 'ref', base: Project, path: 'project' },
251
+ { name: 'prefix', type: 'string', path: 'prefix' },
252
+ ],
253
+ })
254
+
255
+ const Media = Entity.create({
256
+ name: 'Media',
257
+ properties: [
258
+ Property.create({ name: 'project', type: 'id' }),
259
+ Property.create({ name: 'prefix', type: 'string' }),
260
+ Property.create({
261
+ name: 'serialNumber',
262
+ type: 'number',
263
+ computation: assetSerial,
264
+ }),
265
+ ],
266
+ constraints: [
267
+ UniqueConstraint.create({
268
+ name: 'uniqMediaProjectPrefixSerial',
269
+ properties: ['project', 'prefix', 'serialNumber'],
270
+ }),
271
+ ],
272
+ })
273
+ ```
274
+
275
+ ### WHY
276
+ `ScopedSequence` is the declarative way to allocate values like `project + prefix + serialNumber`. It runs after the host record is created and before the dispatch transaction commits. Do not implement this with `StateMachine(lastValue + 1)`, `Custom`, direct SQL, or `max(serialNumber) + 1`; those approaches are not safe across PostgreSQL connections.
277
+
278
+ ### ScopedSequence Checklist
279
+ - [ ] The sequence property is `type: 'number'`
280
+ - [ ] The sequence property has no `defaultValue`
281
+ - [ ] The sequence property is not insert-time non-null
282
+ - [ ] Every scope path reads a primitive/ref value already present on the created record
283
+ - [ ] A `UniqueConstraint` covers the scope fields plus the sequence property
284
+ - [ ] Existing data migrations seed every scope with `initializeFrom`; do not partial-seed with `initializeFrom.match` unless the sequence only ever applies to that subset
285
+
242
286
  ### Checklist
243
287
  - [ ] Transform is on `Entity.computation` or `Relation.computation`, NEVER on `Property.computation`
244
288
  - [ ] Count, WeightedSummation, Every, Any are on `Property.computation`
245
289
  - [ ] StateMachine is on `Property.computation`
290
+ - [ ] ScopedSequence is on a number `Property.computation` for scoped serial allocation
246
291
  - [ ] `computed` is used for same-record-only property derivations
247
- - [ ] Properties with computation ALWAYS have `defaultValue`
292
+ - [ ] Properties with aggregate/state computations have `defaultValue`; `ScopedSequence` does not
248
293
  - [ ] NEVER pass computations to Controller constructor
249
294
 
250
295
  ---
@@ -555,3 +555,123 @@ const successResult = await controller.dispatch(SharePost, {
555
555
  - **Condition on Interaction**: The `Condition.create` is attached to the Interaction's `conditions` field. The `content` function receives the event args and returns `true` to allow or `false` to reject. The `this` context is bound to the Controller, providing access to `this.system.storage` for database queries.
556
556
  - **`isRef: true`**: The payload contains only an ID reference. With `isRef: true`, the payload value is the entity ID directly (e.g., `payload: { post: draftPost.id }`).
557
557
  - **Error in result, not exception**: Condition failures return `{ error: { type: 'condition check failed' } }`, consistent with all interaqt error handling. Never use try-catch.
558
+
559
+ ---
560
+
561
+ # Recipe: Scoped Media Serial Numbers
562
+
563
+ ## Scenario
564
+ A media system needs `serialNumber` values that increment independently for each `(project, prefix)` pair, for example `Project A + img -> 1, 2, 3` and `Project A + video -> 1, 2`. This demonstrates `ScopedSequence` as a property computation.
565
+
566
+ ## Complete Implementation
567
+
568
+ ```typescript
569
+ import {
570
+ Entity, Property, UniqueConstraint, ScopedSequence,
571
+ Interaction, Action, Payload, PayloadItem,
572
+ Transform, InteractionEventEntity,
573
+ Controller, MonoSystem, PGLiteDB, KlassByName, MatchExp
574
+ } from 'interaqt'
575
+
576
+ const Project = Entity.create({
577
+ name: 'Project',
578
+ properties: [
579
+ Property.create({ name: 'name', type: 'string' })
580
+ ]
581
+ })
582
+
583
+ const mediaSerial = ScopedSequence.create({
584
+ name: 'projectMediaSerial',
585
+ scope: [
586
+ { name: 'project', type: 'ref', base: Project, path: 'project' },
587
+ { name: 'prefix', type: 'string', path: 'prefix' },
588
+ ],
589
+ })
590
+
591
+ const Media = Entity.create({
592
+ name: 'Media',
593
+ properties: [
594
+ Property.create({ name: 'project', type: 'id' }),
595
+ Property.create({ name: 'prefix', type: 'string' }),
596
+ Property.create({ name: 'url', type: 'string' }),
597
+ Property.create({
598
+ name: 'serialNumber',
599
+ type: 'number',
600
+ computation: mediaSerial,
601
+ }),
602
+ Property.create({
603
+ name: 'displayName',
604
+ type: 'string',
605
+ computed: (record) => record.serialNumber
606
+ ? `${record.prefix}-${record.serialNumber}`
607
+ : record.prefix,
608
+ }),
609
+ ],
610
+ constraints: [
611
+ UniqueConstraint.create({
612
+ name: 'uniqMediaProjectPrefixSerial',
613
+ properties: ['project', 'prefix', 'serialNumber'],
614
+ }),
615
+ ],
616
+ computation: Transform.create({
617
+ record: InteractionEventEntity,
618
+ attributeQuery: ['interactionName', 'payload'],
619
+ callback: (event) => {
620
+ if (event.interactionName !== 'CreateMedia') return null
621
+ return {
622
+ project: event.payload.project,
623
+ prefix: event.payload.prefix,
624
+ url: event.payload.url,
625
+ }
626
+ }
627
+ })
628
+ })
629
+
630
+ const CreateMedia = Interaction.create({
631
+ name: 'CreateMedia',
632
+ action: Action.create({ name: 'createMedia' }),
633
+ payload: Payload.create({
634
+ items: [
635
+ PayloadItem.create({ name: 'project', type: 'string', required: true }),
636
+ PayloadItem.create({ name: 'prefix', type: 'string', required: true }),
637
+ PayloadItem.create({ name: 'url', type: 'string', required: true }),
638
+ ]
639
+ })
640
+ })
641
+
642
+ const system = new MonoSystem(new PGLiteDB())
643
+ system.conceptClass = KlassByName
644
+ const controller = new Controller({
645
+ system,
646
+ entities: [Project, Media],
647
+ relations: [],
648
+ eventSources: [CreateMedia],
649
+ dict: [],
650
+ })
651
+
652
+ await controller.setup(true)
653
+
654
+ await controller.dispatch(CreateMedia, {
655
+ user: { id: 'system' },
656
+ payload: { project: 'project-1', prefix: 'img', url: 'a.png' },
657
+ })
658
+ await controller.dispatch(CreateMedia, {
659
+ user: { id: 'system' },
660
+ payload: { project: 'project-1', prefix: 'img', url: 'b.png' },
661
+ })
662
+
663
+ const media = await system.storage.find(
664
+ 'Media',
665
+ MatchExp.atom({ key: 'project', value: ['=', 'project-1'] }),
666
+ undefined,
667
+ ['id', 'project', 'prefix', 'serialNumber']
668
+ )
669
+ // img serials are [1, 2]
670
+ ```
671
+
672
+ ## Design Decisions
673
+ - **ScopedSequence on `serialNumber`**: The serial is allocated per `{ project, prefix }` scope. This is safer than `max(serialNumber) + 1` and works across PostgreSQL controllers.
674
+ - **Scope values are persisted fields**: `project` and `prefix` are present on the new `Media` record before `serialNumber` allocation.
675
+ - **UniqueConstraint remains required**: The allocator provides the next value; the unique constraint is the database integrity backstop.
676
+ - **No `defaultValue` on `serialNumber`**: Allocation is post-create/pre-commit.
677
+ - **Migration note**: If existing media rows already have serials, declare `initializeFrom` on the `ScopedSequence` and seed every existing scope before enabling automatic allocation.
@@ -35,7 +35,7 @@ Property.create(args: {
35
35
  collection?: boolean // true for array types
36
36
  defaultValue?: Function // Factory function returning default value
37
37
  computed?: (record: any) => any // Computed from same-record fields (not persisted)
38
- computation?: ComputationInstance // Reactive: Count, Summation, WeightedSummation, Every, Any, StateMachine, Custom
38
+ computation?: ComputationInstance // Reactive: Count, Summation, WeightedSummation, Every, Any, StateMachine, ScopedSequence, Custom
39
39
  }): PropertyInstance
40
40
  ```
41
41
 
@@ -43,7 +43,7 @@ Constraints:
43
43
  - `type` is REQUIRED — always specify it
44
44
  - `computed` is for same-record derivations only — NOT persisted
45
45
  - `computation` results ARE persisted and auto-updated
46
- - When using `computation`, provide `defaultValue`
46
+ - Most aggregate/state computations need a `defaultValue`; `ScopedSequence` is an exception because the allocator supplies the value after create
47
47
  - NEVER use Transform on Property `computation` — Transform belongs on Entity/Relation `computation`
48
48
 
49
49
  ---
@@ -312,6 +312,69 @@ trigger: {
312
312
 
313
313
  ---
314
314
 
315
+ ## ScopedSequence.create
316
+
317
+ ```typescript
318
+ ScopedSequence.create(args: {
319
+ name: string
320
+ scope: Array<
321
+ | { name: string, type: 'string' | 'number' | 'boolean', path: string }
322
+ | { name: string, type: 'ref', base: EntityInstance, path: string }
323
+ >
324
+ initialValue?: number // Defaults to 0; first automatic value is initialValue + step
325
+ step?: number // Positive integer, defaults to 1
326
+ allowManualValue?: boolean // Defaults to false; only for import/backfill paths
327
+ initializeFrom?: {
328
+ record: EntityInstance
329
+ valuePath: string
330
+ scope: Array<{ name: string, path: string }>
331
+ aggregate: 'max'
332
+ }
333
+ }): ScopedSequenceInstance
334
+ ```
335
+
336
+ Use `ScopedSequence` when a `number` property needs a transactionally allocated, per-scope serial such as `{ project, prefix } -> 1, 2, 3`.
337
+
338
+ ```typescript
339
+ const assetSerial = ScopedSequence.create({
340
+ name: 'projectAssetSerial',
341
+ scope: [
342
+ { name: 'project', type: 'ref', base: Project, path: 'project' },
343
+ { name: 'prefix', type: 'string', path: 'prefix' },
344
+ ],
345
+ })
346
+
347
+ const Media = Entity.create({
348
+ name: 'Media',
349
+ properties: [
350
+ Property.create({ name: 'project', type: 'id' }),
351
+ Property.create({ name: 'prefix', type: 'string' }),
352
+ Property.create({
353
+ name: 'serialNumber',
354
+ type: 'number',
355
+ computation: assetSerial,
356
+ }),
357
+ ],
358
+ constraints: [
359
+ UniqueConstraint.create({
360
+ name: 'uniqProjectPrefixSerial',
361
+ properties: ['project', 'prefix', 'serialNumber'],
362
+ }),
363
+ ],
364
+ })
365
+ ```
366
+
367
+ Constraints:
368
+ - Place only on `Property.computation`, and the property must be `type: 'number'`.
369
+ - Do not add `defaultValue` or a non-null insert-time constraint to the same property. Allocation is post-create/pre-commit.
370
+ - Scope paths read persisted values already present on the created record. Do not use relation traversal, queries, or values produced by another post-create computation.
371
+ - Keep the database unique constraint for the same scope fields plus sequence property.
372
+ - `allowManualValue: true` preserves imported values and does not advance the counter. Use `initializeFrom` during migration to seed counters from existing data.
373
+ - Do not use `initializeFrom.match` for partial seeding of a sequence that will later allocate for all host rows; seed every existing scope that the property will cover.
374
+ - PostgreSQL is the production-safe cross-connection driver. PGLite/SQLite are suitable for tests or single-process local use only.
375
+
376
+ ---
377
+
315
378
  ## Controller
316
379
 
317
380
  ```typescript
@@ -557,7 +620,7 @@ import {
557
620
 
558
621
  // Computations
559
622
  Count, Every, Any, Summation, WeightedSummation, Average,
560
- Transform, StateMachine, StateNode, StateTransfer,
623
+ ScopedSequence, Transform, StateMachine, StateNode, StateTransfer,
561
624
  RealTime, Custom,
562
625
 
563
626
  // Math (for RealTime)
@@ -0,0 +1,118 @@
1
+ import { IInstance } from './interfaces.js';
2
+ import { EntityInstance } from './Entity.js';
3
+ import { BoolExp, ExpressionData } from './BoolExp.js';
4
+ export type ScopedSequenceScopeItem = {
5
+ name: string;
6
+ type: 'string' | 'number' | 'boolean';
7
+ path: string;
8
+ } | {
9
+ name: string;
10
+ type: 'ref';
11
+ base: EntityInstance;
12
+ path: string;
13
+ };
14
+ export type ScopedSequenceInitializer = {
15
+ record: EntityInstance;
16
+ valuePath: string;
17
+ scope: Array<{
18
+ name: string;
19
+ path: string;
20
+ }>;
21
+ aggregate: 'max';
22
+ match?: ScopedSequenceMatchExpression;
23
+ };
24
+ export type ScopedSequenceMatchOperator = '=' | '!=' | 'is null' | 'is not null' | 'in' | 'not in';
25
+ export type ScopedSequenceMatchAtom = {
26
+ key: string;
27
+ value: [ScopedSequenceMatchOperator, unknown];
28
+ };
29
+ export type ScopedSequenceMatchExpression = ExpressionData<ScopedSequenceMatchAtom> | BoolExp<ScopedSequenceMatchAtom>;
30
+ export interface ScopedSequenceInstance extends IInstance {
31
+ name: string;
32
+ scope: ScopedSequenceScopeItem[];
33
+ match?: ScopedSequenceMatchExpression;
34
+ initialValue?: number;
35
+ step?: number;
36
+ allowManualValue?: boolean;
37
+ initializeFrom?: ScopedSequenceInitializer;
38
+ }
39
+ export interface ScopedSequenceCreateArgs {
40
+ name: string;
41
+ scope: ScopedSequenceScopeItem[];
42
+ match?: ScopedSequenceMatchExpression;
43
+ initialValue?: number;
44
+ step?: number;
45
+ allowManualValue?: boolean;
46
+ initializeFrom?: ScopedSequenceInitializer;
47
+ }
48
+ export declare function normalizeScopedSequenceMatchExpression(match: ScopedSequenceMatchExpression | undefined): ExpressionData<ScopedSequenceMatchAtom> | undefined;
49
+ export declare function stableScopedSequenceMatchStringify(match: ScopedSequenceMatchExpression | undefined): string;
50
+ export declare function getEffectiveScopedSequenceInitializerMatch(args: Pick<ScopedSequenceInstance, 'match' | 'initializeFrom'>): ExpressionData<ScopedSequenceMatchAtom> | undefined;
51
+ export declare class ScopedSequence implements ScopedSequenceInstance {
52
+ uuid: string;
53
+ _type: string;
54
+ _options?: {
55
+ uuid?: string;
56
+ };
57
+ name: string;
58
+ scope: ScopedSequenceScopeItem[];
59
+ match?: ScopedSequenceMatchExpression;
60
+ initialValue?: number;
61
+ step?: number;
62
+ allowManualValue?: boolean;
63
+ initializeFrom?: ScopedSequenceInitializer;
64
+ constructor(args: ScopedSequenceCreateArgs, options?: {
65
+ uuid?: string;
66
+ });
67
+ static isKlass: true;
68
+ static displayName: string;
69
+ static instances: ScopedSequenceInstance[];
70
+ static public: {
71
+ name: {
72
+ type: "string";
73
+ required: true;
74
+ constraints: {
75
+ format: ({ name }: {
76
+ name: string;
77
+ }) => boolean;
78
+ };
79
+ };
80
+ scope: {
81
+ instanceType: ScopedSequenceScopeItem;
82
+ collection: true;
83
+ required: true;
84
+ };
85
+ match: {
86
+ instanceType: ScopedSequenceMatchExpression;
87
+ collection: false;
88
+ required: false;
89
+ };
90
+ initialValue: {
91
+ type: "number";
92
+ required: false;
93
+ };
94
+ step: {
95
+ type: "number";
96
+ required: false;
97
+ };
98
+ allowManualValue: {
99
+ type: "boolean";
100
+ required: false;
101
+ };
102
+ initializeFrom: {
103
+ instanceType: ScopedSequenceInitializer;
104
+ collection: false;
105
+ required: false;
106
+ };
107
+ };
108
+ static create(args: ScopedSequenceCreateArgs, options?: {
109
+ uuid?: string;
110
+ }): ScopedSequenceInstance;
111
+ static validate(args: ScopedSequenceCreateArgs): void;
112
+ static stringify(instance: ScopedSequenceInstance): string;
113
+ static clone(instance: ScopedSequenceInstance): ScopedSequenceInstance;
114
+ static is(obj: unknown): obj is ScopedSequenceInstance;
115
+ static check(data: unknown): boolean;
116
+ static parse(json: string): ScopedSequenceInstance;
117
+ }
118
+ //# sourceMappingURL=ScopedSequence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScopedSequence.d.ts","sourceRoot":"","sources":["../../src/core/ScopedSequence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAAkB,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAI5D,MAAM,MAAM,uBAAuB,GAC/B;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACtC,IAAI,EAAE,MAAM,CAAC;CACd,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEN,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7C,SAAS,EAAE,KA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,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,sBAAsB;IAItD,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;IAIpC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,sBAAsB;CAQnD"}
@@ -20,6 +20,7 @@ export * from './Any.js';
20
20
  export * from './Transform.js';
21
21
  export * from './RealTime.js';
22
22
  export * from './Custom.js';
23
+ export * from './ScopedSequence.js';
23
24
  export * from './RealDictionary.js';
24
25
  export * from './SideEffect.js';
25
26
  export * from './EventSource.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAGhC,OAAO,WAAW,CAAC;AACnB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAGlC,cAAc,cAAc,CAAC;AAG7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAGhC,cAAc,kBAAkB,CAAC;AAGjC,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAGhC,OAAO,WAAW,CAAC;AACnB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAGlC,cAAc,cAAc,CAAC;AAG7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAGhC,cAAc,kBAAkB,CAAC;AAGjC,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/core/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,YAAY,CAAC;AAgDxD,OAAO,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/core/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,YAAY,CAAC;AAkDxD,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -13,11 +13,12 @@ import { StateMachineInstance } from './StateMachine';
13
13
  import { RealTimeInstance } from './RealTime';
14
14
  import { DictionaryInstance } from './RealDictionary';
15
15
  import { CustomInstance } from './Custom';
16
- export type { EntityInstance, RelationInstance, PropertyInstance, EventSourceInstance, CountInstance, SummationInstance, AverageInstance, WeightedSummationInstance, EveryInstance, AnyInstance, TransformInstance, StateMachineInstance, RealTimeInstance, DictionaryInstance };
16
+ import { ScopedSequenceInstance } from './ScopedSequence';
17
+ export type { EntityInstance, RelationInstance, PropertyInstance, EventSourceInstance, CountInstance, SummationInstance, AverageInstance, WeightedSummationInstance, EveryInstance, AnyInstance, TransformInstance, StateMachineInstance, RealTimeInstance, DictionaryInstance, ScopedSequenceInstance };
17
18
  /**
18
19
  * Union type of all computation instances
19
20
  */
20
- export type ComputationInstance = CountInstance | SummationInstance | AverageInstance | WeightedSummationInstance | EveryInstance | AnyInstance | TransformInstance | StateMachineInstance | RealTimeInstance | CustomInstance;
21
+ export type ComputationInstance = CountInstance | SummationInstance | AverageInstance | WeightedSummationInstance | EveryInstance | AnyInstance | TransformInstance | StateMachineInstance | RealTimeInstance | CustomInstance | ScopedSequenceInstance;
21
22
  /**
22
23
  * Record type that can be used in computations.
23
24
  * Any named record source: Entity or Relation.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO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Ae,EACf,yBAAyB,EACzB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACvB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC3B,aAAa,GACb,iBAAiB,GACjB,eAAe,GACf,yBAAyB,GACzB,aAAa,GACb,WAAW,GACX,iBAAiB,GACjB,oBAAoB,GACpB,gBAAgB,GAChB,cAAc,GACd,sBAAsB,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GACzB,cAAc,GACd,gBAAgB,CAAC;AAErB;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;AAC/E,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,4BAA4B,CAAC;AAC3E,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,EAAE,CAAC;AAG1D,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
@@ -18,6 +18,14 @@ export declare class PGLiteDB implements Database {
18
18
  db: InstanceType<typeof PGlite>;
19
19
  supportsSelectForUpdate: boolean;
20
20
  transactionCapability: TransactionCapability;
21
+ atomicSequenceCapability: {
22
+ requiresActiveTransaction: true;
23
+ transactional: boolean;
24
+ crossConnection: boolean;
25
+ crossProcess: boolean;
26
+ returning: boolean;
27
+ productionSafe: boolean;
28
+ };
21
29
  schemaDialect: {
22
30
  name: "postgres";
23
31
  maxIdentifierLength: number;
@@ -33,6 +41,7 @@ export declare class PGLiteDB implements Database {
33
41
  open(forceDrop?: boolean): Promise<void>;
34
42
  openForSchemaRead(): Promise<void>;
35
43
  setupInternalComputationState(): Promise<void>;
44
+ setupScopedSequenceState(): Promise<void>;
36
45
  query<T>(sql: string, params?: unknown[], name?: string): Promise<T[]>;
37
46
  update<T>(sql: string, values: unknown[], idField?: string, name?: string): Promise<T[]>;
38
47
  insert(sql: string, values: unknown[], name?: string): Promise<EntityIdRef>;
@@ -1 +1 @@
1
- {"version":3,"file":"PGLite.d.ts","sourceRoot":"","sources":["../../src/drivers/PGLite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAE,WAAW,EAA6E,qBAAqB,EAAC,MAAM,UAAU,CAAC;AACjK,OAAO,EAAE,MAAM,EAAC,MAAM,sBAAsB,CAAA;AAE5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,cAAM,QAAQ;IACS,EAAE,EAAE,QAAQ;gBAAZ,EAAE,EAAE,QAAQ;IAC/B,KAAK;IAGC,SAAS,CAAC,UAAU,EAAE,MAAM;CAGrC;AAED,MAAM,MAAM,cAAc,GAAG;IAAE,MAAM,CAAC,EAAE,cAAc,CAAA;CAAE,CAAA;AAExD,qBAAa,QAAS,YAAW,QAAQ;IAsBlB,QAAQ,CAAC,EAAC,MAAM;IAAS,OAAO,EAAE,cAAc;IArBnE,QAAQ,EAAG,QAAQ,CAAA;IACnB,MAAM,EAAE,cAAc,CAAA;IACtB,EAAE,EAAE,YAAY,CAAC,OAAO,MAAM,CAAC,CAAA;IAC/B,uBAAuB,UAAO;IAC9B,qBAAqB,EAAE,qBAAqB,CAS3C;IACD,aAAa;;;;;;;;;;MAMZ;gBACkB,QAAQ,CAAC,EAAC,MAAM,YAAA,EAAS,OAAO,GAAE,cAAmB;IAKlE,IAAI,CAAC,SAAS,UAAQ;IAqBtB,iBAAiB;IAIjB,6BAA6B;IAU7B,KAAK,C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E,OAAO,EAAE,sBAAsB,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC,EAAE,MAAM,MAAM;;;;IAYzL,cAAc;IAOd,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO;CAmBtD"}
@@ -32,6 +32,14 @@ export declare class PostgreSQLDB implements Database {
32
32
  private transactionContext;
33
33
  supportsSelectForUpdate: boolean;
34
34
  transactionCapability: TransactionCapability;
35
+ atomicSequenceCapability: {
36
+ requiresActiveTransaction: true;
37
+ transactional: boolean;
38
+ crossConnection: boolean;
39
+ crossProcess: boolean;
40
+ returning: boolean;
41
+ productionSafe: boolean;
42
+ };
35
43
  schemaDialect: {
36
44
  name: "postgres";
37
45
  maxIdentifierLength: number;
@@ -49,6 +57,7 @@ export declare class PostgreSQLDB implements Database {
49
57
  private getQueryable;
50
58
  runInTransaction<T>(options: TransactionOptions, fn: () => Promise<T>): Promise<T>;
51
59
  setupInternalComputationState(): Promise<void>;
60
+ setupScopedSequenceState(): Promise<void>;
52
61
  query<T>(sql: string, where?: unknown[], name?: string): Promise<T[]>;
53
62
  update<T>(sql: string, values: unknown[], idField?: string, name?: string): Promise<T[]>;
54
63
  insert(sql: string, values: unknown[], name?: string): Promise<EntityIdRef>;
@@ -1 +1 @@
1
- {"version":3,"file":"PostgreSQL.d.ts","sourceRoot":"","sources":["../../src/drivers/PostgreSQL.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAuG,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAG/M,OAAO,EAAE,EAAE,EAAE,KAAK,YAAY,EAAkB,MAAM,IAAI,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,QAAA,MAAQ,MAAM,oBAAE,IAAI,gBAAO,CAAA;AAQ3B,cAAM,QAAQ;IAGS,EAAE,EAAE,YAAY;IAFnC,O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20
20
  transactionCapability: TransactionCapability;
21
+ atomicSequenceCapability: {
22
+ requiresActiveTransaction: true;
23
+ transactional: boolean;
24
+ crossConnection: boolean;
25
+ crossProcess: boolean;
26
+ returning: boolean;
27
+ productionSafe: boolean;
28
+ };
21
29
  schemaDialect: {
22
30
  name: "sqlite";
23
31
  maxIdentifierLength: number;
@@ -33,6 +41,7 @@ export declare class SQLiteDB implements Database {
33
41
  open(): Promise<void>;
34
42
  openForSchemaRead(): Promise<void>;
35
43
  setupInternalComputationState(): Promise<void>;
44
+ setupScopedSequenceState(): Promise<void>;
36
45
  query<T>(sql: string, where?: unknown[], name?: string): Promise<T[]>;
37
46
  update(sql: string, values: unknown[], idField?: string, name?: string): Promise<EntityIdRef[]>;
38
47
  insert(sql: string, values: unknown[], name?: string): Promise<EntityIdRef>;
@@ -1 +1 @@
1
- {"version":3,"file":"SQLite.d.ts","sourceRoot":"","sources":["../../src/drivers/SQLite.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAE,WAAW,EAA6E,qBAAqB,EAAC,MAAM,UAAU,CAAC;AACjK,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,cAAM,QAAQ;IACS,EAAE,EAAE,QAAQ;gBAAZ,EAAE,EAAE,QAAQ;IAC/B,KAAK;IAGC,SAAS,CAAC,UAAU,EAAE,MAAM;CAWrC;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,cAAc,CAAA;CAAE,CAAA;AAEvF,qBAAa,QAAS,YAAW,QAAQ;IAsBlB,IAAI,EAAC,MAAM;IAAsB,OAAO,CAAC,EAAE,eAAe;IArB7E,EAAE,EAAG,YAAY,CAAC,OAAO,MAAM,CAAC,CAAA;IAChC,QAAQ,EAAG,QAAQ,CAAA;IACnB,MAAM,EAAE,cAAc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