interaqt 1.2.0 → 1.4.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 (51) hide show
  1. package/README.md +66 -1
  2. package/agent/agentspace/knowledge/generator/integration-implementation-handler.md +1 -1
  3. package/agent/agentspace/knowledge/usage/03-entity-relations.md +37 -7
  4. package/agent/agentspace/knowledge/usage/04-reactive-computations.md +1 -1
  5. package/agent/agentspace/knowledge/usage/05-interactions.md +12 -1
  6. package/agent/agentspace/knowledge/usage/18-api-exports-reference.md +28 -2
  7. package/agent/skill/interaqt-reference.md +2 -1
  8. package/dist/builtins/interaction/activity/ActivityManager.d.ts.map +1 -1
  9. package/dist/core/Constraint.d.ts +95 -0
  10. package/dist/core/Constraint.d.ts.map +1 -0
  11. package/dist/core/Entity.d.ts +10 -0
  12. package/dist/core/Entity.d.ts.map +1 -1
  13. package/dist/core/EventSource.d.ts +19 -3
  14. package/dist/core/EventSource.d.ts.map +1 -1
  15. package/dist/core/Relation.d.ts +10 -0
  16. package/dist/core/Relation.d.ts.map +1 -1
  17. package/dist/core/index.d.ts +1 -0
  18. package/dist/core/index.d.ts.map +1 -1
  19. package/dist/core/init.d.ts.map +1 -1
  20. package/dist/drivers/Mysql.d.ts +13 -1
  21. package/dist/drivers/Mysql.d.ts.map +1 -1
  22. package/dist/drivers/PGLite.d.ts +13 -1
  23. package/dist/drivers/PGLite.d.ts.map +1 -1
  24. package/dist/drivers/PostgreSQL.d.ts +13 -1
  25. package/dist/drivers/PostgreSQL.d.ts.map +1 -1
  26. package/dist/drivers/SQLite.d.ts +13 -1
  27. package/dist/drivers/SQLite.d.ts.map +1 -1
  28. package/dist/index.js +2586 -1975
  29. package/dist/index.js.map +1 -1
  30. package/dist/runtime/Controller.d.ts +9 -0
  31. package/dist/runtime/Controller.d.ts.map +1 -1
  32. package/dist/runtime/MonoSystem.d.ts.map +1 -1
  33. package/dist/runtime/System.d.ts +33 -2
  34. package/dist/runtime/System.d.ts.map +1 -1
  35. package/dist/runtime/errors/ConstraintErrors.d.ts +36 -0
  36. package/dist/runtime/errors/ConstraintErrors.d.ts.map +1 -0
  37. package/dist/runtime/errors/DatabaseErrors.d.ts +13 -0
  38. package/dist/runtime/errors/DatabaseErrors.d.ts.map +1 -0
  39. package/dist/runtime/errors/index.d.ts +2 -0
  40. package/dist/runtime/errors/index.d.ts.map +1 -1
  41. package/dist/runtime/index.d.ts +2 -0
  42. package/dist/runtime/index.d.ts.map +1 -1
  43. package/dist/runtime/transaction.d.ts +34 -0
  44. package/dist/runtime/transaction.d.ts.map +1 -1
  45. package/dist/storage/erstorage/SchemaDialect.d.ts +29 -0
  46. package/dist/storage/erstorage/SchemaDialect.d.ts.map +1 -0
  47. package/dist/storage/erstorage/Setup.d.ts +24 -1
  48. package/dist/storage/erstorage/Setup.d.ts.map +1 -1
  49. package/dist/storage/index.d.ts +1 -0
  50. package/dist/storage/index.d.ts.map +1 -1
  51. package/package.json +1 -1
