sdk-aws-lambda 0.5.0 → 0.6.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 (50) hide show
  1. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.d.ts +24 -0
  2. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js +24 -0
  3. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js.map +1 -1
  4. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.d.ts +19 -0
  5. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js.map +1 -1
  6. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js +7 -7
  7. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js.map +1 -1
  8. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.d.ts +28 -3
  9. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js +3 -2
  10. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js.map +1 -1
  11. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js +6 -6
  12. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js.map +1 -1
  13. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.d.ts +1 -1
  14. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js +19 -1
  15. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js.map +1 -1
  16. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.d.ts +0 -4
  17. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.js +224 -3
  18. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.js.map +1 -1
  19. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.d.ts +12 -4
  20. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js +12 -4
  21. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js.map +1 -1
  22. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedInput.d.ts +22 -0
  23. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedInput.js +29 -0
  24. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedInput.js.map +1 -0
  25. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.d.ts +35 -0
  26. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.js +58 -1
  27. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.js.map +1 -1
  28. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.d.ts +1 -0
  29. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js +65 -9
  30. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js.map +1 -1
  31. package/dist/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.d.ts +20 -0
  32. package/dist/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.js +31 -2
  33. package/dist/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.js.map +1 -1
  34. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js +24 -19
  35. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js.map +1 -1
  36. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.d.ts +10 -3
  37. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js +10 -3
  38. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js.map +1 -1
  39. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js +9 -23
  40. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js.map +1 -1
  41. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js +11 -18
  42. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js.map +1 -1
  43. package/dist/domain.operations/genServiceSdk/getAllJsonSchemaNodes.d.ts +59 -0
  44. package/dist/domain.operations/genServiceSdk/getAllJsonSchemaNodes.js +87 -0
  45. package/dist/domain.operations/genServiceSdk/getAllJsonSchemaNodes.js.map +1 -0
  46. package/dist/index.d.ts +25 -0
  47. package/dist/index.js +26 -1
  48. package/dist/index.js.map +1 -1
  49. package/package.json +3 -3
  50. package/readme.md +89 -8
@@ -20,16 +20,24 @@ const getValidatedOutput_1 = require("./getValidatedOutput");
20
20
  * signature cannot warn them — `request.response` is `unknown` to middy, so both bind.
21
21
  *
22
22
  * .note = UNRESOLVED, NOT A DEFECT — this export carries two contracts with no discriminant.
23
- * tracked as **F33** in `1.vision.yield.md`'s fulcrum table, where the three options
24
- * (deprecate, add a `point` discriminant, accept) are spelled out.
23
+ * tracked as **F33** in
24
+ * `.behavior/v2026_08_03.feat-apigateway-wire-response/1.vision.yield.md`'s fulcrum
25
+ * table — the bound that SHIPPED this export, and already merged — where the three
26
+ * options (deprecate, add a `point` discriminant, accept) are spelled out.
25
27
  *
26
28
  * no shipped chain registers it — both families validate inline instead, because each
27
29
  * knows which of the two shapes it holds at that moment and this middleware cannot. so
28
30
  * the open question is one of surface area, never of a live defect.
29
31
  *
30
- * .note = the validation itself is delegated to `getValidatedOutput`, as both input-side peers
31
- * delegate to `getValidationError` — one guarantee, one implementation
32
+ * .note = the validation itself is delegated to `getValidatedOutput`, exactly as both input-side
33
+ * peers delegate to `getValidatedInput` — one guarantee, one implementation, per border
32
34
  * (rule.forbid.parallel-codepaths)
35
+ *
36
+ * the two root primitives are peers rather than one, because they make DIFFERENT
37
+ * guarantees: a bad input is the caller's fault and raises a `ConstraintError`, while a
38
+ * bad output is the server's fault and raises a `MalfunctionError`
39
+ * (rule.require.failloud). to merge them would need an error-class argument, which is a
40
+ * fork on handed config — the shape that rule forbids
33
41
  */
