codika 3.0.0
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/LICENSE +21 -0
- package/README.md +68 -0
- package/dist/cli/commands/completion.d.ts +15 -0
- package/dist/cli/commands/completion.d.ts.map +1 -0
- package/dist/cli/commands/completion.js +810 -0
- package/dist/cli/commands/completion.js.map +1 -0
- package/dist/cli/commands/config/clear.d.ts +12 -0
- package/dist/cli/commands/config/clear.d.ts.map +1 -0
- package/dist/cli/commands/config/clear.js +35 -0
- package/dist/cli/commands/config/clear.js.map +1 -0
- package/dist/cli/commands/config/index.d.ts +15 -0
- package/dist/cli/commands/config/index.d.ts.map +1 -0
- package/dist/cli/commands/config/index.js +21 -0
- package/dist/cli/commands/config/index.js.map +1 -0
- package/dist/cli/commands/config/set.d.ts +41 -0
- package/dist/cli/commands/config/set.d.ts.map +1 -0
- package/dist/cli/commands/config/set.js +185 -0
- package/dist/cli/commands/config/set.js.map +1 -0
- package/dist/cli/commands/config/show.d.ts +12 -0
- package/dist/cli/commands/config/show.d.ts.map +1 -0
- package/dist/cli/commands/config/show.js +45 -0
- package/dist/cli/commands/config/show.js.map +1 -0
- package/dist/cli/commands/deploy/documents.d.ts +12 -0
- package/dist/cli/commands/deploy/documents.d.ts.map +1 -0
- package/dist/cli/commands/deploy/documents.js +217 -0
- package/dist/cli/commands/deploy/documents.js.map +1 -0
- package/dist/cli/commands/deploy/index.d.ts +14 -0
- package/dist/cli/commands/deploy/index.d.ts.map +1 -0
- package/dist/cli/commands/deploy/index.js +21 -0
- package/dist/cli/commands/deploy/index.js.map +1 -0
- package/dist/cli/commands/deploy/process-data-ingestion.d.ts +13 -0
- package/dist/cli/commands/deploy/process-data-ingestion.d.ts.map +1 -0
- package/dist/cli/commands/deploy/process-data-ingestion.js +226 -0
- package/dist/cli/commands/deploy/process-data-ingestion.js.map +1 -0
- package/dist/cli/commands/deploy/use-case.d.ts +9 -0
- package/dist/cli/commands/deploy/use-case.d.ts.map +1 -0
- package/dist/cli/commands/deploy/use-case.js +212 -0
- package/dist/cli/commands/deploy/use-case.js.map +1 -0
- package/dist/cli/commands/get/execution.d.ts +9 -0
- package/dist/cli/commands/get/execution.d.ts.map +1 -0
- package/dist/cli/commands/get/execution.js +159 -0
- package/dist/cli/commands/get/execution.js.map +1 -0
- package/dist/cli/commands/get/index.d.ts +13 -0
- package/dist/cli/commands/get/index.d.ts.map +1 -0
- package/dist/cli/commands/get/index.js +20 -0
- package/dist/cli/commands/get/index.js.map +1 -0
- package/dist/cli/commands/get/skills.d.ts +15 -0
- package/dist/cli/commands/get/skills.d.ts.map +1 -0
- package/dist/cli/commands/get/skills.js +135 -0
- package/dist/cli/commands/get/skills.js.map +1 -0
- package/dist/cli/commands/get/use-case.d.ts +9 -0
- package/dist/cli/commands/get/use-case.d.ts.map +1 -0
- package/dist/cli/commands/get/use-case.js +186 -0
- package/dist/cli/commands/get/use-case.js.map +1 -0
- package/dist/cli/commands/init.d.ts +14 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +347 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/integration/delete.d.ts +13 -0
- package/dist/cli/commands/integration/delete.d.ts.map +1 -0
- package/dist/cli/commands/integration/delete.js +140 -0
- package/dist/cli/commands/integration/delete.js.map +1 -0
- package/dist/cli/commands/integration/index.d.ts +13 -0
- package/dist/cli/commands/integration/index.d.ts.map +1 -0
- package/dist/cli/commands/integration/index.js +20 -0
- package/dist/cli/commands/integration/index.js.map +1 -0
- package/dist/cli/commands/integration/list.d.ts +13 -0
- package/dist/cli/commands/integration/list.d.ts.map +1 -0
- package/dist/cli/commands/integration/list.js +129 -0
- package/dist/cli/commands/integration/list.js.map +1 -0
- package/dist/cli/commands/integration/set.d.ts +13 -0
- package/dist/cli/commands/integration/set.d.ts.map +1 -0
- package/dist/cli/commands/integration/set.js +253 -0
- package/dist/cli/commands/integration/set.js.map +1 -0
- package/dist/cli/commands/list/executions.d.ts +12 -0
- package/dist/cli/commands/list/executions.d.ts.map +1 -0
- package/dist/cli/commands/list/executions.js +168 -0
- package/dist/cli/commands/list/executions.js.map +1 -0
- package/dist/cli/commands/list/index.d.ts +11 -0
- package/dist/cli/commands/list/index.d.ts.map +1 -0
- package/dist/cli/commands/list/index.js +14 -0
- package/dist/cli/commands/list/index.js.map +1 -0
- package/dist/cli/commands/logout.d.ts +12 -0
- package/dist/cli/commands/logout.d.ts.map +1 -0
- package/dist/cli/commands/logout.js +58 -0
- package/dist/cli/commands/logout.js.map +1 -0
- package/dist/cli/commands/project/create.d.ts +8 -0
- package/dist/cli/commands/project/create.d.ts.map +1 -0
- package/dist/cli/commands/project/create.js +109 -0
- package/dist/cli/commands/project/create.js.map +1 -0
- package/dist/cli/commands/project/index.d.ts +12 -0
- package/dist/cli/commands/project/index.d.ts.map +1 -0
- package/dist/cli/commands/project/index.js +15 -0
- package/dist/cli/commands/project/index.js.map +1 -0
- package/dist/cli/commands/publish.d.ts +12 -0
- package/dist/cli/commands/publish.d.ts.map +1 -0
- package/dist/cli/commands/publish.js +152 -0
- package/dist/cli/commands/publish.js.map +1 -0
- package/dist/cli/commands/redeploy.d.ts +11 -0
- package/dist/cli/commands/redeploy.d.ts.map +1 -0
- package/dist/cli/commands/redeploy.js +166 -0
- package/dist/cli/commands/redeploy.js.map +1 -0
- package/dist/cli/commands/status.d.ts +63 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +290 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/trigger.d.ts +8 -0
- package/dist/cli/commands/trigger.d.ts.map +1 -0
- package/dist/cli/commands/trigger.js +247 -0
- package/dist/cli/commands/trigger.js.map +1 -0
- package/dist/cli/commands/use.d.ts +13 -0
- package/dist/cli/commands/use.d.ts.map +1 -0
- package/dist/cli/commands/use.js +92 -0
- package/dist/cli/commands/use.js.map +1 -0
- package/dist/cli/commands/verify/index.d.ts +13 -0
- package/dist/cli/commands/verify/index.d.ts.map +1 -0
- package/dist/cli/commands/verify/index.js +18 -0
- package/dist/cli/commands/verify/index.js.map +1 -0
- package/dist/cli/commands/verify/use-case.d.ts +23 -0
- package/dist/cli/commands/verify/use-case.d.ts.map +1 -0
- package/dist/cli/commands/verify/use-case.js +94 -0
- package/dist/cli/commands/verify/use-case.js.map +1 -0
- package/dist/cli/commands/verify/workflow.d.ts +22 -0
- package/dist/cli/commands/verify/workflow.d.ts.map +1 -0
- package/dist/cli/commands/verify/workflow.js +82 -0
- package/dist/cli/commands/verify/workflow.js.map +1 -0
- package/dist/cli/commands/whoami.d.ts +13 -0
- package/dist/cli/commands/whoami.d.ts.map +1 -0
- package/dist/cli/commands/whoami.js +126 -0
- package/dist/cli/commands/whoami.js.map +1 -0
- package/dist/cli/index.d.ts +24 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +90 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/templates/claude-md-template.d.ts +12 -0
- package/dist/cli/templates/claude-md-template.d.ts.map +1 -0
- package/dist/cli/templates/claude-md-template.js +162 -0
- package/dist/cli/templates/claude-md-template.js.map +1 -0
- package/dist/cli/templates/config-template.d.ts +18 -0
- package/dist/cli/templates/config-template.d.ts.map +1 -0
- package/dist/cli/templates/config-template.js +350 -0
- package/dist/cli/templates/config-template.js.map +1 -0
- package/dist/cli/templates/skill-templates.d.ts +24 -0
- package/dist/cli/templates/skill-templates.d.ts.map +1 -0
- package/dist/cli/templates/skill-templates.js +117 -0
- package/dist/cli/templates/skill-templates.js.map +1 -0
- package/dist/cli/templates/slug.d.ts +9 -0
- package/dist/cli/templates/slug.d.ts.map +1 -0
- package/dist/cli/templates/slug.js +17 -0
- package/dist/cli/templates/slug.js.map +1 -0
- package/dist/cli/templates/workflow-templates.d.ts +693 -0
- package/dist/cli/templates/workflow-templates.d.ts.map +1 -0
- package/dist/cli/templates/workflow-templates.js +516 -0
- package/dist/cli/templates/workflow-templates.js.map +1 -0
- package/dist/cli/utils/output.d.ts +65 -0
- package/dist/cli/utils/output.d.ts.map +1 -0
- package/dist/cli/utils/output.js +188 -0
- package/dist/cli/utils/output.js.map +1 -0
- package/dist/cli/utils/validation-output.d.ts +21 -0
- package/dist/cli/utils/validation-output.d.ts.map +1 -0
- package/dist/cli/utils/validation-output.js +204 -0
- package/dist/cli/utils/validation-output.js.map +1 -0
- package/dist/data/integration-fields.d.ts +27 -0
- package/dist/data/integration-fields.d.ts.map +1 -0
- package/dist/data/integration-fields.js +361 -0
- package/dist/data/integration-fields.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/types/process-types.d.ts +740 -0
- package/dist/types/process-types.d.ts.map +1 -0
- package/dist/types/process-types.js +22 -0
- package/dist/types/process-types.js.map +1 -0
- package/dist/utils/config.d.ts +127 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +315 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/data-ingestion-deploy-client.d.ts +53 -0
- package/dist/utils/data-ingestion-deploy-client.d.ts.map +1 -0
- package/dist/utils/data-ingestion-deploy-client.js +63 -0
- package/dist/utils/data-ingestion-deploy-client.js.map +1 -0
- package/dist/utils/data-ingestion-deployer.d.ts +78 -0
- package/dist/utils/data-ingestion-deployer.d.ts.map +1 -0
- package/dist/utils/data-ingestion-deployer.js +119 -0
- package/dist/utils/data-ingestion-deployer.js.map +1 -0
- package/dist/utils/deploy-client.d.ts +55 -0
- package/dist/utils/deploy-client.d.ts.map +1 -0
- package/dist/utils/deploy-client.js +73 -0
- package/dist/utils/deploy-client.js.map +1 -0
- package/dist/utils/deployment-archiver.d.ts +110 -0
- package/dist/utils/deployment-archiver.d.ts.map +1 -0
- package/dist/utils/deployment-archiver.js +158 -0
- package/dist/utils/deployment-archiver.js.map +1 -0
- package/dist/utils/document-deploy-client.d.ts +41 -0
- package/dist/utils/document-deploy-client.d.ts.map +1 -0
- package/dist/utils/document-deploy-client.js +46 -0
- package/dist/utils/document-deploy-client.js.map +1 -0
- package/dist/utils/encryption.d.ts +85 -0
- package/dist/utils/encryption.d.ts.map +1 -0
- package/dist/utils/encryption.js +162 -0
- package/dist/utils/encryption.js.map +1 -0
- package/dist/utils/execution-client.d.ts +71 -0
- package/dist/utils/execution-client.d.ts.map +1 -0
- package/dist/utils/execution-client.js +56 -0
- package/dist/utils/execution-client.js.map +1 -0
- package/dist/utils/integration-client.d.ts +134 -0
- package/dist/utils/integration-client.d.ts.map +1 -0
- package/dist/utils/integration-client.js +109 -0
- package/dist/utils/integration-client.js.map +1 -0
- package/dist/utils/list-executions-client.d.ts +47 -0
- package/dist/utils/list-executions-client.d.ts.map +1 -0
- package/dist/utils/list-executions-client.js +50 -0
- package/dist/utils/list-executions-client.js.map +1 -0
- package/dist/utils/metadata-client.d.ts +90 -0
- package/dist/utils/metadata-client.d.ts.map +1 -0
- package/dist/utils/metadata-client.js +66 -0
- package/dist/utils/metadata-client.js.map +1 -0
- package/dist/utils/project-client.d.ts +70 -0
- package/dist/utils/project-client.d.ts.map +1 -0
- package/dist/utils/project-client.js +63 -0
- package/dist/utils/project-client.js.map +1 -0
- package/dist/utils/project-json.d.ts +71 -0
- package/dist/utils/project-json.d.ts.map +1 -0
- package/dist/utils/project-json.js +129 -0
- package/dist/utils/project-json.js.map +1 -0
- package/dist/utils/publish-client.d.ts +53 -0
- package/dist/utils/publish-client.d.ts.map +1 -0
- package/dist/utils/publish-client.js +64 -0
- package/dist/utils/publish-client.js.map +1 -0
- package/dist/utils/redeploy-client.d.ts +39 -0
- package/dist/utils/redeploy-client.d.ts.map +1 -0
- package/dist/utils/redeploy-client.js +51 -0
- package/dist/utils/redeploy-client.js.map +1 -0
- package/dist/utils/skill-parser.d.ts +52 -0
- package/dist/utils/skill-parser.d.ts.map +1 -0
- package/dist/utils/skill-parser.js +127 -0
- package/dist/utils/skill-parser.js.map +1 -0
- package/dist/utils/skills-client.d.ts +39 -0
- package/dist/utils/skills-client.d.ts.map +1 -0
- package/dist/utils/skills-client.js +32 -0
- package/dist/utils/skills-client.js.map +1 -0
- package/dist/utils/trigger-client.d.ts +78 -0
- package/dist/utils/trigger-client.d.ts.map +1 -0
- package/dist/utils/trigger-client.js +81 -0
- package/dist/utils/trigger-client.js.map +1 -0
- package/dist/utils/use-case-deployer.d.ts +93 -0
- package/dist/utils/use-case-deployer.d.ts.map +1 -0
- package/dist/utils/use-case-deployer.js +270 -0
- package/dist/utils/use-case-deployer.js.map +1 -0
- package/dist/utils/version-manager.d.ts +63 -0
- package/dist/utils/version-manager.d.ts.map +1 -0
- package/dist/utils/version-manager.js +91 -0
- package/dist/utils/version-manager.js.map +1 -0
- package/dist/utils/workflow-encoding.d.ts +26 -0
- package/dist/utils/workflow-encoding.d.ts.map +1 -0
- package/dist/utils/workflow-encoding.js +41 -0
- package/dist/utils/workflow-encoding.js.map +1 -0
- package/dist/validation/fixer.d.ts +56 -0
- package/dist/validation/fixer.d.ts.map +1 -0
- package/dist/validation/fixer.js +168 -0
- package/dist/validation/fixer.js.map +1 -0
- package/dist/validation/rules/codika-init-required.d.ts +18 -0
- package/dist/validation/rules/codika-init-required.d.ts.map +1 -0
- package/dist/validation/rules/codika-init-required.js +70 -0
- package/dist/validation/rules/codika-init-required.js.map +1 -0
- package/dist/validation/rules/codika-submit-result.d.ts +22 -0
- package/dist/validation/rules/codika-submit-result.d.ts.map +1 -0
- package/dist/validation/rules/codika-submit-result.js +144 -0
- package/dist/validation/rules/codika-submit-result.js.map +1 -0
- package/dist/validation/rules/error-branch-required.d.ts +24 -0
- package/dist/validation/rules/error-branch-required.d.ts.map +1 -0
- package/dist/validation/rules/error-branch-required.js +103 -0
- package/dist/validation/rules/error-branch-required.js.map +1 -0
- package/dist/validation/rules/index.d.ts +18 -0
- package/dist/validation/rules/index.d.ts.map +1 -0
- package/dist/validation/rules/index.js +28 -0
- package/dist/validation/rules/index.js.map +1 -0
- package/dist/validation/rules/schedule-webhook-convergence.d.ts +24 -0
- package/dist/validation/rules/schedule-webhook-convergence.d.ts.map +1 -0
- package/dist/validation/rules/schedule-webhook-convergence.js +129 -0
- package/dist/validation/rules/schedule-webhook-convergence.js.map +1 -0
- package/dist/validation/rules/subworkflow-min-params.d.ts +21 -0
- package/dist/validation/rules/subworkflow-min-params.d.ts.map +1 -0
- package/dist/validation/rules/subworkflow-min-params.js +84 -0
- package/dist/validation/rules/subworkflow-min-params.js.map +1 -0
- package/dist/validation/runner.d.ts +43 -0
- package/dist/validation/runner.d.ts.map +1 -0
- package/dist/validation/runner.js +335 -0
- package/dist/validation/runner.js.map +1 -0
- package/dist/validation/types.d.ts +155 -0
- package/dist/validation/types.d.ts.map +1 -0
- package/dist/validation/types.js +8 -0
- package/dist/validation/types.js.map +1 -0
- package/dist/validation/use-case-scripts/calledby-consistency.d.ts +23 -0
- package/dist/validation/use-case-scripts/calledby-consistency.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/calledby-consistency.js +236 -0
- package/dist/validation/use-case-scripts/calledby-consistency.js.map +1 -0
- package/dist/validation/use-case-scripts/config-exports.d.ts +17 -0
- package/dist/validation/use-case-scripts/config-exports.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/config-exports.js +93 -0
- package/dist/validation/use-case-scripts/config-exports.js.map +1 -0
- package/dist/validation/use-case-scripts/custom-integration-schema.d.ts +21 -0
- package/dist/validation/use-case-scripts/custom-integration-schema.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/custom-integration-schema.js +378 -0
- package/dist/validation/use-case-scripts/custom-integration-schema.js.map +1 -0
- package/dist/validation/use-case-scripts/index.d.ts +27 -0
- package/dist/validation/use-case-scripts/index.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/index.js +52 -0
- package/dist/validation/use-case-scripts/index.js.map +1 -0
- package/dist/validation/use-case-scripts/integration-inheritance.d.ts +35 -0
- package/dist/validation/use-case-scripts/integration-inheritance.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/integration-inheritance.js +348 -0
- package/dist/validation/use-case-scripts/integration-inheritance.js.map +1 -0
- package/dist/validation/use-case-scripts/schema-types.d.ts +21 -0
- package/dist/validation/use-case-scripts/schema-types.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/schema-types.js +134 -0
- package/dist/validation/use-case-scripts/schema-types.js.map +1 -0
- package/dist/validation/use-case-scripts/skill-consistency.d.ts +21 -0
- package/dist/validation/use-case-scripts/skill-consistency.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/skill-consistency.js +180 -0
- package/dist/validation/use-case-scripts/skill-consistency.js.map +1 -0
- package/dist/validation/use-case-scripts/subworkflow-references.d.ts +22 -0
- package/dist/validation/use-case-scripts/subworkflow-references.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/subworkflow-references.js +139 -0
- package/dist/validation/use-case-scripts/subworkflow-references.js.map +1 -0
- package/dist/validation/use-case-scripts/trigger-type-consistency.d.ts +25 -0
- package/dist/validation/use-case-scripts/trigger-type-consistency.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/trigger-type-consistency.js +265 -0
- package/dist/validation/use-case-scripts/trigger-type-consistency.js.map +1 -0
- package/dist/validation/use-case-scripts/trigger-types.d.ts +20 -0
- package/dist/validation/use-case-scripts/trigger-types.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/trigger-types.js +177 -0
- package/dist/validation/use-case-scripts/trigger-types.js.map +1 -0
- package/dist/validation/use-case-scripts/triggers-required.d.ts +23 -0
- package/dist/validation/use-case-scripts/triggers-required.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/triggers-required.js +111 -0
- package/dist/validation/use-case-scripts/triggers-required.js.map +1 -0
- package/dist/validation/use-case-scripts/webhook-path-consistency.d.ts +28 -0
- package/dist/validation/use-case-scripts/webhook-path-consistency.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/webhook-path-consistency.js +288 -0
- package/dist/validation/use-case-scripts/webhook-path-consistency.js.map +1 -0
- package/dist/validation/use-case-scripts/workflow-imports.d.ts +16 -0
- package/dist/validation/use-case-scripts/workflow-imports.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/workflow-imports.js +206 -0
- package/dist/validation/use-case-scripts/workflow-imports.js.map +1 -0
- package/dist/validation/workflow-scripts/credential-placeholders.d.ts +21 -0
- package/dist/validation/workflow-scripts/credential-placeholders.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/credential-placeholders.js +278 -0
- package/dist/validation/workflow-scripts/credential-placeholders.js.map +1 -0
- package/dist/validation/workflow-scripts/db-always-output.d.ts +16 -0
- package/dist/validation/workflow-scripts/db-always-output.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/db-always-output.js +95 -0
- package/dist/validation/workflow-scripts/db-always-output.js.map +1 -0
- package/dist/validation/workflow-scripts/exec-workflow-wait.d.ts +15 -0
- package/dist/validation/workflow-scripts/exec-workflow-wait.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/exec-workflow-wait.js +85 -0
- package/dist/validation/workflow-scripts/exec-workflow-wait.js.map +1 -0
- package/dist/validation/workflow-scripts/index.d.ts +31 -0
- package/dist/validation/workflow-scripts/index.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/index.js +58 -0
- package/dist/validation/workflow-scripts/index.js.map +1 -0
- package/dist/validation/workflow-scripts/instparm-quoting.d.ts +21 -0
- package/dist/validation/workflow-scripts/instparm-quoting.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/instparm-quoting.js +59 -0
- package/dist/validation/workflow-scripts/instparm-quoting.js.map +1 -0
- package/dist/validation/workflow-scripts/llm-model-id.d.ts +17 -0
- package/dist/validation/workflow-scripts/llm-model-id.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/llm-model-id.js +171 -0
- package/dist/validation/workflow-scripts/llm-model-id.js.map +1 -0
- package/dist/validation/workflow-scripts/llm-output-access.d.ts +23 -0
- package/dist/validation/workflow-scripts/llm-output-access.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/llm-output-access.js +274 -0
- package/dist/validation/workflow-scripts/llm-output-access.js.map +1 -0
- package/dist/validation/workflow-scripts/merge-before-terminal.d.ts +20 -0
- package/dist/validation/workflow-scripts/merge-before-terminal.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/merge-before-terminal.js +87 -0
- package/dist/validation/workflow-scripts/merge-before-terminal.js.map +1 -0
- package/dist/validation/workflow-scripts/placeholder-syntax.d.ts +29 -0
- package/dist/validation/workflow-scripts/placeholder-syntax.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/placeholder-syntax.js +154 -0
- package/dist/validation/workflow-scripts/placeholder-syntax.js.map +1 -0
- package/dist/validation/workflow-scripts/retry-backoff.d.ts +16 -0
- package/dist/validation/workflow-scripts/retry-backoff.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/retry-backoff.js +197 -0
- package/dist/validation/workflow-scripts/retry-backoff.js.map +1 -0
- package/dist/validation/workflow-scripts/webhook-id.d.ts +17 -0
- package/dist/validation/workflow-scripts/webhook-id.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/webhook-id.js +79 -0
- package/dist/validation/workflow-scripts/webhook-id.js.map +1 -0
- package/dist/validation/workflow-scripts/workflow-format.d.ts +16 -0
- package/dist/validation/workflow-scripts/workflow-format.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/workflow-format.js +51 -0
- package/dist/validation/workflow-scripts/workflow-format.js.map +1 -0
- package/dist/validation/workflow-scripts/workflow-sanitization.d.ts +21 -0
- package/dist/validation/workflow-scripts/workflow-sanitization.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/workflow-sanitization.js +78 -0
- package/dist/validation/workflow-scripts/workflow-sanitization.js.map +1 -0
- package/dist/validation/workflow-scripts/workflow-settings.d.ts +19 -0
- package/dist/validation/workflow-scripts/workflow-settings.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/workflow-settings.js +131 -0
- package/dist/validation/workflow-scripts/workflow-settings.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Document Deployment Client
|
|
3
|
+
* HTTP client for deploying use case documents to the Codika platform.
|
|
4
|
+
*/
|
|
5
|
+
export interface DocumentInput {
|
|
6
|
+
stage: number;
|
|
7
|
+
title: string;
|
|
8
|
+
content: string;
|
|
9
|
+
summary: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CreatedDocumentInfo {
|
|
12
|
+
stage: number;
|
|
13
|
+
documentId: string;
|
|
14
|
+
version: string;
|
|
15
|
+
status: 'accepted';
|
|
16
|
+
}
|
|
17
|
+
export interface DeployDocumentsSuccessResult {
|
|
18
|
+
success: true;
|
|
19
|
+
projectId: string;
|
|
20
|
+
documentsCreated: CreatedDocumentInfo[];
|
|
21
|
+
requestId: string;
|
|
22
|
+
}
|
|
23
|
+
export interface DeployDocumentsErrorResult {
|
|
24
|
+
success: false;
|
|
25
|
+
error: string;
|
|
26
|
+
errorCode?: string;
|
|
27
|
+
details?: {
|
|
28
|
+
stage?: number;
|
|
29
|
+
reason?: string;
|
|
30
|
+
};
|
|
31
|
+
requestId?: string;
|
|
32
|
+
}
|
|
33
|
+
export type DeployDocumentsResult = DeployDocumentsSuccessResult | DeployDocumentsErrorResult;
|
|
34
|
+
export declare function deployDocuments(options: {
|
|
35
|
+
projectId: string;
|
|
36
|
+
documents: DocumentInput[];
|
|
37
|
+
apiUrl: string;
|
|
38
|
+
apiKey: string;
|
|
39
|
+
}): Promise<DeployDocumentsResult>;
|
|
40
|
+
export declare function isDeployDocumentsSuccess(result: DeployDocumentsResult): result is DeployDocumentsSuccessResult;
|
|
41
|
+
//# sourceMappingURL=document-deploy-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-deploy-client.d.ts","sourceRoot":"","sources":["../../src/utils/document-deploy-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,IAAI,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,mBAAmB,EAAE,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,qBAAqB,GAAG,4BAA4B,GAAG,0BAA0B,CAAC;AAI9F,wBAAsB,eAAe,CAAC,OAAO,EAAE;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAqCjC;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,qBAAqB,GAC5B,MAAM,IAAI,4BAA4B,CAExC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Document Deployment Client
|
|
3
|
+
* HTTP client for deploying use case documents to the Codika platform.
|
|
4
|
+
*/
|
|
5
|
+
// ── API Functions ────────────────────────────────────────
|
|
6
|
+
export async function deployDocuments(options) {
|
|
7
|
+
const { projectId, documents, apiUrl, apiKey } = options;
|
|
8
|
+
try {
|
|
9
|
+
const response = await fetch(apiUrl, {
|
|
10
|
+
method: 'POST',
|
|
11
|
+
headers: {
|
|
12
|
+
'Content-Type': 'application/json',
|
|
13
|
+
'X-Process-Manager-Key': apiKey,
|
|
14
|
+
},
|
|
15
|
+
body: JSON.stringify({ projectId, documents }),
|
|
16
|
+
});
|
|
17
|
+
const result = await response.json();
|
|
18
|
+
if (result.success) {
|
|
19
|
+
return {
|
|
20
|
+
success: true,
|
|
21
|
+
projectId: result.data.projectId,
|
|
22
|
+
documentsCreated: result.data.documentsCreated,
|
|
23
|
+
requestId: result.requestId,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return {
|
|
28
|
+
success: false,
|
|
29
|
+
error: result.error?.message || 'Unknown error',
|
|
30
|
+
errorCode: result.error?.code,
|
|
31
|
+
details: result.error?.details,
|
|
32
|
+
requestId: result.requestId,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return {
|
|
38
|
+
success: false,
|
|
39
|
+
error: error instanceof Error ? error.message : String(error),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export function isDeployDocumentsSuccess(result) {
|
|
44
|
+
return result.success === true;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=document-deploy-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-deploy-client.js","sourceRoot":"","sources":["../../src/utils/document-deploy-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmCH,4DAA4D;AAE5D,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAKrC;IACC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEzD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,EAAE;YACnC,MAAM,EAAE,MAAM;YACd,OAA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is a Node.js port of the browser-based encryption from
|
|
6
|
+
* codika-app-platform/src/lib/services/integrations/utils/integrationEncryption.ts
|
|
7
|
+
*
|
|
8
|
+
* Compatibility:
|
|
9
|
+
* - Uses WebCrypto API (crypto.subtle) available in Node 18+
|
|
10
|
+
* - AES-GCM output includes the 16-byte auth tag appended to the ciphertext,
|
|
11
|
+
* matching the browser WebCrypto behavior
|
|
12
|
+
* - The backend (functions/src/utils/crypto/decryption.ts) splits the last 16 bytes
|
|
13
|
+
* as the auth tag when decrypting
|
|
14
|
+
* - RSA-OAEP with SHA-256 matches backend's RSA_PKCS1_OAEP_PADDING + oaepHash 'sha256'
|
|
15
|
+
* - Serialization format: JSON.stringify({ encryptedKey, encryptedData, iv }) all base64
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Encrypted data structure containing all components needed for decryption.
|
|
19
|
+
* This matches the structure expected by the backend's `deserializeAndDecrypt()`.
|
|
20
|
+
*/
|
|
21
|
+
export interface EncryptedData {
|
|
22
|
+
/** RSA-OAEP encrypted AES-256 key, base64-encoded */
|
|
23
|
+
encryptedKey: string;
|
|
24
|
+
/** AES-GCM encrypted data with 16-byte auth tag appended, base64-encoded */
|
|
25
|
+
encryptedData: string;
|
|
26
|
+
/** 96-bit initialization vector for AES-GCM, base64-encoded */
|
|
27
|
+
iv: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Encrypted field representation for storage in Firestore.
|
|
31
|
+
* The `value` field contains the JSON-serialized EncryptedData.
|
|
32
|
+
*/
|
|
33
|
+
export interface EncryptedField {
|
|
34
|
+
/** JSON.stringify(EncryptedData) */
|
|
35
|
+
value: string;
|
|
36
|
+
/** Always true for encrypted fields */
|
|
37
|
+
encrypted: boolean;
|
|
38
|
+
/** Optional human-readable description of the secret */
|
|
39
|
+
description?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Fetch the RSA public key (PEM format) from the Codika platform.
|
|
43
|
+
*
|
|
44
|
+
* The key is cached in memory for the lifetime of the process to avoid
|
|
45
|
+
* redundant network requests.
|
|
46
|
+
*
|
|
47
|
+
* @param publicKeyUrl - URL to fetch the public key from.
|
|
48
|
+
* Defaults to `CODIKA_PUBLIC_KEY_URL` env var, or the platform's hosted key.
|
|
49
|
+
* @returns The public key in PEM format
|
|
50
|
+
* @throws If the key cannot be fetched
|
|
51
|
+
*/
|
|
52
|
+
export declare function fetchPublicKey(publicKeyUrl?: string): Promise<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Encrypt a plaintext secret using RSA-OAEP + AES-GCM hybrid encryption.
|
|
55
|
+
*
|
|
56
|
+
* The encryption process:
|
|
57
|
+
* 1. Fetches the RSA public key from the Codika platform (cached per process)
|
|
58
|
+
* 2. Generates a random 256-bit AES key
|
|
59
|
+
* 3. Generates a random 96-bit IV
|
|
60
|
+
* 4. Encrypts the plaintext with AES-256-GCM (output includes 16-byte auth tag)
|
|
61
|
+
* 5. Encrypts the AES key with RSA-OAEP (SHA-256)
|
|
62
|
+
* 6. Returns an {@link EncryptedField} ready for Firestore storage
|
|
63
|
+
*
|
|
64
|
+
* The output is compatible with the backend's `deserializeAndDecrypt()` function
|
|
65
|
+
* which uses Node.js `crypto.privateDecrypt()` for the RSA step and
|
|
66
|
+
* `crypto.createDecipheriv('aes-256-gcm')` for the AES step, splitting the
|
|
67
|
+
* last 16 bytes of `encryptedData` as the GCM auth tag.
|
|
68
|
+
*
|
|
69
|
+
* @param plaintext - The secret value to encrypt
|
|
70
|
+
* @param description - Optional description of the secret (stored unencrypted)
|
|
71
|
+
* @param publicKeyUrl - Optional URL override for the public key.
|
|
72
|
+
* Defaults to `CODIKA_PUBLIC_KEY_URL` env var, or the platform's hosted key.
|
|
73
|
+
* @returns An {@link EncryptedField} with the serialized encrypted data
|
|
74
|
+
* @throws If encryption fails (e.g., public key unavailable, crypto error)
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* const field = await encryptSecret('sk-my-api-key', 'OpenAI API Key');
|
|
79
|
+
* // field.value is JSON with { encryptedKey, encryptedData, iv }
|
|
80
|
+
* // field.encrypted is true
|
|
81
|
+
* // Store field in Firestore
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function encryptSecret(plaintext: string, description?: string, publicKeyUrl?: string): Promise<EncryptedField>;
|
|
85
|
+
//# sourceMappingURL=encryption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/utils/encryption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAgBH;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B,qDAAqD;IACrD,YAAY,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,aAAa,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,EAAE,EAAE,MAAM,CAAC;CACX;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,SAAS,EAAE,OAAO,CAAC;IACnB,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AASD;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAqB3E;AA8BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,aAAa,CAClC,SAAS,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,cAAc,CAAC,CA8EzB"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encryption Utilities (Node.js port)
|
|
3
|
+
*
|
|
4
|
+
* Hybrid encryption (RSA-OAEP + AES-GCM) for integration tokens and secrets.
|
|
5
|
+
* This is a Node.js port of the browser-based encryption from
|
|
6
|
+
* codika-app-platform/src/lib/services/integrations/utils/integrationEncryption.ts
|
|
7
|
+
*
|
|
8
|
+
* Compatibility:
|
|
9
|
+
* - Uses WebCrypto API (crypto.subtle) available in Node 18+
|
|
10
|
+
* - AES-GCM output includes the 16-byte auth tag appended to the ciphertext,
|
|
11
|
+
* matching the browser WebCrypto behavior
|
|
12
|
+
* - The backend (functions/src/utils/crypto/decryption.ts) splits the last 16 bytes
|
|
13
|
+
* as the auth tag when decrypting
|
|
14
|
+
* - RSA-OAEP with SHA-256 matches backend's RSA_PKCS1_OAEP_PADDING + oaepHash 'sha256'
|
|
15
|
+
* - Serialization format: JSON.stringify({ encryptedKey, encryptedData, iv }) all base64
|
|
16
|
+
*/
|
|
17
|
+
import { webcrypto } from 'crypto';
|
|
18
|
+
const subtle = webcrypto.subtle;
|
|
19
|
+
// ========================================
|
|
20
|
+
// CONSTANTS
|
|
21
|
+
// ========================================
|
|
22
|
+
const DEFAULT_PUBLIC_KEY_URL = 'https://codika-app.web.app/encryption/public.pem';
|
|
23
|
+
// ========================================
|
|
24
|
+
// PUBLIC KEY CACHE
|
|
25
|
+
// ========================================
|
|
26
|
+
/** In-memory cache for fetched public keys, keyed by URL */
|
|
27
|
+
const publicKeyCache = new Map();
|
|
28
|
+
/**
|
|
29
|
+
* Fetch the RSA public key (PEM format) from the Codika platform.
|
|
30
|
+
*
|
|
31
|
+
* The key is cached in memory for the lifetime of the process to avoid
|
|
32
|
+
* redundant network requests.
|
|
33
|
+
*
|
|
34
|
+
* @param publicKeyUrl - URL to fetch the public key from.
|
|
35
|
+
* Defaults to `CODIKA_PUBLIC_KEY_URL` env var, or the platform's hosted key.
|
|
36
|
+
* @returns The public key in PEM format
|
|
37
|
+
* @throws If the key cannot be fetched
|
|
38
|
+
*/
|
|
39
|
+
export async function fetchPublicKey(publicKeyUrl) {
|
|
40
|
+
const url = publicKeyUrl ?? process.env.CODIKA_PUBLIC_KEY_URL ?? DEFAULT_PUBLIC_KEY_URL;
|
|
41
|
+
const cached = publicKeyCache.get(url);
|
|
42
|
+
if (cached) {
|
|
43
|
+
return cached;
|
|
44
|
+
}
|
|
45
|
+
const response = await fetch(url);
|
|
46
|
+
if (!response.ok) {
|
|
47
|
+
throw new Error(`Failed to fetch public key from ${url}: ${response.status} ${response.statusText}`);
|
|
48
|
+
}
|
|
49
|
+
const pem = await response.text();
|
|
50
|
+
if (!pem.includes('-----BEGIN PUBLIC KEY-----')) {
|
|
51
|
+
throw new Error(`Invalid public key format from ${url}: missing PEM header`);
|
|
52
|
+
}
|
|
53
|
+
publicKeyCache.set(url, pem);
|
|
54
|
+
return pem;
|
|
55
|
+
}
|
|
56
|
+
// ========================================
|
|
57
|
+
// INTERNAL HELPERS
|
|
58
|
+
// ========================================
|
|
59
|
+
/**
|
|
60
|
+
* Convert a PEM-encoded public key to an ArrayBuffer (DER format).
|
|
61
|
+
*/
|
|
62
|
+
function pemToArrayBuffer(pem) {
|
|
63
|
+
const base64 = pem
|
|
64
|
+
.replace('-----BEGIN PUBLIC KEY-----', '')
|
|
65
|
+
.replace('-----END PUBLIC KEY-----', '')
|
|
66
|
+
.replace(/\s/g, '');
|
|
67
|
+
const buffer = Buffer.from(base64, 'base64');
|
|
68
|
+
return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Convert an ArrayBuffer to a base64 string.
|
|
72
|
+
*/
|
|
73
|
+
function arrayBufferToBase64(buffer) {
|
|
74
|
+
return Buffer.from(buffer).toString('base64');
|
|
75
|
+
}
|
|
76
|
+
// ========================================
|
|
77
|
+
// ENCRYPTION
|
|
78
|
+
// ========================================
|
|
79
|
+
/**
|
|
80
|
+
* Encrypt a plaintext secret using RSA-OAEP + AES-GCM hybrid encryption.
|
|
81
|
+
*
|
|
82
|
+
* The encryption process:
|
|
83
|
+
* 1. Fetches the RSA public key from the Codika platform (cached per process)
|
|
84
|
+
* 2. Generates a random 256-bit AES key
|
|
85
|
+
* 3. Generates a random 96-bit IV
|
|
86
|
+
* 4. Encrypts the plaintext with AES-256-GCM (output includes 16-byte auth tag)
|
|
87
|
+
* 5. Encrypts the AES key with RSA-OAEP (SHA-256)
|
|
88
|
+
* 6. Returns an {@link EncryptedField} ready for Firestore storage
|
|
89
|
+
*
|
|
90
|
+
* The output is compatible with the backend's `deserializeAndDecrypt()` function
|
|
91
|
+
* which uses Node.js `crypto.privateDecrypt()` for the RSA step and
|
|
92
|
+
* `crypto.createDecipheriv('aes-256-gcm')` for the AES step, splitting the
|
|
93
|
+
* last 16 bytes of `encryptedData` as the GCM auth tag.
|
|
94
|
+
*
|
|
95
|
+
* @param plaintext - The secret value to encrypt
|
|
96
|
+
* @param description - Optional description of the secret (stored unencrypted)
|
|
97
|
+
* @param publicKeyUrl - Optional URL override for the public key.
|
|
98
|
+
* Defaults to `CODIKA_PUBLIC_KEY_URL` env var, or the platform's hosted key.
|
|
99
|
+
* @returns An {@link EncryptedField} with the serialized encrypted data
|
|
100
|
+
* @throws If encryption fails (e.g., public key unavailable, crypto error)
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* const field = await encryptSecret('sk-my-api-key', 'OpenAI API Key');
|
|
105
|
+
* // field.value is JSON with { encryptedKey, encryptedData, iv }
|
|
106
|
+
* // field.encrypted is true
|
|
107
|
+
* // Store field in Firestore
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
export async function encryptSecret(plaintext, description, publicKeyUrl) {
|
|
111
|
+
try {
|
|
112
|
+
// 1. Fetch and import the RSA public key
|
|
113
|
+
const pem = await fetchPublicKey(publicKeyUrl);
|
|
114
|
+
const publicKey = await subtle.importKey('spki', pemToArrayBuffer(pem), {
|
|
115
|
+
name: 'RSA-OAEP',
|
|
116
|
+
hash: { name: 'SHA-256' }
|
|
117
|
+
}, false, ['encrypt']);
|
|
118
|
+
// 2. Generate a random 256-bit AES key
|
|
119
|
+
const aesKey = await subtle.generateKey({
|
|
120
|
+
name: 'AES-GCM',
|
|
121
|
+
length: 256
|
|
122
|
+
}, true, // extractable — we need to export it for RSA encryption
|
|
123
|
+
['encrypt']);
|
|
124
|
+
const aesKeyRaw = await subtle.exportKey('raw', aesKey);
|
|
125
|
+
// 3. Generate a random 96-bit IV (recommended for AES-GCM)
|
|
126
|
+
const iv = new Uint8Array(12);
|
|
127
|
+
webcrypto.getRandomValues(iv);
|
|
128
|
+
// 4. Encrypt the plaintext with AES-GCM
|
|
129
|
+
// WebCrypto AES-GCM automatically appends the 16-byte auth tag to the ciphertext.
|
|
130
|
+
// This is critical: the backend expects this format and splits the last 16 bytes.
|
|
131
|
+
const encoder = new TextEncoder();
|
|
132
|
+
const plaintextBytes = encoder.encode(plaintext);
|
|
133
|
+
const encryptedDataBuffer = await subtle.encrypt({
|
|
134
|
+
name: 'AES-GCM',
|
|
135
|
+
iv: iv
|
|
136
|
+
}, aesKey, plaintextBytes);
|
|
137
|
+
// 5. Encrypt the AES key with RSA-OAEP
|
|
138
|
+
const encryptedKeyBuffer = await subtle.encrypt({
|
|
139
|
+
name: 'RSA-OAEP'
|
|
140
|
+
}, publicKey, aesKeyRaw);
|
|
141
|
+
// 6. Build the encrypted data structure (all base64)
|
|
142
|
+
const encryptedData = {
|
|
143
|
+
encryptedKey: arrayBufferToBase64(encryptedKeyBuffer),
|
|
144
|
+
encryptedData: arrayBufferToBase64(encryptedDataBuffer),
|
|
145
|
+
iv: arrayBufferToBase64(iv.buffer)
|
|
146
|
+
};
|
|
147
|
+
// 7. Build the encrypted field
|
|
148
|
+
const field = {
|
|
149
|
+
value: JSON.stringify(encryptedData),
|
|
150
|
+
encrypted: true
|
|
151
|
+
};
|
|
152
|
+
if (description) {
|
|
153
|
+
field.description = description;
|
|
154
|
+
}
|
|
155
|
+
return field;
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
159
|
+
throw new Error(`Failed to encrypt secret: ${message}`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=encryption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption.js","sourceRoot":"","sources":["../../src/utils/encryption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;AAEhC,2CAA2C;AAC3C,YAAY;AACZ,2CAA2C;AAE3C,MAAM,sBAAsB,GAAG,kDAAkD,CAAC;AAgClF,2CAA2C;AAC3C,mBAAmB;AACnB,2CAA2C;AAE3C,4DAA4D;AAC5D,MAAM,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,YAAqB;IACzD,MAAM,GAAG,GAAG,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,sBAAsB,CAAC;IAExF,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,MAAM,EAAE,CAAC;QACZ,OAAO,MAAM,CAAC;IACf,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,mCAAmC,GAAG,KAAK,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IACtG,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAElC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,4BAA4B,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CAAC,kCAAkC,GAAG,sBAAsB,CAAC,C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KAAK,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QACzE,MAAM,IAAI,KAAK,CAAC,6BAA6B,OAAO,EAAE,CAAC,CAAC;IACzD,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution Client
|
|
3
|
+
* HTTP client for fetching execution details from the Codika platform via API key
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Options for fetching execution details
|
|
7
|
+
*/
|
|
8
|
+
export interface GetExecutionDetailsOptions {
|
|
9
|
+
/** Process instance ID */
|
|
10
|
+
processInstanceId: string;
|
|
11
|
+
/** Codika execution ID */
|
|
12
|
+
executionId: string;
|
|
13
|
+
/** Recursively fetch sub-workflow executions */
|
|
14
|
+
deep?: boolean;
|
|
15
|
+
/** Strip noise for readability */
|
|
16
|
+
slim?: boolean;
|
|
17
|
+
/** API URL for the getExecutionDetailsPublic endpoint */
|
|
18
|
+
apiUrl: string;
|
|
19
|
+
/** API key (organization API key or admin key) */
|
|
20
|
+
apiKey: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Success response from execution details fetch
|
|
24
|
+
*/
|
|
25
|
+
export interface GetExecutionDetailsSuccessResponse {
|
|
26
|
+
success: true;
|
|
27
|
+
execution: {
|
|
28
|
+
codikaExecutionId: string;
|
|
29
|
+
n8nExecutionId: string;
|
|
30
|
+
status: string;
|
|
31
|
+
n8nExecution: any;
|
|
32
|
+
};
|
|
33
|
+
requestId: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Error response from execution details fetch
|
|
37
|
+
*/
|
|
38
|
+
export interface GetExecutionDetailsErrorResponse {
|
|
39
|
+
success: false;
|
|
40
|
+
error: string;
|
|
41
|
+
code: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Combined response type
|
|
45
|
+
*/
|
|
46
|
+
export type GetExecutionDetailsResponse = GetExecutionDetailsSuccessResponse | GetExecutionDetailsErrorResponse;
|
|
47
|
+
/**
|
|
48
|
+
* Type guard for success response
|
|
49
|
+
*/
|
|
50
|
+
export declare function isGetExecutionDetailsSuccess(response: GetExecutionDetailsResponse): response is GetExecutionDetailsSuccessResponse;
|
|
51
|
+
/**
|
|
52
|
+
* Type guard for error response
|
|
53
|
+
*/
|
|
54
|
+
export declare function isGetExecutionDetailsError(response: GetExecutionDetailsResponse): response is GetExecutionDetailsErrorResponse;
|
|
55
|
+
/**
|
|
56
|
+
* Fetch execution details from the Codika platform
|
|
57
|
+
*
|
|
58
|
+
* @param options - Execution details fetch options
|
|
59
|
+
* @returns Execution details result
|
|
60
|
+
*/
|
|
61
|
+
export declare function getExecutionDetails(options: GetExecutionDetailsOptions): Promise<GetExecutionDetailsResponse>;
|
|
62
|
+
/**
|
|
63
|
+
* Fetch execution details and throw on error
|
|
64
|
+
* Convenience function for when you want exceptions on failure
|
|
65
|
+
*
|
|
66
|
+
* @param options - Execution details fetch options
|
|
67
|
+
* @returns Success response with execution details
|
|
68
|
+
* @throws Error if fetch fails
|
|
69
|
+
*/
|
|
70
|
+
export declare function getExecutionDetailsOrThrow(options: GetExecutionDetailsOptions): Promise<GetExecutionDetailsSuccessResponse>;
|
|
71
|
+
//# sourceMappingURL=execution-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-client.d.ts","sourceRoot":"","sources":["../../src/utils/execution-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,0BAA0B;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,kCAAkC;IAClC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,kCAAkC;IACjD,OAAO,EAAE,IAAI,CAAC;IACd,SAAS,EAAE;QACT,iBAAiB,EAAE,MAAM,CAAC;QAC1B,cAAc,EAAE,MAAM,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,EAAE,GAAG,CAAC;KACnB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,2BAA2B,GACnC,kCAAkC,GAClC,gCAAgC,CAAC;AAErC;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,2BAA2B,GACpC,QAAQ,IAAI,kCAAkC,CAEhD;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,2BAA2B,GACpC,QAAQ,IAAI,gCAAgC,CAE9C;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,2BAA2B,CAAC,CA0BtC;AAED;;;;;;;GAOG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,kCAAkC,CAAC,CAU7C"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution Client
|
|
3
|
+
* HTTP client for fetching execution details from the Codika platform via API key
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Type guard for success response
|
|
7
|
+
*/
|
|
8
|
+
export function isGetExecutionDetailsSuccess(response) {
|
|
9
|
+
return response.success === true;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Type guard for error response
|
|
13
|
+
*/
|
|
14
|
+
export function isGetExecutionDetailsError(response) {
|
|
15
|
+
return response.success === false;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Fetch execution details from the Codika platform
|
|
19
|
+
*
|
|
20
|
+
* @param options - Execution details fetch options
|
|
21
|
+
* @returns Execution details result
|
|
22
|
+
*/
|
|
23
|
+
export async function getExecutionDetails(options) {
|
|
24
|
+
const { processInstanceId, executionId, deep, slim, apiKey, apiUrl, } = options;
|
|
25
|
+
const params = new URLSearchParams();
|
|
26
|
+
if (deep)
|
|
27
|
+
params.set('deep', 'true');
|
|
28
|
+
if (slim)
|
|
29
|
+
params.set('slim', 'true');
|
|
30
|
+
const queryString = params.toString();
|
|
31
|
+
const url = `${apiUrl}/${processInstanceId}/${executionId}${queryString ? '?' + queryString : ''}`;
|
|
32
|
+
const response = await fetch(url, {
|
|
33
|
+
method: 'GET',
|
|
34
|
+
headers: {
|
|
35
|
+
'X-Process-Manager-Key': apiKey,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
const result = (await response.json());
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Fetch execution details and throw on error
|
|
43
|
+
* Convenience function for when you want exceptions on failure
|
|
44
|
+
*
|
|
45
|
+
* @param options - Execution details fetch options
|
|
46
|
+
* @returns Success response with execution details
|
|
47
|
+
* @throws Error if fetch fails
|
|
48
|
+
*/
|
|
49
|
+
export async function getExecutionDetailsOrThrow(options) {
|
|
50
|
+
const result = await getExecutionDetails(options);
|
|
51
|
+
if (isGetExecutionDetailsError(result)) {
|
|
52
|
+
throw new Error(`Execution details fetch failed: ${result.error}`);
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=execution-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-client.js","sourceRoot":"","s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,OAAO,CAAC,CAAC;IAElD,IAAI,0BAA0B,CAAC,MAAM,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CACb,mCAAmC,MAAM,CAAC,KAAK,EAAE,CAClD,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration Client
|
|
3
|
+
*
|
|
4
|
+
* HTTP client for managing integrations via public API endpoints.
|
|
5
|
+
* Follows the same pattern as redeploy-client.ts.
|
|
6
|
+
*/
|
|
7
|
+
interface EncryptedField {
|
|
8
|
+
value: string;
|
|
9
|
+
encrypted: boolean;
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface CreateIntegrationRequest {
|
|
13
|
+
organizationId?: string;
|
|
14
|
+
integrationId: string;
|
|
15
|
+
contextType: 'organization' | 'member' | 'process_instance';
|
|
16
|
+
memberId?: string;
|
|
17
|
+
processInstanceId?: string;
|
|
18
|
+
secrets: Record<string, EncryptedField>;
|
|
19
|
+
metadata: Record<string, any>;
|
|
20
|
+
customIntegrationSchema?: Record<string, any>;
|
|
21
|
+
}
|
|
22
|
+
export interface CreateIntegrationSuccessResponse {
|
|
23
|
+
success: true;
|
|
24
|
+
data: {
|
|
25
|
+
message: string;
|
|
26
|
+
n8nCredentialId?: string;
|
|
27
|
+
};
|
|
28
|
+
requestId: string;
|
|
29
|
+
}
|
|
30
|
+
export interface CreateIntegrationErrorResponse {
|
|
31
|
+
success: false;
|
|
32
|
+
error: {
|
|
33
|
+
code: string;
|
|
34
|
+
message: string;
|
|
35
|
+
};
|
|
36
|
+
requestId: string;
|
|
37
|
+
}
|
|
38
|
+
export type CreateIntegrationResponse = CreateIntegrationSuccessResponse | CreateIntegrationErrorResponse;
|
|
39
|
+
export declare function isCreateIntegrationSuccess(response: CreateIntegrationResponse): response is CreateIntegrationSuccessResponse;
|
|
40
|
+
export interface CreateIntegrationOptions {
|
|
41
|
+
apiUrl: string;
|
|
42
|
+
apiKey: string;
|
|
43
|
+
body: CreateIntegrationRequest;
|
|
44
|
+
}
|
|
45
|
+
export declare function createIntegrationRemote(options: CreateIntegrationOptions): Promise<CreateIntegrationResponse>;
|
|
46
|
+
export interface DeleteIntegrationRequest {
|
|
47
|
+
organizationId?: string;
|
|
48
|
+
integrationId: string;
|
|
49
|
+
contextType: 'organization' | 'member' | 'process_instance';
|
|
50
|
+
memberId?: string;
|
|
51
|
+
processInstanceId?: string;
|
|
52
|
+
confirmDeletion?: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface PendingDeactivation {
|
|
55
|
+
processInstanceId: string;
|
|
56
|
+
title: string;
|
|
57
|
+
}
|
|
58
|
+
export interface DeleteIntegrationSuccessResponse {
|
|
59
|
+
success: true;
|
|
60
|
+
data: {
|
|
61
|
+
message: string;
|
|
62
|
+
deactivatedCount?: number;
|
|
63
|
+
};
|
|
64
|
+
requestId: string;
|
|
65
|
+
}
|
|
66
|
+
export interface DeleteIntegrationPendingResponse {
|
|
67
|
+
success: false;
|
|
68
|
+
data: {
|
|
69
|
+
message: string;
|
|
70
|
+
pendingDeactivations: {
|
|
71
|
+
count: number;
|
|
72
|
+
processes: PendingDeactivation[];
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
requestId: string;
|
|
76
|
+
}
|
|
77
|
+
export interface DeleteIntegrationErrorResponse {
|
|
78
|
+
success: false;
|
|
79
|
+
error: {
|
|
80
|
+
code: string;
|
|
81
|
+
message: string;
|
|
82
|
+
};
|
|
83
|
+
requestId: string;
|
|
84
|
+
}
|
|
85
|
+
export type DeleteIntegrationResponse = DeleteIntegrationSuccessResponse | DeleteIntegrationPendingResponse | DeleteIntegrationErrorResponse;
|
|
86
|
+
export declare function isDeleteIntegrationSuccess(response: DeleteIntegrationResponse): response is DeleteIntegrationSuccessResponse;
|
|
87
|
+
export declare function isDeleteIntegrationPending(response: DeleteIntegrationResponse): response is DeleteIntegrationPendingResponse;
|
|
88
|
+
export interface DeleteIntegrationOptions {
|
|
89
|
+
apiUrl: string;
|
|
90
|
+
apiKey: string;
|
|
91
|
+
body: DeleteIntegrationRequest;
|
|
92
|
+
}
|
|
93
|
+
export declare function deleteIntegrationRemote(options: DeleteIntegrationOptions): Promise<DeleteIntegrationResponse>;
|
|
94
|
+
export interface ListIntegrationsRequest {
|
|
95
|
+
organizationId?: string;
|
|
96
|
+
contextType: 'organization' | 'member' | 'process_instance';
|
|
97
|
+
memberId?: string;
|
|
98
|
+
processInstanceId?: string;
|
|
99
|
+
}
|
|
100
|
+
export interface IntegrationSummaryEntry {
|
|
101
|
+
integrationId: string;
|
|
102
|
+
connected: boolean;
|
|
103
|
+
connectedAt?: string;
|
|
104
|
+
connectedBy?: string;
|
|
105
|
+
hasValidTokens?: boolean;
|
|
106
|
+
n8nCredentialId?: string;
|
|
107
|
+
customSchema?: Record<string, any>;
|
|
108
|
+
}
|
|
109
|
+
export interface ListIntegrationsSuccessResponse {
|
|
110
|
+
success: true;
|
|
111
|
+
data: {
|
|
112
|
+
connectedIntegrations: string[];
|
|
113
|
+
integrations: IntegrationSummaryEntry[];
|
|
114
|
+
};
|
|
115
|
+
requestId: string;
|
|
116
|
+
}
|
|
117
|
+
export interface ListIntegrationsErrorResponse {
|
|
118
|
+
success: false;
|
|
119
|
+
error: {
|
|
120
|
+
code: string;
|
|
121
|
+
message: string;
|
|
122
|
+
};
|
|
123
|
+
requestId: string;
|
|
124
|
+
}
|
|
125
|
+
export type ListIntegrationsResponse = ListIntegrationsSuccessResponse | ListIntegrationsErrorResponse;
|
|
126
|
+
export declare function isListIntegrationsSuccess(response: ListIntegrationsResponse): response is ListIntegrationsSuccessResponse;
|
|
127
|
+
export interface ListIntegrationsOptions {
|
|
128
|
+
apiUrl: string;
|
|
129
|
+
apiKey: string;
|
|
130
|
+
body: ListIntegrationsRequest;
|
|
131
|
+
}
|
|
132
|
+
export declare function listIntegrationsRemote(options: ListIntegrationsOptions): Promise<ListIntegrationsResponse>;
|
|
133
|
+
export {};
|
|
134
|
+
//# sourceMappingURL=integration-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-client.d.ts","sourceRoot":"","sources":["../../src/utils/integration-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,MAAM,WAAW,wBAAwB;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,cAAc,GAAG,QAAQ,GAAG,kBAAkB,CAAC;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACxC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,uBAAuB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAChB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,yBAAyB,GACjC,gCAAgC,GAChC,8BAA8B,CAAC;AAEnC,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,yBAAyB,GAClC,QAAQ,IAAI,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