@decocms/mesh 2.20.1 → 2.20.3

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 (142) hide show
  1. package/dist/client/assets/{AlertCircle-DeGhTF84.js → AlertCircle-CI2U-jkN.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-m6KeIjPT.js → ArrowLeft-B3km7toT.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-BDjaIiFu.js → ArrowUp-BF7mM4C2.js} +1 -1
  4. package/dist/client/assets/{Check-Cs5AiVxS.js → Check-BQkm1TiP.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-7pGjkuTY.js → ChevronDown-DP6jvip7.js} +1 -1
  6. package/dist/client/assets/{Code01-BdN1qNoI.js → Code01-qXTn9GK9.js} +1 -1
  7. package/dist/client/assets/{Copy01-B_oHlu2-.js → Copy01-CEYn2daS.js} +1 -1
  8. package/dist/client/assets/{DotsHorizontal-B-RZHKDt.js → DotsHorizontal-C2Nr-D-f.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-HKe7Lpcg.js → DotsVertical-BPP4U4GQ.js} +1 -1
  10. package/dist/client/assets/{Download01-4uLxYlt-.js → Download01-BkDXja2z.js} +1 -1
  11. package/dist/client/assets/{Edit01-CcxqoKWW.js → Edit01-Cq0mQDLh.js} +1 -1
  12. package/dist/client/assets/{File06-K5gpmB1y.js → File06-KMD38I-q.js} +1 -1
  13. package/dist/client/assets/{FilterLines-BCus583X.js → FilterLines-Bojt6HPl.js} +1 -1
  14. package/dist/client/assets/{FlipBackward-MuxfY5vX.js → FlipBackward-C-K9FamE.js} +1 -1
  15. package/dist/client/assets/{GitBranch01-ClkRJDdk.js → GitBranch01-DGTCzEh5.js} +1 -1
  16. package/dist/client/assets/{Grid01-XLGz76ym.js → Grid01-D4lXvveX.js} +1 -1
  17. package/dist/client/assets/{Home02-CeVIG1t0.js → Home02-DPdZvu8L.js} +1 -1
  18. package/dist/client/assets/{Image01-CycaMeSm.js → Image01-C0R6SF_P.js} +1 -1
  19. package/dist/client/assets/{Inbox01-1DQwZbO-.js → Inbox01-BsOUYwQZ.js} +1 -1
  20. package/dist/client/assets/{InfoCircle-DXvgKrQ3.js → InfoCircle-BgIkbjJr.js} +1 -1
  21. package/dist/client/assets/{Key01-B8mxyE2f.js → Key01-DTwk4FpG.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-B4WpWXG7.js → LinkExternal01-DmruqAb9.js} +1 -1
  23. package/dist/client/assets/{List-DWWQESNh.js → List-BsSZz32j.js} +1 -1
  24. package/dist/client/assets/{Loading01-BtKovu_m.js → Loading01-Ae5ezbtD.js} +1 -1
  25. package/dist/client/assets/{Lock01-CDOVc6ZJ.js → Lock01-BuQSktMF.js} +1 -1
  26. package/dist/client/assets/{Play-DYDE6oE1.js → Play-DKlNHVjf.js} +1 -1
  27. package/dist/client/assets/{Plus-CPExS1G1.js → Plus-CdG75X26.js} +1 -1
  28. package/dist/client/assets/{SearchMd-DwKDi1yz.js → SearchMd-GFaonOaJ.js} +1 -1
  29. package/dist/client/assets/{Terminal-LP4GeLJv.js → Terminal-C6mZx-5A.js} +1 -1
  30. package/dist/client/assets/{Trash01-DCb3R_1E.js → Trash01-BWIN9RL_.js} +1 -1
  31. package/dist/client/assets/{Upload01-BKDlh_J7.js → Upload01-CaBE4VYK.js} +1 -1
  32. package/dist/client/assets/{X-DWXiZn3v.js → X-C18ho617.js} +1 -1
  33. package/dist/client/assets/{XClose-s9vu-dQj.js → XClose-CfwoKknl.js} +1 -1
  34. package/dist/client/assets/{alert-dialog-CNXrLp-S.js → alert-dialog-CCJCsKzK.js} +1 -1
  35. package/dist/client/assets/{auth-catchall-M9fqis8u.js → auth-catchall-C33VWmDE.js} +1 -1
  36. package/dist/client/assets/{avatar-noXapmql.js → avatar-B7xnPXuk.js} +1 -1
  37. package/dist/client/assets/{badge-ChGpQW0J.js → badge-BVO6I0sW.js} +1 -1
  38. package/dist/client/assets/{binder-DZT62WgB.js → binder-By0LBK9Y.js} +1 -1
  39. package/dist/client/assets/{button-Dh_UOMtF.js → button-CGmrzkpY.js} +1 -1
  40. package/dist/client/assets/{card-Bjs7HBa2.js → card-DIjMh1NO.js} +1 -1
  41. package/dist/client/assets/{checkbox-DiEhrfCa.js → checkbox-DYViXeUc.js} +1 -1
  42. package/dist/client/assets/{collection-detail-BHOMTlVb.js → collection-detail-DtlOJm8P.js} +1 -1
  43. package/dist/client/assets/{collection-display-button-DKfm8yFW.js → collection-display-button-CtkxsCB_.js} +1 -1
  44. package/dist/client/assets/{collection-header-Cn-YMrm9.js → collection-header-B4qcjEt5.js} +1 -1
  45. package/dist/client/assets/{collection-page-A6cy4ewQ.js → collection-page-s-RR5fU6.js} +1 -1
  46. package/dist/client/assets/{collection-search-Bm9HY_m8.js → collection-search-BVb42O45.js} +1 -1
  47. package/dist/client/assets/{collection-tab-BQzpUnQW.js → collection-tab-CvrhLJCU.js} +1 -1
  48. package/dist/client/assets/{collection-table-wrapper-CnCS_a8f.js → collection-table-wrapper-BohFZqii.js} +1 -1
  49. package/dist/client/assets/{connection-DuIRkEvB.js → connection-ChwHK0-S.js} +1 -1
  50. package/dist/client/assets/{connection-card-Db71-JIc.js → connection-card-DMMfNQUo.js} +1 -1
  51. package/dist/client/assets/{connection-detail-C1yH43Km.js → connection-detail-D9bORT-_.js} +1 -1
  52. package/dist/client/assets/{connections-Bd35VTO7.js → connections-CRhyn7eO.js} +1 -1
  53. package/dist/client/assets/constants-J0aH6mLs.js +1 -0
  54. package/dist/client/assets/{create-organization-dialog-B19KPYZ1.js → create-organization-dialog-CtbMd6S_.js} +1 -1
  55. package/dist/client/assets/{dialog-BFNjB_wS.js → dialog-DJJ2cvEE.js} +1 -1
  56. package/dist/client/assets/{dropdown-menu-T7u8fl7N.js → dropdown-menu-CAeD2aIb.js} +1 -1
  57. package/dist/client/assets/{dynamic-plugin-layout-CaPvL2ak.js → dynamic-plugin-layout-BeSg8wRq.js} +1 -1
  58. package/dist/client/assets/{empty-state-ylKJe6-v.js → empty-state-BkAB-hls.js} +1 -1
  59. package/dist/client/assets/{empty-state-DhpaMqQD.js → empty-state-wP9uukGJ.js} +1 -1
  60. package/dist/client/assets/{env-vars-editor-BwDtTYE8.js → env-vars-editor-DuH6BBdA.js} +1 -1
  61. package/dist/client/assets/{error-boundary-_npCfvs4.js → error-boundary-BUvK8Sry.js} +1 -1
  62. package/dist/client/assets/{extract-connection-data-DfFE7uXb.js → extract-connection-data-BLs0SRok.js} +1 -1
  63. package/dist/client/assets/{file-browser-NWpg0oN1.js → file-browser-DuR45yyf.js} +2 -2
  64. package/dist/client/assets/{form-BEM8UzSv.js → form-DiGzBnRK.js} +1 -1
  65. package/dist/client/assets/{gateway-detail-BrjbS3jo.js → gateway-detail-BCBmyW-G.js} +1 -1
  66. package/dist/client/assets/{gateways-DhcOJhD5.js → gateways-BgSVXbfx.js} +1 -1
  67. package/dist/client/assets/{grid-view-BUF5kath.js → grid-view-Db741zGU.js} +1 -1
  68. package/dist/client/assets/{home-DyK0jpSk.js → home-BtJc_wcZ.js} +1 -1
  69. package/dist/client/assets/{index-Dh8Y3NBs.js → index-CL_rL7XJ.js} +4 -4
  70. package/dist/client/assets/{index-DanqEyuv.js → index-D4QCsSzb.js} +1 -1
  71. package/dist/client/assets/index-DUA-vRuy.js +1 -0
  72. package/dist/client/assets/{index-skH-OUyO.js → index-Diww4UW3.js} +2 -2
  73. package/dist/client/assets/{index-BRipTsvS.js → index-DjRWdLI4.js} +1 -1
  74. package/dist/client/assets/{infiniteQueryObserver-Dvgbvv4A.js → infiniteQueryObserver-BmbQcWdI.js} +1 -1
  75. package/dist/client/assets/{input-CdlPz8Vq.js → input-CrURMEZe.js} +1 -1
  76. package/dist/client/assets/{layout-DopLDDPE.js → layout-kp8TTJc9.js} +1 -1
  77. package/dist/client/assets/{lazy-highlighter-CQ8gN0d3.js → lazy-highlighter-dN3WcL6s.js} +1 -1
  78. package/dist/client/assets/{localstorage-keys-B_H3St2R.js → localstorage-keys-BVANkONM.js} +1 -1
  79. package/dist/client/assets/{login-1cuD6_Oo.js → login-CnuJ6k4x.js} +1 -1
  80. package/dist/client/assets/{mcp-oauth-B6eUt4Mr.js → mcp-oauth-CdcIczUJ.js} +1 -1
  81. package/dist/client/assets/{mcp-server-card-DTQIT3pj.js → mcp-server-card-VZUBDTRj.js} +1 -1
  82. package/dist/client/assets/{mcp-server-detail-BB_FT5IH.js → mcp-server-detail-CIR0FKMd.js} +1 -1
  83. package/dist/client/assets/{members-Cy4UaFKY.js → members-bQTH1spX.js} +1 -1
  84. package/dist/client/assets/{monaco-editor-CKUC5K4P.js → monaco-editor-CDRbE4GY.js} +1 -1
  85. package/dist/client/assets/{monitoring-DOZ3Tm1E.js → monitoring-Cb41cf-X.js} +1 -1
  86. package/dist/client/assets/{oauth-callback-DxWqmOqk.js → oauth-callback-z6t0OToi.js} +1 -1
  87. package/dist/client/assets/{page-wGlLXgmM.js → page-CcKdSzCp.js} +1 -1
  88. package/dist/client/assets/{page-zq0-MjKt.js → page-SWPgLEpC.js} +1 -1
  89. package/dist/client/assets/{pin-to-sidebar-button-C5qdidS1.js → pin-to-sidebar-button-DIwkO0Tx.js} +1 -1
  90. package/dist/client/assets/{plugin-empty-state-cSLsH0S-.js → plugin-empty-state-B-glkOMH.js} +1 -1
  91. package/dist/client/assets/{plugin-header-CzG38AxU.js → plugin-header-BA0z5mBU.js} +1 -1
  92. package/dist/client/assets/{plugins-BqbdQ0eM.js → plugins-Cq62fkYj.js} +1 -1
  93. package/dist/client/assets/{popover-B4iU4oXK.js → popover-Bx7diZ86.js} +1 -1
  94. package/dist/client/assets/{project-context-provider-Ci1EHyGR.js → project-context-provider-DulCVL2k.js} +1 -1
  95. package/dist/client/assets/{registry-utils-8goOeMwE.js → registry-utils-8Lvx2XTy.js} +1 -1
  96. package/dist/client/assets/{resizable-BteAr06H.js → resizable-Gk1RjNnW.js} +1 -1
  97. package/dist/client/assets/{resource-tabs-Dzc9tSXU.js → resource-tabs-ACbF96qo.js} +1 -1
  98. package/dist/client/assets/{select-B4aq4vxk.js → select-C8LOz7vA.js} +1 -1
  99. package/dist/client/assets/{settings-B6nAEWR5.js → settings-BXJ6BGel.js} +1 -1
  100. package/dist/client/assets/{shell-layout-CNkO6ROG.js → shell-layout-CFRw9Ru3.js} +1 -1
  101. package/dist/client/assets/{spinner-DwVZzFPC.js → spinner-BF56RAKQ.js} +1 -1
  102. package/dist/client/assets/{switch-PB1r01nO.js → switch-DJBd8Fzb.js} +1 -1
  103. package/dist/client/assets/{textarea-B7no0HbU.js → textarea-C_zgj3Sp.js} +1 -1
  104. package/dist/client/assets/{tool-set-selector-Cl3nu1df.js → tool-set-selector-B9rTBahU.js} +1 -1
  105. package/dist/client/assets/{tools-list-DNdG8U23.js → tools-list-mr-l2d8l.js} +1 -1
  106. package/dist/client/assets/{tooltip-DgJ4R-G6.js → tooltip-Suu_Gpqh.js} +1 -1
  107. package/dist/client/assets/{typewriter-title-YmbwonUg.js → typewriter-title-DM-oRxie.js} +1 -1
  108. package/dist/client/assets/{use-binding-R6SoNecZ.js → use-binding-D6wv_5fO.js} +1 -1
  109. package/dist/client/assets/{use-collections-CC15C_nK.js → use-collections-CXETocKO.js} +1 -1
  110. package/dist/client/assets/{use-connection-BY9aOm7H.js → use-connection-CCXutWLD.js} +1 -1
  111. package/dist/client/assets/{use-connection-resources-D2N-7Fdh.js → use-connection-resources-D0st76bP.js} +1 -1
  112. package/dist/client/assets/{use-create-gateway-D4_8vfl-.js → use-create-gateway-BlLsktgc.js} +1 -1
  113. package/dist/client/assets/{use-gateway-CmDE4xLF.js → use-gateway-DD-xEZju.js} +1 -1
  114. package/dist/client/assets/{use-gateway-system-prompt-nzDoNyO-.js → use-gateway-system-prompt-zGJSEzce.js} +1 -1
  115. package/dist/client/assets/{use-list-state-B0HVVNOr.js → use-list-state-AndcW8aD.js} +1 -1
  116. package/dist/client/assets/{use-mcp-DUgnx05H.js → use-mcp-D9llr83X.js} +1 -1
  117. package/dist/client/assets/{use-members-DEeTkVb7.js → use-members-CB2ebBfn.js} +1 -1
  118. package/dist/client/assets/{use-mobile-CZeMkOxo.js → use-mobile-DssCtDl6.js} +1 -1
  119. package/dist/client/assets/{use-organization-settings-8tWqPbhq.js → use-organization-settings-CQXtXtZs.js} +1 -1
  120. package/dist/client/assets/{use-tool-call-_jHZu2qb.js → use-tool-call-BmvKn7jp.js} +1 -1
  121. package/dist/client/assets/useInfiniteQuery-BttwTOfK.js +1 -0
  122. package/dist/client/assets/{useMutation-n0xwrWOz.js → useMutation-Dl1MMkEC.js} +1 -1
  123. package/dist/client/assets/useQuery-Bvk0U2ed.js +1 -0
  124. package/dist/client/assets/{value-BOu8imSs.js → value-DaPOjTmC.js} +1 -1
  125. package/dist/client/assets/{view-mode-toggle-Z5AVjYj0.js → view-mode-toggle-BLClM-0g.js} +1 -1
  126. package/dist/client/assets/{workflow-CZ2JUtj_.js → workflow-CQ7PQ7Dg.js} +1 -1
  127. package/dist/client/index.html +1 -1
  128. package/dist/server/cli.js +1 -1
  129. package/dist/server/node_modules/kysely/README.md +3 -1
  130. package/dist/server/node_modules/kysely/dist/cjs/index.d.ts +3 -1
  131. package/dist/server/node_modules/kysely/dist/cjs/migration/migrator.d.ts +1 -1
  132. package/dist/server/node_modules/kysely/dist/cjs/migration/migrator.js +75 -68
  133. package/dist/server/node_modules/kysely/dist/esm/index.d.ts +3 -1
  134. package/dist/server/node_modules/kysely/dist/esm/migration/migrator.d.ts +1 -1
  135. package/dist/server/node_modules/kysely/dist/esm/migration/migrator.js +75 -68
  136. package/dist/server/node_modules/kysely/package.json +13 -13
  137. package/dist/server/server.js +1 -1
  138. package/package.json +1 -1
  139. package/dist/client/assets/constants-C1rpewgJ.js +0 -1
  140. package/dist/client/assets/index-C6eYxyql.js +0 -1
  141. package/dist/client/assets/useInfiniteQuery-x4_y1w34.js +0 -1
  142. package/dist/client/assets/useQuery-FRehIqtM.js +0 -1
