anhedral 0.13.0 → 0.16.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 +23 -229
- package/assets/patches/audit-deps.mjs +12 -2
- package/assets/stack/ai-schema.ts.txt +5 -0
- package/assets/stack/ai.ts.txt +30 -0
- package/assets/stack/api-index.ts.txt +15 -0
- package/assets/stack/auth-features.ts.txt +4 -0
- package/assets/stack/auth-journal.json.txt +13 -0
- package/assets/stack/auth-migration.sql.txt +53 -0
- package/assets/stack/auth-routes.ts.txt +11 -0
- package/assets/stack/auth-schema.ts.txt +64 -0
- package/assets/stack/auth-snapshot.json.txt +346 -0
- package/assets/stack/auth.ts.txt +32 -0
- package/assets/stack/billing-mode.ts.txt +8 -0
- package/assets/stack/billing-schema.ts.txt +11 -0
- package/assets/stack/desktop.rs.txt +21 -0
- package/assets/stack/entitlement-guard.ts.txt +32 -0
- package/assets/stack/entitlements.ts.txt +8 -0
- package/assets/stack/events-schema.ts.txt +12 -0
- package/assets/stack/events.ts.txt +59 -0
- package/assets/stack/mobile-auth.ts.txt +25 -0
- package/assets/stack/mobile-billing.tsx.txt +63 -0
- package/assets/stack/mobile-session.tsx.txt +83 -0
- package/assets/stack/native-button.tsx.txt +108 -0
- package/assets/stack/native-global.css.txt +4 -0
- package/assets/stack/native-lib-utils.ts.txt +5 -0
- package/assets/stack/native-metro.config.js.txt +6 -0
- package/assets/stack/native-nativewind-env.d.ts.txt +1 -0
- package/assets/stack/native-tailwind.config.js.txt +73 -0
- package/assets/stack/native-text.tsx.txt +89 -0
- package/assets/stack/purchases.ts.txt +65 -0
- package/assets/stack/revenuecat.ts.txt +88 -0
- package/assets/stack/rtc-schema.ts.txt +10 -0
- package/assets/stack/rtc.ts.txt +122 -0
- package/assets/stack/security.ts.txt +31 -0
- package/assets/stack/storage.ts.txt +36 -0
- package/assets/stack/stripe.ts.txt +126 -0
- package/assets/stack/web-sign-in.tsx.txt +51 -0
- package/assets/ui/LICENSE.react-native-reusables +21 -0
- package/assets/ui/LICENSE.shadcn +21 -0
- package/assets/ui/UPSTREAM.json +39 -0
- package/assets/ui/catalog.json +891 -0
- package/assets/ui/extensions/registry.json +6 -0
- package/assets/ui/native/_controls.tsx +521 -0
- package/assets/ui/native/_core.tsx +118 -0
- package/assets/ui/native/_data.tsx +200 -0
- package/assets/ui/native/_display.tsx +453 -0
- package/assets/ui/native/_feedback.tsx +242 -0
- package/assets/ui/native/_legacy-dialog.tsx +38 -0
- package/assets/ui/native/_motion.tsx +520 -0
- package/assets/ui/native/_overlay.tsx +402 -0
- package/assets/ui/native/_selection.tsx +366 -0
- package/assets/ui/native/accordion.tsx +1 -0
- package/assets/ui/native/alert-dialog.tsx +11 -0
- package/assets/ui/native/alert.tsx +1 -0
- package/assets/ui/native/aspect-ratio.tsx +1 -0
- package/assets/ui/native/attachment.tsx +8 -0
- package/assets/ui/native/avatar.tsx +8 -0
- package/assets/ui/native/badge.tsx +1 -0
- package/assets/ui/native/breadcrumb.tsx +9 -0
- package/assets/ui/native/bubble.tsx +1 -0
- package/assets/ui/native/button-group.tsx +1 -0
- package/assets/ui/native/button.tsx +86 -0
- package/assets/ui/native/calendar.tsx +170 -0
- package/assets/ui/native/card.tsx +44 -0
- package/assets/ui/native/carousel.tsx +1 -0
- package/assets/ui/native/chart.tsx +193 -0
- package/assets/ui/native/checkbox.tsx +1 -0
- package/assets/ui/native/code-block.tsx +137 -0
- package/assets/ui/native/collapsible.tsx +1 -0
- package/assets/ui/native/combobox.tsx +1 -0
- package/assets/ui/native/command.tsx +11 -0
- package/assets/ui/native/context-menu.tsx +16 -0
- package/assets/ui/native/data-table.tsx +1 -0
- package/assets/ui/native/date-picker.tsx +43 -0
- package/assets/ui/native/dialog.tsx +15 -0
- package/assets/ui/native/direction.tsx +1 -0
- package/assets/ui/native/drawer.tsx +10 -0
- package/assets/ui/native/dropdown-menu.tsx +16 -0
- package/assets/ui/native/empty.tsx +8 -0
- package/assets/ui/native/field.tsx +13 -0
- package/assets/ui/native/hover-card.tsx +1 -0
- package/assets/ui/native/input-group.tsx +8 -0
- package/assets/ui/native/input-otp.tsx +1 -0
- package/assets/ui/native/input.tsx +28 -0
- package/assets/ui/native/item.tsx +12 -0
- package/assets/ui/native/kbd.tsx +1 -0
- package/assets/ui/native/label.tsx +4 -0
- package/assets/ui/native/layout.tsx +26 -0
- package/assets/ui/native/marker.tsx +1 -0
- package/assets/ui/native/menubar.tsx +17 -0
- package/assets/ui/native/message-scroller.tsx +6 -0
- package/assets/ui/native/message.tsx +10 -0
- package/assets/ui/native/native-select.tsx +1 -0
- package/assets/ui/native/navigation-menu.tsx +10 -0
- package/assets/ui/native/pagination.tsx +9 -0
- package/assets/ui/native/popover.tsx +1 -0
- package/assets/ui/native/progress.tsx +1 -0
- package/assets/ui/native/questionnaire.tsx +130 -0
- package/assets/ui/native/radio-group.tsx +1 -0
- package/assets/ui/native/registry.json +1103 -0
- package/assets/ui/native/resizable.tsx +1 -0
- package/assets/ui/native/scroll-area.tsx +1 -0
- package/assets/ui/native/select.tsx +11 -0
- package/assets/ui/native/separator.tsx +1 -0
- package/assets/ui/native/sheet.tsx +10 -0
- package/assets/ui/native/sidebar.tsx +22 -0
- package/assets/ui/native/skeleton.tsx +1 -0
- package/assets/ui/native/slider.tsx +1 -0
- package/assets/ui/native/spinner.tsx +1 -0
- package/assets/ui/native/switch.tsx +1 -0
- package/assets/ui/native/table.tsx +10 -0
- package/assets/ui/native/tabs.tsx +1 -0
- package/assets/ui/native/text.tsx +20 -0
- package/assets/ui/native/textarea.tsx +1 -0
- package/assets/ui/native/theme-switcher.tsx +22 -0
- package/assets/ui/native/toast.tsx +11 -0
- package/assets/ui/native/toggle-group.tsx +1 -0
- package/assets/ui/native/toggle.tsx +1 -0
- package/assets/ui/native/tooltip.tsx +1 -0
- package/assets/ui/native/trace.tsx +20 -0
- package/assets/ui/native/typography.tsx +15 -0
- package/assets/ui/theme-storage.ts +25 -0
- package/assets/ui/theme.tsx +66 -0
- package/assets/ui/web/button.tsx +59 -0
- package/assets/ui/web/input.tsx +21 -0
- package/assets/ui/web/label.tsx +19 -0
- package/dist/bin.js +7 -12
- package/dist/capabilities.d.ts +4 -33
- package/dist/capabilities.js +2 -84
- package/dist/capability-catalog.d.ts +83 -0
- package/dist/capability-catalog.js +121 -0
- package/dist/capability-command.d.ts +3 -0
- package/dist/capability-command.js +188 -0
- package/dist/capability-editor.d.ts +17 -0
- package/dist/capability-editor.js +97 -0
- package/dist/capability-recipes.d.ts +4 -0
- package/dist/capability-recipes.js +520 -0
- package/dist/capability-references.d.ts +4 -0
- package/dist/capability-references.js +7 -0
- package/dist/cli-commands.d.ts +1 -2
- package/dist/cli-commands.js +10 -104
- package/dist/cli-output.d.ts +1 -2
- package/dist/cli-output.js +6 -251
- package/dist/command-schema.js +40 -374
- package/dist/dependencies.d.ts +34 -62
- package/dist/dependencies.js +112 -199
- package/dist/index.d.ts +1 -45
- package/dist/index.js +1 -30
- package/dist/platforms/mobile.js +29 -139
- package/dist/platforms/web.d.ts +3 -0
- package/dist/platforms/web.js +251 -0
- package/dist/project-config.d.ts +2 -13
- package/dist/project-config.js +10 -83
- package/dist/registry/context.js +0 -1
- package/dist/registry/options.js +6 -40
- package/dist/registry/resolve.d.ts +3 -4
- package/dist/registry/resolve.js +18 -108
- package/dist/registry/types.d.ts +1 -7
- package/dist/registry/usage.js +3 -9
- package/dist/runtime-policy.d.ts +0 -2
- package/dist/runtime-policy.js +0 -16
- package/dist/scaffold/backend.d.ts +0 -4
- package/dist/scaffold/backend.js +1 -189
- package/dist/scaffold/bootstrap.d.ts +2 -3
- package/dist/scaffold/bootstrap.js +37 -43
- package/dist/scaffold/compose.js +2 -14
- package/dist/scaffold/database.d.ts +1 -1
- package/dist/scaffold/database.js +19 -126
- package/dist/scaffold/documentation.d.ts +0 -1
- package/dist/scaffold/documentation.js +82 -84
- package/dist/scaffold/expo-runtime.d.ts +2 -2
- package/dist/scaffold/expo-runtime.js +9 -101
- package/dist/scaffold/native-ui.d.ts +2 -0
- package/dist/scaffold/native-ui.js +74 -0
- package/dist/scaffold/stack-documentation.d.ts +0 -1
- package/dist/scaffold/stack-documentation.js +3 -49
- package/dist/scaffold/storage.d.ts +2 -0
- package/dist/scaffold/storage.js +21 -0
- package/dist/scaffold/styling.d.ts +1 -1
- package/dist/scaffold/styling.js +20 -28
- package/dist/scaffold/workspace.js +63 -199
- package/dist/stack-registry.d.ts +2 -58
- package/dist/stack-registry.js +22 -446
- package/dist/standard.js +7 -24
- package/dist/ui-catalog.d.ts +26 -0
- package/dist/ui-catalog.js +31 -0
- package/dist/ui-command.d.ts +3 -0
- package/dist/ui-command.js +219 -0
- package/dist/ui-project.d.ts +22 -0
- package/dist/ui-project.js +110 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/anhedral-stack.md +4 -119
- package/docs/capabilities.md +110 -0
- package/docs/native-ui.md +102 -0
- package/docs/software-factory.md +16 -577
- package/docs/stack-standard.md +11 -307
- package/docs/ui.md +33 -0
- package/docs/verification.md +511 -0
- package/package.json +26 -27
- package/dist/access.d.ts +0 -10
- package/dist/access.js +0 -93
- package/dist/auth-schema-snapshot.d.ts +0 -346
- package/dist/auth-schema-snapshot.js +0 -347
- package/dist/auth-schema.d.ts +0 -1
- package/dist/auth-schema.js +0 -57
- package/dist/capability-contract.d.ts +0 -47
- package/dist/capability-contract.js +0 -168
- package/dist/catalog-model.d.ts +0 -24
- package/dist/catalog-model.js +0 -1
- package/dist/catalog-registration.d.ts +0 -16
- package/dist/catalog-registration.js +0 -22
- package/dist/catalog-snapshot.d.ts +0 -5
- package/dist/catalog-snapshot.js +0 -97
- package/dist/cli-delivery.d.ts +0 -3
- package/dist/cli-delivery.js +0 -172
- package/dist/cloudflare.d.ts +0 -25
- package/dist/cloudflare.js +0 -226
- package/dist/delivery-evidence.d.ts +0 -62
- package/dist/delivery-evidence.js +0 -186
- package/dist/delivery.d.ts +0 -88
- package/dist/delivery.js +0 -570
- package/dist/inspector-model.d.ts +0 -123
- package/dist/inspector-model.js +0 -1
- package/dist/integration-service-readers.d.ts +0 -13
- package/dist/integration-service-readers.js +0 -173
- package/dist/lifecycle-model.d.ts +0 -15
- package/dist/lifecycle-model.js +0 -20
- package/dist/lifecycle.d.ts +0 -11
- package/dist/lifecycle.js +0 -91
- package/dist/management.d.ts +0 -3
- package/dist/management.js +0 -47
- package/dist/mobile-delivery.d.ts +0 -77
- package/dist/mobile-delivery.js +0 -366
- package/dist/neon-service-data.d.ts +0 -8
- package/dist/neon-service-data.js +0 -117
- package/dist/platforms/desktop.d.ts +0 -2
- package/dist/platforms/desktop.js +0 -415
- package/dist/platforms/extension.d.ts +0 -2
- package/dist/platforms/extension.js +0 -328
- package/dist/project-catalog.d.ts +0 -41
- package/dist/project-catalog.js +0 -288
- package/dist/project-inspector.d.ts +0 -4
- package/dist/project-inspector.js +0 -702
- package/dist/project-lifecycle.d.ts +0 -25
- package/dist/project-lifecycle.js +0 -57
- package/dist/project-state.d.ts +0 -49
- package/dist/project-state.js +0 -563
- package/dist/provider-auth.d.ts +0 -41
- package/dist/provider-auth.js +0 -215
- package/dist/provider-readiness.d.ts +0 -30
- package/dist/provider-readiness.js +0 -104
- package/dist/providers/adapters.d.ts +0 -17
- package/dist/providers/adapters.js +0 -278
- package/dist/providers/api.d.ts +0 -29
- package/dist/providers/api.js +0 -253
- package/dist/providers/config.d.ts +0 -15
- package/dist/providers/config.js +0 -182
- package/dist/providers/definitions.d.ts +0 -318
- package/dist/providers/definitions.js +0 -127
- package/dist/providers/provision.d.ts +0 -24
- package/dist/providers/provision.js +0 -76
- package/dist/providers/receipts.d.ts +0 -20
- package/dist/providers/receipts.js +0 -66
- package/dist/providers/recovery-verification.d.ts +0 -7
- package/dist/providers/recovery-verification.js +0 -112
- package/dist/providers/recovery.d.ts +0 -30
- package/dist/providers/recovery.js +0 -34
- package/dist/providers/runtime.d.ts +0 -10
- package/dist/providers/runtime.js +0 -265
- package/dist/providers/schema.d.ts +0 -28
- package/dist/providers/schema.js +0 -49
- package/dist/providers/state.d.ts +0 -55
- package/dist/providers/state.js +0 -289
- package/dist/provision.d.ts +0 -55
- package/dist/provision.js +0 -284
- package/dist/r2-service-data.d.ts +0 -2
- package/dist/r2-service-data.js +0 -136
- package/dist/readiness.d.ts +0 -23
- package/dist/readiness.js +0 -122
- package/dist/registry/add.d.ts +0 -24
- package/dist/registry/add.js +0 -270
- package/dist/registry/bootstrap.d.ts +0 -2
- package/dist/registry/bootstrap.js +0 -14
- package/dist/registry/commands.d.ts +0 -3
- package/dist/registry/commands.js +0 -85
- package/dist/registry/presets.d.ts +0 -4
- package/dist/registry/presets.js +0 -41
- package/dist/registry/preview.d.ts +0 -11
- package/dist/registry/preview.js +0 -91
- package/dist/registry/receipt.d.ts +0 -3
- package/dist/registry/receipt.js +0 -68
- package/dist/repository.d.ts +0 -24
- package/dist/repository.js +0 -96
- package/dist/scaffold/auth.d.ts +0 -3
- package/dist/scaffold/auth.js +0 -151
- package/dist/scaffold/billing-config.d.ts +0 -1
- package/dist/scaffold/billing-config.js +0 -73
- package/dist/scaffold/billing-contracts.d.ts +0 -2
- package/dist/scaffold/billing-contracts.js +0 -48
- package/dist/scaffold/billing-providers.d.ts +0 -1
- package/dist/scaffold/billing-providers.js +0 -249
- package/dist/scaffold/billing-schema.d.ts +0 -1
- package/dist/scaffold/billing-schema.js +0 -34
- package/dist/scaffold/billing-security.d.ts +0 -1
- package/dist/scaffold/billing-security.js +0 -46
- package/dist/scaffold/billing-server.d.ts +0 -1
- package/dist/scaffold/billing-server.js +0 -139
- package/dist/scaffold/billing-store.d.ts +0 -1
- package/dist/scaffold/billing-store.js +0 -72
- package/dist/scaffold/billing.d.ts +0 -2
- package/dist/scaffold/billing.js +0 -216
- package/dist/scaffold/cloudflare-services.d.ts +0 -8
- package/dist/scaffold/cloudflare-services.js +0 -198
- package/dist/scaffold/expo-auth.d.ts +0 -3
- package/dist/scaffold/expo-auth.js +0 -192
- package/dist/scaffold/expo-billing.d.ts +0 -3
- package/dist/scaffold/expo-billing.js +0 -292
- package/dist/scaffold/integrations.d.ts +0 -4
- package/dist/scaffold/integrations.js +0 -12
- package/dist/scaffold/lint.d.ts +0 -4
- package/dist/scaffold/lint.js +0 -56
- package/dist/scaffold/neon-realtime.d.ts +0 -2
- package/dist/scaffold/neon-realtime.js +0 -97
- package/dist/scaffold/services.d.ts +0 -5
- package/dist/scaffold/services.js +0 -108
- package/dist/scaffold/stream.d.ts +0 -2
- package/dist/scaffold/stream.js +0 -114
- package/dist/scaffold/void.d.ts +0 -4
- package/dist/scaffold/void.js +0 -264
- package/dist/scaffold/web.d.ts +0 -2
- package/dist/scaffold/web.js +0 -130
- package/dist/service-deletion.d.ts +0 -29
- package/dist/service-deletion.js +0 -195
- package/dist/service-descriptor.d.ts +0 -10
- package/dist/service-descriptor.js +0 -78
- package/dist/service-model.d.ts +0 -49
- package/dist/service-model.js +0 -8
- package/dist/service-operations.d.ts +0 -29
- package/dist/service-operations.js +0 -78
- package/dist/service-readers.d.ts +0 -8
- package/dist/service-readers.js +0 -247
- package/dist/services-command.d.ts +0 -39
- package/dist/services-command.js +0 -102
- package/dist/ship.d.ts +0 -348
- package/dist/ship.js +0 -239
- package/dist/vercel-project.d.ts +0 -101
- package/dist/vercel-project.js +0 -305
- package/dist/vercel.d.ts +0 -67
- package/dist/vercel.js +0 -581
- package/dist/vinext.d.ts +0 -2
- package/dist/vinext.js +0 -86
- package/dist/void-execution.d.ts +0 -10
- package/dist/void-execution.js +0 -94
- package/dist/void-migrations.d.ts +0 -6
- package/dist/void-migrations.js +0 -110
- package/dist/void-state.d.ts +0 -16
- package/dist/void-state.js +0 -65
- package/dist/void.d.ts +0 -3
- package/dist/void.js +0 -5
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { STACK_DEPENDENCIES } from '../dependencies.js';
|
|
2
|
-
import { rmSync, readFileSync } from 'node:fs';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { patchPackage, put, sharedPackage } from './files.js';
|
|
5
|
-
import { writeEnvironmentFile } from './environment.js';
|
|
6
|
-
/** Server-only packages are linked to their owner, never to client manifests. */
|
|
7
|
-
function serverPackage(context, name, source, guide, secrets = []) {
|
|
8
|
-
const { root, runtimeApp } = context;
|
|
9
|
-
sharedPackage(root, name, '', {});
|
|
10
|
-
rmSync(path.join(root, `packages/${name}/src/index.ts`));
|
|
11
|
-
patchPackage(root, `packages/${name}/package.json`, {
|
|
12
|
-
exports: { './server': './src/server.ts' },
|
|
13
|
-
});
|
|
14
|
-
put(root, `packages/${name}/src/server.ts`, source);
|
|
15
|
-
put(root, `packages/${name}/README.md`, guide);
|
|
16
|
-
patchPackage(root, `apps/${runtimeApp}/package.json`, {
|
|
17
|
-
dependencies: { [`@workspace/${name}`]: 'workspace:*' },
|
|
18
|
-
});
|
|
19
|
-
if (['video', 'realtimekit'].includes(name))
|
|
20
|
-
patchPackage(root, `packages/${name}/package.json`, {
|
|
21
|
-
dependencies: { '@workspace/cloudflare-api': 'workspace:*', zod: STACK_DEPENDENCIES.zod },
|
|
22
|
-
});
|
|
23
|
-
if (secrets.length) {
|
|
24
|
-
writeEnvironmentFile(root, `apps/${runtimeApp}/.dev.vars.example`, Object.fromEntries(secrets.map((key) => [key, ''])));
|
|
25
|
-
put(root, `apps/${runtimeApp}/src/${name}-secrets.d.ts`, `interface Env { ${secrets.map((key) => `${key}: string;`).join(' ')} }\n`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export function scaffoldAnalyticsEngine(context) {
|
|
29
|
-
serverPackage(context, 'analytics-engine', `export interface AnalyticsBinding {
|
|
30
|
-
writeDataPoint(point: { indexes: string[]; blobs: string[]; doubles: number[] }): void;
|
|
31
|
-
}
|
|
32
|
-
// Use a stable, non-sensitive tenant key. Never log credentials or raw user content.
|
|
33
|
-
export function recordEvent(binding: AnalyticsBinding, tenantKey: string, event: string, value = 1): void {
|
|
34
|
-
if (!tenantKey || !event || !Number.isFinite(value)) throw new Error('Invalid analytics event.');
|
|
35
|
-
binding.writeDataPoint({ indexes: [tenantKey], blobs: [event], doubles: [value] });
|
|
36
|
-
}
|
|
37
|
-
`, `# Workers Analytics Engine
|
|
38
|
-
|
|
39
|
-
In Hono product routes, use c.get('services').analytics(tenant, event, value), or import recordEvent from @workspace/analytics-engine/server and pass env.EVENTS, an authorized non-sensitive tenant key, a server-controlled event name and a numeric value. Define consent, retention and event semantics before recording production events. The helper does not create a public ingestion route. writeDataPoint is non-blocking; analytics is not a billing ledger or transactional quota authority. Verify dataset receipt and sampled SQL query semantics with the selected account. Dataset binding is configured on deployment; account activation and analytics read credentials remain explicit.
|
|
40
|
-
|
|
41
|
-
https://developers.cloudflare.com/analytics/analytics-engine/get-started/
|
|
42
|
-
`);
|
|
43
|
-
}
|
|
44
|
-
export function scaffoldImages(context) {
|
|
45
|
-
serverPackage(context, 'images', `export interface ImagesBinding {
|
|
46
|
-
input(stream: ReadableStream<Uint8Array>): {
|
|
47
|
-
transform(options: { width: number; fit: 'scale-down' }): {
|
|
48
|
-
output(options: { format: 'image/webp' }): Promise<{ response(): Response }>;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
// Pass bytes from an already authorized R2 object, not an arbitrary caller URL.
|
|
53
|
-
export async function resizeImage(images: ImagesBinding, body: ReadableStream<Uint8Array>, width: number): Promise<Response> {
|
|
54
|
-
if (!Number.isInteger(width) || width < 1 || width > 2048) throw new Error('Invalid image width.');
|
|
55
|
-
const result = await images.input(body).transform({ width, fit: 'scale-down' }).output({ format: 'image/webp' });
|
|
56
|
-
const response = result.response();
|
|
57
|
-
response.headers.set('cache-control', 'private, no-store');
|
|
58
|
-
return response;
|
|
59
|
-
}
|
|
60
|
-
`, `# Cloudflare Images
|
|
61
|
-
|
|
62
|
-
In Hono product routes, use c.get('services').images(body, width) after authorizing source access, or import resizeImage from @workspace/images/server with env.IMAGES and an R2 object's body. The binding transforms raw bytes; it is not an Images hosted-upload service or an R2 replacement. Public image caching requires a separate reviewed visibility/cache policy; private responses are no-store. Enforce upload size/type, allowed dimensions and usage limits in product routes. No public transform/upload endpoint is generated. Activate the selected account's Images entitlement and verify actual transforms before claiming acceptance.
|
|
63
|
-
|
|
64
|
-
https://developers.cloudflare.com/images/optimization/binding/
|
|
65
|
-
`);
|
|
66
|
-
}
|
|
67
|
-
// Both services use fixed provider origins and redact provider responses in errors.
|
|
68
|
-
export function scaffoldCloudflareTransport({ root }) {
|
|
69
|
-
sharedPackage(root, 'cloudflare-api', '', { zod: STACK_DEPENDENCIES.zod });
|
|
70
|
-
rmSync(path.join(root, 'packages/cloudflare-api/src/index.ts'));
|
|
71
|
-
patchPackage(root, 'packages/cloudflare-api/package.json', {
|
|
72
|
-
exports: { './server': './src/server.ts' },
|
|
73
|
-
});
|
|
74
|
-
put(root, 'packages/cloudflare-api/src/server.ts', `import { z } from 'zod';
|
|
75
|
-
const account = z.string().regex(/^[a-f0-9]{32}$/i);
|
|
76
|
-
const payload = z.record(z.string(), z.unknown());
|
|
77
|
-
const envelope = z.object({ success: z.literal(true), result: payload.optional(), data: payload.optional() });
|
|
78
|
-
function readResult(value: unknown): Record<string, unknown> {
|
|
79
|
-
const parsed = envelope.safeParse(value);
|
|
80
|
-
if (!parsed.success) throw new Error('Invalid Cloudflare service response.');
|
|
81
|
-
const result = parsed.data.result ?? parsed.data.data;
|
|
82
|
-
if (!result) throw new Error('Missing Cloudflare service response.');
|
|
83
|
-
return result;
|
|
84
|
-
}
|
|
85
|
-
export function cloudflareClient(accountId: string, apiToken: string, service: string) {
|
|
86
|
-
account.parse(accountId);
|
|
87
|
-
z.string().trim().min(1).parse(apiToken);
|
|
88
|
-
const base = 'https://api.cloudflare.com/client/v4/accounts/' + accountId + '/' + service;
|
|
89
|
-
return async (route: string, body: unknown): Promise<Record<string, unknown>> => {
|
|
90
|
-
const response = await fetch(base + route, { method: 'POST', redirect: 'error',
|
|
91
|
-
headers: { authorization: 'Bearer ' + apiToken, 'content-type': 'application/json' },
|
|
92
|
-
body: JSON.stringify(body), signal: AbortSignal.timeout(15000) });
|
|
93
|
-
if (!response.ok) throw new Error('Cloudflare service request failed (' + response.status + ').');
|
|
94
|
-
const value = await response.json().catch(() => { throw new Error('Invalid Cloudflare JSON response.'); });
|
|
95
|
-
return readResult(value);
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
`);
|
|
99
|
-
}
|
|
100
|
-
const cloudflareRequest = "import { cloudflareClient } from '@workspace/cloudflare-api/server';\nimport { z } from 'zod';\n";
|
|
101
|
-
export function scaffoldRealtimeKit(context) {
|
|
102
|
-
serverPackage(context, 'realtimekit', cloudflareRequest +
|
|
103
|
-
`
|
|
104
|
-
export function createRealtimeKit(options: { accountId: string; appId: string; apiToken: string }) {
|
|
105
|
-
z.string().regex(/^[a-zA-Z0-9_-]{1,128}$/).parse(options.appId);
|
|
106
|
-
const request = cloudflareClient(options.accountId, options.apiToken, 'realtime/kit/' + options.appId);
|
|
107
|
-
return {
|
|
108
|
-
// Authorize meeting creation and persist its ID/owner. Reconcile uncertain creates before retrying.
|
|
109
|
-
async createMeeting(title: string): Promise<{ id: string }> {
|
|
110
|
-
z.string().trim().min(1).max(256).parse(title);
|
|
111
|
-
const result = await request('/meetings', { title });
|
|
112
|
-
return z.object({ id: z.string().min(1) }).parse(result);
|
|
113
|
-
},
|
|
114
|
-
// Derive subject and preset on the server after checking membership; never trust a requested role.
|
|
115
|
-
async addParticipant(meetingId: string, subject: string, preset: string): Promise<{ id: string; token: string }> {
|
|
116
|
-
z.uuid().parse(meetingId);
|
|
117
|
-
z.string().min(1).parse(subject);
|
|
118
|
-
z.string().min(1).parse(preset);
|
|
119
|
-
const result = await request('/meetings/' + meetingId + '/participants', { custom_participant_id: subject, preset_name: preset });
|
|
120
|
-
return z.object({ id: z.string().min(1), token: z.string().min(1) }).parse(result);
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
`, `# Cloudflare RealtimeKit
|
|
125
|
-
|
|
126
|
-
In Hono product routes, c.get('services').realtimekit() creates the server client lazily. Alternatively import createRealtimeKit from @workspace/realtimekit/server. Configure REALTIMEKIT_ACCOUNT_ID, REALTIMEKIT_APP_ID and server-only REALTIMEKIT_API_TOKEN (scoped Realtime permission). Activate/select the app and configure participant presets manually. After authenticating and authorizing membership, derive the participant subject/preset server-side, call addParticipant, and return only that participant's token with Cache-Control: no-store. Store meeting IDs with their tenant owner; reconcile uncertain creates before retrying. No public meeting/token endpoint is generated.
|
|
127
|
-
|
|
128
|
-
Install the platform-supported RealtimeKit client SDK and implement media UI separately. Media travels between clients and Cloudflare RealtimeKit, not through Hono or D1. Verify camera/microphone permissions, tenant isolation, token revocation/expiry, reconnect and track teardown on actual target devices. RealtimeKit conferencing is distinct from Durable Object messaging (--realtime) and Stream one-to-many video (--stream / --video). Source helpers do not activate the provider or establish working calls.
|
|
129
|
-
|
|
130
|
-
https://developers.cloudflare.com/realtime/realtimekit/quickstart/
|
|
131
|
-
`, ['REALTIMEKIT_ACCOUNT_ID', 'REALTIMEKIT_APP_ID', 'REALTIMEKIT_API_TOKEN']);
|
|
132
|
-
}
|
|
133
|
-
export function scaffoldVideo(context) {
|
|
134
|
-
serverPackage(context, 'video', cloudflareRequest +
|
|
135
|
-
`
|
|
136
|
-
export function createVideo(options: { accountId: string; apiToken: string }) {
|
|
137
|
-
const request = cloudflareClient(options.accountId, options.apiToken, 'stream');
|
|
138
|
-
return {
|
|
139
|
-
// Authorize uploads and enforce tenant quotas before reserving Stream capacity.
|
|
140
|
-
async createUpload(maxDurationSeconds: number): Promise<{ uid: string; uploadURL: string }> {
|
|
141
|
-
z.number().int().min(1).max(3600).parse(maxDurationSeconds);
|
|
142
|
-
const result = await request('/direct_upload', { maxDurationSeconds, requireSignedURLs: true,
|
|
143
|
-
expiry: new Date(Date.now() + 15 * 60 * 1000).toISOString() });
|
|
144
|
-
const value = z.object({ uid: z.string().min(1), uploadURL: z.url() }).parse(result);
|
|
145
|
-
const url = new URL(value.uploadURL);
|
|
146
|
-
z.literal('https:').parse(url.protocol);
|
|
147
|
-
z.string().endsWith('.videodelivery.net').parse(url.hostname);
|
|
148
|
-
z.literal('').parse(url.username + url.password);
|
|
149
|
-
return value;
|
|
150
|
-
},
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
`, `# Cloudflare Stream video uploads
|
|
154
|
-
|
|
155
|
-
In Hono product routes, use c.get('services').video() after authorization. Alternatively import createVideo from @workspace/video/server with STREAM_ACCOUNT_ID and STREAM_API_TOKEN (Stream Write). This is on-demand uploaded video, separate from --stream's WHIP/WHEP live input helper. Authenticate/authorize creators, enforce tenant quotas, then issue a one-time direct upload URL; persist uid and ownership and return it only to the authorized creator with no-store. Basic POST uploads are limited to 200 MB; implement TUS separately for larger/unreliable uploads. Processing completion/webhooks, video UI, retention/deletion and private playback token issuance remain product work. Upload completion is not processing readiness. Signed playback is required by this helper; implement and verify short-lived viewer tokens before exposing playback. Do not proxy video bytes through Hono or expose the management token. Stream account activation and stored/delivered video billing are explicit owner setup, not init side effects.
|
|
156
|
-
|
|
157
|
-
https://developers.cloudflare.com/stream/uploading-videos/direct-creator-uploads/
|
|
158
|
-
`, ['STREAM_ACCOUNT_ID', 'STREAM_API_TOKEN']);
|
|
159
|
-
}
|
|
160
|
-
/** Lazy Hono adapters wire selected helpers without exposing generic public routes. */
|
|
161
|
-
export function scaffoldCloudflareServiceContext({ root, has }) {
|
|
162
|
-
const selected = ['analytics-engine', 'images', 'realtimekit', 'video'].filter(has);
|
|
163
|
-
if (!selected.length)
|
|
164
|
-
return;
|
|
165
|
-
const imports = [];
|
|
166
|
-
const adapters = [];
|
|
167
|
-
if (has('analytics-engine')) {
|
|
168
|
-
imports.push("import { recordEvent } from '@workspace/analytics-engine/server';");
|
|
169
|
-
adapters.push('analytics: (tenant: string, event: string, value = 1) => recordEvent(env.EVENTS, tenant, event, value)');
|
|
170
|
-
}
|
|
171
|
-
if (has('images')) {
|
|
172
|
-
imports.push("import { resizeImage } from '@workspace/images/server';");
|
|
173
|
-
adapters.push('images: (body: ReadableStream<Uint8Array>, width: number) => resizeImage(env.IMAGES, body, width)');
|
|
174
|
-
}
|
|
175
|
-
if (has('realtimekit')) {
|
|
176
|
-
imports.push("import { createRealtimeKit } from '@workspace/realtimekit/server';");
|
|
177
|
-
adapters.push('realtimekit: () => createRealtimeKit({ accountId: env.REALTIMEKIT_ACCOUNT_ID, appId: env.REALTIMEKIT_APP_ID, apiToken: env.REALTIMEKIT_API_TOKEN })');
|
|
178
|
-
}
|
|
179
|
-
if (has('video')) {
|
|
180
|
-
imports.push("import { createVideo } from '@workspace/video/server';");
|
|
181
|
-
adapters.push('video: () => createVideo({ accountId: env.STREAM_ACCOUNT_ID, apiToken: env.STREAM_API_TOKEN })');
|
|
182
|
-
}
|
|
183
|
-
put(root, 'apps/api/src/services.ts', imports.join('\n') +
|
|
184
|
-
'\n\n// Call after product authorization and quota checks; no service is activated at startup.\nexport function createServices(env: Env) {\n return {\n ' +
|
|
185
|
-
adapters.join(',\n ') +
|
|
186
|
-
',\n };\n}\n');
|
|
187
|
-
const file = 'apps/api/src/index.ts';
|
|
188
|
-
let source = readFileSync(path.join(root, file), 'utf8');
|
|
189
|
-
if (source.includes("import { createServices } from './services';"))
|
|
190
|
-
return;
|
|
191
|
-
source = "import { createServices } from './services';\n" + source;
|
|
192
|
-
if (source.includes('Variables: {'))
|
|
193
|
-
source = source.replace('Variables: {', 'Variables: { services: ReturnType<typeof createServices>;');
|
|
194
|
-
else
|
|
195
|
-
source = source.replace('Bindings: Env', 'Bindings: Env; Variables: { services: ReturnType<typeof createServices> }');
|
|
196
|
-
source = source.replace('const health = createRoute({', "// Product routes use c.get('services') after authorization.\napp.use('/api/*', async (c, next) => {\n c.set('services', createServices(c.env));\n await next();\n});\nconst health = createRoute({");
|
|
197
|
-
put(root, file, source);
|
|
198
|
-
}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { STACK_DEPENDENCIES } from '../dependencies.js';
|
|
4
|
-
import { jsString } from '../render.js';
|
|
5
|
-
import { json, patchPackage, put, readJson } from './files.js';
|
|
6
|
-
export function expoAuthScheme(root) {
|
|
7
|
-
const config = readJson(root, 'apps/mobile/app.json');
|
|
8
|
-
const scheme = config.expo?.scheme;
|
|
9
|
-
if (typeof scheme !== 'string' || !/^[a-z][a-z0-9+.-]*$/i.test(scheme))
|
|
10
|
-
throw new Error('Expo authentication requires one explicit valid app.json URL scheme.');
|
|
11
|
-
return scheme;
|
|
12
|
-
}
|
|
13
|
-
/** Platform resolution keeps SecureStore and the native plugin out of the browser bundle. */
|
|
14
|
-
export function scaffoldExpoAuth(root, scheme, linkHome = true) {
|
|
15
|
-
const directory = 'apps/mobile';
|
|
16
|
-
patchPackage(root, `${directory}/package.json`, {
|
|
17
|
-
dependencies: {
|
|
18
|
-
'better-auth': STACK_DEPENDENCIES['better-auth'],
|
|
19
|
-
'@better-auth/expo': STACK_DEPENDENCIES['@better-auth/expo'],
|
|
20
|
-
'expo-secure-store': STACK_DEPENDENCIES['expo-secure-store'],
|
|
21
|
-
'expo-network': STACK_DEPENDENCIES['expo-network'],
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
const config = readJson(root, `${directory}/app.json`);
|
|
25
|
-
const expo = config.expo;
|
|
26
|
-
const plugins = expo.plugins ?? [];
|
|
27
|
-
if (!plugins.some((plugin) => (Array.isArray(plugin) ? plugin[0] : plugin) === 'expo-secure-store'))
|
|
28
|
-
expo.plugins = [...plugins, 'expo-secure-store'];
|
|
29
|
-
json(root, `${directory}/app.json`, config);
|
|
30
|
-
put(root, `${directory}/lib/auth-client.ts`, `import { createAuthClient } from 'better-auth/react';
|
|
31
|
-
|
|
32
|
-
let client: ReturnType<typeof createAuthClient> | undefined;
|
|
33
|
-
export function getAuthClient() { return client ??= createAuthClient(); }
|
|
34
|
-
export function authConfigurationError(): string | null { return null; }
|
|
35
|
-
`);
|
|
36
|
-
put(root, `${directory}/lib/auth-client.native.ts`, `import { createAuthClient } from 'better-auth/react';
|
|
37
|
-
import { expoClient } from '@better-auth/expo/client';
|
|
38
|
-
import * as SecureStore from 'expo-secure-store';
|
|
39
|
-
import { nativeApiOrigin } from './api-client';
|
|
40
|
-
|
|
41
|
-
export function authConfigurationError(): string | null {
|
|
42
|
-
try { nativeApiOrigin(); return null; }
|
|
43
|
-
catch (error) { return error instanceof Error ? error.message : 'Invalid product API origin.'; }
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function createNativeClient() {
|
|
47
|
-
return createAuthClient({
|
|
48
|
-
baseURL: nativeApiOrigin(),
|
|
49
|
-
plugins: [expoClient({ scheme: ${jsString(scheme)}, storagePrefix: ${jsString(scheme)}, storage: SecureStore })],
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
let client: ReturnType<typeof createNativeClient> | undefined;
|
|
53
|
-
export function getAuthClient() { return client ??= createNativeClient(); }
|
|
54
|
-
`);
|
|
55
|
-
put(root, `${directory}/lib/session-api.ts`, `import { createApplicationApiClient } from './api-client';
|
|
56
|
-
export const sessionApi = createApplicationApiClient();
|
|
57
|
-
`);
|
|
58
|
-
put(root, `${directory}/lib/session-api.native.ts`, `import { createApplicationApiClient } from './api-client';
|
|
59
|
-
import { getAuthClient } from './auth-client.native';
|
|
60
|
-
|
|
61
|
-
export const sessionApi = createApplicationApiClient({ headers: async () => {
|
|
62
|
-
const cookie = await getAuthClient().getCookie();
|
|
63
|
-
const headers = new Headers();
|
|
64
|
-
if (cookie) headers.set('cookie', cookie);
|
|
65
|
-
return headers;
|
|
66
|
-
} });
|
|
67
|
-
`);
|
|
68
|
-
put(root, `${directory}/components/auth-configuration.tsx`, `import { Text, View } from 'react-native';
|
|
69
|
-
import { authConfigurationError } from '@/lib/auth-client';
|
|
70
|
-
|
|
71
|
-
export function AuthConfiguration({ children }: { children: React.ReactNode }) {
|
|
72
|
-
const error = authConfigurationError();
|
|
73
|
-
if (error) return <View style={{ padding: 24, gap: 12 }}><Text accessibilityRole="header">Configure the product API</Text><Text selectable>{error}</Text></View>;
|
|
74
|
-
return <>{children}</>;
|
|
75
|
-
}
|
|
76
|
-
`);
|
|
77
|
-
put(root, `${directory}/app/sign-in.tsx`, `import { useState } from 'react';
|
|
78
|
-
import { router } from 'expo-router';
|
|
79
|
-
import { ScrollView, Text, TextInput } from 'react-native';
|
|
80
|
-
import { Button } from '@/components/ui/button';
|
|
81
|
-
import { AuthConfiguration } from '@/components/auth-configuration';
|
|
82
|
-
import { getAuthClient } from '@/lib/auth-client';
|
|
83
|
-
import { sessionApi } from '@/lib/session-api';
|
|
84
|
-
|
|
85
|
-
export default function SignInRoute() { return <AuthConfiguration><SignIn /></AuthConfiguration>; }
|
|
86
|
-
|
|
87
|
-
function modeLabel(create: boolean): string { return create ? 'Create account' : 'Sign in'; }
|
|
88
|
-
function submitLabel(pending: boolean, create: boolean): string { return pending ? 'Working…' : modeLabel(create); }
|
|
89
|
-
function switchLabel(create: boolean): string { return create ? 'Use an existing account' : 'Create an account'; }
|
|
90
|
-
function authenticationError(error: unknown): string {
|
|
91
|
-
return error instanceof Error ? error.message : 'Unable to verify the session. Check the connection and try again.';
|
|
92
|
-
}
|
|
93
|
-
async function authenticate(values: { create: boolean; name: string; email: string; password: string }) {
|
|
94
|
-
const auth = getAuthClient();
|
|
95
|
-
const result = values.create ? await auth.signUp.email(values) : await auth.signIn.email(values);
|
|
96
|
-
if (result.error) throw new Error(result.error.message ?? 'Authentication failed.');
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function SignIn() {
|
|
100
|
-
const [create, setCreate] = useState(false);
|
|
101
|
-
const [name, setName] = useState('');
|
|
102
|
-
const [email, setEmail] = useState('');
|
|
103
|
-
const [password, setPassword] = useState('');
|
|
104
|
-
const [pending, setPending] = useState(false);
|
|
105
|
-
const [message, setMessage] = useState('');
|
|
106
|
-
async function submit() {
|
|
107
|
-
setPending(true); setMessage('');
|
|
108
|
-
try {
|
|
109
|
-
await authenticate({ create, name, email, password });
|
|
110
|
-
await sessionApi.session();
|
|
111
|
-
setPassword('');
|
|
112
|
-
router.replace('/account');
|
|
113
|
-
} catch (error) { setMessage(authenticationError(error)); }
|
|
114
|
-
finally { setPending(false); }
|
|
115
|
-
}
|
|
116
|
-
return <ScrollView contentContainerStyle={{ padding: 24, gap: 12 }} keyboardShouldPersistTaps="handled">
|
|
117
|
-
<Text accessibilityRole="header">{modeLabel(create)}</Text>
|
|
118
|
-
{create && <TextInput accessibilityLabel="Name" placeholder="Name" value={name} onChangeText={setName} autoComplete="name" />}
|
|
119
|
-
<TextInput accessibilityLabel="Email" placeholder="Email" value={email} onChangeText={setEmail} keyboardType="email-address" autoCapitalize="none" autoComplete="email" />
|
|
120
|
-
<TextInput accessibilityLabel="Password" placeholder="Password" value={password} onChangeText={setPassword} secureTextEntry autoComplete={create ? 'new-password' : 'current-password'} />
|
|
121
|
-
<Button disabled={pending} onPress={() => void submit()}>{submitLabel(pending, create)}</Button>
|
|
122
|
-
<Text accessibilityLiveRegion="polite">{message}</Text>
|
|
123
|
-
<Button disabled={pending} onPress={() => { setCreate(!create); setMessage(''); }}>{switchLabel(create)}</Button>
|
|
124
|
-
</ScrollView>;
|
|
125
|
-
}
|
|
126
|
-
`);
|
|
127
|
-
put(root, `${directory}/app/account.tsx`, `import { useEffect, useState } from 'react';
|
|
128
|
-
import { Link, Redirect, router } from 'expo-router';
|
|
129
|
-
import { Text, View } from 'react-native';
|
|
130
|
-
import type { Session } from '@workspace/contracts';
|
|
131
|
-
import { Button } from '@/components/ui/button';
|
|
132
|
-
import { AuthConfiguration } from '@/components/auth-configuration';
|
|
133
|
-
import { getAuthClient } from '@/lib/auth-client';
|
|
134
|
-
import { sessionApi } from '@/lib/session-api';
|
|
135
|
-
|
|
136
|
-
export default function AccountRoute() { return <AuthConfiguration><Account /></AuthConfiguration>; }
|
|
137
|
-
|
|
138
|
-
function Account() {
|
|
139
|
-
const { data: session, isPending, refetch } = getAuthClient().useSession();
|
|
140
|
-
const userId = session?.user.id;
|
|
141
|
-
const [verified, setVerified] = useState<Session['user'] | null>(null);
|
|
142
|
-
const [message, setMessage] = useState('');
|
|
143
|
-
const [pending, setPending] = useState(false);
|
|
144
|
-
useEffect(() => {
|
|
145
|
-
let active = true;
|
|
146
|
-
if (userId) void sessionApi.session().then(
|
|
147
|
-
(current) => { if (active) { setVerified(current.user); setMessage(''); } },
|
|
148
|
-
() => { if (active) { setVerified(null); setMessage('The server could not verify this session. Sign in again or retry when connected.'); } },
|
|
149
|
-
);
|
|
150
|
-
return () => { active = false; };
|
|
151
|
-
}, [userId]);
|
|
152
|
-
async function signOut() {
|
|
153
|
-
setVerified(null); setPending(true); setMessage('');
|
|
154
|
-
try {
|
|
155
|
-
const result = await getAuthClient().signOut();
|
|
156
|
-
if (result.error) { setMessage(result.error.message ?? 'Sign out failed.'); return; }
|
|
157
|
-
await refetch(); router.replace('/sign-in');
|
|
158
|
-
} catch { setMessage('Unable to sign out. Check the connection and retry.'); }
|
|
159
|
-
finally { setPending(false); }
|
|
160
|
-
}
|
|
161
|
-
if (isPending) return <View style={{ padding: 24 }}><Text>Restoring session…</Text></View>;
|
|
162
|
-
if (!session) return <Redirect href="/sign-in" />;
|
|
163
|
-
return <AccountContent userId={session.user.id} verified={verified} message={message} pending={pending} signOut={signOut} />;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function accountMessage(userId: string, verified: Session['user'] | null, message: string): string {
|
|
167
|
-
if (verified?.id === userId) return verified.email;
|
|
168
|
-
return message || 'Verifying with the API…';
|
|
169
|
-
}
|
|
170
|
-
function AccountContent({ userId, verified, message, pending, signOut }: {
|
|
171
|
-
userId: string; verified: Session['user'] | null; message: string; pending: boolean; signOut: () => Promise<void>;
|
|
172
|
-
}) {
|
|
173
|
-
return <View style={{ padding: 24, gap: 12 }}>
|
|
174
|
-
<Text accessibilityRole="header">Account</Text>
|
|
175
|
-
<Text>{accountMessage(userId, verified, message)}</Text>
|
|
176
|
-
<Text accessibilityLiveRegion="polite">{message}</Text>
|
|
177
|
-
<Button disabled={pending} onPress={() => void signOut()}>{pending ? 'Signing out…' : 'Sign out'}</Button>
|
|
178
|
-
<Link href="/sign-in">Sign in again</Link>
|
|
179
|
-
<Link href="/">Home</Link>
|
|
180
|
-
</View>;
|
|
181
|
-
}
|
|
182
|
-
`);
|
|
183
|
-
// Additions expose /account and /sign-in without rewriting existing product screens.
|
|
184
|
-
if (!linkHome)
|
|
185
|
-
return;
|
|
186
|
-
const home = `${directory}/app/index.tsx`;
|
|
187
|
-
const source = readFileSync(path.join(root, home), 'utf8');
|
|
188
|
-
if (source.includes('<Link href="/account">'))
|
|
189
|
-
return;
|
|
190
|
-
put(root, home, "import { Link } from 'expo-router';\n" +
|
|
191
|
-
source.replace("<Button onPress={() => void Linking.openURL('https://docs.expo.dev')}>Learn more</Button>", '<Link href="/account">Account and sign in</Link>\n <Button onPress={() => void Linking.openURL(\'https://docs.expo.dev\')}>Learn more</Button>'));
|
|
192
|
-
}
|