@ankhorage/contracts 0.0.4 → 0.1.3

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 ADDED
@@ -0,0 +1,47 @@
1
+ # @ankhorage/contracts
2
+
3
+ ## 0.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 7eb0dbc: Add canonical auth flow config types using sign-in, sign-up, and sign-out terminology.
8
+
9
+ ## 0.1.2
10
+
11
+ ### Patch Changes
12
+
13
+ - fc2928d: update publish config to 'public' access
14
+
15
+ ## 0.1.1
16
+
17
+ ### Patch Changes
18
+
19
+ - 7075528: add repository metadata
20
+
21
+ ## 0.1.0
22
+
23
+ ### Minor Changes
24
+
25
+ - 07b8da7: Add shared auth and database adapter contracts.
26
+
27
+ ### Patch Changes
28
+
29
+ - 5c800d8: add missing script
30
+
31
+ ## 0.0.4
32
+
33
+ ### Patch Changes
34
+
35
+ - Refresh the README copy so the published package overview and usage example stay aligned with the current messaging.
36
+
37
+ ## 0.0.3
38
+
39
+ ### Patch Changes
40
+
41
+ - 908b4de: Export `APP_CATEGORIES` and `AppCategory` so template packages can consume the shared category contract instead of redefining it.
42
+
43
+ ## 0.0.2
44
+
45
+ ### Patch Changes
46
+
47
+ - 2c2e771: Migrate to @ankhorage/devtools for shared ESLint and Prettier configuration.
package/README.md CHANGED
@@ -1,20 +1,63 @@
1
1
  # contracts
2
2
 
3
- Shared type definitions for applications.
3
+ Shared public contracts for Ankhorage packages and standalone provider packages.
4
4
 
5
5
  ## 🎯 What you get
6
+
6
7
  - Strongly typed app structures
7
- - Clear contracts between systems
8
+ - Serializable schemas for app manifests and UI definitions
9
+ - Provider-neutral runtime contracts for auth and database adapters
10
+ - Clear contracts between systems without depending on framework internals
8
11
 
9
12
  ## ✨ Features
10
- - Serializable schemas
11
- - App manifests
12
- - UI definitions
13
+
14
+ - Serializable app, action, theme, infra, and auth config contracts
15
+ - UI and navigation definitions
16
+ - Auth adapter contracts using `signIn`, `signUp`, and `signOut` naming
17
+ - Database adapter contracts for provider-neutral CRUD-style access
18
+ - Dedicated subpath exports for focused imports
13
19
 
14
20
  ## 📦 Usage
21
+
15
22
  ```ts
16
- import { AppManifest } from '@ankhorage/contracts'
23
+ import type { AppManifest } from '@ankhorage/contracts';
24
+ import type { AuthAdapter } from '@ankhorage/contracts/auth';
25
+ import type { DbAdapter } from '@ankhorage/contracts/db';
26
+ ```
27
+
28
+ Provider packages can implement the shared contracts without importing runtime,
29
+ CLI, ZORA, Expo Router, or app-generation logic.
30
+
31
+ ```ts
32
+ import type { AuthAdapter } from '@ankhorage/contracts/auth';
33
+
34
+ export function createSupabaseAuthAdapter(): AuthAdapter {
35
+ return {
36
+ async signIn(input) {
37
+ return {
38
+ ok: true,
39
+ data: {
40
+ accessToken: `token:${input.identifier.value}`,
41
+ user: { id: 'user-1', email: input.identifier.value },
42
+ },
43
+ };
44
+ },
45
+ async signUp(input) {
46
+ return { ok: true, data: { id: 'user-1', email: input.identifier.value } };
47
+ },
48
+ async signOut() {
49
+ return { ok: true };
50
+ },
51
+ async getSession() {
52
+ return { ok: true, data: null };
53
+ },
54
+ };
55
+ }
17
56
  ```
18
57
 
19
58
  ## 🧠 Why this exists
