@ankhorage/contracts 1.6.0 → 1.8.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 +12 -0
- package/dist/bindings.d.ts +38 -0
- package/dist/bindings.d.ts.map +1 -0
- package/dist/bindings.js +2 -0
- package/dist/bindings.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/state.d.ts +41 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +2 -0
- package/dist/state.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +9 -1
- package/src/bindings.test.ts +96 -0
- package/src/bindings.ts +54 -0
- package/src/index.ts +2 -0
- package/src/state.test.ts +188 -0
- package/src/state.ts +63 -0
- package/src/types.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ankhorage/contracts
|
|
2
2
|
|
|
3
|
+
## 1.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e70556e: Add provider-neutral data and state binding contracts for manifest node props and database collection queries.
|
|
8
|
+
|
|
9
|
+
## 1.7.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- eff4efc: Add provider-neutral state adapter contracts for path-based reads, writes, subscriptions, and optional removal support.
|
|
14
|
+
|
|
3
15
|
## 1.6.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { DbFilter, DbPage, DbSort } from './db';
|
|
2
|
+
export type BindingValue = string | number | boolean | null | readonly BindingValue[] | {
|
|
3
|
+
readonly [key: string]: BindingValue;
|
|
4
|
+
};
|
|
5
|
+
export type BindingRefreshMode = 'focus' | 'live' | 'poll' | 'static';
|
|
6
|
+
export interface DbCollectionQueryBinding {
|
|
7
|
+
readonly collection: string;
|
|
8
|
+
readonly schema?: string;
|
|
9
|
+
readonly columns?: readonly string[];
|
|
10
|
+
readonly filters?: readonly DbFilter[];
|
|
11
|
+
readonly sort?: readonly DbSort[];
|
|
12
|
+
readonly page?: DbPage;
|
|
13
|
+
readonly refresh?: BindingRefreshMode;
|
|
14
|
+
readonly pollIntervalMs?: number;
|
|
15
|
+
}
|
|
16
|
+
export type BindingValueSource = {
|
|
17
|
+
readonly source: 'context';
|
|
18
|
+
readonly path: string;
|
|
19
|
+
} | {
|
|
20
|
+
readonly source: 'db.collection';
|
|
21
|
+
readonly query: DbCollectionQueryBinding;
|
|
22
|
+
} | {
|
|
23
|
+
readonly source: 'event';
|
|
24
|
+
readonly path: string;
|
|
25
|
+
} | {
|
|
26
|
+
readonly source: 'literal';
|
|
27
|
+
readonly value: BindingValue;
|
|
28
|
+
} | {
|
|
29
|
+
readonly source: 'state';
|
|
30
|
+
readonly path: string;
|
|
31
|
+
};
|
|
32
|
+
export type BindingValueTransform = 'lowercase' | 'trim' | 'uppercase';
|
|
33
|
+
export interface NodePropBinding {
|
|
34
|
+
readonly prop: string;
|
|
35
|
+
readonly valueFrom: BindingValueSource;
|
|
36
|
+
readonly transform?: BindingValueTransform | readonly BindingValueTransform[];
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=bindings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAErD,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,YAAY,EAAE,GACvB;IACE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;CACtC,CAAC;AAEN,MAA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kB,CAAC;IACvC,QAAQ,CAAC,SAAS,CAAC,EAAE,qBAAqB,GAAG,SAAS,qBAAqB,EAAE,CAAC;CAC/E"}
|
package/dist/bindings.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bindings.js","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":"","sourcesContent":["import type { DbFilter, DbPage, DbSort } from './db';\n\nexport type BindingValue =\n | string\n | number\n | boolean\n | null\n | readonly BindingValue[]\n | {\n readonly [key: string]: BindingValue;\n };\n\nexport type BindingRefreshMode = 'focus' | 'live' | 'poll' | 'static';\n\nexport interface DbCollectionQueryBinding {\n readonly collection: string;\n readonly schema?: string;\n readonly columns?: readonly string[];\n readonly filters?: readonly DbFilter[];\n readonly sort?: readonly DbSort[];\n readonly page?: DbPage;\n readonly refresh?: BindingRefreshMode;\n readonly pollIntervalMs?: number;\n}\n\nexport type BindingValueSource =\n | {\n readonly source: 'context';\n readonly path: string;\n }\n | {\n readonly source: 'db.collection';\n readonly query: DbCollectionQueryBinding;\n }\n | {\n readonly source: 'event';\n readonly path: string;\n }\n | {\n readonly source: 'literal';\n readonly value: BindingValue;\n }\n | {\n readonly source: 'state';\n readonly path: string;\n };\n\nexport type BindingValueTransform = 'lowercase' | 'trim' | 'uppercase';\n\nexport interface NodePropBinding {\n readonly prop: string;\n readonly valueFrom: BindingValueSource;\n readonly transform?: BindingValueTransform | readonly BindingValueTransform[];\n}\n"]}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -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,YAAY,CAAC;AAC3B,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
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,YAAY,CAAC;AAC3B,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC","sourcesContent":["export * from './auth';\nexport * from './bindings';\nexport * from './db';\nexport * from './state';\nexport * from './storage';\nexport * from './types';\n"]}
|
package/dist/state.d.ts
ADDED
|
@@ -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,CAA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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 @@
|
|
|
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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ColorHarmony } from '@ankhorage/color-theory';
|
|
2
2
|
import type { AuthFlowConfig, AuthIdentifierKind, AuthSignUpField } from './auth';
|
|
3
|
+
import type { NodePropBinding } from './bindings';
|
|
3
4
|
export interface ThemeModeConfig {
|
|
4
5
|
primaryColor: string;
|
|
5
6
|
harmony: ColorHarmony;
|
|
@@ -191,6 +192,7 @@ export interface UiNode {
|
|
|
191
192
|
type: string;
|
|
192
193
|
alias?: string;
|
|
193
194
|
props?: Record<string, unknown>;
|
|
195
|
+
bindings?: readonly NodePropBinding[];
|
|
194
196
|
children?: UiNode[];
|
|
195
197
|
style?: Record<string, number | string>;
|
|
196
198
|
events?: UiNodeEventBindings;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -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;
|
|
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;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,YAAY,CAAC;C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O,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"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAwPA,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';\nimport type { NodePropBinding } from './bindings';\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 bindings?: readonly NodePropBinding[];\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.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@ankhorage/color-theory": "^0.0.7"
|
|
@@ -21,10 +21,18 @@
|
|
|
21
21
|
"types": "./dist/auth.d.ts",
|
|
22
22
|
"default": "./dist/auth.js"
|
|
23
23
|
},
|
|
24
|
+
"./bindings": {
|
|
25
|
+
"types": "./dist/bindings.d.ts",
|
|
26
|
+
"default": "./dist/bindings.js"
|
|
27
|
+
},
|
|
24
28
|
"./db": {
|
|
25
29
|
"types": "./dist/db.d.ts",
|
|
26
30
|
"default": "./dist/db.js"
|
|
27
31
|
},
|
|
32
|
+
"./state": {
|
|
33
|
+
"types": "./dist/state.d.ts",
|
|
34
|
+
"default": "./dist/state.js"
|
|
35
|
+
},
|
|
28
36
|
"./storage": {
|
|
29
37
|
"types": "./dist/storage.d.ts",
|
|
30
38
|
"default": "./dist/storage.js"
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
BindingValueSource,
|
|
5
|
+
DbCollectionQueryBinding,
|
|
6
|
+
NodePropBinding,
|
|
7
|
+
UiNode,
|
|
8
|
+
} from './index';
|
|
9
|
+
|
|
10
|
+
describe('binding contracts', () => {
|
|
11
|
+
it('serializes a node prop bound to state', () => {
|
|
12
|
+
const binding: NodePropBinding = {
|
|
13
|
+
prop: 'value',
|
|
14
|
+
valueFrom: {
|
|
15
|
+
source: 'state',
|
|
16
|
+
path: 'forms.contact.values.firstname',
|
|
17
|
+
},
|
|
18
|
+
transform: 'trim',
|
|
19
|
+
};
|
|
20
|
+
const node: UiNode = {
|
|
21
|
+
id: 'firstname-input',
|
|
22
|
+
type: 'Input',
|
|
23
|
+
props: {
|
|
24
|
+
label: 'Firstname',
|
|
25
|
+
},
|
|
26
|
+
bindings: [binding],
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
expect(JSON.parse(JSON.stringify(node))).toEqual(node);
|
|
30
|
+
expect(node.bindings?.[0]?.valueFrom.source).toBe('state');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('serializes a node prop bound to a DB collection query', () => {
|
|
34
|
+
const query: DbCollectionQueryBinding = {
|
|
35
|
+
collection: 'posts',
|
|
36
|
+
schema: 'public',
|
|
37
|
+
columns: ['id', 'title', 'published'],
|
|
38
|
+
filters: [{ field: 'published', operator: 'eq', value: true }],
|
|
39
|
+
sort: [{ field: 'created_at', direction: 'desc' }],
|
|
40
|
+
page: { limit: 10, offset: 0 },
|
|
41
|
+
refresh: 'live',
|
|
42
|
+
};
|
|
43
|
+
const node: UiNode = {
|
|
44
|
+
id: 'posts-list',
|
|
45
|
+
type: 'CollectionList',
|
|
46
|
+
bindings: [
|
|
47
|
+
{
|
|
48
|
+
prop: 'items',
|
|
49
|
+
valueFrom: {
|
|
50
|
+
source: 'db.collection',
|
|
51
|
+
query,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
expect(JSON.parse(JSON.stringify(node))).toEqual(node);
|
|
58
|
+
expect(node.bindings?.[0]?.valueFrom.source).toBe('db.collection');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('supports literal, context, and event value sources', () => {
|
|
62
|
+
const sources: readonly BindingValueSource[] = [
|
|
63
|
+
{ source: 'literal', value: { fallback: 'Untitled' } },
|
|
64
|
+
{ source: 'context', path: 'auth.user.displayName' },
|
|
65
|
+
{ source: 'event', path: 'payload.values.search' },
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
expect(JSON.parse(JSON.stringify(sources))).toEqual(sources);
|
|
69
|
+
expect(sources.map((source) => source.source)).toEqual(['literal', 'context', 'event']);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('supports static, focus, poll, and live refresh intent', () => {
|
|
73
|
+
const refreshModes = ['static', 'focus', 'poll', 'live'] as const;
|
|
74
|
+
const bindings = refreshModes.map(
|
|
75
|
+
(refresh): NodePropBinding => ({
|
|
76
|
+
prop: `items.${refresh}`,
|
|
77
|
+
valueFrom: {
|
|
78
|
+
source: 'db.collection',
|
|
79
|
+
query: {
|
|
80
|
+
collection: 'posts',
|
|
81
|
+
refresh,
|
|
82
|
+
pollIntervalMs: refresh === 'poll' ? 30_000 : undefined,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
}),
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
expect(JSON.parse(JSON.stringify(bindings))).toEqual(bindings);
|
|
89
|
+
expect(bindings.map((binding) => binding.valueFrom.source)).toEqual([
|
|
90
|
+
'db.collection',
|
|
91
|
+
'db.collection',
|
|
92
|
+
'db.collection',
|
|
93
|
+
'db.collection',
|
|
94
|
+
]);
|
|
95
|
+
});
|
|
96
|
+
});
|
package/src/bindings.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { DbFilter, DbPage, DbSort } from './db';
|
|
2
|
+
|
|
3
|
+
export type BindingValue =
|
|
4
|
+
| string
|
|
5
|
+
| number
|
|
6
|
+
| boolean
|
|
7
|
+
| null
|
|
8
|
+
| readonly BindingValue[]
|
|
9
|
+
| {
|
|
10
|
+
readonly [key: string]: BindingValue;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type BindingRefreshMode = 'focus' | 'live' | 'poll' | 'static';
|
|
14
|
+
|
|
15
|
+
export interface DbCollectionQueryBinding {
|
|
16
|
+
readonly collection: string;
|
|
17
|
+
readonly schema?: string;
|
|
18
|
+
readonly columns?: readonly string[];
|
|
19
|
+
readonly filters?: readonly DbFilter[];
|
|
20
|
+
readonly sort?: readonly DbSort[];
|
|
21
|
+
readonly page?: DbPage;
|
|
22
|
+
readonly refresh?: BindingRefreshMode;
|
|
23
|
+
readonly pollIntervalMs?: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type BindingValueSource =
|
|
27
|
+
| {
|
|
28
|
+
readonly source: 'context';
|
|
29
|
+
readonly path: string;
|
|
30
|
+
}
|
|
31
|
+
| {
|
|
32
|
+
readonly source: 'db.collection';
|
|
33
|
+
readonly query: DbCollectionQueryBinding;
|
|
34
|
+
}
|
|
35
|
+
| {
|
|
36
|
+
readonly source: 'event';
|
|
37
|
+
readonly path: string;
|
|
38
|
+
}
|
|
39
|
+
| {
|
|
40
|
+
readonly source: 'literal';
|
|
41
|
+
readonly value: BindingValue;
|
|
42
|
+
}
|
|
43
|
+
| {
|
|
44
|
+
readonly source: 'state';
|
|
45
|
+
readonly path: string;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type BindingValueTransform = 'lowercase' | 'trim' | 'uppercase';
|
|
49
|
+
|
|
50
|
+
export interface NodePropBinding {
|
|
51
|
+
readonly prop: string;
|
|
52
|
+
readonly valueFrom: BindingValueSource;
|
|
53
|
+
readonly transform?: BindingValueTransform | readonly BindingValueTransform[];
|
|
54
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ColorHarmony } from '@ankhorage/color-theory';
|
|
2
2
|
|
|
3
3
|
import type { AuthFlowConfig, AuthIdentifierKind, AuthSignUpField } from './auth';
|
|
4
|
+
import type { NodePropBinding } from './bindings';
|
|
4
5
|
|
|
5
6
|
export interface ThemeModeConfig {
|
|
6
7
|
primaryColor: string;
|
|
@@ -330,6 +331,7 @@ export interface UiNode {
|
|
|
330
331
|
type: string;
|
|
331
332
|
alias?: string;
|
|
332
333
|
props?: Record<string, unknown>;
|
|
334
|
+
bindings?: readonly NodePropBinding[];
|
|
333
335
|
children?: UiNode[];
|
|
334
336
|
style?: Record<string, number | string>;
|
|
335
337
|
events?: UiNodeEventBindings;
|