@tickernelz/paperclip-pro-db 2026.925.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/adapter-auth-sessions-schema.test.d.ts +2 -0
- package/dist/adapter-auth-sessions-schema.test.d.ts.map +1 -0
- package/dist/adapter-auth-sessions-schema.test.js +112 -0
- package/dist/adapter-auth-sessions-schema.test.js.map +1 -0
- package/dist/agent-chat-migration.test.d.ts +2 -0
- package/dist/agent-chat-migration.test.d.ts.map +1 -0
- package/dist/agent-chat-migration.test.js +111 -0
- package/dist/agent-chat-migration.test.js.map +1 -0
- package/dist/agent-wakeup-requests-schema.test.d.ts +2 -0
- package/dist/agent-wakeup-requests-schema.test.d.ts.map +1 -0
- package/dist/agent-wakeup-requests-schema.test.js +24 -0
- package/dist/agent-wakeup-requests-schema.test.js.map +1 -0
- package/dist/backup-lib.d.ts +42 -0
- package/dist/backup-lib.d.ts.map +1 -0
- package/dist/backup-lib.js +921 -0
- package/dist/backup-lib.js.map +1 -0
- package/dist/backup-lib.test.d.ts +2 -0
- package/dist/backup-lib.test.d.ts.map +1 -0
- package/dist/backup-lib.test.js +502 -0
- package/dist/backup-lib.test.js.map +1 -0
- package/dist/backup.d.ts +2 -0
- package/dist/backup.d.ts.map +1 -0
- package/dist/backup.js +77 -0
- package/dist/backup.js.map +1 -0
- package/dist/better-auth-account-issuer-migration.test.d.ts +9 -0
- package/dist/better-auth-account-issuer-migration.test.d.ts.map +1 -0
- package/dist/better-auth-account-issuer-migration.test.js +113 -0
- package/dist/better-auth-account-issuer-migration.test.js.map +1 -0
- package/dist/built-in-agent-unique-marker-migration.test.d.ts +2 -0
- package/dist/built-in-agent-unique-marker-migration.test.d.ts.map +1 -0
- package/dist/built-in-agent-unique-marker-migration.test.js +102 -0
- package/dist/built-in-agent-unique-marker-migration.test.js.map +1 -0
- package/dist/chat-github-migration.test.d.ts +2 -0
- package/dist/chat-github-migration.test.d.ts.map +1 -0
- package/dist/chat-github-migration.test.js +34 -0
- package/dist/chat-github-migration.test.js.map +1 -0
- package/dist/chat-identity-migration-reconciliation.test.d.ts +2 -0
- package/dist/chat-identity-migration-reconciliation.test.d.ts.map +1 -0
- package/dist/chat-identity-migration-reconciliation.test.js +531 -0
- package/dist/chat-identity-migration-reconciliation.test.js.map +1 -0
- package/dist/chat-telegram-draft-ids-migration.test.d.ts +2 -0
- package/dist/chat-telegram-draft-ids-migration.test.d.ts.map +1 -0
- package/dist/chat-telegram-draft-ids-migration.test.js +71 -0
- package/dist/chat-telegram-draft-ids-migration.test.js.map +1 -0
- package/dist/chat-tenant-foreign-keys.test.d.ts +2 -0
- package/dist/chat-tenant-foreign-keys.test.d.ts.map +1 -0
- package/dist/chat-tenant-foreign-keys.test.js +140 -0
- package/dist/chat-tenant-foreign-keys.test.js.map +1 -0
- package/dist/check-migration-numbering.d.ts +2 -0
- package/dist/check-migration-numbering.d.ts.map +1 -0
- package/dist/check-migration-numbering.js +64 -0
- package/dist/check-migration-numbering.js.map +1 -0
- package/dist/check-migration-safety.d.ts +27 -0
- package/dist/check-migration-safety.d.ts.map +1 -0
- package/dist/check-migration-safety.js +811 -0
- package/dist/check-migration-safety.js.map +1 -0
- package/dist/check-migration-safety.test.d.ts +2 -0
- package/dist/check-migration-safety.test.d.ts.map +1 -0
- package/dist/check-migration-safety.test.js +391 -0
- package/dist/check-migration-safety.test.js.map +1 -0
- package/dist/client-options.test.d.ts +2 -0
- package/dist/client-options.test.d.ts.map +1 -0
- package/dist/client-options.test.js +88 -0
- package/dist/client-options.test.js.map +1 -0
- package/dist/client-teardown-registry.test.d.ts +2 -0
- package/dist/client-teardown-registry.test.d.ts.map +1 -0
- package/dist/client-teardown-registry.test.js +100 -0
- package/dist/client-teardown-registry.test.js.map +1 -0
- package/dist/client.d.ts +111 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +883 -0
- package/dist/client.js.map +1 -0
- package/dist/client.test.d.ts +2 -0
- package/dist/client.test.d.ts.map +1 -0
- package/dist/client.test.js +1759 -0
- package/dist/client.test.js.map +1 -0
- package/dist/company-secret-proposals-migration.test.d.ts +2 -0
- package/dist/company-secret-proposals-migration.test.d.ts.map +1 -0
- package/dist/company-secret-proposals-migration.test.js +40 -0
- package/dist/company-secret-proposals-migration.test.js.map +1 -0
- package/dist/connection-grants-phase2-migration.test.d.ts +2 -0
- package/dist/connection-grants-phase2-migration.test.d.ts.map +1 -0
- package/dist/connection-grants-phase2-migration.test.js +30 -0
- package/dist/connection-grants-phase2-migration.test.js.map +1 -0
- package/dist/connection-grants-phase4-migration.test.d.ts +2 -0
- package/dist/connection-grants-phase4-migration.test.d.ts.map +1 -0
- package/dist/connection-grants-phase4-migration.test.js +300 -0
- package/dist/connection-grants-phase4-migration.test.js.map +1 -0
- package/dist/connections-v3-schema-core-migration.test.d.ts +2 -0
- package/dist/connections-v3-schema-core-migration.test.d.ts.map +1 -0
- package/dist/connections-v3-schema-core-migration.test.js +98 -0
- package/dist/connections-v3-schema-core-migration.test.js.map +1 -0
- package/dist/decision-queue-migrations.test.d.ts +2 -0
- package/dist/decision-queue-migrations.test.d.ts.map +1 -0
- package/dist/decision-queue-migrations.test.js +78 -0
- package/dist/decision-queue-migrations.test.js.map +1 -0
- package/dist/embedded-postgres-error.d.ts +9 -0
- package/dist/embedded-postgres-error.d.ts.map +1 -0
- package/dist/embedded-postgres-error.js +73 -0
- package/dist/embedded-postgres-error.js.map +1 -0
- package/dist/embedded-postgres-error.test.d.ts +2 -0
- package/dist/embedded-postgres-error.test.d.ts.map +1 -0
- package/dist/embedded-postgres-error.test.js +25 -0
- package/dist/embedded-postgres-error.test.js.map +1 -0
- package/dist/embedded-postgres-lifecycle.d.ts +16 -0
- package/dist/embedded-postgres-lifecycle.d.ts.map +1 -0
- package/dist/embedded-postgres-lifecycle.js +43 -0
- package/dist/embedded-postgres-lifecycle.js.map +1 -0
- package/dist/embedded-postgres-lifecycle.test.d.ts +2 -0
- package/dist/embedded-postgres-lifecycle.test.d.ts.map +1 -0
- package/dist/embedded-postgres-lifecycle.test.js +64 -0
- package/dist/embedded-postgres-lifecycle.test.js.map +1 -0
- package/dist/embedded-postgres-native.d.ts +3 -0
- package/dist/embedded-postgres-native.d.ts.map +1 -0
- package/dist/embedded-postgres-native.js +83 -0
- package/dist/embedded-postgres-native.js.map +1 -0
- package/dist/embedded-postgres-native.test.d.ts +2 -0
- package/dist/embedded-postgres-native.test.d.ts.map +1 -0
- package/dist/embedded-postgres-native.test.js +49 -0
- package/dist/embedded-postgres-native.test.js.map +1 -0
- package/dist/environment-custom-images-schema.test.d.ts +2 -0
- package/dist/environment-custom-images-schema.test.d.ts.map +1 -0
- package/dist/environment-custom-images-schema.test.js +26 -0
- package/dist/environment-custom-images-schema.test.js.map +1 -0
- package/dist/external-objects-schema.test.d.ts +2 -0
- package/dist/external-objects-schema.test.d.ts.map +1 -0
- package/dist/external-objects-schema.test.js +46 -0
- package/dist/external-objects-schema.test.js.map +1 -0
- package/dist/heartbeat-context-snapshot-index-migration.test.d.ts +2 -0
- package/dist/heartbeat-context-snapshot-index-migration.test.d.ts.map +1 -0
- package/dist/heartbeat-context-snapshot-index-migration.test.js +60 -0
- package/dist/heartbeat-context-snapshot-index-migration.test.js.map +1 -0
- package/dist/inbox-archive-agent-policies-migration.test.d.ts +2 -0
- package/dist/inbox-archive-agent-policies-migration.test.d.ts.map +1 -0
- package/dist/inbox-archive-agent-policies-migration.test.js +155 -0
- package/dist/inbox-archive-agent-policies-migration.test.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/issue-comment-derived-attribution-migration.test.d.ts +2 -0
- package/dist/issue-comment-derived-attribution-migration.test.d.ts.map +1 -0
- package/dist/issue-comment-derived-attribution-migration.test.js +287 -0
- package/dist/issue-comment-derived-attribution-migration.test.js.map +1 -0
- package/dist/issue-comment-on-behalf-migration.test.d.ts +2 -0
- package/dist/issue-comment-on-behalf-migration.test.d.ts.map +1 -0
- package/dist/issue-comment-on-behalf-migration.test.js +146 -0
- package/dist/issue-comment-on-behalf-migration.test.js.map +1 -0
- package/dist/issue-thread-interaction-resolver-policy-migration.test.d.ts +2 -0
- package/dist/issue-thread-interaction-resolver-policy-migration.test.d.ts.map +1 -0
- package/dist/issue-thread-interaction-resolver-policy-migration.test.js +146 -0
- package/dist/issue-thread-interaction-resolver-policy-migration.test.js.map +1 -0
- package/dist/migrate.d.ts +2 -0
- package/dist/migrate.d.ts.map +1 -0
- package/dist/migrate.js +25 -0
- package/dist/migrate.js.map +1 -0
- package/dist/migration-runtime.d.ts +7 -0
- package/dist/migration-runtime.d.ts.map +1 -0
- package/dist/migration-runtime.js +159 -0
- package/dist/migration-runtime.js.map +1 -0
- package/dist/migration-safety-baseline.d.ts +135 -0
- package/dist/migration-safety-baseline.d.ts.map +1 -0
- package/dist/migration-safety-baseline.js +150 -0
- package/dist/migration-safety-baseline.js.map +1 -0
- package/dist/migration-snapshot-drift.test.d.ts +2 -0
- package/dist/migration-snapshot-drift.test.d.ts.map +1 -0
- package/dist/migration-snapshot-drift.test.js +55 -0
- package/dist/migration-snapshot-drift.test.js.map +1 -0
- package/dist/migration-status.d.ts +2 -0
- package/dist/migration-status.d.ts.map +1 -0
- package/dist/migration-status.js +55 -0
- package/dist/migration-status.js.map +1 -0
- package/dist/migrations/0000_mature_masked_marvel.sql +208 -0
- package/dist/migrations/0001_fast_northstar.sql +87 -0
- package/dist/migrations/0002_big_zaladane.sql +1 -0
- package/dist/migrations/0003_shallow_quentin_quire.sql +5 -0
- package/dist/migrations/0004_issue_identifiers.sql +28 -0
- package/dist/migrations/0005_chief_luke_cage.sql +19 -0
- package/dist/migrations/0006_overjoyed_mister_sinister.sql +36 -0
- package/dist/migrations/0007_new_quentin_quire.sql +20 -0
- package/dist/migrations/0008_amused_zzzax.sql +1 -0
- package/dist/migrations/0009_fast_jackal.sql +36 -0
- package/dist/migrations/0010_stale_justin_hammer.sql +37 -0
- package/dist/migrations/0011_windy_corsair.sql +18 -0
- package/dist/migrations/0012_perpetual_ser_duncan.sql +2 -0
- package/dist/migrations/0013_dashing_wasp.sql +4 -0
- package/dist/migrations/0014_many_mikhail_rasputin.sql +135 -0
- package/dist/migrations/0015_project_color_archived.sql +2 -0
- package/dist/migrations/0016_agent_icon.sql +1 -0
- package/dist/migrations/0017_tiresome_gabe_jones.sql +51 -0
- package/dist/migrations/0018_flat_sleepwalker.sql +26 -0
- package/dist/migrations/0019_public_victor_mancha.sql +18 -0
- package/dist/migrations/0020_white_anita_blake.sql +1 -0
- package/dist/migrations/0021_chief_vindicator.sql +1 -0
- package/dist/migrations/0022_company_brand_color.sql +1 -0
- package/dist/migrations/0023_fair_lethal_legion.sql +3 -0
- package/dist/migrations/0024_far_beast.sql +2 -0
- package/dist/migrations/0025_nasty_salo.sql +15 -0
- package/dist/migrations/0026_lying_pete_wisdom.sql +39 -0
- package/dist/migrations/0027_tranquil_tenebrous.sql +2 -0
- package/dist/migrations/0028_harsh_goliath.sql +54 -0
- package/dist/migrations/0029_plugin_tables.sql +177 -0
- package/dist/migrations/0030_rich_magneto.sql +12 -0
- package/dist/migrations/0031_zippy_magma.sql +51 -0
- package/dist/migrations/0032_pretty_doctor_octopus.sql +102 -0
- package/dist/migrations/0033_shiny_black_tarantula.sql +2 -0
- package/dist/migrations/0034_fat_dormammu.sql +2 -0
- package/dist/migrations/0035_marvelous_satana.sql +91 -0
- package/dist/migrations/0036_cheerful_nitro.sql +9 -0
- package/dist/migrations/0037_friendly_eddie_brock.sql +29 -0
- package/dist/migrations/0038_careless_iron_monger.sql +5 -0
- package/dist/migrations/0039_fat_magneto.sql +161 -0
- package/dist/migrations/0040_eager_shotgun.sql +5 -0
- package/dist/migrations/0041_curly_maria_hill.sql +1 -0
- package/dist/migrations/0042_spotty_the_renegades.sql +26 -0
- package/dist/migrations/0043_reflective_captain_universe.sql +6 -0
- package/dist/migrations/0044_illegal_toad.sql +56 -0
- package/dist/migrations/0045_workable_shockwave.sql +17 -0
- package/dist/migrations/0046_smooth_sentinels.sql +11 -0
- package/dist/migrations/0047_overjoyed_groot.sql +102 -0
- package/dist/migrations/0048_flashy_marrow.sql +1 -0
- package/dist/migrations/0049_flawless_abomination.sql +21 -0
- package/dist/migrations/0050_stiff_luckman.sql +1 -0
- package/dist/migrations/0051_young_korg.sql +5 -0
- package/dist/migrations/0052_mushy_trauma.sql +26 -0
- package/dist/migrations/0053_sharp_wild_child.sql +18 -0
- package/dist/migrations/0054_draft_routines.sql +2 -0
- package/dist/migrations/0055_kind_weapon_omega.sql +1 -0
- package/dist/migrations/0056_spooky_ultragirl.sql +22 -0
- package/dist/migrations/0057_tidy_join_requests.sql +57 -0
- package/dist/migrations/0058_wealthy_starbolt.sql +6 -0
- package/dist/migrations/0059_plugin_database_namespaces.sql +41 -0
- package/dist/migrations/0060_orange_annihilus.sql +50 -0
- package/dist/migrations/0061_lively_thor_girl.sql +3 -0
- package/dist/migrations/0062_routine_run_dispatch_fingerprint.sql +9 -0
- package/dist/migrations/0063_issue_thread_interactions.sql +65 -0
- package/dist/migrations/0064_issue_thread_interaction_idempotency.sql +4 -0
- package/dist/migrations/0065_environments.sql +50 -0
- package/dist/migrations/0066_issue_tree_holds.sql +107 -0
- package/dist/migrations/0067_agent_default_environment.sql +3 -0
- package/dist/migrations/0068_environment_local_driver_unique.sql +2 -0
- package/dist/migrations/0069_liveness_recovery_dedupe.sql +13 -0
- package/dist/migrations/0070_active_run_output_watchdog.sql +70 -0
- package/dist/migrations/0071_default_hire_approval_off.sql +1 -0
- package/dist/migrations/0072_large_sandman.sql +6 -0
- package/dist/migrations/0073_shiny_salo.sql +1 -0
- package/dist/migrations/0074_striped_genesis.sql +4 -0
- package/dist/migrations/0075_cultured_sebastian_shaw.sql +7 -0
- package/dist/migrations/0076_useful_elektra.sql +29 -0
- package/dist/migrations/0077_unusual_karnak.sql +140 -0
- package/dist/migrations/0078_white_darwin.sql +3 -0
- package/dist/migrations/0079_company_search_document_indexes.sql +2 -0
- package/dist/migrations/0080_company_search_fuzzystrmatch.sql +1 -0
- package/dist/migrations/0081_optimal_dormammu.sql +1 -0
- package/dist/migrations/0082_dry_vision.sql +124 -0
- package/dist/migrations/0083_company_secret_provider_configs.sql +51 -0
- package/dist/migrations/0084_issue_recovery_actions.sql +64 -0
- package/dist/migrations/0085_tranquil_the_executioner.sql +8 -0
- package/dist/migrations/0086_routine_env_runtime_contract.sql +8 -0
- package/dist/migrations/0087_backfill_environment_manage_human_defaults.sql +29 -0
- package/dist/migrations/0088_backfill_principal_access_compatibility.sql +75 -0
- package/dist/migrations/0089_cloud_upstreams.sql +71 -0
- package/dist/migrations/0090_resource_memberships.sql +55 -0
- package/dist/migrations/0091_old_swarm.sql +189 -0
- package/dist/migrations/0092_mighty_puma.sql +28 -0
- package/dist/migrations/0093_giant_green_goblin.sql +6 -0
- package/dist/migrations/0094_backfill_archived_company_agent_pauses.sql +10 -0
- package/dist/migrations/0095_issue_comment_tombstones.sql +15 -0
- package/dist/migrations/0096_document_annotation_issue_comment_links.sql +7 -0
- package/dist/migrations/0097_low_trust_source_trust.sql +4 -0
- package/dist/migrations/0098_project_icon.sql +1 -0
- package/dist/migrations/0099_skills_store_foundation.sql +121 -0
- package/dist/migrations/0100_skill_install_count_backfill.sql +3 -0
- package/dist/migrations/0101_plugin_company_id_tenant_isolation.sql +14 -0
- package/dist/migrations/0102_managed_sandbox_dedup_index.sql +33 -0
- package/dist/migrations/0103_agent_error_reason.sql +1 -0
- package/dist/migrations/0104_issue_watchdogs.sql +90 -0
- package/dist/migrations/0105_instance_scoped_environments.sql +170 -0
- package/dist/migrations/0106_external_object_references.sql +106 -0
- package/dist/migrations/0107_external_object_display_metadata.sql +5 -0
- package/dist/migrations/0108_workspace_operations_issue_id.sql +41 -0
- package/dist/migrations/0109_routine_description_annotations.sql +170 -0
- package/dist/migrations/0110_document_company_cascade.sql +31 -0
- package/dist/migrations/0111_backfill_skill_create_human_defaults.sql +29 -0
- package/dist/migrations/0112_rename_skill_create_permission_key.sql +30 -0
- package/dist/migrations/0113_pipeline_foundation.sql +335 -0
- package/dist/migrations/0114_pipeline_case_issue_unlinked_event.sql +3 -0
- package/dist/migrations/0115_pipeline_routine_origin.sql +3 -0
- package/dist/migrations/0116_pipeline_upstream_drift_event.sql +3 -0
- package/dist/migrations/0117_pipeline_transition_forced_event.sql +3 -0
- package/dist/migrations/0118_pipeline_case_agent_fanout.sql +3 -0
- package/dist/migrations/0119_pipeline_drift_acknowledged_event.sql +3 -0
- package/dist/migrations/0120_pipeline_stage_working_primitives.sql +19 -0
- package/dist/migrations/0121_pipeline_automation_retry_effects.sql +43 -0
- package/dist/migrations/0122_pipeline_case_documents.sql +28 -0
- package/dist/migrations/0123_document_annotation_source_trust.sql +1 -0
- package/dist/migrations/0124_agent_api_key_scope_config.sql +1 -0
- package/dist/migrations/0125_environment_custom_image_templates.sql +147 -0
- package/dist/migrations/0127_environment_custom_images_instance_scoped.sql +106 -0
- package/dist/migrations/0128_user_specific_secrets.sql +178 -0
- package/dist/migrations/0129_agent_api_key_responsible_user.sql +41 -0
- package/dist/migrations/0131_repair_run_responsible_user_context_refs.sql +67 -0
- package/dist/migrations/0132_issue_comment_derived_attribution_fast.sql +82 -0
- package/dist/migrations/0133_resource_membership_stars.sql +7 -0
- package/dist/migrations/0134_run_responsible_user_invariant.sql +211 -0
- package/dist/migrations/0135_repair_run_responsible_user_updated_at_sweep.sql +84 -0
- package/dist/migrations/0136_acpx_default_engine_migration.sql +97 -0
- package/dist/migrations/0137_skill_studio_server_foundation.sql +76 -0
- package/dist/migrations/0138_skill_studio_run_retention.sql +5 -0
- package/dist/migrations/0139_skill_studio_run_templates.sql +44 -0
- package/dist/migrations/0140_built_in_managed_resources.sql +43 -0
- package/dist/migrations/0141_heartbeat_runs_company_created_at_index.sql +2 -0
- package/dist/migrations/0142_company_search_sort_indexes.sql +3 -0
- package/dist/migrations/0143_cases_foundation.sql +248 -0
- package/dist/migrations/0144_case_document_annotations.sql +31 -0
- package/dist/migrations/0145_inbox_dismissal_snooze_kind.sql +15 -0
- package/dist/migrations/0146_routine_activity_gate.sql +3 -0
- package/dist/migrations/0147_cost_event_status.sql +1 -0
- package/dist/migrations/0148_tool_access_mcp_connections.sql +126 -0
- package/dist/migrations/0149_agent_access_phase2_contracts.sql +612 -0
- package/dist/migrations/0150_tool_invocation_catalog_snapshots.sql +2 -0
- package/dist/migrations/0151_tool_gateway_sessions.sql +38 -0
- package/dist/migrations/0152_tool_connection_application_no_cascade.sql +18 -0
- package/dist/migrations/0153_tool_stdio_command_templates.sql +32 -0
- package/dist/migrations/0154_tool_oauth_states.sql +36 -0
- package/dist/migrations/0155_tool_oauth_state_actor_binding.sql +5 -0
- package/dist/migrations/0156_tool_oauth_state_session_binding.sql +1 -0
- package/dist/migrations/0157_tool_profile_new_tools_review.sql +1 -0
- package/dist/migrations/0158_tool_invocation_connected_mcp_metadata.sql +4 -0
- package/dist/migrations/0159_named_mcp_gateways.sql +72 -0
- package/dist/migrations/0160_mcp_gateway_contract_expansion.sql +176 -0
- package/dist/migrations/0161_environment_custom_image_company_scope_repair.sql +8 -0
- package/dist/migrations/0162_tool_runtime_metric_counters.sql +27 -0
- package/dist/migrations/0163_secret_binding_projection_class.sql +2 -0
- package/dist/migrations/0164_plugin_config_company_scope.sql +117 -0
- package/dist/migrations/0165_connection_token_issuances.sql +64 -0
- package/dist/migrations/0166_smoke_lab_results.sql +51 -0
- package/dist/migrations/0167_environment_custom_image_instance_scope_cleanup.sql +32 -0
- package/dist/migrations/0168_tool_connection_installs.sql +56 -0
- package/dist/migrations/0169_tool_gateway_protocol_rate_limit_counters.sql +43 -0
- package/dist/migrations/0170_company_skill_policies.sql +12 -0
- package/dist/migrations/0171_issue_create_idempotency_keys.sql +19 -0
- package/dist/migrations/0172_inbox_archive_agent_policies.sql +42 -0
- package/dist/migrations/0173_inbox_policy_agent_cleanup.sql +22 -0
- package/dist/migrations/0174_folders.sql +46 -0
- package/dist/migrations/0175_nested_skill_folders.sql +232 -0
- package/dist/migrations/0176_issue_create_idempotency_key_expiry.sql +2 -0
- package/dist/migrations/0177_activity_log_responsible_user.sql +10 -0
- package/dist/migrations/0178_summary_slots.sql +37 -0
- package/dist/migrations/0179_summary_slot_failure_reason.sql +1 -0
- package/dist/migrations/0180_decision_training_examples.sql +23 -0
- package/dist/migrations/0181_decision_training_retention_policy.sql +2 -0
- package/dist/migrations/0182_connections_v3_schema_core.sql +74 -0
- package/dist/migrations/0183_connection_user_authorization_state.sql +6 -0
- package/dist/migrations/0184_routable_blocked.sql +3 -0
- package/dist/migrations/0185_status_cards.sql +111 -0
- package/dist/migrations/0186_status_card_compile_provenance.sql +3 -0
- package/dist/migrations/0187_status_card_pending_change_hash.sql +1 -0
- package/dist/migrations/0188_status_card_generation_issue_index.sql +1 -0
- package/dist/migrations/0189_status_card_agent.sql +6 -0
- package/dist/migrations/0190_status_card_single_prompt.sql +2 -0
- package/dist/migrations/0191_status_card_mentioned_issue_ids.sql +1 -0
- package/dist/migrations/0192_task_watchdog_stop_snapshots.sql +2 -0
- package/dist/migrations/0193_document_memberships.sql +15 -0
- package/dist/migrations/0194_company_skill_releases.sql +4 -0
- package/dist/migrations/0195_built_in_agent_unique_marker.sql +53 -0
- package/dist/migrations/0196_drop_cloud_upstream_tables.sql +9 -0
- package/dist/migrations/0197_decisions_v1.sql +106 -0
- package/dist/migrations/0198_decision_queues_and_triage.sql +161 -0
- package/dist/migrations/0199_decision_queue_composite_key.sql +10 -0
- package/dist/migrations/0200_yellow_maria_hill.sql +64 -0
- package/dist/migrations/0201_concerned_captain_midlands.sql +1 -0
- package/dist/migrations/0202_eminent_marvel_zombies.sql +1 -0
- package/dist/migrations/0203_interaction_resolver_governance.sql +8 -0
- package/dist/migrations/0204_interaction_addressee.sql +6 -0
- package/dist/migrations/0205_narrow_shiva.sql +10 -0
- package/dist/migrations/0206_review_path_recovery_idempotency_index.sql +2 -0
- package/dist/migrations/0207_moaning_amazoness.sql +94 -0
- package/dist/migrations/0208_keen_sharon_carter.sql +1 -0
- package/dist/migrations/0209_heartbeat_context_snapshot_indexes.sql +4 -0
- package/dist/migrations/0210_heartbeat_context_taskkey_index.sql +1 -0
- package/dist/migrations/0211_bright_morg.sql +1 -0
- package/dist/migrations/0212_onboarding_first_task_unique.sql +3 -0
- package/dist/migrations/0213_complete_mystique.sql +24 -0
- package/dist/migrations/0214_lively_lord_tyger.sql +22 -0
- package/dist/migrations/0215_flat_daimon_hellstrom.sql +1 -0
- package/dist/migrations/0216_company_onboarding_seeds.sql +42 -0
- package/dist/migrations/0217_yielding_starbolt.sql +21 -0
- package/dist/migrations/0218_mushy_jack_murdock.sql +38 -0
- package/dist/migrations/0219_runtime_service_exposure.sql +3 -0
- package/dist/migrations/0220_execution_workspace_runtime_leases.sql +26 -0
- package/dist/migrations/0221_swift_justin_hammer.sql +20 -0
- package/dist/migrations/0222_orphan_cleanup_env_reference_survives_delete.sql +4 -0
- package/dist/migrations/0223_robust_zaladane.sql +6 -0
- package/dist/migrations/0224_unified_adapter_auth_sessions.sql +18 -0
- package/dist/migrations/0225_drop_claude_setup_token_sessions.sql +5 -0
- package/dist/migrations/0226_tan_colossus.sql +2 -0
- package/dist/migrations/0227_modern_pandemic.sql +410 -0
- package/dist/migrations/0228_nasty_grim_reaper.sql +59 -0
- package/dist/migrations/0229_drop_company_brand_color_and_attachment_max_bytes.sql +7 -0
- package/dist/migrations/0230_better_auth_account_issuer.sql +23 -0
- package/dist/migrations/0231_remove_app_connection_wide_includes.sql +10 -0
- package/dist/migrations/0232_fixed_hannibal_king.sql +202 -0
- package/dist/migrations/0233_living_dreaming_celestial.sql +13 -0
- package/dist/migrations/0234_provider_trace_records.sql +31 -0
- package/dist/migrations/0235_heartbeat_run_event_sequence_uniqueness.sql +28 -0
- package/dist/migrations/0236_remove_cheap_model_profiles.sql +108 -0
- package/dist/migrations/0237_clammy_colonel_america.sql +52 -0
- package/dist/migrations/0238_graceful_infant_terrible.sql +7 -0
- package/dist/migrations/0239_sturdy_santa_claus.sql +38 -0
- package/dist/migrations/0240_pink_fantastic_four.sql +25 -0
- package/dist/migrations/0241_conscious_adam_destine.sql +1 -0
- package/dist/migrations/0242_wide_lightspeed.sql +1 -0
- package/dist/migrations/0243_sleepy_metal_master.sql +1 -0
- package/dist/migrations/0244_organic_meltdown.sql +1 -0
- package/dist/migrations/0245_misty_nightshade.sql +3 -0
- package/dist/migrations/0246_nostalgic_medusa.sql +19 -0
- package/dist/migrations/0247_even_moon_knight.sql +2 -0
- package/dist/migrations/0248_small_manta.sql +36 -0
- package/dist/migrations/0249_fast_silverclaw.sql +33 -0
- package/dist/migrations/0250_exotic_dakota_north.sql +2 -0
- package/dist/migrations/0251_narrow_mastermind.sql +1 -0
- package/dist/migrations/0252_friendly_kate_bishop.sql +1 -0
- package/dist/migrations/0253_real_firebrand.sql +1 -0
- package/dist/migrations/0254_military_calypso.sql +3 -0
- package/dist/migrations/0255_previous_captain_america.sql +290 -0
- package/dist/migrations/0256_married_king_cobra.sql +3 -0
- package/dist/migrations/0257_bizarre_the_hunter.sql +8 -0
- package/dist/migrations/0258_typical_sauron.sql +2 -0
- package/dist/migrations/0259_tan_chat.sql +1 -0
- package/dist/migrations/0260_chat_interaction_wakeup_idempotency.sql +106 -0
- package/dist/migrations/0261_faulty_iceman.sql +4 -0
- package/dist/migrations/0262_lying_avengers.sql +3 -0
- package/dist/migrations/0263_nebulous_iron_lad.sql +3 -0
- package/dist/migrations/0264_cynical_hellcat.sql +3 -0
- package/dist/migrations/0265_chat_interaction_wakeup_provenance.sql +80 -0
- package/dist/migrations/0266_brave_living_mummy.sql +56 -0
- package/dist/migrations/0267_warm_wild_child.sql +8 -0
- package/dist/migrations/0268_lively_runaways.sql +1 -0
- package/dist/migrations/0269_fearless_young_avengers.sql +15 -0
- package/dist/migrations/0270_harsh_queen_noir.sql +12 -0
- package/dist/migrations/0271_woozy_silver_surfer.sql +1 -0
- package/dist/migrations/0272_light_kate_bishop.sql +98 -0
- package/dist/migrations/0273_aromatic_moondragon.sql +3 -0
- package/dist/migrations/0274_agent_chat.sql +33 -0
- package/dist/migrations/0275_easy_dragon_man.sql +5 -0
- package/dist/migrations/0276_hard_mandroid.sql +77 -0
- package/dist/migrations/0277_uneven_lady_deathstrike.sql +47 -0
- package/dist/migrations/0278_nappy_colonel_america.sql +6 -0
- package/dist/migrations/0279_tired_deathstrike.sql +3 -0
- package/dist/migrations/0280_unique_genesis.sql +11 -0
- package/dist/migrations/0281_true_boom_boom.sql +14 -0
- package/dist/migrations/0282_colossal_shocker.sql +2 -0
- package/dist/migrations/0283_jittery_psynapse.sql +81 -0
- package/dist/migrations/meta/_journal.json +1980 -0
- package/dist/native-runner-recovery-migration.test.d.ts +2 -0
- package/dist/native-runner-recovery-migration.test.d.ts.map +1 -0
- package/dist/native-runner-recovery-migration.test.js +121 -0
- package/dist/native-runner-recovery-migration.test.js.map +1 -0
- package/dist/nested-skill-folders-migration.test.d.ts +2 -0
- package/dist/nested-skill-folders-migration.test.d.ts.map +1 -0
- package/dist/nested-skill-folders-migration.test.js +106 -0
- package/dist/nested-skill-folders-migration.test.js.map +1 -0
- package/dist/pipelines-schema.test.d.ts +2 -0
- package/dist/pipelines-schema.test.d.ts.map +1 -0
- package/dist/pipelines-schema.test.js +205 -0
- package/dist/pipelines-schema.test.js.map +1 -0
- package/dist/postgres-connection-recovery.test.d.ts +2 -0
- package/dist/postgres-connection-recovery.test.d.ts.map +1 -0
- package/dist/postgres-connection-recovery.test.js +35 -0
- package/dist/postgres-connection-recovery.test.js.map +1 -0
- package/dist/question-response-delivery-migration.test.d.ts +2 -0
- package/dist/question-response-delivery-migration.test.d.ts.map +1 -0
- package/dist/question-response-delivery-migration.test.js +62 -0
- package/dist/question-response-delivery-migration.test.js.map +1 -0
- package/dist/run-event-payload.d.ts +30 -0
- package/dist/run-event-payload.d.ts.map +1 -0
- package/dist/run-event-payload.js +57 -0
- package/dist/run-event-payload.js.map +1 -0
- package/dist/run-event-payload.test.d.ts +2 -0
- package/dist/run-event-payload.test.d.ts.map +1 -0
- package/dist/run-event-payload.test.js +46 -0
- package/dist/run-event-payload.test.js.map +1 -0
- package/dist/run-identity-migration.test.d.ts +2 -0
- package/dist/run-identity-migration.test.d.ts.map +1 -0
- package/dist/run-identity-migration.test.js +60 -0
- package/dist/run-identity-migration.test.js.map +1 -0
- package/dist/runtime-config.d.ts +16 -0
- package/dist/runtime-config.d.ts.map +1 -0
- package/dist/runtime-config.js +168 -0
- package/dist/runtime-config.js.map +1 -0
- package/dist/runtime-config.test.d.ts +2 -0
- package/dist/runtime-config.test.d.ts.map +1 -0
- package/dist/runtime-config.test.js +111 -0
- package/dist/runtime-config.test.js.map +1 -0
- package/dist/schema/activity_log.d.ts +214 -0
- package/dist/schema/activity_log.d.ts.map +1 -0
- package/dist/schema/activity_log.js +25 -0
- package/dist/schema/activity_log.js.map +1 -0
- package/dist/schema/adapter_auth_sessions.d.ts +377 -0
- package/dist/schema/adapter_auth_sessions.d.ts.map +1 -0
- package/dist/schema/adapter_auth_sessions.js +88 -0
- package/dist/schema/adapter_auth_sessions.js.map +1 -0
- package/dist/schema/agent_api_keys.d.ts +204 -0
- package/dist/schema/agent_api_keys.d.ts.map +1 -0
- package/dist/schema/agent_api_keys.js +19 -0
- package/dist/schema/agent_api_keys.js.map +1 -0
- package/dist/schema/agent_config_revisions.d.ts +201 -0
- package/dist/schema/agent_config_revisions.d.ts.map +1 -0
- package/dist/schema/agent_config_revisions.js +20 -0
- package/dist/schema/agent_config_revisions.js.map +1 -0
- package/dist/schema/agent_memberships.d.ts +144 -0
- package/dist/schema/agent_memberships.d.ts.map +1 -0
- package/dist/schema/agent_memberships.js +19 -0
- package/dist/schema/agent_memberships.js.map +1 -0
- package/dist/schema/agent_runtime_state.d.ts +248 -0
- package/dist/schema/agent_runtime_state.d.ts.map +1 -0
- package/dist/schema/agent_runtime_state.js +23 -0
- package/dist/schema/agent_runtime_state.js.map +1 -0
- package/dist/schema/agent_task_sessions.d.ts +569 -0
- package/dist/schema/agent_task_sessions.d.ts.map +1 -0
- package/dist/schema/agent_task_sessions.js +51 -0
- package/dist/schema/agent_task_sessions.js.map +1 -0
- package/dist/schema/agent_wakeup_requests.d.ts +333 -0
- package/dist/schema/agent_wakeup_requests.d.ts.map +1 -0
- package/dist/schema/agent_wakeup_requests.js +56 -0
- package/dist/schema/agent_wakeup_requests.js.map +1 -0
- package/dist/schema/agents.d.ts +434 -0
- package/dist/schema/agents.d.ts.map +1 -0
- package/dist/schema/agents.js +35 -0
- package/dist/schema/agents.js.map +1 -0
- package/dist/schema/ai_connection_defaults.d.ts +132 -0
- package/dist/schema/ai_connection_defaults.d.ts.map +1 -0
- package/dist/schema/ai_connection_defaults.js +28 -0
- package/dist/schema/ai_connection_defaults.js.map +1 -0
- package/dist/schema/ai_provider_defaults.d.ts +114 -0
- package/dist/schema/ai_provider_defaults.d.ts.map +1 -0
- package/dist/schema/ai_provider_defaults.js +19 -0
- package/dist/schema/ai_provider_defaults.js.map +1 -0
- package/dist/schema/announcement_dismissals.d.ts +83 -0
- package/dist/schema/announcement_dismissals.d.ts.map +1 -0
- package/dist/schema/announcement_dismissals.js +15 -0
- package/dist/schema/announcement_dismissals.js.map +1 -0
- package/dist/schema/approval_comments.d.ts +144 -0
- package/dist/schema/approval_comments.d.ts.map +1 -0
- package/dist/schema/approval_comments.js +19 -0
- package/dist/schema/approval_comments.js.map +1 -0
- package/dist/schema/approvals.d.ts +214 -0
- package/dist/schema/approvals.d.ts.map +1 -0
- package/dist/schema/approvals.js +20 -0
- package/dist/schema/approvals.js.map +1 -0
- package/dist/schema/assets.d.ts +212 -0
- package/dist/schema/assets.d.ts.map +1 -0
- package/dist/schema/assets.js +22 -0
- package/dist/schema/assets.js.map +1 -0
- package/dist/schema/auth.d.ts +638 -0
- package/dist/schema/auth.d.ts.map +1 -0
- package/dist/schema/auth.js +61 -0
- package/dist/schema/auth.js.map +1 -0
- package/dist/schema/board_api_keys.d.ts +144 -0
- package/dist/schema/board_api_keys.d.ts.map +1 -0
- package/dist/schema/board_api_keys.js +16 -0
- package/dist/schema/board_api_keys.js.map +1 -0
- package/dist/schema/budget_incidents.d.ts +297 -0
- package/dist/schema/budget_incidents.d.ts.map +1 -0
- package/dist/schema/budget_incidents.js +29 -0
- package/dist/schema/budget_incidents.js.map +1 -0
- package/dist/schema/budget_policies.d.ts +263 -0
- package/dist/schema/budget_policies.d.ts.map +1 -0
- package/dist/schema/budget_policies.js +24 -0
- package/dist/schema/budget_policies.js.map +1 -0
- package/dist/schema/built_in_managed_resources.d.ts +197 -0
- package/dist/schema/built_in_managed_resources.d.ts.map +1 -0
- package/dist/schema/built_in_managed_resources.js +22 -0
- package/dist/schema/built_in_managed_resources.js.map +1 -0
- package/dist/schema/cases.d.ts +982 -0
- package/dist/schema/cases.d.ts.map +1 -0
- package/dist/schema/cases.js +122 -0
- package/dist/schema/cases.js.map +1 -0
- package/dist/schema/chat_channels.d.ts +3035 -0
- package/dist/schema/chat_channels.d.ts.map +1 -0
- package/dist/schema/chat_channels.js +605 -0
- package/dist/schema/chat_channels.js.map +1 -0
- package/dist/schema/chat_discord_command_owners.d.ts +93 -0
- package/dist/schema/chat_discord_command_owners.d.ts.map +1 -0
- package/dist/schema/chat_discord_command_owners.js +19 -0
- package/dist/schema/chat_discord_command_owners.js.map +1 -0
- package/dist/schema/chat_github.d.ts +730 -0
- package/dist/schema/chat_github.d.ts.map +1 -0
- package/dist/schema/chat_github.js +110 -0
- package/dist/schema/chat_github.js.map +1 -0
- package/dist/schema/chat_teams_file_transfers.d.ts +639 -0
- package/dist/schema/chat_teams_file_transfers.d.ts.map +1 -0
- package/dist/schema/chat_teams_file_transfers.js +86 -0
- package/dist/schema/chat_teams_file_transfers.js.map +1 -0
- package/dist/schema/chat_telegram_draft_ids.d.ts +2 -0
- package/dist/schema/chat_telegram_draft_ids.d.ts.map +1 -0
- package/dist/schema/chat_telegram_draft_ids.js +14 -0
- package/dist/schema/chat_telegram_draft_ids.js.map +1 -0
- package/dist/schema/cli_auth_challenges.d.ts +263 -0
- package/dist/schema/cli_auth_challenges.d.ts.map +1 -0
- package/dist/schema/cli_auth_challenges.js +26 -0
- package/dist/schema/cli_auth_challenges.js.map +1 -0
- package/dist/schema/companies.d.ts +333 -0
- package/dist/schema/companies.d.ts.map +1 -0
- package/dist/schema/companies.js +32 -0
- package/dist/schema/companies.js.map +1 -0
- package/dist/schema/company_logos.d.ts +93 -0
- package/dist/schema/company_logos.d.ts.map +1 -0
- package/dist/schema/company_logos.js +14 -0
- package/dist/schema/company_logos.js.map +1 -0
- package/dist/schema/company_memberships.d.ts +144 -0
- package/dist/schema/company_memberships.d.ts.map +1 -0
- package/dist/schema/company_memberships.js +17 -0
- package/dist/schema/company_memberships.js.map +1 -0
- package/dist/schema/company_onboarding_seeds.d.ts +257 -0
- package/dist/schema/company_onboarding_seeds.d.ts.map +1 -0
- package/dist/schema/company_onboarding_seeds.js +35 -0
- package/dist/schema/company_onboarding_seeds.js.map +1 -0
- package/dist/schema/company_secret_bindings.d.ts +229 -0
- package/dist/schema/company_secret_bindings.d.ts.map +1 -0
- package/dist/schema/company_secret_bindings.js +24 -0
- package/dist/schema/company_secret_bindings.js.map +1 -0
- package/dist/schema/company_secret_proposals.d.ts +575 -0
- package/dist/schema/company_secret_proposals.d.ts.map +1 -0
- package/dist/schema/company_secret_proposals.js +69 -0
- package/dist/schema/company_secret_proposals.js.map +1 -0
- package/dist/schema/company_secret_provider_configs.d.ts +284 -0
- package/dist/schema/company_secret_provider_configs.d.ts.map +1 -0
- package/dist/schema/company_secret_provider_configs.js +29 -0
- package/dist/schema/company_secret_provider_configs.js.map +1 -0
- package/dist/schema/company_secret_versions.d.ts +231 -0
- package/dist/schema/company_secret_versions.d.ts.map +1 -0
- package/dist/schema/company_secret_versions.js +24 -0
- package/dist/schema/company_secret_versions.js.map +1 -0
- package/dist/schema/company_secrets.d.ts +384 -0
- package/dist/schema/company_secrets.d.ts.map +1 -0
- package/dist/schema/company_secrets.js +56 -0
- package/dist/schema/company_secrets.js.map +1 -0
- package/dist/schema/company_skill_policies.d.ts +131 -0
- package/dist/schema/company_skill_policies.d.ts.map +1 -0
- package/dist/schema/company_skill_policies.js +12 -0
- package/dist/schema/company_skill_policies.js.map +1 -0
- package/dist/schema/company_skills.d.ts +1858 -0
- package/dist/schema/company_skills.d.ts.map +1 -0
- package/dist/schema/company_skills.js +157 -0
- package/dist/schema/company_skills.js.map +1 -0
- package/dist/schema/company_transfer_runs.d.ts +297 -0
- package/dist/schema/company_transfer_runs.d.ts.map +1 -0
- package/dist/schema/company_transfer_runs.js +42 -0
- package/dist/schema/company_transfer_runs.js.map +1 -0
- package/dist/schema/company_user_sidebar_preferences.d.ts +112 -0
- package/dist/schema/company_user_sidebar_preferences.d.ts.map +1 -0
- package/dist/schema/company_user_sidebar_preferences.js +15 -0
- package/dist/schema/company_user_sidebar_preferences.js.map +1 -0
- package/dist/schema/completion_contracts.d.ts +265 -0
- package/dist/schema/completion_contracts.d.ts.map +1 -0
- package/dist/schema/completion_contracts.js +35 -0
- package/dist/schema/completion_contracts.js.map +1 -0
- package/dist/schema/connection_event_deliveries.d.ts +291 -0
- package/dist/schema/connection_event_deliveries.d.ts.map +1 -0
- package/dist/schema/connection_event_deliveries.js +31 -0
- package/dist/schema/connection_event_deliveries.js.map +1 -0
- package/dist/schema/connection_intent_deliveries.d.ts +94 -0
- package/dist/schema/connection_intent_deliveries.d.ts.map +1 -0
- package/dist/schema/connection_intent_deliveries.js +12 -0
- package/dist/schema/connection_intent_deliveries.js.map +1 -0
- package/dist/schema/cost_events.d.ts +331 -0
- package/dist/schema/cost_events.d.ts.map +1 -0
- package/dist/schema/cost_events.js +35 -0
- package/dist/schema/cost_events.js.map +1 -0
- package/dist/schema/decision_queues.d.ts +1510 -0
- package/dist/schema/decision_queues.d.ts.map +1 -0
- package/dist/schema/decision_queues.js +161 -0
- package/dist/schema/decision_queues.js.map +1 -0
- package/dist/schema/decision_training_examples.d.ts +255 -0
- package/dist/schema/decision_training_examples.d.ts.map +1 -0
- package/dist/schema/decision_training_examples.js +27 -0
- package/dist/schema/decision_training_examples.js.map +1 -0
- package/dist/schema/decisions.d.ts +824 -0
- package/dist/schema/decisions.d.ts.map +1 -0
- package/dist/schema/decisions.js +78 -0
- package/dist/schema/decisions.js.map +1 -0
- package/dist/schema/document_annotation_anchor_snapshots.d.ts +255 -0
- package/dist/schema/document_annotation_anchor_snapshots.d.ts.map +1 -0
- package/dist/schema/document_annotation_anchor_snapshots.js +25 -0
- package/dist/schema/document_annotation_anchor_snapshots.js.map +1 -0
- package/dist/schema/document_annotation_comments.d.ts +285 -0
- package/dist/schema/document_annotation_comments.d.ts.map +1 -0
- package/dist/schema/document_annotation_comments.js +39 -0
- package/dist/schema/document_annotation_comments.js.map +1 -0
- package/dist/schema/document_annotation_threads.d.ts +510 -0
- package/dist/schema/document_annotation_threads.d.ts.map +1 -0
- package/dist/schema/document_annotation_threads.js +52 -0
- package/dist/schema/document_annotation_threads.js.map +1 -0
- package/dist/schema/document_memberships.d.ts +127 -0
- package/dist/schema/document_memberships.d.ts.map +1 -0
- package/dist/schema/document_memberships.js +16 -0
- package/dist/schema/document_memberships.js.map +1 -0
- package/dist/schema/document_revisions.d.ts +212 -0
- package/dist/schema/document_revisions.d.ts.map +1 -0
- package/dist/schema/document_revisions.js +23 -0
- package/dist/schema/document_revisions.js.map +1 -0
- package/dist/schema/documents.d.ts +300 -0
- package/dist/schema/documents.d.ts.map +1 -0
- package/dist/schema/documents.js +28 -0
- package/dist/schema/documents.js.map +1 -0
- package/dist/schema/email.d.ts +550 -0
- package/dist/schema/email.d.ts.map +1 -0
- package/dist/schema/email.js +80 -0
- package/dist/schema/email.js.map +1 -0
- package/dist/schema/environment_custom_image_setup_sessions.d.ts +351 -0
- package/dist/schema/environment_custom_image_setup_sessions.d.ts.map +1 -0
- package/dist/schema/environment_custom_image_setup_sessions.js +39 -0
- package/dist/schema/environment_custom_image_setup_sessions.js.map +1 -0
- package/dist/schema/environment_custom_image_templates.d.ts +284 -0
- package/dist/schema/environment_custom_image_templates.d.ts.map +1 -0
- package/dist/schema/environment_custom_image_templates.js +32 -0
- package/dist/schema/environment_custom_image_templates.js.map +1 -0
- package/dist/schema/environment_leases.d.ts +333 -0
- package/dist/schema/environment_leases.d.ts.map +1 -0
- package/dist/schema/environment_leases.js +42 -0
- package/dist/schema/environment_leases.js.map +1 -0
- package/dist/schema/environments.d.ts +184 -0
- package/dist/schema/environments.d.ts.map +1 -0
- package/dist/schema/environments.js +24 -0
- package/dist/schema/environments.js.map +1 -0
- package/dist/schema/execution_workspace_runtime_leases.d.ts +248 -0
- package/dist/schema/execution_workspace_runtime_leases.d.ts.map +1 -0
- package/dist/schema/execution_workspace_runtime_leases.js +35 -0
- package/dist/schema/execution_workspace_runtime_leases.js.map +1 -0
- package/dist/schema/execution_workspaces.d.ts +418 -0
- package/dist/schema/execution_workspaces.d.ts.map +1 -0
- package/dist/schema/execution_workspaces.js +39 -0
- package/dist/schema/execution_workspaces.js.map +1 -0
- package/dist/schema/external_object_mentions.d.ts +337 -0
- package/dist/schema/external_object_mentions.d.ts.map +1 -0
- package/dist/schema/external_object_mentions.js +34 -0
- package/dist/schema/external_object_mentions.js.map +1 -0
- package/dist/schema/external_objects.d.ts +543 -0
- package/dist/schema/external_objects.d.ts.map +1 -0
- package/dist/schema/external_objects.js +43 -0
- package/dist/schema/external_objects.js.map +1 -0
- package/dist/schema/feedback_exports.d.ts +450 -0
- package/dist/schema/feedback_exports.d.ts.map +1 -0
- package/dist/schema/feedback_exports.js +41 -0
- package/dist/schema/feedback_exports.js.map +1 -0
- package/dist/schema/feedback_votes.d.ts +246 -0
- package/dist/schema/feedback_votes.d.ts.map +1 -0
- package/dist/schema/feedback_votes.js +25 -0
- package/dist/schema/feedback_votes.js.map +1 -0
- package/dist/schema/finance_events.d.ts +469 -0
- package/dist/schema/finance_events.d.ts.map +1 -0
- package/dist/schema/finance_events.js +45 -0
- package/dist/schema/finance_events.js.map +1 -0
- package/dist/schema/folders.d.ts +198 -0
- package/dist/schema/folders.d.ts.map +1 -0
- package/dist/schema/folders.js +29 -0
- package/dist/schema/folders.js.map +1 -0
- package/dist/schema/goals.d.ts +178 -0
- package/dist/schema/goals.d.ts.map +1 -0
- package/dist/schema/goals.js +18 -0
- package/dist/schema/goals.js.map +1 -0
- package/dist/schema/heartbeat_run_events.d.ts +299 -0
- package/dist/schema/heartbeat_run_events.d.ts.map +1 -0
- package/dist/schema/heartbeat_run_events.js +36 -0
- package/dist/schema/heartbeat_run_events.js.map +1 -0
- package/dist/schema/heartbeat_run_watchdog_decisions.d.ts +195 -0
- package/dist/schema/heartbeat_run_watchdog_decisions.d.ts.map +1 -0
- package/dist/schema/heartbeat_run_watchdog_decisions.js +22 -0
- package/dist/schema/heartbeat_run_watchdog_decisions.js.map +1 -0
- package/dist/schema/heartbeat_runs.d.ts +1206 -0
- package/dist/schema/heartbeat_runs.d.ts.map +1 -0
- package/dist/schema/heartbeat_runs.js +103 -0
- package/dist/schema/heartbeat_runs.js.map +1 -0
- package/dist/schema/inbox_dismissals.d.ts +163 -0
- package/dist/schema/inbox_dismissals.d.ts.map +1 -0
- package/dist/schema/inbox_dismissals.js +18 -0
- package/dist/schema/inbox_dismissals.js.map +1 -0
- package/dist/schema/index.d.ts +138 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +138 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/instance_settings.d.ts +131 -0
- package/dist/schema/instance_settings.d.ts.map +1 -0
- package/dist/schema/instance_settings.js +14 -0
- package/dist/schema/instance_settings.js.map +1 -0
- package/dist/schema/instance_user_roles.d.ts +93 -0
- package/dist/schema/instance_user_roles.d.ts.map +1 -0
- package/dist/schema/instance_user_roles.js +12 -0
- package/dist/schema/instance_user_roles.js.map +1 -0
- package/dist/schema/invites.d.ts +214 -0
- package/dist/schema/invites.d.ts.map +1 -0
- package/dist/schema/invites.js +20 -0
- package/dist/schema/invites.js.map +1 -0
- package/dist/schema/issue_approvals.d.ts +110 -0
- package/dist/schema/issue_approvals.d.ts.map +1 -0
- package/dist/schema/issue_approvals.js +19 -0
- package/dist/schema/issue_approvals.js.map +1 -0
- package/dist/schema/issue_attachments.d.ts +144 -0
- package/dist/schema/issue_attachments.d.ts.map +1 -0
- package/dist/schema/issue_attachments.js +24 -0
- package/dist/schema/issue_attachments.js.map +1 -0
- package/dist/schema/issue_comments.d.ts +429 -0
- package/dist/schema/issue_comments.d.ts.map +1 -0
- package/dist/schema/issue_comments.js +45 -0
- package/dist/schema/issue_comments.js.map +1 -0
- package/dist/schema/issue_create_idempotency_keys.d.ts +93 -0
- package/dist/schema/issue_create_idempotency_keys.d.ts.map +1 -0
- package/dist/schema/issue_create_idempotency_keys.js +15 -0
- package/dist/schema/issue_create_idempotency_keys.js.map +1 -0
- package/dist/schema/issue_documents.d.ts +127 -0
- package/dist/schema/issue_documents.d.ts.map +1 -0
- package/dist/schema/issue_documents.js +18 -0
- package/dist/schema/issue_documents.js.map +1 -0
- package/dist/schema/issue_execution_decisions.d.ts +212 -0
- package/dist/schema/issue_execution_decisions.d.ts.map +1 -0
- package/dist/schema/issue_execution_decisions.js +23 -0
- package/dist/schema/issue_execution_decisions.js.map +1 -0
- package/dist/schema/issue_inbox_archives.d.ts +180 -0
- package/dist/schema/issue_inbox_archives.d.ts.map +1 -0
- package/dist/schema/issue_inbox_archives.js +25 -0
- package/dist/schema/issue_inbox_archives.js.map +1 -0
- package/dist/schema/issue_labels.d.ts +76 -0
- package/dist/schema/issue_labels.d.ts.map +1 -0
- package/dist/schema/issue_labels.js +16 -0
- package/dist/schema/issue_labels.js.map +1 -0
- package/dist/schema/issue_plan_decompositions.d.ts +284 -0
- package/dist/schema/issue_plan_decompositions.d.ts.map +1 -0
- package/dist/schema/issue_plan_decompositions.js +36 -0
- package/dist/schema/issue_plan_decompositions.js.map +1 -0
- package/dist/schema/issue_question_response_deliveries.d.ts +320 -0
- package/dist/schema/issue_question_response_deliveries.d.ts.map +1 -0
- package/dist/schema/issue_question_response_deliveries.js +42 -0
- package/dist/schema/issue_question_response_deliveries.js.map +1 -0
- package/dist/schema/issue_read_states.d.ts +127 -0
- package/dist/schema/issue_read_states.d.ts.map +1 -0
- package/dist/schema/issue_read_states.js +17 -0
- package/dist/schema/issue_read_states.js.map +1 -0
- package/dist/schema/issue_recovery_actions.d.ts +456 -0
- package/dist/schema/issue_recovery_actions.d.ts.map +1 -0
- package/dist/schema/issue_recovery_actions.js +44 -0
- package/dist/schema/issue_recovery_actions.js.map +1 -0
- package/dist/schema/issue_reference_mentions.d.ts +180 -0
- package/dist/schema/issue_reference_mentions.d.ts.map +1 -0
- package/dist/schema/issue_reference_mentions.js +23 -0
- package/dist/schema/issue_reference_mentions.js.map +1 -0
- package/dist/schema/issue_relations.d.ts +163 -0
- package/dist/schema/issue_relations.d.ts.map +1 -0
- package/dist/schema/issue_relations.js +21 -0
- package/dist/schema/issue_relations.js.map +1 -0
- package/dist/schema/issue_thread_interactions.d.ts +516 -0
- package/dist/schema/issue_thread_interactions.d.ts.map +1 -0
- package/dist/schema/issue_thread_interactions.js +61 -0
- package/dist/schema/issue_thread_interactions.js.map +1 -0
- package/dist/schema/issue_tree_hold_members.d.ts +280 -0
- package/dist/schema/issue_tree_hold_members.d.ts.map +1 -0
- package/dist/schema/issue_tree_hold_members.js +29 -0
- package/dist/schema/issue_tree_hold_members.js.map +1 -0
- package/dist/schema/issue_tree_holds.d.ts +352 -0
- package/dist/schema/issue_tree_holds.d.ts.map +1 -0
- package/dist/schema/issue_tree_holds.js +31 -0
- package/dist/schema/issue_tree_holds.js.map +1 -0
- package/dist/schema/issue_watchdogs.d.ts +382 -0
- package/dist/schema/issue_watchdogs.d.ts.map +1 -0
- package/dist/schema/issue_watchdogs.js +38 -0
- package/dist/schema/issue_watchdogs.js.map +1 -0
- package/dist/schema/issue_work_products.d.ts +370 -0
- package/dist/schema/issue_work_products.d.ts.map +1 -0
- package/dist/schema/issue_work_products.js +38 -0
- package/dist/schema/issue_work_products.js.map +1 -0
- package/dist/schema/issues.d.ts +1062 -0
- package/dist/schema/issues.d.ts.map +1 -0
- package/dist/schema/issues.js +158 -0
- package/dist/schema/issues.js.map +1 -0
- package/dist/schema/join_requests.d.ts +384 -0
- package/dist/schema/join_requests.d.ts.map +1 -0
- package/dist/schema/join_requests.js +39 -0
- package/dist/schema/join_requests.js.map +1 -0
- package/dist/schema/labels.d.ts +110 -0
- package/dist/schema/labels.d.ts.map +1 -0
- package/dist/schema/labels.js +14 -0
- package/dist/schema/labels.js.map +1 -0
- package/dist/schema/managed_agent_profiles.d.ts +339 -0
- package/dist/schema/managed_agent_profiles.d.ts.map +1 -0
- package/dist/schema/managed_agent_profiles.js +44 -0
- package/dist/schema/managed_agent_profiles.js.map +1 -0
- package/dist/schema/native_run_finalizations.d.ts +403 -0
- package/dist/schema/native_run_finalizations.d.ts.map +1 -0
- package/dist/schema/native_run_finalizations.js +91 -0
- package/dist/schema/native_run_finalizations.js.map +1 -0
- package/dist/schema/native_run_results.d.ts +248 -0
- package/dist/schema/native_run_results.d.ts.map +1 -0
- package/dist/schema/native_run_results.js +56 -0
- package/dist/schema/native_run_results.js.map +1 -0
- package/dist/schema/pipeline_case_events.d.ts +231 -0
- package/dist/schema/pipeline_case_events.d.ts.map +1 -0
- package/dist/schema/pipeline_case_events.js +52 -0
- package/dist/schema/pipeline_case_events.js.map +1 -0
- package/dist/schema/pipeline_cases.d.ts +1388 -0
- package/dist/schema/pipeline_cases.d.ts.map +1 -0
- package/dist/schema/pipeline_cases.js +138 -0
- package/dist/schema/pipeline_cases.js.map +1 -0
- package/dist/schema/pipelines.d.ts +500 -0
- package/dist/schema/pipelines.d.ts.map +1 -0
- package/dist/schema/pipelines.js +52 -0
- package/dist/schema/pipelines.js.map +1 -0
- package/dist/schema/plugin_company_settings.d.ts +159 -0
- package/dist/schema/plugin_company_settings.d.ts.map +1 -0
- package/dist/schema/plugin_company_settings.js +35 -0
- package/dist/schema/plugin_company_settings.js.map +1 -0
- package/dist/schema/plugin_config.d.ts +139 -0
- package/dist/schema/plugin_config.d.ts.map +1 -0
- package/dist/schema/plugin_config.js +29 -0
- package/dist/schema/plugin_config.js.map +1 -0
- package/dist/schema/plugin_database.d.ts +357 -0
- package/dist/schema/plugin_database.d.ts.map +1 -0
- package/dist/schema/plugin_database.js +51 -0
- package/dist/schema/plugin_database.js.map +1 -0
- package/dist/schema/plugin_entities.d.ts +230 -0
- package/dist/schema/plugin_entities.d.ts.map +1 -0
- package/dist/schema/plugin_entities.js +52 -0
- package/dist/schema/plugin_entities.js.map +1 -0
- package/dist/schema/plugin_jobs.d.ts +409 -0
- package/dist/schema/plugin_jobs.d.ts.map +1 -0
- package/dist/schema/plugin_jobs.js +87 -0
- package/dist/schema/plugin_jobs.js.map +1 -0
- package/dist/schema/plugin_logs.d.ts +142 -0
- package/dist/schema/plugin_logs.d.ts.map +1 -0
- package/dist/schema/plugin_logs.js +33 -0
- package/dist/schema/plugin_logs.js.map +1 -0
- package/dist/schema/plugin_managed_resources.d.ts +180 -0
- package/dist/schema/plugin_managed_resources.d.ts.map +1 -0
- package/dist/schema/plugin_managed_resources.js +25 -0
- package/dist/schema/plugin_managed_resources.js.map +1 -0
- package/dist/schema/plugin_state.d.ts +169 -0
- package/dist/schema/plugin_state.d.ts.map +1 -0
- package/dist/schema/plugin_state.js +68 -0
- package/dist/schema/plugin_state.js.map +1 -0
- package/dist/schema/plugin_webhooks.d.ts +256 -0
- package/dist/schema/plugin_webhooks.d.ts.map +1 -0
- package/dist/schema/plugin_webhooks.js +56 -0
- package/dist/schema/plugin_webhooks.js.map +1 -0
- package/dist/schema/plugins.d.ts +246 -0
- package/dist/schema/plugins.d.ts.map +1 -0
- package/dist/schema/plugins.js +31 -0
- package/dist/schema/plugins.js.map +1 -0
- package/dist/schema/principal_permission_grants.d.ts +163 -0
- package/dist/schema/principal_permission_grants.d.ts.map +1 -0
- package/dist/schema/principal_permission_grants.js +17 -0
- package/dist/schema/principal_permission_grants.js.map +1 -0
- package/dist/schema/project_goals.d.ts +93 -0
- package/dist/schema/project_goals.d.ts.map +1 -0
- package/dist/schema/project_goals.js +17 -0
- package/dist/schema/project_goals.js.map +1 -0
- package/dist/schema/project_memberships.d.ts +144 -0
- package/dist/schema/project_memberships.d.ts.map +1 -0
- package/dist/schema/project_memberships.js +19 -0
- package/dist/schema/project_memberships.js.map +1 -0
- package/dist/schema/project_workspaces.d.ts +333 -0
- package/dist/schema/project_workspaces.d.ts.map +1 -0
- package/dist/schema/project_workspaces.js +32 -0
- package/dist/schema/project_workspaces.js.map +1 -0
- package/dist/schema/projects.d.ts +302 -0
- package/dist/schema/projects.d.ts.map +1 -0
- package/dist/schema/projects.js +26 -0
- package/dist/schema/projects.js.map +1 -0
- package/dist/schema/provider_trace_records.d.ts +264 -0
- package/dist/schema/provider_trace_records.d.ts.map +1 -0
- package/dist/schema/provider_trace_records.js +34 -0
- package/dist/schema/provider_trace_records.js.map +1 -0
- package/dist/schema/remote_agent_profiles.d.ts +238 -0
- package/dist/schema/remote_agent_profiles.d.ts.map +1 -0
- package/dist/schema/remote_agent_profiles.js +31 -0
- package/dist/schema/remote_agent_profiles.js.map +1 -0
- package/dist/schema/routine_documents.d.ts +127 -0
- package/dist/schema/routine_documents.d.ts.map +1 -0
- package/dist/schema/routine_documents.js +18 -0
- package/dist/schema/routine_documents.js.map +1 -0
- package/dist/schema/routines.d.ts +1611 -0
- package/dist/schema/routines.d.ts.map +1 -0
- package/dist/schema/routines.js +140 -0
- package/dist/schema/routines.js.map +1 -0
- package/dist/schema/run_identity_contexts.d.ts +248 -0
- package/dist/schema/run_identity_contexts.d.ts.map +1 -0
- package/dist/schema/run_identity_contexts.js +29 -0
- package/dist/schema/run_identity_contexts.js.map +1 -0
- package/dist/schema/secret_access_events.d.ts +382 -0
- package/dist/schema/secret_access_events.d.ts.map +1 -0
- package/dist/schema/secret_access_events.js +39 -0
- package/dist/schema/secret_access_events.js.map +1 -0
- package/dist/schema/smoke_lab.d.ts +367 -0
- package/dist/schema/smoke_lab.d.ts.map +1 -0
- package/dist/schema/smoke_lab.js +33 -0
- package/dist/schema/smoke_lab.js.map +1 -0
- package/dist/schema/status_cards.d.ts +949 -0
- package/dist/schema/status_cards.d.ts.map +1 -0
- package/dist/schema/status_cards.js +70 -0
- package/dist/schema/status_cards.js.map +1 -0
- package/dist/schema/status_decision_effects.d.ts +299 -0
- package/dist/schema/status_decision_effects.d.ts.map +1 -0
- package/dist/schema/status_decision_effects.js +37 -0
- package/dist/schema/status_decision_effects.js.map +1 -0
- package/dist/schema/status_decisions.d.ts +282 -0
- package/dist/schema/status_decisions.d.ts.map +1 -0
- package/dist/schema/status_decisions.js +49 -0
- package/dist/schema/status_decisions.js.map +1 -0
- package/dist/schema/summary_slots.d.ts +252 -0
- package/dist/schema/summary_slots.d.ts.map +1 -0
- package/dist/schema/summary_slots.js +32 -0
- package/dist/schema/summary_slots.js.map +1 -0
- package/dist/schema/tool_access.d.ts +8382 -0
- package/dist/schema/tool_access.d.ts.map +1 -0
- package/dist/schema/tool_access.js +735 -0
- package/dist/schema/tool_access.js.map +1 -0
- package/dist/schema/tool_action_deliveries.d.ts +111 -0
- package/dist/schema/tool_action_deliveries.d.ts.map +1 -0
- package/dist/schema/tool_action_deliveries.js +27 -0
- package/dist/schema/tool_action_deliveries.js.map +1 -0
- package/dist/schema/user_inbox_agent_policies.d.ts +131 -0
- package/dist/schema/user_inbox_agent_policies.d.ts.map +1 -0
- package/dist/schema/user_inbox_agent_policies.js +17 -0
- package/dist/schema/user_inbox_agent_policies.js.map +1 -0
- package/dist/schema/user_secret_declarations.d.ts +229 -0
- package/dist/schema/user_secret_declarations.d.ts.map +1 -0
- package/dist/schema/user_secret_declarations.js +31 -0
- package/dist/schema/user_secret_declarations.js.map +1 -0
- package/dist/schema/user_secret_definitions.d.ts +316 -0
- package/dist/schema/user_secret_definitions.d.ts.map +1 -0
- package/dist/schema/user_secret_definitions.js +33 -0
- package/dist/schema/user_secret_definitions.js.map +1 -0
- package/dist/schema/user_sidebar_preferences.d.ts +95 -0
- package/dist/schema/user_sidebar_preferences.d.ts.map +1 -0
- package/dist/schema/user_sidebar_preferences.js +11 -0
- package/dist/schema/user_sidebar_preferences.js.map +1 -0
- package/dist/schema/work_assessments.d.ts +333 -0
- package/dist/schema/work_assessments.d.ts.map +1 -0
- package/dist/schema/work_assessments.js +67 -0
- package/dist/schema/work_assessments.js.map +1 -0
- package/dist/schema/workspace_operations.d.ts +384 -0
- package/dist/schema/workspace_operations.d.ts.map +1 -0
- package/dist/schema/workspace_operations.js +40 -0
- package/dist/schema/workspace_operations.js.map +1 -0
- package/dist/schema/workspace_runtime_services.d.ts +523 -0
- package/dist/schema/workspace_runtime_services.d.ts.map +1 -0
- package/dist/schema/workspace_runtime_services.js +53 -0
- package/dist/schema/workspace_runtime_services.js.map +1 -0
- package/dist/seed.d.ts +2 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +91 -0
- package/dist/seed.js.map +1 -0
- package/dist/session-goal-migration.test.d.ts +2 -0
- package/dist/session-goal-migration.test.d.ts.map +1 -0
- package/dist/session-goal-migration.test.js +47 -0
- package/dist/session-goal-migration.test.js.map +1 -0
- package/dist/status-card-migrations.test.d.ts +2 -0
- package/dist/status-card-migrations.test.d.ts.map +1 -0
- package/dist/status-card-migrations.test.js +34 -0
- package/dist/status-card-migrations.test.js.map +1 -0
- package/dist/summary-slots-schema.test.d.ts +2 -0
- package/dist/summary-slots-schema.test.d.ts.map +1 -0
- package/dist/summary-slots-schema.test.js +62 -0
- package/dist/summary-slots-schema.test.js.map +1 -0
- package/dist/table-size-estimates.d.ts +366 -0
- package/dist/table-size-estimates.d.ts.map +1 -0
- package/dist/table-size-estimates.js +153 -0
- package/dist/table-size-estimates.js.map +1 -0
- package/dist/test-embedded-postgres.d.ts +37 -0
- package/dist/test-embedded-postgres.d.ts.map +1 -0
- package/dist/test-embedded-postgres.js +240 -0
- package/dist/test-embedded-postgres.js.map +1 -0
- package/dist/test-embedded-postgres.test.d.ts +2 -0
- package/dist/test-embedded-postgres.test.d.ts.map +1 -0
- package/dist/test-embedded-postgres.test.js +76 -0
- package/dist/test-embedded-postgres.test.js.map +1 -0
- package/dist/transient-write-retry.d.ts +4 -0
- package/dist/transient-write-retry.d.ts.map +1 -0
- package/dist/transient-write-retry.js +79 -0
- package/dist/transient-write-retry.js.map +1 -0
- package/dist/transient-write-retry.test.d.ts +2 -0
- package/dist/transient-write-retry.test.d.ts.map +1 -0
- package/dist/transient-write-retry.test.js +166 -0
- package/dist/transient-write-retry.test.js.map +1 -0
- package/dist/vercel-connect-credential-source-migration.test.d.ts +2 -0
- package/dist/vercel-connect-credential-source-migration.test.d.ts.map +1 -0
- package/dist/vercel-connect-credential-source-migration.test.js +71 -0
- package/dist/vercel-connect-credential-source-migration.test.js.map +1 -0
- package/node_modules/async-exit-hook/index.js +171 -0
- package/node_modules/async-exit-hook/license +21 -0
- package/node_modules/async-exit-hook/package.json +66 -0
- package/node_modules/async-exit-hook/readme.md +118 -0
- package/node_modules/embedded-postgres/LICENSE.md +9 -0
- package/node_modules/embedded-postgres/README.md +191 -0
- package/node_modules/embedded-postgres/dist/binary.d.ts +7 -0
- package/node_modules/embedded-postgres/dist/binary.js +41 -0
- package/node_modules/embedded-postgres/dist/index.d.ts +58 -0
- package/node_modules/embedded-postgres/dist/index.js +366 -0
- package/node_modules/embedded-postgres/dist/types.d.ts +54 -0
- package/node_modules/embedded-postgres/dist/types.js +1 -0
- package/node_modules/embedded-postgres/package.json +59 -0
- package/node_modules/pg/LICENSE +21 -0
- package/node_modules/pg/README.md +96 -0
- package/node_modules/pg/esm/index.mjs +20 -0
- package/node_modules/pg/lib/client.js +828 -0
- package/node_modules/pg/lib/connection-parameters.js +184 -0
- package/node_modules/pg/lib/connection.js +243 -0
- package/node_modules/pg/lib/crypto/cert-signatures.js +122 -0
- package/node_modules/pg/lib/crypto/sasl.js +262 -0
- package/node_modules/pg/lib/crypto/utils.js +89 -0
- package/node_modules/pg/lib/defaults.js +94 -0
- package/node_modules/pg/lib/index.js +73 -0
- package/node_modules/pg/lib/native/client.js +420 -0
- package/node_modules/pg/lib/native/index.js +2 -0
- package/node_modules/pg/lib/native/query.js +165 -0
- package/node_modules/pg/lib/query.js +259 -0
- package/node_modules/pg/lib/result.js +109 -0
- package/node_modules/pg/lib/stream.js +83 -0
- package/node_modules/pg/lib/type-overrides.js +35 -0
- package/node_modules/pg/lib/utils.js +207 -0
- package/node_modules/pg/package.json +76 -0
- package/node_modules/pg-cloudflare/LICENSE +21 -0
- package/node_modules/pg-cloudflare/README.md +112 -0
- package/node_modules/pg-cloudflare/dist/empty.d.ts +2 -0
- package/node_modules/pg-cloudflare/dist/empty.js +6 -0
- package/node_modules/pg-cloudflare/dist/empty.js.map +1 -0
- package/node_modules/pg-cloudflare/dist/index.d.ts +31 -0
- package/node_modules/pg-cloudflare/dist/index.js +154 -0
- package/node_modules/pg-cloudflare/dist/index.js.map +1 -0
- package/node_modules/pg-cloudflare/esm/index.mjs +3 -0
- package/node_modules/pg-cloudflare/package.json +39 -0
- package/node_modules/pg-cloudflare/src/empty.ts +3 -0
- package/node_modules/pg-cloudflare/src/index.ts +169 -0
- package/node_modules/pg-cloudflare/src/types.d.ts +25 -0
- package/node_modules/pg-connection-string/LICENSE +21 -0
- package/node_modules/pg-connection-string/README.md +105 -0
- package/node_modules/pg-connection-string/esm/index.mjs +8 -0
- package/node_modules/pg-connection-string/index.d.ts +37 -0
- package/node_modules/pg-connection-string/index.js +237 -0
- package/node_modules/pg-connection-string/package.json +52 -0
- package/node_modules/pg-int8/LICENSE +13 -0
- package/node_modules/pg-int8/README.md +16 -0
- package/node_modules/pg-int8/index.js +100 -0
- package/node_modules/pg-int8/package.json +24 -0
- package/node_modules/pg-pool/LICENSE +21 -0
- package/node_modules/pg-pool/README.md +357 -0
- package/node_modules/pg-pool/esm/index.mjs +5 -0
- package/node_modules/pg-pool/index.js +517 -0
- package/node_modules/pg-pool/package.json +51 -0
- package/node_modules/pg-protocol/LICENSE +21 -0
- package/node_modules/pg-protocol/README.md +3 -0
- package/node_modules/pg-protocol/dist/b.d.ts +1 -0
- package/node_modules/pg-protocol/dist/b.js +23 -0
- package/node_modules/pg-protocol/dist/b.js.map +1 -0
- package/node_modules/pg-protocol/dist/buffer-reader.d.ts +14 -0
- package/node_modules/pg-protocol/dist/buffer-reader.js +55 -0
- package/node_modules/pg-protocol/dist/buffer-reader.js.map +1 -0
- package/node_modules/pg-protocol/dist/buffer-writer.d.ts +17 -0
- package/node_modules/pg-protocol/dist/buffer-writer.js +104 -0
- package/node_modules/pg-protocol/dist/buffer-writer.js.map +1 -0
- package/node_modules/pg-protocol/dist/inbound-parser.test.d.ts +1 -0
- package/node_modules/pg-protocol/dist/inbound-parser.test.js +538 -0
- package/node_modules/pg-protocol/dist/inbound-parser.test.js.map +1 -0
- package/node_modules/pg-protocol/dist/index.d.ts +5 -0
- package/node_modules/pg-protocol/dist/index.js +15 -0
- package/node_modules/pg-protocol/dist/index.js.map +1 -0
- package/node_modules/pg-protocol/dist/messages.d.ts +161 -0
- package/node_modules/pg-protocol/dist/messages.js +160 -0
- package/node_modules/pg-protocol/dist/messages.js.map +1 -0
- package/node_modules/pg-protocol/dist/outbound-serializer.test.d.ts +1 -0
- package/node_modules/pg-protocol/dist/outbound-serializer.test.js +325 -0
- package/node_modules/pg-protocol/dist/outbound-serializer.test.js.map +1 -0
- package/node_modules/pg-protocol/dist/parser.d.ts +22 -0
- package/node_modules/pg-protocol/dist/parser.js +325 -0
- package/node_modules/pg-protocol/dist/parser.js.map +1 -0
- package/node_modules/pg-protocol/dist/serializer.d.ts +42 -0
- package/node_modules/pg-protocol/dist/serializer.js +196 -0
- package/node_modules/pg-protocol/dist/serializer.js.map +1 -0
- package/node_modules/pg-protocol/esm/index.js +11 -0
- package/node_modules/pg-protocol/package.json +44 -0
- package/node_modules/pg-protocol/src/b.ts +25 -0
- package/node_modules/pg-protocol/src/buffer-reader.ts +58 -0
- package/node_modules/pg-protocol/src/buffer-writer.ts +110 -0
- package/node_modules/pg-protocol/src/inbound-parser.test.ts +585 -0
- package/node_modules/pg-protocol/src/index.ts +11 -0
- package/node_modules/pg-protocol/src/messages.ts +262 -0
- package/node_modules/pg-protocol/src/outbound-serializer.test.ts +356 -0
- package/node_modules/pg-protocol/src/parser.ts +414 -0
- package/node_modules/pg-protocol/src/serializer.ts +280 -0
- package/node_modules/pg-protocol/src/testing/buffer-list.ts +67 -0
- package/node_modules/pg-protocol/src/testing/test-buffers.ts +166 -0
- package/node_modules/pg-types/.travis.yml +7 -0
- package/node_modules/pg-types/Makefile +14 -0
- package/node_modules/pg-types/README.md +75 -0
- package/node_modules/pg-types/index.d.ts +137 -0
- package/node_modules/pg-types/index.js +47 -0
- package/node_modules/pg-types/index.test-d.ts +21 -0
- package/node_modules/pg-types/lib/arrayParser.js +11 -0
- package/node_modules/pg-types/lib/binaryParsers.js +257 -0
- package/node_modules/pg-types/lib/builtins.js +73 -0
- package/node_modules/pg-types/lib/textParsers.js +215 -0
- package/node_modules/pg-types/package.json +42 -0
- package/node_modules/pg-types/test/index.js +24 -0
- package/node_modules/pg-types/test/types.js +597 -0
- package/node_modules/pgpass/README.md +74 -0
- package/node_modules/pgpass/lib/helper.js +233 -0
- package/node_modules/pgpass/lib/index.js +23 -0
- package/node_modules/pgpass/package.json +41 -0
- package/node_modules/postgres-array/index.d.ts +4 -0
- package/node_modules/postgres-array/index.js +97 -0
- package/node_modules/postgres-array/license +21 -0
- package/node_modules/postgres-array/package.json +35 -0
- package/node_modules/postgres-array/readme.md +43 -0
- package/node_modules/postgres-bytea/index.js +33 -0
- package/node_modules/postgres-bytea/license +21 -0
- package/node_modules/postgres-bytea/package.json +34 -0
- package/node_modules/postgres-bytea/readme.md +34 -0
- package/node_modules/postgres-date/index.js +116 -0
- package/node_modules/postgres-date/license +21 -0
- package/node_modules/postgres-date/package.json +33 -0
- package/node_modules/postgres-date/readme.md +49 -0
- package/node_modules/postgres-interval/index.d.ts +20 -0
- package/node_modules/postgres-interval/index.js +125 -0
- package/node_modules/postgres-interval/license +21 -0
- package/node_modules/postgres-interval/package.json +36 -0
- package/node_modules/postgres-interval/readme.md +48 -0
- package/node_modules/split2/LICENSE +13 -0
- package/node_modules/split2/README.md +85 -0
- package/node_modules/split2/bench.js +27 -0
- package/node_modules/split2/index.js +141 -0
- package/node_modules/split2/package.json +39 -0
- package/node_modules/split2/test.js +409 -0
- package/node_modules/xtend/.jshintrc +30 -0
- package/node_modules/xtend/LICENSE +20 -0
- package/node_modules/xtend/README.md +32 -0
- package/node_modules/xtend/immutable.js +19 -0
- package/node_modules/xtend/mutable.js +17 -0
- package/node_modules/xtend/package.json +55 -0
- package/node_modules/xtend/test.js +103 -0
- package/package.json +69 -0
|
@@ -0,0 +1,811 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readdir, readFile } from "node:fs/promises";
|
|
3
|
+
import { basename } from "node:path";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
+
import { MIGRATION_SAFETY_BASELINE } from "./migration-safety-baseline.js";
|
|
6
|
+
import { getTableSizeEstimate, isKnownLargeTable, } from "./table-size-estimates.js";
|
|
7
|
+
const migrationsDir = fileURLToPath(new URL("./migrations", import.meta.url));
|
|
8
|
+
const RULE_METADATA = {
|
|
9
|
+
"loop-mutation-large-table": {
|
|
10
|
+
severity: "error",
|
|
11
|
+
message: "DO $$ loop mutates a known-large table without a same-migration support index",
|
|
12
|
+
},
|
|
13
|
+
"batched-mutation-large-table-missing-index": {
|
|
14
|
+
severity: "error",
|
|
15
|
+
message: "Batched LIMIT mutation over a known-large table lacks a same-migration support index",
|
|
16
|
+
},
|
|
17
|
+
"full-table-mutation-large-table": {
|
|
18
|
+
severity: "error",
|
|
19
|
+
message: "Known-large table mutation does not have a selective WHERE clause",
|
|
20
|
+
},
|
|
21
|
+
"large-create-index-not-concurrently": {
|
|
22
|
+
severity: "warning",
|
|
23
|
+
message: "CREATE INDEX on a known-large table is missing CONCURRENTLY",
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
const RESERVED_ALIAS_WORDS = new Set([
|
|
27
|
+
"add",
|
|
28
|
+
"alter",
|
|
29
|
+
"as",
|
|
30
|
+
"delete",
|
|
31
|
+
"from",
|
|
32
|
+
"on",
|
|
33
|
+
"returning",
|
|
34
|
+
"set",
|
|
35
|
+
"using",
|
|
36
|
+
"where",
|
|
37
|
+
"with",
|
|
38
|
+
]);
|
|
39
|
+
function normalizeIdentifier(value) {
|
|
40
|
+
return value
|
|
41
|
+
.trim()
|
|
42
|
+
.replace(/^"public"\s*\.\s*/i, "")
|
|
43
|
+
.replace(/^public\s*\.\s*/i, "")
|
|
44
|
+
.replace(/^"/, "")
|
|
45
|
+
.replace(/"$/, "")
|
|
46
|
+
.replaceAll('""', '"');
|
|
47
|
+
}
|
|
48
|
+
function normalizeSql(value) {
|
|
49
|
+
return value.replace(/\s+/g, " ").trim();
|
|
50
|
+
}
|
|
51
|
+
function statementExcerpt(statement) {
|
|
52
|
+
const normalized = normalizeSql(statement);
|
|
53
|
+
if (normalized.length <= 700)
|
|
54
|
+
return normalized;
|
|
55
|
+
return `${normalized.slice(0, 700)}...`;
|
|
56
|
+
}
|
|
57
|
+
function findingId(rule, migration, table, statement) {
|
|
58
|
+
return createHash("sha256")
|
|
59
|
+
.update(`${rule}\0${migration}\0${table}\0${normalizeSql(statement)}`)
|
|
60
|
+
.digest("hex")
|
|
61
|
+
.slice(0, 16);
|
|
62
|
+
}
|
|
63
|
+
function splitSqlStatements(sql) {
|
|
64
|
+
const breakpointParts = sql
|
|
65
|
+
.split(/-->\s*statement-breakpoint/g)
|
|
66
|
+
.map((part) => part.trim())
|
|
67
|
+
.filter((part) => part.length > 0);
|
|
68
|
+
if (breakpointParts.length > 1)
|
|
69
|
+
return breakpointParts;
|
|
70
|
+
const statements = [];
|
|
71
|
+
let start = 0;
|
|
72
|
+
let singleQuoted = false;
|
|
73
|
+
let dollarQuoteTag = null;
|
|
74
|
+
for (let index = 0; index < sql.length; index += 1) {
|
|
75
|
+
if (dollarQuoteTag) {
|
|
76
|
+
if (sql.startsWith(dollarQuoteTag, index)) {
|
|
77
|
+
index += dollarQuoteTag.length - 1;
|
|
78
|
+
dollarQuoteTag = null;
|
|
79
|
+
}
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const char = sql[index];
|
|
83
|
+
if (singleQuoted) {
|
|
84
|
+
if (char === "'" && sql[index + 1] === "'") {
|
|
85
|
+
index += 1;
|
|
86
|
+
}
|
|
87
|
+
else if (char === "'") {
|
|
88
|
+
singleQuoted = false;
|
|
89
|
+
}
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (char === "'") {
|
|
93
|
+
singleQuoted = true;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (char === "$") {
|
|
97
|
+
const tag = dollarQuoteTagAt(sql, index);
|
|
98
|
+
if (tag) {
|
|
99
|
+
dollarQuoteTag = tag;
|
|
100
|
+
index += dollarQuoteTag.length - 1;
|
|
101
|
+
}
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (char === ";") {
|
|
105
|
+
const statement = sql.slice(start, index + 1).trim();
|
|
106
|
+
if (statement.length > 0)
|
|
107
|
+
statements.push(statement);
|
|
108
|
+
start = index + 1;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const tail = sql.slice(start).trim();
|
|
112
|
+
if (tail.length > 0)
|
|
113
|
+
statements.push(tail);
|
|
114
|
+
return statements;
|
|
115
|
+
}
|
|
116
|
+
function ignoreRules(statement) {
|
|
117
|
+
const rules = new Set();
|
|
118
|
+
const pattern = /--\s*paperclip:migration-safety-ignore\s+([a-z0-9-]+|all)\s*:\s*(\S.*)$/gim;
|
|
119
|
+
for (const match of statement.matchAll(pattern)) {
|
|
120
|
+
const rule = match[1];
|
|
121
|
+
const reason = match[2]?.trim();
|
|
122
|
+
if (rule && reason)
|
|
123
|
+
rules.add(rule);
|
|
124
|
+
}
|
|
125
|
+
return rules;
|
|
126
|
+
}
|
|
127
|
+
function isIgnored(statement, rule) {
|
|
128
|
+
const ignored = ignoreRules(statement);
|
|
129
|
+
return ignored.has(rule) || ignored.has("all");
|
|
130
|
+
}
|
|
131
|
+
function skipSingleQuotedLiteral(statement, startIndex) {
|
|
132
|
+
let index = startIndex + 1;
|
|
133
|
+
while (index < statement.length) {
|
|
134
|
+
if (statement[index] === "'" && statement[index + 1] === "'") {
|
|
135
|
+
index += 2;
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (statement[index] === "'")
|
|
139
|
+
return index + 1;
|
|
140
|
+
index += 1;
|
|
141
|
+
}
|
|
142
|
+
return index;
|
|
143
|
+
}
|
|
144
|
+
function skipDoubleQuotedIdentifier(statement, startIndex) {
|
|
145
|
+
let index = startIndex + 1;
|
|
146
|
+
while (index < statement.length) {
|
|
147
|
+
if (statement[index] === '"' && statement[index + 1] === '"') {
|
|
148
|
+
index += 2;
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (statement[index] === '"')
|
|
152
|
+
return index + 1;
|
|
153
|
+
index += 1;
|
|
154
|
+
}
|
|
155
|
+
return index;
|
|
156
|
+
}
|
|
157
|
+
function skipLineComment(statement, startIndex) {
|
|
158
|
+
const newlineIndex = statement.indexOf("\n", startIndex + 2);
|
|
159
|
+
return newlineIndex === -1 ? statement.length : newlineIndex;
|
|
160
|
+
}
|
|
161
|
+
function skipBlockComment(statement, startIndex) {
|
|
162
|
+
let depth = 1;
|
|
163
|
+
let index = startIndex + 2;
|
|
164
|
+
while (index < statement.length && depth > 0) {
|
|
165
|
+
if (statement.startsWith("/*", index)) {
|
|
166
|
+
depth += 1;
|
|
167
|
+
index += 2;
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (statement.startsWith("*/", index)) {
|
|
171
|
+
depth -= 1;
|
|
172
|
+
index += 2;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
index += 1;
|
|
176
|
+
}
|
|
177
|
+
return index;
|
|
178
|
+
}
|
|
179
|
+
function skipDollarQuotedString(statement, startIndex) {
|
|
180
|
+
const tag = dollarQuoteTagAt(statement, startIndex);
|
|
181
|
+
if (!tag)
|
|
182
|
+
return startIndex;
|
|
183
|
+
const closeIndex = statement.indexOf(tag, startIndex + tag.length);
|
|
184
|
+
return closeIndex === -1 ? statement.length : closeIndex + tag.length;
|
|
185
|
+
}
|
|
186
|
+
function stripSqlComments(statement) {
|
|
187
|
+
let stripped = "";
|
|
188
|
+
let index = 0;
|
|
189
|
+
while (index < statement.length) {
|
|
190
|
+
const char = statement[index];
|
|
191
|
+
const next = statement[index + 1];
|
|
192
|
+
if (char === "'") {
|
|
193
|
+
const literalEnd = skipSingleQuotedLiteral(statement, index);
|
|
194
|
+
stripped += statement.slice(index, literalEnd);
|
|
195
|
+
index = literalEnd;
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
if (char === '"') {
|
|
199
|
+
const identifierEnd = skipDoubleQuotedIdentifier(statement, index);
|
|
200
|
+
stripped += statement.slice(index, identifierEnd);
|
|
201
|
+
index = identifierEnd;
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (char === "$") {
|
|
205
|
+
const dollarEnd = skipDollarQuotedString(statement, index);
|
|
206
|
+
if (dollarEnd !== index) {
|
|
207
|
+
stripped += statement.slice(index, dollarEnd);
|
|
208
|
+
index = dollarEnd;
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (char === "-" && next === "-") {
|
|
213
|
+
stripped += " ";
|
|
214
|
+
index = skipLineComment(statement, index);
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (char === "/" && next === "*") {
|
|
218
|
+
stripped += " ";
|
|
219
|
+
const commentEnd = skipBlockComment(statement, index);
|
|
220
|
+
for (let commentIndex = index; commentIndex < commentEnd; commentIndex += 1) {
|
|
221
|
+
if (statement[commentIndex] === "\n")
|
|
222
|
+
stripped += "\n";
|
|
223
|
+
}
|
|
224
|
+
index = commentEnd;
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
stripped += char;
|
|
228
|
+
index += 1;
|
|
229
|
+
}
|
|
230
|
+
return stripped;
|
|
231
|
+
}
|
|
232
|
+
function skipSqlTrivia(statement, index) {
|
|
233
|
+
const char = statement[index];
|
|
234
|
+
const next = statement[index + 1];
|
|
235
|
+
if (char === "'")
|
|
236
|
+
return skipSingleQuotedLiteral(statement, index);
|
|
237
|
+
if (char === '"')
|
|
238
|
+
return skipDoubleQuotedIdentifier(statement, index);
|
|
239
|
+
if (char === "$") {
|
|
240
|
+
const end = skipDollarQuotedString(statement, index);
|
|
241
|
+
if (end !== index)
|
|
242
|
+
return end;
|
|
243
|
+
}
|
|
244
|
+
if (char === "-" && next === "-")
|
|
245
|
+
return skipLineComment(statement, index);
|
|
246
|
+
if (char === "/" && next === "*")
|
|
247
|
+
return skipBlockComment(statement, index);
|
|
248
|
+
return index;
|
|
249
|
+
}
|
|
250
|
+
function identifierList(value) {
|
|
251
|
+
return [...value.matchAll(/"([^"]+)"|(?:^|[\s,(])([A-Za-z_][A-Za-z0-9_]*)/g)]
|
|
252
|
+
.map((match) => normalizeIdentifier(match[1] ?? match[2] ?? ""))
|
|
253
|
+
.filter((identifier) => identifier.length > 0)
|
|
254
|
+
.filter((identifier) => !RESERVED_ALIAS_WORDS.has(identifier.toLowerCase()));
|
|
255
|
+
}
|
|
256
|
+
function plainIndexColumns(columnSpec) {
|
|
257
|
+
// Only include simple column references. Skip expression columns such as
|
|
258
|
+
// (id * 2) or lower(col) — PostgreSQL cannot use those to satisfy ORDER BY
|
|
259
|
+
// on the plain column, so they must not suppress a missing-index finding.
|
|
260
|
+
return splitSqlList(columnSpec).flatMap((part) => {
|
|
261
|
+
const trimmed = part.trim();
|
|
262
|
+
if (/\(/.test(trimmed))
|
|
263
|
+
return [];
|
|
264
|
+
return identifierList(trimmed);
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
function splitSqlList(value) {
|
|
268
|
+
const parts = [];
|
|
269
|
+
let start = 0;
|
|
270
|
+
let depth = 0;
|
|
271
|
+
let singleQuoted = false;
|
|
272
|
+
let doubleQuoted = false;
|
|
273
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
274
|
+
const char = value[index];
|
|
275
|
+
if (singleQuoted) {
|
|
276
|
+
if (char === "'" && value[index + 1] === "'") {
|
|
277
|
+
index += 1;
|
|
278
|
+
}
|
|
279
|
+
else if (char === "'") {
|
|
280
|
+
singleQuoted = false;
|
|
281
|
+
}
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
if (doubleQuoted) {
|
|
285
|
+
if (char === '"' && value[index + 1] === '"') {
|
|
286
|
+
index += 1;
|
|
287
|
+
}
|
|
288
|
+
else if (char === '"') {
|
|
289
|
+
doubleQuoted = false;
|
|
290
|
+
}
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
if (char === "'") {
|
|
294
|
+
singleQuoted = true;
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
if (char === '"') {
|
|
298
|
+
doubleQuoted = true;
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
if (char === "(") {
|
|
302
|
+
depth += 1;
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
if (char === ")") {
|
|
306
|
+
depth = Math.max(0, depth - 1);
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
if (char === "," && depth === 0) {
|
|
310
|
+
const part = value.slice(start, index).trim();
|
|
311
|
+
if (part)
|
|
312
|
+
parts.push(part);
|
|
313
|
+
start = index + 1;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
const tail = value.slice(start).trim();
|
|
317
|
+
if (tail)
|
|
318
|
+
parts.push(tail);
|
|
319
|
+
return parts;
|
|
320
|
+
}
|
|
321
|
+
function orderByExpressionColumn(value) {
|
|
322
|
+
const withoutSortModifiers = value
|
|
323
|
+
.replace(/\bCOLLATE\s+(?:"[^"]+"|[A-Za-z_][A-Za-z0-9_]*)/gi, " ")
|
|
324
|
+
.replace(/\bNULLS\s+(?:FIRST|LAST)\b/gi, " ")
|
|
325
|
+
.replace(/\b(?:ASC|DESC)\b/gi, " ");
|
|
326
|
+
const identifiers = [
|
|
327
|
+
...withoutSortModifiers.matchAll(/"([^"]+)"|([A-Za-z_][A-Za-z0-9_]*)/g),
|
|
328
|
+
]
|
|
329
|
+
.map((match) => normalizeIdentifier(match[1] ?? match[2] ?? ""))
|
|
330
|
+
.filter((identifier) => identifier.length > 0)
|
|
331
|
+
.filter((identifier) => !RESERVED_ALIAS_WORDS.has(identifier.toLowerCase()));
|
|
332
|
+
return identifiers[identifiers.length - 1] ?? null;
|
|
333
|
+
}
|
|
334
|
+
function predicateColumns(statement) {
|
|
335
|
+
const columns = new Set();
|
|
336
|
+
const sql = stripSqlComments(statement);
|
|
337
|
+
const predicatePattern = /\b(?:WHERE|ORDER\s+BY|ON)\b([\s\S]*?)(?=\b(?:LIMIT|RETURNING|GROUP\s+BY|ORDER\s+BY|SET|FROM)\b|$)/gi;
|
|
338
|
+
for (const match of sql.matchAll(predicatePattern)) {
|
|
339
|
+
for (const identifier of identifierList(match[1] ?? "")) {
|
|
340
|
+
columns.add(identifier);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return [...columns];
|
|
344
|
+
}
|
|
345
|
+
function keywordOccurrenceAt(sql, index, pattern) {
|
|
346
|
+
const previous = sql[index - 1];
|
|
347
|
+
if (previous && /[A-Za-z0-9_]/.test(previous))
|
|
348
|
+
return null;
|
|
349
|
+
return sql.slice(index).match(pattern);
|
|
350
|
+
}
|
|
351
|
+
function keywordOccurrences(sql, pattern) {
|
|
352
|
+
const occurrences = [];
|
|
353
|
+
let depth = 0;
|
|
354
|
+
let index = 0;
|
|
355
|
+
while (index < sql.length) {
|
|
356
|
+
const char = sql[index];
|
|
357
|
+
if (char === "'") {
|
|
358
|
+
index = skipSingleQuotedLiteral(sql, index);
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
if (char === '"') {
|
|
362
|
+
index = skipDoubleQuotedIdentifier(sql, index);
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
if (char === "(") {
|
|
366
|
+
depth += 1;
|
|
367
|
+
index += 1;
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
if (char === ")") {
|
|
371
|
+
depth = Math.max(0, depth - 1);
|
|
372
|
+
index += 1;
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
const match = keywordOccurrenceAt(sql, index, pattern);
|
|
376
|
+
if (match) {
|
|
377
|
+
occurrences.push({ index, depth, length: match[0].length });
|
|
378
|
+
index += match[0].length;
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
index += 1;
|
|
382
|
+
}
|
|
383
|
+
return occurrences;
|
|
384
|
+
}
|
|
385
|
+
function batchWhereClausesBeforeOrderBy(statement) {
|
|
386
|
+
const sql = stripSqlComments(statement);
|
|
387
|
+
const whereOccurrences = keywordOccurrences(sql, /^\bWHERE\b/i);
|
|
388
|
+
const orderByOccurrences = keywordOccurrences(sql, /^\bORDER\s+BY\b/i);
|
|
389
|
+
const clauses = [];
|
|
390
|
+
for (const orderBy of orderByOccurrences) {
|
|
391
|
+
const where = whereOccurrences
|
|
392
|
+
.filter((candidate) => candidate.depth === orderBy.depth && candidate.index < orderBy.index)
|
|
393
|
+
.at(-1);
|
|
394
|
+
if (!where)
|
|
395
|
+
continue;
|
|
396
|
+
const clause = sql.slice(where.index + where.length, orderBy.index).trim();
|
|
397
|
+
if (clause)
|
|
398
|
+
clauses.push(clause);
|
|
399
|
+
}
|
|
400
|
+
return clauses;
|
|
401
|
+
}
|
|
402
|
+
function hasBalancedOuterParens(value) {
|
|
403
|
+
if (!value.startsWith("(") || !value.endsWith(")"))
|
|
404
|
+
return false;
|
|
405
|
+
let depth = 0;
|
|
406
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
407
|
+
const char = value[index];
|
|
408
|
+
if (char === "'") {
|
|
409
|
+
index = skipSingleQuotedLiteral(value, index) - 1;
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
if (char === '"') {
|
|
413
|
+
index = skipDoubleQuotedIdentifier(value, index) - 1;
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
if (char === "(")
|
|
417
|
+
depth += 1;
|
|
418
|
+
if (char === ")")
|
|
419
|
+
depth -= 1;
|
|
420
|
+
if (depth === 0 && index < value.length - 1)
|
|
421
|
+
return false;
|
|
422
|
+
}
|
|
423
|
+
return depth === 0;
|
|
424
|
+
}
|
|
425
|
+
function stripOuterParens(value) {
|
|
426
|
+
let stripped = normalizeSql(value).replace(/;$/, "").trim();
|
|
427
|
+
while (hasBalancedOuterParens(stripped)) {
|
|
428
|
+
stripped = normalizeSql(stripped.slice(1, -1));
|
|
429
|
+
}
|
|
430
|
+
return stripped;
|
|
431
|
+
}
|
|
432
|
+
function splitConjunctivePredicate(value) {
|
|
433
|
+
const terms = [];
|
|
434
|
+
const sql = stripOuterParens(value);
|
|
435
|
+
let depth = 0;
|
|
436
|
+
let start = 0;
|
|
437
|
+
let index = 0;
|
|
438
|
+
while (index < sql.length) {
|
|
439
|
+
const char = sql[index];
|
|
440
|
+
if (char === "'") {
|
|
441
|
+
index = skipSingleQuotedLiteral(sql, index);
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
if (char === '"') {
|
|
445
|
+
index = skipDoubleQuotedIdentifier(sql, index);
|
|
446
|
+
continue;
|
|
447
|
+
}
|
|
448
|
+
if (char === "(") {
|
|
449
|
+
depth += 1;
|
|
450
|
+
index += 1;
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
if (char === ")") {
|
|
454
|
+
depth = Math.max(0, depth - 1);
|
|
455
|
+
index += 1;
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
const match = depth === 0 ? keywordOccurrenceAt(sql, index, /^\bAND\b/i) : null;
|
|
459
|
+
if (match) {
|
|
460
|
+
const term = stripOuterParens(sql.slice(start, index));
|
|
461
|
+
if (term)
|
|
462
|
+
terms.push(term);
|
|
463
|
+
start = index + match[0].length;
|
|
464
|
+
index = start;
|
|
465
|
+
continue;
|
|
466
|
+
}
|
|
467
|
+
index += 1;
|
|
468
|
+
}
|
|
469
|
+
const tail = stripOuterParens(sql.slice(start));
|
|
470
|
+
if (tail)
|
|
471
|
+
terms.push(tail);
|
|
472
|
+
return terms;
|
|
473
|
+
}
|
|
474
|
+
function lowercaseSqlOutsideSingleQuotedLiterals(value) {
|
|
475
|
+
let lowered = "";
|
|
476
|
+
let index = 0;
|
|
477
|
+
while (index < value.length) {
|
|
478
|
+
if (value[index] === "'") {
|
|
479
|
+
const end = skipSingleQuotedLiteral(value, index);
|
|
480
|
+
lowered += value.slice(index, end);
|
|
481
|
+
index = end;
|
|
482
|
+
continue;
|
|
483
|
+
}
|
|
484
|
+
lowered += value[index]?.toLowerCase() ?? "";
|
|
485
|
+
index += 1;
|
|
486
|
+
}
|
|
487
|
+
return lowered;
|
|
488
|
+
}
|
|
489
|
+
function normalizePredicateTerm(term) {
|
|
490
|
+
const normalized = stripOuterParens(term)
|
|
491
|
+
.replace(/(?:"[^"]+"|[A-Za-z_][A-Za-z0-9_]*)\s*\.\s*("[^"]+"|[A-Za-z_][A-Za-z0-9_]*)/g, "$1")
|
|
492
|
+
.replace(/"([^"]+)"/g, "$1")
|
|
493
|
+
.replace(/\s+/g, " ")
|
|
494
|
+
.trim();
|
|
495
|
+
return lowercaseSqlOutsideSingleQuotedLiterals(normalized);
|
|
496
|
+
}
|
|
497
|
+
function predicateTerms(value) {
|
|
498
|
+
return new Set(splitConjunctivePredicate(value).map(normalizePredicateTerm));
|
|
499
|
+
}
|
|
500
|
+
function orderByColumns(statement) {
|
|
501
|
+
const columns = [];
|
|
502
|
+
const sql = stripSqlComments(statement);
|
|
503
|
+
const pattern = /\bORDER\s+BY\b([\s\S]*?)(?=\b(?:LIMIT|RETURNING|GROUP\s+BY|WHERE|SET|FROM|END|LOOP)\b|$)/gi;
|
|
504
|
+
for (const match of sql.matchAll(pattern)) {
|
|
505
|
+
for (const expression of splitSqlList(match[1] ?? "")) {
|
|
506
|
+
const column = orderByExpressionColumn(expression);
|
|
507
|
+
if (column && !columns.includes(column)) {
|
|
508
|
+
columns.push(column);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
return columns;
|
|
513
|
+
}
|
|
514
|
+
function parseCreateIndexes(statement) {
|
|
515
|
+
const indexes = [];
|
|
516
|
+
const sql = stripSqlComments(statement);
|
|
517
|
+
const pattern = /\bCREATE\s+(?:UNIQUE\s+)?INDEX\s+(CONCURRENTLY\s+)?(?:IF\s+NOT\s+EXISTS\s+)?(?:"[^"]+"|[A-Za-z_][A-Za-z0-9_]*)\s+ON\s+(?:(?:"public"|public)\s*\.\s*)?(?:"([^"]+)"|([A-Za-z_][A-Za-z0-9_]*))\s*(?:USING\s+[A-Za-z_][A-Za-z0-9_]*\s*)?\(([\s\S]*?)\)(?:\s+WHERE\s+([\s\S]*))?/gi;
|
|
518
|
+
for (const match of sql.matchAll(pattern)) {
|
|
519
|
+
const table = normalizeIdentifier(match[2] ?? match[3] ?? "");
|
|
520
|
+
if (!table)
|
|
521
|
+
continue;
|
|
522
|
+
const predicate = match[5]?.trim().replace(/;$/, "").trim() ?? "";
|
|
523
|
+
indexes.push({
|
|
524
|
+
table,
|
|
525
|
+
columns: plainIndexColumns(match[4] ?? ""),
|
|
526
|
+
predicate: predicate.length > 0 ? predicate : null,
|
|
527
|
+
predicateColumns: predicateColumns(predicate),
|
|
528
|
+
concurrently: Boolean(match[1]),
|
|
529
|
+
statement,
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
return indexes;
|
|
533
|
+
}
|
|
534
|
+
function parseMutations(statement) {
|
|
535
|
+
const mutations = [];
|
|
536
|
+
const sql = stripSqlComments(statement);
|
|
537
|
+
const updatePattern = /\bUPDATE\s+(?:ONLY\s+)?(?:(?:"public"|public)\s*\.\s*)?(?:"([^"]+)"|([A-Za-z_][A-Za-z0-9_]*))(?:\s+(?:AS\s+)?(?:"?([A-Za-z_][A-Za-z0-9_]*)"?))?/gi;
|
|
538
|
+
const deletePattern = /\bDELETE\s+FROM\s+(?:ONLY\s+)?(?:(?:"public"|public)\s*\.\s*)?(?:"([^"]+)"|([A-Za-z_][A-Za-z0-9_]*))(?:\s+(?:AS\s+)?(?:"?([A-Za-z_][A-Za-z0-9_]*)"?))?/gi;
|
|
539
|
+
for (const match of sql.matchAll(updatePattern)) {
|
|
540
|
+
const table = normalizeIdentifier(match[1] ?? match[2] ?? "");
|
|
541
|
+
if (table) {
|
|
542
|
+
mutations.push({ table, statementSql: sql, keywordIndex: match.index ?? 0 });
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
for (const match of sql.matchAll(deletePattern)) {
|
|
546
|
+
const table = normalizeIdentifier(match[1] ?? match[2] ?? "");
|
|
547
|
+
if (table) {
|
|
548
|
+
mutations.push({ table, statementSql: sql, keywordIndex: match.index ?? 0 });
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
return mutations;
|
|
552
|
+
}
|
|
553
|
+
function hasDoLoop(statement) {
|
|
554
|
+
return /\bDO\s+\$[A-Za-z_]*\$[\s\S]*\bLOOP\b/i.test(statement);
|
|
555
|
+
}
|
|
556
|
+
function hasBatchedLimitMutation(statement) {
|
|
557
|
+
const hasLimit = /\bLIMIT\s+(?:\d+|[A-Za-z_][A-Za-z0-9_]*|\$[0-9]+)\b/i.test(statement);
|
|
558
|
+
const hasFetchLimit = /\bFETCH\s+(?:FIRST|NEXT)(?:\s+(?:\d+|[A-Za-z_][A-Za-z0-9_]*|\$[0-9]+))?\s+ROWS?\s+(?:ONLY|WITH\s+TIES)\b/i.test(statement);
|
|
559
|
+
const hasDml = /\b(?:UPDATE|DELETE)\b/i.test(statement);
|
|
560
|
+
return (hasLimit || hasFetchLimit) && hasDml;
|
|
561
|
+
}
|
|
562
|
+
function dollarQuoteTagAt(statement, startIndex) {
|
|
563
|
+
if (statement[startIndex] !== "$")
|
|
564
|
+
return null;
|
|
565
|
+
const match = statement.slice(startIndex).match(/^\$(?:[A-Za-z_][A-Za-z0-9_]*)?\$/);
|
|
566
|
+
return match?.[0] ?? null;
|
|
567
|
+
}
|
|
568
|
+
function topLevelWhereClause(statement, startIndex) {
|
|
569
|
+
// Walk character-by-character, tracking paren depth.
|
|
570
|
+
// Only consider WHERE keywords at depth 0 after the target mutation.
|
|
571
|
+
let depth = 0;
|
|
572
|
+
let i = startIndex;
|
|
573
|
+
while (i < statement.length) {
|
|
574
|
+
const nextIndex = skipSqlTrivia(statement, i);
|
|
575
|
+
if (nextIndex !== i) {
|
|
576
|
+
i = nextIndex;
|
|
577
|
+
continue;
|
|
578
|
+
}
|
|
579
|
+
const ch = statement[i];
|
|
580
|
+
if (ch === "(") {
|
|
581
|
+
depth++;
|
|
582
|
+
i++;
|
|
583
|
+
continue;
|
|
584
|
+
}
|
|
585
|
+
if (ch === ")") {
|
|
586
|
+
depth = Math.max(0, depth - 1);
|
|
587
|
+
i++;
|
|
588
|
+
continue;
|
|
589
|
+
}
|
|
590
|
+
if (depth === 0) {
|
|
591
|
+
const rem = statement.slice(i);
|
|
592
|
+
const m = rem.match(/^\bWHERE\b/i);
|
|
593
|
+
if (m)
|
|
594
|
+
return rem.slice(m[0].length);
|
|
595
|
+
}
|
|
596
|
+
i++;
|
|
597
|
+
}
|
|
598
|
+
return null;
|
|
599
|
+
}
|
|
600
|
+
function hasSelectiveWhere(mutation) {
|
|
601
|
+
const afterWhere = topLevelWhereClause(mutation.statementSql, mutation.keywordIndex);
|
|
602
|
+
if (!afterWhere)
|
|
603
|
+
return false;
|
|
604
|
+
const whereClause = normalizeSql(afterWhere).replace(/;$/, "");
|
|
605
|
+
if (/^(?:true|1\s*=\s*1)$/i.test(whereClause))
|
|
606
|
+
return false;
|
|
607
|
+
if (!/(?:=|<>|!=|<|>|\bIN\s*\(|\bEXISTS\s*\(|\bLIKE\b|\bIS\s+(?:NOT\s+)?NULL\b)/i.test(whereClause))
|
|
608
|
+
return false;
|
|
609
|
+
// A WHERE that only constrains joined tables is not a filter on the target table.
|
|
610
|
+
// Collect every table-qualified column reference (both "tbl"."col" and alias."col").
|
|
611
|
+
const qualRefs = [
|
|
612
|
+
...whereClause.matchAll(/"([^"]+)"\s*\.\s*(?:"[^"]+"|\w+)/g),
|
|
613
|
+
...whereClause.matchAll(/\b([A-Za-z_][A-Za-z0-9_]*)\s*\."[^"]+"/g),
|
|
614
|
+
...whereClause.matchAll(/\b([A-Za-z_][A-Za-z0-9_]*)\.([A-Za-z_][A-Za-z0-9_]*)\b/g),
|
|
615
|
+
].map((m) => normalizeIdentifier(m[1] ?? "")).filter(Boolean);
|
|
616
|
+
if (qualRefs.length > 0) {
|
|
617
|
+
// Resolve unquoted aliases from UPDATE/FROM/JOIN clauses to their real table names.
|
|
618
|
+
const aliasMap = new Map();
|
|
619
|
+
const aliasPattern = /\b(?:UPDATE|FROM|JOIN)\s+(?:"public"\s*\.\s*)?(?:"([^"]+)"|([A-Za-z_][A-Za-z0-9_]*))\s+(?:AS\s+)?(?:"([^"]+)"|([A-Za-z_][A-Za-z0-9_]*))\b/gi;
|
|
620
|
+
for (const m of stripSqlComments(mutation.statementSql).matchAll(aliasPattern)) {
|
|
621
|
+
const tbl = normalizeIdentifier(m[1] ?? m[2] ?? "");
|
|
622
|
+
const alias = normalizeIdentifier(m[3] ?? m[4] ?? "");
|
|
623
|
+
if (tbl && alias && !RESERVED_ALIAS_WORDS.has(alias.toLowerCase()))
|
|
624
|
+
aliasMap.set(alias, tbl);
|
|
625
|
+
}
|
|
626
|
+
const refTables = qualRefs.map((r) => aliasMap.get(r) ?? r);
|
|
627
|
+
if (!refTables.some((t) => t === mutation.table)) {
|
|
628
|
+
// All refs resolve to other tables. Confirm no bare unqualified identifiers remain.
|
|
629
|
+
const noQual = whereClause
|
|
630
|
+
.replace(/"[^"]+"\s*\.\s*(?:"[^"]+"|\w+)/g, " ")
|
|
631
|
+
.replace(/\b[A-Za-z_][A-Za-z0-9_]*\s*\."[^"]+"/g, " ")
|
|
632
|
+
.replace(/\b[A-Za-z_][A-Za-z0-9_]*\.[A-Za-z_][A-Za-z0-9_]*/g, " ")
|
|
633
|
+
.replace(/'(?:[^']|'')*'/g, " ");
|
|
634
|
+
const SQL_KW = /\b(?:AND|OR|NOT|IN|EXISTS|LIKE|IS|NULL|TRUE|FALSE|BETWEEN|CASE|WHEN|THEN|END|CAST|AS|ANY|ALL|SOME)\b/gi;
|
|
635
|
+
if (!/\b[A-Za-z_][A-Za-z0-9_]*\b/.test(noQual.replace(SQL_KW, " ")))
|
|
636
|
+
return false;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
return true;
|
|
640
|
+
}
|
|
641
|
+
function hasLeadingOrderPrefix(supportIndex, orderColumns, statement) {
|
|
642
|
+
const indexedColumns = supportIndex.columns;
|
|
643
|
+
const prefixLength = Math.min(indexedColumns.length, orderColumns.length);
|
|
644
|
+
if (prefixLength === 0)
|
|
645
|
+
return false;
|
|
646
|
+
for (let index = 0; index < prefixLength; index += 1) {
|
|
647
|
+
if (indexedColumns[index] !== orderColumns[index])
|
|
648
|
+
return false;
|
|
649
|
+
}
|
|
650
|
+
if (!supportIndex.predicate)
|
|
651
|
+
return true;
|
|
652
|
+
const indexPredicateTerms = predicateTerms(supportIndex.predicate);
|
|
653
|
+
if (indexPredicateTerms.size === 0)
|
|
654
|
+
return false;
|
|
655
|
+
return batchWhereClausesBeforeOrderBy(statement).some((whereClause) => {
|
|
656
|
+
const batchTerms = predicateTerms(whereClause);
|
|
657
|
+
return [...indexPredicateTerms].every((term) => batchTerms.has(term));
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
function hasOrderPrefixCompatibleIndex(supportIndex, orderColumns, statement) {
|
|
661
|
+
return hasLeadingOrderPrefix(supportIndex, orderColumns, statement);
|
|
662
|
+
}
|
|
663
|
+
function hasMatchingSupportIndex(indexes, mutation, statement) {
|
|
664
|
+
const matchingIndexes = indexes.filter((index) => index.table === mutation.table);
|
|
665
|
+
if (matchingIndexes.length === 0)
|
|
666
|
+
return false;
|
|
667
|
+
// ORDER BY columns are the batch-progression key. If the statement orders its
|
|
668
|
+
// batch, the support index must cover the ordered key prefix using index key
|
|
669
|
+
// columns; predicate-only overlap cannot stand in for an unindexed cursor.
|
|
670
|
+
const orderCols = orderByColumns(statement);
|
|
671
|
+
const allPredicateCols = new Set(predicateColumns(statement));
|
|
672
|
+
if (allPredicateCols.size === 0)
|
|
673
|
+
return true;
|
|
674
|
+
if (orderCols.length > 0) {
|
|
675
|
+
return matchingIndexes.some((index) => hasOrderPrefixCompatibleIndex(index, orderCols, statement));
|
|
676
|
+
}
|
|
677
|
+
return matchingIndexes.some((index) => {
|
|
678
|
+
const indexedColumns = new Set([...index.columns, ...index.predicateColumns]);
|
|
679
|
+
return [...allPredicateCols].some((col) => indexedColumns.has(col));
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
function estimateSuffix(table, estimates) {
|
|
683
|
+
const estimate = estimates.get(table) ?? getTableSizeEstimate(table);
|
|
684
|
+
if (!estimate)
|
|
685
|
+
return "bucket=large";
|
|
686
|
+
return `bucket=${estimate.bucket}, localRows=${estimate.localRows}, estimatedRows=${estimate.estimatedRows}`;
|
|
687
|
+
}
|
|
688
|
+
function makeFinding(rule, migration, table, statement, estimates) {
|
|
689
|
+
const metadata = RULE_METADATA[rule];
|
|
690
|
+
return {
|
|
691
|
+
id: findingId(rule, migration, table, statement),
|
|
692
|
+
rule,
|
|
693
|
+
severity: metadata.severity,
|
|
694
|
+
migration,
|
|
695
|
+
table,
|
|
696
|
+
statement: statementExcerpt(statement),
|
|
697
|
+
message: `${metadata.message} (${estimateSuffix(table, estimates)})`,
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
function addFindingOnce(findings, seen, finding) {
|
|
701
|
+
const key = `${finding.rule}:${finding.migration}:${finding.table}:${finding.id}`;
|
|
702
|
+
if (seen.has(key))
|
|
703
|
+
return;
|
|
704
|
+
seen.add(key);
|
|
705
|
+
findings.push(finding);
|
|
706
|
+
}
|
|
707
|
+
function estimatesByTable(estimates) {
|
|
708
|
+
if (!estimates)
|
|
709
|
+
return new Map();
|
|
710
|
+
return new Map(estimates.map((estimate) => [estimate.table, estimate]));
|
|
711
|
+
}
|
|
712
|
+
function tableIsLarge(table, estimates) {
|
|
713
|
+
if (estimates.size > 0)
|
|
714
|
+
return estimates.get(table)?.bucket === "large";
|
|
715
|
+
return isKnownLargeTable(table);
|
|
716
|
+
}
|
|
717
|
+
export function analyzeMigrationSafety(migrations, options = {}) {
|
|
718
|
+
const findings = [];
|
|
719
|
+
const seen = new Set();
|
|
720
|
+
const estimates = estimatesByTable(options.estimates);
|
|
721
|
+
for (const migration of migrations) {
|
|
722
|
+
const statements = splitSqlStatements(migration.sql);
|
|
723
|
+
const migrationIndexes = statements.flatMap(parseCreateIndexes);
|
|
724
|
+
for (const statement of statements) {
|
|
725
|
+
for (const index of parseCreateIndexes(statement)) {
|
|
726
|
+
if (tableIsLarge(index.table, estimates) &&
|
|
727
|
+
!index.concurrently &&
|
|
728
|
+
!isIgnored(statement, "large-create-index-not-concurrently")) {
|
|
729
|
+
addFindingOnce(findings, seen, makeFinding("large-create-index-not-concurrently", migration.fileName, index.table, statement, estimates));
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
const mutations = parseMutations(statement)
|
|
733
|
+
.filter((mutation) => tableIsLarge(mutation.table, estimates));
|
|
734
|
+
for (const mutation of mutations) {
|
|
735
|
+
const hasSupportIndex = hasMatchingSupportIndex(migrationIndexes, mutation, statement);
|
|
736
|
+
if (hasDoLoop(statement) &&
|
|
737
|
+
!hasSupportIndex &&
|
|
738
|
+
!isIgnored(statement, "loop-mutation-large-table")) {
|
|
739
|
+
addFindingOnce(findings, seen, makeFinding("loop-mutation-large-table", migration.fileName, mutation.table, statement, estimates));
|
|
740
|
+
}
|
|
741
|
+
if (hasBatchedLimitMutation(statement) &&
|
|
742
|
+
!hasSupportIndex &&
|
|
743
|
+
!isIgnored(statement, "batched-mutation-large-table-missing-index")) {
|
|
744
|
+
addFindingOnce(findings, seen, makeFinding("batched-mutation-large-table-missing-index", migration.fileName, mutation.table, statement, estimates));
|
|
745
|
+
}
|
|
746
|
+
if (!hasSelectiveWhere(mutation) &&
|
|
747
|
+
!isIgnored(statement, "full-table-mutation-large-table")) {
|
|
748
|
+
addFindingOnce(findings, seen, makeFinding("full-table-mutation-large-table", migration.fileName, mutation.table, statement, estimates));
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
const baselineIds = new Set(options.baselineIds ?? MIGRATION_SAFETY_BASELINE.map((entry) => entry.id));
|
|
754
|
+
const foundIds = new Set(findings.map((finding) => finding.id));
|
|
755
|
+
const newFindings = findings.filter((finding) => !baselineIds.has(finding.id));
|
|
756
|
+
const baselineFindings = findings.filter((finding) => baselineIds.has(finding.id));
|
|
757
|
+
const staleBaselineIds = [...baselineIds].filter((id) => !foundIds.has(id));
|
|
758
|
+
return {
|
|
759
|
+
findings,
|
|
760
|
+
newFindings,
|
|
761
|
+
baselineFindings,
|
|
762
|
+
staleBaselineIds,
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
async function readMigrations() {
|
|
766
|
+
const files = (await readdir(migrationsDir))
|
|
767
|
+
.filter((entry) => entry.endsWith(".sql"))
|
|
768
|
+
.sort();
|
|
769
|
+
return Promise.all(files.map(async (fileName) => ({
|
|
770
|
+
fileName,
|
|
771
|
+
sql: await readFile(new URL(`./migrations/${fileName}`, import.meta.url), "utf8"),
|
|
772
|
+
})));
|
|
773
|
+
}
|
|
774
|
+
function formatFinding(finding) {
|
|
775
|
+
return [
|
|
776
|
+
`[${finding.rule}] ${finding.migration} table=${finding.table} severity=${finding.severity} id=${finding.id}`,
|
|
777
|
+
finding.message,
|
|
778
|
+
`Statement: ${finding.statement}`,
|
|
779
|
+
].join("\n");
|
|
780
|
+
}
|
|
781
|
+
function formatNewFindings(findings) {
|
|
782
|
+
const rendered = findings.map(formatFinding).join("\n\n");
|
|
783
|
+
return [
|
|
784
|
+
`Migration safety check found ${findings.length} new finding(s).`,
|
|
785
|
+
"Add a same-migration support index, use CONCURRENTLY where applicable, or add",
|
|
786
|
+
"`-- paperclip:migration-safety-ignore <rule>: <reason>` next to the statement.",
|
|
787
|
+
"",
|
|
788
|
+
rendered,
|
|
789
|
+
].join("\n");
|
|
790
|
+
}
|
|
791
|
+
async function main() {
|
|
792
|
+
const result = analyzeMigrationSafety(await readMigrations());
|
|
793
|
+
if (result.newFindings.length > 0) {
|
|
794
|
+
throw new Error(formatNewFindings(result.newFindings));
|
|
795
|
+
}
|
|
796
|
+
const staleSuffix = result.staleBaselineIds.length > 0
|
|
797
|
+
? ` (${result.staleBaselineIds.length} stale baseline id(s) ignored)`
|
|
798
|
+
: "";
|
|
799
|
+
console.log(`Migration safety check passed: ${result.baselineFindings.length} historical finding(s) covered by baseline${staleSuffix}.`);
|
|
800
|
+
}
|
|
801
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
802
|
+
try {
|
|
803
|
+
await main();
|
|
804
|
+
}
|
|
805
|
+
catch (error) {
|
|
806
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
807
|
+
console.error(`${basename(process.argv[1])}: ${detail}`);
|
|
808
|
+
process.exitCode = 1;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
//# sourceMappingURL=check-migration-safety.js.map
|