primitive-admin 1.1.0-alpha.6 → 1.1.0-alpha.60
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 +389 -71
- package/assets/skill/skills/primitive-platform/SKILL.md +670 -0
- package/dist/bin/primitive.d.ts +2 -0
- package/dist/bin/primitive.js +287 -17
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/admins.d.ts +2 -0
- package/dist/src/commands/admins.js +138 -19
- package/dist/src/commands/admins.js.map +1 -1
- package/dist/src/commands/analytics.d.ts +2 -0
- package/dist/src/commands/analytics.js +554 -55
- package/dist/src/commands/analytics.js.map +1 -1
- package/dist/src/commands/apps.d.ts +2 -0
- package/dist/src/commands/apps.js +27 -80
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth.d.ts +2 -0
- package/dist/src/commands/auth.js +177 -7
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.d.ts +2 -0
- package/dist/src/commands/blob-buckets.js +330 -0
- package/dist/src/commands/blob-buckets.js.map +1 -0
- package/dist/src/commands/catalog.d.ts +2 -0
- package/dist/src/commands/catalog.js +37 -38
- package/dist/src/commands/catalog.js.map +1 -1
- package/dist/src/commands/collection-type-configs.d.ts +2 -0
- package/dist/src/commands/collection-type-configs.js +92 -0
- package/dist/src/commands/collection-type-configs.js.map +1 -0
- package/dist/src/commands/collections.d.ts +2 -0
- package/dist/src/commands/collections.js +526 -0
- package/dist/src/commands/collections.js.map +1 -0
- package/dist/src/commands/comparisons.d.ts +2 -0
- package/dist/src/commands/comparisons.js +6 -6
- package/dist/src/commands/comparisons.js.map +1 -1
- package/dist/src/commands/config.d.ts +35 -0
- package/dist/src/commands/config.js +437 -0
- package/dist/src/commands/config.js.map +1 -0
- package/dist/src/commands/connections.d.ts +2 -0
- package/dist/src/commands/connections.js +100 -0
- package/dist/src/commands/connections.js.map +1 -0
- package/dist/src/commands/cron-triggers.d.ts +2 -0
- package/dist/src/commands/cron-triggers.js +204 -0
- package/dist/src/commands/cron-triggers.js.map +1 -0
- package/dist/src/commands/database-types.d.ts +2 -0
- package/dist/src/commands/database-types.js +171 -0
- package/dist/src/commands/database-types.js.map +1 -0
- package/dist/src/commands/databases.d.ts +65 -0
- package/dist/src/commands/databases.js +2153 -96
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.d.ts +2 -0
- package/dist/src/commands/documents.js +1230 -19
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/email-templates.d.ts +2 -0
- package/dist/src/commands/email-templates.js +174 -0
- package/dist/src/commands/email-templates.js.map +1 -0
- package/dist/src/commands/env.d.ts +12 -0
- package/dist/src/commands/env.js +260 -0
- package/dist/src/commands/env.js.map +1 -0
- package/dist/src/commands/group-type-configs.d.ts +2 -0
- package/dist/src/commands/group-type-configs.js +86 -0
- package/dist/src/commands/group-type-configs.js.map +1 -0
- package/dist/src/commands/groups.d.ts +2 -0
- package/dist/src/commands/groups.js +38 -99
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.d.ts +223 -0
- package/dist/src/commands/guides.js +617 -65
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/init.d.ts +17 -0
- package/dist/src/commands/init.js +964 -202
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.d.ts +2 -0
- package/dist/src/commands/integrations.js +484 -205
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/llm.d.ts +2 -0
- package/dist/src/commands/llm.js +13 -8
- package/dist/src/commands/llm.js.map +1 -1
- package/dist/src/commands/locks.d.ts +8 -0
- package/dist/src/commands/locks.js +160 -0
- package/dist/src/commands/locks.js.map +1 -0
- package/dist/src/commands/metadata.d.ts +2 -0
- package/dist/src/commands/metadata.js +406 -0
- package/dist/src/commands/metadata.js.map +1 -0
- package/dist/src/commands/prompts.d.ts +2 -0
- package/dist/src/commands/prompts.js +135 -355
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rule-sets.d.ts +3 -0
- package/dist/src/commands/rule-sets.js +271 -0
- package/dist/src/commands/rule-sets.js.map +1 -0
- package/dist/src/commands/scripts.d.ts +20 -0
- package/dist/src/commands/scripts.js +739 -0
- package/dist/src/commands/scripts.js.map +1 -0
- package/dist/src/commands/secrets.d.ts +2 -0
- package/dist/src/commands/secrets.js +108 -0
- package/dist/src/commands/secrets.js.map +1 -0
- package/dist/src/commands/sessions.d.ts +2 -0
- package/dist/src/commands/sessions.js +75 -0
- package/dist/src/commands/sessions.js.map +1 -0
- package/dist/src/commands/settings.d.ts +18 -0
- package/dist/src/commands/settings.js +54 -0
- package/dist/src/commands/settings.js.map +1 -0
- package/dist/src/commands/skill.d.ts +2 -0
- package/dist/src/commands/skill.js +29 -0
- package/dist/src/commands/skill.js.map +1 -0
- package/dist/src/commands/sync-app-settings.d.ts +125 -0
- package/dist/src/commands/sync-app-settings.js +380 -0
- package/dist/src/commands/sync-app-settings.js.map +1 -0
- package/dist/src/commands/sync.d.ts +958 -0
- package/dist/src/commands/sync.js +8954 -812
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/tokens.d.ts +2 -0
- package/dist/src/commands/tokens.js +130 -21
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/users.d.ts +2 -0
- package/dist/src/commands/users.js +440 -22
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/vars.d.ts +8 -0
- package/dist/src/commands/vars.js +96 -0
- package/dist/src/commands/vars.js.map +1 -0
- package/dist/src/commands/waitlist.d.ts +2 -0
- package/dist/src/commands/waitlist.js +10 -10
- package/dist/src/commands/waitlist.js.map +1 -1
- package/dist/src/commands/webhooks.d.ts +2 -0
- package/dist/src/commands/webhooks.js +442 -0
- package/dist/src/commands/webhooks.js.map +1 -0
- package/dist/src/commands/workflows.d.ts +94 -0
- package/dist/src/commands/workflows.js +1581 -448
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +1814 -0
- package/dist/src/lib/api-client.js +1655 -103
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +130 -0
- package/dist/src/lib/app-settings-descriptor.js +262 -0
- package/dist/src/lib/app-settings-descriptor.js.map +1 -0
- package/dist/src/lib/auth-flow.d.ts +8 -0
- package/dist/src/lib/batch.d.ts +26 -0
- package/dist/src/lib/batch.js +32 -0
- package/dist/src/lib/batch.js.map +1 -0
- package/dist/src/lib/block-layout.d.ts +160 -0
- package/dist/src/lib/block-layout.js +451 -0
- package/dist/src/lib/block-layout.js.map +1 -0
- package/dist/src/lib/canonical-json.d.ts +12 -0
- package/dist/src/lib/canonical-json.js +35 -0
- package/dist/src/lib/canonical-json.js.map +1 -0
- package/dist/src/lib/channel.d.ts +30 -0
- package/dist/src/lib/channel.js +68 -0
- package/dist/src/lib/channel.js.map +1 -0
- package/dist/src/lib/cli-manifest.d.ts +68 -0
- package/dist/src/lib/cli-manifest.js +71 -0
- package/dist/src/lib/cli-manifest.js.map +1 -0
- package/dist/src/lib/codegen-shared/generatedFiles.d.ts +97 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js +184 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
- package/dist/src/lib/codegen-shared/prettierStable.d.ts +262 -0
- package/dist/src/lib/codegen-shared/prettierStable.js +610 -0
- package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +68 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +168 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -0
- package/dist/src/lib/config-object-descriptor.d.ts +108 -0
- package/dist/src/lib/config-object-descriptor.js +607 -0
- package/dist/src/lib/config-object-descriptor.js.map +1 -0
- package/dist/src/lib/config-payload.d.ts +85 -0
- package/dist/src/lib/config-payload.js +105 -0
- package/dist/src/lib/config-payload.js.map +1 -0
- package/dist/src/lib/config-surface.d.ts +93 -0
- package/dist/src/lib/config-surface.js +178 -0
- package/dist/src/lib/config-surface.js.map +1 -0
- package/dist/src/lib/config-toml.d.ts +10 -0
- package/dist/src/lib/config-toml.js +42 -0
- package/dist/src/lib/config-toml.js.map +1 -0
- package/dist/src/lib/config.d.ts +53 -0
- package/dist/src/lib/config.js +92 -53
- package/dist/src/lib/config.js.map +1 -1
- package/dist/src/lib/confirm-prompt.d.ts +83 -0
- package/dist/src/lib/confirm-prompt.js +110 -0
- package/dist/src/lib/confirm-prompt.js.map +1 -0
- package/dist/src/lib/constants.d.ts +11 -0
- package/dist/src/lib/constants.js +12 -0
- package/dist/src/lib/constants.js.map +1 -0
- package/dist/src/lib/crash-handlers.d.ts +20 -0
- package/dist/src/lib/crash-handlers.js +49 -0
- package/dist/src/lib/crash-handlers.js.map +1 -0
- package/dist/src/lib/credentials-store.d.ts +89 -0
- package/dist/src/lib/credentials-store.js +330 -0
- package/dist/src/lib/credentials-store.js.map +1 -0
- package/dist/src/lib/csv.d.ts +47 -0
- package/dist/src/lib/csv.js +172 -0
- package/dist/src/lib/csv.js.map +1 -0
- package/dist/src/lib/data-input.d.ts +23 -0
- package/dist/src/lib/data-input.js +50 -0
- package/dist/src/lib/data-input.js.map +1 -0
- package/dist/src/lib/db-codegen/dbFingerprint.d.ts +10 -0
- package/dist/src/lib/db-codegen/dbFingerprint.js +17 -0
- package/dist/src/lib/db-codegen/dbFingerprint.js.map +1 -0
- package/dist/src/lib/db-codegen/dbGenerator.d.ts +67 -0
- package/dist/src/lib/db-codegen/dbGenerator.js +170 -0
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -0
- package/dist/src/lib/db-codegen/dbNaming.d.ts +87 -0
- package/dist/src/lib/db-codegen/dbNaming.js +180 -0
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -0
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +272 -0
- package/dist/src/lib/db-codegen/dbTemplates.js +480 -0
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -0
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +73 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js +139 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -0
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +146 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js +517 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +112 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +211 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
- package/dist/src/lib/env-resolver.d.ts +62 -0
- package/dist/src/lib/env-resolver.js +121 -0
- package/dist/src/lib/env-resolver.js.map +1 -0
- package/dist/src/lib/fetch.d.ts +5 -0
- package/dist/src/lib/generated-allowlist.d.ts +28 -0
- package/dist/src/lib/generated-allowlist.js +266 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -0
- package/dist/src/lib/generated-config-surfaces.d.ts +578 -0
- package/dist/src/lib/generated-config-surfaces.js +3630 -0
- package/dist/src/lib/generated-config-surfaces.js.map +1 -0
- package/dist/src/lib/generated-template-lint.d.ts +206 -0
- package/dist/src/lib/generated-template-lint.js +589 -0
- package/dist/src/lib/generated-template-lint.js.map +1 -0
- package/dist/src/lib/generated-workflow-model-fields.d.ts +20 -0
- package/dist/src/lib/generated-workflow-model-fields.js +53 -0
- package/dist/src/lib/generated-workflow-model-fields.js.map +1 -0
- package/dist/src/lib/google-client-secret-status.d.ts +35 -0
- package/dist/src/lib/google-client-secret-status.js +56 -0
- package/dist/src/lib/google-client-secret-status.js.map +1 -0
- package/dist/src/lib/init-config.d.ts +81 -0
- package/dist/src/lib/init-config.js +149 -0
- package/dist/src/lib/init-config.js.map +1 -0
- package/dist/src/lib/log-inspection.d.ts +568 -0
- package/dist/src/lib/log-inspection.js +639 -0
- package/dist/src/lib/log-inspection.js.map +1 -0
- package/dist/src/lib/migration-nag.d.ts +49 -0
- package/dist/src/lib/migration-nag.js +163 -0
- package/dist/src/lib/migration-nag.js.map +1 -0
- package/dist/src/lib/output.d.ts +109 -0
- package/dist/src/lib/output.js +191 -8
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/package-manager.d.ts +140 -0
- package/dist/src/lib/package-manager.js +305 -0
- package/dist/src/lib/package-manager.js.map +1 -0
- package/dist/src/lib/paginate.d.ts +83 -0
- package/dist/src/lib/paginate.js +95 -0
- package/dist/src/lib/paginate.js.map +1 -0
- package/dist/src/lib/platform-owned.d.ts +51 -0
- package/dist/src/lib/platform-owned.js +64 -0
- package/dist/src/lib/platform-owned.js.map +1 -0
- package/dist/src/lib/project-config.d.ts +97 -0
- package/dist/src/lib/project-config.js +219 -0
- package/dist/src/lib/project-config.js.map +1 -0
- package/dist/src/lib/query-operators.d.ts +43 -0
- package/dist/src/lib/query-operators.js +80 -0
- package/dist/src/lib/query-operators.js.map +1 -0
- package/dist/src/lib/record-filter.d.ts +18 -0
- package/dist/src/lib/record-filter.js +55 -0
- package/dist/src/lib/record-filter.js.map +1 -0
- package/dist/src/lib/refresh-admin-credentials.d.ts +65 -0
- package/dist/src/lib/refresh-admin-credentials.js +103 -0
- package/dist/src/lib/refresh-admin-credentials.js.map +1 -0
- package/dist/src/lib/resolve-init-dev-port.d.ts +56 -0
- package/dist/src/lib/resolve-init-dev-port.js +55 -0
- package/dist/src/lib/resolve-init-dev-port.js.map +1 -0
- package/dist/src/lib/resolve-init-server.d.ts +71 -0
- package/dist/src/lib/resolve-init-server.js +94 -0
- package/dist/src/lib/resolve-init-server.js.map +1 -0
- package/dist/src/lib/resolve-platform.d.ts +45 -0
- package/dist/src/lib/resolve-platform.js +43 -0
- package/dist/src/lib/resolve-platform.js.map +1 -0
- package/dist/src/lib/run-status.d.ts +19 -0
- package/dist/src/lib/run-status.generated.d.ts +39 -0
- package/dist/src/lib/run-status.generated.js +66 -0
- package/dist/src/lib/run-status.generated.js.map +1 -0
- package/dist/src/lib/run-status.js +19 -0
- package/dist/src/lib/run-status.js.map +1 -0
- package/dist/src/lib/signing-secret-status.d.ts +81 -0
- package/dist/src/lib/signing-secret-status.js +116 -0
- package/dist/src/lib/signing-secret-status.js.map +1 -0
- package/dist/src/lib/skill-installer.d.ts +25 -0
- package/dist/src/lib/skill-installer.js +266 -0
- package/dist/src/lib/skill-installer.js.map +1 -0
- package/dist/src/lib/snapshots.d.ts +99 -0
- package/dist/src/lib/snapshots.js +357 -0
- package/dist/src/lib/snapshots.js.map +1 -0
- package/dist/src/lib/swift-codegen/dbGenerator.d.ts +100 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js +682 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +42 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.js +100 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.js.map +1 -0
- package/dist/src/lib/swift-codegen/generator.d.ts +85 -0
- package/dist/src/lib/swift-codegen/generator.js +266 -0
- package/dist/src/lib/swift-codegen/generator.js.map +1 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +72 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.js +644 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.d.ts +90 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.js +152 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.js.map +1 -0
- package/dist/src/lib/swift-codegen/swiftNaming.d.ts +85 -0
- package/dist/src/lib/swift-codegen/swiftNaming.js +198 -0
- package/dist/src/lib/swift-codegen/swiftNaming.js.map +1 -0
- package/dist/src/lib/sync-paths.d.ts +72 -0
- package/dist/src/lib/sync-paths.js +130 -0
- package/dist/src/lib/sync-paths.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +445 -0
- package/dist/src/lib/sync-resource-types.js +812 -0
- package/dist/src/lib/sync-resource-types.js.map +1 -0
- package/dist/src/lib/sync-selectors.d.ts +95 -0
- package/dist/src/lib/sync-selectors.js +228 -0
- package/dist/src/lib/sync-selectors.js.map +1 -0
- package/dist/src/lib/template.d.ts +121 -0
- package/dist/src/lib/template.js +447 -67
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/token-inject.d.ts +56 -0
- package/dist/src/lib/token-inject.js +204 -0
- package/dist/src/lib/token-inject.js.map +1 -0
- package/dist/src/lib/toml-database-config.d.ts +123 -0
- package/dist/src/lib/toml-database-config.js +527 -0
- package/dist/src/lib/toml-database-config.js.map +1 -0
- package/dist/src/lib/toml-metadata-config.d.ts +151 -0
- package/dist/src/lib/toml-metadata-config.js +476 -0
- package/dist/src/lib/toml-metadata-config.js.map +1 -0
- package/dist/src/lib/toml-native-form.d.ts +46 -0
- package/dist/src/lib/toml-native-form.js +78 -0
- package/dist/src/lib/toml-native-form.js.map +1 -0
- package/dist/src/lib/toml-params-validator.d.ts +129 -0
- package/dist/src/lib/toml-params-validator.js +298 -0
- package/dist/src/lib/toml-params-validator.js.map +1 -0
- package/dist/src/lib/toml-scalar-edit.d.ts +43 -0
- package/dist/src/lib/toml-scalar-edit.js +283 -0
- package/dist/src/lib/toml-scalar-edit.js.map +1 -0
- package/dist/src/lib/user-selector.d.ts +24 -0
- package/dist/src/lib/user-selector.js +33 -0
- package/dist/src/lib/user-selector.js.map +1 -0
- package/dist/src/lib/version-check.d.ts +35 -0
- package/dist/src/lib/version-check.js +241 -0
- package/dist/src/lib/version-check.js.map +1 -0
- package/dist/src/lib/watch.d.ts +121 -0
- package/dist/src/lib/watch.js +169 -0
- package/dist/src/lib/watch.js.map +1 -0
- package/dist/src/lib/workflow-apply.d.ts +51 -0
- package/dist/src/lib/workflow-apply.js +89 -0
- package/dist/src/lib/workflow-apply.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +129 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +269 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generator.d.ts +96 -0
- package/dist/src/lib/workflow-codegen/generator.js +361 -0
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
- package/dist/src/lib/workflow-codegen/invokerIR.d.ts +83 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js +71 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -0
- package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
- package/dist/src/lib/workflow-codegen/naming.js +81 -0
- package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +80 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js +303 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
- package/dist/src/lib/workflow-config-apply.d.ts +70 -0
- package/dist/src/lib/workflow-config-apply.js +137 -0
- package/dist/src/lib/workflow-config-apply.js.map +1 -0
- package/dist/src/lib/workflow-config-sidecar.d.ts +63 -0
- package/dist/src/lib/workflow-config-sidecar.js +96 -0
- package/dist/src/lib/workflow-config-sidecar.js.map +1 -0
- package/dist/src/lib/workflow-field-descriptor.d.ts +91 -0
- package/dist/src/lib/workflow-field-descriptor.js +153 -0
- package/dist/src/lib/workflow-field-descriptor.js.map +1 -0
- package/dist/src/lib/workflow-fragments.d.ts +64 -0
- package/dist/src/lib/workflow-fragments.js +342 -0
- package/dist/src/lib/workflow-fragments.js.map +1 -0
- package/dist/src/lib/workflow-include-preserve.d.ts +71 -0
- package/dist/src/lib/workflow-include-preserve.js +153 -0
- package/dist/src/lib/workflow-include-preserve.js.map +1 -0
- package/dist/src/lib/workflow-payload.d.ts +86 -0
- package/dist/src/lib/workflow-payload.js +168 -0
- package/dist/src/lib/workflow-payload.js.map +1 -0
- package/dist/src/lib/workflow-toml-validator.d.ts +199 -0
- package/dist/src/lib/workflow-toml-validator.js +754 -0
- package/dist/src/lib/workflow-toml-validator.js.map +1 -0
- package/dist/src/types/index.d.ts +533 -0
- package/dist/src/validators.d.ts +65 -0
- package/dist/src/validators.js +64 -0
- package/dist/src/validators.js.map +1 -0
- package/package.json +32 -6
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared TOML → workflow-payload builder (#1177).
|
|
3
|
+
*
|
|
4
|
+
* Background: the CLI built the create/update workflow payload in THREE
|
|
5
|
+
* separate hand-enumerated literals — `workflows create --from-file`
|
|
6
|
+
* (`cli/src/commands/workflows.ts`), the `sync push` create branch
|
|
7
|
+
* (`cli/src/commands/sync.ts`), and the `sync push` update branch (the metadata
|
|
8
|
+
* PATCH in `cli/src/lib/workflow-apply.ts`). Because each site listed the
|
|
9
|
+
* `[workflow]` fields by hand, they drifted apart: a field added to one path was
|
|
10
|
+
* silently dropped by the others. `status` was the 4th field lost this way
|
|
11
|
+
* (after `syncCallable` #807, `accessRule` #571, `runAs` #1081); the audit also
|
|
12
|
+
* found `capabilities` (#1172) and `perAppMaxRunning` / `perAppMaxQueued` /
|
|
13
|
+
* `queueTtlSeconds` dropped from at least one path.
|
|
14
|
+
*
|
|
15
|
+
* The fix: one shared builder that owns the `[workflow]`-derived field list.
|
|
16
|
+
* All three call-sites spread its output; only the per-field presence coalescing
|
|
17
|
+
* and the create-only `syncCallable` inclusion differ by `mode`, so the field
|
|
18
|
+
* list itself lives in exactly one place and can't drift again. A unit
|
|
19
|
+
* drift-guard asserts the builder's key set (see
|
|
20
|
+
* `cli/tests/unit/workflow-payload-fields.test.ts`).
|
|
21
|
+
*
|
|
22
|
+
* What the builder does NOT own (structural / call-site-specific wiring the
|
|
23
|
+
* callers still attach): `workflowKey`, `steps`, and the `metadataManifest`
|
|
24
|
+
* declared-access manifest (#1304) — the sync paths always attach it, create
|
|
25
|
+
* --from-file never does.
|
|
26
|
+
*
|
|
27
|
+
* Presence semantics, by mode:
|
|
28
|
+
* - create: optional strings coalesce absent/empty → `undefined` (omit; the
|
|
29
|
+
* server default applies). `capabilities` forwards the raw array (absent →
|
|
30
|
+
* omit). Schemas omit when absent.
|
|
31
|
+
* - update: optional strings distinguish explicit-clear from leave-unset via
|
|
32
|
+
* `x !== undefined ? (x || null) : undefined`. `status` forwards the bare
|
|
33
|
+
* value (matching the server's hasOwnProperty path). Schemas send `null`
|
|
34
|
+
* when absent so a cleared schema round-trips.
|
|
35
|
+
* - booleans (`requiresClientApply`, and `syncCallable` on create) are raw
|
|
36
|
+
* pass-through so an explicit `false` is preserved and only a truly-absent
|
|
37
|
+
* key drops.
|
|
38
|
+
* - `syncCallable` is OMITTED in `mode: "update"`: the server re-validates
|
|
39
|
+
* `syncCallable: true` against the CURRENTLY-active steps, so the update
|
|
40
|
+
* path must send it as a deferred second PATCH after the new steps are live
|
|
41
|
+
* (#807). `applyWorkflowBody` owns that second PATCH.
|
|
42
|
+
*/
|
|
43
|
+
export type WorkflowPayloadMode = "create" | "update";
|
|
44
|
+
/**
|
|
45
|
+
* Parse a JSON schema field that TOML may present as a string OR (for an inline
|
|
46
|
+
* table) as an already-parsed object. Kept here in `cli/src/lib` so the builder
|
|
47
|
+
* owns its own parse decision rather than importing back into a command module
|
|
48
|
+
* (#1177 dependency-direction decision).
|
|
49
|
+
*/
|
|
50
|
+
export declare function safeJsonParse(value: any): any;
|
|
51
|
+
/**
|
|
52
|
+
* #1614 — the workflow-level named `expr.*` definitions payload. Phase 1
|
|
53
|
+
* carries CEL guard definitions only (`cel`); `[expr.template]` is a deferred
|
|
54
|
+
* later phase.
|
|
55
|
+
*/
|
|
56
|
+
export type WorkflowExpressionsPayload = {
|
|
57
|
+
cel?: Record<string, string>;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* #1614 — extract the top-level `[expr.cel]` table from a parsed workflow TOML
|
|
61
|
+
* into the `expressions` payload the server persists on the R2 steps blob. A
|
|
62
|
+
* structural field (like `steps` / `metadataManifest`), attached alongside the
|
|
63
|
+
* steps write — NOT a `[workflow]`-table field. Returns `undefined` when no
|
|
64
|
+
* `[expr.cel]` table (or no string entries) is present, so a workflow without
|
|
65
|
+
* definitions round-trips a clean drop.
|
|
66
|
+
*
|
|
67
|
+
* `tomlData.expr.cel` is the parsed `[expr.cel]` table: `{ <name>: <cel-string> }`.
|
|
68
|
+
*/
|
|
69
|
+
export declare function parseWorkflowExpressionsToml(tomlData: any): WorkflowExpressionsPayload | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* The `[workflow]`-derived keys the builder emits, per mode — read from the
|
|
72
|
+
* vendored definition (#2644), not restated here. A field added to
|
|
73
|
+
* `src/config-surface/workflow.ts` is pushed with no edit to this file, which
|
|
74
|
+
* is what closes the recurring "CLI silently drops a new server field" bug.
|
|
75
|
+
*/
|
|
76
|
+
export declare function workflowPayloadFields(mode: WorkflowPayloadMode): string[];
|
|
77
|
+
/**
|
|
78
|
+
* Build the workflow payload's `[workflow]`-derived fields from a parsed TOML
|
|
79
|
+
* `[workflow]` table. `workflow` is `tomlData.workflow` (already merged with any
|
|
80
|
+
* explicit CLI flag overrides by the caller). Callers spread the result into
|
|
81
|
+
* the create/update payload and attach the structural fields themselves
|
|
82
|
+
* (`workflowKey`, `steps`, `metadataManifest`).
|
|
83
|
+
*/
|
|
84
|
+
export declare function buildWorkflowPayloadFromToml(workflow: any, { mode }: {
|
|
85
|
+
mode: WorkflowPayloadMode;
|
|
86
|
+
}): Record<string, any>;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared TOML → workflow-payload builder (#1177).
|
|
3
|
+
*
|
|
4
|
+
* Background: the CLI built the create/update workflow payload in THREE
|
|
5
|
+
* separate hand-enumerated literals — `workflows create --from-file`
|
|
6
|
+
* (`cli/src/commands/workflows.ts`), the `sync push` create branch
|
|
7
|
+
* (`cli/src/commands/sync.ts`), and the `sync push` update branch (the metadata
|
|
8
|
+
* PATCH in `cli/src/lib/workflow-apply.ts`). Because each site listed the
|
|
9
|
+
* `[workflow]` fields by hand, they drifted apart: a field added to one path was
|
|
10
|
+
* silently dropped by the others. `status` was the 4th field lost this way
|
|
11
|
+
* (after `syncCallable` #807, `accessRule` #571, `runAs` #1081); the audit also
|
|
12
|
+
* found `capabilities` (#1172) and `perAppMaxRunning` / `perAppMaxQueued` /
|
|
13
|
+
* `queueTtlSeconds` dropped from at least one path.
|
|
14
|
+
*
|
|
15
|
+
* The fix: one shared builder that owns the `[workflow]`-derived field list.
|
|
16
|
+
* All three call-sites spread its output; only the per-field presence coalescing
|
|
17
|
+
* and the create-only `syncCallable` inclusion differ by `mode`, so the field
|
|
18
|
+
* list itself lives in exactly one place and can't drift again. A unit
|
|
19
|
+
* drift-guard asserts the builder's key set (see
|
|
20
|
+
* `cli/tests/unit/workflow-payload-fields.test.ts`).
|
|
21
|
+
*
|
|
22
|
+
* What the builder does NOT own (structural / call-site-specific wiring the
|
|
23
|
+
* callers still attach): `workflowKey`, `steps`, and the `metadataManifest`
|
|
24
|
+
* declared-access manifest (#1304) — the sync paths always attach it, create
|
|
25
|
+
* --from-file never does.
|
|
26
|
+
*
|
|
27
|
+
* Presence semantics, by mode:
|
|
28
|
+
* - create: optional strings coalesce absent/empty → `undefined` (omit; the
|
|
29
|
+
* server default applies). `capabilities` forwards the raw array (absent →
|
|
30
|
+
* omit). Schemas omit when absent.
|
|
31
|
+
* - update: optional strings distinguish explicit-clear from leave-unset via
|
|
32
|
+
* `x !== undefined ? (x || null) : undefined`. `status` forwards the bare
|
|
33
|
+
* value (matching the server's hasOwnProperty path). Schemas send `null`
|
|
34
|
+
* when absent so a cleared schema round-trips.
|
|
35
|
+
* - booleans (`requiresClientApply`, and `syncCallable` on create) are raw
|
|
36
|
+
* pass-through so an explicit `false` is preserved and only a truly-absent
|
|
37
|
+
* key drops.
|
|
38
|
+
* - `syncCallable` is OMITTED in `mode: "update"`: the server re-validates
|
|
39
|
+
* `syncCallable: true` against the CURRENTLY-active steps, so the update
|
|
40
|
+
* path must send it as a deferred second PATCH after the new steps are live
|
|
41
|
+
* (#807). `applyWorkflowBody` owns that second PATCH.
|
|
42
|
+
*/
|
|
43
|
+
import { writableFieldNames } from "./generated-config-surfaces.js";
|
|
44
|
+
import { WORKFLOW_TABLE } from "./config-surface.js";
|
|
45
|
+
/**
|
|
46
|
+
* Parse a JSON schema field that TOML may present as a string OR (for an inline
|
|
47
|
+
* table) as an already-parsed object. Kept here in `cli/src/lib` so the builder
|
|
48
|
+
* owns its own parse decision rather than importing back into a command module
|
|
49
|
+
* (#1177 dependency-direction decision).
|
|
50
|
+
*/
|
|
51
|
+
export function safeJsonParse(value) {
|
|
52
|
+
if (value === undefined || value === null)
|
|
53
|
+
return undefined;
|
|
54
|
+
if (typeof value === "string")
|
|
55
|
+
return JSON.parse(value);
|
|
56
|
+
return value; // Already an object (TOML parsed it as a table)
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* #1614 — extract the top-level `[expr.cel]` table from a parsed workflow TOML
|
|
60
|
+
* into the `expressions` payload the server persists on the R2 steps blob. A
|
|
61
|
+
* structural field (like `steps` / `metadataManifest`), attached alongside the
|
|
62
|
+
* steps write — NOT a `[workflow]`-table field. Returns `undefined` when no
|
|
63
|
+
* `[expr.cel]` table (or no string entries) is present, so a workflow without
|
|
64
|
+
* definitions round-trips a clean drop.
|
|
65
|
+
*
|
|
66
|
+
* `tomlData.expr.cel` is the parsed `[expr.cel]` table: `{ <name>: <cel-string> }`.
|
|
67
|
+
*/
|
|
68
|
+
export function parseWorkflowExpressionsToml(tomlData) {
|
|
69
|
+
const cel = tomlData?.expr?.cel;
|
|
70
|
+
if (!cel || typeof cel !== "object" || Array.isArray(cel))
|
|
71
|
+
return undefined;
|
|
72
|
+
const out = {};
|
|
73
|
+
for (const [name, body] of Object.entries(cel)) {
|
|
74
|
+
if (typeof body === "string")
|
|
75
|
+
out[name] = body;
|
|
76
|
+
}
|
|
77
|
+
return Object.keys(out).length > 0 ? { cel: out } : undefined;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Fields the SERVER accepts on update but the CLI deliberately sends only on
|
|
81
|
+
* create. This is a sequencing invariant, not a statement about the server:
|
|
82
|
+
* `syncCallable: true` is re-validated against the CURRENTLY-active steps, so
|
|
83
|
+
* the update path defers it to a second PATCH once the new steps are live
|
|
84
|
+
* (#807 — `applyWorkflowBody` owns that). The definition correctly declares
|
|
85
|
+
* `writableOn: ["create", "update"]`; the exception lives here, where the
|
|
86
|
+
* ordering decision is.
|
|
87
|
+
*/
|
|
88
|
+
const CREATE_ONLY_ON_THE_WIRE = new Set(["syncCallable"]);
|
|
89
|
+
/**
|
|
90
|
+
* The `[workflow]`-derived keys the builder emits, per mode — read from the
|
|
91
|
+
* vendored definition (#2644), not restated here. A field added to
|
|
92
|
+
* `src/config-surface/workflow.ts` is pushed with no edit to this file, which
|
|
93
|
+
* is what closes the recurring "CLI silently drops a new server field" bug.
|
|
94
|
+
*/
|
|
95
|
+
export function workflowPayloadFields(mode) {
|
|
96
|
+
const fields = writableFieldNames(WORKFLOW_TABLE, mode);
|
|
97
|
+
return mode === "create"
|
|
98
|
+
? fields
|
|
99
|
+
: fields.filter((f) => !CREATE_ONLY_ON_THE_WIRE.has(f));
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Per-field value producers, keyed by the definition's field name. A field with
|
|
103
|
+
* no entry is a scalar passthrough: the TOML value is forwarded as-is (absent →
|
|
104
|
+
* `undefined`, which `JSON.stringify` drops so the server default applies).
|
|
105
|
+
* That is what makes a passthrough field authorable by editing the definition
|
|
106
|
+
* alone (#2644 criterion 1); the entries below are the fields whose presence
|
|
107
|
+
* semantics are genuinely their own.
|
|
108
|
+
*/
|
|
109
|
+
const PAYLOAD_VALUE = {
|
|
110
|
+
// status — create coalesces absent/empty → omit (server default `draft`
|
|
111
|
+
// applies); update forwards the bare value so it round-trips and an
|
|
112
|
+
// explicit "" surfaces the server's validation error rather than a silent
|
|
113
|
+
// no-op (matches the pre-existing update path).
|
|
114
|
+
status: (value, create) => (create ? value || undefined : value),
|
|
115
|
+
// accessRule / runAs — create coalesces absent/empty → omit; update
|
|
116
|
+
// distinguishes explicit clear ("" → null) from leave-unset (absent →
|
|
117
|
+
// undefined).
|
|
118
|
+
accessRule: (value, create) => create
|
|
119
|
+
? value || undefined
|
|
120
|
+
: value !== undefined
|
|
121
|
+
? value || null
|
|
122
|
+
: undefined,
|
|
123
|
+
runAs: (value, create) => create
|
|
124
|
+
? value || undefined
|
|
125
|
+
: value !== undefined
|
|
126
|
+
? value || null
|
|
127
|
+
: undefined,
|
|
128
|
+
// Schemas — parse a JSON string (or accept an inline table). Create omits
|
|
129
|
+
// when absent; update sends null so a cleared schema round-trips.
|
|
130
|
+
inputSchema: (value, create) => value ? safeJsonParse(value) : create ? undefined : null,
|
|
131
|
+
outputSchema: (value, create) => value ? safeJsonParse(value) : create ? undefined : null,
|
|
132
|
+
// #1972 — declarative run-scoped lock (`[workflow.lock]`, #1518 Phase 3).
|
|
133
|
+
// A TOML-owned nested-object field, mirroring the schemas above. Presence-
|
|
134
|
+
// keyed, not truthiness-keyed: forward the value whenever the KEY is present
|
|
135
|
+
// (`!== undefined`) — the server's create/PATCH accept an object OR a JSON
|
|
136
|
+
// string, so a present-but-malformed falsy value (`lock = false`/`0`) must
|
|
137
|
+
// be forwarded so the server surfaces its validation error, rather than
|
|
138
|
+
// being silently treated as absent (dropped on create, cleared on update).
|
|
139
|
+
// Absent on create → omit (server default: no lock); absent on update →
|
|
140
|
+
// null so removing `[workflow.lock]` clears the server-side lock
|
|
141
|
+
// (config-as-code). Before this the field was dropped from both sync paths,
|
|
142
|
+
// so a pull → push cycle silently lost the lock (#1972).
|
|
143
|
+
lock: (value, create) => value !== undefined ? value : create ? undefined : null,
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Build the workflow payload's `[workflow]`-derived fields from a parsed TOML
|
|
147
|
+
* `[workflow]` table. `workflow` is `tomlData.workflow` (already merged with any
|
|
148
|
+
* explicit CLI flag overrides by the caller). Callers spread the result into
|
|
149
|
+
* the create/update payload and attach the structural fields themselves
|
|
150
|
+
* (`workflowKey`, `steps`, `metadataManifest`).
|
|
151
|
+
*/
|
|
152
|
+
export function buildWorkflowPayloadFromToml(workflow, { mode }) {
|
|
153
|
+
const create = mode === "create";
|
|
154
|
+
const payload = {};
|
|
155
|
+
for (const field of workflowPayloadFields(mode)) {
|
|
156
|
+
const descriptor = WORKFLOW_TABLE.fields.find((f) => f.field === field);
|
|
157
|
+
const tomlKey = descriptor?.tomlKey ?? field;
|
|
158
|
+
const produce = PAYLOAD_VALUE[field];
|
|
159
|
+
payload[field] = produce
|
|
160
|
+
? produce(workflow[tomlKey], create, workflow)
|
|
161
|
+
: // Scalar passthrough: queue limits, dequeueOrder, name, description,
|
|
162
|
+
// capabilities, and the boolean flags — raw so an explicit `false`
|
|
163
|
+
// survives and only a truly-absent key drops.
|
|
164
|
+
workflow[tomlKey];
|
|
165
|
+
}
|
|
166
|
+
return payload;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=workflow-payload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-payload.js","sourceRoot":"","sources":["../../../src/lib/workflow-payload.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Push-time validator for workflow TOML files (issue #685, #998).
|
|
3
|
+
*
|
|
4
|
+
* Detects the common footgun where a user writes `[steps.<id>.<field>]` under
|
|
5
|
+
* an open `[[steps]]` array. TOML parses that as a sub-table on the
|
|
6
|
+
* most-recent step keyed by the step's id (e.g. `steps[0]["refresh-each"]`),
|
|
7
|
+
* not as the intended `steps[0].request`. The result is a step with an
|
|
8
|
+
* unrecognized top-level field — the runtime silently ignores it, and the
|
|
9
|
+
* step then runs with an empty `request` block.
|
|
10
|
+
*
|
|
11
|
+
* The validator walks every step in `tomlData.steps[]`. For a step whose
|
|
12
|
+
* `kind` the CLI KNOWS about, it reports any top-level field not in the
|
|
13
|
+
* generated allowlist. For an UNKNOWN kind (an old CLI run against a newer
|
|
14
|
+
* server that registered a step kind the CLI doesn't have), it SKIPS the
|
|
15
|
+
* per-field allowlist check — but still runs the kind-agnostic
|
|
16
|
+
* misnested-header footgun detector. This is the #998 fix: the recurring
|
|
17
|
+
* "newer server kind → false-reject of valid fields" failure (#685/#802/#971
|
|
18
|
+
* were all false rejections) becomes "unvalidated, not rejected."
|
|
19
|
+
*
|
|
20
|
+
* ── Source of truth (#998) ───────────────────────────────────────────────
|
|
21
|
+
* The allowlist field union and the known-kind set are GENERATED from the
|
|
22
|
+
* server step runners (`src/workflows/steps/*.ts`) and the universal
|
|
23
|
+
* `BaseStepDefinition` shape into the committed
|
|
24
|
+
* `cli/src/lib/generated-allowlist.ts` artifact (the CLI does NOT import
|
|
25
|
+
* server `src/` at runtime — only the build-time generator does). The union is
|
|
26
|
+
* derived from what each runner READS, not what the `*StepDefinition` TYPE
|
|
27
|
+
* declares — types over-declare and would weaken the footgun detector. A CI
|
|
28
|
+
* freshness guard (`gen-allowlist.mjs --check`, also asserted by the #985
|
|
29
|
+
* drift-guard test) keeps the committed artifact in sync with the runners, so
|
|
30
|
+
* the hand-edit drift class (#685/#802/#971) cannot recur for the same-version
|
|
31
|
+
* case. Regenerate with `node cli/scripts/gen-allowlist.mjs`.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Read-only view of `ALLOWLISTED_FIELDS` for the drift-guard test (#985).
|
|
35
|
+
*
|
|
36
|
+
* Exported so `cli/tests/unit/workflow-toml-validator-drift-guard.test.ts` can
|
|
37
|
+
* assert this set stays a superset of every top-level field the step runners
|
|
38
|
+
* in `src/workflows/steps/*.ts` actually read — checking the *live* set the
|
|
39
|
+
* validator enforces rather than a copy that could itself drift. Not part of
|
|
40
|
+
* the public validator API; consumed only by the guard.
|
|
41
|
+
*/
|
|
42
|
+
export declare const ALLOWLISTED_FIELDS_FOR_DRIFT_GUARD: ReadonlySet<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Read-only view of `KNOWN_KINDS` for the drift-guard test (#998). Lets the
|
|
45
|
+
* guard assert the generated known-kind set matches a fresh scan.
|
|
46
|
+
*/
|
|
47
|
+
export declare const KNOWN_KINDS_FOR_DRIFT_GUARD: ReadonlySet<string>;
|
|
48
|
+
/**
|
|
49
|
+
* A single offending field on a step.
|
|
50
|
+
*
|
|
51
|
+
* `stepIndex` is the array index in `steps[]`.
|
|
52
|
+
* `stepId` is the value of the step's `id` field, if any (string).
|
|
53
|
+
* `field` is the unknown top-level key; uses sentinel names for shape
|
|
54
|
+
* errors:
|
|
55
|
+
* - `__steps_shape__`: `steps` is not an array (table or scalar).
|
|
56
|
+
* - `__step_shape__`: a step is not an object.
|
|
57
|
+
* - `__workflow_system_access_rule__`: `[workflow] runAs = "system"` with a
|
|
58
|
+
* non-empty `accessRule` — dead config the server rejects (#1447/#1258).
|
|
59
|
+
* A workflow-level error (not tied to a step): `stepIndex: -1, stepId: null`.
|
|
60
|
+
* - `__template_expression__`: a `{{ }}` expression that can never resolve
|
|
61
|
+
* (#2689). The field itself is valid — the `hint` carries the expression's
|
|
62
|
+
* location and the lint's message.
|
|
63
|
+
* `hint` is a short, user-facing explanation (used by
|
|
64
|
+
* `formatWorkflowTomlErrors` to render the multi-line diagnostic).
|
|
65
|
+
* `parentStepId` is set when this error came from a `collect` step's
|
|
66
|
+
* nested inner `step` definition (codex review, 2026-05-15): the outer
|
|
67
|
+
* `stepIndex` points at the array index, `parentStepId` carries the
|
|
68
|
+
* outer step's id (if any), and `stepId` carries the inner step's id.
|
|
69
|
+
* It's `null` for top-level errors (the renderer treats both `null` and
|
|
70
|
+
* `undefined` as top-level — see `formatWorkflowTomlErrors`).
|
|
71
|
+
*/
|
|
72
|
+
export type WorkflowTomlError = {
|
|
73
|
+
stepIndex: number;
|
|
74
|
+
stepId: string | null;
|
|
75
|
+
field: string;
|
|
76
|
+
hint: string;
|
|
77
|
+
parentStepId?: string | null;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* #1447 workflow-identity predicate, extracted (codex review, 2026-07-15) so
|
|
81
|
+
* command sites that apply command-line metadata overrides can re-run it
|
|
82
|
+
* against the merged/effective workflow rather than only the parsed file.
|
|
83
|
+
*
|
|
84
|
+
* `runAs = "system"` + a non-empty `accessRule` is dead config: a system run
|
|
85
|
+
* can only be started by the system and never evaluates its accessRule, so any
|
|
86
|
+
* non-empty rule is inert. The server rejects this at save time (#1258,
|
|
87
|
+
* `src/workflows/definition-store.ts:271-280`); catching it locally keeps
|
|
88
|
+
* `sync push` all-or-nothing instead of failing mid-push and leaving partial
|
|
89
|
+
* server state (#1418 drift).
|
|
90
|
+
*
|
|
91
|
+
* Mirrors the server predicate byte-for-byte: returns the sentinel error only
|
|
92
|
+
* when `runAs === "system"` AND `typeof accessRule === "string"` AND
|
|
93
|
+
* `accessRule.trim() !== ""`. Default/unset/empty/whitespace-only runAs or
|
|
94
|
+
* accessRule (and a bare non-string boolean accessRule) return `null`.
|
|
95
|
+
*
|
|
96
|
+
* @param workflow The workflow-metadata object — the `[workflow]` table, or
|
|
97
|
+
* for commands that accept unwrapped root-level metadata, the root TOML
|
|
98
|
+
* object (`tomlData.workflow || tomlData`). Non-object inputs return `null`.
|
|
99
|
+
*/
|
|
100
|
+
export declare function validateWorkflowIdentity(workflow: any): WorkflowTomlError | null;
|
|
101
|
+
/**
|
|
102
|
+
* #2643 — `templateMissingMarker` was removed from the platform. A workflow
|
|
103
|
+
* TOML that still sets it is rejected here, before the push, with the same
|
|
104
|
+
* sentence the server returns, rather than being silently dropped.
|
|
105
|
+
*/
|
|
106
|
+
export declare const REMOVED_TEMPLATE_MISSING_MARKER_MESSAGE: string;
|
|
107
|
+
/**
|
|
108
|
+
* Non-blocking notes for a workflow TOML — things worth saying on a push that
|
|
109
|
+
* are not errors.
|
|
110
|
+
*
|
|
111
|
+
* #2643: `strict` / `strictParams` are accepted and ignored, because the
|
|
112
|
+
* failure they used to opt into now applies to every workflow. A definition
|
|
113
|
+
* that sets them keeps working unchanged, so this is a note, not an error.
|
|
114
|
+
*/
|
|
115
|
+
export declare function collectWorkflowTomlNotes(tomlData: any): string[];
|
|
116
|
+
/** The runAs / accessRule pair the identity lint reads. */
|
|
117
|
+
export interface WorkflowIdentityFields {
|
|
118
|
+
runAs?: unknown;
|
|
119
|
+
accessRule?: unknown;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* #1447 (maintainer decision, 2026-07-21): compute the EFFECTIVE workflow
|
|
123
|
+
* identity that an `update --from-file` push will leave on the server — the
|
|
124
|
+
* merge of the persisted record with the incoming file/flags.
|
|
125
|
+
*
|
|
126
|
+
* `applyWorkflowBody` omits undefined fields, so the server retains whichever
|
|
127
|
+
* side of the runAs/accessRule pair the incoming payload doesn't set. Linting
|
|
128
|
+
* the incoming payload alone therefore misses the case where the OTHER side is
|
|
129
|
+
* already `system` / a stored rule: an existing `runAs="system"` workflow plus
|
|
130
|
+
* a file adding only an `accessRule`, or a file flipping a workflow with a
|
|
131
|
+
* stored rule to `runAs="system"`. Both pass a payload-only lint and are then
|
|
132
|
+
* rejected by the server's PATCH. Merging the two before `validateWorkflowIdentity`
|
|
133
|
+
* catches them locally at zero extra cost — the persisted record is already
|
|
134
|
+
* fetched at the call site.
|
|
135
|
+
*
|
|
136
|
+
* Presence semantics mirror the update payload builder: a field PRESENT in
|
|
137
|
+
* `incoming` (including an empty-string clear) overrides the stored value; an
|
|
138
|
+
* ABSENT field (undefined) falls back to what the server keeps.
|
|
139
|
+
*/
|
|
140
|
+
export declare function effectiveWorkflowIdentity(existing: WorkflowIdentityFields | null | undefined, incoming: WorkflowIdentityFields | null | undefined): WorkflowIdentityFields;
|
|
141
|
+
/**
|
|
142
|
+
* Walk a parsed workflow TOML document and return all unknown-field errors.
|
|
143
|
+
*
|
|
144
|
+
* @param tomlData The output of `parseConfigToml()` for a workflow TOML file.
|
|
145
|
+
* @param opts.skipWorkflowIdentity When true, suppress the #1447 workflow
|
|
146
|
+
* identity check (`runAs="system"` + non-empty `accessRule`). Callers that
|
|
147
|
+
* merge command-line overrides after parsing re-run `validateWorkflowIdentity`
|
|
148
|
+
* against the effective metadata themselves.
|
|
149
|
+
* @returns An array of error objects, one per offending field. Empty if no
|
|
150
|
+
* errors were found.
|
|
151
|
+
*/
|
|
152
|
+
export declare function validateWorkflowToml(tomlData: any, opts?: {
|
|
153
|
+
skipWorkflowIdentity?: boolean;
|
|
154
|
+
}): WorkflowTomlError[];
|
|
155
|
+
/**
|
|
156
|
+
* Render a multi-line diagnostic for a list of errors. Designed for the
|
|
157
|
+
* shape called out in the issue:
|
|
158
|
+
*
|
|
159
|
+
* Error in workflows/refresh.toml:
|
|
160
|
+
* steps[0] (id="refresh-each") has unknown field "refresh-each".
|
|
161
|
+
* This is usually caused by writing [steps.refresh-each.request] instead of [steps.request].
|
|
162
|
+
* TOML can't address an array element by id — use [steps.request] (refers to the most recent step).
|
|
163
|
+
*
|
|
164
|
+
* @param filePath The TOML file path (or display name) to include in the
|
|
165
|
+
* header.
|
|
166
|
+
* @param errors The error list from `validateWorkflowToml`.
|
|
167
|
+
* @returns A multi-line string ready to print to stderr.
|
|
168
|
+
*/
|
|
169
|
+
export declare function formatWorkflowTomlErrors(filePath: string, errors: WorkflowTomlError[]): string;
|
|
170
|
+
/**
|
|
171
|
+
* #1614 — client-side mirror of the server's `validateWorkflowExpressions`
|
|
172
|
+
* (`src/workflows/definition-store.ts`) for named `expr.*` CEL guards. Returns
|
|
173
|
+
* structural errors so `sync push` fails fast with the same class of diagnostic
|
|
174
|
+
* the server would 400 on:
|
|
175
|
+
* 1. every `expr.<name>` reference — in a definition body OR a step guard
|
|
176
|
+
* (`runIf` / `successWhen` / switch `when`) — names a DECLARED definition;
|
|
177
|
+
* 2. the definition reference graph is a DAG (no cycles);
|
|
178
|
+
* 3. each definition body is a non-empty string.
|
|
179
|
+
*
|
|
180
|
+
* The CLI has no CEL parser, so full CEL parse validation stays server-side
|
|
181
|
+
* (the authoritative check) — this mirror catches the common undeclared-name
|
|
182
|
+
* and cycle mistakes before a network round-trip, matching how the CLI does
|
|
183
|
+
* structural checks and the server does authoritative validation elsewhere.
|
|
184
|
+
*/
|
|
185
|
+
/**
|
|
186
|
+
* #1614 — validate the RAW `[expr.cel]` table shape BEFORE
|
|
187
|
+
* `parseWorkflowExpressionsToml` filters it. That parser drops any entry whose
|
|
188
|
+
* body is not a string, so a mistyped `ready = true` would vanish and, with no
|
|
189
|
+
* references left to fail on, `sync push` would succeed while omitting the whole
|
|
190
|
+
* expression table. Surface non-string / empty / wrong-typed bodies (and a
|
|
191
|
+
* non-table `cel`) as a hard CLI validation error instead. Mirrors the server's
|
|
192
|
+
* `validateRawExpressionsShape` (`src/workflows/definition-store.ts`).
|
|
193
|
+
*
|
|
194
|
+
* `tomlData.expr.cel` is the parsed `[expr.cel]` table.
|
|
195
|
+
*/
|
|
196
|
+
export declare function validateWorkflowExpressionsRawToml(tomlData: any): string[];
|
|
197
|
+
export declare function validateWorkflowExpressionsToml(steps: any[], expressions: {
|
|
198
|
+
cel?: Record<string, string>;
|
|
199
|
+
} | undefined): string[];
|