primitive-admin 1.0.62 → 1.0.64
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 +132 -42
- package/assets/skill/skills/primitive-platform/SKILL.md +142 -661
- package/dist/bin/primitive.js +121 -41
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/admins.js +37 -50
- package/dist/src/commands/admins.js.map +1 -1
- package/dist/src/commands/analytics.js +178 -9
- package/dist/src/commands/analytics.js.map +1 -1
- package/dist/src/commands/apps.js +17 -7
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth-sessions.d.ts +7 -0
- package/dist/src/commands/auth-sessions.js +144 -0
- package/dist/src/commands/auth-sessions.js.map +1 -0
- package/dist/src/commands/auth.js +76 -116
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.js +2 -1
- package/dist/src/commands/blob-buckets.js.map +1 -1
- package/dist/src/commands/catalog.js +26 -10
- package/dist/src/commands/catalog.js.map +1 -1
- package/dist/src/commands/collection-type-configs.js +3 -10
- package/dist/src/commands/collection-type-configs.js.map +1 -1
- package/dist/src/commands/collections.js +736 -19
- package/dist/src/commands/collections.js.map +1 -1
- package/dist/src/commands/config.js +13 -27
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/connections.js +8 -9
- package/dist/src/commands/connections.js.map +1 -1
- package/dist/src/commands/cron-triggers.js +2 -1
- package/dist/src/commands/cron-triggers.js.map +1 -1
- package/dist/src/commands/database-type-configs.js +5 -12
- package/dist/src/commands/database-type-configs.js.map +1 -1
- package/dist/src/commands/databases.js +59 -72
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.d.ts +58 -0
- package/dist/src/commands/documents.js +1623 -95
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/email-templates.js +5 -4
- package/dist/src/commands/email-templates.js.map +1 -1
- package/dist/src/commands/env.d.ts +1 -1
- package/dist/src/commands/env.js +106 -44
- package/dist/src/commands/env.js.map +1 -1
- package/dist/src/commands/feature-flags.js +2 -1
- package/dist/src/commands/feature-flags.js.map +1 -1
- package/dist/src/commands/functions.d.ts +20 -0
- package/dist/src/commands/functions.js +1630 -0
- package/dist/src/commands/functions.js.map +1 -0
- package/dist/src/commands/group-type-configs.js +2 -1
- package/dist/src/commands/group-type-configs.js.map +1 -1
- package/dist/src/commands/groups.js +30 -17
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.js +17 -11
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/init.d.ts +24 -12
- package/dist/src/commands/init.js +198 -110
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.js +65 -26
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/locks.js +17 -2
- package/dist/src/commands/locks.js.map +1 -1
- package/dist/src/commands/metadata-category-configs.js +2 -1
- package/dist/src/commands/metadata-category-configs.js.map +1 -1
- package/dist/src/commands/metadata.js +8 -1
- package/dist/src/commands/metadata.js.map +1 -1
- package/dist/src/commands/prompts.js +106 -59
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rule-sets.js +3 -10
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/scripts.d.ts +10 -0
- package/dist/src/commands/scripts.js +159 -25
- package/dist/src/commands/scripts.js.map +1 -1
- package/dist/src/commands/secrets.js +2 -1
- package/dist/src/commands/secrets.js.map +1 -1
- package/dist/src/commands/sessions.js +10 -9
- package/dist/src/commands/sessions.js.map +1 -1
- package/dist/src/commands/sync-app-settings.js +3 -5
- package/dist/src/commands/sync-app-settings.js.map +1 -1
- package/dist/src/commands/sync.d.ts +391 -44
- package/dist/src/commands/sync.js +2622 -534
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/tokens.js +2 -1
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/users.js +19 -10
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/vars.js +2 -1
- package/dist/src/commands/vars.js.map +1 -1
- package/dist/src/commands/waitlist.js +2 -1
- package/dist/src/commands/waitlist.js.map +1 -1
- package/dist/src/commands/webhooks.d.ts +29 -0
- package/dist/src/commands/webhooks.js +135 -64
- package/dist/src/commands/webhooks.js.map +1 -1
- package/dist/src/commands/workflows.d.ts +1 -29
- package/dist/src/commands/workflows.js +113 -179
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +628 -14
- package/dist/src/lib/api-client.js +776 -70
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +1 -1
- package/dist/src/lib/app-settings-descriptor.js +9 -1
- package/dist/src/lib/app-settings-descriptor.js.map +1 -1
- package/dist/src/lib/block-selector.d.ts +58 -0
- package/dist/src/lib/block-selector.js +92 -0
- package/dist/src/lib/block-selector.js.map +1 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +24 -54
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +31 -153
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -1
- package/dist/src/lib/collection-export.d.ts +184 -0
- package/dist/src/lib/collection-export.js +252 -0
- package/dist/src/lib/collection-export.js.map +1 -0
- package/dist/src/lib/config-json-field.d.ts +28 -0
- package/dist/src/lib/config-json-field.js +56 -0
- package/dist/src/lib/config-json-field.js.map +1 -0
- package/dist/src/lib/config-object-descriptor.js +88 -6
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/config-payload.d.ts +8 -1
- package/dist/src/lib/config-payload.js +49 -4
- package/dist/src/lib/config-payload.js.map +1 -1
- package/dist/src/lib/config-surface.d.ts +12 -1
- package/dist/src/lib/config-surface.js +71 -3
- package/dist/src/lib/config-surface.js.map +1 -1
- package/dist/src/lib/config.d.ts +31 -13
- package/dist/src/lib/config.js +34 -70
- package/dist/src/lib/config.js.map +1 -1
- package/dist/src/lib/credentials-store.d.ts +37 -22
- package/dist/src/lib/credentials-store.js +103 -97
- package/dist/src/lib/credentials-store.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTypeIR.js +8 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
- package/dist/src/lib/deprecation.d.ts +22 -0
- package/dist/src/lib/deprecation.js +43 -0
- package/dist/src/lib/deprecation.js.map +1 -0
- package/dist/src/lib/document-export-permissions.d.ts +30 -0
- package/dist/src/lib/document-export-permissions.js +54 -0
- package/dist/src/lib/document-export-permissions.js.map +1 -0
- package/dist/src/lib/document-ingest-artifact.d.ts +120 -0
- package/dist/src/lib/document-ingest-artifact.js +505 -0
- package/dist/src/lib/document-ingest-artifact.js.map +1 -0
- package/dist/src/lib/document-ingest-input.d.ts +51 -0
- package/dist/src/lib/document-ingest-input.js +132 -0
- package/dist/src/lib/document-ingest-input.js.map +1 -0
- package/dist/src/lib/document-ingest-rows.d.ts +137 -0
- package/dist/src/lib/document-ingest-rows.js +181 -0
- package/dist/src/lib/document-ingest-rows.js.map +1 -0
- package/dist/src/lib/document-ingest.d.ts +101 -0
- package/dist/src/lib/document-ingest.js +384 -0
- package/dist/src/lib/document-ingest.js.map +1 -0
- package/dist/src/lib/env-resolver-core.d.ts +128 -17
- package/dist/src/lib/env-resolver-core.js +204 -22
- package/dist/src/lib/env-resolver-core.js.map +1 -1
- package/dist/src/lib/env-resolver.d.ts +18 -3
- package/dist/src/lib/env-resolver.js +23 -3
- package/dist/src/lib/env-resolver.js.map +1 -1
- package/dist/src/lib/function-bundle.d.ts +147 -0
- package/dist/src/lib/function-bundle.js +341 -0
- package/dist/src/lib/function-bundle.js.map +1 -0
- package/dist/src/lib/function-collect.d.ts +123 -0
- package/dist/src/lib/function-collect.js +610 -0
- package/dist/src/lib/function-collect.js.map +1 -0
- package/dist/src/lib/function-db-types.d.ts +202 -0
- package/dist/src/lib/function-db-types.js +870 -0
- package/dist/src/lib/function-db-types.js.map +1 -0
- package/dist/src/lib/function-document-types.d.ts +144 -0
- package/dist/src/lib/function-document-types.js +370 -0
- package/dist/src/lib/function-document-types.js.map +1 -0
- package/dist/src/lib/function-grants-preflight.d.ts +64 -0
- package/dist/src/lib/function-grants-preflight.js +105 -0
- package/dist/src/lib/function-grants-preflight.js.map +1 -0
- package/dist/src/lib/function-log-lines.d.ts +76 -0
- package/dist/src/lib/function-log-lines.js +160 -0
- package/dist/src/lib/function-log-lines.js.map +1 -0
- package/dist/src/lib/function-log-row.d.ts +29 -0
- package/dist/src/lib/function-log-row.js +73 -0
- package/dist/src/lib/function-log-row.js.map +1 -0
- package/dist/src/lib/function-log-tail.d.ts +132 -0
- package/dist/src/lib/function-log-tail.js +262 -0
- package/dist/src/lib/function-log-tail.js.map +1 -0
- package/dist/src/lib/function-run.d.ts +289 -0
- package/dist/src/lib/function-run.js +389 -0
- package/dist/src/lib/function-run.js.map +1 -0
- package/dist/src/lib/function-schema-codegen.d.ts +143 -0
- package/dist/src/lib/function-schema-codegen.js +420 -0
- package/dist/src/lib/function-schema-codegen.js.map +1 -0
- package/dist/src/lib/function-sync.d.ts +459 -0
- package/dist/src/lib/function-sync.js +1258 -0
- package/dist/src/lib/function-sync.js.map +1 -0
- package/dist/src/lib/function-trigger-listing.d.ts +27 -0
- package/dist/src/lib/function-trigger-listing.js +70 -0
- package/dist/src/lib/function-trigger-listing.js.map +1 -0
- package/dist/src/lib/function-typecheck.d.ts +86 -0
- package/dist/src/lib/function-typecheck.js +370 -0
- package/dist/src/lib/function-typecheck.js.map +1 -0
- package/dist/src/lib/function-versions.d.ts +122 -0
- package/dist/src/lib/function-versions.js +182 -0
- package/dist/src/lib/function-versions.js.map +1 -0
- package/dist/src/lib/generated-allowlist.js +4 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -1
- package/dist/src/lib/generated-config-surfaces.d.ts +2332 -78
- package/dist/src/lib/generated-config-surfaces.js +6979 -468
- package/dist/src/lib/generated-config-surfaces.js.map +1 -1
- package/dist/src/lib/generated-sdk-types.d.ts +12 -0
- package/dist/src/lib/generated-sdk-types.js +13 -0
- package/dist/src/lib/generated-sdk-types.js.map +1 -0
- package/dist/src/lib/init-adopt.js +2 -2
- package/dist/src/lib/init-adopt.js.map +1 -1
- package/dist/src/lib/init-assets.js +3 -3
- package/dist/src/lib/init-client-platforms.d.ts +14 -0
- package/dist/src/lib/init-client-platforms.js +71 -0
- package/dist/src/lib/init-client-platforms.js.map +1 -0
- package/dist/src/lib/init-config.d.ts +1 -1
- package/dist/src/lib/init-email-redirect-uris.d.ts +37 -0
- package/dist/src/lib/init-email-redirect-uris.js +46 -0
- package/dist/src/lib/init-email-redirect-uris.js.map +1 -0
- package/dist/src/lib/init-ios-links.d.ts +41 -0
- package/dist/src/lib/init-ios-links.js +67 -1
- package/dist/src/lib/init-ios-links.js.map +1 -1
- package/dist/src/lib/init-plan.d.ts +1 -1
- package/dist/src/lib/init-plan.js +1 -1
- package/dist/src/lib/init-xcode.d.ts +6 -5
- package/dist/src/lib/init-xcode.js +34 -10
- package/dist/src/lib/init-xcode.js.map +1 -1
- package/dist/src/lib/integration-selector.d.ts +42 -0
- package/dist/src/lib/integration-selector.js +46 -0
- package/dist/src/lib/integration-selector.js.map +1 -0
- package/dist/src/lib/ios-app-id.d.ts +34 -0
- package/dist/src/lib/ios-app-id.js +69 -0
- package/dist/src/lib/ios-app-id.js.map +1 -0
- package/dist/src/lib/list-options.d.ts +68 -0
- package/dist/src/lib/list-options.js +89 -0
- package/dist/src/lib/list-options.js.map +1 -0
- package/dist/src/lib/local-state.d.ts +1 -1
- package/dist/src/lib/local-state.js +1 -1
- package/dist/src/lib/local-test-cases.d.ts +63 -0
- package/dist/src/lib/local-test-cases.js +136 -0
- package/dist/src/lib/local-test-cases.js.map +1 -0
- package/dist/src/lib/log-inspection.d.ts +152 -5
- package/dist/src/lib/log-inspection.js +179 -2
- package/dist/src/lib/log-inspection.js.map +1 -1
- package/dist/src/lib/logout-admin-session.d.ts +33 -0
- package/dist/src/lib/logout-admin-session.js +70 -0
- package/dist/src/lib/logout-admin-session.js.map +1 -0
- package/dist/src/lib/output.d.ts +15 -0
- package/dist/src/lib/output.js +28 -0
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/paginate.d.ts +15 -0
- package/dist/src/lib/paginate.js +17 -0
- package/dist/src/lib/paginate.js.map +1 -1
- package/dist/src/lib/project-config.d.ts +46 -21
- package/dist/src/lib/project-config.js +74 -47
- package/dist/src/lib/project-config.js.map +1 -1
- package/dist/src/lib/prompt-cost-format.d.ts +11 -0
- package/dist/src/lib/prompt-cost-format.js +41 -0
- package/dist/src/lib/prompt-cost-format.js.map +1 -0
- package/dist/src/lib/prompt-schema-codegen.d.ts +147 -0
- package/dist/src/lib/prompt-schema-codegen.js +462 -0
- package/dist/src/lib/prompt-schema-codegen.js.map +1 -0
- package/dist/src/lib/refresh-admin-credentials.d.ts +9 -1
- package/dist/src/lib/refresh-admin-credentials.js +22 -2
- package/dist/src/lib/refresh-admin-credentials.js.map +1 -1
- package/dist/src/lib/resolve-owner.d.ts +19 -0
- package/dist/src/lib/resolve-owner.js +20 -0
- package/dist/src/lib/resolve-owner.js.map +1 -0
- package/dist/src/lib/skill-installer.d.ts +49 -3
- package/dist/src/lib/skill-installer.js +275 -100
- package/dist/src/lib/skill-installer.js.map +1 -1
- package/dist/src/lib/snapshot-audit-source.d.ts +45 -0
- package/dist/src/lib/snapshot-audit-source.js +58 -0
- package/dist/src/lib/snapshot-audit-source.js.map +1 -0
- package/dist/src/lib/snapshot-audit-store.d.ts +52 -0
- package/dist/src/lib/snapshot-audit-store.js +196 -0
- package/dist/src/lib/snapshot-audit-store.js.map +1 -0
- package/dist/src/lib/snapshot-audit.d.ts +207 -0
- package/dist/src/lib/snapshot-audit.js +431 -0
- package/dist/src/lib/snapshot-audit.js.map +1 -0
- package/dist/src/lib/snapshot-build-rows.d.ts +60 -0
- package/dist/src/lib/snapshot-build-rows.js +87 -0
- package/dist/src/lib/snapshot-build-rows.js.map +1 -0
- package/dist/src/lib/snapshot-build.d.ts +50 -0
- package/dist/src/lib/snapshot-build.js +111 -0
- package/dist/src/lib/snapshot-build.js.map +1 -0
- package/dist/src/lib/snapshot-manifest-layout.d.ts +61 -0
- package/dist/src/lib/snapshot-manifest-layout.js +70 -0
- package/dist/src/lib/snapshot-manifest-layout.js.map +1 -0
- package/dist/src/lib/snapshots.d.ts +8 -9
- package/dist/src/lib/snapshots.js +20 -83
- package/dist/src/lib/snapshots.js.map +1 -1
- package/dist/src/lib/step-run-table.d.ts +43 -0
- package/dist/src/lib/step-run-table.js +129 -0
- package/dist/src/lib/step-run-table.js.map +1 -0
- package/dist/src/lib/storage-pending-retry.d.ts +26 -0
- package/dist/src/lib/storage-pending-retry.js +42 -0
- package/dist/src/lib/storage-pending-retry.js.map +1 -0
- package/dist/src/lib/swift-codegen/agentGenerator.d.ts +42 -0
- package/dist/src/lib/swift-codegen/agentGenerator.js +118 -0
- package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/banners.d.ts +24 -0
- package/dist/src/lib/swift-codegen/banners.js +25 -0
- package/dist/src/lib/swift-codegen/banners.js.map +1 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js +19 -7
- package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/functionGenerator.d.ts +139 -0
- package/dist/src/lib/swift-codegen/functionGenerator.js +462 -0
- package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/generator.d.ts +7 -1
- package/dist/src/lib/swift-codegen/generator.js +28 -11
- package/dist/src/lib/swift-codegen/generator.js.map +1 -1
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +15 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.js +21 -4
- package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
- package/dist/src/lib/sync-paths.d.ts +72 -55
- package/dist/src/lib/sync-paths.js +97 -100
- package/dist/src/lib/sync-paths.js.map +1 -1
- package/dist/src/lib/sync-resource-types.d.ts +23 -4
- package/dist/src/lib/sync-resource-types.js +106 -8
- package/dist/src/lib/sync-resource-types.js.map +1 -1
- package/dist/src/lib/sync-selectors.d.ts +45 -2
- package/dist/src/lib/sync-selectors.js +66 -5
- package/dist/src/lib/sync-selectors.js.map +1 -1
- package/dist/src/lib/template.d.ts +2 -2
- package/dist/src/lib/template.js +2 -2
- package/dist/src/lib/test-case-file-names.d.ts +40 -0
- package/dist/src/lib/test-case-file-names.js +91 -0
- package/dist/src/lib/test-case-file-names.js.map +1 -0
- package/dist/src/lib/test-case-keys.d.ts +1 -1
- package/dist/src/lib/test-case-keys.js +1 -1
- package/dist/src/lib/test-case-variables.d.ts +14 -0
- package/dist/src/lib/test-case-variables.js +42 -0
- package/dist/src/lib/test-case-variables.js.map +1 -1
- package/dist/src/lib/toml-database-config.js +19 -2
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/web-url.d.ts +40 -0
- package/dist/src/lib/web-url.js +76 -0
- package/dist/src/lib/web-url.js.map +1 -0
- package/dist/src/lib/webhook-deliver.d.ts +209 -0
- package/dist/src/lib/webhook-deliver.js +519 -0
- package/dist/src/lib/webhook-deliver.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generator.d.ts +1 -1
- package/dist/src/lib/workflow-codegen/generator.js +1 -1
- package/dist/src/lib/workflow-toml-validator.d.ts +17 -8
- package/dist/src/lib/workflow-toml-validator.js +25 -12
- package/dist/src/lib/workflow-toml-validator.js.map +1 -1
- package/dist/src/lib/workflow-usage.d.ts +196 -0
- package/dist/src/lib/workflow-usage.js +310 -0
- package/dist/src/lib/workflow-usage.js.map +1 -0
- package/dist/src/types/index.d.ts +12 -2
- package/package.json +5 -4
|
@@ -31,15 +31,65 @@
|
|
|
31
31
|
*/
|
|
32
32
|
import { existsSync, readFileSync } from "node:fs";
|
|
33
33
|
import { basename, dirname, join, resolve } from "node:path";
|
|
34
|
-
/** Schema version of
|
|
34
|
+
/** Schema version of `primitive/config.json` this core understands. */
|
|
35
35
|
export const PRIMITIVE_CONFIG_VERSION = 1;
|
|
36
36
|
/** Schema version of `.primitive/local.json` this core writes and reads. */
|
|
37
37
|
export const PRIMITIVE_LOCAL_STATE_VERSION = 1;
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
|
+
* The two directories, split apart by #3153 so one name never means two
|
|
40
|
+
* things: `primitive/` is the COMMITTED tree (the config and every
|
|
41
|
+
* environment's TOML), `.primitive/` is MACHINE-LOCAL state (credentials, this
|
|
42
|
+
* machine's selection, snapshot backups) and is gitignored whole.
|
|
43
|
+
*/
|
|
44
|
+
export const PROJECT_TREE_DIR = "primitive";
|
|
45
|
+
export const PROJECT_LOCAL_STATE_DIR = ".primitive";
|
|
39
46
|
export const PROJECT_CONFIG_FILENAME = "config.json";
|
|
40
47
|
export const LOCAL_STATE_FILENAME = "local.json";
|
|
41
|
-
export const PROJECT_CONFIG_DISPLAY_NAME = "
|
|
48
|
+
export const PROJECT_CONFIG_DISPLAY_NAME = "primitive/config.json";
|
|
42
49
|
export const LOCAL_STATE_DISPLAY_NAME = ".primitive/local.json";
|
|
50
|
+
/**
|
|
51
|
+
* The one refusal for a project that never migrated off the pre-#3153 layout:
|
|
52
|
+
* a `.primitive/config.json` with no `primitive/config.json` beside it.
|
|
53
|
+
*
|
|
54
|
+
* That shape is refused rather than walked past because the walk's next stop
|
|
55
|
+
* is the parent directory, and in a nested checkout the parent may be a
|
|
56
|
+
* DIFFERENT project — a command run in the unmigrated one would silently act
|
|
57
|
+
* on the other's app. Nothing else is refused (#3392): anything left under
|
|
58
|
+
* `.primitive/` beside a migrated tree is machine-local junk, not signal.
|
|
59
|
+
*
|
|
60
|
+
* One sentence, naming both halves — the file that was found and the file
|
|
61
|
+
* that is expected — and no document. The migration page this once pointed
|
|
62
|
+
* at was never published (#3155, won't-fix), and every reader that shares
|
|
63
|
+
* this refusal — this core, the generated Vite-plugin copy, the Swift
|
|
64
|
+
* pre-build script, the Vue template's deploy script — says the same thing.
|
|
65
|
+
*/
|
|
66
|
+
export function unmigratedProjectMessage(found, expected) {
|
|
67
|
+
return (`Found ${found} but no ${expected}: this project still uses the retired ` +
|
|
68
|
+
`layout under ${PROJECT_LOCAL_STATE_DIR}/, which is never read.`);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The one refusal for a command run outside a Primitive project (#3154,
|
|
72
|
+
* intent criterion 5).
|
|
73
|
+
*
|
|
74
|
+
* There is exactly one way to resolve the configuration tree, the credentials
|
|
75
|
+
* and the app: the environment named by `primitive/config.json`. Outside a
|
|
76
|
+
* project there is no such thing, and the CLI says so once, in these words,
|
|
77
|
+
* wherever the question is asked — the resolver core, the CLI's
|
|
78
|
+
* `requireCurrentEnvironment()`, and the credentials store.
|
|
79
|
+
*
|
|
80
|
+
* Two constraints on the wording, both test-asserted:
|
|
81
|
+
*
|
|
82
|
+
* - it names `primitive init`, the one command that creates what is missing;
|
|
83
|
+
* - it never names `primitive env add`, which after this change also fails
|
|
84
|
+
* outside a project — an error may only offer an invocation it does not
|
|
85
|
+
* itself block.
|
|
86
|
+
*/
|
|
87
|
+
export function missingConfigMessage(where) {
|
|
88
|
+
return (`No ${PROJECT_CONFIG_DISPLAY_NAME} found in ${where} or any parent directory. ` +
|
|
89
|
+
`Primitive commands run inside a Primitive project: it is where the CLI reads ` +
|
|
90
|
+
`the environment, the app that environment names, and the configuration tree ` +
|
|
91
|
+
`from. Run 'primitive init' to create one.`);
|
|
92
|
+
}
|
|
43
93
|
export class PrimitiveEnvError extends Error {
|
|
44
94
|
kind;
|
|
45
95
|
path;
|
|
@@ -50,6 +100,99 @@ export class PrimitiveEnvError extends Error {
|
|
|
50
100
|
this.path = path;
|
|
51
101
|
}
|
|
52
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* The app's web counterpart as a normalized ORIGIN, or undefined when the
|
|
105
|
+
* value cannot be one (#2982).
|
|
106
|
+
*
|
|
107
|
+
* Unlike `appId`/`appName`, a typed read is not enough. This value is not
|
|
108
|
+
* merely carried: the Swift app points its emailed sign-in link at
|
|
109
|
+
* `<webUrl>/oauth/callback` and trusts incoming universal links from the same
|
|
110
|
+
* origin, and BOTH jobs need an origin —
|
|
111
|
+
*
|
|
112
|
+
* - https except loopback, the rule the server applies to every redirect URI
|
|
113
|
+
* (`src/auth/redirect-uri.ts`): an origin that cannot be allow-listed turns
|
|
114
|
+
* every sign-in request into a 400, and a plain-http link would carry the
|
|
115
|
+
* magic token in clear;
|
|
116
|
+
* - no path, query or fragment: the web client serves its callback on its own
|
|
117
|
+
* origin plus `/oauth/callback`, which is also the exact path the
|
|
118
|
+
* `apple-app-site-association` component claims;
|
|
119
|
+
* - no credentials, which have no business in a link that goes out by email.
|
|
120
|
+
*
|
|
121
|
+
* `primitive env add --web-url` and the project-config validation reject those
|
|
122
|
+
* shapes with a field-named error, but neither is on the path from a
|
|
123
|
+
* hand-edited `primitive/config.json` to an Xcode build: the Swift template's
|
|
124
|
+
* pre-build script reads the file directly. So every reader that feeds
|
|
125
|
+
* `primitive.json` applies the contract, and a value that misses it is read as
|
|
126
|
+
* "this environment has no web counterpart" — code-only email, no trusted
|
|
127
|
+
* origin, nothing silently pointed at the wrong URL.
|
|
128
|
+
*
|
|
129
|
+
* The message-producing twin of this rule lives in `cli/src/lib/web-url.ts`;
|
|
130
|
+
* this file cannot import it (see COPYABILITY above), and a test pins that the
|
|
131
|
+
* two agree.
|
|
132
|
+
*/
|
|
133
|
+
export function normalizeWebOrigin(value) {
|
|
134
|
+
if (typeof value !== "string")
|
|
135
|
+
return undefined;
|
|
136
|
+
const trimmed = value.trim();
|
|
137
|
+
if (!trimmed)
|
|
138
|
+
return undefined;
|
|
139
|
+
let url;
|
|
140
|
+
try {
|
|
141
|
+
url = new URL(trimmed);
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
if (url.protocol !== "https:" && url.protocol !== "http:")
|
|
147
|
+
return undefined;
|
|
148
|
+
if (url.protocol === "http:" &&
|
|
149
|
+
url.hostname !== "localhost" &&
|
|
150
|
+
url.hostname !== "127.0.0.1") {
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
if (url.username || url.password)
|
|
154
|
+
return undefined;
|
|
155
|
+
if (url.pathname !== "/" && url.pathname !== "")
|
|
156
|
+
return undefined;
|
|
157
|
+
if (url.search || url.hash)
|
|
158
|
+
return undefined;
|
|
159
|
+
return url.origin;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The one remedy for an environment that names no app (#3152), shared by every
|
|
163
|
+
* reader that can hit it: this core, the CLI's `validateProjectConfig`, the
|
|
164
|
+
* Swift template's pre-build script, and the Vue template's cf-deploy.
|
|
165
|
+
*
|
|
166
|
+
* Two constraints on the wording, both test-asserted:
|
|
167
|
+
*
|
|
168
|
+
* - it never says `primitive env add <name>`, which REFUSES an environment
|
|
169
|
+
* name that already exists — the shape this error is always about;
|
|
170
|
+
* - it names no command the failure itself blocks. The CLI validates the
|
|
171
|
+
* project config before any command parses, so every `primitive` command
|
|
172
|
+
* run inside the broken project fails with this same error. The only
|
|
173
|
+
* invocation it may offer is one it says out loud to run elsewhere.
|
|
174
|
+
*/
|
|
175
|
+
export function missingAppIdMessage(name, configPath) {
|
|
176
|
+
const where = configPath
|
|
177
|
+
? `${PROJECT_CONFIG_DISPLAY_NAME} (${configPath})`
|
|
178
|
+
: PROJECT_CONFIG_DISPLAY_NAME;
|
|
179
|
+
return (`Environment "${name}" in ${where} has no "appId". ` +
|
|
180
|
+
`Every environment names exactly one app — add "appId": "<app-id>" to that environment in ${PROJECT_CONFIG_DISPLAY_NAME}. ` +
|
|
181
|
+
`Find the app id in the Primitive admin UI, with 'primitive apps list' run from another Primitive project, ` +
|
|
182
|
+
`or as the residual "currentAppId" in .primitive/credentials.json if this environment was ever pointed at an app by the retired per-machine app selection.`);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* An environment's `appId` as a usable string, or undefined when the value
|
|
186
|
+
* cannot be one. Non-string and blank-after-trim are both "no app named": a
|
|
187
|
+
* numeric or whitespace appId reaches a consumer as an app id it cannot use,
|
|
188
|
+
* which is the silent version of the failure this field exists to prevent.
|
|
189
|
+
*/
|
|
190
|
+
function readAppId(value) {
|
|
191
|
+
if (typeof value !== "string")
|
|
192
|
+
return undefined;
|
|
193
|
+
const trimmed = value.trim();
|
|
194
|
+
return trimmed || undefined;
|
|
195
|
+
}
|
|
53
196
|
/**
|
|
54
197
|
* Derives the WebSocket URL from the API URL. Every apiUrl/wsUrl pair in
|
|
55
198
|
* practice is the same host with the scheme swapped, so it is derived rather
|
|
@@ -63,21 +206,43 @@ export function deriveWsUrl(apiUrl) {
|
|
|
63
206
|
return apiUrl;
|
|
64
207
|
}
|
|
65
208
|
/**
|
|
66
|
-
* Finds
|
|
209
|
+
* Finds `primitive/config.json` by walking up from `cwd`, or returns the
|
|
67
210
|
* PRIMITIVE_PROJECT_CONFIG override when it is set (and exists).
|
|
211
|
+
*
|
|
212
|
+
* The override is checked for provenance BEFORE the file is read (#3153, F2):
|
|
213
|
+
* it bypasses the walk, so without this an old-layout config could be handed
|
|
214
|
+
* straight to a reader and defeat the cutover. An override that points inside
|
|
215
|
+
* a `.primitive/` directory IS the old layout, named explicitly.
|
|
216
|
+
*
|
|
217
|
+
* This is the one function every reader goes through — `resolvePrimitiveEnv`
|
|
218
|
+
* and the CLI's own `loadProjectConfig`/`findProjectRoot` alike — so the
|
|
219
|
+
* unmigrated-project refusal lives HERE, in the walk, or the commands that
|
|
220
|
+
* never call `resolvePrimitiveEnv` would walk past the old anchor into the
|
|
221
|
+
* parent directory's project.
|
|
68
222
|
*/
|
|
69
223
|
export function findPrimitiveConfigPath(options = {}) {
|
|
70
224
|
const env = options.env ?? process.env;
|
|
71
225
|
const override = env.PRIMITIVE_PROJECT_CONFIG;
|
|
72
226
|
if (override) {
|
|
73
227
|
const forced = resolve(override);
|
|
228
|
+
if (basename(dirname(forced)) === PROJECT_LOCAL_STATE_DIR) {
|
|
229
|
+
throw new PrimitiveEnvError("stale-layout", unmigratedProjectMessage(forced, join(dirname(dirname(forced)), PROJECT_TREE_DIR, PROJECT_CONFIG_FILENAME)), forced);
|
|
230
|
+
}
|
|
74
231
|
return existsSync(forced) ? forced : null;
|
|
75
232
|
}
|
|
76
233
|
let current = resolve(options.cwd ?? process.cwd());
|
|
77
234
|
while (true) {
|
|
78
|
-
const candidate = join(current,
|
|
235
|
+
const candidate = join(current, PROJECT_TREE_DIR, PROJECT_CONFIG_FILENAME);
|
|
79
236
|
if (existsSync(candidate))
|
|
80
237
|
return candidate;
|
|
238
|
+
// No anchor here. The old one means this directory IS a project — one
|
|
239
|
+
// that never migrated — and the walk stops rather than resolving whatever
|
|
240
|
+
// project the parent turns out to be (#3392). Checked only when the new
|
|
241
|
+
// anchor is absent: beside a migrated tree the old file is a leftover.
|
|
242
|
+
const unmigrated = join(current, PROJECT_LOCAL_STATE_DIR, PROJECT_CONFIG_FILENAME);
|
|
243
|
+
if (existsSync(unmigrated)) {
|
|
244
|
+
throw new PrimitiveEnvError("stale-layout", unmigratedProjectMessage(unmigrated, candidate), unmigrated);
|
|
245
|
+
}
|
|
81
246
|
const parent = dirname(current);
|
|
82
247
|
if (parent === current)
|
|
83
248
|
return null;
|
|
@@ -85,43 +250,52 @@ export function findPrimitiveConfigPath(options = {}) {
|
|
|
85
250
|
}
|
|
86
251
|
}
|
|
87
252
|
/**
|
|
88
|
-
* The project root for a config path: the parent of
|
|
253
|
+
* The project root for a config path: the parent of `primitive/`, or the
|
|
89
254
|
* containing directory when the config was pointed at directly (a fixture via
|
|
90
|
-
* PRIMITIVE_PROJECT_CONFIG, which is not inside a
|
|
255
|
+
* PRIMITIVE_PROJECT_CONFIG, which is not inside a `primitive/` directory).
|
|
91
256
|
*/
|
|
92
257
|
export function projectRootForConfigPath(configPath) {
|
|
93
258
|
const dir = dirname(configPath);
|
|
94
|
-
return basename(dir) ===
|
|
259
|
+
return basename(dir) === PROJECT_TREE_DIR ? dirname(dir) : dir;
|
|
95
260
|
}
|
|
96
261
|
/**
|
|
97
|
-
*
|
|
98
|
-
* config
|
|
262
|
+
* Machine-local state lives under the project root's `.primitive/`, not beside
|
|
263
|
+
* the config — the config is committed now, and the two must not share a
|
|
264
|
+
* directory. A fixture-pointed bare config still gets its own `.primitive/`
|
|
265
|
+
* in its own directory, so it never picks up a real project's selection.
|
|
99
266
|
*/
|
|
100
267
|
export function localStatePathForConfigPath(configPath) {
|
|
101
|
-
return join(
|
|
268
|
+
return join(projectRootForConfigPath(configPath), PROJECT_LOCAL_STATE_DIR, LOCAL_STATE_FILENAME);
|
|
102
269
|
}
|
|
103
270
|
/**
|
|
104
|
-
*
|
|
271
|
+
* The message of a caught value. A catch binding is `unknown` under the
|
|
272
|
+
* strict config primitive-app compiles this copy with, so narrow first.
|
|
273
|
+
*/
|
|
274
|
+
function errorMessage(err) {
|
|
275
|
+
return err instanceof Error ? err.message : String(err);
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Reads and structurally validates `primitive/config.json`. Throws rather
|
|
105
279
|
* than guessing: a config that cannot be understood is always louder than a
|
|
106
280
|
* silent fallback to the wrong backend.
|
|
107
281
|
*/
|
|
108
282
|
export function readCoreProjectConfig(configPath) {
|
|
109
283
|
if (!existsSync(configPath)) {
|
|
110
|
-
throw new PrimitiveEnvError("missing-config",
|
|
284
|
+
throw new PrimitiveEnvError("missing-config", missingConfigMessage(dirname(configPath)), configPath);
|
|
111
285
|
}
|
|
112
286
|
let raw;
|
|
113
287
|
try {
|
|
114
288
|
raw = readFileSync(configPath, "utf-8");
|
|
115
289
|
}
|
|
116
290
|
catch (err) {
|
|
117
|
-
throw new PrimitiveEnvError("malformed-config", `Failed to read ${PROJECT_CONFIG_DISPLAY_NAME} (${configPath}): ${err
|
|
291
|
+
throw new PrimitiveEnvError("malformed-config", `Failed to read ${PROJECT_CONFIG_DISPLAY_NAME} (${configPath}): ${errorMessage(err)}`, configPath);
|
|
118
292
|
}
|
|
119
293
|
let parsed;
|
|
120
294
|
try {
|
|
121
295
|
parsed = JSON.parse(raw);
|
|
122
296
|
}
|
|
123
297
|
catch (err) {
|
|
124
|
-
throw new PrimitiveEnvError("malformed-config", `Failed to parse ${PROJECT_CONFIG_DISPLAY_NAME} (${configPath}): ${err
|
|
298
|
+
throw new PrimitiveEnvError("malformed-config", `Failed to parse ${PROJECT_CONFIG_DISPLAY_NAME} (${configPath}): ${errorMessage(err)}`, configPath);
|
|
125
299
|
}
|
|
126
300
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
127
301
|
throw new PrimitiveEnvError("malformed-config", `${PROJECT_CONFIG_DISPLAY_NAME} (${configPath}) must contain a JSON object at the top level.`, configPath);
|
|
@@ -145,10 +319,19 @@ export function readCoreProjectConfig(configPath) {
|
|
|
145
319
|
if (typeof e.apiUrl !== "string" || !e.apiUrl) {
|
|
146
320
|
throw new PrimitiveEnvError("malformed-config", `Environment "${name}" must have a non-empty "apiUrl" string in ${PROJECT_CONFIG_DISPLAY_NAME} (${configPath}).`, configPath);
|
|
147
321
|
}
|
|
322
|
+
// Every environment names one app, checked here rather than after the
|
|
323
|
+
// selection: the criterion is about the FILE, and a second reader (the
|
|
324
|
+
// Vite plugin, cf-deploy, the Swift pre-build script) may land on a
|
|
325
|
+
// different environment than the CLI did.
|
|
326
|
+
const appId = readAppId(e.appId);
|
|
327
|
+
if (!appId) {
|
|
328
|
+
throw new PrimitiveEnvError("missing-app-id", missingAppIdMessage(name, configPath), configPath);
|
|
329
|
+
}
|
|
148
330
|
environments[name] = {
|
|
149
331
|
apiUrl: e.apiUrl.replace(/\/$/, ""),
|
|
150
|
-
appId
|
|
332
|
+
appId,
|
|
151
333
|
appName: typeof e.appName === "string" ? e.appName : undefined,
|
|
334
|
+
webUrl: normalizeWebOrigin(e.webUrl),
|
|
152
335
|
description: typeof e.description === "string" ? e.description : undefined,
|
|
153
336
|
};
|
|
154
337
|
}
|
|
@@ -177,7 +360,7 @@ export function readLocalSelection(configPath) {
|
|
|
177
360
|
parsed = JSON.parse(readFileSync(path, "utf-8"));
|
|
178
361
|
}
|
|
179
362
|
catch (err) {
|
|
180
|
-
return corrupt(err
|
|
363
|
+
return corrupt(errorMessage(err));
|
|
181
364
|
}
|
|
182
365
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
183
366
|
return corrupt("expected a JSON object");
|
|
@@ -236,8 +419,9 @@ export function resolvePrimitiveEnv(options = {}) {
|
|
|
236
419
|
const env = options.env ?? process.env;
|
|
237
420
|
const configPath = options.configPath ?? findPrimitiveConfigPath({ cwd: options.cwd, env });
|
|
238
421
|
if (!configPath) {
|
|
239
|
-
throw new PrimitiveEnvError("missing-config",
|
|
422
|
+
throw new PrimitiveEnvError("missing-config", missingConfigMessage(options.cwd ?? process.cwd()));
|
|
240
423
|
}
|
|
424
|
+
const projectRoot = projectRootForConfigPath(configPath);
|
|
241
425
|
const config = readCoreProjectConfig(configPath);
|
|
242
426
|
const { name, source } = selectEnvironmentName(config, {
|
|
243
427
|
explicitEnvName: options.explicitEnvName || null,
|
|
@@ -246,20 +430,18 @@ export function resolvePrimitiveEnv(options = {}) {
|
|
|
246
430
|
configPath,
|
|
247
431
|
});
|
|
248
432
|
const entry = config.environments[name];
|
|
249
|
-
if (options.requireAppId && !entry.appId) {
|
|
250
|
-
throw new PrimitiveEnvError("missing-app-id", `Environment "${name}" in ${PROJECT_CONFIG_DISPLAY_NAME} (${configPath}) has no "appId", which this build needs. Add one with 'primitive env add ${name} --api-url ${entry.apiUrl} --app-id <id>' or edit the config.`, configPath);
|
|
251
|
-
}
|
|
252
433
|
return {
|
|
253
434
|
name,
|
|
254
435
|
apiUrl: entry.apiUrl,
|
|
255
436
|
wsUrl: deriveWsUrl(entry.apiUrl),
|
|
256
437
|
appId: entry.appId,
|
|
257
438
|
appName: entry.appName,
|
|
439
|
+
webUrl: entry.webUrl,
|
|
258
440
|
description: entry.description,
|
|
259
441
|
source,
|
|
260
442
|
configPath,
|
|
261
443
|
localStatePath: localStatePathForConfigPath(configPath),
|
|
262
|
-
projectRoot
|
|
444
|
+
projectRoot,
|
|
263
445
|
};
|
|
264
446
|
}
|
|
265
447
|
//# sourceMappingURL=env-resolver-core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-resolver-core.js","sourceRoot":"","sources":["../../../src/lib/env-resolver-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7D,wEAAwE;AACxE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAC1C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAC/C,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAC;AACrD,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC;AACjD,MAAM,CAAC,MAAM,2BAA2B,GAAG,wBAAwB,CAAC;AACpE,MAAM,CAAC,MAAM,wBAAwB,GAAG,uBAAuB,CAAC;AAehE,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACjC,IAAI,CAAwB;IAC5B,IAAI,CAAU;IAEvB,YAAY,IAA2B,EAAE,OAAe,EAAE,IAAa;QACrE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAgDD;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,IAAI,MA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E,IAAI,EAAE,MAAM,EAAE,GAAG,qBAAqB,CAAC,MAAM,EAAE;QACrD,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,IAAI;QAChD,UAAU,EAAE,GAAG,CAAC,aAAa,IAAI,IAAI;QACrC,cAAc,EAAE,kBAAkB,CAAC,UAAU,CAAC;QAC9C,UAAU;KACX,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAExC,OAAO;QACL,IAAI;QACJ,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC;QAChC,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,MAAM;QACN,UAAU;QACV,cAAc,EAAE,2BAA2B,CAAC,UAAU,CAAC;QACvD,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -29,7 +29,7 @@ export interface ResolvedEnvironment {
|
|
|
29
29
|
name: string;
|
|
30
30
|
/** The config entry for this environment. */
|
|
31
31
|
config: ProjectEnvironment;
|
|
32
|
-
/** Absolute path to
|
|
32
|
+
/** Absolute path to primitive/config.json. */
|
|
33
33
|
projectConfigPath: string;
|
|
34
34
|
/** Absolute path to the project root (the parent of .primitive/). */
|
|
35
35
|
projectRoot: string;
|
|
@@ -49,7 +49,7 @@ export declare function setCurrentEnvName(name: string | null): void;
|
|
|
49
49
|
export declare function resetEnvResolver(): void;
|
|
50
50
|
/**
|
|
51
51
|
* Loads and caches the project config. Returns null if no
|
|
52
|
-
*
|
|
52
|
+
* primitive/config.json is present. Throws ProjectConfigError on a broken config.
|
|
53
53
|
*/
|
|
54
54
|
export declare function getProjectConfig(): ProjectConfig | null;
|
|
55
55
|
/**
|
|
@@ -63,13 +63,28 @@ export declare function getLocalSelection(): string | null;
|
|
|
63
63
|
export declare function getLocalStatePath(): string | null;
|
|
64
64
|
/**
|
|
65
65
|
* Resolves the current environment, or returns null if we're running in
|
|
66
|
-
* legacy mode (no
|
|
66
|
+
* legacy mode (no primitive/config.json present).
|
|
67
67
|
*
|
|
68
68
|
* This never throws for a missing project config — that's legitimate
|
|
69
69
|
* "legacy mode" usage. It DOES throw if the project config exists but the
|
|
70
70
|
* requested environment doesn't.
|
|
71
71
|
*/
|
|
72
72
|
export declare function getCurrentEnvironment(): ResolvedEnvironment | null;
|
|
73
|
+
/**
|
|
74
|
+
* The resolved environment, or the one refusal (#3154, intent criterion 5).
|
|
75
|
+
*
|
|
76
|
+
* `getCurrentEnvironment()` answers `null` outside a project, which used to
|
|
77
|
+
* mean "legacy mode — fall back to `./config` and `~/.primitive/`". There is
|
|
78
|
+
* no such mode any more: the environment is the ONLY thing that names the
|
|
79
|
+
* configuration tree, the app and the server, so a caller that needs one asks
|
|
80
|
+
* here and gets an error naming what is missing instead of a second answer.
|
|
81
|
+
*
|
|
82
|
+
* Everything else propagates untouched. `no-selection`, `unknown-environment`,
|
|
83
|
+
* `corrupt-local-state` and `stale-layout` are real answers about a real
|
|
84
|
+
* project, and the old `safeEnv()` swallowing them is exactly how a typo in
|
|
85
|
+
* `--env` used to end up writing into `./config`.
|
|
86
|
+
*/
|
|
87
|
+
export declare function requireCurrentEnvironment(): ResolvedEnvironment;
|
|
73
88
|
/**
|
|
74
89
|
* Returns the current environment name for display purposes (e.g. in status
|
|
75
90
|
* headers). Returns null in legacy mode. Swallows resolution errors so the
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* The resolution is cached for the lifetime of the process.
|
|
24
24
|
*/
|
|
25
25
|
import { loadProjectConfig, findProjectConfigPath, findProjectRoot, } from "./project-config.js";
|
|
26
|
-
import { PrimitiveEnvError, localStatePathForConfigPath, readLocalSelection, selectEnvironmentName, } from "./env-resolver-core.js";
|
|
26
|
+
import { PrimitiveEnvError, localStatePathForConfigPath, missingConfigMessage, readLocalSelection, selectEnvironmentName, } from "./env-resolver-core.js";
|
|
27
27
|
/** Process-lifetime cache for resolution results. */
|
|
28
28
|
let cachedResolution;
|
|
29
29
|
let explicitEnvName = null;
|
|
@@ -49,7 +49,7 @@ export function resetEnvResolver() {
|
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Loads and caches the project config. Returns null if no
|
|
52
|
-
*
|
|
52
|
+
* primitive/config.json is present. Throws ProjectConfigError on a broken config.
|
|
53
53
|
*/
|
|
54
54
|
export function getProjectConfig() {
|
|
55
55
|
if (cachedProjectConfig === undefined) {
|
|
@@ -76,7 +76,7 @@ export function getLocalStatePath() {
|
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* Resolves the current environment, or returns null if we're running in
|
|
79
|
-
* legacy mode (no
|
|
79
|
+
* legacy mode (no primitive/config.json present).
|
|
80
80
|
*
|
|
81
81
|
* This never throws for a missing project config — that's legitimate
|
|
82
82
|
* "legacy mode" usage. It DOES throw if the project config exists but the
|
|
@@ -109,6 +109,26 @@ export function getCurrentEnvironment() {
|
|
|
109
109
|
};
|
|
110
110
|
return cachedResolution;
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* The resolved environment, or the one refusal (#3154, intent criterion 5).
|
|
114
|
+
*
|
|
115
|
+
* `getCurrentEnvironment()` answers `null` outside a project, which used to
|
|
116
|
+
* mean "legacy mode — fall back to `./config` and `~/.primitive/`". There is
|
|
117
|
+
* no such mode any more: the environment is the ONLY thing that names the
|
|
118
|
+
* configuration tree, the app and the server, so a caller that needs one asks
|
|
119
|
+
* here and gets an error naming what is missing instead of a second answer.
|
|
120
|
+
*
|
|
121
|
+
* Everything else propagates untouched. `no-selection`, `unknown-environment`,
|
|
122
|
+
* `corrupt-local-state` and `stale-layout` are real answers about a real
|
|
123
|
+
* project, and the old `safeEnv()` swallowing them is exactly how a typo in
|
|
124
|
+
* `--env` used to end up writing into `./config`.
|
|
125
|
+
*/
|
|
126
|
+
export function requireCurrentEnvironment() {
|
|
127
|
+
const env = getCurrentEnvironment();
|
|
128
|
+
if (env)
|
|
129
|
+
return env;
|
|
130
|
+
throw new PrimitiveEnvError("missing-config", missingConfigMessage(process.cwd()));
|
|
131
|
+
}
|
|
112
132
|
/**
|
|
113
133
|
* Returns the current environment name for display purposes (e.g. in status
|
|
114
134
|
* headers). Returns null in legacy mode. Swallows resolution errors so the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-resolver.js","sourceRoot":"","sources":["../../../src/lib/env-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,GAGhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,EAClB,qBAAqB,GAEtB,MAAM,wBAAwB,CAAC;AAehC,qDAAqD;AACrD,IAAI,gBAAwD,CAAC;AAC7D,IAAI,eAAe,GAAkB,IAAI,CAAC;AAC1C,IAAI,mBAAqD,CAAC;AAE1D;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAmB;IACnD,eAAe,GAAG,IAAI,CAAC;IACvB,uEAAuE;IACvE,6BAA6B;IAC7B,gBAAgB,GAAG,SAAS,CAAC;AAC/B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,gBAAgB,GAAG,SAAS,CAAC;IAC7B,mBAAmB,GAAG,SAAS,CAAC;AAClC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,IAAI,mBAAmB,KAAK,SAAS,EAAE,CAAC;QACtC,mBAAmB,GAAG,iBAAiB,EAAE,CAAC;IAC5C,CAAC;IACD,OAAO,mBAAmB,IAAI,IAAI,CAAC;AACrC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,UAAU,GAAG,qBAAqB,E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;;;;GAIG;AACH,MAAM,UAAU,qBAAqB;IACnC,IAAI,CAAC;QACH,OAAO,qBAAqB,EAAE,EAAE,IAAI,IAAI,IAAI,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Building a server function's bundle, in the CLI (#3179, project
|
|
3
|
+
* `server-functions`).
|
|
4
|
+
*
|
|
5
|
+
* The intent decides that the build happens here and never on the server:
|
|
6
|
+
* `config push` runs esbuild over the authored `entry`, inlines the npm
|
|
7
|
+
* dependencies, and ships the built bundle next to the authored source bytes
|
|
8
|
+
* in one envelope. The server verifies the hash and stores the object; it does
|
|
9
|
+
* not compile anything.
|
|
10
|
+
*
|
|
11
|
+
* ── The two import rules ─────────────────────────────────────────────────
|
|
12
|
+
*
|
|
13
|
+
* They look contradictory and are not (F-005):
|
|
14
|
+
*
|
|
15
|
+
* - A **filesystem import** — relative or absolute — must stay inside the
|
|
16
|
+
* config tree. `entry`, every import it reaches, and every symlink they
|
|
17
|
+
* traverse are realpath-resolved and checked against the tree root, so a
|
|
18
|
+
* push can never read a file off a developer's disk that the tree does not
|
|
19
|
+
* contain.
|
|
20
|
+
* - A **bare package specifier** is exempt. It resolves through Node into an
|
|
21
|
+
* ancestor `node_modules`, which is outside every config tree by
|
|
22
|
+
* construction; esbuild inlines it into the bundle, and it is never
|
|
23
|
+
* captured as an authored source (so `config pull` never writes
|
|
24
|
+
* `node_modules` content back).
|
|
25
|
+
*
|
|
26
|
+
* The exemption follows the specifier, not the path a file happens to sit at.
|
|
27
|
+
* A resolver plugin records the files a BARE specifier reached (and the files
|
|
28
|
+
* those reach in turn), so `import "../../node_modules/private/index.js"` — a
|
|
29
|
+
* relative filesystem import that merely lands in a `node_modules` directory —
|
|
30
|
+
* is still an escape and still refused. Deciding by path would have let that
|
|
31
|
+
* one specifier read any file on the disk and upload it.
|
|
32
|
+
*
|
|
33
|
+
* `primitive-functions` is the one bare specifier left EXTERNAL: the loader
|
|
34
|
+
* (#3180) supplies it at invoke time, so baking a copy into every bundle would
|
|
35
|
+
* pin the SDK version to whenever the function was last pushed.
|
|
36
|
+
*
|
|
37
|
+
* ── The retired specifier ────────────────────────────────────────────────
|
|
38
|
+
*
|
|
39
|
+
* That module was called `primitive-sdk` until #3209. This file is the one
|
|
40
|
+
* place in the repo that still writes the old name on purpose: without a
|
|
41
|
+
* detector, an author who copied an older example gets esbuild's generic
|
|
42
|
+
* `Could not resolve "primitive-sdk"`, which reads as a missing dependency
|
|
43
|
+
* rather than a rename. `RETIRED_SDK_MODULE` below is that detector, and
|
|
44
|
+
* `cli/tests/unit/retired-sdk-name-guard-3209.test.ts` allowlists exactly this
|
|
45
|
+
* site while proving the name appears nowhere else.
|
|
46
|
+
*
|
|
47
|
+
* The refusal is made TWICE, because one mechanism cannot see both halves:
|
|
48
|
+
*
|
|
49
|
+
* - the resolver plugin catches a runtime import, which is the one that
|
|
50
|
+
* would otherwise reach the loader and fail there;
|
|
51
|
+
* - a scan of the authored source catches the TYPE-ONLY spellings —
|
|
52
|
+
* `import type … from`, `export type … from`, and a plain named import
|
|
53
|
+
* used only in type position. TypeScript erases all three, and esbuild
|
|
54
|
+
* erases them before any resolver callback runs, so the plugin never sees
|
|
55
|
+
* a specifier to compare. Those imports build and push silently, leaving
|
|
56
|
+
* the stored source teaching an import that no longer exists.
|
|
57
|
+
*
|
|
58
|
+
* The scan is anchored at the start of a line so that prose about the retired
|
|
59
|
+
* name — a `//` comment, a `*` doc-comment line, a string holding an example —
|
|
60
|
+
* does not refuse a push. Missing an import someone hid mid-line is the safe
|
|
61
|
+
* direction to be wrong in; refusing a valid push is not.
|
|
62
|
+
*
|
|
63
|
+
* ── The canonical envelope encoding ──────────────────────────────────────
|
|
64
|
+
*
|
|
65
|
+
* `canonicalFunctionEnvelopeBytes` reproduces `canonicalEnvelopeBytes` in
|
|
66
|
+
* `src/services/function-bundle-storage.ts` byte for byte. The server hashes
|
|
67
|
+
* the envelope to decide whether a push is a no-op; the CLI hashes it to decide
|
|
68
|
+
* whether to make the call at all, and the two answers have to agree or a push
|
|
69
|
+
* the CLI called unchanged lands as a new version (or worse, the reverse).
|
|
70
|
+
* `cli/tests/unit/function-bundle-3179.test.ts` pins them against each other.
|
|
71
|
+
*/
|
|
72
|
+
/** The module the loader supplies; never bundled. */
|
|
73
|
+
export declare const PRIMITIVE_FUNCTIONS_MODULE = "primitive-functions";
|
|
74
|
+
/** What that module was called before #3209. Refused at push, by name. */
|
|
75
|
+
export declare const RETIRED_SDK_MODULE = "primitive-sdk";
|
|
76
|
+
/** Whether an authored source imports the retired module in any spelling. */
|
|
77
|
+
export declare function importsRetiredModule(source: string): boolean;
|
|
78
|
+
/** Matches the server's `FUNCTION_ENVELOPE_SCHEMA_VERSION`. */
|
|
79
|
+
/**
|
|
80
|
+
* 2 since #3187: the envelope carries the collected query MANIFEST.
|
|
81
|
+
*
|
|
82
|
+
* Bumped rather than added quietly, because the encoding the hash is taken
|
|
83
|
+
* over changed: the manifest is part of config-version identity (D3187-SO-005)
|
|
84
|
+
* precisely so a manifest change makes a new version and a collector fix can
|
|
85
|
+
* reach a tree that was pushed before it.
|
|
86
|
+
*/
|
|
87
|
+
export declare const FUNCTION_ENVELOPE_SCHEMA_VERSION = 2;
|
|
88
|
+
/** A push that cannot proceed: a missing entry, a build error, or an escape. */
|
|
89
|
+
export declare class FunctionBuildError extends Error {
|
|
90
|
+
constructor(message: string);
|
|
91
|
+
}
|
|
92
|
+
export interface FunctionSourceFile {
|
|
93
|
+
/** Tree-relative, POSIX-separated — the path stored in the envelope. */
|
|
94
|
+
path: string;
|
|
95
|
+
/** The authored bytes, untouched. */
|
|
96
|
+
content: Buffer;
|
|
97
|
+
}
|
|
98
|
+
export interface BuiltFunctionBundle {
|
|
99
|
+
/** The entry, normalized tree-relative. */
|
|
100
|
+
entry: string;
|
|
101
|
+
/** The built bundle. */
|
|
102
|
+
bundle: Buffer;
|
|
103
|
+
/** sha256 of the bundle — what a durable run pins its code by. */
|
|
104
|
+
contentHash: string;
|
|
105
|
+
/** Every authored file the build read, sorted by path. */
|
|
106
|
+
sources: FunctionSourceFile[];
|
|
107
|
+
}
|
|
108
|
+
export interface EnvelopeShape {
|
|
109
|
+
schemaVersion: number;
|
|
110
|
+
entry: string;
|
|
111
|
+
toml: string;
|
|
112
|
+
sources: Array<{
|
|
113
|
+
path: string;
|
|
114
|
+
content: string;
|
|
115
|
+
}>;
|
|
116
|
+
bundle: string;
|
|
117
|
+
/** base64 of the collected manifest JSON, or null when there is none. */
|
|
118
|
+
manifest?: string | null;
|
|
119
|
+
/**
|
|
120
|
+
* base64 of the project's authored `models/models.toml` bytes, or absent
|
|
121
|
+
* when the project declares no document schema (#3455). Must stay identical
|
|
122
|
+
* to the server's `FunctionEnvelope.documentSchema`.
|
|
123
|
+
*/
|
|
124
|
+
documentSchema?: string | null;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The canonical encoding both sides hash. Fixed key order, sources sorted by
|
|
128
|
+
* path — see the module note; this must stay identical to the server's.
|
|
129
|
+
*/
|
|
130
|
+
export declare function canonicalFunctionEnvelopeBytes(envelope: EnvelopeShape): Uint8Array;
|
|
131
|
+
export declare function functionEnvelopeHash(envelope: EnvelopeShape): string;
|
|
132
|
+
/** Whether a tree-relative path names a `node_modules` file. */
|
|
133
|
+
export declare function isDependencyPath(path: string): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Build one function's bundle and collect its authored sources.
|
|
136
|
+
*
|
|
137
|
+
* Throws `FunctionBuildError` — never a raw esbuild error — so `config push`
|
|
138
|
+
* has one thing to report and nothing is pushed for that function.
|
|
139
|
+
*/
|
|
140
|
+
export declare function buildFunctionBundle(options: {
|
|
141
|
+
/** The config tree root (`.primitive/` or the configured dir). */
|
|
142
|
+
configDir: string;
|
|
143
|
+
/** `entry` as authored in the TOML, relative to the config tree root. */
|
|
144
|
+
entry: string;
|
|
145
|
+
/** Only for the message; the key is not part of the build. */
|
|
146
|
+
functionKey: string;
|
|
147
|
+
}): Promise<BuiltFunctionBundle>;
|