@onequery/cli 0.1.45-win32-x64 → 0.1.46-darwin-arm64

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.
Files changed (145) hide show
  1. package/package.json +3 -3
  2. package/vendor/{x86_64-pc-windows-msvc/onequery/onequery.exe → aarch64-apple-darwin/onequery/onequery} +0 -0
  3. package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/server/onequery-server.mjs +628 -685
  4. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260327065242_curious_nightmare.sql +0 -0
  5. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260403103652_slippery_hellfire_club.sql +0 -0
  6. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260403112219_gigantic_namora.sql +0 -0
  7. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260420071232_previous_justin_hammer.sql +0 -0
  8. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260420093157_spooky_cassandra_nova.sql +0 -0
  9. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260420101631_even_ogun.sql +0 -0
  10. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260425110519_smart_amazoness.sql +0 -0
  11. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260327065242_snapshot.json +0 -0
  12. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260403103652_snapshot.json +0 -0
  13. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260403112219_snapshot.json +0 -0
  14. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260420071232_snapshot.json +0 -0
  15. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260420093157_snapshot.json +0 -0
  16. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260420101631_snapshot.json +0 -0
  17. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260425110519_snapshot.json +0 -0
  18. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/_journal.json +0 -0
  19. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/initdb.wasm +0 -0
  20. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/pglite.data +0 -0
  21. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/pglite.wasm +0 -0
  22. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/sql-parser/sql_parser_wasm_bg.wasm +0 -0
  23. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/CompositeItem-BczSyMtT.js +0 -0
  24. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/CompositeList-FRTEqUDK.js +0 -0
  25. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/DialogTitle-XJoEl7im.js +0 -0
  26. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconArrowRight-DsOD7mDl.js +0 -0
  27. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconCheck-Gc24xPT2.js +0 -0
  28. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconChevronDown-B-39MA7-.js +0 -0
  29. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconCoins-C7Nn0L6R.js +0 -0
  30. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconHistory-BqAd-xl2.js +0 -0
  31. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconLoader2-B3B6M8nQ.js +0 -0
  32. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconPlus-C3-kRhGX.js +0 -0
  33. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconX-BQkA009b.js +0 -0
  34. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/Separator-CHfSrIVw.js +0 -0
  35. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/_authenticated-BM2yiz99.js +0 -0
  36. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/_org_slug-BfXJF28s.js +0 -0
  37. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/alert-CgZYtErJ.js +0 -0
  38. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/api-base-url-DIb6qukm.js +0 -0
  39. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/api-client-B2Cc7TWF.js +0 -0
  40. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/api-paths-DM-NAvAZ.js +0 -0
  41. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/app-routes-CnJncMlZ.js +0 -0
  42. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/audit-ClpgHu9B.js +0 -0
  43. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/auth-bootstrap-query-B7dkGOfQ.js +0 -0
  44. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/auth-client-DF1BsKzX.js +0 -0
  45. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/avatar-BJ8wGO2c.js +0 -0
  46. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/badge-CwG2ykXV.js +0 -0
  47. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/budget-D6Ev_SML.js +0 -0
  48. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/callback-B6XJzLSF.js +0 -0
  49. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/card-BWqhQk-T.js +0 -0
  50. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/checkbox-BRqndHHY.js +0 -0
  51. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/compiler-runtime-DCc3R3Xn.js +0 -0
  52. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/connect-database-JaPJNCsD.js +0 -0
  53. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/create-org-BbAFZCln.js +0 -0
  54. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/createReactComponent-_L2mp4Ui.js +0 -0
  55. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/data-source-connection-form-pf2b-ERK.js +0 -0
  56. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/device-XQc0RI9Z.js +0 -0
  57. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/dist-D0YU0n1N.js +0 -0
  58. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/dropdown-menu-Bb-uhONR.js +0 -0
  59. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/empty-nwzd6339.js +0 -0
  60. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/format-date-Ctrh7my1.js +0 -0
  61. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/getDisabledMountTransitionStyles-Co-5TcgR.js +0 -0
  62. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/getPseudoElementBounds-BefWKytd.js +0 -0
  63. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/home-CA1ev4te.js +0 -0
  64. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/index-B4tzcC1c.js +0 -0
  65. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/index-BBPJeil4.css +0 -0
  66. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/input-CG_cIxvO.js +0 -0
  67. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/integrations-KI8qBfl_.js +0 -0
  68. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  69. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  70. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  71. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  72. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  73. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  74. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  75. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/invite._invitationId-BPdIb9rb.js +0 -0
  76. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/jsx-runtime-DG_AJzB_.js +0 -0
  77. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/label-DDLGZnWP.js +0 -0
  78. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/link-Cgvqhh5w.js +0 -0
  79. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/matchContext-CDajBC0L.js +0 -0
  80. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/organization-permissions-BQQ5PJbI.js +0 -0
  81. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/organization-query-keys-DwLucsD_.js +0 -0
  82. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/query-timing-LGzitMXx.js +0 -0
  83. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/queryOptions-BHw87wTZ.js +0 -0
  84. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/removable-BfDesq3B.js +0 -0
  85. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/routes-BUGLO-p-.js +0 -0
  86. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/schemas-n4sxh6jF.js +0 -0
  87. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/select--f8ikhXw.js +0 -0
  88. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/separator-C6uGWs7e.js +0 -0
  89. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/settings-DbZya6GZ.js +0 -0
  90. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/signin-DZOz5SqL.js +0 -0
  91. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/src-DCIPwIx0.js +0 -0
  92. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/table-Bzsu823v.js +0 -0
  93. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/team-BC8PBk76.js +0 -0
  94. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/textarea-DeFlZYve.js +0 -0
  95. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/theme-toggle-7vhlmsbU.js +0 -0
  96. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/use-optimistic-mutation-F9aL7LPX.js +0 -0
  97. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useBaseQuery-O7HCqjpX.js +0 -0
  98. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useBaseUiId-BLFGpnYJ.js +0 -0
  99. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useCompositeItem-C3Tz1oAb.js +0 -0
  100. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useControlled-B8q0aJoo.js +0 -0
  101. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useQuery-Cbo-5C23.js +0 -0
  102. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useRender-B2c9_UYd.js +0 -0
  103. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useRouterState-DpT8luFk.js +0 -0
  104. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useSuspenseQuery-GImltoGU.js +0 -0
  105. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useValueChanged-C3CBkPge.js +0 -0
  106. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/utils-C8DGLIgm.js +0 -0
  107. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/xstate-react.esm-U3P0kbzA.js +0 -0
  108. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/zod-Ch0Zejov.js +0 -0
  109. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/favicon.ico +0 -0
  110. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step1_settings_sidebar.png +0 -0
  111. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step2_projects.png +0 -0
  112. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step3_project_keys.png +0 -0
  113. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step4_api_keys.png +0 -0
  114. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step1_service_accounts.png +0 -0
  115. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step2_bigquery_roles.png +0 -0
  116. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step3_add_key_menu.png +0 -0
  117. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step4_create_json_key.png +0 -0
  118. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step1_service_accounts.png +0 -0
  119. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step2_create_json_key.png +0 -0
  120. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step3_add_user_viewer.png +0 -0
  121. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step4_property_details.png +0 -0
  122. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step1_signin.png +0 -0
  123. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step2_new_fine_grained_token_sanitized.png +0 -0
  124. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step3_permissions_configured_sanitized.png +0 -0
  125. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step4_token_created_sanitized.png +0 -0
  126. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step1_service_accounts.png +0 -0
  127. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step2_create_service_account.png +0 -0
  128. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step3_credentials.png +0 -0
  129. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step4_project_settings.png +0 -0
  130. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/postgresql/step1_create_user.png +0 -0
  131. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/postgresql/step2_connection.png +0 -0
  132. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/posthog/step1_project_settings.png +0 -0
  133. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/posthog/step2_personal_api_keys.png +0 -0
  134. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/posthog/step3_create_key_modal.png +0 -0
  135. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step1_connect.png +0 -0
  136. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step2_create_user.png +0 -0
  137. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step3_grant.png +0 -0
  138. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step4_info.png +0 -0
  139. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step1_personal_tokens.png +0 -0
  140. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step2_create_token_permissions.png +0 -0
  141. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step3_organization_slug.png +0 -0
  142. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step4_project_slug.png +0 -0
  143. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/index.html +0 -0
  144. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/linear.svg +0 -0
  145. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/onequery.svg +0 -0
@@ -28527,8 +28527,8 @@ const workflowEffectDispatches = pgTable("workflow_effect_dispatches", {
28527
28527
  check$2("workflow_effect_dispatches_completion_status_check", sql$1`((${table.status} = 'completed' and ${table.completedAt} is not null) or (${table.status} <> 'completed' and ${table.completedAt} is null))`)
28528
28528
  ]);
28529
28529
  //#endregion
28530
- //#region packages/db/src/client.ts
28531
- const postgresSchema = {
28530
+ //#region packages/db/src/schema/index.ts
28531
+ const schema$2 = {
28532
28532
  ...audit_feed_entries_exports,
28533
28533
  ...audit_projection_checkpoints_exports,
28534
28534
  ...audit_workflow_exports,
@@ -28548,43 +28548,17 @@ const postgresSchema = {
28548
28548
  ...workflow_effect_dispatches_exports,
28549
28549
  ...relations_exports
28550
28550
  };
28551
+ //#endregion
28552
+ //#region packages/db/src/client.ts
28551
28553
  const DB_CACHE_SYMBOL = Symbol.for("onequery.db.instance-cache");
28552
- const DB_RUNTIME_SCHEMA_SYMBOL = Symbol.for("onequery.db.runtime-schema");
28553
28554
  function getDbCache() {
28554
28555
  const globalWithCache = globalThis;
28555
28556
  if (!globalWithCache[DB_CACHE_SYMBOL]) globalWithCache[DB_CACHE_SYMBOL] = /* @__PURE__ */ new Map();
28556
28557
  return globalWithCache[DB_CACHE_SYMBOL];
28557
28558
  }
28558
- function attachRuntimeSchema(db, runtimeSchema) {
28559
- Object.defineProperty(db, DB_RUNTIME_SCHEMA_SYMBOL, {
28560
- configurable: true,
28561
- enumerable: false,
28562
- value: runtimeSchema,
28563
- writable: false
28564
- });
28565
- return db;
28566
- }
28567
28559
  function getDatabaseEngine(connectionString) {
28568
28560
  return isPgliteConnectionString(connectionString) ? "pglite" : "postgres";
28569
28561
  }
28570
- function getDatabaseSchemaForEngine(_engine) {
28571
- return postgresSchema;
28572
- }
28573
- function getDatabaseSchema(db) {
28574
- const stableRuntimeSchema = db[DB_RUNTIME_SCHEMA_SYMBOL];
28575
- if (stableRuntimeSchema) return stableRuntimeSchema;
28576
- const drizzleRuntimeSchema = db._?.fullSchema;
28577
- if (!drizzleRuntimeSchema) throw new Error("Database instance does not expose a runtime schema");
28578
- return drizzleRuntimeSchema;
28579
- }
28580
- function createDatabaseRuntime(connectionString) {
28581
- const engine = getDatabaseEngine(connectionString);
28582
- return {
28583
- db: createDb(connectionString),
28584
- engine,
28585
- schema: getDatabaseSchemaForEngine(engine)
28586
- };
28587
- }
28588
28562
  function createDb(connectionString) {
28589
28563
  const cache = getDbCache();
28590
28564
  const cachedDb = cache.get(connectionString);
@@ -28595,13 +28569,12 @@ function createDb(connectionString) {
28595
28569
  max: 5,
28596
28570
  fetch_types: false,
28597
28571
  prepare: true
28598
- }), { schema: postgresSchema });
28599
- db = attachRuntimeSchema(db, postgresSchema);
28572
+ }), { schema: schema$2 });
28600
28573
  cache.set(connectionString, db);
28601
28574
  return db;
28602
28575
  }
28603
28576
  function createPgliteDb(connectionString) {
28604
- return drizzle$1(new Xe(ensurePgliteDataDir(connectionString), resolvePgliteRuntimeOptions()), { schema: postgresSchema });
28577
+ return drizzle$1(new Xe(ensurePgliteDataDir(connectionString), resolvePgliteRuntimeOptions()), { schema: schema$2 });
28605
28578
  }
28606
28579
  //#endregion
28607
28580
  //#region node_modules/.bun/drizzle-orm@0.45.2+8cc11c6382417d66/node_modules/drizzle-orm/migrator.js
