appos 0.3.5-0 → 0.3.6-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/main.mjs +2 -2
- package/dist/exports/api/adapter-C2mMJKvG.mjs +1504 -0
- package/dist/exports/api/{auth-schema.mjs → auth-schema-CON4yFFY.mjs} +2 -3
- package/dist/exports/api/bun-sqlite-dialect-CPpPZa23.mjs +155 -0
- package/dist/exports/{cli/_virtual/rolldown_runtime.mjs → api/chunk-CyXqrcp_.mjs} +14 -1
- package/dist/exports/api/conditions-DjBAWfiK.mjs +116 -0
- package/dist/exports/api/dialect-CUUD24Ge.mjs +72 -0
- package/dist/exports/api/env-CwT3zhez.mjs +1 -0
- package/dist/exports/api/esm-_hkVMulx.mjs +15816 -0
- package/dist/exports/api/event-BHFSE6hY.mjs +20983 -0
- package/dist/exports/api/extract-blob-metadata-BMgUEPcW.mjs +4 -0
- package/dist/exports/api/extract-blob-metadata-_9RUEwoU.mjs +9818 -0
- package/dist/exports/api/generate-image-variant-DOIzj1wJ.mjs +4 -0
- package/dist/exports/api/generate-image-variant-DxOPoGAk.mjs +118 -0
- package/dist/exports/api/generate-preview-CvTFuq58.mjs +160 -0
- package/dist/exports/api/generate-preview-Dk3coswZ.mjs +4 -0
- package/dist/exports/api/index.d.mts +7347 -20
- package/dist/exports/api/index.mjs +146856 -18
- package/dist/exports/api/kysely-adapter-CmP2TbkS.mjs +296 -0
- package/dist/exports/api/memory-adapter-BzhRhLFK.mjs +212 -0
- package/dist/exports/api/node-sqlite-dialect-Bl5suBxl.mjs +155 -0
- package/dist/exports/api/orm-CMqufD21.mjs +153690 -0
- package/dist/exports/api/orm-DXqYuKvB.d.mts +11 -0
- package/dist/exports/api/orm.d.mts +2 -11
- package/dist/exports/api/orm.mjs +4 -42
- package/dist/exports/api/pdf-YxB2Hm1p.mjs +25822 -0
- package/dist/exports/api/purge-attachment-Cf6KH2Jv.mjs +34 -0
- package/dist/exports/api/purge-attachment-DIuil7ps.mjs +4 -0
- package/dist/exports/{cli/api/workflows/purge-audit-logs.mjs → api/purge-audit-logs-z6j_Pu47.mjs} +3 -3
- package/dist/exports/{cli/api/workflows/purge-unattached-blobs.mjs → api/purge-unattached-blobs-B0TfY5Hk.mjs} +1 -1
- package/dist/exports/api/react-BYhV5bYt.mjs +1131 -0
- package/dist/exports/api/server.node-DyVrQ6cz.mjs +19298 -0
- package/dist/exports/api/table-6bTIEqON.mjs +2636 -0
- package/dist/exports/api/{workflows/track-db-changes.mjs → track-db-changes-BysaV6nN.mjs} +14 -14
- package/dist/exports/api/{workflow.mjs → workflow-BuSWHcX-.mjs} +121 -10
- package/dist/exports/api/workflows/auth-schema-BFve3hgZ.mjs +2813 -0
- package/dist/exports/api/{_virtual/rolldown_runtime.mjs → workflows/chunk-B36mNPO4.mjs} +5 -1
- package/dist/exports/api/workflows/extract-blob-metadata-BcWKvY2K.mjs +9818 -0
- package/dist/exports/api/workflows/{generate-image-variant.mjs → generate-image-variant-BAFvL_zV.mjs} +20 -20
- package/dist/exports/{cli/api/workflows/generate-preview.mjs → api/workflows/generate-preview-BjlIVYYp.mjs} +6 -6
- package/dist/exports/api/workflows/index.d.mts +2011 -1
- package/dist/exports/api/workflows/index.mjs +2 -1
- package/dist/exports/api/workflows/pdf-DUB8zyIc.mjs +25822 -0
- package/dist/exports/{cli/api/workflows/purge-attachment.mjs → api/workflows/purge-attachment-k_sdxTPY.mjs} +3 -3
- package/dist/exports/api/workflows/{purge-audit-logs.mjs → purge-audit-logs-zCyWj4Mw.mjs} +12 -3
- package/dist/exports/api/workflows/{purge-unattached-blobs.mjs → purge-unattached-blobs-CdsuFAeW.mjs} +1 -1
- package/dist/exports/api/workflows/track-db-changes-CiKaI9gT.mjs +20943 -0
- package/dist/exports/api/workflows/track-db-changes-DEWQYryO.mjs +4 -0
- package/dist/exports/{cli/api/workflow.mjs → api/workflows/workflow-BjM2xCa6.mjs} +23 -3
- package/dist/exports/api/workflows/zod-Br0enFWK.mjs +12333 -0
- package/dist/exports/api/zod-CdrJdBtV.mjs +12571 -0
- package/dist/exports/cli/auth-schema-CNuOqPi-.mjs +2813 -0
- package/dist/exports/{api/workflows/_virtual/rolldown_runtime.mjs → cli/chunk-B36mNPO4.mjs} +5 -1
- package/dist/exports/cli/extract-blob-metadata-CV1Ke90d.mjs +9818 -0
- package/dist/exports/cli/{api/workflows/generate-image-variant.mjs → generate-image-variant-CM1BrVvZ.mjs} +20 -20
- package/dist/exports/{api/workflows/generate-preview.mjs → cli/generate-preview-DdHQ3ukz.mjs} +6 -6
- package/dist/exports/cli/index.d.mts +2142 -2
- package/dist/exports/cli/index.mjs +41 -1
- package/dist/exports/cli/pdf-CLUPEIdT.mjs +25822 -0
- package/dist/exports/{api/workflows/purge-attachment.mjs → cli/purge-attachment-Dc_J74dG.mjs} +3 -3
- package/dist/exports/cli/purge-audit-logs-DFhWh-Bx.mjs +56 -0
- package/dist/exports/cli/purge-unattached-blobs-C1MRlM_2.mjs +46 -0
- package/dist/exports/cli/track-db-changes-CfneOF2_.mjs +20943 -0
- package/dist/exports/{api/workflows/api/workflow.mjs → cli/workflow-DSbbXBMt.mjs} +23 -3
- package/dist/exports/cli/zod-7q0_Mtnn.mjs +12333 -0
- package/dist/exports/devtools/BaseTanStackRouterDevtoolsPanel-BBz1qLry-DUwdvyLv.js +2090 -0
- package/dist/exports/devtools/EIDV623S-B7f6114d.js +2497 -0
- package/dist/exports/devtools/FloatingTanStackRouterDevtools-DymJEvfG-BHuQHiRR.js +237 -0
- package/dist/exports/devtools/MIMHJGAX-Cb3wf11F.js +10903 -0
- package/dist/exports/devtools/Q7LWSL4U-BoEO3rNq.js +37 -0
- package/dist/exports/devtools/VLTTJS3N-CIyRc84e.js +44 -0
- package/dist/exports/devtools/index.js +1724 -3
- package/dist/exports/devtools/utils-YRTCpRgb.js +1670 -0
- package/dist/exports/tests/api.d.mts +7354 -5
- package/dist/exports/tests/api.mjs +79 -1
- package/dist/exports/tests/auth-schema-DUCJw-_2.mjs +1 -0
- package/dist/exports/tests/chunk-Cii4FAhs.mjs +1 -0
- package/dist/exports/tests/conditions-B0ffVJ5E.mjs +1 -0
- package/dist/exports/tests/constants-DHjjg05J.mjs +1 -0
- package/dist/exports/tests/dist-D6vgKv3t.mjs +7 -0
- package/dist/exports/tests/dist-EfrRkq5c.mjs +296 -0
- package/dist/exports/tests/extract-blob-metadata-Dv343Vcn.mjs +169 -0
- package/dist/exports/tests/generate-image-variant-cQc8q0kh.mjs +1 -0
- package/dist/exports/tests/generate-preview-HaTMd2hS.mjs +1 -0
- package/dist/exports/tests/magic-string.es-D6VRmdiF.mjs +14 -0
- package/dist/exports/tests/mock-BvkO5nlm.mjs +1 -0
- package/dist/exports/tests/mock.mjs +1 -1
- package/dist/exports/tests/pdf-BDsS3vjF.mjs +13 -0
- package/dist/exports/tests/purge-attachment-D4uOzHRi.mjs +1 -0
- package/dist/exports/tests/purge-audit-logs-DiPcc09d.mjs +1 -0
- package/dist/exports/tests/purge-unattached-blobs-CqW6tlIC.mjs +1 -0
- package/dist/exports/tests/react.mjs +6 -1
- package/dist/exports/tests/setup.d.mts +1 -1
- package/dist/exports/tests/setup.mjs +34 -1
- package/dist/exports/tests/table-CbU04119.mjs +1 -0
- package/dist/exports/tests/track-db-changes-Bd4W-P1q.mjs +1 -0
- package/dist/exports/tests/vi.2VT5v0um-Cme1b0Dl.mjs +348 -0
- package/dist/exports/tests/{api/workflow.mjs → workflow-DwZxTqdH.mjs} +1 -1
- package/dist/exports/tests/zod-DcpxsMPz.mjs +23 -0
- package/dist/exports/vendors/date.js +13236 -1
- package/dist/exports/vendors/toolkit.js +2206 -1
- package/dist/exports/vendors/zod.js +12344 -1
- package/dist/exports/vite/api-DGRU_RdM.mjs +27 -0
- package/dist/exports/vite/build-CxJAu2Bn.mjs +1 -0
- package/dist/exports/vite/build2-BMK0OFVt.mjs +16 -0
- package/dist/exports/vite/chunk-CxnlK1Zi.mjs +1 -0
- package/dist/exports/vite/chunk-PtveFMYu.mjs +1 -0
- package/dist/exports/vite/dist-Bxp8DqWh.mjs +114 -0
- package/dist/exports/vite/dist-CX51FKbX.mjs +1 -0
- package/dist/exports/vite/dist-DcyNr-KR.mjs +1 -0
- package/dist/exports/vite/dist-j3-Khlzt.mjs +1 -0
- package/dist/exports/vite/experimental-index-3KsfmUbz.mjs +1 -0
- package/dist/exports/vite/false-BNJbUKYT.mjs +1 -0
- package/dist/exports/vite/false-BvrPEDU6.mjs +1 -0
- package/dist/exports/vite/index.d.mts +1 -1
- package/dist/exports/vite/index.mjs +26 -1
- package/dist/exports/vite/internal-C5cVwRiK.mjs +1 -0
- package/dist/exports/vite/jiti-BjSPrFvg.mjs +9 -0
- package/dist/exports/vite/lexer-DQCqS3nf-C6xCDOEQ.mjs +3 -0
- package/dist/exports/vite/lib-CMv7Sfwa.mjs +1 -0
- package/dist/exports/vite/lib-D9TnS-7w.mjs +1 -0
- package/dist/exports/vite/lib-DuBRr9dH.mjs +382 -0
- package/dist/exports/vite/node-DI8AnY_i.mjs +437 -0
- package/dist/exports/vite/postcss-BtmDpj-c.mjs +32 -0
- package/dist/exports/vite/postcss-import-Bk_ZCd6c.mjs +5 -0
- package/dist/exports/vite/rolldown-build-CNW2eye_-CJNfyXdF.mjs +13 -0
- package/dist/exports/vitest/api-CPv6lnxG.mjs +27 -0
- package/dist/exports/vitest/build2-28i3OiJ3.mjs +16 -0
- package/dist/exports/vitest/chunk-_e2jlDPK.mjs +1 -0
- package/dist/exports/vitest/chunk-jwDkFoXW.mjs +1 -0
- package/dist/exports/vitest/config.mjs +77 -1
- package/dist/exports/vitest/dist-L-OpshPJ.mjs +114 -0
- package/dist/exports/vitest/index.mjs +348 -1
- package/dist/exports/vitest/jiti-eNGOyHIo.mjs +9 -0
- package/dist/exports/vitest/lexer-DQCqS3nf-TWLyIqlY.mjs +3 -0
- package/dist/exports/vitest/lib-C3G64csm.mjs +1 -0
- package/dist/exports/vitest/magic-string.es-CxM5Ubyl.mjs +14 -0
- package/dist/exports/vitest/module-runner-DsF4L04D.mjs +1 -0
- package/dist/exports/vitest/postcss-BxLp_Too.mjs +32 -0
- package/dist/exports/vitest/postcss-import-5pKj3f5q.mjs +5 -0
- package/dist/exports/web/browser-ponyfill-DxTJMXNq.js +443 -0
- package/dist/exports/web/chunk-DksrlJLg.js +49 -0
- package/dist/exports/web/index.d.ts +2546 -2
- package/dist/exports/web/index.js +9295 -6
- package/dist/exports/web/plugin-DqTFWG7p.js +250 -0
- package/package.json +1 -1
- package/dist/exports/api/app-context.d.mts +0 -115
- package/dist/exports/api/app-context.mjs +0 -24
- package/dist/exports/api/auth-schema.d.mts +0 -4248
- package/dist/exports/api/auth.d.mts +0 -402
- package/dist/exports/api/auth.mjs +0 -188
- package/dist/exports/api/cache.d.mts +0 -44
- package/dist/exports/api/cache.mjs +0 -28
- package/dist/exports/api/config.d.mts +0 -28
- package/dist/exports/api/config.mjs +0 -72
- package/dist/exports/api/constants.mjs +0 -92
- package/dist/exports/api/container.d.mts +0 -210
- package/dist/exports/api/container.mjs +0 -49
- package/dist/exports/api/database.d.mts +0 -101
- package/dist/exports/api/database.mjs +0 -219
- package/dist/exports/api/event.d.mts +0 -235
- package/dist/exports/api/event.mjs +0 -236
- package/dist/exports/api/i18n.d.mts +0 -34
- package/dist/exports/api/i18n.mjs +0 -45
- package/dist/exports/api/instrumentation.d.mts +0 -7
- package/dist/exports/api/instrumentation.mjs +0 -40
- package/dist/exports/api/logger.d.mts +0 -21
- package/dist/exports/api/logger.mjs +0 -26
- package/dist/exports/api/mailer.d.mts +0 -70
- package/dist/exports/api/mailer.mjs +0 -37
- package/dist/exports/api/middleware/request-logger.d.mts +0 -24
- package/dist/exports/api/middleware.d.mts +0 -39
- package/dist/exports/api/middleware.mjs +0 -73
- package/dist/exports/api/openapi.d.mts +0 -271
- package/dist/exports/api/openapi.mjs +0 -507
- package/dist/exports/api/otel.d.mts +0 -40
- package/dist/exports/api/otel.mjs +0 -56
- package/dist/exports/api/redis.d.mts +0 -34
- package/dist/exports/api/redis.mjs +0 -41
- package/dist/exports/api/storage-schema.d.mts +0 -707
- package/dist/exports/api/storage-schema.mjs +0 -72
- package/dist/exports/api/storage.d.mts +0 -506
- package/dist/exports/api/storage.mjs +0 -833
- package/dist/exports/api/web/auth.mjs +0 -17
- package/dist/exports/api/workflow.d.mts +0 -250
- package/dist/exports/api/workflows/api/auth-schema.mjs +0 -373
- package/dist/exports/api/workflows/api/auth.d.mts +0 -379
- package/dist/exports/api/workflows/api/cache.d.mts +0 -44
- package/dist/exports/api/workflows/api/config.d.mts +0 -18
- package/dist/exports/api/workflows/api/container.d.mts +0 -167
- package/dist/exports/api/workflows/api/database.d.mts +0 -47
- package/dist/exports/api/workflows/api/event.d.mts +0 -68
- package/dist/exports/api/workflows/api/event.mjs +0 -126
- package/dist/exports/api/workflows/api/logger.d.mts +0 -21
- package/dist/exports/api/workflows/api/mailer.d.mts +0 -70
- package/dist/exports/api/workflows/api/orm.d.mts +0 -13
- package/dist/exports/api/workflows/api/redis.mjs +0 -3
- package/dist/exports/api/workflows/api/storage-schema.d.mts +0 -699
- package/dist/exports/api/workflows/api/storage.d.mts +0 -396
- package/dist/exports/api/workflows/api/workflow.d.mts +0 -24
- package/dist/exports/api/workflows/constants.mjs +0 -23
- package/dist/exports/api/workflows/extract-blob-metadata.mjs +0 -132
- package/dist/exports/api/workflows/generate-image-variant.d.mts +0 -63
- package/dist/exports/api/workflows/track-db-changes.d.mts +0 -72
- package/dist/exports/cli/api/auth-schema.mjs +0 -373
- package/dist/exports/cli/api/auth.d.mts +0 -379
- package/dist/exports/cli/api/cache.d.mts +0 -44
- package/dist/exports/cli/api/config.d.mts +0 -18
- package/dist/exports/cli/api/container.d.mts +0 -167
- package/dist/exports/cli/api/database.d.mts +0 -47
- package/dist/exports/cli/api/event.d.mts +0 -68
- package/dist/exports/cli/api/event.mjs +0 -126
- package/dist/exports/cli/api/logger.d.mts +0 -21
- package/dist/exports/cli/api/mailer.d.mts +0 -70
- package/dist/exports/cli/api/orm.d.mts +0 -13
- package/dist/exports/cli/api/redis.mjs +0 -3
- package/dist/exports/cli/api/storage-schema.d.mts +0 -699
- package/dist/exports/cli/api/storage.d.mts +0 -396
- package/dist/exports/cli/api/workflow.d.mts +0 -2
- package/dist/exports/cli/api/workflows/extract-blob-metadata.mjs +0 -132
- package/dist/exports/cli/api/workflows/generate-image-variant.d.mts +0 -63
- package/dist/exports/cli/api/workflows/track-db-changes.mjs +0 -110
- package/dist/exports/cli/command.d.mts +0 -56
- package/dist/exports/cli/command.mjs +0 -43
- package/dist/exports/cli/constants.mjs +0 -23
- package/dist/exports/cli/context.d.mts +0 -170
- package/dist/exports/tests/_virtual/rolldown_runtime.mjs +0 -1
- package/dist/exports/tests/api/app-context.d.mts +0 -115
- package/dist/exports/tests/api/app-context.mjs +0 -1
- package/dist/exports/tests/api/auth-schema.d.mts +0 -4248
- package/dist/exports/tests/api/auth-schema.mjs +0 -1
- package/dist/exports/tests/api/auth.d.mts +0 -402
- package/dist/exports/tests/api/cache.d.mts +0 -44
- package/dist/exports/tests/api/config.d.mts +0 -28
- package/dist/exports/tests/api/container.d.mts +0 -210
- package/dist/exports/tests/api/database.d.mts +0 -101
- package/dist/exports/tests/api/database.mjs +0 -1
- package/dist/exports/tests/api/event.d.mts +0 -235
- package/dist/exports/tests/api/event.mjs +0 -1
- package/dist/exports/tests/api/i18n.d.mts +0 -34
- package/dist/exports/tests/api/index.d.mts +0 -26
- package/dist/exports/tests/api/logger.d.mts +0 -21
- package/dist/exports/tests/api/mailer.d.mts +0 -70
- package/dist/exports/tests/api/middleware/error-handler.mjs +0 -1
- package/dist/exports/tests/api/middleware/health.mjs +0 -1
- package/dist/exports/tests/api/middleware/i18n.mjs +0 -1
- package/dist/exports/tests/api/middleware/request-logger.d.mts +0 -24
- package/dist/exports/tests/api/middleware/request-logger.mjs +0 -1
- package/dist/exports/tests/api/middleware/shutdown.mjs +0 -1
- package/dist/exports/tests/api/middleware/timeout.mjs +0 -1
- package/dist/exports/tests/api/middleware.d.mts +0 -39
- package/dist/exports/tests/api/middleware.mjs +0 -1
- package/dist/exports/tests/api/openapi.d.mts +0 -271
- package/dist/exports/tests/api/openapi.mjs +0 -1
- package/dist/exports/tests/api/orm.d.mts +0 -13
- package/dist/exports/tests/api/otel.d.mts +0 -40
- package/dist/exports/tests/api/redis.d.mts +0 -34
- package/dist/exports/tests/api/redis.mjs +0 -1
- package/dist/exports/tests/api/server.mjs +0 -1
- package/dist/exports/tests/api/storage-schema.d.mts +0 -707
- package/dist/exports/tests/api/storage.d.mts +0 -506
- package/dist/exports/tests/api/workflow.d.mts +0 -250
- package/dist/exports/tests/api/workflows/extract-blob-metadata.mjs +0 -1
- package/dist/exports/tests/api/workflows/generate-image-variant.d.mts +0 -63
- package/dist/exports/tests/api/workflows/generate-image-variant.mjs +0 -1
- package/dist/exports/tests/api/workflows/generate-preview.mjs +0 -1
- package/dist/exports/tests/api/workflows/purge-attachment.mjs +0 -1
- package/dist/exports/tests/api/workflows/purge-audit-logs.mjs +0 -1
- package/dist/exports/tests/api/workflows/purge-unattached-blobs.mjs +0 -1
- package/dist/exports/tests/api/workflows/track-db-changes.mjs +0 -1
- package/dist/exports/tests/constants.mjs +0 -1
- package/dist/exports/tests/instrumentation.d.mts +0 -7
- package/dist/exports/tests/instrumentation.mjs +0 -1
- package/dist/exports/web/api/auth.d.ts +0 -125
- package/dist/exports/web/api/database.d.ts +0 -4
- package/dist/exports/web/api/logger.d.ts +0 -1
- package/dist/exports/web/auth.d.ts +0 -2388
- package/dist/exports/web/auth.js +0 -75
- package/dist/exports/web/i18n.d.ts +0 -42
- package/dist/exports/web/i18n.js +0 -45
- /package/dist/exports/tests/{api/middleware/youch-handler.mjs → youch-handler-Ch5yf6im.mjs} +0 -0
|
@@ -0,0 +1,2813 @@
|
|
|
1
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/column-common.js
|
|
2
|
+
const OriginalColumn = Symbol.for("drizzle:OriginalColumn");
|
|
3
|
+
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/entity.js
|
|
6
|
+
const entityKind = Symbol.for("drizzle:entityKind");
|
|
7
|
+
const hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
8
|
+
function is(value, type) {
|
|
9
|
+
if (!value || typeof value !== "object") return false;
|
|
10
|
+
if (value instanceof type) return true;
|
|
11
|
+
if (!Object.prototype.hasOwnProperty.call(type, entityKind)) throw new Error(`Class "${type.name ?? "<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);
|
|
12
|
+
let cls = Object.getPrototypeOf(value).constructor;
|
|
13
|
+
if (cls) while (cls) {
|
|
14
|
+
if (entityKind in cls && cls[entityKind] === type[entityKind]) return true;
|
|
15
|
+
cls = Object.getPrototypeOf(cls);
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/column.js
|
|
22
|
+
var Column = class {
|
|
23
|
+
static [entityKind] = "Column";
|
|
24
|
+
name;
|
|
25
|
+
keyAsName;
|
|
26
|
+
primary;
|
|
27
|
+
notNull;
|
|
28
|
+
default;
|
|
29
|
+
defaultFn;
|
|
30
|
+
onUpdateFn;
|
|
31
|
+
hasDefault;
|
|
32
|
+
isUnique;
|
|
33
|
+
uniqueName;
|
|
34
|
+
uniqueType;
|
|
35
|
+
dataType;
|
|
36
|
+
columnType;
|
|
37
|
+
enumValues = void 0;
|
|
38
|
+
generated = void 0;
|
|
39
|
+
generatedIdentity = void 0;
|
|
40
|
+
length;
|
|
41
|
+
isLengthExact;
|
|
42
|
+
isAlias;
|
|
43
|
+
/** @internal */
|
|
44
|
+
config;
|
|
45
|
+
/** @internal */
|
|
46
|
+
table;
|
|
47
|
+
/** @internal */
|
|
48
|
+
onInit() {}
|
|
49
|
+
constructor(table, config) {
|
|
50
|
+
this.config = config;
|
|
51
|
+
this.onInit();
|
|
52
|
+
this.table = table;
|
|
53
|
+
this.name = config.name;
|
|
54
|
+
this.isAlias = false;
|
|
55
|
+
this.keyAsName = config.keyAsName;
|
|
56
|
+
this.notNull = config.notNull;
|
|
57
|
+
this.default = config.default;
|
|
58
|
+
this.defaultFn = config.defaultFn;
|
|
59
|
+
this.onUpdateFn = config.onUpdateFn;
|
|
60
|
+
this.hasDefault = config.hasDefault;
|
|
61
|
+
this.primary = config.primaryKey;
|
|
62
|
+
this.isUnique = config.isUnique;
|
|
63
|
+
this.uniqueName = config.uniqueName;
|
|
64
|
+
this.uniqueType = config.uniqueType;
|
|
65
|
+
this.dataType = config.dataType;
|
|
66
|
+
this.columnType = config.columnType;
|
|
67
|
+
this.generated = config.generated;
|
|
68
|
+
this.generatedIdentity = config.generatedIdentity;
|
|
69
|
+
this.length = config["length"];
|
|
70
|
+
this.isLengthExact = config["isLengthExact"];
|
|
71
|
+
}
|
|
72
|
+
mapFromDriverValue(value) {
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
mapToDriverValue(value) {
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
78
|
+
shouldDisableInsert() {
|
|
79
|
+
return this.config.generated !== void 0 && this.config.generated.type !== "byDefault";
|
|
80
|
+
}
|
|
81
|
+
/** @internal */
|
|
82
|
+
[OriginalColumn]() {
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/column-builder.js
|
|
89
|
+
var ColumnBuilder = class {
|
|
90
|
+
static [entityKind] = "ColumnBuilder";
|
|
91
|
+
/** @internal */
|
|
92
|
+
config;
|
|
93
|
+
constructor(name, dataType, columnType) {
|
|
94
|
+
this.config = {
|
|
95
|
+
name,
|
|
96
|
+
keyAsName: name === "",
|
|
97
|
+
notNull: false,
|
|
98
|
+
default: void 0,
|
|
99
|
+
hasDefault: false,
|
|
100
|
+
primaryKey: false,
|
|
101
|
+
isUnique: false,
|
|
102
|
+
uniqueName: void 0,
|
|
103
|
+
uniqueType: void 0,
|
|
104
|
+
dataType,
|
|
105
|
+
columnType,
|
|
106
|
+
generated: void 0
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Changes the data type of the column. Commonly used with `json` columns. Also, useful for branded types.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* const users = pgTable('users', {
|
|
115
|
+
* id: integer('id').$type<UserId>().primaryKey(),
|
|
116
|
+
* details: json('details').$type<UserDetails>().notNull(),
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
$type() {
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Adds a `not null` clause to the column definition.
|
|
125
|
+
*
|
|
126
|
+
* Affects the `select` model of the table - columns *without* `not null` will be nullable on select.
|
|
127
|
+
*/
|
|
128
|
+
notNull() {
|
|
129
|
+
this.config.notNull = true;
|
|
130
|
+
return this;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Adds a `default <value>` clause to the column definition.
|
|
134
|
+
*
|
|
135
|
+
* Affects the `insert` model of the table - columns *with* `default` are optional on insert.
|
|
136
|
+
*
|
|
137
|
+
* If you need to set a dynamic default value, use {@link $defaultFn} instead.
|
|
138
|
+
*/
|
|
139
|
+
default(value) {
|
|
140
|
+
this.config.default = value;
|
|
141
|
+
this.config.hasDefault = true;
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Adds a dynamic default value to the column.
|
|
146
|
+
* The function will be called when the row is inserted, and the returned value will be used as the column value.
|
|
147
|
+
*
|
|
148
|
+
* **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
|
|
149
|
+
*/
|
|
150
|
+
$defaultFn(fn) {
|
|
151
|
+
this.config.defaultFn = fn;
|
|
152
|
+
this.config.hasDefault = true;
|
|
153
|
+
return this;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Alias for {@link $defaultFn}.
|
|
157
|
+
*/
|
|
158
|
+
$default = this.$defaultFn;
|
|
159
|
+
/**
|
|
160
|
+
* Adds a dynamic update value to the column.
|
|
161
|
+
* The function will be called when the row is updated, and the returned value will be used as the column value if none is provided.
|
|
162
|
+
* If no `default` (or `$defaultFn`) value is provided, the function will be called when the row is inserted as well, and the returned value will be used as the column value.
|
|
163
|
+
*
|
|
164
|
+
* **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
|
|
165
|
+
*/
|
|
166
|
+
$onUpdateFn(fn) {
|
|
167
|
+
this.config.onUpdateFn = fn;
|
|
168
|
+
this.config.hasDefault = true;
|
|
169
|
+
return this;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Alias for {@link $onUpdateFn}.
|
|
173
|
+
*/
|
|
174
|
+
$onUpdate = this.$onUpdateFn;
|
|
175
|
+
/**
|
|
176
|
+
* Adds a `primary key` clause to the column definition. This implicitly makes the column `not null`.
|
|
177
|
+
*
|
|
178
|
+
* In SQLite, `integer primary key` implicitly makes the column auto-incrementing.
|
|
179
|
+
*/
|
|
180
|
+
primaryKey() {
|
|
181
|
+
this.config.primaryKey = true;
|
|
182
|
+
this.config.notNull = true;
|
|
183
|
+
return this;
|
|
184
|
+
}
|
|
185
|
+
/** @internal Sets the name of the column to the key within the table definition if a name was not given. */
|
|
186
|
+
setName(name) {
|
|
187
|
+
if (this.config.name !== "") return;
|
|
188
|
+
this.config.name = name;
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/table.utils.js
|
|
194
|
+
const TableName = Symbol.for("drizzle:Name");
|
|
195
|
+
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/foreign-keys.js
|
|
198
|
+
var ForeignKeyBuilder = class {
|
|
199
|
+
static [entityKind] = "PgForeignKeyBuilder";
|
|
200
|
+
/** @internal */
|
|
201
|
+
reference;
|
|
202
|
+
/** @internal */
|
|
203
|
+
_onUpdate = "no action";
|
|
204
|
+
/** @internal */
|
|
205
|
+
_onDelete = "no action";
|
|
206
|
+
constructor(config, actions) {
|
|
207
|
+
this.reference = () => {
|
|
208
|
+
const { name, columns, foreignColumns } = config();
|
|
209
|
+
return {
|
|
210
|
+
name,
|
|
211
|
+
columns,
|
|
212
|
+
foreignTable: foreignColumns[0].table,
|
|
213
|
+
foreignColumns
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
if (actions) {
|
|
217
|
+
this._onUpdate = actions.onUpdate;
|
|
218
|
+
this._onDelete = actions.onDelete;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
onUpdate(action) {
|
|
222
|
+
this._onUpdate = action === void 0 ? "no action" : action;
|
|
223
|
+
return this;
|
|
224
|
+
}
|
|
225
|
+
onDelete(action) {
|
|
226
|
+
this._onDelete = action === void 0 ? "no action" : action;
|
|
227
|
+
return this;
|
|
228
|
+
}
|
|
229
|
+
/** @internal */
|
|
230
|
+
build(table) {
|
|
231
|
+
return new ForeignKey(table, this);
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
var ForeignKey = class {
|
|
235
|
+
constructor(table, builder) {
|
|
236
|
+
this.table = table;
|
|
237
|
+
this.reference = builder.reference;
|
|
238
|
+
this.onUpdate = builder._onUpdate;
|
|
239
|
+
this.onDelete = builder._onDelete;
|
|
240
|
+
}
|
|
241
|
+
static [entityKind] = "PgForeignKey";
|
|
242
|
+
reference;
|
|
243
|
+
onUpdate;
|
|
244
|
+
onDelete;
|
|
245
|
+
name;
|
|
246
|
+
getName() {
|
|
247
|
+
const { name, columns, foreignColumns } = this.reference();
|
|
248
|
+
const columnNames = columns.map((column) => column.name);
|
|
249
|
+
const foreignColumnNames = foreignColumns.map((column) => column.name);
|
|
250
|
+
const chunks = [
|
|
251
|
+
this.table[TableName],
|
|
252
|
+
...columnNames,
|
|
253
|
+
foreignColumns[0].table[TableName],
|
|
254
|
+
...foreignColumnNames
|
|
255
|
+
];
|
|
256
|
+
return name ?? `${chunks.join("_")}_fk`;
|
|
257
|
+
}
|
|
258
|
+
isNameExplicit() {
|
|
259
|
+
return !!this.reference().name;
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/tracing-utils.js
|
|
265
|
+
function iife(fn, ...args) {
|
|
266
|
+
return fn(...args);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/utils/array.js
|
|
271
|
+
function parsePgArrayValue(arrayString, startFrom, inQuotes) {
|
|
272
|
+
for (let i = startFrom; i < arrayString.length; i++) {
|
|
273
|
+
const char$1 = arrayString[i];
|
|
274
|
+
if (char$1 === "\\") {
|
|
275
|
+
i++;
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
if (char$1 === "\"") return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i + 1];
|
|
279
|
+
if (inQuotes) continue;
|
|
280
|
+
if (char$1 === "," || char$1 === "}") return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i];
|
|
281
|
+
}
|
|
282
|
+
return [arrayString.slice(startFrom).replace(/\\/g, ""), arrayString.length];
|
|
283
|
+
}
|
|
284
|
+
function parsePgNestedArray(arrayString, startFrom = 0) {
|
|
285
|
+
const result = [];
|
|
286
|
+
let i = startFrom;
|
|
287
|
+
let lastCharIsComma = false;
|
|
288
|
+
while (i < arrayString.length) {
|
|
289
|
+
const char$1 = arrayString[i];
|
|
290
|
+
if (char$1 === ",") {
|
|
291
|
+
if (lastCharIsComma || i === startFrom) result.push("");
|
|
292
|
+
lastCharIsComma = true;
|
|
293
|
+
i++;
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
lastCharIsComma = false;
|
|
297
|
+
if (char$1 === "\\") {
|
|
298
|
+
i += 2;
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
if (char$1 === "\"") {
|
|
302
|
+
const [value2, startFrom2] = parsePgArrayValue(arrayString, i + 1, true);
|
|
303
|
+
result.push(value2);
|
|
304
|
+
i = startFrom2;
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
if (char$1 === "}") return [result, i + 1];
|
|
308
|
+
if (char$1 === "{") {
|
|
309
|
+
const [value2, startFrom2] = parsePgNestedArray(arrayString, i + 1);
|
|
310
|
+
result.push(value2);
|
|
311
|
+
i = startFrom2;
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
const [value, newStartFrom] = parsePgArrayValue(arrayString, i, false);
|
|
315
|
+
result.push(value);
|
|
316
|
+
i = newStartFrom;
|
|
317
|
+
}
|
|
318
|
+
return [result, i];
|
|
319
|
+
}
|
|
320
|
+
function parsePgArray(arrayString) {
|
|
321
|
+
const [result] = parsePgNestedArray(arrayString, 1);
|
|
322
|
+
return result;
|
|
323
|
+
}
|
|
324
|
+
function makePgArray(array) {
|
|
325
|
+
return `{${array.map((item) => {
|
|
326
|
+
if (Array.isArray(item)) return makePgArray(item);
|
|
327
|
+
if (typeof item === "string") return `"${item.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
328
|
+
return `${item}`;
|
|
329
|
+
}).join(",")}}`;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
//#endregion
|
|
333
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/common.js
|
|
334
|
+
var PgColumnBuilder = class extends ColumnBuilder {
|
|
335
|
+
foreignKeyConfigs = [];
|
|
336
|
+
static [entityKind] = "PgColumnBuilder";
|
|
337
|
+
array(length) {
|
|
338
|
+
return new PgArrayBuilder(this.config.name, this, length);
|
|
339
|
+
}
|
|
340
|
+
references(ref, config = {}) {
|
|
341
|
+
this.foreignKeyConfigs.push({
|
|
342
|
+
ref,
|
|
343
|
+
config
|
|
344
|
+
});
|
|
345
|
+
return this;
|
|
346
|
+
}
|
|
347
|
+
unique(name, config) {
|
|
348
|
+
this.config.isUnique = true;
|
|
349
|
+
this.config.uniqueName = name;
|
|
350
|
+
this.config.uniqueType = config?.nulls;
|
|
351
|
+
return this;
|
|
352
|
+
}
|
|
353
|
+
generatedAlwaysAs(as) {
|
|
354
|
+
this.config.generated = {
|
|
355
|
+
as,
|
|
356
|
+
type: "always",
|
|
357
|
+
mode: "stored"
|
|
358
|
+
};
|
|
359
|
+
return this;
|
|
360
|
+
}
|
|
361
|
+
/** @internal */
|
|
362
|
+
buildForeignKeys(column, table) {
|
|
363
|
+
return this.foreignKeyConfigs.map(({ ref, config }) => {
|
|
364
|
+
return iife((ref2, config2) => {
|
|
365
|
+
const builder = new ForeignKeyBuilder(() => {
|
|
366
|
+
const foreignColumn = ref2();
|
|
367
|
+
return {
|
|
368
|
+
name: config2.name,
|
|
369
|
+
columns: [column],
|
|
370
|
+
foreignColumns: [foreignColumn]
|
|
371
|
+
};
|
|
372
|
+
});
|
|
373
|
+
if (config2.onUpdate) builder.onUpdate(config2.onUpdate);
|
|
374
|
+
if (config2.onDelete) builder.onDelete(config2.onDelete);
|
|
375
|
+
return builder.build(table);
|
|
376
|
+
}, ref, config);
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
/** @internal */
|
|
380
|
+
buildExtraConfigColumn(table) {
|
|
381
|
+
return new ExtraConfigColumn(table, this.config);
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
var PgColumn = class extends Column {
|
|
385
|
+
static [entityKind] = "PgColumn";
|
|
386
|
+
/** @internal */
|
|
387
|
+
table;
|
|
388
|
+
constructor(table, config) {
|
|
389
|
+
super(table, config);
|
|
390
|
+
this.table = table;
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
var ExtraConfigColumn = class extends PgColumn {
|
|
394
|
+
static [entityKind] = "ExtraConfigColumn";
|
|
395
|
+
getSQLType() {
|
|
396
|
+
return this.getSQLType();
|
|
397
|
+
}
|
|
398
|
+
indexConfig = {
|
|
399
|
+
order: this.config.order ?? "asc",
|
|
400
|
+
nulls: this.config.nulls ?? "last",
|
|
401
|
+
opClass: this.config.opClass
|
|
402
|
+
};
|
|
403
|
+
defaultConfig = {
|
|
404
|
+
order: "asc",
|
|
405
|
+
nulls: "last",
|
|
406
|
+
opClass: void 0
|
|
407
|
+
};
|
|
408
|
+
asc() {
|
|
409
|
+
this.indexConfig.order = "asc";
|
|
410
|
+
return this;
|
|
411
|
+
}
|
|
412
|
+
desc() {
|
|
413
|
+
this.indexConfig.order = "desc";
|
|
414
|
+
return this;
|
|
415
|
+
}
|
|
416
|
+
nullsFirst() {
|
|
417
|
+
this.indexConfig.nulls = "first";
|
|
418
|
+
return this;
|
|
419
|
+
}
|
|
420
|
+
nullsLast() {
|
|
421
|
+
this.indexConfig.nulls = "last";
|
|
422
|
+
return this;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* ### PostgreSQL documentation quote
|
|
426
|
+
*
|
|
427
|
+
* > An operator class with optional parameters can be specified for each column of an index.
|
|
428
|
+
* The operator class identifies the operators to be used by the index for that column.
|
|
429
|
+
* For example, a B-tree index on four-byte integers would use the int4_ops class;
|
|
430
|
+
* this operator class includes comparison functions for four-byte integers.
|
|
431
|
+
* In practice the default operator class for the column's data type is usually sufficient.
|
|
432
|
+
* The main point of having operator classes is that for some data types, there could be more than one meaningful ordering.
|
|
433
|
+
* For example, we might want to sort a complex-number data type either by absolute value or by real part.
|
|
434
|
+
* We could do this by defining two operator classes for the data type and then selecting the proper class when creating an index.
|
|
435
|
+
* More information about operator classes check:
|
|
436
|
+
*
|
|
437
|
+
* ### Useful links
|
|
438
|
+
* https://www.postgresql.org/docs/current/sql-createindex.html
|
|
439
|
+
*
|
|
440
|
+
* https://www.postgresql.org/docs/current/indexes-opclass.html
|
|
441
|
+
*
|
|
442
|
+
* https://www.postgresql.org/docs/current/xindex.html
|
|
443
|
+
*
|
|
444
|
+
* ### Additional types
|
|
445
|
+
* If you have the `pg_vector` extension installed in your database, you can use the
|
|
446
|
+
* `vector_l2_ops`, `vector_ip_ops`, `vector_cosine_ops`, `vector_l1_ops`, `bit_hamming_ops`, `bit_jaccard_ops`, `halfvec_l2_ops`, `sparsevec_l2_ops` options, which are predefined types.
|
|
447
|
+
*
|
|
448
|
+
* **You can always specify any string you want in the operator class, in case Drizzle doesn't have it natively in its types**
|
|
449
|
+
*
|
|
450
|
+
* @param opClass
|
|
451
|
+
* @returns
|
|
452
|
+
*/
|
|
453
|
+
op(opClass) {
|
|
454
|
+
this.indexConfig.opClass = opClass;
|
|
455
|
+
return this;
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
var IndexedColumn = class {
|
|
459
|
+
static [entityKind] = "IndexedColumn";
|
|
460
|
+
constructor(name, keyAsName, type, indexConfig) {
|
|
461
|
+
this.name = name;
|
|
462
|
+
this.keyAsName = keyAsName;
|
|
463
|
+
this.type = type;
|
|
464
|
+
this.indexConfig = indexConfig;
|
|
465
|
+
}
|
|
466
|
+
name;
|
|
467
|
+
keyAsName;
|
|
468
|
+
type;
|
|
469
|
+
indexConfig;
|
|
470
|
+
};
|
|
471
|
+
var PgArrayBuilder = class extends PgColumnBuilder {
|
|
472
|
+
static [entityKind] = "PgArrayBuilder";
|
|
473
|
+
constructor(name, baseBuilder, length) {
|
|
474
|
+
super(name, "array basecolumn", "PgArray");
|
|
475
|
+
this.config.baseBuilder = baseBuilder;
|
|
476
|
+
this.config.length = length;
|
|
477
|
+
}
|
|
478
|
+
/** @internal */
|
|
479
|
+
build(table) {
|
|
480
|
+
const baseColumn = this.config.baseBuilder.build(table);
|
|
481
|
+
return new PgArray(table, this.config, baseColumn);
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
var PgArray = class PgArray extends PgColumn {
|
|
485
|
+
constructor(table, config, baseColumn, range) {
|
|
486
|
+
super(table, config);
|
|
487
|
+
this.baseColumn = baseColumn;
|
|
488
|
+
this.range = range;
|
|
489
|
+
}
|
|
490
|
+
static [entityKind] = "PgArray";
|
|
491
|
+
getSQLType() {
|
|
492
|
+
return `${this.baseColumn.getSQLType()}[${typeof this.length === "number" ? this.length : ""}]`;
|
|
493
|
+
}
|
|
494
|
+
mapFromDriverValue(value) {
|
|
495
|
+
if (typeof value === "string") value = parsePgArray(value);
|
|
496
|
+
return value.map((v) => this.baseColumn.mapFromDriverValue(v));
|
|
497
|
+
}
|
|
498
|
+
mapFromJsonValue(value) {
|
|
499
|
+
if (typeof value === "string") value = parsePgArray(value);
|
|
500
|
+
const base = this.baseColumn;
|
|
501
|
+
return "mapFromJsonValue" in base ? value.map((v) => base.mapFromJsonValue(v)) : value.map((v) => base.mapFromDriverValue(v));
|
|
502
|
+
}
|
|
503
|
+
mapToDriverValue(value, isNestedArray = false) {
|
|
504
|
+
const a = value.map((v) => v === null ? null : is(this.baseColumn, PgArray) ? this.baseColumn.mapToDriverValue(v, true) : this.baseColumn.mapToDriverValue(v));
|
|
505
|
+
if (isNestedArray) return a;
|
|
506
|
+
return makePgArray(a);
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
//#endregion
|
|
511
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/enum.js
|
|
512
|
+
var PgEnumObjectColumnBuilder = class extends PgColumnBuilder {
|
|
513
|
+
static [entityKind] = "PgEnumObjectColumnBuilder";
|
|
514
|
+
constructor(name, enumInstance) {
|
|
515
|
+
super(name, "string enum", "PgEnumObjectColumn");
|
|
516
|
+
this.config.enum = enumInstance;
|
|
517
|
+
}
|
|
518
|
+
/** @internal */
|
|
519
|
+
build(table) {
|
|
520
|
+
return new PgEnumObjectColumn(table, this.config);
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
var PgEnumObjectColumn = class extends PgColumn {
|
|
524
|
+
static [entityKind] = "PgEnumObjectColumn";
|
|
525
|
+
enum;
|
|
526
|
+
enumValues = this.config.enum.enumValues;
|
|
527
|
+
constructor(table, config) {
|
|
528
|
+
super(table, config);
|
|
529
|
+
this.enum = config.enum;
|
|
530
|
+
}
|
|
531
|
+
getSQLType() {
|
|
532
|
+
return this.enum.enumName;
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
const isPgEnumSym = Symbol.for("drizzle:isPgEnum");
|
|
536
|
+
function isPgEnum(obj) {
|
|
537
|
+
return !!obj && typeof obj === "function" && isPgEnumSym in obj && obj[isPgEnumSym] === true;
|
|
538
|
+
}
|
|
539
|
+
var PgEnumColumnBuilder = class extends PgColumnBuilder {
|
|
540
|
+
static [entityKind] = "PgEnumColumnBuilder";
|
|
541
|
+
constructor(name, enumInstance) {
|
|
542
|
+
super(name, "string enum", "PgEnumColumn");
|
|
543
|
+
this.config.enum = enumInstance;
|
|
544
|
+
}
|
|
545
|
+
/** @internal */
|
|
546
|
+
build(table) {
|
|
547
|
+
return new PgEnumColumn(table, this.config);
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
var PgEnumColumn = class extends PgColumn {
|
|
551
|
+
static [entityKind] = "PgEnumColumn";
|
|
552
|
+
enum = this.config.enum;
|
|
553
|
+
enumValues = this.config.enum.enumValues;
|
|
554
|
+
constructor(table, config) {
|
|
555
|
+
super(table, config);
|
|
556
|
+
this.enum = config.enum;
|
|
557
|
+
}
|
|
558
|
+
getSQLType() {
|
|
559
|
+
return this.enum.enumName;
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
//#endregion
|
|
564
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/subquery.js
|
|
565
|
+
var Subquery = class {
|
|
566
|
+
static [entityKind] = "Subquery";
|
|
567
|
+
constructor(sql$1, fields, alias, isWith = false, usedTables = []) {
|
|
568
|
+
this._ = {
|
|
569
|
+
brand: "Subquery",
|
|
570
|
+
sql: sql$1,
|
|
571
|
+
selectedFields: fields,
|
|
572
|
+
alias,
|
|
573
|
+
isWith,
|
|
574
|
+
usedTables
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
var WithSubquery = class extends Subquery {
|
|
579
|
+
static [entityKind] = "WithSubquery";
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
//#endregion
|
|
583
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/tracing.js
|
|
584
|
+
const tracer = { startActiveSpan(name, fn) {
|
|
585
|
+
return fn();
|
|
586
|
+
} };
|
|
587
|
+
|
|
588
|
+
//#endregion
|
|
589
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/view-common.js
|
|
590
|
+
const ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
|
|
591
|
+
|
|
592
|
+
//#endregion
|
|
593
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/table.js
|
|
594
|
+
const TableSchema = Symbol.for("drizzle:Schema");
|
|
595
|
+
const TableColumns = Symbol.for("drizzle:Columns");
|
|
596
|
+
const ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
|
597
|
+
const OriginalName = Symbol.for("drizzle:OriginalName");
|
|
598
|
+
const BaseName = Symbol.for("drizzle:BaseName");
|
|
599
|
+
const IsAlias = Symbol.for("drizzle:IsAlias");
|
|
600
|
+
const ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
|
|
601
|
+
const IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
|
|
602
|
+
var Table = class {
|
|
603
|
+
static [entityKind] = "Table";
|
|
604
|
+
/** @internal */
|
|
605
|
+
static Symbol = {
|
|
606
|
+
Name: TableName,
|
|
607
|
+
Schema: TableSchema,
|
|
608
|
+
OriginalName,
|
|
609
|
+
Columns: TableColumns,
|
|
610
|
+
ExtraConfigColumns,
|
|
611
|
+
BaseName,
|
|
612
|
+
IsAlias,
|
|
613
|
+
ExtraConfigBuilder
|
|
614
|
+
};
|
|
615
|
+
/**
|
|
616
|
+
* @internal
|
|
617
|
+
* Can be changed if the table is aliased.
|
|
618
|
+
*/
|
|
619
|
+
[TableName];
|
|
620
|
+
/**
|
|
621
|
+
* @internal
|
|
622
|
+
* Used to store the original name of the table, before any aliasing.
|
|
623
|
+
*/
|
|
624
|
+
[OriginalName];
|
|
625
|
+
/** @internal */
|
|
626
|
+
[TableSchema];
|
|
627
|
+
/** @internal */
|
|
628
|
+
[TableColumns];
|
|
629
|
+
/** @internal */
|
|
630
|
+
[ExtraConfigColumns];
|
|
631
|
+
/**
|
|
632
|
+
* @internal
|
|
633
|
+
* Used to store the table name before the transformation via the `tableCreator` functions.
|
|
634
|
+
*/
|
|
635
|
+
[BaseName];
|
|
636
|
+
/** @internal */
|
|
637
|
+
[IsAlias] = false;
|
|
638
|
+
/** @internal */
|
|
639
|
+
[IsDrizzleTable] = true;
|
|
640
|
+
/** @internal */
|
|
641
|
+
[ExtraConfigBuilder] = void 0;
|
|
642
|
+
constructor(name, schema, baseName) {
|
|
643
|
+
this[TableName] = this[OriginalName] = name;
|
|
644
|
+
this[TableSchema] = schema;
|
|
645
|
+
this[BaseName] = baseName;
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
//#endregion
|
|
650
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/sql/sql.js
|
|
651
|
+
var FakePrimitiveParam = class {
|
|
652
|
+
static [entityKind] = "FakePrimitiveParam";
|
|
653
|
+
};
|
|
654
|
+
function isSQLWrapper(value) {
|
|
655
|
+
return value !== null && value !== void 0 && typeof value.getSQL === "function";
|
|
656
|
+
}
|
|
657
|
+
function mergeQueries(queries) {
|
|
658
|
+
const result = {
|
|
659
|
+
sql: "",
|
|
660
|
+
params: []
|
|
661
|
+
};
|
|
662
|
+
for (const query of queries) {
|
|
663
|
+
result.sql += query.sql;
|
|
664
|
+
result.params.push(...query.params);
|
|
665
|
+
if (query.typings?.length) {
|
|
666
|
+
if (!result.typings) result.typings = [];
|
|
667
|
+
result.typings.push(...query.typings);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
return result;
|
|
671
|
+
}
|
|
672
|
+
var StringChunk = class {
|
|
673
|
+
static [entityKind] = "StringChunk";
|
|
674
|
+
value;
|
|
675
|
+
constructor(value) {
|
|
676
|
+
this.value = Array.isArray(value) ? value : [value];
|
|
677
|
+
}
|
|
678
|
+
getSQL() {
|
|
679
|
+
return new SQL([this]);
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
var SQL = class SQL {
|
|
683
|
+
constructor(queryChunks) {
|
|
684
|
+
this.queryChunks = queryChunks;
|
|
685
|
+
for (const chunk of queryChunks) if (is(chunk, Table)) {
|
|
686
|
+
const schemaName = chunk[Table.Symbol.Schema];
|
|
687
|
+
this.usedTables.push(schemaName === void 0 ? chunk[Table.Symbol.Name] : schemaName + "." + chunk[Table.Symbol.Name]);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
static [entityKind] = "SQL";
|
|
691
|
+
/** @internal */
|
|
692
|
+
decoder = noopDecoder;
|
|
693
|
+
shouldInlineParams = false;
|
|
694
|
+
/** @internal */
|
|
695
|
+
usedTables = [];
|
|
696
|
+
append(query) {
|
|
697
|
+
this.queryChunks.push(...query.queryChunks);
|
|
698
|
+
return this;
|
|
699
|
+
}
|
|
700
|
+
toQuery(config) {
|
|
701
|
+
return tracer.startActiveSpan("drizzle.buildSQL", (span) => {
|
|
702
|
+
const query = this.buildQueryFromSourceParams(this.queryChunks, config);
|
|
703
|
+
span?.setAttributes({
|
|
704
|
+
"drizzle.query.text": query.sql,
|
|
705
|
+
"drizzle.query.params": JSON.stringify(query.params)
|
|
706
|
+
});
|
|
707
|
+
return query;
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
buildQueryFromSourceParams(chunks, _config) {
|
|
711
|
+
const config = Object.assign({}, _config, {
|
|
712
|
+
inlineParams: _config.inlineParams || this.shouldInlineParams,
|
|
713
|
+
paramStartIndex: _config.paramStartIndex || { value: 0 }
|
|
714
|
+
});
|
|
715
|
+
const { casing, escapeName, escapeParam, prepareTyping, inlineParams, paramStartIndex, invokeSource } = config;
|
|
716
|
+
return mergeQueries(chunks.map((chunk) => {
|
|
717
|
+
if (is(chunk, StringChunk)) return {
|
|
718
|
+
sql: chunk.value.join(""),
|
|
719
|
+
params: []
|
|
720
|
+
};
|
|
721
|
+
if (is(chunk, Name)) return {
|
|
722
|
+
sql: escapeName(chunk.value),
|
|
723
|
+
params: []
|
|
724
|
+
};
|
|
725
|
+
if (chunk === void 0) return {
|
|
726
|
+
sql: "",
|
|
727
|
+
params: []
|
|
728
|
+
};
|
|
729
|
+
if (Array.isArray(chunk)) {
|
|
730
|
+
const result = [new StringChunk("(")];
|
|
731
|
+
for (const [i, p] of chunk.entries()) {
|
|
732
|
+
result.push(p);
|
|
733
|
+
if (i < chunk.length - 1) result.push(new StringChunk(", "));
|
|
734
|
+
}
|
|
735
|
+
result.push(new StringChunk(")"));
|
|
736
|
+
return this.buildQueryFromSourceParams(result, config);
|
|
737
|
+
}
|
|
738
|
+
if (is(chunk, SQL)) return this.buildQueryFromSourceParams(chunk.queryChunks, {
|
|
739
|
+
...config,
|
|
740
|
+
inlineParams: inlineParams || chunk.shouldInlineParams
|
|
741
|
+
});
|
|
742
|
+
if (is(chunk, Table)) {
|
|
743
|
+
const schemaName = chunk[Table.Symbol.Schema];
|
|
744
|
+
const tableName = chunk[Table.Symbol.Name];
|
|
745
|
+
if (invokeSource === "mssql-view-with-schemabinding") return {
|
|
746
|
+
sql: (schemaName === void 0 ? escapeName("dbo") : escapeName(schemaName)) + "." + escapeName(tableName),
|
|
747
|
+
params: []
|
|
748
|
+
};
|
|
749
|
+
return {
|
|
750
|
+
sql: schemaName === void 0 || chunk[IsAlias] ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
|
|
751
|
+
params: []
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
if (is(chunk, Column)) {
|
|
755
|
+
const columnName = casing.getColumnCasing(chunk);
|
|
756
|
+
if (_config.invokeSource === "indexes") return {
|
|
757
|
+
sql: escapeName(columnName),
|
|
758
|
+
params: []
|
|
759
|
+
};
|
|
760
|
+
const schemaName = invokeSource === "mssql-check" ? void 0 : chunk.table[Table.Symbol.Schema];
|
|
761
|
+
return {
|
|
762
|
+
sql: chunk.isAlias ? escapeName(chunk.name) : chunk.table[IsAlias] || schemaName === void 0 ? escapeName(chunk.table[Table.Symbol.Name]) + "." + escapeName(columnName) : escapeName(schemaName) + "." + escapeName(chunk.table[Table.Symbol.Name]) + "." + escapeName(columnName),
|
|
763
|
+
params: []
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
if (is(chunk, View)) {
|
|
767
|
+
const schemaName = chunk[ViewBaseConfig].schema;
|
|
768
|
+
const viewName = chunk[ViewBaseConfig].name;
|
|
769
|
+
return {
|
|
770
|
+
sql: schemaName === void 0 || chunk[ViewBaseConfig].isAlias ? escapeName(viewName) : escapeName(schemaName) + "." + escapeName(viewName),
|
|
771
|
+
params: []
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
if (is(chunk, Param)) {
|
|
775
|
+
if (is(chunk.value, Placeholder)) return {
|
|
776
|
+
sql: escapeParam(paramStartIndex.value++, chunk),
|
|
777
|
+
params: [chunk],
|
|
778
|
+
typings: ["none"]
|
|
779
|
+
};
|
|
780
|
+
const mappedValue = chunk.value === null ? null : chunk.encoder.mapToDriverValue(chunk.value);
|
|
781
|
+
if (is(mappedValue, SQL)) return this.buildQueryFromSourceParams([mappedValue], config);
|
|
782
|
+
if (inlineParams) return {
|
|
783
|
+
sql: this.mapInlineParam(mappedValue, config),
|
|
784
|
+
params: []
|
|
785
|
+
};
|
|
786
|
+
let typings = ["none"];
|
|
787
|
+
if (prepareTyping) typings = [prepareTyping(chunk.encoder)];
|
|
788
|
+
return {
|
|
789
|
+
sql: escapeParam(paramStartIndex.value++, mappedValue),
|
|
790
|
+
params: [mappedValue],
|
|
791
|
+
typings
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
if (is(chunk, Placeholder)) return {
|
|
795
|
+
sql: escapeParam(paramStartIndex.value++, chunk),
|
|
796
|
+
params: [chunk],
|
|
797
|
+
typings: ["none"]
|
|
798
|
+
};
|
|
799
|
+
if (is(chunk, SQL.Aliased) && chunk.fieldAlias !== void 0) return {
|
|
800
|
+
sql: escapeName(chunk.fieldAlias),
|
|
801
|
+
params: []
|
|
802
|
+
};
|
|
803
|
+
if (is(chunk, Subquery)) {
|
|
804
|
+
if (chunk._.isWith) return {
|
|
805
|
+
sql: escapeName(chunk._.alias),
|
|
806
|
+
params: []
|
|
807
|
+
};
|
|
808
|
+
return this.buildQueryFromSourceParams([
|
|
809
|
+
new StringChunk("("),
|
|
810
|
+
chunk._.sql,
|
|
811
|
+
new StringChunk(") "),
|
|
812
|
+
new Name(chunk._.alias)
|
|
813
|
+
], config);
|
|
814
|
+
}
|
|
815
|
+
if (isPgEnum(chunk)) {
|
|
816
|
+
if (chunk.schema) return {
|
|
817
|
+
sql: escapeName(chunk.schema) + "." + escapeName(chunk.enumName),
|
|
818
|
+
params: []
|
|
819
|
+
};
|
|
820
|
+
return {
|
|
821
|
+
sql: escapeName(chunk.enumName),
|
|
822
|
+
params: []
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
if (isSQLWrapper(chunk)) {
|
|
826
|
+
if (chunk.shouldOmitSQLParens?.()) return this.buildQueryFromSourceParams([chunk.getSQL()], config);
|
|
827
|
+
return this.buildQueryFromSourceParams([
|
|
828
|
+
new StringChunk("("),
|
|
829
|
+
chunk.getSQL(),
|
|
830
|
+
new StringChunk(")")
|
|
831
|
+
], config);
|
|
832
|
+
}
|
|
833
|
+
if (inlineParams) return {
|
|
834
|
+
sql: this.mapInlineParam(chunk, config),
|
|
835
|
+
params: []
|
|
836
|
+
};
|
|
837
|
+
return {
|
|
838
|
+
sql: escapeParam(paramStartIndex.value++, chunk),
|
|
839
|
+
params: [chunk],
|
|
840
|
+
typings: ["none"]
|
|
841
|
+
};
|
|
842
|
+
}));
|
|
843
|
+
}
|
|
844
|
+
mapInlineParam(chunk, { escapeString }) {
|
|
845
|
+
if (chunk === null) return "null";
|
|
846
|
+
if (typeof chunk === "number" || typeof chunk === "boolean" || typeof chunk === "bigint") return chunk.toString();
|
|
847
|
+
if (typeof chunk === "string") return escapeString(chunk);
|
|
848
|
+
if (typeof chunk === "object") {
|
|
849
|
+
const mappedValueAsString = chunk.toString();
|
|
850
|
+
if (mappedValueAsString === "[object Object]") return escapeString(JSON.stringify(chunk));
|
|
851
|
+
return escapeString(mappedValueAsString);
|
|
852
|
+
}
|
|
853
|
+
throw new Error("Unexpected param value: " + chunk);
|
|
854
|
+
}
|
|
855
|
+
getSQL() {
|
|
856
|
+
return this;
|
|
857
|
+
}
|
|
858
|
+
as(alias) {
|
|
859
|
+
if (alias === void 0) return this;
|
|
860
|
+
return new SQL.Aliased(this, alias);
|
|
861
|
+
}
|
|
862
|
+
mapWith(decoder) {
|
|
863
|
+
this.decoder = typeof decoder === "function" ? { mapFromDriverValue: decoder } : decoder;
|
|
864
|
+
return this;
|
|
865
|
+
}
|
|
866
|
+
inlineParams() {
|
|
867
|
+
this.shouldInlineParams = true;
|
|
868
|
+
return this;
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* This method is used to conditionally include a part of the query.
|
|
872
|
+
*
|
|
873
|
+
* @param condition - Condition to check
|
|
874
|
+
* @returns itself if the condition is `true`, otherwise `undefined`
|
|
875
|
+
*/
|
|
876
|
+
if(condition) {
|
|
877
|
+
return condition ? this : void 0;
|
|
878
|
+
}
|
|
879
|
+
};
|
|
880
|
+
var Name = class {
|
|
881
|
+
constructor(value) {
|
|
882
|
+
this.value = value;
|
|
883
|
+
}
|
|
884
|
+
static [entityKind] = "Name";
|
|
885
|
+
brand;
|
|
886
|
+
getSQL() {
|
|
887
|
+
return new SQL([this]);
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
function isDriverValueEncoder(value) {
|
|
891
|
+
return typeof value === "object" && value !== null && "mapToDriverValue" in value && typeof value.mapToDriverValue === "function";
|
|
892
|
+
}
|
|
893
|
+
const noopDecoder = { mapFromDriverValue: (value) => value };
|
|
894
|
+
const noopEncoder = { mapToDriverValue: (value) => value };
|
|
895
|
+
const noopMapper = {
|
|
896
|
+
...noopDecoder,
|
|
897
|
+
...noopEncoder
|
|
898
|
+
};
|
|
899
|
+
var Param = class {
|
|
900
|
+
/**
|
|
901
|
+
* @param value - Parameter value
|
|
902
|
+
* @param encoder - Encoder to convert the value to a driver parameter
|
|
903
|
+
*/
|
|
904
|
+
constructor(value, encoder = noopEncoder) {
|
|
905
|
+
this.value = value;
|
|
906
|
+
this.encoder = encoder;
|
|
907
|
+
}
|
|
908
|
+
static [entityKind] = "Param";
|
|
909
|
+
brand;
|
|
910
|
+
getSQL() {
|
|
911
|
+
return new SQL([this]);
|
|
912
|
+
}
|
|
913
|
+
};
|
|
914
|
+
function sql(strings, ...params) {
|
|
915
|
+
const queryChunks = [];
|
|
916
|
+
if (params.length > 0 || strings.length > 0 && strings[0] !== "") queryChunks.push(new StringChunk(strings[0]));
|
|
917
|
+
for (const [paramIndex, param2] of params.entries()) queryChunks.push(param2, new StringChunk(strings[paramIndex + 1]));
|
|
918
|
+
return new SQL(queryChunks);
|
|
919
|
+
}
|
|
920
|
+
((sql2) => {
|
|
921
|
+
function empty() {
|
|
922
|
+
return new SQL([]);
|
|
923
|
+
}
|
|
924
|
+
sql2.empty = empty;
|
|
925
|
+
function fromList(list) {
|
|
926
|
+
return new SQL(list);
|
|
927
|
+
}
|
|
928
|
+
sql2.fromList = fromList;
|
|
929
|
+
function raw(str) {
|
|
930
|
+
return new SQL([new StringChunk(str)]);
|
|
931
|
+
}
|
|
932
|
+
sql2.raw = raw;
|
|
933
|
+
function join(chunks, separator) {
|
|
934
|
+
const result = [];
|
|
935
|
+
for (const [i, chunk] of chunks.entries()) {
|
|
936
|
+
if (i > 0 && separator !== void 0) result.push(separator);
|
|
937
|
+
result.push(chunk);
|
|
938
|
+
}
|
|
939
|
+
return new SQL(result);
|
|
940
|
+
}
|
|
941
|
+
sql2.join = join;
|
|
942
|
+
function identifier(value) {
|
|
943
|
+
return new Name(value);
|
|
944
|
+
}
|
|
945
|
+
sql2.identifier = identifier;
|
|
946
|
+
function placeholder2(name2) {
|
|
947
|
+
return new Placeholder(name2);
|
|
948
|
+
}
|
|
949
|
+
sql2.placeholder = placeholder2;
|
|
950
|
+
function param2(value, encoder) {
|
|
951
|
+
return new Param(value, encoder);
|
|
952
|
+
}
|
|
953
|
+
sql2.param = param2;
|
|
954
|
+
})(sql || (sql = {}));
|
|
955
|
+
((SQL2) => {
|
|
956
|
+
class Aliased {
|
|
957
|
+
constructor(sql2, fieldAlias) {
|
|
958
|
+
this.sql = sql2;
|
|
959
|
+
this.fieldAlias = fieldAlias;
|
|
960
|
+
}
|
|
961
|
+
static [entityKind] = "SQL.Aliased";
|
|
962
|
+
/** @internal */
|
|
963
|
+
isSelectionField = false;
|
|
964
|
+
getSQL() {
|
|
965
|
+
return this.sql;
|
|
966
|
+
}
|
|
967
|
+
/** @internal */
|
|
968
|
+
clone() {
|
|
969
|
+
return new Aliased(this.sql, this.fieldAlias);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
SQL2.Aliased = Aliased;
|
|
973
|
+
})(SQL || (SQL = {}));
|
|
974
|
+
var Placeholder = class {
|
|
975
|
+
constructor(name2) {
|
|
976
|
+
this.name = name2;
|
|
977
|
+
}
|
|
978
|
+
static [entityKind] = "Placeholder";
|
|
979
|
+
getSQL() {
|
|
980
|
+
return new SQL([this]);
|
|
981
|
+
}
|
|
982
|
+
};
|
|
983
|
+
const IsDrizzleView = Symbol.for("drizzle:IsDrizzleView");
|
|
984
|
+
var View = class {
|
|
985
|
+
static [entityKind] = "View";
|
|
986
|
+
/** @internal */
|
|
987
|
+
[ViewBaseConfig];
|
|
988
|
+
/** @internal */
|
|
989
|
+
[IsDrizzleView] = true;
|
|
990
|
+
/** @internal */
|
|
991
|
+
get [TableName]() {
|
|
992
|
+
return this[ViewBaseConfig].name;
|
|
993
|
+
}
|
|
994
|
+
/** @internal */
|
|
995
|
+
get [TableSchema]() {
|
|
996
|
+
return this[ViewBaseConfig].schema;
|
|
997
|
+
}
|
|
998
|
+
/** @internal */
|
|
999
|
+
get [IsAlias]() {
|
|
1000
|
+
return this[ViewBaseConfig].isAlias;
|
|
1001
|
+
}
|
|
1002
|
+
/** @internal */
|
|
1003
|
+
get [OriginalName]() {
|
|
1004
|
+
return this[ViewBaseConfig].originalName;
|
|
1005
|
+
}
|
|
1006
|
+
/** @internal */
|
|
1007
|
+
get [TableColumns]() {
|
|
1008
|
+
return this[ViewBaseConfig].selectedFields;
|
|
1009
|
+
}
|
|
1010
|
+
constructor({ name: name2, schema, selectedFields, query }) {
|
|
1011
|
+
this[ViewBaseConfig] = {
|
|
1012
|
+
name: name2,
|
|
1013
|
+
originalName: name2,
|
|
1014
|
+
schema,
|
|
1015
|
+
selectedFields,
|
|
1016
|
+
query,
|
|
1017
|
+
isExisting: !query,
|
|
1018
|
+
isAlias: false
|
|
1019
|
+
};
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
Column.prototype.getSQL = function() {
|
|
1023
|
+
return new SQL([this]);
|
|
1024
|
+
};
|
|
1025
|
+
Subquery.prototype.getSQL = function() {
|
|
1026
|
+
return new SQL([this]);
|
|
1027
|
+
};
|
|
1028
|
+
|
|
1029
|
+
//#endregion
|
|
1030
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/utils.js
|
|
1031
|
+
function getColumnNameAndConfig(a, b) {
|
|
1032
|
+
return {
|
|
1033
|
+
name: typeof a === "string" && a.length > 0 ? a : "",
|
|
1034
|
+
config: typeof a === "object" ? a : b
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
const textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder();
|
|
1038
|
+
|
|
1039
|
+
//#endregion
|
|
1040
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/int.common.js
|
|
1041
|
+
var PgIntColumnBaseBuilder = class extends PgColumnBuilder {
|
|
1042
|
+
static [entityKind] = "PgIntColumnBaseBuilder";
|
|
1043
|
+
generatedAlwaysAsIdentity(sequence) {
|
|
1044
|
+
if (sequence) {
|
|
1045
|
+
const { name, ...options } = sequence;
|
|
1046
|
+
this.config.generatedIdentity = {
|
|
1047
|
+
type: "always",
|
|
1048
|
+
sequenceName: name,
|
|
1049
|
+
sequenceOptions: options
|
|
1050
|
+
};
|
|
1051
|
+
} else this.config.generatedIdentity = { type: "always" };
|
|
1052
|
+
this.config.hasDefault = true;
|
|
1053
|
+
this.config.notNull = true;
|
|
1054
|
+
return this;
|
|
1055
|
+
}
|
|
1056
|
+
generatedByDefaultAsIdentity(sequence) {
|
|
1057
|
+
if (sequence) {
|
|
1058
|
+
const { name, ...options } = sequence;
|
|
1059
|
+
this.config.generatedIdentity = {
|
|
1060
|
+
type: "byDefault",
|
|
1061
|
+
sequenceName: name,
|
|
1062
|
+
sequenceOptions: options
|
|
1063
|
+
};
|
|
1064
|
+
} else this.config.generatedIdentity = { type: "byDefault" };
|
|
1065
|
+
this.config.hasDefault = true;
|
|
1066
|
+
this.config.notNull = true;
|
|
1067
|
+
return this;
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1070
|
+
|
|
1071
|
+
//#endregion
|
|
1072
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/bigint.js
|
|
1073
|
+
var PgBigInt53Builder = class extends PgIntColumnBaseBuilder {
|
|
1074
|
+
static [entityKind] = "PgBigInt53Builder";
|
|
1075
|
+
constructor(name) {
|
|
1076
|
+
super(name, "number int53", "PgBigInt53");
|
|
1077
|
+
}
|
|
1078
|
+
/** @internal */
|
|
1079
|
+
build(table) {
|
|
1080
|
+
return new PgBigInt53(table, this.config);
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
var PgBigInt53 = class extends PgColumn {
|
|
1084
|
+
static [entityKind] = "PgBigInt53";
|
|
1085
|
+
getSQLType() {
|
|
1086
|
+
return "bigint";
|
|
1087
|
+
}
|
|
1088
|
+
mapFromDriverValue(value) {
|
|
1089
|
+
if (typeof value === "number") return value;
|
|
1090
|
+
return Number(value);
|
|
1091
|
+
}
|
|
1092
|
+
};
|
|
1093
|
+
var PgBigInt64Builder = class extends PgIntColumnBaseBuilder {
|
|
1094
|
+
static [entityKind] = "PgBigInt64Builder";
|
|
1095
|
+
constructor(name) {
|
|
1096
|
+
super(name, "bigint int64", "PgBigInt64");
|
|
1097
|
+
}
|
|
1098
|
+
/** @internal */
|
|
1099
|
+
build(table) {
|
|
1100
|
+
return new PgBigInt64(table, this.config);
|
|
1101
|
+
}
|
|
1102
|
+
};
|
|
1103
|
+
var PgBigInt64 = class extends PgColumn {
|
|
1104
|
+
static [entityKind] = "PgBigInt64";
|
|
1105
|
+
getSQLType() {
|
|
1106
|
+
return "bigint";
|
|
1107
|
+
}
|
|
1108
|
+
mapFromDriverValue(value) {
|
|
1109
|
+
return BigInt(value);
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
var PgBigIntStringBuilder = class extends PgIntColumnBaseBuilder {
|
|
1113
|
+
static [entityKind] = "PgBigIntStringBuilder";
|
|
1114
|
+
constructor(name) {
|
|
1115
|
+
super(name, "string int64", "PgBigIntString");
|
|
1116
|
+
}
|
|
1117
|
+
/** @internal */
|
|
1118
|
+
build(table) {
|
|
1119
|
+
return new PgBigIntString(table, this.config);
|
|
1120
|
+
}
|
|
1121
|
+
};
|
|
1122
|
+
var PgBigIntString = class extends PgColumn {
|
|
1123
|
+
static [entityKind] = "PgBigIntString";
|
|
1124
|
+
getSQLType() {
|
|
1125
|
+
return "bigint";
|
|
1126
|
+
}
|
|
1127
|
+
mapFromDriverValue(value) {
|
|
1128
|
+
if (typeof value === "string") return value;
|
|
1129
|
+
return String(value);
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
1132
|
+
function bigint(a, b) {
|
|
1133
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
1134
|
+
if (config.mode === "number") return new PgBigInt53Builder(name);
|
|
1135
|
+
if (config.mode === "string") return new PgBigIntStringBuilder(name);
|
|
1136
|
+
return new PgBigInt64Builder(name);
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
//#endregion
|
|
1140
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/bigserial.js
|
|
1141
|
+
var PgBigSerial53Builder = class extends PgColumnBuilder {
|
|
1142
|
+
static [entityKind] = "PgBigSerial53Builder";
|
|
1143
|
+
constructor(name) {
|
|
1144
|
+
super(name, "number int53", "PgBigSerial53");
|
|
1145
|
+
this.config.hasDefault = true;
|
|
1146
|
+
this.config.notNull = true;
|
|
1147
|
+
}
|
|
1148
|
+
/** @internal */
|
|
1149
|
+
build(table) {
|
|
1150
|
+
return new PgBigSerial53(table, this.config);
|
|
1151
|
+
}
|
|
1152
|
+
};
|
|
1153
|
+
var PgBigSerial53 = class extends PgColumn {
|
|
1154
|
+
static [entityKind] = "PgBigSerial53";
|
|
1155
|
+
getSQLType() {
|
|
1156
|
+
return "bigserial";
|
|
1157
|
+
}
|
|
1158
|
+
mapFromDriverValue(value) {
|
|
1159
|
+
if (typeof value === "number") return value;
|
|
1160
|
+
return Number(value);
|
|
1161
|
+
}
|
|
1162
|
+
};
|
|
1163
|
+
var PgBigSerial64Builder = class extends PgColumnBuilder {
|
|
1164
|
+
static [entityKind] = "PgBigSerial64Builder";
|
|
1165
|
+
constructor(name) {
|
|
1166
|
+
super(name, "bigint int64", "PgBigSerial64");
|
|
1167
|
+
this.config.hasDefault = true;
|
|
1168
|
+
this.config.notNull = true;
|
|
1169
|
+
}
|
|
1170
|
+
/** @internal */
|
|
1171
|
+
build(table) {
|
|
1172
|
+
return new PgBigSerial64(table, this.config);
|
|
1173
|
+
}
|
|
1174
|
+
};
|
|
1175
|
+
var PgBigSerial64 = class extends PgColumn {
|
|
1176
|
+
static [entityKind] = "PgBigSerial64";
|
|
1177
|
+
getSQLType() {
|
|
1178
|
+
return "bigserial";
|
|
1179
|
+
}
|
|
1180
|
+
mapFromDriverValue(value) {
|
|
1181
|
+
return BigInt(value);
|
|
1182
|
+
}
|
|
1183
|
+
};
|
|
1184
|
+
function bigserial(a, b) {
|
|
1185
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
1186
|
+
if (config.mode === "number") return new PgBigSerial53Builder(name);
|
|
1187
|
+
return new PgBigSerial64Builder(name);
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
//#endregion
|
|
1191
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/boolean.js
|
|
1192
|
+
var PgBooleanBuilder = class extends PgColumnBuilder {
|
|
1193
|
+
static [entityKind] = "PgBooleanBuilder";
|
|
1194
|
+
constructor(name) {
|
|
1195
|
+
super(name, "boolean", "PgBoolean");
|
|
1196
|
+
}
|
|
1197
|
+
/** @internal */
|
|
1198
|
+
build(table) {
|
|
1199
|
+
return new PgBoolean(table, this.config);
|
|
1200
|
+
}
|
|
1201
|
+
};
|
|
1202
|
+
var PgBoolean = class extends PgColumn {
|
|
1203
|
+
static [entityKind] = "PgBoolean";
|
|
1204
|
+
getSQLType() {
|
|
1205
|
+
return "boolean";
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
function boolean(name) {
|
|
1209
|
+
return new PgBooleanBuilder(name ?? "");
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
//#endregion
|
|
1213
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/char.js
|
|
1214
|
+
var PgCharBuilder = class extends PgColumnBuilder {
|
|
1215
|
+
static [entityKind] = "PgCharBuilder";
|
|
1216
|
+
constructor(name, config) {
|
|
1217
|
+
super(name, config.enum?.length ? "string enum" : "string", "PgChar");
|
|
1218
|
+
this.config.length = config.length ?? 1;
|
|
1219
|
+
this.config.setLength = config.length !== void 0;
|
|
1220
|
+
this.config.enumValues = config.enum;
|
|
1221
|
+
}
|
|
1222
|
+
/** @internal */
|
|
1223
|
+
build(table) {
|
|
1224
|
+
return new PgChar(table, this.config);
|
|
1225
|
+
}
|
|
1226
|
+
};
|
|
1227
|
+
var PgChar = class extends PgColumn {
|
|
1228
|
+
static [entityKind] = "PgChar";
|
|
1229
|
+
enumValues = this.config.enumValues;
|
|
1230
|
+
getSQLType() {
|
|
1231
|
+
return this.config.setLength ? `char(${this.length})` : `char`;
|
|
1232
|
+
}
|
|
1233
|
+
};
|
|
1234
|
+
function char(a, b = {}) {
|
|
1235
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
1236
|
+
return new PgCharBuilder(name, config);
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
//#endregion
|
|
1240
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/cidr.js
|
|
1241
|
+
var PgCidrBuilder = class extends PgColumnBuilder {
|
|
1242
|
+
static [entityKind] = "PgCidrBuilder";
|
|
1243
|
+
constructor(name) {
|
|
1244
|
+
super(name, "string cidr", "PgCidr");
|
|
1245
|
+
}
|
|
1246
|
+
/** @internal */
|
|
1247
|
+
build(table) {
|
|
1248
|
+
return new PgCidr(table, this.config);
|
|
1249
|
+
}
|
|
1250
|
+
};
|
|
1251
|
+
var PgCidr = class extends PgColumn {
|
|
1252
|
+
static [entityKind] = "PgCidr";
|
|
1253
|
+
getSQLType() {
|
|
1254
|
+
return "cidr";
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
function cidr(name) {
|
|
1258
|
+
return new PgCidrBuilder(name ?? "");
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
//#endregion
|
|
1262
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/custom.js
|
|
1263
|
+
var PgCustomColumnBuilder = class extends PgColumnBuilder {
|
|
1264
|
+
static [entityKind] = "PgCustomColumnBuilder";
|
|
1265
|
+
constructor(name, fieldConfig, customTypeParams) {
|
|
1266
|
+
super(name, "custom", "PgCustomColumn");
|
|
1267
|
+
this.config.fieldConfig = fieldConfig;
|
|
1268
|
+
this.config.customTypeParams = customTypeParams;
|
|
1269
|
+
}
|
|
1270
|
+
/** @internal */
|
|
1271
|
+
build(table) {
|
|
1272
|
+
return new PgCustomColumn(table, this.config);
|
|
1273
|
+
}
|
|
1274
|
+
};
|
|
1275
|
+
var PgCustomColumn = class extends PgColumn {
|
|
1276
|
+
static [entityKind] = "PgCustomColumn";
|
|
1277
|
+
sqlName;
|
|
1278
|
+
mapTo;
|
|
1279
|
+
mapFrom;
|
|
1280
|
+
mapJson;
|
|
1281
|
+
forJsonSelect;
|
|
1282
|
+
constructor(table, config) {
|
|
1283
|
+
super(table, config);
|
|
1284
|
+
this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
|
|
1285
|
+
this.mapTo = config.customTypeParams.toDriver;
|
|
1286
|
+
this.mapFrom = config.customTypeParams.fromDriver;
|
|
1287
|
+
this.mapJson = config.customTypeParams.fromJson;
|
|
1288
|
+
this.forJsonSelect = config.customTypeParams.forJsonSelect;
|
|
1289
|
+
}
|
|
1290
|
+
getSQLType() {
|
|
1291
|
+
return this.sqlName;
|
|
1292
|
+
}
|
|
1293
|
+
mapFromDriverValue(value) {
|
|
1294
|
+
return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
|
|
1295
|
+
}
|
|
1296
|
+
mapFromJsonValue(value) {
|
|
1297
|
+
return typeof this.mapJson === "function" ? this.mapJson(value) : this.mapFromDriverValue(value);
|
|
1298
|
+
}
|
|
1299
|
+
jsonSelectIdentifier(identifier, sql$1, arrayDimensions) {
|
|
1300
|
+
if (typeof this.forJsonSelect === "function") return this.forJsonSelect(identifier, sql$1, arrayDimensions);
|
|
1301
|
+
const rawType = this.getSQLType().toLowerCase();
|
|
1302
|
+
const parenPos = rawType.indexOf("(");
|
|
1303
|
+
switch (parenPos + 1 ? rawType.slice(0, parenPos) : rawType) {
|
|
1304
|
+
case "bytea":
|
|
1305
|
+
case "geometry":
|
|
1306
|
+
case "timestamp":
|
|
1307
|
+
case "numeric":
|
|
1308
|
+
case "bigint": {
|
|
1309
|
+
const arrVal = "[]".repeat(arrayDimensions ?? 0);
|
|
1310
|
+
return sql$1`${identifier}::text${sql$1.raw(arrVal).if(arrayDimensions)}`;
|
|
1311
|
+
}
|
|
1312
|
+
default: return identifier;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
mapToDriverValue(value) {
|
|
1316
|
+
return typeof this.mapTo === "function" ? this.mapTo(value) : value;
|
|
1317
|
+
}
|
|
1318
|
+
};
|
|
1319
|
+
function customType(customTypeParams) {
|
|
1320
|
+
return (a, b) => {
|
|
1321
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
1322
|
+
return new PgCustomColumnBuilder(name, config, customTypeParams);
|
|
1323
|
+
};
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
//#endregion
|
|
1327
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/date.common.js
|
|
1328
|
+
var PgDateColumnBaseBuilder = class extends PgColumnBuilder {
|
|
1329
|
+
static [entityKind] = "PgDateColumnBaseBuilder";
|
|
1330
|
+
defaultNow() {
|
|
1331
|
+
return this.default(sql`now()`);
|
|
1332
|
+
}
|
|
1333
|
+
};
|
|
1334
|
+
|
|
1335
|
+
//#endregion
|
|
1336
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/date.js
|
|
1337
|
+
var PgDateBuilder = class extends PgDateColumnBaseBuilder {
|
|
1338
|
+
static [entityKind] = "PgDateBuilder";
|
|
1339
|
+
constructor(name) {
|
|
1340
|
+
super(name, "object date", "PgDate");
|
|
1341
|
+
}
|
|
1342
|
+
/** @internal */
|
|
1343
|
+
build(table) {
|
|
1344
|
+
return new PgDate(table, this.config);
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
var PgDate = class extends PgColumn {
|
|
1348
|
+
static [entityKind] = "PgDate";
|
|
1349
|
+
getSQLType() {
|
|
1350
|
+
return "date";
|
|
1351
|
+
}
|
|
1352
|
+
mapFromDriverValue(value) {
|
|
1353
|
+
if (typeof value === "string") return new Date(value);
|
|
1354
|
+
return value;
|
|
1355
|
+
}
|
|
1356
|
+
mapToDriverValue(value) {
|
|
1357
|
+
if (typeof value === "string") return value;
|
|
1358
|
+
return value.toISOString();
|
|
1359
|
+
}
|
|
1360
|
+
};
|
|
1361
|
+
var PgDateStringBuilder = class extends PgDateColumnBaseBuilder {
|
|
1362
|
+
static [entityKind] = "PgDateStringBuilder";
|
|
1363
|
+
constructor(name) {
|
|
1364
|
+
super(name, "string date", "PgDateString");
|
|
1365
|
+
}
|
|
1366
|
+
/** @internal */
|
|
1367
|
+
build(table) {
|
|
1368
|
+
return new PgDateString(table, this.config);
|
|
1369
|
+
}
|
|
1370
|
+
};
|
|
1371
|
+
var PgDateString = class extends PgColumn {
|
|
1372
|
+
static [entityKind] = "PgDateString";
|
|
1373
|
+
getSQLType() {
|
|
1374
|
+
return "date";
|
|
1375
|
+
}
|
|
1376
|
+
mapFromDriverValue(value) {
|
|
1377
|
+
if (typeof value === "string") return value;
|
|
1378
|
+
return value.toISOString().slice(0, -14);
|
|
1379
|
+
}
|
|
1380
|
+
mapToDriverValue(value) {
|
|
1381
|
+
if (typeof value === "string") return value;
|
|
1382
|
+
return value.toISOString();
|
|
1383
|
+
}
|
|
1384
|
+
};
|
|
1385
|
+
function date(a, b) {
|
|
1386
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
1387
|
+
if (config?.mode === "date") return new PgDateBuilder(name);
|
|
1388
|
+
return new PgDateStringBuilder(name);
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
//#endregion
|
|
1392
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/double-precision.js
|
|
1393
|
+
var PgDoublePrecisionBuilder = class extends PgColumnBuilder {
|
|
1394
|
+
static [entityKind] = "PgDoublePrecisionBuilder";
|
|
1395
|
+
constructor(name) {
|
|
1396
|
+
super(name, "number double", "PgDoublePrecision");
|
|
1397
|
+
}
|
|
1398
|
+
/** @internal */
|
|
1399
|
+
build(table) {
|
|
1400
|
+
return new PgDoublePrecision(table, this.config);
|
|
1401
|
+
}
|
|
1402
|
+
};
|
|
1403
|
+
var PgDoublePrecision = class extends PgColumn {
|
|
1404
|
+
static [entityKind] = "PgDoublePrecision";
|
|
1405
|
+
getSQLType() {
|
|
1406
|
+
return "double precision";
|
|
1407
|
+
}
|
|
1408
|
+
mapFromDriverValue(value) {
|
|
1409
|
+
if (typeof value === "string") return Number.parseFloat(value);
|
|
1410
|
+
return value;
|
|
1411
|
+
}
|
|
1412
|
+
};
|
|
1413
|
+
function doublePrecision(name) {
|
|
1414
|
+
return new PgDoublePrecisionBuilder(name ?? "");
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
//#endregion
|
|
1418
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/inet.js
|
|
1419
|
+
var PgInetBuilder = class extends PgColumnBuilder {
|
|
1420
|
+
static [entityKind] = "PgInetBuilder";
|
|
1421
|
+
constructor(name) {
|
|
1422
|
+
super(name, "string inet", "PgInet");
|
|
1423
|
+
}
|
|
1424
|
+
/** @internal */
|
|
1425
|
+
build(table) {
|
|
1426
|
+
return new PgInet(table, this.config);
|
|
1427
|
+
}
|
|
1428
|
+
};
|
|
1429
|
+
var PgInet = class extends PgColumn {
|
|
1430
|
+
static [entityKind] = "PgInet";
|
|
1431
|
+
getSQLType() {
|
|
1432
|
+
return "inet";
|
|
1433
|
+
}
|
|
1434
|
+
};
|
|
1435
|
+
function inet(name) {
|
|
1436
|
+
return new PgInetBuilder(name ?? "");
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
//#endregion
|
|
1440
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/integer.js
|
|
1441
|
+
var PgIntegerBuilder = class extends PgIntColumnBaseBuilder {
|
|
1442
|
+
static [entityKind] = "PgIntegerBuilder";
|
|
1443
|
+
constructor(name) {
|
|
1444
|
+
super(name, "number int32", "PgInteger");
|
|
1445
|
+
}
|
|
1446
|
+
/** @internal */
|
|
1447
|
+
build(table) {
|
|
1448
|
+
return new PgInteger(table, this.config);
|
|
1449
|
+
}
|
|
1450
|
+
};
|
|
1451
|
+
var PgInteger = class extends PgColumn {
|
|
1452
|
+
static [entityKind] = "PgInteger";
|
|
1453
|
+
getSQLType() {
|
|
1454
|
+
return "integer";
|
|
1455
|
+
}
|
|
1456
|
+
mapFromDriverValue(value) {
|
|
1457
|
+
if (typeof value === "string") return Number.parseInt(value);
|
|
1458
|
+
return value;
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1461
|
+
function integer(name) {
|
|
1462
|
+
return new PgIntegerBuilder(name ?? "");
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
//#endregion
|
|
1466
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/interval.js
|
|
1467
|
+
var PgIntervalBuilder = class extends PgColumnBuilder {
|
|
1468
|
+
static [entityKind] = "PgIntervalBuilder";
|
|
1469
|
+
constructor(name, intervalConfig) {
|
|
1470
|
+
super(name, "string interval", "PgInterval");
|
|
1471
|
+
this.config.intervalConfig = intervalConfig;
|
|
1472
|
+
}
|
|
1473
|
+
/** @internal */
|
|
1474
|
+
build(table) {
|
|
1475
|
+
return new PgInterval(table, this.config);
|
|
1476
|
+
}
|
|
1477
|
+
};
|
|
1478
|
+
var PgInterval = class extends PgColumn {
|
|
1479
|
+
static [entityKind] = "PgInterval";
|
|
1480
|
+
fields = this.config.intervalConfig.fields;
|
|
1481
|
+
precision = this.config.intervalConfig.precision;
|
|
1482
|
+
getSQLType() {
|
|
1483
|
+
return `interval${this.fields ? ` ${this.fields}` : ""}${this.precision ? `(${this.precision})` : ""}`;
|
|
1484
|
+
}
|
|
1485
|
+
};
|
|
1486
|
+
function interval(a, b = {}) {
|
|
1487
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
1488
|
+
return new PgIntervalBuilder(name, config);
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
//#endregion
|
|
1492
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/json.js
|
|
1493
|
+
var PgJsonBuilder = class extends PgColumnBuilder {
|
|
1494
|
+
static [entityKind] = "PgJsonBuilder";
|
|
1495
|
+
constructor(name) {
|
|
1496
|
+
super(name, "object json", "PgJson");
|
|
1497
|
+
}
|
|
1498
|
+
/** @internal */
|
|
1499
|
+
build(table) {
|
|
1500
|
+
return new PgJson(table, this.config);
|
|
1501
|
+
}
|
|
1502
|
+
};
|
|
1503
|
+
var PgJson = class extends PgColumn {
|
|
1504
|
+
static [entityKind] = "PgJson";
|
|
1505
|
+
constructor(table, config) {
|
|
1506
|
+
super(table, config);
|
|
1507
|
+
}
|
|
1508
|
+
getSQLType() {
|
|
1509
|
+
return "json";
|
|
1510
|
+
}
|
|
1511
|
+
mapToDriverValue(value) {
|
|
1512
|
+
return JSON.stringify(value);
|
|
1513
|
+
}
|
|
1514
|
+
mapFromDriverValue(value) {
|
|
1515
|
+
if (typeof value === "string") try {
|
|
1516
|
+
return JSON.parse(value);
|
|
1517
|
+
} catch {
|
|
1518
|
+
return value;
|
|
1519
|
+
}
|
|
1520
|
+
return value;
|
|
1521
|
+
}
|
|
1522
|
+
};
|
|
1523
|
+
function json(name) {
|
|
1524
|
+
return new PgJsonBuilder(name ?? "");
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
//#endregion
|
|
1528
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/jsonb.js
|
|
1529
|
+
var PgJsonbBuilder = class extends PgColumnBuilder {
|
|
1530
|
+
static [entityKind] = "PgJsonbBuilder";
|
|
1531
|
+
constructor(name) {
|
|
1532
|
+
super(name, "object json", "PgJsonb");
|
|
1533
|
+
}
|
|
1534
|
+
/** @internal */
|
|
1535
|
+
build(table) {
|
|
1536
|
+
return new PgJsonb(table, this.config);
|
|
1537
|
+
}
|
|
1538
|
+
};
|
|
1539
|
+
var PgJsonb = class extends PgColumn {
|
|
1540
|
+
static [entityKind] = "PgJsonb";
|
|
1541
|
+
constructor(table, config) {
|
|
1542
|
+
super(table, config);
|
|
1543
|
+
}
|
|
1544
|
+
getSQLType() {
|
|
1545
|
+
return "jsonb";
|
|
1546
|
+
}
|
|
1547
|
+
mapToDriverValue(value) {
|
|
1548
|
+
return JSON.stringify(value);
|
|
1549
|
+
}
|
|
1550
|
+
mapFromDriverValue(value) {
|
|
1551
|
+
if (typeof value === "string") try {
|
|
1552
|
+
return JSON.parse(value);
|
|
1553
|
+
} catch {
|
|
1554
|
+
return value;
|
|
1555
|
+
}
|
|
1556
|
+
return value;
|
|
1557
|
+
}
|
|
1558
|
+
};
|
|
1559
|
+
function jsonb(name) {
|
|
1560
|
+
return new PgJsonbBuilder(name ?? "");
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
//#endregion
|
|
1564
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/line.js
|
|
1565
|
+
var PgLineBuilder = class extends PgColumnBuilder {
|
|
1566
|
+
static [entityKind] = "PgLineBuilder";
|
|
1567
|
+
constructor(name) {
|
|
1568
|
+
super(name, "array line", "PgLine");
|
|
1569
|
+
}
|
|
1570
|
+
/** @internal */
|
|
1571
|
+
build(table) {
|
|
1572
|
+
return new PgLineTuple(table, this.config);
|
|
1573
|
+
}
|
|
1574
|
+
};
|
|
1575
|
+
var PgLineTuple = class extends PgColumn {
|
|
1576
|
+
static [entityKind] = "PgLine";
|
|
1577
|
+
mode = "tuple";
|
|
1578
|
+
getSQLType() {
|
|
1579
|
+
return "line";
|
|
1580
|
+
}
|
|
1581
|
+
mapFromDriverValue(value) {
|
|
1582
|
+
const [a, b, c] = value.slice(1, -1).split(",");
|
|
1583
|
+
return [
|
|
1584
|
+
Number.parseFloat(a),
|
|
1585
|
+
Number.parseFloat(b),
|
|
1586
|
+
Number.parseFloat(c)
|
|
1587
|
+
];
|
|
1588
|
+
}
|
|
1589
|
+
mapToDriverValue(value) {
|
|
1590
|
+
return `{${value[0]},${value[1]},${value[2]}}`;
|
|
1591
|
+
}
|
|
1592
|
+
};
|
|
1593
|
+
var PgLineABCBuilder = class extends PgColumnBuilder {
|
|
1594
|
+
static [entityKind] = "PgLineABCBuilder";
|
|
1595
|
+
constructor(name) {
|
|
1596
|
+
super(name, "object line", "PgLineABC");
|
|
1597
|
+
}
|
|
1598
|
+
/** @internal */
|
|
1599
|
+
build(table) {
|
|
1600
|
+
return new PgLineABC(table, this.config);
|
|
1601
|
+
}
|
|
1602
|
+
};
|
|
1603
|
+
var PgLineABC = class extends PgColumn {
|
|
1604
|
+
static [entityKind] = "PgLineABC";
|
|
1605
|
+
mode = "abc";
|
|
1606
|
+
getSQLType() {
|
|
1607
|
+
return "line";
|
|
1608
|
+
}
|
|
1609
|
+
mapFromDriverValue(value) {
|
|
1610
|
+
const [a, b, c] = value.slice(1, -1).split(",");
|
|
1611
|
+
return {
|
|
1612
|
+
a: Number.parseFloat(a),
|
|
1613
|
+
b: Number.parseFloat(b),
|
|
1614
|
+
c: Number.parseFloat(c)
|
|
1615
|
+
};
|
|
1616
|
+
}
|
|
1617
|
+
mapToDriverValue(value) {
|
|
1618
|
+
return `{${value.a},${value.b},${value.c}}`;
|
|
1619
|
+
}
|
|
1620
|
+
};
|
|
1621
|
+
function line(a, b) {
|
|
1622
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
1623
|
+
if (!config?.mode || config.mode === "tuple") return new PgLineBuilder(name);
|
|
1624
|
+
return new PgLineABCBuilder(name);
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
//#endregion
|
|
1628
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/macaddr.js
|
|
1629
|
+
var PgMacaddrBuilder = class extends PgColumnBuilder {
|
|
1630
|
+
static [entityKind] = "PgMacaddrBuilder";
|
|
1631
|
+
constructor(name) {
|
|
1632
|
+
super(name, "string macaddr", "PgMacaddr");
|
|
1633
|
+
}
|
|
1634
|
+
/** @internal */
|
|
1635
|
+
build(table) {
|
|
1636
|
+
return new PgMacaddr(table, this.config);
|
|
1637
|
+
}
|
|
1638
|
+
};
|
|
1639
|
+
var PgMacaddr = class extends PgColumn {
|
|
1640
|
+
static [entityKind] = "PgMacaddr";
|
|
1641
|
+
getSQLType() {
|
|
1642
|
+
return "macaddr";
|
|
1643
|
+
}
|
|
1644
|
+
};
|
|
1645
|
+
function macaddr(name) {
|
|
1646
|
+
return new PgMacaddrBuilder(name ?? "");
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
//#endregion
|
|
1650
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/macaddr8.js
|
|
1651
|
+
var PgMacaddr8Builder = class extends PgColumnBuilder {
|
|
1652
|
+
static [entityKind] = "PgMacaddr8Builder";
|
|
1653
|
+
constructor(name) {
|
|
1654
|
+
super(name, "string macaddr8", "PgMacaddr8");
|
|
1655
|
+
}
|
|
1656
|
+
/** @internal */
|
|
1657
|
+
build(table) {
|
|
1658
|
+
return new PgMacaddr8(table, this.config);
|
|
1659
|
+
}
|
|
1660
|
+
};
|
|
1661
|
+
var PgMacaddr8 = class extends PgColumn {
|
|
1662
|
+
static [entityKind] = "PgMacaddr8";
|
|
1663
|
+
getSQLType() {
|
|
1664
|
+
return "macaddr8";
|
|
1665
|
+
}
|
|
1666
|
+
};
|
|
1667
|
+
function macaddr8(name) {
|
|
1668
|
+
return new PgMacaddr8Builder(name ?? "");
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
//#endregion
|
|
1672
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/numeric.js
|
|
1673
|
+
var PgNumericBuilder = class extends PgColumnBuilder {
|
|
1674
|
+
static [entityKind] = "PgNumericBuilder";
|
|
1675
|
+
constructor(name, precision, scale) {
|
|
1676
|
+
super(name, "string numeric", "PgNumeric");
|
|
1677
|
+
this.config.precision = precision;
|
|
1678
|
+
this.config.scale = scale;
|
|
1679
|
+
}
|
|
1680
|
+
/** @internal */
|
|
1681
|
+
build(table) {
|
|
1682
|
+
return new PgNumeric(table, this.config);
|
|
1683
|
+
}
|
|
1684
|
+
};
|
|
1685
|
+
var PgNumeric = class extends PgColumn {
|
|
1686
|
+
static [entityKind] = "PgNumeric";
|
|
1687
|
+
precision;
|
|
1688
|
+
scale;
|
|
1689
|
+
constructor(table, config) {
|
|
1690
|
+
super(table, config);
|
|
1691
|
+
this.precision = config.precision;
|
|
1692
|
+
this.scale = config.scale;
|
|
1693
|
+
}
|
|
1694
|
+
mapFromDriverValue(value) {
|
|
1695
|
+
if (typeof value === "string") return value;
|
|
1696
|
+
return String(value);
|
|
1697
|
+
}
|
|
1698
|
+
getSQLType() {
|
|
1699
|
+
if (this.precision !== void 0 && this.scale !== void 0) return `numeric(${this.precision}, ${this.scale})`;
|
|
1700
|
+
else if (this.precision === void 0) return "numeric";
|
|
1701
|
+
else return `numeric(${this.precision})`;
|
|
1702
|
+
}
|
|
1703
|
+
};
|
|
1704
|
+
var PgNumericNumberBuilder = class extends PgColumnBuilder {
|
|
1705
|
+
static [entityKind] = "PgNumericNumberBuilder";
|
|
1706
|
+
constructor(name, precision, scale) {
|
|
1707
|
+
super(name, "number", "PgNumericNumber");
|
|
1708
|
+
this.config.precision = precision;
|
|
1709
|
+
this.config.scale = scale;
|
|
1710
|
+
}
|
|
1711
|
+
/** @internal */
|
|
1712
|
+
build(table) {
|
|
1713
|
+
return new PgNumericNumber(table, this.config);
|
|
1714
|
+
}
|
|
1715
|
+
};
|
|
1716
|
+
var PgNumericNumber = class extends PgColumn {
|
|
1717
|
+
static [entityKind] = "PgNumericNumber";
|
|
1718
|
+
precision;
|
|
1719
|
+
scale;
|
|
1720
|
+
constructor(table, config) {
|
|
1721
|
+
super(table, config);
|
|
1722
|
+
this.precision = config.precision;
|
|
1723
|
+
this.scale = config.scale;
|
|
1724
|
+
}
|
|
1725
|
+
mapFromDriverValue(value) {
|
|
1726
|
+
if (typeof value === "number") return value;
|
|
1727
|
+
return Number(value);
|
|
1728
|
+
}
|
|
1729
|
+
mapToDriverValue = String;
|
|
1730
|
+
getSQLType() {
|
|
1731
|
+
if (this.precision !== void 0 && this.scale !== void 0) return `numeric(${this.precision}, ${this.scale})`;
|
|
1732
|
+
else if (this.precision === void 0) return "numeric";
|
|
1733
|
+
else return `numeric(${this.precision})`;
|
|
1734
|
+
}
|
|
1735
|
+
};
|
|
1736
|
+
var PgNumericBigIntBuilder = class extends PgColumnBuilder {
|
|
1737
|
+
static [entityKind] = "PgNumericBigIntBuilder";
|
|
1738
|
+
constructor(name, precision, scale) {
|
|
1739
|
+
super(name, "bigint int64", "PgNumericBigInt");
|
|
1740
|
+
this.config.precision = precision;
|
|
1741
|
+
this.config.scale = scale;
|
|
1742
|
+
}
|
|
1743
|
+
/** @internal */
|
|
1744
|
+
build(table) {
|
|
1745
|
+
return new PgNumericBigInt(table, this.config);
|
|
1746
|
+
}
|
|
1747
|
+
};
|
|
1748
|
+
var PgNumericBigInt = class extends PgColumn {
|
|
1749
|
+
static [entityKind] = "PgNumericBigInt";
|
|
1750
|
+
precision;
|
|
1751
|
+
scale;
|
|
1752
|
+
constructor(table, config) {
|
|
1753
|
+
super(table, config);
|
|
1754
|
+
this.precision = config.precision;
|
|
1755
|
+
this.scale = config.scale;
|
|
1756
|
+
}
|
|
1757
|
+
mapFromDriverValue = BigInt;
|
|
1758
|
+
mapToDriverValue = String;
|
|
1759
|
+
getSQLType() {
|
|
1760
|
+
if (this.precision !== void 0 && this.scale !== void 0) return `numeric(${this.precision}, ${this.scale})`;
|
|
1761
|
+
else if (this.precision === void 0) return "numeric";
|
|
1762
|
+
else return `numeric(${this.precision})`;
|
|
1763
|
+
}
|
|
1764
|
+
};
|
|
1765
|
+
function numeric(a, b) {
|
|
1766
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
1767
|
+
const mode = config?.mode;
|
|
1768
|
+
return mode === "number" ? new PgNumericNumberBuilder(name, config?.precision, config?.scale) : mode === "bigint" ? new PgNumericBigIntBuilder(name, config?.precision, config?.scale) : new PgNumericBuilder(name, config?.precision, config?.scale);
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
//#endregion
|
|
1772
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/point.js
|
|
1773
|
+
var PgPointTupleBuilder = class extends PgColumnBuilder {
|
|
1774
|
+
static [entityKind] = "PgPointTupleBuilder";
|
|
1775
|
+
constructor(name) {
|
|
1776
|
+
super(name, "array point", "PgPointTuple");
|
|
1777
|
+
}
|
|
1778
|
+
/** @internal */
|
|
1779
|
+
build(table) {
|
|
1780
|
+
return new PgPointTuple(table, this.config);
|
|
1781
|
+
}
|
|
1782
|
+
};
|
|
1783
|
+
var PgPointTuple = class extends PgColumn {
|
|
1784
|
+
static [entityKind] = "PgPointTuple";
|
|
1785
|
+
mode = "tuple";
|
|
1786
|
+
getSQLType() {
|
|
1787
|
+
return "point";
|
|
1788
|
+
}
|
|
1789
|
+
mapFromDriverValue(value) {
|
|
1790
|
+
if (typeof value === "string") {
|
|
1791
|
+
const [x, y] = value.slice(1, -1).split(",");
|
|
1792
|
+
return [Number.parseFloat(x), Number.parseFloat(y)];
|
|
1793
|
+
}
|
|
1794
|
+
return [value.x, value.y];
|
|
1795
|
+
}
|
|
1796
|
+
mapToDriverValue(value) {
|
|
1797
|
+
return `(${value[0]},${value[1]})`;
|
|
1798
|
+
}
|
|
1799
|
+
};
|
|
1800
|
+
var PgPointObjectBuilder = class extends PgColumnBuilder {
|
|
1801
|
+
static [entityKind] = "PgPointObjectBuilder";
|
|
1802
|
+
constructor(name) {
|
|
1803
|
+
super(name, "object point", "PgPointObject");
|
|
1804
|
+
}
|
|
1805
|
+
/** @internal */
|
|
1806
|
+
build(table) {
|
|
1807
|
+
return new PgPointObject(table, this.config);
|
|
1808
|
+
}
|
|
1809
|
+
};
|
|
1810
|
+
var PgPointObject = class extends PgColumn {
|
|
1811
|
+
static [entityKind] = "PgPointObject";
|
|
1812
|
+
mode = "xy";
|
|
1813
|
+
getSQLType() {
|
|
1814
|
+
return "point";
|
|
1815
|
+
}
|
|
1816
|
+
mapFromDriverValue(value) {
|
|
1817
|
+
if (typeof value === "string") {
|
|
1818
|
+
const [x, y] = value.slice(1, -1).split(",");
|
|
1819
|
+
return {
|
|
1820
|
+
x: Number.parseFloat(x),
|
|
1821
|
+
y: Number.parseFloat(y)
|
|
1822
|
+
};
|
|
1823
|
+
}
|
|
1824
|
+
return value;
|
|
1825
|
+
}
|
|
1826
|
+
mapToDriverValue(value) {
|
|
1827
|
+
return `(${value.x},${value.y})`;
|
|
1828
|
+
}
|
|
1829
|
+
};
|
|
1830
|
+
function point(a, b) {
|
|
1831
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
1832
|
+
if (!config?.mode || config.mode === "tuple") return new PgPointTupleBuilder(name);
|
|
1833
|
+
return new PgPointObjectBuilder(name);
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
//#endregion
|
|
1837
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/postgis_extension/utils.js
|
|
1838
|
+
function hexToBytes(hex) {
|
|
1839
|
+
const bytes = [];
|
|
1840
|
+
for (let c = 0; c < hex.length; c += 2) bytes.push(Number.parseInt(hex.slice(c, c + 2), 16));
|
|
1841
|
+
return new Uint8Array(bytes);
|
|
1842
|
+
}
|
|
1843
|
+
function bytesToFloat64(bytes, offset) {
|
|
1844
|
+
const buffer = /* @__PURE__ */ new ArrayBuffer(8);
|
|
1845
|
+
const view = new DataView(buffer);
|
|
1846
|
+
for (let i = 0; i < 8; i++) view.setUint8(i, bytes[offset + i]);
|
|
1847
|
+
return view.getFloat64(0, true);
|
|
1848
|
+
}
|
|
1849
|
+
function parseEWKB(hex) {
|
|
1850
|
+
const bytes = hexToBytes(hex);
|
|
1851
|
+
let offset = 0;
|
|
1852
|
+
const byteOrder = bytes[offset];
|
|
1853
|
+
offset += 1;
|
|
1854
|
+
const view = new DataView(bytes.buffer);
|
|
1855
|
+
const geomType = view.getUint32(offset, byteOrder === 1);
|
|
1856
|
+
offset += 4;
|
|
1857
|
+
let srid;
|
|
1858
|
+
if (geomType & 536870912) {
|
|
1859
|
+
srid = view.getUint32(offset, byteOrder === 1);
|
|
1860
|
+
offset += 4;
|
|
1861
|
+
}
|
|
1862
|
+
if ((geomType & 65535) === 1) {
|
|
1863
|
+
const x = bytesToFloat64(bytes, offset);
|
|
1864
|
+
offset += 8;
|
|
1865
|
+
const y = bytesToFloat64(bytes, offset);
|
|
1866
|
+
offset += 8;
|
|
1867
|
+
return {
|
|
1868
|
+
srid,
|
|
1869
|
+
point: [x, y]
|
|
1870
|
+
};
|
|
1871
|
+
}
|
|
1872
|
+
throw new Error("Unsupported geometry type");
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
//#endregion
|
|
1876
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/postgis_extension/geometry.js
|
|
1877
|
+
var PgGeometryBuilder = class extends PgColumnBuilder {
|
|
1878
|
+
static [entityKind] = "PgGeometryBuilder";
|
|
1879
|
+
constructor(name, srid) {
|
|
1880
|
+
super(name, "array geometry", "PgGeometry");
|
|
1881
|
+
this.config.srid = srid;
|
|
1882
|
+
}
|
|
1883
|
+
/** @internal */
|
|
1884
|
+
build(table) {
|
|
1885
|
+
return new PgGeometry(table, this.config);
|
|
1886
|
+
}
|
|
1887
|
+
};
|
|
1888
|
+
var PgGeometry = class extends PgColumn {
|
|
1889
|
+
static [entityKind] = "PgGeometry";
|
|
1890
|
+
srid = this.config.srid;
|
|
1891
|
+
mode = "tuple";
|
|
1892
|
+
getSQLType() {
|
|
1893
|
+
return `geometry(point${this.srid === void 0 ? "" : `,${this.srid}`})`;
|
|
1894
|
+
}
|
|
1895
|
+
mapFromDriverValue(value) {
|
|
1896
|
+
if (typeof value !== "string") return value;
|
|
1897
|
+
return parseEWKB(value).point;
|
|
1898
|
+
}
|
|
1899
|
+
mapToDriverValue(value) {
|
|
1900
|
+
return `point(${value[0]} ${value[1]})`;
|
|
1901
|
+
}
|
|
1902
|
+
};
|
|
1903
|
+
var PgGeometryObjectBuilder = class extends PgColumnBuilder {
|
|
1904
|
+
static [entityKind] = "PgGeometryObjectBuilder";
|
|
1905
|
+
constructor(name, srid) {
|
|
1906
|
+
super(name, "object geometry", "PgGeometryObject");
|
|
1907
|
+
this.config.srid = srid;
|
|
1908
|
+
}
|
|
1909
|
+
/** @internal */
|
|
1910
|
+
build(table) {
|
|
1911
|
+
return new PgGeometryObject(table, this.config);
|
|
1912
|
+
}
|
|
1913
|
+
};
|
|
1914
|
+
var PgGeometryObject = class extends PgColumn {
|
|
1915
|
+
static [entityKind] = "PgGeometryObject";
|
|
1916
|
+
srid = this.config.srid;
|
|
1917
|
+
mode = "object";
|
|
1918
|
+
getSQLType() {
|
|
1919
|
+
return `geometry(point${this.srid === void 0 ? "" : `,${this.srid}`})`;
|
|
1920
|
+
}
|
|
1921
|
+
mapFromDriverValue(value) {
|
|
1922
|
+
const parsed = parseEWKB(value);
|
|
1923
|
+
return {
|
|
1924
|
+
x: parsed.point[0],
|
|
1925
|
+
y: parsed.point[1]
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1928
|
+
mapToDriverValue(value) {
|
|
1929
|
+
return `point(${value.x} ${value.y})`;
|
|
1930
|
+
}
|
|
1931
|
+
};
|
|
1932
|
+
function geometry(a, b) {
|
|
1933
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
1934
|
+
if (!config?.mode || config.mode === "tuple") return new PgGeometryBuilder(name, config?.srid);
|
|
1935
|
+
return new PgGeometryObjectBuilder(name, config?.srid);
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
//#endregion
|
|
1939
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/real.js
|
|
1940
|
+
var PgRealBuilder = class extends PgColumnBuilder {
|
|
1941
|
+
static [entityKind] = "PgRealBuilder";
|
|
1942
|
+
constructor(name, length) {
|
|
1943
|
+
super(name, "number float", "PgReal");
|
|
1944
|
+
this.config.length = length;
|
|
1945
|
+
}
|
|
1946
|
+
/** @internal */
|
|
1947
|
+
build(table) {
|
|
1948
|
+
return new PgReal(table, this.config);
|
|
1949
|
+
}
|
|
1950
|
+
};
|
|
1951
|
+
var PgReal = class extends PgColumn {
|
|
1952
|
+
static [entityKind] = "PgReal";
|
|
1953
|
+
constructor(table, config) {
|
|
1954
|
+
super(table, config);
|
|
1955
|
+
}
|
|
1956
|
+
getSQLType() {
|
|
1957
|
+
return "real";
|
|
1958
|
+
}
|
|
1959
|
+
mapFromDriverValue = (value) => {
|
|
1960
|
+
if (typeof value === "string") return Number.parseFloat(value);
|
|
1961
|
+
return value;
|
|
1962
|
+
};
|
|
1963
|
+
};
|
|
1964
|
+
function real(name) {
|
|
1965
|
+
return new PgRealBuilder(name ?? "");
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
//#endregion
|
|
1969
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/serial.js
|
|
1970
|
+
var PgSerialBuilder = class extends PgColumnBuilder {
|
|
1971
|
+
static [entityKind] = "PgSerialBuilder";
|
|
1972
|
+
constructor(name) {
|
|
1973
|
+
super(name, "number int32", "PgSerial");
|
|
1974
|
+
this.config.hasDefault = true;
|
|
1975
|
+
this.config.notNull = true;
|
|
1976
|
+
}
|
|
1977
|
+
/** @internal */
|
|
1978
|
+
build(table) {
|
|
1979
|
+
return new PgSerial(table, this.config);
|
|
1980
|
+
}
|
|
1981
|
+
};
|
|
1982
|
+
var PgSerial = class extends PgColumn {
|
|
1983
|
+
static [entityKind] = "PgSerial";
|
|
1984
|
+
getSQLType() {
|
|
1985
|
+
return "serial";
|
|
1986
|
+
}
|
|
1987
|
+
};
|
|
1988
|
+
function serial(name) {
|
|
1989
|
+
return new PgSerialBuilder(name ?? "");
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
//#endregion
|
|
1993
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/smallint.js
|
|
1994
|
+
var PgSmallIntBuilder = class extends PgIntColumnBaseBuilder {
|
|
1995
|
+
static [entityKind] = "PgSmallIntBuilder";
|
|
1996
|
+
constructor(name) {
|
|
1997
|
+
super(name, "number int16", "PgSmallInt");
|
|
1998
|
+
}
|
|
1999
|
+
/** @internal */
|
|
2000
|
+
build(table) {
|
|
2001
|
+
return new PgSmallInt(table, this.config);
|
|
2002
|
+
}
|
|
2003
|
+
};
|
|
2004
|
+
var PgSmallInt = class extends PgColumn {
|
|
2005
|
+
static [entityKind] = "PgSmallInt";
|
|
2006
|
+
getSQLType() {
|
|
2007
|
+
return "smallint";
|
|
2008
|
+
}
|
|
2009
|
+
mapFromDriverValue = (value) => {
|
|
2010
|
+
if (typeof value === "string") return Number(value);
|
|
2011
|
+
return value;
|
|
2012
|
+
};
|
|
2013
|
+
};
|
|
2014
|
+
function smallint(name) {
|
|
2015
|
+
return new PgSmallIntBuilder(name ?? "");
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
//#endregion
|
|
2019
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/smallserial.js
|
|
2020
|
+
var PgSmallSerialBuilder = class extends PgColumnBuilder {
|
|
2021
|
+
static [entityKind] = "PgSmallSerialBuilder";
|
|
2022
|
+
constructor(name) {
|
|
2023
|
+
super(name, "number int16", "PgSmallSerial");
|
|
2024
|
+
this.config.hasDefault = true;
|
|
2025
|
+
this.config.notNull = true;
|
|
2026
|
+
}
|
|
2027
|
+
/** @internal */
|
|
2028
|
+
build(table) {
|
|
2029
|
+
return new PgSmallSerial(table, this.config);
|
|
2030
|
+
}
|
|
2031
|
+
};
|
|
2032
|
+
var PgSmallSerial = class extends PgColumn {
|
|
2033
|
+
static [entityKind] = "PgSmallSerial";
|
|
2034
|
+
getSQLType() {
|
|
2035
|
+
return "smallserial";
|
|
2036
|
+
}
|
|
2037
|
+
};
|
|
2038
|
+
function smallserial(name) {
|
|
2039
|
+
return new PgSmallSerialBuilder(name ?? "");
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
//#endregion
|
|
2043
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/text.js
|
|
2044
|
+
var PgTextBuilder = class extends PgColumnBuilder {
|
|
2045
|
+
static [entityKind] = "PgTextBuilder";
|
|
2046
|
+
constructor(name, config) {
|
|
2047
|
+
super(name, config.enum?.length ? "string enum" : "string", "PgText");
|
|
2048
|
+
this.config.enumValues = config.enum;
|
|
2049
|
+
}
|
|
2050
|
+
/** @internal */
|
|
2051
|
+
build(table) {
|
|
2052
|
+
return new PgText(table, this.config, this.config.enumValues);
|
|
2053
|
+
}
|
|
2054
|
+
};
|
|
2055
|
+
var PgText = class extends PgColumn {
|
|
2056
|
+
static [entityKind] = "PgText";
|
|
2057
|
+
enumValues;
|
|
2058
|
+
constructor(table, config, enumValues) {
|
|
2059
|
+
super(table, config);
|
|
2060
|
+
this.enumValues = enumValues;
|
|
2061
|
+
}
|
|
2062
|
+
getSQLType() {
|
|
2063
|
+
return "text";
|
|
2064
|
+
}
|
|
2065
|
+
};
|
|
2066
|
+
function text(a, b = {}) {
|
|
2067
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2068
|
+
return new PgTextBuilder(name, config);
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
//#endregion
|
|
2072
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/time.js
|
|
2073
|
+
var PgTimeBuilder = class extends PgDateColumnBaseBuilder {
|
|
2074
|
+
constructor(name, withTimezone, precision) {
|
|
2075
|
+
super(name, "string time", "PgTime");
|
|
2076
|
+
this.withTimezone = withTimezone;
|
|
2077
|
+
this.precision = precision;
|
|
2078
|
+
this.config.withTimezone = withTimezone;
|
|
2079
|
+
this.config.precision = precision;
|
|
2080
|
+
}
|
|
2081
|
+
static [entityKind] = "PgTimeBuilder";
|
|
2082
|
+
/** @internal */
|
|
2083
|
+
build(table) {
|
|
2084
|
+
return new PgTime(table, this.config);
|
|
2085
|
+
}
|
|
2086
|
+
};
|
|
2087
|
+
var PgTime = class extends PgColumn {
|
|
2088
|
+
static [entityKind] = "PgTime";
|
|
2089
|
+
withTimezone;
|
|
2090
|
+
precision;
|
|
2091
|
+
constructor(table, config) {
|
|
2092
|
+
super(table, config);
|
|
2093
|
+
this.withTimezone = config.withTimezone;
|
|
2094
|
+
this.precision = config.precision;
|
|
2095
|
+
}
|
|
2096
|
+
getSQLType() {
|
|
2097
|
+
return `time${this.precision === void 0 ? "" : `(${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
2098
|
+
}
|
|
2099
|
+
};
|
|
2100
|
+
function time(a, b = {}) {
|
|
2101
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2102
|
+
return new PgTimeBuilder(name, config.withTimezone ?? false, config.precision);
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
//#endregion
|
|
2106
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/timestamp.js
|
|
2107
|
+
var PgTimestampBuilder = class extends PgDateColumnBaseBuilder {
|
|
2108
|
+
static [entityKind] = "PgTimestampBuilder";
|
|
2109
|
+
constructor(name, withTimezone, precision) {
|
|
2110
|
+
super(name, "object date", "PgTimestamp");
|
|
2111
|
+
this.config.withTimezone = withTimezone;
|
|
2112
|
+
this.config.precision = precision;
|
|
2113
|
+
}
|
|
2114
|
+
/** @internal */
|
|
2115
|
+
build(table) {
|
|
2116
|
+
return new PgTimestamp(table, this.config);
|
|
2117
|
+
}
|
|
2118
|
+
};
|
|
2119
|
+
var PgTimestamp = class extends PgColumn {
|
|
2120
|
+
static [entityKind] = "PgTimestamp";
|
|
2121
|
+
withTimezone;
|
|
2122
|
+
precision;
|
|
2123
|
+
constructor(table, config) {
|
|
2124
|
+
super(table, config);
|
|
2125
|
+
this.withTimezone = config.withTimezone;
|
|
2126
|
+
this.precision = config.precision;
|
|
2127
|
+
}
|
|
2128
|
+
getSQLType() {
|
|
2129
|
+
return `timestamp${this.precision === void 0 ? "" : ` (${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
2130
|
+
}
|
|
2131
|
+
mapFromDriverValue(value) {
|
|
2132
|
+
if (typeof value === "string") return new Date(this.withTimezone ? value : value + "+0000");
|
|
2133
|
+
return value;
|
|
2134
|
+
}
|
|
2135
|
+
mapToDriverValue(value) {
|
|
2136
|
+
if (typeof value === "string") return value;
|
|
2137
|
+
return value.toISOString();
|
|
2138
|
+
}
|
|
2139
|
+
};
|
|
2140
|
+
var PgTimestampStringBuilder = class extends PgDateColumnBaseBuilder {
|
|
2141
|
+
static [entityKind] = "PgTimestampStringBuilder";
|
|
2142
|
+
constructor(name, withTimezone, precision) {
|
|
2143
|
+
super(name, "string timestamp", "PgTimestampString");
|
|
2144
|
+
this.config.withTimezone = withTimezone;
|
|
2145
|
+
this.config.precision = precision;
|
|
2146
|
+
}
|
|
2147
|
+
/** @internal */
|
|
2148
|
+
build(table) {
|
|
2149
|
+
return new PgTimestampString(table, this.config);
|
|
2150
|
+
}
|
|
2151
|
+
};
|
|
2152
|
+
var PgTimestampString = class extends PgColumn {
|
|
2153
|
+
static [entityKind] = "PgTimestampString";
|
|
2154
|
+
withTimezone;
|
|
2155
|
+
precision;
|
|
2156
|
+
constructor(table, config) {
|
|
2157
|
+
super(table, config);
|
|
2158
|
+
this.withTimezone = config.withTimezone;
|
|
2159
|
+
this.precision = config.precision;
|
|
2160
|
+
}
|
|
2161
|
+
getSQLType() {
|
|
2162
|
+
return `timestamp${this.precision === void 0 ? "" : `(${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
2163
|
+
}
|
|
2164
|
+
mapFromDriverValue(value) {
|
|
2165
|
+
if (typeof value === "string") return value;
|
|
2166
|
+
const shortened = value.toISOString().slice(0, -1).replace("T", " ");
|
|
2167
|
+
if (this.withTimezone) {
|
|
2168
|
+
const offset = value.getTimezoneOffset();
|
|
2169
|
+
return `${shortened}${offset <= 0 ? "+" : "-"}${Math.floor(Math.abs(offset) / 60).toString().padStart(2, "0")}`;
|
|
2170
|
+
}
|
|
2171
|
+
return shortened;
|
|
2172
|
+
}
|
|
2173
|
+
mapToDriverValue(value) {
|
|
2174
|
+
if (typeof value === "string") return value;
|
|
2175
|
+
return value.toISOString();
|
|
2176
|
+
}
|
|
2177
|
+
};
|
|
2178
|
+
function timestamp(a, b = {}) {
|
|
2179
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2180
|
+
if (config?.mode === "string") return new PgTimestampStringBuilder(name, config.withTimezone ?? false, config.precision);
|
|
2181
|
+
return new PgTimestampBuilder(name, config?.withTimezone ?? false, config?.precision);
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
//#endregion
|
|
2185
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/uuid.js
|
|
2186
|
+
var PgUUIDBuilder = class extends PgColumnBuilder {
|
|
2187
|
+
static [entityKind] = "PgUUIDBuilder";
|
|
2188
|
+
constructor(name) {
|
|
2189
|
+
super(name, "string uuid", "PgUUID");
|
|
2190
|
+
}
|
|
2191
|
+
/**
|
|
2192
|
+
* Adds `default gen_random_uuid()` to the column definition.
|
|
2193
|
+
*/
|
|
2194
|
+
defaultRandom() {
|
|
2195
|
+
return this.default(sql`gen_random_uuid()`);
|
|
2196
|
+
}
|
|
2197
|
+
/** @internal */
|
|
2198
|
+
build(table) {
|
|
2199
|
+
return new PgUUID(table, this.config);
|
|
2200
|
+
}
|
|
2201
|
+
};
|
|
2202
|
+
var PgUUID = class extends PgColumn {
|
|
2203
|
+
static [entityKind] = "PgUUID";
|
|
2204
|
+
getSQLType() {
|
|
2205
|
+
return "uuid";
|
|
2206
|
+
}
|
|
2207
|
+
};
|
|
2208
|
+
function uuid(name) {
|
|
2209
|
+
return new PgUUIDBuilder(name ?? "");
|
|
2210
|
+
}
|
|
2211
|
+
|
|
2212
|
+
//#endregion
|
|
2213
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/varchar.js
|
|
2214
|
+
var PgVarcharBuilder = class extends PgColumnBuilder {
|
|
2215
|
+
static [entityKind] = "PgVarcharBuilder";
|
|
2216
|
+
constructor(name, config) {
|
|
2217
|
+
super(name, config.enum?.length ? "string enum" : "string", "PgVarchar");
|
|
2218
|
+
this.config.length = config.length;
|
|
2219
|
+
this.config.enumValues = config.enum;
|
|
2220
|
+
}
|
|
2221
|
+
/** @internal */
|
|
2222
|
+
build(table) {
|
|
2223
|
+
return new PgVarchar(table, this.config);
|
|
2224
|
+
}
|
|
2225
|
+
};
|
|
2226
|
+
var PgVarchar = class extends PgColumn {
|
|
2227
|
+
static [entityKind] = "PgVarchar";
|
|
2228
|
+
enumValues = this.config.enumValues;
|
|
2229
|
+
getSQLType() {
|
|
2230
|
+
return this.length === void 0 ? `varchar` : `varchar(${this.length})`;
|
|
2231
|
+
}
|
|
2232
|
+
};
|
|
2233
|
+
function varchar(a, b = {}) {
|
|
2234
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2235
|
+
return new PgVarcharBuilder(name, config);
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
//#endregion
|
|
2239
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/vector_extension/bit.js
|
|
2240
|
+
var PgBinaryVectorBuilder = class extends PgColumnBuilder {
|
|
2241
|
+
static [entityKind] = "PgBinaryVectorBuilder";
|
|
2242
|
+
constructor(name, config) {
|
|
2243
|
+
super(name, "string binary", "PgBinaryVector");
|
|
2244
|
+
this.config.length = config.dimensions;
|
|
2245
|
+
this.config.isLengthExact = true;
|
|
2246
|
+
}
|
|
2247
|
+
/** @internal */
|
|
2248
|
+
build(table) {
|
|
2249
|
+
return new PgBinaryVector(table, this.config);
|
|
2250
|
+
}
|
|
2251
|
+
};
|
|
2252
|
+
var PgBinaryVector = class extends PgColumn {
|
|
2253
|
+
static [entityKind] = "PgBinaryVector";
|
|
2254
|
+
getSQLType() {
|
|
2255
|
+
return `bit(${this.length})`;
|
|
2256
|
+
}
|
|
2257
|
+
};
|
|
2258
|
+
function bit(a, b) {
|
|
2259
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2260
|
+
return new PgBinaryVectorBuilder(name, config);
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
//#endregion
|
|
2264
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/vector_extension/halfvec.js
|
|
2265
|
+
var PgHalfVectorBuilder = class extends PgColumnBuilder {
|
|
2266
|
+
static [entityKind] = "PgHalfVectorBuilder";
|
|
2267
|
+
constructor(name, config) {
|
|
2268
|
+
super(name, "array halfvector", "PgHalfVector");
|
|
2269
|
+
this.config.length = config.dimensions;
|
|
2270
|
+
this.config.isLengthExact = true;
|
|
2271
|
+
}
|
|
2272
|
+
/** @internal */
|
|
2273
|
+
build(table) {
|
|
2274
|
+
return new PgHalfVector(table, this.config);
|
|
2275
|
+
}
|
|
2276
|
+
};
|
|
2277
|
+
var PgHalfVector = class extends PgColumn {
|
|
2278
|
+
static [entityKind] = "PgHalfVector";
|
|
2279
|
+
getSQLType() {
|
|
2280
|
+
return `halfvec(${this.length})`;
|
|
2281
|
+
}
|
|
2282
|
+
mapToDriverValue(value) {
|
|
2283
|
+
return JSON.stringify(value);
|
|
2284
|
+
}
|
|
2285
|
+
mapFromDriverValue(value) {
|
|
2286
|
+
return value.slice(1, -1).split(",").map((v) => Number.parseFloat(v));
|
|
2287
|
+
}
|
|
2288
|
+
};
|
|
2289
|
+
function halfvec(a, b) {
|
|
2290
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2291
|
+
return new PgHalfVectorBuilder(name, config);
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
//#endregion
|
|
2295
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/vector_extension/sparsevec.js
|
|
2296
|
+
var PgSparseVectorBuilder = class extends PgColumnBuilder {
|
|
2297
|
+
static [entityKind] = "PgSparseVectorBuilder";
|
|
2298
|
+
constructor(name, config) {
|
|
2299
|
+
super(name, "string sparsevec", "PgSparseVector");
|
|
2300
|
+
this.config.dimensions = config.dimensions;
|
|
2301
|
+
}
|
|
2302
|
+
/** @internal */
|
|
2303
|
+
build(table) {
|
|
2304
|
+
return new PgSparseVector(table, this.config);
|
|
2305
|
+
}
|
|
2306
|
+
};
|
|
2307
|
+
var PgSparseVector = class extends PgColumn {
|
|
2308
|
+
static [entityKind] = "PgSparseVector";
|
|
2309
|
+
dimensions = this.config.dimensions;
|
|
2310
|
+
getSQLType() {
|
|
2311
|
+
return `sparsevec(${this.dimensions})`;
|
|
2312
|
+
}
|
|
2313
|
+
};
|
|
2314
|
+
function sparsevec(a, b) {
|
|
2315
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2316
|
+
return new PgSparseVectorBuilder(name, config);
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
//#endregion
|
|
2320
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/vector_extension/vector.js
|
|
2321
|
+
var PgVectorBuilder = class extends PgColumnBuilder {
|
|
2322
|
+
static [entityKind] = "PgVectorBuilder";
|
|
2323
|
+
constructor(name, config) {
|
|
2324
|
+
super(name, "array vector", "PgVector");
|
|
2325
|
+
this.config.length = config.dimensions;
|
|
2326
|
+
this.config.isLengthExact = true;
|
|
2327
|
+
}
|
|
2328
|
+
/** @internal */
|
|
2329
|
+
build(table) {
|
|
2330
|
+
return new PgVector(table, this.config);
|
|
2331
|
+
}
|
|
2332
|
+
};
|
|
2333
|
+
var PgVector = class extends PgColumn {
|
|
2334
|
+
static [entityKind] = "PgVector";
|
|
2335
|
+
getSQLType() {
|
|
2336
|
+
return `vector(${this.length})`;
|
|
2337
|
+
}
|
|
2338
|
+
mapToDriverValue(value) {
|
|
2339
|
+
return JSON.stringify(value);
|
|
2340
|
+
}
|
|
2341
|
+
mapFromDriverValue(value) {
|
|
2342
|
+
return value.slice(1, -1).split(",").map((v) => Number.parseFloat(v));
|
|
2343
|
+
}
|
|
2344
|
+
};
|
|
2345
|
+
function vector(a, b) {
|
|
2346
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2347
|
+
return new PgVectorBuilder(name, config);
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
//#endregion
|
|
2351
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/columns/all.js
|
|
2352
|
+
function getPgColumnBuilders() {
|
|
2353
|
+
return {
|
|
2354
|
+
bigint,
|
|
2355
|
+
bigserial,
|
|
2356
|
+
boolean,
|
|
2357
|
+
char,
|
|
2358
|
+
cidr,
|
|
2359
|
+
customType,
|
|
2360
|
+
date,
|
|
2361
|
+
doublePrecision,
|
|
2362
|
+
inet,
|
|
2363
|
+
integer,
|
|
2364
|
+
interval,
|
|
2365
|
+
json,
|
|
2366
|
+
jsonb,
|
|
2367
|
+
line,
|
|
2368
|
+
macaddr,
|
|
2369
|
+
macaddr8,
|
|
2370
|
+
numeric,
|
|
2371
|
+
point,
|
|
2372
|
+
geometry,
|
|
2373
|
+
real,
|
|
2374
|
+
serial,
|
|
2375
|
+
smallint,
|
|
2376
|
+
smallserial,
|
|
2377
|
+
text,
|
|
2378
|
+
time,
|
|
2379
|
+
timestamp,
|
|
2380
|
+
uuid,
|
|
2381
|
+
varchar,
|
|
2382
|
+
bit,
|
|
2383
|
+
halfvec,
|
|
2384
|
+
sparsevec,
|
|
2385
|
+
vector
|
|
2386
|
+
};
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
//#endregion
|
|
2390
|
+
//#region ../../node_modules/.bun/drizzle-orm@1.0.0-beta.2-f9236e3+94f63afaebaec8a7/node_modules/drizzle-orm/pg-core/table.js
|
|
2391
|
+
const InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
|
|
2392
|
+
const EnableRLS = Symbol.for("drizzle:EnableRLS");
|
|
2393
|
+
var PgTable = class extends Table {
|
|
2394
|
+
static [entityKind] = "PgTable";
|
|
2395
|
+
/** @internal */
|
|
2396
|
+
static Symbol = Object.assign({}, Table.Symbol, {
|
|
2397
|
+
InlineForeignKeys,
|
|
2398
|
+
EnableRLS
|
|
2399
|
+
});
|
|
2400
|
+
/**@internal */
|
|
2401
|
+
[InlineForeignKeys] = [];
|
|
2402
|
+
/** @internal */
|
|
2403
|
+
[EnableRLS] = false;
|
|
2404
|
+
/** @internal */
|
|
2405
|
+
[Table.Symbol.ExtraConfigBuilder] = void 0;
|
|
2406
|
+
/** @internal */
|
|
2407
|
+
[Table.Symbol.ExtraConfigColumns] = {};
|
|
2408
|
+
};
|
|
2409
|
+
function pgTableWithSchema(name, columns, extraConfig, schema, baseName = name) {
|
|
2410
|
+
const rawTable = new PgTable(name, schema, baseName);
|
|
2411
|
+
const parsedColumns = typeof columns === "function" ? columns(getPgColumnBuilders()) : columns;
|
|
2412
|
+
const builtColumns = Object.fromEntries(Object.entries(parsedColumns).map(([name2, colBuilderBase]) => {
|
|
2413
|
+
const colBuilder = colBuilderBase;
|
|
2414
|
+
colBuilder.setName(name2);
|
|
2415
|
+
const column = colBuilder.build(rawTable);
|
|
2416
|
+
rawTable[InlineForeignKeys].push(...colBuilder.buildForeignKeys(column, rawTable));
|
|
2417
|
+
return [name2, column];
|
|
2418
|
+
}));
|
|
2419
|
+
const builtColumnsForExtraConfig = Object.fromEntries(Object.entries(parsedColumns).map(([name2, colBuilderBase]) => {
|
|
2420
|
+
const colBuilder = colBuilderBase;
|
|
2421
|
+
colBuilder.setName(name2);
|
|
2422
|
+
return [name2, colBuilder.buildExtraConfigColumn(rawTable)];
|
|
2423
|
+
}));
|
|
2424
|
+
const table = Object.assign(rawTable, builtColumns);
|
|
2425
|
+
table[Table.Symbol.Columns] = builtColumns;
|
|
2426
|
+
table[Table.Symbol.ExtraConfigColumns] = builtColumnsForExtraConfig;
|
|
2427
|
+
if (extraConfig) table[PgTable.Symbol.ExtraConfigBuilder] = extraConfig;
|
|
2428
|
+
return Object.assign(table, { enableRLS: () => {
|
|
2429
|
+
table[PgTable.Symbol.EnableRLS] = true;
|
|
2430
|
+
return table;
|
|
2431
|
+
} });
|
|
2432
|
+
}
|
|
2433
|
+
const pgTableInternal = (name, columns, extraConfig) => {
|
|
2434
|
+
return pgTableWithSchema(name, columns, extraConfig, void 0);
|
|
2435
|
+
};
|
|
2436
|
+
const pgTableWithRLS = (name, columns, extraConfig) => {
|
|
2437
|
+
const table = pgTableWithSchema(name, columns, extraConfig, void 0);
|
|
2438
|
+
table[EnableRLS] = true;
|
|
2439
|
+
return table;
|
|
2440
|
+
};
|
|
2441
|
+
const pgTable = Object.assign(pgTableInternal, { withRLS: pgTableWithRLS });
|
|
2442
|
+
|
|
2443
|
+
//#endregion
|
|
2444
|
+
//#region src/api/auth-schema.ts
|
|
2445
|
+
/**
|
|
2446
|
+
* Defines the authentication schema for the application.
|
|
2447
|
+
*
|
|
2448
|
+
* @returns An object containing the schema and relations for the authentication tables.
|
|
2449
|
+
*/
|
|
2450
|
+
function defineAuthSchema() {
|
|
2451
|
+
const accounts = pgTable("accounts", (t) => ({
|
|
2452
|
+
id: t.text("id").primaryKey().default(sql`uuidv7()`),
|
|
2453
|
+
accessToken: t.text("access_token"),
|
|
2454
|
+
accessTokenExpiresAt: t.timestamp("access_token_expires_at", {
|
|
2455
|
+
mode: "string",
|
|
2456
|
+
withTimezone: true
|
|
2457
|
+
}),
|
|
2458
|
+
accountId: t.text("account_id").notNull(),
|
|
2459
|
+
createdAt: t.timestamp("created_at", {
|
|
2460
|
+
mode: "string",
|
|
2461
|
+
withTimezone: true
|
|
2462
|
+
}).default(sql`NOW()`).notNull(),
|
|
2463
|
+
idToken: t.text("id_token"),
|
|
2464
|
+
providerId: t.text("provider_id").notNull(),
|
|
2465
|
+
password: t.text("password"),
|
|
2466
|
+
userId: t.text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
2467
|
+
refreshToken: t.text("refresh_token"),
|
|
2468
|
+
refreshTokenExpiresAt: t.timestamp("refresh_token_expires_at", {
|
|
2469
|
+
mode: "string",
|
|
2470
|
+
withTimezone: true
|
|
2471
|
+
}),
|
|
2472
|
+
scope: t.text("scope"),
|
|
2473
|
+
updatedAt: t.timestamp("updated_at", {
|
|
2474
|
+
mode: "string",
|
|
2475
|
+
withTimezone: true
|
|
2476
|
+
}).default(sql`NOW()`).notNull()
|
|
2477
|
+
}), (t) => []);
|
|
2478
|
+
const apiKeys = pgTable("api_keys", (t) => ({
|
|
2479
|
+
id: t.text("id").primaryKey().default(sql`uuidv7()`),
|
|
2480
|
+
name: t.text("name"),
|
|
2481
|
+
enabled: t.boolean("enabled").default(true),
|
|
2482
|
+
expiresAt: t.timestamp("expires_at", {
|
|
2483
|
+
mode: "string",
|
|
2484
|
+
withTimezone: true
|
|
2485
|
+
}),
|
|
2486
|
+
key: t.text("key").notNull(),
|
|
2487
|
+
lastRefillAt: t.timestamp("last_refill_at", {
|
|
2488
|
+
mode: "string",
|
|
2489
|
+
withTimezone: true
|
|
2490
|
+
}),
|
|
2491
|
+
lastRequest: t.timestamp("last_request", {
|
|
2492
|
+
mode: "string",
|
|
2493
|
+
withTimezone: true
|
|
2494
|
+
}),
|
|
2495
|
+
lastUsedAt: t.timestamp("last_used_at", {
|
|
2496
|
+
mode: "string",
|
|
2497
|
+
withTimezone: true
|
|
2498
|
+
}),
|
|
2499
|
+
metadata: t.text("metadata"),
|
|
2500
|
+
permissions: t.text("permissions"),
|
|
2501
|
+
prefix: t.text("prefix"),
|
|
2502
|
+
rateLimitEnabled: t.boolean("rate_limit_enabled").default(true),
|
|
2503
|
+
rateLimitTimeWindow: t.integer("rate_limit_time_window").default(864e5),
|
|
2504
|
+
rateLimitMax: t.integer("rate_limit_max").default(10),
|
|
2505
|
+
refillInterval: t.integer("refill_interval"),
|
|
2506
|
+
refillAmount: t.integer("refill_amount"),
|
|
2507
|
+
requestCount: t.integer("request_count"),
|
|
2508
|
+
remaining: t.integer("remaining"),
|
|
2509
|
+
start: t.text("start"),
|
|
2510
|
+
userId: t.text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
2511
|
+
createdAt: t.timestamp("created_at", {
|
|
2512
|
+
mode: "string",
|
|
2513
|
+
withTimezone: true
|
|
2514
|
+
}).default(sql`NOW()`).notNull(),
|
|
2515
|
+
updatedAt: t.timestamp("updated_at", {
|
|
2516
|
+
mode: "string",
|
|
2517
|
+
withTimezone: true
|
|
2518
|
+
}).default(sql`NOW()`).notNull()
|
|
2519
|
+
}), (t) => []);
|
|
2520
|
+
const invitations = pgTable("invitations", (t) => ({
|
|
2521
|
+
id: t.text("id").primaryKey().default(sql`uuidv7()`),
|
|
2522
|
+
email: t.text("email").notNull(),
|
|
2523
|
+
expiresAt: t.timestamp("expires_at", {
|
|
2524
|
+
mode: "string",
|
|
2525
|
+
withTimezone: true
|
|
2526
|
+
}).notNull(),
|
|
2527
|
+
inviterId: t.text("inviter_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
2528
|
+
organizationId: t.text("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
2529
|
+
role: t.text("role"),
|
|
2530
|
+
status: t.text("status").default("pending").notNull(),
|
|
2531
|
+
teamId: t.text("team_id"),
|
|
2532
|
+
createdAt: t.timestamp("created_at", {
|
|
2533
|
+
mode: "string",
|
|
2534
|
+
withTimezone: true
|
|
2535
|
+
}).default(sql`NOW()`).notNull(),
|
|
2536
|
+
updatedAt: t.timestamp("updated_at", {
|
|
2537
|
+
mode: "string",
|
|
2538
|
+
withTimezone: true
|
|
2539
|
+
}).default(sql`NOW()`).notNull()
|
|
2540
|
+
}), (t) => []);
|
|
2541
|
+
const members = pgTable("members", (t) => ({
|
|
2542
|
+
id: t.text("id").primaryKey().default(sql`uuidv7()`),
|
|
2543
|
+
organizationId: t.text("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
2544
|
+
role: t.text("role").default("member").notNull(),
|
|
2545
|
+
userId: t.text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
2546
|
+
createdAt: t.timestamp("created_at", {
|
|
2547
|
+
mode: "string",
|
|
2548
|
+
withTimezone: true
|
|
2549
|
+
}).default(sql`NOW()`).notNull()
|
|
2550
|
+
}), (t) => []);
|
|
2551
|
+
const organizations = pgTable("organizations", (t) => ({
|
|
2552
|
+
id: t.text("id").primaryKey().default(sql`uuidv7()`),
|
|
2553
|
+
name: t.text("name").notNull(),
|
|
2554
|
+
slug: t.text("slug").unique(),
|
|
2555
|
+
logo: t.text("logo"),
|
|
2556
|
+
createdAt: t.timestamp("created_at", {
|
|
2557
|
+
mode: "string",
|
|
2558
|
+
withTimezone: true
|
|
2559
|
+
}).default(sql`NOW()`).notNull(),
|
|
2560
|
+
updatedAt: t.timestamp("updated_at", {
|
|
2561
|
+
mode: "string",
|
|
2562
|
+
withTimezone: true
|
|
2563
|
+
}).default(sql`NOW()`).notNull(),
|
|
2564
|
+
metadata: t.text("metadata")
|
|
2565
|
+
}), (t) => []);
|
|
2566
|
+
const sessions = pgTable("sessions", (t) => ({
|
|
2567
|
+
id: t.text("id").primaryKey().default(sql`uuidv7()`),
|
|
2568
|
+
activeOrganizationId: t.text("active_organization_id").references(() => organizations.id, { onDelete: "set null" }),
|
|
2569
|
+
activeTeamId: t.text("active_team_id"),
|
|
2570
|
+
createdAt: t.timestamp("created_at", {
|
|
2571
|
+
mode: "string",
|
|
2572
|
+
withTimezone: true
|
|
2573
|
+
}).default(sql`NOW()`).notNull(),
|
|
2574
|
+
expiresAt: t.timestamp("expires_at", {
|
|
2575
|
+
mode: "string",
|
|
2576
|
+
withTimezone: true
|
|
2577
|
+
}).notNull(),
|
|
2578
|
+
impersonatedBy: t.text("impersonated_by").references(() => users.id, { onDelete: "set null" }),
|
|
2579
|
+
ipAddress: t.text("ip_address"),
|
|
2580
|
+
token: t.text("token").notNull().unique(),
|
|
2581
|
+
updatedAt: t.timestamp("updated_at", {
|
|
2582
|
+
mode: "string",
|
|
2583
|
+
withTimezone: true
|
|
2584
|
+
}).default(sql`NOW()`).notNull(),
|
|
2585
|
+
userAgent: t.text("user_agent"),
|
|
2586
|
+
userId: t.text("user_id").notNull().references(() => users.id, { onDelete: "cascade" })
|
|
2587
|
+
}), (t) => []);
|
|
2588
|
+
const ssoProviders = pgTable("sso_providers", (t) => ({
|
|
2589
|
+
id: t.text("id").primaryKey().default(sql`uuidv7()`),
|
|
2590
|
+
domain: t.text("domain").notNull(),
|
|
2591
|
+
issuer: t.text("issuer").notNull(),
|
|
2592
|
+
oidcConfig: t.text("oidc_config"),
|
|
2593
|
+
organizationId: t.text("organization_id").references(() => organizations.id, { onDelete: "cascade" }),
|
|
2594
|
+
providerId: t.text("provider_id").notNull().unique(),
|
|
2595
|
+
samlConfig: t.text("saml_config"),
|
|
2596
|
+
userId: t.text("user_id").references(() => users.id, { onDelete: "cascade" })
|
|
2597
|
+
}), (t) => []);
|
|
2598
|
+
const users = pgTable("users", (t) => ({
|
|
2599
|
+
id: t.text("id").primaryKey().default(sql`uuidv7()`),
|
|
2600
|
+
banExpires: t.timestamp("ban_expires", {
|
|
2601
|
+
mode: "string",
|
|
2602
|
+
withTimezone: true
|
|
2603
|
+
}),
|
|
2604
|
+
banReason: t.text("ban_reason"),
|
|
2605
|
+
banned: t.boolean("banned").default(false),
|
|
2606
|
+
createdAt: t.timestamp("created_at", {
|
|
2607
|
+
mode: "string",
|
|
2608
|
+
withTimezone: true
|
|
2609
|
+
}).default(sql`NOW()`).notNull(),
|
|
2610
|
+
displayUsername: t.text("display_username"),
|
|
2611
|
+
email: t.text("email").notNull().unique(),
|
|
2612
|
+
emailVerified: t.boolean("email_verified").default(false).notNull(),
|
|
2613
|
+
image: t.text("image"),
|
|
2614
|
+
isAnonymous: t.boolean("is_anonymous"),
|
|
2615
|
+
lastLoginMethod: t.text("last_login_method"),
|
|
2616
|
+
name: t.text("name").notNull(),
|
|
2617
|
+
phoneNumber: t.text("phone_number").unique(),
|
|
2618
|
+
phoneNumberVerified: t.boolean("phone_number_verified"),
|
|
2619
|
+
role: t.text("role"),
|
|
2620
|
+
twoFactorEnabled: t.boolean("two_factor_enabled").default(false),
|
|
2621
|
+
updatedAt: t.timestamp("updated_at", {
|
|
2622
|
+
mode: "string",
|
|
2623
|
+
withTimezone: true
|
|
2624
|
+
}).default(sql`NOW()`).notNull(),
|
|
2625
|
+
username: t.text("username").unique()
|
|
2626
|
+
}), (t) => []);
|
|
2627
|
+
const teams = pgTable("teams", (t) => ({
|
|
2628
|
+
id: t.text("id").primaryKey().default(sql`uuidv7()`),
|
|
2629
|
+
name: t.text("name").notNull(),
|
|
2630
|
+
organizationId: t.text("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
2631
|
+
createdAt: t.timestamp("created_at", {
|
|
2632
|
+
mode: "string",
|
|
2633
|
+
withTimezone: true
|
|
2634
|
+
}).default(sql`NOW()`).notNull(),
|
|
2635
|
+
updatedAt: t.timestamp("updated_at", {
|
|
2636
|
+
mode: "string",
|
|
2637
|
+
withTimezone: true
|
|
2638
|
+
}).default(sql`NOW()`).notNull()
|
|
2639
|
+
}), (t) => []);
|
|
2640
|
+
const teamMembers = pgTable("team_members", (t) => ({
|
|
2641
|
+
id: t.text("id").primaryKey().default(sql`uuidv7()`),
|
|
2642
|
+
teamId: t.text("team_id").notNull().references(() => teams.id, { onDelete: "cascade" }),
|
|
2643
|
+
userId: t.text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
2644
|
+
createdAt: t.timestamp("created_at", {
|
|
2645
|
+
mode: "string",
|
|
2646
|
+
withTimezone: true
|
|
2647
|
+
}).default(sql`NOW()`).notNull()
|
|
2648
|
+
}), (t) => []);
|
|
2649
|
+
const twoFactors = pgTable("two_factors", (t) => ({
|
|
2650
|
+
id: t.text("id").primaryKey().default(sql`uuidv7()`),
|
|
2651
|
+
secret: t.text("secret").notNull(),
|
|
2652
|
+
backupCodes: t.text("backup_codes").notNull(),
|
|
2653
|
+
userId: t.text("user_id").notNull().references(() => users.id, { onDelete: "cascade" })
|
|
2654
|
+
}), (t) => []);
|
|
2655
|
+
const verifications = pgTable("verifications", (t) => ({
|
|
2656
|
+
id: t.text("id").primaryKey().default(sql`uuidv7()`),
|
|
2657
|
+
createdAt: t.timestamp("created_at", {
|
|
2658
|
+
mode: "string",
|
|
2659
|
+
withTimezone: true
|
|
2660
|
+
}).default(sql`NOW()`).notNull(),
|
|
2661
|
+
expiresAt: t.timestamp("expires_at", {
|
|
2662
|
+
mode: "string",
|
|
2663
|
+
withTimezone: true
|
|
2664
|
+
}).notNull(),
|
|
2665
|
+
identifier: t.text("identifier").notNull(),
|
|
2666
|
+
updatedAt: t.timestamp("updated_at", {
|
|
2667
|
+
mode: "string",
|
|
2668
|
+
withTimezone: true
|
|
2669
|
+
}).default(sql`NOW()`).notNull(),
|
|
2670
|
+
value: t.text("value").notNull()
|
|
2671
|
+
}), (t) => []);
|
|
2672
|
+
return {
|
|
2673
|
+
tables: {
|
|
2674
|
+
accounts,
|
|
2675
|
+
apiKeys,
|
|
2676
|
+
auditLogs: pgTable("audit_logs", (t) => ({
|
|
2677
|
+
id: t.text("id").primaryKey().default(sql`uuidv7()`),
|
|
2678
|
+
tableName: t.text("table_name"),
|
|
2679
|
+
action: t.text("action").notNull(),
|
|
2680
|
+
customAction: t.text("custom_action"),
|
|
2681
|
+
oldData: t.jsonb("old_data"),
|
|
2682
|
+
newData: t.jsonb("new_data"),
|
|
2683
|
+
metadata: t.jsonb("metadata"),
|
|
2684
|
+
organizationId: t.text("organization_id").references(() => organizations.id, { onDelete: "set null" }),
|
|
2685
|
+
userId: t.text("user_id").references(() => users.id, { onDelete: "set null" }),
|
|
2686
|
+
sessionId: t.text("session_id").references(() => sessions.id, { onDelete: "set null" }),
|
|
2687
|
+
requestId: t.text("request_id"),
|
|
2688
|
+
createdAt: t.timestamp("created_at", {
|
|
2689
|
+
mode: "string",
|
|
2690
|
+
withTimezone: true
|
|
2691
|
+
}).default(sql`NOW()`).notNull()
|
|
2692
|
+
}), (t) => []),
|
|
2693
|
+
invitations,
|
|
2694
|
+
members,
|
|
2695
|
+
organizations,
|
|
2696
|
+
sessions,
|
|
2697
|
+
ssoProviders,
|
|
2698
|
+
teams,
|
|
2699
|
+
teamMembers,
|
|
2700
|
+
twoFactors,
|
|
2701
|
+
users,
|
|
2702
|
+
verifications
|
|
2703
|
+
},
|
|
2704
|
+
relations: (r) => ({
|
|
2705
|
+
users: {
|
|
2706
|
+
sessions: r.many.sessions({
|
|
2707
|
+
from: r.users.id,
|
|
2708
|
+
to: r.sessions.userId
|
|
2709
|
+
}),
|
|
2710
|
+
accounts: r.many.accounts({
|
|
2711
|
+
from: r.users.id,
|
|
2712
|
+
to: r.accounts.userId
|
|
2713
|
+
}),
|
|
2714
|
+
apiKeys: r.many.apiKeys({
|
|
2715
|
+
from: r.users.id,
|
|
2716
|
+
to: r.apiKeys.userId
|
|
2717
|
+
}),
|
|
2718
|
+
memberships: r.many.members({
|
|
2719
|
+
from: r.users.id,
|
|
2720
|
+
to: r.members.userId
|
|
2721
|
+
}),
|
|
2722
|
+
invitations: r.many.invitations({
|
|
2723
|
+
from: r.users.id,
|
|
2724
|
+
to: r.invitations.inviterId
|
|
2725
|
+
}),
|
|
2726
|
+
ssoProvider: r.one.ssoProviders({
|
|
2727
|
+
from: r.users.id,
|
|
2728
|
+
to: r.ssoProviders.userId
|
|
2729
|
+
}),
|
|
2730
|
+
twoFactor: r.one.twoFactors({
|
|
2731
|
+
from: r.users.id,
|
|
2732
|
+
to: r.twoFactors.userId
|
|
2733
|
+
})
|
|
2734
|
+
},
|
|
2735
|
+
sessions: { user: r.one.users({
|
|
2736
|
+
from: r.sessions.userId,
|
|
2737
|
+
to: r.users.id
|
|
2738
|
+
}) },
|
|
2739
|
+
accounts: { user: r.one.users({
|
|
2740
|
+
from: r.accounts.userId,
|
|
2741
|
+
to: r.users.id
|
|
2742
|
+
}) },
|
|
2743
|
+
apiKeys: { user: r.one.users({
|
|
2744
|
+
from: r.apiKeys.userId,
|
|
2745
|
+
to: r.users.id
|
|
2746
|
+
}) },
|
|
2747
|
+
organizations: {
|
|
2748
|
+
members: r.many.members({
|
|
2749
|
+
from: r.organizations.id,
|
|
2750
|
+
to: r.members.organizationId
|
|
2751
|
+
}),
|
|
2752
|
+
invitations: r.many.invitations({
|
|
2753
|
+
from: r.organizations.id,
|
|
2754
|
+
to: r.invitations.organizationId
|
|
2755
|
+
}),
|
|
2756
|
+
teams: r.many.teams({
|
|
2757
|
+
from: r.organizations.id,
|
|
2758
|
+
to: r.teams.organizationId
|
|
2759
|
+
})
|
|
2760
|
+
},
|
|
2761
|
+
members: {
|
|
2762
|
+
organization: r.one.organizations({
|
|
2763
|
+
from: r.members.organizationId,
|
|
2764
|
+
to: r.organizations.id
|
|
2765
|
+
}),
|
|
2766
|
+
user: r.one.users({
|
|
2767
|
+
from: r.members.userId,
|
|
2768
|
+
to: r.users.id
|
|
2769
|
+
})
|
|
2770
|
+
},
|
|
2771
|
+
invitations: {
|
|
2772
|
+
organization: r.one.organizations({
|
|
2773
|
+
from: r.invitations.organizationId,
|
|
2774
|
+
to: r.organizations.id
|
|
2775
|
+
}),
|
|
2776
|
+
inviter: r.one.users({
|
|
2777
|
+
from: r.invitations.inviterId,
|
|
2778
|
+
to: r.users.id
|
|
2779
|
+
})
|
|
2780
|
+
},
|
|
2781
|
+
teams: { organization: r.one.organizations({
|
|
2782
|
+
from: r.teams.organizationId,
|
|
2783
|
+
to: r.organizations.id
|
|
2784
|
+
}) },
|
|
2785
|
+
ssoProviders: { user: r.one.users({
|
|
2786
|
+
from: r.ssoProviders.userId,
|
|
2787
|
+
to: r.users.id
|
|
2788
|
+
}) },
|
|
2789
|
+
verifications: {},
|
|
2790
|
+
twoFactors: { user: r.one.users({
|
|
2791
|
+
from: r.twoFactors.userId,
|
|
2792
|
+
to: r.users.id
|
|
2793
|
+
}) },
|
|
2794
|
+
auditLogs: {
|
|
2795
|
+
organization: r.one.organizations({
|
|
2796
|
+
from: r.auditLogs.organizationId,
|
|
2797
|
+
to: r.organizations.id
|
|
2798
|
+
}),
|
|
2799
|
+
user: r.one.users({
|
|
2800
|
+
from: r.auditLogs.userId,
|
|
2801
|
+
to: r.users.id
|
|
2802
|
+
}),
|
|
2803
|
+
session: r.one.sessions({
|
|
2804
|
+
from: r.auditLogs.sessionId,
|
|
2805
|
+
to: r.sessions.id
|
|
2806
|
+
})
|
|
2807
|
+
}
|
|
2808
|
+
})
|
|
2809
|
+
};
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
//#endregion
|
|
2813
|
+
export { isDriverValueEncoder as a, Table as c, View as i, Column as l, Param as n, isSQLWrapper as o, Placeholder as r, sql as s, defineAuthSchema as t, is as u };
|