anhedral 0.13.0 → 0.15.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 +35 -232
- package/assets/patches/audit-deps.mjs +12 -2
- package/assets/ui/LICENSE.shadcn +21 -0
- package/assets/ui/UPSTREAM.json +33 -0
- package/assets/ui/native/button.tsx +85 -0
- package/assets/ui/native/card.tsx +33 -0
- package/assets/ui/native/dialog.tsx +75 -0
- package/assets/ui/native/input.tsx +27 -0
- package/assets/ui/native/label.tsx +4 -0
- package/assets/ui/native/layout.tsx +26 -0
- package/assets/ui/native/text.tsx +20 -0
- package/assets/ui/native/theme-switcher.tsx +22 -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/capabilities.d.ts +5 -5
- package/dist/capabilities.js +3 -21
- package/dist/capability-contract.d.ts +3 -3
- package/dist/capability-contract.js +11 -50
- package/dist/cli-delivery.d.ts +1 -1
- package/dist/cli-delivery.js +5 -65
- package/dist/cli-output.js +3 -3
- package/dist/command-schema.js +35 -86
- package/dist/delivery-evidence.d.ts +1 -1
- package/dist/delivery-evidence.js +7 -36
- package/dist/delivery.d.ts +2 -8
- package/dist/delivery.js +20 -101
- package/dist/dependencies.d.ts +6 -57
- package/dist/dependencies.js +54 -188
- package/dist/index.d.ts +1 -4
- package/dist/index.js +1 -4
- package/dist/inspector-model.d.ts +2 -2
- package/dist/integration-service-readers.d.ts +1 -2
- package/dist/integration-service-readers.js +3 -84
- package/dist/lifecycle-model.d.ts +1 -1
- package/dist/lifecycle-model.js +1 -1
- package/dist/mobile-delivery.d.ts +1 -1
- package/dist/mobile-delivery.js +4 -0
- package/dist/platforms/mobile.js +30 -121
- package/dist/platforms/web.d.ts +3 -0
- package/dist/platforms/web.js +299 -0
- package/dist/project-config.d.ts +1 -1
- package/dist/project-config.js +0 -1
- package/dist/project-inspector.js +5 -36
- package/dist/project-state.d.ts +1 -3
- package/dist/project-state.js +2 -85
- package/dist/provider-auth.js +3 -38
- package/dist/provider-readiness.d.ts +1 -1
- package/dist/provider-readiness.js +5 -24
- package/dist/providers/adapters.js +0 -175
- package/dist/providers/api.d.ts +1 -1
- package/dist/providers/api.js +3 -3
- package/dist/providers/config.js +2 -48
- package/dist/providers/definitions.d.ts +1 -204
- package/dist/providers/definitions.js +0 -85
- package/dist/providers/provision.d.ts +1 -1
- package/dist/providers/receipts.js +1 -11
- package/dist/providers/recovery-verification.js +1 -61
- package/dist/providers/runtime.js +4 -35
- package/dist/providers/state.js +1 -7
- package/dist/provision.d.ts +5 -13
- package/dist/provision.js +4 -80
- package/dist/readiness.d.ts +1 -1
- package/dist/readiness.js +3 -8
- package/dist/registry/add.js +10 -70
- package/dist/registry/bootstrap.d.ts +3 -2
- package/dist/registry/bootstrap.js +4 -13
- package/dist/registry/commands.js +8 -10
- package/dist/registry/context.js +0 -1
- package/dist/registry/options.js +8 -38
- package/dist/registry/resolve.d.ts +3 -4
- package/dist/registry/resolve.js +26 -108
- package/dist/registry/types.d.ts +1 -7
- package/dist/registry/usage.js +2 -2
- package/dist/runtime-policy.d.ts +0 -2
- package/dist/runtime-policy.js +0 -16
- package/dist/scaffold/auth.d.ts +1 -2
- package/dist/scaffold/auth.js +55 -130
- package/dist/scaffold/backend.d.ts +0 -4
- package/dist/scaffold/backend.js +1 -186
- package/dist/scaffold/billing-schema.d.ts +1 -1
- package/dist/scaffold/billing-schema.js +4 -4
- package/dist/scaffold/billing.js +11 -19
- 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 +18 -126
- package/dist/scaffold/documentation.d.ts +0 -1
- package/dist/scaffold/documentation.js +22 -86
- package/dist/scaffold/expo-auth.js +33 -22
- package/dist/scaffold/expo-billing.js +17 -52
- package/dist/scaffold/expo-runtime.d.ts +2 -2
- package/dist/scaffold/expo-runtime.js +6 -97
- package/dist/scaffold/integrations.d.ts +1 -3
- package/dist/scaffold/integrations.js +9 -10
- package/dist/scaffold/managed-email.d.ts +3 -0
- package/dist/scaffold/managed-email.js +47 -0
- package/dist/scaffold/native-ui.d.ts +2 -0
- package/dist/scaffold/native-ui.js +69 -0
- package/dist/scaffold/password-reset.d.ts +1 -0
- package/dist/scaffold/password-reset.js +99 -0
- package/dist/scaffold/private-files.d.ts +2 -0
- package/dist/scaffold/private-files.js +78 -0
- package/dist/scaffold/stack-documentation.d.ts +0 -1
- package/dist/scaffold/stack-documentation.js +3 -49
- package/dist/scaffold/styling.d.ts +1 -1
- package/dist/scaffold/styling.js +20 -28
- package/dist/scaffold/web-billing.d.ts +2 -0
- package/dist/scaffold/web-billing.js +48 -0
- package/dist/scaffold/workspace.js +53 -194
- package/dist/service-deletion.js +1 -1
- package/dist/service-descriptor.js +5 -12
- package/dist/service-model.d.ts +1 -1
- package/dist/service-operations.js +2 -32
- package/dist/service-readers.js +1 -32
- package/dist/services-command.d.ts +1 -1
- package/dist/services-command.js +3 -9
- package/dist/ship.d.ts +3 -316
- package/dist/ship.js +10 -142
- package/dist/stack-registry.d.ts +2 -52
- package/dist/stack-registry.js +55 -403
- package/dist/standard.js +7 -14
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/anhedral-stack.md +23 -122
- package/docs/assets/anhedral-stack-light.png +0 -0
- package/docs/assets/anhedral-stack.png +0 -0
- package/docs/software-factory.md +24 -557
- package/docs/stack-standard.md +47 -294
- package/docs/verification.md +320 -0
- package/package.json +20 -22
- 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/registry/presets.d.ts +0 -4
- package/dist/registry/presets.js +0 -41
- package/dist/scaffold/cloudflare-services.d.ts +0 -8
- package/dist/scaffold/cloudflare-services.js +0 -198
- 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/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
package/docs/verification.md
CHANGED
|
@@ -1,7 +1,115 @@
|
|
|
1
|
+
# Next.js web and Expo native architecture — October 23, 2026
|
|
2
|
+
|
|
3
|
+
CLI 0.15 source preparation separates full Next.js App Router web (SSR/RSC through
|
|
4
|
+
Cloudflare OpenNext) from Expo iOS/Android. The UI contracts are DOM shadcn for web
|
|
5
|
+
and the Anhedral-maintained React Native port of shadcn for native, with shared
|
|
6
|
+
semantic tokens and public API contracts. Hono, Drizzle/D1 and private R2 remain
|
|
7
|
+
core; Stripe and RevenueCat remain the only additions.
|
|
8
|
+
|
|
9
|
+
The canonical diagram was regenerated in both themes as self-contained SVG and
|
|
10
|
+
1920×1080 PNG using the existing local Chrome renderer. The same SVG bytes are
|
|
11
|
+
mirrored by the Platform landing. This is documentation/artwork verification;
|
|
12
|
+
it does not establish generated-app, installed-plugin, native-device, provider,
|
|
13
|
+
hosted-image or production acceptance. Record runtime evidence separately.
|
|
14
|
+
|
|
15
|
+
## Next development proxy response framing — October 23, 2026
|
|
16
|
+
|
|
17
|
+
The Platform Linux image proof reproduced a failed `/api/health` response through
|
|
18
|
+
actual Next dev: Node fetch decoded the Hono sidecar's gzip body, but the generated
|
|
19
|
+
proxy retained its compressed `Content-Encoding` and `Content-Length`. The next
|
|
20
|
+
HTTP client attempted to decode the already-decoded response and failed.
|
|
21
|
+
|
|
22
|
+
The development HTTP proxy now removes those stale wire headers before Next
|
|
23
|
+
frames the response. The production service-binding path retains its existing
|
|
24
|
+
response handling. A real loopback HTTP server supplies a gzip response in the
|
|
25
|
+
regression test; all five Next web tests pass. `pnpm build` and `pnpm lint` also
|
|
26
|
+
pass, including typecheck, formatting, source hygiene and release-policy checks.
|
|
27
|
+
This evidence does not establish a deployed Platform runtime; its image and live
|
|
28
|
+
initialization are verified separately in the Platform repository.
|
|
29
|
+
|
|
30
|
+
The full `pnpm release:check` passed: 550 unit tests passed with one existing
|
|
31
|
+
skip, frozen patch installation checks passed, and packed CLI smoke and packlist
|
|
32
|
+
checks passed. Linux Next dev returned `200 {"ok":true}` through `/api/health`
|
|
33
|
+
and `200 null` through `/api/auth/get-session` after applying the generated fix.
|
|
34
|
+
|
|
35
|
+
## CLI 0.15 generated runtime acceptance — October 23, 2026
|
|
36
|
+
|
|
37
|
+
The implementation agent recorded the following local evidence for the unpublished
|
|
38
|
+
0.15 source preview, with Next.js web separate from Expo native:
|
|
39
|
+
|
|
40
|
+
- Complete generated `pnpm check` passed: lint, typechecks, Fallow with zero issues,
|
|
41
|
+
dependency audit, available tests and builds. A manual fixture rsync temporarily
|
|
42
|
+
overwrote its patch policy; after restoring the ordinary-init policy, the full
|
|
43
|
+
check passed. This was a test-harness issue, not an initialization result.
|
|
44
|
+
- The packed tarball completed ordinary initialization, including staged dependency
|
|
45
|
+
resolution, patches and frozen installation; doctor and target checks passed.
|
|
46
|
+
- Both iOS and Android Hermes exports passed, with output retained locally at
|
|
47
|
+
`/tmp/anhedral-next-native-final-export`. This is export evidence, not device,
|
|
48
|
+
screen-reader, store or native interaction acceptance.
|
|
49
|
+
- Production OpenNext running in local workerd passed SSR/RSC, guarded account,
|
|
50
|
+
cookie roundtrip, signup, reload, sign-in/sign-out and rejected native-origin
|
|
51
|
+
checks. Browser acceptance reported zero errors. The final typography-only
|
|
52
|
+
OpenNext rebuild passed: 5474.81 KiB upload, 1130.07 KiB gzip and 44 assets;
|
|
53
|
+
its additional browser/layout rerun was still pending when this entry was written.
|
|
54
|
+
- Root Turbopack development reached first compile/browser readiness in 4825 ms.
|
|
55
|
+
A source edit reached HMR in 790 ms, preserving window state with zero browser
|
|
56
|
+
errors. Webpack development failed reproducibly in
|
|
57
|
+
`WasmHash._updateWithBuffer` with an undefined `length`; production webpack and
|
|
58
|
+
OpenNext builds passed. The supported default development path uses Turbopack.
|
|
59
|
+
|
|
60
|
+
A small warm-workerd comparison used three fresh Chrome contexts before the final
|
|
61
|
+
heading CSS adjustment. Next readiness was 115/90/78 ms, transferred bytes were
|
|
62
|
+
172418/172089/172092 and FCP was 72/40/40 ms. The earlier Expo baseline medians
|
|
63
|
+
were 149 ms readiness, 438928 transferred bytes and 48 ms FCP. These are tiny local
|
|
64
|
+
samples with a warm server, not universal performance claims or live deployment
|
|
65
|
+
measurements. They do not establish a consistent FCP improvement.
|
|
66
|
+
|
|
67
|
+
No npm publication, installed-plugin update, hosted-image activation, production
|
|
68
|
+
deployment, real payment or physical-device acceptance is established by these
|
|
69
|
+
checks. Final serialized CLI/plugin/reference checks follow this documentation
|
|
70
|
+
update and must be recorded separately if they expose further failures.
|
|
71
|
+
|
|
72
|
+
# Focused core verification — October 23, 2026
|
|
73
|
+
|
|
74
|
+
The 0.14.0 source intentionally narrows initialization to Expo + Hono + Drizzle/D1 + private R2, supporting Better Auth and styling, with only Stripe and RevenueCat additions. This supersedes the older catalog scope in the historical evidence below. Existing applications/resources were not migrated or deleted. Compiled 0.13 output was preserved locally before rebuilding; output and credentials remain ignored rather than committed.
|
|
75
|
+
|
|
76
|
+
Validation of this change:
|
|
77
|
+
|
|
78
|
+
- CLI build, typecheck, formatting/hygiene, release policy and static security passed.
|
|
79
|
+
- Complete CLI unit suite after the streamlining pass: 545 passed, one platform-conditional skip, zero failures (546 tests).
|
|
80
|
+
- Codex plugin check: typecheck/build and 61 tests passed; browser smoke 11/11 passed using installed Chrome.
|
|
81
|
+
- Packed CLI installed/executed successfully; packlist allowlist passed (222 files, approximately 543 KB compressed at this validation).
|
|
82
|
+
- OSV audit passed for all 56 unique locked/catalog dependency versions.
|
|
83
|
+
- Generated all four supported selections in isolated tests; offline init, authored-source preservation, addition rollback/conflicts, private secret exclusion and generator provenance covered.
|
|
84
|
+
- Private-file route tests against real Hono passed: anonymous and cross-user rejection, upload/download/delete, origin protection, actual streamed size enforcement and misleading Content-Length.
|
|
85
|
+
- Installed generated both-payment workspace: lint and typecheck across seven packages, Fallow audit with zero issues, dependency audit under existing reviewed local-patch policy, Hono Worker bundle, Expo web export and gateway bundle passed. Generated pnpm test currently has no default product tests; successful execution alone is not test coverage.
|
|
86
|
+
- Real local workerd: exported Expo routes, gateway service binding, isolated local D1 authentication/session/revocation and native scheme/origin handling passed.
|
|
87
|
+
- Actual generated Hono/Better Auth/Drizzle signup/login/session/revocation passed with in-memory SQLite. Generated Stripe/RevenueCat billing reconciliation tests passed with synthetic vendor responses, including idempotency, webhook replay/order, ownership/CSRF, expiry/revocation, provider union and outage/retry recovery.
|
|
88
|
+
|
|
89
|
+
The follow-up streamlining pass removed obsolete alternate-stack adapters and unused bootstrap test fixtures, aligned human help/plugin defaults with the supported stack, and removed a retired dependency's secret-scanner exemption. Regression tests cover actual core catalog paths and payment-only suggestions. CLI build/lint/static security, all unit tests, plugin check (61 tests), packed smoke and package allowlist passed again. The final package remains 222 files, approximately 543 KB compressed. README instructions distinguish the source candidate from a published npm release.
|
|
90
|
+
|
|
91
|
+
Worktree recovery review also recovered a one-line inspector safe-area correction: project details now retain host top padding through the shared CSS variable. Two new browser regressions exercise 24px and 112px insets through project/tab/list navigation. Plugin typecheck/build and all 61 plugin tests passed; browser smoke passed 13/13 using installed Chrome. This simulates the host layout contract and does not claim installed native-host acceptance.
|
|
92
|
+
|
|
93
|
+
The CLI presentation follow-up restores a connected static default-stack diagram in both themes, with only Stripe and RevenueCat marked optional. The README, stack guide, npm documentation and plugin references carry valid image targets. Only the two PNGs are added to the npm package; editable SVG/layout/logo source remains documentation source. CLI build/lint, documentation/plugin contracts, packed smoke and packlist passed (224 files, approximately 793 KB compressed). The platform landing mirrors the canonical SVGs rather than maintaining a second diagram layout. Artwork does not certify provider activation or deployment.
|
|
94
|
+
|
|
95
|
+
Local staging acceptance generated a fresh core application through ordinary init, including dependency installation and Git initialization. Drizzle generation reported no schema changes; the generated lint, typechecks, Fallow/dependency audit and web/Worker builds passed. Local D1 migrations were applied explicitly. Browser acceptance reproduced a return-to-sign-in race after sign-out: the API accepted the new session while the account hook still held the earlier anonymous state. The generator now mounts the session hook on sign-in and awaits its refresh after server verification, before navigating. This follows the supported [Better Auth session hook](https://better-auth.com/docs/basic-usage#use-session).
|
|
96
|
+
|
|
97
|
+
The expanded real-workerd browser regression passed signup, protected account, reload, sign-out, sign-in again, another reload and mobile viewport checks in a newly generated application. Local D1 session/revocation and native scheme/origin transport checks passed. Independent live local R2 checks exercised upload/download/delete, forced attachment headers, anonymous rejection, cross-user read/delete isolation, mutation-origin rejection and the 1 MiB bound. CLI build/lint and all 545 unit tests passed with one conditional skip. Logs are retained locally under `/tmp/anhedral-staging-init-*` and `/tmp/anhedral-staging-default-flow*.log`; generated applications and private local state remain ignored. These checks exercise web and API transport, not native-device execution.
|
|
98
|
+
|
|
99
|
+
No cloud provisioning, real payment, configured-database migration, deployment, app-store/device acceptance, npm publication or installed-plugin update occurred. Existing installed runtimes remain separate from this source candidate. Historical provider reports below are dated evidence, not current live verification.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
1
103
|
# Verification record
|
|
2
104
|
|
|
3
105
|
Dated records below describe the source and environment exercised at that time. Earlier results are historical evidence, not acceptance of a later release. Current architecture and operating instructions live in the stack standard and software factory.
|
|
4
106
|
|
|
107
|
+
## README stack catalog and static artwork — 2026-10-19
|
|
108
|
+
|
|
109
|
+
Replaced the README Mermaid diagram with dark/light static artwork. After reviewing the earlier connected reference, refined the illustration to Expo web/iOS/Android → Hono → Better Auth / Drizzle + D1 / private R2, with Cloudflare hosting, native distribution, shared UI/contracts and workspace tools. Large icons, short labels and thin curves follow the landing hero style. The caption explicitly preserves plain init's Expo-only selection; backend/auth/data are added when needed. The README retains the under-construction notice, early starting commands, all CLI selections and upstream documentation for 117 named ecosystem options.
|
|
110
|
+
|
|
111
|
+
Local validation: all 38 registry entries remain represented in the retained catalog; CLI build, four documentation-contract tests and the npm packlist policy passed. Inspected rendered artwork for icons, connections and label spacing. No CLI runtime behavior, provider configuration or deployment changed. GitHub/npm image URLs will show this artwork after the assets reach main.
|
|
112
|
+
|
|
5
113
|
## Full Cloudflare default and optional shared billing — 2026-10-18
|
|
6
114
|
|
|
7
115
|
New plain initialization and new Expo selections include Expo web/iOS/Android, Hono, Better Auth, Drizzle/D1 and private R2. Explicit Neon replaces D1. WXT-only initialization adds an extension to that default; explicit primary applications preserve their compatibility selection. Existing saved selections and unrelated additions do not receive new profile defaults. Legacy billing SDK/guidance projects require their pinned CLI or an explicit reviewed migration; strict provenance was preserved.
|
|
@@ -555,3 +663,215 @@ hosted CI and publication are recorded separately after they actually complete.
|
|
|
555
663
|
- Hosted generated-profile checks exposed an unused web API-client stub in Clerk builds and Wrangler ready URLs without trailing slashes. Emit the web client/dependency only for its Better Auth consumer; normalize both Vite and Wrangler loopback URLs. Both Clerk profiles subsequently passed real local generation, check, build and Worker preview. Universal auth and billing reference previews passed with the corrected readiness parser.
|
|
556
664
|
- Provider-call assertions in billing fixtures now compare exact hostnames, addressing CodeQL substring findings without changing provider transport.
|
|
557
665
|
- Publication consumes the immutable candidate from successful trusted main CI for the exact reviewed SHA instead of reinstalling and rebuilding it. CLI/plugin integrity pins, secret scan, package smoke, cross-platform artifact checks, protected npm environment and OIDC publication remain required. Negative policy checks reject staging, PR-run or unpinned candidate selection.
|
|
666
|
+
|
|
667
|
+
## 2026-10-21 — focused staging releases and CI tiers
|
|
668
|
+
|
|
669
|
+
Adopted topic PRs into `staging` and focused staging-to-main release PRs. Routine
|
|
670
|
+
code CI uses one Linux Node 24 CLI lane and one plugin lane; release candidates
|
|
671
|
+
retain supported Node, macOS/Windows, both plugin toolchains and all generated
|
|
672
|
+
profiles. Removed the duplicate E2E packed-CLI job. Stable `CI gate` fails on scope
|
|
673
|
+
errors or applicable failed/skipped jobs. Candidate upload is restricted to trusted
|
|
674
|
+
main CI. Reviewed-integrity dispatch, npm OIDC/provenance, immutable tags and
|
|
675
|
+
existing maintainer/CodeQL review requirements are preserved. Renovate targets staging.
|
|
676
|
+
|
|
677
|
+
Local build, typecheck, lint, release-policy and release-tooling checks passed.
|
|
678
|
+
Scope/promotion, candidate and plugin packaging regression checks passed. Full unit
|
|
679
|
+
suite passed with pinned pnpm 10.34.5: 750 passed, two optional runtime checks
|
|
680
|
+
skipped, zero failures. actionlint 1.7.12 passed (optional shellcheck/pyflakes disabled).
|
|
681
|
+
Initial checks caught a broken bundled relative documentation link and an obsolete
|
|
682
|
+
candidate-condition expectation; both were corrected. The host's pnpm 11 first
|
|
683
|
+
rejected the inspector's pnpm-10 override configuration; rerunning with the declared
|
|
684
|
+
version avoided a lockfile change. This is source/fixture evidence, not live provider
|
|
685
|
+
acceptance or a new npm publication. Adoption source takes effect on main after its
|
|
686
|
+
release PR merges; main remains the default branch.
|
|
687
|
+
|
|
688
|
+
Hosted adoption PR #39 subsequently exposed generated-project blockers: desktop
|
|
689
|
+
rejected Vite advisory GHSA-587h-7wmj-h5pm, and clients rejected duplicate affected
|
|
690
|
+
versions in advisory data. The generated dependency/advisory sources are unchanged
|
|
691
|
+
by this conventions diff; these failures are retained as release blockers for a
|
|
692
|
+
separate focused maintenance PR. Added fail-fast matrices and made portability/
|
|
693
|
+
generated jobs wait for primary checks to avoid spending on an already-failing
|
|
694
|
+
candidate. Hosted checks must pass before promotion/publication.
|
|
695
|
+
|
|
696
|
+
GitHub settings could not be applied: the authenticated account reports push access
|
|
697
|
+
but admin=false, and the attempted ruleset update returned HTTP 404. Existing rules
|
|
698
|
+
are unchanged. PR #39 lists the exact administrator prerequisites, including both
|
|
699
|
+
main rulesets, CI gate, merge commits and disabling automatic staging deletion.
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
## 2026-10-21 correction — lightweight hosted checks on both branches
|
|
703
|
+
|
|
704
|
+
The owner clarified that large hosted checks are unacceptable on staging **and**
|
|
705
|
+
production. Earlier release-matrix proposals above are superseded. Automatic PR
|
|
706
|
+
CI now has one Linux CI gate on both branches; no full suite, generated project,
|
|
707
|
+
browser or platform matrix expands at promotion. Expensive validation is optional
|
|
708
|
+
and explicitly manual, or local. Main has no duplicate push check. CLI candidate
|
|
709
|
+
packaging is requested manually on main; publication keeps exact SHA/artifact,
|
|
710
|
+
secret/integrity, protected npm approval, provenance and tag checks while using a
|
|
711
|
+
single Linux artifact smoke lane instead of the six-job native matrix. Main repo
|
|
712
|
+
PRs fetch only the formatter, not the full application dependency graph. Its deploy
|
|
713
|
+
scripts no longer repeat full checks/tests, while retaining main/source guards,
|
|
714
|
+
affected-service detection and the selected app's necessary build/typecheck/upload.
|
|
715
|
+
|
|
716
|
+
The corrected lightweight CLI gate passed locally: compile, formatting, source
|
|
717
|
+
hygiene, static security/release policy, fast contract tests and release-tooling
|
|
718
|
+
negative paths. actionlint passed for automatic, manual-validation and publishing
|
|
719
|
+
workflows. The dependency/advisory repair remains a separate staging PR.
|
|
720
|
+
|
|
721
|
+
## 2026-10-21 — generated dependency/advisory repair
|
|
722
|
+
|
|
723
|
+
Reproduced three live OSV findings on desktop's pinned Vite 7.3.6:
|
|
724
|
+
GHSA-587h-7wmj-h5pm, GHSA-698v-4r3x-3vcv and GHSA-r825-w8mm-5pxw.
|
|
725
|
+
The upstream repaired 7.x release is 7.3.7; the desktop recipe now pins it without
|
|
726
|
+
a major upgrade. Sources: https://github.com/advisories/GHSA-587h-7wmj-h5pm
|
|
727
|
+
and https://github.com/vitejs/vite/releases/tag/v7.3.7.
|
|
728
|
+
|
|
729
|
+
A real pnpm 10.34.5 clients audit also emitted two Vite 7.3.6 findings for the
|
|
730
|
+
extension and desktop dependency paths. Its severity metadata counted both
|
|
731
|
+
instances. The audit verifier now permits repeated versions at distinct paths,
|
|
732
|
+
preserves both counts and the raw report, and rejects duplicate version/path
|
|
733
|
+
entries. New regressions cover count mismatches, unknown high advisories and
|
|
734
|
+
exact reviewed-patch requirements with repeated versions. No advisory was added
|
|
735
|
+
to an exception list and no severity threshold changed.
|
|
736
|
+
|
|
737
|
+
Validation used Node 24.21.0 and pnpm 10.34.5. `pnpm test:all` passed: build, lint,
|
|
738
|
+
static security policy, live OSV audit of 110 locked/catalog coordinates, 751 unit
|
|
739
|
+
passes with two optional skips, frozen patch probes, packed CLI installation and
|
|
740
|
+
packlist checks. The 12 focused audit/scaffold checks passed. Fresh real desktop
|
|
741
|
+
and clients profiles passed generation, frozen install, lint/type/audit/tests/build
|
|
742
|
+
and unsigned macOS Electron packaging; clients also exercised Expo and WXT outputs.
|
|
743
|
+
The clients gate still requires its existing reviewed braces/node-forge patches;
|
|
744
|
+
raw advisories remain visible. Initial parallel generator runs collided in shadcn's
|
|
745
|
+
shared temporary clone directory; rerunning sequentially resolved that setup failure
|
|
746
|
+
without changing tests or adding retries. These results do not establish Windows,
|
|
747
|
+
Linux, signed macOS distribution or store acceptance. Hosted PR checks provide
|
|
748
|
+
separate evidence. This focused repair has no version bump or npm publication.
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
## 2026-10-23 — Product family naming
|
|
752
|
+
|
|
753
|
+
Positioned Anhedral CLI as the starter foundation in the README and software factory, alongside Anhedral Platform, Anhedral Agents, and Anhedral Cloud. This documentation change does not publish a package or activate provider services. Validation: Git whitespace checks; canonical software-factory reference refreshed through the normal build.
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
## 2026-10-23 — Generated audit dependency security recovery
|
|
757
|
+
|
|
758
|
+
The managed-email recovery release check refreshed OSV and found two advisories
|
|
759
|
+
against the existing generated Fallow 3.33.1 pin: GHSA-h4fr-cmh5-qr62 and
|
|
760
|
+
GHSA-jfwm-3p3c-6hx5. Both upstream advisories identify 3.34.0 as the patched
|
|
761
|
+
version. Pin the generated audit tool to that version; keep audit admission and
|
|
762
|
+
all existing security gates enabled. No provider resources or databases changed.
|
|
763
|
+
|
|
764
|
+
CLI build, lint/typecheck/format/hygiene/release policy, focused dependency/Next
|
|
765
|
+
contracts (11 tests) and refreshed OSV audit (61 locked/catalog versions) passed.
|
|
766
|
+
Publication of the integrated candidate remains separate.
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
## 2026-10-23 — Managed authentication email recovery
|
|
770
|
+
|
|
771
|
+
Recover the scoped email adapter and verification/password-reset flows from the
|
|
772
|
+
preserved `4a48ca3` snapshot against the current Next web/native-only Expo stack.
|
|
773
|
+
Use an optional, fully validated API binding/scope/capability; empty standalone
|
|
774
|
+
setup retains current sessions, partial setup fails closed, and configured setup
|
|
775
|
+
requires verification with reset session revocation. All generated session
|
|
776
|
+
consumers pass the same server environment, including private files and billing.
|
|
777
|
+
The adapter uses deterministic send identities and bounded requests; broker error
|
|
778
|
+
bodies and credential/token-bearing transport errors never reach clients.
|
|
779
|
+
|
|
780
|
+
Next and native signup wait for verification rather than trying to open Account
|
|
781
|
+
without a session. Resend and reset flows use exact same-origin/native callbacks.
|
|
782
|
+
The framework-independent reset transport is shared through contracts; each
|
|
783
|
+
platform owns its controls. Nova Input/Label integrate with the reviewed form PR.
|
|
784
|
+
|
|
785
|
+
Validation: focused generator/broker/Next tests (8), complete CLI unit suite
|
|
786
|
+
(553 passed, one optional skip), unchanged CLI release gate including OSV, patch
|
|
787
|
+
regressions, packed CLI and packlist passed again on the final combined Nova/email/tooling source. The
|
|
788
|
+
installed generated core fixture passed full checks including Fallow, dependency
|
|
789
|
+
audit, types, lint, OpenNext/API builds; iOS/Android Hermes exports passed.
|
|
790
|
+
Compiled Worker plus real Better Auth/Drizzle/in-memory SQLite proved signup,
|
|
791
|
+
verification, denied unverified login, reset, single-use/expired tokens, session
|
|
792
|
+
revocation, incorrect password, unknown-user privacy, foreign callback denial and
|
|
793
|
+
exact native return scheme. Default unconfigured auth acceptance also passed.
|
|
794
|
+
Browser testing verified the signup prompt, verification link, authenticated
|
|
795
|
+
Account and sign-out with the isolated sink. No real email or configured database
|
|
796
|
+
was used. Physical-device, inbox delivery and hosted-image activation are separate.
|
|
797
|
+
|
|
798
|
+
Initial checks retained failures for synthetic email strings in the security
|
|
799
|
+
scanner, screen/adapter complexity and cross-platform duplication; fixture
|
|
800
|
+
addresses were assembled and shared reset transport extracted without relaxing
|
|
801
|
+
checks. Fresh advisory refresh required separately reviewed Fallow, Expo-Zod and
|
|
802
|
+
Miniflare-Undici fixes. A local UI HTTP harness initially wrote cookie headers
|
|
803
|
+
after committing response headers; fixing that fixture restored sign-in. The
|
|
804
|
+
product's compiled-Worker authentication tests already passed independently.
|
|
805
|
+
|
|
806
|
+
## 2026-10-23 — Nova authentication form recovery
|
|
807
|
+
|
|
808
|
+
The current Next/native default already contains the recovered native shadcn
|
|
809
|
+
foundation and Base Nova Button (#49). Recover the source-owned Base UI Nova
|
|
810
|
+
Input and Label from the retained CLI snapshot and use them on generated web
|
|
811
|
+
sign-in forms. Preserve the existing MIT notice and upstream provenance hashes;
|
|
812
|
+
adapt only the local utility import, client boundary and focus ownership. Input
|
|
813
|
+
delegates keyboard focus to the generated global rule rather than adding a
|
|
814
|
+
second focus-only border/ring layer. Other historical components remain preserved
|
|
815
|
+
in the recovery branch and are not installed as unused starter code.
|
|
816
|
+
|
|
817
|
+
CLI build/lint/typecheck/format/hygiene and five Next contract tests passed.
|
|
818
|
+
The integrated generated web fixture passed Next route/type generation and lint
|
|
819
|
+
with these recovered controls. Browser interaction and final integrated release
|
|
820
|
+
checks are recorded with the managed-email recovery.
|
|
821
|
+
|
|
822
|
+
## 2026-10-23 — Expo CLI validation dependency recovery
|
|
823
|
+
|
|
824
|
+
A fresh installed core fixture failed the unchanged dependency audit on
|
|
825
|
+
GHSA-mrhx-c7xc-m3w5: Expo CLI 57.0.32 pulls Zod 3.25.76 although application
|
|
826
|
+
contracts already use patched Zod 4.6.6. Add a narrow @expo/cli>zod override to
|
|
827
|
+
the existing catalog pin. Expo SDK stays at 57. Audit admission remains enabled.
|
|
828
|
+
The actual CLI plugin/MCP schemas and native exports are tested before promotion;
|
|
829
|
+
this does not claim upstream Expo has migrated its declared range.
|
|
830
|
+
|
|
831
|
+
The next audit also identified GHSA-xjj6-f33q-929c in Miniflare's Undici
|
|
832
|
+
7.29.1. A same-major, consumer-scoped miniflare>undici 7.30.1 override uses
|
|
833
|
+
the upstream patched version and also removes the related moderate Undici
|
|
834
|
+
findings. No high/critical advisory is waived. Existing exact reviewed
|
|
835
|
+
node-forge/braces patches remain unchanged.
|
|
836
|
+
|
|
837
|
+
The installed generated core fixture passed the unchanged high/critical audit
|
|
838
|
+
gate with only the existing exact verified node-forge patch acceptance. Both
|
|
839
|
+
Hermes native exports passed. The actual Expo plugin and MCP schemas passed
|
|
840
|
+
positive/negative parsing against scoped Zod 4.6.6; CLI build/lint and 11 focused
|
|
841
|
+
contract tests passed, and OSV passed for 62 locked/catalog versions.
|
|
842
|
+
|
|
843
|
+
Final integrated acceptance: the unchanged full CLI release gate passed, including
|
|
844
|
+
553 unit passes/one optional skip, refreshed OSV (62 locked/catalog versions),
|
|
845
|
+
exact patch regressions, packed installation and strict packlist (249 files).
|
|
846
|
+
Inspector/plugin check passed all 61 tests. Both core and Stripe+RevenueCat
|
|
847
|
+
generated profiles passed full local checks and builds. The payment profile also
|
|
848
|
+
passed real workerd SSR/RSC, protected account, D1 session/revocation, native
|
|
849
|
+
scheme/origin rejection, compiled email acceptance and synthetic billing tests.
|
|
850
|
+
The 28 generated browser JavaScript assets contain no managed-email broker
|
|
851
|
+
configuration/module or native purchase modules. Browser reset-request confirmation
|
|
852
|
+
passed; native exports do not establish physical-device acceptance.
|
|
853
|
+
|
|
854
|
+
The final strict packlist initially rejected the recovered Input/Label paths;
|
|
855
|
+
PR #62 requires and allowlists exactly those two files without widening exclusions.
|
|
856
|
+
Nova form recovery is #60; security prerequisites are #58/#59. Storage safeguards
|
|
857
|
+
were already recovered/shipped as anhedral-main#201: nine regressions, root
|
|
858
|
+
check (26 tasks) and serial root build (five tasks) passed again at Platform
|
|
859
|
+
source 822825e9; later observed staging changes did not touch those safeguards.
|
|
860
|
+
No Comms source, retained recovery snapshot or stash was changed by this work.
|
|
861
|
+
Publication and provider state are verified separately after promotion.
|
|
862
|
+
|
|
863
|
+
Final React review gives web/native reset forms a token/error-derived route key,
|
|
864
|
+
so following a new recovery link resets prior completion, input and error state.
|
|
865
|
+
Only the used token/error fields cross the Next server/client boundary.
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
## 2026-10-23 — Immutable release smoke prerequisite
|
|
869
|
+
|
|
870
|
+
The first 0.15.0 publication attempt (run 40056207567, source 4557627f) stopped
|
|
871
|
+
before npm publishing. Hash and secret checks passed; exact-artifact smoke failed
|
|
872
|
+
while spawning pnpm for the installed CLI's normal initialization. Main candidate
|
|
873
|
+
CI had pnpm setup, but the isolated release verification and exact-artifact jobs
|
|
874
|
+
provisioned only Node. Add the same pinned pnpm action/version to those jobs, with
|
|
875
|
+
run_install disabled. Keep normal init, artifact integrity, npm environment/OIDC
|
|
876
|
+
and exact-artifact checks intact. A workflow regression covers all three smoke
|
|
877
|
+
locations. A fresh main candidate must be reviewed again after this correction.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anhedral",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.15.0",
|
|
4
|
+
"description": "Create a Next.js web + native Expo + Hono + Drizzle/D1 + private R2 application. Add Stripe and RevenueCat when needed.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -26,7 +26,10 @@
|
|
|
26
26
|
"docs/stack-standard.md",
|
|
27
27
|
"docs/software-factory.md",
|
|
28
28
|
"docs/verification.md",
|
|
29
|
-
"docs/anhedral-stack.md"
|
|
29
|
+
"docs/anhedral-stack.md",
|
|
30
|
+
"docs/assets/anhedral-stack.png",
|
|
31
|
+
"docs/assets/anhedral-stack-light.png",
|
|
32
|
+
"assets/ui"
|
|
30
33
|
],
|
|
31
34
|
"homepage": "https://github.com/anhedral/anhedral-cli#readme",
|
|
32
35
|
"repository": {
|
|
@@ -59,6 +62,7 @@
|
|
|
59
62
|
"pretest": "pnpm build",
|
|
60
63
|
"prepublishOnly": "pnpm test:all",
|
|
61
64
|
"test:cli:validation": "node --test tests/test-cli-validation.test.mjs",
|
|
65
|
+
"test:contracts:types": "node tests/test-generated-contracts-types.mjs",
|
|
62
66
|
"test:pack": "pnpm build && node tests/test-packed-cli.js",
|
|
63
67
|
"test:pack:exact": "node tests/test-packed-cli.js .artifacts/release/metadata.json",
|
|
64
68
|
"test:packlist": "pnpm build && node tests/test-packlist.js",
|
|
@@ -71,48 +75,42 @@
|
|
|
71
75
|
"test:standard": "pnpm build && node --test tests/test-standard.test.mjs",
|
|
72
76
|
"test:unit": "node scripts/prepare-test-runtime.mjs && node --test --test-concurrency=4 --test-reporter=spec tests/*.test.mjs",
|
|
73
77
|
"test:integration": "pnpm build && node tests/test-generated-apps.mjs",
|
|
74
|
-
"test:runtime:void": "node tests/test-void-runtime.mjs",
|
|
75
|
-
"test:runtime:void:generated": "node tests/test-void-runtime-generated.mjs",
|
|
76
78
|
"test:live:delivery": "pnpm build && node tests/test-live-delivery.mjs",
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"format": "prettier --write src scripts tests plugins/codex/inspector \"assets/patches/*.mjs\"",
|
|
80
|
-
"format:check": "prettier --check src scripts tests plugins/codex/inspector \"assets/patches/*.mjs\"",
|
|
79
|
+
"format": "prettier --write src scripts tests plugins/codex/inspector \"assets/patches/*.mjs\" assets/ui",
|
|
80
|
+
"format:check": "prettier --check src scripts tests plugins/codex/inspector \"assets/patches/*.mjs\" assets/ui",
|
|
81
81
|
"plugin:build": "pnpm --dir plugins/codex/inspector build",
|
|
82
82
|
"plugin:check": "pnpm --dir plugins/codex/inspector check",
|
|
83
83
|
"plugin:preview": "pnpm --dir plugins/codex/inspector start",
|
|
84
84
|
"test:patch": "node tests/test-braces-install.mjs && node tests/test-forge-install.mjs",
|
|
85
|
-
"test:
|
|
86
|
-
"test:billing": "node tests/test-generated-billing.mjs examples/billing-reference"
|
|
85
|
+
"test:billing": "node tests/test-generated-apps.mjs billing"
|
|
87
86
|
},
|
|
88
87
|
"keywords": [
|
|
89
88
|
"cli",
|
|
90
89
|
"scaffold",
|
|
91
90
|
"typescript",
|
|
92
|
-
"
|
|
91
|
+
"expo",
|
|
93
92
|
"hono",
|
|
94
93
|
"cloudflare",
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"electron",
|
|
98
|
-
"wxt",
|
|
99
|
-
"neon",
|
|
94
|
+
"d1",
|
|
95
|
+
"r2",
|
|
100
96
|
"drizzle",
|
|
101
|
-
"
|
|
97
|
+
"stripe",
|
|
98
|
+
"revenuecat",
|
|
102
99
|
"turborepo",
|
|
103
|
-
"
|
|
100
|
+
"nextjs",
|
|
101
|
+
"opennext"
|
|
104
102
|
],
|
|
105
103
|
"license": "Apache-2.0",
|
|
106
104
|
"packageManager": "pnpm@10.34.5",
|
|
107
105
|
"devDependencies": {
|
|
108
106
|
"@types/node": "20.19.43",
|
|
107
|
+
"hono": "4.13.13",
|
|
109
108
|
"prettier": "3.9.10",
|
|
110
109
|
"typescript": "5.9.3"
|
|
111
110
|
},
|
|
112
111
|
"dependencies": {
|
|
113
|
-
"@neondatabase/serverless": "1.2.0",
|
|
114
112
|
"jsonc-parser": "3.3.1",
|
|
115
|
-
"
|
|
116
|
-
"
|
|
113
|
+
"yaml": "2.9.1",
|
|
114
|
+
"zod": "4.6.6"
|
|
117
115
|
}
|
|
118
116
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { neon } from '@neondatabase/serverless';
|
|
2
|
-
import type { ApiRequest } from './providers/api.js';
|
|
3
|
-
import { type IntegrationService } from './integration-service-readers.js';
|
|
4
|
-
import type { ServiceData } from './service-model.js';
|
|
5
|
-
export type NeonRead = (query: string, params?: unknown[]) => Promise<Record<string, unknown>[]>;
|
|
6
|
-
export declare function neonReadConnection(service: IntegrationService, api: ApiRequest, env?: NodeJS.ProcessEnv, createClient?: typeof neon): Promise<NeonRead>;
|
|
7
|
-
export declare function listNeonTables(read: NeonRead): Promise<string[]>;
|
|
8
|
-
export declare function browseNeonData(read: NeonRead, table: string, offset?: number): Promise<ServiceData>;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { neon } from '@neondatabase/serverless';
|
|
2
|
-
import { setting } from './providers/config.js';
|
|
3
|
-
import { record } from './service-readers.js';
|
|
4
|
-
import { inspectIntegrationResource, } from './integration-service-readers.js';
|
|
5
|
-
const identifier = (value) => {
|
|
6
|
-
if (!/^[a-zA-Z_][a-zA-Z0-9_]{0,127}$/.test(value))
|
|
7
|
-
throw new Error('Unsupported database identifier.');
|
|
8
|
-
return `"${value}"`;
|
|
9
|
-
};
|
|
10
|
-
const sensitive = /password|secret|token|email|phone|address|authorization|cookie|session|private|credential/i;
|
|
11
|
-
export async function neonReadConnection(service, api, env = process.env, createClient = neon) {
|
|
12
|
-
if (service.provider !== 'neon')
|
|
13
|
-
throw new Error('Choose the selected Neon project.');
|
|
14
|
-
const project = await inspectIntegrationResource(service, api);
|
|
15
|
-
const connection = env[`ANHEDRAL_NEON_READONLY_URL_${String(project.id)
|
|
16
|
-
.replace(/[^a-zA-Z0-9]/g, '_')
|
|
17
|
-
.toUpperCase()}`] ?? env.ANHEDRAL_NEON_READONLY_URL;
|
|
18
|
-
if (!connection)
|
|
19
|
-
throw new Error('Provide ANHEDRAL_NEON_READONLY_URL for a restricted read-only role.');
|
|
20
|
-
let url;
|
|
21
|
-
try {
|
|
22
|
-
url = new URL(connection);
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
throw new Error('Invalid read-only database connection.');
|
|
26
|
-
}
|
|
27
|
-
if (!['postgres:', 'postgresql:'].includes(url.protocol) ||
|
|
28
|
-
!url.hostname.endsWith('.neon.tech') ||
|
|
29
|
-
!url.username ||
|
|
30
|
-
!url.password ||
|
|
31
|
-
(url.port && url.port !== '5432') ||
|
|
32
|
-
decodeURIComponent(url.pathname.slice(1)) !== setting(service.settings, 'database'))
|
|
33
|
-
throw new Error('Read-only database connection does not match selected configuration.');
|
|
34
|
-
const endpoints = record(await api(`/api/v2/projects/${project.id}/endpoints`)).endpoints;
|
|
35
|
-
if (!Array.isArray(endpoints) ||
|
|
36
|
-
endpoints.length > 100 ||
|
|
37
|
-
!endpoints.some((endpoint) => record(endpoint).host === url.hostname.replace(/-pooler\./, '.')))
|
|
38
|
-
throw new Error('Database endpoint does not belong to the selected Neon project.');
|
|
39
|
-
const sql = createClient(connection);
|
|
40
|
-
return async (query, params = []) => {
|
|
41
|
-
try {
|
|
42
|
-
const result = await sql.transaction([
|
|
43
|
-
sql.query("SELECT set_config('statement_timeout','5000',true)"),
|
|
44
|
-
sql.query("SELECT current_setting('transaction_read_only') = 'on' AS read_only, (SELECT rolsuper OR rolcreatedb OR rolcreaterole FROM pg_roles WHERE rolname = current_user) AS privileged, EXISTS(SELECT 1 FROM pg_class c JOIN pg_namespace n ON n.oid=c.relnamespace WHERE n.nspname='public' AND c.relkind IN ('r','p') AND has_table_privilege(current_user,c.oid,'INSERT,UPDATE,DELETE,TRUNCATE')) AS writable"),
|
|
45
|
-
sql.query(query, params),
|
|
46
|
-
], {
|
|
47
|
-
readOnly: true,
|
|
48
|
-
isolationLevel: 'RepeatableRead',
|
|
49
|
-
fetchOptions: { signal: AbortSignal.timeout(10000), redirect: 'error' },
|
|
50
|
-
});
|
|
51
|
-
const role = result[1]?.[0];
|
|
52
|
-
if (role?.read_only !== true || role.privileged !== false || role.writable !== false)
|
|
53
|
-
throw new Error('Restricted read-only role required.');
|
|
54
|
-
if (!Array.isArray(result[2]) || result[2].length > 1001)
|
|
55
|
-
throw new Error('Database response exceeded limits.');
|
|
56
|
-
return result[2].map(record);
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
throw new Error('Neon read failed. Check the selected endpoint, restricted role, read permissions and query limits.');
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
export async function listNeonTables(read) {
|
|
64
|
-
const rows = await read("SELECT table_name AS name FROM information_schema.tables WHERE table_schema='public' AND table_type='BASE TABLE' ORDER BY table_name LIMIT 1001");
|
|
65
|
-
if (rows.length > 1000)
|
|
66
|
-
throw new Error('Database schema exceeds its table limit.');
|
|
67
|
-
return rows.map((row) => {
|
|
68
|
-
if (typeof row.name !== 'string')
|
|
69
|
-
throw new Error('Invalid database table.');
|
|
70
|
-
identifier(row.name);
|
|
71
|
-
return row.name;
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
export async function browseNeonData(read, table, offset = 0) {
|
|
75
|
-
identifier(table);
|
|
76
|
-
if (!Number.isSafeInteger(offset) ||
|
|
77
|
-
offset < 0 ||
|
|
78
|
-
offset > 10000 ||
|
|
79
|
-
!(await listNeonTables(read)).includes(table))
|
|
80
|
-
throw new Error('Choose a bounded existing table page.');
|
|
81
|
-
const fields = await read("SELECT column_name AS name FROM information_schema.columns WHERE table_schema='public' AND table_name=$1 ORDER BY ordinal_position LIMIT 51", [table]);
|
|
82
|
-
if (fields.length > 50 || !fields.length)
|
|
83
|
-
throw new Error('Table exceeds its supported column limit.');
|
|
84
|
-
const columns = fields.map((row) => {
|
|
85
|
-
if (typeof row.name !== 'string')
|
|
86
|
-
throw new Error('Invalid database column.');
|
|
87
|
-
identifier(row.name);
|
|
88
|
-
return row.name;
|
|
89
|
-
});
|
|
90
|
-
const projection = columns
|
|
91
|
-
.map((column) => sensitive.test(column)
|
|
92
|
-
? `'[masked]'::text AS ${identifier(column)}`
|
|
93
|
-
: `left(${identifier(column)}::text,1000) AS ${identifier(column)}`)
|
|
94
|
-
.join(', ');
|
|
95
|
-
const rows = await read(`SELECT ${projection} FROM public.${identifier(table)} ORDER BY ${columns.map((_, index) => index + 1).join(', ')} LIMIT $1 OFFSET $2`, [26, offset]);
|
|
96
|
-
let masked = columns.some((column) => sensitive.test(column));
|
|
97
|
-
const outputRows = rows.slice(0, 25).map((row) => columns.map((column) => {
|
|
98
|
-
const value = row[column];
|
|
99
|
-
if (value === null)
|
|
100
|
-
return null;
|
|
101
|
-
if (typeof value !== 'string')
|
|
102
|
-
throw new Error('Unsupported database value.');
|
|
103
|
-
if (/^(?:sk[-_]|rk[-_]|whsec[-_]|Bearer )/i.test(value)) {
|
|
104
|
-
masked = true;
|
|
105
|
-
return '[masked]';
|
|
106
|
-
}
|
|
107
|
-
return value.slice(0, 1000);
|
|
108
|
-
}));
|
|
109
|
-
return {
|
|
110
|
-
fetchedAt: new Date().toISOString(),
|
|
111
|
-
columns,
|
|
112
|
-
rows: outputRows,
|
|
113
|
-
offset,
|
|
114
|
-
hasMore: rows.length > 25,
|
|
115
|
-
masked,
|
|
116
|
-
};
|
|
117
|
-
}
|