@distilled.cloud/core 1.0.0-rc.2 → 1.0.0-rc.20

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 (291) hide show
  1. package/LICENSE +201 -0
  2. package/lib/_bundle/aws.js +2 -0
  3. package/lib/_bundle/aws.js.map +1 -0
  4. package/lib/_bundle/base.js +5 -0
  5. package/lib/_bundle/base.js.map +1 -0
  6. package/lib/_bundle/graphql.js +3 -0
  7. package/lib/_bundle/graphql.js.map +1 -0
  8. package/lib/_bundle/grpc.js +2 -0
  9. package/lib/_bundle/grpc.js.map +1 -0
  10. package/lib/_bundle/rest.js +2 -0
  11. package/lib/_bundle/rest.js.map +1 -0
  12. package/lib/_bundle/xml.js +4 -0
  13. package/lib/_bundle/xml.js.map +1 -0
  14. package/lib/annotations.d.ts +17 -0
  15. package/lib/annotations.d.ts.map +1 -0
  16. package/lib/annotations.js +2 -0
  17. package/lib/annotations.js.map +1 -0
  18. package/lib/api.d.ts +174 -18
  19. package/lib/api.d.ts.map +1 -1
  20. package/lib/api.js +1 -178
  21. package/lib/category.d.ts +4 -4
  22. package/lib/category.d.ts.map +1 -1
  23. package/lib/category.js +1 -280
  24. package/lib/chunks.d.ts +3 -0
  25. package/lib/chunks.d.ts.map +1 -0
  26. package/lib/chunks.js +1 -0
  27. package/lib/config.d.ts +68 -0
  28. package/lib/config.d.ts.map +1 -0
  29. package/lib/config.js +1 -0
  30. package/lib/crypto.d.ts +76 -0
  31. package/lib/crypto.d.ts.map +1 -0
  32. package/lib/crypto.js +1 -0
  33. package/lib/error-category.d.ts +1 -1
  34. package/lib/error-category.d.ts.map +1 -1
  35. package/lib/error-category.js +1 -46
  36. package/lib/errors.d.ts +64 -72
  37. package/lib/errors.d.ts.map +1 -1
  38. package/lib/errors.js +1 -186
  39. package/lib/graphql.d.ts +403 -0
  40. package/lib/graphql.d.ts.map +1 -0
  41. package/lib/graphql.js +1 -0
  42. package/lib/graphql.types.d.ts +12 -0
  43. package/lib/graphql.types.d.ts.map +1 -0
  44. package/lib/graphql.types.js +1 -0
  45. package/lib/grpc-transport-cloudflare-http2.d.ts +7 -0
  46. package/lib/grpc-transport-cloudflare-http2.d.ts.map +1 -0
  47. package/lib/grpc-transport-cloudflare-http2.js +6 -0
  48. package/lib/grpc-transport-cloudflare-http2.js.map +1 -0
  49. package/lib/grpc-transport-cloudflare-sockets.d.ts +7 -0
  50. package/lib/grpc-transport-cloudflare-sockets.d.ts.map +1 -0
  51. package/lib/grpc-transport-cloudflare-sockets.js +5 -0
  52. package/lib/grpc-transport-cloudflare-sockets.js.map +1 -0
  53. package/lib/grpc-transport-node-http2.d.ts +19 -0
  54. package/lib/grpc-transport-node-http2.d.ts.map +1 -0
  55. package/lib/grpc-transport-node-http2.js +2 -0
  56. package/lib/grpc-transport-node-http2.js.map +1 -0
  57. package/lib/grpc-transport.d.ts +76 -0
  58. package/lib/grpc-transport.d.ts.map +1 -0
  59. package/lib/grpc-transport.js +1 -0
  60. package/lib/hpack.d.ts +34 -0
  61. package/lib/hpack.d.ts.map +1 -0
  62. package/lib/hpack.js +2 -0
  63. package/lib/hpack.js.map +1 -0
  64. package/lib/index.d.ts +32 -0
  65. package/lib/index.d.ts.map +1 -0
  66. package/lib/index.js +17 -0
  67. package/lib/pagination.d.ts +101 -24
  68. package/lib/pagination.d.ts.map +1 -1
  69. package/lib/pagination.js +1 -182
  70. package/lib/plain-values.d.ts +10 -0
  71. package/lib/plain-values.d.ts.map +1 -0
  72. package/lib/plain-values.js +2 -0
  73. package/lib/plain-values.js.map +1 -0
  74. package/lib/protobuf.d.ts +92 -0
  75. package/lib/protobuf.d.ts.map +1 -0
  76. package/lib/protobuf.js +1 -0
  77. package/lib/protocol-grpc.d.ts +86 -0
  78. package/lib/protocol-grpc.d.ts.map +1 -0
  79. package/lib/protocol-grpc.js +1 -0
  80. package/lib/protocol-http.d.ts +102 -23
  81. package/lib/protocol-http.d.ts.map +1 -1
  82. package/lib/protocol-http.js +1 -554
  83. package/lib/protocol-rest.d.ts +120 -50
  84. package/lib/protocol-rest.d.ts.map +1 -1
  85. package/lib/protocol-rest.js +1 -242
  86. package/lib/query.d.ts +29 -0
  87. package/lib/query.d.ts.map +1 -0
  88. package/lib/query.js +1 -0
  89. package/lib/response-validation-strict.d.ts +48 -0
  90. package/lib/response-validation-strict.d.ts.map +1 -0
  91. package/lib/response-validation-strict.js +1 -0
  92. package/lib/response-validation.d.ts +86 -0
  93. package/lib/response-validation.d.ts.map +1 -0
  94. package/lib/response-validation.js +1 -0
  95. package/lib/retry-after.d.ts +3 -3
  96. package/lib/retry-after.d.ts.map +1 -1
  97. package/lib/retry-after.js +1 -112
  98. package/lib/retry.d.ts +48 -29
  99. package/lib/retry.d.ts.map +1 -1
  100. package/lib/retry.js +1 -210
  101. package/lib/schema-lite-impl.d.ts +158 -0
  102. package/lib/schema-lite-impl.d.ts.map +1 -0
  103. package/lib/schema-lite-impl.js +1 -0
  104. package/lib/schema-lite-typed.d.ts +41 -0
  105. package/lib/schema-lite-typed.d.ts.map +1 -0
  106. package/lib/schema-lite-typed.js +1 -0
  107. package/lib/schema-lite.d.ts +40 -0
  108. package/lib/schema-lite.d.ts.map +1 -0
  109. package/lib/schema-lite.js +1 -0
  110. package/lib/schema.d.ts +21 -7
  111. package/lib/schema.d.ts.map +1 -1
  112. package/lib/schema.js +1 -48
  113. package/lib/sdk-error.d.ts +27 -0
  114. package/lib/sdk-error.d.ts.map +1 -0
  115. package/lib/sdk-error.js +1 -0
  116. package/lib/sensitive.d.ts +28 -0
  117. package/lib/sensitive.d.ts.map +1 -0
  118. package/lib/sensitive.js +2 -0
  119. package/lib/sensitive.js.map +1 -0
  120. package/lib/telemetry-debug.d.ts +6 -0
  121. package/lib/telemetry-debug.d.ts.map +1 -0
  122. package/lib/telemetry-debug.js +2 -0
  123. package/lib/telemetry-debug.js.map +1 -0
  124. package/lib/telemetry-hooks.d.ts +32 -0
  125. package/lib/telemetry-hooks.d.ts.map +1 -0
  126. package/lib/telemetry-hooks.js +2 -0
  127. package/lib/telemetry-hooks.js.map +1 -0
  128. package/lib/telemetry-host-rules.d.ts +23 -0
  129. package/lib/telemetry-host-rules.d.ts.map +1 -0
  130. package/lib/telemetry-host-rules.js +2 -0
  131. package/lib/telemetry-host-rules.js.map +1 -0
  132. package/lib/telemetry-lambda-context.d.ts +17 -0
  133. package/lib/telemetry-lambda-context.d.ts.map +1 -0
  134. package/lib/telemetry-lambda-context.js +2 -0
  135. package/lib/telemetry-lambda-context.js.map +1 -0
  136. package/lib/telemetry-message-context.d.ts +52 -0
  137. package/lib/telemetry-message-context.d.ts.map +1 -0
  138. package/lib/telemetry-message-context.js +2 -0
  139. package/lib/telemetry-message-context.js.map +1 -0
  140. package/lib/telemetry-metrics.d.ts +6 -0
  141. package/lib/telemetry-metrics.d.ts.map +1 -0
  142. package/lib/telemetry-metrics.js +2 -0
  143. package/lib/telemetry-metrics.js.map +1 -0
  144. package/lib/telemetry-name-template.d.ts +13 -0
  145. package/lib/telemetry-name-template.d.ts.map +1 -0
  146. package/lib/telemetry-name-template.js +2 -0
  147. package/lib/telemetry-name-template.js.map +1 -0
  148. package/lib/telemetry-stream.d.ts +11 -0
  149. package/lib/telemetry-stream.d.ts.map +1 -0
  150. package/lib/telemetry-stream.js +2 -0
  151. package/lib/telemetry-stream.js.map +1 -0
  152. package/lib/telemetry-xray.d.ts +28 -0
  153. package/lib/telemetry-xray.d.ts.map +1 -0
  154. package/lib/telemetry-xray.js +2 -0
  155. package/lib/telemetry-xray.js.map +1 -0
  156. package/lib/telemetry.d.ts +288 -0
  157. package/lib/telemetry.d.ts.map +1 -0
  158. package/lib/telemetry.js +3 -0
  159. package/lib/telemetry.js.map +1 -0
  160. package/lib/trait.d.ts +71 -20
  161. package/lib/trait.d.ts.map +1 -1
  162. package/lib/trait.js +1 -107
  163. package/lib/unknown-error.d.ts +18 -0
  164. package/lib/unknown-error.d.ts.map +1 -0
  165. package/lib/unknown-error.js +1 -0
  166. package/lib/xml.d.ts +44 -0
  167. package/lib/xml.d.ts.map +1 -0
  168. package/lib/xml.js +1 -0
  169. package/package.json +13 -13
  170. package/src/annotations.ts +53 -0
  171. package/src/api.ts +1370 -200
  172. package/src/category.ts +76 -106
  173. package/src/chunks.ts +30 -0
  174. package/src/config.ts +245 -0
  175. package/src/crypto.ts +202 -0
  176. package/src/error-category.ts +16 -29
  177. package/src/errors.ts +75 -75
  178. package/src/graphql.ts +1778 -0
  179. package/src/graphql.types.ts +105 -0
  180. package/src/grpc-transport-cloudflare-http2.ts +494 -0
  181. package/src/grpc-transport-cloudflare-sockets.ts +299 -0
  182. package/src/grpc-transport-node-http2.ts +234 -0
  183. package/src/grpc-transport.ts +118 -0
  184. package/src/hpack.ts +331 -0
  185. package/src/index.ts +31 -0
  186. package/src/pagination.ts +368 -94
  187. package/src/plain-values.ts +41 -0
  188. package/src/protobuf.ts +1332 -0
  189. package/src/protocol-grpc.ts +641 -0
  190. package/src/protocol-http.ts +622 -322
  191. package/src/protocol-rest.ts +440 -227
  192. package/src/query.ts +39 -0
  193. package/src/response-validation-strict.ts +327 -0
  194. package/src/response-validation.ts +161 -0
  195. package/src/retry-after.ts +7 -13
  196. package/src/retry.ts +96 -110
  197. package/src/schema-lite-impl.ts +550 -0
  198. package/src/schema-lite-typed.ts +44 -0
  199. package/src/schema-lite.ts +44 -0
  200. package/src/schema.ts +259 -15
  201. package/src/sdk-error.ts +33 -0
  202. package/src/sensitive.ts +154 -0
  203. package/src/telemetry-debug.ts +179 -0
  204. package/src/telemetry-hooks.ts +33 -0
  205. package/src/telemetry-host-rules.ts +39 -0
  206. package/src/telemetry-lambda-context.ts +46 -0
  207. package/src/telemetry-message-context.ts +170 -0
  208. package/src/telemetry-metrics.ts +69 -0
  209. package/src/telemetry-name-template.ts +26 -0
  210. package/src/telemetry-stream.ts +100 -0
  211. package/src/telemetry-xray.ts +66 -0
  212. package/src/telemetry.ts +832 -0
  213. package/src/trait.ts +106 -67
  214. package/src/unknown-error.ts +38 -0
  215. package/src/xml.ts +346 -0
  216. package/lib/api.js.map +0 -1
  217. package/lib/category.js.map +0 -1
  218. package/lib/codegen/cli.d.ts +0 -29
  219. package/lib/codegen/cli.d.ts.map +0 -1
  220. package/lib/codegen/cli.js +0 -165
  221. package/lib/codegen/cli.js.map +0 -1
  222. package/lib/codegen/emit.d.ts +0 -129
  223. package/lib/codegen/emit.d.ts.map +0 -1
  224. package/lib/codegen/emit.js +0 -105
  225. package/lib/codegen/emit.js.map +0 -1
  226. package/lib/codegen/format.d.ts +0 -23
  227. package/lib/codegen/format.d.ts.map +0 -1
  228. package/lib/codegen/format.js +0 -28
  229. package/lib/codegen/format.js.map +0 -1
  230. package/lib/codegen/generator.d.ts +0 -334
  231. package/lib/codegen/generator.d.ts.map +0 -1
  232. package/lib/codegen/generator.js +0 -691
  233. package/lib/codegen/generator.js.map +0 -1
  234. package/lib/codegen/graph.d.ts +0 -36
  235. package/lib/codegen/graph.d.ts.map +0 -1
  236. package/lib/codegen/graph.js +0 -136
  237. package/lib/codegen/graph.js.map +0 -1
  238. package/lib/codegen/members.d.ts +0 -25
  239. package/lib/codegen/members.d.ts.map +0 -1
  240. package/lib/codegen/members.js +0 -55
  241. package/lib/codegen/members.js.map +0 -1
  242. package/lib/codegen/naming.d.ts +0 -29
  243. package/lib/codegen/naming.d.ts.map +0 -1
  244. package/lib/codegen/naming.js +0 -74
  245. package/lib/codegen/naming.js.map +0 -1
  246. package/lib/codegen/openapi-cli.d.ts +0 -38
  247. package/lib/codegen/openapi-cli.d.ts.map +0 -1
  248. package/lib/codegen/openapi-cli.js +0 -107
  249. package/lib/codegen/openapi-cli.js.map +0 -1
  250. package/lib/codegen/openapi.d.ts +0 -115
  251. package/lib/codegen/openapi.d.ts.map +0 -1
  252. package/lib/codegen/openapi.js +0 -1220
  253. package/lib/codegen/openapi.js.map +0 -1
  254. package/lib/codegen/operations.d.ts +0 -24
  255. package/lib/codegen/operations.d.ts.map +0 -1
  256. package/lib/codegen/operations.js +0 -56
  257. package/lib/codegen/operations.js.map +0 -1
  258. package/lib/codegen/pagination.d.ts +0 -39
  259. package/lib/codegen/pagination.d.ts.map +0 -1
  260. package/lib/codegen/pagination.js +0 -33
  261. package/lib/codegen/pagination.js.map +0 -1
  262. package/lib/codegen/prelude.d.ts +0 -15
  263. package/lib/codegen/prelude.d.ts.map +0 -1
  264. package/lib/codegen/prelude.js +0 -60
  265. package/lib/codegen/prelude.js.map +0 -1
  266. package/lib/error-category.js.map +0 -1
  267. package/lib/errors.js.map +0 -1
  268. package/lib/json-patch.d.ts +0 -44
  269. package/lib/json-patch.d.ts.map +0 -1
  270. package/lib/json-patch.js +0 -174
  271. package/lib/json-patch.js.map +0 -1
  272. package/lib/pagination.js.map +0 -1
  273. package/lib/protocol-http.js.map +0 -1
  274. package/lib/protocol-rest.js.map +0 -1
  275. package/lib/retry-after.js.map +0 -1
  276. package/lib/retry.js.map +0 -1
  277. package/lib/schema.js.map +0 -1
  278. package/lib/trait.js.map +0 -1
  279. package/src/codegen/cli.ts +0 -268
  280. package/src/codegen/emit.ts +0 -207
  281. package/src/codegen/format.ts +0 -47
  282. package/src/codegen/generator.ts +0 -1153
  283. package/src/codegen/graph.ts +0 -151
  284. package/src/codegen/members.ts +0 -71
  285. package/src/codegen/naming.ts +0 -86
  286. package/src/codegen/openapi-cli.ts +0 -166
  287. package/src/codegen/openapi.ts +0 -1450
  288. package/src/codegen/operations.ts +0 -76
  289. package/src/codegen/pagination.ts +0 -71
  290. package/src/codegen/prelude.ts +0 -70
  291. package/src/json-patch.ts +0 -222
