@ankhorage/contracts 1.5.0 → 1.7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ankhorage/contracts
2
2
 
3
+ ## 1.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - eff4efc: Add provider-neutral state adapter contracts for path-based reads, writes, subscriptions, and optional removal support.
8
+
9
+ ## 1.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - bde43ab: Add provider-neutral action value sources, typed action bindings, and normalized command DTO contracts for event-driven runtime action resolution.
14
+
3
15
  ## 1.5.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './auth';
2
2
  export * from './db';
3
+ export * from './state';
3
4
  export * from './storage';
4
5
  export * from './types';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './auth';
2
2
  export * from './db';
3
+ export * from './state';
3
4
  export * from './storage';
4
5
  export * from './types';
5
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC","sourcesContent":["export * from './auth';\nexport * from './db';\nexport * from './storage';\nexport * from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC","sourcesContent":["export * from './auth';\nexport * from './db';\nexport * from './state';\nexport * from './storage';\nexport * from './types';\n"]}
@@ -0,0 +1,41 @@
1
+ export type StatePrimitive = string | number | boolean | null;
2
+ export type StateValue = StatePrimitive | readonly StateValue[] | {
3
+ readonly [key: string]: StateValue;
4
+ };
5
+ export type StatePath = string | readonly string[];
6
+ export interface StateAdapterCapabilities {
7
+ readonly subscriptions: boolean;
8
+ readonly computed: boolean;
9
+ readonly persistence: boolean;
10
+ }
11
+ export interface StateAdapterError {
12
+ readonly code: string;
13
+ readonly message: string;
14
+ readonly cause?: unknown;
15
+ }
16
+ export type StateSuccess<TValue = void> = [TValue] extends [void] ? {
17
+ readonly ok: true;
18
+ } : {
19
+ readonly ok: true;
20
+ readonly data: TValue;
21
+ };
22
+ export type StateResult<TValue = void> = StateSuccess<TValue> | {
23
+ readonly ok: false;
24
+ readonly error: StateAdapterError;
25
+ };
26
+ export interface StateSnapshot<TValue extends StateValue = StateValue> {
27
+ readonly path: StatePath;
28
+ readonly value: TValue | undefined;
29
+ }
30
+ export type StateListener<TValue extends StateValue = StateValue> = (snapshot: StateSnapshot<TValue>) => void;
31
+ export interface StateSubscription {
32
+ unsubscribe(): Promise<void> | void;
33
+ }
34
+ export interface StateAdapter {
35
+ readonly capabilities: StateAdapterCapabilities;
36
+ get<TValue extends StateValue = StateValue>(path: StatePath): StateResult<TValue | undefined>;
37
+ set<TValue extends StateValue = StateValue>(path: StatePath, value: TValue): StateResult;
38
+ subscribe<TValue extends StateValue = StateValue>(path: StatePath, listener: StateListener<TValue>): StateResult<StateSubscription>;
39
+ delete?(path: StatePath): StateResult;
40
+ }
41
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE9D,MAAM,MAAM,UAAU,GAClB,cAAc,GACd,SAAS,UAAU,EAAE,GACrB;IACE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;CACpC,CAAC;AAEN,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;AAEnD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,MAAM,YAAY,CAAC,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAC7D;IACE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;CACnB,GACD;IACE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAEN,MAAM,MAAM,WAAW,CAAC,MAAM,GAAG,IAAI,IACjC,YAAY,CAAC,MAAM,CAAC,GACpB;IACE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;CACnC,CAAC;AAEN,MAAM,WAAW,aAAa,CAAC,MAAM,SAAS,UAAU,GAAG,UAAU;IACnE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED,MAAM,MAAM,aAAa,CAAC,MAAM,SAAS,UAAU,GAAG,UAAU,IAAI,CAClE,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,KAC5B,IAAI,CAAC;AAEV,MAAM,WAAW,iBAAiB;IAChC,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,YAAY,EAAE,wBAAwB,CAAC;IAEhD,GAAG,CAAC,MAAM,SAAS,UAAU,GAAG,UAAU,EAAE,IAAI,EAAE,SAAS,GAAG,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC9F,GAAG,CAAC,MAAM,SAAS,UAAU,GAAG,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC;IACzF,SAAS,CAAC,MAAM,SAAS,UAAU,GAAG,UAAU,EAC9C,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAC9B,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAClC,MAAM,CAAC,CAAC,IAAI,EAAE,SAAS,GAAG,WAAW,CAAC;CACvC"}
package/dist/state.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"","sourcesContent":["export type StatePrimitive = string | number | boolean | null;\n\nexport type StateValue =\n | StatePrimitive\n | readonly StateValue[]\n | {\n readonly [key: string]: StateValue;\n };\n\nexport type StatePath = string | readonly string[];\n\nexport interface StateAdapterCapabilities {\n readonly subscriptions: boolean;\n readonly computed: boolean;\n readonly persistence: boolean;\n}\n\nexport interface StateAdapterError {\n readonly code: string;\n readonly message: string;\n readonly cause?: unknown;\n}\n\nexport type StateSuccess<TValue = void> = [TValue] extends [void]\n ? {\n readonly ok: true;\n }\n : {\n readonly ok: true;\n readonly data: TValue;\n };\n\nexport type StateResult<TValue = void> =\n | StateSuccess<TValue>\n | {\n readonly ok: false;\n readonly error: StateAdapterError;\n };\n\nexport interface StateSnapshot<TValue extends StateValue = StateValue> {\n readonly path: StatePath;\n readonly value: TValue | undefined;\n}\n\nexport type StateListener<TValue extends StateValue = StateValue> = (\n snapshot: StateSnapshot<TValue>,\n) => void;\n\nexport interface StateSubscription {\n unsubscribe(): Promise<void> | void;\n}\n\nexport interface StateAdapter {\n readonly capabilities: StateAdapterCapabilities;\n\n get<TValue extends StateValue = StateValue>(path: StatePath): StateResult<TValue | undefined>;\n set<TValue extends StateValue = StateValue>(path: StatePath, value: TValue): StateResult;\n subscribe<TValue extends StateValue = StateValue>(\n path: StatePath,\n listener: StateListener<TValue>,\n ): StateResult<StateSubscription>;\n delete?(path: StatePath): StateResult;\n}\n"]}
package/dist/types.d.ts CHANGED
@@ -56,21 +56,82 @@ export type Action = AlertAction | ConsoleAction | FilterAction | NavigateAction
56
56
  export type ManifestValue = string | number | boolean | null | readonly ManifestValue[] | {
57
57
  readonly [key: string]: ManifestValue;
58
58
  };
59
- export type ActionBindingPayload = Record<string, ManifestValue>;
59
+ export type ActionValue = ManifestValue;
60
+ export type ActionBindingPayload = Record<string, ActionValue>;
60
61
  export type ActionConditionSource = 'context' | 'event' | 'state';
