@ankhorage/studio 0.0.20 → 0.1.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/README.md +1 -2
- package/dist/cli/index.d.ts +4 -4
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +81 -56
- package/dist/cli/index.js.map +1 -1
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +17 -6
- package/dist/core/constants.js.map +1 -1
- package/dist/hooks/useProjects.js +1 -1
- package/dist/hooks/useProjects.js.map +1 -1
- package/dist/host/createStudioHost.d.ts +13 -0
- package/dist/host/createStudioHost.d.ts.map +1 -0
- package/dist/host/createStudioHost.js +16 -0
- package/dist/host/createStudioHost.js.map +1 -0
- package/dist/host/http/security.d.ts +2 -0
- package/dist/host/http/security.d.ts.map +1 -0
- package/dist/host/http/security.js +55 -0
- package/dist/host/http/security.js.map +1 -0
- package/dist/host/http/server.d.ts +16 -0
- package/dist/host/http/server.d.ts.map +1 -0
- package/dist/host/http/server.js +549 -0
- package/dist/host/http/server.js.map +1 -0
- package/dist/host/layout/auth/resolveAuthLayoutPlan.d.ts +38 -0
- package/dist/host/layout/auth/resolveAuthLayoutPlan.d.ts.map +1 -0
- package/dist/host/layout/auth/resolveAuthLayoutPlan.js +262 -0
- package/dist/host/layout/auth/resolveAuthLayoutPlan.js.map +1 -0
- package/dist/host/layout/layoutGenerator.d.ts +19 -0
- package/dist/host/layout/layoutGenerator.d.ts.map +1 -0
- package/dist/host/layout/layoutGenerator.js +418 -0
- package/dist/host/layout/layoutGenerator.js.map +1 -0
- package/dist/host/layout/templates/auth/adapter.d.ts +6 -0
- package/dist/host/layout/templates/auth/adapter.d.ts.map +1 -0
- package/dist/host/layout/templates/auth/adapter.js +94 -0
- package/dist/host/layout/templates/auth/adapter.js.map +1 -0
- package/dist/host/layout/templates/auth/screen.d.ts +12 -0
- package/dist/host/layout/templates/auth/screen.d.ts.map +1 -0
- package/dist/host/layout/templates/auth/screen.js +648 -0
- package/dist/host/layout/templates/auth/screen.js.map +1 -0
- package/dist/host/layout/templates/auth/session.d.ts +2 -0
- package/dist/host/layout/templates/auth/session.d.ts.map +1 -0
- package/dist/host/layout/templates/auth/session.js +326 -0
- package/dist/host/layout/templates/auth/session.js.map +1 -0
- package/dist/host/layout/templates/auth/signOut.d.ts +2 -0
- package/dist/host/layout/templates/auth/signOut.d.ts.map +1 -0
- package/dist/host/layout/templates/auth/signOut.js +43 -0
- package/dist/host/layout/templates/auth/signOut.js.map +1 -0
- package/dist/host/layout/templates/index.d.ts +11 -0
- package/dist/host/layout/templates/index.d.ts.map +1 -0
- package/dist/host/layout/templates/index.js +10 -0
- package/dist/host/layout/templates/index.js.map +1 -0
- package/dist/host/layout/templates/navigation.d.ts +16 -0
- package/dist/host/layout/templates/navigation.d.ts.map +1 -0
- package/dist/host/layout/templates/navigation.js +332 -0
- package/dist/host/layout/templates/navigation.js.map +1 -0
- package/dist/host/layout/templates/nestedLayout.d.ts +7 -0
- package/dist/host/layout/templates/nestedLayout.d.ts.map +1 -0
- package/dist/host/layout/templates/nestedLayout.js +56 -0
- package/dist/host/layout/templates/nestedLayout.js.map +1 -0
- package/dist/host/layout/templates/redirect.d.ts +2 -0
- package/dist/host/layout/templates/redirect.d.ts.map +1 -0
- package/dist/host/layout/templates/redirect.js +10 -0
- package/dist/host/layout/templates/redirect.js.map +1 -0
- package/dist/host/layout/templates/rootLayout.d.ts +28 -0
- package/dist/host/layout/templates/rootLayout.d.ts.map +1 -0
- package/dist/host/layout/templates/rootLayout.js +507 -0
- package/dist/host/layout/templates/rootLayout.js.map +1 -0
- package/dist/host/layout/templates/screen.d.ts +6 -0
- package/dist/host/layout/templates/screen.d.ts.map +1 -0
- package/dist/host/layout/templates/screen.js +94 -0
- package/dist/host/layout/templates/screen.js.map +1 -0
- package/dist/host/layout/templates/utils/routes.d.ts +3 -0
- package/dist/host/layout/templates/utils/routes.d.ts.map +1 -0
- package/dist/host/layout/templates/utils/routes.js +15 -0
- package/dist/host/layout/templates/utils/routes.js.map +1 -0
- package/dist/host/layout/templates/utils/strings.d.ts +3 -0
- package/dist/host/layout/templates/utils/strings.d.ts.map +1 -0
- package/dist/host/layout/templates/utils/strings.js +7 -0
- package/dist/host/layout/templates/utils/strings.js.map +1 -0
- package/dist/host/layout/utils/escapeStringLiteral.d.ts +2 -0
- package/dist/host/layout/utils/escapeStringLiteral.d.ts.map +1 -0
- package/dist/host/layout/utils/escapeStringLiteral.js +8 -0
- package/dist/host/layout/utils/escapeStringLiteral.js.map +1 -0
- package/dist/host/manifestSystem/auth/index.d.ts +2 -0
- package/dist/host/manifestSystem/auth/index.d.ts.map +1 -0
- package/dist/host/manifestSystem/auth/index.js +2 -0
- package/dist/host/manifestSystem/auth/index.js.map +1 -0
- package/dist/host/manifestSystem/auth/shared/global.auth.system.tpl.d.ts +4 -0
- package/dist/host/manifestSystem/auth/shared/global.auth.system.tpl.d.ts.map +1 -0
- package/dist/host/manifestSystem/auth/shared/global.auth.system.tpl.js +7 -0
- package/dist/host/manifestSystem/auth/shared/global.auth.system.tpl.js.map +1 -0
- package/dist/host/manifestSystem/auth/shared/index.d.ts +3 -0
- package/dist/host/manifestSystem/auth/shared/index.d.ts.map +1 -0
- package/dist/host/manifestSystem/auth/shared/index.js +8 -0
- package/dist/host/manifestSystem/auth/shared/index.js.map +1 -0
- package/dist/host/manifestSystem/index.d.ts +5 -0
- package/dist/host/manifestSystem/index.d.ts.map +1 -0
- package/dist/host/manifestSystem/index.js +23 -0
- package/dist/host/manifestSystem/index.js.map +1 -0
- package/dist/host/manifestSystem/types.d.ts +8 -0
- package/dist/host/manifestSystem/types.d.ts.map +1 -0
- package/dist/host/manifestSystem/types.js +2 -0
- package/dist/host/manifestSystem/types.js.map +1 -0
- package/dist/host/modules/catalog.d.ts +40 -0
- package/dist/host/modules/catalog.d.ts.map +1 -0
- package/dist/host/modules/catalog.js +112 -0
- package/dist/host/modules/catalog.js.map +1 -0
- package/dist/host/modules/layout.d.ts +7 -0
- package/dist/host/modules/layout.d.ts.map +1 -0
- package/dist/host/modules/layout.js +2 -0
- package/dist/host/modules/layout.js.map +1 -0
- package/dist/host/modules/runtime/LocalFsTargetAdapter.d.ts +34 -0
- package/dist/host/modules/runtime/LocalFsTargetAdapter.d.ts.map +1 -0
- package/dist/host/modules/runtime/LocalFsTargetAdapter.js +85 -0
- package/dist/host/modules/runtime/LocalFsTargetAdapter.js.map +1 -0
- package/dist/host/orchestrator/generatedAppFiles.d.ts +8 -0
- package/dist/host/orchestrator/generatedAppFiles.d.ts.map +1 -0
- package/dist/host/orchestrator/generatedAppFiles.js +125 -0
- package/dist/host/orchestrator/generatedAppFiles.js.map +1 -0
- package/dist/host/orchestrator/generatedRouteCleanup.d.ts +5 -0
- package/dist/host/orchestrator/generatedRouteCleanup.d.ts.map +1 -0
- package/dist/host/orchestrator/generatedRouteCleanup.js +117 -0
- package/dist/host/orchestrator/generatedRouteCleanup.js.map +1 -0
- package/dist/host/orchestrator/infraGenerator.d.ts +35 -0
- package/dist/host/orchestrator/infraGenerator.d.ts.map +1 -0
- package/dist/host/orchestrator/infraGenerator.js +135 -0
- package/dist/host/orchestrator/infraGenerator.js.map +1 -0
- package/dist/host/orchestrator/infraRuntime.d.ts +38 -0
- package/dist/host/orchestrator/infraRuntime.d.ts.map +1 -0
- package/dist/host/orchestrator/infraRuntime.js +227 -0
- package/dist/host/orchestrator/infraRuntime.js.map +1 -0
- package/dist/host/orchestrator/infraValidation.d.ts +3 -0
- package/dist/host/orchestrator/infraValidation.d.ts.map +1 -0
- package/dist/host/orchestrator/infraValidation.js +59 -0
- package/dist/host/orchestrator/infraValidation.js.map +1 -0
- package/dist/host/orchestrator/moduleManager.d.ts +86 -0
- package/dist/host/orchestrator/moduleManager.d.ts.map +1 -0
- package/dist/host/orchestrator/moduleManager.js +312 -0
- package/dist/host/orchestrator/moduleManager.js.map +1 -0
- package/dist/host/orchestrator/projectDeletion.d.ts +27 -0
- package/dist/host/orchestrator/projectDeletion.d.ts.map +1 -0
- package/dist/host/orchestrator/projectDeletion.js +242 -0
- package/dist/host/orchestrator/projectDeletion.js.map +1 -0
- package/dist/host/orchestrator/projectManager.d.ts +87 -0
- package/dist/host/orchestrator/projectManager.d.ts.map +1 -0
- package/dist/host/orchestrator/projectManager.js +371 -0
- package/dist/host/orchestrator/projectManager.js.map +1 -0
- package/dist/host/orchestrator/projectPaths.d.ts +4 -0
- package/dist/host/orchestrator/projectPaths.d.ts.map +1 -0
- package/dist/host/orchestrator/projectPaths.js +25 -0
- package/dist/host/orchestrator/projectPaths.js.map +1 -0
- package/dist/host/orchestrator/projectStore.d.ts +24 -0
- package/dist/host/orchestrator/projectStore.d.ts.map +1 -0
- package/dist/host/orchestrator/projectStore.js +155 -0
- package/dist/host/orchestrator/projectStore.js.map +1 -0
- package/dist/host/orchestrator/resolveMutations.d.ts +3 -0
- package/dist/host/orchestrator/resolveMutations.d.ts.map +1 -0
- package/dist/host/orchestrator/resolveMutations.js +12 -0
- package/dist/host/orchestrator/resolveMutations.js.map +1 -0
- package/dist/host/orchestrator/scaffolder.d.ts +33 -0
- package/dist/host/orchestrator/scaffolder.d.ts.map +1 -0
- package/dist/host/orchestrator/scaffolder.js +246 -0
- package/dist/host/orchestrator/scaffolder.js.map +1 -0
- package/dist/host/orchestrator/templates.d.ts +83 -0
- package/dist/host/orchestrator/templates.d.ts.map +1 -0
- package/dist/host/orchestrator/templates.js +355 -0
- package/dist/host/orchestrator/templates.js.map +1 -0
- package/dist/host/orchestrator/workspaceRuntime.d.ts +2 -0
- package/dist/host/orchestrator/workspaceRuntime.d.ts.map +1 -0
- package/dist/host/orchestrator/workspaceRuntime.js +82 -0
- package/dist/host/orchestrator/workspaceRuntime.js.map +1 -0
- package/dist/host/templateRegistry/index.d.ts +16 -0
- package/dist/host/templateRegistry/index.d.ts.map +1 -0
- package/dist/host/templateRegistry/index.js +74 -0
- package/dist/host/templateRegistry/index.js.map +1 -0
- package/dist/host/utils/requirementsInference.d.ts +4 -0
- package/dist/host/utils/requirementsInference.d.ts.map +1 -0
- package/dist/host/utils/requirementsInference.js +49 -0
- package/dist/host/utils/requirementsInference.js.map +1 -0
- package/dist/host/utils/trimOutput.d.ts +7 -0
- package/dist/host/utils/trimOutput.d.ts.map +1 -0
- package/dist/host/utils/trimOutput.js +32 -0
- package/dist/host/utils/trimOutput.js.map +1 -0
- package/dist/host/utils/workspaceRoot.d.ts +2 -0
- package/dist/host/utils/workspaceRoot.d.ts.map +1 -0
- package/dist/host/utils/workspaceRoot.js +33 -0
- package/dist/host/utils/workspaceRoot.js.map +1 -0
- package/dist/host/zoraExtensions/index.d.ts +11 -0
- package/dist/host/zoraExtensions/index.d.ts.map +1 -0
- package/dist/host/zoraExtensions/index.js +54 -0
- package/dist/host/zoraExtensions/index.js.map +1 -0
- package/dist/runtime/appExtensionRegistry.d.ts +3 -0
- package/dist/runtime/appExtensionRegistry.d.ts.map +1 -0
- package/dist/runtime/appExtensionRegistry.js +8 -0
- package/dist/runtime/appExtensionRegistry.js.map +1 -0
- package/dist/runtime/index.d.ts +8 -4
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +8 -4
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/registry.d.ts +7 -0
- package/dist/runtime/registry.d.ts.map +1 -0
- package/dist/runtime/registry.js +7 -0
- package/dist/runtime/registry.js.map +1 -0
- package/dist/runtime/runtimeActions.d.ts +19 -0
- package/dist/runtime/runtimeActions.d.ts.map +1 -0
- package/dist/runtime/runtimeActions.js +5 -0
- package/dist/runtime/runtimeActions.js.map +1 -0
- package/dist/runtime/useRuntimeAction.d.ts +10 -0
- package/dist/runtime/useRuntimeAction.d.ts.map +1 -0
- package/dist/runtime/useRuntimeAction.js +30 -0
- package/dist/runtime/useRuntimeAction.js.map +1 -0
- package/package.json +35 -3
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import { resolveExpoRuntimeLayoutIntegration, } from '@ankhorage/expo-runtime/planning';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { resolveAuthLayoutPlan, } from './auth/resolveAuthLayoutPlan';
|
|
4
|
+
import { buildNavigatorJsx, getAuthAdapterTs, getAuthScreenTsx, getAuthSessionTs, getIndexRedirectRouteTsx, getNestedLayoutTsx, getRootLayoutTsx, getScreenTsx, getSignOutScreenTsx, } from './templates';
|
|
5
|
+
const SUPABASE_LOCAL_PORT_BASE = 55320;
|
|
6
|
+
const SUPABASE_LOCAL_PORT_BUCKET_SIZE = 10;
|
|
7
|
+
const SUPABASE_LOCAL_PORT_BUCKET_COUNT = 1000;
|
|
8
|
+
const SUPABASE_LOCAL_PORT_REFERENCE_PROJECT = 'my-app';
|
|
9
|
+
const DEFAULT_NAMESPACE = 'ankh-app';
|
|
10
|
+
function getPackageOwnedRuntimeImports() {
|
|
11
|
+
return `import {
|
|
12
|
+
createRuntimeDataSourceOperationExecutor,
|
|
13
|
+
RuntimeRendererConfigProvider,
|
|
14
|
+
useOptionalManifestContext,
|
|
15
|
+
} from '@ankhorage/runtime';
|
|
16
|
+
import {
|
|
17
|
+
APP_EXTENSION_COMPONENT_REGISTRY as STUDIO_APP_EXTENSION_COMPONENT_REGISTRY,
|
|
18
|
+
createComponentRegistry,
|
|
19
|
+
useRuntimeAction,
|
|
20
|
+
ZORA_COMPONENT_REGISTRY as STUDIO_ZORA_COMPONENT_REGISTRY,
|
|
21
|
+
} from '@ankhorage/studio/runtime';
|
|
22
|
+
import { APP_EXTENSION_COMPONENT_REGISTRY as GENERATED_APP_EXTENSION_COMPONENT_REGISTRY } from '@/generated/appExtensionRegistry';`;
|
|
23
|
+
}
|
|
24
|
+
function getGeneratedRuntimeRegistryDeclarations() {
|
|
25
|
+
return `const APP_EXTENSION_COMPONENT_REGISTRY = {
|
|
26
|
+
...STUDIO_APP_EXTENSION_COMPONENT_REGISTRY,
|
|
27
|
+
...GENERATED_APP_EXTENSION_COMPONENT_REGISTRY,
|
|
28
|
+
};
|
|
29
|
+
const ZORA_COMPONENT_REGISTRY = createComponentRegistry(
|
|
30
|
+
STUDIO_ZORA_COMPONENT_REGISTRY,
|
|
31
|
+
GENERATED_APP_EXTENSION_COMPONENT_REGISTRY,
|
|
32
|
+
);`;
|
|
33
|
+
}
|
|
34
|
+
function mergeRuntimeModuleDeclarations(...declarations) {
|
|
35
|
+
return declarations
|
|
36
|
+
.map((declaration) => declaration.trim())
|
|
37
|
+
.filter(Boolean)
|
|
38
|
+
.join('\n\n');
|
|
39
|
+
}
|
|
40
|
+
export class LayoutGenerator {
|
|
41
|
+
generateAll(_projectRoot, manifest, mutations, options = {}) {
|
|
42
|
+
const files = [];
|
|
43
|
+
const { includeStudio = true, runtimePlan } = options;
|
|
44
|
+
const authLayoutPlan = resolveAuthLayoutPlan({ manifest });
|
|
45
|
+
const authScreenPlansByPath = new Map(authLayoutPlan.authScreenFiles.map((file) => [file.path, file]));
|
|
46
|
+
const appRootRel = 'src/app';
|
|
47
|
+
const addStudioAdminRouteFiles = () => {
|
|
48
|
+
if (!includeStudio)
|
|
49
|
+
return;
|
|
50
|
+
files.push({
|
|
51
|
+
path: normalizeRel(path.join(appRootRel, 'ankh', '_layout.tsx')),
|
|
52
|
+
content: getStudioAdminLayoutTsx(),
|
|
53
|
+
}, {
|
|
54
|
+
path: normalizeRel(path.join(appRootRel, 'ankh', 'apis.tsx')),
|
|
55
|
+
content: getStudioAdminRouteTsx('apis'),
|
|
56
|
+
}, {
|
|
57
|
+
path: normalizeRel(path.join(appRootRel, 'ankh', 'properties', '[id].tsx')),
|
|
58
|
+
content: getStudioAdminRouteTsx('properties'),
|
|
59
|
+
}, {
|
|
60
|
+
path: normalizeRel(path.join(appRootRel, 'ankh', 'theme.tsx')),
|
|
61
|
+
content: getStudioAdminRouteTsx('theme'),
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const walk = (node, currentRel) => {
|
|
65
|
+
if (currentRel !== '') {
|
|
66
|
+
files.push({
|
|
67
|
+
path: normalizeRel(path.join(appRootRel, currentRel, '_layout.tsx')),
|
|
68
|
+
content: this.getLayoutTemplate(node, manifest, includeStudio),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (!Array.isArray(node.routes))
|
|
72
|
+
return;
|
|
73
|
+
node.routes.forEach((route) => {
|
|
74
|
+
const segment = route.name;
|
|
75
|
+
const nextRel = currentRel ? path.join(currentRel, segment) : segment;
|
|
76
|
+
if (route.navigator) {
|
|
77
|
+
walk(route.navigator, nextRel);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const fileName = `${path.basename(nextRel)}.tsx`;
|
|
81
|
+
const dirRel = path.dirname(nextRel);
|
|
82
|
+
const targetDirRel = dirRel === '.' ? '' : dirRel;
|
|
83
|
+
const targetPath = normalizeRel(path.join(appRootRel, targetDirRel, fileName));
|
|
84
|
+
if (authLayoutPlan.enabled && authScreenPlansByPath.has(targetPath)) {
|
|
85
|
+
const authScreenPlan = authScreenPlansByPath.get(targetPath);
|
|
86
|
+
if (!authScreenPlan?.authMode) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
files.push({
|
|
90
|
+
path: targetPath,
|
|
91
|
+
content: getAuthScreenTsx({
|
|
92
|
+
initialMode: authScreenPlan.authMode,
|
|
93
|
+
screenName: authScreenPlan.authMode === 'signUp' ? 'SignUp' : 'SignIn',
|
|
94
|
+
title: authScreenPlan.authMode === 'signUp' ? 'Sign up' : 'Sign in',
|
|
95
|
+
signInRoute: authLayoutPlan.signInRoute,
|
|
96
|
+
signUpRoute: authLayoutPlan.signUpRoute,
|
|
97
|
+
signInIdentifiers: manifest.infra.auth?.signIn?.identifiers ?? ['email'],
|
|
98
|
+
signUpRequiredFields: manifest.infra.auth?.signUp?.requiredFields ?? [
|
|
99
|
+
'email',
|
|
100
|
+
'password',
|
|
101
|
+
],
|
|
102
|
+
signUpOptionalFields: manifest.infra.auth?.signUp?.optionalFields ?? [],
|
|
103
|
+
signUpPolicy: manifest.infra.auth?.signUp?.signUpPolicy ?? 'autoSignIn',
|
|
104
|
+
}),
|
|
105
|
+
});
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (!route.screenId)
|
|
109
|
+
return;
|
|
110
|
+
const screenDef = manifest.screens[route.screenId];
|
|
111
|
+
if (!screenDef)
|
|
112
|
+
return;
|
|
113
|
+
files.push({
|
|
114
|
+
path: targetPath,
|
|
115
|
+
content: getScreenTsx({ screenId: route.screenId, screenDef }),
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
if (authLayoutPlan.enabled) {
|
|
120
|
+
files.push({
|
|
121
|
+
path: normalizeRel(path.join('src/app/_layout.tsx')),
|
|
122
|
+
content: this.getAuthShellLayoutContent(manifest, mutations, authLayoutPlan, includeStudio, runtimePlan),
|
|
123
|
+
});
|
|
124
|
+
if (authLayoutPlan.postSignInRoute !== '/') {
|
|
125
|
+
files.push({
|
|
126
|
+
path: normalizeRel(path.join('src/app/index.tsx')),
|
|
127
|
+
content: getIndexRedirectRouteTsx(authLayoutPlan.postSignInRoute),
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
addStudioAdminRouteFiles();
|
|
131
|
+
for (const generatedAuthFile of authLayoutPlan.generatedFiles) {
|
|
132
|
+
files.push({
|
|
133
|
+
path: generatedAuthFile.path,
|
|
134
|
+
content: this.getGeneratedAuthFileContent(generatedAuthFile, authLayoutPlan, manifest),
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
walk(prepareNavigatorForGeneratedRoutes(authLayoutPlan.appNavigator), '(app)');
|
|
138
|
+
if (authLayoutPlan.authNavigator.routes.length > 0) {
|
|
139
|
+
walk(prepareNavigatorForGeneratedRoutes(authLayoutPlan.authNavigator), '(auth)');
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
files.push({
|
|
144
|
+
path: normalizeRel(path.join('src/app/_layout.tsx')),
|
|
145
|
+
content: this.getRootLayoutContent(manifest, mutations, includeStudio, runtimePlan),
|
|
146
|
+
});
|
|
147
|
+
addStudioAdminRouteFiles();
|
|
148
|
+
walk(prepareNavigatorForGeneratedRoutes(manifest.navigator), '');
|
|
149
|
+
}
|
|
150
|
+
return files;
|
|
151
|
+
}
|
|
152
|
+
getAuthShellLayoutContent(manifest, mutations, authLayoutPlan, includeStudio, runtimePlan) {
|
|
153
|
+
const studioAdminStackScreen = includeStudio
|
|
154
|
+
? `
|
|
155
|
+
<Stack.Screen key="ankh" name="ankh" />`
|
|
156
|
+
: '';
|
|
157
|
+
const innerNavigationJsx = `<Stack screenOptions={rootStackScreenOptions}>
|
|
158
|
+
<Stack.Screen key="app" name="(app)" />
|
|
159
|
+
<Stack.Screen key="auth" name="(auth)" />${studioAdminStackScreen}
|
|
160
|
+
</Stack>`;
|
|
161
|
+
const innerNavigation = {
|
|
162
|
+
declarations: `const rootStackScreenOptions = {
|
|
163
|
+
headerShown: false,
|
|
164
|
+
};`,
|
|
165
|
+
jsx: innerNavigationJsx,
|
|
166
|
+
usesTheme: false,
|
|
167
|
+
usesIcon: false,
|
|
168
|
+
usesZoraTabBar: false,
|
|
169
|
+
usesZoraDrawerContent: false,
|
|
170
|
+
usesZoraNavigationRouteMap: false,
|
|
171
|
+
};
|
|
172
|
+
const pluginImports = mutations.flatMap((m) => m.imports);
|
|
173
|
+
const pluginHooks = mutations.flatMap((m) => m.hooks);
|
|
174
|
+
const runtimeLayoutIntegration = resolveExpoRuntimeLayoutIntegration(runtimePlan);
|
|
175
|
+
const allImports = [
|
|
176
|
+
`import type { AppManifest${includeStudio ? ', NavigatorSpec, RouteDefinition' : ''} } from '@ankhorage/contracts';`,
|
|
177
|
+
...runtimeLayoutIntegration.imports,
|
|
178
|
+
`import { ${['AppShell', 'ZoraProvider', includeStudio ? 'AppBar' : '']
|
|
179
|
+
.filter(Boolean)
|
|
180
|
+
.join(', ')} } from '@ankhorage/zora';`,
|
|
181
|
+
`import ankhConfig from '@root/ankh.config.json';`,
|
|
182
|
+
`import { Stack, usePathname, useRootNavigationState, useRouter } from 'expo-router';`,
|
|
183
|
+
`import { StatusBar } from 'expo-status-bar';`,
|
|
184
|
+
`import { useCallback, useEffect, useMemo, useState } from 'react';`,
|
|
185
|
+
`import { GestureHandlerRootView } from 'react-native-gesture-handler';`,
|
|
186
|
+
`import { SafeAreaProvider } from 'react-native-safe-area-context';`,
|
|
187
|
+
`
|
|
188
|
+
import { authAdapter } from '@/auth/adapter';`,
|
|
189
|
+
`import {
|
|
190
|
+
bootstrapAuthSession,
|
|
191
|
+
getStoredAuthSession,
|
|
192
|
+
isAuthenticated,
|
|
193
|
+
refreshAuthSessionIfNeeded,
|
|
194
|
+
subscribeToAuthSessionChanges,
|
|
195
|
+
} from '@/auth/session';`,
|
|
196
|
+
getPackageOwnedRuntimeImports(),
|
|
197
|
+
includeStudio
|
|
198
|
+
? `import { StudioProvider, AnkhStudio, useStudio, useStudioAppBarAugmentation } from '@ankhorage/studio';`
|
|
199
|
+
: '',
|
|
200
|
+
...pluginImports,
|
|
201
|
+
]
|
|
202
|
+
.filter(Boolean)
|
|
203
|
+
.join('\n');
|
|
204
|
+
const allHooks = pluginHooks.join('\n ');
|
|
205
|
+
return getRootLayoutTsx({
|
|
206
|
+
manifest,
|
|
207
|
+
mutations,
|
|
208
|
+
allImports,
|
|
209
|
+
allHooks,
|
|
210
|
+
innerNavigation,
|
|
211
|
+
includeStudio,
|
|
212
|
+
authRuntime: authLayoutPlan,
|
|
213
|
+
initialRouteNameOverride: '(app)',
|
|
214
|
+
runtimeModuleDeclarations: mergeRuntimeModuleDeclarations(getGeneratedRuntimeRegistryDeclarations(), ...runtimeLayoutIntegration.moduleDeclarations),
|
|
215
|
+
runtimeProviderEnd: [...runtimeLayoutIntegration.providerEnd],
|
|
216
|
+
runtimeProviderStart: [...runtimeLayoutIntegration.providerStart],
|
|
217
|
+
useStoredAuthSessionCredentialResolver: true,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
getRootLayoutContent(manifest, mutations, includeStudio, runtimePlan) {
|
|
221
|
+
const rootNavigator = prepareNavigatorForGeneratedRoutes(manifest.navigator);
|
|
222
|
+
const innerNavigation = buildNavigatorJsx({
|
|
223
|
+
navigator: rootNavigator,
|
|
224
|
+
manifest,
|
|
225
|
+
includeStudio,
|
|
226
|
+
});
|
|
227
|
+
const needsTheme = innerNavigation.usesTheme;
|
|
228
|
+
const needsIcon = innerNavigation.usesIcon;
|
|
229
|
+
const needsZoraTabBar = innerNavigation.usesZoraTabBar;
|
|
230
|
+
const needsZoraDrawerContent = innerNavigation.usesZoraDrawerContent;
|
|
231
|
+
const needsZoraNavigationRouteMap = innerNavigation.usesZoraNavigationRouteMap;
|
|
232
|
+
const runtimeLayoutIntegration = resolveExpoRuntimeLayoutIntegration(runtimePlan);
|
|
233
|
+
const coreImports = [
|
|
234
|
+
`import type { AppManifest${includeStudio ? ', NavigatorSpec, RouteDefinition' : ''} } from '@ankhorage/contracts';`,
|
|
235
|
+
...runtimeLayoutIntegration.imports,
|
|
236
|
+
needsZoraNavigationRouteMap
|
|
237
|
+
? `import type { ZoraNavigationRouteMap } from '@ankhorage/zora';`
|
|
238
|
+
: '',
|
|
239
|
+
`import { ${[
|
|
240
|
+
'AppShell',
|
|
241
|
+
'ZoraProvider',
|
|
242
|
+
includeStudio ? 'AppBar' : '',
|
|
243
|
+
needsZoraTabBar ? 'ZoraTabBar' : '',
|
|
244
|
+
needsZoraDrawerContent ? 'ZoraDrawerContent' : '',
|
|
245
|
+
needsTheme ? 'useZoraTheme' : '',
|
|
246
|
+
needsIcon ? 'Icon' : '',
|
|
247
|
+
]
|
|
248
|
+
.filter(Boolean)
|
|
249
|
+
.join(', ')} } from '@ankhorage/zora';`,
|
|
250
|
+
`import ankhConfig from '@root/ankh.config.json';`,
|
|
251
|
+
rootNavigator.type === 'tabs'
|
|
252
|
+
? `import { Tabs${includeStudio ? ', usePathname' : ''} } from 'expo-router';`
|
|
253
|
+
: rootNavigator.type === 'drawer'
|
|
254
|
+
? `${includeStudio ? `import { usePathname } from 'expo-router';\n` : ''}import { Drawer } from 'expo-router/drawer';`
|
|
255
|
+
: `import { Stack${includeStudio ? ', usePathname' : ''} } from 'expo-router';`,
|
|
256
|
+
`import { StatusBar } from 'expo-status-bar';`,
|
|
257
|
+
`import React, { useMemo } from 'react';`,
|
|
258
|
+
`import { GestureHandlerRootView } from 'react-native-gesture-handler';`,
|
|
259
|
+
`import { SafeAreaProvider } from 'react-native-safe-area-context';`,
|
|
260
|
+
'',
|
|
261
|
+
getPackageOwnedRuntimeImports(),
|
|
262
|
+
includeStudio
|
|
263
|
+
? `import { StudioProvider, AnkhStudio, useStudio, useStudioAppBarAugmentation } from '@ankhorage/studio';`
|
|
264
|
+
: '',
|
|
265
|
+
];
|
|
266
|
+
const pluginImports = mutations.flatMap((m) => m.imports);
|
|
267
|
+
const pluginHooks = mutations.flatMap((m) => m.hooks);
|
|
268
|
+
const allImports = [...coreImports, ...pluginImports]
|
|
269
|
+
.filter((value) => value !== '')
|
|
270
|
+
.join('\n');
|
|
271
|
+
const allHooks = pluginHooks.join('\n ');
|
|
272
|
+
return getRootLayoutTsx({
|
|
273
|
+
manifest,
|
|
274
|
+
mutations,
|
|
275
|
+
allImports,
|
|
276
|
+
allHooks,
|
|
277
|
+
innerNavigation,
|
|
278
|
+
includeStudio,
|
|
279
|
+
runtimeModuleDeclarations: mergeRuntimeModuleDeclarations(getGeneratedRuntimeRegistryDeclarations(), ...runtimeLayoutIntegration.moduleDeclarations),
|
|
280
|
+
runtimeProviderEnd: [...runtimeLayoutIntegration.providerEnd],
|
|
281
|
+
runtimeProviderStart: [...runtimeLayoutIntegration.providerStart],
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
getGeneratedAuthFileContent(filePlan, authLayoutPlan, manifest) {
|
|
285
|
+
switch (filePlan.kind) {
|
|
286
|
+
case 'adapter':
|
|
287
|
+
return getAuthAdapterTs({
|
|
288
|
+
localSupabaseUrl: resolveGeneratedLocalSupabaseUrl(manifest),
|
|
289
|
+
});
|
|
290
|
+
case 'session':
|
|
291
|
+
return getAuthSessionTs();
|
|
292
|
+
case 'sign-out':
|
|
293
|
+
return getSignOutScreenTsx();
|
|
294
|
+
default:
|
|
295
|
+
return getAuthSessionTs();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
getLayoutTemplate(node, manifest, includeStudio) {
|
|
299
|
+
const navigator = buildNavigatorJsx({ navigator: node, manifest, includeStudio });
|
|
300
|
+
return getNestedLayoutTsx({
|
|
301
|
+
node,
|
|
302
|
+
navigator,
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
function getStudioAdminLayoutTsx() {
|
|
307
|
+
return `import { Stack } from 'expo-router';
|
|
308
|
+
|
|
309
|
+
export default function AnkhLayout() {
|
|
310
|
+
return <Stack screenOptions={{ headerShown: false }} />;
|
|
311
|
+
}
|
|
312
|
+
`;
|
|
313
|
+
}
|
|
314
|
+
function getStudioAdminRouteTsx(routeName) {
|
|
315
|
+
const titleByRouteName = {
|
|
316
|
+
apis: 'APIs',
|
|
317
|
+
properties: 'Properties',
|
|
318
|
+
theme: 'Theme',
|
|
319
|
+
};
|
|
320
|
+
const title = titleByRouteName[routeName];
|
|
321
|
+
return `export default function Ankh${title}Route() {
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
`;
|
|
325
|
+
}
|
|
326
|
+
function normalizeRel(p) {
|
|
327
|
+
return p.replace(/\\/g, '/');
|
|
328
|
+
}
|
|
329
|
+
function prepareNavigatorForGeneratedRoutes(navigator) {
|
|
330
|
+
const normalizedRoutes = navigator.routes.map((route) => prepareRouteForGeneratedRoutes(route));
|
|
331
|
+
const normalizedInitialRouteName = resolveValidGeneratedInitialRouteName(navigator.initialRouteName
|
|
332
|
+
? normalizeGeneratedRouteName(navigator.initialRouteName)
|
|
333
|
+
: undefined, normalizedRoutes);
|
|
334
|
+
const normalizedNavigator = {
|
|
335
|
+
...navigator,
|
|
336
|
+
...(normalizedInitialRouteName ? { initialRouteName: normalizedInitialRouteName } : {}),
|
|
337
|
+
routes: normalizedRoutes,
|
|
338
|
+
};
|
|
339
|
+
if (normalizedNavigator.type !== 'tabs') {
|
|
340
|
+
return normalizedNavigator;
|
|
341
|
+
}
|
|
342
|
+
const visibleRoutes = normalizedNavigator.routes.filter((route) => route.hideInTabBar !== true);
|
|
343
|
+
const hiddenRoutes = normalizedNavigator.routes.filter((route) => route.hideInTabBar === true);
|
|
344
|
+
if (hiddenRoutes.length === 0) {
|
|
345
|
+
return normalizedNavigator;
|
|
346
|
+
}
|
|
347
|
+
return {
|
|
348
|
+
type: 'stack',
|
|
349
|
+
initialRouteName: '(tabs)',
|
|
350
|
+
routes: [
|
|
351
|
+
{
|
|
352
|
+
name: '(tabs)',
|
|
353
|
+
navigator: {
|
|
354
|
+
...normalizedNavigator,
|
|
355
|
+
initialRouteName: resolveValidGeneratedInitialRouteName(normalizedNavigator.initialRouteName, visibleRoutes),
|
|
356
|
+
routes: visibleRoutes,
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
...hiddenRoutes,
|
|
360
|
+
],
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
function prepareRouteForGeneratedRoutes(route) {
|
|
364
|
+
return {
|
|
365
|
+
...route,
|
|
366
|
+
name: normalizeGeneratedRouteName(route.name),
|
|
367
|
+
...(route.navigator ? { navigator: prepareNavigatorForGeneratedRoutes(route.navigator) } : {}),
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function normalizeGeneratedRouteName(routeName) {
|
|
371
|
+
const normalized = routeName.trim().replace(/^\/+/, '').replace(/\/+$/, '');
|
|
372
|
+
return normalized.length > 0 ? normalized : 'index';
|
|
373
|
+
}
|
|
374
|
+
function resolveValidGeneratedInitialRouteName(initialRouteName, routes) {
|
|
375
|
+
const routeNames = new Set(routes.map((route) => route.name));
|
|
376
|
+
if (initialRouteName && routeNames.has(initialRouteName)) {
|
|
377
|
+
return initialRouteName;
|
|
378
|
+
}
|
|
379
|
+
return routes[0]?.name ?? 'index';
|
|
380
|
+
}
|
|
381
|
+
function resolveGeneratedLocalSupabaseUrl(manifest) {
|
|
382
|
+
const namespace = resolveMinikubeNamespace(manifest);
|
|
383
|
+
const port = resolveSupabaseLocalApiPort(namespace);
|
|
384
|
+
return `http://127.0.0.1:${port}`;
|
|
385
|
+
}
|
|
386
|
+
function resolveMinikubeNamespace(manifest) {
|
|
387
|
+
const domain = manifest.infra.networking?.domain?.trim();
|
|
388
|
+
const slug = manifest.metadata.slug.trim();
|
|
389
|
+
const source = firstNonEmptyString(domain, slug) ?? DEFAULT_NAMESPACE;
|
|
390
|
+
const normalized = source
|
|
391
|
+
.toLowerCase()
|
|
392
|
+
.replace(/[^a-z0-9-]/g, '-')
|
|
393
|
+
.replace(/-+/g, '-')
|
|
394
|
+
.replace(/^-|-$/g, '');
|
|
395
|
+
const safe = normalized.slice(0, 63).replace(/-+$/g, '');
|
|
396
|
+
return firstNonEmptyString(safe) ?? DEFAULT_NAMESPACE;
|
|
397
|
+
}
|
|
398
|
+
function firstNonEmptyString(...values) {
|
|
399
|
+
return values.find((value) => value !== undefined && value.length > 0);
|
|
400
|
+
}
|
|
401
|
+
function resolveSupabaseLocalApiPort(namespace) {
|
|
402
|
+
return (SUPABASE_LOCAL_PORT_BASE +
|
|
403
|
+
resolveSupabaseLocalPortBucket(namespace) * SUPABASE_LOCAL_PORT_BUCKET_SIZE +
|
|
404
|
+
1);
|
|
405
|
+
}
|
|
406
|
+
function resolveSupabaseLocalPortBucket(namespace) {
|
|
407
|
+
const rawBucket = hashProjectId(namespace) - hashProjectId(SUPABASE_LOCAL_PORT_REFERENCE_PROJECT);
|
|
408
|
+
return (rawBucket + SUPABASE_LOCAL_PORT_BUCKET_COUNT) % SUPABASE_LOCAL_PORT_BUCKET_COUNT;
|
|
409
|
+
}
|
|
410
|
+
function hashProjectId(value) {
|
|
411
|
+
const source = value.trim().length > 0 ? value.trim() : 'app';
|
|
412
|
+
let hash = 0;
|
|
413
|
+
for (const char of source) {
|
|
414
|
+
hash = (hash * 31 + char.charCodeAt(0)) % SUPABASE_LOCAL_PORT_BUCKET_COUNT;
|
|
415
|
+
}
|
|
416
|
+
return hash;
|
|
417
|
+
}
|
|
418
|
+
//# sourceMappingURL=layoutGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layoutGenerator.js","sourceRoot":"","sources":["../../../src/host/layout/layoutGenerator.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,mCAAmC,GACpC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAGL,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,iBAAiB,EAEjB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAYrB,MAAM,wBAAwB,GAAG,KAAK,CAAC;AACvC,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAC3C,MAAM,gCAAgC,GAAG,IAAI,CAAC;AAC9C,MAAM,qCAAqC,GAAG,QAAQ,CAAC;AACvD,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAErC,SAAS,6BAA6B;IACpC,OAAO;;;;;;;;;;;mIAW0H,CAAC;AACpI,CAAC;AAED,SAAS,uCAAuC;IAC9C,OAAO;;;;;;;GAON,CAAC;AACJ,CAAC;AAED,SAAS,8BAA8B,CAAC,GAAG,YAA+B;IACxE,OAAO,YAAY;SAChB,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;SACxC,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,OAAO,eAAe;IAC1B,WAAW,CACT,YAAoB,EACpB,QAAqB,EACrB,SAA2B,EAC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QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AAKD,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,0BAA+B,UA4FxE"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
const DEFAULT_LOCAL_SUPABASE_ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6IjEyMzQ1Njc4OTAiLCJyb2xlIjoiYW5vbiIsImlhdCI6MTUxNjIzOTAyMn0.UYDs1JMK4NH23zXO1aEDLOO_iUYIrOHwzqDqaea-6FY';
|
|
2
|
+
export function getAuthAdapterTs(options = {}) {
|
|
3
|
+
const localSupabaseUrl = options.localSupabaseUrl ?? '';
|
|
4
|
+
return `import type { AuthAdapter, AuthResult, AuthSession, AuthUser } from '@ankhorage/contracts/auth';
|
|
5
|
+
import { createSupabaseAuthAdapter } from '@ankhorage/supabase-auth';
|
|
6
|
+
|
|
7
|
+
import { AUTH_SESSION_STORAGE_KEY, authSessionStorage } from './session';
|
|
8
|
+
|
|
9
|
+
const generatedLocalSupabaseUrl = '${localSupabaseUrl}';
|
|
10
|
+
const generatedLocalSupabaseAnonKey =
|
|
11
|
+
'${DEFAULT_LOCAL_SUPABASE_ANON_KEY}';
|
|
12
|
+
|
|
13
|
+
function readEnv(name: string): string | undefined {
|
|
14
|
+
const maybeProcess: unknown = 'process' in globalThis ? globalThis.process : undefined;
|
|
15
|
+
if (!maybeProcess || typeof maybeProcess !== 'object' || !('env' in maybeProcess)) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const maybeEnv = maybeProcess.env;
|
|
20
|
+
if (!maybeEnv || typeof maybeEnv !== 'object') {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const value = (maybeEnv as Record<string, unknown>)[name];
|
|
25
|
+
return typeof value === 'string' ? value : undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function resolveConfiguredValue(
|
|
29
|
+
primary: string | undefined,
|
|
30
|
+
secondary: string | undefined,
|
|
31
|
+
fallback: string,
|
|
32
|
+
): string {
|
|
33
|
+
const configured = primary?.trim() ?? secondary?.trim() ?? '';
|
|
34
|
+
if (configured.length > 0) {
|
|
35
|
+
return configured;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return fallback;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const nodeEnv = readEnv('NODE_ENV') ?? '';
|
|
42
|
+
const shouldUseGeneratedLocalSupabaseFallback = nodeEnv !== 'production';
|
|
43
|
+
const configuredSupabaseUrl = readEnv('EXPO_PUBLIC_SUPABASE_URL') ?? readEnv('SUPABASE_URL') ?? '';
|
|
44
|
+
const configuredSupabaseAnonKey =
|
|
45
|
+
readEnv('EXPO_PUBLIC_SUPABASE_ANON_KEY') ?? readEnv('SUPABASE_ANON_KEY') ?? '';
|
|
46
|
+
const supabaseUrl = resolveConfiguredValue(
|
|
47
|
+
configuredSupabaseUrl,
|
|
48
|
+
undefined,
|
|
49
|
+
shouldUseGeneratedLocalSupabaseFallback ? generatedLocalSupabaseUrl : '',
|
|
50
|
+
);
|
|
51
|
+
const supabaseAnonKey = resolveConfiguredValue(
|
|
52
|
+
configuredSupabaseAnonKey,
|
|
53
|
+
undefined,
|
|
54
|
+
shouldUseGeneratedLocalSupabaseFallback ? generatedLocalSupabaseAnonKey : '',
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
export const authAdapter: AuthAdapter =
|
|
58
|
+
supabaseUrl.length > 0 && supabaseAnonKey.length > 0
|
|
59
|
+
? createSupabaseAuthAdapter({
|
|
60
|
+
url: supabaseUrl,
|
|
61
|
+
anonKey: supabaseAnonKey,
|
|
62
|
+
storage: authSessionStorage,
|
|
63
|
+
storageKey: AUTH_SESSION_STORAGE_KEY,
|
|
64
|
+
})
|
|
65
|
+
: createMissingSupabaseAuthAdapter();
|
|
66
|
+
|
|
67
|
+
function createMissingSupabaseAuthAdapter(): AuthAdapter {
|
|
68
|
+
const createError = <TData>(): AuthResult<TData> => ({
|
|
69
|
+
ok: false,
|
|
70
|
+
error: {
|
|
71
|
+
code: 'missing-supabase-auth-env',
|
|
72
|
+
message:
|
|
73
|
+
'Supabase Auth environment is missing. Set EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_ANON_KEY, or run the generated Supabase local env bootstrap before starting the app.',
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
capabilities: {
|
|
79
|
+
signInIdentifiers: ['email'],
|
|
80
|
+
supportsSignUp: true,
|
|
81
|
+
supportsPasswordReset: false,
|
|
82
|
+
supportsOtp: false,
|
|
83
|
+
supportsSessionRefresh: false,
|
|
84
|
+
},
|
|
85
|
+
signIn: () => Promise.resolve(createError<AuthSession>()),
|
|
86
|
+
signUp: () => Promise.resolve(createError<AuthSession | AuthUser>()),
|
|
87
|
+
signOut: () => Promise.resolve(createError()),
|
|
88
|
+
getSession: () => Promise.resolve(createError<AuthSession | null>()),
|
|
89
|
+
refreshSession: () => Promise.resolve(createError<AuthSession | null>()),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../../../src/host/layout/templates/auth/adapter.ts"],"names":[],"mappings":"AAIA,MAAM,+BAA+B,GACnC,8KAA8K,CAAC;AAEjL,MAAM,UAAU,gBAAgB,CAAC,UAAsC,EAAE;IACvE,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC;IAExD,OAAO;;;;;qCAK4B,gBAAgB;;KAEhD,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFnC,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function getAuthScreenTsx(args: {
|
|
2
|
+
initialMode: 'signIn' | 'signUp';
|
|
3
|
+
screenName: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
signInRoute: string;
|
|
6
|
+
signUpRoute: string;
|
|
7
|
+
signInIdentifiers: string[];
|
|
8
|
+
signUpRequiredFields: string[];
|
|
9
|
+
signUpOptionalFields: string[];
|
|
10
|
+
signUpPolicy: 'autoSignIn' | 'requireVerification';
|
|
11
|
+
}): string;
|
|
12
|
+
//# sourceMappingURL=screen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../../../../../src/host/layout/templates/auth/screen.ts"],"names":[],"mappings":"AAWA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,WAAW,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,YAAY,EAAE,YAAY,GAAG,qBAAqB,CAAC;CACpD,UA0oBA"}
|