@palbase/backend 22.1.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.
- package/dist/bin/palbase-backend.cjs +750 -40
- package/dist/bin/palbase-backend.cjs.map +1 -1
- package/dist/bin/palbase-backend.js +5 -5
- package/dist/{chunk-YL4C5NRY.js → chunk-HQRJDARQ.js} +2 -2
- package/dist/{chunk-74XDEF5J.js → chunk-M5MCBWJI.js} +723 -37
- package/dist/chunk-M5MCBWJI.js.map +1 -0
- package/dist/{chunk-W5ODXPY3.js → chunk-NS5V43YQ.js} +14 -1
- package/dist/chunk-NS5V43YQ.js.map +1 -0
- package/dist/{chunk-SQC5EIWY.js → chunk-OHALWEOG.js} +19 -9
- package/dist/chunk-OHALWEOG.js.map +1 -0
- package/dist/{chunk-I3ON7MYF.js → chunk-PY7YJDCT.js} +129 -18
- package/dist/chunk-PY7YJDCT.js.map +1 -0
- package/dist/{chunk-N32VDWKH.js → chunk-R3KN6RHD.js} +4 -59
- package/dist/chunk-R3KN6RHD.js.map +1 -0
- package/dist/{chunk-QMVK4X3V.js → chunk-RCLNBJCM.js} +98 -98
- package/dist/chunk-RCLNBJCM.js.map +1 -0
- package/dist/db/env.cjs.map +1 -1
- package/dist/db/env.d.cts +3 -21
- package/dist/db/env.d.ts +3 -21
- package/dist/db/index.cjs +140 -16
- package/dist/db/index.cjs.map +1 -1
- package/dist/db/index.d.cts +3 -2
- package/dist/db/index.d.ts +3 -2
- package/dist/db/index.js +2 -2
- package/dist/{endpoint-BVT6jcVW.d.cts → endpoint-CVWXh6oG.d.ts} +147 -15
- package/dist/{endpoint-BVT6jcVW.d.ts → endpoint-c9h5jriX.d.cts} +147 -15
- package/dist/engine/index.cjs +750 -40
- package/dist/engine/index.cjs.map +1 -1
- package/dist/engine/index.d.cts +6 -5
- package/dist/engine/index.d.ts +6 -5
- package/dist/engine/index.js +4 -4
- package/dist/{index-BS1gW4nV.d.cts → index-BZrJXnVh.d.ts} +142 -72
- package/dist/{index-BqCiHao8.d.cts → index-By8Dle5U.d.cts} +196 -21
- package/dist/{index-vwHoS0l2.d.ts → index-CwAJ7HEe.d.ts} +196 -21
- package/dist/{index-CCZqzych.d.ts → index-CxeQSfJP.d.cts} +142 -72
- package/dist/index.cjs +388 -1101
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +89 -1134
- package/dist/index.d.ts +89 -1134
- package/dist/index.js +133 -902
- package/dist/index.js.map +1 -1
- package/dist/openapi/index.cjs +32 -61
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.d.cts +6 -2
- package/dist/openapi/index.d.ts +6 -2
- package/dist/openapi/index.js +34 -26
- package/dist/openapi/index.js.map +1 -1
- package/dist/{registry-Bsuf-orT.d.ts → registry-B3niOVYp.d.ts} +108 -170
- package/dist/{registry-BWttGlaT.d.cts → registry-CqPK2Qby.d.cts} +108 -170
- package/dist/{purchases/keys.cjs → stack.cjs} +4 -4
- package/dist/stack.cjs.map +1 -0
- package/dist/stack.d.cts +76 -0
- package/dist/stack.d.ts +76 -0
- package/dist/stack.js +1 -0
- package/dist/test/index.cjs +482 -9
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.d.cts +35 -3
- package/dist/test/index.d.ts +35 -3
- package/dist/test/index.js +480 -8
- package/dist/test/index.js.map +1 -1
- package/docs/README.md +7 -6
- package/docs/llms-full.txt +7 -260
- package/docs/llms.txt +0 -2
- package/package.json +9 -8
- package/stager/return_types.js +23 -0
- package/template/package.json +1 -1
- package/dist/chunk-74XDEF5J.js.map +0 -1
- package/dist/chunk-I3ON7MYF.js.map +0 -1
- package/dist/chunk-N32VDWKH.js.map +0 -1
- package/dist/chunk-QMVK4X3V.js.map +0 -1
- package/dist/chunk-SQC5EIWY.js.map +0 -1
- package/dist/chunk-W5ODXPY3.js.map +0 -1
- package/dist/purchases/keys.cjs.map +0 -1
- package/dist/purchases/keys.d.cts +0 -42
- package/dist/purchases/keys.d.ts +0 -42
- package/dist/purchases/keys.js +0 -1
- package/docs/config.md +0 -147
- package/docs/resources.md +0 -97
- package/template/config/secrets.ts +0 -24
- /package/dist/{chunk-YL4C5NRY.js.map → chunk-HQRJDARQ.js.map} +0 -0
- /package/dist/{purchases/keys.js.map → stack.js.map} +0 -0
package/dist/openapi/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { OpenApiGeneratorV31 } from '@asteasolutions/zod-to-openapi';
|
|
2
2
|
import { ZodTypeAny } from 'zod';
|
|
3
|
-
import { A as AuthSpec, R as RateLimitConfig } from '../endpoint-
|
|
4
|
-
import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig } from '../registry-
|
|
3
|
+
import { A as AuthSpec, R as RateLimitConfig } from '../endpoint-c9h5jriX.cjs';
|
|
4
|
+
import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig, S as SseConfig } from '../registry-CqPK2Qby.cjs';
|
|
5
|
+
import '../stack.cjs';
|
|
5
6
|
|
|
6
7
|
/** A controller class (constructor). Kept loose — the only contract is that it
|
|
7
8
|
* is a `@Controller`-decorated class, asserted via {@link isController}. */
|
|
@@ -57,6 +58,9 @@ interface FlatRoute {
|
|
|
57
58
|
* presence MARKS this as an upload route through openapi + codegen (the bytes
|
|
58
59
|
* go client→storage; the method body is the completion handler). */
|
|
59
60
|
uploadConfig?: UploadConfig;
|
|
61
|
+
/** Present ONLY on `@Sse` routes — the marker the converter turns into
|
|
62
|
+
* `x-palbase-sse`. */
|
|
63
|
+
sseConfig?: SseConfig;
|
|
60
64
|
}
|
|
61
65
|
/**
|
|
62
66
|
* Flatten a `@Controller` class into its route entries. The full path is
|
package/dist/openapi/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { OpenApiGeneratorV31 } from '@asteasolutions/zod-to-openapi';
|
|
2
2
|
import { ZodTypeAny } from 'zod';
|
|
3
|
-
import { A as AuthSpec, R as RateLimitConfig } from '../endpoint-
|
|
4
|
-
import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig } from '../registry-
|
|
3
|
+
import { A as AuthSpec, R as RateLimitConfig } from '../endpoint-CVWXh6oG.js';
|
|
4
|
+
import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig, S as SseConfig } from '../registry-B3niOVYp.js';
|
|
5
|
+
import '../stack.js';
|
|
5
6
|
|
|
6
7
|
/** A controller class (constructor). Kept loose — the only contract is that it
|
|
7
8
|
* is a `@Controller`-decorated class, asserted via {@link isController}. */
|
|
@@ -57,6 +58,9 @@ interface FlatRoute {
|
|
|
57
58
|
* presence MARKS this as an upload route through openapi + codegen (the bytes
|
|
58
59
|
* go client→storage; the method body is the completion handler). */
|
|
59
60
|
uploadConfig?: UploadConfig;
|
|
61
|
+
/** Present ONLY on `@Sse` routes — the marker the converter turns into
|
|
62
|
+
* `x-palbase-sse`. */
|
|
63
|
+
sseConfig?: SseConfig;
|
|
60
64
|
}
|
|
61
65
|
/**
|
|
62
66
|
* Flatten a `@Controller` class into its route entries. The full path is
|
package/dist/openapi/index.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
spendFor
|
|
5
|
-
} from "../chunk-N32VDWKH.js";
|
|
2
|
+
getErrorRegistry
|
|
3
|
+
} from "../chunk-R3KN6RHD.js";
|
|
6
4
|
import {
|
|
7
5
|
isController,
|
|
8
6
|
resolveController
|
|
9
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-HQRJDARQ.js";
|
|
10
8
|
import {
|
|
11
9
|
getRoutes
|
|
12
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-RCLNBJCM.js";
|
|
13
11
|
import {
|
|
14
12
|
__commonJS,
|
|
15
13
|
__require,
|
|
@@ -5792,19 +5790,6 @@ var import_fast_glob = __toESM(require_out4(), 1);
|
|
|
5792
5790
|
import path from "path";
|
|
5793
5791
|
import { pathToFileURL } from "url";
|
|
5794
5792
|
|
|
5795
|
-
// src/purchases/openapi.ts
|
|
5796
|
-
function purchaseThrows(ctor, fnName) {
|
|
5797
|
-
const out = [];
|
|
5798
|
-
if (entitlementFor(ctor, fnName) !== void 0) {
|
|
5799
|
-
out.push({ name: "EntitlementRequired", code: "entitlement_required" });
|
|
5800
|
-
}
|
|
5801
|
-
if (spendFor(ctor, fnName) !== void 0) {
|
|
5802
|
-
out.push({ name: "QuotaExceeded", code: "quota_exceeded" });
|
|
5803
|
-
out.push({ name: "CreditInsufficient", code: "credit_insufficient" });
|
|
5804
|
-
}
|
|
5805
|
-
return out;
|
|
5806
|
-
}
|
|
5807
|
-
|
|
5808
5793
|
// src/openapi/discover.ts
|
|
5809
5794
|
function capitalizeSegment(s) {
|
|
5810
5795
|
if (s.length === 0) return s;
|
|
@@ -5851,6 +5836,20 @@ function flattenController(controller) {
|
|
|
5851
5836
|
const meta = resolveController(controller);
|
|
5852
5837
|
const controllerName = deriveControllerName(controller.name);
|
|
5853
5838
|
const routes = getRoutes(controller);
|
|
5839
|
+
const kindsByMethod = /* @__PURE__ */ new Map();
|
|
5840
|
+
for (const route of routes) {
|
|
5841
|
+
const seen = kindsByMethod.get(route.fnName) ?? { sse: false, upload: false };
|
|
5842
|
+
if (route.options.sseConfig !== void 0) seen.sse = true;
|
|
5843
|
+
if (route.options.uploadConfig !== void 0) seen.upload = true;
|
|
5844
|
+
kindsByMethod.set(route.fnName, seen);
|
|
5845
|
+
}
|
|
5846
|
+
for (const [fnName, seen] of kindsByMethod) {
|
|
5847
|
+
if (seen.sse && seen.upload) {
|
|
5848
|
+
throw new Error(
|
|
5849
|
+
`${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.`
|
|
5850
|
+
);
|
|
5851
|
+
}
|
|
5852
|
+
}
|
|
5854
5853
|
const out = [];
|
|
5855
5854
|
for (const route of routes) {
|
|
5856
5855
|
const fullPath = joinControllerPath(meta.basePath, route.subpath);
|
|
@@ -5875,11 +5874,9 @@ function flattenController(controller) {
|
|
|
5875
5874
|
break;
|
|
5876
5875
|
}
|
|
5877
5876
|
}
|
|
5878
|
-
const purchases = purchaseThrows(controller, route.fnName);
|
|
5879
5877
|
const seen = new Set((route.throws ?? []).map((t) => t.code));
|
|
5880
5878
|
const allThrows = [
|
|
5881
|
-
...route.throws ?? []
|
|
5882
|
-
...purchases.filter((t) => !seen.has(t.code))
|
|
5879
|
+
...route.throws ?? []
|
|
5883
5880
|
];
|
|
5884
5881
|
out.push({
|
|
5885
5882
|
method: route.method,
|
|
@@ -5893,7 +5890,8 @@ function flattenController(controller) {
|
|
|
5893
5890
|
...route.returnSchema !== void 0 ? { returnSchema: route.returnSchema } : {},
|
|
5894
5891
|
...route.options.rateLimit !== void 0 ? { rateLimit: route.options.rateLimit } : {},
|
|
5895
5892
|
...allThrows.length > 0 ? { throws: allThrows } : {},
|
|
5896
|
-
...route.options.uploadConfig !== void 0 ? { uploadConfig: route.options.uploadConfig } : {}
|
|
5893
|
+
...route.options.uploadConfig !== void 0 ? { uploadConfig: route.options.uploadConfig } : {},
|
|
5894
|
+
...route.options.sseConfig !== void 0 ? { sseConfig: route.options.sseConfig } : {}
|
|
5897
5895
|
});
|
|
5898
5896
|
}
|
|
5899
5897
|
return out;
|
|
@@ -5991,7 +5989,8 @@ function registerControllerRoute(registry, route) {
|
|
|
5991
5989
|
returnSchema: route.returnSchema,
|
|
5992
5990
|
effectiveAuth: route.effectiveAuth,
|
|
5993
5991
|
throws: route.throws,
|
|
5994
|
-
...route.uploadConfig !== void 0 ? { uploadConfig: route.uploadConfig } : {}
|
|
5992
|
+
...route.uploadConfig !== void 0 ? { uploadConfig: route.uploadConfig } : {},
|
|
5993
|
+
...route.sseConfig !== void 0 ? { sseConfig: route.sseConfig } : {}
|
|
5995
5994
|
});
|
|
5996
5995
|
}
|
|
5997
5996
|
function registerOperation(registry, op) {
|
|
@@ -6012,7 +6011,11 @@ function registerOperation(registry, op) {
|
|
|
6012
6011
|
description: "Success",
|
|
6013
6012
|
content: {
|
|
6014
6013
|
"application/json": {
|
|
6015
|
-
|
|
6014
|
+
// A streaming operation's response is ONE FRAME, and its schema is the
|
|
6015
|
+
// declared frame — not the handler's return type, which is void. Without
|
|
6016
|
+
// this the document describes an untyped response and every generated
|
|
6017
|
+
// client is opaque (measured live: the contract gate refuses the deploy).
|
|
6018
|
+
schema: op.sseConfig !== void 0 ? op.sseConfig.frame : op.returnSchema !== void 0 ? op.returnSchema : z.unknown()
|
|
6016
6019
|
}
|
|
6017
6020
|
}
|
|
6018
6021
|
},
|
|
@@ -6059,7 +6062,12 @@ function registerOperation(registry, op) {
|
|
|
6059
6062
|
bucket: op.uploadConfig.bucket,
|
|
6060
6063
|
pathTemplate: op.uploadConfig.pathTemplate
|
|
6061
6064
|
}
|
|
6062
|
-
} : {}
|
|
6065
|
+
} : {},
|
|
6066
|
+
// Without this extension the document describes a streaming route as a
|
|
6067
|
+
// plain POST, and every client generated from it reads the body ONCE
|
|
6068
|
+
// instead of iterating frames — a generated client that compiles, runs and
|
|
6069
|
+
// is simply wrong. Same failure class as the upload extension above.
|
|
6070
|
+
...op.sseConfig !== void 0 ? { "x-palbase-sse": {} } : {}
|
|
6063
6071
|
});
|
|
6064
6072
|
}
|
|
6065
6073
|
function resolveThrows(throws) {
|