@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.
Files changed (81) hide show
  1. package/dist/bin/palbase-backend.cjs +750 -40
  2. package/dist/bin/palbase-backend.cjs.map +1 -1
  3. package/dist/bin/palbase-backend.js +5 -5
  4. package/dist/{chunk-YL4C5NRY.js → chunk-HQRJDARQ.js} +2 -2
  5. package/dist/{chunk-74XDEF5J.js → chunk-M5MCBWJI.js} +723 -37
  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-SQC5EIWY.js → chunk-OHALWEOG.js} +19 -9
  10. package/dist/chunk-OHALWEOG.js.map +1 -0
  11. package/dist/{chunk-I3ON7MYF.js → chunk-PY7YJDCT.js} +129 -18
  12. package/dist/chunk-PY7YJDCT.js.map +1 -0
  13. package/dist/{chunk-N32VDWKH.js → chunk-R3KN6RHD.js} +4 -59
  14. package/dist/chunk-R3KN6RHD.js.map +1 -0
  15. package/dist/{chunk-QMVK4X3V.js → chunk-RCLNBJCM.js} +98 -98
  16. package/dist/chunk-RCLNBJCM.js.map +1 -0
  17. package/dist/db/env.cjs.map +1 -1
  18. package/dist/db/env.d.cts +3 -21
  19. package/dist/db/env.d.ts +3 -21
  20. package/dist/db/index.cjs +140 -16
  21. package/dist/db/index.cjs.map +1 -1
  22. package/dist/db/index.d.cts +3 -2
  23. package/dist/db/index.d.ts +3 -2
  24. package/dist/db/index.js +2 -2
  25. package/dist/{endpoint-BVT6jcVW.d.cts → endpoint-CVWXh6oG.d.ts} +147 -15
  26. package/dist/{endpoint-BVT6jcVW.d.ts → endpoint-c9h5jriX.d.cts} +147 -15
  27. package/dist/engine/index.cjs +750 -40
  28. package/dist/engine/index.cjs.map +1 -1
  29. package/dist/engine/index.d.cts +6 -5
  30. package/dist/engine/index.d.ts +6 -5
  31. package/dist/engine/index.js +4 -4
  32. package/dist/{index-BS1gW4nV.d.cts → index-BZrJXnVh.d.ts} +142 -72
  33. package/dist/{index-BqCiHao8.d.cts → index-By8Dle5U.d.cts} +196 -21
  34. package/dist/{index-vwHoS0l2.d.ts → index-CwAJ7HEe.d.ts} +196 -21
  35. package/dist/{index-CCZqzych.d.ts → index-CxeQSfJP.d.cts} +142 -72
  36. package/dist/index.cjs +388 -1101
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +89 -1134
  39. package/dist/index.d.ts +89 -1134
  40. package/dist/index.js +133 -902
  41. package/dist/index.js.map +1 -1
  42. package/dist/openapi/index.cjs +32 -61
  43. package/dist/openapi/index.cjs.map +1 -1
  44. package/dist/openapi/index.d.cts +6 -2
  45. package/dist/openapi/index.d.ts +6 -2
  46. package/dist/openapi/index.js +34 -26
  47. package/dist/openapi/index.js.map +1 -1
  48. package/dist/{registry-Bsuf-orT.d.ts → registry-B3niOVYp.d.ts} +108 -170
  49. package/dist/{registry-BWttGlaT.d.cts → registry-CqPK2Qby.d.cts} +108 -170
  50. package/dist/{purchases/keys.cjs → stack.cjs} +4 -4
  51. package/dist/stack.cjs.map +1 -0
  52. package/dist/stack.d.cts +76 -0
  53. package/dist/stack.d.ts +76 -0
  54. package/dist/stack.js +1 -0
  55. package/dist/test/index.cjs +482 -9
  56. package/dist/test/index.cjs.map +1 -1
  57. package/dist/test/index.d.cts +35 -3
  58. package/dist/test/index.d.ts +35 -3
  59. package/dist/test/index.js +480 -8
  60. package/dist/test/index.js.map +1 -1
  61. package/docs/README.md +7 -6
  62. package/docs/llms-full.txt +7 -260
  63. package/docs/llms.txt +0 -2
  64. package/package.json +9 -8
  65. package/stager/return_types.js +23 -0
  66. package/template/package.json +1 -1
  67. package/dist/chunk-74XDEF5J.js.map +0 -1
  68. package/dist/chunk-I3ON7MYF.js.map +0 -1
  69. package/dist/chunk-N32VDWKH.js.map +0 -1
  70. package/dist/chunk-QMVK4X3V.js.map +0 -1
  71. package/dist/chunk-SQC5EIWY.js.map +0 -1
  72. package/dist/chunk-W5ODXPY3.js.map +0 -1
  73. package/dist/purchases/keys.cjs.map +0 -1
  74. package/dist/purchases/keys.d.cts +0 -42
  75. package/dist/purchases/keys.d.ts +0 -42
  76. package/dist/purchases/keys.js +0 -1
  77. package/docs/config.md +0 -147
  78. package/docs/resources.md +0 -97
  79. package/template/config/secrets.ts +0 -24
  80. /package/dist/{chunk-YL4C5NRY.js.map → chunk-HQRJDARQ.js.map} +0 -0
  81. /package/dist/{purchases/keys.js.map → stack.js.map} +0 -0