package/README.md CHANGED
@@ -61,6 +61,36 @@ No update handlers. No sync bugs. When a like relationship is created, `likeCoun
61
61
 
62
62
  ---
63
63
 
64
+ ## Dispatch Transactions
65
+
66
+ `Controller.dispatch()` is the synchronous fact transaction boundary in interaqt. The framework runs guard checks, `mapEventData`, event record creation, `resolve`, synchronous computations, and `afterDispatch` inside one retryable storage transaction attempt.
67
+
68
+ If any transaction step fails, the event record and all synchronous derived writes from that attempt are rolled back. `postCommit` and record mutation side effects run only after a successful commit; their failures are reported in `sideEffects` and do not roll back committed facts.
69
+
70
+ Use these hooks with the transaction boundary in mind:
71
+
72
+ | Hook | Transaction boundary |
73
+ |---|---|
74
+ | `guard` / `mapEventData` / `resolve` | Run inside the retryable transaction attempt and may be replayed. |
75
+ | `afterDispatch` | Runs before commit inside the transaction. Use it only for response context or local reversible storage work. Do not perform irreversible external IO here. |
76
+ | `postCommit` | Runs after commit. Use it for external IO, notifications, outbox enqueueing, or non-critical response context. |
77
+ | `RecordMutationSideEffect` | Runs after commit for committed mutation events. Failure is reported in `sideEffects`. |
78
+
79
+ Nested `controller.dispatch()` calls are rejected inside a dispatch transaction with `NestedDispatchError`. Dispatching again from `postCommit` or a record mutation side effect is allowed because it starts a new transaction boundary.
80
+
81
+ Database drivers declare their transaction support through `getTransactionCapability()`:
82
+
83
+ | Driver | Transaction support |
84
+ |---|---|
85
+ | PostgreSQL | Strong transaction target: transaction-bound pool client, `READ COMMITTED` and `SERIALIZABLE`, PostgreSQL retryable SQLSTATE handling. |
86
+ | PGLite | Fallback support for local tests and framework retry-path metadata. `SERIALIZABLE` is not a production PostgreSQL isolation guarantee. |
87
+ | SQLite | Local fallback atomicity and framework retry-path metadata. It does not provide PostgreSQL-level concurrent dispatch isolation. |
88
+ | MySQL | Marked unsupported for strong dispatch transactions until it has a transaction-bound connection implementation. |
89
+
90
+ Useful exported helpers include `TransactionCapabilityError`, `TransactionRetryExhaustedError`, `NestedDispatchError`, `isTransactionCapabilityError()`, `isTransactionRetryExhaustedError()`, `isRetryableTransactionError()`, and `hasErrorCode()`.
91
+
92
+ ---
93
+
64
94
  ## Quick Example: Social Post System
65
95
 
66
96
  ```typescript
@@ -245,6 +275,40 @@ const system = new MonoSystem(new PostgreSQLDB({ /* connection config */ }))
245
275
 
246
276
  ---
247
277
 
278
+ ## Schema Constraints and Transaction Boundaries
279
+
280
+ interaqt supports schema-level uniqueness for framework-managed records. Declare uniqueness at the Entity or Relation level with `UniqueConstraint`; the storage setup installs database unique indexes and reports duplicate writes as structured framework errors.
281
+
282
+ ```typescript
283
+ import { Entity, Property, UniqueConstraint } from 'interaqt'
284
+
285
+ const User = Entity.create({
286
+ name: 'User',
287
+ properties: [
288
+ Property.create({ name: 'email', type: 'string' })
289
+ ],
290
+ constraints: [
291
+ UniqueConstraint.create({
292
+ name: 'User_email_unique',
293
+ properties: ['email'],
294
+ violationCode: 'USER_EMAIL_DUPLICATE'
295
+ })
296
+ ]
297
+ })
298
+ ```
299
+
300
+ `controller.dispatch()` runs event persistence and synchronous computation writes in one transaction. Unique conflicts roll back the whole dispatch attempt and can be handled with `ConstraintViolationError` or `findConstraintViolationError(error)`.
301
+
302
+ For diagnostics and migration planning, inspect the read-only schema metadata:
303
+
304
+ ```typescript
305
+ system.storage.schema.constraints
306
+ system.storage.schema.records
307
+ system.storage.schema.tables
308
+ ```
309
+
310
+ ---
311
+
248
312
  ## Installation
249
313
 
250
314
  ```bash
@@ -291,8 +355,9 @@ npm install @electric-sql/pglite
291
355
  - **Activities** — Compose multi-step business workflows from ordered Interactions
292
356
  - **Attributive Permissions** — Declarative, entity-aware access control
293
357
  - **Dictionary** — Global reactive key-value state
358
+ - **Schema Constraints** — Persistent unique constraints with structured duplicate errors
294
359
  - **Hard Deletion** — Built-in support for both soft and hard delete patterns
295
- - **Side Effects** — Hook into record mutations for external integrations (email, payments, file uploads)
360
+ - **Post-Commit Side Effects** — Use `postCommit` or record mutation side effects for external integrations after commit
296
361
 
297
362
  ---
298
363
 
@@ -206,7 +206,7 @@ async setup(controller: Controller) {
206
206
 
207
207
  **Purpose**: Define side effects that synchronize reactive data changes to external systems.
208
208
 
209
- `RecordMutationSideEffect` is the recommended place for irreversible external IO. Interaction callbacks, custom computation callbacks, `afterDispatch`, and `asyncReturn` may be replayed by PostgreSQL transaction retry; side effects run after the final successful commit.
209
+ `postCommit` is the recommended place for irreversible external IO tied to one interaction. `RecordMutationSideEffect` is the recommended place for irreversible external IO driven by record mutations. Interaction callbacks, custom computation callbacks, `afterDispatch`, and `asyncReturn` may be replayed by PostgreSQL transaction retry; post-commit hooks and side effects run after the final successful commit.
210
210
 
211
211
  **Use Cases**:
212
212
  - Push data mutations to external APIs
@@ -36,14 +36,20 @@ One-to-one relations represent unique correspondences between two entities, such
36
36
  ### Basic One-to-One Relation
37
37
 
38
38
  ```javascript