34
42
  const genZodOutputValidationMiddleware = (input) => {
35
43
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"genZodOutputValidationMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.ts"],"names":[],"mappings":";;;AAGA,6DAA0D;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACI,MAAM,gCAAgC,GAAG,CAAU,KAEzD,EAAyC,EAAE;IAC1C,OAAO;QACL,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACvB,uEAAuE;YACvE,yFAAyF;YACzF,OAAO,CAAC,QAAQ,GAAG,IAAA,uCAAkB,EAAC;gBACpC,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;aACrB,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,gCAAgC,oCAa3C"}
1
+ {"version":3,"file":"genZodOutputValidationMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.ts"],"names":[],"mappings":";;;AAGA,6DAA0D;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACI,MAAM,gCAAgC,GAAG,CAAU,KAEzD,EAAyC,EAAE;IAC1C,OAAO;QACL,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACvB,uEAAuE;YACvE,yFAAyF;YACzF,OAAO,CAAC,QAAQ,GAAG,IAAA,uCAAkB,EAAC;gBACpC,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;aACrB,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,gCAAgC,oCAa3C"}
@@ -0,0 +1,22 @@
1
+ import type { ZodSchema } from 'zod';
2
+ /**
3
+ * .what = validate a caller's value against an endpoint's input schema, and hand back the
4
+ * parsed result
5
+ * .why = this is the ONE root primitive for the input border. both endpoint families reach it,
6
+ * so a guarantee added here — a coerce, a redaction, an error shape — lands once rather
7
+ * than in each family's own validator
8
+ *
9
+ * .note = the two families differ only in WHICH SLOT carries the caller's value, never in what
10
+ * validation means. `forAskEndpoint` hands the whole `request.event`; `forApiGateway`
11
+ * hands `event.body`, because its `request.event` must stay http-shaped for
12
+ * `@middy/http-cors`. that slot choice stays with each family; the validation itself
13
+ * lives here
14
+ *
15
+ * .note = the result is the POST-parse shape, so a schema that coerces (any `X.contract()`
16
+ * position) yields live domain instances rather than the plain objects that crossed the
17
+ * wire. the caller assigns it into its own slot
18
+ */
19
+ export declare const getValidatedInput: <TInput>(input: {
20
+ schema: ZodSchema<TInput>;
21
+ value: unknown;
22
+ }) => TInput;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getValidatedInput = void 0;
4
+ const getValidationError_1 = require("./getValidationError");
5
+ /**
6
+ * .what = validate a caller's value against an endpoint's input schema, and hand back the
7
+ * parsed result
8
+ * .why = this is the ONE root primitive for the input border. both endpoint families reach it,
9
+ * so a guarantee added here — a coerce, a redaction, an error shape — lands once rather
10
+ * than in each family's own validator
11
+ *
12
+ * .note = the two families differ only in WHICH SLOT carries the caller's value, never in what
13
+ * validation means. `forAskEndpoint` hands the whole `request.event`; `forApiGateway`
14
+ * hands `event.body`, because its `request.event` must stay http-shaped for
15
+ * `@middy/http-cors`. that slot choice stays with each family; the validation itself
16
+ * lives here
17
+ *
18
+ * .note = the result is the POST-parse shape, so a schema that coerces (any `X.contract()`
19
+ * position) yields live domain instances rather than the plain objects that crossed the
20
+ * wire. the caller assigns it into its own slot
21
+ */
22
+ const getValidatedInput = (input) => {
23
+ const result = input.schema.safeParse(input.value);
24
+ if (!result.success)
25
+ throw (0, getValidationError_1.getValidationError)({ error: result.error });
26
+ return result.data;
27
+ };
28
+ exports.getValidatedInput = getValidatedInput;
29
+ //# sourceMappingURL=getValidatedInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getValidatedInput.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getValidatedInput.ts"],"names":[],"mappings":";;;AAEA,6DAA0D;AAE1D;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,iBAAiB,GAAG,CAAS,KAGzC,EAAU,EAAE;IACX,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnD,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,MAAM,IAAA,uCAAkB,EAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IACvE,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC,CAAC;AAPW,QAAA,iBAAiB,qBAO5B"}
@@ -1,7 +1,42 @@
1
1
  import type { ZodType } from 'zod';
2
+ import { type ZodIssueSummary } from './getZodIssuesSummary';
3
+ export interface OutputValidationErrorMetadata {
4
+ issues: ZodIssueSummary[];
5
+ hint: string;
6
+ }
2
7
  /**
3
8
  * .what = validates output against schema and returns typed result
4
9
  * .why = named transformer for decode-friction-free validation in orchestrators
10
+ *
11
+ * .note = this is the ONE output-side validator, and BOTH families call it DIRECTLY —
12
+ * `forAskEndpoint.ts:125` and `forApiGateway.ts:274`. so a repair here lands at both
13
+ * borders at once, exactly as `getValidatedInput` does on the input side
14
+ *
15
+ * ⚠️ .why NOT through `genZodOutputValidationMiddleware` = that export wraps this function for a
16
+ * consumer who composes their own chain, and no shipped chain registers it. each family
17
+ * validates inline because each knows which of two shapes it holds at that moment and the
18
+ * middleware cannot (its own `.note` states the same, as does the readme)
19
+ *
20
+ * 🟡 .why the parameter is `response` where its input-border twin takes `value` = the asymmetry
21
+ * is motivated, not an oversight, and it was raised as a nitpick at i018:
22
+ *
23
+ * - at THIS border the value has exactly one home, in both families and in the
24
+ * readme's own consumer example: `response: request.response`. the name states
25
+ * the slot, so the call site reads as an identity
26
+ * - at the INPUT border it has TWO homes — `forAskEndpoint` hands `request.event`
27
+ * whole, `forApiGateway` hands `event.body`, because its `request.event` must
28
+ * stay http-shaped for `@middy/http-cors`. no slot name is true of both, so
29
+ * `value` is the honest neutral there rather than a claim about position
30
+ * (rule.prefer.names-by-position-over-claim)
31
+ *
32
+ * ⇒ ⛔ the plan that used to sit here is VOID: it deferred the rename to *"F35's
33
+ * resolution, which forces a shared `parseOrThrow` primitive"*. F35 was ruled
34
+ * 2026-09-21 as NO REPAIR OWED, so no such extraction will arrive and no future
35
+ * edit will carry this rename for free
36
+ *
37
+ * ⇒ the divergence therefore stands on its own merits, which are the two bullets
38
+ * above and are sufficient: one border has a true slot name, the other has two
39
+ * homes and no name true of both. ⇒ this is a settled asymmetry, never a debt
5
40
  */
