thinkwork-cli 0.13.1 → 1.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/README.md +3 -14
- package/dist/{api-client-4DZ266J5.js → api-client-4P4JZOBX.js} +3 -1
- package/dist/bowser-6Z6JFAIR.js +2822 -0
- package/dist/{chunk-Y2WHJECR.js → chunk-4OMDWYZQ.js} +5 -44
- package/dist/chunk-AD2NIWB5.js +6516 -0
- package/dist/chunk-DV3MRBR5.js +43 -0
- package/dist/chunk-EI5ZX7CN.js +522 -0
- package/dist/chunk-EUJ7X6YD.js +126 -0
- package/dist/chunk-GG5WKBOX.js +436 -0
- package/dist/chunk-I64EZSU5.js +358 -0
- package/dist/chunk-KMIJ5KGT.js +128 -0
- package/dist/chunk-MWQ7RO76.js +137 -0
- package/dist/chunk-OCPHU34C.js +996 -0
- package/dist/chunk-OLUQ4U2Z.js +1728 -0
- package/dist/chunk-XYM7PE2A.js +2264 -0
- package/dist/chunk-YQCYD6NE.js +3299 -0
- package/dist/cli.js +49156 -31257
- package/dist/commands/enterprise/templates/deploy-repo/scripts/apply-release.mjs +0 -1
- package/dist/commands/enterprise/templates/deploy-repo/scripts/smoke.mjs +0 -1
- package/dist/commands/enterprise/templates/deploy-repo/terraform/main.tf +0 -14
- package/dist/dist-es-2OTNTL4N.js +315 -0
- package/dist/dist-es-2XVAH4BQ.js +14726 -0
- package/dist/dist-es-3DPDUJAH.js +2000 -0
- package/dist/dist-es-BNZTBBVC.js +176 -0
- package/dist/dist-es-CD2RBDAC.js +88 -0
- package/dist/dist-es-I4FW57PS.js +88 -0
- package/dist/dist-es-KL7Y5NB2.js +377 -0
- package/dist/dist-es-KVFWJNDY.js +318 -0
- package/dist/dist-es-PS73DWNL.js +70 -0
- package/dist/dist-es-S3NZQFGT.js +170 -0
- package/dist/dist-es-SGCA4P32.js +48 -0
- package/dist/dist-es-WBM6J4RA.js +70 -0
- package/dist/dist-es-ZGVADYIF.js +485 -0
- package/dist/dist-es-ZKC2QKD2.js +377 -0
- package/dist/drizzle/0076_scheduled_jobs_marco_backfill.sql +2 -1
- package/dist/drizzle/0079_seed_tenant_customize_catalog.sql +1 -0
- package/dist/drizzle/0090_brain_schema_extraction.sql +10 -0
- package/dist/drizzle/0132_drop_computer_tables.sql +3 -0
- package/dist/drizzle/0160_compliance_event_types_plugins.sql +2 -0
- package/dist/drizzle/0214_think137_drop_judge_evidence_roi.sql +1 -0
- package/dist/drizzle/0216_drop_agent_loop_versions_goal_worker_policy.sql +1 -0
- package/dist/drizzle/0227_analyst_reader_role.sql +17 -20
- package/dist/drizzle/0230_analyst_rls.sql +28 -36
- package/dist/drizzle/0250_kg_schema_extraction.sql +27 -0
- package/dist/drizzle/0251_brain_stragglers.sql +21 -0
- package/dist/drizzle/0253_drop_brain_substrate.sql +2 -0
- package/dist/drizzle/0257_agents_runtime_allow_harness.sql +24 -0
- package/dist/drizzle/0261_native_auth_control_plane.sql +332 -0
- package/dist/drizzle/0262_auth_subscription_tickets.sql +59 -0
- package/dist/drizzle/0263_agentcore_runtime_identifier.sql +69 -0
- package/dist/drizzle/0263_drop_workos_auth_runtime.sql +236 -0
- package/dist/drizzle/0264_auth_enrollment_attempt_limits.sql +15 -0
- package/dist/drizzle/0265_eval_runs_requester_identity.sql +28 -0
- package/dist/drizzle/0265_require_fully_valid_auth_publication.sql +27 -0
- package/dist/drizzle/0266_auth_identity_recovery_grants.sql +9 -0
- package/dist/drizzle/0266_eval_profiles_runtime_type.sql +12 -0
- package/dist/drizzle/0267_ontology_candidate_rejections.sql +53 -0
- package/dist/drizzle/0268_identity_crosswalk_routing.sql +182 -0
- package/dist/drizzle/0269_ontology_system_map.sql +31 -0
- package/dist/drizzle/0270_tool_execution_ledger.sql +115 -0
- package/dist/drizzle/0271_ontology_twin_declarations.sql +47 -0
- package/dist/drizzle/0272_identity_graph_projection_cursor.sql +23 -0
- package/dist/drizzle/0273_twin_materialization_suggestions.sql +29 -0
- package/dist/drizzle/0274_tenant_mcp_twin_keys.sql +59 -0
- package/dist/drizzle/0275_identity_bulk_rebuild_fence.sql +30 -0
- package/dist/drizzle/0276_tool_execution_ledger_allow_cascade_delete.sql +18 -0
- package/dist/drizzle/0277_knowledge_base_sources.sql +107 -0
- package/dist/drizzle/0278_kb_page_transcription.sql +55 -0
- package/dist/drizzle/0279_mcp_servers_off_plugin_provenance.sql +93 -0
- package/dist/drizzle/0280_work_item_external_refs_drop_plane_provider.sql +46 -0
- package/dist/drizzle/0281_tenant_mcp_twin_keys_expiry_suffix.sql +9 -0
- package/dist/drizzle/0282_tenant_mcp_twin_keys_grants.sql +24 -0
- package/dist/drizzle/0283_agents_agentcore_runtime_dispatch.sql +13 -0
- package/dist/drizzle/0284_user_brain_claims.sql +69 -0
- package/dist/drizzle/0285_tenant_mcp_twin_keys_trusted_subsystem.sql +30 -0
- package/dist/drizzle/0286_brain_analytics_key.sql +26 -0
- package/dist/drizzle/0287_brain_subject.sql +25 -0
- package/dist/drizzle/0288_multi_lane_identities.sql +25 -0
- package/dist/event-streams-7JNLJEEL.js +894 -0
- package/dist/event-streams-KDF5RWR6.js +1515 -0
- package/dist/loadSso-ETCXTR4I.js +576 -0
- package/dist/loadSso-UBD7KUHE.js +583 -0
- package/dist/plugins/README.md +2 -2
- package/dist/plugins/catalog/package.json +1 -5
- package/dist/plugins/catalog/src/__tests__/build-catalog.test.ts +6 -4
- package/dist/plugins/catalog/src/__tests__/catalog.test.ts +21 -21
- package/dist/plugins/catalog/src/__tests__/contracts.test.ts +102 -94
- package/dist/plugins/catalog/src/__tests__/plugin-package.test.ts +7 -8
- package/dist/plugins/catalog/src/__tests__/plugin-registry.test.ts +0 -20
- package/dist/plugins/catalog/src/contracts.ts +17 -179
- package/dist/plugins/catalog/src/registry/generated-first-party.ts +0 -24
- package/dist/plugins/n8n/test/integrated-app-contract.test.ts +1 -1
- package/dist/plugins/twenty/package.json +2 -1
- package/dist/plugins/twenty/scripts/LAMBDA_DEPLOY.md +114 -0
- package/dist/plugins/twenty/scripts/build-lambda.sh +29 -0
- package/dist/plugins/twenty/scripts/configure-product-views.ts +195 -0
- package/dist/plugins/twenty/scripts/lambda-handler.ts +49 -0
- package/dist/plugins/twenty/scripts/lib/__tests__/load-attachments.test.ts +38 -0
- package/dist/plugins/twenty/scripts/lib/__tests__/load-records.test.ts +145 -2
- package/dist/plugins/twenty/scripts/lib/__tests__/mappers.test.ts +397 -151
- package/dist/plugins/twenty/scripts/lib/__tests__/members-ensure.test.ts +28 -129
- package/dist/plugins/twenty/scripts/lib/__tests__/provision-members-db.test.ts +10 -0
- package/dist/plugins/twenty/scripts/lib/__tests__/schema-ensure.test.ts +13 -8
- package/dist/plugins/twenty/scripts/lib/lastmile-reader.ts +222 -2
- package/dist/plugins/twenty/scripts/lib/load-attachments.ts +29 -0
- package/dist/plugins/twenty/scripts/lib/load-records.ts +160 -43
- package/dist/plugins/twenty/scripts/lib/mappers.ts +368 -152
- package/dist/plugins/twenty/scripts/lib/members-ensure.ts +43 -268
- package/dist/plugins/twenty/scripts/lib/provision-members-db.ts +57 -0
- package/dist/plugins/twenty/scripts/lib/schema-ensure.ts +136 -31
- package/dist/plugins/twenty/scripts/migrate-lastmile.ts +254 -152
- package/dist/plugins/twenty/scripts/provision-twenty-members.ts +44 -1
- package/dist/plugins/twenty/scripts/purge-lastmile-import.ts +178 -0
- package/dist/plugins/twenty/scripts/restructure-products.ts +312 -0
- package/dist/plugins/twenty/scripts/retag-stage-values.ts +362 -0
- package/dist/plugins/twenty/test/manifest.test.ts +2 -4
- package/dist/scripts/post-deploy.sh +79 -1
- package/dist/signin-5QZNRSOO.js +821 -0
- package/dist/sso-oidc-XK673P54.js +837 -0
- package/dist/sts-OXI2UALF.js +1113 -0
- package/dist/sts-SQW4NBK3.js +1117 -0
- package/dist/terraform/examples/greenfield/main.tf +391 -176
- package/dist/terraform/examples/greenfield/terraform.tfvars.example +26 -8
- package/dist/terraform/modules/app/agentcore-admin/main.tf +47 -0
- package/dist/terraform/modules/app/agentcore-code-interpreter/README.md +39 -47
- package/dist/terraform/modules/app/agentcore-code-interpreter/main.tf +13 -66
- package/dist/terraform/modules/app/agentcore-identity/main.tf +253 -0
- package/dist/terraform/modules/app/agentcore-identity/outputs.tf +51 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/bootstrap_twenty_oauth_client.sh +239 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/delete_identity.sh +22 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/delete_twenty_identity.sh +16 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/delete_workload_identity.sh +19 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/ensure_workload_identity.sh +29 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/read_identity.sh +55 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/reconcile_identity.sh +73 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/reconcile_twenty_identity.sh +45 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/reconcile_twenty_provider.mjs +123 -0
- package/dist/terraform/modules/app/agentcore-identity/tests/tainted-marker/after.tf +15 -0
- package/dist/terraform/modules/app/agentcore-identity/tests/tainted-marker/before.tf +7 -0
- package/dist/terraform/modules/app/agentcore-identity/tests/tainted-marker/identity-after.tf +8 -0
- package/dist/terraform/modules/app/agentcore-identity/tests/tainted-marker/identity-before.tf +9 -0
- package/dist/terraform/modules/app/agentcore-identity/tests/tainted-marker/thinkwork-after.tf +3 -0
- package/dist/terraform/modules/app/agentcore-identity/tests/tainted-marker/thinkwork-before.tf +3 -0
- package/dist/terraform/modules/app/agentcore-identity/variables.tf +60 -0
- package/dist/terraform/modules/app/agentcore-memory/README.md +46 -9
- package/dist/terraform/modules/app/agentcore-memory/main.tf +27 -10
- package/dist/terraform/modules/app/agentcore-memory/scripts/create_or_find_memory.sh +156 -24
- package/dist/terraform/modules/app/agentcore-pi/README.md +1 -3
- package/dist/terraform/modules/app/agentcore-pi/main.tf +42 -52
- package/dist/terraform/modules/app/agentcore-pi/outputs.tf +3 -3
- package/dist/terraform/modules/app/agentcore-pi/scripts/reconcile_pi_runtime.mjs +175 -0
- package/dist/terraform/modules/app/agentcore-pi/variables.tf +35 -28
- package/dist/terraform/modules/app/agentcore-platform/main.tf +68 -0
- package/dist/terraform/modules/app/agentcore-runtime/main.tf +4 -20
- package/dist/terraform/modules/app/appsync-subscriptions/main.tf +127 -21
- package/dist/terraform/modules/app/appsync-subscriptions/outputs.tf +0 -6
- package/dist/terraform/modules/app/appsync-subscriptions/variables.tf +5 -0
- package/dist/terraform/modules/app/capability-broker/main.tf +2 -2
- package/dist/terraform/modules/app/capability-broker/variables.tf +11 -0
- package/dist/terraform/modules/app/deployment-control-plane/README.md +264 -0
- package/dist/terraform/modules/app/deployment-control-plane/buildspec.yml +4 -1
- package/dist/terraform/modules/app/deployment-control-plane/main.tf +94 -0
- package/dist/terraform/modules/app/deployment-control-plane/outputs.tf +5 -0
- package/dist/terraform/modules/app/deployment-control-plane/runner.py +3689 -233
- package/dist/terraform/modules/app/deployment-control-plane/test_runner_bundle.py +2579 -140
- package/dist/terraform/modules/app/deployment-control-plane/variables.tf +33 -0
- package/dist/terraform/modules/app/lambda-api/auth-state.tf +72 -0
- package/dist/terraform/modules/app/lambda-api/chat-latency-observability.tf +466 -0
- package/dist/terraform/modules/app/lambda-api/dispatch-dlq.tf +55 -0
- package/dist/terraform/modules/app/lambda-api/handlers.tf +531 -619
- package/dist/terraform/modules/app/lambda-api/iam-grouped.tf +350 -241
- package/dist/terraform/modules/app/lambda-api/main.tf +75 -13
- package/dist/terraform/modules/app/lambda-api/memory-alarms.tf +3 -28
- package/dist/terraform/modules/app/lambda-api/oauth-secrets.tf +1 -2
- package/dist/terraform/modules/app/lambda-api/outputs.tf +17 -10
- package/dist/terraform/modules/app/lambda-api/runtime-config.tf +3 -21
- package/dist/terraform/modules/app/lambda-api/turn-assertion.tf +45 -0
- package/dist/terraform/modules/app/lambda-api/variables.tf +307 -121
- package/dist/{plugins/n8n/terraform → terraform/modules/app}/n8n/README.md +1 -1
- package/dist/{plugins/n8n/terraform → terraform/modules/app}/n8n/main.tf +18 -18
- package/dist/terraform/modules/app/sandbox-log-scrubber/README.md +11 -10
- package/dist/terraform/modules/app/sandbox-log-scrubber/main.tf +5 -5
- package/dist/terraform/modules/app/static-site/main.tf +1 -1
- package/dist/terraform/modules/app/www-dns/main.tf +9 -27
- package/dist/terraform/modules/app/www-dns/variables.tf +4 -10
- package/dist/terraform/modules/data/aurora-postgres/README.md +34 -0
- package/dist/terraform/modules/data/aurora-postgres/alarms.tf +82 -0
- package/dist/terraform/modules/data/aurora-postgres/main.tf +27 -57
- package/dist/terraform/modules/data/aurora-postgres/outputs.tf +0 -9
- package/dist/terraform/modules/data/aurora-postgres/variables.tf +41 -0
- package/dist/terraform/modules/data/s3-buckets/main.tf +5 -6
- package/dist/terraform/modules/foundation/cognito/main.tf +367 -72
- package/dist/terraform/modules/foundation/cognito/outputs.tf +47 -0
- package/dist/terraform/modules/foundation/cognito/variables.tf +131 -9
- package/dist/terraform/modules/thinkwork/README.md +5 -1
- package/dist/terraform/modules/thinkwork/main.tf +459 -234
- package/dist/terraform/modules/thinkwork/outputs.tf +44 -62
- package/dist/terraform/modules/thinkwork/variables.tf +353 -89
- package/dist/terraform/schema.graphql +69 -36
- package/dist/workspace-defaults/files/INSTRUCTIONS.md +9 -11
- package/dist/workspace-defaults/files/MEMORY_GUIDE.md +38 -35
- package/dist/workspace-defaults/files/ROUTER.md +1 -1
- package/dist/workspace-defaults/files/TOOLS.md +9 -39
- package/dist/workspace-defaults/files/USER.md +1 -0
- package/dist/workspace-defaults/files/agents/analyst/INSTRUCTIONS.md +6 -3
- package/dist/workspace-defaults/files/catalog-skills/brain-brief-builder/SKILL.md +165 -0
- package/dist/workspace-defaults/files/catalog-skills/n8n-workflow-operator/SKILL.md +75 -0
- package/dist/workspace-defaults/files/catalog-skills/n8n-workflow-operator/references/mcp-tooling.md +40 -0
- package/dist/workspace-defaults/files/catalog-skills/n8n-workflow-operator/references/validation-and-handoff.md +40 -0
- package/dist/workspace-defaults/files/catalog-skills/n8n-workflow-operator/references/workflow-authoring.md +46 -0
- package/dist/workspace-defaults/files/skills/artifact-builder/references/crm-dashboard.md +1 -1
- package/dist/workspace-defaults/files/skills/document-composer/SKILL.md +22 -3
- package/package.json +3 -2
- package/dist/drizzle/0261_thread_turns_origin_turn_index.sql +0 -11
- package/dist/plugins/company-data/README.md +0 -49
- package/dist/plugins/company-data/package.json +0 -21
- package/dist/plugins/company-data/src/index.ts +0 -30
- package/dist/plugins/company-data/src/manifest.ts +0 -26
- package/dist/plugins/company-data/test/manifest.test.ts +0 -116
- package/dist/plugins/company-data/tsconfig.json +0 -8
- package/dist/plugins/company-etl/README.md +0 -46
- package/dist/plugins/company-etl/package.json +0 -21
- package/dist/plugins/company-etl/src/index.ts +0 -29
- package/dist/plugins/company-etl/src/manifest.ts +0 -26
- package/dist/plugins/company-etl/test/manifest.test.ts +0 -108
- package/dist/plugins/company-etl/tsconfig.json +0 -8
- package/dist/plugins/lastmile/README.md +0 -50
- package/dist/plugins/lastmile/package.json +0 -23
- package/dist/plugins/lastmile/smoke/lastmile-plugin-smoke.mjs +0 -661
- package/dist/plugins/lastmile/src/api/tasks-adapter.ts +0 -572
- package/dist/plugins/lastmile/src/discovery.fixture.ts +0 -64
- package/dist/plugins/lastmile/src/index.ts +0 -46
- package/dist/plugins/lastmile/src/manifest.ts +0 -139
- package/dist/plugins/lastmile/test/api/tasks-adapter.test.ts +0 -266
- package/dist/plugins/lastmile/test/discovery.test.ts +0 -88
- package/dist/plugins/lastmile/tsconfig.json +0 -8
- package/dist/plugins/n8n/smoke/n8n-managed-app-smoke.mjs +0 -409
- package/dist/plugins/twenty/smoke/twenty-managed-app-smoke.mjs +0 -359
- package/dist/plugins/workos-auth/package.json +0 -22
- package/dist/plugins/workos-auth/src/index.ts +0 -30
- package/dist/plugins/workos-auth/src/manifest.ts +0 -40
- package/dist/plugins/workos-auth/src/provider-contract.ts +0 -39
- package/dist/plugins/workos-auth/test/manifest.test.ts +0 -94
- package/dist/plugins/workos-auth/tsconfig.json +0 -8
- package/dist/terraform/modules/app/agentcore-code-interpreter/Dockerfile.sandbox-base +0 -61
- package/dist/terraform/modules/app/agentcore-code-interpreter/sandbox/sitecustomize.py +0 -227
- package/dist/terraform/modules/app/agentcore-code-interpreter/sandbox/test_sitecustomize.py +0 -277
- package/dist/terraform/modules/app/agentcore-code-interpreter/scripts/build_and_push_sandbox_base.sh +0 -70
- package/dist/terraform/modules/app/agentcore-harness/main.tf +0 -101
- package/dist/terraform/modules/app/agentcore-harness/outputs.tf +0 -9
- package/dist/terraform/modules/app/agentcore-harness/variables.tf +0 -25
- package/dist/terraform/modules/app/hindsight-memory/README.md +0 -89
- package/dist/terraform/modules/app/hindsight-memory/main.tf +0 -411
- package/dist/terraform/modules/data/bedrock-knowledge-base/main.tf +0 -102
- /package/dist/{plugins/n8n/terraform → terraform/modules/app}/n8n/outputs.tf +0 -0
- /package/dist/{plugins/n8n/terraform → terraform/modules/app}/n8n/scripts/sync-database.py +0 -0
- /package/dist/{plugins/n8n/terraform → terraform/modules/app}/n8n/scripts/test_sync_database.py +0 -0
- /package/dist/{plugins/n8n/terraform → terraform/modules/app}/n8n/variables.tf +0 -0
- /package/dist/{plugins/twenty/terraform → terraform/modules/app}/twenty/README.md +0 -0
- /package/dist/{plugins/twenty/terraform → terraform/modules/app}/twenty/main.tf +0 -0
- /package/dist/{plugins/twenty/terraform → terraform/modules/app}/twenty/outputs.tf +0 -0
- /package/dist/{plugins/twenty/terraform → terraform/modules/app}/twenty/variables.tf +0 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
CredentialsProviderError,
|
|
4
|
+
ProviderError,
|
|
5
|
+
loadConfig,
|
|
6
|
+
parseUrl
|
|
7
|
+
} from "./chunk-XYM7PE2A.js";
|
|
8
|
+
import "./chunk-OCPHU34C.js";
|
|
9
|
+
import "./chunk-DV3MRBR5.js";
|
|
10
|
+
|
|
11
|
+
// ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.3.8/node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/ImdsCredentials.js
|
|
12
|
+
var isImdsCredentials = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.AccessKeyId === "string" && typeof arg.SecretAccessKey === "string" && typeof arg.Token === "string" && typeof arg.Expiration === "string";
|
|
13
|
+
var fromImdsCredentials = (creds) => ({
|
|
14
|
+
accessKeyId: creds.AccessKeyId,
|
|
15
|
+
secretAccessKey: creds.SecretAccessKey,
|
|
16
|
+
sessionToken: creds.Token,
|
|
17
|
+
expiration: new Date(creds.Expiration),
|
|
18
|
+
...creds.AccountId && { accountId: creds.AccountId }
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.3.8/node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/RemoteProviderInit.js
|
|
22
|
+
var DEFAULT_TIMEOUT = 1e3;
|
|
23
|
+
var DEFAULT_MAX_RETRIES = 0;
|
|
24
|
+
var providerConfigFromInit = ({ maxRetries = DEFAULT_MAX_RETRIES, timeout = DEFAULT_TIMEOUT }) => ({ maxRetries, timeout });
|
|
25
|
+
|
|
26
|
+
// ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.3.8/node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/node-http.js
|
|
27
|
+
import node_http from "http";
|
|
28
|
+
|
|
29
|
+
// ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.3.8/node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/httpRequest.js
|
|
30
|
+
function httpRequest(options) {
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
const req = node_http.request({
|
|
33
|
+
method: "GET",
|
|
34
|
+
...options,
|
|
35
|
+
hostname: options.hostname?.replace(/^\[(.+)\]$/, "$1")
|
|
36
|
+
});
|
|
37
|
+
req.on("error", (err) => {
|
|
38
|
+
reject(Object.assign(new ProviderError("Unable to connect to instance metadata service"), err));
|
|
39
|
+
req.destroy();
|
|
40
|
+
});
|
|
41
|
+
req.on("timeout", () => {
|
|
42
|
+
reject(new ProviderError("TimeoutError from instance metadata service"));
|
|
43
|
+
req.destroy();
|
|
44
|
+
});
|
|
45
|
+
req.on("response", (res) => {
|
|
46
|
+
const { statusCode = 400 } = res;
|
|
47
|
+
if (statusCode < 200 || 300 <= statusCode) {
|
|
48
|
+
reject(Object.assign(new ProviderError("Error response received from instance metadata service"), { statusCode }));
|
|
49
|
+
req.destroy();
|
|
50
|
+
}
|
|
51
|
+
const chunks = [];
|
|
52
|
+
res.on("data", (chunk) => {
|
|
53
|
+
chunks.push(chunk);
|
|
54
|
+
});
|
|
55
|
+
res.on("end", () => {
|
|
56
|
+
resolve(Buffer.concat(chunks));
|
|
57
|
+
req.destroy();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
req.end();
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.3.8/node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/retry.js
|
|
65
|
+
var retry = (toRetry, maxRetries) => {
|
|
66
|
+
let promise = toRetry();
|
|
67
|
+
for (let i = 0; i < maxRetries; i++) {
|
|
68
|
+
promise = promise.catch(toRetry);
|
|
69
|
+
}
|
|
70
|
+
return promise;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.3.8/node_modules/@smithy/credential-provider-imds/dist-es/fromContainerMetadata.js
|
|
74
|
+
var ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI";
|
|
75
|
+
var ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI";
|
|
76
|
+
var ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN";
|
|
77
|
+
var fromContainerMetadata = (init = {}) => {
|
|
78
|
+
const { timeout, maxRetries } = providerConfigFromInit(init);
|
|
79
|
+
return () => retry(async () => {
|
|
80
|
+
const requestOptions = await getCmdsUri({ logger: init.logger });
|
|
81
|
+
const credsResponse = JSON.parse(await requestFromEcsImds(timeout, requestOptions));
|
|
82
|
+
if (!isImdsCredentials(credsResponse)) {
|
|
83
|
+
throw new CredentialsProviderError("Invalid response received from instance metadata service.", {
|
|
84
|
+
logger: init.logger
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return fromImdsCredentials(credsResponse);
|
|
88
|
+
}, maxRetries);
|
|
89
|
+
};
|
|
90
|
+
var requestFromEcsImds = async (timeout, options) => {
|
|
91
|
+
if (process.env[ENV_CMDS_AUTH_TOKEN]) {
|
|
92
|
+
options.headers = {
|
|
93
|
+
...options.headers,
|
|
94
|
+
Authorization: process.env[ENV_CMDS_AUTH_TOKEN]
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const buffer = await httpRequest({
|
|
98
|
+
...options,
|
|
99
|
+
timeout
|
|
100
|
+
});
|
|
101
|
+
return buffer.toString();
|
|
102
|
+
};
|
|
103
|
+
var CMDS_IP = "169.254.170.2";
|
|
104
|
+
var GREENGRASS_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1"]);
|
|
105
|
+
var GREENGRASS_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:"]);
|
|
106
|
+
var getCmdsUri = async ({ logger }) => {
|
|
107
|
+
if (process.env[ENV_CMDS_RELATIVE_URI]) {
|
|
108
|
+
return {
|
|
109
|
+
hostname: CMDS_IP,
|
|
110
|
+
path: process.env[ENV_CMDS_RELATIVE_URI]
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
if (process.env[ENV_CMDS_FULL_URI]) {
|
|
114
|
+
let parsed;
|
|
115
|
+
try {
|
|
116
|
+
parsed = new URL(process.env[ENV_CMDS_FULL_URI]);
|
|
117
|
+
} catch {
|
|
118
|
+
throw new CredentialsProviderError(`${process.env[ENV_CMDS_FULL_URI]} is not a valid container metadata service URL`, { tryNextLink: false, logger });
|
|
119
|
+
}
|
|
120
|
+
if (!parsed.hostname || !GREENGRASS_HOSTS.has(parsed.hostname)) {
|
|
121
|
+
throw new CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, {
|
|
122
|
+
tryNextLink: false,
|
|
123
|
+
logger
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
if (!parsed.protocol || !GREENGRASS_PROTOCOLS.has(parsed.protocol)) {
|
|
127
|
+
throw new CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, {
|
|
128
|
+
tryNextLink: false,
|
|
129
|
+
logger
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
protocol: parsed.protocol,
|
|
134
|
+
hostname: parsed.hostname,
|
|
135
|
+
path: parsed.pathname + parsed.search,
|
|
136
|
+
port: parsed.port ? parseInt(parsed.port, 10) : void 0
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
throw new CredentialsProviderError(`The container metadata credential provider cannot be used unless the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment variable is set`, {
|
|
140
|
+
tryNextLink: false,
|
|
141
|
+
logger
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.3.8/node_modules/@smithy/credential-provider-imds/dist-es/error/InstanceMetadataV1FallbackError.js
|
|
146
|
+
var InstanceMetadataV1FallbackError = class _InstanceMetadataV1FallbackError extends CredentialsProviderError {
|
|
147
|
+
tryNextLink;
|
|
148
|
+
name = "InstanceMetadataV1FallbackError";
|
|
149
|
+
constructor(message, tryNextLink = true) {
|
|
150
|
+
super(message, tryNextLink);
|
|
151
|
+
this.tryNextLink = tryNextLink;
|
|
152
|
+
Object.setPrototypeOf(this, _InstanceMetadataV1FallbackError.prototype);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.3.8/node_modules/@smithy/credential-provider-imds/dist-es/config/Endpoint.js
|
|
157
|
+
var Endpoint;
|
|
158
|
+
(function(Endpoint2) {
|
|
159
|
+
Endpoint2["IPv4"] = "http://169.254.169.254";
|
|
160
|
+
Endpoint2["IPv6"] = "http://[fd00:ec2::254]";
|
|
161
|
+
})(Endpoint || (Endpoint = {}));
|
|
162
|
+
|
|
163
|
+
// ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.3.8/node_modules/@smithy/credential-provider-imds/dist-es/config/EndpointConfigOptions.js
|
|
164
|
+
var ENV_ENDPOINT_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT";
|
|
165
|
+
var CONFIG_ENDPOINT_NAME = "ec2_metadata_service_endpoint";
|
|
166
|
+
var ENDPOINT_CONFIG_OPTIONS = {
|
|
167
|
+
environmentVariableSelector: (env) => env[ENV_ENDPOINT_NAME],
|
|
168
|
+
configFileSelector: (profile) => profile[CONFIG_ENDPOINT_NAME],
|
|
169
|
+
default: void 0
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.3.8/node_modules/@smithy/credential-provider-imds/dist-es/config/EndpointMode.js
|
|
173
|
+
var EndpointMode;
|
|
174
|
+
(function(EndpointMode2) {
|
|
175
|
+
EndpointMode2["IPv4"] = "IPv4";
|
|
176
|
+
EndpointMode2["IPv6"] = "IPv6";
|
|
177
|
+
})(EndpointMode || (EndpointMode = {}));
|
|
178
|
+
|
|
179
|
+
// ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.3.8/node_modules/@smithy/credential-provider-imds/dist-es/config/EndpointModeConfigOptions.js
|
|
180
|
+
var ENV_ENDPOINT_MODE_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE";
|
|
181
|
+
var CONFIG_ENDPOINT_MODE_NAME = "ec2_metadata_service_endpoint_mode";
|
|
182
|
+
var ENDPOINT_MODE_CONFIG_OPTIONS = {
|
|
183
|
+
environmentVariableSelector: (env) => env[ENV_ENDPOINT_MODE_NAME],
|
|
184
|
+
configFileSelector: (profile) => profile[CONFIG_ENDPOINT_MODE_NAME],
|
|
185
|
+
default: EndpointMode.IPv4
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.3.8/node_modules/@smithy/credential-provider-imds/dist-es/utils/getInstanceMetadataEndpoint.js
|
|
189
|
+
var getInstanceMetadataEndpoint = async () => parseUrl(await getFromEndpointConfig() || await getFromEndpointModeConfig());
|
|
190
|
+
var getFromEndpointConfig = async () => loadConfig(ENDPOINT_CONFIG_OPTIONS)();
|
|
191
|
+
var getFromEndpointModeConfig = async () => {
|
|
192
|
+
const endpointMode = await loadConfig(ENDPOINT_MODE_CONFIG_OPTIONS)();
|
|
193
|
+
switch (endpointMode) {
|
|
194
|
+
case EndpointMode.IPv4:
|
|
195
|
+
return Endpoint.IPv4;
|
|
196
|
+
case EndpointMode.IPv6:
|
|
197
|
+
return Endpoint.IPv6;
|
|
198
|
+
default:
|
|
199
|
+
throw new Error(`Unsupported endpoint mode: ${endpointMode}. Select from ${Object.values(EndpointMode)}`);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.3.8/node_modules/@smithy/credential-provider-imds/dist-es/utils/getExtendedInstanceMetadataCredentials.js
|
|
204
|
+
var STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60;
|
|
205
|
+
var STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60;
|
|
206
|
+
var STATIC_STABILITY_DOC_URL = "https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html";
|
|
207
|
+
var getExtendedInstanceMetadataCredentials = (credentials, logger) => {
|
|
208
|
+
const refreshInterval = STATIC_STABILITY_REFRESH_INTERVAL_SECONDS + Math.floor(Math.random() * STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS);
|
|
209
|
+
const newExpiration = new Date(Date.now() + refreshInterval * 1e3);
|
|
210
|
+
logger.warn(`Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(newExpiration)}.
|
|
211
|
+
For more information, please visit: ` + STATIC_STABILITY_DOC_URL);
|
|
212
|
+
const originalExpiration = credentials.originalExpiration ?? credentials.expiration;
|
|
213
|
+
return {
|
|
214
|
+
...credentials,
|
|
215
|
+
...originalExpiration ? { originalExpiration } : {},
|
|
216
|
+
expiration: newExpiration
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.3.8/node_modules/@smithy/credential-provider-imds/dist-es/utils/staticStabilityProvider.js
|
|
221
|
+
var staticStabilityProvider = (provider, options = {}) => {
|
|
222
|
+
const logger = options?.logger || console;
|
|
223
|
+
let pastCredentials;
|
|
224
|
+
return async () => {
|
|
225
|
+
let credentials;
|
|
226
|
+
try {
|
|
227
|
+
credentials = await provider();
|
|
228
|
+
if (credentials.expiration && credentials.expiration.getTime() < Date.now()) {
|
|
229
|
+
credentials = getExtendedInstanceMetadataCredentials(credentials, logger);
|
|
230
|
+
}
|
|
231
|
+
} catch (e) {
|
|
232
|
+
if (pastCredentials) {
|
|
233
|
+
logger.warn("Credential renew failed: ", e);
|
|
234
|
+
credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger);
|
|
235
|
+
} else {
|
|
236
|
+
throw e;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
pastCredentials = credentials;
|
|
240
|
+
return credentials;
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.3.8/node_modules/@smithy/credential-provider-imds/dist-es/fromInstanceMetadata.js
|
|
245
|
+
var IMDS_PATH = "/latest/meta-data/iam/security-credentials/";
|
|
246
|
+
var IMDS_TOKEN_PATH = "/latest/api/token";
|
|
247
|
+
var AWS_EC2_METADATA_V1_DISABLED = "AWS_EC2_METADATA_V1_DISABLED";
|
|
248
|
+
var PROFILE_AWS_EC2_METADATA_V1_DISABLED = "ec2_metadata_v1_disabled";
|
|
249
|
+
var X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token";
|
|
250
|
+
var fromInstanceMetadata = (init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger });
|
|
251
|
+
var getInstanceMetadataProvider = (init = {}) => {
|
|
252
|
+
let disableFetchToken = false;
|
|
253
|
+
const { logger, profile } = init;
|
|
254
|
+
const { timeout, maxRetries } = providerConfigFromInit(init);
|
|
255
|
+
const getCredentials = async (maxRetries2, options) => {
|
|
256
|
+
const isImdsV1Fallback = disableFetchToken || options.headers?.[X_AWS_EC2_METADATA_TOKEN] == null;
|
|
257
|
+
if (isImdsV1Fallback) {
|
|
258
|
+
let fallbackBlockedFromProfile = false;
|
|
259
|
+
let fallbackBlockedFromProcessEnv = false;
|
|
260
|
+
const configValue = await loadConfig({
|
|
261
|
+
environmentVariableSelector: (env) => {
|
|
262
|
+
const envValue = env[AWS_EC2_METADATA_V1_DISABLED];
|
|
263
|
+
fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false";
|
|
264
|
+
if (envValue === void 0) {
|
|
265
|
+
throw new CredentialsProviderError(`${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, { logger: init.logger });
|
|
266
|
+
}
|
|
267
|
+
return fallbackBlockedFromProcessEnv;
|
|
268
|
+
},
|
|
269
|
+
configFileSelector: (profile2) => {
|
|
270
|
+
const profileValue = profile2[PROFILE_AWS_EC2_METADATA_V1_DISABLED];
|
|
271
|
+
fallbackBlockedFromProfile = !!profileValue && profileValue !== "false";
|
|
272
|
+
return fallbackBlockedFromProfile;
|
|
273
|
+
},
|
|
274
|
+
default: false
|
|
275
|
+
}, {
|
|
276
|
+
profile
|
|
277
|
+
})();
|
|
278
|
+
if (init.ec2MetadataV1Disabled || configValue) {
|
|
279
|
+
const causes = [];
|
|
280
|
+
if (init.ec2MetadataV1Disabled)
|
|
281
|
+
causes.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");
|
|
282
|
+
if (fallbackBlockedFromProfile)
|
|
283
|
+
causes.push(`config file profile (${PROFILE_AWS_EC2_METADATA_V1_DISABLED})`);
|
|
284
|
+
if (fallbackBlockedFromProcessEnv)
|
|
285
|
+
causes.push(`process environment variable (${AWS_EC2_METADATA_V1_DISABLED})`);
|
|
286
|
+
throw new InstanceMetadataV1FallbackError(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${causes.join(", ")}].`);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
const imdsProfile = (await retry(async () => {
|
|
290
|
+
let profile2;
|
|
291
|
+
try {
|
|
292
|
+
profile2 = await getProfile(options);
|
|
293
|
+
} catch (err) {
|
|
294
|
+
if (err.statusCode === 401) {
|
|
295
|
+
disableFetchToken = false;
|
|
296
|
+
}
|
|
297
|
+
throw err;
|
|
298
|
+
}
|
|
299
|
+
return profile2;
|
|
300
|
+
}, maxRetries2)).trim();
|
|
301
|
+
return retry(async () => {
|
|
302
|
+
let creds;
|
|
303
|
+
try {
|
|
304
|
+
creds = await getCredentialsFromProfile(imdsProfile, options, init);
|
|
305
|
+
} catch (err) {
|
|
306
|
+
if (err.statusCode === 401) {
|
|
307
|
+
disableFetchToken = false;
|
|
308
|
+
}
|
|
309
|
+
throw err;
|
|
310
|
+
}
|
|
311
|
+
return creds;
|
|
312
|
+
}, maxRetries2);
|
|
313
|
+
};
|
|
314
|
+
return async () => {
|
|
315
|
+
const endpoint = await getInstanceMetadataEndpoint();
|
|
316
|
+
if (disableFetchToken) {
|
|
317
|
+
logger?.debug("AWS SDK Instance Metadata", "using v1 fallback (no token fetch)");
|
|
318
|
+
return getCredentials(maxRetries, { ...endpoint, timeout });
|
|
319
|
+
} else {
|
|
320
|
+
let token;
|
|
321
|
+
try {
|
|
322
|
+
token = (await getMetadataToken({ ...endpoint, timeout })).toString();
|
|
323
|
+
} catch (error) {
|
|
324
|
+
if (error?.statusCode === 400) {
|
|
325
|
+
throw Object.assign(error, {
|
|
326
|
+
message: "EC2 Metadata token request returned error"
|
|
327
|
+
});
|
|
328
|
+
} else if (error.message === "TimeoutError" || [403, 404, 405].includes(error.statusCode)) {
|
|
329
|
+
disableFetchToken = true;
|
|
330
|
+
}
|
|
331
|
+
logger?.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)");
|
|
332
|
+
return getCredentials(maxRetries, { ...endpoint, timeout });
|
|
333
|
+
}
|
|
334
|
+
return getCredentials(maxRetries, {
|
|
335
|
+
...endpoint,
|
|
336
|
+
headers: {
|
|
337
|
+
[X_AWS_EC2_METADATA_TOKEN]: token
|
|
338
|
+
},
|
|
339
|
+
timeout
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
var getMetadataToken = async (options) => httpRequest({
|
|
345
|
+
...options,
|
|
346
|
+
path: IMDS_TOKEN_PATH,
|
|
347
|
+
method: "PUT",
|
|
348
|
+
headers: {
|
|
349
|
+
"x-aws-ec2-metadata-token-ttl-seconds": "21600"
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
var getProfile = async (options) => (await httpRequest({ ...options, path: IMDS_PATH })).toString();
|
|
353
|
+
var getCredentialsFromProfile = async (profile, options, init) => {
|
|
354
|
+
const credentialsResponse = JSON.parse((await httpRequest({
|
|
355
|
+
...options,
|
|
356
|
+
path: IMDS_PATH + profile
|
|
357
|
+
})).toString());
|
|
358
|
+
if (!isImdsCredentials(credentialsResponse)) {
|
|
359
|
+
throw new CredentialsProviderError("Invalid response received from instance metadata service.", {
|
|
360
|
+
logger: init.logger
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
return fromImdsCredentials(credentialsResponse);
|
|
364
|
+
};
|
|
365
|
+
export {
|
|
366
|
+
DEFAULT_MAX_RETRIES,
|
|
367
|
+
DEFAULT_TIMEOUT,
|
|
368
|
+
ENV_CMDS_AUTH_TOKEN,
|
|
369
|
+
ENV_CMDS_FULL_URI,
|
|
370
|
+
ENV_CMDS_RELATIVE_URI,
|
|
371
|
+
Endpoint,
|
|
372
|
+
fromContainerMetadata,
|
|
373
|
+
fromInstanceMetadata,
|
|
374
|
+
getInstanceMetadataEndpoint,
|
|
375
|
+
httpRequest,
|
|
376
|
+
providerConfigFromInit
|
|
377
|
+
};
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
--
|
|
19
19
|
-- Idempotent: re-running with the same :computer_id is a no-op.
|
|
20
20
|
--
|
|
21
|
-
--
|
|
21
|
+
-- data-only-migration
|
|
22
|
+
-- This is a data backfill, not a schema change.
|
|
22
23
|
|
|
23
24
|
\set ON_ERROR_STOP on
|
|
24
25
|
|
|
@@ -60,6 +60,16 @@
|
|
|
60
60
|
--
|
|
61
61
|
-- Markers (consumed by scripts/db-migrate-manual.sh):
|
|
62
62
|
--
|
|
63
|
+
-- moves-owner: public.tenant_entity_pages -> brain.pages
|
|
64
|
+
-- moves-owner: public.tenant_entity_page_sections -> brain.page_sections
|
|
65
|
+
-- moves-owner: public.tenant_entity_page_links -> brain.page_links
|
|
66
|
+
-- moves-owner: public.tenant_entity_page_aliases -> brain.page_aliases
|
|
67
|
+
-- moves-owner: public.tenant_entity_section_sources -> brain.section_sources
|
|
68
|
+
-- moves-owner: public.tenant_entity_external_refs -> brain.external_refs
|
|
69
|
+
-- drops: public.uq_tenant_entity_pages_tenant_type_subtype_slug
|
|
70
|
+
-- drops: public.idx_tenant_entity_pages_search_tsv
|
|
71
|
+
-- drops: public.uq_tenant_entity_section_sources_section_kind_ref
|
|
72
|
+
-- creates-trigger: brain.section_sources.trg_tenant_entity_section_sources_tenant
|
|
63
73
|
-- creates: brain.pages
|
|
64
74
|
-- creates: brain.page_sections
|
|
65
75
|
-- creates: brain.page_links
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
-- drops: public.computer_assignments
|
|
5
5
|
-- drops: public.computer_snapshots
|
|
6
6
|
-- drops: public.computers
|
|
7
|
+
-- drops-constraint: public.eval_runs.eval_runs_computer_id_computers_id_fk
|
|
8
|
+
-- drops-constraint: public.thread_idle_learning_state.thread_idle_learning_state_computer_id_computers_id_fk
|
|
9
|
+
-- drops-constraint: public.thread_idle_learning_runs.thread_idle_learning_runs_computer_id_computers_id_fk
|
|
7
10
|
--
|
|
8
11
|
-- Kill the legacy Computer feature. All product surfaces (admin, Spaces,
|
|
9
12
|
-- mobile, CLI), Lambda handlers (computer-runtime, computer-manager,
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
--
|
|
16
16
|
-- creates-constraint: compliance.audit_outbox.audit_outbox_event_type_prefix_v3
|
|
17
17
|
-- creates-constraint: compliance.audit_events.audit_events_event_type_prefix_v3
|
|
18
|
+
-- drops-constraint: compliance.audit_outbox.audit_outbox_event_type_prefix_v2
|
|
19
|
+
-- drops-constraint: compliance.audit_events.audit_events_event_type_prefix_v2
|
|
18
20
|
|
|
19
21
|
BEGIN;
|
|
20
22
|
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
-- drops-column: public.agent_loops.cost_per_accepted_run_usd_cents
|
|
49
49
|
-- drops-column: public.agent_loop_versions.judge_spec
|
|
50
50
|
-- drops-column: public.agent_loop_versions.evidence_policy
|
|
51
|
+
-- drops: public.view_agent_loop_versions_judge_evidence_nullable
|
|
51
52
|
|
|
52
53
|
\set ON_ERROR_STOP on
|
|
53
54
|
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
-- drops-column: public.agent_loop_versions.worker_spec
|
|
28
28
|
-- drops-column: public.agent_loop_versions.loop_policy
|
|
29
29
|
-- creates: public.view_agent_loop_versions_target_spec_required
|
|
30
|
+
-- drops: public.view_agent_loop_versions_goal_worker_policy_nullable
|
|
30
31
|
|
|
31
32
|
\set ON_ERROR_STOP on
|
|
32
33
|
|
|
@@ -215,11 +215,6 @@ BEGIN
|
|
|
215
215
|
ELSE
|
|
216
216
|
missing := missing || 'agent_capabilities'::text;
|
|
217
217
|
END IF;
|
|
218
|
-
IF to_regclass('public.agent_knowledge_bases') IS NOT NULL THEN
|
|
219
|
-
GRANT SELECT ON public.agent_knowledge_bases TO analyst_reader;
|
|
220
|
-
ELSE
|
|
221
|
-
missing := missing || 'agent_knowledge_bases'::text;
|
|
222
|
-
END IF;
|
|
223
218
|
IF to_regclass('public.agent_loop_iterations') IS NOT NULL THEN
|
|
224
219
|
GRANT SELECT ON public.agent_loop_iterations TO analyst_reader;
|
|
225
220
|
ELSE
|
|
@@ -525,16 +520,6 @@ BEGIN
|
|
|
525
520
|
ELSE
|
|
526
521
|
missing := missing || 'inbox_items'::text;
|
|
527
522
|
END IF;
|
|
528
|
-
IF to_regclass('public.knowledge_base_documents') IS NOT NULL THEN
|
|
529
|
-
GRANT SELECT ON public.knowledge_base_documents TO analyst_reader;
|
|
530
|
-
ELSE
|
|
531
|
-
missing := missing || 'knowledge_base_documents'::text;
|
|
532
|
-
END IF;
|
|
533
|
-
IF to_regclass('public.knowledge_bases') IS NOT NULL THEN
|
|
534
|
-
GRANT SELECT ON public.knowledge_bases TO analyst_reader;
|
|
535
|
-
ELSE
|
|
536
|
-
missing := missing || 'knowledge_bases'::text;
|
|
537
|
-
END IF;
|
|
538
523
|
IF to_regclass('public.linked_task_events') IS NOT NULL THEN
|
|
539
524
|
GRANT SELECT ON public.linked_task_events TO analyst_reader;
|
|
540
525
|
ELSE
|
|
@@ -825,11 +810,6 @@ BEGIN
|
|
|
825
810
|
ELSE
|
|
826
811
|
missing := missing || 'space_integrations'::text;
|
|
827
812
|
END IF;
|
|
828
|
-
IF to_regclass('public.space_knowledge_bases') IS NOT NULL THEN
|
|
829
|
-
GRANT SELECT ON public.space_knowledge_bases TO analyst_reader;
|
|
830
|
-
ELSE
|
|
831
|
-
missing := missing || 'space_knowledge_bases'::text;
|
|
832
|
-
END IF;
|
|
833
813
|
IF to_regclass('public.space_mcp_servers') IS NOT NULL THEN
|
|
834
814
|
GRANT SELECT ON public.space_mcp_servers TO analyst_reader;
|
|
835
815
|
ELSE
|
|
@@ -967,6 +947,12 @@ BEGIN
|
|
|
967
947
|
ELSE
|
|
968
948
|
missing := missing || 'threads'::text;
|
|
969
949
|
END IF;
|
|
950
|
+
IF to_regclass('public.tool_execution_events') IS NOT NULL THEN
|
|
951
|
+
REVOKE ALL PRIVILEGES ON public.tool_execution_events FROM analyst_reader;
|
|
952
|
+
GRANT SELECT (created_at, duration_ms, error_preview, event_type, id, idempotency_key, input_preview, operation, output_preview, policy_decision_id, policy_revision, principal_id, principal_type, provider_cost_usd, provider_request_id, tenant_id, thread_id, tool_use_id, turn_id) ON public.tool_execution_events TO analyst_reader;
|
|
953
|
+
ELSE
|
|
954
|
+
missing := missing || 'tool_execution_events'::text;
|
|
955
|
+
END IF;
|
|
970
956
|
IF to_regclass('public.trace_cost_reconciliation_facts') IS NOT NULL THEN
|
|
971
957
|
GRANT SELECT ON public.trace_cost_reconciliation_facts TO analyst_reader;
|
|
972
958
|
ELSE
|
|
@@ -987,6 +973,16 @@ BEGIN
|
|
|
987
973
|
ELSE
|
|
988
974
|
missing := missing || 'trace_source_evidence'::text;
|
|
989
975
|
END IF;
|
|
976
|
+
IF to_regclass('public.twin_materialization_suggestions') IS NOT NULL THEN
|
|
977
|
+
GRANT SELECT ON public.twin_materialization_suggestions TO analyst_reader;
|
|
978
|
+
ELSE
|
|
979
|
+
missing := missing || 'twin_materialization_suggestions'::text;
|
|
980
|
+
END IF;
|
|
981
|
+
IF to_regclass('public.user_brain_claims') IS NOT NULL THEN
|
|
982
|
+
GRANT SELECT ON public.user_brain_claims TO analyst_reader;
|
|
983
|
+
ELSE
|
|
984
|
+
missing := missing || 'user_brain_claims'::text;
|
|
985
|
+
END IF;
|
|
990
986
|
IF to_regclass('public.user_model_approvals') IS NOT NULL THEN
|
|
991
987
|
GRANT SELECT ON public.user_model_approvals TO analyst_reader;
|
|
992
988
|
ELSE
|
|
@@ -1112,6 +1108,7 @@ BEGIN
|
|
|
1112
1108
|
RAISE WARNING 'analyst grants skipped for tables missing on this database: %', missing;
|
|
1113
1109
|
END IF;
|
|
1114
1110
|
END $$;
|
|
1111
|
+
|
|
1115
1112
|
-- END GENERATED ANALYST GRANTS
|
|
1116
1113
|
|
|
1117
1114
|
COMMIT;
|
|
@@ -146,15 +146,6 @@ BEGIN
|
|
|
146
146
|
ELSE
|
|
147
147
|
missing := missing || 'agent_capabilities'::text;
|
|
148
148
|
END IF;
|
|
149
|
-
IF to_regclass('public.agent_knowledge_bases') IS NOT NULL THEN
|
|
150
|
-
ALTER TABLE public.agent_knowledge_bases ENABLE ROW LEVEL SECURITY;
|
|
151
|
-
DROP POLICY IF EXISTS analyst_tenant_isolation ON public.agent_knowledge_bases;
|
|
152
|
-
CREATE POLICY analyst_tenant_isolation ON public.agent_knowledge_bases
|
|
153
|
-
FOR SELECT TO analyst_reader
|
|
154
|
-
USING (tenant_id = current_setting('thinkwork.analyst_tenant', true)::uuid);
|
|
155
|
-
ELSE
|
|
156
|
-
missing := missing || 'agent_knowledge_bases'::text;
|
|
157
|
-
END IF;
|
|
158
149
|
IF to_regclass('public.agent_loop_iterations') IS NOT NULL THEN
|
|
159
150
|
ALTER TABLE public.agent_loop_iterations ENABLE ROW LEVEL SECURITY;
|
|
160
151
|
DROP POLICY IF EXISTS analyst_tenant_isolation ON public.agent_loop_iterations;
|
|
@@ -695,24 +686,6 @@ BEGIN
|
|
|
695
686
|
ELSE
|
|
696
687
|
missing := missing || 'inbox_items'::text;
|
|
697
688
|
END IF;
|
|
698
|
-
IF to_regclass('public.knowledge_base_documents') IS NOT NULL THEN
|
|
699
|
-
ALTER TABLE public.knowledge_base_documents ENABLE ROW LEVEL SECURITY;
|
|
700
|
-
DROP POLICY IF EXISTS analyst_tenant_isolation ON public.knowledge_base_documents;
|
|
701
|
-
CREATE POLICY analyst_tenant_isolation ON public.knowledge_base_documents
|
|
702
|
-
FOR SELECT TO analyst_reader
|
|
703
|
-
USING (tenant_id = current_setting('thinkwork.analyst_tenant', true)::uuid);
|
|
704
|
-
ELSE
|
|
705
|
-
missing := missing || 'knowledge_base_documents'::text;
|
|
706
|
-
END IF;
|
|
707
|
-
IF to_regclass('public.knowledge_bases') IS NOT NULL THEN
|
|
708
|
-
ALTER TABLE public.knowledge_bases ENABLE ROW LEVEL SECURITY;
|
|
709
|
-
DROP POLICY IF EXISTS analyst_tenant_isolation ON public.knowledge_bases;
|
|
710
|
-
CREATE POLICY analyst_tenant_isolation ON public.knowledge_bases
|
|
711
|
-
FOR SELECT TO analyst_reader
|
|
712
|
-
USING (tenant_id = current_setting('thinkwork.analyst_tenant', true)::uuid);
|
|
713
|
-
ELSE
|
|
714
|
-
missing := missing || 'knowledge_bases'::text;
|
|
715
|
-
END IF;
|
|
716
689
|
IF to_regclass('public.linked_task_events') IS NOT NULL THEN
|
|
717
690
|
ALTER TABLE public.linked_task_events ENABLE ROW LEVEL SECURITY;
|
|
718
691
|
DROP POLICY IF EXISTS analyst_tenant_isolation ON public.linked_task_events;
|
|
@@ -1217,15 +1190,6 @@ BEGIN
|
|
|
1217
1190
|
ELSE
|
|
1218
1191
|
missing := missing || 'space_integrations'::text;
|
|
1219
1192
|
END IF;
|
|
1220
|
-
IF to_regclass('public.space_knowledge_bases') IS NOT NULL THEN
|
|
1221
|
-
ALTER TABLE public.space_knowledge_bases ENABLE ROW LEVEL SECURITY;
|
|
1222
|
-
DROP POLICY IF EXISTS analyst_tenant_isolation ON public.space_knowledge_bases;
|
|
1223
|
-
CREATE POLICY analyst_tenant_isolation ON public.space_knowledge_bases
|
|
1224
|
-
FOR SELECT TO analyst_reader
|
|
1225
|
-
USING (tenant_id = current_setting('thinkwork.analyst_tenant', true)::uuid);
|
|
1226
|
-
ELSE
|
|
1227
|
-
missing := missing || 'space_knowledge_bases'::text;
|
|
1228
|
-
END IF;
|
|
1229
1193
|
IF to_regclass('public.space_mcp_servers') IS NOT NULL THEN
|
|
1230
1194
|
ALTER TABLE public.space_mcp_servers ENABLE ROW LEVEL SECURITY;
|
|
1231
1195
|
DROP POLICY IF EXISTS analyst_tenant_isolation ON public.space_mcp_servers;
|
|
@@ -1469,6 +1433,15 @@ BEGIN
|
|
|
1469
1433
|
ELSE
|
|
1470
1434
|
missing := missing || 'threads'::text;
|
|
1471
1435
|
END IF;
|
|
1436
|
+
IF to_regclass('public.tool_execution_events') IS NOT NULL THEN
|
|
1437
|
+
ALTER TABLE public.tool_execution_events ENABLE ROW LEVEL SECURITY;
|
|
1438
|
+
DROP POLICY IF EXISTS analyst_tenant_isolation ON public.tool_execution_events;
|
|
1439
|
+
CREATE POLICY analyst_tenant_isolation ON public.tool_execution_events
|
|
1440
|
+
FOR SELECT TO analyst_reader
|
|
1441
|
+
USING (tenant_id = current_setting('thinkwork.analyst_tenant', true)::uuid);
|
|
1442
|
+
ELSE
|
|
1443
|
+
missing := missing || 'tool_execution_events'::text;
|
|
1444
|
+
END IF;
|
|
1472
1445
|
IF to_regclass('public.trace_cost_reconciliation_facts') IS NOT NULL THEN
|
|
1473
1446
|
ALTER TABLE public.trace_cost_reconciliation_facts ENABLE ROW LEVEL SECURITY;
|
|
1474
1447
|
DROP POLICY IF EXISTS analyst_tenant_isolation ON public.trace_cost_reconciliation_facts;
|
|
@@ -1505,6 +1478,24 @@ BEGIN
|
|
|
1505
1478
|
ELSE
|
|
1506
1479
|
missing := missing || 'trace_source_evidence'::text;
|
|
1507
1480
|
END IF;
|
|
1481
|
+
IF to_regclass('public.twin_materialization_suggestions') IS NOT NULL THEN
|
|
1482
|
+
ALTER TABLE public.twin_materialization_suggestions ENABLE ROW LEVEL SECURITY;
|
|
1483
|
+
DROP POLICY IF EXISTS analyst_tenant_isolation ON public.twin_materialization_suggestions;
|
|
1484
|
+
CREATE POLICY analyst_tenant_isolation ON public.twin_materialization_suggestions
|
|
1485
|
+
FOR SELECT TO analyst_reader
|
|
1486
|
+
USING (tenant_id = current_setting('thinkwork.analyst_tenant', true)::uuid);
|
|
1487
|
+
ELSE
|
|
1488
|
+
missing := missing || 'twin_materialization_suggestions'::text;
|
|
1489
|
+
END IF;
|
|
1490
|
+
IF to_regclass('public.user_brain_claims') IS NOT NULL THEN
|
|
1491
|
+
ALTER TABLE public.user_brain_claims ENABLE ROW LEVEL SECURITY;
|
|
1492
|
+
DROP POLICY IF EXISTS analyst_tenant_isolation ON public.user_brain_claims;
|
|
1493
|
+
CREATE POLICY analyst_tenant_isolation ON public.user_brain_claims
|
|
1494
|
+
FOR SELECT TO analyst_reader
|
|
1495
|
+
USING (tenant_id = current_setting('thinkwork.analyst_tenant', true)::uuid);
|
|
1496
|
+
ELSE
|
|
1497
|
+
missing := missing || 'user_brain_claims'::text;
|
|
1498
|
+
END IF;
|
|
1508
1499
|
IF to_regclass('public.user_model_approvals') IS NOT NULL THEN
|
|
1509
1500
|
ALTER TABLE public.user_model_approvals ENABLE ROW LEVEL SECURITY;
|
|
1510
1501
|
DROP POLICY IF EXISTS analyst_tenant_isolation ON public.user_model_approvals;
|
|
@@ -1725,6 +1716,7 @@ BEGIN
|
|
|
1725
1716
|
RAISE WARNING 'analyst RLS skipped for tables missing on this database: %', missing;
|
|
1726
1717
|
END IF;
|
|
1727
1718
|
END $$;
|
|
1719
|
+
|
|
1728
1720
|
-- END GENERATED ANALYST RLS
|
|
1729
1721
|
|
|
1730
1722
|
COMMIT;
|
|
@@ -61,11 +61,38 @@
|
|
|
61
61
|
--
|
|
62
62
|
-- Markers (consumed by scripts/db-migrate-manual.sh):
|
|
63
63
|
--
|
|
64
|
+
-- moves-owner: public.knowledge_graph_ingest_runs -> kg.ingest_runs
|
|
65
|
+
-- moves-owner: public.knowledge_graph_entities -> kg.entities
|
|
66
|
+
-- moves-owner: public.knowledge_graph_relationships -> kg.relationships
|
|
67
|
+
-- moves-owner: public.knowledge_graph_evidence -> kg.evidence
|
|
68
|
+
-- moves-owner: public.knowledge_graph_observation_cursors -> kg.observation_cursors
|
|
64
69
|
-- creates: kg.ingest_runs
|
|
65
70
|
-- creates: kg.entities
|
|
66
71
|
-- creates: kg.relationships
|
|
67
72
|
-- creates: kg.evidence
|
|
68
73
|
-- creates: kg.observation_cursors
|
|
74
|
+
-- creates: kg.uq_kg_entities_run_graph_node
|
|
75
|
+
-- creates: kg.uq_kg_relationships_run_graph_edge
|
|
76
|
+
-- drops: public.uq_kg_entities_run_graph_node
|
|
77
|
+
-- drops: public.uq_kg_relationships_run_graph_edge
|
|
78
|
+
-- drops-constraint: public.knowledge_graph_ingest_runs.knowledge_graph_ingest_runs_status_allowed
|
|
79
|
+
-- drops-constraint: public.knowledge_graph_ingest_runs.knowledge_graph_ingest_runs_trigger_allowed
|
|
80
|
+
-- drops-constraint: public.knowledge_graph_ingest_runs.knowledge_graph_ingest_runs_source_kind_allowed
|
|
81
|
+
-- drops-constraint: public.knowledge_graph_ingest_runs.knowledge_graph_ingest_runs_thread_scope_required
|
|
82
|
+
-- drops-constraint: public.knowledge_graph_entities.knowledge_graph_entities_grounding_allowed
|
|
83
|
+
-- drops-constraint: public.knowledge_graph_entities.knowledge_graph_entities_provenance_allowed
|
|
84
|
+
-- drops-constraint: public.knowledge_graph_entities.knowledge_graph_entities_source_kind_allowed
|
|
85
|
+
-- drops-constraint: public.knowledge_graph_entities.knowledge_graph_entities_resolution_state_allowed
|
|
86
|
+
-- drops-constraint: public.knowledge_graph_relationships.knowledge_graph_relationships_grounding_allowed
|
|
87
|
+
-- drops-constraint: public.knowledge_graph_relationships.knowledge_graph_relationships_provenance_allowed
|
|
88
|
+
-- drops-constraint: public.knowledge_graph_relationships.knowledge_graph_relationships_source_kind_allowed
|
|
89
|
+
-- drops-constraint: public.knowledge_graph_evidence.knowledge_graph_evidence_source_kind_allowed
|
|
90
|
+
-- drops-constraint: public.knowledge_graph_evidence.knowledge_graph_evidence_evidence_source_kind_allowed
|
|
91
|
+
-- drops-constraint: public.knowledge_graph_evidence.knowledge_graph_evidence_subject_required
|
|
92
|
+
-- creates-trigger: kg.ingest_runs.knowledge_graph_ingest_runs_scope_guard
|
|
93
|
+
-- creates-trigger: kg.entities.knowledge_graph_entities_scope_guard
|
|
94
|
+
-- creates-trigger: kg.relationships.knowledge_graph_relationships_scope_guard
|
|
95
|
+
-- creates-trigger: kg.evidence.knowledge_graph_evidence_scope_guard
|
|
69
96
|
-- creates-constraint: kg.ingest_runs.ingest_runs_status_allowed
|
|
70
97
|
-- creates-constraint: kg.ingest_runs.ingest_runs_trigger_allowed
|
|
71
98
|
-- creates-constraint: kg.ingest_runs.ingest_runs_source_kind_allowed
|