39
- import { Entity, Property, Relation } from 'interaqt';
39
+ import { Entity, Property, Relation, UniqueConstraint } from 'interaqt';
40
40
 
41
41
  // Define user entity
42
42
  const User = Entity.create({
43
43
  name: 'User',
44
44
  properties: [
45
- Property.create({ name: 'email', type: 'string', unique: true }),
45
+ Property.create({ name: 'email', type: 'string' }),
46
46
  Property.create({ name: 'name', type: 'string' })
47
+ ],
48
+ constraints: [
49
+ UniqueConstraint.create({
50
+ name: 'User_email_unique',
51
+ properties: ['email']
52
+ })
47
53
  ]
48
54
  });
49
55
 
@@ -116,8 +122,14 @@ One-to-many relations represent that one entity can be associated with multiple
116
122
  const User = Entity.create({
117
123
  name: 'User',
118
124
  properties: [
119
- Property.create({ name: 'email', type: 'string', unique: true }),
125
+ Property.create({ name: 'email', type: 'string' }),
120
126
  Property.create({ name: 'name', type: 'string' })
127
+ ],
128
+ constraints: [
129
+ UniqueConstraint.create({
130
+ name: 'User_email_unique',
131
+ properties: ['email']
132
+ })
121
133
  ]
122
134
  });
123
135
 
@@ -195,8 +207,14 @@ Many-to-many relations represent multiple associations between two entities, suc
195
207
  const Tag = Entity.create({
196
208
  name: 'Tag',
197
209
  properties: [
198
- Property.create({ name: 'name', type: 'string', unique: true }),
210
+ Property.create({ name: 'name', type: 'string' }),
199
211
  Property.create({ name: 'color', type: 'string', defaultValue: '#666666' })
212
+ ],
213
+ constraints: [
214
+ UniqueConstraint.create({
215
+ name: 'Tag_name_unique',
216
+ properties: ['name']
217
+ })
200
218
  ]
201
219
  });
202
220
 