20
- Separates data contracts from implementation.
59
+
60
+ Contracts separates shared data and runtime contracts from implementation details.
61
+ Standalone packages such as Supabase, Clerk, or database providers can depend on
62
+ these contracts while staying independent from Ankhorage app generation,
63
+ runtime, CLI, and UI packages.
package/dist/auth.d.ts ADDED
@@ -0,0 +1,110 @@
1
+ export declare const AUTH_IDENTIFIER_KINDS: readonly ["email", "phone", "username"];
2
+ export type AuthIdentifierKind = (typeof AUTH_IDENTIFIER_KINDS)[number];
3
+ export declare const AUTH_SIGN_UP_FIELDS: readonly ["email", "phone", "username", "password", "displayName", "firstName", "lastName"];
4
+ export type KnownAuthSignUpField = (typeof AUTH_SIGN_UP_FIELDS)[number];
5
+ export type AuthSignUpField = KnownAuthSignUpField | (string & {});
6
+ export interface AuthIdentifier {
7
+ kind: AuthIdentifierKind;
8
+ value: string;
9
+ }
10
+ export interface AuthFlowConfig {
11
+ signInRoute: string;
12
+ signUpRoute?: string;
13
+ signOutRoute?: string;
14
+ forgotPasswordRoute?: string;
15
+ otpRoute?: string;
16
+ postSignInRoute: string;
17
+ unauthorizedRoute?: string;
18
+ }
19
+ export interface AuthSignInConfig {
20
+ identifiers: AuthIdentifierKind[];
21
+ }
22
+ export interface AuthSignUpConfig {
23
+ requiredFields: AuthSignUpField[];
24
+ optionalFields?: AuthSignUpField[];
25
+ }
26
+ export interface AuthProviderConfig {
27
+ provider: string;
28
+ flow: AuthFlowConfig;
29
+ signIn: AuthSignInConfig;
30
+ signUp?: AuthSignUpConfig;
31
+ passwordReset?: {
32
+ enabled: boolean;
33
+ };
34
+ otp?: {
35
+ enabled: boolean;
36
+ };
37
+ }
38
+ export interface AuthUser {
39
+ id: string;
40
+ email?: string;
41
+ phone?: string;
42
+ username?: string;
43
+ displayName?: string;
44
+ avatarUrl?: string;
45
+ metadata?: Record<string, unknown>;
46
+ }
47
+ export interface AuthSession {
48
+ accessToken: string;
49
+ refreshToken?: string;
50
+ expiresAt?: number;
51
+ tokenType?: string;
52
+ user: AuthUser;
53
+ }
54
+ export interface AuthAdapterError {
55
+ code: string;
56
+ message: string;
57
+ cause?: unknown;
58
+ }
59
+ export type AuthResult<TData = void> = {
60
+ ok: true;
61
+ data?: TData;
62
+ } | {
63
+ ok: false;
64
+ error: AuthAdapterError;
65
+ };
66
+ export interface SignInInput {
67
+ identifier: AuthIdentifier;
68
+ password?: string;
69
+ otp?: string;
70
+ redirectTo?: string;
71
+ metadata?: Record<string, unknown>;
72
+ }
73
+ export interface SignUpInput {
74
+ identifier: AuthIdentifier;
75
+ password?: string;
76
+ profile?: Record<string, unknown>;
77
+ redirectTo?: string;
78
+ metadata?: Record<string, unknown>;
79
+ }
80
+ export interface SignOutInput {
81
+ allDevices?: boolean;
82
+ }
83
+ export interface PasswordResetInput {
84
+ identifier: AuthIdentifier;
85
+ redirectTo?: string;
86
+ }
87
+ export interface VerifyOtpInput {
88
+ identifier: AuthIdentifier;
89
+ token: string;
90
+ redirectTo?: string;
91
+ metadata?: Record<string, unknown>;
92
+ }
93
+ export interface AuthAdapterCapabilities {
94
+ signInIdentifiers: AuthIdentifierKind[];
95
+ supportsSignUp: boolean;
96
+ supportsPasswordReset: boolean;
97
+ supportsOtp: boolean;
98
+ supportsSessionRefresh: boolean;
99
+ }
100
+ export interface AuthAdapter {
101
+ readonly capabilities?: AuthAdapterCapabilities;
102
+ signIn(input: SignInInput): Promise<AuthResult<AuthSession>>;
103
+ signUp(input: SignUpInput): Promise<AuthResult<AuthSession | AuthUser>>;
104
+ signOut(input?: SignOutInput): Promise<AuthResult>;
105
+ getSession(): Promise<AuthResult<AuthSession | null>>;
106
+ refreshSession?(): Promise<AuthResult<AuthSession | null>>;
107
+ requestPasswordReset?(input: PasswordResetInput): Promise<AuthResult>;
108
+ verifyOtp?(input: VerifyOtpInput): Promise<AuthResult<AuthSession>>;
109
+ }
110
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,yCAA0C,CAAC;AAC7E,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,eAAO,MAAM,mBAAmB,6FAMtB,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AACxE,MAAM,MAAM,eAAe,GAAG,oBAAoB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEnE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,M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AAE,CAAC;IACxC,cAAc,EAAE,OAAO,CAAC;IACxB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,WAAW,EAAE,OAAO,CAAC;IACrB,sBAAsB,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,YAAY,CAAC,EAAE,uBAAuB,CAAC;IAEhD,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;IAC7D,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC;IACxE,OAAO,CAAC,KAAK,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAEnD,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC;IACtD,cAAc,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC;IAE3D,oBAAoB,CAAC,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACtE,SAAS,CAAC,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;CACrE"}
package/dist/auth.js ADDED
@@ -0,0 +1,9 @@
1
+ export const AUTH_IDENTIFIER_KINDS = ['email', 'phone', 'username'];
2
+ export const AUTH_SIGN_UP_FIELDS = [
3
+ ...AUTH_IDENTIFIER_KINDS,
4
+ 'password',
5
+ 'displayName',
6
+ 'firstName',
7
+ 'lastName',
8
+ ];
9
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;AAG7E,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,GAAG,qBAAqB;IACxB,UAAU;IACV,aAAa;IACb,WAAW;IACX,UAAU;CACF,CAAC","sourcesContent":["export const AUTH_IDENTIFIER_KINDS = ['email', 'phone', 'username'] as const;\nexport type AuthIdentifierKind = (typeof AUTH_IDENTIFIER_KINDS)[number];\n\nexport const AUTH_SIGN_UP_FIELDS = [\n ...AUTH_IDENTIFIER_KINDS,\n 'password',\n 'displayName',\n 'firstName',\n 'lastName',\n] as const;\nexport type KnownAuthSignUpField = (typeof AUTH_SIGN_UP_FIELDS)[number];\nexport type AuthSignUpField = KnownAuthSignUpField | (string & {});\n\nexport interface AuthIdentifier {\n kind: AuthIdentifierKind;\n value: string;\n}\n\nexport interface AuthFlowConfig {\n signInRoute: string;\n signUpRoute?: string;\n signOutRoute?: string;\n forgotPasswordRoute?: string;\n otpRoute?: string;\n postSignInRoute: string;\n unauthorizedRoute?: string;\n}\n\nexport interface AuthSignInConfig {\n identifiers: AuthIdentifierKind[];\n}\n\nexport interface AuthSignUpConfig {\n requiredFields: AuthSignUpField[];\n optionalFields?: AuthSignUpField[];\n}\n\nexport interface AuthProviderConfig {\n provider: string;\n flow: AuthFlowConfig;\n signIn: AuthSignInConfig;\n signUp?: AuthSignUpConfig;\n passwordReset?: {\n enabled: boolean;\n };\n otp?: {\n enabled: boolean;\n };\n}\n\nexport interface AuthUser {\n id: string;\n email?: string;\n phone?: string;\n username?: string;\n displayName?: string;\n avatarUrl?: string;\n metadata?: Record<string, unknown>;\n}\n\nexport interface AuthSession {\n accessToken: string;\n refreshToken?: string;\n expiresAt?: number;\n tokenType?: string;\n user: AuthUser;\n}\n\nexport interface AuthAdapterError {\n code: string;\n message: string;\n cause?: unknown;\n}\n\nexport type AuthResult<TData = void> =\n | {\n ok: true;\n data?: TData;\n }\n | {\n ok: false;\n error: AuthAdapterError;\n };\n\nexport interface SignInInput {\n identifier: AuthIdentifier;\n password?: string;\n otp?: string;\n redirectTo?: string;\n metadata?: Record<string, unknown>;\n}\n\nexport interface SignUpInput {\n identifier: AuthIdentifier;\n password?: string;\n profile?: Record<string, unknown>;\n redirectTo?: string;\n metadata?: Record<string, unknown>;\n}\n\nexport interface SignOutInput {\n allDevices?: boolean;\n}\n\nexport interface PasswordResetInput {\n identifier: AuthIdentifier;\n redirectTo?: string;\n}\n\nexport interface VerifyOtpInput {\n identifier: AuthIdentifier;\n token: string;\n redirectTo?: string;\n metadata?: Record<string, unknown>;\n}\n\nexport interface AuthAdapterCapabilities {\n signInIdentifiers: AuthIdentifierKind[];\n supportsSignUp: boolean;\n supportsPasswordReset: boolean;\n supportsOtp: boolean;\n supportsSessionRefresh: boolean;\n}\n\nexport interface AuthAdapter {\n readonly capabilities?: AuthAdapterCapabilities;\n\n signIn(input: SignInInput): Promise<AuthResult<AuthSession>>;\n signUp(input: SignUpInput): Promise<AuthResult<AuthSession | AuthUser>>;\n signOut(input?: SignOutInput): Promise<AuthResult>;\n\n getSession(): Promise<AuthResult<AuthSession | null>>;\n refreshSession?(): Promise<AuthResult<AuthSession | null>>;\n\n requestPasswordReset?(input: PasswordResetInput): Promise<AuthResult>;\n verifyOtp?(input: VerifyOtpInput): Promise<AuthResult<AuthSession>>;\n}\n"]}
package/dist/db.d.ts ADDED
@@ -0,0 +1,68 @@
1
+ export type DbRecord = Record<string, unknown>;
2
+ export type DbSortDirection = 'asc' | 'desc';
3
+ export interface DbAdapterError {
4
+ code: string;
5
+ message: string;
6
+ cause?: unknown;
7
+ }
8
+ export type DbResult<TData = void> = {
9
+ ok: true;
10
+ data?: TData;
11
+ } | {
12
+ ok: false;
13
+ error: DbAdapterError;
14
+ };
15
+ export interface DbSort {
16
+ field: string;
17
+ direction?: DbSortDirection;
18
+ }
19
+ export interface DbPage {
20
+ limit?: number;
21
+ offset?: number;
22
+ }
23
+ export type DbFilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'contains' | 'startsWith' | 'endsWith';
24
+ export interface DbFilter {
25
+ field: string;
26
+ operator: DbFilterOperator;
27
+ value: unknown;
28
+ }
29
+ export interface DbSelectInput {
30
+ table: string;
31
+ columns?: string[];
32
+ filters?: DbFilter[];
33
+ sort?: DbSort[];
34
+ page?: DbPage;
35
+ }
36
+ export interface DbFindByIdInput {
37
+ table: string;
38
+ id: string | number;
39
+ columns?: string[];
40
+ }
41
+ export interface DbInsertInput<TRecord extends object = DbRecord> {
42
+ table: string;
43
+ values: TRecord | TRecord[];
44
+ }
45
+ export interface DbUpdateInput<TRecord extends object = DbRecord> {
46
+ table: string;
47
+ values: Partial<TRecord>;
48
+ filters: DbFilter[];
49
+ }
50
+ export interface DbDeleteInput {
51
+ table: string;
52
+ filters: DbFilter[];
53
+ }
54
+ export interface DbAdapterCapabilities {
55
+ supportsTransactions: boolean;
56
+ supportsReturning: boolean;
57
+ supportsRealtime: boolean;
58
+ }
59
+ export interface DbAdapter {
60
+ readonly capabilities?: DbAdapterCapabilities;
61
+ select<TRecord extends object = DbRecord>(input: DbSelectInput): Promise<DbResult<TRecord[]>>;
62
+ findById<TRecord extends object = DbRecord>(input: DbFindByIdInput): Promise<DbResult<TRecord | null>>;
63
+ insert<TRecord extends object = DbRecord>(input: DbInsertInput<TRecord>): Promise<DbResult<TRecord[]>>;
64
+ update<TRecord extends object = DbRecord>(input: DbUpdateInput<TRecord>): Promise<DbResult<TRecord[]>>;
65
+ delete<TRecord extends object = DbRecord>(input: DbDeleteInput): Promise<DbResult<TRecord[]>>;
66
+ transaction?<TResult>(run: (adapter: DbAdapter) => Promise<TResult>): Promise<DbResult<TResult>>;
67
+ }
68
+ //# sourceMappingURL=db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC/C,MAAM,MAAM,eAAe,GA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,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAE9F,WAAW,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,SAAS,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;CAClG"}
package/dist/db.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=db.js.map
package/dist/db.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.js","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"","sourcesContent":["export type DbRecord = Record<string, unknown>;\nexport type DbSortDirection = 'asc' | 'desc';\n\nexport interface DbAdapterError {\n code: string;\n message: string;\n cause?: unknown;\n}\n\nexport type DbResult<TData = void> =\n | {\n ok: true;\n data?: TData;\n }\n | {\n ok: false;\n error: DbAdapterError;\n };\n\nexport interface DbSort {\n field: string;\n direction?: DbSortDirection;\n}\n\nexport interface DbPage {\n limit?: number;\n offset?: number;\n}\n\nexport type DbFilterOperator =\n | 'eq'\n | 'neq'\n | 'gt'\n | 'gte'\n | 'lt'\n | 'lte'\n | 'in'\n | 'contains'\n | 'startsWith'\n | 'endsWith';\n\nexport interface DbFilter {\n field: string;\n operator: DbFilterOperator;\n value: unknown;\n}\n\nexport interface DbSelectInput {\n table: string;\n columns?: string[];\n filters?: DbFilter[];\n sort?: DbSort[];\n page?: DbPage;\n}\n\nexport interface DbFindByIdInput {\n table: string;\n id: string | number;\n columns?: string[];\n}\n\nexport interface DbInsertInput<TRecord extends object = DbRecord> {\n table: string;\n values: TRecord | TRecord[];\n}\n\nexport interface DbUpdateInput<TRecord extends object = DbRecord> {\n table: string;\n values: Partial<TRecord>;\n filters: DbFilter[];\n}\n\nexport interface DbDeleteInput {\n table: string;\n filters: DbFilter[];\n}\n\nexport interface DbAdapterCapabilities {\n supportsTransactions: boolean;\n supportsReturning: boolean;\n supportsRealtime: boolean;\n}\n\nexport interface DbAdapter {\n readonly capabilities?: DbAdapterCapabilities;\n\n select<TRecord extends object = DbRecord>(input: DbSelectInput): Promise<DbResult<TRecord[]>>;\n findById<TRecord extends object = DbRecord>(\n input: DbFindByIdInput,\n ): Promise<DbResult<TRecord | null>>;\n insert<TRecord extends object = DbRecord>(\n input: DbInsertInput<TRecord>,\n ): Promise<DbResult<TRecord[]>>;\n update<TRecord extends object = DbRecord>(\n input: DbUpdateInput<TRecord>,\n ): Promise<DbResult<TRecord[]>>;\n delete<TRecord extends object = DbRecord>(input: DbDeleteInput): Promise<DbResult<TRecord[]>>;\n\n transaction?<TResult>(run: (adapter: DbAdapter) => Promise<TResult>): Promise<DbResult<TResult>>;\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
+ export * from './auth';
2
+ export * from './db';
1
3
  export * from './types';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,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"}
package/dist/index.js CHANGED
@@ -1,2 +1,4 @@
1
+ export * from './auth';
2
+ export * from './db';
1
3
  export * from './types';
2
4
  //# 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,SAAS,CAAC"}
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","sourcesContent":["export * from './auth';\nexport * from './db';\nexport * from './types';\n"]}
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { AuthFlowConfig, AuthIdentifierKind, AuthSignUpField } from './auth';
1
2
  export type ColorHarmony = 'monochromatic' | 'analogous' | 'complementary' | 'triadic' | 'tetradic' | 'splitComplementary';
2
3
  export type SystemTone = 'neutral' | 'pastel' | 'earth' | 'jewel' | 'fluorescent';
3
4
  export interface ThemeModeConfig {
@@ -77,13 +78,10 @@ export type AuthScope = (typeof AUTH_SCOPES)[number];
77
78
  export declare const AUTH_PROVIDERS: readonly ["supabase"];
78
79
  export type KnownAuthProvider = (typeof AUTH_PROVIDERS)[number];
79
80
  export type AuthProvider = KnownAuthProvider | (string & {});
80
- export declare const AUTH_LOGIN_IDENTIFIERS: readonly ["email", "username", "phone"];
81
- export type AuthLoginIdentifier = (typeof AUTH_LOGIN_IDENTIFIERS)[number];
82
- export declare const AUTH_REGISTRATION_FIELDS: readonly ["email", "username", "phone", "password", "firstName", "lastName", "displayName", "avatarUrl"];
83
- export type KnownAuthRegistrationField = (typeof AUTH_REGISTRATION_FIELDS)[number];
84
- export type AuthRegistrationField = KnownAuthRegistrationField | (string & {});
85
- export declare const AUTH_SIGNUP_POLICIES: readonly ["autoSignIn", "requireVerification"];
86
- export type AuthSignupPolicy = (typeof AUTH_SIGNUP_POLICIES)[number];
81
+ export declare const AUTH_SIGN_IN_IDENTIFIERS: readonly ["email", "username", "phone"];
82
+ export type AuthSignInIdentifier = AuthIdentifierKind;
83
+ export declare const AUTH_SIGN_UP_POLICIES: readonly ["autoSignIn", "requireVerification"];
84
+ export type AuthSignUpPolicy = (typeof AUTH_SIGN_UP_POLICIES)[number];
87
85
  export declare const AUTH_PROFILE_FIELDS: readonly ["email", "username", "phone", "firstName", "lastName", "displayName", "avatarUrl"];
88
86
  export type KnownAuthProfileField = (typeof AUTH_PROFILE_FIELDS)[number];
89
87
  export type AuthProfileField = KnownAuthProfileField | (string & {});
@@ -140,13 +138,13 @@ export interface AuthzSpec {
140
138
  kind: AuthzKind;
141
139
  engine: AuthzEngine;
142
140
  }
143
- export interface AuthLoginSpec {
144
- identifiers: AuthLoginIdentifier[];
141
+ export interface AuthSignInSpec {
142
+ identifiers: AuthSignInIdentifier[];
145
143
  }
146
- export interface AuthRegistrationSpec {
147
- requiredFields: AuthRegistrationField[];
148
- optionalFields?: AuthRegistrationField[];
149
- signupPolicy?: AuthSignupPolicy;
144
+ export interface AuthSignUpSpec {
145
+ requiredFields: AuthSignUpField[];
146
+ optionalFields?: AuthSignUpField[];
147
+ signUpPolicy?: AuthSignUpPolicy;
150
148
  }
151
149
  export interface AuthProfileSpec {
152
150
  fields: AuthProfileField[];
@@ -155,8 +153,9 @@ export interface AuthSpec {
155
153
  scope: AuthScope;
156
154
  provider: AuthProvider;
157
155
  authorization: AuthzSpec;
158
- login?: AuthLoginSpec;
159
- registration?: AuthRegistrationSpec;
156
+ flow?: AuthFlowConfig;
157
+ signIn?: AuthSignInSpec;
158
+ signUp?: AuthSignUpSpec;
160
159
  profile?: AuthProfileSpec;
161
160
  }
162
161
  export interface NetworkingSpec {
@@ -193,11 +192,7 @@ export interface AppManifest {
193
192
  defaultLocale: string;
194
193
  locales: string[];
195
194
  };
196
- authFlow: {
197
- loginRoute: string;
198
- unauthorizedRoute: string;
199
- postLoginRoute: string;
200
- };
195
+ authFlow: AuthFlowConfig;
201
196
  };
202
197
  }
203
198
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GACpB,eAAe,GACf,WAAW,GACX,eAAe,GACf,SAAS,GACT,UAAU,GACV,oBAAoB,CAAC;AAEzB,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,aAAa,CAAC;AAElF,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,YAAY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AAE,MAAM,CAAC;YACtB,OAAO,EAAE,MAAM,EAAE,CAAC;SACnB,CAAC;QACF,QAAQ,EAAE,cAAc,CAAC;KAC1B,CAAC;CACH"}
package/dist/types.js CHANGED
@@ -32,18 +32,10 @@ export const AUTHZ_KINDS = ['RBAC', 'ABAC'];
32
32
  export const AUTHZ_ENGINES = ['cerbos', 'native'];
33
33
  export const AUTH_SCOPES = ['global', 'none', 'integrated'];
34
34
  export const AUTH_PROVIDERS = ['supabase'];
35
- export const AUTH_LOGIN_IDENTIFIERS = ['email', 'username', 'phone'];
36
- export const AUTH_REGISTRATION_FIELDS = [
37
- ...AUTH_LOGIN_IDENTIFIERS,
38
- 'password',
39
- 'firstName',
40
- 'lastName',
41
- 'displayName',
42
- 'avatarUrl',
43
- ];
44
- export const AUTH_SIGNUP_POLICIES = ['autoSignIn', 'requireVerification'];
35
+ export const AUTH_SIGN_IN_IDENTIFIERS = ['email', 'username', 'phone'];
36
+ export const AUTH_SIGN_UP_POLICIES = ['autoSignIn', 'requireVerification'];
45
37
  export const AUTH_PROFILE_FIELDS = [
46
- ...AUTH_LOGIN_IDENTIFIERS,
38
+ ...AUTH_SIGN_IN_IDENTIFIERS,
47
39
  'firstName',
48
40
  'lastName',
49
41
  'displayName',
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAyFA,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,mB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ignUpField } from './auth';\n\nexport type ColorHarmony =\n | 'monochromatic'\n | 'analogous'\n | 'complementary'\n | 'triadic'\n | 'tetradic'\n | 'splitComplementary';\n\nexport type SystemTone = 'neutral' | 'pastel' | 'earth' | 'jewel' | 'fluorescent';\n\nexport interface ThemeModeConfig {\n primaryColor: string;\n harmony: ColorHarmony;\n systemTone: SystemTone;\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 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}\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,37 +1,60 @@
1
1
  {
2
2
  "name": "@ankhorage/contracts",
3
- "type": "module",
4
- "version": "0.0.4",
5
- "description": "Serializable app, action, and theme config contracts for Ankhorage.",
3
+ "version": "0.1.3",
6
4
  "main": "./dist/index.js",
7
- "sideEffects": false,
8
- "types": "./dist/index.d.ts",
9
- "files": [
10
- "dist"
11
- ],
5
+ "devDependencies": {
6
+ "@ankhorage/devtools": "^1.0.0",
7
+ "@changesets/cli": "^2.30.0",
8
+ "@types/bun": "^1.3.13",
9
+ "@types/node": "^25.2.3",
10
+ "typescript": "^5.9.3"
11
+ },
12
12
  "exports": {
13
13
  ".": {
14
14
  "types": "./dist/index.d.ts",
15
15
  "default": "./dist/index.js"
16
+ },
17
+ "./auth": {
18
+ "types": "./dist/auth.d.ts",
19
+ "default": "./dist/auth.js"
20
+ },
21
+ "./db": {
22
+ "types": "./dist/db.d.ts",
23
+ "default": "./dist/db.js"
16
24
  }
17
25
  },
26
+ "description": "Serializable app, action, and theme config contracts for Ankhorage.",
27
+ "files": [
28
+ "dist",
29
+ "src",
30
+ "package.json",
31
+ "README.md",
32
+ "CHANGELOG.md",
33
+ "LICENSE"
34
+ ],
35
+ "packageManager": "bun@1.3.13",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/ankhorage/contracts"
39
+ },
40
+ "homepage": "https://github.com/ankhorage/contracts#readme",
41
+ "bugs": {
42
+ "url": "https://github.com/ankhorage/contracts/issues"
43
+ },
18
44
  "scripts": {
19
45
  "build": "rm -rf dist tsconfig.tsbuildinfo && bun x tsc -p tsconfig.json",
20
46
  "lint": "eslint . --max-warnings=0",
21
47
  "lint:fix": "eslint . --fix --max-warnings=0",
22
48
  "format": "prettier --write .",
23
49
  "format:check": "prettier --check .",
24
- "test": "bun test src"
50
+ "test": "bun test src",
51
+ "version-packages": "changeset version"
25
52
  },
26
- "devDependencies": {
27
- "@ankhorage/devtools": "^1.0.0",
28
- "@changesets/cli": "^2.30.0",
29
- "@types/bun": "^1.3.11",
30
- "@types/node": "^25.2.3",
31
- "typescript": "^5.9.3"
53
+ "sideEffects": false,
54
+ "type": "module",
55
+ "types": "./dist/index.d.ts",
56
+ "publishConfig": {
57
+ "access": "public"
32
58
  },
33
- "packageManager": "bun@1.3.11",
34
- "dependencies": {
35
- "bun": "^1.3.11"
36
- }
59
+ "license": "MIT"
37
60
  }
package/src/auth.ts ADDED
@@ -0,0 +1,137 @@
1
+ export const AUTH_IDENTIFIER_KINDS = ['email', 'phone', 'username'] as const;
2
+ export type AuthIdentifierKind = (typeof AUTH_IDENTIFIER_KINDS)[number];
3
+
4
+ export const AUTH_SIGN_UP_FIELDS = [
5
+ ...AUTH_IDENTIFIER_KINDS,
6
+ 'password',
7
+ 'displayName',
8
+ 'firstName',
9
+ 'lastName',
10
+ ] as const;
11
+ export type KnownAuthSignUpField = (typeof AUTH_SIGN_UP_FIELDS)[number];
12
+ export type AuthSignUpField = KnownAuthSignUpField | (string & {});
13
+
14
+ export interface AuthIdentifier {
15
+ kind: AuthIdentifierKind;
16
+ value: string;
17
+ }
18
+
19
+ export interface AuthFlowConfig {
20
+ signInRoute: string;
21
+ signUpRoute?: string;
22
+ signOutRoute?: string;
23
+ forgotPasswordRoute?: string;
24
+ otpRoute?: string;
25
+ postSignInRoute: string;
26
+ unauthorizedRoute?: string;
27
+ }
28
+
29
+ export interface AuthSignInConfig {
30
+ identifiers: AuthIdentifierKind[];
31
+ }
32
+
33
+ export interface AuthSignUpConfig {
34
+ requiredFields: AuthSignUpField[];
35
+ optionalFields?: AuthSignUpField[];
36
+ }
37
+
38
+ export interface AuthProviderConfig {
39
+ provider: string;
40
+ flow: AuthFlowConfig;
41
+ signIn: AuthSignInConfig;
42
+ signUp?: AuthSignUpConfig;
43
+ passwordReset?: {
44
+ enabled: boolean;
45
+ };
46
+ otp?: {
47
+ enabled: boolean;
48
+ };
49
+ }
50
+
51
+ export interface AuthUser {
52
+ id: string;
53
+ email?: string;
54
+ phone?: string;
55
+ username?: string;
56
+ displayName?: string;
57
+ avatarUrl?: string;
58
+ metadata?: Record<string, unknown>;
59
+ }
60
+
61
+ export interface AuthSession {
62
+ accessToken: string;
63
+ refreshToken?: string;
64
+ expiresAt?: number;
65
+ tokenType?: string;
66
+ user: AuthUser;
67
+ }
68
+
69
+ export interface AuthAdapterError {
70
+ code: string;
71
+ message: string;
72
+ cause?: unknown;
73
+ }
74
+
75
+ export type AuthResult<TData = void> =
76
+ | {
77
+ ok: true;
78
+ data?: TData;
79
+ }
80
+ | {
81
+ ok: false;
82
+ error: AuthAdapterError;
83
+ };
84
+
85
+ export interface SignInInput {
86
+ identifier: AuthIdentifier;
87
+ password?: string;
88
+ otp?: string;
89
+ redirectTo?: string;
90
+ metadata?: Record<string, unknown>;
91
+ }
92
+
93
+ export interface SignUpInput {
94
+ identifier: AuthIdentifier;
95
+ password?: string;
96
+ profile?: Record<string, unknown>;
97
+ redirectTo?: string;
98
+ metadata?: Record<string, unknown>;
99
+ }
100
+
101
+ export interface SignOutInput {
102
+ allDevices?: boolean;
103
+ }
104
+
105
+ export interface PasswordResetInput {
106
+ identifier: AuthIdentifier;
107
+ redirectTo?: string;
108
+ }
109
+
110
+ export interface VerifyOtpInput {
111
+ identifier: AuthIdentifier;
112
+ token: string;
113
+ redirectTo?: string;
114
+ metadata?: Record<string, unknown>;
115
+ }
116
+
117
+ export interface AuthAdapterCapabilities {
118
+ signInIdentifiers: AuthIdentifierKind[];
119
+ supportsSignUp: boolean;
120
+ supportsPasswordReset: boolean;
121
+ supportsOtp: boolean;
122
+ supportsSessionRefresh: boolean;
123
+ }
124
+
125
+ export interface AuthAdapter {
126
+ readonly capabilities?: AuthAdapterCapabilities;
127
+
128
+ signIn(input: SignInInput): Promise<AuthResult<AuthSession>>;
129
+ signUp(input: SignUpInput): Promise<AuthResult<AuthSession | AuthUser>>;
130
+ signOut(input?: SignOutInput): Promise<AuthResult>;
131
+
132
+ getSession(): Promise<AuthResult<AuthSession | null>>;
133
+ refreshSession?(): Promise<AuthResult<AuthSession | null>>;
134
+
135
+ requestPasswordReset?(input: PasswordResetInput): Promise<AuthResult>;
136
+ verifyOtp?(input: VerifyOtpInput): Promise<AuthResult<AuthSession>>;
137
+ }
@@ -0,0 +1,180 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+
3
+ import {
4
+ APP_CATEGORIES,
5
+ type AppCategory,
6
+ AUTH_PROVIDERS,
7
+ AUTH_SIGN_IN_IDENTIFIERS,
8
+ AUTH_SIGN_UP_POLICIES,
9
+ type AuthAdapter,
10
+ type AuthFlowConfig,
11
+ type AuthSpec,
12
+ type DbAdapter,
13
+ DEPLOYMENT_TARGETS,
14
+ NAVIGATOR_TYPES,
15
+ type SignInInput,
16
+ type ThemeConfig,
17
+ } from './index';
18
+
19
+ describe('contracts', () => {
20
+ it('exports stable platform constants', () => {
21
+ expect(NAVIGATOR_TYPES).toEqual(['stack', 'tabs', 'drawer']);
22
+ expect(APP_CATEGORIES).toEqual([
23
+ 'books_reading',
24
+ 'business_productivity',
25
+ 'developer_tools',
26
+ 'education_learning',
27
+ 'entertainment_media',
28
+ 'finance_money',
29
+ 'food_drink',
30
+ 'games',
31
+ 'graphics_design',
32
+ 'health_fitness',
33
+ 'kids_family',
34
+ 'lifestyle',
35
+ 'medical',
36
+ 'music_audio',
37
+ 'navigation_travel',
38
+ 'news_magazines',
39
+ 'photo_video',
40
+ 'reference',
41
+ 'shopping_commerce',
42
+ 'social_community',
43
+ 'sports',
44
+ 'utilities_tools',
45
+ 'weather',
46
+ ]);
47
+ expect(DEPLOYMENT_TARGETS).toEqual(['minikube']);
48
+ expect(AUTH_PROVIDERS).toEqual(['supabase']);
49
+ });
50
+
51
+ it('exports the app category union for template packages', () => {
52
+ const category: AppCategory = 'developer_tools';
53
+ expect(category).toBe('developer_tools');
54
+ });
55
+
56
+ it('accepts the current serialized theme config shape', () => {
57
+ const theme: ThemeConfig = {
58
+ id: 'theme-default',
59
+ name: 'Default',
60
+ light: {
61
+ primaryColor: '#3366ff',
62
+ harmony: 'analogous',
63
+ systemTone: 'neutral',
64
+ },
65
+ dark: {
66
+ primaryColor: '#3366ff',
67
+ harmony: 'analogous',
68
+ systemTone: 'neutral',
69
+ },
70
+ };
71
+
72
+ expect(theme.light.primaryColor).toBe('#3366ff');
73
+ expect(theme.dark.systemTone).toBe('neutral');
74
+ });
75
+
76
+ it('accepts canonical auth flow config without legacy route fields', () => {
77
+ const authFlow: AuthFlowConfig = {
78
+ signInRoute: '/sign-in',
79
+ signUpRoute: '/sign-up',
80
+ signOutRoute: '/sign-out',
81
+ forgotPasswordRoute: '/forgot-password',
82
+ postSignInRoute: '/',
83
+ unauthorizedRoute: '/sign-in',
84
+ };
85
+
86
+ const auth: AuthSpec = {
87
+ scope: 'global',
88
+ provider: 'supabase',
89
+ authorization: { kind: 'RBAC', engine: 'cerbos' },
90
+ flow: authFlow,
91
+ signIn: { identifiers: ['email'] },
92
+ signUp: {
93
+ requiredFields: ['email', 'password'],
94
+ optionalFields: ['displayName'],
95
+ signUpPolicy: 'requireVerification',
96
+ },
97
+ };
98
+
99
+ expect(AUTH_SIGN_IN_IDENTIFIERS).toEqual(['email', 'username', 'phone']);
100
+ expect(AUTH_SIGN_UP_POLICIES).toEqual(['autoSignIn', 'requireVerification']);
101
+ expect(auth.flow?.signInRoute).toBe('/sign-in');
102
+ expect(auth.signUp?.signUpPolicy).toBe('requireVerification');
103
+ });
104
+
105
+ it('accepts provider-neutral auth and db adapter implementations', async () => {
106
+ const authAdapter: AuthAdapter = {
107
+ capabilities: {
108
+ signInIdentifiers: ['email'],
109
+ supportsSignUp: true,
110
+ supportsPasswordReset: true,
111
+ supportsOtp: false,
112
+ supportsSessionRefresh: true,
113
+ },
114
+ async signIn(input: SignInInput) {
115
+ await new Promise((resolve) => setTimeout(resolve, 1));
116
+ return {
117
+ ok: true,
118
+ data: {
119
+ accessToken: `token:${input.identifier.value}`,
120
+ user: {
121
+ id: 'user-1',
122
+ email: input.identifier.value,
123
+ },
124
+ },
125
+ };
126
+ },
127
+ async signUp(input) {
128
+ await new Promise((resolve) => setTimeout(resolve, 1));
129
+ return {
130
+ ok: true,
131
+ data: {
132
+ id: 'user-1',
133
+ email: input.identifier.value,
134
+ },
135
+ };
136
+ },
137
+ async signOut() {
138
+ await new Promise((resolve) => setTimeout(resolve, 1));
139
+ return { ok: true };
140
+ },
141
+ async getSession() {
142
+ await new Promise((resolve) => setTimeout(resolve, 1));
143
+ return { ok: true, data: null };
144
+ },
145
+ };
146
+
147
+ const dbAdapter: DbAdapter = {
148
+ async select() {
149
+ await new Promise((resolve) => setTimeout(resolve, 1));
150
+ return { ok: true, data: [{ id: 'row-1' }] };
151
+ },
152
+ async findById() {
153
+ await new Promise((resolve) => setTimeout(resolve, 1));
154
+ return { ok: true, data: { id: 'row-1' } };
155
+ },
156
+ async insert(input) {
157
+ const values = Array.isArray(input.values) ? input.values : [input.values];
158
+ await new Promise((resolve) => setTimeout(resolve, 1));
159
+ return { ok: true, data: values };
160
+ },
161
+ async update(input) {
162
+ await new Promise((resolve) => setTimeout(resolve, 1));
163
+ return { ok: true, data: [input.values] };
164
+ },
165
+ async delete() {
166
+ await new Promise((resolve) => setTimeout(resolve, 1));
167
+ return { ok: true, data: [] };
168
+ },
169
+ };
170
+
171
+ const signInResult = await authAdapter.signIn({
172
+ identifier: { kind: 'email', value: 'hello@example.com' },
173
+ password: 'secret',
174
+ });
175
+ const selectResult = await dbAdapter.select({ table: 'profiles' });
176
+
177
+ expect(signInResult.ok).toBe(true);
178
+ expect(selectResult.ok).toBe(true);
179
+ });
180
+ });
package/src/db.ts ADDED
@@ -0,0 +1,100 @@
1
+ export type DbRecord = Record<string, unknown>;
2
+ export type DbSortDirection = 'asc' | 'desc';
3
+
4
+ export interface DbAdapterError {
5
+ code: string;
6
+ message: string;
7
+ cause?: unknown;
8
+ }
9
+
10
+ export type DbResult<TData = void> =
11
+ | {
12
+ ok: true;
13
+ data?: TData;
14
+ }
15
+ | {
16
+ ok: false;
17
+ error: DbAdapterError;
18
+ };
19
+
20
+ export interface DbSort {
21
+ field: string;
22
+ direction?: DbSortDirection;
23
+ }
24
+
25
+ export interface DbPage {
26
+ limit?: number;
27
+ offset?: number;
28
+ }
29
+
30
+ export type DbFilterOperator =
31
+ | 'eq'
32
+ | 'neq'
33
+ | 'gt'
34
+ | 'gte'
35
+ | 'lt'
36
+ | 'lte'
37
+ | 'in'
38
+ | 'contains'
39
+ | 'startsWith'
40
+ | 'endsWith';
41
+
42
+ export interface DbFilter {
43
+ field: string;
44
+ operator: DbFilterOperator;
45
+ value: unknown;
46
+ }
47
+
48
+ export interface DbSelectInput {
49
+ table: string;
50
+ columns?: string[];
51
+ filters?: DbFilter[];
52
+ sort?: DbSort[];
53
+ page?: DbPage;
54
+ }
55
+
56
+ export interface DbFindByIdInput {
57
+ table: string;
58
+ id: string | number;
59
+ columns?: string[];
60
+ }
61
+
62
+ export interface DbInsertInput<TRecord extends object = DbRecord> {
63
+ table: string;
64
+ values: TRecord | TRecord[];
65
+ }
66
+
67
+ export interface DbUpdateInput<TRecord extends object = DbRecord> {
68
+ table: string;
69
+ values: Partial<TRecord>;
70
+ filters: DbFilter[];
71
+ }
72
+
73
+ export interface DbDeleteInput {
74
+ table: string;
75
+ filters: DbFilter[];
76
+ }
77
+
78
+ export interface DbAdapterCapabilities {
79
+ supportsTransactions: boolean;
80
+ supportsReturning: boolean;
81
+ supportsRealtime: boolean;
82
+ }
83
+
84
+ export interface DbAdapter {
85
+ readonly capabilities?: DbAdapterCapabilities;
86
+
87
+ select<TRecord extends object = DbRecord>(input: DbSelectInput): Promise<DbResult<TRecord[]>>;
88
+ findById<TRecord extends object = DbRecord>(
89
+ input: DbFindByIdInput,
90
+ ): Promise<DbResult<TRecord | null>>;
91
+ insert<TRecord extends object = DbRecord>(
92
+ input: DbInsertInput<TRecord>,
93
+ ): Promise<DbResult<TRecord[]>>;
94
+ update<TRecord extends object = DbRecord>(
95
+ input: DbUpdateInput<TRecord>,
96
+ ): Promise<DbResult<TRecord[]>>;
97
+ delete<TRecord extends object = DbRecord>(input: DbDeleteInput): Promise<DbResult<TRecord[]>>;
98
+
99
+ transaction?<TResult>(run: (adapter: DbAdapter) => Promise<TResult>): Promise<DbResult<TResult>>;
100
+ }
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './auth';
2
+ export * from './db';
3
+ export * from './types';
package/src/types.ts ADDED
@@ -0,0 +1,289 @@
1
+ import type { AuthFlowConfig, AuthIdentifierKind, AuthSignUpField } from './auth';
2
+
3
+ export type ColorHarmony =
4
+ | 'monochromatic'
5
+ | 'analogous'
6
+ | 'complementary'
7
+ | 'triadic'
8
+ | 'tetradic'
9
+ | 'splitComplementary';
10
+
11
+ export type SystemTone = 'neutral' | 'pastel' | 'earth' | 'jewel' | 'fluorescent';
12
+
13
+ export interface ThemeModeConfig {
14
+ primaryColor: string;
15
+ harmony: ColorHarmony;
16
+ systemTone: SystemTone;
17
+ }
18
+
19
+ export interface ThemeConfig {
20
+ id: string;
21
+ name: string;
22
+ light: ThemeModeConfig;
23
+ dark: ThemeModeConfig;
24
+ }
25
+
26
+ export type ActionType =
27
+ | 'navigate'
28
+ | 'alert'
29
+ | 'console'
30
+ | 'toggleDarkMode'
31
+ | 'setLanguage'
32
+ | 'search'
33
+ | 'filter';
34
+
35
+ export interface NavigateAction {
36
+ type: 'navigate';
37
+ payload: {
38
+ route: string;
39
+ params?: Record<string, number | string>;
40
+ };
41
+ }
42
+
43
+ export interface AlertAction {
44
+ type: 'alert';
45
+ payload?: {
46
+ message?: string;
47
+ };
48
+ }
49
+
50
+ export interface ConsoleAction {
51
+ type: 'console';
52
+ payload?: Record<string, unknown>;
53
+ }
54
+
55
+ export interface ToggleDarkModeAction {
56
+ type: 'toggleDarkMode';
57
+ payload?: never;
58
+ }
59
+
60
+ export interface SetLanguageAction {
61
+ type: 'setLanguage';
62
+ payload: {
63
+ locale: string;
64
+ };
65
+ }
66
+
67
+ export interface SearchAction {
68
+ type: 'search';
69
+ payload: {
70
+ query: string;
71
+ scope?: string;
72
+ };
73
+ }
74
+
75
+ export interface FilterAction {
76
+ type: 'filter';
77
+ payload: {
78
+ filterKey: string;
79
+ filterValue: string;
80
+ };
81
+ }
82
+
83
+ export type Action =
84
+ | AlertAction
85
+ | ConsoleAction
86
+ | FilterAction
87
+ | NavigateAction
88
+ | SearchAction
89
+ | SetLanguageAction
90
+ | ToggleDarkModeAction;
91
+
92
+ export const NAVIGATOR_TYPES = ['stack', 'tabs', 'drawer'] as const;
93
+ export type NavigatorType = (typeof NAVIGATOR_TYPES)[number];
94
+
95
+ export const APP_CATEGORIES = [
96
+ 'books_reading',
97
+ 'business_productivity',
98
+ 'developer_tools',
99
+ 'education_learning',
100
+ 'entertainment_media',
101
+ 'finance_money',
102
+ 'food_drink',
103
+ 'games',
104
+ 'graphics_design',
105
+ 'health_fitness',
106
+ 'kids_family',
107
+ 'lifestyle',
108
+ 'medical',
109
+ 'music_audio',
110
+ 'navigation_travel',
111
+ 'news_magazines',
112
+ 'photo_video',
113
+ 'reference',
114
+ 'shopping_commerce',
115
+ 'social_community',
116
+ 'sports',
117
+ 'utilities_tools',
118
+ 'weather',
119
+ ] as const;
120
+ export type AppCategory = (typeof APP_CATEGORIES)[number];
121
+
122
+ export const DEPLOYMENT_TARGETS = ['minikube'] as const;
123
+ export type KnownDeploymentTarget = (typeof DEPLOYMENT_TARGETS)[number];
124
+ export type DeploymentTarget = KnownDeploymentTarget | (string & {});
125
+
126
+ export const DATABASE_PROVIDERS = ['supabase'] as const;
127
+ export type KnownDatabaseProvider = (typeof DATABASE_PROVIDERS)[number];
128
+ export type DatabaseProvider = KnownDatabaseProvider | (string & {});
129
+
130
+ export const DATABASE_TIERS = ['dev', 'prod'] as const;
131
+ export type DatabaseTier = (typeof DATABASE_TIERS)[number];
132
+
133
+ export const STORAGE_PROVIDERS = ['auto', 's3', 'r2'] as const;
134
+ export type StorageProvider = (typeof STORAGE_PROVIDERS)[number];
135
+
136
+ export const AUTHZ_KINDS = ['RBAC', 'ABAC'] as const;
137
+ export type AuthzKind = (typeof AUTHZ_KINDS)[number];
138
+
139
+ export const AUTHZ_ENGINES = ['cerbos', 'native'] as const;
140
+ export type AuthzEngine = (typeof AUTHZ_ENGINES)[number];
141
+
142
+ export const AUTH_SCOPES = ['global', 'none', 'integrated'] as const;
143
+ export type AuthScope = (typeof AUTH_SCOPES)[number];
144
+
145
+ export const AUTH_PROVIDERS = ['supabase'] as const;
146
+ export type KnownAuthProvider = (typeof AUTH_PROVIDERS)[number];
147
+ export type AuthProvider = KnownAuthProvider | (string & {});
148
+
149
+ export const AUTH_SIGN_IN_IDENTIFIERS = ['email', 'username', 'phone'] as const;
150
+ export type AuthSignInIdentifier = AuthIdentifierKind;
151
+
152
+ export const AUTH_SIGN_UP_POLICIES = ['autoSignIn', 'requireVerification'] as const;
153
+ export type AuthSignUpPolicy = (typeof AUTH_SIGN_UP_POLICIES)[number];
154
+
155
+ export const AUTH_PROFILE_FIELDS = [
156
+ ...AUTH_SIGN_IN_IDENTIFIERS,
157
+ 'firstName',
158
+ 'lastName',
159
+ 'displayName',
160
+ 'avatarUrl',
161
+ ] as const;
162
+ export type KnownAuthProfileField = (typeof AUTH_PROFILE_FIELDS)[number];
163
+ export type AuthProfileField = KnownAuthProfileField | (string & {});
164
+
165
+ export interface IconSpec {
166
+ name: string;
167
+ provider?: string;
168
+ size?: number | string;
169
+ color?: string;
170
+ }
171
+
172
+ export interface UiNode {
173
+ id: string;
174
+ type: string;
175
+ alias?: string;
176
+ props?: Record<string, unknown>;
177
+ children?: UiNode[];
178
+ style?: Record<string, number | string>;
179
+ }
180
+
181
+ export interface ScreenSpec {
182
+ id: string;
183
+ name: string;
184
+ title?: string;
185
+ description?: string;
186
+ root: UiNode;
187
+ }
188
+
189
+ export interface NavigatorSpec {
190
+ type: NavigatorType;
191
+ initialRouteName?: string;
192
+ routes: RouteDefinition[];
193
+ options?: Record<string, unknown>;
194
+ }
195
+
196
+ export interface RouteDefinition {
197
+ name: string;
198
+ path?: string;
199
+ label?: string;
200
+ icon?: IconSpec;
201
+ hideInTabBar?: boolean;
202
+ guards?: string[];
203
+ screenId?: string;
204
+ navigator?: NavigatorSpec;
205
+ }
206
+
207
+ export interface DeploymentSpec {
208
+ target: DeploymentTarget;
209
+ monitoring: boolean;
210
+ }
211
+
212
+ export interface DatabaseSpec {
213
+ provider: DatabaseProvider;
214
+ tier: DatabaseTier;
215
+ }
216
+
217
+ export interface StorageSpec {
218
+ provider: StorageProvider;
219
+ buckets: string[];
220
+ }
221
+
222
+ export interface AuthzSpec {
223
+ kind: AuthzKind;
224
+ engine: AuthzEngine;
225
+ }
226
+
227
+ export interface AuthSignInSpec {
228
+ identifiers: AuthSignInIdentifier[];
229
+ }
230
+
231
+ export interface AuthSignUpSpec {
232
+ requiredFields: AuthSignUpField[];
233
+ optionalFields?: AuthSignUpField[];
234
+ signUpPolicy?: AuthSignUpPolicy;
235
+ }
236
+
237
+ export interface AuthProfileSpec {
238
+ fields: AuthProfileField[];
239
+ }
240
+
241
+ export interface AuthSpec {
242
+ scope: AuthScope;
243
+ provider: AuthProvider;
244
+ authorization: AuthzSpec;
245
+ flow?: AuthFlowConfig;
246
+ signIn?: AuthSignInSpec;
247
+ signUp?: AuthSignUpSpec;
248
+ profile?: AuthProfileSpec;
249
+ }
250
+
251
+ export interface NetworkingSpec {
252
+ domain?: string;
253
+ cdn: boolean;
254
+ }
255
+
256
+ export interface InfraManifest {
257
+ deployment?: DeploymentSpec;
258
+ auth?: AuthSpec;
259
+ database?: DatabaseSpec;
260
+ storage?: StorageSpec;
261
+ networking?: NetworkingSpec;
262
+ plugins: string[];
263
+ pluginsConfig?: Record<string, unknown>;
264
+ }
265
+
266
+ export interface AppManifest {
267
+ metadata: {
268
+ name: string;
269
+ slug: string;
270
+ version: string;
271
+ themeId: string;
272
+ created?: string;
273
+ updated?: string;
274
+ };
275
+ themes: ThemeConfig[];
276
+ activeThemeId: string;
277
+ activeThemeMode?: 'dark' | 'light';
278
+ infra: InfraManifest;
279
+ navigator: NavigatorSpec;
280
+ screens: Record<string, ScreenSpec>;
281
+ settings: {
282
+ apiBaseUrl?: string;
283
+ localization: {
284
+ defaultLocale: string;
285
+ locales: string[];
286
+ };
287
+ authFlow: AuthFlowConfig;
288
+ };
289
+ }