primitive-admin 1.2.0-alpha.9 → 1.3.0-alpha.1
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 +303 -186
- package/assets/skill/skills/primitive-platform/SKILL.md +93 -27
- package/dist/bin/primitive.js +15 -89
- 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.d.ts +129 -0
- package/dist/src/commands/agent-sessions.js +532 -20
- package/dist/src/commands/agent-sessions.js.map +1 -1
- package/dist/src/commands/analytics.js +207 -155
- package/dist/src/commands/analytics.js.map +1 -1
- package/dist/src/commands/apps-children.js +3 -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 +17 -0
- package/dist/src/commands/apps.js +108 -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 +170 -50
- 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 +318 -256
- 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 +2 -2
- package/dist/src/commands/config.js +59 -33
- 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.d.ts +42 -0
- package/dist/src/commands/db3-types.js +445 -0
- package/dist/src/commands/db3-types.js.map +1 -0
- package/dist/src/commands/db3.d.ts +38 -0
- package/dist/src/commands/db3.js +2053 -0
- package/dist/src/commands/db3.js.map +1 -0
- package/dist/src/commands/documents.d.ts +110 -10
- package/dist/src/commands/documents.js +1019 -748
- 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 +8 -4
- package/dist/src/commands/env.js.map +1 -1
- package/dist/src/commands/function-trigger-commands.d.ts +28 -0
- package/dist/src/commands/function-trigger-commands.js +341 -0
- package/dist/src/commands/function-trigger-commands.js.map +1 -0
- package/dist/src/commands/functions.js +383 -32
- package/dist/src/commands/functions.js.map +1 -1
- package/dist/src/commands/groups.js +168 -50
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.js +7 -5
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/hosting.d.ts +8 -0
- package/dist/src/commands/hosting.js +509 -0
- package/dist/src/commands/hosting.js.map +1 -0
- package/dist/src/commands/init.js +129 -38
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.js +82 -53
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/locks.d.ts +5 -3
- package/dist/src/commands/locks.js +19 -61
- package/dist/src/commands/locks.js.map +1 -1
- package/dist/src/commands/metadata-category-configs.d.ts +2 -2
- package/dist/src/commands/metadata-category-configs.js +4 -2
- package/dist/src/commands/metadata-category-configs.js.map +1 -1
- package/dist/src/commands/metadata.js +55 -6
- package/dist/src/commands/metadata.js.map +1 -1
- package/dist/src/commands/prompts.js +75 -52
- 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.d.ts +1 -1
- package/dist/src/commands/rule-sets.js +2 -1
- 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/scripts.d.ts +9 -17
- package/dist/src/commands/scripts.js +24 -479
- package/dist/src/commands/scripts.js.map +1 -1
- package/dist/src/commands/secrets.d.ts +38 -0
- package/dist/src/commands/secrets.js +148 -6
- 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/spent-tokens.d.ts +19 -0
- package/dist/src/commands/spent-tokens.js +79 -0
- package/dist/src/commands/spent-tokens.js.map +1 -0
- package/dist/src/commands/sync-app-settings.d.ts +58 -0
- package/dist/src/commands/sync-app-settings.js +119 -2
- package/dist/src/commands/sync-app-settings.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 +578 -546
- package/dist/src/commands/sync.js +3516 -5134
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/tokens.js +5 -3
- 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 +42 -0
- package/dist/src/commands/usage.js +397 -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 +951 -18
- 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/commands/workflows.d.ts +5 -83
- package/dist/src/commands/workflows.js +57 -2282
- package/dist/src/commands/workflows.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 +1976 -431
- package/dist/src/lib/api-client.js +1095 -550
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +14 -2
- package/dist/src/lib/app-settings-descriptor.js +55 -1
- package/dist/src/lib/app-settings-descriptor.js.map +1 -1
- package/dist/src/lib/auth-fixtures.d.ts +44 -0
- package/dist/src/lib/auth-fixtures.js +61 -0
- package/dist/src/lib/auth-fixtures.js.map +1 -0
- package/dist/src/lib/auth-flow.d.ts +47 -1
- package/dist/src/lib/auth-flow.js +451 -14
- package/dist/src/lib/auth-flow.js.map +1 -1
- package/dist/src/lib/block-layout.d.ts +12 -23
- package/dist/src/lib/block-layout.js +26 -92
- package/dist/src/lib/block-layout.js.map +1 -1
- package/dist/src/lib/block-selector.d.ts +8 -14
- package/dist/src/lib/block-selector.js +8 -19
- package/dist/src/lib/block-selector.js.map +1 -1
- package/dist/src/lib/child-apps-local.d.ts +3 -1
- package/dist/src/lib/child-apps-local.js +9 -1
- package/dist/src/lib/child-apps-local.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/collection-export.d.ts +76 -15
- package/dist/src/lib/collection-export.js +116 -23
- package/dist/src/lib/collection-export.js.map +1 -1
- package/dist/src/lib/collection-principal.d.ts +22 -0
- package/dist/src/lib/collection-principal.js +35 -0
- package/dist/src/lib/collection-principal.js.map +1 -0
- package/dist/src/lib/command-groups.d.ts +30 -0
- package/dist/src/lib/command-groups.js +111 -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 +9 -22
- package/dist/src/lib/config-object-descriptor.js +113 -277
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/config-surface.d.ts +3 -7
- package/dist/src/lib/config-surface.js +9 -13
- package/dist/src/lib/config-surface.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/credentials-home.d.ts +7 -0
- package/dist/src/lib/credentials-home.js +45 -10
- package/dist/src/lib/credentials-home.js.map +1 -1
- package/dist/src/lib/credentials-lock.d.ts +14 -6
- package/dist/src/lib/credentials-lock.js +90 -10
- package/dist/src/lib/credentials-lock.js.map +1 -1
- package/dist/src/lib/credentials-store.d.ts +142 -70
- package/dist/src/lib/credentials-store.js +420 -111
- package/dist/src/lib/credentials-store.js.map +1 -1
- package/dist/src/lib/custodian.d.ts +8 -0
- package/dist/src/lib/custodian.js +18 -0
- package/dist/src/lib/custodian.js.map +1 -0
- 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 +40 -1
- package/dist/src/lib/db-codegen/dbTypeIR.js +32 -8
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
- package/dist/src/lib/db-type-records.d.ts +125 -0
- package/dist/src/lib/db-type-records.js +237 -0
- package/dist/src/lib/db-type-records.js.map +1 -0
- package/dist/src/lib/db3-export.d.ts +322 -0
- package/dist/src/lib/db3-export.js +767 -0
- package/dist/src/lib/db3-export.js.map +1 -0
- package/dist/src/lib/db3-index-output.d.ts +116 -0
- package/dist/src/lib/db3-index-output.js +223 -0
- package/dist/src/lib/db3-index-output.js.map +1 -0
- package/dist/src/lib/db3-json-fields.d.ts +49 -0
- package/dist/src/lib/db3-json-fields.js +195 -0
- package/dist/src/lib/db3-json-fields.js.map +1 -0
- package/dist/src/lib/db3-type-archive.d.ts +59 -0
- package/dist/src/lib/db3-type-archive.js +95 -0
- package/dist/src/lib/db3-type-archive.js.map +1 -0
- package/dist/src/lib/db3-type-models.d.ts +148 -0
- package/dist/src/lib/db3-type-models.js +583 -0
- package/dist/src/lib/db3-type-models.js.map +1 -0
- package/dist/src/lib/deprecation.d.ts +2 -2
- package/dist/src/lib/deprecation.js +2 -2
- package/dist/src/lib/document-export-record-log.d.ts +7 -0
- package/dist/src/lib/document-export-record-log.js +9 -0
- package/dist/src/lib/document-export-record-log.js.map +1 -1
- package/dist/src/lib/document-ingest-artifact.d.ts +19 -0
- package/dist/src/lib/document-ingest-artifact.js +55 -6
- package/dist/src/lib/document-ingest-artifact.js.map +1 -1
- package/dist/src/lib/document-ingest-format2.d.ts +36 -0
- package/dist/src/lib/document-ingest-format2.js +78 -0
- package/dist/src/lib/document-ingest-format2.js.map +1 -0
- package/dist/src/lib/document-ingest-input.d.ts +9 -0
- package/dist/src/lib/document-ingest-input.js +28 -1
- package/dist/src/lib/document-ingest-input.js.map +1 -1
- package/dist/src/lib/document-ingest.d.ts +11 -1
- package/dist/src/lib/document-ingest.js +16 -0
- package/dist/src/lib/document-ingest.js.map +1 -1
- package/dist/src/lib/document-schema-rows.d.ts +42 -0
- package/dist/src/lib/document-schema-rows.js +53 -0
- package/dist/src/lib/document-schema-rows.js.map +1 -0
- 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 +142 -0
- package/dist/src/lib/function-authorize-check.js +311 -0
- package/dist/src/lib/function-authorize-check.js.map +1 -0
- package/dist/src/lib/function-authorize-view.d.ts +36 -0
- package/dist/src/lib/function-authorize-view.js +110 -0
- package/dist/src/lib/function-authorize-view.js.map +1 -0
- package/dist/src/lib/function-bundle.d.ts +27 -5
- package/dist/src/lib/function-bundle.js +142 -7
- package/dist/src/lib/function-bundle.js.map +1 -1
- package/dist/src/lib/function-collect.d.ts +112 -12
- package/dist/src/lib/function-collect.js +601 -12
- package/dist/src/lib/function-collect.js.map +1 -1
- package/dist/src/lib/function-db-types.d.ts +65 -11
- package/dist/src/lib/function-db-types.js +326 -157
- 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-grants-preflight.d.ts +99 -0
- package/dist/src/lib/function-grants-preflight.js +154 -2
- package/dist/src/lib/function-grants-preflight.js.map +1 -1
- package/dist/src/lib/function-lint.d.ts +85 -0
- package/dist/src/lib/function-lint.js +442 -0
- package/dist/src/lib/function-lint.js.map +1 -0
- package/dist/src/lib/function-log-row.js +21 -2
- package/dist/src/lib/function-log-row.js.map +1 -1
- package/dist/src/lib/function-run.d.ts +13 -21
- package/dist/src/lib/function-run.js +14 -27
- package/dist/src/lib/function-run.js.map +1 -1
- package/dist/src/lib/function-schema-codegen.d.ts +86 -22
- package/dist/src/lib/function-schema-codegen.js +194 -88
- 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 +120 -6
- package/dist/src/lib/function-sync.js +217 -26
- package/dist/src/lib/function-sync.js.map +1 -1
- package/dist/src/lib/function-trigger-listing.d.ts +11 -6
- package/dist/src/lib/function-trigger-listing.js +32 -11
- package/dist/src/lib/function-trigger-listing.js.map +1 -1
- package/dist/src/lib/function-typecheck.d.ts +52 -0
- package/dist/src/lib/function-typecheck.js +174 -54
- package/dist/src/lib/function-typecheck.js.map +1 -1
- package/dist/src/lib/function-versions.d.ts +2 -0
- package/dist/src/lib/function-versions.js +1 -0
- package/dist/src/lib/function-versions.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 +502 -0
- package/dist/src/lib/generated-command-status.js.map +1 -0
- package/dist/src/lib/generated-config-surfaces.d.ts +804 -140
- package/dist/src/lib/generated-config-surfaces.js +2491 -1806
- 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-trust-step.d.ts +67 -0
- package/dist/src/lib/hosting-trust-step.js +279 -0
- package/dist/src/lib/hosting-trust-step.js.map +1 -0
- package/dist/src/lib/hosting-trust.d.ts +77 -0
- package/dist/src/lib/hosting-trust.js +194 -0
- package/dist/src/lib/hosting-trust.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/init-assets.d.ts +2 -6
- package/dist/src/lib/init-assets.js +11 -27
- package/dist/src/lib/init-assets.js.map +1 -1
- package/dist/src/lib/init-ios-links.d.ts +11 -7
- package/dist/src/lib/init-ios-links.js +28 -22
- package/dist/src/lib/init-ios-links.js.map +1 -1
- package/dist/src/lib/init-login-note.d.ts +13 -0
- package/dist/src/lib/init-login-note.js +22 -0
- package/dist/src/lib/init-login-note.js.map +1 -0
- package/dist/src/lib/init-schema.d.ts +15 -0
- package/dist/src/lib/init-schema.js +54 -0
- package/dist/src/lib/init-schema.js.map +1 -1
- 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/json-value.d.ts +6 -0
- package/dist/src/lib/json-value.js +13 -0
- package/dist/src/lib/json-value.js.map +1 -0
- package/dist/src/lib/load-routes.d.ts +33 -0
- package/dist/src/lib/load-routes.js +35 -0
- package/dist/src/lib/load-routes.js.map +1 -0
- package/dist/src/lib/log-inspection.d.ts +23 -4
- package/dist/src/lib/log-inspection.js +14 -5
- package/dist/src/lib/log-inspection.js.map +1 -1
- package/dist/src/lib/login-exchange-check.d.ts +18 -0
- package/dist/src/lib/login-exchange-check.js +27 -0
- package/dist/src/lib/login-exchange-check.js.map +1 -0
- package/dist/src/lib/login-scope-lines.d.ts +17 -7
- package/dist/src/lib/login-scope-lines.js +33 -10
- package/dist/src/lib/login-scope-lines.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/object-status-filter.d.ts +9 -1
- package/dist/src/lib/object-status-filter.js +9 -1
- package/dist/src/lib/object-status-filter.js.map +1 -1
- package/dist/src/lib/output.d.ts +1 -1
- package/dist/src/lib/output.js +3 -1
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/pin-refusal-hint.d.ts +12 -0
- package/dist/src/lib/pin-refusal-hint.js +35 -0
- package/dist/src/lib/pin-refusal-hint.js.map +1 -0
- 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 +871 -0
- package/dist/src/lib/primitive-declaration.js.map +1 -0
- package/dist/src/lib/primitive-env-plugin.d.ts +99 -0
- package/dist/src/lib/primitive-env-plugin.js +408 -0
- package/dist/src/lib/primitive-env-plugin.js.map +1 -0
- package/dist/src/lib/project-login-apps.d.ts +8 -0
- package/dist/src/lib/project-login-apps.js +27 -0
- package/dist/src/lib/project-login-apps.js.map +1 -0
- package/dist/src/lib/prompt-schema-codegen.d.ts +36 -12
- package/dist/src/lib/prompt-schema-codegen.js +96 -100
- 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 +79 -0
- package/dist/src/lib/records-verbs.js +45 -0
- package/dist/src/lib/records-verbs.js.map +1 -0
- package/dist/src/lib/refresh-admin-credentials.d.ts +34 -4
- package/dist/src/lib/refresh-admin-credentials.js +85 -29
- package/dist/src/lib/refresh-admin-credentials.js.map +1 -1
- package/dist/src/lib/refresh-stored-login.d.ts +85 -0
- package/dist/src/lib/refresh-stored-login.js +233 -0
- package/dist/src/lib/refresh-stored-login.js.map +1 -0
- 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/row-field-rename.d.ts +18 -0
- package/dist/src/lib/row-field-rename.js +32 -0
- package/dist/src/lib/row-field-rename.js.map +1 -0
- package/dist/src/lib/run-status.d.ts +1 -1
- package/dist/src/lib/run-status.generated.d.ts +2 -2
- package/dist/src/lib/run-status.generated.js +3 -1
- package/dist/src/lib/run-status.generated.js.map +1 -1
- package/dist/src/lib/run-status.js +1 -1
- 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 +229 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.js +420 -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 +258 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +422 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -0
- 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/naming.d.ts +35 -0
- package/dist/src/lib/schema-codegen/naming.js +83 -0
- package/dist/src/lib/schema-codegen/naming.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 +109 -0
- package/dist/src/lib/schema-codegen/schemaToTs.js +269 -0
- package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -0
- 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-defs-module.d.ts +29 -0
- package/dist/src/lib/schema-defs-module.js +103 -0
- package/dist/src/lib/schema-defs-module.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/scope-request.d.ts +23 -11
- package/dist/src/lib/scope-request.js +69 -31
- package/dist/src/lib/scope-request.js.map +1 -1
- package/dist/src/lib/session-scope.d.ts +26 -0
- package/dist/src/lib/session-scope.js +58 -0
- package/dist/src/lib/session-scope.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 +25 -23
- 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 +169 -51
- package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +33 -9
- package/dist/src/lib/swift-codegen/schemaToSwift.js +215 -179
- package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
- package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +51 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js +239 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/swiftKeys.d.ts +19 -0
- package/dist/src/lib/swift-codegen/swiftKeys.js +31 -0
- package/dist/src/lib/swift-codegen/swiftKeys.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 +117 -31
- package/dist/src/lib/sync-resource-types.js +197 -189
- 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/template.d.ts +39 -3
- package/dist/src/lib/template.js +103 -14
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/test-case-file-names.d.ts +3 -5
- package/dist/src/lib/test-case-file-names.js +3 -5
- package/dist/src/lib/test-case-file-names.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/test-users.d.ts +25 -0
- package/dist/src/lib/test-users.js +36 -0
- package/dist/src/lib/test-users.js.map +1 -0
- package/dist/src/lib/toml-database-config.d.ts +4 -2
- package/dist/src/lib/toml-database-config.js +11 -6
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/toml-list-edit.d.ts +33 -0
- package/dist/src/lib/toml-list-edit.js +481 -0
- package/dist/src/lib/toml-list-edit.js.map +1 -0
- package/dist/src/lib/toml-scalar-edit.d.ts +9 -0
- package/dist/src/lib/toml-scalar-edit.js +73 -5
- 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/usage-meters.d.ts +16 -0
- package/dist/src/lib/usage-meters.js +52 -0
- package/dist/src/lib/usage-meters.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/webhook-capture.d.ts +43 -0
- package/dist/src/lib/webhook-capture.js +91 -0
- package/dist/src/lib/webhook-capture.js.map +1 -0
- package/dist/src/lib/webhook-deliver.d.ts +18 -20
- package/dist/src/lib/webhook-deliver.js +34 -89
- package/dist/src/lib/webhook-deliver.js.map +1 -1
- package/dist/src/lib/webhook-test-run.d.ts +32 -0
- package/dist/src/lib/webhook-test-run.js +108 -0
- package/dist/src/lib/webhook-test-run.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 +20 -65
- package/dist/src/validators.d.ts +7 -55
- package/dist/src/validators.js +7 -53
- package/dist/src/validators.js.map +1 -1
- package/dist/src/vite.d.ts +17 -0
- package/dist/src/vite.js +18 -0
- package/dist/src/vite.js.map +1 -0
- package/package.json +20 -9
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The TypeScript types of `user-properties.toml` (#5385, project
|
|
3
|
+
* `user-index-properties` phase 2).
|
|
4
|
+
*
|
|
5
|
+
* Two renderings of one schema, read with the server's own parser (the
|
|
6
|
+
* vendored `generated-properties-schema.ts`):
|
|
7
|
+
*
|
|
8
|
+
* - the `UserProperties` namespace of `functions/primitive.d.ts` (#5544),
|
|
9
|
+
* whose interfaces augment the SDK's empty `UserProperties`,
|
|
10
|
+
* `ClientUserProperties` and `UserUniqueProperties`, so a server function
|
|
11
|
+
* reads a user's properties typed;
|
|
12
|
+
* - `functions/generated/user-properties.generated.ts`, the same two
|
|
13
|
+
* interfaces for the app's own client code, beside the function invokers.
|
|
14
|
+
*
|
|
15
|
+
* Each field's type comes from the db3 field grammar's TypeScript mapping
|
|
16
|
+
* (`tsTypeForDbFieldType`), an `enum` field as its string-literal union, and
|
|
17
|
+
* every member is optional: a property a user has not set is absent.
|
|
18
|
+
* `ClientUserProperties` holds the fields whose `client` is not `none`.
|
|
19
|
+
*/
|
|
20
|
+
import { existsSync, readFileSync } from "fs";
|
|
21
|
+
import { join } from "path";
|
|
22
|
+
import { parseUserPropertiesToml } from "./generated-properties-schema.js";
|
|
23
|
+
import { FunctionSchemaCodegenError } from "../function-schema-codegen.js";
|
|
24
|
+
import { tsTypeForDbFieldType } from "../db-codegen/dbTsTypes.js";
|
|
25
|
+
import { fingerprintToml } from "../db-codegen/dbFingerprint.js";
|
|
26
|
+
import { atom, renderMember, tsStringLiteral, union } from "../codegen-shared/prettierStable.js";
|
|
27
|
+
import { renderValuesList } from "../schema-codegen/valuesLists.js";
|
|
28
|
+
import { pascalCase } from "../db-codegen/dbNaming.js";
|
|
29
|
+
/** The file the schema is authored in, at the tree's root. */
|
|
30
|
+
export const USER_PROPERTIES_FILE = "user-properties.toml";
|
|
31
|
+
/** The app's client types, beside the function invokers. */
|
|
32
|
+
export const USER_PROPERTIES_CLIENT_FILE = "user-properties.generated.ts";
|
|
33
|
+
/** Whether the tree declares user properties at all. */
|
|
34
|
+
export function treeHasUserProperties(configDir) {
|
|
35
|
+
return existsSync(join(configDir, USER_PROPERTIES_FILE));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The tree's `user-properties.toml`, parsed; null when it has none. A file
|
|
39
|
+
* that does not parse throws a `FunctionSchemaCodegenError` naming it, the
|
|
40
|
+
* failure every other generator's malformed source raises.
|
|
41
|
+
*/
|
|
42
|
+
export function userPropertiesSource(configDir) {
|
|
43
|
+
const path = join(configDir, USER_PROPERTIES_FILE);
|
|
44
|
+
if (!existsSync(path))
|
|
45
|
+
return null;
|
|
46
|
+
const text = readFileSync(path, "utf-8");
|
|
47
|
+
const parsed = parseUserPropertiesToml(text);
|
|
48
|
+
if ("reasons" in parsed) {
|
|
49
|
+
throw new FunctionSchemaCodegenError(`${USER_PROPERTIES_FILE}: ${parsed.reasons.map((r) => `${r.path ? `${r.path}: ` : ""}${r.reason}`).join("; ")}`);
|
|
50
|
+
}
|
|
51
|
+
return { text, schema: parsed.schema };
|
|
52
|
+
}
|
|
53
|
+
/** A field's TypeScript type: its enum as a string-literal union (quoted as Prettier quotes), else the field grammar's type. */
|
|
54
|
+
function userPropertyTypeNode(field) {
|
|
55
|
+
if (field.type === "string" && field.enum && field.enum.length > 0)
|
|
56
|
+
return union(field.enum.map((value) => atom(tsStringLiteral(value))));
|
|
57
|
+
return atom(tsTypeForDbFieldType(field.type));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* One interface, every member optional; `{}` with none. Members go through
|
|
61
|
+
* the shared Prettier-stable printer (#1565), so a long enum union wraps the
|
|
62
|
+
* way Prettier would and `--check` never reports a formatted file stale.
|
|
63
|
+
*/
|
|
64
|
+
function renderInterface(name, fields, exported) {
|
|
65
|
+
if (fields.length === 0)
|
|
66
|
+
return `${exported}interface ${name} {}`;
|
|
67
|
+
return [`${exported}interface ${name} {`, ...fields.map(([key, field]) => renderMember(1, key, true, userPropertyTypeNode(field))), "}"].join("\n");
|
|
68
|
+
}
|
|
69
|
+
const fieldsOf = (schema) => Object.entries(schema?.fields ?? {});
|
|
70
|
+
/** The names `ctx.users.getBy` takes: each unique field, then each named constraint, as `name: true` members. */
|
|
71
|
+
function renderUniqueNames(name, schema) {
|
|
72
|
+
const names = [...fieldsOf(schema).filter(([, field]) => field.unique).map(([key]) => key), ...(schema?.uniqueConstraints ?? []).map((c) => c.name)];
|
|
73
|
+
if (names.length === 0)
|
|
74
|
+
return `export interface ${name} {}`;
|
|
75
|
+
return [`export interface ${name} {`, ...names.map((key) => renderMember(1, key, false, atom("true"))), "}"].join("\n");
|
|
76
|
+
}
|
|
77
|
+
const clientFieldsOf = (schema) => fieldsOf(schema).filter(([, field]) => field.client !== "none");
|
|
78
|
+
/**
|
|
79
|
+
* The `UserProperties` namespace's declarations of `functions/primitive.d.ts`
|
|
80
|
+
* (#5544): every field, the client-visible ones, and the unique names
|
|
81
|
+
* `ctx.users.getBy` looks up (#5386); all empty with no schema.
|
|
82
|
+
*/
|
|
83
|
+
export function renderUserPropertiesDeclarations(schema, names) {
|
|
84
|
+
return [
|
|
85
|
+
`/** A user's properties, as ${USER_PROPERTIES_FILE} declares them. Every field is optional: a property a user has not set is absent. */\n${renderInterface(names.userProperties, fieldsOf(schema), "export ")}`,
|
|
86
|
+
`/** The properties a client session may reach: the fields whose \`client\` is not \`none\`. */\n${renderInterface(names.clientUserProperties, clientFieldsOf(schema), "export ")}`,
|
|
87
|
+
`/** The unique fields and constraints \`ctx.users.getBy\` looks up. */\n${renderUniqueNames(names.uniqueUserProperties, schema)}`,
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The value list of each enum field an interface declares (#5544):
|
|
92
|
+
* `<Interface><Field>Values`, two fields resolving to one name refused naming
|
|
93
|
+
* both.
|
|
94
|
+
*/
|
|
95
|
+
function valuesLists(interfaceName, fields) {
|
|
96
|
+
const byName = new Map();
|
|
97
|
+
const out = [];
|
|
98
|
+
for (const [key, field] of fields) {
|
|
99
|
+
if (field.type !== "string" || !field.enum || field.enum.length === 0)
|
|
100
|
+
continue;
|
|
101
|
+
const name = `${interfaceName}${pascalCase(key)}Values`;
|
|
102
|
+
const prior = byName.get(name);
|
|
103
|
+
if (prior !== undefined) {
|
|
104
|
+
throw new FunctionSchemaCodegenError(`${USER_PROPERTIES_FILE}: the value lists of \`fields.${prior}\` and \`fields.${key}\` both name \`${name}\` — rename one field so the two do not collide`);
|
|
105
|
+
}
|
|
106
|
+
byName.set(name, key);
|
|
107
|
+
out.push(renderValuesList({ name, path: `fields.${key}`, values: field.enum }));
|
|
108
|
+
}
|
|
109
|
+
return out;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* `functions/generated/user-properties.generated.ts`: the app's client types,
|
|
113
|
+
* fingerprinted by the TOML they came from, each interface followed by the
|
|
114
|
+
* value list of every enum field it declares (#5544).
|
|
115
|
+
*/
|
|
116
|
+
export function renderUserPropertiesClientTypes(source) {
|
|
117
|
+
return ([
|
|
118
|
+
[
|
|
119
|
+
`// AUTO-GENERATED FROM ${USER_PROPERTIES_FILE} — DO NOT EDIT.`,
|
|
120
|
+
"// Run `primitive functions codegen` to regenerate.",
|
|
121
|
+
`// fingerprint: ${fingerprintToml(source.text)}`,
|
|
122
|
+
].join("\n"),
|
|
123
|
+
`/** A user's properties, as ${USER_PROPERTIES_FILE} declares them. Every field is optional. */\n${renderInterface("UserProperties", fieldsOf(source.schema), "export ")}`,
|
|
124
|
+
...valuesLists("UserProperties", fieldsOf(source.schema)),
|
|
125
|
+
`/** The properties a client session may reach: the fields whose \`client\` is not \`none\`. */\n${renderInterface("ClientUserProperties", clientFieldsOf(source.schema), "export ")}`,
|
|
126
|
+
...valuesLists("ClientUserProperties", clientFieldsOf(source.schema)),
|
|
127
|
+
].join("\n\n") + "\n");
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=user-properties-codegen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-properties-codegen.js","sourceRoot":"","sources":["../../../../src/lib/user-properties/user-properties-codegen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAqD,MAAM,kCAAkC,CAAC;AAC9H,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,C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CAAC,CAAC;QACzD,mGAAmG,eAAe,CAAC,sBAAsB,EAAE,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,EAAE;QACtL,GAAG,WAAW,CAAC,sBAAsB,EAAE,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;KACtE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The parts of `primitive users walk` that need no server: the start's flag
|
|
3
|
+
* parsing, the wait loop, and the status's human form.
|
|
4
|
+
*/
|
|
5
|
+
import type { UserWalkStartBody } from "./api-client.js";
|
|
6
|
+
/** A walk's terminal statuses. */
|
|
7
|
+
export declare const USER_WALK_TERMINAL: string[];
|
|
8
|
+
/** How long `--wait` retries a 404 after the start it made: the run index may lag the start. */
|
|
9
|
+
export declare const USER_WALK_INDEX_GRACE_MS = 10000;
|
|
10
|
+
/** A JSON flag's value, or a refusal naming the flag; `undefined` when absent. */
|
|
11
|
+
export declare function parseWalkJsonFlag(flag: string, raw: string | undefined): unknown;
|
|
12
|
+
/**
|
|
13
|
+
* The body of `users walk start` from its flags (the filter already read by
|
|
14
|
+
* `parseFilterOptions`). Refuses a malformed number or JSON value before any
|
|
15
|
+
* request; `--sort` without `--snapshot` is the server's to refuse.
|
|
16
|
+
*/
|
|
17
|
+
export declare function walkStartBodyOf(options: Record<string, any>, filter: Record<string, unknown> | undefined): UserWalkStartBody;
|
|
18
|
+
/**
|
|
19
|
+
* Poll `read` once a second until the walk is terminal; answers the last
|
|
20
|
+
* read, or null when `timeoutMs` passed first. A 404 within
|
|
21
|
+
* {@link USER_WALK_INDEX_GRACE_MS} of `startedAt` is retried (the run index
|
|
22
|
+
* may not have the row yet); any later one is thrown.
|
|
23
|
+
*/
|
|
24
|
+
export declare function waitForUserWalk(read: () => Promise<any>, timeoutMs: number, startedAt: number, intervalMs?: number): Promise<any | null>;
|
|
25
|
+
/** `done` and `failed` of a walk's status answer. */
|
|
26
|
+
export declare function walkCounts(answer: any): {
|
|
27
|
+
done: number;
|
|
28
|
+
failed: number;
|
|
29
|
+
};
|
|
30
|
+
/** The status's human form, label and value. */
|
|
31
|
+
export declare function walkStatusLines(answer: any): Array<[string, string | null]>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The parts of `primitive users walk` that need no server: the start's flag
|
|
3
|
+
* parsing, the wait loop, and the status's human form.
|
|
4
|
+
*/
|
|
5
|
+
import { formatDate } from "./output.js";
|
|
6
|
+
import { parsePositiveIntegerFlag, UserIndexFlagError } from "./user-index.js";
|
|
7
|
+
/** A walk's terminal statuses. */
|
|
8
|
+
export const USER_WALK_TERMINAL = ["completed", "failed", "terminated"];
|
|
9
|
+
/** How long `--wait` retries a 404 after the start it made: the run index may lag the start. */
|
|
10
|
+
export const USER_WALK_INDEX_GRACE_MS = 10_000;
|
|
11
|
+
/** A JSON flag's value, or a refusal naming the flag; `undefined` when absent. */
|
|
12
|
+
export function parseWalkJsonFlag(flag, raw) {
|
|
13
|
+
if (raw === undefined)
|
|
14
|
+
return undefined;
|
|
15
|
+
try {
|
|
16
|
+
return JSON.parse(raw);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
throw new UserIndexFlagError(`Invalid ${flag} JSON.`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The body of `users walk start` from its flags (the filter already read by
|
|
24
|
+
* `parseFilterOptions`). Refuses a malformed number or JSON value before any
|
|
25
|
+
* request; `--sort` without `--snapshot` is the server's to refuse.
|
|
26
|
+
*/
|
|
27
|
+
export function walkStartBodyOf(options, filter) {
|
|
28
|
+
const sort = parseWalkJsonFlag("--sort", options.sort);
|
|
29
|
+
const input = parseWalkJsonFlag("--input", options.input);
|
|
30
|
+
const batchSize = options.batchSize !== undefined ? parsePositiveIntegerFlag("batch-size", String(options.batchSize)) : undefined;
|
|
31
|
+
const concurrency = options.concurrency !== undefined ? parsePositiveIntegerFlag("concurrency", String(options.concurrency)) : undefined;
|
|
32
|
+
return {
|
|
33
|
+
function: String(options.function),
|
|
34
|
+
key: String(options.key),
|
|
35
|
+
...(filter !== undefined ? { filter } : {}),
|
|
36
|
+
...(sort !== undefined ? { sort: sort } : {}),
|
|
37
|
+
...(input !== undefined ? { input } : {}),
|
|
38
|
+
...(batchSize !== undefined ? { batchSize } : {}),
|
|
39
|
+
...(concurrency !== undefined ? { concurrency } : {}),
|
|
40
|
+
...(options.snapshot ? { snapshot: true } : {}),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Poll `read` once a second until the walk is terminal; answers the last
|
|
45
|
+
* read, or null when `timeoutMs` passed first. A 404 within
|
|
46
|
+
* {@link USER_WALK_INDEX_GRACE_MS} of `startedAt` is retried (the run index
|
|
47
|
+
* may not have the row yet); any later one is thrown.
|
|
48
|
+
*/
|
|
49
|
+
export async function waitForUserWalk(read, timeoutMs, startedAt, intervalMs = 1000) {
|
|
50
|
+
const deadline = Date.now() + timeoutMs;
|
|
51
|
+
for (;;) {
|
|
52
|
+
let answer = null;
|
|
53
|
+
try {
|
|
54
|
+
answer = await read();
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
if (!(err?.statusCode === 404 && Date.now() - startedAt < USER_WALK_INDEX_GRACE_MS))
|
|
58
|
+
throw err;
|
|
59
|
+
}
|
|
60
|
+
if (answer && USER_WALK_TERMINAL.includes(String(answer.status?.status)))
|
|
61
|
+
return answer;
|
|
62
|
+
if (Date.now() + intervalMs > deadline)
|
|
63
|
+
return null;
|
|
64
|
+
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** `done` and `failed` of a walk's status answer. */
|
|
68
|
+
export function walkCounts(answer) {
|
|
69
|
+
const batches = answer?.status?.walk?.batches ?? {};
|
|
70
|
+
return { done: Number(batches.done ?? 0), failed: Number(batches.failed ?? 0) };
|
|
71
|
+
}
|
|
72
|
+
const count = (value) => (value === null || value === undefined ? "?" : String(value));
|
|
73
|
+
/** The status's human form, label and value. */
|
|
74
|
+
export function walkStatusLines(answer) {
|
|
75
|
+
const walk = answer?.status?.walk ?? null;
|
|
76
|
+
const run = answer?.run ?? {};
|
|
77
|
+
const batches = walk?.batches ?? null;
|
|
78
|
+
const partitions = Array.isArray(walk?.partitions) ? walk.partitions : [];
|
|
79
|
+
const lines = [
|
|
80
|
+
["Status", String(answer?.status?.status ?? run.status ?? "")],
|
|
81
|
+
["Run", String(run.runId ?? walk?.runId ?? "")],
|
|
82
|
+
["Walk", String(walk?.walkId ?? run.walkId ?? "")],
|
|
83
|
+
["Function", String(walk?.functionKey ?? run.functionKey ?? "")],
|
|
84
|
+
["Key", String(walk?.key ?? run.key ?? "")],
|
|
85
|
+
["Matched", walk?.matched ? `${count(walk.matched.count)}${walk.matched.exact === false ? " (so far)" : ""}` : null],
|
|
86
|
+
[
|
|
87
|
+
"Batches",
|
|
88
|
+
batches
|
|
89
|
+
? `${count(batches.done)} done / ${count(batches.failed)} failed / ${count(batches.inFlight)} in flight / ` +
|
|
90
|
+
`${count(batches.retrying)} retrying / ${count(batches.remaining)} remaining of ${count(batches.total)}`
|
|
91
|
+
: null,
|
|
92
|
+
],
|
|
93
|
+
["Partitions", walk ? `${partitions.filter((p) => p.done === true).length} done of ${partitions.length}` : null],
|
|
94
|
+
["Started", run.startedAt ?? walk?.startedAt ? formatDate(run.startedAt ?? walk?.startedAt) : null],
|
|
95
|
+
["Ended", run.endedAt ?? walk?.endedAt ? formatDate(run.endedAt ?? walk?.endedAt) : null],
|
|
96
|
+
];
|
|
97
|
+
const errorText = walk?.lastError ?? run.errorMessage ?? null;
|
|
98
|
+
if (errorText)
|
|
99
|
+
lines.push(["Error", String(errorText)]);
|
|
100
|
+
return lines;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=user-walk.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SACT;QACD,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,MAAM,YAAY,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAChH,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,IAAI,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,IAAI,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACnG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;KAC1F,CAAC;IACF,MAAM,SAAS,GAAG,IAAI,EAAE,SAAS,IAAI,GAAG,CAAC,YAAY,IAAI,IAAI,CAAC;IAC9D,IAAI,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACxD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform ceiling on a webhook body (`MAX_WEBHOOK_BODY_BYTES_LIMIT`, 25 MiB).
|
|
3
|
+
* A per-webhook cap can be lower — that one is the server's call and comes back
|
|
4
|
+
* as a `body_too_large` verdict. This bound only stops the CLI from reading and
|
|
5
|
+
* encoding a file no webhook could ever accept.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MAX_VERIFY_BODY_BYTES: number;
|
|
8
|
+
/** A delivery captured from a provider: its headers and its exact body bytes. */
|
|
9
|
+
export interface CapturedDelivery {
|
|
10
|
+
/**
|
|
11
|
+
* Ordered pairs, not an object: a real capture can carry the same field name
|
|
12
|
+
* on more than one line, which an object cannot represent.
|
|
13
|
+
*/
|
|
14
|
+
headers: Array<[string, string]>;
|
|
15
|
+
/** Exactly one body form — the server refuses a request naming both. */
|
|
16
|
+
body: {
|
|
17
|
+
rawBody: string;
|
|
18
|
+
} | {
|
|
19
|
+
bodyBase64: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Read `--header`, `--body` and `--body-file` into the body of a verify
|
|
24
|
+
* request, or say what is wrong with them.
|
|
25
|
+
*
|
|
26
|
+
* Used by `functions triggers verify`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function readCapturedDelivery(options: {
|
|
29
|
+
header?: string[];
|
|
30
|
+
body?: string;
|
|
31
|
+
bodyFile?: string;
|
|
32
|
+
}): {
|
|
33
|
+
ok: true;
|
|
34
|
+
delivery: CapturedDelivery;
|
|
35
|
+
} | {
|
|
36
|
+
ok: false;
|
|
37
|
+
message: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Print a verify verdict. Returns the exit code: 0 when the signature verifies
|
|
41
|
+
* and 1 otherwise, so the command composes in a script.
|
|
42
|
+
*/
|
|
43
|
+
export declare function renderVerifyResult(result: any, asJson: boolean): number;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { readFileSync, statSync } from "fs";
|
|
2
|
+
import { success, error, keyValue, json, warn } from "./output.js";
|
|
3
|
+
/**
|
|
4
|
+
* Platform ceiling on a webhook body (`MAX_WEBHOOK_BODY_BYTES_LIMIT`, 25 MiB).
|
|
5
|
+
* A per-webhook cap can be lower — that one is the server's call and comes back
|
|
6
|
+
* as a `body_too_large` verdict. This bound only stops the CLI from reading and
|
|
7
|
+
* encoding a file no webhook could ever accept.
|
|
8
|
+
*/
|
|
9
|
+
export const MAX_VERIFY_BODY_BYTES = 25 * 1024 * 1024;
|
|
10
|
+
/**
|
|
11
|
+
* Read `--header`, `--body` and `--body-file` into the body of a verify
|
|
12
|
+
* request, or say what is wrong with them.
|
|
13
|
+
*
|
|
14
|
+
* Used by `functions triggers verify`.
|
|
15
|
+
*/
|
|
16
|
+
export function readCapturedDelivery(options) {
|
|
17
|
+
if (options.body !== undefined && options.bodyFile !== undefined) {
|
|
18
|
+
return { ok: false, message: "Pass --body or --body-file, not both." };
|
|
19
|
+
}
|
|
20
|
+
let body;
|
|
21
|
+
if (options.bodyFile !== undefined) {
|
|
22
|
+
let bytes;
|
|
23
|
+
try {
|
|
24
|
+
// Size first: a mistakenly-passed large file should be a clear CLI
|
|
25
|
+
// error rather than a buffer the command tries to base64 and ship.
|
|
26
|
+
const { size } = statSync(options.bodyFile);
|
|
27
|
+
if (size > MAX_VERIFY_BODY_BYTES) {
|
|
28
|
+
return {
|
|
29
|
+
ok: false,
|
|
30
|
+
message: `--body-file is ${size} bytes, over the ${MAX_VERIFY_BODY_BYTES}-byte platform maximum for a webhook body. A delivery that large is refused before its signature is checked.`,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
bytes = readFileSync(options.bodyFile);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
return { ok: false, message: `Could not read --body-file: ${err.message}` };
|
|
37
|
+
}
|
|
38
|
+
// A signature is over BYTES. Decoding a capture that is not valid UTF-8
|
|
39
|
+
// replaces each bad byte with U+FFFD, so sending it as `rawBody` would
|
|
40
|
+
// check the signature against bytes the provider never sent and report a
|
|
41
|
+
// confident `sig_invalid` — the wrong answer in exactly the case this
|
|
42
|
+
// command exists for. `bodyBase64` carries those bytes intact, so only a
|
|
43
|
+
// body that round-trips losslessly goes as text.
|
|
44
|
+
const asText = bytes.toString("utf-8");
|
|
45
|
+
body = Buffer.from(asText, "utf-8").equals(bytes)
|
|
46
|
+
? { rawBody: asText }
|
|
47
|
+
: { bodyBase64: bytes.toString("base64") };
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
// An empty body is a legitimate delivery, so an omitted --body means "the
|
|
51
|
+
// delivery carried no body" rather than "no body was supplied".
|
|
52
|
+
body = { rawBody: options.body ?? "" };
|
|
53
|
+
}
|
|
54
|
+
const headers = [];
|
|
55
|
+
for (const entry of options.header || []) {
|
|
56
|
+
const separator = entry.indexOf(":");
|
|
57
|
+
if (separator <= 0) {
|
|
58
|
+
return { ok: false, message: `Invalid --header '${entry}'. Use 'Name: value'.` };
|
|
59
|
+
}
|
|
60
|
+
headers.push([entry.slice(0, separator).trim(), entry.slice(separator + 1).trim()]);
|
|
61
|
+
}
|
|
62
|
+
return { ok: true, delivery: { headers, body } };
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Print a verify verdict. Returns the exit code: 0 when the signature verifies
|
|
66
|
+
* and 1 otherwise, so the command composes in a script.
|
|
67
|
+
*/
|
|
68
|
+
export function renderVerifyResult(result, asJson) {
|
|
69
|
+
if (asJson) {
|
|
70
|
+
json(result);
|
|
71
|
+
}
|
|
72
|
+
else if (result.verified) {
|
|
73
|
+
success("Signature verified.");
|
|
74
|
+
keyValue(" Scheme", String(result.verificationScheme));
|
|
75
|
+
if (result.dedupKey)
|
|
76
|
+
keyValue(" Dedup key", String(result.dedupKey));
|
|
77
|
+
if (result.externalEventId) {
|
|
78
|
+
keyValue(" Event ID", String(result.externalEventId));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
error("Signature did NOT verify.");
|
|
83
|
+
keyValue(" Scheme", String(result.verificationScheme));
|
|
84
|
+
keyValue(" Reason", String(result.rejectionReason || "unknown"));
|
|
85
|
+
}
|
|
86
|
+
if (result.webhookStatus && result.webhookStatus !== "active") {
|
|
87
|
+
warn(`This webhook is ${result.webhookStatus} — a live delivery would be refused before its signature was checked.`);
|
|
88
|
+
}
|
|
89
|
+
return result.verified ? 0 : 1;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=webhook-capture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-capture.js","sourceRoot":"","sources":["../../../src/l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C;QAC3B,OAAO,CAAC,qBAAqB,CAAC,CAAC;QAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACxD,IAAI,MAAM,CAAC,QAAQ;YAAE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QACtE,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;YAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACxD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,IAAI,SAAS,CAAC,CAAC,CAAC;IACpE,CAAC;IACD,IAAI,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,KAAK,QAAQ,EAAE,CAAC;QAC9D,IAAI,CACF,mBAAmB,MAAM,CAAC,aAAa,uEAAuE,CAC/G,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Deliver a signed preview through a webhook's real receive path
|
|
2
|
+
* Deliver a signed preview through a webhook trigger's real receive path
|
|
3
|
+
* (#3321; a function's trigger since #3190 retired the standalone webhook).
|
|
3
4
|
*
|
|
4
|
-
* `primitive
|
|
5
|
-
* composes two capabilities that already exist:
|
|
5
|
+
* `primitive functions triggers test <key> --deliver` adds no server dispatch
|
|
6
|
+
* surface. It composes two capabilities that already exist:
|
|
6
7
|
*
|
|
7
|
-
* 1. the admin-gated preview
|
|
8
|
+
* 1. the admin-gated preview
|
|
9
|
+
* `POST /admin/api/apps/{appId}/functions/{functionId}/triggers/webhook/test`,
|
|
8
10
|
* which signs a payload with the same rule the receiver verifies with, and
|
|
9
|
-
* 2. the public receive endpoint `POST /app/{appId}/webhook/{
|
|
11
|
+
* 2. the public receive endpoint `POST /app/{appId}/webhook/{functionKey}`,
|
|
10
12
|
* the unauthenticated path a provider posts to.
|
|
11
13
|
*
|
|
12
14
|
* So the delivery is a real delivery: the body cap, the availability check, the
|
|
@@ -42,10 +44,8 @@
|
|
|
42
44
|
* this correlator can reach, and is reported as unconfirmed — with what
|
|
43
45
|
* the absence of the key means — rather than named from a row.
|
|
44
46
|
* - **A run is confirmed, not assumed.** An `accepted` row names a run id
|
|
45
|
-
* before the run finishes,
|
|
46
|
-
*
|
|
47
|
-
* throws. So the named run is looked up on the authenticated runs surface
|
|
48
|
-
* before dispatch is claimed.
|
|
47
|
+
* before the run finishes, so the named run is looked up on the
|
|
48
|
+
* function's authenticated runs surface before dispatch is claimed.
|
|
49
49
|
* - **Everything else is named for what it was** — a suppressed replay, a
|
|
50
50
|
* 410/403/401 refusal, each of which the receive endpoint reports for
|
|
51
51
|
* itself — or reported as "dispatch unconfirmed", which is where a
|
|
@@ -61,9 +61,9 @@ export interface WebhookPreview {
|
|
|
61
61
|
signatureHeaders: Record<string, string>;
|
|
62
62
|
verificationScheme: string;
|
|
63
63
|
timestamp?: number;
|
|
64
|
-
/** #3321 — the receive path's key
|
|
64
|
+
/** #3321 — the receive path's key, which is the function key. */
|
|
65
65
|
webhookKey?: string | null;
|
|
66
|
-
/** #3321 — the owning server function
|
|
66
|
+
/** #3321 — the owning server function. */
|
|
67
67
|
functionId?: string | null;
|
|
68
68
|
/** #3321 — the correlator; null for scheme `none`. */
|
|
69
69
|
dedupKey?: string | null;
|
|
@@ -90,9 +90,10 @@ export interface RunPage {
|
|
|
90
90
|
/**
|
|
91
91
|
* The admin reads and the one admin write this flow needs.
|
|
92
92
|
*
|
|
93
|
-
* `
|
|
94
|
-
*
|
|
95
|
-
* this module be proven end to end
|
|
93
|
+
* `functionWebhookDeliverClient` answers them through a function's trigger
|
|
94
|
+
* routes; the live api test implements the same three over the test context's
|
|
95
|
+
* authenticated client, which is what lets this module be proven end to end
|
|
96
|
+
* against a real server.
|
|
96
97
|
*/
|
|
97
98
|
export interface WebhookDeliverClient {
|
|
98
99
|
testWebhook(appId: string, webhookId: string, payload?: any): Promise<any>;
|
|
@@ -100,20 +101,17 @@ export interface WebhookDeliverClient {
|
|
|
100
101
|
limit?: number;
|
|
101
102
|
cursor?: string;
|
|
102
103
|
}): Promise<EventPage>;
|
|
103
|
-
getWebhook(appId: string, webhookId: string): Promise<any>;
|
|
104
104
|
listFunctionRuns(appId: string, functionId: string, params?: {
|
|
105
105
|
limit?: number;
|
|
106
106
|
cursor?: string;
|
|
107
107
|
}): Promise<RunPage>;
|
|
108
|
-
listWorkflowRuns(appId: string, workflowId: string, params?: {
|
|
109
|
-
limit?: number;
|
|
110
|
-
cursor?: string;
|
|
111
|
-
}): Promise<RunPage>;
|
|
112
108
|
}
|
|
113
109
|
export type FetchLike = (url: string, init: any) => Promise<any>;
|
|
114
110
|
export interface DeliverInput {
|
|
115
111
|
appId: string;
|
|
116
112
|
webhookId: string;
|
|
113
|
+
/** The function key: the receive path, and what the hints name. */
|
|
114
|
+
functionKey: string;
|
|
117
115
|
/** The payload to sign, passed to the preview endpoint unchanged. */
|
|
118
116
|
payload?: any;
|
|
119
117
|
/** The API base URL — the receive endpoint lives under it. */
|
|
@@ -147,7 +145,7 @@ export interface DeliveryAttempt {
|
|
|
147
145
|
export interface RunConfirmation {
|
|
148
146
|
runId: string | null;
|
|
149
147
|
confirmed: boolean;
|
|
150
|
-
surface: "function" |
|
|
148
|
+
surface: "function" | null;
|
|
151
149
|
reason: string | null;
|
|
152
150
|
}
|
|
153
151
|
export interface DeliverResult {
|