@palbase/backend 39.1.7 → 40.0.1

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 (44) hide show
  1. package/dist/bin/palbase-backend.cjs.map +1 -1
  2. package/dist/bin/palbase-backend.js +2 -2
  3. package/dist/{chunk-C525N4OW.js → chunk-AS2HDWVQ.js} +3 -2
  4. package/dist/{chunk-C525N4OW.js.map → chunk-AS2HDWVQ.js.map} +1 -1
  5. package/dist/{chunk-H7EKL6HC.js → chunk-RA7KFELX.js} +88 -2
  6. package/dist/chunk-RA7KFELX.js.map +1 -0
  7. package/dist/db/index.d.cts +1 -1
  8. package/dist/db/index.d.ts +1 -1
  9. package/dist/engine/index.cjs +2 -0
  10. package/dist/engine/index.cjs.map +1 -1
  11. package/dist/engine/index.d.cts +3 -3
  12. package/dist/engine/index.d.ts +3 -3
  13. package/dist/engine/index.js +4 -2
  14. package/dist/{index-fLaf0PN2.d.ts → index-B8zC9oV0.d.ts} +3 -3
  15. package/dist/{index-Db5QHdTa.d.cts → index-BAjRbjnq.d.cts} +3 -3
  16. package/dist/{index-QWN1Ncrv.d.ts → index-Ck2K1TgC.d.ts} +3 -3
  17. package/dist/{index-CCY1h_J2.d.cts → index-t7Ie44mM.d.cts} +3 -3
  18. package/dist/index.cjs +84 -59
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +20 -18
  21. package/dist/index.d.ts +20 -18
  22. package/dist/index.js +2 -61
  23. package/dist/index.js.map +1 -1
  24. package/dist/openapi/index.d.cts +2 -2
  25. package/dist/openapi/index.d.ts +2 -2
  26. package/dist/{registry-CH6HRR6T.d.cts → registry-C88au7ti.d.cts} +1 -1
  27. package/dist/{registry-C7tCRyPm.d.ts → registry-wwVUGunv.d.ts} +1 -1
  28. package/dist/stack.cjs.map +1 -1
  29. package/dist/stack.d.cts +21 -6
  30. package/dist/stack.d.ts +21 -6
  31. package/dist/test/index.cjs +19 -1
  32. package/dist/test/index.cjs.map +1 -1
  33. package/dist/test/index.d.cts +21 -2
  34. package/dist/test/index.d.ts +21 -2
  35. package/dist/test/index.js +18 -1
  36. package/dist/test/index.js.map +1 -1
  37. package/docs/README.md +6 -6
  38. package/docs/llms-full.txt +6 -6
  39. package/package.json +3 -6
  40. package/template/AGENTS.md +14 -14
  41. package/template/modules/notes/notes.e2e.test.ts +53 -0
  42. package/template/package.json +2 -2
  43. package/dist/chunk-H7EKL6HC.js.map +0 -1
  44. package/template/scripts/test.sh +0 -33
@@ -1,5 +1,5 @@
1
1
  import { T as Token } from '../module-Dl1KFVtc.cjs';
2
- import { E as EnvServiceDatabase, a as DBClient, b as RuntimeServices } from '../index-CCY1h_J2.cjs';
2
+ import { E as EnvServiceDatabase, a as DBClient, b as RuntimeServices } from '../index-t7Ie44mM.cjs';
3
3
  import 'zod';
4
4
  import '../db/env.cjs';
5
5
  import '../stack.cjs';
@@ -131,6 +131,25 @@ interface TestApi {
131
131
  readonly requests: readonly RecordedRequest[];
132
132
  }
133
133
  declare function createTestApi(config: TestApiConfig): TestApi;
134
+ /** What THIS run was given, asked before a suite decides what it can measure.
135
+ *
136
+ * A suite that calls the stack cannot run under `npm test` or `palbase test
137
+ * --unit` — there is no stack there — and a suite that signs in as a fixture
138
+ * user cannot run on a deploy whose project declared none. Both are facts about
139
+ * the RUN, set by whoever started it, so they are read here rather than out of
140
+ * the environment in the project's own code: a scaffold that shows
141
+ * `process.env` teaches the habit that ends with a secret in a repository.
142
+ *
143
+ * Ask it for a SKIP CONDITION, never as a way out of an assertion that failed:
144
+ * `describe.skipIf(!testRun.stack)`, `describe.if(testRun.minted("author"))`.
145
+ */
146
+ interface TestRun {
147
+ /** There is a stack to call — the deploy set one, or `palbase test --live` did. */
148
+ readonly stack: boolean;
149
+ /** This run minted a login under that fixture name. */
150
+ minted(name: string): boolean;
151
+ }
152
+ declare const testRun: TestRun;
134
153
  declare const api: TestApi;
135
154
 
