primitive-admin 1.1.0-alpha.7 → 1.1.0-alpha.71
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 +404 -80
- package/assets/skill/skills/primitive-platform/SKILL.md +808 -0
- package/dist/bin/primitive.d.ts +2 -0
- package/dist/bin/primitive.js +294 -21
- 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 +544 -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 +51 -96
- 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 +565 -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 +46 -0
- package/dist/src/commands/config.js +479 -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 +265 -0
- package/dist/src/commands/cron-triggers.js.map +1 -0
- package/dist/src/commands/database-type-configs.d.ts +2 -0
- package/dist/src/commands/database-type-configs.js +171 -0
- package/dist/src/commands/database-type-configs.js.map +1 -0
- package/dist/src/commands/database-types.d.ts +2 -0
- package/dist/src/commands/database-types.js +471 -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 +2140 -112
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.d.ts +2 -0
- package/dist/src/commands/documents.js +1357 -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 +23 -0
- package/dist/src/commands/env.js +333 -0
- package/dist/src/commands/env.js.map +1 -0
- package/dist/src/commands/feature-flags.d.ts +14 -0
- package/dist/src/commands/feature-flags.js +116 -0
- package/dist/src/commands/feature-flags.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 +25 -0
- package/dist/src/commands/init.js +1605 -208
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.d.ts +2 -0
- package/dist/src/commands/integrations.js +380 -178
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/llm.d.ts +2 -0
- package/dist/src/commands/llm.js +4 -2
- 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-category-configs.d.ts +12 -0
- package/dist/src/commands/metadata-category-configs.js +112 -0
- package/dist/src/commands/metadata-category-configs.js.map +1 -0
- package/dist/src/commands/metadata.d.ts +2 -0
- package/dist/src/commands/metadata.js +281 -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 +225 -584
- 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 +272 -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 +554 -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/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 +158 -0
- package/dist/src/commands/sync-app-settings.js +330 -0
- package/dist/src/commands/sync-app-settings.js.map +1 -0
- package/dist/src/commands/sync.d.ts +2323 -0
- package/dist/src/commands/sync.js +15065 -843
- 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 +532 -23
- 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 +562 -0
- package/dist/src/commands/webhooks.js.map +1 -0
- package/dist/src/commands/workflows.d.ts +116 -0
- package/dist/src/commands/workflows.js +1583 -681
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/access-rule-display.d.ts +21 -0
- package/dist/src/lib/access-rule-display.js +34 -0
- package/dist/src/lib/access-rule-display.js.map +1 -0
- package/dist/src/lib/api-client.d.ts +1936 -0
- package/dist/src/lib/api-client.js +1826 -138
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +263 -0
- package/dist/src/lib/app-settings-descriptor.js +575 -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 +101 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js +191 -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 +127 -0
- package/dist/src/lib/config-object-descriptor.js +658 -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 +116 -0
- package/dist/src/lib/config-payload.js.map +1 -0
- package/dist/src/lib/config-surface.d.ts +130 -0
- package/dist/src/lib/config-surface.js +300 -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-core.d.ts +147 -0
- package/dist/src/lib/env-resolver-core.js +265 -0
- package/dist/src/lib/env-resolver-core.js.map +1 -0
- package/dist/src/lib/env-resolver.d.ts +84 -0
- package/dist/src/lib/env-resolver.js +133 -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 +277 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -0
- package/dist/src/lib/generated-config-surfaces.d.ts +682 -0
- package/dist/src/lib/generated-config-surfaces.js +4058 -0
- package/dist/src/lib/generated-config-surfaces.js.map +1 -0
- package/dist/src/lib/generated-template-lint.d.ts +212 -0
- package/dist/src/lib/generated-template-lint.js +624 -0
- package/dist/src/lib/generated-template-lint.js.map +1 -0
- package/dist/src/lib/init-adopt.d.ts +16 -0
- package/dist/src/lib/init-adopt.js +34 -0
- package/dist/src/lib/init-adopt.js.map +1 -0
- package/dist/src/lib/init-assets.d.ts +39 -0
- package/dist/src/lib/init-assets.js +97 -0
- package/dist/src/lib/init-assets.js.map +1 -0
- package/dist/src/lib/init-config.d.ts +98 -0
- package/dist/src/lib/init-config.js +186 -0
- package/dist/src/lib/init-config.js.map +1 -0
- package/dist/src/lib/init-ios-links.d.ts +50 -0
- package/dist/src/lib/init-ios-links.js +153 -0
- package/dist/src/lib/init-ios-links.js.map +1 -0
- package/dist/src/lib/init-plan.d.ts +80 -0
- package/dist/src/lib/init-plan.js +95 -0
- package/dist/src/lib/init-plan.js.map +1 -0
- package/dist/src/lib/init-production-env.d.ts +48 -0
- package/dist/src/lib/init-production-env.js +59 -0
- package/dist/src/lib/init-production-env.js.map +1 -0
- package/dist/src/lib/init-schema.d.ts +74 -0
- package/dist/src/lib/init-schema.js +358 -0
- package/dist/src/lib/init-schema.js.map +1 -0
- package/dist/src/lib/init-xcode.d.ts +33 -0
- package/dist/src/lib/init-xcode.js +114 -0
- package/dist/src/lib/init-xcode.js.map +1 -0
- package/dist/src/lib/integration-request-config.d.ts +30 -0
- package/dist/src/lib/integration-request-config.js +145 -0
- package/dist/src/lib/integration-request-config.js.map +1 -0
- package/dist/src/lib/local-state.d.ts +55 -0
- package/dist/src/lib/local-state.js +167 -0
- package/dist/src/lib/local-state.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/object-status-filter.d.ts +22 -0
- package/dist/src/lib/object-status-filter.js +45 -0
- package/dist/src/lib/object-status-filter.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 +63 -0
- package/dist/src/lib/platform-owned.js +85 -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 +217 -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 +64 -0
- package/dist/src/lib/resolve-init-server.js +77 -0
- package/dist/src/lib/resolve-init-server.js.map +1 -0
- package/dist/src/lib/resolve-platform.d.ts +74 -0
- package/dist/src/lib/resolve-platform.js +105 -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/server-text-normalization.d.ts +51 -0
- package/dist/src/lib/server-text-normalization.js +90 -0
- package/dist/src/lib/server-text-normalization.js.map +1 -0
- package/dist/src/lib/server-url.d.ts +22 -0
- package/dist/src/lib/server-url.js +33 -0
- package/dist/src/lib/server-url.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 +113 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js +914 -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 +94 -0
- package/dist/src/lib/swift-codegen/generator.js +440 -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 +94 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.js +155 -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-dir-selector.d.ts +21 -0
- package/dist/src/lib/sync-dir-selector.js +30 -0
- package/dist/src/lib/sync-dir-selector.js.map +1 -0
- package/dist/src/lib/sync-paths.d.ts +111 -0
- package/dist/src/lib/sync-paths.js +198 -0
- package/dist/src/lib/sync-paths.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +544 -0
- package/dist/src/lib/sync-resource-types.js +975 -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 +170 -0
- package/dist/src/lib/template.js +484 -68
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/test-case-keys.d.ts +29 -0
- package/dist/src/lib/test-case-keys.js +55 -0
- package/dist/src/lib/test-case-keys.js.map +1 -0
- package/dist/src/lib/test-case-variables.d.ts +15 -0
- package/dist/src/lib/test-case-variables.js +29 -0
- package/dist/src/lib/test-case-variables.js.map +1 -0
- 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 +110 -0
- package/dist/src/lib/workflow-apply.js +164 -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 +94 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js +76 -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-defaults.d.ts +29 -0
- package/dist/src/lib/workflow-defaults.js +41 -0
- package/dist/src/lib/workflow-defaults.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 +76 -0
- package/dist/src/lib/workflow-include-preserve.js +286 -0
- package/dist/src/lib/workflow-include-preserve.js.map +1 -0
- package/dist/src/lib/workflow-payload.d.ts +98 -0
- package/dist/src/lib/workflow-payload.js +178 -0
- package/dist/src/lib/workflow-payload.js.map +1 -0
- package/dist/src/lib/workflow-toml-validator.d.ts +202 -0
- package/dist/src/lib/workflow-toml-validator.js +757 -0
- package/dist/src/lib/workflow-toml-validator.js.map +1 -0
- package/dist/src/types/index.d.ts +581 -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 -8
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI-only workflow fragment expansion.
|
|
3
|
+
*
|
|
4
|
+
* Workflows may declare `include = ["fragment-name", ...]` at the top of
|
|
5
|
+
* their TOML. The CLI expands those references into a fully-flattened
|
|
6
|
+
* `[[steps]]` list before push — the server never sees fragments and
|
|
7
|
+
* stores only the canonical, expanded JSON.
|
|
8
|
+
*
|
|
9
|
+
* Pinned decisions (#744):
|
|
10
|
+
* - CLI-only. No server-side WorkflowFragment model.
|
|
11
|
+
* - Fragments live at <workflowDir>/../workflow-fragments/<name>.toml.
|
|
12
|
+
* - Fragment files are `[[steps]]` lists only — no `[workflow]` block.
|
|
13
|
+
* - No recursive includes in v1 (fragments cannot themselves `include`).
|
|
14
|
+
* - Unique step ids validated post-expansion; collisions name both
|
|
15
|
+
* locations in the error message.
|
|
16
|
+
*
|
|
17
|
+
* Parameterized includes (#1448):
|
|
18
|
+
* - Two include forms are supported. The bare form
|
|
19
|
+
* `include = ["name", ...]` (an array of fragment-name strings) is
|
|
20
|
+
* unchanged. The parameterized form uses `[[include]]` array-of-tables:
|
|
21
|
+
*
|
|
22
|
+
* [[include]]
|
|
23
|
+
* fragment = "lifecycle-email" # required
|
|
24
|
+
* runIf = "input.type == 'x'" # optional; ANDed onto each step
|
|
25
|
+
* with = { id = "...", subject = "..." } # params, exposed as {{ params.* }}
|
|
26
|
+
*
|
|
27
|
+
* - A file uses one form or the other — mixing string and table entries in a
|
|
28
|
+
* single `include` array is an error.
|
|
29
|
+
* - `{{ params.* }}` references inside the fragment's steps are substituted
|
|
30
|
+
* at EXPAND time from the include's `with` table. A whole-string
|
|
31
|
+
* `{{ params.x }}` splices the raw typed value (number/bool/table);
|
|
32
|
+
* an embedded `{{ params.x }}` inside a larger string stringifies it.
|
|
33
|
+
* A missing param is a hard error. Only the `params.` namespace is
|
|
34
|
+
* touched — every other `{{ ... }}` template passes through to the server
|
|
35
|
+
* verbatim, and `params.` never survives into the expanded output.
|
|
36
|
+
* - The include-level `runIf` (CEL) is ANDed onto every expanded step:
|
|
37
|
+
* both present → `(<includeRunIf>) && (<stepRunIf>)`; one present → that
|
|
38
|
+
* one; neither → no runIf.
|
|
39
|
+
*
|
|
40
|
+
* Wiring: `parseTomlFile()` in `cli/src/commands/sync.ts` calls
|
|
41
|
+
* `expandWorkflowTomlData()` after parsing. All 24 push parse sites in
|
|
42
|
+
* sync.ts route through that single seam, so the expansion is uniform.
|
|
43
|
+
* The standalone `expandWorkflow(filePath)` helper backs the
|
|
44
|
+
* `primitive workflows expand` subcommand for debugging.
|
|
45
|
+
*/
|
|
46
|
+
import { existsSync, readFileSync } from "fs";
|
|
47
|
+
import { dirname, join, basename } from "path";
|
|
48
|
+
import { parseConfigToml } from "./config-toml.js";
|
|
49
|
+
/**
|
|
50
|
+
* True only for a genuine plain TOML table: a non-null, non-array object whose
|
|
51
|
+
* prototype is `Object.prototype` or `null`. This deliberately rejects the
|
|
52
|
+
* non-plain objects that a bare `typeof x === "object"` check would accept —
|
|
53
|
+
* notably smol-toml's `TomlDate` (a `Date` subclass) and any other boxed value
|
|
54
|
+
* — so a TOML date/time literal (`with = 1979-05-27T07:32:00Z`) can never slip
|
|
55
|
+
* through a guard that expects a parameter table. Used everywhere a `with` /
|
|
56
|
+
* params sub-table is required so the plain-table rule is applied consistently.
|
|
57
|
+
*/
|
|
58
|
+
function isPlainTable(value) {
|
|
59
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
const proto = Object.getPrototypeOf(value);
|
|
63
|
+
return proto === Object.prototype || proto === null;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Read and expand a workflow TOML file from disk. Returns the parsed
|
|
67
|
+
* TOML with all `include` fragments spliced in. If the file has no
|
|
68
|
+
* `include` key, the parsed TOML is returned unchanged.
|
|
69
|
+
*/
|
|
70
|
+
export function expandWorkflow(workflowPath) {
|
|
71
|
+
const content = readFileSync(workflowPath, "utf-8");
|
|
72
|
+
const parsed = parseConfigToml(content);
|
|
73
|
+
return expandWorkflowTomlData(parsed, workflowPath);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Expand the `include` key of an already-parsed TOML object. Resolves
|
|
77
|
+
* fragment files relative to `<workflowPath>/../../workflow-fragments/`.
|
|
78
|
+
* Use this when the TOML has already been parsed elsewhere (e.g. inside
|
|
79
|
+
* `parseTomlFile()`).
|
|
80
|
+
*/
|
|
81
|
+
export function expandWorkflowTomlData(parsed, workflowPath) {
|
|
82
|
+
// Fast path: nothing to expand. Preserve the original shape exactly —
|
|
83
|
+
// including the absence of a `steps` field, since not every TOML file
|
|
84
|
+
// routed through `parseTomlFile()` represents a workflow.
|
|
85
|
+
if (!("include" in parsed)) {
|
|
86
|
+
return parsed;
|
|
87
|
+
}
|
|
88
|
+
const includeList = parsed.include;
|
|
89
|
+
if (!Array.isArray(includeList)) {
|
|
90
|
+
throw new Error(`Workflow '${workflowPath}' has an 'include' key but it is not an array. Use \`include = ["fragment-name"]\`.`);
|
|
91
|
+
}
|
|
92
|
+
// Resolve fragments directory: sibling of workflow's parent directory.
|
|
93
|
+
// E.g. workflow at config/workflows/foo.toml
|
|
94
|
+
// fragments at config/workflow-fragments/<name>.toml
|
|
95
|
+
const fragmentsDir = join(dirname(workflowPath), "..", "workflow-fragments");
|
|
96
|
+
const workflowOwnSteps = Array.isArray(parsed.steps)
|
|
97
|
+
? parsed.steps
|
|
98
|
+
: [];
|
|
99
|
+
const allOriginated = [];
|
|
100
|
+
// Classify each entry as a bare fragment-name string or a parameterized
|
|
101
|
+
// `[[include]]` table. A single file must use one form throughout. A
|
|
102
|
+
// `[[include]]` entry must be a genuine plain table — a non-plain object
|
|
103
|
+
// (e.g. a TOML date literal parsed to a `TomlDate`) is neither a valid
|
|
104
|
+
// string entry nor a valid table and falls through to the per-entry error.
|
|
105
|
+
const isTable = (e) => isPlainTable(e);
|
|
106
|
+
const hasStringEntry = includeList.some((e) => typeof e === "string");
|
|
107
|
+
const hasTableEntry = includeList.some((e) => isTable(e));
|
|
108
|
+
if (hasStringEntry && hasTableEntry) {
|
|
109
|
+
throw new Error(`Workflow '${workflowPath}' mixes bare-string include entries and [[include]] tables in one 'include' array. Pick one form per file: either \`include = ["a", "b"]\` or repeated \`[[include]]\` tables.`);
|
|
110
|
+
}
|
|
111
|
+
includeList.forEach((entry, index) => {
|
|
112
|
+
if (typeof entry === "string") {
|
|
113
|
+
if (entry.length === 0) {
|
|
114
|
+
throw new Error(`Workflow '${workflowPath}' has an invalid include entry: ${JSON.stringify(entry)}. Each entry must be a fragment name string.`);
|
|
115
|
+
}
|
|
116
|
+
const fragmentPath = join(fragmentsDir, `${entry}.toml`);
|
|
117
|
+
const fragment = readFragmentSafely(fragmentPath, workflowPath, entry);
|
|
118
|
+
for (const step of fragment.steps) {
|
|
119
|
+
allOriginated.push({ step, origin: `fragment '${entry}'` });
|
|
120
|
+
}
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (isTable(entry)) {
|
|
124
|
+
expandParameterizedInclude(entry, index, fragmentsDir, workflowPath, allOriginated);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
throw new Error(`Workflow '${workflowPath}' has an invalid include entry: ${JSON.stringify(entry)}. Each entry must be a fragment name string or a [[include]] table.`);
|
|
128
|
+
});
|
|
129
|
+
for (const step of workflowOwnSteps) {
|
|
130
|
+
allOriginated.push({ step, origin: `workflow '${basename(workflowPath)}'` });
|
|
131
|
+
}
|
|
132
|
+
assertUniqueStepIds(allOriginated, workflowPath);
|
|
133
|
+
// Build the expanded object: drop `include`, replace `steps` with the
|
|
134
|
+
// concatenated list. Preserve all other top-level keys (workflow,
|
|
135
|
+
// triggers, configs, etc.) exactly as parsed.
|
|
136
|
+
const result = { ...parsed };
|
|
137
|
+
delete result.include;
|
|
138
|
+
result.steps = allOriginated.map((o) => o.step);
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
function readFragmentSafely(fragmentPath, workflowPath, fragmentName) {
|
|
142
|
+
if (!existsSync(fragmentPath)) {
|
|
143
|
+
throw new Error(`Workflow '${workflowPath}' includes fragment '${fragmentName}' but the file does not exist at '${fragmentPath}'.`);
|
|
144
|
+
}
|
|
145
|
+
let parsed;
|
|
146
|
+
try {
|
|
147
|
+
const content = readFileSync(fragmentPath, "utf-8");
|
|
148
|
+
parsed = parseConfigToml(content);
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
throw new Error(`Failed to parse fragment '${fragmentName}' at '${fragmentPath}': ${err?.message ?? err}`);
|
|
152
|
+
}
|
|
153
|
+
if ("include" in parsed) {
|
|
154
|
+
throw new Error(`Fragment '${fragmentName}' at '${fragmentPath}' contains its own 'include' key — recursive includes are not supported in v1. Inline the steps directly into this fragment.`);
|
|
155
|
+
}
|
|
156
|
+
if ("workflow" in parsed) {
|
|
157
|
+
throw new Error(`Fragment '${fragmentName}' at '${fragmentPath}' contains a [workflow] block. Fragment files must be [[steps]] lists only.`);
|
|
158
|
+
}
|
|
159
|
+
const steps = Array.isArray(parsed.steps)
|
|
160
|
+
? parsed.steps
|
|
161
|
+
: [];
|
|
162
|
+
return { steps };
|
|
163
|
+
}
|
|
164
|
+
// ── Parameterized include expansion (#1448) ─────────────────────────────────
|
|
165
|
+
const ALLOWED_INCLUDE_KEYS = new Set(["fragment", "runIf", "with"]);
|
|
166
|
+
// The dotted path after `params.`. Each segment is a TOML bare key, which may
|
|
167
|
+
// contain letters, digits, `_` and `-`; segments are joined by dots. Keeping
|
|
168
|
+
// the full bare-key charset means hyphenated keys like `subject-line` expand
|
|
169
|
+
// instead of leaking `{{ params.subject-line }}` to the server.
|
|
170
|
+
const PARAM_PATH = "[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)*";
|
|
171
|
+
// A string that is EXACTLY one `{{ params.<path> }}` token (raw typed splice).
|
|
172
|
+
const WHOLE_PARAM_RE = new RegExp(`^\\{\\{\\s*params\\.(${PARAM_PATH})\\s*\\}\\}$`);
|
|
173
|
+
// Any embedded `{{ params.<path> }}` token (string interpolation).
|
|
174
|
+
const EMBEDDED_PARAM_RE = new RegExp(`\\{\\{\\s*params\\.(${PARAM_PATH})\\s*\\}\\}`, "g");
|
|
175
|
+
function expandParameterizedInclude(entry, index, fragmentsDir, workflowPath, allOriginated) {
|
|
176
|
+
const includeLabel = `[[include]] #${index + 1}`;
|
|
177
|
+
for (const key of Object.keys(entry)) {
|
|
178
|
+
if (!ALLOWED_INCLUDE_KEYS.has(key)) {
|
|
179
|
+
throw new Error(`Workflow '${workflowPath}' has an unknown key '${key}' in ${includeLabel}. Allowed keys are: fragment, runIf, with.`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const fragmentName = entry.fragment;
|
|
183
|
+
if (typeof fragmentName !== "string" || fragmentName.length === 0) {
|
|
184
|
+
throw new Error(`Workflow '${workflowPath}' has a ${includeLabel} missing a valid 'fragment' name (got ${JSON.stringify(fragmentName)}).`);
|
|
185
|
+
}
|
|
186
|
+
const includeRunIf = entry.runIf;
|
|
187
|
+
if (includeRunIf !== undefined && typeof includeRunIf !== "string") {
|
|
188
|
+
throw new Error(`Workflow '${workflowPath}' has a non-string 'runIf' in ${includeLabel} (fragment '${fragmentName}'). runIf must be a CEL string.`);
|
|
189
|
+
}
|
|
190
|
+
const withParams = entry.with;
|
|
191
|
+
// `with` must be a genuine plain table. `isPlainTable` rejects arrays and any
|
|
192
|
+
// non-plain object — including a TOML date/time literal (`with = 1979-…Z`),
|
|
193
|
+
// which parses to a `TomlDate` and would otherwise be accepted as a param
|
|
194
|
+
// table by a bare `typeof === "object"` check.
|
|
195
|
+
if (withParams !== undefined && !isPlainTable(withParams)) {
|
|
196
|
+
throw new Error(`Workflow '${workflowPath}' has a non-table 'with' in ${includeLabel} (fragment '${fragmentName}'). 'with' must be a table of parameters.`);
|
|
197
|
+
}
|
|
198
|
+
const params = withParams ?? {};
|
|
199
|
+
const fragmentPath = join(fragmentsDir, `${fragmentName}.toml`);
|
|
200
|
+
const fragment = readFragmentSafely(fragmentPath, workflowPath, fragmentName);
|
|
201
|
+
const ctx = {
|
|
202
|
+
fragment: fragmentName,
|
|
203
|
+
includeLabel,
|
|
204
|
+
workflowPath,
|
|
205
|
+
};
|
|
206
|
+
for (const rawStep of fragment.steps) {
|
|
207
|
+
const step = substituteParamsDeep(rawStep, params, ctx);
|
|
208
|
+
applyIncludeRunIf(step, includeRunIf, ctx);
|
|
209
|
+
allOriginated.push({
|
|
210
|
+
step,
|
|
211
|
+
origin: `fragment '${fragmentName}' (${includeLabel})`,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Recursively substitute `{{ params.* }}` references throughout a fragment
|
|
217
|
+
* step. Returns a new value; the input is not mutated. Only the `params.`
|
|
218
|
+
* namespace is touched — every other `{{ ... }}` template is preserved
|
|
219
|
+
* verbatim for the server to render.
|
|
220
|
+
*/
|
|
221
|
+
function substituteParamsDeep(node, params, ctx) {
|
|
222
|
+
if (typeof node === "string") {
|
|
223
|
+
return substituteParamsInString(node, params, ctx);
|
|
224
|
+
}
|
|
225
|
+
if (Array.isArray(node)) {
|
|
226
|
+
return node.map((el) => substituteParamsDeep(el, params, ctx));
|
|
227
|
+
}
|
|
228
|
+
if (node !== null && typeof node === "object") {
|
|
229
|
+
// Only recurse into plain tables. Non-plain objects (e.g. smol-toml's
|
|
230
|
+
// `TomlDate`, which extends `Date`) carry internal state that is not
|
|
231
|
+
// enumerable, so rebuilding them via `Object.entries` would collapse them
|
|
232
|
+
// to `{}`. TOML date/time literals can only appear as leaf param values —
|
|
233
|
+
// there is nothing to substitute inside them — so pass them through
|
|
234
|
+
// unchanged.
|
|
235
|
+
const proto = Object.getPrototypeOf(node);
|
|
236
|
+
if (proto !== Object.prototype && proto !== null) {
|
|
237
|
+
return node;
|
|
238
|
+
}
|
|
239
|
+
// Clone into a null-prototype object so a legal TOML key that collides with
|
|
240
|
+
// a prototype member — `__proto__`, `constructor`, `prototype` — is written
|
|
241
|
+
// as an ordinary own data property instead of tripping the `__proto__`
|
|
242
|
+
// setter (which would drop the field or reparent the clone). `Object.entries`
|
|
243
|
+
// reads only own enumerable keys, so no inherited members leak in either.
|
|
244
|
+
const out = Object.create(null);
|
|
245
|
+
for (const [k, v] of Object.entries(node)) {
|
|
246
|
+
out[k] = substituteParamsDeep(v, params, ctx);
|
|
247
|
+
}
|
|
248
|
+
return out;
|
|
249
|
+
}
|
|
250
|
+
return node;
|
|
251
|
+
}
|
|
252
|
+
function substituteParamsInString(value, params, ctx) {
|
|
253
|
+
// Whole-string `{{ params.x }}` → splice the raw typed value.
|
|
254
|
+
const whole = value.match(WHOLE_PARAM_RE);
|
|
255
|
+
if (whole) {
|
|
256
|
+
return resolveParamPath(whole[1], params, ctx);
|
|
257
|
+
}
|
|
258
|
+
// Embedded `{{ params.x }}` → stringify the resolved value in place.
|
|
259
|
+
return value.replace(EMBEDDED_PARAM_RE, (_match, path) => stringifyParamValue(resolveParamPath(path, params, ctx)));
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Resolve a dotted `params.<path>` reference against the include's `with`
|
|
263
|
+
* table. A missing key (or missing sub-path) is a hard error naming the
|
|
264
|
+
* fragment, the param, and the include.
|
|
265
|
+
*/
|
|
266
|
+
function resolveParamPath(path, params, ctx) {
|
|
267
|
+
const segments = path.split(".");
|
|
268
|
+
let cursor = params;
|
|
269
|
+
for (const segment of segments) {
|
|
270
|
+
// Resolve only OWN properties at each segment. Using `in` here would walk
|
|
271
|
+
// the prototype chain, so `{{ params.constructor }}`, `{{ params.toString }}`,
|
|
272
|
+
// `{{ params.__proto__ }}`, or `{{ params.hasOwnProperty }}` would resolve
|
|
273
|
+
// an inherited `Object.prototype` member instead of hard-erroring like any
|
|
274
|
+
// other missing param. `Object.hasOwn` restricts the lookup to real,
|
|
275
|
+
// author-declared keys.
|
|
276
|
+
if (cursor === null ||
|
|
277
|
+
typeof cursor !== "object" ||
|
|
278
|
+
Array.isArray(cursor) ||
|
|
279
|
+
!Object.hasOwn(cursor, segment)) {
|
|
280
|
+
throw new Error(`Fragment '${ctx.fragment}' references '{{ params.${path} }}' but no matching key exists in the ${ctx.includeLabel} 'with' table (workflow '${ctx.workflowPath}').`);
|
|
281
|
+
}
|
|
282
|
+
cursor = cursor[segment];
|
|
283
|
+
}
|
|
284
|
+
return cursor;
|
|
285
|
+
}
|
|
286
|
+
function stringifyParamValue(value) {
|
|
287
|
+
if (value === null || value === undefined)
|
|
288
|
+
return "";
|
|
289
|
+
if (typeof value === "object")
|
|
290
|
+
return JSON.stringify(value);
|
|
291
|
+
return String(value);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* AND the include-level `runIf` onto a step's own `runIf`. Each operand is
|
|
295
|
+
* paren-wrapped because CEL's `&&` binds tighter than `||`. Mutates `step`.
|
|
296
|
+
*/
|
|
297
|
+
function applyIncludeRunIf(step, includeRunIf, ctx) {
|
|
298
|
+
// A non-string step `runIf` (e.g. `runIf = 123`, or a param that spliced a
|
|
299
|
+
// non-string value in) must hard-error, consistent with the include-level
|
|
300
|
+
// non-string `runIf` rejection. Otherwise it would fall through the
|
|
301
|
+
// string-only guard below and be silently dropped, turning a guarded step
|
|
302
|
+
// into an unconditional one.
|
|
303
|
+
if ("runIf" in step &&
|
|
304
|
+
step.runIf !== undefined &&
|
|
305
|
+
typeof step.runIf !== "string") {
|
|
306
|
+
throw new Error(`Fragment '${ctx.fragment}' produced a non-string 'runIf' (got ${JSON.stringify(step.runIf)}) in ${ctx.includeLabel} (workflow '${ctx.workflowPath}'). runIf must be a CEL string.`);
|
|
307
|
+
}
|
|
308
|
+
const include = typeof includeRunIf === "string" && includeRunIf.length > 0
|
|
309
|
+
? includeRunIf
|
|
310
|
+
: undefined;
|
|
311
|
+
const own = typeof step.runIf === "string" && step.runIf.length > 0
|
|
312
|
+
? step.runIf
|
|
313
|
+
: undefined;
|
|
314
|
+
let combined;
|
|
315
|
+
if (include && own)
|
|
316
|
+
combined = `(${include}) && (${own})`;
|
|
317
|
+
else
|
|
318
|
+
combined = include ?? own;
|
|
319
|
+
if (combined === undefined) {
|
|
320
|
+
if ("runIf" in step)
|
|
321
|
+
delete step.runIf;
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
step.runIf = combined;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
function assertUniqueStepIds(originated, workflowPath) {
|
|
328
|
+
const seen = new Map();
|
|
329
|
+
for (const { step, origin } of originated) {
|
|
330
|
+
const id = step?.id;
|
|
331
|
+
if (id === undefined || id === null)
|
|
332
|
+
continue; // let downstream code complain about missing ids
|
|
333
|
+
if (typeof id !== "string")
|
|
334
|
+
continue;
|
|
335
|
+
if (seen.has(id)) {
|
|
336
|
+
const firstOrigin = seen.get(id);
|
|
337
|
+
throw new Error(`Step id '${id}' appears twice when expanding workflow '${workflowPath}': first in ${firstOrigin}, then in ${origin}.`);
|
|
338
|
+
}
|
|
339
|
+
seen.set(id, origin);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
//# sourceMappingURL=workflow-fragments.js.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AAM,IAAI,KAAK,CACb,YAAY,EAAE,4CAA4C,YAAY,eAAe,WAAW,aAAa,MAAM,GAAG,CACvH,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keep `[[include]]` fragment structure alive across `config pull` (issue #2416).
|
|
3
|
+
*
|
|
4
|
+
* Fragments are a CLI-only authoring form: `expandWorkflowTomlData()` splices
|
|
5
|
+
* the referenced fragments into a flat `[[steps]]` list and the server only
|
|
6
|
+
* ever stores that expansion (see `workflow-fragments.ts`). `config pull`
|
|
7
|
+
* serializes the server's flat steps straight back to disk, so before this
|
|
8
|
+
* module a pull unconditionally overwrote a fragment-authored file with its
|
|
9
|
+
* own expansion — the `[[include]]` blocks were gone and had to be rebuilt by
|
|
10
|
+
* hand, even when `config diff` reported the file as synced.
|
|
11
|
+
*
|
|
12
|
+
* `reconcileWorkflowIncludes()` decides what pull should write for one
|
|
13
|
+
* workflow file. It only ever engages for a local file that actually carries
|
|
14
|
+
* an `include` key; everything else takes the unchanged "write what the server
|
|
15
|
+
* gave us" path.
|
|
16
|
+
*
|
|
17
|
+
* - **skip** — the local file expands to exactly what the server is running.
|
|
18
|
+
* There is nothing to apply, so leave the fragment source (and its
|
|
19
|
+
* comments and formatting) untouched. One thing still has to be applied to
|
|
20
|
+
* an otherwise-unchanged file: a retired inline `[[configs]]` list (#2733).
|
|
21
|
+
* Pull rewrites every other workflow file off it, and push rejects a file
|
|
22
|
+
* that still carries one, so a plain skip left the fragment source in a
|
|
23
|
+
* shape push refuses — pull → push of an untouched tree failed. Such a
|
|
24
|
+
* file takes the write-merged path with only the list removed.
|
|
25
|
+
* - **write-merged** — the server drifted, but its step list still *starts*
|
|
26
|
+
* with exactly the steps the local includes expand to. The drift is
|
|
27
|
+
* therefore expressible in fragment form: re-emit the file with the
|
|
28
|
+
* original `[[include]]` blocks and put the remaining server steps in the
|
|
29
|
+
* workflow's own `[[steps]]` list. Re-expanding that file reproduces the
|
|
30
|
+
* server's step list in order, so the next `config diff` reads as synced.
|
|
31
|
+
* - **write-expanded** — the fragment-derived prefix no longer matches what
|
|
32
|
+
* the server is running (a fragment's steps were edited or removed
|
|
33
|
+
* server-side), so no fragment-preserving file could reproduce it. Fall
|
|
34
|
+
* back to the historical behavior — write the fully expanded form — and
|
|
35
|
+
* say why, so the operator knows the fragment source was replaced rather
|
|
36
|
+
* than silently losing it.
|
|
37
|
+
*
|
|
38
|
+
* The order rule comes from the expander: it emits every fragment's steps
|
|
39
|
+
* first (in `include` order) and then the workflow's own `[[steps]]`. So a
|
|
40
|
+
* fragment-preserving file can only represent a server step list whose leading
|
|
41
|
+
* steps are exactly the fragment expansion. Server steps inserted *between*
|
|
42
|
+
* fragment steps are not representable and take the write-expanded path.
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* Hashes an already-parsed (and, for a local file, already-expanded) workflow
|
|
46
|
+
* TOML object to its canonical content hash. Injected by the caller so this
|
|
47
|
+
* module uses exactly the same normalization `config diff` does
|
|
48
|
+
* (`hashWorkflowTomlForDiff` in `commands/sync.ts`) without importing the
|
|
49
|
+
* command module back into `lib/`.
|
|
50
|
+
*/
|
|
51
|
+
export type WorkflowTomlHasher = (parsed: any) => string;
|
|
52
|
+
export interface IncludeReconcileOutcome {
|
|
53
|
+
/**
|
|
54
|
+
* `write-expanded`: write the server's serialized TOML unchanged (the
|
|
55
|
+
* pre-#2416 behavior). `skip`: leave the local file alone. `write-merged`:
|
|
56
|
+
* write `content`, which preserves the local `[[include]]` blocks.
|
|
57
|
+
*/
|
|
58
|
+
action: "write-expanded" | "skip" | "write-merged";
|
|
59
|
+
/** TOML to write. Only set when `action` is `write-merged`. */
|
|
60
|
+
content?: string;
|
|
61
|
+
/** Human-readable note for the pull log. Absent when there's nothing to say. */
|
|
62
|
+
message?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface ReconcileWorkflowIncludesOptions {
|
|
65
|
+
/** Workflow key, used only for log messages. */
|
|
66
|
+
workflowKey: string;
|
|
67
|
+
/** Absolute path of the local workflow TOML (also resolves the fragments dir). */
|
|
68
|
+
localPath: string;
|
|
69
|
+
/** Current contents of that file, or `undefined` when it doesn't exist yet. */
|
|
70
|
+
localContent: string | undefined;
|
|
71
|
+
/** The TOML `config pull` would write, from `serializeWorkflow()`. */
|
|
72
|
+
remoteToml: string;
|
|
73
|
+
/** Canonical content hash for a parsed workflow TOML. */
|
|
74
|
+
hashParsedToml: WorkflowTomlHasher;
|
|
75
|
+
}
|
|
76
|
+
export declare function reconcileWorkflowIncludes(options: ReconcileWorkflowIncludesOptions): IncludeReconcileOutcome;
|