@ankhorage/contracts 1.4.0 → 1.6.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.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - bde43ab: Add provider-neutral action value sources, typed action bindings, and normalized command DTO contracts for event-driven runtime action resolution.
8
+
9
+ ## 1.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 524a288: Add normalized component event DTO contracts for stable component-emitted event envelopes, including form submit, button press, and collection item press events.
14
+
3
15
  ## 1.4.0
4
16
 
5
17
  ### Minor Changes
package/dist/types.d.ts CHANGED
@@ -56,21 +56,100 @@ 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;
135
+ export type ComponentEventPayloadValue = ManifestValue;
136
+ export interface ComponentEventDto<TType extends string = string, TPayload extends object = Record<string, ComponentEventPayloadValue>> {
137
+ readonly type: TType;
138
+ readonly sourceNodeId: string;
139
+ readonly payload: TPayload;
140
+ }
141
+ export type FormSubmitValues = Record<string, ComponentEventPayloadValue>;
142
+ export type FormSubmitEventDto = ComponentEventDto<'form.submit', {
143
+ readonly values: FormSubmitValues;
144
+ }>;
145
+ export type ButtonPressEventDto = ComponentEventDto<'button.press', Record<string, never>>;
146
+ export interface CollectionItemPressPayload {
147
+ readonly itemId: string | number;
148
+ readonly item: Record<string, ComponentEventPayloadValue>;
149
+ }
150
+ export type CollectionItemPressEventDto = ComponentEventDto<'collection.itemPress', CollectionItemPressPayload>;
151
+ export type ComponentEventDtoKind = ButtonPressEventDto['type'] | CollectionItemPressEventDto['type'] | FormSubmitEventDto['type'];
152
+ export type KnownComponentEventDto = ButtonPressEventDto | CollectionItemPressEventDto | FormSubmitEventDto;
74
153
  export declare const NAVIGATOR_TYPES: readonly ["stack", "tabs", "drawer"];
75
154
  export type NavigatorType = (typeof NAVIGATOR_TYPES)[number];
76
155
  export declare const APP_CATEGORIES: readonly ["books_reading", "business_productivity", "developer_tools", "education_learning", "entertainment_media", "finance_money", "food_drink", "games", "graphics_design", "health_fitness", "kids_family", "lifestyle", "medical", "music_audio", "navigation_travel", "news_magazines", "photo_video", "reference", "shopping_commerce", "social_community", "sports", "utilities_tools", "weather"];
