@ankhorage/contracts 1.12.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/auth.d.ts +38 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +21 -0
- package/dist/auth.js.map +1 -1
- package/dist/types.d.ts +15 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/auth-oauth.test.ts +103 -0
- package/src/auth.ts +66 -0
- package/src/contracts.test.ts +21 -0
- package/src/types.ts +19 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ankhorage/contracts
|
|
2
2
|
|
|
3
|
+
## 1.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d55e849: Add a provider-neutral splash screen branding contract to app manifests.
|
|
8
|
+
|
|
9
|
+
## 1.13.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 15e9234: Add provider-neutral OAuth2 auth contracts and manifest auth config support.
|
|
14
|
+
|
|
3
15
|
## 1.12.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import type { IconSpec } from './types';
|
|
1
2
|
export declare const AUTH_IDENTIFIER_KINDS: readonly ["email", "phone", "username"];
|
|
2
3
|
export type AuthIdentifierKind = (typeof AUTH_IDENTIFIER_KINDS)[number];
|
|
3
4
|
export declare const AUTH_SIGN_UP_FIELDS: readonly ["email", "phone", "username", "password", "displayName", "firstName", "lastName"];
|
|
4
5
|
export type KnownAuthSignUpField = (typeof AUTH_SIGN_UP_FIELDS)[number];
|
|
5
6
|
export type AuthSignUpField = KnownAuthSignUpField | (string & {});
|
|
7
|
+
export declare const AUTH_OAUTH_PROVIDER_IDS: readonly ["apple", "azure", "bitbucket", "discord", "facebook", "figma", "github", "gitlab", "google", "kakao", "keycloak", "linkedin", "notion", "slack", "spotify", "twitch", "twitter", "workos", "zoom"];
|
|
8
|
+
export type KnownAuthOAuthProviderId = (typeof AUTH_OAUTH_PROVIDER_IDS)[number];
|
|
9
|
+
export type AuthOAuthProviderId = KnownAuthOAuthProviderId | (string & {});
|
|
6
10
|
export interface AuthIdentifier {
|
|
7
11
|
kind: AuthIdentifierKind;
|
|
8
12
|
value: string;
|
|
@@ -23,11 +27,26 @@ export interface AuthSignUpConfig {
|
|
|
23
27
|
requiredFields: AuthSignUpField[];
|
|
24
28
|
optionalFields?: AuthSignUpField[];
|
|
25
29
|
}
|
|
30
|
+
export interface AuthOAuthProviderConfig {
|
|
31
|
+
id: AuthOAuthProviderId;
|
|
32
|
+
label?: string;
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
scopes?: string[];
|
|
35
|
+
redirectTo?: string;
|
|
36
|
+
queryParams?: Record<string, string>;
|
|
37
|
+
icon?: IconSpec;
|
|
38
|
+
}
|
|
39
|
+
export interface AuthOAuthConfig {
|
|
40
|
+
enabled: boolean;
|
|
41
|
+
callbackRoute: string;
|
|
42
|
+
providers: AuthOAuthProviderConfig[];
|
|
43
|
+
}
|
|
26
44
|
export interface AuthProviderConfig {
|
|
27
45
|
provider: string;
|
|
28
46
|
flow: AuthFlowConfig;
|
|
29
47
|
signIn: AuthSignInConfig;
|
|
30
48
|
signUp?: AuthSignUpConfig;
|
|
49
|
+
oauth?: AuthOAuthConfig;
|
|
31
50
|
passwordReset?: {
|
|
32
51
|
enabled: boolean;
|
|
33
52
|
};
|
|
@@ -90,12 +109,29 @@ export interface VerifyOtpInput {
|
|
|
90
109
|
redirectTo?: string;
|
|
91
110
|
metadata?: Record<string, unknown>;
|
|
92
111
|
}
|
|
112
|
+
export interface SignInWithOAuthInput {
|
|
113
|
+
provider: AuthOAuthProviderId;
|
|
114
|
+
redirectTo?: string;
|
|
115
|
+
scopes?: string[];
|
|
116
|
+
queryParams?: Record<string, string>;
|
|
117
|
+
metadata?: Record<string, unknown>;
|
|
118
|
+
}
|
|
119
|
+
export interface AuthOAuthRedirect {
|
|
120
|
+
provider: AuthOAuthProviderId;
|
|
121
|
+
url: string;
|
|
122
|
+
}
|
|
123
|
+
export interface CompleteOAuthSignInInput {
|
|
124
|
+
url: string;
|
|
125
|
+
redirectTo?: string;
|
|
126
|
+
}
|
|
93
127
|
export interface AuthAdapterCapabilities {
|
|
94
128
|
signInIdentifiers: AuthIdentifierKind[];
|
|
95
129
|
supportsSignUp: boolean;
|
|
96
130
|
supportsPasswordReset: boolean;
|
|
97
131
|
supportsOtp: boolean;
|
|
98
132
|
supportsSessionRefresh: boolean;
|
|
133
|
+
supportsOAuth?: boolean;
|
|
134
|
+
oauthProviders?: AuthOAuthProviderId[];
|
|
99
135
|
}
|
|
100
136
|
export interface AuthAdapter {
|
|
101
137
|
readonly capabilities?: AuthAdapterCapabilities;
|
|
@@ -106,5 +142,7 @@ export interface AuthAdapter {
|
|
|
106
142
|
refreshSession?(): Promise<AuthResult<AuthSession | null>>;
|
|
107
143
|
requestPasswordReset?(input: PasswordResetInput): Promise<AuthResult>;
|
|
108
144
|
verifyOtp?(input: VerifyOtpInput): Promise<AuthResult<AuthSession>>;
|
|
145
|
+
signInWithOAuth?(input: SignInWithOAuthInput): Promise<AuthResult<AuthOAuthRedirect>>;
|
|
146
|
+
completeOAuthSignIn?(input: CompleteOAuthSignInInput): Promise<AuthResult<AuthSession>>;
|
|
109
147
|
}
|
|
110
148
|
//# sourceMappingURL=auth.d.ts.map
|
package/dist/auth.d.ts.map
CHANGED
|
@@ -1 +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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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;IAEpE,eAAe,CAAC,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACtF,mBAAmB,CAAC,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;CACzF"}
|
package/dist/auth.js
CHANGED
|
@@ -6,4 +6,25 @@ export const AUTH_SIGN_UP_FIELDS = [
|
|
|
6
6
|
'firstName',
|
|
7
7
|
'lastName',
|
|
8
8
|
];
|
|
9
|
+
export const AUTH_OAUTH_PROVIDER_IDS = [
|
|
10
|
+
'apple',
|
|
11
|
+
'azure',
|
|
12
|
+
'bitbucket',
|
|
13
|
+
'discord',
|
|
14
|
+
'facebook',
|
|
15
|
+
'figma',
|
|
16
|
+
'github',
|
|
17
|
+
'gitlab',
|
|
18
|
+
'google',
|
|
19
|
+
'kakao',
|
|
20
|
+
'keycloak',
|
|
21
|
+
'linkedin',
|
|
22
|
+
'notion',
|
|
23
|
+
'slack',
|
|
24
|
+
'spotify',
|
|
25
|
+
'twitch',
|
|
26
|
+
'twitter',
|
|
27
|
+
'workos',
|
|
28
|
+
'zoom',
|
|
29
|
+
];
|
|
9
30
|
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAEA,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;AAIX,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,OAAO;IACP,OAAO;IACP,WAAW;IACX,SAAS;IACT,UAAU;IACV,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,UAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;IACP,SAAS;IACT,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,MAAM;CACE,CAAC","sourcesContent":["import type { IconSpec } from './types';\n\nexport 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 const AUTH_OAUTH_PROVIDER_IDS = [\n 'apple',\n 'azure',\n 'bitbucket',\n 'discord',\n 'facebook',\n 'figma',\n 'github',\n 'gitlab',\n 'google',\n 'kakao',\n 'keycloak',\n 'linkedin',\n 'notion',\n 'slack',\n 'spotify',\n 'twitch',\n 'twitter',\n 'workos',\n 'zoom',\n] as const;\nexport type KnownAuthOAuthProviderId = (typeof AUTH_OAUTH_PROVIDER_IDS)[number];\nexport type AuthOAuthProviderId = KnownAuthOAuthProviderId | (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 AuthOAuthProviderConfig {\n id: AuthOAuthProviderId;\n label?: string;\n enabled?: boolean;\n scopes?: string[];\n redirectTo?: string;\n queryParams?: Record<string, string>;\n icon?: IconSpec;\n}\n\nexport interface AuthOAuthConfig {\n enabled: boolean;\n callbackRoute: string;\n providers: AuthOAuthProviderConfig[];\n}\n\nexport interface AuthProviderConfig {\n provider: string;\n flow: AuthFlowConfig;\n signIn: AuthSignInConfig;\n signUp?: AuthSignUpConfig;\n oauth?: AuthOAuthConfig;\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 SignInWithOAuthInput {\n provider: AuthOAuthProviderId;\n redirectTo?: string;\n scopes?: string[];\n queryParams?: Record<string, string>;\n metadata?: Record<string, unknown>;\n}\n\nexport interface AuthOAuthRedirect {\n provider: AuthOAuthProviderId;\n url: string;\n}\n\nexport interface CompleteOAuthSignInInput {\n url: string;\n redirectTo?: string;\n}\n\nexport interface AuthAdapterCapabilities {\n signInIdentifiers: AuthIdentifierKind[];\n supportsSignUp: boolean;\n supportsPasswordReset: boolean;\n supportsOtp: boolean;\n supportsSessionRefresh: boolean;\n supportsOAuth?: boolean;\n oauthProviders?: AuthOAuthProviderId[];\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 signInWithOAuth?(input: SignInWithOAuthInput): Promise<AuthResult<AuthOAuthRedirect>>;\n completeOAuthSignIn?(input: CompleteOAuthSignInInput): Promise<AuthResult<AuthSession>>;\n}\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ColorHarmony } from '@ankhorage/color-theory';
|
|
2
|
-
import type { AuthFlowConfig, AuthIdentifierKind, AuthSignUpField } from './auth';
|
|
2
|
+
import type { AuthFlowConfig, AuthIdentifierKind, AuthOAuthConfig, AuthSignUpField } from './auth';
|
|
3
3
|
import type { ComponentDataBindingRegistry } from './bindings';
|
|
4
4
|
import type { DataSourceRegistry } from './data';
|
|
5
5
|
export interface ThemeModeConfig {
|
|
@@ -143,6 +143,18 @@ export interface RouteDefinition {
|
|
|
143
143
|
screenId?: string;
|
|
144
144
|
navigator?: NavigatorSpec;
|
|
145
145
|
}
|
|
146
|
+
export type SplashScreenResizeMode = 'contain' | 'cover' | 'native';
|
|
147
|
+
export interface SplashScreenAssetSpec {
|
|
148
|
+
readonly image?: string;
|
|
149
|
+
readonly imageWidth?: number;
|
|
150
|
+
readonly resizeMode?: SplashScreenResizeMode;
|
|
151
|
+
}
|
|
152
|
+
export interface SplashScreenModeSpec extends SplashScreenAssetSpec {
|
|
153
|
+
readonly backgroundColor?: string;
|
|
154
|
+
}
|
|
155
|
+
export interface SplashScreenSpec extends SplashScreenModeSpec {
|
|
156
|
+
readonly dark?: SplashScreenModeSpec;
|
|
157
|
+
}
|
|
146
158
|
export interface DeploymentSpec {
|
|
147
159
|
target: DeploymentTarget;
|
|
148
160
|
monitoring: boolean;
|
|
@@ -177,6 +189,7 @@ export interface AuthSpec {
|
|
|
177
189
|
flow?: AuthFlowConfig;
|
|
178
190
|
signIn?: AuthSignInSpec;
|
|
179
191
|
signUp?: AuthSignUpSpec;
|
|
192
|
+
oauth?: AuthOAuthConfig;
|
|
180
193
|
profile?: AuthProfileSpec;
|
|
181
194
|
}
|
|
182
195
|
export interface NetworkingSpec {
|
|
@@ -204,6 +217,7 @@ export interface AppManifest {
|
|
|
204
217
|
themes: ThemeConfig[];
|
|
205
218
|
activeThemeId: string;
|
|
206
219
|
activeThemeMode?: 'dark' | 'light';
|
|
220
|
+
splashScreen?: SplashScreenSpec;
|
|
207
221
|
infra: InfraManifest;
|
|
208
222
|
navigator: NavigatorSpec;
|
|
209
223
|
screens: Record<string, ScreenSpec>;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACnG,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,eAAe,CAAC;IACvB,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,OAAO,GACP,SAAS,GACT,gBAAgB,GAChB,aAAa,GACb,QAAQ,GACR,QAAQ,CAAC;AAEb,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE;QACP,KAAK,EAAE,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,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,CAAU,CAAC;AAGvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC;AAG/D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU,CAAC;AAGrD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAG3D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAU,CAAC;AAGrE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAAU,CAAU,CAAC;AAIpD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAU,CAAC;AAGhF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,YAAY,EAAE,qBAAqB,CAAU,CAAC;AAGpF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,GAAG,wBAAwB;IAC3B,WAAW;IACX,UAAU;IACV,aAAa;IACb,WAAW;CACH,CAAC","sourcesContent":["import type { ColorHarmony } from '@ankhorage/color-theory';\n\nimport type { AuthFlowConfig, AuthIdentifierKind, AuthSignUpField } from './auth';\nimport type { ComponentDataBindingRegistry } from './bindings';\nimport type { DataSourceRegistry } from './data';\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 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}\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 dataSources?: DataSourceRegistry;\n dataBindings?: ComponentDataBindingRegistry;\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":"AAsIA,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, AuthOAuthConfig, AuthSignUpField } from './auth';\nimport type { ComponentDataBindingRegistry } from './bindings';\nimport type { DataSourceRegistry } from './data';\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 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}\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 type SplashScreenResizeMode = 'contain' | 'cover' | 'native';\n\nexport interface SplashScreenAssetSpec {\n readonly image?: string;\n readonly imageWidth?: number;\n readonly resizeMode?: SplashScreenResizeMode;\n}\n\nexport interface SplashScreenModeSpec extends SplashScreenAssetSpec {\n readonly backgroundColor?: string;\n}\n\nexport interface SplashScreenSpec extends SplashScreenModeSpec {\n readonly dark?: SplashScreenModeSpec;\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 oauth?: AuthOAuthConfig;\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 splashScreen?: SplashScreenSpec;\n infra: InfraManifest;\n navigator: NavigatorSpec;\n screens: Record<string, ScreenSpec>;\n dataSources?: DataSourceRegistry;\n dataBindings?: ComponentDataBindingRegistry;\n settings: {\n apiBaseUrl?: string;\n localization: {\n defaultLocale: string;\n locales: string[];\n };\n authFlow: AuthFlowConfig;\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AUTH_OAUTH_PROVIDER_IDS,
|
|
5
|
+
type AuthAdapter,
|
|
6
|
+
type AuthOAuthConfig,
|
|
7
|
+
type AuthSpec,
|
|
8
|
+
} from './index';
|
|
9
|
+
|
|
10
|
+
describe('OAuth auth contracts', () => {
|
|
11
|
+
it('accepts provider-neutral OAuth provider config on auth specs', () => {
|
|
12
|
+
const oauth: AuthOAuthConfig = {
|
|
13
|
+
enabled: true,
|
|
14
|
+
callbackRoute: '/auth/callback',
|
|
15
|
+
providers: [
|
|
16
|
+
{
|
|
17
|
+
id: 'google',
|
|
18
|
+
label: 'Google',
|
|
19
|
+
enabled: true,
|
|
20
|
+
scopes: ['openid', 'email', 'profile'],
|
|
21
|
+
icon: {
|
|
22
|
+
provider: 'FontAwesome',
|
|
23
|
+
name: 'google',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'custom-sso',
|
|
28
|
+
label: 'Custom SSO',
|
|
29
|
+
enabled: false,
|
|
30
|
+
redirectTo: '/auth/custom/callback',
|
|
31
|
+
queryParams: {
|
|
32
|
+
prompt: 'select_account',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const auth: AuthSpec = {
|
|
39
|
+
scope: 'global',
|
|
40
|
+
provider: 'supabase',
|
|
41
|
+
authorization: { kind: 'RBAC', engine: 'native' },
|
|
42
|
+
oauth,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
expect(AUTH_OAUTH_PROVIDER_IDS.includes('google')).toBe(true);
|
|
46
|
+
expect(auth.oauth?.providers[0]?.icon?.name).toBe('google');
|
|
47
|
+
expect(auth.oauth?.providers[1]?.id).toBe('custom-sso');
|
|
48
|
+
expect(auth.oauth?.providers[1]?.enabled).toBe(false);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('accepts optional OAuth adapter capabilities and redirect flow methods', async () => {
|
|
52
|
+
const adapter: AuthAdapter = {
|
|
53
|
+
capabilities: {
|
|
54
|
+
signInIdentifiers: ['email'],
|
|
55
|
+
supportsSignUp: true,
|
|
56
|
+
supportsPasswordReset: true,
|
|
57
|
+
supportsOtp: true,
|
|
58
|
+
supportsSessionRefresh: true,
|
|
59
|
+
supportsOAuth: true,
|
|
60
|
+
oauthProviders: ['google', 'custom-sso'],
|
|
61
|
+
},
|
|
62
|
+
signIn() {
|
|
63
|
+
return Promise.resolve({
|
|
64
|
+
ok: false,
|
|
65
|
+
error: { code: 'unsupported', message: 'Password sign-in is not implemented.' },
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
signUp() {
|
|
69
|
+
return Promise.resolve({
|
|
70
|
+
ok: false,
|
|
71
|
+
error: { code: 'unsupported', message: 'Sign-up is not implemented.' },
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
signOut() {
|
|
75
|
+
return Promise.resolve({ ok: true });
|
|
76
|
+
},
|
|
77
|
+
getSession() {
|
|
78
|
+
return Promise.resolve({ ok: true, data: null });
|
|
79
|
+
},
|
|
80
|
+
signInWithOAuth(input) {
|
|
81
|
+
return Promise.resolve({
|
|
82
|
+
ok: true,
|
|
83
|
+
data: {
|
|
84
|
+
provider: input.provider,
|
|
85
|
+
url: `https://auth.example.com/oauth/${input.provider}`,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const result = await adapter.signInWithOAuth?.({
|
|
92
|
+
provider: 'google',
|
|
93
|
+
redirectTo: '/auth/callback',
|
|
94
|
+
scopes: ['openid', 'email', 'profile'],
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
expect(adapter.capabilities?.supportsOAuth).toBe(true);
|
|
98
|
+
expect(adapter.capabilities?.oauthProviders).toEqual(['google', 'custom-sso']);
|
|
99
|
+
expect(result?.ok).toBe(true);
|
|
100
|
+
expect(result?.ok === true ? result.data?.provider : undefined).toBe('google');
|
|
101
|
+
expect(result?.ok === true ? result.data?.url : undefined).toContain('/oauth/google');
|
|
102
|
+
});
|
|
103
|
+
});
|
package/src/auth.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { IconSpec } from './types';
|
|
2
|
+
|
|
1
3
|
export const AUTH_IDENTIFIER_KINDS = ['email', 'phone', 'username'] as const;
|
|
2
4
|
export type AuthIdentifierKind = (typeof AUTH_IDENTIFIER_KINDS)[number];
|
|
3
5
|
|
|
@@ -11,6 +13,30 @@ export const AUTH_SIGN_UP_FIELDS = [
|
|
|
11
13
|
export type KnownAuthSignUpField = (typeof AUTH_SIGN_UP_FIELDS)[number];
|
|
12
14
|
export type AuthSignUpField = KnownAuthSignUpField | (string & {});
|
|
13
15
|
|
|
16
|
+
export const AUTH_OAUTH_PROVIDER_IDS = [
|
|
17
|
+
'apple',
|
|
18
|
+
'azure',
|
|
19
|
+
'bitbucket',
|
|
20
|
+
'discord',
|
|
21
|
+
'facebook',
|
|
22
|
+
'figma',
|
|
23
|
+
'github',
|
|
24
|
+
'gitlab',
|
|
25
|
+
'google',
|
|
26
|
+
'kakao',
|
|
27
|
+
'keycloak',
|
|
28
|
+
'linkedin',
|
|
29
|
+
'notion',
|
|
30
|
+
'slack',
|
|
31
|
+
'spotify',
|
|
32
|
+
'twitch',
|
|
33
|
+
'twitter',
|
|
34
|
+
'workos',
|
|
35
|
+
'zoom',
|
|
36
|
+
] as const;
|
|
37
|
+
export type KnownAuthOAuthProviderId = (typeof AUTH_OAUTH_PROVIDER_IDS)[number];
|
|
38
|
+
export type AuthOAuthProviderId = KnownAuthOAuthProviderId | (string & {});
|
|
39
|
+
|
|
14
40
|
export interface AuthIdentifier {
|
|
15
41
|
kind: AuthIdentifierKind;
|
|
16
42
|
value: string;
|
|
@@ -35,11 +61,28 @@ export interface AuthSignUpConfig {
|
|
|
35
61
|
optionalFields?: AuthSignUpField[];
|
|
36
62
|
}
|
|
37
63
|
|
|
64
|
+
export interface AuthOAuthProviderConfig {
|
|
65
|
+
id: AuthOAuthProviderId;
|
|
66
|
+
label?: string;
|
|
67
|
+
enabled?: boolean;
|
|
68
|
+
scopes?: string[];
|
|
69
|
+
redirectTo?: string;
|
|
70
|
+
queryParams?: Record<string, string>;
|
|
71
|
+
icon?: IconSpec;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface AuthOAuthConfig {
|
|
75
|
+
enabled: boolean;
|
|
76
|
+
callbackRoute: string;
|
|
77
|
+
providers: AuthOAuthProviderConfig[];
|
|
78
|
+
}
|
|
79
|
+
|
|
38
80
|
export interface AuthProviderConfig {
|
|
39
81
|
provider: string;
|
|
40
82
|
flow: AuthFlowConfig;
|
|
41
83
|
signIn: AuthSignInConfig;
|
|
42
84
|
signUp?: AuthSignUpConfig;
|
|
85
|
+
oauth?: AuthOAuthConfig;
|
|
43
86
|
passwordReset?: {
|
|
44
87
|
enabled: boolean;
|
|
45
88
|
};
|
|
@@ -114,12 +157,32 @@ export interface VerifyOtpInput {
|
|
|
114
157
|
metadata?: Record<string, unknown>;
|
|
115
158
|
}
|
|
116
159
|
|
|
160
|
+
export interface SignInWithOAuthInput {
|
|
161
|
+
provider: AuthOAuthProviderId;
|
|
162
|
+
redirectTo?: string;
|
|
163
|
+
scopes?: string[];
|
|
164
|
+
queryParams?: Record<string, string>;
|
|
165
|
+
metadata?: Record<string, unknown>;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface AuthOAuthRedirect {
|
|
169
|
+
provider: AuthOAuthProviderId;
|
|
170
|
+
url: string;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface CompleteOAuthSignInInput {
|
|
174
|
+
url: string;
|
|
175
|
+
redirectTo?: string;
|
|
176
|
+
}
|
|
177
|
+
|
|
117
178
|
export interface AuthAdapterCapabilities {
|
|
118
179
|
signInIdentifiers: AuthIdentifierKind[];
|
|
119
180
|
supportsSignUp: boolean;
|
|
120
181
|
supportsPasswordReset: boolean;
|
|
121
182
|
supportsOtp: boolean;
|
|
122
183
|
supportsSessionRefresh: boolean;
|
|
184
|
+
supportsOAuth?: boolean;
|
|
185
|
+
oauthProviders?: AuthOAuthProviderId[];
|
|
123
186
|
}
|
|
124
187
|
|
|
125
188
|
export interface AuthAdapter {
|
|
@@ -134,4 +197,7 @@ export interface AuthAdapter {
|
|
|
134
197
|
|
|
135
198
|
requestPasswordReset?(input: PasswordResetInput): Promise<AuthResult>;
|
|
136
199
|
verifyOtp?(input: VerifyOtpInput): Promise<AuthResult<AuthSession>>;
|
|
200
|
+
|
|
201
|
+
signInWithOAuth?(input: SignInWithOAuthInput): Promise<AuthResult<AuthOAuthRedirect>>;
|
|
202
|
+
completeOAuthSignIn?(input: CompleteOAuthSignInInput): Promise<AuthResult<AuthSession>>;
|
|
137
203
|
}
|
package/src/contracts.test.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { describe, expect, it } from 'bun:test';
|
|
|
7
7
|
import {
|
|
8
8
|
APP_CATEGORIES,
|
|
9
9
|
type AppCategory,
|
|
10
|
+
type AppManifest,
|
|
10
11
|
AUTH_PROVIDERS,
|
|
11
12
|
AUTH_SIGN_IN_IDENTIFIERS,
|
|
12
13
|
AUTH_SIGN_UP_POLICIES,
|
|
@@ -24,6 +25,7 @@ import {
|
|
|
24
25
|
type FormSubmitEventDto,
|
|
25
26
|
type ImageAssetSource,
|
|
26
27
|
NAVIGATOR_TYPES,
|
|
28
|
+
type SplashScreenSpec,
|
|
27
29
|
type StoragePublicUrlResult,
|
|
28
30
|
type StorageResult,
|
|
29
31
|
type StorageUploadResult,
|
|
@@ -105,6 +107,25 @@ describe('contracts', () => {
|
|
|
105
107
|
expect(theme.light.harmony).toBe('analogous');
|
|
106
108
|
});
|
|
107
109
|
|
|
110
|
+
it('accepts serializable splash screen branding on app manifests', () => {
|
|
111
|
+
const splashScreen: SplashScreenSpec = {
|
|
112
|
+
backgroundColor: '#ffffff',
|
|
113
|
+
image: './assets/splash/icon.png',
|
|
114
|
+
imageWidth: 160,
|
|
115
|
+
resizeMode: 'contain',
|
|
116
|
+
dark: {
|
|
117
|
+
backgroundColor: '#000000',
|
|
118
|
+
image: './assets/splash/icon-dark.png',
|
|
119
|
+
imageWidth: 160,
|
|
120
|
+
resizeMode: 'contain',
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const manifest: Pick<AppManifest, 'splashScreen'> = { splashScreen };
|
|
125
|
+
|
|
126
|
+
expect(JSON.parse(JSON.stringify(manifest))).toEqual({ splashScreen });
|
|
127
|
+
});
|
|
128
|
+
|
|
108
129
|
it('ThemeModeConfig.harmony accepts all ColorHarmony values', () => {
|
|
109
130
|
for (const harmony of COLOR_HARMONIES) {
|
|
110
131
|
const config: ThemeModeConfig = { primaryColor: '#ff0000', harmony };
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ColorHarmony } from '@ankhorage/color-theory';
|
|
2
2
|
|
|
3
|
-
import type { AuthFlowConfig, AuthIdentifierKind, AuthSignUpField } from './auth';
|
|
3
|
+
import type { AuthFlowConfig, AuthIdentifierKind, AuthOAuthConfig, AuthSignUpField } from './auth';
|
|
4
4
|
import type { ComponentDataBindingRegistry } from './bindings';
|
|
5
5
|
import type { DataSourceRegistry } from './data';
|
|
6
6
|
|
|
@@ -247,6 +247,22 @@ export interface RouteDefinition {
|
|
|
247
247
|
navigator?: NavigatorSpec;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
+
export type SplashScreenResizeMode = 'contain' | 'cover' | 'native';
|
|
251
|
+
|
|
252
|
+
export interface SplashScreenAssetSpec {
|
|
253
|
+
readonly image?: string;
|
|
254
|
+
readonly imageWidth?: number;
|
|
255
|
+
readonly resizeMode?: SplashScreenResizeMode;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface SplashScreenModeSpec extends SplashScreenAssetSpec {
|
|
259
|
+
readonly backgroundColor?: string;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface SplashScreenSpec extends SplashScreenModeSpec {
|
|
263
|
+
readonly dark?: SplashScreenModeSpec;
|
|
264
|
+
}
|
|
265
|
+
|
|
250
266
|
export interface DeploymentSpec {
|
|
251
267
|
target: DeploymentTarget;
|
|
252
268
|
monitoring: boolean;
|
|
@@ -288,6 +304,7 @@ export interface AuthSpec {
|
|
|
288
304
|
flow?: AuthFlowConfig;
|
|
289
305
|
signIn?: AuthSignInSpec;
|
|
290
306
|
signUp?: AuthSignUpSpec;
|
|
307
|
+
oauth?: AuthOAuthConfig;
|
|
291
308
|
profile?: AuthProfileSpec;
|
|
292
309
|
}
|
|
293
310
|
|
|
@@ -318,6 +335,7 @@ export interface AppManifest {
|
|
|
318
335
|
themes: ThemeConfig[];
|
|
319
336
|
activeThemeId: string;
|
|
320
337
|
activeThemeMode?: 'dark' | 'light';
|
|
338
|
+
splashScreen?: SplashScreenSpec;
|
|
321
339
|
infra: InfraManifest;
|
|
322
340
|
navigator: NavigatorSpec;
|
|
323
341
|
screens: Record<string, ScreenSpec>;
|