@@ -1,334 +0,0 @@
1
- /**
2
- * The generic smithy→SDK service generator (dev-time only).
3
- *
4
- * One driver compiles a Smithy JSON model into an Effect SDK service module.
5
- * Everything provider-specific arrives through {@link SdkSpec}: import
6
- * header, trait vocabulary (which trait ids mean payload/file/nullable/…),
7
- * the `T.*` pipe expressions to emit for each binding, how operations are
8
- * declared (protocol/retry/error names), and naming policies. The driver
9
- * owns the pipeline: operation discovery, reachability, topological order,
10
- * schema/interface emission, error classes, pagination validation, and
11
- * operation consts.
12
- *
13
- * A provider's `scripts/generate.ts` reduces to: load models (its own
14
- * pipeline — docs-derived specs, patches, …), define its {@link SdkSpec},
15
- * call {@link generateService} per model, write files.
16
- */
17
- import { local, q, tsKey, upperFirst } from "./naming.ts";
18
- import { type ShapeMap } from "./graph.ts";
19
- import { errorUnionAlias, operationConst } from "./emit.ts";
20
- import { type OpEntry } from "./operations.ts";
21
- /**
22
- * Error categories, derived from the STANDARD Smithy error traits.
23
- *
24
- * `smithy.api#httpError` and `smithy.api#retryable` are how every Smithy
25
- * model — AWS's included — says what kind of failure an error is. The
26
- * categories the runtime acts on (`core/category.ts`, and `isTransientError`
27
- * in `core/retry.ts`) are a reading of those two traits, so the reading
28
- * belongs here, once, for every provider.
29
- *
30
- * A model that wants its errors classified states the status the API
31
- * actually returns:
32
- *
33
- * "traits": { "smithy.api#error": "client", "smithy.api#httpError": 404 }
34
- *
35
- * and the error class is emitted with `.pipe(C.withNotFoundError)`. A model
36
- * with no `httpError` gets no categories — the same as today.
37
- */
38
- export declare const errorCategories: (traits: Record<string, any> | undefined,
39
- /** Categories a provider knows that the traits don't say (AWS's spec file). */
40
- extra?: readonly string[]) => string[];
41
- /** A member's resolved binding. The four generic kinds plus provider extras. */
42
- export type MemberBinding = "label" | "query" | "header" | "body" | (string & {});
43
- export interface EmittedMember {
44
- readonly name: string;
45
- readonly tsName: string;
46
- readonly wire: string;
47
- readonly target: string;
48
- readonly binding: MemberBinding;
49
- readonly required: boolean;
50
- readonly nullable: boolean;
51
- readonly doc: string | undefined;
52
- readonly traits: Record<string, any>;
53
- }
54
- export interface PaginationProfile {
55
- /** Protocol const for paginated ops. Defaults to operationDecl.protocol. */
56
- readonly protocol?: string;
57
- /** Strategy expression passed as makePaginated's second argument. */
58
- readonly strategy?: string;
59
- /** Items path fallback when the trait omits `items`. */
60
- readonly itemsFallback: string;
61
- /** Output names accepted even when not modeled (delivered by the protocol). */
62
- readonly syntheticOutputs?: readonly string[];
63
- /**
64
- * Extra interface field + struct member appended to paginated outputs
65
- * that don't already model them (what the protocol delivers beyond the
66
- * modeled shape — e.g. cloudflare's `resultInfo` from the envelope's
67
- * `result_info`). `imports` are pulled from the pagination module in the
68
- * header.
69
- */
70
- readonly injectOutputMember?: {
71
- readonly tsName: string;
72
- readonly interfaceLines: readonly string[];
73
- readonly structLine: string;
74
- readonly imports?: readonly string[];
75
- };
76
- }
77
- export interface OperationEmit {
78
- readonly op: OpEntry;
79
- readonly opName: string;
80
- readonly exportName: string;
81
- readonly inputName: string;
82
- readonly outputName: string;
83
- /**
84
- * The output as a TS type and as a schema expression. These differ from
85
- * {@link outputName} when the operation's output IS a prelude shape
86
- * (e.g. stripe's freeform `smithy.api#Document` responses): the bare
87
- * local name isn't declared in the module, so it must resolve through
88
- * the prelude maps (`unknown` / `S.Unknown`) instead.
89
- */
90
- readonly outputTsType: string;
91
- readonly outputSchema: string;
92
- /** Declared error class names present in the model. */
93
- readonly errorNames: readonly string[];
94
- readonly doc: string | undefined;
95
- /** The validated pagination trait, when the op paginates. */
96
- readonly pagination: unknown | undefined;
97
- }
98
- export interface SdkSpec {
99
- /** Namespace fallback for models with no operations. Default `"smithy.unknown"`. */
100
- readonly namespaceFallback?: string;
101
- /** PURE marker before schema consts. Default: the shared single marker. */
102
- readonly pure?: string;
103
- /** Prelude scalar → schema expression map. Default {@link JSON_PRELUDE}. */
104
- readonly prelude?: Record<string, string>;
105
- /** Prelude scalar → TS type map. Default {@link TS_JSON_PRELUDE}. */
106
- readonly tsPrelude?: Record<string, string>;
107
- /** Wire member name → TS-facing name. Default: identity. */
108
- readonly memberName?: (name: string) => string;
109
- /** Operation shape name → exported const name. Default: lowerFirst. */
110
- readonly opExportName?: (name: string) => string;
111
- /**
112
- * Emit the one-line smithy doc comment above shapes and error classes.
113
- * Default true. AWS turns this off — its models carry multi-kilobyte HTML
114
- * docs per shape and the SDK only surfaces operation-level docs.
115
- */
116
- readonly shapeDocs?: boolean;
117
- /**
118
- * Extra reachability roots beyond the operations' I/O shapes. AWS seeds
119
- * the error shapes here so their member targets are emitted (error class
120
- * fields reference schema consts); the error shapes themselves are still
121
- * emitted as error classes, not schemas.
122
- */
123
- readonly extraRoots?: (selected: readonly OpEntry[], shapes: ShapeMap) => Iterable<string>;
124
- /**
125
- * Provider member bindings as data, checked in order between the generic
126
- * header binding and `smithy.api#httpPayload`. The driver's cascade:
127
- * label → query → header → extraBindings → rawBody (httpPayload) → body.
128
- *
129
- * `pipe` is emitted for the member; `tsType` overrides its interface
130
- * type (e.g. file uploads → `(File | Blob)[]`).
131
- */
132
- readonly extraBindings?: ReadonlyArray<{
133
- readonly trait: string;
134
- readonly binding: MemberBinding;
135
- readonly pipe: string;
136
- readonly tsType?: string;
137
- /**
138
- * Bare-payload form: when this binding is the sole member of a
139
- * (non-paginated) output structure, the whole response IS that
140
- * member's value — the driver emits the member's type directly and
141
- * pipes the schema through this root marker for the protocol.
142
- */
143
- readonly rootPipe?: string;
144
- }>;
145
- /**
146
- * Which wire-name rule a binding follows. Defaults: the three generic
147
- * kinds map to themselves, everything else to `"other"` (jsonName).
148
- */
149
- readonly wireKind?: (binding: MemberBinding) => "label" | "query" | "header" | "other";
150
- /** Trait id marking a member nullable (`S.NullOr` + `| null`). */
151
- readonly nullableTrait?: string;
152
- /**
153
- * Blanket-nullable optionals: every optional body member types and
154
- * decodes as `X | null` in addition to being omittable (`?: X | null`,
155
- * `S.optional(S.NullOr(X))`). The cloudflare docs pipeline sets this —
156
- * the v4 API freely returns explicit nulls for absent optional fields,
157
- * and the v0 SDK surface modeled every optional that way.
158
- */
159
- readonly optionalsNullable?: boolean;
160
- /**
161
- * Member traits emitted as pipes when present: trait id → pipe builder
162
- * name in the SDK's traits module. The trait's value is JSON-inlined as
163
- * the argument (e.g. `"…#keyDictionary": "T.KeyDictionary"` →
164
- * `T.KeyDictionary({…})`).
165
- */
166
- readonly memberTraitPipes?: Readonly<Record<string, string>>;
167
- /**
168
- * Extra schema pipes appended after the generic ones, for anything the
169
- * data tables can't express. The driver emits `T.Label/T.Query/T.Header`
170
- * (wire-aware), `T.HttpBody()` for rawBody, and `T.Body(wire)` renames —
171
- * the SDK's traits module must export those core builders under these
172
- * names.
173
- */
174
- readonly memberExtraPipes?: (m: EmittedMember) => string[];
175
- /** Full override of member pipe emission (rarely needed). */
176
- readonly memberPipes?: (m: EmittedMember) => string[];
177
- /** Function override for member TS types beyond the binding table. */
178
- readonly memberTsType?: (m: EmittedMember, tsRef: (target: string) => string) => string | undefined;
179
- /**
180
- * Struct-level pipes for a shape (after the member struct): the http
181
- * trait on op inputs, service-wide key-dictionary stamping, etc.
182
- */
183
- readonly structPipes?: (ctx: {
184
- readonly id: string;
185
- readonly isOpIo: boolean;
186
- readonly httpTrait: unknown | undefined;
187
- }) => string[];
188
- /**
189
- * Pagination profiles. A profile is the codegen-side description of one
190
- * paginated wire variant: the Protocol const that decodes it, the
191
- * strategy passed to makePaginated, the trait-validation rules, and any
192
- * output member the protocol delivers beyond the modeled shape. SDKs
193
- * with several pagination styles declare several profiles and select
194
- * per-op via {@link SdkSpec.paginationProfileFor}.
195
- */
196
- readonly paginationProfiles?: Readonly<Record<string, PaginationProfile>>;
197
- /**
198
- * Select the profile for a paginated op (from its `smithy.api#paginated`
199
- * trait / shape). Default: the sole declared profile; with several
200
- * profiles this becomes required for ops to paginate.
201
- */
202
- readonly paginationProfileFor?: (trait: any, op: OpEntry) => string | undefined;
203
- /**
204
- * Service-wide fallback key dictionary stamped on op I/O roots (emitted
205
- * as a `KEY_DICTIONARY` header const + `T.KeyDictionary(KEY_DICTIONARY)`
206
- * root pipe). `doc` is the const's doc comment. An entry may list several
207
- * wire spellings (first = canonical encode name; decode accepts all).
208
- */
209
- readonly rootKeyDictionary?: {
210
- readonly dict: Record<string, string | ReadonlyArray<string>>;
211
- readonly doc: string;
212
- };
213
- /** Banner suffix: `AUTO-GENERATED by scripts/generate.ts from <note>`. */
214
- readonly sourceNote?: string;
215
- /**
216
- * Operation aliases: re-export the canonical op (and its
217
- * Request/Response/Error types) under each alias name. Skipped when the
218
- * target wasn't emitted or the alias name is taken.
219
- */
220
- readonly opAliases?: ReadonlyArray<{
221
- readonly alias: string;
222
- readonly target: string;
223
- }>;
224
- /**
225
- * Full shape-emission override, checked before the driver's own shape
226
- * handling. Return the emitted lines to own a shape (e.g. AWS's
227
- * newtypes, structural unions, event streams), or undefined to let the
228
- * driver emit it. `selfIdx` is the shape's position in emission order
229
- * for forward-ref decisions.
230
- */
231
- readonly shapeOverride?: (ctx: {
232
- readonly id: string;
233
- readonly def: any;
234
- readonly name: string;
235
- readonly selfIdx: number;
236
- readonly ref: (target: string, selfIdx: number) => string;
237
- readonly tsRef: (target: string) => string;
238
- readonly members: (d: any) => EmittedMember[];
239
- }) => string[] | undefined;
240
- /**
241
- * Union emission style. `"opaque-cases"`: the TS type is the case union
242
- * and the schema is `S.Unknown.pipe(T.UnionCases([...case key sets]))` —
243
- * the protocol discriminates by key-set at decode time (for APIs that
244
- * return every case's keys with nulls, like Cloudflare's).
245
- */
246
- readonly unionStyle?: "opaque-cases";
247
- /** Full override of union emission. */
248
- readonly union?: (ctx: {
249
- readonly name: string;
250
- readonly caseTargets: readonly string[];
251
- readonly caseKeys: readonly (readonly string[])[];
252
- readonly tsRef: (target: string) => string;
253
- }) => string[];
254
- /**
255
- * Trait id carrying error matchers: when present on an error shape, the
256
- * class is wrapped in `T.applyErrorMatchers(<cls>, <trait value>)`.
257
- */
258
- readonly errorMatchersTrait?: string;
259
- /** Error-class emission details. All optional. */
260
- readonly errors?: {
261
- /**
262
- * Full override of one error class's emission (mirrors shapeOverride):
263
- * return the emitted lines to own the error, or undefined to fall back
264
- * to the driver's field/wrap-based emission.
265
- */
266
- readonly override?: (ctx: {
267
- readonly id: string;
268
- readonly def: any;
269
- readonly name: string;
270
- }) => string[] | undefined;
271
- /**
272
- * Field lines used when the error shape declares no members.
273
- * Default: `code` (integer) + `message` (string) — the common REST
274
- * error envelope.
275
- */
276
- readonly defaultFields?: (prelude: Record<string, string>) => string[];
277
- /** Field line for a declared member. Default: prelude-mapped schema. */
278
- readonly field?: (name: string, target: string) => string;
279
- /** Optional wrapper (e.g. matcher application) from the shape's traits. */
280
- readonly wrap?: (traits: Record<string, any>) => ((cls: string) => string) | undefined;
281
- };
282
- /**
283
- * Declarative operation emission — the names the op consts are built
284
- * from. `operation` overrides this entirely when a provider needs full
285
- * control of the emitted shape.
286
- */
287
- readonly operationDecl?: {
288
- /** Requirements type in the OperationMethod annotation. */
289
- readonly contextType: string;
290
- /** Base of the per-op error union alias (e.g. `CloudflareOpError`). */
291
- readonly commonErrorType: string;
292
- /** Error classes appended to every op's `errors: [...]` list. */
293
- readonly commonErrorClasses: readonly string[];
294
- readonly protocol: string;
295
- /** The retry tag expression (e.g. `Retry.Retry`). */
296
- readonly retry: string;
297
- /**
298
- * Extra config lines inserted before the pagination entry (e.g. AWS's
299
- * `operationName` and `endpointHostPrefix`).
300
- */
301
- readonly extraConfig?: (ctx: OperationEmit) => string[];
302
- };
303
- /** Full override of operation const emission. */
304
- readonly operation?: (ctx: OperationEmit) => string;
305
- /**
306
- * Module header override. The default builds the banner + imports from
307
- * {@link SdkSpec.operationDecl} names and the conventional module layout
308
- * (`../traits.ts`, `../protocol.ts`, `../pagination.ts`, `../errors.ts`,
309
- * `../retry.ts`), re-exports the op error/context types, and emits the
310
- * `KEY_DICTIONARY` const when {@link SdkSpec.rootKeyDictionary} is set.
311
- */
312
- readonly header?: (ctx: {
313
- readonly hasPaginated: boolean;
314
- readonly model: any;
315
- }) => string;
316
- /** Final pass over the assembled module (e.g. pruning unused imports). */
317
- readonly postProcess?: (code: string) => string;
318
- /**
319
- * Trailing sections after operations (e.g. route-alias re-exports).
320
- * Receives the set of emitted op export names (mutable — additions are
321
- * visible to subsequent alias checks).
322
- */
323
- readonly footer?: (ctx: {
324
- readonly emittedOps: Set<string>;
325
- }) => string[];
326
- }
327
- export interface GeneratedService {
328
- code: string;
329
- operations: number;
330
- }
331
- /** Compile one Smithy model into a service module. */
332
- export declare const generateService: (model: any, spec: SdkSpec) => GeneratedService;
333
- export { errorUnionAlias, operationConst, upperFirst, tsKey, q, local };
334
- //# sourceMappingURL=generator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/codegen/generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAEL,KAAK,EAGL,CAAC,EACD,KAAK,EACL,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAKL,KAAK,QAAQ,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAGL,eAAe,EAGf,cAAc,EAGf,MAAM,WAAW,CAAC;AAOnB,OAAO,EAKL,KAAK,OAAO,EACb,MAAM,iBAAiB,CAAC;AAMzB;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,eAAe,WAClB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS;AACvC,+EAA+E;QACxE,SAAS,MAAM,EAAE,KACvB,MAAM,EAgCR,CAAC;AAMF,gFAAgF;AAChF,MAAM,MAAM,aAAa,GACrB,OAAO,GACP,OAAO,GACP,QAAQ,GACR,MAAM,GACN,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;I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