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,440 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `workflows codegen --lang swift` orchestrator (issue #1547, Phases 2-3).
|
|
3
|
+
*
|
|
4
|
+
* The Swift counterpart of `workflow-codegen/generator.ts`. Reads the SAME
|
|
5
|
+
* synced workflow TOMLs (`.primitive/sync/<env>/<appId>/workflows/*.toml`) and
|
|
6
|
+
* emits ONE `<key>.generated.swift` per workflow. Each file carries the
|
|
7
|
+
* workflow's `<Key>Input`/`<Key>Output` Swift `Codable` types (Phase 1's
|
|
8
|
+
* `renderSwiftRootType`) plus — Phase 3 — a typed invoker factory: a free
|
|
9
|
+
* function `func <key>(_ client:) -> <Key>Workflow` returning a struct with
|
|
10
|
+
* `async throws` `runSync`/`start`/`getStatus` methods (Fork 2 = A). The
|
|
11
|
+
* factory binds `<Key>Input`/`<Key>Output` over the additive generic overloads
|
|
12
|
+
* on `WorkflowsAPI` (the only published SDK surface).
|
|
13
|
+
*
|
|
14
|
+
* Design decisions realized (maintainer decision, issue #1547):
|
|
15
|
+
* - Schemas are interpreted through the SAME drift-guarded descriptor the TS
|
|
16
|
+
* emitter reads (Fork 1 = A), via `renderSwiftRootType`, so a generated
|
|
17
|
+
* Swift type can never promise a shape the runtime validator rejects.
|
|
18
|
+
* - Operation metadata (key, `syncCallable`, required-vs-optional `input`) is
|
|
19
|
+
* read from the SHARED `describeWorkflowInvoker` IR — the SAME source the TS
|
|
20
|
+
* invoker uses. The Swift renderer reconstructs none of it (#1547 binding 5),
|
|
21
|
+
* so the two clients can never disagree on which operations a workflow
|
|
22
|
+
* exposes or whether its input is required.
|
|
23
|
+
* - `runSync` is emitted ONLY for `syncCallable: true` workflows (the server
|
|
24
|
+
* rejects run-sync otherwise), matching the TS factory. `start`,
|
|
25
|
+
* `getStatus`, `terminate`, and the workflow-scoped
|
|
26
|
+
* `cronTriggers.{create,update}` are emitted for every non-reserved
|
|
27
|
+
* workflow; `define` only for an apply-mode one. That is the SAME per-member
|
|
28
|
+
* gating the TS factory uses (#2806) — the two factories expose one surface,
|
|
29
|
+
* decided by the shared IR, not per language.
|
|
30
|
+
* - Where the Swift client is less typed than the JS one, the OPERATION still
|
|
31
|
+
* reaches parity while the payload stays as typed as the client is: a cron
|
|
32
|
+
* `rootInput` over an object-shaped schema is an open `JSONValue` (Swift has
|
|
33
|
+
* no `Partial<>` for the fields an `inputMapping` may supply), and
|
|
34
|
+
* `define`'s handler sees the client's untyped `WorkflowApplyContext`.
|
|
35
|
+
* - Disk lifecycle (write / `--check` / orphan cleanup) delegates to the shared
|
|
36
|
+
* `writeOrCheckGeneratedFiles`, scoped by an ownership BANNER (the "banner
|
|
37
|
+
* namespacing" edge case) so a shared Swift output dir stays safe.
|
|
38
|
+
*/
|
|
39
|
+
import * as path from "path";
|
|
40
|
+
import { writeOrCheckGeneratedFiles, } from "../codegen-shared/generatedFiles.js";
|
|
41
|
+
import { fingerprintToml } from "../db-codegen/dbFingerprint.js";
|
|
42
|
+
import { describeWorkflowInvoker } from "../workflow-codegen/invokerIR.js";
|
|
43
|
+
import { renderSwiftRootType, SwiftCodegenError } from "./schemaToSwift.js";
|
|
44
|
+
import { structTypeName, workflowSwiftFactoryName } from "./swiftNaming.js";
|
|
45
|
+
// Foreign banner guarded against when a workflow run shares an output dir with
|
|
46
|
+
// the database Swift generator (issue #1653, class 3b). Function-time use only,
|
|
47
|
+
// so the generator.ts ↔ dbGenerator.ts import cycle resolves safely.
|
|
48
|
+
import { DB_SWIFT_BANNER_PREFIXES } from "./dbGenerator.js";
|
|
49
|
+
import { assertNoRetainedSiblingCollision, assertNoForeignGeneratorSymbolCollision, } from "./siblingSymbols.js";
|
|
50
|
+
/** Suffix identifying a generated Swift file. */
|
|
51
|
+
export const GENERATED_SWIFT_FILE_SUFFIX = ".generated.swift";
|
|
52
|
+
/**
|
|
53
|
+
* Banner prefix stamped at the top of every CLI-emitted `.generated.swift`
|
|
54
|
+
* file. Deliberately DISTINCT from the Swift model codegen's
|
|
55
|
+
* `// Generated by swift-bao-codegen` header so that:
|
|
56
|
+
* - the model codegen's stale-sweep (which only removes files starting with
|
|
57
|
+
* its own header) never deletes these; and
|
|
58
|
+
* - this generator's cleanup (scoped to this prefix) never deletes a
|
|
59
|
+
* model-codegen file that shares the `.generated.swift` suffix.
|
|
60
|
+
* The prefix is common to every workflow file, so it is a safe ownership key.
|
|
61
|
+
*/
|
|
62
|
+
export const SWIFT_BANNER_PREFIX = "// AUTO-GENERATED FROM workflows/";
|
|
63
|
+
/** The Swift module the generated types + invoker import (`JSONValue`,
|
|
64
|
+
* `JsBaoClient`, the `WorkflowsAPI` generics, and the typed result structs all
|
|
65
|
+
* live there). */
|
|
66
|
+
const CLIENT_MODULE = "JsBaoClient";
|
|
67
|
+
const INDENT = " ";
|
|
68
|
+
/** PascalCase, sanitized, non-keyword base type name for a workflow key.
|
|
69
|
+
* `create-checkout-session` → `CreateCheckoutSession`; `123-job` → `_123Job`
|
|
70
|
+
* (digit-leading prefixed, parity with the TS `ensureValidIdentifierStart`). */
|
|
71
|
+
export function workflowSwiftTypeBaseName(key) {
|
|
72
|
+
return structTypeName(key);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Parse a single workflow TOML into the data the Swift emitter needs. The
|
|
76
|
+
* operation metadata comes from the SHARED `describeWorkflowInvoker` IR (the
|
|
77
|
+
* SAME source the TS invoker uses); only the Swift-specific naming +
|
|
78
|
+
* type-declaration rendering happens here. Throws on malformed schema JSON
|
|
79
|
+
* (fail-and-exit). Returns null for a reserved workflow.
|
|
80
|
+
*/
|
|
81
|
+
function parseWorkflow(input) {
|
|
82
|
+
const ir = describeWorkflowInvoker({
|
|
83
|
+
fileStem: input.fileStem,
|
|
84
|
+
tomlContent: input.tomlContent,
|
|
85
|
+
});
|
|
86
|
+
if (!ir)
|
|
87
|
+
return null; // reserved workflow
|
|
88
|
+
const base = workflowSwiftTypeBaseName(ir.key);
|
|
89
|
+
const inputTypeName = `${base}Input`;
|
|
90
|
+
const outputTypeName = `${base}Output`;
|
|
91
|
+
const sourceFile = `workflows/${ir.key}.toml`;
|
|
92
|
+
return {
|
|
93
|
+
key: ir.key,
|
|
94
|
+
base,
|
|
95
|
+
inputTypeName,
|
|
96
|
+
outputTypeName,
|
|
97
|
+
syncCallable: ir.syncCallable,
|
|
98
|
+
inputRequired: ir.inputRequired,
|
|
99
|
+
requiresClientApply: ir.requiresClientApply,
|
|
100
|
+
inputIsObjectShaped: ir.inputIsObjectShaped,
|
|
101
|
+
inputDecl: renderSwiftRootType(inputTypeName, ir.inputSchema, { sourceFile }),
|
|
102
|
+
outputDecl: renderSwiftRootType(outputTypeName, ir.outputSchema, {
|
|
103
|
+
sourceFile,
|
|
104
|
+
}),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** A Swift string literal for the workflow key (runtime call passes it verbatim). */
|
|
108
|
+
function swiftKeyLiteral(key) {
|
|
109
|
+
const escaped = key
|
|
110
|
+
.replace(/\\/g, "\\\\")
|
|
111
|
+
.replace(/"/g, '\\"')
|
|
112
|
+
.replace(/\n/g, "\\n")
|
|
113
|
+
.replace(/\r/g, "\\r")
|
|
114
|
+
.replace(/\t/g, "\\t");
|
|
115
|
+
return `"${escaped}"`;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Render the workflow-scoped cron-trigger helpers (#2806), the Swift half of
|
|
119
|
+
* the JS factory's `cronTriggers.{create,update}`. They live in a NESTED
|
|
120
|
+
* `CronTriggers` struct reached through a `cronTriggers` property, so the call
|
|
121
|
+
* shape matches JS (`<key>(client).cronTriggers.create(...)`) and no extra
|
|
122
|
+
* top-level Swift symbol is declared.
|
|
123
|
+
*
|
|
124
|
+
* `workflowKey` is pinned into the params the helper builds and is not a
|
|
125
|
+
* caller-facing argument, so a trigger cannot be redirected at another
|
|
126
|
+
* workflow. Every other field of `CreateCronTriggerParams` /
|
|
127
|
+
* `UpdateCronTriggerParams` is passed through, defaulted exactly as the client
|
|
128
|
+
* struct defaults it — including `update`'s clearable `description`
|
|
129
|
+
* (`Updatable<String>`), which the client models and JS types as
|
|
130
|
+
* `string | null`.
|
|
131
|
+
*
|
|
132
|
+
* `rootInput` follows the SHARED IR's `inputIsObjectShaped` decision: an
|
|
133
|
+
* object-shaped input keeps the open `JSONValue` the client takes, because the
|
|
134
|
+
* JS factory types it `Partial<<Key>Input>` (an `inputMapping` may supply the
|
|
135
|
+
* rest) and Swift has no `Partial<>` to express that; anything else binds the
|
|
136
|
+
* full `<Key>Input` and is encoded here, matching the JS rule.
|
|
137
|
+
*
|
|
138
|
+
* `update`'s `rootInput` is TRI-STATE, because the JS param it mirrors is
|
|
139
|
+
* `rootInput?: I | null` — omitted leaves the stored value alone, a value
|
|
140
|
+
* replaces it, and JSON null CLEARS it. The open `JSONValue` branch already
|
|
141
|
+
* spells the clear `.null`; the bound branch would otherwise have no way to say
|
|
142
|
+
* it (a bound `<Key>Input?` reads `nil` as "omitted"), so it takes the client's
|
|
143
|
+
* own `Updatable<<Key>Input>` — the same wrapper `description` uses — and maps
|
|
144
|
+
* `.clear` to the `JSONValue.null` the wire wants.
|
|
145
|
+
*/
|
|
146
|
+
function renderCronTriggers(wf) {
|
|
147
|
+
const keyLiteral = swiftKeyLiteral(wf.key);
|
|
148
|
+
const I = INDENT;
|
|
149
|
+
// Object-shaped → open value (JS's `Partial<>`); otherwise the bound type.
|
|
150
|
+
const rootInputParam = wf.inputIsObjectShaped
|
|
151
|
+
? `rootInput: JSONValue? = nil`
|
|
152
|
+
: `rootInput: ${wf.inputTypeName}? = nil`;
|
|
153
|
+
const rootInputArg = wf.inputIsObjectShaped
|
|
154
|
+
? `rootInput: rootInput,`
|
|
155
|
+
: `rootInput: try rootInput.map { try JSONValue(encoding: $0) },`;
|
|
156
|
+
// `update` only: the clearable form of the same parameter.
|
|
157
|
+
const updateRootInputParam = wf.inputIsObjectShaped
|
|
158
|
+
? rootInputParam
|
|
159
|
+
: `rootInput: Updatable<${wf.inputTypeName}>? = nil`;
|
|
160
|
+
const updateRootInputDoc = wf.inputIsObjectShaped
|
|
161
|
+
? [
|
|
162
|
+
`${I}${I}/// unchanged; \`description\` removes the stored value with \`.clear\``,
|
|
163
|
+
`${I}${I}/// and \`rootInput\` with \`.null\`.`,
|
|
164
|
+
]
|
|
165
|
+
: [
|
|
166
|
+
`${I}${I}/// unchanged; \`description\` and \`rootInput\` both remove the stored`,
|
|
167
|
+
`${I}${I}/// value with \`.clear\`.`,
|
|
168
|
+
];
|
|
169
|
+
// Lowering the tri-state to the client's `JSONValue?` needs a statement, so
|
|
170
|
+
// the bound branch hoists it into a local instead of inlining the map.
|
|
171
|
+
const updateRootInputPrelude = wf.inputIsObjectShaped
|
|
172
|
+
? []
|
|
173
|
+
: [
|
|
174
|
+
`${I}${I}${I}let rootInputValue: JSONValue? = try rootInput.map {`,
|
|
175
|
+
`${I}${I}${I}${I}(change: Updatable<${wf.inputTypeName}>) throws -> JSONValue in`,
|
|
176
|
+
`${I}${I}${I}${I}switch change {`,
|
|
177
|
+
`${I}${I}${I}${I}case .clear: return .null`,
|
|
178
|
+
`${I}${I}${I}${I}case let .value(input): return try JSONValue(encoding: input)`,
|
|
179
|
+
`${I}${I}${I}${I}}`,
|
|
180
|
+
`${I}${I}${I}}`,
|
|
181
|
+
];
|
|
182
|
+
const updateRootInputArg = wf.inputIsObjectShaped
|
|
183
|
+
? `rootInput: rootInput,`
|
|
184
|
+
: `rootInput: rootInputValue,`;
|
|
185
|
+
// The prelude costs the body its implicit single-expression return.
|
|
186
|
+
const updateReturn = updateRootInputPrelude.length > 0 ? `return ` : ``;
|
|
187
|
+
return [
|
|
188
|
+
``,
|
|
189
|
+
`${I}/// Cron triggers scoped to the \`${wf.key}\` workflow. The workflow key is`,
|
|
190
|
+
`${I}/// pinned by the helpers below, so a trigger cannot be redirected.`,
|
|
191
|
+
`${I}public var cronTriggers: CronTriggers {`,
|
|
192
|
+
`${I}${I}CronTriggers(client: client)`,
|
|
193
|
+
`${I}}`,
|
|
194
|
+
``,
|
|
195
|
+
`${I}/// Typed cron-trigger management for the \`${wf.key}\` workflow.`,
|
|
196
|
+
`${I}public struct CronTriggers: Sendable {`,
|
|
197
|
+
`${I}${I}public let client: JsBaoClient`,
|
|
198
|
+
``,
|
|
199
|
+
`${I}${I}public init(client: JsBaoClient) {`,
|
|
200
|
+
`${I}${I}${I}self.client = client`,
|
|
201
|
+
`${I}${I}}`,
|
|
202
|
+
``,
|
|
203
|
+
`${I}${I}/// Create a cron trigger that fires this workflow.`,
|
|
204
|
+
`${I}${I}@discardableResult`,
|
|
205
|
+
`${I}${I}public func create(`,
|
|
206
|
+
`${I}${I}${I}triggerKey: String,`,
|
|
207
|
+
`${I}${I}${I}displayName: String,`,
|
|
208
|
+
`${I}${I}${I}cron: String,`,
|
|
209
|
+
`${I}${I}${I}timezone: String? = nil,`,
|
|
210
|
+
`${I}${I}${I}description: String? = nil,`,
|
|
211
|
+
`${I}${I}${I}overlapPolicy: CronOverlapPolicy? = nil,`,
|
|
212
|
+
`${I}${I}${I}${rootInputParam},`,
|
|
213
|
+
`${I}${I}${I}inputMapping: JSONValue? = nil`,
|
|
214
|
+
`${I}${I}) async throws -> CronTriggerInfo {`,
|
|
215
|
+
`${I}${I}${I}try await client.cronTriggers.create(`,
|
|
216
|
+
`${I}${I}${I}${I}params: CreateCronTriggerParams(`,
|
|
217
|
+
`${I}${I}${I}${I}${I}triggerKey: triggerKey,`,
|
|
218
|
+
`${I}${I}${I}${I}${I}displayName: displayName,`,
|
|
219
|
+
`${I}${I}${I}${I}${I}cron: cron,`,
|
|
220
|
+
`${I}${I}${I}${I}${I}workflowKey: ${keyLiteral},`,
|
|
221
|
+
`${I}${I}${I}${I}${I}timezone: timezone,`,
|
|
222
|
+
`${I}${I}${I}${I}${I}description: description,`,
|
|
223
|
+
`${I}${I}${I}${I}${I}overlapPolicy: overlapPolicy,`,
|
|
224
|
+
`${I}${I}${I}${I}${I}${rootInputArg}`,
|
|
225
|
+
`${I}${I}${I}${I}${I}inputMapping: inputMapping`,
|
|
226
|
+
`${I}${I}${I}${I})`,
|
|
227
|
+
`${I}${I}${I})`,
|
|
228
|
+
`${I}${I}}`,
|
|
229
|
+
``,
|
|
230
|
+
`${I}${I}/// Update a cron trigger that fires this workflow. Omitted fields stay`,
|
|
231
|
+
...updateRootInputDoc,
|
|
232
|
+
`${I}${I}@discardableResult`,
|
|
233
|
+
`${I}${I}public func update(`,
|
|
234
|
+
`${I}${I}${I}triggerId: String,`,
|
|
235
|
+
`${I}${I}${I}displayName: String? = nil,`,
|
|
236
|
+
`${I}${I}${I}description: Updatable<String>? = nil,`,
|
|
237
|
+
`${I}${I}${I}cron: String? = nil,`,
|
|
238
|
+
`${I}${I}${I}timezone: String? = nil,`,
|
|
239
|
+
`${I}${I}${I}overlapPolicy: CronOverlapPolicy? = nil,`,
|
|
240
|
+
`${I}${I}${I}${updateRootInputParam},`,
|
|
241
|
+
`${I}${I}${I}inputMapping: JSONValue? = nil`,
|
|
242
|
+
`${I}${I}) async throws -> CronTriggerInfo {`,
|
|
243
|
+
...updateRootInputPrelude,
|
|
244
|
+
`${I}${I}${I}${updateReturn}try await client.cronTriggers.update(`,
|
|
245
|
+
`${I}${I}${I}${I}triggerId: triggerId,`,
|
|
246
|
+
`${I}${I}${I}${I}params: UpdateCronTriggerParams(`,
|
|
247
|
+
`${I}${I}${I}${I}${I}displayName: displayName,`,
|
|
248
|
+
`${I}${I}${I}${I}${I}description: description,`,
|
|
249
|
+
`${I}${I}${I}${I}${I}cron: cron,`,
|
|
250
|
+
`${I}${I}${I}${I}${I}timezone: timezone,`,
|
|
251
|
+
`${I}${I}${I}${I}${I}workflowKey: ${keyLiteral},`,
|
|
252
|
+
`${I}${I}${I}${I}${I}overlapPolicy: overlapPolicy,`,
|
|
253
|
+
`${I}${I}${I}${I}${I}${updateRootInputArg}`,
|
|
254
|
+
`${I}${I}${I}${I}${I}inputMapping: inputMapping`,
|
|
255
|
+
`${I}${I}${I}${I})`,
|
|
256
|
+
`${I}${I}${I})`,
|
|
257
|
+
`${I}${I}}`,
|
|
258
|
+
`${I}}`,
|
|
259
|
+
];
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Render the typed Swift invoker for one workflow (Fork 2 = A): a free function
|
|
263
|
+
* returning a small struct with `async throws` methods, mirroring the JS
|
|
264
|
+
* factory. `runSync` is emitted only when the shared IR says `syncCallable`;
|
|
265
|
+
* `start` + `getStatus` always. The `input` argument is required or optional
|
|
266
|
+
* per the shared IR's `inputRequired` (the SAME decision the TS factory makes).
|
|
267
|
+
*
|
|
268
|
+
* Each method delegates to the additive generic overloads on `WorkflowsAPI`
|
|
269
|
+
* (`runSync<Input,Output>` / `start<Input>` / `getStatus<Output>`), binding
|
|
270
|
+
* `<Key>Input`/`<Key>Output`. Those overloads are the only published SDK
|
|
271
|
+
* surface; this generated struct is app-target code.
|
|
272
|
+
*/
|
|
273
|
+
function renderInvoker(wf) {
|
|
274
|
+
const structName = `${wf.base}Workflow`;
|
|
275
|
+
const factoryName = workflowSwiftFactoryName(wf.key);
|
|
276
|
+
const keyLiteral = swiftKeyLiteral(wf.key);
|
|
277
|
+
// Required `input` → `input: <Key>Input`; optional → `input: <Key>Input? = nil`.
|
|
278
|
+
// The generic overloads take `Input?`, so a required value auto-promotes and
|
|
279
|
+
// an omitted optional sends the server `{}` (parity with the JS `input ?? {}`).
|
|
280
|
+
const inputParam = wf.inputRequired
|
|
281
|
+
? `input: ${wf.inputTypeName}`
|
|
282
|
+
: `input: ${wf.inputTypeName}? = nil`;
|
|
283
|
+
const lines = [];
|
|
284
|
+
lines.push(`/// Typed invoker for the \`${wf.key}\` workflow. Bind its \`${wf.inputTypeName}\` /`, `/// \`${wf.outputTypeName}\` over the generic \`WorkflowsAPI\` overloads. Obtain one`, `/// with \`${factoryName}(client)\`.`, `public struct ${structName}: Sendable {`, `${INDENT}public let client: JsBaoClient`, ``, `${INDENT}public init(client: JsBaoClient) {`, `${INDENT}${INDENT}self.client = client`, `${INDENT}}`);
|
|
285
|
+
if (wf.syncCallable) {
|
|
286
|
+
lines.push(``, `${INDENT}/// Run the workflow synchronously and wait for its terminal status.`, `${INDENT}/// Emitted only because \`${wf.key}\` is \`syncCallable\` (parity with JS).`, `${INDENT}public func runSync(`, `${INDENT}${INDENT}${inputParam},`, `${INDENT}${INDENT}runKey: String? = nil,`, `${INDENT}${INDENT}contextDocId: String? = nil,`, `${INDENT}${INDENT}meta: [String: Any]? = nil,`, `${INDENT}${INDENT}timeout: TimeInterval? = nil`, `${INDENT}) async throws -> RunSyncResult<${wf.outputTypeName}> {`, `${INDENT}${INDENT}try await client.workflows.runSync(`, `${INDENT}${INDENT}${INDENT}workflowKey: ${keyLiteral},`, `${INDENT}${INDENT}${INDENT}input: input,`, `${INDENT}${INDENT}${INDENT}runKey: runKey,`, `${INDENT}${INDENT}${INDENT}contextDocId: contextDocId,`, `${INDENT}${INDENT}${INDENT}meta: meta,`, `${INDENT}${INDENT}${INDENT}timeout: timeout`, `${INDENT}${INDENT})`, `${INDENT}}`);
|
|
287
|
+
}
|
|
288
|
+
lines.push(``, `${INDENT}/// Start the workflow asynchronously; returns the run handle.`, `${INDENT}@discardableResult`, `${INDENT}public func start(`, `${INDENT}${INDENT}${inputParam},`, `${INDENT}${INDENT}runKey: String? = nil,`, `${INDENT}${INDENT}contextDocId: String? = nil,`, `${INDENT}${INDENT}meta: [String: Any]? = nil,`, `${INDENT}${INDENT}forceRerun: Bool? = nil`, `${INDENT}) async throws -> StartWorkflowResult {`, `${INDENT}${INDENT}try await client.workflows.start(`, `${INDENT}${INDENT}${INDENT}workflowKey: ${keyLiteral},`, `${INDENT}${INDENT}${INDENT}input: input,`, `${INDENT}${INDENT}${INDENT}runKey: runKey,`, `${INDENT}${INDENT}${INDENT}contextDocId: contextDocId,`, `${INDENT}${INDENT}${INDENT}meta: meta,`, `${INDENT}${INDENT}${INDENT}forceRerun: forceRerun`, `${INDENT}${INDENT})`, `${INDENT}}`);
|
|
289
|
+
lines.push(``, `${INDENT}/// Fetch a run's status with a typed \`output\` bound to \`${wf.outputTypeName}\`.`, `${INDENT}public func getStatus(`, `${INDENT}${INDENT}runKey: String,`, `${INDENT}${INDENT}contextDocId: String? = nil`, `${INDENT}) async throws -> WorkflowStatus<${wf.outputTypeName}> {`, `${INDENT}${INDENT}try await client.workflows.getStatus(`, `${INDENT}${INDENT}${INDENT}workflowKey: ${keyLiteral},`, `${INDENT}${INDENT}${INDENT}runKey: runKey,`, `${INDENT}${INDENT}${INDENT}contextDocId: contextDocId`, `${INDENT}${INDENT})`, `${INDENT}}`);
|
|
290
|
+
// Typed termination (#2806), the Swift half of the JS factory's `terminate`.
|
|
291
|
+
// Emitted for EVERY non-reserved workflow — any run can be terminated — and
|
|
292
|
+
// bound to `<Key>Output`, since a terminated run can carry partial output
|
|
293
|
+
// (same rule as `getStatus`). `runKey` stays required and the key is pinned,
|
|
294
|
+
// so a caller cannot terminate another workflow's run.
|
|
295
|
+
lines.push(``, `${INDENT}/// Terminate a run; \`output\` is bound to \`${wf.outputTypeName}\` (a terminated`, `${INDENT}/// run can carry partial output).`, `${INDENT}@discardableResult`, `${INDENT}public func terminate(`, `${INDENT}${INDENT}runKey: String,`, `${INDENT}${INDENT}contextDocId: String? = nil`, `${INDENT}) async throws -> WorkflowStatus<${wf.outputTypeName}> {`, `${INDENT}${INDENT}try await client.workflows.terminate(`, `${INDENT}${INDENT}${INDENT}workflowKey: ${keyLiteral},`, `${INDENT}${INDENT}${INDENT}runKey: runKey,`, `${INDENT}${INDENT}${INDENT}contextDocId: contextDocId`, `${INDENT}${INDENT})`, `${INDENT}}`);
|
|
296
|
+
// Typed apply-handler registration (#2806), emitted ONLY for an apply-mode
|
|
297
|
+
// workflow (`requiresClientApply !== false` — the same shared-IR flag that
|
|
298
|
+
// gates the JS factory's `define`). The key is passed positionally, so there
|
|
299
|
+
// is nothing a caller could spread over it. Unlike JS, the handler's `output`
|
|
300
|
+
// is NOT bound to `<Key>Output`: the Swift client's `WorkflowApplyContext`
|
|
301
|
+
// carries an untyped `Any?` and no output generic to bind, so this member
|
|
302
|
+
// brings the OPERATION to parity while the payload stays as typed as the
|
|
303
|
+
// client itself is.
|
|
304
|
+
if (wf.requiresClientApply) {
|
|
305
|
+
lines.push(``, `${INDENT}/// Register this workflow's apply handler. Emitted only because`, `${INDENT}/// \`${wf.key}\` is apply-mode (parity with JS). The context's \`output\``, `${INDENT}/// is the client's untyped \`Any?\`.`, `${INDENT}public func define(onApply: @escaping WorkflowApplyHandler) {`, `${INDENT}${INDENT}client.workflows.define(${keyLiteral}, onApply: onApply)`, `${INDENT}}`);
|
|
306
|
+
}
|
|
307
|
+
lines.push(...renderCronTriggers(wf));
|
|
308
|
+
lines.push(`}`);
|
|
309
|
+
// The free-function factory (Fork 2 = A call shape: `<key>(client).runSync(...)`).
|
|
310
|
+
lines.push(``, `/// Typed invoker factory for the \`${wf.key}\` workflow.`, `public func ${factoryName}(_ client: JsBaoClient) -> ${structName} {`, `${INDENT}${structName}(client: client)`, `}`);
|
|
311
|
+
return lines.join("\n");
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Render the full `<key>.generated.swift` content for a single workflow TOML.
|
|
315
|
+
* Returns null for a reserved (`__internal.*`) workflow. Pure — exported so
|
|
316
|
+
* tests can assert on the string directly.
|
|
317
|
+
*/
|
|
318
|
+
export function renderWorkflowSwiftFile(input) {
|
|
319
|
+
const wf = parseWorkflow(input);
|
|
320
|
+
if (!wf)
|
|
321
|
+
return null;
|
|
322
|
+
const fingerprint = fingerprintToml(input.tomlContent);
|
|
323
|
+
const banner = [
|
|
324
|
+
`// AUTO-GENERATED FROM workflows/${wf.key}.toml — DO NOT EDIT.`,
|
|
325
|
+
"// Run `primitive workflows codegen --lang swift` to regenerate.",
|
|
326
|
+
`// fingerprint: ${fingerprint}`,
|
|
327
|
+
].join("\n");
|
|
328
|
+
const imports = ["import Foundation", `import ${CLIENT_MODULE}`].join("\n");
|
|
329
|
+
const content = [banner, imports, wf.inputDecl, wf.outputDecl, renderInvoker(wf)].join("\n\n") + "\n";
|
|
330
|
+
// Every top-level Swift symbol this file declares: the `<Key>Input` /
|
|
331
|
+
// `<Key>Output` types, the `<Key>Workflow` invoker struct, and its
|
|
332
|
+
// free-function factory. Enumerating ALL of them (issue #1653, Codex
|
|
333
|
+
// refinement) lets the run-scoped registry catch a cross-workflow collision on
|
|
334
|
+
// any of them, not just Input/Output.
|
|
335
|
+
const symbols = [
|
|
336
|
+
wf.inputTypeName,
|
|
337
|
+
wf.outputTypeName,
|
|
338
|
+
`${wf.base}Workflow`,
|
|
339
|
+
workflowSwiftFactoryName(wf.key),
|
|
340
|
+
];
|
|
341
|
+
return { key: wf.key, content, symbols };
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Run Swift workflow codegen end-to-end. One `<key>.generated.swift` per
|
|
345
|
+
* workflow; delegates the disk lifecycle to the shared writer/checker with
|
|
346
|
+
* banner-scoped ownership so a shared Swift output dir stays safe.
|
|
347
|
+
*/
|
|
348
|
+
export async function generateWorkflowSwiftTypes(options) {
|
|
349
|
+
const outAbs = path.resolve(options.outputDir);
|
|
350
|
+
// Run-scoped registry: emitted top-level Swift symbol → the workflow key that
|
|
351
|
+
// emitted it. Two DIFFERENT keys emitting the same symbol redeclare when all
|
|
352
|
+
// `.generated.swift` files compile into one module (issue #1653, class 1).
|
|
353
|
+
const symbolOwner = new Map();
|
|
354
|
+
const filesToWrite = new Map();
|
|
355
|
+
for (const input of options.inputs) {
|
|
356
|
+
const rendered = renderWorkflowSwiftFile(input);
|
|
357
|
+
if (!rendered)
|
|
358
|
+
continue; // reserved workflow — no file, no symbols
|
|
359
|
+
for (const symbol of rendered.symbols) {
|
|
360
|
+
const prior = symbolOwner.get(symbol);
|
|
361
|
+
if (prior !== undefined && prior !== rendered.key) {
|
|
362
|
+
throw new SwiftCodegenError(`swift workflow codegen: type-name collision — workflow keys ` +
|
|
363
|
+
`"${prior}" and "${rendered.key}" both produce Swift type ` +
|
|
364
|
+
`"${symbol}", which redeclare when all .generated.swift files ` +
|
|
365
|
+
`compile into one module. Rename one workflow key so the two differ ` +
|
|
366
|
+
`after Swift PascalCase normalization.`, { sourceFile: `workflows/${rendered.key}.toml` });
|
|
367
|
+
}
|
|
368
|
+
symbolOwner.set(symbol, rendered.key);
|
|
369
|
+
}
|
|
370
|
+
const filePath = path.join(outAbs, `${rendered.key}${GENERATED_SWIFT_FILE_SUFFIX}`);
|
|
371
|
+
filesToWrite.set(filePath, rendered.content);
|
|
372
|
+
}
|
|
373
|
+
// Filtered-run sibling collision (issue #1653, class 1 for `--single` runs).
|
|
374
|
+
// A `singleWorkflow` run renders only the selected key; its retained sibling
|
|
375
|
+
// `.generated.swift` files stay on disk but never enter `symbolOwner` above,
|
|
376
|
+
// so a symbol this run emits could still redeclare against a sibling once
|
|
377
|
+
// every file compiles into one module. The foreign-banner write guard does NOT
|
|
378
|
+
// cover this (siblings carry the SAME banner and a different filename, so there
|
|
379
|
+
// is no path or banner collision). Compare against the retained siblings' own
|
|
380
|
+
// declared symbols — no persistent manifest (sponsor decision #1).
|
|
381
|
+
if (options.singleWorkflow === true) {
|
|
382
|
+
await assertNoRetainedSiblingCollision({
|
|
383
|
+
outputDir: outAbs,
|
|
384
|
+
ownershipBanner: SWIFT_BANNER_PREFIX,
|
|
385
|
+
suffix: GENERATED_SWIFT_FILE_SUFFIX,
|
|
386
|
+
emitted: symbolOwner,
|
|
387
|
+
ownPaths: filesToWrite.keys(),
|
|
388
|
+
makeError: ({ symbol, owner, siblingStem }) => new SwiftCodegenError(`swift workflow codegen: type-name collision with a retained sibling — ` +
|
|
389
|
+
`workflow key "${owner}" (this run) and the existing ` +
|
|
390
|
+
`"${siblingStem}${GENERATED_SWIFT_FILE_SUFFIX}" both declare Swift ` +
|
|
391
|
+
`symbol "${symbol}", which redeclares when all .generated.swift files ` +
|
|
392
|
+
`compile into one module. A filtered (single-workflow) run does not ` +
|
|
393
|
+
`regenerate siblings, so both files coexist. Rename one workflow key, ` +
|
|
394
|
+
`or regenerate the whole output directory.`, { sourceFile: `workflows/${owner}.toml` }),
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
// Cross-generator namespace collision (issue #1857), the mirror of the check
|
|
398
|
+
// in the DB generator. A workflow's top-level symbol (`<Key>Input`, etc.) can
|
|
399
|
+
// match the namespace enum name a DATABASE-generated file already declares in
|
|
400
|
+
// a shared output dir — e.g. workflow `foo` emits a top-level struct `FooInput`
|
|
401
|
+
// while db type `foo-input` emits `public enum FooInput`. Their filenames
|
|
402
|
+
// differ, so the foreign-banner WRITE guard below (path-only) never trips, and
|
|
403
|
+
// the retained-sibling guard above only scans workflow-owned files. This scan
|
|
404
|
+
// reads the DB-owned siblings' declared top-level symbols and throws if any of
|
|
405
|
+
// this run's emitted symbols collides. It runs on every workflow run (not just
|
|
406
|
+
// filtered), because a full workflow run does not regenerate DB files — they
|
|
407
|
+
// coexist regardless of ordering.
|
|
408
|
+
await assertNoForeignGeneratorSymbolCollision({
|
|
409
|
+
outputDir: outAbs,
|
|
410
|
+
foreignBanner: DB_SWIFT_BANNER_PREFIXES,
|
|
411
|
+
suffix: GENERATED_SWIFT_FILE_SUFFIX,
|
|
412
|
+
emitted: symbolOwner,
|
|
413
|
+
makeError: ({ symbol, owner, siblingStem }) => new SwiftCodegenError(`swift workflow codegen: type-name collision with a database-generated ` +
|
|
414
|
+
`file — workflow key "${owner}" emits Swift type "${symbol}", but the ` +
|
|
415
|
+
`existing "${siblingStem}${GENERATED_SWIFT_FILE_SUFFIX}" (owned by the ` +
|
|
416
|
+
`database Swift generator) already declares a top-level "${symbol}" in ` +
|
|
417
|
+
`the same output directory, which redeclares when all .generated.swift ` +
|
|
418
|
+
`files compile into one module. Rename the workflow or the ` +
|
|
419
|
+
`"${siblingStem}" database type so the two differ after Swift ` +
|
|
420
|
+
`normalization, or give one generator a separate --output directory.`, { sourceFile: `workflows/${owner}.toml` }),
|
|
421
|
+
});
|
|
422
|
+
return await writeOrCheckGeneratedFiles({
|
|
423
|
+
outputDir: outAbs,
|
|
424
|
+
filesToWrite,
|
|
425
|
+
check: options.check,
|
|
426
|
+
fullOwnership: options.singleWorkflow !== true,
|
|
427
|
+
generatedSuffix: GENERATED_SWIFT_FILE_SUFFIX,
|
|
428
|
+
ownershipBanner: SWIFT_BANNER_PREFIX,
|
|
429
|
+
// Class 3b: never clobber a file owned by the database Swift generator —
|
|
430
|
+
// including one it stamped before the #2760 banner rename.
|
|
431
|
+
foreignOwnershipBanners: DB_SWIFT_BANNER_PREFIXES,
|
|
432
|
+
onForeignBannerCollision: ({ filePath, foreignBanner }) => new SwiftCodegenError(`swift codegen: output collision — this run would overwrite ` +
|
|
433
|
+
`"${path.basename(filePath)}" in the shared output directory, which ` +
|
|
434
|
+
`is already owned by a different generator (banner ` +
|
|
435
|
+
`"${foreignBanner.trim()}"). A workflow key and a database type with ` +
|
|
436
|
+
`the same name cannot share an output directory; give one generator a ` +
|
|
437
|
+
`separate --output directory.`),
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","s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
* JSON-Schema → Swift `Codable` converter for `swift-codegen` (issue #1547,
|
|
3
|
+
* Phase 1). The Swift counterpart of `workflow-codegen/schemaToTs.ts`.
|
|
4
|
+
*
|
|
5
|
+
* Both emitters read the SAME drift-guarded interpretation of the JSON-Schema
|
|
6
|
+
* subset the workflow platform supports — the vendored `SchemaDescriptor`
|
|
7
|
+
* (`workflow-codegen/generated-schema-descriptor.ts`, a byte copy of the server
|
|
8
|
+
* validator). Only the emitted syntax differs, so a generated Swift type can
|
|
9
|
+
* never promise a shape the runtime validator rejects. See the design and
|
|
10
|
+
* maintainer decision on issue #1547.
|
|
11
|
+
*
|
|
12
|
+
* Where Swift diverges from TypeScript:
|
|
13
|
+
*
|
|
14
|
+
* - **Named types, not anonymous.** TS renders nested object/enum/`oneOf`
|
|
15
|
+
* types inline; Swift `Codable` needs a NAMED `struct`/`enum` for each, so
|
|
16
|
+
* this emitter declares nested types inside their enclosing type.
|
|
17
|
+
* - **Scalars** (Fork 4, maintainer-confirmed): `string`→`String`,
|
|
18
|
+
* `number`→`Double`, `integer`→`Int` (ergonomic divergence from TS
|
|
19
|
+
* `number`), `boolean`→`Bool`.
|
|
20
|
+
* - **Un-descended nodes** (`$ref`, `allOf`, `format`, tuple `items`,
|
|
21
|
+
* `patternProperties`, numeric constraints, multi-scalar non-null unions,
|
|
22
|
+
* mixed-type enums, open-object extra values) → `JSONValue`, the Swift
|
|
23
|
+
* analog of TS `unknown`.
|
|
24
|
+
* - **`never`** (an uninhabitable enum after the type gate) → a strict codegen
|
|
25
|
+
* error, since the field can never be constructed (Fork 4).
|
|
26
|
+
* - **Scalar `enum`, all strings** → a nested `enum … : String, Codable,
|
|
27
|
+
* CaseIterable, Sendable`, the same form the Swift model codegen emits.
|
|
28
|
+
* - **`oneOf` discriminated union** → an `enum` with associated values plus a
|
|
29
|
+
* generated `init(from:)`/`encode(to:)` keyed on the discriminator.
|
|
30
|
+
*
|
|
31
|
+
* Codable semantics adopted from the maintainer decision (binding item 4):
|
|
32
|
+
*
|
|
33
|
+
* - Every generated `struct` gets a generated **public memberwise
|
|
34
|
+
* initializer** (Swift's synthesized memberwise init is not `public` across
|
|
35
|
+
* module boundaries).
|
|
36
|
+
* - A **required-nullable** property (required, but its value may be `null`)
|
|
37
|
+
* is encoded with an EXPLICIT null (not omitted) so server-side
|
|
38
|
+
* required-key validation still sees the key; decode is lenient (a missing
|
|
39
|
+
* key decodes to `nil`).
|
|
40
|
+
* - An **open object** stores unknown keys in an `extra: [String: JSONValue]`
|
|
41
|
+
* catch-all via custom Codable that separates known keys from extras; a key
|
|
42
|
+
* that collides with a known property is owned by the known property (the
|
|
43
|
+
* extra copy is dropped on encode, and never captured on decode).
|
|
44
|
+
* - A `oneOf` branch `struct` CARRIES the discriminator as a single-case
|
|
45
|
+
* `String` enum property, so decoding a branch rejects a conflicting
|
|
46
|
+
* discriminator value, and encoding re-emits the tag from the branch.
|
|
47
|
+
*
|
|
48
|
+
* Errors are named (`SwiftCodegenError`) and carry the source file and schema
|
|
49
|
+
* path for diagnostics (binding item 6).
|
|
50
|
+
*/
|
|
51
|
+
import { schemaRejectsEmptyObject } from "../workflow-codegen/schemaToTs.js";
|
|
52
|
+
/** Re-exported so the invoker phases share ONE required-vs-optional decision. */
|
|
53
|
+
export { schemaRejectsEmptyObject };
|
|
54
|
+
/** A named codegen error carrying the source file + schema path (binding 6). */
|
|
55
|
+
export declare class SwiftCodegenError extends Error {
|
|
56
|
+
readonly sourceFile?: string;
|
|
57
|
+
readonly schemaPath?: string;
|
|
58
|
+
constructor(message: string, opts?: {
|
|
59
|
+
sourceFile?: string;
|
|
60
|
+
schemaPath?: string;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
export interface SwiftCodegenContext {
|
|
64
|
+
/** The `.toml`/schema file this type was generated from, for diagnostics. */
|
|
65
|
+
sourceFile?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Render a full Swift type declaration for a ROOT schema (e.g. a workflow's
|
|
69
|
+
* `<Key>Input`/`<Key>Output`), including every nested type it needs. Returns the
|
|
70
|
+
* Swift source for the type only — the CLI adds the import/banner (Phase 2).
|
|
71
|
+
*/
|
|
72
|
+
export declare function renderSwiftRootType(rootTypeName: string, schema: any, ctx?: SwiftCodegenContext): string;
|