61
62
  export type ActionConditionOperator = 'eq' | 'exists' | 'neq' | 'notExists';
62
63
  export interface ActionCondition {
63
64
  readonly source: ActionConditionSource;
64
65
  readonly path: string;
65
66
  readonly operator: ActionConditionOperator;
66
- readonly value?: ManifestValue;
67
+ readonly value?: ActionValue;
67
68
  }
68
- export interface ActionBinding {
69
- readonly type: string;
70
- readonly payload?: ActionBindingPayload;
69
+ export type ActionValueSource = {
70
+ readonly source: 'context';
71
+ readonly path: string;
72
+ } | {
73
+ readonly source: 'event';
74
+ readonly path: string;
75
+ } | {
76
+ readonly source: 'literal';
77
+ readonly value: ActionValue;
78
+ } | {
79
+ readonly source: 'state';
80
+ readonly path: string;
81
+ };
82
+ export type ActionValueTransform = 'lowercase' | 'trim' | 'uppercase';
83
+ export interface ActionValueBinding {
84
+ readonly valueFrom: ActionValueSource;
85
+ readonly transform?: ActionValueTransform | readonly ActionValueTransform[];
86
+ }
87
+ export interface ActionBinding<TType extends string = string, TPayload extends object = ActionBindingPayload> {
88
+ readonly type: TType;
89
+ readonly payload?: TPayload;
71
90
  readonly when?: ActionCondition;
72
91
  }
73
- export type UiNodeEventBindings = Record<string, readonly ActionBinding[]>;
92
+ export type DbPersistMode = 'columns' | 'json';
93
+ export interface DbPersistFieldBinding {
94
+ readonly field: string;
95
+ readonly valueFrom: ActionValueSource;
96
+ readonly transform?: ActionValueTransform | readonly ActionValueTransform[];
97
+ }
98
+ export interface DbPersistActionPayload {
99
+ readonly collection: string;
100
+ readonly kind?: string;
101
+ readonly mode?: DbPersistMode;
102
+ readonly jsonField?: string;
103
+ readonly values: readonly DbPersistFieldBinding[];
104
+ }
105
+ export interface DbPersistActionBinding extends ActionBinding<'db.persist', DbPersistActionPayload> {
106
+ readonly payload: DbPersistActionPayload;
107
+ }
108
+ export interface EmailSendActionPayload {
109
+ readonly to: string;
110
+ readonly subject?: string;
111
+ readonly body?: string;
112
+ readonly bodyFrom?: ActionValueSource;
113
+ }
114
+ export interface EmailSendActionBinding extends ActionBinding<'email.send', EmailSendActionPayload> {
115
+ readonly payload: EmailSendActionPayload;
116
+ }
117
+ export type KnownActionBinding = DbPersistActionBinding | EmailSendActionBinding;
118
+ export type UiNodeEventBindings = Record<string, readonly ActionBinding<string, object>[]>;
119
+ export interface CommandDto<TType extends string = string, TPayload extends object = Record<string, ActionValue>> {
120
+ readonly type: TType;
121
+ readonly payload: TPayload;
122
+ }
123
+ export type DbPersistOperation = 'insert';
124
+ export type DbPersistCommandValues = Record<string, ActionValue>;
125
+ export interface DbPersistCommandPayload {
126
+ readonly operation: DbPersistOperation;
127
+ readonly collection: string;
128
+ readonly kind?: string;
129
+ readonly mode?: DbPersistMode;
130
+ readonly jsonField?: string;
131
+ readonly values: DbPersistCommandValues;
132
+ }
133
+ export type DbPersistCommand = CommandDto<'db.persist.command', DbPersistCommandPayload>;
134
+ export type KnownCommandDto = DbPersistCommand;
74
135
  export type ComponentEventPayloadValue = ManifestValue;
75
136
  export interface ComponentEventDto<TType extends string = string, TPayload extends object = Record<string, ComponentEventPayloadValue>> {
76
137
  readonly type: TType;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAElF,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,eAAe,CAAC;IACvB,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,OAAO,GACP,SAAS,GACT,gBAAgB,GAChB,aAAa,GACb,QAAQ,GACR,QAAQ,CAAC;AAEb,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;KAC1C,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,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WAAW,CAAC;IACtB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACpC,QAAQ,EAAE;QACR,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE;YACZ,aAAa,EAAE,MAAM,CAAC;YACtB,OAAO,EAAE,MAAM,EAAE,CAAC;SACnB,CAAC;QACF,QAAQ,EAAE,cAAc,CAAC;KAC1B,CAAC;CACH"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAyJA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AAGpE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,eAAe;IACf,uBAAuB;IACvB,iBAAiB;IACjB,oBAAoB;IACpB,qBAAqB;IACrB,eAAe;IACf,YAAY;IACZ,OAAO;IACP,iBAAiB;IACjB,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,SAAS;IACT,aAAa;IACb,mBAAmB;IACnB,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,mBAAmB;IACnB,kBAAkB;IAClB,QAAQ;IACR,iBAAiB;IACjB,SAAS;CACD,CAAC;AAGX,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,UAAU,CAAU,CAAC;AAIxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,UAAU,CAAU,CAAC;AAIxD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,CAAU,CAAC;AAGvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC;AAG/D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU,CAAC;AAGrD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAG3D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAU,CAAC;AAGrE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAAU,CAAU,CAAC;AAIpD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAU,CAAC;AAGhF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,YAAY,EAAE,qBAAqB,CAAU,CAAC;AAGpF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,GAAG,wBAAwB;IAC3B,WAAW;IACX,UAAU;IACV,aAAa;IACb,WAAW;CACH,CAAC","sourcesContent":["import type { ColorHarmony } from '@ankhorage/color-theory';\n\nimport type { AuthFlowConfig, AuthIdentifierKind, AuthSignUpField } from './auth';\n\nexport interface ThemeModeConfig {\n primaryColor: string;\n harmony: ColorHarmony;\n}\n\nexport interface ThemeConfig {\n id: string;\n name: string;\n light: ThemeModeConfig;\n dark: ThemeModeConfig;\n}\n\nexport type ActionType =\n | 'navigate'\n | 'alert'\n | 'console'\n | 'toggleDarkMode'\n | 'setLanguage'\n | 'search'\n | 'filter';\n\nexport interface NavigateAction {\n type: 'navigate';\n payload: {\n route: string;\n params?: Record<string, number | string>;\n };\n}\n\nexport interface AlertAction {\n type: 'alert';\n payload?: {\n message?: string;\n };\n}\n\nexport interface ConsoleAction {\n type: 'console';\n payload?: Record<string, unknown>;\n}\n\nexport interface ToggleDarkModeAction {\n type: 'toggleDarkMode';\n payload?: never;\n}\n\nexport interface SetLanguageAction {\n type: 'setLanguage';\n payload: {\n locale: string;\n };\n}\n\nexport interface SearchAction {\n type: 'search';\n payload: {\n query: string;\n scope?: string;\n };\n}\n\nexport interface FilterAction {\n type: 'filter';\n payload: {\n filterKey: string;\n filterValue: string;\n };\n}\n\nexport type Action =\n | AlertAction\n | ConsoleAction\n | FilterAction\n | NavigateAction\n | SearchAction\n | SetLanguageAction\n | ToggleDarkModeAction;\n\nexport type ManifestValue =\n | string\n | number\n | boolean\n | null\n | readonly ManifestValue[]\n | { readonly [key: string]: ManifestValue };\n\nexport type ActionBindingPayload = Record<string, ManifestValue>;\n\nexport type ActionConditionSource = 'context' | 'event' | 'state';\n\nexport type ActionConditionOperator = 'eq' | 'exists' | 'neq' | 'notExists';\n\nexport interface ActionCondition {\n readonly source: ActionConditionSource;\n readonly path: string;\n readonly operator: ActionConditionOperator;\n readonly value?: ManifestValue;\n}\n\nexport interface ActionBinding {\n readonly type: string;\n readonly payload?: ActionBindingPayload;\n readonly when?: ActionCondition;\n}\n\nexport type UiNodeEventBindings = Record<string, readonly ActionBinding[]>;\n\nexport type ComponentEventPayloadValue = ManifestValue;\n\nexport interface ComponentEventDto<\n TType extends string = string,\n TPayload extends object = Record<string, ComponentEventPayloadValue>,\n> {\n readonly type: TType;\n readonly sourceNodeId: string;\n readonly payload: TPayload;\n}\n\nexport type FormSubmitValues = Record<string, ComponentEventPayloadValue>;\n\nexport type FormSubmitEventDto = ComponentEventDto<\n 'form.submit',\n {\n readonly values: FormSubmitValues;\n }\n>;\n\nexport type ButtonPressEventDto = ComponentEventDto<'button.press', Record<string, never>>;\n\nexport interface CollectionItemPressPayload {\n readonly itemId: string | number;\n readonly item: Record<string, ComponentEventPayloadValue>;\n}\n\nexport type CollectionItemPressEventDto = ComponentEventDto<\n 'collection.itemPress',\n CollectionItemPressPayload\n>;\n\nexport type ComponentEventDtoKind =\n | ButtonPressEventDto['type']\n | CollectionItemPressEventDto['type']\n | FormSubmitEventDto['type'];\n\nexport type KnownComponentEventDto =\n | ButtonPressEventDto\n | CollectionItemPressEventDto\n | FormSubmitEventDto;\n\nexport const NAVIGATOR_TYPES = ['stack', 'tabs', 'drawer'] as const;\nexport type NavigatorType = (typeof NAVIGATOR_TYPES)[number];\n\nexport const APP_CATEGORIES = [\n 'books_reading',\n 'business_productivity',\n 'developer_tools',\n 'education_learning',\n 'entertainment_media',\n 'finance_money',\n 'food_drink',\n 'games',\n 'graphics_design',\n 'health_fitness',\n 'kids_family',\n 'lifestyle',\n 'medical',\n 'music_audio',\n 'navigation_travel',\n 'news_magazines',\n 'photo_video',\n 'reference',\n 'shopping_commerce',\n 'social_community',\n 'sports',\n 'utilities_tools',\n 'weather',\n] as const;\nexport type AppCategory = (typeof APP_CATEGORIES)[number];\n\nexport const DEPLOYMENT_TARGETS = ['minikube'] as const;\nexport type KnownDeploymentTarget = (typeof DEPLOYMENT_TARGETS)[number];\nexport type DeploymentTarget = KnownDeploymentTarget | (string & {});\n\nexport const DATABASE_PROVIDERS = ['supabase'] as const;\nexport type KnownDatabaseProvider = (typeof DATABASE_PROVIDERS)[number];\nexport type DatabaseProvider = KnownDatabaseProvider | (string & {});\n\nexport const DATABASE_TIERS = ['dev', 'prod'] as const;\nexport type DatabaseTier = (typeof DATABASE_TIERS)[number];\n\nexport const STORAGE_PROVIDERS = ['auto', 's3', 'r2'] as const;\nexport type StorageProvider = (typeof STORAGE_PROVIDERS)[number];\n\nexport const AUTHZ_KINDS = ['RBAC', 'ABAC'] as const;\nexport type AuthzKind = (typeof AUTHZ_KINDS)[number];\n\nexport const AUTHZ_ENGINES = ['cerbos', 'native'] as const;\nexport type AuthzEngine = (typeof AUTHZ_ENGINES)[number];\n\nexport const AUTH_SCOPES = ['global', 'none', 'integrated'] as const;\nexport type AuthScope = (typeof AUTH_SCOPES)[number];\n\nexport const AUTH_PROVIDERS = ['supabase'] as const;\nexport type KnownAuthProvider = (typeof AUTH_PROVIDERS)[number];\nexport type AuthProvider = KnownAuthProvider | (string & {});\n\nexport const AUTH_SIGN_IN_IDENTIFIERS = ['email', 'username', 'phone'] as const;\nexport type AuthSignInIdentifier = AuthIdentifierKind;\n\nexport const AUTH_SIGN_UP_POLICIES = ['autoSignIn', 'requireVerification'] as const;\nexport type AuthSignUpPolicy = (typeof AUTH_SIGN_UP_POLICIES)[number];\n\nexport const AUTH_PROFILE_FIELDS = [\n ...AUTH_SIGN_IN_IDENTIFIERS,\n 'firstName',\n 'lastName',\n 'displayName',\n 'avatarUrl',\n] as const;\nexport type KnownAuthProfileField = (typeof AUTH_PROFILE_FIELDS)[number];\nexport type AuthProfileField = KnownAuthProfileField | (string & {});\n\nexport interface IconSpec {\n name: string;\n provider?: string;\n size?: number | string;\n color?: string;\n}\n\nexport interface UiNode {\n id: string;\n type: string;\n alias?: string;\n props?: Record<string, unknown>;\n children?: UiNode[];\n style?: Record<string, number | string>;\n events?: UiNodeEventBindings;\n}\n\nexport interface ScreenSpec {\n id: string;\n name: string;\n title?: string;\n description?: string;\n root: UiNode;\n}\n\nexport interface NavigatorSpec {\n type: NavigatorType;\n initialRouteName?: string;\n routes: RouteDefinition[];\n options?: Record<string, unknown>;\n}\n\nexport interface RouteDefinition {\n name: string;\n path?: string;\n label?: string;\n icon?: IconSpec;\n hideInTabBar?: boolean;\n guards?: string[];\n screenId?: string;\n navigator?: NavigatorSpec;\n}\n\nexport interface DeploymentSpec {\n target: DeploymentTarget;\n monitoring: boolean;\n}\n\nexport interface DatabaseSpec {\n provider: DatabaseProvider;\n tier: DatabaseTier;\n}\n\nexport interface StorageSpec {\n provider: StorageProvider;\n buckets: string[];\n}\n\nexport interface AuthzSpec {\n kind: AuthzKind;\n engine: AuthzEngine;\n}\n\nexport interface AuthSignInSpec {\n identifiers: AuthSignInIdentifier[];\n}\n\nexport interface AuthSignUpSpec {\n requiredFields: AuthSignUpField[];\n optionalFields?: AuthSignUpField[];\n signUpPolicy?: AuthSignUpPolicy;\n}\n\nexport interface AuthProfileSpec {\n fields: AuthProfileField[];\n}\n\nexport interface AuthSpec {\n scope: AuthScope;\n provider: AuthProvider;\n authorization: AuthzSpec;\n flow?: AuthFlowConfig;\n signIn?: AuthSignInSpec;\n signUp?: AuthSignUpSpec;\n profile?: AuthProfileSpec;\n}\n\nexport interface NetworkingSpec {\n domain?: string;\n cdn: boolean;\n}\n\nexport interface InfraManifest {\n deployment?: DeploymentSpec;\n auth?: AuthSpec;\n database?: DatabaseSpec;\n storage?: StorageSpec;\n networking?: NetworkingSpec;\n plugins: string[];\n pluginsConfig?: Record<string, unknown>;\n}\n\nexport interface AppManifest {\n metadata: {\n name: string;\n slug: string;\n version: string;\n themeId: string;\n created?: string;\n updated?: string;\n };\n themes: ThemeConfig[];\n activeThemeId: string;\n activeThemeMode?: 'dark' | 'light';\n infra: InfraManifest;\n navigator: NavigatorSpec;\n screens: Record<string, ScreenSpec>;\n settings: {\n apiBaseUrl?: string;\n localization: {\n defaultLocale: string;\n locales: string[];\n };\n authFlow: AuthFlowConfig;\n };\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAuPA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AAGpE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,eAAe;IACf,uBAAuB;IACvB,iBAAiB;IACjB,oBAAoB;IACpB,qBAAqB;IACrB,eAAe;IACf,YAAY;IACZ,OAAO;IACP,iBAAiB;IACjB,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,SAAS;IACT,aAAa;IACb,mBAAmB;IACnB,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,mBAAmB;IACnB,kBAAkB;IAClB,QAAQ;IACR,iBAAiB;IACjB,SAAS;CACD,CAAC;AAGX,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,UAAU,CAAU,CAAC;AAIxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,UAAU,CAAU,CAAC;AAIxD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,CAAU,CAAC;AAGvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC;AAG/D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU,CAAC;AAGrD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAG3D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAU,CAAC;AAGrE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAAU,CAAU,CAAC;AAIpD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAU,CAAC;AAGhF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,YAAY,EAAE,qBAAqB,CAAU,CAAC;AAGpF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,GAAG,wBAAwB;IAC3B,WAAW;IACX,UAAU;IACV,aAAa;IACb,WAAW;CACH,CAAC","sourcesContent":["import type { ColorHarmony } from '@ankhorage/color-theory';\n\nimport type { AuthFlowConfig, AuthIdentifierKind, AuthSignUpField } from './auth';\n\nexport interface ThemeModeConfig {\n primaryColor: string;\n harmony: ColorHarmony;\n}\n\nexport interface ThemeConfig {\n id: string;\n name: string;\n light: ThemeModeConfig;\n dark: ThemeModeConfig;\n}\n\nexport type ActionType =\n | 'navigate'\n | 'alert'\n | 'console'\n | 'toggleDarkMode'\n | 'setLanguage'\n | 'search'\n | 'filter';\n\nexport interface NavigateAction {\n type: 'navigate';\n payload: {\n route: string;\n params?: Record<string, number | string>;\n };\n}\n\nexport interface AlertAction {\n type: 'alert';\n payload?: {\n message?: string;\n };\n}\n\nexport interface ConsoleAction {\n type: 'console';\n payload?: Record<string, unknown>;\n}\n\nexport interface ToggleDarkModeAction {\n type: 'toggleDarkMode';\n payload?: never;\n}\n\nexport interface SetLanguageAction {\n type: 'setLanguage';\n payload: {\n locale: string;\n };\n}\n\nexport interface SearchAction {\n type: 'search';\n payload: {\n query: string;\n scope?: string;\n };\n}\n\nexport interface FilterAction {\n type: 'filter';\n payload: {\n filterKey: string;\n filterValue: string;\n };\n}\n\nexport type Action =\n | AlertAction\n | ConsoleAction\n | FilterAction\n | NavigateAction\n | SearchAction\n | SetLanguageAction\n | ToggleDarkModeAction;\n\nexport type ManifestValue =\n | string\n | number\n | boolean\n | null\n | readonly ManifestValue[]\n | { readonly [key: string]: ManifestValue };\n\nexport type ActionValue = ManifestValue;\n\nexport type ActionBindingPayload = Record<string, ActionValue>;\n\nexport type ActionConditionSource = 'context' | 'event' | 'state';\n\nexport type ActionConditionOperator = 'eq' | 'exists' | 'neq' | 'notExists';\n\nexport interface ActionCondition {\n readonly source: ActionConditionSource;\n readonly path: string;\n readonly operator: ActionConditionOperator;\n readonly value?: ActionValue;\n}\n\nexport type ActionValueSource =\n | {\n readonly source: 'context';\n readonly path: string;\n }\n | {\n readonly source: 'event';\n readonly path: string;\n }\n | {\n readonly source: 'literal';\n readonly value: ActionValue;\n }\n | {\n readonly source: 'state';\n readonly path: string;\n };\n\nexport type ActionValueTransform = 'lowercase' | 'trim' | 'uppercase';\n\nexport interface ActionValueBinding {\n readonly valueFrom: ActionValueSource;\n readonly transform?: ActionValueTransform | readonly ActionValueTransform[];\n}\n\nexport interface ActionBinding<\n TType extends string = string,\n TPayload extends object = ActionBindingPayload,\n> {\n readonly type: TType;\n readonly payload?: TPayload;\n readonly when?: ActionCondition;\n}\n\nexport type DbPersistMode = 'columns' | 'json';\n\nexport interface DbPersistFieldBinding {\n readonly field: string;\n readonly valueFrom: ActionValueSource;\n readonly transform?: ActionValueTransform | readonly ActionValueTransform[];\n}\n\nexport interface DbPersistActionPayload {\n readonly collection: string;\n readonly kind?: string;\n readonly mode?: DbPersistMode;\n readonly jsonField?: string;\n readonly values: readonly DbPersistFieldBinding[];\n}\n\nexport interface DbPersistActionBinding extends ActionBinding<\n 'db.persist',\n DbPersistActionPayload\n> {\n readonly payload: DbPersistActionPayload;\n}\n\nexport interface EmailSendActionPayload {\n readonly to: string;\n readonly subject?: string;\n readonly body?: string;\n readonly bodyFrom?: ActionValueSource;\n}\n\nexport interface EmailSendActionBinding extends ActionBinding<\n 'email.send',\n EmailSendActionPayload\n> {\n readonly payload: EmailSendActionPayload;\n}\n\nexport type KnownActionBinding = DbPersistActionBinding | EmailSendActionBinding;\n\nexport type UiNodeEventBindings = Record<string, readonly ActionBinding<string, object>[]>;\n\nexport interface CommandDto<\n TType extends string = string,\n TPayload extends object = Record<string, ActionValue>,\n> {\n readonly type: TType;\n readonly payload: TPayload;\n}\n\nexport type DbPersistOperation = 'insert';\n\nexport type DbPersistCommandValues = Record<string, ActionValue>;\n\nexport interface DbPersistCommandPayload {\n readonly operation: DbPersistOperation;\n readonly collection: string;\n readonly kind?: string;\n readonly mode?: DbPersistMode;\n readonly jsonField?: string;\n readonly values: DbPersistCommandValues;\n}\n\nexport type DbPersistCommand = CommandDto<'db.persist.command', DbPersistCommandPayload>;\n\nexport type KnownCommandDto = DbPersistCommand;\n\nexport type ComponentEventPayloadValue = ManifestValue;\n\nexport interface ComponentEventDto<\n TType extends string = string,\n TPayload extends object = Record<string, ComponentEventPayloadValue>,\n> {\n readonly type: TType;\n readonly sourceNodeId: string;\n readonly payload: TPayload;\n}\n\nexport type FormSubmitValues = Record<string, ComponentEventPayloadValue>;\n\nexport type FormSubmitEventDto = ComponentEventDto<\n 'form.submit',\n {\n readonly values: FormSubmitValues;\n }\n>;\n\nexport type ButtonPressEventDto = ComponentEventDto<'button.press', Record<string, never>>;\n\nexport interface CollectionItemPressPayload {\n readonly itemId: string | number;\n readonly item: Record<string, ComponentEventPayloadValue>;\n}\n\nexport type CollectionItemPressEventDto = ComponentEventDto<\n 'collection.itemPress',\n CollectionItemPressPayload\n>;\n\nexport type ComponentEventDtoKind =\n | ButtonPressEventDto['type']\n | CollectionItemPressEventDto['type']\n | FormSubmitEventDto['type'];\n\nexport type KnownComponentEventDto =\n | ButtonPressEventDto\n | CollectionItemPressEventDto\n | FormSubmitEventDto;\n\nexport const NAVIGATOR_TYPES = ['stack', 'tabs', 'drawer'] as const;\nexport type NavigatorType = (typeof NAVIGATOR_TYPES)[number];\n\nexport const APP_CATEGORIES = [\n 'books_reading',\n 'business_productivity',\n 'developer_tools',\n 'education_learning',\n 'entertainment_media',\n 'finance_money',\n 'food_drink',\n 'games',\n 'graphics_design',\n 'health_fitness',\n 'kids_family',\n 'lifestyle',\n 'medical',\n 'music_audio',\n 'navigation_travel',\n 'news_magazines',\n 'photo_video',\n 'reference',\n 'shopping_commerce',\n 'social_community',\n 'sports',\n 'utilities_tools',\n 'weather',\n] as const;\nexport type AppCategory = (typeof APP_CATEGORIES)[number];\n\nexport const DEPLOYMENT_TARGETS = ['minikube'] as const;\nexport type KnownDeploymentTarget = (typeof DEPLOYMENT_TARGETS)[number];\nexport type DeploymentTarget = KnownDeploymentTarget | (string & {});\n\nexport const DATABASE_PROVIDERS = ['supabase'] as const;\nexport type KnownDatabaseProvider = (typeof DATABASE_PROVIDERS)[number];\nexport type DatabaseProvider = KnownDatabaseProvider | (string & {});\n\nexport const DATABASE_TIERS = ['dev', 'prod'] as const;\nexport type DatabaseTier = (typeof DATABASE_TIERS)[number];\n\nexport const STORAGE_PROVIDERS = ['auto', 's3', 'r2'] as const;\nexport type StorageProvider = (typeof STORAGE_PROVIDERS)[number];\n\nexport const AUTHZ_KINDS = ['RBAC', 'ABAC'] as const;\nexport type AuthzKind = (typeof AUTHZ_KINDS)[number];\n\nexport const AUTHZ_ENGINES = ['cerbos', 'native'] as const;\nexport type AuthzEngine = (typeof AUTHZ_ENGINES)[number];\n\nexport const AUTH_SCOPES = ['global', 'none', 'integrated'] as const;\nexport type AuthScope = (typeof AUTH_SCOPES)[number];\n\nexport const AUTH_PROVIDERS = ['supabase'] as const;\nexport type KnownAuthProvider = (typeof AUTH_PROVIDERS)[number];\nexport type AuthProvider = KnownAuthProvider | (string & {});\n\nexport const AUTH_SIGN_IN_IDENTIFIERS = ['email', 'username', 'phone'] as const;\nexport type AuthSignInIdentifier = AuthIdentifierKind;\n\nexport const AUTH_SIGN_UP_POLICIES = ['autoSignIn', 'requireVerification'] as const;\nexport type AuthSignUpPolicy = (typeof AUTH_SIGN_UP_POLICIES)[number];\n\nexport const AUTH_PROFILE_FIELDS = [\n ...AUTH_SIGN_IN_IDENTIFIERS,\n 'firstName',\n 'lastName',\n 'displayName',\n 'avatarUrl',\n] as const;\nexport type KnownAuthProfileField = (typeof AUTH_PROFILE_FIELDS)[number];\nexport type AuthProfileField = KnownAuthProfileField | (string & {});\n\nexport interface IconSpec {\n name: string;\n provider?: string;\n size?: number | string;\n color?: string;\n}\n\nexport interface UiNode {\n id: string;\n type: string;\n alias?: string;\n props?: Record<string, unknown>;\n children?: UiNode[];\n style?: Record<string, number | string>;\n events?: UiNodeEventBindings;\n}\n\nexport interface ScreenSpec {\n id: string;\n name: string;\n title?: string;\n description?: string;\n root: UiNode;\n}\n\nexport interface NavigatorSpec {\n type: NavigatorType;\n initialRouteName?: string;\n routes: RouteDefinition[];\n options?: Record<string, unknown>;\n}\n\nexport interface RouteDefinition {\n name: string;\n path?: string;\n label?: string;\n icon?: IconSpec;\n hideInTabBar?: boolean;\n guards?: string[];\n screenId?: string;\n navigator?: NavigatorSpec;\n}\n\nexport interface DeploymentSpec {\n target: DeploymentTarget;\n monitoring: boolean;\n}\n\nexport interface DatabaseSpec {\n provider: DatabaseProvider;\n tier: DatabaseTier;\n}\n\nexport interface StorageSpec {\n provider: StorageProvider;\n buckets: string[];\n}\n\nexport interface AuthzSpec {\n kind: AuthzKind;\n engine: AuthzEngine;\n}\n\nexport interface AuthSignInSpec {\n identifiers: AuthSignInIdentifier[];\n}\n\nexport interface AuthSignUpSpec {\n requiredFields: AuthSignUpField[];\n optionalFields?: AuthSignUpField[];\n signUpPolicy?: AuthSignUpPolicy;\n}\n\nexport interface AuthProfileSpec {\n fields: AuthProfileField[];\n}\n\nexport interface AuthSpec {\n scope: AuthScope;\n provider: AuthProvider;\n authorization: AuthzSpec;\n flow?: AuthFlowConfig;\n signIn?: AuthSignInSpec;\n signUp?: AuthSignUpSpec;\n profile?: AuthProfileSpec;\n}\n\nexport interface NetworkingSpec {\n domain?: string;\n cdn: boolean;\n}\n\nexport interface InfraManifest {\n deployment?: DeploymentSpec;\n auth?: AuthSpec;\n database?: DatabaseSpec;\n storage?: StorageSpec;\n networking?: NetworkingSpec;\n plugins: string[];\n pluginsConfig?: Record<string, unknown>;\n}\n\nexport interface AppManifest {\n metadata: {\n name: string;\n slug: string;\n version: string;\n themeId: string;\n created?: string;\n updated?: string;\n };\n themes: ThemeConfig[];\n activeThemeId: string;\n activeThemeMode?: 'dark' | 'light';\n infra: InfraManifest;\n navigator: NavigatorSpec;\n screens: Record<string, ScreenSpec>;\n settings: {\n apiBaseUrl?: string;\n localization: {\n defaultLocale: string;\n locales: string[];\n };\n authFlow: AuthFlowConfig;\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/contracts",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@ankhorage/color-theory": "^0.0.7"
@@ -25,6 +25,10 @@
25
25
  "types": "./dist/db.d.ts",
26
26
  "default": "./dist/db.js"
27
27
  },
28
+ "./state": {
29
+ "types": "./dist/state.d.ts",
30
+ "default": "./dist/state.js"
31
+ },
28
32
  "./storage": {
29
33
  "types": "./dist/storage.d.ts",
30
34
  "default": "./dist/storage.js"
@@ -6,6 +6,7 @@ import { describe, expect, it } from 'bun:test';
6
6
 
7
7
  import {
8
8
  type ActionBinding,
9
+ type ActionValueSource,
9
10
  APP_CATEGORIES,
10
11
  type AppCategory,
11
12
  AUTH_PROVIDERS,
@@ -20,10 +21,15 @@ import {
20
21
  type DbAdapter,
21
22
  type DbAdminAdapter,
22
23
  type DbChangeEvent,
24
+ type DbPersistActionBinding,
25
+ type DbPersistCommand,
23
26
  type DbRealtimeAdapter,
24
27
  DEPLOYMENT_TARGETS,
28
+ type EmailSendActionBinding,
25
29
  type FormSubmitEventDto,
26
30
  type ImageAssetSource,
31
+ type KnownActionBinding,
32
+ type KnownCommandDto,
27
33
  NAVIGATOR_TYPES,
28
34
  type StoragePublicUrlResult,
29
35
  type StorageResult,
@@ -338,6 +344,121 @@ describe('contracts', () => {
338
344
  expect(knownEventType).toBe('form.submit');
339
345
  });
340
346
 
347
+ it('serializes provider-neutral value sources for action payloads', () => {
348
+ const sources: readonly ActionValueSource[] = [
349
+ { source: 'event', path: 'payload.values.email' },
350
+ { source: 'literal', value: 'website-contact-form' },
351
+ { source: 'context', path: 'auth.user.id' },
352
+ { source: 'state', path: 'forms.contact.isSubmitting' },
353
+ ];
354
+
355
+ expect(JSON.parse(JSON.stringify(sources))).toEqual(sources);
356
+ expect(sources.map((source) => source.source)).toEqual([
357
+ 'event',
358
+ 'literal',
359
+ 'context',
360
+ 'state',
361
+ ]);
362
+ });
363
+
364
+ it('serializes a typed db.persist action binding', () => {
365
+ const binding: DbPersistActionBinding = {
366
+ type: 'db.persist',
367
+ payload: {
368
+ collection: 'contact_messages',
369
+ mode: 'columns',
370
+ values: [
371
+ {
372
+ field: 'firstname',
373
+ valueFrom: { source: 'event', path: 'payload.values.firstname' },
374
+ transform: 'trim',
375
+ },
376
+ {
377
+ field: 'message',
378
+ valueFrom: { source: 'event', path: 'payload.values.message' },
379
+ },
380
+ {
381
+ field: 'source',
382
+ valueFrom: { source: 'literal', value: 'website-contact-form' },
383
+ },
384
+ ],
385
+ },
386
+ };
387
+
388
+ expect(JSON.parse(JSON.stringify(binding))).toEqual(binding);
389
+ expect(binding.payload.values.map((value) => value.field)).toEqual([
390
+ 'firstname',
391
+ 'message',
392
+ 'source',
393
+ ]);
394
+ });
395
+
396
+ it('serializes a typed email.send action binding', () => {
397
+ const binding: EmailSendActionBinding = {
398
+ type: 'email.send',
399
+ payload: {
400
+ to: 'info@example.com',
401
+ subject: 'New contact message',
402
+ bodyFrom: { source: 'event', path: 'payload.values.message' },
403
+ },
404
+ };
405
+
406
+ expect(JSON.parse(JSON.stringify(binding))).toEqual(binding);
407
+ expect(binding.payload.bodyFrom?.source).toBe('event');
408
+ });
409
+
410
+ it('accepts typed action bindings in node event bindings', () => {
411
+ const persist: DbPersistActionBinding = {
412
+ type: 'db.persist',
413
+ payload: {
414
+ collection: 'contact_messages',
415
+ values: [
416
+ {
417
+ field: 'message',
418
+ valueFrom: { source: 'event', path: 'payload.values.message' },
419
+ },
420
+ ],
421
+ },
422
+ };
423
+ const email: EmailSendActionBinding = {
424
+ type: 'email.send',
425
+ payload: {
426
+ to: 'info@example.com',
427
+ bodyFrom: { source: 'event', path: 'payload.values.message' },
428
+ },
429
+ };
430
+ const node: UiNode = {
431
+ id: 'contact-form',
432
+ type: 'Form',
433
+ events: {
434
+ submit: [persist, email],
435
+ },
436
+ };
437
+ const known: KnownActionBinding = persist;
438
+
439
+ expect(node.events?.submit?.map((action) => action.type)).toEqual(['db.persist', 'email.send']);
440
+ expect(known.type).toBe('db.persist');
441
+ });
442
+
443
+ it('serializes a normalized db.persist command DTO', () => {
444
+ const command: DbPersistCommand = {
445
+ type: 'db.persist.command',
446
+ payload: {
447
+ operation: 'insert',
448
+ collection: 'contact_messages',
449
+ mode: 'columns',
450
+ values: {
451
+ firstname: 'Fabio',
452
+ message: 'This is my contact message',
453
+ },
454
+ },
455
+ };
456
+ const knownCommand: KnownCommandDto = command;
457
+
458
+ expect(JSON.parse(JSON.stringify(command))).toEqual(command);
459
+ expect(knownCommand.type).toBe('db.persist.command');
460
+ });
461
+
341
462
  it('accepts a provider-neutral CRUD database adapter', async () => {
342
463
  const adapter: DbAdapter = {
343
464
  capabilities: {
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './auth';
2
2
  export * from './db';
3
+ export * from './state';
3
4
  export * from './storage';
4
5
  export * from './types';
@@ -0,0 +1,188 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+
3
+ import type {
4
+ StateAdapter,
5
+ StateListener,
6
+ StatePath,
7
+ StateResult,
8
+ StateSubscription,
9
+ StateValue,
10
+ } from './state';
11
+
12
+ function pathToKey(path: StatePath): string {
13
+ return Array.isArray(path) ? path.join('.') : path;
14
+ }
15
+
16
+ function isStateValue(value: unknown): value is StateValue {
17
+ if (value === null) {
18
+ return true;
19
+ }
20
+
21
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
22
+ return true;
23
+ }
24
+
25
+ if (Array.isArray(value)) {
26
+ return value.every(isStateValue);
27
+ }
28
+
29
+ if (typeof value !== 'object') {
30
+ return false;
31
+ }
32
+
33
+ return Object.values(value).every(isStateValue);
34
+ }
35
+
36
+ function createError(code: string, message: string): StateResult {
37
+ return {
38
+ ok: false,
39
+ error: { code, message },
40
+ };
41
+ }
42
+
43
+ function createFakeStateAdapter(): StateAdapter {
44
+ const values = new Map<string, StateValue>();
45
+ const listeners = new Map<string, Set<StateListener>>();
46
+
47
+ const emit = (path: StatePath, value: StateValue | undefined) => {
48
+ const key = pathToKey(path);
49
+ const pathListeners = listeners.get(key);
50
+
51
+ if (!pathListeners) {
52
+ return;
53
+ }
54
+
55
+ for (const listener of pathListeners) {
56
+ listener({ path, value });
57
+ }
58
+ };
59
+
60
+ return {
61
+ capabilities: {
62
+ subscriptions: true,
63
+ computed: false,
64
+ persistence: false,
65
+ },
66
+ get(path) {
67
+ return { ok: true, data: values.get(pathToKey(path)) };
68
+ },
69
+ set(path, value) {
70
+ if (!isStateValue(value)) {
71
+ return createError('invalid_value', 'State value must be serializable.');
72
+ }
73
+
74
+ values.set(pathToKey(path), value);
75
+ emit(path, value);
76
+ return { ok: true };
77
+ },
78
+ subscribe(path, listener) {
79
+ const key = pathToKey(path);
80
+ const pathListeners = listeners.get(key) ?? new Set<StateListener>();
81
+ pathListeners.add(listener);
82
+ listeners.set(key, pathListeners);
83
+
84
+ const subscription: StateSubscription = {
85
+ unsubscribe() {
86
+ pathListeners.delete(listener);
87
+ if (pathListeners.size === 0) {
88
+ listeners.delete(key);
89
+ }
90
+ },
91
+ };
92
+
93
+ return { ok: true, data: subscription };
94
+ },
95
+ delete(path) {
96
+ values.delete(pathToKey(path));
97
+ emit(path, undefined);
98
+ return { ok: true };
99
+ },
100
+ };
101
+ }
102
+
103
+ describe('StateAdapter', () => {
104
+ it('supports path-based set and get', () => {
105
+ const adapter = createFakeStateAdapter();
106
+
107
+ const setResult = adapter.set(['forms', 'contact', 'values'], {
108
+ firstname: 'Fabio',
109
+ newsletter: true,
110
+ });
111
+ const getResult = adapter.get(['forms', 'contact', 'values']);
112
+
113
+ expect(setResult).toEqual({ ok: true });
114
+ expect(getResult).toEqual({
115
+ ok: true,
116
+ data: {
117
+ firstname: 'Fabio',
118
+ newsletter: true,
119
+ },
120
+ });
121
+ });
122
+
123
+ it('supports string paths and serializable nested values', () => {
124
+ const adapter = createFakeStateAdapter();
125
+ const value: StateValue = {
126
+ selectedIds: ['post-1', 'post-2'],
127
+ filters: {
128
+ search: 'hello',
129
+ onlyPublished: true,
130
+ },
131
+ };
132
+
133
+ adapter.set('collections.posts', value);
134
+
135
+ expect(adapter.get('collections.posts')).toEqual({ ok: true, data: value });
136
+ });
137
+
138
+ it('notifies subscribers when a value changes', () => {
139
+ const adapter = createFakeStateAdapter();
140
+ const snapshots: StateValue[] = [];
141
+ const subscriptionResult = adapter.subscribe('counter.value', ({ value }) => {
142
+ if (value !== undefined) {
143
+ snapshots.push(value);
144
+ }
145
+ });
146
+
147
+ adapter.set('counter.value', 1);
148
+ adapter.set('counter.value', 2);
149
+
150
+ expect(subscriptionResult.ok).toBe(true);
151
+ expect(snapshots).toEqual([1, 2]);
152
+ });
153
+
154
+ it('stops notifying after unsubscribe', async () => {
155
+ const adapter = createFakeStateAdapter();
156
+ const snapshots: StateValue[] = [];
157
+ const subscriptionResult = adapter.subscribe('counter.value', ({ value }) => {
158
+ if (value !== undefined) {
159
+ snapshots.push(value);
160
+ }
161
+ });
162
+
163
+ if (!subscriptionResult.ok) {
164
+ throw new Error('Expected subscription to succeed.');
165
+ }
166
+
167
+ adapter.set('counter.value', 1);
168
+ await subscriptionResult.data.unsubscribe();
169
+ adapter.set('counter.value', 2);
170
+
171
+ expect(snapshots).toEqual([1]);
172
+ });
173
+
174
+ it('supports deleting values when the adapter implements delete', () => {
175
+ const adapter = createFakeStateAdapter();
176
+ const snapshots: (StateValue | undefined)[] = [];
177
+ adapter.subscribe('session.user', ({ value }) => {
178
+ snapshots.push(value);
179
+ });
180
+
181
+ adapter.set('session.user', { id: 'user-1' });
182
+ const deleteResult = adapter.delete?.('session.user');
183
+
184
+ expect(deleteResult).toEqual({ ok: true });
185
+ expect(adapter.get('session.user')).toEqual({ ok: true, data: undefined });
186
+ expect(snapshots).toEqual([{ id: 'user-1' }, undefined]);
187
+ });
188
+ });
package/src/state.ts ADDED
@@ -0,0 +1,63 @@
1
+ export type StatePrimitive = string | number | boolean | null;
2
+
3
+ export type StateValue =
4
+ | StatePrimitive
5
+ | readonly StateValue[]
6
+ | {
7
+ readonly [key: string]: StateValue;
8
+ };
9
+
10
+ export type StatePath = string | readonly string[];
11
+
12
+ export interface StateAdapterCapabilities {
13
+ readonly subscriptions: boolean;
14
+ readonly computed: boolean;
15
+ readonly persistence: boolean;
16
+ }
17
+
18
+ export interface StateAdapterError {
19
+ readonly code: string;
20
+ readonly message: string;
21
+ readonly cause?: unknown;
22
+ }
23
+
24
+ export type StateSuccess<TValue = void> = [TValue] extends [void]
25
+ ? {
26
+ readonly ok: true;
27
+ }
28
+ : {
29
+ readonly ok: true;
30
+ readonly data: TValue;
31
+ };
32
+
33
+ export type StateResult<TValue = void> =
34
+ | StateSuccess<TValue>
35
+ | {
36
+ readonly ok: false;
37
+ readonly error: StateAdapterError;
38
+ };
39
+
40
+ export interface StateSnapshot<TValue extends StateValue = StateValue> {
41
+ readonly path: StatePath;
42
+ readonly value: TValue | undefined;
43
+ }
44
+
45
+ export type StateListener<TValue extends StateValue = StateValue> = (
46
+ snapshot: StateSnapshot<TValue>,
47
+ ) => void;
48
+
49
+ export interface StateSubscription {
50
+ unsubscribe(): Promise<void> | void;
51
+ }
52
+
53
+ export interface StateAdapter {
54
+ readonly capabilities: StateAdapterCapabilities;
55
+
56
+ get<TValue extends StateValue = StateValue>(path: StatePath): StateResult<TValue | undefined>;
57
+ set<TValue extends StateValue = StateValue>(path: StatePath, value: TValue): StateResult;
58
+ subscribe<TValue extends StateValue = StateValue>(
59
+ path: StatePath,
60
+ listener: StateListener<TValue>,
61
+ ): StateResult<StateSubscription>;
62
+ delete?(path: StatePath): StateResult;
63
+ }
package/src/types.ts CHANGED
@@ -88,7 +88,9 @@ export type ManifestValue =
88
88
  | readonly ManifestValue[]
89
89
  | { readonly [key: string]: ManifestValue };
90
90
 
91
- export type ActionBindingPayload = Record<string, ManifestValue>;
91
+ export type ActionValue = ManifestValue;
92
+
93
+ export type ActionBindingPayload = Record<string, ActionValue>;
92
94
 
93
95
  export type ActionConditionSource = 'context' | 'event' | 'state';
94
96
 
@@ -98,16 +100,108 @@ export interface ActionCondition {
98
100
  readonly source: ActionConditionSource;
99
101
  readonly path: string;
100
102
  readonly operator: ActionConditionOperator;
101
- readonly value?: ManifestValue;
103
+ readonly value?: ActionValue;
102
104
  }
103
105
 
104
- export interface ActionBinding {
105
- readonly type: string;
106
- readonly payload?: ActionBindingPayload;
106
+ export type ActionValueSource =
107
+ | {
108
+ readonly source: 'context';
109
+ readonly path: string;
110
+ }
111
+ | {
112
+ readonly source: 'event';
113
+ readonly path: string;
114
+ }
115
+ | {
116
+ readonly source: 'literal';
117
+ readonly value: ActionValue;
118
+ }
119
+ | {
120
+ readonly source: 'state';
121
+ readonly path: string;
122
+ };
123
+
124
+ export type ActionValueTransform = 'lowercase' | 'trim' | 'uppercase';
125
+
126
+ export interface ActionValueBinding {
127
+ readonly valueFrom: ActionValueSource;
128
+ readonly transform?: ActionValueTransform | readonly ActionValueTransform[];
129
+ }
130
+
131
+ export interface ActionBinding<
132
+ TType extends string = string,
133
+ TPayload extends object = ActionBindingPayload,
134
+ > {
135
+ readonly type: TType;
136
+ readonly payload?: TPayload;
107
137
  readonly when?: ActionCondition;
108
138
  }
109
139
 
110
- export type UiNodeEventBindings = Record<string, readonly ActionBinding[]>;
140
+ export type DbPersistMode = 'columns' | 'json';
141
+
142
+ export interface DbPersistFieldBinding {
143
+ readonly field: string;
144
+ readonly valueFrom: ActionValueSource;
145
+ readonly transform?: ActionValueTransform | readonly ActionValueTransform[];
146
+ }
147
+
148
+ export interface DbPersistActionPayload {
149
+ readonly collection: string;
150
+ readonly kind?: string;
151
+ readonly mode?: DbPersistMode;
152
+ readonly jsonField?: string;
153
+ readonly values: readonly DbPersistFieldBinding[];
154
+ }
155
+
156
+ export interface DbPersistActionBinding extends ActionBinding<
157
+ 'db.persist',
158
+ DbPersistActionPayload
159
+ > {
160
+ readonly payload: DbPersistActionPayload;
161
+ }
162
+
163
+ export interface EmailSendActionPayload {
164
+ readonly to: string;
165
+ readonly subject?: string;
166
+ readonly body?: string;
167
+ readonly bodyFrom?: ActionValueSource;
168
+ }
169
+
170
+ export interface EmailSendActionBinding extends ActionBinding<
171
+ 'email.send',
172
+ EmailSendActionPayload
173
+ > {
174
+ readonly payload: EmailSendActionPayload;
175
+ }
176
+
177
+ export type KnownActionBinding = DbPersistActionBinding | EmailSendActionBinding;
178
+
179
+ export type UiNodeEventBindings = Record<string, readonly ActionBinding<string, object>[]>;
180
+
181
+ export interface CommandDto<
182
+ TType extends string = string,
183
+ TPayload extends object = Record<string, ActionValue>,
184
+ > {
185
+ readonly type: TType;
186
+ readonly payload: TPayload;
187
+ }
188
+
189
+ export type DbPersistOperation = 'insert';
190
+
191
+ export type DbPersistCommandValues = Record<string, ActionValue>;
192
+
193
+ export interface DbPersistCommandPayload {
194
+ readonly operation: DbPersistOperation;
195
+ readonly collection: string;
196
+ readonly kind?: string;
197
+ readonly mode?: DbPersistMode;
198
+ readonly jsonField?: string;
199
+ readonly values: DbPersistCommandValues;
200
+ }
201
+
202
+ export type DbPersistCommand = CommandDto<'db.persist.command', DbPersistCommandPayload>;
203
+
204
+ export type KnownCommandDto = DbPersistCommand;
111
205
 
112
206
  export type ComponentEventPayloadValue = ManifestValue;
113
207