@palbase/backend 23.0.0 → 23.1.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.
Files changed (60) hide show
  1. package/dist/bin/palbase-backend.cjs +313 -24
  2. package/dist/bin/palbase-backend.cjs.map +1 -1
  3. package/dist/bin/palbase-backend.js +5 -5
  4. package/dist/{chunk-Y5HXVUMP.js → chunk-HQRJDARQ.js} +2 -2
  5. package/dist/{chunk-REZU6UKT.js → chunk-M5MCBWJI.js} +296 -25
  6. package/dist/chunk-M5MCBWJI.js.map +1 -0
  7. package/dist/{chunk-W5ODXPY3.js → chunk-NS5V43YQ.js} +14 -1
  8. package/dist/chunk-NS5V43YQ.js.map +1 -0
  9. package/dist/{chunk-FSGSB42K.js → chunk-OHALWEOG.js} +9 -4
  10. package/dist/chunk-OHALWEOG.js.map +1 -0
  11. package/dist/{chunk-HAF67F2H.js → chunk-PY7YJDCT.js} +57 -3
  12. package/dist/chunk-PY7YJDCT.js.map +1 -0
  13. package/dist/{chunk-ZC6Q2BRD.js → chunk-R3KN6RHD.js} +2 -2
  14. package/dist/{chunk-OMRTHM4X.js → chunk-RCLNBJCM.js} +1 -1
  15. package/dist/chunk-RCLNBJCM.js.map +1 -0
  16. package/dist/db/index.cjs +68 -1
  17. package/dist/db/index.cjs.map +1 -1
  18. package/dist/db/index.d.cts +2 -2
  19. package/dist/db/index.d.ts +2 -2
  20. package/dist/db/index.js +2 -2
  21. package/dist/{endpoint-BavvbW4P.d.ts → endpoint-CVWXh6oG.d.ts} +70 -8
  22. package/dist/{endpoint-i8TTCohk.d.cts → endpoint-c9h5jriX.d.cts} +70 -8
  23. package/dist/engine/index.cjs +313 -24
  24. package/dist/engine/index.cjs.map +1 -1
  25. package/dist/engine/index.d.cts +4 -4
  26. package/dist/engine/index.d.ts +4 -4
  27. package/dist/engine/index.js +4 -4
  28. package/dist/{index-B7YBEG5w.d.ts → index-BZrJXnVh.d.ts} +49 -4
  29. package/dist/{index-Bmvx1EvJ.d.cts → index-By8Dle5U.d.cts} +86 -17
  30. package/dist/{index-B3jmmItD.d.ts → index-CwAJ7HEe.d.ts} +86 -17
  31. package/dist/{index-E7OscPJT.d.cts → index-CxeQSfJP.d.cts} +49 -4
  32. package/dist/index.cjs +104 -3
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.cts +8 -8
  35. package/dist/index.d.ts +8 -8
  36. package/dist/index.js +32 -6
  37. package/dist/index.js.map +1 -1
  38. package/dist/openapi/index.cjs +29 -4
  39. package/dist/openapi/index.cjs.map +1 -1
  40. package/dist/openapi/index.d.cts +5 -2
  41. package/dist/openapi/index.d.ts +5 -2
  42. package/dist/openapi/index.js +32 -7
  43. package/dist/openapi/index.js.map +1 -1
  44. package/dist/{registry-DY3d9l1k.d.ts → registry-B3niOVYp.d.ts} +101 -7
  45. package/dist/{registry-C3H2uPeZ.d.cts → registry-CqPK2Qby.d.cts} +101 -7
  46. package/dist/test/index.cjs +482 -9
  47. package/dist/test/index.cjs.map +1 -1
  48. package/dist/test/index.d.cts +35 -3
  49. package/dist/test/index.d.ts +35 -3
  50. package/dist/test/index.js +480 -8
  51. package/dist/test/index.js.map +1 -1
  52. package/package.json +4 -3
  53. package/stager/return_types.js +23 -0
  54. package/dist/chunk-FSGSB42K.js.map +0 -1
  55. package/dist/chunk-HAF67F2H.js.map +0 -1
  56. package/dist/chunk-OMRTHM4X.js.map +0 -1
  57. package/dist/chunk-REZU6UKT.js.map +0 -1
  58. package/dist/chunk-W5ODXPY3.js.map +0 -1
  59. /package/dist/{chunk-Y5HXVUMP.js.map → chunk-HQRJDARQ.js.map} +0 -0
  60. /package/dist/{chunk-ZC6Q2BRD.js.map → chunk-R3KN6RHD.js.map} +0 -0
