@noodleseed/one 0.161.2 → 0.163.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/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/billing-catalog-ops.d.ts +4 -0
- package/dist/commands/billing-catalog-ops.d.ts.map +1 -0
- package/dist/commands/billing-catalog-ops.js +58 -0
- package/dist/commands/billing-catalog-ops.js.map +1 -0
- package/dist/commands/billing-ops.d.ts.map +1 -1
- package/dist/commands/billing-ops.js +3 -0
- package/dist/commands/billing-ops.js.map +1 -1
- package/dist/commands/catalog.d.ts.map +1 -1
- package/dist/commands/catalog.js +3 -0
- package/dist/commands/catalog.js.map +1 -1
- package/dist/commands/config-values.d.ts.map +1 -1
- package/dist/commands/config-values.js +16 -0
- package/dist/commands/config-values.js.map +1 -1
- package/dist/commands/installation-variables.d.ts +26 -0
- package/dist/commands/installation-variables.d.ts.map +1 -0
- package/dist/commands/installation-variables.js +171 -0
- package/dist/commands/installation-variables.js.map +1 -0
- package/dist/commands/solutions-activity.d.ts +5 -0
- package/dist/commands/solutions-activity.d.ts.map +1 -0
- package/dist/commands/solutions-activity.js +116 -0
- package/dist/commands/solutions-activity.js.map +1 -0
- package/dist/commands/solutions-connections.d.ts +7 -0
- package/dist/commands/solutions-connections.d.ts.map +1 -0
- package/dist/commands/solutions-connections.js +88 -0
- package/dist/commands/solutions-connections.js.map +1 -0
- package/dist/commands/solutions-installation-options.d.ts +5 -0
- package/dist/commands/solutions-installation-options.d.ts.map +1 -0
- package/dist/commands/solutions-installation-options.js +52 -0
- package/dist/commands/solutions-installation-options.js.map +1 -0
- package/dist/commands/solutions-onboarding.d.ts +5 -0
- package/dist/commands/solutions-onboarding.d.ts.map +1 -0
- package/dist/commands/solutions-onboarding.js +113 -0
- package/dist/commands/solutions-onboarding.js.map +1 -0
- package/dist/commands/solutions-ops.d.ts +7 -0
- package/dist/commands/solutions-ops.d.ts.map +1 -0
- package/dist/commands/solutions-ops.js +544 -0
- package/dist/commands/solutions-ops.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/admission-limits/dist/counter-store.d.ts +21 -2
- package/node_modules/@noodle-borg/admission-limits/dist/counter-store.js +10 -1
- package/node_modules/@noodle-borg/admission-limits/dist/in-memory-counter-store.d.ts +5 -1
- package/node_modules/@noodle-borg/admission-limits/dist/in-memory-counter-store.js +31 -2
- package/node_modules/@noodle-borg/admission-limits/dist/portable.d.ts +3 -0
- package/node_modules/@noodle-borg/admission-limits/dist/portable.js +3 -0
- package/node_modules/@noodle-borg/admission-limits/dist/public-admission-assertion.d.ts +28 -0
- package/node_modules/@noodle-borg/admission-limits/dist/public-admission-assertion.js +124 -0
- package/node_modules/@noodle-borg/admission-limits/dist/public-record-admission.d.ts +54 -0
- package/node_modules/@noodle-borg/admission-limits/dist/public-record-admission.js +74 -0
- package/node_modules/@noodle-borg/admission-limits/dist/request-attribution.d.ts +11 -0
- package/node_modules/@noodle-borg/admission-limits/dist/request-attribution.js +19 -0
- package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js +4 -0
- package/node_modules/@noodle-borg/agent-kit/dist/curated/error-fixes.js +4 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +5 -5
- package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js +6 -0
- package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js +21 -2
- package/node_modules/@noodle-borg/agent-kit/dist/skill-content.js +1 -1
- package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
- package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-configuration.d.ts +9 -1
- package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-configuration.js +33 -2
- package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-execution-bound.d.ts +3 -0
- package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-execution-bound.js +29 -0
- package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-interaction-state.d.ts +5 -3
- package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-interaction-state.js +21 -10
- package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-store.d.ts +1 -1
- package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-store.js +3 -3
- package/node_modules/@noodle-borg/assistant-gateway/dist/portable.d.ts +1 -0
- package/node_modules/@noodle-borg/assistant-gateway/dist/portable.js +1 -0
- package/node_modules/@noodle-borg/assistant-gateway/dist/session-target.js +5 -4
- package/node_modules/@noodle-borg/authoring/dist/config.d.ts +20 -0
- package/node_modules/@noodle-borg/authoring/dist/config.js +29 -2
- package/node_modules/@noodle-borg/authoring/dist/connectors.d.ts +6 -1
- package/node_modules/@noodle-borg/authoring/dist/connectors.js +5 -0
- package/node_modules/@noodle-borg/authoring/dist/index.d.ts +2 -1
- package/node_modules/@noodle-borg/authoring/dist/index.js +1 -0
- package/node_modules/@noodle-borg/authoring/dist/json-schema.d.ts +1 -1
- package/node_modules/@noodle-borg/authoring/dist/json-schema.js +15 -2
- package/node_modules/@noodle-borg/authoring/dist/load-authored.js +1 -1
- package/node_modules/@noodle-borg/authoring/dist/managed-collection.d.ts +40 -0
- package/node_modules/@noodle-borg/authoring/dist/managed-collection.js +39 -0
- package/node_modules/@noodle-borg/authoring/dist/platform.d.ts +3 -0
- package/node_modules/@noodle-borg/authoring/dist/platform.js +4 -0
- package/node_modules/@noodle-borg/authoring/dist/server-presentation.js +43 -0
- package/node_modules/@noodle-borg/authoring/dist/server.d.ts +6 -1
- package/node_modules/@noodle-borg/authoring/dist/server.js +5 -43
- package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-billing.js +18 -0
- package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-config.js +31 -4
- package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-solutions.js +778 -0
- package/node_modules/@noodle-borg/cli-catalog/dist/catalog-types.js +7 -0
- package/node_modules/@noodle-borg/cli-catalog/dist/index.js +20 -0
- package/node_modules/@noodle-borg/compiler/dist/artifact/assemble.js +5 -1
- package/node_modules/@noodle-borg/compiler/dist/artifact/catalog-emission.js +3 -1
- package/node_modules/@noodle-borg/compiler/dist/artifact/config.js +3 -0
- package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts +26 -0
- package/node_modules/@noodle-borg/compiler/dist/artifact/version.d.ts +9 -1
- package/node_modules/@noodle-borg/compiler/dist/artifact/version.js +9 -1
- package/node_modules/@noodle-borg/compiler/dist/business-variables.d.ts +27 -0
- package/node_modules/@noodle-borg/compiler/dist/business-variables.js +230 -0
- package/node_modules/@noodle-borg/compiler/dist/compile.js +9 -0
- package/node_modules/@noodle-borg/compiler/dist/errors.d.ts +1 -1
- package/node_modules/@noodle-borg/compiler/dist/index.d.ts +5 -1
- package/node_modules/@noodle-borg/compiler/dist/index.js +4 -0
- package/node_modules/@noodle-borg/compiler/dist/managed-collection-controls.d.ts +52 -0
- package/node_modules/@noodle-borg/compiler/dist/managed-collection-controls.js +92 -0
- package/node_modules/@noodle-borg/compiler/dist/managed-collections.d.ts +50 -0
- package/node_modules/@noodle-borg/compiler/dist/managed-collections.js +373 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts +114 -36
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js +5 -0
- package/node_modules/@noodle-borg/compiler/dist/native-record-operations.d.ts +7 -0
- package/node_modules/@noodle-borg/compiler/dist/native-record-operations.js +59 -0
- package/node_modules/@noodle-borg/connector-defs/dist/compile-http.js +83 -8
- package/node_modules/@noodle-borg/connector-defs/dist/schema.d.ts +31 -1
- package/node_modules/@noodle-borg/connector-defs/dist/schema.js +16 -0
- package/node_modules/@noodle-borg/connector-http/dist/http-connector.d.ts +12 -3
- package/node_modules/@noodle-borg/connector-http/dist/http-connector.js +41 -2
- package/node_modules/@noodle-borg/connector-http/dist/http-response.js +3 -2
- package/node_modules/@noodle-borg/connector-http/dist/mcp/config.js +1 -1
- package/node_modules/@noodle-borg/connector-http/dist/url-resolution.js +1 -1
- package/node_modules/@noodle-borg/control-plane/dist/contracts.d.ts +2 -1
- package/node_modules/@noodle-borg/control-plane/dist/in-memory-organization-store.d.ts +3 -0
- package/node_modules/@noodle-borg/control-plane/dist/in-memory-organization-store.js +11 -0
- package/node_modules/@noodle-borg/control-plane/dist/organization-agreements.d.ts +45 -0
- package/node_modules/@noodle-borg/control-plane/dist/organization-agreements.js +74 -0
- package/node_modules/@noodle-borg/control-plane/dist/portable.d.ts +1 -0
- package/node_modules/@noodle-borg/control-plane/dist/portable.js +1 -0
- package/node_modules/@noodle-borg/module/dist/contract.d.ts +20 -0
- package/node_modules/@noodle-borg/module/dist/platform-human-identity.d.ts +2 -0
- package/node_modules/@noodle-borg/protocol/dist/request-deps.js +1 -0
- package/node_modules/@noodle-borg/protocol/dist/request-state.d.ts +1 -0
- package/node_modules/@noodle-borg/protocol/dist/request-state.js +11 -2
- package/node_modules/@noodle-borg/protocol/dist/sdk-server.d.ts +2 -0
- package/node_modules/@noodle-borg/protocol/dist/v2/input-required.js +2 -1
- package/node_modules/@noodle-borg/protocol/dist/v2/server.js +2 -1
- package/node_modules/@noodle-borg/runtime/dist/ambient-context.js +6 -1
- package/node_modules/@noodle-borg/runtime/dist/broker/types.d.ts +2 -0
- package/node_modules/@noodle-borg/runtime/dist/business-variables.d.ts +15 -0
- package/node_modules/@noodle-borg/runtime/dist/business-variables.js +75 -0
- package/node_modules/@noodle-borg/runtime/dist/confirmation-continuation.js +2 -1
- package/node_modules/@noodle-borg/runtime/dist/confirmation.js +23 -3
- package/node_modules/@noodle-borg/runtime/dist/connector/types.d.ts +17 -1
- package/node_modules/@noodle-borg/runtime/dist/connector-snapshot.js +6 -0
- package/node_modules/@noodle-borg/runtime/dist/execute.d.ts +18 -3
- package/node_modules/@noodle-borg/runtime/dist/execute.js +13 -3
- package/node_modules/@noodle-borg/runtime/dist/index.d.ts +2 -0
- package/node_modules/@noodle-borg/runtime/dist/index.js +1 -0
- package/node_modules/@noodle-borg/runtime/dist/interactive.js +11 -0
- package/node_modules/@noodle-borg/runtime/dist/managed-origins.d.ts +3 -1
- package/node_modules/@noodle-borg/runtime/dist/managed-origins.js +32 -7
- package/node_modules/@noodle-borg/runtime/dist/operation-credential.js +6 -0
- package/node_modules/@noodle-borg/runtime/dist/operation-evidence.d.ts +30 -0
- package/node_modules/@noodle-borg/runtime/dist/operation-evidence.js +68 -0
- package/node_modules/@noodle-borg/runtime/dist/operation-execution.d.ts +2 -2
- package/node_modules/@noodle-borg/runtime/dist/operation-execution.js +142 -71
- package/node_modules/@noodle-borg/runtime/dist/result.d.ts +6 -4
- package/node_modules/@noodle-borg/runtime/dist/tool-dispatch.d.ts +7 -0
- package/node_modules/@noodle-borg/runtime/dist/tool-dispatch.js +48 -4
- package/node_modules/@noodle-borg/service/dist/admission.js +2 -1
- package/node_modules/@noodle-borg/service/dist/application-activity.js +236 -0
- package/node_modules/@noodle-borg/service/dist/application-business-notice.js +28 -0
- package/node_modules/@noodle-borg/service/dist/application-runtime-target.js +141 -0
- package/node_modules/@noodle-borg/service/dist/application-settings-targets.js +72 -0
- package/node_modules/@noodle-borg/service/dist/application-settings.js +210 -0
- package/node_modules/@noodle-borg/service/dist/business-api-admission.js +121 -0
- package/node_modules/@noodle-borg/service/dist/business-information/activity-pagination.js +73 -0
- package/node_modules/@noodle-borg/service/dist/business-information/business-notice.d.ts +24 -0
- package/node_modules/@noodle-borg/service/dist/business-information/business-notice.js +18 -0
- package/node_modules/@noodle-borg/service/dist/business-information/collection-controls.js +51 -0
- package/node_modules/@noodle-borg/service/dist/business-information/contracts.d.ts +439 -0
- package/node_modules/@noodle-borg/service/dist/business-information/contracts.js +5 -0
- package/node_modules/@noodle-borg/service/dist/business-information/definition-resolver.js +94 -0
- package/node_modules/@noodle-borg/service/dist/business-information/in-memory-installation-lifecycle.js +136 -0
- package/node_modules/@noodle-borg/service/dist/business-information/in-memory-invitations.js +160 -0
- package/node_modules/@noodle-borg/service/dist/business-information/in-memory-locks.js +23 -0
- package/node_modules/@noodle-borg/service/dist/business-information/in-memory-store.js +557 -0
- package/node_modules/@noodle-borg/service/dist/business-information/installation-capacity.js +10 -0
- package/node_modules/@noodle-borg/service/dist/business-information/invitations.js +68 -0
- package/node_modules/@noodle-borg/service/dist/business-information/legacy-request-migration.js +60 -0
- package/node_modules/@noodle-borg/service/dist/business-information/managed-releases.js +245 -0
- package/node_modules/@noodle-borg/service/dist/business-information/managed-solution-blueprints.js +51 -0
- package/node_modules/@noodle-borg/service/dist/business-information/managed-solution-executable.js +76 -0
- package/node_modules/@noodle-borg/service/dist/business-information/model.js +393 -0
- package/node_modules/@noodle-borg/service/dist/business-information/native-query.js +162 -0
- package/node_modules/@noodle-borg/service/dist/business-information/native-storage-budget.js +60 -0
- package/node_modules/@noodle-borg/service/dist/business-information/pagination.js +78 -0
- package/node_modules/@noodle-borg/service/dist/business-information/portable.js +15 -0
- package/node_modules/@noodle-borg/service/dist/business-information/principal-authority.d.ts +11 -0
- package/node_modules/@noodle-borg/service/dist/business-information/principal-authority.js +42 -0
- package/node_modules/@noodle-borg/service/dist/business-information/profiles.js +252 -0
- package/node_modules/@noodle-borg/service/dist/business-information/reader-floor.js +26 -0
- package/node_modules/@noodle-borg/service/dist/business-information/source-credential-fence.js +79 -0
- package/node_modules/@noodle-borg/service/dist/business-information/source-custody-budget.js +30 -0
- package/node_modules/@noodle-borg/service/dist/business-information/source-custody-memory.js +122 -0
- package/node_modules/@noodle-borg/service/dist/business-information/source-executor.js +191 -0
- package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-contracts.js +2 -0
- package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-coordinator.js +136 -0
- package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-failures.js +32 -0
- package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-memory-state.js +154 -0
- package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-memory-store.js +568 -0
- package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-memory-types.js +26 -0
- package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-memory-values.js +59 -0
- package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-pagination.js +54 -0
- package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-validation.js +163 -0
- package/node_modules/@noodle-borg/service/dist/business-information/source-refresh-retention.js +29 -0
- package/node_modules/@noodle-borg/service/dist/business-information/validation.js +200 -0
- package/node_modules/@noodle-borg/service/dist/business-information-runtime.js +80 -0
- package/node_modules/@noodle-borg/service/dist/business-onboarding.js +73 -0
- package/node_modules/@noodle-borg/service/dist/connections/types.js +8 -0
- package/node_modules/@noodle-borg/service/dist/credential-binding-index.js +38 -33
- package/node_modules/@noodle-borg/service/dist/deployment-execution.js +275 -0
- package/node_modules/@noodle-borg/service/dist/external-credential-binding-broker.js +19 -1
- package/node_modules/@noodle-borg/service/dist/external-credential-exchange.d.ts +16 -1
- package/node_modules/@noodle-borg/service/dist/modules/host.js +4 -1
- package/node_modules/@noodle-borg/service/dist/native-record-connector.d.ts +20 -0
- package/node_modules/@noodle-borg/service/dist/native-record-connector.js +206 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts +5 -2
- package/node_modules/@noodle-borg/service/dist/operation-evidence.js +89 -0
- package/node_modules/@noodle-borg/service/dist/recovery-quarantine.js +49 -0
- package/node_modules/@noodle-borg/service/dist/registry-compile.js +60 -11
- package/node_modules/@noodle-borg/service/dist/registry-deploy-transaction.js +18 -0
- package/node_modules/@noodle-borg/service/dist/registry-rollback.js +2 -1
- package/node_modules/@noodle-borg/service/dist/registry-state.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/registry-state.js +6 -3
- package/node_modules/@noodle-borg/service/dist/registry-targets.js +49 -0
- package/node_modules/@noodle-borg/service/dist/registry-types.d.ts +2 -0
- package/node_modules/@noodle-borg/service/dist/registry.d.ts +15 -3
- package/node_modules/@noodle-borg/service/dist/registry.js +177 -137
- package/node_modules/@noodle-borg/service/dist/routes/assistant-appearance.js +3 -2
- package/node_modules/@noodle-borg/service/dist/routes/assistant-clients.js +2 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-doctor.js +2 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-embeds.js +8 -3
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-replay.js +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.js +48 -36
- package/node_modules/@noodle-borg/service/dist/routes/assistant-public-configuration.js +3 -2
- package/node_modules/@noodle-borg/service/dist/routes/assistant-public-session.js +10 -10
- package/node_modules/@noodle-borg/service/dist/routes/assistant-session-target.js +32 -3
- package/node_modules/@noodle-borg/service/dist/routes/assistant-suggestions.js +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-transcript.js +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant.js +10 -10
- package/node_modules/@noodle-borg/service/dist/routes/business-information-activity.js +83 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-admission.js +26 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-channels.js +153 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-connections.js +107 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-dispatch.js +131 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-external.js +79 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-installation.js +24 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-notice.js +69 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-onboarding.js +58 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-paths.js +168 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-public.js +151 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-reader-floor.js +15 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-record-create.js +29 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-record-reads.js +36 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-request.js +64 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-settings.js +64 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-source.js +249 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-staff.js +258 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information-wire.js +317 -0
- package/node_modules/@noodle-borg/service/dist/routes/business-information.js +592 -0
- package/node_modules/@noodle-borg/service/dist/routes/config-values-dispatch.js +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/config-values.js +26 -4
- package/node_modules/@noodle-borg/service/dist/routes/control-plane.js +19 -233
- package/node_modules/@noodle-borg/service/dist/routes/deployment-activation-response.js +13 -4
- package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js +6 -0
- package/node_modules/@noodle-borg/service/dist/service.js +77 -6
- package/node_modules/@noodle-borg/service/dist/solution-installation-activation.js +149 -0
- package/node_modules/@noodle-borg/service/dist/source-configuration-authority.js +94 -0
- package/node_modules/@noodle-borg/service/dist/state-catalog.js +6 -5
- package/node_modules/@noodle-borg/service/dist/store/config-values.d.ts +42 -17
- package/node_modules/@noodle-borg/service/dist/store/config-values.js +123 -24
- package/node_modules/@noodle-borg/service/dist/store/in-memory.d.ts +1 -0
- package/node_modules/@noodle-borg/service/dist/store/in-memory.js +3 -0
- package/node_modules/@noodle-borg/service/dist/store/json-file.d.ts +1 -0
- package/node_modules/@noodle-borg/service/dist/store/json-file.js +3 -0
- package/node_modules/@noodle-borg/service/dist/store.d.ts +3 -1
- package/node_modules/@noodle-borg/service/package.json +2 -2
- package/node_modules/@noodle-borg/transport-http/dist/serve-request.js +9 -0
- package/node_modules/@noodle-borg/transport-http/package.json +1 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/application-activity.d.ts +143 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/application-activity.js +90 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/application-channels.d.ts +130 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/application-channels.js +77 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/application-connections.d.ts +105 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/application-connections.js +67 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/application-onboarding.d.ts +27 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/application-onboarding.js +28 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/application-settings.d.ts +112 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/application-settings.js +88 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/assistant.d.ts +1 -1
- package/node_modules/@noodle-borg/wire-contracts/dist/billing-catalog.d.ts +62 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/billing-catalog.js +57 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/billing-enforcement.d.ts +12 -12
- package/node_modules/@noodle-borg/wire-contracts/dist/billing-metering.d.ts +4 -4
- package/node_modules/@noodle-borg/wire-contracts/dist/billing-org-transfer.d.ts +3 -3
- package/node_modules/@noodle-borg/wire-contracts/dist/business-information-query.d.ts +25 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/business-information-query.js +37 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/business-information.d.ts +2241 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/business-information.js +580 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/control-plane.d.ts +2 -2
- package/node_modules/@noodle-borg/wire-contracts/dist/distribution.d.ts +5 -5
- package/node_modules/@noodle-borg/wire-contracts/dist/index.d.ts +12 -3
- package/node_modules/@noodle-borg/wire-contracts/dist/index.js +9 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/knowledge.d.ts +6 -6
- package/node_modules/@noodle-borg/wire-contracts/dist/managed-assistant-sponsorship.d.ts +15 -15
- package/node_modules/@noodle-borg/wire-contracts/dist/platform-account-reset.d.ts +5 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/platform-account-reset.js +1 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/platform-auth.d.ts +66 -66
- package/node_modules/@noodle-borg/wire-contracts/dist/solution-onboarding.d.ts +143 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/solution-onboarding.js +94 -0
- package/node_modules/@noodleseed/assistant/README.md +5 -0
- package/package.json +2 -2
package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-pagination.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { scopeKey } from './pagination.js';
|
|
2
|
+
import { sourceDigest, sourceInteger } from './source-ingestion-validation.js';
|
|
3
|
+
import { CursorValidationError, validateScalar } from './validation.js';
|
|
4
|
+
export function externalRecordPageLimit(value) {
|
|
5
|
+
return sourceInteger('external record page limit', value ?? 100, 1, 500);
|
|
6
|
+
}
|
|
7
|
+
export function encodeExternalRecordCursor(binding, lastIdentityDigest) {
|
|
8
|
+
const cursor = {
|
|
9
|
+
version: 1,
|
|
10
|
+
kind: 'external-records',
|
|
11
|
+
scope: scopeKey(binding.scope),
|
|
12
|
+
collectionKey: binding.collectionKey,
|
|
13
|
+
bindingId: binding.id,
|
|
14
|
+
bindingGeneration: binding.generation,
|
|
15
|
+
lastIdentityDigest: sourceDigest('source identity digest', lastIdentityDigest),
|
|
16
|
+
};
|
|
17
|
+
return Buffer.from(JSON.stringify(cursor), 'utf8').toString('base64url');
|
|
18
|
+
}
|
|
19
|
+
export function decodeExternalRecordCursor(value, binding) {
|
|
20
|
+
if (value === undefined)
|
|
21
|
+
return undefined;
|
|
22
|
+
try {
|
|
23
|
+
const decoded = JSON.parse(Buffer.from(validateScalar('cursor', value, 2_048), 'base64url').toString('utf8'));
|
|
24
|
+
if (!isExternalRecordCursor(decoded))
|
|
25
|
+
throw new CursorValidationError();
|
|
26
|
+
if (decoded.scope !== scopeKey(binding.scope) ||
|
|
27
|
+
decoded.collectionKey !== binding.collectionKey ||
|
|
28
|
+
decoded.bindingId !== binding.id ||
|
|
29
|
+
decoded.bindingGeneration !== binding.generation) {
|
|
30
|
+
throw new CursorValidationError('cursor does not belong to this source binding');
|
|
31
|
+
}
|
|
32
|
+
return decoded.lastIdentityDigest;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
if (error instanceof CursorValidationError)
|
|
36
|
+
throw error;
|
|
37
|
+
throw new CursorValidationError();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function isExternalRecordCursor(value) {
|
|
41
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
42
|
+
return false;
|
|
43
|
+
const input = value;
|
|
44
|
+
return (input.version === 1 &&
|
|
45
|
+
input.kind === 'external-records' &&
|
|
46
|
+
typeof input.scope === 'string' &&
|
|
47
|
+
typeof input.collectionKey === 'string' &&
|
|
48
|
+
typeof input.bindingId === 'string' &&
|
|
49
|
+
Number.isSafeInteger(input.bindingGeneration) &&
|
|
50
|
+
(input.bindingGeneration ?? 0) > 0 &&
|
|
51
|
+
typeof input.lastIdentityDigest === 'string' &&
|
|
52
|
+
/^[a-f0-9]{64}$/.test(input.lastIdentityDigest));
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=source-ingestion-pagination.js.map
|
package/node_modules/@noodle-borg/service/dist/business-information/source-ingestion-validation.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { createHash, createHmac } from 'node:crypto';
|
|
2
|
+
import { scopeKey } from './pagination.js';
|
|
3
|
+
import { validateScalar, validateScope } from './validation.js';
|
|
4
|
+
export function normalizeSourceBindingCreate(input) {
|
|
5
|
+
return {
|
|
6
|
+
scope: structuredClone(validateScope(input.scope)),
|
|
7
|
+
collectionKey: validateScalar('source collection key', input.collectionKey, 128),
|
|
8
|
+
id: validateScalar('source binding id', input.id, 128),
|
|
9
|
+
...(input.bindingReference === undefined
|
|
10
|
+
? {}
|
|
11
|
+
: {
|
|
12
|
+
bindingReference: validateScalar('source binding reference', input.bindingReference, 128),
|
|
13
|
+
}),
|
|
14
|
+
...(input.configurationReference === undefined
|
|
15
|
+
? {}
|
|
16
|
+
: {
|
|
17
|
+
configurationReference: validateScalar('source configuration reference', input.configurationReference, 128),
|
|
18
|
+
}),
|
|
19
|
+
...(input.credentialIdentity === undefined
|
|
20
|
+
? {}
|
|
21
|
+
: {
|
|
22
|
+
credentialIdentity: {
|
|
23
|
+
...(input.credentialIdentity.generation === undefined
|
|
24
|
+
? {}
|
|
25
|
+
: {
|
|
26
|
+
generation: validateScalar('source credential generation', input.credentialIdentity.generation, 128),
|
|
27
|
+
}),
|
|
28
|
+
...(input.credentialIdentity.account === undefined
|
|
29
|
+
? {}
|
|
30
|
+
: {
|
|
31
|
+
account: validateScalar('source credential account', input.credentialIdentity.account, 128),
|
|
32
|
+
}),
|
|
33
|
+
...(input.credentialIdentity.configuration === undefined
|
|
34
|
+
? {}
|
|
35
|
+
: {
|
|
36
|
+
configuration: validateScalar('source configuration generation', input.credentialIdentity.configuration, 128),
|
|
37
|
+
}),
|
|
38
|
+
},
|
|
39
|
+
}),
|
|
40
|
+
generation: sourceInteger('source binding generation', input.generation, 1, Number.MAX_SAFE_INTEGER),
|
|
41
|
+
schemaVersion: sourceInteger('source schema version', input.schemaVersion, 1, 1_000_000),
|
|
42
|
+
schemaDigest: sourceDigest('source schema digest', input.schemaDigest),
|
|
43
|
+
queryFingerprint: sourceDigest('source query fingerprint', input.queryFingerprint),
|
|
44
|
+
scan: normalizeOperation(input.scan),
|
|
45
|
+
retentionDays: sourceRetentionDays(input.retentionDays),
|
|
46
|
+
pollIntervalMs: sourceInteger('source poll interval', input.pollIntervalMs, 5_000, 86_400_000),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export function sourceBindingCreateFrom(value) {
|
|
50
|
+
return {
|
|
51
|
+
scope: value.scope,
|
|
52
|
+
collectionKey: value.collectionKey,
|
|
53
|
+
id: value.id,
|
|
54
|
+
...(value.bindingReference === undefined ? {} : { bindingReference: value.bindingReference }),
|
|
55
|
+
...(value.configurationReference === undefined
|
|
56
|
+
? {}
|
|
57
|
+
: { configurationReference: value.configurationReference }),
|
|
58
|
+
...(value.credentialIdentity === undefined
|
|
59
|
+
? {}
|
|
60
|
+
: { credentialIdentity: { ...value.credentialIdentity } }),
|
|
61
|
+
generation: value.generation,
|
|
62
|
+
schemaVersion: value.schemaVersion,
|
|
63
|
+
schemaDigest: value.schemaDigest,
|
|
64
|
+
queryFingerprint: value.queryFingerprint,
|
|
65
|
+
scan: value.scan,
|
|
66
|
+
retentionDays: value.retentionDays,
|
|
67
|
+
pollIntervalMs: value.pollIntervalMs,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export function sourceBindingFingerprint(value) {
|
|
71
|
+
return sourceJsonDigest(value);
|
|
72
|
+
}
|
|
73
|
+
export function sourceBindingValues(input) {
|
|
74
|
+
const scope = validateScope(input.scope);
|
|
75
|
+
return [
|
|
76
|
+
scope.org,
|
|
77
|
+
scope.app,
|
|
78
|
+
scope.env,
|
|
79
|
+
scope.installationId,
|
|
80
|
+
validateScalar('source collection key', input.collectionKey, 128),
|
|
81
|
+
validateScalar('source binding id', input.id, 128),
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
export function sourceIdentityDigest(identityKey, binding, sourceId) {
|
|
85
|
+
return createHmac('sha256', identityKey)
|
|
86
|
+
.update(`${scopeKey(binding.scope)}\0${binding.collectionKey}\0${binding.id}\0${binding.bindingReference ?? binding.id}\0${sourceToken('source record id', sourceId)}`)
|
|
87
|
+
.digest('hex');
|
|
88
|
+
}
|
|
89
|
+
export function normalizeSourceSuppression(input) {
|
|
90
|
+
const reason = input.reason;
|
|
91
|
+
if (reason !== 'customer_request' && reason !== 'source_access_revoked') {
|
|
92
|
+
throw new Error('source suppression reason is invalid');
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
scope: structuredClone(validateScope(input.scope)),
|
|
96
|
+
collectionKey: validateScalar('source collection key', input.collectionKey, 128),
|
|
97
|
+
id: validateScalar('source binding id', input.id, 128),
|
|
98
|
+
bindingGeneration: sourceInteger('source binding generation', input.bindingGeneration, 1, Number.MAX_SAFE_INTEGER),
|
|
99
|
+
sourceIdentityDigest: sourceDigest('source identity digest', input.sourceIdentityDigest),
|
|
100
|
+
reason,
|
|
101
|
+
erasedAt: sourceInstant('source suppression time', input.erasedAt),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export function sourceToken(label, value) {
|
|
105
|
+
const normalized = value.trim();
|
|
106
|
+
if (normalized.length === 0 || normalized.length > 4_096 || /[\0\r\n]/.test(normalized)) {
|
|
107
|
+
throw new Error(`${label} is invalid`);
|
|
108
|
+
}
|
|
109
|
+
return normalized;
|
|
110
|
+
}
|
|
111
|
+
export function sourceDigest(label, value) {
|
|
112
|
+
if (!/^[a-f0-9]{64}$/.test(value))
|
|
113
|
+
throw new Error(`${label} must be a SHA-256 hex digest`);
|
|
114
|
+
return value;
|
|
115
|
+
}
|
|
116
|
+
export function sourceOperationSignatureDigest(value) {
|
|
117
|
+
const match = /^(?:sha256v2:|sha256:)?([a-f0-9]{64})$/.exec(value);
|
|
118
|
+
if (match?.[1] === undefined)
|
|
119
|
+
throw new Error('source operation signature is invalid');
|
|
120
|
+
return match[1];
|
|
121
|
+
}
|
|
122
|
+
export function sourceJsonDigest(value) {
|
|
123
|
+
return createHash('sha256').update(stableJson(value)).digest('hex');
|
|
124
|
+
}
|
|
125
|
+
export function sourceInteger(label, value, minimum, maximum) {
|
|
126
|
+
if (!Number.isSafeInteger(value) || value < minimum || value > maximum) {
|
|
127
|
+
throw new Error(`${label} is outside the supported range`);
|
|
128
|
+
}
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
131
|
+
export function sourceInstant(label, value) {
|
|
132
|
+
const milliseconds = value instanceof Date ? value.getTime() : Date.parse(value);
|
|
133
|
+
if (!Number.isFinite(milliseconds))
|
|
134
|
+
throw new Error(`${label} is invalid`);
|
|
135
|
+
return new Date(milliseconds).toISOString();
|
|
136
|
+
}
|
|
137
|
+
function normalizeOperation(value) {
|
|
138
|
+
return {
|
|
139
|
+
connector: validateScalar('source connector', value.connector, 128),
|
|
140
|
+
connectorVersion: validateScalar('source connector version', value.connectorVersion, 128),
|
|
141
|
+
operation: validateScalar('source operation', value.operation, 128),
|
|
142
|
+
signatureDigest: sourceDigest('source operation signature', value.signatureDigest),
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function sourceRetentionDays(value) {
|
|
146
|
+
if (value !== 7 && value !== 30 && value !== 90) {
|
|
147
|
+
throw new Error('source retention days must be 7, 30, or 90');
|
|
148
|
+
}
|
|
149
|
+
return value;
|
|
150
|
+
}
|
|
151
|
+
function stableJson(value) {
|
|
152
|
+
if (Array.isArray(value))
|
|
153
|
+
return `[${value.map(stableJson).join(',')}]`;
|
|
154
|
+
if (value !== null && typeof value === 'object') {
|
|
155
|
+
return `{${Object.entries(value)
|
|
156
|
+
.filter(([, entry]) => entry !== undefined)
|
|
157
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
158
|
+
.map(([key, entry]) => `${JSON.stringify(key)}:${stableJson(entry)}`)
|
|
159
|
+
.join(',')}}`;
|
|
160
|
+
}
|
|
161
|
+
return JSON.stringify(value);
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=source-ingestion-validation.js.map
|
package/node_modules/@noodle-borg/service/dist/business-information/source-refresh-retention.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SOURCE_REFRESH_REPLAY_MS } from './source-custody-budget.js';
|
|
2
|
+
export function terminalRefresh(state) {
|
|
3
|
+
return state === 'completed' || state === 'superseded';
|
|
4
|
+
}
|
|
5
|
+
export function refreshReplayExpiresAt(terminalAt) {
|
|
6
|
+
return new Date(Date.parse(terminalAt) + SOURCE_REFRESH_REPLAY_MS).toISOString();
|
|
7
|
+
}
|
|
8
|
+
export function pruneMemoryRefreshReceipts(requests, now, limit) {
|
|
9
|
+
const expired = [...requests.entries()]
|
|
10
|
+
.filter(([, row]) => terminalRefresh(row.state) &&
|
|
11
|
+
row.terminalAt !== undefined &&
|
|
12
|
+
Date.parse(row.terminalAt) + SOURCE_REFRESH_REPLAY_MS <= now.getTime())
|
|
13
|
+
.sort((left, right) => (left[1].terminalAt ?? '').localeCompare(right[1].terminalAt ?? ''))
|
|
14
|
+
.slice(0, limit);
|
|
15
|
+
for (const [key] of expired)
|
|
16
|
+
requests.delete(key);
|
|
17
|
+
return expired.length;
|
|
18
|
+
}
|
|
19
|
+
export async function prunePostgresRefreshReceipts(client, organizations, limit) {
|
|
20
|
+
if (limit === 0)
|
|
21
|
+
return 0;
|
|
22
|
+
const result = await client.query(`DELETE FROM business_source_refresh_requests WHERE ctid IN (
|
|
23
|
+
SELECT ctid FROM business_source_refresh_requests WHERE org_slug=ANY($1::text[])
|
|
24
|
+
AND state IN ('completed','superseded') AND terminal_at<=clock_timestamp()-($2 * interval '1 millisecond')
|
|
25
|
+
ORDER BY terminal_at LIMIT $3 FOR UPDATE SKIP LOCKED
|
|
26
|
+
)`, [organizations, SOURCE_REFRESH_REPLAY_MS, limit]);
|
|
27
|
+
return result.rowCount ?? 0;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=source-refresh-retention.js.map
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { MANAGED_RETENTION_DAYS } from './contracts.js';
|
|
2
|
+
export const MAX_PAYLOAD_BYTES = 32 * 1024;
|
|
3
|
+
export const MAX_PAYLOAD_DEPTH = 6;
|
|
4
|
+
export const MAX_PAYLOAD_PROPERTIES = 128;
|
|
5
|
+
export const MAX_PAYLOAD_STRING_LENGTH = 4096;
|
|
6
|
+
export const MAX_PAYLOAD_ARRAY_ITEMS = 50;
|
|
7
|
+
export const MAX_PAGE_SIZE = 100;
|
|
8
|
+
export const MAX_EXPORT_PAGE_SIZE = 500;
|
|
9
|
+
export const DEFAULT_PAGE_SIZE = 50;
|
|
10
|
+
export const DEFAULT_RETENTION_DAYS = 30;
|
|
11
|
+
export class PayloadValidationError extends Error {
|
|
12
|
+
code;
|
|
13
|
+
constructor(code, message) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.code = code;
|
|
16
|
+
this.name = 'PayloadValidationError';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export class CursorValidationError extends Error {
|
|
20
|
+
constructor(message = 'cursor is invalid') {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = 'CursorValidationError';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const PROHIBITED_FIELD_PATTERNS = [
|
|
26
|
+
/^(?:card_?number|credit_?card|debit_?card|pan|cvv|cvc|card_?expiry)$/i,
|
|
27
|
+
/(?:password|passwd|passcode|secret|api_?key|access_?token|refresh_?token|authorization)/i,
|
|
28
|
+
/(?:ssn|social_?security|national_?id|government_?id|passport|driver.?s?_?licen[cs]e)/i,
|
|
29
|
+
/(?:health|medical|diagnosis|patient|biometric|fingerprint|faceprint|voiceprint)/i,
|
|
30
|
+
];
|
|
31
|
+
const CREDENTIAL_VALUE_PATTERNS = [
|
|
32
|
+
/\bBearer\s+[A-Za-z0-9._~+/=-]{8,}/i,
|
|
33
|
+
/-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/,
|
|
34
|
+
/\b(?:sk|ghp|github_pat|xox[baprs])-[_A-Za-z0-9-]{8,}\b/,
|
|
35
|
+
/\b(?:password|passwd|api[_-]?key|access[_-]?token|refresh[_-]?token)\s*[:=]\s*\S+/i,
|
|
36
|
+
];
|
|
37
|
+
const GOVERNMENT_ID_VALUE_PATTERNS = [
|
|
38
|
+
/\b\d{3}-\d{2}-\d{4}\b/,
|
|
39
|
+
/\b(?:SSN|social security|national ID|passport number|driver'?s? licen[cs]e)\s*[:#-]\s*\S+/i,
|
|
40
|
+
];
|
|
41
|
+
const HEALTH_BIOMETRIC_VALUE_PATTERNS = [
|
|
42
|
+
/\b(?:medical record|patient record|diagnosis|biometric template|fingerprint template|faceprint|voiceprint)\s*[:#-]/i,
|
|
43
|
+
];
|
|
44
|
+
export function validateManagedPayload(value) {
|
|
45
|
+
if (!isPlainObject(value)) {
|
|
46
|
+
throw new PayloadValidationError('invalid_json', 'managed payload must be a JSON object');
|
|
47
|
+
}
|
|
48
|
+
let properties = 0;
|
|
49
|
+
const validated = validateValue(value, '$', 1, () => {
|
|
50
|
+
properties += 1;
|
|
51
|
+
if (properties > MAX_PAYLOAD_PROPERTIES) {
|
|
52
|
+
throw new PayloadValidationError('too_many_properties', `managed payload exceeds ${MAX_PAYLOAD_PROPERTIES} properties`);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const encoded = Buffer.byteLength(JSON.stringify(validated), 'utf8');
|
|
56
|
+
if (encoded > MAX_PAYLOAD_BYTES) {
|
|
57
|
+
throw new PayloadValidationError('payload_too_large', `managed payload exceeds ${MAX_PAYLOAD_BYTES} bytes`);
|
|
58
|
+
}
|
|
59
|
+
return structuredClone(validated);
|
|
60
|
+
}
|
|
61
|
+
function validateValue(value, path, depth, countProperty) {
|
|
62
|
+
if (depth > MAX_PAYLOAD_DEPTH) {
|
|
63
|
+
throw new PayloadValidationError('payload_too_deep', `managed payload exceeds depth ${MAX_PAYLOAD_DEPTH}`);
|
|
64
|
+
}
|
|
65
|
+
if (value === null || typeof value === 'boolean')
|
|
66
|
+
return value;
|
|
67
|
+
if (typeof value === 'number') {
|
|
68
|
+
if (!Number.isFinite(value)) {
|
|
69
|
+
throw new PayloadValidationError('invalid_json', `${path} must be a finite JSON number`);
|
|
70
|
+
}
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
if (typeof value === 'string') {
|
|
74
|
+
validateString(value, path);
|
|
75
|
+
return value;
|
|
76
|
+
}
|
|
77
|
+
if (Array.isArray(value)) {
|
|
78
|
+
if (value.length > MAX_PAYLOAD_ARRAY_ITEMS) {
|
|
79
|
+
throw new PayloadValidationError('array_too_large', `${path} exceeds ${MAX_PAYLOAD_ARRAY_ITEMS} array items`);
|
|
80
|
+
}
|
|
81
|
+
return value.map((entry, index) => validateValue(entry, `${path}[${index}]`, depth + 1, countProperty));
|
|
82
|
+
}
|
|
83
|
+
if (!isPlainObject(value)) {
|
|
84
|
+
throw new PayloadValidationError('invalid_json', `${path} contains a non-JSON value`);
|
|
85
|
+
}
|
|
86
|
+
const result = {};
|
|
87
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
88
|
+
countProperty();
|
|
89
|
+
if (key.length === 0 || key.length > 64) {
|
|
90
|
+
throw new PayloadValidationError('invalid_json', `${path} contains an invalid property name`);
|
|
91
|
+
}
|
|
92
|
+
if (PROHIBITED_FIELD_PATTERNS.some((pattern) => pattern.test(key))) {
|
|
93
|
+
throw new PayloadValidationError('prohibited_field', `${path}.${key} is a prohibited field`);
|
|
94
|
+
}
|
|
95
|
+
result[key] = validateValue(entry, `${path}.${key}`, depth + 1, countProperty);
|
|
96
|
+
}
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
function validateString(value, path) {
|
|
100
|
+
if (value.length > MAX_PAYLOAD_STRING_LENGTH) {
|
|
101
|
+
throw new PayloadValidationError('string_too_long', `${path} exceeds ${MAX_PAYLOAD_STRING_LENGTH} string characters`);
|
|
102
|
+
}
|
|
103
|
+
if (looksLikePaymentCard(value)) {
|
|
104
|
+
throw new PayloadValidationError('payment_card_value', `${path} contains payment card data`);
|
|
105
|
+
}
|
|
106
|
+
if (CREDENTIAL_VALUE_PATTERNS.some((pattern) => pattern.test(value))) {
|
|
107
|
+
throw new PayloadValidationError('credential_value', `${path} contains credential data`);
|
|
108
|
+
}
|
|
109
|
+
if (GOVERNMENT_ID_VALUE_PATTERNS.some((pattern) => pattern.test(value))) {
|
|
110
|
+
throw new PayloadValidationError('government_id_value', `${path} contains government ID data`);
|
|
111
|
+
}
|
|
112
|
+
if (HEALTH_BIOMETRIC_VALUE_PATTERNS.some((pattern) => pattern.test(value))) {
|
|
113
|
+
throw new PayloadValidationError('health_biometric_value', `${path} contains health or biometric data`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function looksLikePaymentCard(value) {
|
|
117
|
+
const candidates = value.match(/(?:\d[ -]?){13,19}/g) ?? [];
|
|
118
|
+
return candidates.some((candidate) => {
|
|
119
|
+
const digits = candidate.replace(/\D/g, '');
|
|
120
|
+
return digits.length >= 13 && digits.length <= 19 && luhnValid(digits);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function luhnValid(digits) {
|
|
124
|
+
let sum = 0;
|
|
125
|
+
let double = false;
|
|
126
|
+
for (let index = digits.length - 1; index >= 0; index -= 1) {
|
|
127
|
+
let digit = Number(digits[index]);
|
|
128
|
+
if (double) {
|
|
129
|
+
digit *= 2;
|
|
130
|
+
if (digit > 9)
|
|
131
|
+
digit -= 9;
|
|
132
|
+
}
|
|
133
|
+
sum += digit;
|
|
134
|
+
double = !double;
|
|
135
|
+
}
|
|
136
|
+
return sum % 10 === 0;
|
|
137
|
+
}
|
|
138
|
+
function isPlainObject(value) {
|
|
139
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
140
|
+
return false;
|
|
141
|
+
const prototype = Object.getPrototypeOf(value);
|
|
142
|
+
return prototype === Object.prototype || prototype === null;
|
|
143
|
+
}
|
|
144
|
+
export function validateScalar(label, value, maximum = 128) {
|
|
145
|
+
const normalized = value.trim();
|
|
146
|
+
if (normalized.length === 0 || normalized.length > maximum || /[\0\r\n]/.test(normalized)) {
|
|
147
|
+
throw new Error(`${label} must be between 1 and ${maximum} single-line characters`);
|
|
148
|
+
}
|
|
149
|
+
return normalized;
|
|
150
|
+
}
|
|
151
|
+
export function validateEmail(value) {
|
|
152
|
+
const normalized = validateScalar('business grant email', value, 320).toLowerCase();
|
|
153
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(normalized)) {
|
|
154
|
+
throw new Error('business grant email is invalid');
|
|
155
|
+
}
|
|
156
|
+
return normalized;
|
|
157
|
+
}
|
|
158
|
+
export function validateScope(scope) {
|
|
159
|
+
validateSlug('organization', scope.org);
|
|
160
|
+
validateSlug('app', scope.app);
|
|
161
|
+
validateSlug('environment', scope.env);
|
|
162
|
+
validateSlug('installation', scope.installationId);
|
|
163
|
+
return scope;
|
|
164
|
+
}
|
|
165
|
+
export function validateSlug(label, value) {
|
|
166
|
+
if (!/^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/.test(value)) {
|
|
167
|
+
throw new Error(`${label} must be a lowercase slug`);
|
|
168
|
+
}
|
|
169
|
+
return value;
|
|
170
|
+
}
|
|
171
|
+
export function validateRetentionDays(value) {
|
|
172
|
+
const resolved = value ?? DEFAULT_RETENTION_DAYS;
|
|
173
|
+
if (!MANAGED_RETENTION_DAYS.includes(resolved)) {
|
|
174
|
+
throw new Error('retentionDays must be 7, 30, or 90');
|
|
175
|
+
}
|
|
176
|
+
return resolved;
|
|
177
|
+
}
|
|
178
|
+
export function boundedPageSize(value) {
|
|
179
|
+
if (value === undefined)
|
|
180
|
+
return DEFAULT_PAGE_SIZE;
|
|
181
|
+
if (!Number.isInteger(value) || value < 1 || value > MAX_PAGE_SIZE) {
|
|
182
|
+
throw new Error(`limit must be an integer between 1 and ${MAX_PAGE_SIZE}`);
|
|
183
|
+
}
|
|
184
|
+
return value;
|
|
185
|
+
}
|
|
186
|
+
export function boundedExportPageSize(value) {
|
|
187
|
+
if (value === undefined)
|
|
188
|
+
return DEFAULT_PAGE_SIZE;
|
|
189
|
+
if (!Number.isInteger(value) || value < 1 || value > MAX_EXPORT_PAGE_SIZE) {
|
|
190
|
+
throw new Error(`limit must be an integer between 1 and ${MAX_EXPORT_PAGE_SIZE}`);
|
|
191
|
+
}
|
|
192
|
+
return value;
|
|
193
|
+
}
|
|
194
|
+
export function validateRevision(value) {
|
|
195
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
196
|
+
throw new Error('expectedRevision must be a non-negative safe integer');
|
|
197
|
+
}
|
|
198
|
+
return value;
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { resolveApplicationRuntimeTarget } from './application-runtime-target.js';
|
|
2
|
+
import { InMemoryBusinessInformationStore, InMemorySourceIngestionStore, privateDefinitionFromDeployment, RegistrySourceReadExecutor, SourceIngestionCoordinator, validateManagedPayload, } from './business-information/portable.js';
|
|
3
|
+
import { fenceSourceStore } from './business-information/source-credential-fence.js';
|
|
4
|
+
import { createDeploymentNativeRecordConnector } from './native-record-connector.js';
|
|
5
|
+
import { sourceConfigurationAuthority } from './source-configuration-authority.js';
|
|
6
|
+
/** Compose generic business information ports without introducing application-specific records. */
|
|
7
|
+
export function createBusinessInformationRuntime(registry, options, publicCounters) {
|
|
8
|
+
const businessInformationStore = options.businessInformationStore ??
|
|
9
|
+
(options.businessInformationEnabled === false
|
|
10
|
+
? undefined
|
|
11
|
+
: new InMemoryBusinessInformationStore());
|
|
12
|
+
if (businessInformationStore)
|
|
13
|
+
registry.setApplicationLifecycleObserver((org, app, at, retired) => businessInformationStore.pauseApplication(org, app, at, retired));
|
|
14
|
+
if (businessInformationStore instanceof InMemoryBusinessInformationStore) {
|
|
15
|
+
businessInformationStore.configureApplicationLifecycle(async (scope) => {
|
|
16
|
+
const generation = await registry.getAppGeneration(scope.org, scope.app);
|
|
17
|
+
if (!generation)
|
|
18
|
+
return undefined;
|
|
19
|
+
return {
|
|
20
|
+
generation,
|
|
21
|
+
active: (await registry.getAppArchivedAt(scope.org, scope.app)) === undefined &&
|
|
22
|
+
(await registry.getActiveByTenant(scope)) !== undefined,
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const sourceStore = options.businessInformationSourceStore ??
|
|
27
|
+
(businessInformationStore === undefined
|
|
28
|
+
? undefined
|
|
29
|
+
: new InMemorySourceIngestionStore({
|
|
30
|
+
identityKey: 'local-business-source-identity-key-v1',
|
|
31
|
+
...(options.clock === undefined ? {} : { now: options.clock }),
|
|
32
|
+
}));
|
|
33
|
+
const sourceAuthority = sourceConfigurationAuthority(() => registry, options.connectionRuntime?.sourceCredentials);
|
|
34
|
+
const businessInformationSourceStore = sourceStore
|
|
35
|
+
? fenceSourceStore(sourceStore, sourceAuthority)
|
|
36
|
+
: undefined;
|
|
37
|
+
const businessInformationSourceExecutor = options.businessInformationSourceExecutor ??
|
|
38
|
+
(businessInformationStore === undefined
|
|
39
|
+
? undefined
|
|
40
|
+
: new RegistrySourceReadExecutor(registry, businessInformationStore, (target) => resolveApplicationRuntimeTarget(target, undefined, options.connectionRuntime?.readGenerations), sourceAuthority));
|
|
41
|
+
const sourceCoordinator = businessInformationSourceStore === undefined || businessInformationSourceExecutor === undefined
|
|
42
|
+
? undefined
|
|
43
|
+
: new SourceIngestionCoordinator({
|
|
44
|
+
store: businessInformationSourceStore,
|
|
45
|
+
executor: businessInformationSourceExecutor,
|
|
46
|
+
workerId: 'service-refresh',
|
|
47
|
+
validateRecord: (_binding, value) => validateManagedPayload(value),
|
|
48
|
+
...(options.clock === undefined ? {} : { now: options.clock }),
|
|
49
|
+
});
|
|
50
|
+
registry.setPlatformConnectors({
|
|
51
|
+
...(businessInformationStore === undefined
|
|
52
|
+
? {}
|
|
53
|
+
: {
|
|
54
|
+
nativeRecords: (input) => createDeploymentNativeRecordConnector(input, {
|
|
55
|
+
store: businessInformationStore,
|
|
56
|
+
counters: publicCounters,
|
|
57
|
+
publicIntakeEnabled: options.businessInformationPublicIntakeEnabled !== false,
|
|
58
|
+
...(options.clock === undefined ? {} : { now: options.clock }),
|
|
59
|
+
}),
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
62
|
+
return { businessInformationStore, businessInformationSourceStore, sourceCoordinator };
|
|
63
|
+
}
|
|
64
|
+
/** Resolve immutable same-organization private definition bytes; publisher configuration stays private. */
|
|
65
|
+
export async function resolvePrivateInstallationDefinition(registry, selector) {
|
|
66
|
+
const source = await registry.getDeploymentSource({ org: selector.publisherOrg, app: selector.app, env: selector.environment }, selector.deploymentId);
|
|
67
|
+
if (!source)
|
|
68
|
+
return undefined;
|
|
69
|
+
const target = await registry.get(selector.deploymentId);
|
|
70
|
+
if (!target)
|
|
71
|
+
return undefined;
|
|
72
|
+
return privateDefinitionFromDeployment(selector, {
|
|
73
|
+
deploymentId: selector.deploymentId,
|
|
74
|
+
org: selector.publisherOrg,
|
|
75
|
+
app: selector.app,
|
|
76
|
+
environment: selector.environment,
|
|
77
|
+
artifact: target.served.artifact,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=business-information-runtime.js.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { agreementDocumentDigest, OrganizationAgreementError, validateAgreementDocuments, } from '@noodle-borg/control-plane/portable';
|
|
2
|
+
import { AgreementDocumentsSchema, } from '@noodle-borg/wire-contracts';
|
|
3
|
+
export const BUSINESS_SETUP_MESSAGE = 'Complete the organization agreement and business notice in Portal before activating this application. Retained records remain accessible.';
|
|
4
|
+
export class BusinessSetupError extends Error {
|
|
5
|
+
code = 'business_setup_required';
|
|
6
|
+
constructor() {
|
|
7
|
+
super(BUSINESS_SETUP_MESSAGE);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/** Portable hosts may inject their own approved catalog; Noodle-hosted composition always installs this policy. */
|
|
11
|
+
export function parseBusinessOnboarding(serialized) {
|
|
12
|
+
if (serialized === undefined)
|
|
13
|
+
return {};
|
|
14
|
+
if (serialized.length > 16384)
|
|
15
|
+
throw new Error('Organization agreement catalog is too large');
|
|
16
|
+
return { documents: AgreementDocumentsSchema.parse(JSON.parse(serialized)) };
|
|
17
|
+
}
|
|
18
|
+
export class BusinessOnboarding {
|
|
19
|
+
organizations;
|
|
20
|
+
installations;
|
|
21
|
+
#documents;
|
|
22
|
+
constructor(options, organizations, installations) {
|
|
23
|
+
this.organizations = organizations;
|
|
24
|
+
this.installations = installations;
|
|
25
|
+
this.#documents = options.documents ? validateAgreementDocuments(options.documents) : undefined;
|
|
26
|
+
}
|
|
27
|
+
async status(org, subject) {
|
|
28
|
+
const canAccept = (await this.organizations.getOrgMember({ org, subject }))?.role === 'owner';
|
|
29
|
+
const documents = this.#documents;
|
|
30
|
+
if (!documents)
|
|
31
|
+
return { canAccept, accepted: false, required: null };
|
|
32
|
+
const documentDigest = agreementDocumentDigest(documents);
|
|
33
|
+
const acceptance = await this.organizations.getOrganizationAgreement(org, documents.version);
|
|
34
|
+
const accepted = acceptance?.documentDigest === documentDigest;
|
|
35
|
+
return {
|
|
36
|
+
canAccept,
|
|
37
|
+
accepted,
|
|
38
|
+
required: { ...structuredClone(documents), documentDigest },
|
|
39
|
+
...(acceptance
|
|
40
|
+
? {
|
|
41
|
+
receipt: {
|
|
42
|
+
version: acceptance.documents.version,
|
|
43
|
+
documentDigest: acceptance.documentDigest,
|
|
44
|
+
acceptedAt: acceptance.acceptedAt,
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
: {}),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
async accept(org, subject, input) {
|
|
51
|
+
const status = await this.status(org, subject);
|
|
52
|
+
if (!status.canAccept)
|
|
53
|
+
throw new OrganizationAgreementError('agreement_owner_required');
|
|
54
|
+
if (!status.required ||
|
|
55
|
+
status.required.version !== input.version ||
|
|
56
|
+
status.required.documentDigest !== input.documentDigest)
|
|
57
|
+
throw new OrganizationAgreementError('agreement_version_conflict');
|
|
58
|
+
const documents = this.#documents;
|
|
59
|
+
if (!documents)
|
|
60
|
+
throw new BusinessSetupError();
|
|
61
|
+
await this.organizations.acceptOrganizationAgreement({ org, actorSubject: subject, documents });
|
|
62
|
+
return this.status(org, subject);
|
|
63
|
+
}
|
|
64
|
+
async ready(installation) {
|
|
65
|
+
const documents = this.#documents;
|
|
66
|
+
if (!documents)
|
|
67
|
+
return false;
|
|
68
|
+
const receipt = await this.organizations.getOrganizationAgreement(installation.scope.org, documents.version);
|
|
69
|
+
return (receipt?.documentDigest === agreementDocumentDigest(documents) &&
|
|
70
|
+
(await this.installations.getBusinessNotice(installation.scope)) !== undefined);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=business-onboarding.js.map
|