@palbase/backend 22.0.1 → 23.0.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 +764 -25
- package/dist/bin/palbase-backend.cjs.map +1 -1
- package/dist/bin/palbase-backend.js +4 -4
- package/dist/{chunk-POYAFBLF.js → chunk-FSGSB42K.js} +13 -6
- package/dist/chunk-FSGSB42K.js.map +1 -0
- package/dist/{chunk-SSGAMC26.js → chunk-HAF67F2H.js} +114 -5
- package/dist/chunk-HAF67F2H.js.map +1 -0
- package/dist/{chunk-QMVK4X3V.js → chunk-OMRTHM4X.js} +98 -98
- package/dist/chunk-OMRTHM4X.js.map +1 -0
- package/dist/{chunk-QYOHMVUW.js → chunk-REZU6UKT.js} +755 -24
- package/dist/chunk-REZU6UKT.js.map +1 -0
- package/dist/{chunk-YL4C5NRY.js → chunk-Y5HXVUMP.js} +2 -2
- package/dist/{chunk-N32VDWKH.js → chunk-ZC6Q2BRD.js} +4 -59
- package/dist/chunk-ZC6Q2BRD.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 +117 -6
- 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 +7 -3
- package/dist/{endpoint-B0LpZixz.d.cts → endpoint-BavvbW4P.d.ts} +116 -14
- package/dist/{endpoint-B0LpZixz.d.ts → endpoint-i8TTCohk.d.cts} +116 -14
- package/dist/engine/index.cjs +764 -25
- 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 +3 -3
- package/dist/{index-g-EzitI-.d.ts → index-B3jmmItD.d.ts} +203 -7
- package/dist/{index-BCNtlG1w.d.ts → index-B7YBEG5w.d.ts} +117 -93
- package/dist/{index-BGSCWlUa.d.cts → index-Bmvx1EvJ.d.cts} +203 -7
- package/dist/{index-B4W6d2VJ.d.cts → index-E7OscPJT.d.cts} +117 -93
- package/dist/index.cjs +509 -1085
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +203 -1133
- package/dist/index.d.ts +203 -1133
- package/dist/index.js +288 -900
- package/dist/index.js.map +1 -1
- package/dist/openapi/index.cjs +3 -57
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.d.cts +3 -2
- package/dist/openapi/index.d.ts +3 -2
- package/dist/openapi/index.js +5 -22
- package/dist/openapi/index.js.map +1 -1
- package/dist/{registry-3BLYv4si.d.ts → registry-C3H2uPeZ.d.cts} +13 -169
- package/dist/{registry-Cw0YEYCg.d.cts → registry-DY3d9l1k.d.ts} +13 -169
- 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/docs/README.md +7 -6
- package/docs/endpoints.md +1 -1
- package/docs/errors.md +9 -0
- package/docs/llms-full.txt +17 -261
- package/docs/llms.txt +0 -2
- package/package.json +7 -7
- package/template/package.json +1 -1
- package/dist/chunk-N32VDWKH.js.map +0 -1
- package/dist/chunk-POYAFBLF.js.map +0 -1
- package/dist/chunk-QMVK4X3V.js.map +0 -1
- package/dist/chunk-QYOHMVUW.js.map +0 -1
- package/dist/chunk-SSGAMC26.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-Y5HXVUMP.js.map} +0 -0
- /package/dist/{purchases/keys.js.map → stack.js.map} +0 -0
package/dist/openapi/index.cjs
CHANGED
|
@@ -5857,27 +5857,7 @@ var BUILTIN_DATA_SCHEMAS = {
|
|
|
5857
5857
|
bad_request: import_zod.z.object({
|
|
5858
5858
|
fields: import_zod.z.array(import_zod.z.object({ field: import_zod.z.string(), message: import_zod.z.string() }))
|
|
5859
5859
|
}),
|
|
5860
|
-
too_many_requests: import_zod.z.object({ retryAfter: import_zod.z.number().int() })
|
|
5861
|
-
// Purchases (@RequireEntitlement / @Spend). Their payloads are what make a
|
|
5862
|
-
// paywall renderable on the client: WHICH entitlement was missing, and for a
|
|
5863
|
-
// spend the real ceiling and reset time rather than a guessed retry delay.
|
|
5864
|
-
entitlement_required: import_zod.z.object({ entitlement: import_zod.z.string().nullable() }),
|
|
5865
|
-
quota_exceeded: import_zod.z.object({
|
|
5866
|
-
key: import_zod.z.string(),
|
|
5867
|
-
scope: import_zod.z.string(),
|
|
5868
|
-
window: import_zod.z.string(),
|
|
5869
|
-
used: import_zod.z.number().int(),
|
|
5870
|
-
reserved: import_zod.z.number().int(),
|
|
5871
|
-
max: import_zod.z.number().int(),
|
|
5872
|
-
remaining: import_zod.z.number().int(),
|
|
5873
|
-
resetAt: import_zod.z.string()
|
|
5874
|
-
}),
|
|
5875
|
-
credit_insufficient: import_zod.z.object({
|
|
5876
|
-
key: import_zod.z.string(),
|
|
5877
|
-
balance: import_zod.z.number().int(),
|
|
5878
|
-
reserved: import_zod.z.number().int(),
|
|
5879
|
-
remaining: import_zod.z.number().int()
|
|
5880
|
-
})
|
|
5860
|
+
too_many_requests: import_zod.z.object({ retryAfter: import_zod.z.number().int() })
|
|
5881
5861
|
};
|
|
5882
5862
|
function getErrorRegistry() {
|
|
5883
5863
|
const g = globalThis;
|
|
@@ -5889,13 +5869,7 @@ function getErrorRegistry() {
|
|
|
5889
5869
|
["forbidden", 403, "Forbidden"],
|
|
5890
5870
|
["not_found", 404, "NotFound"],
|
|
5891
5871
|
["conflict", 409, "Conflict"],
|
|
5892
|
-
["too_many_requests", 429, "TooManyRequests"]
|
|
5893
|
-
// Thrown by the purchases decorators, so they are pre-seeded like the
|
|
5894
|
-
// other built-ins: a project never declares them, but every gated or
|
|
5895
|
-
// metered route must surface them as TYPED errors on the client.
|
|
5896
|
-
["entitlement_required", 403, "EntitlementRequired"],
|
|
5897
|
-
["quota_exceeded", 429, "QuotaExceeded"],
|
|
5898
|
-
["credit_insufficient", 429, "CreditInsufficient"]
|
|
5872
|
+
["too_many_requests", 429, "TooManyRequests"]
|
|
5899
5873
|
]) {
|
|
5900
5874
|
const dataSchema = BUILTIN_DATA_SCHEMAS[code];
|
|
5901
5875
|
m.set(code, {
|
|
@@ -5994,32 +5968,6 @@ function resolveController(ctor) {
|
|
|
5994
5968
|
return meta;
|
|
5995
5969
|
}
|
|
5996
5970
|
|
|
5997
|
-
// src/purchases/registry.ts
|
|
5998
|
-
var ENTITLEMENTS = /* @__PURE__ */ Symbol.for("palbase.backend.purchases.entitlements");
|
|
5999
|
-
var SPENDS = /* @__PURE__ */ Symbol.for("palbase.backend.purchases.spends");
|
|
6000
|
-
function carrierOf2(target) {
|
|
6001
|
-
return typeof target === "function" ? target : target.constructor ?? target;
|
|
6002
|
-
}
|
|
6003
|
-
function entitlementFor(ctor, fnName) {
|
|
6004
|
-
return carrierOf2(ctor)[ENTITLEMENTS]?.[fnName];
|
|
6005
|
-
}
|
|
6006
|
-
function spendFor(ctor, fnName) {
|
|
6007
|
-
return carrierOf2(ctor)[SPENDS]?.[fnName];
|
|
6008
|
-
}
|
|
6009
|
-
|
|
6010
|
-
// src/purchases/openapi.ts
|
|
6011
|
-
function purchaseThrows(ctor, fnName) {
|
|
6012
|
-
const out = [];
|
|
6013
|
-
if (entitlementFor(ctor, fnName) !== void 0) {
|
|
6014
|
-
out.push({ name: "EntitlementRequired", code: "entitlement_required" });
|
|
6015
|
-
}
|
|
6016
|
-
if (spendFor(ctor, fnName) !== void 0) {
|
|
6017
|
-
out.push({ name: "QuotaExceeded", code: "quota_exceeded" });
|
|
6018
|
-
out.push({ name: "CreditInsufficient", code: "credit_insufficient" });
|
|
6019
|
-
}
|
|
6020
|
-
return out;
|
|
6021
|
-
}
|
|
6022
|
-
|
|
6023
5971
|
// src/openapi/discover.ts
|
|
6024
5972
|
function capitalizeSegment(s) {
|
|
6025
5973
|
if (s.length === 0) return s;
|
|
@@ -6090,11 +6038,9 @@ function flattenController(controller) {
|
|
|
6090
6038
|
break;
|
|
6091
6039
|
}
|
|
6092
6040
|
}
|
|
6093
|
-
const purchases = purchaseThrows(controller, route.fnName);
|
|
6094
6041
|
const seen = new Set((route.throws ?? []).map((t) => t.code));
|
|
6095
6042
|
const allThrows = [
|
|
6096
|
-
...route.throws ?? []
|
|
6097
|
-
...purchases.filter((t) => !seen.has(t.code))
|
|
6043
|
+
...route.throws ?? []
|
|
6098
6044
|
];
|
|
6099
6045
|
out.push({
|
|
6100
6046
|
method: route.method,
|