@@ -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;IACr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AAU,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 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.4.0",
3
+ "version": "1.6.0",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@ankhorage/color-theory": "^0.0.7"
@@ -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,
@@ -13,12 +14,22 @@ import {
13
14
  AUTH_SIGN_UP_POLICIES,
14
15
  type AuthFlowConfig,
15
16
  type AuthSpec,
17
+ type ButtonPressEventDto,
18
+ type CollectionItemPressEventDto,
19
+ type ComponentEventDto,
20
+ type ComponentEventDtoKind,
16
21
  type DbAdapter,
17
22
  type DbAdminAdapter,
18
23
  type DbChangeEvent,
24
+ type DbPersistActionBinding,
25
+ type DbPersistCommand,
19
26
  type DbRealtimeAdapter,
20
27
  DEPLOYMENT_TARGETS,
28
+ type EmailSendActionBinding,
29
+ type FormSubmitEventDto,
21
30
  type ImageAssetSource,
31
+ type KnownActionBinding,
32
+ type KnownCommandDto,
22
33
  NAVIGATOR_TYPES,
23
34
  type StoragePublicUrlResult,
24
35
  type StorageResult,
@@ -274,6 +285,180 @@ describe('contracts', () => {
274
285
  expect(binding.payload?.collection).toBe('contact_messages');
275
286
  });
276
287
 
288
+ it('serializes normalized form submit event DTOs', () => {
289
+ const event: FormSubmitEventDto = {
290
+ type: 'form.submit',
291
+ sourceNodeId: 'contact-form',
292
+ payload: {
293
+ values: {
294
+ firstname: 'Fabio',
295
+ message: 'This is my contact message',
296
+ newsletter: true,
297
+ },
298
+ },
299
+ };
300
+
301
+ expect(JSON.parse(JSON.stringify(event))).toEqual(event);
302
+ expect(event.payload.values.message).toBe('This is my contact message');
303
+ });
304
+
305
+ it('serializes normalized button press event DTOs', () => {
306
+ const event: ButtonPressEventDto = {
307
+ type: 'button.press',
308
+ sourceNodeId: 'submit-button',
309
+ payload: {},
310
+ };
311
+
312
+ expect(JSON.parse(JSON.stringify(event))).toEqual(event);
313
+ expect(event.type).toBe('button.press');
314
+ });
315
+
316
+ it('serializes normalized collection item press event DTOs', () => {
317
+ const event: CollectionItemPressEventDto = {
318
+ type: 'collection.itemPress',
319
+ sourceNodeId: 'posts-list',
320
+ payload: {
321
+ itemId: 'post-1',
322
+ item: {
323
+ id: 'post-1',
324
+ title: 'Hello',
325
+ },
326
+ },
327
+ };
328
+
329
+ expect(JSON.parse(JSON.stringify(event))).toEqual(event);
330
+ expect(event.payload.item.title).toBe('Hello');
331
+ });
332
+
333
+ it('accepts custom component event DTOs through the same envelope', () => {
334
+ const event: ComponentEventDto<'media.play', { readonly mediaId: string }> = {
335
+ type: 'media.play',
336
+ sourceNodeId: 'hero-video',
337
+ payload: {
338
+ mediaId: 'video-1',
339
+ },
340
+ };
341
+ const knownEventType: ComponentEventDtoKind = 'form.submit';
342
+
343
+ expect(event.payload.mediaId).toBe('video-1');
344
+ expect(knownEventType).toBe('form.submit');
345
+ });
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
+
277
462
  it('accepts a provider-neutral CRUD database adapter', async () => {
278
463
  const adapter: DbAdapter = {
279
464
  capabilities: {
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,150 @@ 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;
104
+ }
105
+
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[];
102
129
  }
103
130
 
104
- export interface ActionBinding {
105
- readonly type: string;
106
- readonly payload?: ActionBindingPayload;
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;
205
+
206
+ export type ComponentEventPayloadValue = ManifestValue;
207
+
208
+ export interface ComponentEventDto<
209
+ TType extends string = string,
210
+ TPayload extends object = Record<string, ComponentEventPayloadValue>,
211
+ > {
212
+ readonly type: TType;
213
+ readonly sourceNodeId: string;
214
+ readonly payload: TPayload;
215
+ }
216
+
217
+ export type FormSubmitValues = Record<string, ComponentEventPayloadValue>;
218
+
219
+ export type FormSubmitEventDto = ComponentEventDto<
220
+ 'form.submit',
221
+ {
222
+ readonly values: FormSubmitValues;
223
+ }
224
+ >;
225
+
226
+ export type ButtonPressEventDto = ComponentEventDto<'button.press', Record<string, never>>;
227
+
228
+ export interface CollectionItemPressPayload {
229
+ readonly itemId: string | number;
230
+ readonly item: Record<string, ComponentEventPayloadValue>;
231
+ }
232
+
233
+ export type CollectionItemPressEventDto = ComponentEventDto<
234
+ 'collection.itemPress',
235
+ CollectionItemPressPayload
236
+ >;
237
+
238
+ export type ComponentEventDtoKind =
239
+ | ButtonPressEventDto['type']
240
+ | CollectionItemPressEventDto['type']
241
+ | FormSubmitEventDto['type'];
242
+
243
+ export type KnownComponentEventDto =
244
+ | ButtonPressEventDto
245
+ | CollectionItemPressEventDto
246
+ | FormSubmitEventDto;
111
247
 
112
248
  export const NAVIGATOR_TYPES = ['stack', 'tabs', 'drawer'] as const;
113
249
  export type NavigatorType = (typeof NAVIGATOR_TYPES)[number];