136
155
  interface IsolatedContainer {
@@ -233,4 +252,4 @@ declare function fakeDatabase(): FakeDatabase;
233
252
 
234
253
  declare function withServices<T>(services: Partial<RuntimeServices>, fn: () => T): T;
235
254
 
236
- export { type CallOptions, type ErrorEnvelope, type FakeDatabase, type IsolatedContainer, type RecordedQuery, type RecordedRequest, type TestApi, type TestApiConfig, TestApiError, type TestIdentity, api, createTestApi, fakeDatabase, isolated, withServices };
255
+ export { type CallOptions, type ErrorEnvelope, type FakeDatabase, type IsolatedContainer, type RecordedQuery, type RecordedRequest, type TestApi, type TestApiConfig, TestApiError, type TestIdentity, type TestRun, api, createTestApi, fakeDatabase, isolated, testRun, withServices };
@@ -1,5 +1,5 @@
1
1
  import { T as Token } from '../module-Dl1KFVtc.js';
2
- import { E as EnvServiceDatabase, a as DBClient, b as RuntimeServices } from '../index-fLaf0PN2.js';
2
+ import { E as EnvServiceDatabase, a as DBClient, b as RuntimeServices } from '../index-B8zC9oV0.js';
3
3
  import 'zod';
4
4
  import '../db/env.js';
5
5
  import '../stack.js';
@@ -131,6 +131,25 @@ interface TestApi {
131
131
  readonly requests: readonly RecordedRequest[];
132
132
  }
133
133
  declare function createTestApi(config: TestApiConfig): TestApi;
134
+ /** What THIS run was given, asked before a suite decides what it can measure.
135
+ *
136
+ * A suite that calls the stack cannot run under `npm test` or `palbase test
137
+ * --unit` — there is no stack there — and a suite that signs in as a fixture
138
+ * user cannot run on a deploy whose project declared none. Both are facts about
139
+ * the RUN, set by whoever started it, so they are read here rather than out of
140
+ * the environment in the project's own code: a scaffold that shows
141
+ * `process.env` teaches the habit that ends with a secret in a repository.
142
+ *
143
+ * Ask it for a SKIP CONDITION, never as a way out of an assertion that failed:
144
+ * `describe.skipIf(!testRun.stack)`, `describe.if(testRun.minted("author"))`.
145
+ */
146
+ interface TestRun {
147
+ /** There is a stack to call — the deploy set one, or `palbase test --live` did. */
148
+ readonly stack: boolean;
149
+ /** This run minted a login under that fixture name. */
150
+ minted(name: string): boolean;
151
+ }
152
+ declare const testRun: TestRun;
134
153
  declare const api: TestApi;
135
154
 
136
155
  interface IsolatedContainer {
@@ -233,4 +252,4 @@ declare function fakeDatabase(): FakeDatabase;
233
252
 
234
253
  declare function withServices<T>(services: Partial<RuntimeServices>, fn: () => T): T;
235
254
 
236
- export { type CallOptions, type ErrorEnvelope, type FakeDatabase, type IsolatedContainer, type RecordedQuery, type RecordedRequest, type TestApi, type TestApiConfig, TestApiError, type TestIdentity, api, createTestApi, fakeDatabase, isolated, withServices };
255
+ export { type CallOptions, type ErrorEnvelope, type FakeDatabase, type IsolatedContainer, type RecordedQuery, type RecordedRequest, type TestApi, type TestApiConfig, TestApiError, type TestIdentity, type TestRun, api, createTestApi, fakeDatabase, isolated, testRun, withServices };
@@ -1395,7 +1395,7 @@ function parseIdentities(raw) {
1395
1395
  try {
1396
1396
  return JSON.parse(raw);
1397
1397
  } catch {
1398
- return {};
1398
+ throw new Error("PALBASE_TEST_IDENTITIES is set but is not JSON \u2014 the run that started these tests handed over a broken identity set");
1399
1399
  }
1400
1400
  }
1401
1401
  __name(parseIdentities, "parseIdentities");
@@ -1407,6 +1407,22 @@ function safeParse(text) {
1407
1407
  }
1408
1408
  }
1409
1409
  __name(safeParse, "safeParse");
1410
+ var testRun = {
1411
+ get stack() {
1412
+ return Boolean(process.env.PALBASE_TEST_BASE_URL);
1413
+ },
1414
+ minted(name) {
1415
+ const raw = process.env.PALBASE_TEST_IDENTITIES;
1416
+ if (!raw) return false;
1417
+ let identities;
1418
+ try {
1419
+ identities = JSON.parse(raw);
1420
+ } catch {
1421
+ throw new Error("PALBASE_TEST_IDENTITIES is set but is not JSON \u2014 the run that started these tests handed over a broken identity set");
1422
+ }
1423
+ return typeof identities === "object" && identities !== null && Object.prototype.hasOwnProperty.call(identities, name);
1424
+ }
1425
+ };
1410
1426
  var configured = null;
1411
1427
  var api = new Proxy({}, {
1412
1428
  get(_target, prop) {
@@ -2332,6 +2348,7 @@ export {
2332
2348
  createTestApi,
2333
2349
  fakeDatabase,
2334
2350
  isolated,
2351
+ testRun,
2335
2352
  withServices
2336
2353
  };
2337
2354
  /*! Bundled license information: