sdk-aws-lambda 0.2.0 → 0.3.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 (69) hide show
  1. package/dist/contract/cli/asGenArgs.d.ts +21 -0
  2. package/dist/contract/cli/asGenArgs.js +69 -0
  3. package/dist/contract/cli/asGenArgs.js.map +1 -0
  4. package/dist/contract/cli/gen.d.ts +23 -0
  5. package/dist/contract/cli/gen.js +72 -0
  6. package/dist/contract/cli/gen.js.map +1 -0
  7. package/dist/domain.objects/DomainObjectCaptured.d.ts +51 -0
  8. package/dist/domain.objects/DomainObjectCaptured.js +8 -0
  9. package/dist/domain.objects/DomainObjectCaptured.js.map +1 -0
  10. package/dist/domain.objects/GeneratedFile.d.ts +18 -0
  11. package/dist/domain.objects/GeneratedFile.js +8 -0
  12. package/dist/domain.objects/GeneratedFile.js.map +1 -0
  13. package/dist/domain.objects/LambdaCredentialsAbsentError.d.ts +11 -0
  14. package/dist/domain.objects/LambdaCredentialsAbsentError.js +16 -0
  15. package/dist/domain.objects/LambdaCredentialsAbsentError.js.map +1 -0
  16. package/dist/domain.objects/LambdaDomainObjectNotCapturableError.d.ts +12 -0
  17. package/dist/domain.objects/LambdaDomainObjectNotCapturableError.js +17 -0
  18. package/dist/domain.objects/LambdaDomainObjectNotCapturableError.js.map +1 -0
  19. package/dist/domain.objects/LambdaDomainObjectRefUnbindableError.d.ts +14 -0
  20. package/dist/domain.objects/LambdaDomainObjectRefUnbindableError.js +19 -0
  21. package/dist/domain.objects/LambdaDomainObjectRefUnbindableError.js.map +1 -0
  22. package/dist/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.d.ts +16 -0
  23. package/dist/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.js +36 -0
  24. package/dist/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.js.map +1 -0
  25. package/dist/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.d.ts +10 -0
  26. package/dist/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.js +18 -0
  27. package/dist/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.js.map +1 -0
  28. package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.d.ts +14 -0
  29. package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.js +44 -0
  30. package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.js.map +1 -0
  31. package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.d.ts +11 -0
  32. package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.js +42 -0
  33. package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.js.map +1 -0
  34. package/dist/domain.operations/genServiceSdk/gen.file/banner.d.ts +9 -0
  35. package/dist/domain.operations/genServiceSdk/gen.file/banner.js +16 -0
  36. package/dist/domain.operations/genServiceSdk/gen.file/banner.js.map +1 -0
  37. package/dist/domain.operations/genServiceSdk/gen.file/formatTypescript.d.ts +20 -0
  38. package/dist/domain.operations/genServiceSdk/gen.file/formatTypescript.js +44 -0
  39. package/dist/domain.operations/genServiceSdk/gen.file/formatTypescript.js.map +1 -0
  40. package/dist/domain.operations/genServiceSdk/gen.file/setGeneratedFilesBatch.d.ts +13 -0
  41. package/dist/domain.operations/genServiceSdk/gen.file/setGeneratedFilesBatch.js +49 -0
  42. package/dist/domain.operations/genServiceSdk/gen.file/setGeneratedFilesBatch.js.map +1 -0
  43. package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.d.ts +16 -0
  44. package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js +39 -0
  45. package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js.map +1 -0
  46. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.d.ts +35 -0
  47. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js +189 -0
  48. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js.map +1 -0
  49. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.d.ts +15 -0
  50. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js +37 -0
  51. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js.map +1 -0
  52. package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.d.ts +26 -0
  53. package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.js +106 -0
  54. package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.js.map +1 -0
  55. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.d.ts +15 -0
  56. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js +51 -0
  57. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js.map +1 -0
  58. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.d.ts +14 -0
  59. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js +68 -0
  60. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js.map +1 -0
  61. package/dist/domain.operations/genServiceSdk/genServiceSdk.d.ts +20 -0
  62. package/dist/domain.operations/genServiceSdk/genServiceSdk.js +88 -0
  63. package/dist/domain.operations/genServiceSdk/genServiceSdk.js.map +1 -0
  64. package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js +49 -4
  65. package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js.map +1 -1
  66. package/dist/index.d.ts +5 -0
  67. package/dist/index.js +12 -1
  68. package/dist/index.js.map +1 -1
  69. package/package.json +11 -8
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asResourceClassSource = exports.BASE_CLASS_BY_KIND = void 0;
4
+ const getTypescriptFromJsonSchema_1 = require("../gen.mechanism/getTypescriptFromJsonSchema");
5
+ /**
6
+ * .what = the domain-objects base class each `kind` maps to
7
+ * .why = the pragma stamps the true `kind`; the resource extends the base class it
8
+ * names (entity→DomainEntity, literal→DomainLiteral, event→DomainEvent,
9
+ * object→a plain DomainObject)
10
+ */
11
+ exports.BASE_CLASS_BY_KIND = {
12
+ entity: 'DomainEntity',
13
+ literal: 'DomainLiteral',
14
+ event: 'DomainEvent',
15
+ object: 'DomainObject',
16
+ };
17
+ /**
18
+ * .what = emit the TS source for one captured domain-object: its prefixed
19
+ * interface + prefixed class with primary/unique/alias/nested (no schema)
20
+ * .why = the resources file declares each upstream dobj so the consumer gets a
21
+ * real DomainEntity/DomainLiteral (etc), not a bare type (uc.2)
22
+ *
23
+ * .rules
24
+ * - class name = `prefix + name` (the TS class name from the pragma; NOT alias)
25
+ * - base class = the domain-objects class the pragma's `kind` maps to
26
+ * - nested type names are prefixed via the same formula
27
+ * - no `static schema` — consumers do not re-validate
28
+ */
29
+ const asResourceClassSource = (input) => {
30
+ const { dobj, prefix } = input;
31
+ // the emitted symbol name for this dobj (e.g. SvcJobsJob)
32
+ const symbol = `${prefix}${dobj.name}`;
33
+ // the interface shape, with nested dobj-tagged props referenced by prefixed
34
+ // name; asRootShape renders THIS dobj's own shape (not a self-ref)
35
+ const shape = (0, getTypescriptFromJsonSchema_1.getTypescriptFromJsonSchema)({
36
+ schema: dobj.shape,
37
+ dobjRefs: input.dobjRefs,
38
+ asRootShape: true,
39
+ });
40
+ // the base class the dobj's kind maps to
41
+ const base = exports.BASE_CLASS_BY_KIND[dobj.kind];
42
+ // the static key + metadata lines (omit those with no content)
43
+ const statics = [
44
+ asStaticArray('primary', dobj.primary),
45
+ asStaticArray('unique', dobj.unique),
46
+ asStaticAlias(dobj.alias),
47
+ asStaticNested(dobj.nested, prefix),
48
+ ].filter((line) => line !== null);
49
+ const interfaceLine = `export interface ${symbol} ${shape}`;
50
+ const classBody = statics.length > 0 ? `\n ${statics.join('\n ')}\n` : '';
51
+ const classLine = `export class ${symbol} extends ${base}<${symbol}> implements ${symbol} {${classBody}}`;
52
+ // a blank line between the interface + class halves makes each dobj's two-part
53
+ // structure obvious at a glance (biome preserves the gap)
54
+ return `${interfaceLine}\n\n${classLine}`;
55
+ };
56
+ exports.asResourceClassSource = asResourceClassSource;
57
+ /**
58
+ * .what = render a `public static primary = [...] as const;` line, or null if empty
59
+ */
60
+ const asStaticArray = (name, values) => {
61
+ if (values.length === 0)
62
+ return null;
63
+ const items = values.map((v) => JSON.stringify(v)).join(', ');
64
+ return `public static ${name} = [${items}] as const;`;
65
+ };
66
+ /**
67
+ * .what = render a `public static alias = ...;` line, or null if absent
68
+ * .why = the alias is a string ('surfboard') or an object ({ singular, plural });
69
+ * render it as a TS literal — NOT `JSON.stringify` (which emits cramped raw
70
+ * json `{"singular":"job"}` with quoted keys, a codegen blemish)
71
+ */
72
+ const asStaticAlias = (alias) => {
73
+ if (alias === null)
74
+ return null;
75
+ return `public static alias = ${asAliasLiteral(alias)};`;
76
+ };
77
+ /**
78
+ * .what = render an alias value as a clean TS literal
79
+ * .why = a string alias becomes a string literal; an object alias becomes an
80
+ * object literal with unquoted keys + spaces (`{ singular: "job" }`)
81
+ */
82
+ const asAliasLiteral = (alias) => {
83
+ if (typeof alias === 'string')
84
+ return JSON.stringify(alias);
85
+ const members = Object.entries(alias).map(([key, value]) => `${key}: ${JSON.stringify(value)}`);
86
+ return `{ ${members.join(', ')} }`;
87
+ };
88
+ /**
89
+ * .what = render a `public static nested = { key: PrefixedType, ... };` line
90
+ * .why = each nested type name gets the service prefix, so it points at the
91
+ * prefixed resource declaration; an array value (polymorphic) emits an
92
+ * array of prefixed names
93
+ */
94
+ const asStaticNested = (nested, prefix) => {
95
+ const entries = Object.entries(nested);
96
+ if (entries.length === 0)
97
+ return null;
98
+ const members = entries.map(([key, typeName]) => {
99
+ const value = Array.isArray(typeName)
100
+ ? `[${typeName.map((n) => `${prefix}${n}`).join(', ')}]`
101
+ : `${prefix}${typeName}`;
102
+ return `${key}: ${value}`;
103
+ });
104
+ return `public static nested = { ${members.join(', ')} };`;
105
+ };
106
+ //# sourceMappingURL=asResourceClassSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asResourceClassSource.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.ts"],"names":[],"mappings":";;;AAGA,8FAA2F;AAE3F;;;;;GAKG;AACU,QAAA,kBAAkB,GAAqC;IAClE,MAAM,EAAE,cAAc;IACtB,OAAO,EAAE,eAAe;IACxB,KAAK,EAAE,aAAa;IACpB,MAAM,EAAE,cAAc;CACvB,CAAC;AAEF;;;;;;;;;;;GAWG;AACI,MAAM,qBAAqB,GAAG,CAAC,KAIrC,EAAU,EAAE;IACX,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAE/B,0DAA0D;IAC1D,MAAM,MAAM,GAAG,GAAG,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAEvC,4EAA4E;IAC5E,mEAAmE;IACnE,MAAM,KAAK,GAAG,IAAA,yDAA2B,EAAC;QACxC,MAAM,EAAE,IAAI,CAAC,KAAK;QAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC;IAEH,yCAAyC;IACzC,MAAM,IAAI,GAAG,0BAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE3C,+DAA+D;IAC/D,MAAM,OAAO,GAAG;QACd,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC;QACtC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC;QACpC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC;QACzB,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;KACpC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC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,GAAG,CACvC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CACrD,CAAC;IACF,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACrC,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,cAAc,GAAG,CACrB,MAAsC,EACtC,MAAc,EACC,EAAE;IACjB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEtC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,EAAE;QAC9C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;YACnC,CAAC,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YACxD,CAAC,CAAC,GAAG,MAAM,GAAG,QAAQ,EAAE,CAAC;QAC3B,OAAO,GAAG,GAAG,KAAK,KAAK,EAAE,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,OAAO,4BAA4B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;AAC7D,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { LambdaEndpointSchema } from '../../../domain.objects/LambdaEndpointSchema';
2
+ /**
3
+ * .what = verify every `x-domain-object-ref` across a service's contracts names a
4
+ * dobj that is captured in full (present in `capturedNames`)
5
+ * .why = a reference emits `RefByPrimary<typeof Svc<Prefix><Name>>`; that prefixed
6
+ * resource must be declared, else the generated sdk will not compile. an
7
+ * unbound ref means the referenced dobj is surfaced by no endpoint whole —
8
+ * fail loud so the caller surfaces it (all-or-none, exit 2)
9
+ *
10
+ * .throws LambdaDomainObjectRefUnbindableError — names the unbound ref + its dobj
11
+ */
12
+ export declare const assertAllDomainObjectRefsBind: (input: {
13
+ contracts: Record<string, LambdaEndpointSchema>;
14
+ capturedNames: Set<string>;
15
+ }) => void;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertAllDomainObjectRefsBind = void 0;
4
+ const LambdaDomainObjectRefUnbindableError_1 = require("../../../domain.objects/LambdaDomainObjectRefUnbindableError");
5
+ /**
6
+ * .what = verify every `x-domain-object-ref` across a service's contracts names a
7
+ * dobj that is captured in full (present in `capturedNames`)
8
+ * .why = a reference emits `RefByPrimary<typeof Svc<Prefix><Name>>`; that prefixed
9
+ * resource must be declared, else the generated sdk will not compile. an
10
+ * unbound ref means the referenced dobj is surfaced by no endpoint whole —
11
+ * fail loud so the caller surfaces it (all-or-none, exit 2)
12
+ *
13
+ * .throws LambdaDomainObjectRefUnbindableError — names the unbound ref + its dobj
14
+ */
15
+ const assertAllDomainObjectRefsBind = (input) => {
16
+ const referencedNames = new Set();
17
+ // 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
+ }
22
+ // every referenced name must be captured in full; else the ref cannot bind
23
+ const unbound = [...referencedNames]
24
+ .filter((name) => !input.capturedNames.has(name))
25
+ .sort();
26
+ if (unbound.length > 0)
27
+ throw new LambdaDomainObjectRefUnbindableError_1.LambdaDomainObjectRefUnbindableError(`domain-object reference(s) cannot bind: ${unbound.join(', ')} — referenced by key but captured by no endpoint`, {
28
+ 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',
30
+ });
31
+ };
32
+ 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
+ //# sourceMappingURL=assertAllDomainObjectRefsBind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertAllDomainObjectRefsBind.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.ts"],"names":[],"mappings":";;;AAEA,uHAAoH;AAGpH;;;;;;;;;GASG;AACI,MAAM,6BAA6B,GAAG,CAAC,KAG7C,EAAQ,EAAE;IACT,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAE1C,wEAAwE;IACxE,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QACpD,eAAe,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;QAC/D,eAAe,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,2EAA2E;IAC3E,MAAM,OAAO,GAAG,CAAC,GAAG,eAAe,CAAC;SACjC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAChD,IAAI,EAAE,CAAC;IACV,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;QACpB,MAAM,IAAI,2EAAoC,CAC5C,2CAA2C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,kDAAkD,EAC/G;YACE,OAAO;YACP,IAAI,EAAE,0JAA0J;SACjK,CACF,CAAC;AACN,CAAC,CAAC;AAxBW,QAAA,6BAA6B,iCAwBxC;AAEF;;GAEG;AACH,MAAM,eAAe,GAAG,CAAC,KAA2C,EAAQ,EAAE;IAC5E,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAC7B,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO;IAEtD,MAAM,GAAG,GAAI,IAA0D,CACrE,qBAAqB,CACtB,CAAC;IACF,IAAI,GAAG,EAAE,EAAE;QAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAE9B,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,IAA+B,CAAC,EAAE,CAAC;QACnE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACtB,KAAK,MAAM,IAAI,IAAI,KAAK;gBAAE,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;;YAC7D,eAAe,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { DomainObjectCaptured } from '../../../domain.objects/DomainObjectCaptured';
2
+ import type { LambdaEndpointSchema } from '../../../domain.objects/LambdaEndpointSchema';
3
+ /**
4
+ * .what = collect every domain-object captured across a service's contracts,
5
+ * de-duplicated by name
6
+ * .why = the resources file declares each captured dobj once; a dobj referenced
7
+ * by many endpoints must yield a single declaration (uc.2 dedupe)
8
+ *
9
+ * .throws LambdaDomainObjectNotCapturableError — a pragma-tagged node whose shape
10
+ * cannot be reconstructed (no object properties) (uc.9)
11
+ */
12
+ export declare const getAllDomainObjectsFromContracts: (input: {
13
+ contracts: Record<string, LambdaEndpointSchema>;
14
+ }) => DomainObjectCaptured[];
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAllDomainObjectsFromContracts = void 0;
4
+ const LambdaDomainObjectNotCapturableError_1 = require("../../../domain.objects/LambdaDomainObjectNotCapturableError");
5
+ const asDomainObjectPragma_1 = require("./asDomainObjectPragma");
6
+ /**
7
+ * .what = collect every domain-object captured across a service's contracts,
8
+ * de-duplicated by name
9
+ * .why = the resources file declares each captured dobj once; a dobj referenced
10
+ * by many endpoints must yield a single declaration (uc.2 dedupe)
11
+ *
12
+ * .throws LambdaDomainObjectNotCapturableError — a pragma-tagged node whose shape
13
+ * cannot be reconstructed (no object properties) (uc.9)
14
+ */
15
+ const getAllDomainObjectsFromContracts = (input) => {
16
+ // collect every dobj contract from every endpoint's input + output schemas
17
+ const captured = new Map();
18
+ // walk each endpoint's input and output schema trees
19
+ for (const schema of Object.values(input.contracts)) {
20
+ collectFromNode({ node: schema.input, captured });
21
+ collectFromNode({ node: schema.output, captured });
22
+ }
23
+ // return the de-duplicated contracts in stable (name-sorted) order
24
+ return [...captured.values()].sort((a, b) => a.name.localeCompare(b.name));
25
+ };
26
+ exports.getAllDomainObjectsFromContracts = getAllDomainObjectsFromContracts;
27
+ /**
28
+ * .what = recursively walk a json-schema node, collect every `x-domain-object`
29
+ * .why = a dobj can appear at any depth (properties, items, $defs, anyOf, etc.)
30
+ */
31
+ const collectFromNode = (input) => {
32
+ const { node, captured } = input;
33
+ // skip non-object nodes (leaves like strings/booleans/numbers)
34
+ if (typeof node !== 'object' || node === null)
35
+ return;
36
+ // capture this node if it carries a domain-object pragma
37
+ const contract = (0, asDomainObjectPragma_1.asDomainObjectPragma)({ node: node });
38
+ if (contract) {
39
+ // fail loud if the pragma names a dobj with no reconstructable shape (uc.9)
40
+ if (!getIsCapturableShape(node))
41
+ throw new LambdaDomainObjectNotCapturableError_1.LambdaDomainObjectNotCapturableError(`domain-object '${contract.name}' cannot be captured: its object schema declares no properties to reconstruct`, {
42
+ name: contract.name,
43
+ hint: 'ensure the domain-object schema declares its properties (an empty object schema cannot be captured)',
44
+ });
45
+ // keep the first capture; a repeat of the same name is a de-dup no-op
46
+ if (!captured.has(contract.name))
47
+ captured.set(contract.name, contract);
48
+ }
49
+ // recurse into every child value (arrays + nested objects)
50
+ for (const value of Object.values(node)) {
51
+ if (Array.isArray(value))
52
+ for (const item of value)
53
+ collectFromNode({ node: item, captured });
54
+ else
55
+ collectFromNode({ node: value, captured });
56
+ }
57
+ };
58
+ /**
59
+ * .what = decide whether a schema node has an object shape we can reconstruct
60
+ * .why = a dobj resource needs properties to emit; a pragma without them is uncapturable
61
+ */
62
+ const getIsCapturableShape = (node) => {
63
+ const properties = node.properties;
64
+ return (typeof properties === 'object' &&
65
+ properties !== null &&
66
+ Object.keys(properties).length > 0);
67
+ };
68
+ //# sourceMappingURL=getAllDomainObjectsFromContracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAllDomainObjectsFromContracts.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.ts"],"names":[],"mappings":";;;AAGA,uHAAoH;AAEpH,iEAA8D;AAE9D;;;;;;;;GAQG;AACI,MAAM,gCAAgC,GAAG,CAAC,KAEhD,EAA0B,EAAE;IAC3B,2EAA2E;IAC3E,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAgC,CAAC;IAEzD,qDAAqD;IACrD,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QACpD,eAAe,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClD,eAAe,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,mEAAmE;IACnE,OAAO,CAAC,GAAG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E,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClD,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAW,EAAE;IACrD,MAAM,UAAU,GAAI,IAAiC,CAAC,UAAU,CAAC;IACjE,OAAO,CACL,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,KAAK,IAAI;QACnB,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,CACnC,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { ContextAwsLambdaCaller } from '../../domain.objects/ContextAwsLambdaCaller';
2
+ import type { GeneratedFile } from '../../domain.objects/GeneratedFile';
3
+ /**
4
+ * .what = generate a per-service sdk from live lambda contract introspection
5
+ * .why = the whole codegen: discover a service's contracts, capture its
6
+ * domain-objects, and emit the three files (barrel + mechanisms +
7
+ * resources) atomically into the target dir (uc.1, uc.2)
8
+ *
9
+ * .all-or-none = all file content is assembled in memory first; only after every
10
+ * transform succeeds is it written, via one atomic batch call — so any
11
+ * discovery/capture/fs error leaves zero files written (uc.5/6/8/9)
12
+ */
13
+ export declare const genServiceSdk: (input: {
14
+ which: {
15
+ service: string;
16
+ };
17
+ into: string;
18
+ }, context: ContextAwsLambdaCaller) => Promise<{
19
+ files: GeneratedFile[];
20
+ }>;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.genServiceSdk = void 0;
4
+ const node_path_1 = require("node:path");
5
+ const getAllLambdaContracts_1 = require("../getAllLambdaContracts/getAllLambdaContracts");
6
+ const asServiceSymbols_1 = require("./asServiceSymbols/asServiceSymbols");
7
+ const asBarrelFileSource_1 = require("./gen.file/asBarrelFileSource");
8
+ const asMechanismsFileSource_1 = require("./gen.file/asMechanismsFileSource");
9
+ const asResourcesFileSource_1 = require("./gen.file/asResourcesFileSource");
10
+ const formatTypescript_1 = require("./gen.file/formatTypescript");
11
+ const setGeneratedFilesBatch_1 = require("./gen.file/setGeneratedFilesBatch");
12
+ const assertAllDomainObjectRefsBind_1 = require("./gen.resource/assertAllDomainObjectRefsBind");
13
+ const getAllDomainObjectsFromContracts_1 = require("./gen.resource/getAllDomainObjectsFromContracts");
14
+ /**
15
+ * .what = generate a per-service sdk from live lambda contract introspection
16
+ * .why = the whole codegen: discover a service's contracts, capture its
17
+ * domain-objects, and emit the three files (barrel + mechanisms +
18
+ * resources) atomically into the target dir (uc.1, uc.2)
19
+ *
20
+ * .all-or-none = all file content is assembled in memory first; only after every
21
+ * transform succeeds is it written, via one atomic batch call — so any
22
+ * discovery/capture/fs error leaves zero files written (uc.5/6/8/9)
23
+ */
24
+ const genServiceSdk = async (input, context) => {
25
+ // discover the service's endpoint contracts (prep-gated by the spine)
26
+ const contracts = await (0, getAllLambdaContracts_1.getAllLambdaContracts)({ which: { service: input.which.service } }, context);
27
+ // derive the codegen symbols (object name + dobj prefix)
28
+ const symbols = (0, asServiceSymbols_1.asServiceSymbols)({ service: input.which.service });
29
+ // capture every domain-object referenced across the contracts (de-duped)
30
+ const dobjs = (0, getAllDomainObjectsFromContracts_1.getAllDomainObjectsFromContracts)({ contracts });
31
+ // fail loud if any dobj REFERENCE (by key) names a dobj captured by no endpoint —
32
+ // its `typeof Svc<Prefix><Name>` resource would not exist (all-or-none, exit 2)
33
+ (0, assertAllDomainObjectRefsBind_1.assertAllDomainObjectRefsBind)({
34
+ contracts,
35
+ capturedNames: new Set(dobjs.map((dobj) => dobj.name)),
36
+ });
37
+ // build the ref map: each dobj name → its prefixed resource name
38
+ const dobjRefs = Object.fromEntries(dobjs.map((dobj) => [dobj.name, `${symbols.prefix}${dobj.name}`]));
39
+ const resourceNames = dobjs.map((dobj) => `${symbols.prefix}${dobj.name}`);
40
+ // the module specifiers the generated files use to import each other
41
+ const resourcesModule = `./${symbols.object}.resources`;
42
+ const mechanismsModule = `./${symbols.object}.mechanisms`;
43
+ // assemble the three file texts in memory
44
+ const resourcesText = (0, asResourcesFileSource_1.asResourcesFileSource)({
45
+ dobjs,
46
+ prefix: symbols.prefix,
47
+ dobjRefs,
48
+ });
49
+ const mechanismsText = (0, asMechanismsFileSource_1.asMechanismsFileSource)({
50
+ service: input.which.service,
51
+ object: symbols.object,
52
+ resourcesModule,
53
+ resourceNames,
54
+ contracts,
55
+ dobjRefs,
56
+ });
57
+ const barrelText = (0, asBarrelFileSource_1.asBarrelFileSource)({
58
+ object: symbols.object,
59
+ mechanismsModule,
60
+ resourcesModule,
61
+ });
62
+ // pair each text with its target path
63
+ const drafts = [
64
+ { path: (0, node_path_1.join)(input.into, `${symbols.object}.ts`), content: barrelText },
65
+ {
66
+ path: (0, node_path_1.join)(input.into, `${symbols.object}.mechanisms.ts`),
67
+ content: mechanismsText,
68
+ },
69
+ {
70
+ path: (0, node_path_1.join)(input.into, `${symbols.object}.resources.ts`),
71
+ content: resourcesText,
72
+ },
73
+ ];
74
+ // format each file's text through biome (its real target path drives which
75
+ // biome config applies) — clean, drop-in output, not our own whitespace
76
+ const files = await Promise.all(drafts.map(async (draft) => ({
77
+ path: draft.path,
78
+ content: await (0, formatTypescript_1.formatTypescript)({
79
+ content: draft.content,
80
+ path: draft.path,
81
+ }),
82
+ })));
83
+ // write all files atomically (all-or-none)
84
+ await (0, setGeneratedFilesBatch_1.setGeneratedFilesBatch)({ files });
85
+ return { files };
86
+ };
87
+ exports.genServiceSdk = genServiceSdk;
88
+ //# sourceMappingURL=genServiceSdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genServiceSdk.js","sourceRoot":"","sources":["../../../src/domain.operations/genServiceSdk/genServiceSdk.ts"],"names":[],"mappings":";;;AAAA,yCAAiC;AAGjC,0FAAuF;AACvF,0EAAuE;AACvE,sEAAmE;AACnE,8EAA2E;AAC3E,4EAAyE;AACzE,kEAA+D;AAC/D,8EAA2E;AAC3E,gGAA6F;AAC7F,sGAAmG;AAEnG;;;;;;;;;G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EAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAExC,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC,CAAC;AArFW,QAAA,aAAa,iBAqFxB"}
@@ -24,6 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.getAllLambdaContracts = void 0;
27
+ const LambdaCredentialsAbsentError_1 = require("../../domain.objects/LambdaCredentialsAbsentError");
27
28
  const LambdaIntrospectionBlockedError_1 = require("../../domain.objects/LambdaIntrospectionBlockedError");