@@ -58,7 +58,8 @@ class Migrator {
58
58
  * The returned array is sorted by migration name.
59
59
  */
60
60
  async getMigrations() {
61
- const executedMigrations = (await this.#doesTableExists(this.#migrationTable))
61
+ const tableExists = await this.#doesTableExist(this.#migrationTable);
62
+ const executedMigrations = tableExists
62
63
  ? await this.#props.db
63
64
  .withPlugin(this.#schemaPlugin)
64
65
  .selectFrom(this.#migrationTable)
@@ -265,7 +266,10 @@ class Migrator {
265
266
  }
266
267
  async #migrate(getMigrationDirectionAndStep) {
267
268
  try {
268
- await this.#ensureMigrationTablesExists();
269
+ await this.#ensureMigrationTableSchemaExists();
270
+ await this.#ensureMigrationTableExists();
271
+ await this.#ensureMigrationLockTableExists();
272
+ await this.#ensureLockRowExists();
269
273
  return await this.#runMigrations(getMigrationDirectionAndStep);
270
274
  }
271
275
  catch (error) {
@@ -293,95 +297,98 @@ class Migrator {
293
297
  }
294
298
  return new noop_plugin_js_1.NoopPlugin();
295
299
  }
296
- async #ensureMigrationTablesExists() {
297
- await this.#ensureMigrationTableSchemaExists();
298
- await this.#ensureMigrationTableExists();
299
- await this.#ensureMigrationLockTableExists();
300
- await this.#ensureLockRowExists();
301
- }
302
300
  async #ensureMigrationTableSchemaExists() {
303
301
  if (!this.#migrationTableSchema) {
304
302
  // Use default schema. Nothing to do.
305
303
  return;
306
304
  }
307
- if (!(await this.#doesSchemaExists())) {
308
- try {
309
- await this.#createIfNotExists(this.#props.db.schema.createSchema(this.#migrationTableSchema));
310
- }
311
- catch (error) {
312
- // At least on PostgreSQL, `if not exists` doesn't guarantee the `create schema`
313
- // query doesn't throw if the schema already exits. That's why we check if
314
- // the schema exist here and ignore the error if it does.
315
- if (!(await this.#doesSchemaExists())) {
316
- throw error;
317
- }
305
+ const schemaExists = await this.#doesSchemaExist();
306
+ if (schemaExists) {
307
+ return;
308
+ }
309
+ try {
310
+ await this.#createIfNotExists(this.#props.db.schema.createSchema(this.#migrationTableSchema));
311
+ }
312
+ catch (error) {
313
+ const schemaExists = await this.#doesSchemaExist();
314
+ // At least on PostgreSQL, `if not exists` doesn't guarantee the `create schema`
315
+ // query doesn't throw if the schema already exits. That's why we check if
316
+ // the schema exist here and ignore the error if it does.
317
+ if (!schemaExists) {
318
+ throw error;
318
319
  }
319
320
  }
320
321
  }
321
322
  async #ensureMigrationTableExists() {
322
- if (!(await this.#doesTableExists(this.#migrationTable))) {
323
- try {
324
- if (this.#migrationTableSchema) {
325
- await this.#createIfNotExists(this.#props.db.schema.createSchema(this.#migrationTableSchema));
326
- }
327
- await this.#createIfNotExists(this.#props.db.schema
328
- .withPlugin(this.#schemaPlugin)
329
- .createTable(this.#migrationTable)
330
- .addColumn('name', 'varchar(255)', (col) => col.notNull().primaryKey())
331
- // The migration run time as ISO string. This is not a real date type as we
332
- // can't know which data type is supported by all future dialects.
333
- .addColumn('timestamp', 'varchar(255)', (col) => col.notNull()));
334
- }
335
- catch (error) {
336
- // At least on PostgreSQL, `if not exists` doesn't guarantee the `create table`
337
- // query doesn't throw if the table already exits. That's why we check if
338
- // the table exist here and ignore the error if it does.
339
- if (!(await this.#doesTableExists(this.#migrationTable))) {
340
- throw error;
341
- }
323
+ const tableExists = await this.#doesTableExist(this.#migrationTable);
324
+ if (tableExists) {
325
+ return;
326
+ }
327
+ try {
328
+ await this.#createIfNotExists(this.#props.db.schema
329
+ .withPlugin(this.#schemaPlugin)
330
+ .createTable(this.#migrationTable)
331
+ .addColumn('name', 'varchar(255)', (col) => col.notNull().primaryKey())
332
+ // The migration run time as ISO string. This is not a real date type as we
333
+ // can't know which data type is supported by all future dialects.
334
+ .addColumn('timestamp', 'varchar(255)', (col) => col.notNull()));
335
+ }
336
+ catch (error) {
337
+ const tableExists = await this.#doesTableExist(this.#migrationTable);
338
+ // At least on PostgreSQL, `if not exists` doesn't guarantee the `create table`
339
+ // query doesn't throw if the table already exits. That's why we check if
340
+ // the table exist here and ignore the error if it does.
341
+ if (!tableExists) {
342
+ throw error;
342
343
  }
343
344
  }
344
345
  }
345
346
  async #ensureMigrationLockTableExists() {
346
- if (!(await this.#doesTableExists(this.#migrationLockTable))) {
347
- try {
348
- await this.#createIfNotExists(this.#props.db.schema
349
- .withPlugin(this.#schemaPlugin)
350
- .createTable(this.#migrationLockTable)
351
- .addColumn('id', 'varchar(255)', (col) => col.notNull().primaryKey())
352
- .addColumn('is_locked', 'integer', (col) => col.notNull().defaultTo(0)));
353
- }
354
- catch (error) {
355
- // At least on PostgreSQL, `if not exists` doesn't guarantee the `create table`
356
- // query doesn't throw if the table already exits. That's why we check if
357
- // the table exist here and ignore the error if it does.
358
- if (!(await this.#doesTableExists(this.#migrationLockTable))) {
359
- throw error;
360
- }
347
+ const tableExists = await this.#doesTableExist(this.#migrationLockTable);
348
+ if (tableExists) {
349
+ return;
350
+ }
351
+ try {
352
+ await this.#createIfNotExists(this.#props.db.schema
353
+ .withPlugin(this.#schemaPlugin)
354
+ .createTable(this.#migrationLockTable)
355
+ .addColumn('id', 'varchar(255)', (col) => col.notNull().primaryKey())
356
+ .addColumn('is_locked', 'integer', (col) => col.notNull().defaultTo(0)));
357
+ }
358
+ catch (error) {
359
+ const tableExists = await this.#doesTableExist(this.#migrationLockTable);
360
+ // At least on PostgreSQL, `if not exists` doesn't guarantee the `create table`
361
+ // query doesn't throw if the table already exits. That's why we check if
362
+ // the table exist here and ignore the error if it does.
363
+ if (!tableExists) {
364
+ throw error;
361
365
  }
362
366
  }
363
367
  }
364
368
  async #ensureLockRowExists() {
365
- if (!(await this.#doesLockRowExists())) {
366
- try {
367
- await this.#props.db
368
- .withPlugin(this.#schemaPlugin)
369
- .insertInto(this.#migrationLockTable)
370
- .values({ id: exports.MIGRATION_LOCK_ID, is_locked: 0 })
371
- .execute();
372
- }
373
- catch (error) {
374
- if (!(await this.#doesLockRowExists())) {
375
- throw error;
376
- }
369
+ const lockRowExists = await this.#doesLockRowExists();
370
+ if (lockRowExists) {
371
+ return;
372
+ }
373
+ try {
374
+ await this.#props.db
375
+ .withPlugin(this.#schemaPlugin)
376
+ .insertInto(this.#migrationLockTable)
377
+ .values({ id: exports.MIGRATION_LOCK_ID, is_locked: 0 })
378
+ .execute();
379
+ }
380
+ catch (error) {
381
+ const lockRowExists = await this.#doesLockRowExists();
382
+ if (!lockRowExists) {
383
+ throw error;
377
384
  }
378
385
  }
379
386
  }
380
- async #doesSchemaExists() {
387
+ async #doesSchemaExist() {
381
388
  const schemas = await this.#props.db.introspection.getSchemas();
382
389
  return schemas.some((it) => it.name === this.#migrationTableSchema);
383
390
  }
384
- async #doesTableExists(tableName) {
391
+ async #doesTableExist(tableName) {
385
392
  const schema = this.#migrationTableSchema;
386
393
  const tables = await this.#props.db.introspection.getTables({
387
394
  withInternalKyselyTables: true,
@@ -206,10 +206,11 @@ export * from './util/compilable.js';
206
206
  export * from './util/explainable.js';
207
207
  export * from './util/streamable.js';
208
208
  export * from './util/log.js';
209
- export type { AnyAliasedColumn, AnyAliasedColumnWithTable, AnyColumn, AnyColumnWithTable, Equals, UnknownRow, Simplify, SqlBool, Nullable, NumbersWhenDataTypeNotAvailable, NotNull, NumericString, ShallowDehydrateObject, ShallowDehydrateValue, StringsWhenDataTypeNotAvailable, } from './util/type-utils.js';
209
+ export type { AnyAliasedColumn, AnyAliasedColumnWithTable, AnyColumn, AnyColumnWithTable, DrainOuterGeneric, Equals, ExtractColumnType, UnknownRow, Simplify, SqlBool, Nullable, NumbersWhenDataTypeNotAvailable, NotNull, NumericString, ShallowDehydrateObject, ShallowDehydrateValue, SimplifyResult, SimplifySingleResult, StringsWhenDataTypeNotAvailable, } from './util/type-utils.js';
210
210
  export * from './util/infer-result.js';
211
211
  export { logOnce } from './util/log-once.js';
212
212
  export { createQueryId, type QueryId } from './util/query-id.js';
213
+ export type { KyselyTypeError } from './util/type-error.js';
213
214
  export type { SelectExpression, SelectCallback, SelectArg, Selection, CallbackSelection, } from './parser/select-parser.js';
214
215
  export type { ReferenceExpression, ReferenceExpressionOrList, SimpleReferenceExpression, StringReference, ExtractTypeFromStringReference, ExtractTypeFromReferenceExpression, } from './parser/reference-parser.js';
215
216
  export type { ValueExpression, ValueExpressionOrList, } from './parser/value-parser.js';
@@ -222,3 +223,4 @@ export type { ComparisonOperatorExpression, OperandValueExpression, OperandValue
222
223
  export type { ExistsExpression } from './parser/unary-operation-parser.js';
223
224
  export type { OperandExpression, ExpressionOrFactory, } from './parser/expression-parser.js';
224
225
  export type { Collation } from './parser/collate-parser.js';
226
+ export type { QueryCreatorWithCommonTableExpression } from './parser/with-parser.js';
@@ -263,7 +263,7 @@ export interface MigratorProps {
263
263
  * the project, to the end of time or prepare to manually migrate the migration
264
264
  * tables.
265
265
  *
266
- * This only works on postgres.
266
+ * This only works on postgres and mssql.
267
267
  */
268
268
  readonly migrationTableSchema?: string;
269
269
  /**
@@ -56,7 +56,8 @@ export class Migrator {
56
56
  * The returned array is sorted by migration name.
57
57
  */
58
58
  async getMigrations() {
59
- const executedMigrations = (await this.#doesTableExists(this.#migrationTable))
59
+ const tableExists = await this.#doesTableExist(this.#migrationTable);
60
+ const executedMigrations = tableExists
60
61
  ? await this.#props.db
61
62
  .withPlugin(this.#schemaPlugin)
62
63
  .selectFrom(this.#migrationTable)
@@ -263,7 +264,10 @@ export class Migrator {
263
264
  }
264
265
  async #migrate(getMigrationDirectionAndStep) {
265
266
  try {
266
- await this.#ensureMigrationTablesExists();
267
+ await this.#ensureMigrationTableSchemaExists();
268
+ await this.#ensureMigrationTableExists();
269
+ await this.#ensureMigrationLockTableExists();
270
+ await this.#ensureLockRowExists();
267
271
  return await this.#runMigrations(getMigrationDirectionAndStep);
268
272
  }
269
273
  catch (error) {
@@ -291,95 +295,98 @@ export class Migrator {
291
295
  }
292
296
  return new NoopPlugin();
293
297
  }
294
- async #ensureMigrationTablesExists() {
295
- await this.#ensureMigrationTableSchemaExists();
296
- await this.#ensureMigrationTableExists();
297
- await this.#ensureMigrationLockTableExists();
298
- await this.#ensureLockRowExists();
299
- }
300
298
  async #ensureMigrationTableSchemaExists() {
301
299
  if (!this.#migrationTableSchema) {
302
300
  // Use default schema. Nothing to do.
303
301
  return;
304
302
  }
305
- if (!(await this.#doesSchemaExists())) {
306
- try {
307
- await this.#createIfNotExists(this.#props.db.schema.createSchema(this.#migrationTableSchema));
308
- }
309
- catch (error) {
310
- // At least on PostgreSQL, `if not exists` doesn't guarantee the `create schema`
311
- // query doesn't throw if the schema already exits. That's why we check if
312
- // the schema exist here and ignore the error if it does.
313
- if (!(await this.#doesSchemaExists())) {
314
- throw error;
315
- }
303
+ const schemaExists = await this.#doesSchemaExist();
304
+ if (schemaExists) {
305
+ return;
306
+ }
307
+ try {
308
+ await this.#createIfNotExists(this.#props.db.schema.createSchema(this.#migrationTableSchema));
309
+ }
310
+ catch (error) {
311
+ const schemaExists = await this.#doesSchemaExist();
312
+ // At least on PostgreSQL, `if not exists` doesn't guarantee the `create schema`
313
+ // query doesn't throw if the schema already exits. That's why we check if
314
+ // the schema exist here and ignore the error if it does.
315
+ if (!schemaExists) {
316
+ throw error;
316
317
  }
317
318
  }
318
319
  }
319
320
  async #ensureMigrationTableExists() {
320
- if (!(await this.#doesTableExists(this.#migrationTable))) {
321
- try {
322
- if (this.#migrationTableSchema) {
323
- await this.#createIfNotExists(this.#props.db.schema.createSchema(this.#migrationTableSchema));
324
- }
325
- await this.#createIfNotExists(this.#props.db.schema
326
- .withPlugin(this.#schemaPlugin)
327
- .createTable(this.#migrationTable)
328
- .addColumn('name', 'varchar(255)', (col) => col.notNull().primaryKey())
329
- // The migration run time as ISO string. This is not a real date type as we
330
- // can't know which data type is supported by all future dialects.
331
- .addColumn('timestamp', 'varchar(255)', (col) => col.notNull()));
332
- }
333
- catch (error) {
334
- // At least on PostgreSQL, `if not exists` doesn't guarantee the `create table`
335
- // query doesn't throw if the table already exits. That's why we check if
336
- // the table exist here and ignore the error if it does.
337
- if (!(await this.#doesTableExists(this.#migrationTable))) {
338
- throw error;
339
- }
321
+ const tableExists = await this.#doesTableExist(this.#migrationTable);
322
+ if (tableExists) {
323
+ return;
324
+ }
325
+ try {
326
+ await this.#createIfNotExists(this.#props.db.schema
327
+ .withPlugin(this.#schemaPlugin)
328
+ .createTable(this.#migrationTable)
329
+ .addColumn('name', 'varchar(255)', (col) => col.notNull().primaryKey())
330
+ // The migration run time as ISO string. This is not a real date type as we
331
+ // can't know which data type is supported by all future dialects.
332
+ .addColumn('timestamp', 'varchar(255)', (col) => col.notNull()));
333
+ }
334
+ catch (error) {
335
+ const tableExists = await this.#doesTableExist(this.#migrationTable);
336
+ // At least on PostgreSQL, `if not exists` doesn't guarantee the `create table`
337
+ // query doesn't throw if the table already exits. That's why we check if
338
+ // the table exist here and ignore the error if it does.
339
+ if (!tableExists) {
340
+ throw error;
340
341
  }
341
342
  }
342
343
  }
343
344
  async #ensureMigrationLockTableExists() {
344
- if (!(await this.#doesTableExists(this.#migrationLockTable))) {
345
- try {
346
- await this.#createIfNotExists(this.#props.db.schema
347
- .withPlugin(this.#schemaPlugin)
348
- .createTable(this.#migrationLockTable)
349
- .addColumn('id', 'varchar(255)', (col) => col.notNull().primaryKey())
350
- .addColumn('is_locked', 'integer', (col) => col.notNull().defaultTo(0)));
351
- }
352
- catch (error) {
353
- // At least on PostgreSQL, `if not exists` doesn't guarantee the `create table`
354
- // query doesn't throw if the table already exits. That's why we check if
355
- // the table exist here and ignore the error if it does.
356
- if (!(await this.#doesTableExists(this.#migrationLockTable))) {
357
- throw error;
358
- }
345
+ const tableExists = await this.#doesTableExist(this.#migrationLockTable);
346
+ if (tableExists) {
347
+ return;
348
+ }
349
+ try {
350
+ await this.#createIfNotExists(this.#props.db.schema
351
+ .withPlugin(this.#schemaPlugin)
352
+ .createTable(this.#migrationLockTable)
353
+ .addColumn('id', 'varchar(255)', (col) => col.notNull().primaryKey())
354
+ .addColumn('is_locked', 'integer', (col) => col.notNull().defaultTo(0)));
355
+ }
356
+ catch (error) {
357
+ const tableExists = await this.#doesTableExist(this.#migrationLockTable);
358
+ // At least on PostgreSQL, `if not exists` doesn't guarantee the `create table`
359
+ // query doesn't throw if the table already exits. That's why we check if
360
+ // the table exist here and ignore the error if it does.
361
+ if (!tableExists) {
362
+ throw error;
359
363
  }
360
364
  }
361
365
  }
362
366
  async #ensureLockRowExists() {
363
- if (!(await this.#doesLockRowExists())) {
364
- try {
365
- await this.#props.db
366
- .withPlugin(this.#schemaPlugin)
367
- .insertInto(this.#migrationLockTable)
368
- .values({ id: MIGRATION_LOCK_ID, is_locked: 0 })
369
- .execute();
370
- }
371
- catch (error) {
372
- if (!(await this.#doesLockRowExists())) {
373
- throw error;
374
- }
367
+ const lockRowExists = await this.#doesLockRowExists();
368
+ if (lockRowExists) {
369
+ return;
370
+ }
371
+ try {
372
+ await this.#props.db
373
+ .withPlugin(this.#schemaPlugin)
374
+ .insertInto(this.#migrationLockTable)
375
+ .values({ id: MIGRATION_LOCK_ID, is_locked: 0 })
376
+ .execute();
377
+ }
378
+ catch (error) {
379
+ const lockRowExists = await this.#doesLockRowExists();
380
+ if (!lockRowExists) {
381
+ throw error;
375
382
  }
376
383
  }
377
384
  }
378
- async #doesSchemaExists() {
385
+ async #doesSchemaExist() {
379
386
  const schemas = await this.#props.db.introspection.getSchemas();
380
387
  return schemas.some((it) => it.name === this.#migrationTableSchema);
381
388
  }
382
- async #doesTableExists(tableName) {
389
+ async #doesTableExist(tableName) {
383
390
  const schema = this.#migrationTableSchema;
384
391
  const tables = await this.#props.db.introspection.getTables({
385
392
  withInternalKyselyTables: true,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kysely",
3
- "version": "0.28.9",
3
+ "version": "0.28.10",
4
4
  "description": "Type safe SQL query builder",
5
5
  "repository": {
6
6
  "type": "git",
@@ -76,35 +76,35 @@
76
76
  ],
77
77
  "devDependencies": {
78
78
  "@arethetypeswrong/cli": "^0.18.2",
79
- "@ark/attest": "^0.55.0",
79
+ "@ark/attest": "^0.56.0",
80
80
  "@types/better-sqlite3": "^7.6.13",
81
81
  "@types/chai": "^5.2.3",
82
82
  "@types/chai-as-promised": "^8.0.2",
83
83
  "@types/mocha": "^10.0.10",
84
84
  "@types/node": "^24.10.1",
85
- "@types/pg": "^8.15.6",
85
+ "@types/pg": "^8.16.0",
86
86
  "@types/pg-cursor": "^2.7.2",
87
87
  "@types/semver": "^7.7.1",
88
- "@types/sinon": "^17.0.4",
89
- "better-sqlite3": "^12.5.0",
90
- "chai": "^6.2.1",
88
+ "@types/sinon": "^21.0.0",
89
+ "better-sqlite3": "^12.6.0",
90
+ "chai": "^6.2.2",
91
91
  "chai-as-promised": "^8.0.2",
92
- "esbuild": "^0.27.0",
92
+ "esbuild": "^0.27.2",
93
93
  "jsr": "^0.13.4",
94
94
  "lodash": "^4.17.21",
95
95
  "mocha": "^11.7.5",
96
- "mysql2": "^3.15.3",
96
+ "mysql2": "^3.16.1",
97
97
  "pathe": "^2.0.3",
98
- "pg": "^8.15.6",
99
- "pg-cursor": "^2.14.6",
98
+ "pg": "^8.17.1",
99
+ "pg-cursor": "^2.16.1",
100
100
  "pkg-types": "^2.3.0",
101
101
  "playwright": "^1.57.0",
102
- "prettier": "^3.7.3",
102
+ "prettier": "^3.8.0",
103
103
  "semver": "^7.7.3",
104
- "sinon": "^21.0.0",
104
+ "sinon": "^21.0.1",
105
105
  "std-env": "^3.10.0",
106
106
  "tarn": "^3.0.2",
107
- "tedious": "^19.1.3",
107
+ "tedious": "^19.2.0",
108
108
  "tsd": "^0.33.0",
109
109
  "typescript": "~5.9.3"
110
110
  },