primitive-admin 1.2.0-alpha.14 → 1.2.0-alpha.16
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 +181 -73
- package/assets/skill/skills/primitive-platform/SKILL.md +87 -23
- package/dist/bin/primitive.js +11 -82
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/admins.js +80 -17
- package/dist/src/commands/admins.js.map +1 -1
- package/dist/src/commands/agent-sessions.js +2 -0
- package/dist/src/commands/agent-sessions.js.map +1 -1
- package/dist/src/commands/analytics.js +181 -12
- package/dist/src/commands/analytics.js.map +1 -1
- package/dist/src/commands/apps-children.js +2 -0
- package/dist/src/commands/apps-children.js.map +1 -1
- package/dist/src/commands/apps-transitions.d.ts +39 -0
- package/dist/src/commands/apps-transitions.js +198 -0
- package/dist/src/commands/apps-transitions.js.map +1 -0
- package/dist/src/commands/apps.d.ts +11 -0
- package/dist/src/commands/apps.js +65 -3
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth-sessions.js +2 -0
- package/dist/src/commands/auth-sessions.js.map +1 -1
- package/dist/src/commands/auth.js +16 -1
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.js +2 -0
- package/dist/src/commands/blob-buckets.js.map +1 -1
- package/dist/src/commands/collections.js +2 -0
- package/dist/src/commands/collections.js.map +1 -1
- package/dist/src/commands/comparisons.js +2 -0
- package/dist/src/commands/comparisons.js.map +1 -1
- package/dist/src/commands/config.d.ts +1 -1
- package/dist/src/commands/config.js +42 -9
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/connections.js +2 -0
- package/dist/src/commands/connections.js.map +1 -1
- package/dist/src/commands/database-type-configs.js +5 -3
- package/dist/src/commands/database-type-configs.js.map +1 -1
- package/dist/src/commands/databases.js +6 -4
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/db3-types.js +2 -0
- package/dist/src/commands/db3-types.js.map +1 -1
- package/dist/src/commands/db3.d.ts +12 -0
- package/dist/src/commands/db3.js +408 -31
- package/dist/src/commands/db3.js.map +1 -1
- package/dist/src/commands/documents.d.ts +52 -12
- package/dist/src/commands/documents.js +120 -29
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/email-templates.js +74 -0
- package/dist/src/commands/email-templates.js.map +1 -1
- package/dist/src/commands/env.js +2 -0
- package/dist/src/commands/env.js.map +1 -1
- package/dist/src/commands/functions.js +90 -11
- package/dist/src/commands/functions.js.map +1 -1
- package/dist/src/commands/groups.js +20 -3
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.js +2 -0
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/hosting.d.ts +8 -0
- package/dist/src/commands/hosting.js +346 -0
- package/dist/src/commands/hosting.js.map +1 -0
- package/dist/src/commands/init.js +9 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.js +82 -47
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/locks.js +2 -0
- package/dist/src/commands/locks.js.map +1 -1
- package/dist/src/commands/metadata-category-configs.js +2 -0
- package/dist/src/commands/metadata-category-configs.js.map +1 -1
- package/dist/src/commands/metadata.js +41 -0
- package/dist/src/commands/metadata.js.map +1 -1
- package/dist/src/commands/prompts.js +75 -47
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rate-counters.d.ts +19 -0
- package/dist/src/commands/rate-counters.js +104 -0
- package/dist/src/commands/rate-counters.js.map +1 -0
- package/dist/src/commands/rule-sets.js +2 -0
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/schemas.d.ts +15 -0
- package/dist/src/commands/schemas.js +122 -0
- package/dist/src/commands/schemas.js.map +1 -0
- package/dist/src/commands/secrets.js +47 -3
- package/dist/src/commands/secrets.js.map +1 -1
- package/dist/src/commands/sessions.js +2 -0
- package/dist/src/commands/sessions.js.map +1 -1
- package/dist/src/commands/skill.js +2 -0
- package/dist/src/commands/skill.js.map +1 -1
- package/dist/src/commands/sync-schemas.d.ts +202 -0
- package/dist/src/commands/sync-schemas.js +629 -0
- package/dist/src/commands/sync-schemas.js.map +1 -0
- package/dist/src/commands/sync-user-properties.d.ts +118 -0
- package/dist/src/commands/sync-user-properties.js +276 -0
- package/dist/src/commands/sync-user-properties.js.map +1 -0
- package/dist/src/commands/sync.d.ts +344 -14
- package/dist/src/commands/sync.js +1834 -345
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/tokens.js +2 -0
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/transitions.d.ts +54 -0
- package/dist/src/commands/transitions.js +418 -0
- package/dist/src/commands/transitions.js.map +1 -0
- package/dist/src/commands/usage.d.ts +18 -0
- package/dist/src/commands/usage.js +343 -0
- package/dist/src/commands/usage.js.map +1 -0
- package/dist/src/commands/user-properties.d.ts +14 -0
- package/dist/src/commands/user-properties.js +79 -0
- package/dist/src/commands/user-properties.js.map +1 -0
- package/dist/src/commands/users.js +878 -16
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/vars.js +2 -0
- package/dist/src/commands/vars.js.map +1 -1
- package/dist/src/commands/waitlist.js +39 -4
- package/dist/src/commands/waitlist.js.map +1 -1
- package/dist/src/lib/analytics-query.d.ts +58 -0
- package/dist/src/lib/analytics-query.js +134 -0
- package/dist/src/lib/analytics-query.js.map +1 -0
- package/dist/src/lib/api-client.d.ts +1354 -97
- package/dist/src/lib/api-client.js +513 -164
- 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 +6 -0
- package/dist/src/lib/app-settings-descriptor.js.map +1 -1
- package/dist/src/lib/auth-flow.d.ts +33 -0
- package/dist/src/lib/auth-flow.js +404 -13
- package/dist/src/lib/auth-flow.js.map +1 -1
- package/dist/src/lib/block-selector.d.ts +9 -15
- package/dist/src/lib/block-selector.js +9 -20
- package/dist/src/lib/block-selector.js.map +1 -1
- package/dist/src/lib/cli-manifest.d.ts +9 -0
- package/dist/src/lib/cli-manifest.js +10 -1
- package/dist/src/lib/cli-manifest.js.map +1 -1
- package/dist/src/lib/cli-version.d.ts +14 -0
- package/dist/src/lib/cli-version.js +38 -0
- package/dist/src/lib/cli-version.js.map +1 -0
- package/dist/src/lib/codegen-shared/prettierStable.d.ts +41 -0
- package/dist/src/lib/codegen-shared/prettierStable.js +146 -24
- package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -1
- package/dist/src/lib/command-groups.d.ts +30 -0
- package/dist/src/lib/command-groups.js +109 -0
- package/dist/src/lib/command-groups.js.map +1 -0
- package/dist/src/lib/command-status.d.ts +147 -0
- package/dist/src/lib/command-status.js +266 -0
- package/dist/src/lib/command-status.js.map +1 -0
- package/dist/src/lib/config-object-descriptor.d.ts +6 -0
- package/dist/src/lib/config-object-descriptor.js +71 -1
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/config-toml.d.ts +11 -2
- package/dist/src/lib/config-toml.js +25 -2
- package/dist/src/lib/config-toml.js.map +1 -1
- package/dist/src/lib/data-input.d.ts +1 -1
- package/dist/src/lib/data-input.js +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.js +3 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +18 -1
- package/dist/src/lib/db-codegen/dbTypeIR.js +14 -5
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
- package/dist/src/lib/db-type-records.d.ts +106 -0
- package/dist/src/lib/db-type-records.js +224 -0
- package/dist/src/lib/db-type-records.js.map +1 -0
- package/dist/src/lib/db3-export.d.ts +51 -14
- package/dist/src/lib/db3-export.js +136 -28
- package/dist/src/lib/db3-export.js.map +1 -1
- package/dist/src/lib/db3-index-output.d.ts +92 -4
- package/dist/src/lib/db3-index-output.js +183 -11
- package/dist/src/lib/db3-index-output.js.map +1 -1
- package/dist/src/lib/db3-type-models.d.ts +49 -7
- package/dist/src/lib/db3-type-models.js +159 -28
- package/dist/src/lib/db3-type-models.js.map +1 -1
- package/dist/src/lib/deprecation.d.ts +2 -2
- package/dist/src/lib/deprecation.js +2 -2
- package/dist/src/lib/experimental-apis.d.ts +36 -0
- package/dist/src/lib/experimental-apis.js +46 -0
- package/dist/src/lib/experimental-apis.js.map +1 -0
- package/dist/src/lib/file-attachment.d.ts +24 -0
- package/dist/src/lib/file-attachment.js +31 -0
- package/dist/src/lib/file-attachment.js.map +1 -0
- package/dist/src/lib/function-authorize-check.d.ts +1 -1
- package/dist/src/lib/function-authorize-check.js +2 -1
- package/dist/src/lib/function-authorize-check.js.map +1 -1
- package/dist/src/lib/function-authorize-view.d.ts +12 -0
- package/dist/src/lib/function-authorize-view.js +38 -0
- package/dist/src/lib/function-authorize-view.js.map +1 -1
- package/dist/src/lib/function-bundle.d.ts +27 -5
- package/dist/src/lib/function-bundle.js +106 -7
- package/dist/src/lib/function-bundle.js.map +1 -1
- package/dist/src/lib/function-collect.d.ts +15 -0
- package/dist/src/lib/function-collect.js +73 -14
- package/dist/src/lib/function-collect.js.map +1 -1
- package/dist/src/lib/function-db-types.d.ts +63 -40
- package/dist/src/lib/function-db-types.js +289 -293
- package/dist/src/lib/function-db-types.js.map +1 -1
- package/dist/src/lib/function-document-types.d.ts +19 -7
- package/dist/src/lib/function-document-types.js +24 -12
- package/dist/src/lib/function-document-types.js.map +1 -1
- package/dist/src/lib/function-lint.d.ts +24 -1
- package/dist/src/lib/function-lint.js +123 -1
- package/dist/src/lib/function-lint.js.map +1 -1
- package/dist/src/lib/function-run.d.ts +1 -1
- package/dist/src/lib/function-run.js +1 -1
- package/dist/src/lib/function-run.js.map +1 -1
- package/dist/src/lib/function-schema-codegen.d.ts +85 -21
- package/dist/src/lib/function-schema-codegen.js +191 -85
- package/dist/src/lib/function-schema-codegen.js.map +1 -1
- package/dist/src/lib/function-schema-refs.d.ts +98 -0
- package/dist/src/lib/function-schema-refs.js +177 -0
- package/dist/src/lib/function-schema-refs.js.map +1 -0
- package/dist/src/lib/function-sync.d.ts +38 -4
- package/dist/src/lib/function-sync.js +91 -14
- package/dist/src/lib/function-sync.js.map +1 -1
- package/dist/src/lib/function-typecheck.d.ts +52 -0
- package/dist/src/lib/function-typecheck.js +171 -54
- package/dist/src/lib/function-typecheck.js.map +1 -1
- package/dist/src/lib/generated-build-flags.d.ts +13 -0
- package/dist/src/lib/generated-build-flags.js +14 -0
- package/dist/src/lib/generated-build-flags.js.map +1 -0
- package/dist/src/lib/generated-command-status.d.ts +6 -0
- package/dist/src/lib/generated-command-status.js +469 -0
- package/dist/src/lib/generated-command-status.js.map +1 -0
- package/dist/src/lib/generated-config-surfaces.d.ts +239 -14
- package/dist/src/lib/generated-config-surfaces.js +670 -85
- package/dist/src/lib/generated-config-surfaces.js.map +1 -1
- package/dist/src/lib/generated-sdk-types.d.ts +1 -1
- package/dist/src/lib/generated-sdk-types.js +1 -1
- package/dist/src/lib/generated-sdk-types.js.map +1 -1
- package/dist/src/lib/hosting-build.d.ts +97 -0
- package/dist/src/lib/hosting-build.js +204 -0
- package/dist/src/lib/hosting-build.js.map +1 -0
- package/dist/src/lib/hosting-client.d.ts +167 -0
- package/dist/src/lib/hosting-client.js +340 -0
- package/dist/src/lib/hosting-client.js.map +1 -0
- package/dist/src/lib/hosting-environments.d.ts +32 -0
- package/dist/src/lib/hosting-environments.js +74 -0
- package/dist/src/lib/hosting-environments.js.map +1 -0
- package/dist/src/lib/hosting-errors.d.ts +30 -0
- package/dist/src/lib/hosting-errors.js +43 -0
- package/dist/src/lib/hosting-errors.js.map +1 -0
- package/dist/src/lib/hosting-token.d.ts +46 -0
- package/dist/src/lib/hosting-token.js +60 -0
- package/dist/src/lib/hosting-token.js.map +1 -0
- package/dist/src/lib/hosting-wait.d.ts +42 -0
- package/dist/src/lib/hosting-wait.js +84 -0
- package/dist/src/lib/hosting-wait.js.map +1 -0
- package/dist/src/lib/hosting-wfp-upload.d.ts +86 -0
- package/dist/src/lib/hosting-wfp-upload.js +149 -0
- package/dist/src/lib/hosting-wfp-upload.js.map +1 -0
- package/dist/src/lib/integration-test-request.d.ts +54 -0
- package/dist/src/lib/integration-test-request.js +207 -0
- package/dist/src/lib/integration-test-request.js.map +1 -0
- package/dist/src/lib/invoker-shared-enums.d.ts +35 -0
- package/dist/src/lib/invoker-shared-enums.js +98 -0
- package/dist/src/lib/invoker-shared-enums.js.map +1 -0
- package/dist/src/lib/log-inspection.d.ts +4 -1
- package/dist/src/lib/log-inspection.js.map +1 -1
- package/dist/src/lib/metadata-report.d.ts +85 -0
- package/dist/src/lib/metadata-report.js +81 -0
- package/dist/src/lib/metadata-report.js.map +1 -0
- package/dist/src/lib/output.d.ts +1 -1
- package/dist/src/lib/output.js +1 -1
- package/dist/src/lib/platform-owned.js +5 -0
- package/dist/src/lib/platform-owned.js.map +1 -1
- package/dist/src/lib/primitive-declaration-names.d.ts +21 -0
- package/dist/src/lib/primitive-declaration-names.js +22 -0
- package/dist/src/lib/primitive-declaration-names.js.map +1 -0
- package/dist/src/lib/primitive-declaration.d.ts +174 -0
- package/dist/src/lib/primitive-declaration.js +792 -0
- package/dist/src/lib/primitive-declaration.js.map +1 -0
- package/dist/src/lib/prompt-schema-codegen.d.ts +36 -12
- package/dist/src/lib/prompt-schema-codegen.js +94 -98
- package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
- package/dist/src/lib/prompt-schema-document.d.ts +35 -0
- package/dist/src/lib/prompt-schema-document.js +92 -0
- package/dist/src/lib/prompt-schema-document.js.map +1 -0
- package/dist/src/lib/prompt-schema-refs.d.ts +173 -0
- package/dist/src/lib/prompt-schema-refs.js +478 -0
- package/dist/src/lib/prompt-schema-refs.js.map +1 -0
- package/dist/src/lib/records-verbs.d.ts +12 -2
- package/dist/src/lib/records-verbs.js +7 -2
- package/dist/src/lib/records-verbs.js.map +1 -1
- package/dist/src/lib/register-commands.d.ts +36 -0
- package/dist/src/lib/register-commands.js +37 -0
- package/dist/src/lib/register-commands.js.map +1 -0
- package/dist/src/lib/retired-imports.d.ts +53 -0
- package/dist/src/lib/retired-imports.js +120 -0
- package/dist/src/lib/retired-imports.js.map +1 -0
- package/dist/src/lib/schema-codegen/compiledSpace.d.ts +62 -0
- package/dist/src/lib/schema-codegen/compiledSpace.js +103 -0
- package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.d.ts +86 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.js +227 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.d.ts +85 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js +86 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +218 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.js +397 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-field-table.d.ts +80 -0
- package/dist/src/lib/schema-codegen/generated-field-table.js +542 -0
- package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.d.ts +195 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.js +503 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +129 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +154 -1
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -1
- package/dist/src/lib/schema-codegen/generated-schema-file.d.ts +129 -0
- package/dist/src/lib/schema-codegen/generated-schema-file.js +475 -0
- package/dist/src/lib/schema-codegen/generated-schema-file.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.d.ts +115 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.js +274 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.d.ts +366 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.js +1789 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-shape.d.ts +27 -0
- package/dist/src/lib/schema-codegen/generated-schema-shape.js +126 -0
- package/dist/src/lib/schema-codegen/generated-schema-shape.js.map +1 -0
- package/dist/src/lib/schema-codegen/namedRefs.d.ts +56 -0
- package/dist/src/lib/schema-codegen/namedRefs.js +143 -0
- package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaChanges.d.ts +74 -0
- package/dist/src/lib/schema-codegen/schemaChanges.js +277 -0
- package/dist/src/lib/schema-codegen/schemaChanges.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaDocs.d.ts +69 -0
- package/dist/src/lib/schema-codegen/schemaDocs.js +219 -0
- package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaIR.d.ts +158 -0
- package/dist/src/lib/schema-codegen/schemaIR.js +279 -0
- package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaToTs.d.ts +40 -13
- package/dist/src/lib/schema-codegen/schemaToTs.js +124 -160
- package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -1
- package/dist/src/lib/schema-codegen/valuesLists.d.ts +48 -0
- package/dist/src/lib/schema-codegen/valuesLists.js +144 -0
- package/dist/src/lib/schema-codegen/valuesLists.js.map +1 -0
- package/dist/src/lib/schema-family-index.d.ts +228 -0
- package/dist/src/lib/schema-family-index.js +813 -0
- package/dist/src/lib/schema-family-index.js.map +1 -0
- package/dist/src/lib/schema-pins.d.ts +82 -0
- package/dist/src/lib/schema-pins.js +198 -0
- package/dist/src/lib/schema-pins.js.map +1 -0
- package/dist/src/lib/schema-preview.d.ts +244 -0
- package/dist/src/lib/schema-preview.js +498 -0
- package/dist/src/lib/schema-preview.js.map +1 -0
- package/dist/src/lib/skill-installer.d.ts +2 -2
- package/dist/src/lib/skill-installer.js +2 -21
- package/dist/src/lib/skill-installer.js.map +1 -1
- package/dist/src/lib/step-run-table.d.ts +1 -2
- package/dist/src/lib/step-run-table.js +1 -2
- package/dist/src/lib/step-run-table.js.map +1 -1
- package/dist/src/lib/swift-codegen/agentGenerator.d.ts +2 -1
- package/dist/src/lib/swift-codegen/agentGenerator.js +24 -22
- package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/banners.d.ts +12 -0
- package/dist/src/lib/swift-codegen/banners.js +12 -0
- package/dist/src/lib/swift-codegen/banners.js.map +1 -1
- package/dist/src/lib/swift-codegen/functionGenerator.d.ts +36 -1
- package/dist/src/lib/swift-codegen/functionGenerator.js +168 -50
- package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +31 -7
- package/dist/src/lib/swift-codegen/schemaToSwift.js +213 -177
- package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
- package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +45 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js +165 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.d.ts +30 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.js +69 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +37 -5
- package/dist/src/lib/sync-resource-types.js +50 -5
- package/dist/src/lib/sync-resource-types.js.map +1 -1
- package/dist/src/lib/sync-selectors.d.ts +7 -0
- package/dist/src/lib/sync-selectors.js +22 -2
- package/dist/src/lib/sync-selectors.js.map +1 -1
- package/dist/src/lib/test-runs.d.ts +45 -0
- package/dist/src/lib/test-runs.js +150 -0
- package/dist/src/lib/test-runs.js.map +1 -0
- package/dist/src/lib/toml-database-config.d.ts +2 -1
- package/dist/src/lib/toml-database-config.js +7 -4
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/toml-scalar-edit.js +6 -4
- package/dist/src/lib/toml-scalar-edit.js.map +1 -1
- package/dist/src/lib/transition-warnings.d.ts +21 -0
- package/dist/src/lib/transition-warnings.js +49 -0
- package/dist/src/lib/transition-warnings.js.map +1 -0
- package/dist/src/lib/user-index.d.ts +80 -0
- package/dist/src/lib/user-index.js +166 -0
- package/dist/src/lib/user-index.js.map +1 -0
- package/dist/src/lib/user-properties/generated-properties-schema.d.ts +159 -0
- package/dist/src/lib/user-properties/generated-properties-schema.js +471 -0
- package/dist/src/lib/user-properties/generated-properties-schema.js.map +1 -0
- package/dist/src/lib/user-properties/user-properties-codegen.d.ts +55 -0
- package/dist/src/lib/user-properties/user-properties-codegen.js +129 -0
- package/dist/src/lib/user-properties/user-properties-codegen.js.map +1 -0
- package/dist/src/lib/user-walk.d.ts +31 -0
- package/dist/src/lib/user-walk.js +102 -0
- package/dist/src/lib/user-walk.js.map +1 -0
- package/dist/src/lib/worker-perf-format.d.ts +22 -0
- package/dist/src/lib/worker-perf-format.js +27 -0
- package/dist/src/lib/worker-perf-format.js.map +1 -0
- package/dist/src/types/index.d.ts +13 -34
- package/package.json +5 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generated-sdk-types.js","sourceRoot":"","sources":["../../../src/lib/generated-sdk-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,
|
|
1
|
+
{"version":3,"file":"generated-sdk-types.js","sourceRoot":"","sources":["../../../src/lib/generated-sdk-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,2jokBAA2jokB,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The longest path a deployment may list, in UTF-8 bytes; the hosting
|
|
3
|
+
* service refuses a longer one with 413 `path_too_long`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const MAX_PATH_BYTES = 768;
|
|
6
|
+
/**
|
|
7
|
+
* The largest create body the hosting service reads, in bytes (88 MiB); a
|
|
8
|
+
* larger one is refused with 413 `manifest_too_large`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const MAX_MANIFEST_BODY_BYTES: number;
|
|
11
|
+
/**
|
|
12
|
+
* The most files a deployment may hold (99,999); the hosting service refuses
|
|
13
|
+
* more with 400 `too_many_files`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const MAX_FILES = 99999;
|
|
16
|
+
/** One file of a build, as the manifest lists it, with where it is on disk. */
|
|
17
|
+
export interface BuildFile {
|
|
18
|
+
/** The path relative to the build directory, `/`-separated. */
|
|
19
|
+
path: string;
|
|
20
|
+
/** Where the file is on disk. */
|
|
21
|
+
absolutePath: string;
|
|
22
|
+
/** The SHA-256 of the file's bytes, lowercase hex. */
|
|
23
|
+
sha256: string;
|
|
24
|
+
/** The file's size in bytes. */
|
|
25
|
+
size: number;
|
|
26
|
+
/** The content type it is served with, chosen by extension. */
|
|
27
|
+
contentType: string;
|
|
28
|
+
}
|
|
29
|
+
/** A deployment's routing: `spa` serves `index.html` for unknown paths, `static` answers 404. */
|
|
30
|
+
export type RoutingMode = "spa" | "static";
|
|
31
|
+
/**
|
|
32
|
+
* The content type a file is published with, by its extension;
|
|
33
|
+
* `application/octet-stream` for one not listed.
|
|
34
|
+
*
|
|
35
|
+
* @param path The file's path or name.
|
|
36
|
+
* @returns A media type, with `charset=utf-8` for text.
|
|
37
|
+
*/
|
|
38
|
+
export declare function contentTypeFor(path: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* A path relative to the build directory as the manifest lists it, its
|
|
41
|
+
* segments joined with `/` whatever the platform's separator.
|
|
42
|
+
*
|
|
43
|
+
* @param relativePath The path relative to the build directory.
|
|
44
|
+
* @param separator The platform's path separator.
|
|
45
|
+
* @returns The `/`-separated path.
|
|
46
|
+
*/
|
|
47
|
+
export declare function manifestPath(relativePath: string, separator?: string): string;
|
|
48
|
+
/** A file of a build before it is hashed. */
|
|
49
|
+
export type ListedFile = Omit<BuildFile, "sha256">;
|
|
50
|
+
/**
|
|
51
|
+
* Every regular file under `dir`, sorted by path, not yet hashed.
|
|
52
|
+
*
|
|
53
|
+
* @param dir The build directory.
|
|
54
|
+
* @returns The build's files with their sizes and content types.
|
|
55
|
+
* @throws HostingError `directory_not_found` when `dir` is missing or not a
|
|
56
|
+
* directory, `symlink_not_supported` naming a symbolic link inside it, and
|
|
57
|
+
* `no_files` when it holds nothing to publish.
|
|
58
|
+
*/
|
|
59
|
+
export declare function listBuild(dir: string): Promise<ListedFile[]>;
|
|
60
|
+
/**
|
|
61
|
+
* The listed files with their SHA-256, hashed from disk a few at a time.
|
|
62
|
+
*
|
|
63
|
+
* @param listed The files {@link listBuild} found.
|
|
64
|
+
* @returns The same files, hashed, in the same order.
|
|
65
|
+
*/
|
|
66
|
+
export declare function hashBuild(listed: ListedFile[]): Promise<BuildFile[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Every regular file under `dir`, sorted by path, hashed.
|
|
69
|
+
*
|
|
70
|
+
* @param dir The build directory.
|
|
71
|
+
* @returns The build's files.
|
|
72
|
+
* @throws As {@link listBuild}.
|
|
73
|
+
*/
|
|
74
|
+
export declare function readBuild(dir: string): Promise<BuildFile[]>;
|
|
75
|
+
/**
|
|
76
|
+
* Checks the file count and the service's two measured limits before
|
|
77
|
+
* anything is hashed or sent: every hash has the same length, so the body's
|
|
78
|
+
* size is known first.
|
|
79
|
+
*
|
|
80
|
+
* @param listed The files {@link listBuild} found.
|
|
81
|
+
* @param routingMode The deployment's routing.
|
|
82
|
+
* @throws As {@link manifestBody}.
|
|
83
|
+
*/
|
|
84
|
+
export declare function checkManifestLimits(listed: ListedFile[], routingMode: RoutingMode): void;
|
|
85
|
+
/**
|
|
86
|
+
* The create body for `files`: `{ routingMode, files: [{ path, sha256, size,
|
|
87
|
+
* contentType }] }`, checked against the file count and the service's two
|
|
88
|
+
* measured limits.
|
|
89
|
+
*
|
|
90
|
+
* @param files The build's files.
|
|
91
|
+
* @param routingMode The deployment's routing.
|
|
92
|
+
* @returns The body as UTF-8 bytes.
|
|
93
|
+
* @throws HostingError `too_many_files` when there are more than 99,999 files,
|
|
94
|
+
* `path_too_long` naming the first path over 768 bytes, `manifest_too_large`
|
|
95
|
+
* when the body is over 88 MiB.
|
|
96
|
+
*/
|
|
97
|
+
export declare function manifestBody(files: BuildFile[], routingMode: RoutingMode): Buffer;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `primitive hosting deploy` reads from a build directory: every regular
|
|
3
|
+
* file with its `/`-separated path, SHA-256, size and content type, and the
|
|
4
|
+
* create body the control Worker takes. Only the directory itself, the file
|
|
5
|
+
* count and the service's two measured limits are checked here; every other
|
|
6
|
+
* manifest rule is the service's to judge.
|
|
7
|
+
*/
|
|
8
|
+
import { createHash } from "crypto";
|
|
9
|
+
import { createReadStream } from "fs";
|
|
10
|
+
import { lstat, readdir } from "fs/promises";
|
|
11
|
+
import { extname, join, relative, sep } from "path";
|
|
12
|
+
import { HostingError } from "./hosting-errors.js";
|
|
13
|
+
/**
|
|
14
|
+
* The longest path a deployment may list, in UTF-8 bytes; the hosting
|
|
15
|
+
* service refuses a longer one with 413 `path_too_long`.
|
|
16
|
+
*/
|
|
17
|
+
export const MAX_PATH_BYTES = 768;
|
|
18
|
+
/**
|
|
19
|
+
* The largest create body the hosting service reads, in bytes (88 MiB); a
|
|
20
|
+
* larger one is refused with 413 `manifest_too_large`.
|
|
21
|
+
*/
|
|
22
|
+
export const MAX_MANIFEST_BODY_BYTES = 88 * 1024 * 1024;
|
|
23
|
+
/**
|
|
24
|
+
* The most files a deployment may hold (99,999); the hosting service refuses
|
|
25
|
+
* more with 400 `too_many_files`.
|
|
26
|
+
*/
|
|
27
|
+
export const MAX_FILES = 99_999;
|
|
28
|
+
/** Files hashed at once. */
|
|
29
|
+
const HASH_CONCURRENCY = 16;
|
|
30
|
+
/** Finder's folder metadata, never published. */
|
|
31
|
+
const SKIPPED_NAMES = new Set([".DS_Store"]);
|
|
32
|
+
const TEXT = "; charset=utf-8";
|
|
33
|
+
const CONTENT_TYPES = {
|
|
34
|
+
".html": `text/html${TEXT}`,
|
|
35
|
+
".htm": `text/html${TEXT}`,
|
|
36
|
+
".js": `text/javascript${TEXT}`,
|
|
37
|
+
".mjs": `text/javascript${TEXT}`,
|
|
38
|
+
".cjs": `text/javascript${TEXT}`,
|
|
39
|
+
".css": `text/css${TEXT}`,
|
|
40
|
+
".txt": `text/plain${TEXT}`,
|
|
41
|
+
".md": `text/markdown${TEXT}`,
|
|
42
|
+
".csv": `text/csv${TEXT}`,
|
|
43
|
+
".xml": `application/xml`,
|
|
44
|
+
".json": "application/json",
|
|
45
|
+
".map": "application/json",
|
|
46
|
+
".webmanifest": "application/manifest+json",
|
|
47
|
+
".wasm": "application/wasm",
|
|
48
|
+
".pdf": "application/pdf",
|
|
49
|
+
".zip": "application/zip",
|
|
50
|
+
".svg": "image/svg+xml",
|
|
51
|
+
".png": "image/png",
|
|
52
|
+
".jpg": "image/jpeg",
|
|
53
|
+
".jpeg": "image/jpeg",
|
|
54
|
+
".gif": "image/gif",
|
|
55
|
+
".webp": "image/webp",
|
|
56
|
+
".avif": "image/avif",
|
|
57
|
+
".ico": "image/x-icon",
|
|
58
|
+
".woff": "font/woff",
|
|
59
|
+
".woff2": "font/woff2",
|
|
60
|
+
".ttf": "font/ttf",
|
|
61
|
+
".otf": "font/otf",
|
|
62
|
+
".mp3": "audio/mpeg",
|
|
63
|
+
".wav": "audio/wav",
|
|
64
|
+
".ogg": "audio/ogg",
|
|
65
|
+
".mp4": "video/mp4",
|
|
66
|
+
".webm": "video/webm",
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* The content type a file is published with, by its extension;
|
|
70
|
+
* `application/octet-stream` for one not listed.
|
|
71
|
+
*
|
|
72
|
+
* @param path The file's path or name.
|
|
73
|
+
* @returns A media type, with `charset=utf-8` for text.
|
|
74
|
+
*/
|
|
75
|
+
export function contentTypeFor(path) {
|
|
76
|
+
return CONTENT_TYPES[extname(path).toLowerCase()] ?? "application/octet-stream";
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A path relative to the build directory as the manifest lists it, its
|
|
80
|
+
* segments joined with `/` whatever the platform's separator.
|
|
81
|
+
*
|
|
82
|
+
* @param relativePath The path relative to the build directory.
|
|
83
|
+
* @param separator The platform's path separator.
|
|
84
|
+
* @returns The `/`-separated path.
|
|
85
|
+
*/
|
|
86
|
+
export function manifestPath(relativePath, separator = sep) {
|
|
87
|
+
return relativePath.split(separator).join("/");
|
|
88
|
+
}
|
|
89
|
+
async function hashFile(path) {
|
|
90
|
+
const hash = createHash("sha256");
|
|
91
|
+
for await (const chunk of createReadStream(path))
|
|
92
|
+
hash.update(chunk);
|
|
93
|
+
return hash.digest("hex");
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Every regular file under `dir`, sorted by path, not yet hashed.
|
|
97
|
+
*
|
|
98
|
+
* @param dir The build directory.
|
|
99
|
+
* @returns The build's files with their sizes and content types.
|
|
100
|
+
* @throws HostingError `directory_not_found` when `dir` is missing or not a
|
|
101
|
+
* directory, `symlink_not_supported` naming a symbolic link inside it, and
|
|
102
|
+
* `no_files` when it holds nothing to publish.
|
|
103
|
+
*/
|
|
104
|
+
export async function listBuild(dir) {
|
|
105
|
+
const top = await lstat(dir).catch(() => null);
|
|
106
|
+
if (!top?.isDirectory()) {
|
|
107
|
+
throw new HostingError("directory_not_found", top ? `${dir} is not a directory. Name the build's output directory, such as dist.` : `No directory at ${dir}. Build the app first, or name its output directory.`);
|
|
108
|
+
}
|
|
109
|
+
const found = [];
|
|
110
|
+
const walk = async (at) => {
|
|
111
|
+
const entries = await readdir(at, { withFileTypes: true });
|
|
112
|
+
for (const entry of entries) {
|
|
113
|
+
const full = join(at, entry.name);
|
|
114
|
+
if (entry.isSymbolicLink()) {
|
|
115
|
+
throw new HostingError("symlink_not_supported", `${manifestPath(relative(dir, full))} is a symbolic link. Hosting publishes regular files only; copy the file it points to instead.`);
|
|
116
|
+
}
|
|
117
|
+
if (entry.isDirectory()) {
|
|
118
|
+
await walk(full);
|
|
119
|
+
}
|
|
120
|
+
else if (entry.isFile() && !SKIPPED_NAMES.has(entry.name)) {
|
|
121
|
+
const path = manifestPath(relative(dir, full));
|
|
122
|
+
found.push({ path, absolutePath: full, size: (await lstat(full)).size, contentType: contentTypeFor(path) });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
await walk(dir);
|
|
127
|
+
if (found.length === 0)
|
|
128
|
+
throw new HostingError("no_files", `${dir} holds no files to publish.`);
|
|
129
|
+
return found.sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The listed files with their SHA-256, hashed from disk a few at a time.
|
|
133
|
+
*
|
|
134
|
+
* @param listed The files {@link listBuild} found.
|
|
135
|
+
* @returns The same files, hashed, in the same order.
|
|
136
|
+
*/
|
|
137
|
+
export async function hashBuild(listed) {
|
|
138
|
+
const files = new Array(listed.length);
|
|
139
|
+
let next = 0;
|
|
140
|
+
const worker = async () => {
|
|
141
|
+
while (next < listed.length) {
|
|
142
|
+
const at = next++;
|
|
143
|
+
files[at] = { ...listed[at], sha256: await hashFile(listed[at].absolutePath) };
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
await Promise.all(Array.from({ length: Math.min(HASH_CONCURRENCY, listed.length) }, worker));
|
|
147
|
+
return files;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Every regular file under `dir`, sorted by path, hashed.
|
|
151
|
+
*
|
|
152
|
+
* @param dir The build directory.
|
|
153
|
+
* @returns The build's files.
|
|
154
|
+
* @throws As {@link listBuild}.
|
|
155
|
+
*/
|
|
156
|
+
export async function readBuild(dir) {
|
|
157
|
+
return hashBuild(await listBuild(dir));
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Checks the file count and the service's two measured limits before
|
|
161
|
+
* anything is hashed or sent: every hash has the same length, so the body's
|
|
162
|
+
* size is known first.
|
|
163
|
+
*
|
|
164
|
+
* @param listed The files {@link listBuild} found.
|
|
165
|
+
* @param routingMode The deployment's routing.
|
|
166
|
+
* @throws As {@link manifestBody}.
|
|
167
|
+
*/
|
|
168
|
+
export function checkManifestLimits(listed, routingMode) {
|
|
169
|
+
const placeholder = "0".repeat(64);
|
|
170
|
+
manifestBody(listed.map((f) => ({ ...f, sha256: placeholder })), routingMode);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The create body for `files`: `{ routingMode, files: [{ path, sha256, size,
|
|
174
|
+
* contentType }] }`, checked against the file count and the service's two
|
|
175
|
+
* measured limits.
|
|
176
|
+
*
|
|
177
|
+
* @param files The build's files.
|
|
178
|
+
* @param routingMode The deployment's routing.
|
|
179
|
+
* @returns The body as UTF-8 bytes.
|
|
180
|
+
* @throws HostingError `too_many_files` when there are more than 99,999 files,
|
|
181
|
+
* `path_too_long` naming the first path over 768 bytes, `manifest_too_large`
|
|
182
|
+
* when the body is over 88 MiB.
|
|
183
|
+
*/
|
|
184
|
+
export function manifestBody(files, routingMode) {
|
|
185
|
+
if (files.length > MAX_FILES) {
|
|
186
|
+
throw new HostingError("too_many_files", `The build has ${files.length.toLocaleString("en-US")} files; a deployment may hold at most ${MAX_FILES.toLocaleString("en-US")}. Publish fewer files.`);
|
|
187
|
+
}
|
|
188
|
+
const head = `{"routingMode":${JSON.stringify(routingMode)},"files":[`;
|
|
189
|
+
let bytes = Buffer.byteLength(head) + 2;
|
|
190
|
+
const entries = [];
|
|
191
|
+
for (const file of files) {
|
|
192
|
+
if (Buffer.byteLength(file.path) > MAX_PATH_BYTES) {
|
|
193
|
+
throw new HostingError("path_too_long", `${file.path} is longer than hosting's ${MAX_PATH_BYTES}-byte path limit (${Buffer.byteLength(file.path)} UTF-8 bytes). Shorten it.`);
|
|
194
|
+
}
|
|
195
|
+
const entry = JSON.stringify({ path: file.path, sha256: file.sha256, size: file.size, contentType: file.contentType });
|
|
196
|
+
bytes += Buffer.byteLength(entry) + (entries.length > 0 ? 1 : 0);
|
|
197
|
+
if (bytes > MAX_MANIFEST_BODY_BYTES) {
|
|
198
|
+
throw new HostingError("manifest_too_large", `The build's manifest is larger than hosting's 88 MiB limit (${files.length} files). Publish fewer files or shorter paths.`);
|
|
199
|
+
}
|
|
200
|
+
entries.push(entry);
|
|
201
|
+
}
|
|
202
|
+
return Buffer.from(`${head}${entries.join(",")}]}`, "utf-8");
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=hosting-build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosting-build.js","sourceRoot":"","sources":["../../../src/lib/hosting-build.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAElC;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAExD;;;GAGG;AACH,MAAM,CAAC,MAA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,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { type IncomingHttpHeaders } from "http";
|
|
2
|
+
import type { BuildFile } from "./hosting-build.js";
|
|
3
|
+
import type { HostingTokenProvider } from "./hosting-token.js";
|
|
4
|
+
import { type ProbeAnswer } from "./hosting-wait.js";
|
|
5
|
+
import type { UploadSession } from "./hosting-wfp-upload.js";
|
|
6
|
+
/** A request body: bytes, or a file streamed from disk. */
|
|
7
|
+
export type HostingBody = Buffer | {
|
|
8
|
+
file: string;
|
|
9
|
+
size: number;
|
|
10
|
+
};
|
|
11
|
+
/** An answer: its status, headers and body text. */
|
|
12
|
+
export interface HostingResponse {
|
|
13
|
+
status: number;
|
|
14
|
+
headers: IncomingHttpHeaders;
|
|
15
|
+
text: string;
|
|
16
|
+
}
|
|
17
|
+
/** Files uploaded at once. */
|
|
18
|
+
export declare const UPLOAD_CONCURRENCY = 6;
|
|
19
|
+
/** Retries of one upload after a network failure or a 5xx. */
|
|
20
|
+
export declare const UPLOAD_RETRIES = 3;
|
|
21
|
+
/** Attempts of a create the service answers `create_busy`. */
|
|
22
|
+
export declare const CREATE_ATTEMPTS = 3;
|
|
23
|
+
/** Attempts of an activation the service answers `activation_in_progress`. */
|
|
24
|
+
export declare const ACTIVATE_ATTEMPTS = 3;
|
|
25
|
+
/** The header the serve probe sends: a `wfp` origin then answers only once the deployment's own version serves here. */
|
|
26
|
+
export declare const PROBE_HEADER = "x-primitive-hosting-probe";
|
|
27
|
+
/** The headers of the serve probe (`HEAD <origin>/`). */
|
|
28
|
+
export declare const PROBE_REQUEST_HEADERS: Readonly<Record<string, string>>;
|
|
29
|
+
/**
|
|
30
|
+
* Whether an activation that failed with `err` on attempt `attempt` (from 1)
|
|
31
|
+
* is tried again, and after how many milliseconds: only for
|
|
32
|
+
* `activation_in_progress`, after its `retry-after` (5 s when absent or not a
|
|
33
|
+
* number), {@link ACTIVATE_ATTEMPTS} attempts in all; null to give up.
|
|
34
|
+
*/
|
|
35
|
+
export declare function activationRetryDelayMs(err: unknown, attempt: number): number | null;
|
|
36
|
+
/**
|
|
37
|
+
* One HTTP request. A `*.localhost` host is reached on 127.0.0.1 with its
|
|
38
|
+
* `Host` header kept; one connection per request.
|
|
39
|
+
*
|
|
40
|
+
* @param url The full URL.
|
|
41
|
+
* @param init The method, headers, body and timeout.
|
|
42
|
+
* @returns The answer.
|
|
43
|
+
* @throws The transport's error on a network failure or a timeout.
|
|
44
|
+
*/
|
|
45
|
+
export declare function hostingFetch(url: string, init: {
|
|
46
|
+
method: string;
|
|
47
|
+
headers?: Record<string, string>;
|
|
48
|
+
body?: HostingBody;
|
|
49
|
+
/** Socket inactivity bound; 60 s by default. */
|
|
50
|
+
timeoutMs?: number;
|
|
51
|
+
/** Absolute bound on the whole request (lookup, connect, answer), started before it opens. */
|
|
52
|
+
deadlineMs?: number;
|
|
53
|
+
/** Aborts the request when signalled. */
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
}): Promise<HostingResponse>;
|
|
56
|
+
/** The app's hosting view, as the control Worker answers it. */
|
|
57
|
+
export interface HostingView {
|
|
58
|
+
appId: string;
|
|
59
|
+
slug: string | null;
|
|
60
|
+
origin: string | null;
|
|
61
|
+
state: "active" | "disabled" | "deleted" | string;
|
|
62
|
+
suspended: boolean;
|
|
63
|
+
backend: string;
|
|
64
|
+
activeDeployId: string | null;
|
|
65
|
+
activeDeployment: {
|
|
66
|
+
deployId: string;
|
|
67
|
+
manifestHash: string;
|
|
68
|
+
routingMode: string;
|
|
69
|
+
fileCount: number;
|
|
70
|
+
createdAt: string;
|
|
71
|
+
} | null;
|
|
72
|
+
previousSlugs: Array<{
|
|
73
|
+
slug: string;
|
|
74
|
+
redirectUntil: string;
|
|
75
|
+
}>;
|
|
76
|
+
[key: string]: unknown;
|
|
77
|
+
}
|
|
78
|
+
/** One deployment as `primitive hosting deployments` lists it. */
|
|
79
|
+
export interface HostingDeployment {
|
|
80
|
+
deployId: string;
|
|
81
|
+
createdAt: string;
|
|
82
|
+
routingMode: string;
|
|
83
|
+
fileCount: number;
|
|
84
|
+
totalBytes: number;
|
|
85
|
+
active: boolean;
|
|
86
|
+
supersededAt: string | null;
|
|
87
|
+
}
|
|
88
|
+
/** A create's answer: the deployment and the hashes still to upload. */
|
|
89
|
+
export interface CreatedDeployment {
|
|
90
|
+
deployId: string;
|
|
91
|
+
manifestHash: string;
|
|
92
|
+
routingMode: string;
|
|
93
|
+
fileCount: number;
|
|
94
|
+
totalBytes: number;
|
|
95
|
+
missing: string[];
|
|
96
|
+
reusedCount: number;
|
|
97
|
+
/** On `wfp`: the session to upload the missing files straight to Cloudflare with. */
|
|
98
|
+
upload?: UploadSession;
|
|
99
|
+
}
|
|
100
|
+
/** The client of one hosting control Worker. */
|
|
101
|
+
export declare class HostingClient {
|
|
102
|
+
readonly baseUrl: string;
|
|
103
|
+
private readonly tokens;
|
|
104
|
+
private readonly canStepUp;
|
|
105
|
+
/**
|
|
106
|
+
* @param baseUrl The control Worker, without a trailing slash.
|
|
107
|
+
* @param tokens Hands out the bearer of each request.
|
|
108
|
+
* @param canStepUp Whether an unexpired step-up that may reach the app is stored.
|
|
109
|
+
*/
|
|
110
|
+
constructor(baseUrl: string, tokens: HostingTokenProvider, canStepUp: boolean);
|
|
111
|
+
private send;
|
|
112
|
+
private parse;
|
|
113
|
+
/**
|
|
114
|
+
* One control request, answered as JSON. A protected app's refusal of a
|
|
115
|
+
* token derived from the login is retried once with one derived from the
|
|
116
|
+
* stored step-up; when that cannot be derived, the refusal stands.
|
|
117
|
+
*/
|
|
118
|
+
call(method: string, path: string, options?: {
|
|
119
|
+
json?: unknown;
|
|
120
|
+
body?: () => HostingBody;
|
|
121
|
+
headers?: Record<string, string>;
|
|
122
|
+
}): Promise<any>;
|
|
123
|
+
/** `GET /apps/:appId`: the app's view, or null when it has no slug. */
|
|
124
|
+
appView(appId: string): Promise<HostingView | null>;
|
|
125
|
+
/** `POST /apps/:appId/<action>`: a state change, answered with the app's view. */
|
|
126
|
+
change(appId: string, action: "slug" | "rename" | "disable" | "enable" | "suspend" | "unsuspend", json?: unknown): Promise<HostingView>;
|
|
127
|
+
/** `GET /apps/:appId/deployments`, newest first. */
|
|
128
|
+
deployments(appId: string): Promise<HostingDeployment[]>;
|
|
129
|
+
/**
|
|
130
|
+
* `POST /apps/:appId/deployments`: creates a deployment from the manifest
|
|
131
|
+
* body, retried after `retry-after` while the service answers `create_busy`.
|
|
132
|
+
*/
|
|
133
|
+
createDeployment(appId: string, body: Buffer, wait?: (ms: number) => Promise<void>): Promise<CreatedDeployment>;
|
|
134
|
+
/**
|
|
135
|
+
* `PUT /apps/:appId/files/:sha256?size=<n>`, streamed from disk, retried
|
|
136
|
+
* up to {@link UPLOAD_RETRIES} times after a network failure or a 5xx.
|
|
137
|
+
*/
|
|
138
|
+
upload(appId: string, file: BuildFile): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* `POST /apps/:appId/deployments/:deployId/activate` with no body, answered
|
|
141
|
+
* with the app's view; retried after `retry-after` while another
|
|
142
|
+
* activation of the app is in progress, {@link ACTIVATE_ATTEMPTS} attempts in all.
|
|
143
|
+
*/
|
|
144
|
+
activate(appId: string, deployId: string, wait?: (ms: number) => Promise<void>): Promise<HostingView>;
|
|
145
|
+
/** `HEAD <origin>/` with the probe header: its status and the deployment id it carried; at most 10 s, or until `signal`. */
|
|
146
|
+
probe(origin: string, signal?: AbortSignal): Promise<ProbeAnswer>;
|
|
147
|
+
}
|
|
148
|
+
/** What telling hosting about a deleted app came to. */
|
|
149
|
+
export type DeletionMark = {
|
|
150
|
+
outcome: "marked";
|
|
151
|
+
} | {
|
|
152
|
+
outcome: "no_slug";
|
|
153
|
+
} | {
|
|
154
|
+
outcome: "failed";
|
|
155
|
+
reason: string;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* `POST /apps/:appId/deleted`, sent with no token once the API deleted the
|
|
159
|
+
* app: the control Worker checks the API itself and marks the app's
|
|
160
|
+
* hostnames gone, so they answer 410 at once. Never throws.
|
|
161
|
+
*
|
|
162
|
+
* @param hostingUrl The control Worker, without a trailing slash.
|
|
163
|
+
* @param appId The deleted app.
|
|
164
|
+
* @param deadlineMs How long the whole call may take, from before it opens; 10 s by default.
|
|
165
|
+
* @returns `marked`, `no_slug` for an app that never held a slug, or `failed` with why.
|
|
166
|
+
*/
|
|
167
|
+
export declare function reportAppDeleted(hostingUrl: string, appId: string, deadlineMs?: number): Promise<DeletionMark>;
|