@@ -6014,6 +6014,20 @@ function flattenController(controller) {
6014
6014
  const meta = resolveController(controller);
6015
6015
  const controllerName = deriveControllerName(controller.name);
6016
6016
  const routes = getRoutes(controller);
6017
+ const kindsByMethod = /* @__PURE__ */ new Map();
6018
+ for (const route of routes) {
6019
+ const seen = kindsByMethod.get(route.fnName) ?? { sse: false, upload: false };
6020
+ if (route.options.sseConfig !== void 0) seen.sse = true;
6021
+ if (route.options.uploadConfig !== void 0) seen.upload = true;
6022
+ kindsByMethod.set(route.fnName, seen);
6023
+ }
6024
+ for (const [fnName, seen] of kindsByMethod) {
6025
+ if (seen.sse && seen.upload) {
6026
+ throw new Error(
6027
+ `${controller.name}.${fnName} declares BOTH @Sse and @Upload. One method cannot be both a streaming response and an upload completion handler \u2014 the two describe the same handler twice and the second one read silently wins. Split them into two methods.`
6028
+ );
6029
+ }
6030
+ }
6017
6031
  const out = [];
6018
6032
  for (const route of routes) {
6019
6033
  const fullPath = joinControllerPath(meta.basePath, route.subpath);
@@ -6054,7 +6068,8 @@ function flattenController(controller) {
6054
6068
  ...route.returnSchema !== void 0 ? { returnSchema: route.returnSchema } : {},
6055
6069
  ...route.options.rateLimit !== void 0 ? { rateLimit: route.options.rateLimit } : {},
6056
6070
  ...allThrows.length > 0 ? { throws: allThrows } : {},
6057
- ...route.options.uploadConfig !== void 0 ? { uploadConfig: route.options.uploadConfig } : {}
6071
+ ...route.options.uploadConfig !== void 0 ? { uploadConfig: route.options.uploadConfig } : {},
6072
+ ...route.options.sseConfig !== void 0 ? { sseConfig: route.options.sseConfig } : {}
6058
6073
  });
6059
6074
  }
6060
6075
  return out;
@@ -6152,7 +6167,8 @@ function registerControllerRoute(registry, route) {
6152
6167
  returnSchema: route.returnSchema,
6153
6168
  effectiveAuth: route.effectiveAuth,
6154
6169
  throws: route.throws,
6155
- ...route.uploadConfig !== void 0 ? { uploadConfig: route.uploadConfig } : {}
6170
+ ...route.uploadConfig !== void 0 ? { uploadConfig: route.uploadConfig } : {},
6171
+ ...route.sseConfig !== void 0 ? { sseConfig: route.sseConfig } : {}
6156
6172
  });
6157
6173
  }
6158
6174
  function registerOperation(registry, op) {
@@ -6173,7 +6189,11 @@ function registerOperation(registry, op) {
6173
6189
  description: "Success",
6174
6190
  content: {
6175
6191
  "application/json": {
6176
- schema: op.returnSchema !== void 0 ? op.returnSchema : import_zod2.z.unknown()
6192
+ // A streaming operation's response is ONE FRAME, and its schema is the
6193
+ // declared frame — not the handler's return type, which is void. Without
6194
+ // this the document describes an untyped response and every generated
6195
+ // client is opaque (measured live: the contract gate refuses the deploy).
6196
+ schema: op.sseConfig !== void 0 ? op.sseConfig.frame : op.returnSchema !== void 0 ? op.returnSchema : import_zod2.z.unknown()
6177
6197
  }
6178
6198
  }
6179
6199
  },
@@ -6220,7 +6240,12 @@ function registerOperation(registry, op) {
6220
6240
  bucket: op.uploadConfig.bucket,
6221
6241
  pathTemplate: op.uploadConfig.pathTemplate
6222
6242
  }
6223
- } : {}
6243
+ } : {},
6244
+ // Without this extension the document describes a streaming route as a
6245
+ // plain POST, and every client generated from it reads the body ONCE
6246
+ // instead of iterating frames — a generated client that compiles, runs and
6247
+ // is simply wrong. Same failure class as the upload extension above.
6248
+ ...op.sseConfig !== void 0 ? { "x-palbase-sse": {} } : {}
6224
6249
  });
6225
6250
  }
6226
6251
  function resolveThrows(throws) {