28
29
  const LambdaServiceNotFoundError_1 = require("../../domain.objects/LambdaServiceNotFoundError");
29
30
  const asLambdaEndpoint_1 = require("../asLambdaEndpoint/asLambdaEndpoint");
@@ -50,18 +51,32 @@ const getAllLambdaContracts = async (input, context) => {
50
51
  // fail fast if introspection is blocked: only prep exposes schemas
51
52
  // (gate up front so no request is made and no schema can leak)
52
53
  if (context.env.access !== 'prep') {
53
- throw new LambdaIntrospectionBlockedError_1.LambdaIntrospectionBlockedError(`introspection is only available in prep environment, got: ${context.env.access}`, { service: input.which.service, access: context.env.access });
54
+ throw new LambdaIntrospectionBlockedError_1.LambdaIntrospectionBlockedError(`introspection is only available in prep environment, got: ${context.env.access}`, {
55
+ service: input.which.service,
56
+ access: context.env.access,
57
+ hint: 're-run with --env prep',
58
+ });
54
59
  }
55
60
  // build prefix from service + access
56
61
  const prefix = `${input.which.service}-${context.env.access}-`;
57
62
  // get or create LambdaClient (genLambdaSdk always returns valid client)
58
63
  const sdkLambda = context.aws?.lambda?.sdk ??
59
64
  (await Promise.resolve().then(() => __importStar(require('../../access/sdks/lambda/genLambdaSdk'))).then((m) => m.genLambdaSdk({ env: { region: context.env.region } })));
60
- // get all endpoint slugs by prefix
61
- const slugs = await (0, getAllLambdaFunctionsByPrefix_1.getAllLambdaFunctionsByPrefix)({ prefix }, { sdkLambda });
65
+ // discover endpoint slugs by prefix. a creds failure surfaces on this first aws
66
+ // call — map it to a caller-must-fix LambdaCredentialsAbsentError (with an unlock
67
+ // hint), not a raw aws CredentialsProviderError
68
+ const slugs = await (0, getAllLambdaFunctionsByPrefix_1.getAllLambdaFunctionsByPrefix)({ prefix }, { sdkLambda }).catch((error) => throwIfCredentialsError({
69
+ error,
70
+ service: input.which.service,
71
+ access: context.env.access,
72
+ }));
62
73
  // throw if no endpoints found
63
74
  if (slugs.length === 0) {
64
- throw new LambdaServiceNotFoundError_1.LambdaServiceNotFoundError(`no lambda functions found for service: ${input.which.service}`, { service: input.which.service, prefix });
75
+ throw new LambdaServiceNotFoundError_1.LambdaServiceNotFoundError(`no lambda functions found for service: ${input.which.service}`, {
76
+ service: input.which.service,
77
+ prefix,
78
+ hint: 'check the --for service name and verify it is deployed to the prep environment',
79
+ });
65
80
  }
66
81
  // log the discovered endpoints for observability
67
82
  context.log.debug('getAllLambdaContracts.discovered', {
@@ -86,4 +101,34 @@ const getAllLambdaContracts = async (input, context) => {
86
101
  return (0, asContractRecord_1.asContractRecord)(entries);
87
102
  };
88
103
  exports.getAllLambdaContracts = getAllLambdaContracts;
104
+ /**
105
+ * .what = decide whether an error is an aws sdk credentials failure
106
+ * .why = a creds failure is caller-must-fix (unlock + retry), not a malfunction —
107
+ * the discovery boundary maps it to a hinted LambdaCredentialsAbsentError
108
+ */
109
+ const getIsCredentialsError = (error) => {
110
+ if (!(error instanceof Error))
111
+ return false;
112
+ const name = error.name.toLowerCase();
113
+ const message = error.message.toLowerCase();
114
+ return (name.includes('credential') ||
115
+ message.includes('credential') ||
116
+ (message.includes('security token') && message.includes('expired')));
117
+ };
118
+ /**
119
+ * .what = map an aws credentials failure to a hinted LambdaCredentialsAbsentError
120
+ * .why = surface a creds failure with an unlock hint (caller-must-fix) rather than a
121
+ * raw aws error; any non-creds error rethrows unchanged. returns `never` — it
122
+ * always throws — so the caller keeps a non-null slug list.
123
+ */
124
+ const throwIfCredentialsError = (input) => {
125
+ if (!getIsCredentialsError(input.error))
126
+ throw input.error;
127
+ throw new LambdaCredentialsAbsentError_1.LambdaCredentialsAbsentError('aws credentials are absent or expired; cannot introspect', {
128
+ service: input.service,
129
+ access: input.access,
130
+ hint: 'unlock prep creds (e.g. `rhx keyrack unlock --owner ehmpath --env prep`), then re-run',
131
+ cause: input.error instanceof Error ? input.error : undefined,
132
+ });
133
+ };
89
134
  //# sourceMappingURL=getAllLambdaContracts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getAllLambdaContracts.js","sourceRoot":"","sources":["../../../src/domain.operations/getAllLambdaContracts/getAllLambdaContracts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,0GAAuG;AACvG,gGAA6F;AAC7F,2EAAwE;AACxE,uFAAoF;AACpF,wEAAqE;AACrE,kGAA+F;AAE/F;;;;;;;;;;;;;;;GAeG;AACI,MAAM,qBAAqB,GAAG,KAAK,EACxC,KAIC,EACD,OAA+B,EACgB,EAAE;IACjD,mEAAmE;IACnE,+DAA+D;IAC/D,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAClC,MAAM,IAAI,iEAA+B,CACvC,6DAA6D,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EACjF,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAC7D,CAAC;IACJ,CAAC;IAED,qCAAqC;IACrC,MAAM,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC;IAE/D,wEAAwE;IACxE,MAAM,SAAS,GACb,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG;QACxB,CAAC,MAAM,kDAAO,uCAAuC,IAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAChE,CAAC,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE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C;IAEF,8CAA8C;IAC9C,OAAO,IAAA,mCAAgB,EAAC,OAAO,CAAC,CAAC;AACnC,CAAC,CAAC;AAnEW,QAAA,qBAAqB,yBAmEhC"}
1
+ {"version":3,"file":"getAllLambdaContracts.js","sourceRoot":"","sources":["../../../src/domain.operations/getAllLambdaContracts/getAllLambdaContracts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,oGAAiG;AAEjG,0GAAuG;AACvG,gGAA6F;AAC7F,2EAAwE;AACxE,uFAAoF;AACpF,wEAAqE;AACrE,kGAA+F;AAE/F;;;;;;;;;;;;;;;GAeG;AACI,MAAM,qBAAqB,GAAG,KAAK,EACxC,KAIC,EACD,OAA+B,EACgB,EAAE;IACjD,mEAAmE;IACnE,+DAA+D;IAC/D,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAClC,MAAM,IAAI,iEAA+B,CACvC,6DAA6D,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EACjF;YACE,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO;YAC5B,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM;YAC1B,IAAI,EAAE,wBAAwB;SAC/B,CACF,CAAC;IACJ,CAAC;IAED,qCAAqC;IACrC,MAAM,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC;IAE/D,wEAAwE;IACxE,MAAM,SAAS,GACb,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG;QACxB,CAAC,MAAM,kDAAO,uCAAuC,IAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAChE,CAAC,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CACxD,CAAC,CAAC;IAEL,gFAAgF;IAChF,kFAAkF;IA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GED
@@ -6,7 +6,11 @@
6
6
  export { BadRequestError } from 'helpful-errors';
7
7
  export type { ContextAwsLambdaCaller } from './domain.objects/ContextAwsLambdaCaller';
8
8
  export type { ContextAwsLambdaServer, EnvAccess, EnvConfig, } from './domain.objects/ContextAwsLambdaServer';
9
+ export { GeneratedFile } from './domain.objects/GeneratedFile';
9
10
  export { HttpStatusCode } from './domain.objects/HttpStatusCode';
11
+ export { LambdaCredentialsAbsentError } from './domain.objects/LambdaCredentialsAbsentError';
12
+ export { LambdaDomainObjectNotCapturableError } from './domain.objects/LambdaDomainObjectNotCapturableError';
13
+ export { LambdaDomainObjectRefUnbindableError } from './domain.objects/LambdaDomainObjectRefUnbindableError';
10
14
  export { LambdaEndpoint } from './domain.objects/LambdaEndpoint';
11
15
  export { LambdaEndpointError } from './domain.objects/LambdaEndpointError';
12
16
  export type { LambdaEndpointSchema } from './domain.objects/LambdaEndpointSchema';
@@ -32,6 +36,7 @@ export type { IoLogTranslate } from './domain.operations/genLambdaEndpoint/middl
32
36
  export { genIoLoggerMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware';
33
37
  export { genTrailMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware';
34
38
  export { genZodOutputValidationMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware';
39
+ export { genServiceSdk } from './domain.operations/genServiceSdk/genServiceSdk';
35
40
  export { type GetAllLambdaContractsContext, type GetAllLambdaContractsInput, getAllLambdaContracts, } from './domain.operations/getAllLambdaContracts/getAllLambdaContracts';
36
41
  export { getAllLambdaFunctionsByPrefix } from './domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix';
37
42
  export { type GetOneLambdaContractContext, type GetOneLambdaContractInput, getOneLambdaContract, } from './domain.operations/getOneLambdaContract/getOneLambdaContract';
package/dist/index.js CHANGED
@@ -5,12 +5,20 @@
5
5
  * define endpoints, ask endpoints, auto-propagate trace-ids.
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.getOneLambdaContract = exports.getAllLambdaFunctionsByPrefix = exports.getAllLambdaContracts = exports.genZodOutputValidationMiddleware = exports.genTrailMiddleware = exports.genIoLoggerMiddleware = exports.genIntrospectionMiddleware = exports.genConstraintErrorMiddleware = exports.genZodEventValidationMiddleware = exports.genLambdaEndpoint = exports.genApiGatewayEventNormalizationMiddleware = exports.forApiGateway = exports.asLambdaEndpoint = exports.getAskLambdaCacheKey = exports.asCacheWithoutSet = exports.askLambdaEndpoint = exports.LambdaServiceNotFoundError = exports.LambdaIntrospectionNotSupportedError = exports.LambdaIntrospectionBlockedError = exports.LambdaFunctionNotFoundError = exports.LambdaEndpointError = exports.LambdaEndpoint = exports.HttpStatusCode = exports.BadRequestError = void 0;
8
+ exports.getOneLambdaContract = exports.getAllLambdaFunctionsByPrefix = exports.getAllLambdaContracts = exports.genServiceSdk = exports.genZodOutputValidationMiddleware = exports.genTrailMiddleware = exports.genIoLoggerMiddleware = exports.genIntrospectionMiddleware = exports.genConstraintErrorMiddleware = exports.genZodEventValidationMiddleware = exports.genLambdaEndpoint = exports.genApiGatewayEventNormalizationMiddleware = exports.forApiGateway = exports.asLambdaEndpoint = exports.getAskLambdaCacheKey = exports.asCacheWithoutSet = exports.askLambdaEndpoint = exports.LambdaServiceNotFoundError = exports.LambdaIntrospectionNotSupportedError = exports.LambdaIntrospectionBlockedError = exports.LambdaFunctionNotFoundError = exports.LambdaEndpointError = exports.LambdaEndpoint = exports.LambdaDomainObjectRefUnbindableError = exports.LambdaDomainObjectNotCapturableError = exports.LambdaCredentialsAbsentError = exports.HttpStatusCode = exports.GeneratedFile = exports.BadRequestError = void 0;
9
9
  // re-export from helpful-errors for convenience
10
10
  var helpful_errors_1 = require("helpful-errors");
11
11
  Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return helpful_errors_1.BadRequestError; } });
12
+ var GeneratedFile_1 = require("./domain.objects/GeneratedFile");
13
+ Object.defineProperty(exports, "GeneratedFile", { enumerable: true, get: function () { return GeneratedFile_1.GeneratedFile; } });
12
14
  var HttpStatusCode_1 = require("./domain.objects/HttpStatusCode");
13
15
  Object.defineProperty(exports, "HttpStatusCode", { enumerable: true, get: function () { return HttpStatusCode_1.HttpStatusCode; } });
16
+ var LambdaCredentialsAbsentError_1 = require("./domain.objects/LambdaCredentialsAbsentError");
17
+ Object.defineProperty(exports, "LambdaCredentialsAbsentError", { enumerable: true, get: function () { return LambdaCredentialsAbsentError_1.LambdaCredentialsAbsentError; } });
18
+ var LambdaDomainObjectNotCapturableError_1 = require("./domain.objects/LambdaDomainObjectNotCapturableError");
19
+ Object.defineProperty(exports, "LambdaDomainObjectNotCapturableError", { enumerable: true, get: function () { return LambdaDomainObjectNotCapturableError_1.LambdaDomainObjectNotCapturableError; } });
20
+ var LambdaDomainObjectRefUnbindableError_1 = require("./domain.objects/LambdaDomainObjectRefUnbindableError");
21
+ Object.defineProperty(exports, "LambdaDomainObjectRefUnbindableError", { enumerable: true, get: function () { return LambdaDomainObjectRefUnbindableError_1.LambdaDomainObjectRefUnbindableError; } });
14
22
  var LambdaEndpoint_1 = require("./domain.objects/LambdaEndpoint");
15
23
  Object.defineProperty(exports, "LambdaEndpoint", { enumerable: true, get: function () { return LambdaEndpoint_1.LambdaEndpoint; } });
16
24
  var LambdaEndpointError_1 = require("./domain.objects/LambdaEndpointError");
@@ -53,6 +61,9 @@ var genTrailMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middle
53
61
  Object.defineProperty(exports, "genTrailMiddleware", { enumerable: true, get: function () { return genTrailMiddleware_1.genTrailMiddleware; } });
54
62
  var genZodOutputValidationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware");
55
63
  Object.defineProperty(exports, "genZodOutputValidationMiddleware", { enumerable: true, get: function () { return genZodOutputValidationMiddleware_1.genZodOutputValidationMiddleware; } });
64
+ // sdk codegen (generate a per-service sdk from introspection)
65
+ var genServiceSdk_1 = require("./domain.operations/genServiceSdk/genServiceSdk");
66
+ Object.defineProperty(exports, "genServiceSdk", { enumerable: true, get: function () { return genServiceSdk_1.genServiceSdk; } });
56
67
  // contract discovery (for sdk generation)
57
68
  var getAllLambdaContracts_1 = require("./domain.operations/getAllLambdaContracts/getAllLambdaContracts");
58
69
  Object.defineProperty(exports, "getAllLambdaContracts", { enumerable: true, get: function () { return getAllLambdaContracts_1.getAllLambdaContracts; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gDAAgD;AAChD,iDAAiD;AAAxC,iHAAA,eAAe,OAAA;AASxB,kEAAiE;AAAxD,gHAAA,cAAc,OAAA;AACvB,kEAAiE;AAAxD,gHAAA,cAAc,OAAA;AACvB,4EAA2E;AAAlE,0HAAA,mBAAmB,OAAA;AAE5B,4BAA4B;AAC5B,4FAA2F;AAAlF,0IAAA,2BAA2B,OAAA;AACpC,oGAAmG;AAA1F,kJAAA,+BAA+B,OAAA;AACxC,8GAA6G;AAApG,4JAAA,oCAAoC,OAAA;AAC7C,0FAAyF;AAAhF,wIAAA,0BAA0B,OAAA;AAKnC,oBAAoB;AACpB,6FAA4F;AAAnF,sHAAA,iBAAiB,OAAA;AAC1B,mGAAkG;AAAzF,sHAAA,iBAAiB,OAAA;AAC1B,yGAAwG;AAA/F,4HAAA,oBAAoB,OAAA;AAC7B,eAAe;AACf,0FAAyF;AAAhF,oHAAA,gBAAgB,OAAA;AAMzB,yJAAsI;AAA7H,gIAAA,aAAa,OAAA;AAEtB,wLAAuL;AAA9K,sKAAA,yCAAyC,OAAA;AASlD,4JAA4I;AAAnI,qIAAA,iBAAiB,OAAA;AAC1B,qKAAoK;AAA3J,kJAAA,+BAA+B,OAAA;AACxC,8HAA6H;AAApH,4IAAA,4BAA4B,OAAA;AACrC,0HAAyH;AAAhH,wIAAA,0BAA0B,OAAA;AAEn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AiB,OAAA;AAC1B,qKAAoK;AAA3J,kJAAA,+BAA+B,OAAA;AACxC,8HAA6H;AAApH,4IAAA,4BAA4B,OAAA;AACrC,0HAAyH;AAAhH,wIAAA,0BAA0B,OAAA;AAEnC,gHAA+G;AAAtG,8HAAA,qBAAqB,OAAA;AAC9B,gCAAgC;AAChC,0GAAyG;AAAhG,wHAAA,kBAAkB,OAAA;AAC3B,sIAAqI;AAA5H,oJAAA,gCAAgC,OAAA;AACzC,8DAA8D;AAC9D,iFAAgF;AAAvE,8GAAA,aAAa,OAAA;AACtB,0CAA0C;AAC1C,yGAIyE;AADvE,8HAAA,qBAAqB,OAAA;AAEvB,wIAAuI;AAA9H,8IAAA,6BAA6B,OAAA;AACtC,sGAIuE;AADrE,4HAAA,oBAAoB,OAAA"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "sdk-aws-lambda",
3
3
  "author": "ehmpathy",
4
4
  "description": "a simple and opinionated sdk for aws lambda. define endpoints, ask endpoints, auto-propagate trace-ids.",
5
- "version": "0.2.0",
5
+ "version": "0.3.0",
6
6
  "repository": "ehmpathy/sdk-aws-lambda",
7
7
  "homepage": "https://github.com/ehmpathy/sdk-aws-lambda",
8
8
  "keywords": [
@@ -18,6 +18,9 @@
18
18
  "bugs": "https://github.com/ehmpathy/sdk-aws-lambda/issues",
19
19
  "license": "MIT",
20
20
  "main": "dist/index.js",
21
+ "bin": {
22
+ "sdk-aws-lambda": "dist/contract/cli/gen.js"
23
+ },
21
24
  "engines": {
22
25
  "node": ">=8.0.0"
23
26
  },
@@ -52,19 +55,20 @@
52
55
  "preversion": "npm run prepush",
53
56
  "postversion": "git push origin HEAD --tags --no-verify",
54
57
  "prepare:husky": "husky install && chmod ug+x .husky/*",
55
- "prepare:rhachet": "rhachet init --keys --hooks --roles mechanic behaver driver reviewer librarian ergonomist architect dispatcher",
58
+ "prepare:rhachet": "rhachet init --hooks --roles mechanic architect ergonomist driver reviewer dreamer behaver dispatcher",
56
59
  "prepare": "if [ -e .git ] && [ -z $CI ]; then npm run prepare:husky && npm run prepare:rhachet; fi",
57
60
  "upgrade:rhachet": "rhachet upgrade"
58
61
  },
59
62
  "dependencies": {
60
63
  "@aws-sdk/client-lambda": "3.1045.0",
64
+ "@biomejs/biome": "2.3.8",
61
65
  "@ehmpathy/error-fns": "^1.3.7",
62
66
  "@middy/core": "4.7.0",
63
67
  "@middy/http-cors": "4.7.0",
64
68
  "@middy/http-json-body-parser": "4.7.0",
65
69
  "@middy/http-response-serializer": "4.7.0",
66
70
  "@middy/http-security-headers": "4.7.0",
67
- "domain-objects": "0.31.10",
71
+ "domain-objects": "0.33.0",
68
72
  "helpful-errors": "1.7.3",
69
73
  "sdk-environment": "0.1.5",
70
74
  "sdk-logs": "0.9.0",
@@ -73,7 +77,6 @@
73
77
  "zod": "4.4.3"
74
78
  },
75
79
  "devDependencies": {
76
- "@biomejs/biome": "2.3.8",
77
80
  "@commitlint/cli": "19.5.0",
78
81
  "@commitlint/config-conventional": "19.5.0",
79
82
  "@swc/core": "1.15.3",
@@ -96,13 +99,13 @@
96
99
  "esbuild-register": "3.6.0",
97
100
  "husky": "8.0.3",
98
101
  "jest": "30.2.0",
99
- "rhachet": "1.42.4",
102
+ "rhachet": "1.43.1",
100
103
  "rhachet-brains-anthropic": "0.4.1",
101
104
  "rhachet-brains-fireworksai": "0.1.3",
102
105
  "rhachet-brains-xai": "0.3.3",
103
- "rhachet-roles-bhrain": "0.29.12",
104
- "rhachet-roles-bhuild": "0.21.18",
105
- "rhachet-roles-ehmpathy": "1.37.1",
106
+ "rhachet-roles-bhrain": "0.30.2",
107
+ "rhachet-roles-bhuild": "0.21.25",
108
+ "rhachet-roles-ehmpathy": "1.38.1",
106
109
  "rhachet-roles-rhachet": "0.1.7",
107
110
  "test-fns": "1.15.8",
108
111
  "tsc-alias": "1.8.10",