@ankhorage/contracts 0.1.2 → 0.2.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/README.md +9 -0
- package/dist/auth.d.ts +33 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +8 -1
- package/dist/auth.js.map +1 -1
- package/dist/color-theory.d.ts +17 -0
- package/dist/color-theory.d.ts.map +1 -0
- package/dist/color-theory.js +33 -0
- package/dist/color-theory.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +17 -23
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -11
- package/dist/types.js.map +1 -1
- package/package.json +5 -1
- package/src/auth.ts +44 -1
- package/src/color-theory.ts +52 -0
- package/src/contracts.test.ts +37 -4
- package/src/index.ts +1 -0
- package/src/types.ts +18 -39
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ankhorage/contracts
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3536f12: Adds shared color-theory contracts and renames theme mode configuration from `systemTone` / `SystemTone` to `colorTone` / `ColorTone`.
|
|
8
|
+
|
|
9
|
+
## 0.1.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 7eb0dbc: Add canonical auth flow config types using sign-in, sign-up, and sign-out terminology.
|
|
14
|
+
|
|
3
15
|
## 0.1.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -22,9 +22,18 @@ Shared public contracts for Ankhorage packages and standalone provider packages.
|
|
|
22
22
|
```ts
|
|
23
23
|
import type { AppManifest } from '@ankhorage/contracts';
|
|
24
24
|
import type { AuthAdapter } from '@ankhorage/contracts/auth';
|
|
25
|
+
import type { AppMood, ColorHarmony, ColorTone } from '@ankhorage/contracts/color-theory';
|
|
25
26
|
import type { DbAdapter } from '@ankhorage/contracts/db';
|
|
26
27
|
```
|
|
27
28
|
|
|
29
|
+
`ColorTone` describes the visual palette tone, such as `pastel`, `earth`, `jewel`, or
|
|
30
|
+
`fluorescent`.
|
|
31
|
+
|
|
32
|
+
`AppMood` describes psychological/product intent, such as `calm`, `trustworthy`, or
|
|
33
|
+
`playful`.
|
|
34
|
+
|
|
35
|
+
`ColorHarmony` describes hue relationships.
|
|
36
|
+
|
|
28
37
|
Provider packages can implement the shared contracts without importing runtime,
|
|
29
38
|
CLI, ZORA, Expo Router, or app-generation logic.
|
|
30
39
|
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,8 +1,40 @@
|
|
|
1
|
-
export
|
|
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 & {});
|
|
2
6
|
export interface AuthIdentifier {
|
|
3
7
|
kind: AuthIdentifierKind;
|
|
4
8
|
value: string;
|
|
5
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
|
+
}
|
|
6
38
|
export interface AuthUser {
|
|
7
39
|
id: string;
|
|
8
40
|
email?: string;
|
package/dist/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,OAAO,GAAG,
|
|
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,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IAC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,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
CHANGED
package/dist/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"","sourcesContent":["export
|
|
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"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const COLOR_HARMONIES: readonly ["monochromatic", "analogous", "complementary", "triadic", "tetradic", "splitComplementary"];
|
|
2
|
+
export type ColorHarmony = (typeof COLOR_HARMONIES)[number];
|
|
3
|
+
export declare const COLOR_TONES: readonly ["neutral", "pastel", "earth", "mineral", "muted", "jewel", "fluorescent", "obsidian", "vaporwave", "monochromeAccent"];
|
|
4
|
+
export type ColorTone = (typeof COLOR_TONES)[number];
|
|
5
|
+
export declare const APP_MOODS: readonly ["trustworthy", "calm", "focused", "playful", "premium", "energetic", "serious", "creative", "friendly", "technical"];
|
|
6
|
+
export type AppMood = (typeof APP_MOODS)[number];
|
|
7
|
+
export interface ColorToneLaneRecipe {
|
|
8
|
+
backgroundTone: ColorTone;
|
|
9
|
+
foregroundTone: ColorTone;
|
|
10
|
+
}
|
|
11
|
+
export interface ColorThemeRecommendation {
|
|
12
|
+
appMood: AppMood;
|
|
13
|
+
suggestedColorTone: ColorTone;
|
|
14
|
+
suggestedHarmony: ColorHarmony;
|
|
15
|
+
suggestedPrimaryHueDegrees?: number;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=color-theory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-theory.d.ts","sourceRoot":"","sources":["../src/color-theory.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,uGAOlB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D,eAAO,MAAM,WAAW,kIAWd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,eAAO,MAAM,SAAS,gIAWZ,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjD,MAAM,WAAW,mBAAmB;IAClC,cAAc,EAAE,SAAS,CAAC;IAC1B,cAAc,EAAE,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,EAAE,SAAS,CAAC;IAC9B,gBAAgB,EAAE,YAAY,CAAC;IAC/B,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACrC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const COLOR_HARMONIES = [
|
|
2
|
+
'monochromatic',
|
|
3
|
+
'analogous',
|
|
4
|
+
'complementary',
|
|
5
|
+
'triadic',
|
|
6
|
+
'tetradic',
|
|
7
|
+
'splitComplementary',
|
|
8
|
+
];
|
|
9
|
+
export const COLOR_TONES = [
|
|
10
|
+
'neutral',
|
|
11
|
+
'pastel',
|
|
12
|
+
'earth',
|
|
13
|
+
'mineral',
|
|
14
|
+
'muted',
|
|
15
|
+
'jewel',
|
|
16
|
+
'fluorescent',
|
|
17
|
+
'obsidian',
|
|
18
|
+
'vaporwave',
|
|
19
|
+
'monochromeAccent',
|
|
20
|
+
];
|
|
21
|
+
export const APP_MOODS = [
|
|
22
|
+
'trustworthy',
|
|
23
|
+
'calm',
|
|
24
|
+
'focused',
|
|
25
|
+
'playful',
|
|
26
|
+
'premium',
|
|
27
|
+
'energetic',
|
|
28
|
+
'serious',
|
|
29
|
+
'creative',
|
|
30
|
+
'friendly',
|
|
31
|
+
'technical',
|
|
32
|
+
];
|
|
33
|
+
//# sourceMappingURL=color-theory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-theory.js","sourceRoot":"","sources":["../src/color-theory.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,eAAe;IACf,WAAW;IACX,eAAe;IACf,SAAS;IACT,UAAU;IACV,oBAAoB;CACZ,CAAC;AAIX,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,SAAS;IACT,QAAQ;IACR,OAAO;IACP,SAAS;IACT,OAAO;IACP,OAAO;IACP,aAAa;IACb,UAAU;IACV,WAAW;IACX,kBAAkB;CACV,CAAC;AAIX,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,aAAa;IACb,MAAM;IACN,SAAS;IACT,SAAS;IACT,SAAS;IACT,WAAW;IACX,SAAS;IACT,UAAU;IACV,UAAU;IACV,WAAW;CACH,CAAC","sourcesContent":["export const COLOR_HARMONIES = [\n 'monochromatic',\n 'analogous',\n 'complementary',\n 'triadic',\n 'tetradic',\n 'splitComplementary',\n] as const;\n\nexport type ColorHarmony = (typeof COLOR_HARMONIES)[number];\n\nexport const COLOR_TONES = [\n 'neutral',\n 'pastel',\n 'earth',\n 'mineral',\n 'muted',\n 'jewel',\n 'fluorescent',\n 'obsidian',\n 'vaporwave',\n 'monochromeAccent',\n] as const;\n\nexport type ColorTone = (typeof COLOR_TONES)[number];\n\nexport const APP_MOODS = [\n 'trustworthy',\n 'calm',\n 'focused',\n 'playful',\n 'premium',\n 'energetic',\n 'serious',\n 'creative',\n 'friendly',\n 'technical',\n] as const;\n\nexport type AppMood = (typeof APP_MOODS)[number];\n\nexport interface ColorToneLaneRecipe {\n backgroundTone: ColorTone;\n foregroundTone: ColorTone;\n}\n\nexport interface ColorThemeRecommendation {\n appMood: AppMood;\n suggestedColorTone: ColorTone;\n suggestedHarmony: ColorHarmony;\n suggestedPrimaryHueDegrees?: number;\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,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,MAAM,CAAC;AACrB,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,SAAS,CAAC","sourcesContent":["export * from './auth';\nexport * from './db';\nexport * from './types';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC","sourcesContent":["export * from './auth';\nexport * from './color-theory';\nexport * from './db';\nexport * from './types';\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { AuthFlowConfig, AuthIdentifierKind, AuthSignUpField } from './auth';
|
|
2
|
+
import type { ColorHarmony, ColorTone } from './color-theory';
|
|
3
3
|
export interface ThemeModeConfig {
|
|
4
4
|
primaryColor: string;
|
|
5
5
|
harmony: ColorHarmony;
|
|
6
|
-
|
|
6
|
+
colorTone: ColorTone;
|
|
7
7
|
}
|
|
8
8
|
export interface ThemeConfig {
|
|
9
9
|
id: string;
|
|
@@ -77,13 +77,10 @@ export type AuthScope = (typeof AUTH_SCOPES)[number];
|
|
|
77
77
|
export declare const AUTH_PROVIDERS: readonly ["supabase"];
|
|
78
78
|
export type KnownAuthProvider = (typeof AUTH_PROVIDERS)[number];
|
|
79
79
|
export type AuthProvider = KnownAuthProvider | (string & {});
|
|
80
|
-
export declare const
|
|
81
|
-
export type
|
|
82
|
-
export declare const
|
|
83
|
-
export type
|
|
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];
|
|
80
|
+
export declare const AUTH_SIGN_IN_IDENTIFIERS: readonly ["email", "username", "phone"];
|
|
81
|
+
export type AuthSignInIdentifier = AuthIdentifierKind;
|
|
82
|
+
export declare const AUTH_SIGN_UP_POLICIES: readonly ["autoSignIn", "requireVerification"];
|
|
83
|
+
export type AuthSignUpPolicy = (typeof AUTH_SIGN_UP_POLICIES)[number];
|
|
87
84
|
export declare const AUTH_PROFILE_FIELDS: readonly ["email", "username", "phone", "firstName", "lastName", "displayName", "avatarUrl"];
|
|
88
85
|
export type KnownAuthProfileField = (typeof AUTH_PROFILE_FIELDS)[number];
|
|
89
86
|
export type AuthProfileField = KnownAuthProfileField | (string & {});
|
|
@@ -140,13 +137,13 @@ export interface AuthzSpec {
|
|
|
140
137
|
kind: AuthzKind;
|
|
141
138
|
engine: AuthzEngine;
|
|
142
139
|
}
|
|
143
|
-
export interface
|
|
144
|
-
identifiers:
|
|
140
|
+
export interface AuthSignInSpec {
|
|
141
|
+
identifiers: AuthSignInIdentifier[];
|
|
145
142
|
}
|
|
146
|
-
export interface
|
|
147
|
-
requiredFields:
|
|
148
|
-
optionalFields?:
|
|
149
|
-
|
|
143
|
+
export interface AuthSignUpSpec {
|
|
144
|
+
requiredFields: AuthSignUpField[];
|
|
145
|
+
optionalFields?: AuthSignUpField[];
|
|
146
|
+
signUpPolicy?: AuthSignUpPolicy;
|
|
150
147
|
}
|
|
151
148
|
export interface AuthProfileSpec {
|
|
152
149
|
fields: AuthProfileField[];
|
|
@@ -155,8 +152,9 @@ export interface AuthSpec {
|
|
|
155
152
|
scope: AuthScope;
|
|
156
153
|
provider: AuthProvider;
|
|
157
154
|
authorization: AuthzSpec;
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
flow?: AuthFlowConfig;
|
|
156
|
+
signIn?: AuthSignInSpec;
|
|
157
|
+
signUp?: AuthSignUpSpec;
|
|
160
158
|
profile?: AuthProfileSpec;
|
|
161
159
|
}
|
|
162
160
|
export interface NetworkingSpec {
|
|
@@ -193,11 +191,7 @@ export interface AppManifest {
|
|
|
193
191
|
defaultLocale: string;
|
|
194
192
|
locales: string[];
|
|
195
193
|
};
|
|
196
|
-
authFlow:
|
|
197
|
-
loginRoute: string;
|
|
198
|
-
unauthorizedRoute: string;
|
|
199
|
-
postLoginRoute: string;
|
|
200
|
-
};
|
|
194
|
+
authFlow: AuthFlowConfig;
|
|
201
195
|
};
|
|
202
196
|
}
|
|
203
197
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,E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C;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACpC,QAAQ,EAAE;QACR,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE;YACZ,aAAa,EAAE,MAAM,CAAC;YACtB,OAAO,EAAE,MAAM,EAAE,CAAC;SACnB,CAAC;QACF,QAAQ,EAAE,cAAc,CAAC;KAC1B,CAAC;CACH"}
|
package/dist/types.js
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
|
|
36
|
-
export const
|
|
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
|
-
...
|
|
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":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAkFA,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 { AuthFlowConfig, AuthIdentifierKind, AuthSignUpField } from './auth';\nimport type { ColorHarmony, ColorTone } from './color-theory';\n\nexport interface ThemeModeConfig {\n primaryColor: string;\n harmony: ColorHarmony;\n colorTone: ColorTone;\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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@ankhorage/devtools": "^1.0.0",
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
"types": "./dist/auth.d.ts",
|
|
19
19
|
"default": "./dist/auth.js"
|
|
20
20
|
},
|
|
21
|
+
"./color-theory": {
|
|
22
|
+
"types": "./dist/color-theory.d.ts",
|
|
23
|
+
"default": "./dist/color-theory.js"
|
|
24
|
+
},
|
|
21
25
|
"./db": {
|
|
22
26
|
"types": "./dist/db.d.ts",
|
|
23
27
|
"default": "./dist/db.js"
|
package/src/auth.ts
CHANGED
|
@@ -1,10 +1,53 @@
|
|
|
1
|
-
export
|
|
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 & {});
|
|
2
13
|
|
|
3
14
|
export interface AuthIdentifier {
|
|
4
15
|
kind: AuthIdentifierKind;
|
|
5
16
|
value: string;
|
|
6
17
|
}
|
|
7
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
|
+
|
|
8
51
|
export interface AuthUser {
|
|
9
52
|
id: string;
|
|
10
53
|
email?: string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export const COLOR_HARMONIES = [
|
|
2
|
+
'monochromatic',
|
|
3
|
+
'analogous',
|
|
4
|
+
'complementary',
|
|
5
|
+
'triadic',
|
|
6
|
+
'tetradic',
|
|
7
|
+
'splitComplementary',
|
|
8
|
+
] as const;
|
|
9
|
+
|
|
10
|
+
export type ColorHarmony = (typeof COLOR_HARMONIES)[number];
|
|
11
|
+
|
|
12
|
+
export const COLOR_TONES = [
|
|
13
|
+
'neutral',
|
|
14
|
+
'pastel',
|
|
15
|
+
'earth',
|
|
16
|
+
'mineral',
|
|
17
|
+
'muted',
|
|
18
|
+
'jewel',
|
|
19
|
+
'fluorescent',
|
|
20
|
+
'obsidian',
|
|
21
|
+
'vaporwave',
|
|
22
|
+
'monochromeAccent',
|
|
23
|
+
] as const;
|
|
24
|
+
|
|
25
|
+
export type ColorTone = (typeof COLOR_TONES)[number];
|
|
26
|
+
|
|
27
|
+
export const APP_MOODS = [
|
|
28
|
+
'trustworthy',
|
|
29
|
+
'calm',
|
|
30
|
+
'focused',
|
|
31
|
+
'playful',
|
|
32
|
+
'premium',
|
|
33
|
+
'energetic',
|
|
34
|
+
'serious',
|
|
35
|
+
'creative',
|
|
36
|
+
'friendly',
|
|
37
|
+
'technical',
|
|
38
|
+
] as const;
|
|
39
|
+
|
|
40
|
+
export type AppMood = (typeof APP_MOODS)[number];
|
|
41
|
+
|
|
42
|
+
export interface ColorToneLaneRecipe {
|
|
43
|
+
backgroundTone: ColorTone;
|
|
44
|
+
foregroundTone: ColorTone;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface ColorThemeRecommendation {
|
|
48
|
+
appMood: AppMood;
|
|
49
|
+
suggestedColorTone: ColorTone;
|
|
50
|
+
suggestedHarmony: ColorHarmony;
|
|
51
|
+
suggestedPrimaryHueDegrees?: number;
|
|
52
|
+
}
|
package/src/contracts.test.ts
CHANGED
|
@@ -4,7 +4,11 @@ import {
|
|
|
4
4
|
APP_CATEGORIES,
|
|
5
5
|
type AppCategory,
|
|
6
6
|
AUTH_PROVIDERS,
|
|
7
|
+
AUTH_SIGN_IN_IDENTIFIERS,
|
|
8
|
+
AUTH_SIGN_UP_POLICIES,
|
|
7
9
|
type AuthAdapter,
|
|
10
|
+
type AuthFlowConfig,
|
|
11
|
+
type AuthSpec,
|
|
8
12
|
type DbAdapter,
|
|
9
13
|
DEPLOYMENT_TARGETS,
|
|
10
14
|
NAVIGATOR_TYPES,
|
|
@@ -56,17 +60,46 @@ describe('contracts', () => {
|
|
|
56
60
|
light: {
|
|
57
61
|
primaryColor: '#3366ff',
|
|
58
62
|
harmony: 'analogous',
|
|
59
|
-
|
|
63
|
+
colorTone: 'neutral',
|
|
60
64
|
},
|
|
61
65
|
dark: {
|
|
62
66
|
primaryColor: '#3366ff',
|
|
63
67
|
harmony: 'analogous',
|
|
64
|
-
|
|
68
|
+
colorTone: 'neutral',
|
|
65
69
|
},
|
|
66
70
|
};
|
|
67
71
|
|
|
68
72
|
expect(theme.light.primaryColor).toBe('#3366ff');
|
|
69
|
-
expect(theme.dark.
|
|
73
|
+
expect(theme.dark.colorTone).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');
|
|
70
103
|
});
|
|
71
104
|
|
|
72
105
|
it('accepts provider-neutral auth and db adapter implementations', async () => {
|
|
@@ -133,7 +166,7 @@ describe('contracts', () => {
|
|
|
133
166
|
await new Promise((resolve) => setTimeout(resolve, 1));
|
|
134
167
|
return { ok: true, data: [] };
|
|
135
168
|
},
|
|
136
|
-
}
|
|
169
|
+
};
|
|
137
170
|
|
|
138
171
|
const signInResult = await authAdapter.signIn({
|
|
139
172
|
identifier: { kind: 'email', value: 'hello@example.com' },
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
| 'analogous'
|
|
4
|
-
| 'complementary'
|
|
5
|
-
| 'triadic'
|
|
6
|
-
| 'tetradic'
|
|
7
|
-
| 'splitComplementary';
|
|
8
|
-
|
|
9
|
-
export type SystemTone = 'neutral' | 'pastel' | 'earth' | 'jewel' | 'fluorescent';
|
|
1
|
+
import type { AuthFlowConfig, AuthIdentifierKind, AuthSignUpField } from './auth';
|
|
2
|
+
import type { ColorHarmony, ColorTone } from './color-theory';
|
|
10
3
|
|
|
11
4
|
export interface ThemeModeConfig {
|
|
12
5
|
primaryColor: string;
|
|
13
6
|
harmony: ColorHarmony;
|
|
14
|
-
|
|
7
|
+
colorTone: ColorTone;
|
|
15
8
|
}
|
|
16
9
|
|
|
17
10
|
export interface ThemeConfig {
|
|
@@ -144,25 +137,14 @@ export const AUTH_PROVIDERS = ['supabase'] as const;
|
|
|
144
137
|
export type KnownAuthProvider = (typeof AUTH_PROVIDERS)[number];
|
|
145
138
|
export type AuthProvider = KnownAuthProvider | (string & {});
|
|
146
139
|
|
|
147
|
-
export const
|
|
148
|
-
export type
|
|
149
|
-
|
|
150
|
-
export const AUTH_REGISTRATION_FIELDS = [
|
|
151
|
-
...AUTH_LOGIN_IDENTIFIERS,
|
|
152
|
-
'password',
|
|
153
|
-
'firstName',
|
|
154
|
-
'lastName',
|
|
155
|
-
'displayName',
|
|
156
|
-
'avatarUrl',
|
|
157
|
-
] as const;
|
|
158
|
-
export type KnownAuthRegistrationField = (typeof AUTH_REGISTRATION_FIELDS)[number];
|
|
159
|
-
export type AuthRegistrationField = KnownAuthRegistrationField | (string & {});
|
|
140
|
+
export const AUTH_SIGN_IN_IDENTIFIERS = ['email', 'username', 'phone'] as const;
|
|
141
|
+
export type AuthSignInIdentifier = AuthIdentifierKind;
|
|
160
142
|
|
|
161
|
-
export const
|
|
162
|
-
export type
|
|
143
|
+
export const AUTH_SIGN_UP_POLICIES = ['autoSignIn', 'requireVerification'] as const;
|
|
144
|
+
export type AuthSignUpPolicy = (typeof AUTH_SIGN_UP_POLICIES)[number];
|
|
163
145
|
|
|
164
146
|
export const AUTH_PROFILE_FIELDS = [
|
|
165
|
-
...
|
|
147
|
+
...AUTH_SIGN_IN_IDENTIFIERS,
|
|
166
148
|
'firstName',
|
|
167
149
|
'lastName',
|
|
168
150
|
'displayName',
|
|
@@ -233,14 +215,14 @@ export interface AuthzSpec {
|
|
|
233
215
|
engine: AuthzEngine;
|
|
234
216
|
}
|
|
235
217
|
|
|
236
|
-
export interface
|
|
237
|
-
identifiers:
|
|
218
|
+
export interface AuthSignInSpec {
|
|
219
|
+
identifiers: AuthSignInIdentifier[];
|
|
238
220
|
}
|
|
239
221
|
|
|
240
|
-
export interface
|
|
241
|
-
requiredFields:
|
|
242
|
-
optionalFields?:
|
|
243
|
-
|
|
222
|
+
export interface AuthSignUpSpec {
|
|
223
|
+
requiredFields: AuthSignUpField[];
|
|
224
|
+
optionalFields?: AuthSignUpField[];
|
|
225
|
+
signUpPolicy?: AuthSignUpPolicy;
|
|
244
226
|
}
|
|
245
227
|
|
|
246
228
|
export interface AuthProfileSpec {
|
|
@@ -251,8 +233,9 @@ export interface AuthSpec {
|
|
|
251
233
|
scope: AuthScope;
|
|
252
234
|
provider: AuthProvider;
|
|
253
235
|
authorization: AuthzSpec;
|
|
254
|
-
|
|
255
|
-
|
|
236
|
+
flow?: AuthFlowConfig;
|
|
237
|
+
signIn?: AuthSignInSpec;
|
|
238
|
+
signUp?: AuthSignUpSpec;
|
|
256
239
|
profile?: AuthProfileSpec;
|
|
257
240
|
}
|
|
258
241
|
|
|
@@ -292,10 +275,6 @@ export interface AppManifest {
|
|
|
292
275
|
defaultLocale: string;
|
|
293
276
|
locales: string[];
|
|
294
277
|
};
|
|
295
|
-
authFlow:
|
|
296
|
-
loginRoute: string;
|
|
297
|
-
unauthorizedRoute: string;
|
|
298
|
-
postLoginRoute: string;
|
|
299
|
-
};
|
|
278
|
+
authFlow: AuthFlowConfig;
|
|
300
279
|
};
|
|
301
280
|
}
|