@@ -499,15 +517,21 @@ const UserPosts = Relation.create({
499
517
  ## Complete Example: Blog System Relation Design
500
518
 
501
519
  ```javascript
502
- import { Entity, Property, Relation } from 'interaqt';
520
+ import { Entity, Property, Relation, UniqueConstraint } from 'interaqt';
503
521
 
504
522
  // Entity definitions
505
523
  const User = Entity.create({
506
524
  name: 'User',
507
525
  properties: [
508
- Property.create({ name: 'email', type: 'string', unique: true }),
526
+ Property.create({ name: 'email', type: 'string' }),
509
527
  Property.create({ name: 'name', type: 'string' }),
510
528
  Property.create({ name: 'avatar', type: 'string' })
529
+ ],
530
+ constraints: [
531
+ UniqueConstraint.create({
532
+ name: 'User_email_unique',
533
+ properties: ['email']
534
+ })
511
535
  ]
512
536
  });
513
537
 
@@ -532,8 +556,14 @@ const Comment = Entity.create({
532
556
  const Tag = Entity.create({
533
557
  name: 'Tag',
534
558
  properties: [
535
- Property.create({ name: 'name', type: 'string', unique: true }),
559
+ Property.create({ name: 'name', type: 'string' }),
536
560
  Property.create({ name: 'color', type: 'string', defaultValue: '#666666' })
561
+ ],
562
+ constraints: [
563
+ UniqueConstraint.create({
564
+ name: 'Tag_name_unique',
565
+ properties: ['name']
566
+ })
537
567
  ]
538
568
  });
539
569
 
@@ -87,7 +87,7 @@ Built-in computations such as Count, Summation, Average, Every, Any, WeightedSum
87
87
 
88
88
  Custom computations are different because interaqt cannot inspect user callback logic. `Custom.create()` defaults to `concurrency: 'serializable'`, so the framework promotes the transaction to PostgreSQL `SERIALIZABLE` and retries on `40001` / `40P01`. Use `concurrency: 'atomic-safe'` only when the custom computation is explicitly written with atomic state, idempotent patches, or other safe primitives.
89
89
 
90
- Because retry replays the transaction attempt, `guard`, `mapEventData`, `resolve`, computation callbacks, `afterDispatch`, and `asyncReturn` must be deterministic and retry-safe. Put irreversible external IO in `recordMutationSideEffects`, which runs after the final commit.
90
+ Because retry replays the transaction attempt, `guard`, `mapEventData`, `resolve`, computation callbacks, `afterDispatch`, and `asyncReturn` must be deterministic and retry-safe. Put irreversible external IO in `postCommit` for interaction-specific effects or `recordMutationSideEffects` for mutation-driven effects; both run after the final commit.
91
91
 
92
92
  ### Core Principle: Data Existence
93
93
 
@@ -32,7 +32,18 @@ These interaction callbacks must be deterministic and retry-safe:
32
32
  - `resolve`
33
33
  - `afterDispatch`
34
34
 
35
- `afterDispatch` runs before commit inside the retryable transaction attempt. It can return response context or perform retry-safe database work, but it must not perform irreversible external IO. Put emails, webhooks, message publishing, payment calls, and other post-commit external effects in `recordMutationSideEffects`.
35
+ `afterDispatch` runs before commit inside the retryable transaction attempt. It can return response context or perform retry-safe database work, but it must not perform irreversible external IO.
36
+
37
+ Use `postCommit` for interaction-specific external IO that should run only after the final successful commit:
38
+
39
+ ```javascript
40
+ CreateOrder.postCommit = async function(args, result) {
41
+ await sendOrderWebhook(result.data);
42
+ return { webhookSent: true };
43
+ };
44
+ ```
45
+
46
+ If `postCommit` fails, committed data is not rolled back; the error is reported in `result.sideEffects.__postCommit.error`. Use `recordMutationSideEffects` when the side effect should be driven by record mutation events rather than by a specific interaction.
36
47
 
37
48
  ## Basic Concepts of Interactions
38
49
 
@@ -9,6 +9,7 @@ import {
9
9
  // Entity-related
10
10
  Entity,
11
11
  Property,
12
+ UniqueConstraint,
12
13
 
13
14
  // Relation-related
14
15
  Relation,
@@ -56,6 +57,10 @@ import {
56
57
  runWithTransactionRetry,
57
58
  isRetryableTransactionError,
58
59
  isRequireSerializableRetry,
60
+ ConstraintViolationError,
61
+ ConstraintSetupError,
62
+ findConstraintViolationError,
63
+ normalizeDatabaseError,
59
64
 
60
65
  // Dictionary (Global State)
61
66
  Dictionary,
@@ -95,17 +100,36 @@ import {
95
100
 
96
101
  ### Basic Entity Definition
97
102
  ```javascript
98
- import { Entity, Property } from 'interaqt';
103
+ import { Entity, Property, UniqueConstraint } from 'interaqt';
99
104
 
100
105
  const User = Entity.create({
101
106
  name: 'User',
102
107
  properties: [
103
108
  Property.create({ name: 'name', type: 'string' }),
104
109
  Property.create({ name: 'email', type: 'string' })
110
+ ],
111
+ constraints: [
112
+ UniqueConstraint.create({
113
+ name: 'User_email_unique',
114
+ properties: ['email']
115
+ })
105
116
  ]
106
117
  });
107
118
  ```
108
119
 
120
+ ### Data Constraints
121
+ ```javascript
122
+ import {
123
+ UniqueConstraint,
124
+ ConstraintViolationError,
125
+ ConstraintSetupError,
126
+ findConstraintViolationError,
127
+ normalizeDatabaseError
128
+ } from 'interaqt';
129
+ ```
130
+
131
+ `UniqueConstraint` declares persistent database uniqueness at Entity or Relation level. Runtime duplicate writes are reported with `ConstraintViolationError`; setup/index creation problems are reported with `ConstraintSetupError`. Use `findConstraintViolationError(error)` when the top-level error may be a wrapped computation error.
132
+
109
133
  ### Complete CRUD Setup
110
134
  ```javascript
111
135
  import {
@@ -178,4 +202,6 @@ const controller = new Controller({
178
202
 
179
203
  5. **Database Drivers**: Choose one based on your needs - PGLiteDB for in-memory testing, PostgreSQLDB for production, etc.
180
204
 
181
- 6. **Transaction helpers**: `runWithTransactionRetry`, `isRetryableTransactionError`, and `isRequireSerializableRetry` are exported for advanced runtime integrations and tests. Most application code should use `Controller.dispatch()` or `system.storage.runInTransaction()` instead of calling retry helpers directly.
205
+ 6. **Transaction helpers**: `runWithTransactionRetry`, `isRetryableTransactionError`, and `isRequireSerializableRetry` are exported for advanced runtime integrations and tests. Most application code should use `Controller.dispatch()` or `system.storage.runInTransaction()` instead of calling retry helpers directly.
206
+
207
+ 7. **Constraint helpers**: `UniqueConstraint`, `ConstraintViolationError`, `ConstraintSetupError`, `findConstraintViolationError`, and `normalizeDatabaseError` are exported for schema-level uniqueness and stable duplicate handling.
@@ -512,10 +512,11 @@ EventSource.create(args: {
512
512
  mapEventData?: (args: TArgs) => Record<string, any>
513
513
  resolve?: (this: Controller, args: TArgs) => Promise<TResult>
514
514
  afterDispatch?: (this: Controller, args: TArgs, result: { data?: TResult }) => Promise<Record<string, unknown> | void>
515
+ postCommit?: (this: Controller, args: TArgs, result: { data?: TResult, context?: Record<string, unknown> }) => Promise<Record<string, unknown> | void>
515
516
  }): EventSourceInstance
516
517
  ```
517
518
 
518
- Custom event source for scheduled tasks, webhooks, or any non-interaction trigger. Dispatch via `controller.dispatch(eventSource, args)`.
519
+ Custom event source for scheduled tasks, webhooks, or any non-interaction trigger. Dispatch via `controller.dispatch(eventSource, args)`. `afterDispatch` runs inside the retryable transaction; use `postCommit` for external IO that must run only after commit.
519
520
 
520
521
  ---
521
522
 
@@ -1 +1 @@
1
- {"version":3,"file":"ActivityManager.d.ts","sourceRoot":"","sources":["../../../../src/builtins/interaction/activity/ActivityManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,M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AmB,CAAC;AAC1H,OAAO,EAA8B,mBAAmB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAG1G,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,eAAO,MAAM,eAAe,eAAe,CAAA;AAE3C,eAAO,MAAM,mBAAmB,gBAwB9B,CAAA;AAEF,eAAO,MAAM,2BAA2B,kBAOtC,CAAA;AAEF,MAAM,WAAW,qBAAqB;IAClC,YAAY,EAAE,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAA;IAC7C,QAAQ,EAAE,cAAc,EAAE,CAAA;IAC1B,SAAS,EAAE,gBAAgB,EAAE,CAAA;CAChC;AAED,qBAAa,eAAe;IACjB,aAAa,4BAAkC;IAC/C,mBAAmB,4BAAkC;IAE5D,OAAO,CAAC,oBAAoB,CAAsC;IAClE,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,iBAAiB,CAAyB;gBAG9C,UAAU,EAAE,gBAAgB,EAAE;IA8BlC,OAAO,CAAC,mCAAmC;IAoE3C,OAAO,CAAC,sBAAsB;IAU9B,SAAS,IAAI,qBAAqB;IAQlC,qCAAqC,CAAC,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM;IAI5F,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAI7D,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;CAGxE"}
@@ -0,0 +1,95 @@
1
+ import { IInstance } from './interfaces.js';
2
+ export type ConstraintPredicateValue = string | number | boolean | null;
3
+ export type ConstraintPredicateOperator = {
4
+ op: 'isNull';
5
+ } | {
6
+ op: 'isNotNull';
7
+ } | {
8
+ op: 'equals';
9
+ value: ConstraintPredicateValue;
10
+ } | {
11
+ op: 'notEquals';
12
+ value: ConstraintPredicateValue;
13
+ } | {
14
+ op: 'in';
15
+ value: ConstraintPredicateValue[];
16
+ } | {
17
+ op: 'notIn';
18
+ value: ConstraintPredicateValue[];
19
+ };
20
+ export type ConstraintPredicate = {
21
+ [propertyName: string]: ConstraintPredicateOperator;
22
+ };
23
+ export interface UniqueConstraintInstance extends IInstance {
24
+ name: string;
25
+ properties: string[];
26
+ where?: ConstraintPredicate;
27
+ violationCode?: string;
28
+ }
29
+ export type ConstraintInstance = UniqueConstraintInstance;
30
+ export interface UniqueConstraintCreateArgs {
31
+ name: string;
32
+ properties: string[];
33
+ where?: ConstraintPredicate;
34
+ violationCode?: string;
35
+ }
36
+ export declare class UniqueConstraint implements UniqueConstraintInstance {
37
+ uuid: string;
38
+ _type: string;
39
+ _options?: {
40
+ uuid?: string;
41
+ };
42
+ name: string;
43
+ properties: string[];
44
+ where?: ConstraintPredicate;
45
+ violationCode?: string;
46
+ constructor(args: UniqueConstraintCreateArgs, options?: {
47
+ uuid?: string;
48
+ });
49
+ static isKlass: true;
50
+ static displayName: string;
51
+ static instances: UniqueConstraintInstance[];
52
+ static public: {
53
+ name: {
54
+ type: "string";
55
+ required: true;
56
+ constraints: {
57
+ nameFormat: ({ name }: {
58
+ name: string;
59
+ }) => boolean;
60
+ };
61
+ };
62
+ properties: {
63
+ type: "string";
64
+ collection: true;
65
+ required: true;
66
+ constraints: {
67
+ nonEmpty: ({ properties }: {
68
+ properties: string[];
69
+ }) => boolean;
70
+ eachNameUnique: ({ properties }: {
71
+ properties: string[];
72
+ }) => boolean;
73
+ };
74
+ };
75
+ where: {
76
+ type: "object";
77
+ collection: false;
78
+ required: false;
79
+ };
80
+ violationCode: {
81
+ type: "string";
82
+ collection: false;
83
+ required: false;
84
+ };
85
+ };
86
+ static create(args: UniqueConstraintCreateArgs, options?: {
87
+ uuid?: string;
88
+ }): UniqueConstraintInstance;
89
+ static stringify(instance: UniqueConstraintInstance): string;
90
+ static clone(instance: UniqueConstraintInstance): UniqueConstraintInstance;
91
+ static is(obj: unknown): obj is UniqueConstraintInstance;
92
+ static check(data: unknown): boolean;
93
+ static parse(json: string): UniqueConstraintInstance;
94
+ }
95
+ //# sourceMappingURL=Constraint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Constraint.d.ts","sourceRoot":"","sources":["../../src/core/Constraint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgC,MAAM,iBAAiB,CAAC;AAI1E,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAExE,MAAM,MAAM,2BAA2B,GACnC;IAAE,EAAE,EAAE,QAAQ,CAAA;CAAE,GAChB;IAAE,EAAE,EAAE,WAAW,CAAA;CAAE,GACnB;IAAE,EAAE,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,wBAAwB,CAAA;CAAE,GACjD;IAAE,EAAE,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,wBAAwB,CAAA;CAAE,GACpD;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,wBAAwB,EAAE,CAAA;CAAE,GAC/C;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,wBAAwB,EAAE,CAAA;CAAE,CAAC;AAEvD,MAAM,MAAM,mBAAmB,GAAG;IAChC,CAAC,YAAY,EAAE,MAAM,GAAG,2BAA2B,CAAC;CACrD,CAAC;AAEF,MAAM,WAAW,wBAAyB,SAAQ,SAAS;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AAE1D,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B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CAIrD"}
@@ -2,6 +2,7 @@ import { IInstance } from './interfaces.js';
2
2
  import { PropertyInstance } from './Property.js';
3
3
  import { ComputationInstance } from './types.js';
4
4
  import { RelationInstance } from './Relation.js';
5
+ import { ConstraintInstance } from './Constraint.js';
5
6
  export interface EntityInstance extends IInstance {
6
7
  name: string;
7
8
  properties: PropertyInstance[];
@@ -10,6 +11,7 @@ export interface EntityInstance extends IInstance {
10
11
  matchExpression?: object;
11
12
  inputEntities?: EntityInstance[];
12
13
  commonProperties?: PropertyInstance[];
14
+ constraints?: ConstraintInstance[];
13
15
  }
14
16
  export interface EntityCreateArgs {
15
17
  name: string;
@@ -19,6 +21,7 @@ export interface EntityCreateArgs {
19
21
  matchExpression?: object;
20
22
  inputEntities?: EntityInstance[];
21
23
  commonProperties?: PropertyInstance[];
24
+ constraints?: ConstraintInstance[];
22
25
  }
23
26
  export declare class Entity implements EntityInstance {
24
27
  uuid: string;
@@ -33,6 +36,7 @@ export declare class Entity implements EntityInstance {
33
36
  matchExpression?: object;
34
37
  inputEntities?: EntityInstance[];
35
38
  commonProperties?: PropertyInstance[];
39
+ constraints?: ConstraintInstance[];
36
40
  constructor(args: EntityCreateArgs, options?: {
37
41
  uuid?: string;
38
42
  });
@@ -97,6 +101,12 @@ export declare class Entity implements EntityInstance {
97
101
  }) => boolean;
98
102
  };
99
103
  };
104
+ constraints: {
105
+ type: "UniqueConstraint";
106
+ collection: true;
107
+ required: false;
108
+ defaultValue: () => never[];
109
+ };
100
110
  };
101
111
  static create(args: EntityCreateArgs, options?: {
102
112
  uuid?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../../src/core/Entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgC,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO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IACtC,WAAW,CAAC,EAAE,kBAAkB,EAAE,CAAC;gBAC9B,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;IAc/D,MAAM,CAAC,OAAO,EAAG,IAAI,CAAU;IAC/B,MAAM,CAAC,WAAW,SAAY;IAC9B,MAAM,CAAC,SAAS,EAAE,cAAc,EAAE,CAAM;IAExC,MAAM,CAAC,MAAM;;;;;uCAKc;oBAAE,IAAI,EAAE,MAAM,CAAA;iBAAE;;;;;;;;iDAUN;oBAAC,UAAU,EAAE,gBAAgB,EAAE,CAAA;iBAAC;;;;;;;;;iDAYhC;oBAAC,UAAU,EAAE,gBAAgB,EAAE,CAAA;iBAAC;;;;;;;;;;;;;;;;;;;;;;;;0EA2BP;oBAAC,UAAU,EAAE,gBAAgB,EAAE,CAAC;oBAAC,aAAa,CAAC,EAAE,cAAc,EAAE,CAAA;iBAAC;;;;;;;;;MAe9H;IAEF,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,cAAc;IAalF,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM;IAqBlD,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,GAAG,cAAc;IAerE,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,cAAc;IAI9C,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;IAqBpC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc;CAI3C"}
@@ -13,7 +13,7 @@ export interface EventSourceInstance<TArgs = unknown, TResult = void> extends II
13
13
  /**
14
14
  * Runs inside the dispatch transaction attempt and may be replayed on retry.
15
15
  */
16
- mapEventData?: (args: TArgs) => Record<string, unknown>;
16
+ mapEventData?: (args: TArgs) => Record<string, unknown> | Promise<Record<string, unknown>>;
17
17
  /**
18
18
  * Runs inside the dispatch transaction attempt and may be replayed on retry.
19
19
  * External side effects should be modeled with record mutation side effects,
@@ -27,16 +27,28 @@ export interface EventSourceInstance<TArgs = unknown, TResult = void> extends II
27
27
  afterDispatch?: (this: CallbackThis, args: TArgs, result: {
28
28
  data?: TResult;
29
29
  }) => Promise<Record<string, unknown> | void>;
30
+ /**
31
+ * Runs after the dispatch transaction has committed successfully. Failures do
32
+ * not roll back committed storage changes and are reported in sideEffects.
33
+ */
34
+ postCommit?: (this: CallbackThis, args: TArgs, result: {
35
+ data?: TResult;
36
+ context?: Record<string, unknown>;
37
+ }) => Promise<Record<string, unknown> | void>;
30
38
  }
31
39
  export interface EventSourceCreateArgs<TArgs = unknown, TResult = void> {
32
40
  name: string;
33
41
  entity: EntityInstance;
34
42
  guard?: (this: CallbackThis, args: TArgs) => Promise<void>;
35
- mapEventData?: (args: TArgs) => Record<string, unknown>;
43
+ mapEventData?: (args: TArgs) => Record<string, unknown> | Promise<Record<string, unknown>>;
36
44
  resolve?: (this: CallbackThis, args: TArgs) => Promise<TResult>;
37
45
  afterDispatch?: (this: CallbackThis, args: TArgs, result: {
38
46
  data?: TResult;
39
47
  }) => Promise<Record<string, unknown> | void>;
48
+ postCommit?: (this: CallbackThis, args: TArgs, result: {
49
+ data?: TResult;
50
+ context?: Record<string, unknown>;
51
+ }) => Promise<Record<string, unknown> | void>;
40
52
  }
41
53
  export declare class EventSource<TArgs = unknown, TResult = void> implements EventSourceInstance<TArgs, TResult> {
42
54
  uuid: string;
@@ -47,11 +59,15 @@ export declare class EventSource<TArgs = unknown, TResult = void> implements Eve
47
59
  name: string;
48
60
  entity: EntityInstance;
49
61
  guard?: (this: CallbackThis, args: TArgs) => Promise<void>;
50
- mapEventData?: (args: TArgs) => Record<string, unknown>;
62
+ mapEventData?: (args: TArgs) => Record<string, unknown> | Promise<Record<string, unknown>>;
51
63
  resolve?: (this: CallbackThis, args: TArgs) => Promise<TResult>;
52
64
  afterDispatch?: (this: CallbackThis, args: TArgs, result: {
53
65
  data?: TResult;
54
66
  }) => Promise<Record<string, unknown> | void>;
67
+ postCommit?: (this: CallbackThis, args: TArgs, result: {
68
+ data?: TResult;
69
+ context?: Record<string, unknown>;
70
+ }) => Promise<Record<string, unknown> | void>;
55
71
  constructor(args: EventSourceCreateArgs<TArgs, TResult>, options?: {
56
72
  uuid?: string;
57
73
  });
@@ -1 +1 @@
1
- {"version":3,"file":"EventSource.d.ts","sourceRoot":"","sources":["../../src/core/EventSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgC,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,KAAK,YAAY,GAAG,GAAG,CAAA;AAEvB,MAAM,WAAW,mBAAmB,CAAC,KAAK,GAAG,OAAO,EAAE,OAAO,GAAG,IAAI,CAAE,SAAQ,SAAS;IACrF,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,cAAc,CAAA;IACtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1D;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACvD;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAC/D;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,E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E,GAAG,CAAC,EAAE,CAAM;IAEvD,MAAM,CAAC,MAAM,CAAC,KAAK,GAAG,OAAO,EAAE,OAAO,GAAG,IAAI,EAC3C,IAAI,EAAE,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,EAC3C,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAC1B,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC;IAYtC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,mBAAmB;IAInD,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;IAIpC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM;IAavD,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,mBAAmB,EAAE,IAAI,EAAE,OAAO,GAAG,mBAAmB;IAY/E,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB;CAIhD"}
@@ -2,6 +2,7 @@ import { IInstance } from './interfaces.js';
2
2
  import { PropertyInstance } from './Property.js';
3
3
  import { EntityInstance } from './Entity.js';
4
4
  import { ComputationInstance } from './types.js';
5
+ import { ConstraintInstance } from './Constraint.js';
5
6
  export interface RelationInstance extends IInstance {
6
7
  name?: string;
7
8
  source: EntityInstance | RelationInstance;
@@ -16,6 +17,7 @@ export interface RelationInstance extends IInstance {
16
17
  matchExpression?: object;
17
18
  inputRelations?: RelationInstance[];
18
19
  commonProperties?: PropertyInstance[];
20
+ constraints?: ConstraintInstance[];
19
21
  }
20
22
  export interface RelationCreateArgs {
21
23
  name?: string;
@@ -31,6 +33,7 @@ export interface RelationCreateArgs {
31
33
  matchExpression?: object;
32
34
  inputRelations?: RelationInstance[];
33
35
  commonProperties?: PropertyInstance[];
36
+ constraints?: ConstraintInstance[];
34
37
  }
35
38
  export declare class Relation implements RelationInstance {
36
39
  uuid: string;
@@ -51,6 +54,7 @@ export declare class Relation implements RelationInstance {
51
54
  matchExpression?: object;
52
55
  inputRelations?: RelationInstance[];
53
56
  commonProperties?: PropertyInstance[];
57
+ constraints?: ConstraintInstance[];
54
58
  get name(): string | undefined;
55
59
  set name(value: string | undefined);
56
60
  constructor(args: RelationCreateArgs, options?: {
@@ -130,6 +134,12 @@ export declare class Relation implements RelationInstance {
130
134
  sameSourceTarget: (thisInstance: RelationInstance) => boolean;
131
135
  };
132
136
  };
137
+ constraints: {
138
+ type: "UniqueConstraint";
139
+ collection: true;
140
+ required: false;
141
+ defaultValue: () => never[];
142
+ };
133
143
  };
134
144
  static create(args: RelationCreateArgs, options?: {
135
145
  uuid?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Relation.d.ts","sourceRoot":"","sources":["../../src/core/Relation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgC,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAY,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAAC;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAAC;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACpC,gBAAgB,CAAC,EAAE,gBAA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;;;;;;;;2DAsBJ,gBAAgB;iDAO1B,gBAAgB;;;;;;;;;MAqBrD;IAEF,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,gBAAgB;IAatF,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM;IAkCpD,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,UAAQ,GAAG,gBAAgB;IA2BxE,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,gBAAgB;IAIhD,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;IAIpC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB;CAI7C"}
@@ -3,6 +3,7 @@ export * from './interfaces.js';
3
3
  import './init.js';
4
4
  export { KlassByName } from './utils.js';
5
5
  export * from './Property.js';
6
+ export * from './Constraint.js';
6
7
  export * from './Entity.js';
7
8
  export * from './Relation.js';
8
9
  export * from './RefContainer.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,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,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;AA8CxD,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;AAgDxD,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -1,5 +1,6 @@
1
- import { Database, DatabaseLogger, EntityIdRef } from '..';
1
+ import { Database, DatabaseLogger, EntityIdRef, TransactionCapability } from '..';
2
2
  import { default as mysql, Connection, ConnectionOptions } from 'mysql2/promise';
3
+ import { defaultEncodeLiteral } from '../storage';
3
4
  declare class IDSystem {
4
5
  db: Database;
5
6
  constructor(db: Database);
@@ -15,6 +16,17 @@ export declare class MysqlDB implements Database {
15
16
  idSystem: IDSystem;
16
17
  logger: DatabaseLogger;
17
18
  db: Connection;
19
+ transactionCapability: TransactionCapability;
20
+ schemaDialect: {
21
+ name: "mysql";
22
+ maxIdentifierLength: number;
23
+ supportsCreateIndexIfNotExists: boolean;
24
+ encodeLiteral: typeof defaultEncodeLiteral;
25
+ constraints: {
26
+ unique: boolean;
27
+ filteredUnique: boolean;
28
+ };
29
+ };
18
30
  constructor(database: string, options?: MysqlDBConfig);
19
31
  open(forceDrop?: boolean): Promise<void>;
20
32
  query<T>(sql: string, where?: unknown[], name?: string): Promise<T[]>;