6
41
  export declare const getValidatedOutput: <TOutput>(input: {
7
42
  response: unknown;
@@ -3,15 +3,72 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getValidatedOutput = void 0;
4
4
  const helpful_errors_1 = require("helpful-errors");
5
5
  const getZodIssuesSummary_1 = require("./getZodIssuesSummary");
6
+ /**
7
+ * .what = the FIX half of the message a HANDLER AUTHOR meets when their own return is refused
8
+ * .why = `rule.require.errors-name-the-fix` asks for what, why, and the concrete next move. the
9
+ * zod summary supplies the first two; the third has to name an act the reader can perform
10
+ *
11
+ * ⚠️ .why it names a DIFFERENT fix than the input border = the audience inverts. an input
12
+ * failure is the CALLER's to fix, so its hint tells them what to send. an output failure
13
+ * is the HANDLER's to fix, and the caller has no move available at all — which is why
14
+ * this throws `MalfunctionError` where the input border throws `ConstraintError`
15
+ * (invariant.badrequesterror-not-lambda-error)
16
+ *
17
+ * 🔴 .why the constructor is named as a FACT rather than as the FIX = a prior draft of this hint
18
+ * read *"hand back the INSTANCE (`new X({ … })`) rather than a plain object"*, on the
19
+ * premise that `X.contract()` refuses a prop bag here. **that premise is measured FALSE.**
20
+ *
21
+ * - `X.contract()` COERCES, so a bag whose fields are correct PARSES and is handed back
22
+ * as an instance. the shape a handler returns is a TYPE-level contract, never a
23
+ * runtime gate, and the compiler enforces it unevenly — it demands the instance only
24
+ * where a union in the schema blocks inference of `TOutput` from the `invoke` return
25
+ * - ⇒ so bag-vs-instance is ORTHOGONAL to pass-vs-fail, and the DATA is what decides.
26
+ * a bag with a field absent throws HERE; `new X({ … })` built from that same data
27
+ * throws EARLIER, at construction, on the identical path
28
+ * - ⇒ a hint that names the constructor therefore names a move that does not fix the
29
+ * failure it is attached to, which is the defect `rule.require.errors-name-the-fix`
30
+ * exists to prevent
31
+ */
32
+ const OUTPUT_VALIDATION_HINT = 'the handler returned a value its own declared output schema refuses — correct each path named in `issues`. ⚠️ a plain object is NOT the cause: `X.contract()` coerces, so a bag whose fields are correct parses here. `new X({ … })` is the TYPE-level contract, and it checks these same paths at construction instead';
6
33
  /**
7
34
  * .what = validates output against schema and returns typed result
8
35
  * .why = named transformer for decode-friction-free validation in orchestrators
36
+ *
37
+ * .note = this is the ONE output-side validator, and BOTH families call it DIRECTLY —
38
+ * `forAskEndpoint.ts:125` and `forApiGateway.ts:274`. so a repair here lands at both
39
+ * borders at once, exactly as `getValidatedInput` does on the input side
40
+ *
41
+ * ⚠️ .why NOT through `genZodOutputValidationMiddleware` = that export wraps this function for a
42
+ * consumer who composes their own chain, and no shipped chain registers it. each family
43
+ * validates inline because each knows which of two shapes it holds at that moment and the
44
+ * middleware cannot (its own `.note` states the same, as does the readme)
45
+ *
46
+ * 🟡 .why the parameter is `response` where its input-border twin takes `value` = the asymmetry
47
+ * is motivated, not an oversight, and it was raised as a nitpick at i018:
48
+ *
49
+ * - at THIS border the value has exactly one home, in both families and in the
50
+ * readme's own consumer example: `response: request.response`. the name states
51
+ * the slot, so the call site reads as an identity
52
+ * - at the INPUT border it has TWO homes — `forAskEndpoint` hands `request.event`
53
+ * whole, `forApiGateway` hands `event.body`, because its `request.event` must
54
+ * stay http-shaped for `@middy/http-cors`. no slot name is true of both, so
55
+ * `value` is the honest neutral there rather than a claim about position
56
+ * (rule.prefer.names-by-position-over-claim)
57
+ *
58
+ * ⇒ ⛔ the plan that used to sit here is VOID: it deferred the rename to *"F35's
59
+ * resolution, which forces a shared `parseOrThrow` primitive"*. F35 was ruled
60
+ * 2026-09-21 as NO REPAIR OWED, so no such extraction will arrive and no future
61
+ * edit will carry this rename for free
62
+ *
63
+ * ⇒ the divergence therefore stands on its own merits, which are the two bullets
64
+ * above and are sufficient: one border has a true slot name, the other has two
65
+ * homes and no name true of both. ⇒ this is a settled asymmetry, never a debt
9
66
  */
10
67
  const getValidatedOutput = (input) => {
11
68
  const result = input.schema.safeParse(input.response);
12
69
  if (!result.success) {
13
70
  const issues = (0, getZodIssuesSummary_1.getZodIssuesSummary)({ issues: result.error.issues });
14
- throw new helpful_errors_1.MalfunctionError('output validation failed', { issues });
71
+ throw new helpful_errors_1.MalfunctionError(`output validation failed: ${(0, getZodIssuesSummary_1.asZodIssuesMessage)({ issues })}`, { issues, hint: OUTPUT_VALIDATION_HINT });
15
72
  }
16
73
  return result.data;
17
74
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getValidatedOutput.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.ts"],"names":[],"mappings":";;;AAAA,mDAAkD;AAGlD,+DAA4D;AAE5D;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAU,KAG3C,EAAW,EAAE;IACZ,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACtD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QACpE,MAAM,IAAI,iCAAgB,CAAC,0BAA0B,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC,CAAC;AAVW,QAAA,kBAAkB,sBAU7B"}
1
+ {"version":3,"file":"getValidatedOutput.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.ts"],"names":[],"mappings":";;;AAAA,mDAAkD;AAGlD,+DAI+B;AAO/B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,sBAAsB,GAC1B,yTAAyT,CAAC;AAE5T;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACI,MAAM,kBAAkB,GAAG,CAAU,KAG3C,EAAW,EAAE;IACZ,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACtD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QACpE,MAAM,IAAI,iCAAgB,CACxB,6BAA6B,IAAA,wCAAkB,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAC7D,EAAE,MAAM,EAAE,IAAI,EAAE,sBAAsB,EAAE,CACzC,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC,CAAC;AAbW,QAAA,kBAAkB,sBAa7B"}
@@ -3,6 +3,7 @@ import type { ZodError } from 'zod';
3
3
  import { type ZodIssueSummary } from './getZodIssuesSummary';
4
4
  export interface ValidationErrorMetadata {
5
5
  issues: ZodIssueSummary[];
6
+ hint: string;
6
7
  }
7
8
  /**
8
9
  * .what = transforms zod validation error into ConstraintError
@@ -4,22 +4,78 @@ exports.getValidationError = void 0;
4
4
  const helpful_errors_1 = require("helpful-errors");
5
5
  const getZodIssuesSummary_1 = require("./getZodIssuesSummary");
6
6
  /**
7
- * .what = format issues summary for error message
8
- * .why = extract message format from orchestrator
7
+ * .what = the FIX half of the message a caller meets when their input is refused
8
+ * .why = `rule.require.errors-name-the-fix` asks an error for three parts — what, why, and the
9
+ * concrete next move. the zod summary supplies the first two (`(root): expected object,
10
+ * received string` names the path and the mismatch) and says NOT ONE WORD about what to
11
+ * do, so the caller is left to infer it
12
+ *
13
+ * ⚠️ .why it names no MECHANISM = two mechanisms were considered and each is false somewhere:
14
+ * - *"introspect the schema with `{ introspect: 'schema' }`"* — `genIntrospectionMiddleware`
15
+ * gates on `env.access === 'prep'` (`genIntrospectionMiddleware.ts:63`), so the hint would
16
+ * be a dead end in prod
17
+ * - *"check the `deserialize` option"* — refuted in a prior round: it is meaningless at the
18
+ * ask-endpoint border, which shares this builder
19
+ * ⇒ so the hint names the ACT, which is true at both borders and in every env. a hint that is
20
+ * false in one env is worse than none, since a caller spends the trip before they learn it
9
21
  */
10
- const getIssuesMessage = (input) => {
11
- return input.issues
12
- .map((issue) => `${issue.path}: ${issue.message}`)
13
- .join('; ');
14
- };
22
+ /**
23
+ * ⚠️ .why DOUBLE quotes, where this repo's formatter prefers single = the possessive. biome
24
+ * picks the delimiter that needs fewer escapes, so a string that carries `'` takes `"`
25
+ *
26
+ * .the history, since the possessive was deferred for three rounds = "the endpoint declared
27
+ * input schema" shipped first, and three reviewers read it as a defect. the answer each
28
+ * round was a deferral: the string is emitted verbatim by four ACCEPTANCE snapshots whose
29
+ * suite cannot run here, so a source edit would leave four snapshots stale with no run to
30
+ * prove they moved right — the CLEAN half of `rule.always.fix-forward-under-scouts-honor`
31
+ *
32
+ * ⇒ the deferral rested on an absence nobody had measured. a grep of the SUBJECT found
33
+ * 22 byte-identical hits across 8 files, and SEVEN of them are UNIT snapshots — among
34
+ * them `genLambdaEndpoint.forApiGateway.test.ts.snap`, which carries the fully-escaped
35
+ * JSON-in-string form the acceptance hits have. so a unit run proves the identical
36
+ * transformation on the identical shape (rule.require.positive-control-before-absence-claims)
37
+ * ⇒ the repair is one `sedreplace` over all 8 files, then a unit run with NO `--resnap`.
38
+ * green means the hand-applied edit equals what the code emits, byte for byte
39
+ */
40
+ const VALIDATION_HINT_GENERIC = "send a value that satisfies the endpoint's declared input schema — correct each path named in `issues`";
41
+ /**
42
+ * .what = the hint a caller meets when EVERY issue already names its own fix
43
+ * .why = the generic hint above makes a CLAIM — *"the value you sent does not satisfy the
44
+ * schema"* — and on the constructor-reject path that claim is FALSE. `X.contract()`
45
+ * coerces, so the schema ACCEPTED the payload and the class constructor refused it
46
+ * afterward. the caller did exactly what the generic hint asks, and has no move at all
47
+ * ⇒ so the two hints fork on OBSERVED DATA — the issue set — never on handed config,
48
+ * which is the fork `rule.forbid.parallel-codepaths` permits
49
+ */
50
+ const VALIDATION_HINT_SELF_NAMED = 'each entry in `issues` names its own fix — apply the one at the path named there. ⚠️ where a message says the schema ACCEPTED the value, the fix belongs to the endpoint author, never to the caller';
51
+ /**
52
+ * .what = the marker that says an issue carries its own fix, so a generic one would displace it
53
+ * .why = ⚠️ `code === 'custom'` was proposed as the discriminator and is MEASURED over-broad. a
54
+ * constructor reject and a plain `.refine()` emit byte-identical issue shapes —
55
+ * `{ code: 'custom', path, message }`, with no field that separates them — and a
56
+ * `.refine()` IS part of the declared schema, so the generic hint is CORRECT there. to
57
+ * suppress on `custom` would strip right guidance from a real caller fault
58
+ * (probe: `.agent/.notes/probe.issue-discriminators.ts`, q1 vs q2)
59
+ *
60
+ * .why a MESSAGE check is acceptable where a dependency's message is normally not a contract =
61
+ * it degrades to today's behavior. `domain-objects` documents this convention outright —
62
+ * *"the message names the fix"* (`node_modules/domain-objects/readme.md:675`) — and our
63
+ * own `rule.require.errors-name-the-fix` mandates the same token. if upstream rewords it,
64
+ * the generic hint is appended exactly as it is today, so no new failure mode opens
65
+ */
66
+ const FIX_NAMED_MARKER = 'fix:';
15
67
  /**
16
68
  * .what = transforms zod validation error into ConstraintError
17
69
  * .why = callers need friendly error messages for invalid input
18
70
  */
19
71
  const getValidationError = (input) => {
20
72
  const issues = (0, getZodIssuesSummary_1.getZodIssuesSummary)({ issues: input.error.issues });
21
- const issuesMessage = getIssuesMessage({ issues });
22
- return new helpful_errors_1.ConstraintError(`validation failed: ${issuesMessage}`, { issues });
73
+ const issuesMessage = (0, getZodIssuesSummary_1.asZodIssuesMessage)({ issues });
74
+ // every issue names its own fix -> a generic one would name a DIFFERENT fix beside it
75
+ const hint = issues.every((issue) => issue.message.includes(FIX_NAMED_MARKER))
76
+ ? VALIDATION_HINT_SELF_NAMED
77
+ : VALIDATION_HINT_GENERIC;
78
+ return new helpful_errors_1.ConstraintError(`validation failed: ${issuesMessage}`, { issues, hint });
23
79
  };
24
80
  exports.getValidationError = getValidationError;
25
81
  //# sourceMappingURL=getValidationError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getValidationError.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getValidationError.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAGjD,+DAG+B;AAM/B;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAC,KAAoC,EAAU,EAAE;IACxE,OAAO,KAAK,CAAC,MAAM;SAChB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;SACjD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC,CAAC;AAEF;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAElC,EAA4C,EAAE;IAC7C,MAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACnE,MAAM,aAAa,GAAG,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAEnD,OAAO,IAAI,gCAAe,CACxB,sBAAsB,aAAa,EAAE,EACrC,EAAE,MAAM,EAAE,CACX,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,kBAAkB,sBAU7B"}
1
+ {"version":3,"file":"getValidationError.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getValidationError.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAGjD,+DAI+B;AAO/B;;;;;;;;;;;;;;;GAeG;AACH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,uBAAuB,GAC3B,wGAAwG,CAAC;AAE3G;;;;;;;;GAQG;AACH,MAAM,0BAA0B,GAC9B,sMAAsM,CAAC;AAEzM;;;;;;;;;;;;;;GAcG;AACH,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEhC;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAElC,EAA4C,EAAE;IAC7C,MAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACnE,MAAM,aAAa,GAAG,IAAA,wCAAkB,EAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAErD,sFAAsF;IACtF,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QAC5E,CAAC,CAAC,0BAA0B;QAC5B,CAAC,CAAC,uBAAuB,CAAC;IAE5B,OAAO,IAAI,gCAAe,CACxB,sBAAsB,aAAa,EAAE,EACrC,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,kBAAkB,sBAe7B"}
@@ -7,7 +7,27 @@ export interface ZodIssueSummary {
7
7
  /**
8
8
  * .what = transforms zod issues array into friendly summary format
9
9
  * .why = standard zod error format across validation boundaries
10
+ *
11
+ * .note = this is the ONE place a zod path becomes a string, so the root token lands once and
12
+ * reaches every surface: the input border's message (`getValidationError`), and the
13
+ * metadata of BOTH borders (`getValidatedInput` + `getValidatedOutput`). a repair at
14
+ * the render site instead would have left the output border and the metadata unfixed
10
15
  */
11
16
  export declare const getZodIssuesSummary: (input: {
12
17
  issues: ZodIssue[];
13
18
  }) => ZodIssueSummary[];
19
+ /**
20
+ * .what = renders a summary as the one-line `path: message` list an error carries in its title
21
+ * .why = an error's `.message` is the only part a log line, a stack trace, or a caller's
22
+ * `console.error` shows without a decode of the metadata — so the PATHS have to be in it
23
+ * (rule.require.errors-name-the-fix: what went wrong, and where)
24
+ *
25
+ * .note = it lives HERE, beside `getZodIssuesSummary`, rather than at either border. the two
26
+ * borders throw different classes (`ConstraintError` in, `MalfunctionError` out) and
27
+ * name different fixes — but the RENDER of a path list is one guarantee, so it has one
28
+ * home (rule.forbid.parallel-codepaths). a copy at the second border is the copy that
29
+ * would rot, and the root-token note above already names every surface this must reach
30
+ */
31
+ export declare const asZodIssuesMessage: (input: {
32
+ issues: ZodIssueSummary[];
33
+ }) => string;
@@ -1,16 +1,45 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getZodIssuesSummary = void 0;
3
+ exports.asZodIssuesMessage = exports.getZodIssuesSummary = void 0;
4
+ /**
5
+ * .what = the token a ROOT-level issue occupies the `path` slot with
6
+ * .why = zod reports a root-level fault as an EMPTY path array, and the plain join of one is
7
+ * `''` — which renders as a bare `: ` at the one site that prints a path beside a
8
+ * message, and as `"path": ""` in the metadata `helpful-errors` serializes into that
9
+ * same string. both read as an ABSENT location rather than as the root, and the two
10
+ * shapes a caller most often hits at the body border — a raw string and a null — are
11
+ * BOTH root-level, so this is the common surface rather than an edge of it
12
+ */
13
+ const PATH_ROOT = '(root)';
4
14
  /**
5
15
  * .what = transforms zod issues array into friendly summary format
6
16
  * .why = standard zod error format across validation boundaries
17
+ *
18
+ * .note = this is the ONE place a zod path becomes a string, so the root token lands once and
19
+ * reaches every surface: the input border's message (`getValidationError`), and the
20
+ * metadata of BOTH borders (`getValidatedInput` + `getValidatedOutput`). a repair at
21
+ * the render site instead would have left the output border and the metadata unfixed
7
22
  */
8
23
  const getZodIssuesSummary = (input) => {
9
24
  return input.issues.map((issue) => ({
10
- path: issue.path.join('.'),
25
+ path: issue.path.length ? issue.path.join('.') : PATH_ROOT,
11
26
  message: issue.message,
12
27
  code: issue.code,
13
28
  }));
14
29
  };
15
30
  exports.getZodIssuesSummary = getZodIssuesSummary;
31
+ /**
32
+ * .what = renders a summary as the one-line `path: message` list an error carries in its title
33
+ * .why = an error's `.message` is the only part a log line, a stack trace, or a caller's
34
+ * `console.error` shows without a decode of the metadata — so the PATHS have to be in it
35
+ * (rule.require.errors-name-the-fix: what went wrong, and where)
36
+ *
37
+ * .note = it lives HERE, beside `getZodIssuesSummary`, rather than at either border. the two
38
+ * borders throw different classes (`ConstraintError` in, `MalfunctionError` out) and
39
+ * name different fixes — but the RENDER of a path list is one guarantee, so it has one
40
+ * home (rule.forbid.parallel-codepaths). a copy at the second border is the copy that
41
+ * would rot, and the root-token note above already names every surface this must reach
42
+ */
43
+ const asZodIssuesMessage = (input) => input.issues.map((issue) => `${issue.path}: ${issue.message}`).join('; ');
44
+ exports.asZodIssuesMessage = asZodIssuesMessage;
16
45
  //# sourceMappingURL=getZodIssuesSummary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getZodIssuesSummary.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.ts"],"names":[],"mappings":";;;AAQA;;;GAGG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAEnC,EAAqB,EAAE;IACtB,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAClC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;QAC1B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AARW,QAAA,mBAAmB,uBAQ9B"}
1
+ {"version":3,"file":"getZodIssuesSummary.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.ts"],"names":[],"mappings":";;;AAQA;;;;;;;;GAQG;AACH,MAAM,SAAS,GAAG,QAAQ,CAAC;AAE3B;;;;;;;;GAQG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAEnC,EAAqB,EAAE;IACtB,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAClC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;QAC1D,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AARW,QAAA,mBAAmB,uBAQ9B;AAEF;;;;;;;;;;;GAWG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAElC,EAAU,EAAE,CACX,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAH/D,QAAA,kBAAkB,sBAG6C"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRefGenericsUsed = exports.getTypescriptFromJsonSchema = void 0;
4
4
  const helpful_errors_1 = require("helpful-errors");
5
+ const getAllJsonSchemaNodes_1 = require("../getAllJsonSchemaNodes");
5
6
  /**
6
7
  * .what = compile a json-schema into a TypeScript type literal string
7
8
  * .why = the codegen needs typed shapes for mechanism args/returns + resource
@@ -68,6 +69,23 @@ const asType = (node, dobjRefs, skipRootPragma = false) => {
68
69
  return asArray(node, dobjRefs);
69
70
  if (type === 'object')
70
71
  return asObject(node, dobjRefs);
72
+ // `not: {}` → void. the node declares that NO json value is valid at this position —
73
+ // the shape `getJsonSchemaFromZod` emits for a `z.undefined()` / `z.void()` position,
74
+ // and the shape zod itself emits for `z.never()`
75
+ //
76
+ // .why `void` and not `never` = it must read correctly at BOTH positions this node
77
+ // reaches. as a mechanism's return, `Promise<void>` is right and `Promise<never>`
78
+ // would claim the call cannot return at all; as a key, `k?: void` permits the key
79
+ // to be absent, which is what the position accepts. `void` is the one TS type that
80
+ // is correct in each
81
+ //
82
+ // ⚠️ .why it is NOT left to the `unknown` fallthrough below = `unknown` says "any value
83
+ // may be here", which is the exact inverse of what this node declares. so the
84
+ // generated client would carry a rubber-stamp for the one position whose contract
85
+ // is the most precise one available (rule.forbid.failhide)
86
+ const not = node.not;
87
+ if (not && Object.keys(not).length === 0)
88
+ return 'void';
71
89
  // no recognizable shape → unknown (surfaces upstream schema looseness)
72
90
  return 'unknown';
73
91
  };
@@ -130,7 +148,7 @@ const REF_GENERIC_BY = {
130
148
  };
131
149
  /**
132
150
  * .what = read the `x-domain-object-ref` pragma off a schema node (the reference
133
- * pragma stamped by `X.contract.ref(by)` in domain-objects@0.33.0)
151
+ * pragma stamped by `X.contract().ref(by)` in domain-objects)
134
152
  * .why = a reference field carries only the referenced dobj (`of`) + which key (`by`)
135
153
  */
136
154
  const asRefPragma = (node) => node['x-domain-object-ref'];
@@ -161,27 +179,14 @@ const asRefType = (node, dobjRefs) => {
161
179
  */
162
180
  const getRefGenericsUsed = (input) => {
163
181
  const used = new Set();
164
- collectRefGenerics(input.schema, input.dobjRefs, used);
182
+ for (const node of (0, getAllJsonSchemaNodes_1.getAllJsonSchemaNodes)({ root: input.schema })) {
183
+ const ref = asRefPragma(node);
184
+ if (ref && input.dobjRefs[ref.of])
185
+ used.add(REF_GENERIC_BY[ref.by]);
186
+ }
165
187
  return [...used].sort();
166
188
  };
167
189
  exports.getRefGenericsUsed = getRefGenericsUsed;
168
- /**
169
- * .what = recursively collect the ref generics used across a schema tree
170
- */
171
- const collectRefGenerics = (node, dobjRefs, used) => {
172
- if (typeof node !== 'object' || node === null)
173
- return;
174
- const ref = asRefPragma(node);
175
- if (ref && dobjRefs[ref.of])
176
- used.add(REF_GENERIC_BY[ref.by]);
177
- for (const value of Object.values(node)) {
178
- if (Array.isArray(value))
179
- for (const item of value)
180
- collectRefGenerics(item, dobjRefs, used);
181
- else
182
- collectRefGenerics(value, dobjRefs, used);
183
- }
184
- };
185
190
  /**
186
191
  * .what = render a property key, quoted when it is not a valid identifier
187
192
  */
@@ -1 +1 @@
1
- {"version":3,"file":"getTypescriptFromJsonSchema.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.ts"],"names":[],"mappings":";;;AACA,mDAAyD;AAGzD;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,2BAA2B,GAAG,CAAC,KAI3C,EAAU,EAAE,CACX,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,IAAI,EAAE,EAAE,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,CAAC;AAL5D,QAAA,2BAA2B,+BAKiC;AAEzE;;;GAGG;AACH,MAAM,MA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AAQ,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;AACH,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,KAAK,GAAG,CAAC,GAAW,EAAU,EAAE,CACpC,4BAA4B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"getTypescriptFromJsonSchema.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.ts"],"names":[],"mappings":";;;AACA,mDAAyD;AAGzD,oEAAiE;AAEjE;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,2BAA2B,GAAG,CAAC,KAI3C,EAAU,EAAE,CACX,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,IAAI,EAAE,EAAE,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,CAAC;AAL5D,QAAA,2BAA2B,+BAKiC;AAEzE;;;GAGG;AACH,MAAM,MAAM,GAAG,CACb,IAAgB,EAChB,QAAgC,EAChC,cAAc,GAAG,KAAK,EACd,EAAE;IACV,6EAA6E;IAC7E,wFAAwF;IACxF,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC1C,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAE5B,8EAA8E;IAC9E,4EAA4E;IAC5E,MAAM,MAAM,GAAI,IAAiD,CAC/D,iBAAiB,CAClB,CAAC;IACF,IAAI,CAAC,cAAc,IAAI,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;QACpD,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAW,CAAC;IAEzC,uBAAuB;IACvB,IAAI,OAAO,IAAI,IAAI;QAAE,OAAO,SAAS,CAAE,IAA2B,CAAC,KAAK,CAAC,CAAC;IAE1E,2BAA2B;IAC3B,MAAM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OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,WAAW,QAAQ,GAAG,CAAC;AACzD,CAAC,CAAC;AAEF;;;;;GAKG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAGlC,EAAY,EAAE;IACb,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,KAAK,MAAM,IAAI,IAAI,IAAA,6CAAqB,EAAC,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;QACjE,MAAM,GAAG,GAAG,WAAW,CAAC,IAAkB,CAAC,CAAC;QAC5C,IAAI,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AAC1B,CAAC,CAAC;AAZW,QAAA,kBAAkB,sBAY7B;AAEF;;GAEG;AACH,MAAM,KAAK,GAAG,CAAC,GAAW,EAAU,EAAE,CACpC,4BAA4B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC"}
@@ -4,11 +4,18 @@ import type { DomainObjectCaptured } from '../../../domain.objects/DomainObjectC
4
4
  * .what = read the `x-domain-object` pragma off one json-schema node → a
5
5
  * DomainObjectCaptured, or null when the node carries no pragma
6
6
  * .why = a captured node identifies a domain-object only if its schema was built
7
- * from `SomeDobj.contract`; a plain shape has no pragma and stays a plain type
7
+ * from `X.contract()`; a plain shape has no pragma and stays a plain type
8
8
  *
9
- * .kind = domain-objects@0.33.0 stamps the true `kind` on the pragma (via getKind).
9
+ * .kind = domain-objects stamps the true `kind` on the pragma (via getKind) since 0.33.0.
10
10
  * read it directly; fall back to the legacy `primary`-non-empty heuristic
11
- * only for a pre-0.33 producer whose pragma omits `kind` (cross-version safe)
11
+ * only for a pre-0.33 producer whose pragma omits `kind`
12
+ *
13
+ * .note = ⚠️ that fallback is REAL backcompat, and it holds for a reason this repo's own
14
+ * version cannot settle: the pragma's producer is the REMOTE lambda under
15
+ * introspection, which runs its own `domain-objects` on its own release cadence.
16
+ * so our bump to 0.34.0 does not retire a pre-0.33 producer — a peer service
17
+ * still on 0.32.x emits a `kind`-less pragma, and to drop the fallback would
18
+ * mis-type its every entity as a literal, silently
12
19
  */
13
20
  export declare const asDomainObjectPragma: (input: {
14
21
  node: JSONSchema;
@@ -5,11 +5,18 @@ exports.asDomainObjectPragma = void 0;
5
5
  * .what = read the `x-domain-object` pragma off one json-schema node → a
6
6
  * DomainObjectCaptured, or null when the node carries no pragma
7
7
  * .why = a captured node identifies a domain-object only if its schema was built
8
- * from `SomeDobj.contract`; a plain shape has no pragma and stays a plain type
8
+ * from `X.contract()`; a plain shape has no pragma and stays a plain type
9
9
  *
10
- * .kind = domain-objects@0.33.0 stamps the true `kind` on the pragma (via getKind).
10
+ * .kind = domain-objects stamps the true `kind` on the pragma (via getKind) since 0.33.0.
11
11
  * read it directly; fall back to the legacy `primary`-non-empty heuristic
12
- * only for a pre-0.33 producer whose pragma omits `kind` (cross-version safe)
12
+ * only for a pre-0.33 producer whose pragma omits `kind`
13
+ *
14
+ * .note = ⚠️ that fallback is REAL backcompat, and it holds for a reason this repo's own
15
+ * version cannot settle: the pragma's producer is the REMOTE lambda under
16
+ * introspection, which runs its own `domain-objects` on its own release cadence.
17
+ * so our bump to 0.34.0 does not retire a pre-0.33 producer — a peer service
18
+ * still on 0.32.x emits a `kind`-less pragma, and to drop the fallback would
19
+ * mis-type its every entity as a literal, silently
13
20
  */
14
21
  const asDomainObjectPragma = (input) => {
15
22
  // read the pragma keyword off the node (absent → not a domain-object)
@@ -1 +1 @@
1
- {"version":3,"file":"asDomainObjectPragma.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;GASG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAEpC,EAA+B,EAAE;IAChC,sEAAsE;IACtE,MAAM,MAAM,GAAI,KAAK,CAAC,IAAmD,CACvE,iBAAiB,CAClB,CAAC;IACF,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEzB,sEAAsE;IACtE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IACrC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC;IACnC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IAEnC,0EAA0E;IAC1E,MAAM,IAAI,GACR,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAE7D,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI;QACJ,OAAO;QACP,MAAM;QACN,KAAK;QACL,MAAM;QACN,KAAK,EAAE,KAAK,CAAC,IAAI;KACM,CAAC;AAC5B,CAAC,CAAC;AA5BW,QAAA,oBAAoB,wBA4B/B"}
1
+ {"version":3,"file":"asDomainObjectPragma.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAEpC,EAA+B,EAAE;IAChC,sEAAsE;IACtE,MAAM,MAAM,GAAI,KAAK,CAAC,IAAmD,CACvE,iBAAiB,CAClB,CAAC;IACF,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEzB,sEAAsE;IACtE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IACrC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC;IACnC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IAEnC,0EAA0E;IAC1E,MAAM,IAAI,GACR,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAE7D,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI;QACJ,OAAO;QACP,MAAM;QACN,KAAK;QACL,MAAM;QACN,KAAK,EAAE,KAAK,CAAC,IAAI;KACM,CAAC;AAC5B,CAAC,CAAC;AA5BW,QAAA,oBAAoB,wBA4B/B"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assertAllDomainObjectRefsBind = void 0;
4
4
  const LambdaDomainObjectRefUnbindableError_1 = require("../../../domain.objects/LambdaDomainObjectRefUnbindableError");
5
+ const getAllJsonSchemaNodes_1 = require("../getAllJsonSchemaNodes");
5
6
  /**
6
7
  * .what = verify every `x-domain-object-ref` across a service's contracts names a
7
8
  * dobj that is captured in full (present in `capturedNames`)
@@ -15,10 +16,13 @@ const LambdaDomainObjectRefUnbindableError_1 = require("../../../domain.objects/
15
16
  const assertAllDomainObjectRefsBind = (input) => {
16
17
  const referencedNames = new Set();
17
18
  // walk each endpoint's input + output schema trees for ref-pragma names
18
- for (const schema of Object.values(input.contracts)) {
19
- collectRefNames({ node: schema.input, into: referencedNames });
20
- collectRefNames({ node: schema.output, into: referencedNames });
21
- }
19
+ for (const schema of Object.values(input.contracts))
20
+ for (const root of [schema.input, schema.output])
21
+ for (const node of (0, getAllJsonSchemaNodes_1.getAllJsonSchemaNodes)({ root })) {
22
+ const ref = node['x-domain-object-ref'];
23
+ if (ref?.of)
24
+ referencedNames.add(ref.of);
25
+ }
22
26
  // every referenced name must be captured in full; else the ref cannot bind
23
27
  const unbound = [...referencedNames]
24
28
  .filter((name) => !input.capturedNames.has(name))
@@ -26,26 +30,8 @@ const assertAllDomainObjectRefsBind = (input) => {
26
30
  if (unbound.length > 0)
27
31
  throw new LambdaDomainObjectRefUnbindableError_1.LambdaDomainObjectRefUnbindableError(`domain-object reference(s) cannot bind: ${unbound.join(', ')} — referenced by key but captured by no endpoint`, {
28
32
  unbound,
29
- hint: 'surface each referenced domain-object in full on some endpoint of this service (return it whole via `.contract`) so the codegen can declare its resource',
33
+ hint: 'surface each referenced domain-object in full on some endpoint of this service (return it whole via `X.contract()`) so the codegen can declare its resource',
30
34
  });
31
35
  };
32
36
  exports.assertAllDomainObjectRefsBind = assertAllDomainObjectRefsBind;
33
- /**
34
- * .what = recursively read every `x-domain-object-ref` name in a schema tree
35
- */
36
- const collectRefNames = (input) => {
37
- const { node, into } = input;
38
- if (typeof node !== 'object' || node === null)
39
- return;
40
- const ref = node['x-domain-object-ref'];
41
- if (ref?.of)
42
- into.add(ref.of);
43
- for (const value of Object.values(node)) {
44
- if (Array.isArray(value))
45
- for (const item of value)
46
- collectRefNames({ node: item, into });
47
- else
48
- collectRefNames({ node: value, into });
49
- }
50
- };
51
37
  //# sourceMappingURL=assertAllDomainObjectRefsBind.js.map