@rebasepro/server 0.24.0 → 0.24.1-canary.g19596ef

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/README.md +27 -2
  2. package/dist/GCSStorageController-DEga1ULx.js +402 -0
  3. package/dist/GCSStorageController-DEga1ULx.js.map +1 -0
  4. package/dist/S3StorageController-Btx-6bJ5.js +480 -0
  5. package/dist/S3StorageController-Btx-6bJ5.js.map +1 -0
  6. package/dist/api/errors.d.ts +32 -0
  7. package/dist/api/live-schema-routes.d.ts +27 -3
  8. package/dist/api/mount-path.d.ts +30 -0
  9. package/dist/api/mount.d.ts +6 -13
  10. package/dist/api/rest/api-generator.d.ts +53 -1
  11. package/dist/api/rest/auth-collection-writes.d.ts +28 -21
  12. package/dist/api/rest/field-access-query.d.ts +28 -8
  13. package/dist/api/rest/field-ops.d.ts +19 -7
  14. package/dist/api/rest/query-body.d.ts +10 -0
  15. package/dist/api/rest/write-validation.d.ts +7 -5
  16. package/dist/api/schema-editor-routes.d.ts +10 -1
  17. package/dist/api/sql-export-routes.d.ts +8 -0
  18. package/dist/api/types.d.ts +35 -0
  19. package/dist/{ast-schema-editor-CWqS_sLJ.js → ast-schema-editor-mCeSC03x.js} +3 -3
  20. package/dist/{ast-schema-editor-CWqS_sLJ.js.map → ast-schema-editor-mCeSC03x.js.map} +1 -1
  21. package/dist/auth/access.d.ts +62 -11
  22. package/dist/auth/admin-user-ops.d.ts +24 -2
  23. package/dist/auth/admin-users-route.d.ts +1 -0
  24. package/dist/auth/api-keys/api-key-middleware.d.ts +10 -3
  25. package/dist/auth/api-keys/api-key-routes.d.ts +4 -1
  26. package/dist/auth/builtin-auth-adapter.d.ts +13 -0
  27. package/dist/auth/email-change-routes.d.ts +3 -0
  28. package/dist/auth/expired-token-sweep.d.ts +5 -1
  29. package/dist/auth/interfaces.d.ts +10 -0
  30. package/dist/auth/jwks-routes.d.ts +5 -1
  31. package/dist/auth/jwt-crypto.d.ts +7 -0
  32. package/dist/auth/jwt-keys.d.ts +4 -0
  33. package/dist/auth/jwt.d.ts +282 -166
  34. package/dist/auth/magic-link-routes.d.ts +3 -0
  35. package/dist/auth/mfa-crypto.d.ts +9 -3
  36. package/dist/auth/mfa-gate.d.ts +4 -2
  37. package/dist/auth/mfa-routes.d.ts +6 -0
  38. package/dist/auth/middleware.d.ts +9 -2
  39. package/dist/auth/otp-routes.d.ts +3 -0
  40. package/dist/auth/rate-limiter.d.ts +61 -34
  41. package/dist/auth/registration-policy.d.ts +17 -0
  42. package/dist/auth/require-auth.d.ts +1 -1
  43. package/dist/auth/routes.d.ts +16 -0
  44. package/dist/auth/session-routes.d.ts +6 -0
  45. package/dist/auth/token-revocation.d.ts +6 -0
  46. package/dist/auth/user-picking.d.ts +37 -0
  47. package/dist/auth/verify-credential.d.ts +25 -4
  48. package/dist/{auth-DMLngxn_.js → auth-CSBky1mt.js} +2927 -1882
  49. package/dist/auth-CSBky1mt.js.map +1 -0
  50. package/dist/auth_adapter-CIItCTc8.js +21 -0
  51. package/dist/auth_adapter-CIItCTc8.js.map +1 -0
  52. package/dist/backend/create-backend.d.ts +281 -0
  53. package/dist/backend/default-backend.d.ts +35 -0
  54. package/dist/backend/no-collections.d.ts +19 -0
  55. package/dist/backend/options.d.ts +912 -0
  56. package/dist/backend/scope.d.ts +23 -0
  57. package/dist/backend/services.d.ts +54 -0
  58. package/dist/backend-DTAOsLQc.js.map +1 -1
  59. package/dist/backup/backup-common.d.ts +14 -3
  60. package/dist/backup/backup-routes.d.ts +23 -2
  61. package/dist/backup/backup-storage.d.ts +3 -1
  62. package/dist/backup/index.d.ts +3 -1
  63. package/dist/{backup-CN0s50D2.js → backup-DBGRUVTS.js} +178 -37
  64. package/dist/backup-DBGRUVTS.js.map +1 -0
  65. package/dist/boot/boot.d.ts +2 -2
  66. package/dist/boot/driver.d.ts +3 -0
  67. package/dist/boot/env.d.ts +9 -2
  68. package/dist/boot/http-server.d.ts +22 -0
  69. package/dist/boot/options.d.ts +16 -1
  70. package/dist/boot/provision.d.ts +4 -2
  71. package/dist/boot/resource-adapters.d.ts +11 -14
  72. package/dist/boot/runtime-cors.d.ts +17 -0
  73. package/dist/boot/sources.d.ts +9 -0
  74. package/dist/boot/static-routing.d.ts +9 -0
  75. package/dist/{contract-routes-fz8i4pxs.js → contract-routes-DiFwiLg2.js} +5 -21
  76. package/dist/contract-routes-DiFwiLg2.js.map +1 -0
  77. package/dist/cron/cron-loader.d.ts +77 -18
  78. package/dist/cron/cron-routes.d.ts +1 -1
  79. package/dist/cron/cron-scheduler.d.ts +69 -3
  80. package/dist/cron/cron-store.d.ts +33 -5
  81. package/dist/cron/define-cron.d.ts +6 -2
  82. package/dist/cron/index.d.ts +3 -3
  83. package/dist/cron-loader-NHqRfKF0.js +202 -0
  84. package/dist/cron-loader-NHqRfKF0.js.map +1 -0
  85. package/dist/{cron-routes-Bc-SB0Se.js → cron-routes-DsH8Jwn5.js} +29 -6
  86. package/dist/cron-routes-DsH8Jwn5.js.map +1 -0
  87. package/dist/{cron-scheduler-CYQgco86.js → cron-scheduler-D1DT0nw5.js} +300 -34
  88. package/dist/cron-scheduler-D1DT0nw5.js.map +1 -0
  89. package/dist/cron-store-DEpVstUU.js +577 -0
  90. package/dist/cron-store-DEpVstUU.js.map +1 -0
  91. package/dist/{ddl-bootstrap-BaqMSa4Y.js → ddl-bootstrap-BNqi2NZe.js} +2 -2
  92. package/dist/{ddl-bootstrap-BaqMSa4Y.js.map → ddl-bootstrap-BNqi2NZe.js.map} +1 -1
  93. package/dist/email/smtp-email-service.d.ts +23 -0
  94. package/dist/email/types.d.ts +18 -0
  95. package/dist/env.d.ts +0 -37
  96. package/dist/{errors-D6_y86c5.js → errors-Cqp86KnA.js} +166 -7
  97. package/dist/errors-Cqp86KnA.js.map +1 -0
  98. package/dist/filter-dialect-O1HK6Nvr.js +1628 -0
  99. package/dist/filter-dialect-O1HK6Nvr.js.map +1 -0
  100. package/dist/{function-loader-D7o5Epjj.js → function-loader-DbCSoNJj.js} +69 -39
  101. package/dist/function-loader-DbCSoNJj.js.map +1 -0
  102. package/dist/{function-routes-CaNG4waN.js → function-routes-BSTClQNa.js} +6 -5
  103. package/dist/function-routes-BSTClQNa.js.map +1 -0
  104. package/dist/functions/context.d.ts +9 -0
  105. package/dist/functions/define-function.d.ts +10 -6
  106. package/dist/functions/function-loader.d.ts +75 -18
  107. package/dist/functions/function-routes.d.ts +2 -1
  108. package/dist/functions/index.d.ts +5 -4
  109. package/dist/functions/index.js +59 -15
  110. package/dist/functions/index.js.map +1 -1
  111. package/dist/functions/internal.d.ts +2 -2
  112. package/dist/functions/proxy.d.ts +6 -2
  113. package/dist/functions/request-timeout.d.ts +7 -5
  114. package/dist/history/history-routes.d.ts +9 -0
  115. package/dist/history/retention-sweep.d.ts +81 -0
  116. package/dist/{history-recorder-Nr8zLvoU.js → history-recorder-RZ1Ow4YY.js} +4 -4
  117. package/dist/{history-recorder-Nr8zLvoU.js.map → history-recorder-RZ1Ow4YY.js.map} +1 -1
  118. package/dist/{history-store-rcAm_xFR.js → history-store-DPofGVDp.js} +2 -2
  119. package/dist/{history-store-rcAm_xFR.js.map → history-store-DPofGVDp.js.map} +1 -1
  120. package/dist/index.d.ts +24 -11
  121. package/dist/index.es.js +24758 -20153
  122. package/dist/index.es.js.map +1 -1
  123. package/dist/init/docs.d.ts +35 -10
  124. package/dist/init/process-safety.d.ts +7 -2
  125. package/dist/init/shutdown.d.ts +18 -3
  126. package/dist/init.d.ts +49 -865
  127. package/dist/internal-tables-L2t39RdT.js +136 -0
  128. package/dist/internal-tables-L2t39RdT.js.map +1 -0
  129. package/dist/jobs/job-queue.d.ts +8 -0
  130. package/dist/jobs/job-store.d.ts +24 -0
  131. package/dist/jobs/types.d.ts +25 -4
  132. package/dist/{jobs-DqYNfquG.js → jobs-8G-_agld.js} +235 -25
  133. package/dist/jobs-8G-_agld.js.map +1 -0
  134. package/dist/{jwt-R6bSPMjk.js → jwt-CBaFc34Y.js} +530 -455
  135. package/dist/jwt-CBaFc34Y.js.map +1 -0
  136. package/dist/{keys-GAVZqbqx.js → keys-COzQ2aE8.js} +2 -2
  137. package/dist/{keys-GAVZqbqx.js.map → keys-COzQ2aE8.js.map} +1 -1
  138. package/dist/load-failure-L5hvfDoG.js +80 -0
  139. package/dist/load-failure-L5hvfDoG.js.map +1 -0
  140. package/dist/{logger-D-S-hO5e.js → logger-Bt32sHFw.js} +17 -4
  141. package/dist/logger-Bt32sHFw.js.map +1 -0
  142. package/dist/{logs-routes-DAdv37GI.js → logs-routes-DQJhrf-b.js} +3 -3
  143. package/dist/{logs-routes-DAdv37GI.js.map → logs-routes-DQJhrf-b.js.map} +1 -1
  144. package/dist/mcp/mcp-routes.d.ts +6 -0
  145. package/dist/mcp/mcp-tools.d.ts +8 -0
  146. package/dist/mcp/oauth-routes.d.ts +7 -0
  147. package/dist/metrics/index.d.ts +18 -0
  148. package/dist/metrics/pool-wait.d.ts +50 -0
  149. package/dist/offline-QNQgsPOq-B2yGeXkn.js +3305 -0
  150. package/dist/offline-QNQgsPOq-B2yGeXkn.js.map +1 -0
  151. package/dist/offline-store-Cm5sAX81-CALiO4Gn.js +1915 -0
  152. package/dist/offline-store-Cm5sAX81-CALiO4Gn.js.map +1 -0
  153. package/dist/{openapi-generator-DAq_XVDu.js → openapi-generator-CeGW2dLC.js} +366 -82
  154. package/dist/openapi-generator-CeGW2dLC.js.map +1 -0
  155. package/dist/policy-PdzX-Opd.js +121 -0
  156. package/dist/policy-PdzX-Opd.js.map +1 -0
  157. package/dist/project_manifest-R6y_KHms.js +59 -0
  158. package/dist/project_manifest-R6y_KHms.js.map +1 -0
  159. package/dist/{proxy-qRlqeUmO.js → proxy-BEKbsil6.js} +5 -4
  160. package/dist/proxy-BEKbsil6.js.map +1 -0
  161. package/dist/{query-parser-BgiKJKvc.js → query-parser-ECxP0nDw.js} +511 -16
  162. package/dist/query-parser-ECxP0nDw.js.map +1 -0
  163. package/dist/{request-timeout-DgH7j8qO.js → request-timeout-BiRelY-U.js} +17 -10
  164. package/dist/request-timeout-BiRelY-U.js.map +1 -0
  165. package/dist/resumable-upload-threshold-CKv-Ry0l.js +24 -0
  166. package/dist/resumable-upload-threshold-CKv-Ry0l.js.map +1 -0
  167. package/dist/schema-edit/apply-schema-change.d.ts +10 -0
  168. package/dist/schema-edit/local-source.d.ts +29 -0
  169. package/dist/schema-edit/remote-source.d.ts +13 -3
  170. package/dist/schema-edit/source-editor.d.ts +28 -0
  171. package/dist/{schema-editor-routes-oIyuWl3L.js → schema-editor-routes-DRXBAbZy.js} +55 -11
  172. package/dist/schema-editor-routes-DRXBAbZy.js.map +1 -0
  173. package/dist/services/outbound-post.d.ts +50 -0
  174. package/dist/services/outbound-url-guard.d.ts +34 -5
  175. package/dist/services/routed-realtime-service.d.ts +5 -0
  176. package/dist/services/webhook-service.d.ts +66 -14
  177. package/dist/singleton.d.ts +9 -5
  178. package/dist/soft-delete-params-CBryZXMq.js +668 -0
  179. package/dist/soft-delete-params-CBryZXMq.js.map +1 -0
  180. package/dist/sql-export-routes-D8ZaRvoR.js +240 -0
  181. package/dist/sql-export-routes-D8ZaRvoR.js.map +1 -0
  182. package/dist/{src-CatHFUym.js → src-D5Y3N-S4.js} +2 -1
  183. package/dist/{src-CatHFUym.js.map → src-D5Y3N-S4.js.map} +1 -1
  184. package/dist/storage/GCSStorageController.d.ts +46 -2
  185. package/dist/storage/LocalStorageController.d.ts +67 -2
  186. package/dist/storage/S3StorageController.d.ts +37 -3
  187. package/dist/storage/image-transform.d.ts +15 -0
  188. package/dist/storage/maintenance-routes.d.ts +23 -0
  189. package/dist/storage/maintenance.d.ts +126 -0
  190. package/dist/storage/rendition-cache.d.ts +9 -11
  191. package/dist/storage/request-principals.d.ts +30 -0
  192. package/dist/storage/routes.d.ts +20 -0
  193. package/dist/storage/source-variables.d.ts +10 -0
  194. package/dist/storage/streams.d.ts +42 -0
  195. package/dist/storage/tus-handler.d.ts +46 -2
  196. package/dist/storage/types.d.ts +82 -7
  197. package/dist/storage/upload-validation.d.ts +13 -0
  198. package/dist/storage-resumable-VO-cMpse-C_YX71pO.js +125 -0
  199. package/dist/storage-resumable-VO-cMpse-C_YX71pO.js.map +1 -0
  200. package/dist/strings.es-BeZWAodn.js +256 -0
  201. package/dist/strings.es-BeZWAodn.js.map +1 -0
  202. package/dist/upload-validation-CVobI5xO.js +172 -0
  203. package/dist/upload-validation-CVobI5xO.js.map +1 -0
  204. package/dist/utils/byte-size.d.ts +10 -0
  205. package/dist/utils/compression.d.ts +6 -0
  206. package/dist/utils/load-failure.d.ts +14 -0
  207. package/dist/utils/logger.d.ts +9 -0
  208. package/package.json +5 -5
  209. package/dist/GCSStorageController-BSiP1c-f.js +0 -256
  210. package/dist/GCSStorageController-BSiP1c-f.js.map +0 -1
  211. package/dist/S3StorageController-CAwFRgjV.js +0 -276
  212. package/dist/S3StorageController-CAwFRgjV.js.map +0 -1
  213. package/dist/auth-DMLngxn_.js.map +0 -1
  214. package/dist/backup-CN0s50D2.js.map +0 -1
  215. package/dist/contract-routes-fz8i4pxs.js.map +0 -1
  216. package/dist/cron-loader-CwaANlOG.js +0 -118
  217. package/dist/cron-loader-CwaANlOG.js.map +0 -1
  218. package/dist/cron-routes-Bc-SB0Se.js.map +0 -1
  219. package/dist/cron-scheduler-CYQgco86.js.map +0 -1
  220. package/dist/cron-store-D2Q9-Aco.js +0 -300
  221. package/dist/cron-store-D2Q9-Aco.js.map +0 -1
  222. package/dist/dynamic-import-X40pTZUQ.js +0 -23
  223. package/dist/dynamic-import-X40pTZUQ.js.map +0 -1
  224. package/dist/errors-D6_y86c5.js.map +0 -1
  225. package/dist/function-loader-D7o5Epjj.js.map +0 -1
  226. package/dist/function-routes-CaNG4waN.js.map +0 -1
  227. package/dist/jobs-DqYNfquG.js.map +0 -1
  228. package/dist/jwt-R6bSPMjk.js.map +0 -1
  229. package/dist/logger-D-S-hO5e.js.map +0 -1
  230. package/dist/openapi-generator-DAq_XVDu.js.map +0 -1
  231. package/dist/proxy-qRlqeUmO.js.map +0 -1
  232. package/dist/query-parser-BgiKJKvc.js.map +0 -1
  233. package/dist/request-timeout-DgH7j8qO.js.map +0 -1
  234. package/dist/schema-editor-routes-oIyuWl3L.js.map +0 -1
  235. package/dist/soft-delete-params-BWPilMPF.js +0 -59
  236. package/dist/soft-delete-params-BWPilMPF.js.map +0 -1
  237. package/dist/src-I3aG1PcY.js +0 -6870
  238. package/dist/src-I3aG1PcY.js.map +0 -1
  239. package/dist/types-BfKcm9do.js +0 -39
  240. package/dist/types-BfKcm9do.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-editor-routes-oIyuWl3L.js","names":[],"sources":["../src/api/schema-editor-routes.ts"],"sourcesContent":["import { Hono } from \"hono\";\nimport { z } from \"zod\";\nimport { collectionPatchProblems, isCollectionPatch } from \"@rebasepro/types\";\nimport { AstSchemaEditor } from \"./ast-schema-editor\";\nimport { ApiError, errorHandler } from \"./errors\";\nimport { HonoEnv } from \"./types\";\n\n/**\n * Rewriting collection source from the admin panel.\n *\n * Every refusal in `AstSchemaEditor` is written for the person who will read it\n * — \"Collection X has no file at …\", \"Relation Y has no target collection. Pick\n * one before saving.\" — and every one of them was a plain `Error`, which\n * `errorHandler` treats as an unexpected failure: 500, and a body that says\n * \"Internal Server Error\". The messages never left the server. They are 400s\n * now, so the panel can show what it was told.\n */\nfunction refusalsAsBadRequest<T>(run: () => Promise<T>): Promise<T> {\n return run().catch((error: unknown) => {\n if (error instanceof ApiError) throw error;\n throw ApiError.badRequest(\n error instanceof Error ? error.message : String(error),\n \"SCHEMA_EDIT_REFUSED\"\n );\n });\n}\n\n/** The identifier half of every payload here, checked once. */\nconst collectionIdSchema = z.string().min(1, \"`collectionId` is required\");\nconst propertyKeySchema = z.string().min(1, \"`propertyKey` is required\");\n\nconst propertySaveSchema = z.object({\n collectionId: collectionIdSchema,\n propertyKey: propertyKeySchema,\n propertyConfig: z.record(z.string(), z.unknown())\n});\nconst propertyDeleteSchema = z.object({\n collectionId: collectionIdSchema,\n propertyKey: propertyKeySchema\n});\nconst collectionSaveSchema = z.object({\n collectionId: collectionIdSchema,\n collectionData: z.record(z.string(), z.unknown()).optional(),\n /** What changed about an existing collection — see `collection_patch.ts`. */\n patch: z.array(z.unknown()).optional(),\n partial: z.boolean().optional()\n}).refine(\n save => (save.collectionData === undefined) !== (save.patch === undefined),\n { message: \"send `patch` (what changed) or `collectionData` (a new collection), not both\" }\n);\nconst collectionDeleteSchema = z.object({\n collectionId: collectionIdSchema\n});\n\n/** Parse a body against a schema, or 400 naming the field. */\nasync function body<S extends z.ZodType>(c: { req: { json: () => Promise<unknown> } }, schema: S): Promise<z.infer<S>> {\n const raw = await c.req.json().catch(() => undefined);\n const parsed = schema.safeParse(raw);\n if (!parsed.success) {\n throw ApiError.badRequest(\n parsed.error.issues.map(i => `${i.path.join(\".\") || \"body\"}: ${i.message}`).join(\"; \"),\n \"INVALID_INPUT\"\n );\n }\n return parsed.data;\n}\n\nexport function createSchemaEditorRoutes(collectionsDir: string): Hono<HonoEnv> {\n const router = new Hono<HonoEnv>();\n router.onError(errorHandler);\n const editor = new AstSchemaEditor(collectionsDir);\n\n router.post(\"/property/save\", async (c) => {\n const { collectionId, propertyKey, propertyConfig } = await body(c, propertySaveSchema);\n await refusalsAsBadRequest(() => editor.saveProperty(collectionId, propertyKey, propertyConfig));\n return c.json({ success: true });\n });\n\n router.post(\"/property/delete\", async (c) => {\n const { collectionId, propertyKey } = await body(c, propertyDeleteSchema);\n await refusalsAsBadRequest(() => editor.deleteProperty(collectionId, propertyKey));\n return c.json({ success: true });\n });\n\n /**\n * `partial: true` means \"this payload is what changed\", not \"this is the\n * collection\". Without it a one-key patch — which is what adding a column\n * posts — is read as a whole-collection save and deletes everything it does\n * not mention, `securityRules` included. Absent, it defaults to a full save,\n * so an older panel keeps the behaviour it was written against.\n */\n router.post(\"/collection/save\", async (c) => {\n const { collectionId, collectionData, patch, partial } = await body(c, collectionSaveSchema);\n if (patch !== undefined && !isCollectionPatch(patch)) {\n throw ApiError.badRequest(collectionPatchProblems(patch).join(\" \"), \"INVALID_INPUT\");\n }\n await refusalsAsBadRequest(() => patch\n ? editor.applyPatch(collectionId, patch)\n : editor.saveCollection(collectionId, collectionData ?? {}, { partial: partial === true }));\n return c.json({ success: true });\n });\n\n router.post(\"/collection/delete\", async (c) => {\n const { collectionId } = await body(c, collectionDeleteSchema);\n await refusalsAsBadRequest(() => editor.deleteCollection(collectionId));\n return c.json({ success: true });\n });\n\n return router;\n}\n"],"mappings":"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"}