@@ -28649,7 +28622,7 @@ async function prepareApplicationDatabase(options) {
28649
28622
  if (getDatabaseEngine(options.connectionString) === "pglite") {
28650
28623
  const client = new Xe(ensurePgliteDataDir(options.connectionString), resolvePgliteRuntimeOptions());
28651
28624
  try {
28652
- await migrate$1(drizzle$1(client, { schema: postgresSchema }), { migrationsFolder: options.migrationsFolder });
28625
+ await migrate$1(drizzle$1(client, { schema: schema$2 }), { migrationsFolder: options.migrationsFolder });
28653
28626
  } finally {
28654
28627
  await client.close();
28655
28628
  }
@@ -28665,7 +28638,7 @@ async function prepareApplicationDatabase(options) {
28665
28638
  prepare: false
28666
28639
  });
28667
28640
  try {
28668
- await migrate(drizzle(client, { schema: postgresSchema }), { migrationsFolder: options.migrationsFolder });
28641
+ await migrate(drizzle(client, { schema: schema$2 }), { migrationsFolder: options.migrationsFolder });
28669
28642
  } finally {
28670
28643
  await client.end({ timeout: 0 });
28671
28644
  }
@@ -86860,7 +86833,7 @@ async function authorizeSelfHostSignUp(input) {
86860
86833
  };
86861
86834
  const invitations = await input.db.query.invitation.findMany({
86862
86835
  columns: { expiresAt: true },
86863
- where: and(eq(input.schema.invitation.email, normalizedEmail), eq(input.schema.invitation.status, "pending"))
86836
+ where: and(eq(invitation.email, normalizedEmail), eq(invitation.status, "pending"))
86864
86837
  });
86865
86838
  const now = Date.now();
86866
86839
  if (invitations.some((invitation) => invitation.expiresAt.getTime() > now)) return {
@@ -97227,10 +97200,7 @@ function resolveAuthDb(config) {
97227
97200
  }
97228
97201
  function createAuth(config) {
97229
97202
  const db = resolveAuthDb(config);
97230
- const tables = config.schema ?? (config.databaseUrl ? createDatabaseRuntime(config.databaseUrl).schema : void 0);
97231
97203
  const provider = config.provider ?? "pg";
97232
- const authSchema = tables;
97233
- if (!tables) throw new Error("createAuth requires a runtime schema when no databaseUrl is provided");
97234
97204
  const isHttps = config.baseURL?.startsWith("https://") ?? false;
97235
97205
  const trustedOrigins = [config.baseURL, "http://localhost:*"].filter((origin) => origin !== void 0);
97236
97206
  const crossSubDomainCookieDomain = config.baseURL ? new URL(config.baseURL).hostname : void 0;
@@ -97238,7 +97208,7 @@ function createAuth(config) {
97238
97208
  return betterAuth({
97239
97209
  database: drizzleAdapter(db, {
97240
97210
  provider,
97241
- schema: authSchema
97211
+ schema: schema$2
97242
97212
  }),
97243
97213
  secret: config.secret,
97244
97214
  baseURL: config.baseURL,
@@ -97294,8 +97264,7 @@ function createAuth(config) {
97294
97264
  if (signupEmail) {
97295
97265
  const authorization = await authorizeSelfHostSignUp({
97296
97266
  db,
97297
- email: signupEmail,
97298
- schema: tables
97267
+ email: signupEmail
97299
97268
  });
97300
97269
  if (!authorization.allowed) return ctx.json({
97301
97270
  error: authorization.message,
@@ -97310,7 +97279,7 @@ function createAuth(config) {
97310
97279
  if (!organizationId) return;
97311
97280
  const membership = await db.query.member.findFirst({
97312
97281
  columns: { role: true },
97313
- where: and(eq(tables.member.userId, session.user.id), eq(tables.member.organizationId, organizationId))
97282
+ where: and(eq(schema$2.member.userId, session.user.id), eq(schema$2.member.organizationId, organizationId))
97314
97283
  });
97315
97284
  if (!membership) return;
97316
97285
  if (!doesOrganizationMembershipGrantPermission({
@@ -97343,7 +97312,6 @@ function createAuthFromConfig(runtime, input = {}) {
97343
97312
  emailDelivery: runtime.auth.emailDelivery,
97344
97313
  enableTestUtils: input.enableTestUtils,
97345
97314
  provider: input.provider,
97346
- schema: input.schema,
97347
97315
  secret: runtime.auth.secret
97348
97316
  });
97349
97317
  }
@@ -97367,19 +97335,17 @@ function readEmailField(value) {
97367
97335
  //#endregion
97368
97336
  //#region packages/server/src/storage.ts
97369
97337
  function createServerStorage(runtime, apiRateLimitStorage, input = {}) {
97370
- const databaseRuntime = createDatabaseRuntime(runtime.storage.connectionString);
97338
+ const db = createDb(runtime.storage.connectionString);
97371
97339
  return {
97372
97340
  auth: createAuthFromConfig(runtime, {
97373
- db: databaseRuntime.db,
97341
+ db,
97374
97342
  enableTestUtils: input.enableAuthTestUtils,
97375
- provider: "pg",
97376
- schema: databaseRuntime.schema
97343
+ provider: "pg"
97377
97344
  }),
97378
- db: databaseRuntime.db,
97345
+ db,
97379
97346
  emailDelivery: runtime.auth.emailDelivery,
97380
97347
  emailDeliveryMode: getEmailDeliveryMode(runtime.auth.emailDelivery),
97381
- engine: databaseRuntime.engine,
97382
- schema: databaseRuntime.schema,
97348
+ engine: getDatabaseEngine(runtime.storage.connectionString),
97383
97349
  apiRateLimitStorage
97384
97350
  };
97385
97351
  }
@@ -97620,10 +97586,6 @@ function toCliErrorMessage(error) {
97620
97586
  }
97621
97587
  //#endregion
97622
97588
  //#region packages/cli-server/src/app.ts
97623
- function generateCliRequestId(c) {
97624
- const existingRequestId = c.get("requestId");
97625
- return typeof existingRequestId === "string" && existingRequestId.length > 0 ? existingRequestId : crypto.randomUUID();
97626
- }
97627
97589
  const cliRequestObservabilityMiddleware = createMiddleware$1(async (c, next) => {
97628
97590
  const requestStartedAtMs = Date.now();
97629
97591
  c.set("requestStartedAtMs", requestStartedAtMs);
@@ -97667,10 +97629,7 @@ function createCliApp(input) {
97667
97629
  const app = createCliRouter();
97668
97630
  app.use(cliRuntimeMiddleware(input.runtime));
97669
97631
  app.use(serverStorageMiddleware(input.storage));
97670
- app.use(requestId({
97671
- generator: generateCliRequestId,
97672
- headerName: CLI_REQUEST_ID_HEADER
97673
- }));
97632
+ app.use(requestId({ headerName: CLI_REQUEST_ID_HEADER }));
97674
97633
  app.use(cliRequestObservabilityMiddleware);
97675
97634
  return app;
97676
97635
  }
@@ -97678,10 +97637,7 @@ function createCliBrowserApp(input) {
97678
97637
  const app = createCliRouter();
97679
97638
  app.use(cliRuntimeMiddleware(input.runtime));
97680
97639
  app.use(serverStorageMiddleware(input.storage));
97681
- app.use(requestId({
97682
- generator: generateCliRequestId,
97683
- headerName: CLI_REQUEST_ID_HEADER
97684
- }));
97640
+ app.use(requestId({ headerName: CLI_REQUEST_ID_HEADER }));
97685
97641
  app.use(cliRequestObservabilityMiddleware);
97686
97642
  return app;
97687
97643
  }
@@ -107668,8 +107624,7 @@ const CliAuthSessionSchema = object$1({
107668
107624
  async function resolveActiveOrgSlug(storage, activeOrganizationId) {
107669
107625
  if (!activeOrganizationId) return null;
107670
107626
  try {
107671
- const { organization } = getDatabaseSchema(storage.db);
107672
- const [org] = await storage.db.select({ slug: organization.slug }).from(organization).where(eq(organization.id, activeOrganizationId)).limit(1);
107627
+ const [org] = await storage.db.select({ slug: organization$1.slug }).from(organization$1).where(eq(organization$1.id, activeOrganizationId)).limit(1);
107673
107628
  return org?.slug ?? activeOrganizationId;
107674
107629
  } catch {
107675
107630
  return activeOrganizationId;
@@ -107785,14 +107740,13 @@ function authorizeCliOrgAccess(input) {
107785
107740
  //#endregion
107786
107741
  //#region packages/cli-server/src/organization/effects.ts
107787
107742
  async function runCliLoadOrgAccess(input) {
107788
- const { member, organization } = getDatabaseSchema(input.db);
107789
107743
  const org = await input.db.query.organization.findFirst({
107790
107744
  columns: {
107791
107745
  id: true,
107792
107746
  slug: true,
107793
107747
  name: true
107794
107748
  },
107795
- where: eq(organization.slug, input.orgSlug)
107749
+ where: eq(organization$1.slug, input.orgSlug)
107796
107750
  });
107797
107751
  if (!org) return { kind: "not_found" };
107798
107752
  if (typeof org.slug !== "string" || org.slug.trim().length === 0) return { kind: "not_found" };
@@ -107806,7 +107760,7 @@ async function runCliLoadOrgAccess(input) {
107806
107760
  id: true,
107807
107761
  role: true
107808
107762
  },
107809
- where: and(eq(member.userId, input.userId), eq(member.organizationId, accessibleOrg.id))
107763
+ where: and(eq(member$1.userId, input.userId), eq(member$1.organizationId, accessibleOrg.id))
107810
107764
  });
107811
107765
  if (!membership) return { kind: "forbidden" };
107812
107766
  return {
@@ -107816,11 +107770,10 @@ async function runCliLoadOrgAccess(input) {
107816
107770
  };
107817
107771
  }
107818
107772
  async function runCliListVisibleOrgs(input) {
107819
- const { member, organization } = getDatabaseSchema(input.db);
107820
107773
  const rawRows = await input.db.select({
107821
- name: organization.name,
107822
- slug: organization.slug
107823
- }).from(member).innerJoin(organization, eq(member.organizationId, organization.id)).where(eq(member.userId, input.userId));
107774
+ name: organization$1.name,
107775
+ slug: organization$1.slug
107776
+ }).from(member$1).innerJoin(organization$1, eq(member$1.organizationId, organization$1.id)).where(eq(member$1.userId, input.userId));
107824
107777
  const orgs = [];
107825
107778
  for (const row of rawRows) {
107826
107779
  if (typeof row.slug !== "string" || row.slug.trim().length === 0) continue;
@@ -124796,13 +124749,6 @@ var ConnectorJobTimeoutError = class extends ConnectorBrokerError {
124796
124749
  this.timeoutMs = input.timeoutMs;
124797
124750
  }
124798
124751
  };
124799
- function getConnectorTables(db) {
124800
- const schema = getDatabaseSchema(db);
124801
- return {
124802
- connectorJobs: schema.connectorJobs,
124803
- connectors: schema.connectors
124804
- };
124805
- }
124806
124752
  function getTestStoreOverride() {
124807
124753
  return testStoreOverride;
124808
124754
  }
@@ -124883,7 +124829,6 @@ function authenticateConnectorInMemory(input) {
124883
124829
  });
124884
124830
  }
124885
124831
  async function authenticateConnectorInDb(input) {
124886
- const { connectors } = getConnectorTables(input.db);
124887
124832
  const [connector] = await input.db.select({
124888
124833
  authTokenHash: connectors.authTokenHash,
124889
124834
  connectorId: connectors.connectorId,
@@ -124924,7 +124869,6 @@ async function sleepUnlessAborted(input) {
124924
124869
  });
124925
124870
  }
124926
124871
  async function expireConnectorJobIfPending(input) {
124927
- const { connectorJobs } = getConnectorTables(input.db);
124928
124872
  await input.db.update(connectorJobs).set({
124929
124873
  completedAt: input.now,
124930
124874
  status: "expired",
@@ -124932,7 +124876,6 @@ async function expireConnectorJobIfPending(input) {
124932
124876
  }).where(and(eq(connectorJobs.jobId, input.jobId), or(eq(connectorJobs.status, "queued"), eq(connectorJobs.status, "leased"))));
124933
124877
  }
124934
124878
  async function waitForConnectorJobOutcomeInDb(input) {
124935
- const { connectorJobs } = getConnectorTables(input.db);
124936
124879
  const startedAt = Date.now();
124937
124880
  while (Date.now() - startedAt <= input.waitTimeoutMs) {
124938
124881
  const [job] = await input.db.select({
@@ -124965,7 +124908,6 @@ async function waitForConnectorJobOutcomeInDb(input) {
124965
124908
  }));
124966
124909
  }
124967
124910
  async function claimNextQueuedJobInDb(input) {
124968
- const { connectorJobs } = getConnectorTables(input.db);
124969
124911
  while (true) {
124970
124912
  const [candidate] = await input.db.select({
124971
124913
  database: connectorJobs.database,
@@ -125014,7 +124956,6 @@ function assertJobMutationAllowedInMemory(input) {
125014
124956
  }
125015
124957
  async function assertJobMutationAllowedInDb(request) {
125016
124958
  const db = resolveBrokerDb(request.db);
125017
- const { connectorJobs } = getConnectorTables(db);
125018
124959
  const auth = await authenticateConnectorInDb({
125019
124960
  authToken: request.authToken,
125020
124961
  connectorId: request.connectorId,
@@ -125039,7 +124980,6 @@ async function findConnectorIdByAuthToken(input) {
125039
124980
  return matchedConnectorId === null ? U$1.err(new ConnectorBrokerError("Invalid connector token", 401)) : U$1.ok(matchedConnectorId);
125040
124981
  }
125041
124982
  const db = resolveBrokerDb(input.db);
125042
- const { connectors } = getConnectorTables(db);
125043
124983
  const authTokenHash = await hashAuthToken(input.authToken);
125044
124984
  const [connector] = await db.select({ connectorId: connectors.connectorId }).from(connectors).where(eq(connectors.authTokenHash, authTokenHash)).limit(1);
125045
124985
  if (!connector?.connectorId) return U$1.err(new ConnectorBrokerError("Invalid connector token", 401));
@@ -125069,7 +125009,6 @@ async function registerConnector(input) {
125069
125009
  };
125070
125010
  }
125071
125011
  const db = resolveBrokerDb(input.db);
125072
- const { connectors } = getConnectorTables(db);
125073
125012
  const connectorId = generateConnectorId();
125074
125013
  const authToken = generateConnectorAuthToken();
125075
125014
  const authTokenHash = await hashAuthToken(authToken);
@@ -125096,9 +125035,7 @@ async function ensureConnectorOrganization(input) {
125096
125035
  if (connector.organizationId !== input.organizationId) return U$1.err(new ConnectorBrokerError("Connector belongs to a different organization", 403));
125097
125036
  return U$1.ok(void 0);
125098
125037
  }
125099
- const db = resolveBrokerDb(input.db);
125100
- const { connectors } = getConnectorTables(db);
125101
- const [connector] = await db.select({ organizationId: connectors.organizationId }).from(connectors).where(eq(connectors.connectorId, input.connectorId)).limit(1);
125038
+ const [connector] = await resolveBrokerDb(input.db).select({ organizationId: connectors.organizationId }).from(connectors).where(eq(connectors.connectorId, input.connectorId)).limit(1);
125102
125039
  if (!connector) return U$1.err(new ConnectorBrokerError("Connector not found", 404));
125103
125040
  if (connector.organizationId !== input.organizationId) return U$1.err(new ConnectorBrokerError("Connector belongs to a different organization", 403));
125104
125041
  return U$1.ok(void 0);
@@ -125121,7 +125058,6 @@ async function recordConnectorHeartbeat(input) {
125121
125058
  return U$1.ok(void 0);
125122
125059
  }
125123
125060
  const db = resolveBrokerDb(input.db);
125124
- const { connectors } = getConnectorTables(db);
125125
125061
  const auth = await authenticateConnectorInDb({
125126
125062
  authToken: input.authToken,
125127
125063
  connectorId: input.connectorId,
@@ -125173,7 +125109,6 @@ async function pollConnectorJob(input) {
125173
125109
  return U$1.ok(nextJob);
125174
125110
  }
125175
125111
  const db = resolveBrokerDb(input.db);
125176
- const { connectors } = getConnectorTables(db);
125177
125112
  const auth = await authenticateConnectorInDb({
125178
125113
  authToken: input.authToken,
125179
125114
  connectorId: input.connectorId,
@@ -125246,7 +125181,6 @@ async function queueConnectorAthenaJob(input) {
125246
125181
  });
125247
125182
  if (organizationCheck.isErr()) return U$1.err(organizationCheck.error);
125248
125183
  const now = /* @__PURE__ */ new Date();
125249
- const { connectorJobs } = getConnectorTables(db);
125250
125184
  const jobId = generateJobId();
125251
125185
  await db.insert(connectorJobs).values({
125252
125186
  connectorId: input.connectorId,
@@ -125287,7 +125221,6 @@ async function submitConnectorJobResult(input) {
125287
125221
  const prepared = await assertJobMutationAllowedInDb(input);
125288
125222
  if (prepared.isErr()) return U$1.err(prepared.error);
125289
125223
  const db = resolveBrokerDb(input.db);
125290
- const { connectorJobs } = getConnectorTables(db);
125291
125224
  const now = /* @__PURE__ */ new Date();
125292
125225
  const [updated] = await db.update(connectorJobs).set({
125293
125226
  completedAt: now,
@@ -125319,7 +125252,6 @@ async function submitConnectorJobError(input) {
125319
125252
  const prepared = await assertJobMutationAllowedInDb(input);
125320
125253
  if (prepared.isErr()) return U$1.err(prepared.error);
125321
125254
  const db = resolveBrokerDb(input.db);
125322
- const { connectorJobs } = getConnectorTables(db);
125323
125255
  const now = /* @__PURE__ */ new Date();
125324
125256
  const [updated] = await db.update(connectorJobs).set({
125325
125257
  completedAt: now,
@@ -154089,7 +154021,6 @@ async function runCliExecuteSqlEffect(input) {
154089
154021
  };
154090
154022
  }
154091
154023
  async function runCliPersistQueryUsageEffect(input) {
154092
- const { dataSources } = getDatabaseSchema(input.db);
154093
154024
  const persisted = await U$1.tryPromise(async () => {
154094
154025
  await input.db.update(dataSources).set({ lastUsedAt: /* @__PURE__ */ new Date() }).where(eq(dataSources.id, input.effect.sourceId));
154095
154026
  });
@@ -251504,7 +251435,6 @@ function normalizeSourceDisplayName(value) {
251504
251435
  //#endregion
251505
251436
  //#region packages/cli-server/src/source/effects.ts
251506
251437
  async function runCliListSourcesEffect(input) {
251507
- const { dataSources } = getDatabaseSchema(input.db);
251508
251438
  return {
251509
251439
  kind: "sources_loaded",
251510
251440
  sources: (await input.db.query.dataSources.findMany({
@@ -251522,7 +251452,6 @@ async function runCliListSourcesEffect(input) {
251522
251452
  };
251523
251453
  }
251524
251454
  async function runCliLoadSourceEffect(input) {
251525
- const { dataSources } = getDatabaseSchema(input.db);
251526
251455
  const row = await input.db.query.dataSources.findFirst({
251527
251456
  columns: {
251528
251457
  id: true,
@@ -251544,7 +251473,6 @@ async function runCliLoadSourceEffect(input) {
251544
251473
  };
251545
251474
  }
251546
251475
  async function runCliConnectSourceEffect(input) {
251547
- const { dataSources } = getDatabaseSchema(input.db);
251548
251476
  const encrypted = encryptCredentialsObject(input.effect.credentials, input.masterEncryptionKey);
251549
251477
  const [inserted] = await input.db.insert(dataSources).values({
251550
251478
  credentialsEncrypted: encrypted.ciphertext,
@@ -251587,7 +251515,6 @@ async function runCliTestSourceEffect(input) {
251587
251515
  if (preparedCredentials.isErr()) {
251588
251516
  const latencyMs = 0;
251589
251517
  const now = /* @__PURE__ */ new Date();
251590
- const { dataSources } = getDatabaseSchema(input.db);
251591
251518
  await input.db.update(dataSources).set({
251592
251519
  errorMessage: preparedCredentials.error.message,
251593
251520
  lastUsedAt: now,
@@ -251608,7 +251535,6 @@ async function runCliTestSourceEffect(input) {
251608
251535
  }));
251609
251536
  if (serialized.kind === "unsupported") return serialized;
251610
251537
  const now = /* @__PURE__ */ new Date();
251611
- const { dataSources } = getDatabaseSchema(input.db);
251612
251538
  await input.db.update(dataSources).set({
251613
251539
  errorMessage: serialized.result.success ? null : serialized.result.error,
251614
251540
  lastUsedAt: now,
@@ -254533,7 +254459,469 @@ let SourceApiActionFailureCode = /* @__PURE__ */ function(SourceApiActionFailure
254533
254459
  */
254534
254460
  const SourceApiActionFailureCodeSchema = enumDesc(file_onequery_workflow_v1_source_api_action, 6);
254535
254461
  //#endregion
254536
- //#region packages/cli-server/src/audit/source-api-action-family/protobuf-codec.ts
254462
+ //#region packages/cli-server/src/audit/source-api-action-family/protobuf-codec/enums.ts
254463
+ function toWorkflowSourceProvider(provider) {
254464
+ switch (provider) {
254465
+ case "postgres": return WorkflowSourceProvider.POSTGRES;
254466
+ case "supabase": return WorkflowSourceProvider.SUPABASE;
254467
+ case "mysql": return WorkflowSourceProvider.MYSQL;
254468
+ case "mongodb": return WorkflowSourceProvider.MONGODB;
254469
+ case "bigquery": return WorkflowSourceProvider.BIGQUERY;
254470
+ case "laminar": return WorkflowSourceProvider.LAMINAR;
254471
+ case "aws_athena_connector": return WorkflowSourceProvider.AWS_ATHENA_CONNECTOR;
254472
+ case "ga": return WorkflowSourceProvider.GOOGLE_ANALYTICS;
254473
+ case "amplitude": return WorkflowSourceProvider.AMPLITUDE;
254474
+ case "mixpanel": return WorkflowSourceProvider.MIXPANEL;
254475
+ case "posthog": return WorkflowSourceProvider.POSTHOG;
254476
+ case "sentry": return WorkflowSourceProvider.SENTRY;
254477
+ case "github": return WorkflowSourceProvider.GITHUB;
254478
+ case "linear": return WorkflowSourceProvider.LINEAR;
254479
+ default: return assertNever$4(provider);
254480
+ }
254481
+ }
254482
+ function fromWorkflowSourceProvider(provider) {
254483
+ switch (provider) {
254484
+ case WorkflowSourceProvider.POSTGRES: return "postgres";
254485
+ case WorkflowSourceProvider.SUPABASE: return "supabase";
254486
+ case WorkflowSourceProvider.MYSQL: return "mysql";
254487
+ case WorkflowSourceProvider.MONGODB: return "mongodb";
254488
+ case WorkflowSourceProvider.BIGQUERY: return "bigquery";
254489
+ case WorkflowSourceProvider.LAMINAR: return "laminar";
254490
+ case WorkflowSourceProvider.AWS_ATHENA_CONNECTOR: return "aws_athena_connector";
254491
+ case WorkflowSourceProvider.GOOGLE_ANALYTICS: return "ga";
254492
+ case WorkflowSourceProvider.AMPLITUDE: return "amplitude";
254493
+ case WorkflowSourceProvider.MIXPANEL: return "mixpanel";
254494
+ case WorkflowSourceProvider.POSTHOG: return "posthog";
254495
+ case WorkflowSourceProvider.SENTRY: return "sentry";
254496
+ case WorkflowSourceProvider.GITHUB: return "github";
254497
+ case WorkflowSourceProvider.LINEAR: return "linear";
254498
+ case WorkflowSourceProvider.UNSPECIFIED: throw new Error("workflow source provider is unspecified");
254499
+ default: throw new Error(`unsupported workflow source provider: ${provider}`);
254500
+ }
254501
+ }
254502
+ function toSourceApiRequestKind(kind) {
254503
+ switch (kind) {
254504
+ case "describe": return SourceApiActionRequestKind.DESCRIBE;
254505
+ case "invoke": return SourceApiActionRequestKind.INVOKE;
254506
+ default: return assertNever$4(kind);
254507
+ }
254508
+ }
254509
+ function fromSourceApiRequestKind(kind) {
254510
+ switch (kind) {
254511
+ case SourceApiActionRequestKind.DESCRIBE: return "describe";
254512
+ case SourceApiActionRequestKind.INVOKE: return "invoke";
254513
+ case SourceApiActionRequestKind.UNSPECIFIED: throw new Error("source api request kind is unspecified");
254514
+ default: throw new Error(`unsupported source api request kind: ${kind}`);
254515
+ }
254516
+ }
254517
+ function toSourceApiInvokeMode(mode) {
254518
+ switch (mode) {
254519
+ case "preview_only": return SourceApiActionInvokeMode.PREVIEW_ONLY;
254520
+ case "execute": return SourceApiActionInvokeMode.EXECUTE;
254521
+ default: return assertNever$4(mode);
254522
+ }
254523
+ }
254524
+ function fromSourceApiInvokeMode(mode) {
254525
+ switch (mode) {
254526
+ case SourceApiActionInvokeMode.PREVIEW_ONLY: return "preview_only";
254527
+ case SourceApiActionInvokeMode.EXECUTE: return "execute";
254528
+ case SourceApiActionInvokeMode.UNSPECIFIED: throw new Error("source api invoke mode is unspecified");
254529
+ default: throw new Error(`unsupported source api invoke mode: ${mode}`);
254530
+ }
254531
+ }
254532
+ function toSourceApiOperationKind(kind) {
254533
+ switch (kind) {
254534
+ case "http_request": return SourceApiActionOperationKind.HTTP_REQUEST;
254535
+ case "structured_request": return SourceApiActionOperationKind.STRUCTURED_REQUEST;
254536
+ default: return assertNever$4(kind);
254537
+ }
254538
+ }
254539
+ function fromSourceApiOperationKind(kind) {
254540
+ switch (kind) {
254541
+ case SourceApiActionOperationKind.HTTP_REQUEST: return "http_request";
254542
+ case SourceApiActionOperationKind.STRUCTURED_REQUEST: return "structured_request";
254543
+ case SourceApiActionOperationKind.UNSPECIFIED: throw new Error("source api operation kind is unspecified");
254544
+ default: throw new Error(`unsupported source api operation kind: ${kind}`);
254545
+ }
254546
+ }
254547
+ function toSourceApiSelectorKind(kind) {
254548
+ switch (kind) {
254549
+ case "none": return SourceApiActionSelectorKind.NONE;
254550
+ case "path": return SourceApiActionSelectorKind.PATH;
254551
+ case "identifier": return SourceApiActionSelectorKind.IDENTIFIER;
254552
+ default: return assertNever$4(kind);
254553
+ }
254554
+ }
254555
+ function fromSourceApiSelectorKind(kind) {
254556
+ switch (kind) {
254557
+ case SourceApiActionSelectorKind.NONE: return "none";
254558
+ case SourceApiActionSelectorKind.PATH: return "path";
254559
+ case SourceApiActionSelectorKind.IDENTIFIER: return "identifier";
254560
+ case SourceApiActionSelectorKind.UNSPECIFIED: throw new Error("source api selector kind is unspecified");
254561
+ default: throw new Error(`unsupported source api selector kind: ${kind}`);
254562
+ }
254563
+ }
254564
+ function toSourceApiPaginationPolicy(policy) {
254565
+ switch (policy) {
254566
+ case "none": return SourceApiActionPaginationPolicy.NONE;
254567
+ case "continuation_token": return SourceApiActionPaginationPolicy.CONTINUATION_TOKEN;
254568
+ default: return assertNever$4(policy);
254569
+ }
254570
+ }
254571
+ function fromSourceApiPaginationPolicy(policy) {
254572
+ switch (policy) {
254573
+ case SourceApiActionPaginationPolicy.NONE: return "none";
254574
+ case SourceApiActionPaginationPolicy.CONTINUATION_TOKEN: return "continuation_token";
254575
+ case SourceApiActionPaginationPolicy.UNSPECIFIED: throw new Error("source api pagination policy is unspecified");
254576
+ default: throw new Error(`unsupported source api pagination policy: ${policy}`);
254577
+ }
254578
+ }
254579
+ function toSourceApiInputMode(mode) {
254580
+ switch (mode) {
254581
+ case "none": return SourceApiActionInputMode.NONE;
254582
+ case "request_object": return SourceApiActionInputMode.REQUEST_OBJECT;
254583
+ case "request_body": return SourceApiActionInputMode.REQUEST_BODY;
254584
+ default: return assertNever$4(mode);
254585
+ }
254586
+ }
254587
+ function fromSourceApiInputMode(mode) {
254588
+ switch (mode) {
254589
+ case SourceApiActionInputMode.NONE: return "none";
254590
+ case SourceApiActionInputMode.REQUEST_OBJECT: return "request_object";
254591
+ case SourceApiActionInputMode.REQUEST_BODY: return "request_body";
254592
+ case SourceApiActionInputMode.UNSPECIFIED: throw new Error("source api input mode is unspecified");
254593
+ default: throw new Error(`unsupported source api input mode: ${mode}`);
254594
+ }
254595
+ }
254596
+ function toSourceApiFailureCode(code) {
254597
+ switch (code) {
254598
+ case "source_not_found": return SourceApiActionFailureCode.SOURCE_NOT_FOUND;
254599
+ case "descriptor_unavailable": return SourceApiActionFailureCode.DESCRIPTOR_UNAVAILABLE;
254600
+ case "invalid_request": return SourceApiActionFailureCode.INVALID_REQUEST;
254601
+ case "permission_denied": return SourceApiActionFailureCode.PERMISSION_DENIED;
254602
+ case "request_timed_out": return SourceApiActionFailureCode.REQUEST_TIMED_OUT;
254603
+ case "execution_failed": return SourceApiActionFailureCode.EXECUTION_FAILED;
254604
+ case "execution_state_invalid": return SourceApiActionFailureCode.EXECUTION_STATE_INVALID;
254605
+ default: return assertNever$4(code);
254606
+ }
254607
+ }
254608
+ function fromDescriptorResolutionFailureCode(code) {
254609
+ switch (code) {
254610
+ case SourceApiActionFailureCode.DESCRIPTOR_UNAVAILABLE: return "descriptor_unavailable";
254611
+ case SourceApiActionFailureCode.PERMISSION_DENIED: return "permission_denied";
254612
+ case SourceApiActionFailureCode.UNSPECIFIED: throw new Error("source api failure code is unspecified");
254613
+ default: throw new Error(`unsupported descriptor resolution failure code: ${code}`);
254614
+ }
254615
+ }
254616
+ function fromRequestPreparationFailureCode(code) {
254617
+ switch (code) {
254618
+ case SourceApiActionFailureCode.INVALID_REQUEST: return "invalid_request";
254619
+ case SourceApiActionFailureCode.PERMISSION_DENIED: return "permission_denied";
254620
+ case SourceApiActionFailureCode.EXECUTION_STATE_INVALID: return "execution_state_invalid";
254621
+ case SourceApiActionFailureCode.UNSPECIFIED: throw new Error("source api failure code is unspecified");
254622
+ default: throw new Error(`unsupported request preparation failure code: ${code}`);
254623
+ }
254624
+ }
254625
+ function fromPageFetchFailureCode(code) {
254626
+ switch (code) {
254627
+ case SourceApiActionFailureCode.INVALID_REQUEST: return "invalid_request";
254628
+ case SourceApiActionFailureCode.REQUEST_TIMED_OUT: return "request_timed_out";
254629
+ case SourceApiActionFailureCode.EXECUTION_FAILED: return "execution_failed";
254630
+ case SourceApiActionFailureCode.EXECUTION_STATE_INVALID: return "execution_state_invalid";
254631
+ case SourceApiActionFailureCode.UNSPECIFIED: throw new Error("source api failure code is unspecified");
254632
+ default: throw new Error(`unsupported page fetch failure code: ${code}`);
254633
+ }
254634
+ }
254635
+ //#endregion
254636
+ //#region packages/cli-server/src/audit/source-api-action-family/protobuf-codec/shared.ts
254637
+ function assertMatchingPayloadType(expected, actual) {
254638
+ if (expected !== actual) throw new Error(`stored scalar payload type '${expected}' does not match protobuf payload type '${actual}'`);
254639
+ }
254640
+ function requireMessage(value, fieldName) {
254641
+ if (value === void 0) throw new Error(`missing required protobuf field: ${fieldName}`);
254642
+ return value;
254643
+ }
254644
+ //#endregion
254645
+ //#region packages/server/src/source-api/helpers/header-policy.ts
254646
+ function canonicalizeSourceApiHeaderName(name) {
254647
+ return name.trim().toLowerCase();
254648
+ }
254649
+ function canonicalizeSourceApiHeaderNames(names) {
254650
+ const canonicalNames = /* @__PURE__ */ new Set();
254651
+ for (const name of names) canonicalNames.add(canonicalizeSourceApiHeaderName(name));
254652
+ return [...canonicalNames];
254653
+ }
254654
+ function canonicalizeSourceApiHeaderPolicy(policy) {
254655
+ return {
254656
+ allowedRequestHeaders: canonicalizeSourceApiHeaderNames(policy.allowedRequestHeaders),
254657
+ allowedResponseHeaders: canonicalizeSourceApiHeaderNames(policy.allowedResponseHeaders)
254658
+ };
254659
+ }
254660
+ function canonicalizeSourceApiOperationHeaderPolicy(operation) {
254661
+ return {
254662
+ ...operation,
254663
+ headerPolicy: canonicalizeSourceApiHeaderPolicy(operation.headerPolicy)
254664
+ };
254665
+ }
254666
+ function canonicalizeSourceApiDescriptorHeaderPolicies(descriptor) {
254667
+ return {
254668
+ ...descriptor,
254669
+ operations: descriptor.operations.map(canonicalizeSourceApiOperationHeaderPolicy)
254670
+ };
254671
+ }
254672
+ //#endregion
254673
+ //#region packages/cli-server/src/audit/source-api-action-family/protobuf-codec/source-api-value-codec.ts
254674
+ function toSourceApiSourceDescriptorMessage(source) {
254675
+ return create(SourceApiActionSourceDescriptorSchema, {
254676
+ ...source.displayName === null ? {} : { displayName: source.displayName },
254677
+ provider: toWorkflowSourceProvider(source.provider),
254678
+ sourceId: source.sourceId,
254679
+ sourceKey: source.sourceKey
254680
+ });
254681
+ }
254682
+ function fromSourceApiSourceDescriptorMessage(source) {
254683
+ const value = requireMessage(source, "source");
254684
+ return {
254685
+ displayName: isFieldSet(value, SourceApiActionSourceDescriptorSchema.field.displayName) ? value.displayName : null,
254686
+ provider: fromWorkflowSourceProvider(value.provider),
254687
+ sourceId: value.sourceId,
254688
+ sourceKey: value.sourceKey
254689
+ };
254690
+ }
254691
+ function toSourceApiRequestDescriptorMessage(descriptor) {
254692
+ return create(SourceApiActionRequestDescriptorSchema, {
254693
+ ...descriptor.descriptorVersion === null ? {} : { descriptorVersion: descriptor.descriptorVersion },
254694
+ ...descriptor.kind === null ? {} : { kind: toSourceApiOperationKind(descriptor.kind) },
254695
+ ...descriptor.method === null ? {} : { method: descriptor.method },
254696
+ operation: descriptor.operation,
254697
+ ...descriptor.paginationPolicy === null ? {} : { paginationPolicy: toSourceApiPaginationPolicy(descriptor.paginationPolicy) },
254698
+ ...descriptor.selector === null ? {} : { selector: descriptor.selector }
254699
+ });
254700
+ }
254701
+ function fromSourceApiRequestDescriptorMessage(descriptor) {
254702
+ const value = requireMessage(descriptor, "request_descriptor");
254703
+ return {
254704
+ descriptorVersion: isFieldSet(value, SourceApiActionRequestDescriptorSchema.field.descriptorVersion) ? value.descriptorVersion : null,
254705
+ kind: isFieldSet(value, SourceApiActionRequestDescriptorSchema.field.kind) ? fromSourceApiOperationKind(value.kind) : null,
254706
+ method: isFieldSet(value, SourceApiActionRequestDescriptorSchema.field.method) ? value.method : null,
254707
+ operation: value.operation,
254708
+ paginationPolicy: isFieldSet(value, SourceApiActionRequestDescriptorSchema.field.paginationPolicy) ? fromSourceApiPaginationPolicy(value.paginationPolicy) : null,
254709
+ selector: isFieldSet(value, SourceApiActionRequestDescriptorSchema.field.selector) ? value.selector : null
254710
+ };
254711
+ }
254712
+ function toSourceApiDescriptorMessage(descriptor) {
254713
+ return create(SourceApiActionDescriptorSchema, {
254714
+ ...descriptor.defaultPathOperation === void 0 ? {} : { defaultPathOperation: descriptor.defaultPathOperation },
254715
+ descriptorVersion: descriptor.descriptorVersion,
254716
+ examples: descriptor.examples.map(toSourceApiExampleMessage),
254717
+ notes: [...descriptor.notes],
254718
+ operations: descriptor.operations.map(toSourceApiOperationMessage),
254719
+ source: create(SourceApiActionDescriptorSourceSchema, {
254720
+ ...descriptor.source.displayName === void 0 || descriptor.source.displayName === null ? {} : { displayName: descriptor.source.displayName },
254721
+ provider: toWorkflowSourceProvider(descriptor.source.provider),
254722
+ sourceKey: descriptor.source.sourceKey
254723
+ })
254724
+ });
254725
+ }
254726
+ function fromSourceApiDescriptorMessage(descriptor) {
254727
+ const value = requireMessage(descriptor, "descriptor");
254728
+ const source = requireMessage(value.source, "source");
254729
+ return {
254730
+ ...isFieldSet(value, SourceApiActionDescriptorSchema.field.defaultPathOperation) ? { defaultPathOperation: value.defaultPathOperation } : {},
254731
+ descriptorVersion: value.descriptorVersion,
254732
+ examples: value.examples.map(fromSourceApiExampleMessage),
254733
+ notes: [...value.notes],
254734
+ operations: value.operations.map(fromSourceApiOperationMessage),
254735
+ source: {
254736
+ ...isFieldSet(source, SourceApiActionDescriptorSourceSchema.field.displayName) ? { displayName: source.displayName } : {},
254737
+ provider: fromWorkflowSourceProvider(source.provider),
254738
+ sourceKey: source.sourceKey
254739
+ }
254740
+ };
254741
+ }
254742
+ function toSourceApiOperationMessage(operation) {
254743
+ return create(SourceApiActionOperationSchema, {
254744
+ description: operation.description,
254745
+ examples: operation.examples.map(toSourceApiExampleMessage),
254746
+ fieldPolicy: toSourceApiFieldPolicyMessage(operation.fieldPolicy),
254747
+ headerPolicy: toSourceApiHeaderPolicyMessage(operation.headerPolicy),
254748
+ kind: toSourceApiOperationKind(operation.kind),
254749
+ methodPolicy: toSourceApiMethodPolicyMessage(operation.methodPolicy),
254750
+ name: operation.name,
254751
+ notes: [...operation.notes],
254752
+ paginationPolicy: toSourceApiPaginationPolicy(operation.paginationPolicy),
254753
+ ...operation.selectorLabel === void 0 ? {} : { selectorLabel: operation.selectorLabel },
254754
+ selectorKind: toSourceApiSelectorKind(operation.selectorKind),
254755
+ summary: operation.summary
254756
+ });
254757
+ }
254758
+ function fromSourceApiOperationMessage(operation) {
254759
+ return {
254760
+ description: operation.description,
254761
+ examples: operation.examples.map(fromSourceApiExampleMessage),
254762
+ fieldPolicy: fromSourceApiFieldPolicyMessage(operation.fieldPolicy),
254763
+ headerPolicy: fromSourceApiHeaderPolicyMessage(operation.headerPolicy),
254764
+ kind: fromSourceApiOperationKind(operation.kind),
254765
+ methodPolicy: fromSourceApiMethodPolicyMessage(operation.methodPolicy),
254766
+ name: operation.name,
254767
+ notes: [...operation.notes],
254768
+ paginationPolicy: fromSourceApiPaginationPolicy(operation.paginationPolicy),
254769
+ ...isFieldSet(operation, SourceApiActionOperationSchema.field.selectorLabel) ? { selectorLabel: operation.selectorLabel } : {},
254770
+ selectorKind: fromSourceApiSelectorKind(operation.selectorKind),
254771
+ summary: operation.summary
254772
+ };
254773
+ }
254774
+ function toSourceApiMethodPolicyMessage(policy) {
254775
+ return create(SourceApiActionMethodPolicySchema, {
254776
+ allowedMethods: [...policy.allowedMethods],
254777
+ ...policy.defaultMethod === void 0 ? {} : { defaultMethod: policy.defaultMethod }
254778
+ });
254779
+ }
254780
+ function fromSourceApiMethodPolicyMessage(policy) {
254781
+ const value = requireMessage(policy, "method_policy");
254782
+ return {
254783
+ allowedMethods: [...value.allowedMethods],
254784
+ ...isFieldSet(value, SourceApiActionMethodPolicySchema.field.defaultMethod) ? { defaultMethod: value.defaultMethod } : {}
254785
+ };
254786
+ }
254787
+ function toSourceApiFieldPolicyMessage(policy) {
254788
+ return create(SourceApiActionFieldPolicySchema, {
254789
+ acceptsInput: policy.acceptsInput,
254790
+ allowsRawFields: policy.allowsRawFields,
254791
+ allowsTypedFields: policy.allowsTypedFields,
254792
+ inputMode: toSourceApiInputMode(policy.inputMode),
254793
+ mergePatches: policy.mergePatches,
254794
+ supportsArrayPaths: policy.supportsArrayPaths,
254795
+ supportsNestedPaths: policy.supportsNestedPaths
254796
+ });
254797
+ }
254798
+ function fromSourceApiFieldPolicyMessage(policy) {
254799
+ const value = requireMessage(policy, "field_policy");
254800
+ return {
254801
+ acceptsInput: value.acceptsInput,
254802
+ allowsRawFields: value.allowsRawFields,
254803
+ allowsTypedFields: value.allowsTypedFields,
254804
+ inputMode: fromSourceApiInputMode(value.inputMode),
254805
+ mergePatches: value.mergePatches,
254806
+ supportsArrayPaths: value.supportsArrayPaths,
254807
+ supportsNestedPaths: value.supportsNestedPaths
254808
+ };
254809
+ }
254810
+ function toSourceApiHeaderPolicyMessage(policy) {
254811
+ return create(SourceApiActionHeaderPolicySchema, {
254812
+ allowedRequestHeaderNames: canonicalizeSourceApiHeaderNames(policy.allowedRequestHeaders),
254813
+ allowedResponseHeaderNames: canonicalizeSourceApiHeaderNames(policy.allowedResponseHeaders)
254814
+ });
254815
+ }
254816
+ function fromSourceApiHeaderPolicyMessage(policy) {
254817
+ const value = requireMessage(policy, "header_policy");
254818
+ return {
254819
+ allowedRequestHeaders: [...value.allowedRequestHeaderNames],
254820
+ allowedResponseHeaders: [...value.allowedResponseHeaderNames]
254821
+ };
254822
+ }
254823
+ function toSourceApiExampleMessage(example) {
254824
+ return create(SourceApiActionExampleSchema, {
254825
+ command: example.command,
254826
+ ...example.description === void 0 ? {} : { description: example.description },
254827
+ label: example.label
254828
+ });
254829
+ }
254830
+ function fromSourceApiExampleMessage(example) {
254831
+ return {
254832
+ command: example.command,
254833
+ ...isFieldSet(example, SourceApiActionExampleSchema.field.description) ? { description: example.description } : {},
254834
+ label: example.label
254835
+ };
254836
+ }
254837
+ function toSourceApiExecutionResultMessage(result) {
254838
+ return create(SourceApiActionExecutionResultSchema, {
254839
+ body: toSourceApiExecutionBodyMessage(result.body),
254840
+ contentType: result.contentType,
254841
+ headers: result.headers.map((header) => create(WorkflowSourceHeaderSchema, {
254842
+ name: header.name,
254843
+ value: header.value
254844
+ })),
254845
+ ...result.nextContinuationState === void 0 ? {} : { nextContinuationState: fromJson(ValueSchema, result.nextContinuationState) },
254846
+ operation: result.operation,
254847
+ ...result.selector === void 0 ? {} : { selector: result.selector },
254848
+ httpStatus: result.status,
254849
+ source: toSourceApiExecutionSourceMessage(result.source)
254850
+ });
254851
+ }
254852
+ function fromSourceApiExecutionResultMessage(result) {
254853
+ const value = requireMessage(result, "execution_result");
254854
+ return {
254855
+ body: fromSourceApiExecutionBodyMessage(value.body),
254856
+ contentType: value.contentType,
254857
+ headers: value.headers.map((header) => ({
254858
+ name: header.name,
254859
+ value: header.value
254860
+ })),
254861
+ ...value.nextContinuationState === void 0 ? {} : { nextContinuationState: toJson(ValueSchema, value.nextContinuationState) },
254862
+ operation: value.operation,
254863
+ ...isFieldSet(value, SourceApiActionExecutionResultSchema.field.selector) ? { selector: value.selector } : {},
254864
+ source: fromSourceApiExecutionSourceMessage(value.source),
254865
+ status: value.httpStatus
254866
+ };
254867
+ }
254868
+ function toSourceApiExecutionSourceMessage(source) {
254869
+ return create(SourceApiActionExecutionSourceSchema, {
254870
+ ...source.displayName === void 0 || source.displayName === null ? {} : { displayName: source.displayName },
254871
+ provider: toWorkflowSourceProvider(source.provider),
254872
+ sourceKey: source.sourceKey
254873
+ });
254874
+ }
254875
+ function fromSourceApiExecutionSourceMessage(source) {
254876
+ const value = requireMessage(source, "source");
254877
+ return {
254878
+ ...isFieldSet(value, SourceApiActionExecutionSourceSchema.field.displayName) ? { displayName: value.displayName } : {},
254879
+ provider: fromWorkflowSourceProvider(value.provider),
254880
+ sourceKey: value.sourceKey
254881
+ };
254882
+ }
254883
+ function toSourceApiExecutionBodyMessage(body) {
254884
+ switch (body.kind) {
254885
+ case "none": return {
254886
+ case: "none",
254887
+ value: create(SourceApiActionEmptyBodySchema)
254888
+ };
254889
+ case "json": return {
254890
+ case: "json",
254891
+ value: fromJson(ValueSchema, body.value)
254892
+ };
254893
+ case "text": return {
254894
+ case: "text",
254895
+ value: body.value
254896
+ };
254897
+ case "binary": return {
254898
+ case: "binary",
254899
+ value: body.value
254900
+ };
254901
+ default: return assertNever$4(body);
254902
+ }
254903
+ }
254904
+ function fromSourceApiExecutionBodyMessage(body) {
254905
+ switch (body.case) {
254906
+ case "none": return { kind: "none" };
254907
+ case "json": return {
254908
+ kind: "json",
254909
+ value: toJson(ValueSchema, body.value)
254910
+ };
254911
+ case "text": return {
254912
+ kind: "text",
254913
+ value: body.value
254914
+ };
254915
+ case "binary": return {
254916
+ kind: "binary",
254917
+ value: new Uint8Array(body.value)
254918
+ };
254919
+ case void 0: throw new Error("source api execution result body missing oneof case");
254920
+ default: return assertNever$4(body);
254921
+ }
254922
+ }
254923
+ //#endregion
254924
+ //#region packages/cli-server/src/audit/source-api-action-family/protobuf-codec/command-payload.ts
254537
254925
  init_dist$3();
254538
254926
  function encodeSourceApiActionCommandPayload(payload) {
254539
254927
  return encodeWorkflowPayload(SourceApiActionCommandPayloadSchema, toSourceApiActionCommandMessage(payload));
@@ -254583,46 +254971,6 @@ function decodeSourceApiActionCommandPayload(bytes, context) {
254583
254971
  return fromSourceApiActionCommandMessage(decoded.value);
254584
254972
  });
254585
254973
  }
254586
- function encodeSourceApiActionEventPayload(event) {
254587
- return encodeWorkflowPayload(SourceApiActionEventPayloadSchema, toSourceApiActionEventMessage(event));
254588
- }
254589
- function decodeSourceApiActionEventPayload(bytes, context) {
254590
- const decoded = decodeWorkflowPayload(SourceApiActionEventPayloadSchema, bytes, {
254591
- ...context,
254592
- entity: "source_api_action_event_payload",
254593
- family: "source_api_action"
254594
- });
254595
- if (decoded.isErr()) return U$1.err(decoded.error);
254596
- return convertWorkflowPayload({
254597
- ...context,
254598
- entity: "source_api_action_event_payload",
254599
- family: "source_api_action"
254600
- }, () => {
254601
- const event = fromSourceApiActionEventMessage(decoded.value);
254602
- assertMatchingPayloadType(context.payloadType, event.type);
254603
- return event;
254604
- });
254605
- }
254606
- function encodeSourceApiActionEffectPayload(effect) {
254607
- return encodeWorkflowPayload(SourceApiActionEffectPayloadSchema, toSourceApiActionEffectMessage(effect));
254608
- }
254609
- function decodeSourceApiActionEffectPayload(bytes, context) {
254610
- const decoded = decodeWorkflowPayload(SourceApiActionEffectPayloadSchema, bytes, {
254611
- ...context,
254612
- entity: "source_api_action_effect_payload",
254613
- family: "source_api_action"
254614
- });
254615
- if (decoded.isErr()) return U$1.err(decoded.error);
254616
- return convertWorkflowPayload({
254617
- ...context,
254618
- entity: "source_api_action_effect_payload",
254619
- family: "source_api_action"
254620
- }, () => {
254621
- const effect = fromSourceApiActionEffectMessage(decoded.value);
254622
- assertMatchingPayloadType(context.payloadType, effect.type);
254623
- return effect;
254624
- });
254625
- }
254626
254974
  function toSourceApiActionCommandMessage(payload) {
254627
254975
  switch (payload.type) {
254628
254976
  case "start_describe": return create(SourceApiActionCommandPayloadSchema, { command: {
@@ -254815,6 +255163,113 @@ function getSourceApiActionCommandPayloadTypeFromOneofCase(oneofCase) {
254815
255163
  default: return assertNever$4(oneofCase);
254816
255164
  }
254817
255165
  }
255166
+ //#endregion
255167
+ //#region packages/cli-server/src/audit/source-api-action-family/protobuf-codec/effect-payload.ts
255168
+ init_dist$3();
255169
+ function encodeSourceApiActionEffectPayload(effect) {
255170
+ return encodeWorkflowPayload(SourceApiActionEffectPayloadSchema, toSourceApiActionEffectMessage(effect));
255171
+ }
255172
+ function decodeSourceApiActionEffectPayload(bytes, context) {
255173
+ const decoded = decodeWorkflowPayload(SourceApiActionEffectPayloadSchema, bytes, {
255174
+ ...context,
255175
+ entity: "source_api_action_effect_payload",
255176
+ family: "source_api_action"
255177
+ });
255178
+ if (decoded.isErr()) return U$1.err(decoded.error);
255179
+ return convertWorkflowPayload({
255180
+ ...context,
255181
+ entity: "source_api_action_effect_payload",
255182
+ family: "source_api_action"
255183
+ }, () => {
255184
+ const effect = fromSourceApiActionEffectMessage(decoded.value);
255185
+ assertMatchingPayloadType(context.payloadType, effect.type);
255186
+ return effect;
255187
+ });
255188
+ }
255189
+ function toSourceApiActionEffectMessage(effect) {
255190
+ switch (effect.type) {
255191
+ case "load_source": return create(SourceApiActionEffectPayloadSchema, { effect: {
255192
+ case: "loadSource",
255193
+ value: create(SourceApiActionLoadSourceEffectSchema, {
255194
+ organizationId: effect.organizationId,
255195
+ sourceKey: effect.sourceKey
255196
+ })
255197
+ } });
255198
+ case "resolve_descriptor": return create(SourceApiActionEffectPayloadSchema, { effect: {
255199
+ case: "resolveDescriptor",
255200
+ value: create(SourceApiActionResolveDescriptorEffectSchema, { source: toSourceApiSourceDescriptorMessage(effect.source) })
255201
+ } });
255202
+ case "prepare_request": return create(SourceApiActionEffectPayloadSchema, { effect: {
255203
+ case: "prepareRequest",
255204
+ value: create(SourceApiActionPrepareRequestEffectSchema, {
255205
+ requestDescriptor: toSourceApiRequestDescriptorMessage(effect.requestDescriptor),
255206
+ source: toSourceApiSourceDescriptorMessage(effect.source)
255207
+ })
255208
+ } });
255209
+ case "execute_page": return create(SourceApiActionEffectPayloadSchema, { effect: {
255210
+ case: "executePage",
255211
+ value: create(SourceApiActionExecutePageEffectSchema, {
255212
+ attemptNumber: effect.attemptNumber,
255213
+ pageIndex: effect.pageIndex,
255214
+ preparedRequestFingerprint: effect.preparedRequestFingerprint,
255215
+ requestDescriptor: toSourceApiRequestDescriptorMessage(effect.requestDescriptor),
255216
+ source: toSourceApiSourceDescriptorMessage(effect.source)
255217
+ })
255218
+ } });
255219
+ default: return assertNever$4(effect);
255220
+ }
255221
+ }
255222
+ function fromSourceApiActionEffectMessage(payload) {
255223
+ switch (payload.effect.case) {
255224
+ case "loadSource": return {
255225
+ organizationId: payload.effect.value.organizationId,
255226
+ sourceKey: payload.effect.value.sourceKey,
255227
+ type: "load_source"
255228
+ };
255229
+ case "resolveDescriptor": return {
255230
+ source: fromSourceApiSourceDescriptorMessage(payload.effect.value.source),
255231
+ type: "resolve_descriptor"
255232
+ };
255233
+ case "prepareRequest": return {
255234
+ requestDescriptor: fromSourceApiRequestDescriptorMessage(payload.effect.value.requestDescriptor),
255235
+ source: fromSourceApiSourceDescriptorMessage(payload.effect.value.source),
255236
+ type: "prepare_request"
255237
+ };
255238
+ case "executePage": return {
255239
+ attemptNumber: payload.effect.value.attemptNumber,
255240
+ pageIndex: payload.effect.value.pageIndex,
255241
+ preparedRequestFingerprint: payload.effect.value.preparedRequestFingerprint,
255242
+ requestDescriptor: fromSourceApiRequestDescriptorMessage(payload.effect.value.requestDescriptor),
255243
+ source: fromSourceApiSourceDescriptorMessage(payload.effect.value.source),
255244
+ type: "execute_page"
255245
+ };
255246
+ case void 0: throw new Error("source api action effect payload missing oneof case");
255247
+ default: return assertNever$4(payload.effect);
255248
+ }
255249
+ }
255250
+ //#endregion
255251
+ //#region packages/cli-server/src/audit/source-api-action-family/protobuf-codec/event-payload.ts
255252
+ init_dist$3();
255253
+ function encodeSourceApiActionEventPayload(event) {
255254
+ return encodeWorkflowPayload(SourceApiActionEventPayloadSchema, toSourceApiActionEventMessage(event));
255255
+ }
255256
+ function decodeSourceApiActionEventPayload(bytes, context) {
255257
+ const decoded = decodeWorkflowPayload(SourceApiActionEventPayloadSchema, bytes, {
255258
+ ...context,
255259
+ entity: "source_api_action_event_payload",
255260
+ family: "source_api_action"
255261
+ });
255262
+ if (decoded.isErr()) return U$1.err(decoded.error);
255263
+ return convertWorkflowPayload({
255264
+ ...context,
255265
+ entity: "source_api_action_event_payload",
255266
+ family: "source_api_action"
255267
+ }, () => {
255268
+ const event = fromSourceApiActionEventMessage(decoded.value);
255269
+ assertMatchingPayloadType(context.payloadType, event.type);
255270
+ return event;
255271
+ });
255272
+ }
254818
255273
  function toSourceApiActionEventMessage(event) {
254819
255274
  switch (event.type) {
254820
255275
  case "action_received": return create(SourceApiActionEventPayloadSchema, { event: {
@@ -254941,495 +255396,6 @@ function fromSourceApiActionEventMessage(payload) {
254941
255396
  default: return assertNever$4(payload.event);
254942
255397
  }
254943
255398
  }
254944
- function toSourceApiActionEffectMessage(effect) {
254945
- switch (effect.type) {
254946
- case "load_source": return create(SourceApiActionEffectPayloadSchema, { effect: {
254947
- case: "loadSource",
254948
- value: create(SourceApiActionLoadSourceEffectSchema, {
254949
- organizationId: effect.organizationId,
254950
- sourceKey: effect.sourceKey
254951
- })
254952
- } });
254953
- case "resolve_descriptor": return create(SourceApiActionEffectPayloadSchema, { effect: {
254954
- case: "resolveDescriptor",
254955
- value: create(SourceApiActionResolveDescriptorEffectSchema, { source: toSourceApiSourceDescriptorMessage(effect.source) })
254956
- } });
254957
- case "prepare_request": return create(SourceApiActionEffectPayloadSchema, { effect: {
254958
- case: "prepareRequest",
254959
- value: create(SourceApiActionPrepareRequestEffectSchema, {
254960
- requestDescriptor: toSourceApiRequestDescriptorMessage(effect.requestDescriptor),
254961
- source: toSourceApiSourceDescriptorMessage(effect.source)
254962
- })
254963
- } });
254964
- case "execute_page": return create(SourceApiActionEffectPayloadSchema, { effect: {
254965
- case: "executePage",
254966
- value: create(SourceApiActionExecutePageEffectSchema, {
254967
- attemptNumber: effect.attemptNumber,
254968
- pageIndex: effect.pageIndex,
254969
- preparedRequestFingerprint: effect.preparedRequestFingerprint,
254970
- requestDescriptor: toSourceApiRequestDescriptorMessage(effect.requestDescriptor),
254971
- source: toSourceApiSourceDescriptorMessage(effect.source)
254972
- })
254973
- } });
254974
- default: return assertNever$4(effect);
254975
- }
254976
- }
254977
- function fromSourceApiActionEffectMessage(payload) {
254978
- switch (payload.effect.case) {
254979
- case "loadSource": return {
254980
- organizationId: payload.effect.value.organizationId,
254981
- sourceKey: payload.effect.value.sourceKey,
254982
- type: "load_source"
254983
- };
254984
- case "resolveDescriptor": return {
254985
- source: fromSourceApiSourceDescriptorMessage(payload.effect.value.source),
254986
- type: "resolve_descriptor"
254987
- };
254988
- case "prepareRequest": return {
254989
- requestDescriptor: fromSourceApiRequestDescriptorMessage(payload.effect.value.requestDescriptor),
254990
- source: fromSourceApiSourceDescriptorMessage(payload.effect.value.source),
254991
- type: "prepare_request"
254992
- };
254993
- case "executePage": return {
254994
- attemptNumber: payload.effect.value.attemptNumber,
254995
- pageIndex: payload.effect.value.pageIndex,
254996
- preparedRequestFingerprint: payload.effect.value.preparedRequestFingerprint,
254997
- requestDescriptor: fromSourceApiRequestDescriptorMessage(payload.effect.value.requestDescriptor),
254998
- source: fromSourceApiSourceDescriptorMessage(payload.effect.value.source),
254999
- type: "execute_page"
255000
- };
255001
- case void 0: throw new Error("source api action effect payload missing oneof case");
255002
- default: return assertNever$4(payload.effect);
255003
- }
255004
- }
255005
- function toSourceApiSourceDescriptorMessage(source) {
255006
- return create(SourceApiActionSourceDescriptorSchema, {
255007
- ...source.displayName === null ? {} : { displayName: source.displayName },
255008
- provider: toWorkflowSourceProvider(source.provider),
255009
- sourceId: source.sourceId,
255010
- sourceKey: source.sourceKey
255011
- });
255012
- }
255013
- function fromSourceApiSourceDescriptorMessage(source) {
255014
- const value = requireMessage(source, "source");
255015
- return {
255016
- displayName: isFieldSet(value, SourceApiActionSourceDescriptorSchema.field.displayName) ? value.displayName : null,
255017
- provider: fromWorkflowSourceProvider(value.provider),
255018
- sourceId: value.sourceId,
255019
- sourceKey: value.sourceKey
255020
- };
255021
- }
255022
- function toSourceApiRequestDescriptorMessage(descriptor) {
255023
- return create(SourceApiActionRequestDescriptorSchema, {
255024
- ...descriptor.descriptorVersion === null ? {} : { descriptorVersion: descriptor.descriptorVersion },
255025
- ...descriptor.kind === null ? {} : { kind: toSourceApiOperationKind(descriptor.kind) },
255026
- ...descriptor.method === null ? {} : { method: descriptor.method },
255027
- operation: descriptor.operation,
255028
- ...descriptor.paginationPolicy === null ? {} : { paginationPolicy: toSourceApiPaginationPolicy(descriptor.paginationPolicy) },
255029
- ...descriptor.selector === null ? {} : { selector: descriptor.selector }
255030
- });
255031
- }
255032
- function fromSourceApiRequestDescriptorMessage(descriptor) {
255033
- const value = requireMessage(descriptor, "request_descriptor");
255034
- return {
255035
- descriptorVersion: isFieldSet(value, SourceApiActionRequestDescriptorSchema.field.descriptorVersion) ? value.descriptorVersion : null,
255036
- kind: isFieldSet(value, SourceApiActionRequestDescriptorSchema.field.kind) ? fromSourceApiOperationKind(value.kind) : null,
255037
- method: isFieldSet(value, SourceApiActionRequestDescriptorSchema.field.method) ? value.method : null,
255038
- operation: value.operation,
255039
- paginationPolicy: isFieldSet(value, SourceApiActionRequestDescriptorSchema.field.paginationPolicy) ? fromSourceApiPaginationPolicy(value.paginationPolicy) : null,
255040
- selector: isFieldSet(value, SourceApiActionRequestDescriptorSchema.field.selector) ? value.selector : null
255041
- };
255042
- }
255043
- function toSourceApiDescriptorMessage(descriptor) {
255044
- return create(SourceApiActionDescriptorSchema, {
255045
- ...descriptor.defaultPathOperation === void 0 ? {} : { defaultPathOperation: descriptor.defaultPathOperation },
255046
- descriptorVersion: descriptor.descriptorVersion,
255047
- examples: descriptor.examples.map(toSourceApiExampleMessage),
255048
- notes: [...descriptor.notes],
255049
- operations: descriptor.operations.map(toSourceApiOperationMessage),
255050
- source: create(SourceApiActionDescriptorSourceSchema, {
255051
- ...descriptor.source.displayName === void 0 || descriptor.source.displayName === null ? {} : { displayName: descriptor.source.displayName },
255052
- provider: toWorkflowSourceProvider(descriptor.source.provider),
255053
- sourceKey: descriptor.source.sourceKey
255054
- })
255055
- });
255056
- }
255057
- function fromSourceApiDescriptorMessage(descriptor) {
255058
- const value = requireMessage(descriptor, "descriptor");
255059
- const source = requireMessage(value.source, "source");
255060
- return {
255061
- ...isFieldSet(value, SourceApiActionDescriptorSchema.field.defaultPathOperation) ? { defaultPathOperation: value.defaultPathOperation } : {},
255062
- descriptorVersion: value.descriptorVersion,
255063
- examples: value.examples.map(fromSourceApiExampleMessage),
255064
- notes: [...value.notes],
255065
- operations: value.operations.map(fromSourceApiOperationMessage),
255066
- source: {
255067
- ...isFieldSet(source, SourceApiActionDescriptorSourceSchema.field.displayName) ? { displayName: source.displayName } : {},
255068
- provider: fromWorkflowSourceProvider(source.provider),
255069
- sourceKey: source.sourceKey
255070
- }
255071
- };
255072
- }
255073
- function toSourceApiOperationMessage(operation) {
255074
- return create(SourceApiActionOperationSchema, {
255075
- description: operation.description,
255076
- examples: operation.examples.map(toSourceApiExampleMessage),
255077
- fieldPolicy: toSourceApiFieldPolicyMessage(operation.fieldPolicy),
255078
- headerPolicy: toSourceApiHeaderPolicyMessage(operation.headerPolicy),
255079
- kind: toSourceApiOperationKind(operation.kind),
255080
- methodPolicy: toSourceApiMethodPolicyMessage(operation.methodPolicy),
255081
- name: operation.name,
255082
- notes: [...operation.notes],
255083
- paginationPolicy: toSourceApiPaginationPolicy(operation.paginationPolicy),
255084
- ...operation.selectorLabel === void 0 ? {} : { selectorLabel: operation.selectorLabel },
255085
- selectorKind: toSourceApiSelectorKind(operation.selectorKind),
255086
- summary: operation.summary
255087
- });
255088
- }
255089
- function fromSourceApiOperationMessage(operation) {
255090
- return {
255091
- description: operation.description,
255092
- examples: operation.examples.map(fromSourceApiExampleMessage),
255093
- fieldPolicy: fromSourceApiFieldPolicyMessage(operation.fieldPolicy),
255094
- headerPolicy: fromSourceApiHeaderPolicyMessage(operation.headerPolicy),
255095
- kind: fromSourceApiOperationKind(operation.kind),
255096
- methodPolicy: fromSourceApiMethodPolicyMessage(operation.methodPolicy),
255097
- name: operation.name,
255098
- notes: [...operation.notes],
255099
- paginationPolicy: fromSourceApiPaginationPolicy(operation.paginationPolicy),
255100
- ...isFieldSet(operation, SourceApiActionOperationSchema.field.selectorLabel) ? { selectorLabel: operation.selectorLabel } : {},
255101
- selectorKind: fromSourceApiSelectorKind(operation.selectorKind),
255102
- summary: operation.summary
255103
- };
255104
- }
255105
- function toSourceApiMethodPolicyMessage(policy) {
255106
- return create(SourceApiActionMethodPolicySchema, {
255107
- allowedMethods: [...policy.allowedMethods],
255108
- ...policy.defaultMethod === void 0 ? {} : { defaultMethod: policy.defaultMethod }
255109
- });
255110
- }
255111
- function fromSourceApiMethodPolicyMessage(policy) {
255112
- const value = requireMessage(policy, "method_policy");
255113
- return {
255114
- allowedMethods: [...value.allowedMethods],
255115
- ...isFieldSet(value, SourceApiActionMethodPolicySchema.field.defaultMethod) ? { defaultMethod: value.defaultMethod } : {}
255116
- };
255117
- }
255118
- function toSourceApiFieldPolicyMessage(policy) {
255119
- return create(SourceApiActionFieldPolicySchema, {
255120
- acceptsInput: policy.acceptsInput,
255121
- allowsRawFields: policy.allowsRawFields,
255122
- allowsTypedFields: policy.allowsTypedFields,
255123
- inputMode: toSourceApiInputMode(policy.inputMode),
255124
- mergePatches: policy.mergePatches,
255125
- supportsArrayPaths: policy.supportsArrayPaths,
255126
- supportsNestedPaths: policy.supportsNestedPaths
255127
- });
255128
- }
255129
- function fromSourceApiFieldPolicyMessage(policy) {
255130
- const value = requireMessage(policy, "field_policy");
255131
- return {
255132
- acceptsInput: value.acceptsInput,
255133
- allowsRawFields: value.allowsRawFields,
255134
- allowsTypedFields: value.allowsTypedFields,
255135
- inputMode: fromSourceApiInputMode(value.inputMode),
255136
- mergePatches: value.mergePatches,
255137
- supportsArrayPaths: value.supportsArrayPaths,
255138
- supportsNestedPaths: value.supportsNestedPaths
255139
- };
255140
- }
255141
- function toSourceApiHeaderPolicyMessage(policy) {
255142
- return create(SourceApiActionHeaderPolicySchema, {
255143
- allowedRequestHeaderNames: [...policy.allowedRequestHeaders],
255144
- allowedResponseHeaderNames: [...policy.allowedResponseHeaders]
255145
- });
255146
- }
255147
- function fromSourceApiHeaderPolicyMessage(policy) {
255148
- const value = requireMessage(policy, "header_policy");
255149
- return {
255150
- allowedRequestHeaders: [...value.allowedRequestHeaderNames],
255151
- allowedResponseHeaders: [...value.allowedResponseHeaderNames]
255152
- };
255153
- }
255154
- function toSourceApiExampleMessage(example) {
255155
- return create(SourceApiActionExampleSchema, {
255156
- command: example.command,
255157
- ...example.description === void 0 ? {} : { description: example.description },
255158
- label: example.label
255159
- });
255160
- }
255161
- function fromSourceApiExampleMessage(example) {
255162
- return {
255163
- command: example.command,
255164
- ...isFieldSet(example, SourceApiActionExampleSchema.field.description) ? { description: example.description } : {},
255165
- label: example.label
255166
- };
255167
- }
255168
- function toSourceApiExecutionResultMessage(result) {
255169
- return create(SourceApiActionExecutionResultSchema, {
255170
- body: toSourceApiExecutionBodyMessage(result.body),
255171
- contentType: result.contentType,
255172
- headers: result.headers.map((header) => create(WorkflowSourceHeaderSchema, {
255173
- name: header.name,
255174
- value: header.value
255175
- })),
255176
- ...result.nextContinuationState === void 0 ? {} : { nextContinuationState: fromJson(ValueSchema, result.nextContinuationState) },
255177
- operation: result.operation,
255178
- ...result.selector === void 0 ? {} : { selector: result.selector },
255179
- httpStatus: result.status,
255180
- source: toSourceApiExecutionSourceMessage(result.source)
255181
- });
255182
- }
255183
- function fromSourceApiExecutionResultMessage(result) {
255184
- const value = requireMessage(result, "execution_result");
255185
- return {
255186
- body: fromSourceApiExecutionBodyMessage(value.body),
255187
- contentType: value.contentType,
255188
- headers: value.headers.map((header) => ({
255189
- name: header.name,
255190
- value: header.value
255191
- })),
255192
- ...value.nextContinuationState === void 0 ? {} : { nextContinuationState: toJson(ValueSchema, value.nextContinuationState) },
255193
- operation: value.operation,
255194
- ...isFieldSet(value, SourceApiActionExecutionResultSchema.field.selector) ? { selector: value.selector } : {},
255195
- source: fromSourceApiExecutionSourceMessage(value.source),
255196
- status: value.httpStatus
255197
- };
255198
- }
255199
- function toSourceApiExecutionSourceMessage(source) {
255200
- return create(SourceApiActionExecutionSourceSchema, {
255201
- ...source.displayName === void 0 || source.displayName === null ? {} : { displayName: source.displayName },
255202
- provider: toWorkflowSourceProvider(source.provider),
255203
- sourceKey: source.sourceKey
255204
- });
255205
- }
255206
- function fromSourceApiExecutionSourceMessage(source) {
255207
- const value = requireMessage(source, "source");
255208
- return {
255209
- ...isFieldSet(value, SourceApiActionExecutionSourceSchema.field.displayName) ? { displayName: value.displayName } : {},
255210
- provider: fromWorkflowSourceProvider(value.provider),
255211
- sourceKey: value.sourceKey
255212
- };
255213
- }
255214
- function toSourceApiExecutionBodyMessage(body) {
255215
- switch (body.kind) {
255216
- case "none": return {
255217
- case: "none",
255218
- value: create(SourceApiActionEmptyBodySchema)
255219
- };
255220
- case "json": return {
255221
- case: "json",
255222
- value: fromJson(ValueSchema, body.value)
255223
- };
255224
- case "text": return {
255225
- case: "text",
255226
- value: body.value
255227
- };
255228
- case "binary": return {
255229
- case: "binary",
255230
- value: body.value
255231
- };
255232
- default: return assertNever$4(body);
255233
- }
255234
- }
255235
- function fromSourceApiExecutionBodyMessage(body) {
255236
- switch (body.case) {
255237
- case "none": return { kind: "none" };
255238
- case "json": return {
255239
- kind: "json",
255240
- value: toJson(ValueSchema, body.value)
255241
- };
255242
- case "text": return {
255243
- kind: "text",
255244
- value: body.value
255245
- };
255246
- case "binary": return {
255247
- kind: "binary",
255248
- value: new Uint8Array(body.value)
255249
- };
255250
- case void 0: throw new Error("source api execution result body missing oneof case");
255251
- default: return assertNever$4(body);
255252
- }
255253
- }
255254
- function toWorkflowSourceProvider(provider) {
255255
- switch (provider) {
255256
- case "postgres": return WorkflowSourceProvider.POSTGRES;
255257
- case "supabase": return WorkflowSourceProvider.SUPABASE;
255258
- case "mysql": return WorkflowSourceProvider.MYSQL;
255259
- case "mongodb": return WorkflowSourceProvider.MONGODB;
255260
- case "bigquery": return WorkflowSourceProvider.BIGQUERY;
255261
- case "laminar": return WorkflowSourceProvider.LAMINAR;
255262
- case "aws_athena_connector": return WorkflowSourceProvider.AWS_ATHENA_CONNECTOR;
255263
- case "ga": return WorkflowSourceProvider.GOOGLE_ANALYTICS;
255264
- case "amplitude": return WorkflowSourceProvider.AMPLITUDE;
255265
- case "mixpanel": return WorkflowSourceProvider.MIXPANEL;
255266
- case "posthog": return WorkflowSourceProvider.POSTHOG;
255267
- case "sentry": return WorkflowSourceProvider.SENTRY;
255268
- case "github": return WorkflowSourceProvider.GITHUB;
255269
- case "linear": return WorkflowSourceProvider.LINEAR;
255270
- default: return assertNever$4(provider);
255271
- }
255272
- }
255273
- function fromWorkflowSourceProvider(provider) {
255274
- switch (provider) {
255275
- case WorkflowSourceProvider.POSTGRES: return "postgres";
255276
- case WorkflowSourceProvider.SUPABASE: return "supabase";
255277
- case WorkflowSourceProvider.MYSQL: return "mysql";
255278
- case WorkflowSourceProvider.MONGODB: return "mongodb";
255279
- case WorkflowSourceProvider.BIGQUERY: return "bigquery";
255280
- case WorkflowSourceProvider.LAMINAR: return "laminar";
255281
- case WorkflowSourceProvider.AWS_ATHENA_CONNECTOR: return "aws_athena_connector";
255282
- case WorkflowSourceProvider.GOOGLE_ANALYTICS: return "ga";
255283
- case WorkflowSourceProvider.AMPLITUDE: return "amplitude";
255284
- case WorkflowSourceProvider.MIXPANEL: return "mixpanel";
255285
- case WorkflowSourceProvider.POSTHOG: return "posthog";
255286
- case WorkflowSourceProvider.SENTRY: return "sentry";
255287
- case WorkflowSourceProvider.GITHUB: return "github";
255288
- case WorkflowSourceProvider.LINEAR: return "linear";
255289
- case WorkflowSourceProvider.UNSPECIFIED: throw new Error("workflow source provider is unspecified");
255290
- default: throw new Error(`unsupported workflow source provider: ${provider}`);
255291
- }
255292
- }
255293
- function toSourceApiRequestKind(kind) {
255294
- switch (kind) {
255295
- case "describe": return SourceApiActionRequestKind.DESCRIBE;
255296
- case "invoke": return SourceApiActionRequestKind.INVOKE;
255297
- default: return assertNever$4(kind);
255298
- }
255299
- }
255300
- function fromSourceApiRequestKind(kind) {
255301
- switch (kind) {
255302
- case SourceApiActionRequestKind.DESCRIBE: return "describe";
255303
- case SourceApiActionRequestKind.INVOKE: return "invoke";
255304
- case SourceApiActionRequestKind.UNSPECIFIED: throw new Error("source api request kind is unspecified");
255305
- default: throw new Error(`unsupported source api request kind: ${kind}`);
255306
- }
255307
- }
255308
- function toSourceApiInvokeMode(mode) {
255309
- switch (mode) {
255310
- case "preview_only": return SourceApiActionInvokeMode.PREVIEW_ONLY;
255311
- case "execute": return SourceApiActionInvokeMode.EXECUTE;
255312
- default: return assertNever$4(mode);
255313
- }
255314
- }
255315
- function fromSourceApiInvokeMode(mode) {
255316
- switch (mode) {
255317
- case SourceApiActionInvokeMode.PREVIEW_ONLY: return "preview_only";
255318
- case SourceApiActionInvokeMode.EXECUTE: return "execute";
255319
- case SourceApiActionInvokeMode.UNSPECIFIED: throw new Error("source api invoke mode is unspecified");
255320
- default: throw new Error(`unsupported source api invoke mode: ${mode}`);
255321
- }
255322
- }
255323
- function toSourceApiOperationKind(kind) {
255324
- switch (kind) {
255325
- case "http_request": return SourceApiActionOperationKind.HTTP_REQUEST;
255326
- case "structured_request": return SourceApiActionOperationKind.STRUCTURED_REQUEST;
255327
- default: return assertNever$4(kind);
255328
- }
255329
- }
255330
- function fromSourceApiOperationKind(kind) {
255331
- switch (kind) {
255332
- case SourceApiActionOperationKind.HTTP_REQUEST: return "http_request";
255333
- case SourceApiActionOperationKind.STRUCTURED_REQUEST: return "structured_request";
255334
- case SourceApiActionOperationKind.UNSPECIFIED: throw new Error("source api operation kind is unspecified");
255335
- default: throw new Error(`unsupported source api operation kind: ${kind}`);
255336
- }
255337
- }
255338
- function toSourceApiSelectorKind(kind) {
255339
- switch (kind) {
255340
- case "none": return SourceApiActionSelectorKind.NONE;
255341
- case "path": return SourceApiActionSelectorKind.PATH;
255342
- case "identifier": return SourceApiActionSelectorKind.IDENTIFIER;
255343
- default: return assertNever$4(kind);
255344
- }
255345
- }
255346
- function fromSourceApiSelectorKind(kind) {
255347
- switch (kind) {
255348
- case SourceApiActionSelectorKind.NONE: return "none";
255349
- case SourceApiActionSelectorKind.PATH: return "path";
255350
- case SourceApiActionSelectorKind.IDENTIFIER: return "identifier";
255351
- case SourceApiActionSelectorKind.UNSPECIFIED: throw new Error("source api selector kind is unspecified");
255352
- default: throw new Error(`unsupported source api selector kind: ${kind}`);
255353
- }
255354
- }
255355
- function toSourceApiPaginationPolicy(policy) {
255356
- switch (policy) {
255357
- case "none": return SourceApiActionPaginationPolicy.NONE;
255358
- case "continuation_token": return SourceApiActionPaginationPolicy.CONTINUATION_TOKEN;
255359
- default: return assertNever$4(policy);
255360
- }
255361
- }
255362
- function fromSourceApiPaginationPolicy(policy) {
255363
- switch (policy) {
255364
- case SourceApiActionPaginationPolicy.NONE: return "none";
255365
- case SourceApiActionPaginationPolicy.CONTINUATION_TOKEN: return "continuation_token";
255366
- case SourceApiActionPaginationPolicy.UNSPECIFIED: throw new Error("source api pagination policy is unspecified");
255367
- default: throw new Error(`unsupported source api pagination policy: ${policy}`);
255368
- }
255369
- }
255370
- function toSourceApiInputMode(mode) {
255371
- switch (mode) {
255372
- case "none": return SourceApiActionInputMode.NONE;
255373
- case "request_object": return SourceApiActionInputMode.REQUEST_OBJECT;
255374
- case "request_body": return SourceApiActionInputMode.REQUEST_BODY;
255375
- default: return assertNever$4(mode);
255376
- }
255377
- }
255378
- function fromSourceApiInputMode(mode) {
255379
- switch (mode) {
255380
- case SourceApiActionInputMode.NONE: return "none";
255381
- case SourceApiActionInputMode.REQUEST_OBJECT: return "request_object";
255382
- case SourceApiActionInputMode.REQUEST_BODY: return "request_body";
255383
- case SourceApiActionInputMode.UNSPECIFIED: throw new Error("source api input mode is unspecified");
255384
- default: throw new Error(`unsupported source api input mode: ${mode}`);
255385
- }
255386
- }
255387
- function toSourceApiFailureCode(code) {
255388
- switch (code) {
255389
- case "source_not_found": return SourceApiActionFailureCode.SOURCE_NOT_FOUND;
255390
- case "descriptor_unavailable": return SourceApiActionFailureCode.DESCRIPTOR_UNAVAILABLE;
255391
- case "invalid_request": return SourceApiActionFailureCode.INVALID_REQUEST;
255392
- case "permission_denied": return SourceApiActionFailureCode.PERMISSION_DENIED;
255393
- case "request_timed_out": return SourceApiActionFailureCode.REQUEST_TIMED_OUT;
255394
- case "execution_failed": return SourceApiActionFailureCode.EXECUTION_FAILED;
255395
- case "execution_state_invalid": return SourceApiActionFailureCode.EXECUTION_STATE_INVALID;
255396
- default: return assertNever$4(code);
255397
- }
255398
- }
255399
- function fromDescriptorResolutionFailureCode(code) {
255400
- switch (code) {
255401
- case SourceApiActionFailureCode.DESCRIPTOR_UNAVAILABLE: return "descriptor_unavailable";
255402
- case SourceApiActionFailureCode.PERMISSION_DENIED: return "permission_denied";
255403
- case SourceApiActionFailureCode.UNSPECIFIED: throw new Error("source api failure code is unspecified");
255404
- default: throw new Error(`unsupported descriptor resolution failure code: ${code}`);
255405
- }
255406
- }
255407
- function fromRequestPreparationFailureCode(code) {
255408
- switch (code) {
255409
- case SourceApiActionFailureCode.INVALID_REQUEST: return "invalid_request";
255410
- case SourceApiActionFailureCode.PERMISSION_DENIED: return "permission_denied";
255411
- case SourceApiActionFailureCode.EXECUTION_STATE_INVALID: return "execution_state_invalid";
255412
- case SourceApiActionFailureCode.UNSPECIFIED: throw new Error("source api failure code is unspecified");
255413
- default: throw new Error(`unsupported request preparation failure code: ${code}`);
255414
- }
255415
- }
255416
- function fromPageFetchFailureCode(code) {
255417
- switch (code) {
255418
- case SourceApiActionFailureCode.INVALID_REQUEST: return "invalid_request";
255419
- case SourceApiActionFailureCode.REQUEST_TIMED_OUT: return "request_timed_out";
255420
- case SourceApiActionFailureCode.EXECUTION_FAILED: return "execution_failed";
255421
- case SourceApiActionFailureCode.EXECUTION_STATE_INVALID: return "execution_state_invalid";
255422
- case SourceApiActionFailureCode.UNSPECIFIED: throw new Error("source api failure code is unspecified");
255423
- default: throw new Error(`unsupported page fetch failure code: ${code}`);
255424
- }
255425
- }
255426
- function assertMatchingPayloadType(expected, actual) {
255427
- if (expected !== actual) throw new Error(`stored scalar payload type '${expected}' does not match protobuf payload type '${actual}'`);
255428
- }
255429
- function requireMessage(value, fieldName) {
255430
- if (value === void 0) throw new Error(`missing required protobuf field: ${fieldName}`);
255431
- return value;
255432
- }
255433
255399
  //#endregion
255434
255400
  //#region packages/cli-server/src/audit/storage/serialization.ts
255435
255401
  init_dist$3();
@@ -258123,7 +258089,7 @@ function buildCliSourceApiPreview(value) {
258123
258089
  return {
258124
258090
  bodyKind: toCliSourceApiBodyKind(value.bodyKind),
258125
258091
  bodyPaths: [...value.bodyPaths],
258126
- headerNames: lowerUniqueStrings(value.headerNames),
258092
+ headerNames: canonicalizeSourceApiHeaderNames(value.headerNames),
258127
258093
  host: value.host,
258128
258094
  kind: toCliSourceApiOperationKind(value.kind),
258129
258095
  method: value.method,
@@ -258150,7 +258116,7 @@ function buildCliSourceApiOperation(value) {
258150
258116
  description: value.description,
258151
258117
  examples: value.examples.map(buildCliSourceApiExample),
258152
258118
  fieldPolicy: buildCliSourceApiFieldPolicy(value.fieldPolicy),
258153
- headerPolicy: { allowedRequestHeaderNames: lowerUniqueStrings(value.headerPolicy.allowedRequestHeaders) },
258119
+ headerPolicy: { allowedRequestHeaderNames: canonicalizeSourceApiHeaderNames(value.headerPolicy.allowedRequestHeaders) },
258154
258120
  kind: toCliSourceApiOperationKind(value.kind),
258155
258121
  methodPolicy: {
258156
258122
  allowedMethods: [...value.methodPolicy.allowedMethods],
@@ -258176,9 +258142,6 @@ function toCliSourceApiPatchMode(value) {
258176
258142
  if (!value.allowsRawFields && !value.allowsTypedFields) return SourceApiPatchMode.NONE;
258177
258143
  return value.mergePatches ? SourceApiPatchMode.MERGE : SourceApiPatchMode.SEPARATE;
258178
258144
  }
258179
- function lowerUniqueStrings(values) {
258180
- return [...new Set(values.map((value) => value.toLowerCase()))];
258181
- }
258182
258145
  function buildCliSourceApiExample(value) {
258183
258146
  return {
258184
258147
  command: value.command,
@@ -258392,7 +258355,7 @@ function createHttpRequestOperation(input) {
258392
258355
  ...DEFAULT_HTTP_FIELD_POLICY,
258393
258356
  ...input.fieldPolicy
258394
258357
  },
258395
- headerPolicy,
258358
+ headerPolicy: canonicalizeSourceApiHeaderPolicy(headerPolicy),
258396
258359
  kind: "http_request",
258397
258360
  methodPolicy,
258398
258361
  name: input.name,
@@ -258744,7 +258707,7 @@ function createStructuredRequestOperation(input) {
258744
258707
  ...DEFAULT_STRUCTURED_FIELD_POLICY,
258745
258708
  ...input.fieldPolicy
258746
258709
  },
258747
- headerPolicy,
258710
+ headerPolicy: canonicalizeSourceApiHeaderPolicy(headerPolicy),
258748
258711
  kind: "structured_request",
258749
258712
  methodPolicy: {
258750
258713
  allowedMethods: ["POST"],
@@ -260850,10 +260813,10 @@ const sourceApiRegistry = createSourceApiRegistry([
260850
260813
  //#endregion
260851
260814
  //#region packages/server/src/source-api/describe.ts
260852
260815
  async function describeSourceApi(input) {
260853
- return getSourceApiAdapter(input.registry ?? sourceApiRegistry, input.source.provider).describe({
260816
+ return canonicalizeSourceApiDescriptorHeaderPolicies(await getSourceApiAdapter(input.registry ?? sourceApiRegistry, input.source.provider).describe({
260854
260817
  actor: input.actor,
260855
260818
  source: input.source
260856
- });
260819
+ }));
260857
260820
  }
260858
260821
  //#endregion
260859
260822
  //#region packages/server/src/source-api/execute.ts
@@ -262563,10 +262526,12 @@ function registerCliConnectRoutes(router) {
262563
262526
  //#endregion
262564
262527
  //#region packages/cli-server/src/connect/node-adapter.ts
262565
262528
  const cliRequestIdInterceptor = (next) => async (request) => {
262529
+ const requestId = request.contextValues.get(cliConnectRequestContextKey)?.requestId ?? "unknown";
262566
262530
  try {
262567
- return await next(request);
262531
+ const response = await next(request);
262532
+ response.header.set(CLI_REQUEST_ID_HEADER, requestId);
262533
+ return response;
262568
262534
  } catch (reason) {
262569
- const requestId = request.contextValues.get(cliConnectRequestContextKey)?.requestId ?? "unknown";
262570
262535
  throw withCliRequestId(ConnectError.from(reason), requestId);
262571
262536
  }
262572
262537
  };
@@ -263685,10 +263650,7 @@ function createProblemDetailsErrorHandler(source) {
263685
263650
  //#endregion
263686
263651
  //#region packages/server/src/routes/auth.ts
263687
263652
  const authRoute = new Hono().get("/bootstrap-state", async (c) => {
263688
- const state = await readAuthBootstrapState({
263689
- db: c.var.storage.db,
263690
- schema: c.var.storage.schema
263691
- });
263653
+ const state = await readAuthBootstrapState({ db: c.var.storage.db });
263692
263654
  return c.json({
263693
263655
  ...state,
263694
263656
  emailDeliveryMode: c.var.storage.emailDeliveryMode,
@@ -263924,7 +263886,6 @@ const bootstrapRoute = new Hono().get("/", async (c) => {
263924
263886
  if (!(await readBootstrapState(c.var.storage.db)).needsBootstrap) return c.json({ error: "Bootstrap is already complete. Sign in with an existing account." }, 409);
263925
263887
  const auth = c.var.storage.auth;
263926
263888
  const db = c.var.storage.db;
263927
- const schema = c.var.storage.schema;
263928
263889
  const body = c.req.valid("json");
263929
263890
  let createdOrganizationId = null;
263930
263891
  const baseUrl = c.var.runtime.auth.baseURL;
@@ -263970,8 +263931,8 @@ const bootstrapRoute = new Hono().get("/", async (c) => {
263970
263931
  response.headers.set("cache-control", "no-store");
263971
263932
  return response;
263972
263933
  } catch (error) {
263973
- const cleanupOperations = [db.delete(schema.user).where(eq(schema.user.id, userId))];
263974
- if (createdOrganizationId) cleanupOperations.push(db.delete(schema.organization).where(eq(schema.organization.id, createdOrganizationId)));
263934
+ const cleanupOperations = [db.delete(user).where(eq(user.id, userId))];
263935
+ if (createdOrganizationId) cleanupOperations.push(db.delete(organization$1).where(eq(organization$1.id, createdOrganizationId)));
263975
263936
  await Promise.allSettled(cleanupOperations);
263976
263937
  if (error instanceof BootstrapFlowError) return c.json({ error: error.message }, { status: error.status });
263977
263938
  return c.json({ error: "Failed to complete the first-run bootstrap flow" }, 500);
@@ -264024,8 +263985,7 @@ var OrganizationNotFoundError = class extends r$9("OrganizationNotFoundError")()
264024
263985
  * Users must be members of the organization.
264025
263986
  */
264026
263987
  async function verifyOrgAccess(db, userId, organizationId) {
264027
- const { member } = getDatabaseSchema(db);
264028
- const [membership] = await db.select({ id: member.id }).from(member).where(and(eq(member.userId, userId), eq(member.organizationId, organizationId))).limit(1);
263988
+ const [membership] = await db.select({ id: member$1.id }).from(member$1).where(and(eq(member$1.userId, userId), eq(member$1.organizationId, organizationId))).limit(1);
264029
263989
  return Boolean(membership);
264030
263990
  }
264031
263991
  //#endregion
@@ -264565,9 +264525,7 @@ async function revokeLinearToken(input) {
264565
264525
  }
264566
264526
  const dataSourcesCrudRoute = new Hono().get("/", requireOrgAccess(), zValidator("query", OrgQuerySchema, zodProblemHook()), async (c) => {
264567
264527
  const { organizationId } = c.req.valid("query");
264568
- const db = c.var.storage.db;
264569
- const { dataSources } = getDatabaseSchema(db);
264570
- const result = await db.query.dataSources.findMany({
264528
+ const result = await c.var.storage.db.query.dataSources.findMany({
264571
264529
  columns: {
264572
264530
  id: true,
264573
264531
  provider: true,
@@ -264585,9 +264543,7 @@ const dataSourcesCrudRoute = new Hono().get("/", requireOrgAccess(), zValidator(
264585
264543
  }).get("/:id", requireOrgAccess(), zValidator("query", OrgQuerySchema, zodProblemHook()), async (c) => {
264586
264544
  const { organizationId } = c.req.valid("query");
264587
264545
  const id = c.req.param("id");
264588
- const db = c.var.storage.db;
264589
- const { dataSources } = getDatabaseSchema(db);
264590
- const dataSource = await db.query.dataSources.findFirst({
264546
+ const dataSource = await c.var.storage.db.query.dataSources.findFirst({
264591
264547
  columns: {
264592
264548
  id: true,
264593
264549
  provider: true,
@@ -264609,7 +264565,6 @@ const dataSourcesCrudRoute = new Hono().get("/", requireOrgAccess(), zValidator(
264609
264565
  const session = c.get("session");
264610
264566
  if (!session?.user) return c.json({ error: "Unauthorized" }, 401);
264611
264567
  const db = c.var.storage.db;
264612
- const { dataSources } = getDatabaseSchema(db);
264613
264568
  if (!await verifyOrgAccess(db, session.user.id, body.organizationId)) return c.json({ error: "Forbidden: Not a member of this organization" }, 403);
264614
264569
  if (!doesProviderMatchCredentials({
264615
264570
  credentialsType: body.credentials.type,
@@ -264656,7 +264611,6 @@ const dataSourcesCrudRoute = new Hono().get("/", requireOrgAccess(), zValidator(
264656
264611
  const id = c.req.param("id");
264657
264612
  const body = c.req.valid("json");
264658
264613
  const db = c.var.storage.db;
264659
- const { dataSources } = getDatabaseSchema(db);
264660
264614
  const existing = await db.query.dataSources.findFirst({ where: and(eq(dataSources.id, id), eq(dataSources.organizationId, organizationId)) });
264661
264615
  if (!existing) return c.json({ error: "Data source not found" }, 404);
264662
264616
  const updates = { updatedAt: /* @__PURE__ */ new Date() };
@@ -264708,7 +264662,6 @@ const dataSourcesCrudRoute = new Hono().get("/", requireOrgAccess(), zValidator(
264708
264662
  const { organizationId } = c.req.valid("query");
264709
264663
  const id = c.req.param("id");
264710
264664
  const db = c.var.storage.db;
264711
- const { dataSources } = getDatabaseSchema(db);
264712
264665
  const existing = await db.query.dataSources.findFirst({ where: and(eq(dataSources.id, id), eq(dataSources.organizationId, organizationId)) });
264713
264666
  if (!existing) return c.json({ error: "Data source not found" }, 404);
264714
264667
  if (existing.provider === "linear") {
@@ -264802,9 +264755,7 @@ const GitHubRepositoriesSchema = array$1(GitHubRepositorySchema);
264802
264755
  const dataSourcesGitHubRepositoriesRoute = new Hono().use("*", requireOrgAccess()).get("/:id/github-repositories", zValidator("query", OrgQuerySchema, zodProblemHook()), async (c) => {
264803
264756
  const { organizationId } = c.req.valid("query");
264804
264757
  const id = c.req.param("id");
264805
- const db = c.var.storage.db;
264806
- const { dataSources } = getDatabaseSchema(db);
264807
- const dataSource = await db.query.dataSources.findFirst({
264758
+ const dataSource = await c.var.storage.db.query.dataSources.findFirst({
264808
264759
  columns: {
264809
264760
  id: true,
264810
264761
  provider: true,
@@ -264841,7 +264792,6 @@ const dataSourcesGitHubRepositoriesRoute = new Hono().use("*", requireOrgAccess(
264841
264792
  const id = c.req.param("id");
264842
264793
  const body = c.req.valid("json");
264843
264794
  const db = c.var.storage.db;
264844
- const { dataSources } = getDatabaseSchema(db);
264845
264795
  const dataSource = await db.query.dataSources.findFirst({ where: and(eq(dataSources.id, id), eq(dataSources.organizationId, organizationId)) });
264846
264796
  if (!dataSource) return c.json({ error: "Data source not found" }, 404);
264847
264797
  if (dataSource.provider !== "github") return c.json({ error: "Data source is not GitHub" }, 400);
@@ -264871,7 +264821,6 @@ const dataSourcesTestRoute = new Hono().use("*", requireOrgAccess()).post("/:id/
264871
264821
  const { organizationId } = c.req.valid("query");
264872
264822
  const id = c.req.param("id");
264873
264823
  const db = c.var.storage.db;
264874
- const { dataSources } = getDatabaseSchema(db);
264875
264824
  const dataSource = await db.query.dataSources.findFirst({ where: and(eq(dataSources.id, id), eq(dataSources.organizationId, organizationId)) });
264876
264825
  if (!dataSource) return c.json({ error: "Data source not found" }, 404);
264877
264826
  const preparedCredentials = await prepareDataSourceCredentials({
@@ -264916,15 +264865,13 @@ const healthRoute = new Hono().get("/health", (c) => c.json({
264916
264865
  //#region packages/server/src/routes/organizations.ts
264917
264866
  const OrganizationSlugParamsSchema = object$1({ slug: string$3().min(1, "slug is required") });
264918
264867
  const UpdateOrgSettingsSchema = object$1({ monthlyBudgetUsd: number$4().min(0).nullable().optional() }).refine((body) => body.monthlyBudgetUsd !== void 0, { message: "At least one organization setting must be provided" });
264919
- function getOrganizationSettingsSelection(db) {
264920
- const { organizationProfiles } = getDatabaseSchema(db);
264868
+ function getOrganizationSettingsSelection() {
264921
264869
  return { monthlyBudgetUsd: organizationProfiles.monthlyBudgetUsd };
264922
264870
  }
264923
264871
  async function findOrganizationMembershipBySlug(input) {
264924
- const { member, organization } = getDatabaseSchema(input.db);
264925
- const [org] = await input.db.select({ id: organization.id }).from(organization).where(eq(organization.slug, input.slug)).limit(1);
264872
+ const [org] = await input.db.select({ id: organization$1.id }).from(organization$1).where(eq(organization$1.slug, input.slug)).limit(1);
264926
264873
  if (!org) return { kind: "not_found" };
264927
- const [membership] = await input.db.select({ role: member.role }).from(member).where(and(eq(member.organizationId, org.id), eq(member.userId, input.userId))).limit(1);
264874
+ const [membership] = await input.db.select({ role: member$1.role }).from(member$1).where(and(eq(member$1.organizationId, org.id), eq(member$1.userId, input.userId))).limit(1);
264928
264875
  if (!membership) return { kind: "forbidden" };
264929
264876
  return {
264930
264877
  kind: "ok",
@@ -264942,16 +264889,15 @@ async function findOrganizationMembershipBySlug(input) {
264942
264889
  const organizationsRoute = new Hono().get("/:slug", async (c) => {
264943
264890
  const slug = c.req.param("slug");
264944
264891
  const db = c.var.storage.db;
264945
- const { organization } = getDatabaseSchema(db);
264946
264892
  const session = c.get("session");
264947
264893
  if (!session?.user) return c.json({ error: "Unauthorized" }, 401);
264948
264894
  const [org] = await db.select({
264949
- createdAt: organization.createdAt,
264950
- id: organization.id,
264951
- logo: organization.logo,
264952
- name: organization.name,
264953
- slug: organization.slug
264954
- }).from(organization).where(eq(organization.slug, slug)).limit(1);
264895
+ createdAt: organization$1.createdAt,
264896
+ id: organization$1.id,
264897
+ logo: organization$1.logo,
264898
+ name: organization$1.name,
264899
+ slug: organization$1.slug
264900
+ }).from(organization$1).where(eq(organization$1.slug, slug)).limit(1);
264955
264901
  if (!org) return c.json({ error: "Organization not found" }, 404);
264956
264902
  if (!await verifyOrgAccess(db, session.user.id, org.id)) return c.json({ error: "Forbidden: Not a member of this organization" }, 403);
264957
264903
  return c.json({ organization: org });
@@ -264983,11 +264929,10 @@ const organizationsRoute = new Hono().get("/:slug", async (c) => {
264983
264929
  }).get("/:slug/settings", async (c) => {
264984
264930
  const slug = c.req.param("slug");
264985
264931
  const db = c.var.storage.db;
264986
- const { organization, organizationProfiles } = getDatabaseSchema(db);
264987
- const organizationSettingsSelection = getOrganizationSettingsSelection(db);
264932
+ const organizationSettingsSelection = getOrganizationSettingsSelection();
264988
264933
  const session = c.get("session");
264989
264934
  if (!session?.user) return c.json({ error: "Unauthorized" }, 401);
264990
- const [org] = await db.select({ id: organization.id }).from(organization).where(eq(organization.slug, slug)).limit(1);
264935
+ const [org] = await db.select({ id: organization$1.id }).from(organization$1).where(eq(organization$1.slug, slug)).limit(1);
264991
264936
  if (!org) return c.json({ error: "Organization not found" }, 404);
264992
264937
  if (!await verifyOrgAccess(db, session.user.id, org.id)) return c.json({ error: "Forbidden: Not a member of this organization" }, 403);
264993
264938
  const [profile] = await db.select(organizationSettingsSelection).from(organizationProfiles).where(eq(organizationProfiles.organizationId, org.id)).limit(1);
@@ -264999,13 +264944,12 @@ const organizationsRoute = new Hono().get("/:slug", async (c) => {
264999
264944
  const slug = c.req.param("slug");
265000
264945
  const body = c.req.valid("json");
265001
264946
  const db = c.var.storage.db;
265002
- const { member, organization, organizationProfiles } = getDatabaseSchema(db);
265003
- const organizationSettingsSelection = getOrganizationSettingsSelection(db);
264947
+ const organizationSettingsSelection = getOrganizationSettingsSelection();
265004
264948
  const session = c.get("session");
265005
264949
  if (!session?.user) return c.json({ error: "Unauthorized" }, 401);
265006
- const [org] = await db.select({ id: organization.id }).from(organization).where(eq(organization.slug, slug)).limit(1);
264950
+ const [org] = await db.select({ id: organization$1.id }).from(organization$1).where(eq(organization$1.slug, slug)).limit(1);
265007
264951
  if (!org) return c.json({ error: "Organization not found" }, 404);
265008
- const [membership] = await db.select({ role: member.role }).from(member).where(and(eq(member.userId, session.user.id), eq(member.organizationId, org.id))).limit(1);
264952
+ const [membership] = await db.select({ role: member$1.role }).from(member$1).where(and(eq(member$1.userId, session.user.id), eq(member$1.organizationId, org.id))).limit(1);
265009
264953
  if (!membership) return c.json({ error: "Forbidden: Not a member of this organization" }, 403);
265010
264954
  if (!doesOrganizationMembershipGrantPermission({
265011
264955
  permission: organizationPermissionChecks.organizationUpdate,
@@ -265026,7 +264970,6 @@ const QuerySchema = object$1({ organizationId: string$3().min(1, "organizationId
265026
264970
  const statsRoute = new Hono().use("*", requireOrgAccess()).get("/", zValidator("query", QuerySchema, zodProblemHook()), async (c) => {
265027
264971
  const { organizationId } = c.req.valid("query");
265028
264972
  const db = c.var.storage.db;
265029
- const { dataSources } = getDatabaseSchema(db);
265030
264973
  const [dataSourcesResult] = await Promise.all([db.select({ count: count() }).from(dataSources).where(eq(dataSources.organizationId, organizationId))]);
265031
264974
  return c.json({ dataSourcesCount: dataSourcesResult[0]?.count ?? 0 });
265032
264975
  });
@@ -265168,7 +265111,7 @@ function serverRuntimeMiddleware(runtime) {
265168
265111
  */
265169
265112
  function createServerApi(input) {
265170
265113
  const storage = input.storage ?? createServerStorage(input.runtime, createMemoryApiRateLimitStorage(), { enableAuthTestUtils: input.enableAuthTestUtils });
265171
- return new Hono().onError(createProblemDetailsErrorHandler("packages/server/createServerApi")).use("*", serverRuntimeMiddleware(input.runtime)).use("*", serverStorageMiddleware(storage)).use("*", apiRateLimiter({ enabled: input.runtime.rateLimit.enabled })).use("/organizations", sessionMiddleware()).use("/organizations/*", sessionMiddleware()).use("/stats", sessionMiddleware()).use("/stats/*", sessionMiddleware()).use("/team", sessionMiddleware()).use("/team/*", sessionMiddleware()).use("/data-sources", sessionMiddleware()).use("/data-sources/*", sessionMiddleware()).use("/budget", sessionMiddleware()).use("/budget/*", sessionMiddleware()).route("/", healthRoute).route("/bootstrap", bootstrapRoute).route("/budget", budgetRoute).route("/connectors", connectorsRoute).route("/jobs", connectorJobsRoute).route("/auth", authRoute).route("/data-sources", dataSourcesRoute).route("/organizations", organizationsRoute).route("/stats", statsRoute).route("/team", teamRoute);
265114
+ return new Hono().onError(createProblemDetailsErrorHandler("packages/server/createServerApi")).use("*", requestId()).use("*", serverRuntimeMiddleware(input.runtime)).use("*", serverStorageMiddleware(storage)).use("*", apiRateLimiter({ enabled: input.runtime.rateLimit.enabled })).use("/organizations", sessionMiddleware()).use("/organizations/*", sessionMiddleware()).use("/stats", sessionMiddleware()).use("/stats/*", sessionMiddleware()).use("/team", sessionMiddleware()).use("/team/*", sessionMiddleware()).use("/data-sources", sessionMiddleware()).use("/data-sources/*", sessionMiddleware()).use("/budget", sessionMiddleware()).use("/budget/*", sessionMiddleware()).route("/", healthRoute).route("/bootstrap", bootstrapRoute).route("/budget", budgetRoute).route("/connectors", connectorsRoute).route("/jobs", connectorJobsRoute).route("/auth", authRoute).route("/data-sources", dataSourcesRoute).route("/organizations", organizationsRoute).route("/stats", statsRoute).route("/team", teamRoute);
265172
265115
  }
265173
265116
  //#endregion
265174
265117
  //#region node_modules/.bun/hono@4.12.14/node_modules/hono/dist/utils/color.js