@@ -13,7 +13,7 @@ var __copyProps = (to, from, except, desc) => {
13
13
  };
14
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
15
 
16
- // src/purchases/keys.ts
17
- var keys_exports = {};
18
- module.exports = __toCommonJS(keys_exports);
19
- //# sourceMappingURL=keys.cjs.map
16
+ // src/stack.ts
17
+ var stack_exports = {};
18
+ module.exports = __toCommonJS(stack_exports);
19
+ //# sourceMappingURL=stack.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/stack.ts"],"sourcesContent":["/**\n * `@palbase/backend/stack` — the controlled global augmentation target for the\n * names the project's STACK holds.\n *\n * `Secrets.get(...)`, the Flags client's key parameters and `@Upload({ bucket })`\n * take these unions, never a raw string, so a name the stack does not hold is a\n * COMPILE error rather than a 500 in production — or, worse, a silent read of a\n * secret nobody set.\n *\n * Three interfaces in ONE module because the three share a source and a refresh\n * moment: they all come from the linked environment's stack, and any `palbase\n * secret set` / `flags add` / `storage add` moves them together. `@palbase/\n * backend/env` and `@palbase/backend/purchases` stay separate for the opposite\n * reason — their sources are the schema and the catalog.\n *\n * All three are EMPTY by default; the generated `palbase-stack.d.ts` augments\n * them with one member per name:\n *\n * // palbase-stack.d.ts (generated — do not edit)\n * declare module \"@palbase/backend/stack\" {\n * interface Secrets { OPENAI_API_KEY: true }\n * interface Flags { newCheckout: true }\n * interface Buckets { avatars: true }\n * }\n *\n * A project that has not generated the file therefore has NO valid names, and\n * every call fails to compile until it does. That is the intended behaviour,\n * not a rough edge: it is the ONLY shape in which the gate is not optional. A\n * permissive `string` fallback would make the check opt-in, and an opt-in gate\n * is the same as no gate — which is precisely the hole the retired\n * `config/secrets.ts` push-check used to paper over.\n *\n * THIS REPLACED A DECLARATION, and the direction matters. `config/secrets.ts`\n * asked the author to restate, in the repo, names the vault already held; the\n * deploy then compared the two lists. Here the stack is simply read and the\n * result is a type. There is no second list to drift.\n */\n\n/** The secret names this project's vault holds. EMPTY by default; filled by the\n * generated `palbase-stack.d.ts`. */\n// biome-ignore lint/suspicious/noEmptyInterface: augmentation target — filled by generated palbase-stack.d.ts.\nexport interface Secrets {}\n\n/** The flag keys this project's store defines. EMPTY by default; filled by the\n * generated `palbase-stack.d.ts`. */\n// biome-ignore lint/suspicious/noEmptyInterface: augmentation target — filled by generated palbase-stack.d.ts.\nexport interface Flags {}\n\n/**\n * One typed bucket: which renditions the stack declared for it.\n *\n * `variants` is a UNION of the declared names, so asking for one the bucket does\n * not have is a compile error rather than a 404 somebody finds in production.\n * The default `never` means a bucket with no variants accepts no variant name at\n * all, which is exactly right.\n *\n * THIS MOVED HERE FROM `db/env.ts` (2026-08-29). It lived there because\n * `config/storage.ts` fed it through `palbase-env.d.ts`, alongside the schema's\n * tables. Buckets do not come from the schema — they come from the STACK — so\n * they belong in the file generated off the stack. Two `Buckets` interfaces for\n * one concept is how `Storage.buckets.docs` and `@Upload({ bucket: \"docs\" })`\n * came to disagree about whether \"docs\" exists.\n */\nexport interface BucketTypes {\n variants: string;\n}\n\n/** The buckets this project's storage carries, keyed by name. EMPTY by default;\n * filled by the generated `palbase-stack.d.ts`. Drives BOTH `Storage.buckets.*`\n * (through `EnvBuckets`) and `@Upload({ bucket })`. */\n// biome-ignore lint/suspicious/noEmptyInterface: augmentation target — filled by generated palbase-stack.d.ts.\nexport interface Buckets {}\n\n/** Every secret name the stack holds. */\nexport type PalbaseSecretName = keyof Secrets & string;\n\n/** Every flag key the stack defines. */\nexport type PalbaseFlagKey = keyof Flags & string;\n\n/** Every bucket the stack carries. */\nexport type PalbaseBucketName = keyof Buckets & string;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * `@palbase/backend/stack` — the controlled global augmentation target for the
3
+ * names the project's STACK holds.
4
+ *
5
+ * `Secrets.get(...)`, the Flags client's key parameters and `@Upload({ bucket })`
6
+ * take these unions, never a raw string, so a name the stack does not hold is a
7
+ * COMPILE error rather than a 500 in production — or, worse, a silent read of a
8
+ * secret nobody set.
9
+ *
10
+ * Three interfaces in ONE module because the three share a source and a refresh
11
+ * moment: they all come from the linked environment's stack, and any `palbase
12
+ * secret set` / `flags add` / `storage add` moves them together. `@palbase/
13
+ * backend/env` and `@palbase/backend/purchases` stay separate for the opposite
14
+ * reason — their sources are the schema and the catalog.
15
+ *
16
+ * All three are EMPTY by default; the generated `palbase-stack.d.ts` augments
17
+ * them with one member per name:
18
+ *
19
+ * // palbase-stack.d.ts (generated — do not edit)
20
+ * declare module "@palbase/backend/stack" {
21
+ * interface Secrets { OPENAI_API_KEY: true }
22
+ * interface Flags { newCheckout: true }
23
+ * interface Buckets { avatars: true }
24
+ * }
25
+ *
26
+ * A project that has not generated the file therefore has NO valid names, and
27
+ * every call fails to compile until it does. That is the intended behaviour,
28
+ * not a rough edge: it is the ONLY shape in which the gate is not optional. A
29
+ * permissive `string` fallback would make the check opt-in, and an opt-in gate
30
+ * is the same as no gate — which is precisely the hole the retired
31
+ * `config/secrets.ts` push-check used to paper over.
32
+ *
33
+ * THIS REPLACED A DECLARATION, and the direction matters. `config/secrets.ts`
34
+ * asked the author to restate, in the repo, names the vault already held; the
35
+ * deploy then compared the two lists. Here the stack is simply read and the
36
+ * result is a type. There is no second list to drift.
37
+ */
38
+ /** The secret names this project's vault holds. EMPTY by default; filled by the
39
+ * generated `palbase-stack.d.ts`. */
40
+ interface Secrets {
41
+ }
42
+ /** The flag keys this project's store defines. EMPTY by default; filled by the
43
+ * generated `palbase-stack.d.ts`. */
44
+ interface Flags {
45
+ }
46
+ /**
47
+ * One typed bucket: which renditions the stack declared for it.
48
+ *
49
+ * `variants` is a UNION of the declared names, so asking for one the bucket does
50
+ * not have is a compile error rather than a 404 somebody finds in production.
51
+ * The default `never` means a bucket with no variants accepts no variant name at
52
+ * all, which is exactly right.
53
+ *
54
+ * THIS MOVED HERE FROM `db/env.ts` (2026-08-29). It lived there because
55
+ * `config/storage.ts` fed it through `palbase-env.d.ts`, alongside the schema's
56
+ * tables. Buckets do not come from the schema — they come from the STACK — so
57
+ * they belong in the file generated off the stack. Two `Buckets` interfaces for
58
+ * one concept is how `Storage.buckets.docs` and `@Upload({ bucket: "docs" })`
59
+ * came to disagree about whether "docs" exists.
60
+ */
61
+ interface BucketTypes {
62
+ variants: string;
63
+ }
64
+ /** The buckets this project's storage carries, keyed by name. EMPTY by default;
65
+ * filled by the generated `palbase-stack.d.ts`. Drives BOTH `Storage.buckets.*`
66
+ * (through `EnvBuckets`) and `@Upload({ bucket })`. */
67
+ interface Buckets {
68
+ }
69
+ /** Every secret name the stack holds. */
70
+ type PalbaseSecretName = keyof Secrets & string;
71
+ /** Every flag key the stack defines. */
72
+ type PalbaseFlagKey = keyof Flags & string;
73
+ /** Every bucket the stack carries. */
74
+ type PalbaseBucketName = keyof Buckets & string;
75
+
76
+ export type { BucketTypes, Buckets, Flags, PalbaseBucketName, PalbaseFlagKey, PalbaseSecretName, Secrets };
@@ -0,0 +1,76 @@
1
+ /**
2
+ * `@palbase/backend/stack` — the controlled global augmentation target for the
3
+ * names the project's STACK holds.
4
+ *
5
+ * `Secrets.get(...)`, the Flags client's key parameters and `@Upload({ bucket })`
6
+ * take these unions, never a raw string, so a name the stack does not hold is a
7
+ * COMPILE error rather than a 500 in production — or, worse, a silent read of a
8
+ * secret nobody set.
9
+ *
10
+ * Three interfaces in ONE module because the three share a source and a refresh
11
+ * moment: they all come from the linked environment's stack, and any `palbase
12
+ * secret set` / `flags add` / `storage add` moves them together. `@palbase/
13
+ * backend/env` and `@palbase/backend/purchases` stay separate for the opposite
14
+ * reason — their sources are the schema and the catalog.
15
+ *
16
+ * All three are EMPTY by default; the generated `palbase-stack.d.ts` augments
17
+ * them with one member per name:
18
+ *
19
+ * // palbase-stack.d.ts (generated — do not edit)
20
+ * declare module "@palbase/backend/stack" {
21
+ * interface Secrets { OPENAI_API_KEY: true }
22
+ * interface Flags { newCheckout: true }
23
+ * interface Buckets { avatars: true }
24
+ * }
25
+ *
26
+ * A project that has not generated the file therefore has NO valid names, and
27
+ * every call fails to compile until it does. That is the intended behaviour,
28
+ * not a rough edge: it is the ONLY shape in which the gate is not optional. A
29
+ * permissive `string` fallback would make the check opt-in, and an opt-in gate
30
+ * is the same as no gate — which is precisely the hole the retired
31
+ * `config/secrets.ts` push-check used to paper over.
32
+ *
33
+ * THIS REPLACED A DECLARATION, and the direction matters. `config/secrets.ts`
34
+ * asked the author to restate, in the repo, names the vault already held; the
35
+ * deploy then compared the two lists. Here the stack is simply read and the
36
+ * result is a type. There is no second list to drift.
37
+ */
38
+ /** The secret names this project's vault holds. EMPTY by default; filled by the
39
+ * generated `palbase-stack.d.ts`. */
40
+ interface Secrets {
41
+ }
42
+ /** The flag keys this project's store defines. EMPTY by default; filled by the
43
+ * generated `palbase-stack.d.ts`. */
44
+ interface Flags {
45
+ }
46
+ /**
47
+ * One typed bucket: which renditions the stack declared for it.
48
+ *
49
+ * `variants` is a UNION of the declared names, so asking for one the bucket does
50
+ * not have is a compile error rather than a 404 somebody finds in production.
51
+ * The default `never` means a bucket with no variants accepts no variant name at
52
+ * all, which is exactly right.
53
+ *
54
+ * THIS MOVED HERE FROM `db/env.ts` (2026-08-29). It lived there because
55
+ * `config/storage.ts` fed it through `palbase-env.d.ts`, alongside the schema's
56
+ * tables. Buckets do not come from the schema — they come from the STACK — so
57
+ * they belong in the file generated off the stack. Two `Buckets` interfaces for
58
+ * one concept is how `Storage.buckets.docs` and `@Upload({ bucket: "docs" })`
59
+ * came to disagree about whether "docs" exists.
60
+ */
61
+ interface BucketTypes {
62
+ variants: string;
63
+ }
64
+ /** The buckets this project's storage carries, keyed by name. EMPTY by default;
65
+ * filled by the generated `palbase-stack.d.ts`. Drives BOTH `Storage.buckets.*`
66
+ * (through `EnvBuckets`) and `@Upload({ bucket })`. */
67
+ interface Buckets {
68
+ }
69
+ /** Every secret name the stack holds. */
70
+ type PalbaseSecretName = keyof Secrets & string;
71
+ /** Every flag key the stack defines. */
72
+ type PalbaseFlagKey = keyof Flags & string;
73
+ /** Every bucket the stack carries. */
74
+ type PalbaseBucketName = keyof Buckets & string;
75
+
76
+ export type { BucketTypes, Buckets, Flags, PalbaseBucketName, PalbaseFlagKey, PalbaseSecretName, Secrets };
package/dist/stack.js ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=stack.js.map