@@ -1,59 +0,0 @@
1
- import { createRequire as __rebaseCreateRequire } from "module";
2
- import __rebaseProcess from "process";
3
- globalThis.process ??= __rebaseProcess;
4
- __rebaseCreateRequire(import.meta.url);
5
- import { t as ApiError } from "./errors-D6_y86c5.js";
6
- //#region src/api/rest/soft-delete-params.ts
7
- /**
8
- * The two query parameters soft delete adds to the REST surface.
9
- *
10
- * Kept in their own module so the call sites in `query-parser.ts` and the
11
- * delete routes are a single line each: the parsing rules belong to soft
12
- * delete, not to the parser, and a rule spread across the two files that read
13
- * it is a rule that drifts.
14
- */
15
- /** `?deleted=` — what to do about rows a soft delete has stamped. */
16
- var DELETED_QUERY_PARAM = "deleted";
17
- /** `?hard=` — ask for a real `DELETE` on a soft-delete collection. */
18
- var HARD_DELETE_QUERY_PARAM = "hard";
19
- /**
20
- * `?deleted=include|only` → the driver's `withDeleted`.
21
- *
22
- * Spelled `deleted` on the wire and `withDeleted` in the driver, deliberately:
23
- * the URL reads as a question about the rows (`?deleted=only` — "only the
24
- * deleted ones"), and the driver option reads as an instruction about the query.
25
- *
26
- * A value neither word is a 400 rather than a silent fallback to the default.
27
- * `?deleted=true` quietly hiding every deleted row is the worst of both: it
28
- * looks like it worked and answers the opposite question. Absent is the
29
- * default, which is "hide them".
30
- */
31
- function parseWithDeleted(raw) {
32
- if (raw === void 0 || raw === null || raw === "") return void 0;
33
- const value = String(raw).trim().toLowerCase();
34
- if (value === "include") return true;
35
- if (value === "only") return "only";
36
- throw ApiError.badRequest(`Invalid \`?${DELETED_QUERY_PARAM}=${String(raw)}\`. It takes 'include' (live rows and deleted ones) or 'only' (deleted rows alone). Omit it to see only the live rows.`, "INVALID_DELETED_PARAM");
37
- }
38
- /**
39
- * `?hard=true` → a real `DELETE` on a collection that soft-deletes.
40
- *
41
- * Needs no permission beyond the delete it replaces: it is the same verb, and a
42
- * second access-control surface for one operation is a second thing to get
43
- * wrong. What it changes is whether the row can be restored.
44
- *
45
- * Only the exact words `true` and `1` mean yes. Anything else is a 400, not a
46
- * "no" — a typo that silently soft-deletes when the caller asked to purge is a
47
- * caller who believes the data is gone.
48
- */
49
- function parseHardDelete(raw) {
50
- if (raw === void 0 || raw === null || raw === "") return false;
51
- const value = String(raw).trim().toLowerCase();
52
- if (value === "true" || value === "1") return true;
53
- if (value === "false" || value === "0") return false;
54
- throw ApiError.badRequest(`Invalid \`?${HARD_DELETE_QUERY_PARAM}=${String(raw)}\`. It takes 'true' or 'false'.`, "INVALID_HARD_PARAM");
55
- }
56
- //#endregion
57
- export { parseWithDeleted as i, HARD_DELETE_QUERY_PARAM as n, parseHardDelete as r, DELETED_QUERY_PARAM as t };
58
-
59
- //# sourceMappingURL=soft-delete-params-BWPilMPF.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"soft-delete-params-BWPilMPF.js","names":[],"sources":["../src/api/rest/soft-delete-params.ts"],"sourcesContent":["import { ApiError } from \"../errors\";\n\n/**\n * The two query parameters soft delete adds to the REST surface.\n *\n * Kept in their own module so the call sites in `query-parser.ts` and the\n * delete routes are a single line each: the parsing rules belong to soft\n * delete, not to the parser, and a rule spread across the two files that read\n * it is a rule that drifts.\n */\n\n/** `?deleted=` — what to do about rows a soft delete has stamped. */\nexport const DELETED_QUERY_PARAM = \"deleted\";\n/** `?hard=` — ask for a real `DELETE` on a soft-delete collection. */\nexport const HARD_DELETE_QUERY_PARAM = \"hard\";\n\n/**\n * `?deleted=include|only` → the driver's `withDeleted`.\n *\n * Spelled `deleted` on the wire and `withDeleted` in the driver, deliberately:\n * the URL reads as a question about the rows (`?deleted=only` — \"only the\n * deleted ones\"), and the driver option reads as an instruction about the query.\n *\n * A value neither word is a 400 rather than a silent fallback to the default.\n * `?deleted=true` quietly hiding every deleted row is the worst of both: it\n * looks like it worked and answers the opposite question. Absent is the\n * default, which is \"hide them\".\n */\nexport function parseWithDeleted(raw: unknown): boolean | \"only\" | undefined {\n if (raw === undefined || raw === null || raw === \"\") return undefined;\n const value = String(raw).trim().toLowerCase();\n if (value === \"include\") return true;\n if (value === \"only\") return \"only\";\n throw ApiError.badRequest(\n `Invalid \\`?${DELETED_QUERY_PARAM}=${String(raw)}\\`. It takes 'include' (live rows and deleted ones) ` +\n \"or 'only' (deleted rows alone). Omit it to see only the live rows.\",\n \"INVALID_DELETED_PARAM\"\n );\n}\n\n/**\n * `?hard=true` → a real `DELETE` on a collection that soft-deletes.\n *\n * Needs no permission beyond the delete it replaces: it is the same verb, and a\n * second access-control surface for one operation is a second thing to get\n * wrong. What it changes is whether the row can be restored.\n *\n * Only the exact words `true` and `1` mean yes. Anything else is a 400, not a\n * \"no\" — a typo that silently soft-deletes when the caller asked to purge is a\n * caller who believes the data is gone.\n */\nexport function parseHardDelete(raw: unknown): boolean {\n if (raw === undefined || raw === null || raw === \"\") return false;\n const value = String(raw).trim().toLowerCase();\n if (value === \"true\" || value === \"1\") return true;\n if (value === \"false\" || value === \"0\") return false;\n throw ApiError.badRequest(\n `Invalid \\`?${HARD_DELETE_QUERY_PARAM}=${String(raw)}\\`. It takes 'true' or 'false'.`,\n \"INVALID_HARD_PARAM\"\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAYA,IAAa,sBAAsB;;AAEnC,IAAa,0BAA0B;;;;;;;;;;;;;AAcvC,SAAgB,iBAAiB,KAA4C;CACzE,IAAI,QAAQ,KAAA,KAAa,QAAQ,QAAQ,QAAQ,IAAI,OAAO,KAAA;CAC5D,MAAM,QAAQ,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,YAAY;CAC7C,IAAI,UAAU,WAAW,OAAO;CAChC,IAAI,UAAU,QAAQ,OAAO;CAC7B,MAAM,SAAS,WACX,cAAc,oBAAoB,GAAG,OAAO,GAAG,EAAE,yHAEjD,uBACJ;AACJ;;;;;;;;;;;;AAaA,SAAgB,gBAAgB,KAAuB;CACnD,IAAI,QAAQ,KAAA,KAAa,QAAQ,QAAQ,QAAQ,IAAI,OAAO;CAC5D,MAAM,QAAQ,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,YAAY;CAC7C,IAAI,UAAU,UAAU,UAAU,KAAK,OAAO;CAC9C,IAAI,UAAU,WAAW,UAAU,KAAK,OAAO;CAC/C,MAAM,SAAS,WACX,cAAc,wBAAwB,GAAG,OAAO,GAAG,EAAE,kCACrD,oBACJ;AACJ"}