@distilled.cloud/core 1.0.0-rc.16 → 1.0.0-rc.18

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 (306) hide show
  1. package/lib/_bundle/aws.js +2 -0
  2. package/lib/_bundle/aws.js.map +1 -0
  3. package/lib/_bundle/base.js +5 -0
  4. package/lib/_bundle/base.js.map +1 -0
  5. package/lib/_bundle/graphql.js +3 -0
  6. package/lib/_bundle/graphql.js.map +1 -0
  7. package/lib/_bundle/rest.js +2 -0
  8. package/lib/_bundle/rest.js.map +1 -0
  9. package/lib/_bundle/xml.js +4 -0
  10. package/lib/_bundle/xml.js.map +1 -0
  11. package/lib/annotations.d.ts +15 -0
  12. package/lib/annotations.d.ts.map +1 -0
  13. package/lib/annotations.js +2 -0
  14. package/lib/annotations.js.map +1 -0
  15. package/lib/api.d.ts +15 -0
  16. package/lib/api.d.ts.map +1 -1
  17. package/lib/api.js +1 -796
  18. package/lib/category.d.ts.map +1 -1
  19. package/lib/category.js +1 -278
  20. package/lib/chunks.js +1 -11
  21. package/lib/config.d.ts +54 -13
  22. package/lib/config.d.ts.map +1 -1
  23. package/lib/config.js +1 -161
  24. package/lib/crypto.js +1 -130
  25. package/lib/debug.d.ts.map +1 -1
  26. package/lib/debug.js +1 -8
  27. package/lib/error-category.d.ts.map +1 -1
  28. package/lib/error-category.js +1 -47
  29. package/lib/errors.d.ts +2 -13
  30. package/lib/errors.d.ts.map +1 -1
  31. package/lib/errors.js +1 -198
  32. package/lib/graphql.d.ts +14 -0
  33. package/lib/graphql.d.ts.map +1 -1
  34. package/lib/graphql.js +1 -1058
  35. package/lib/graphql.types.js +1 -6
  36. package/lib/index.d.ts +3 -2
  37. package/lib/index.d.ts.map +1 -1
  38. package/lib/index.js +1 -15
  39. package/lib/pagination.d.ts +34 -2
  40. package/lib/pagination.d.ts.map +1 -1
  41. package/lib/pagination.js +1 -271
  42. package/lib/plain-values.js +1 -39
  43. package/lib/plain-values.js.map +1 -1
  44. package/lib/protocol-http.d.ts +30 -6
  45. package/lib/protocol-http.d.ts.map +1 -1
  46. package/lib/protocol-http.js +1 -812
  47. package/lib/protocol-rest.d.ts +53 -39
  48. package/lib/protocol-rest.d.ts.map +1 -1
  49. package/lib/protocol-rest.js +1 -375
  50. package/lib/query.js +1 -27
  51. package/lib/response-validation-strict.js +1 -284
  52. package/lib/response-validation.d.ts +4 -3
  53. package/lib/response-validation.d.ts.map +1 -1
  54. package/lib/response-validation.js +1 -118
  55. package/lib/retry-after.js +1 -112
  56. package/lib/retry.js +1 -197
  57. package/lib/schema-lite-impl.js +1 -341
  58. package/lib/schema-lite-typed.js +1 -27
  59. package/lib/schema-lite.js +1 -31
  60. package/lib/schema.js +1 -220
  61. package/lib/telemetry-debug.d.ts +14 -0
  62. package/lib/telemetry-debug.d.ts.map +1 -0
  63. package/lib/telemetry-debug.js +2 -0
  64. package/lib/telemetry-debug.js.map +1 -0
  65. package/lib/telemetry-hooks.d.ts +32 -0
  66. package/lib/telemetry-hooks.d.ts.map +1 -0
  67. package/lib/telemetry-hooks.js +2 -0
  68. package/lib/telemetry-hooks.js.map +1 -0
  69. package/lib/telemetry-host-rules.d.ts +23 -0
  70. package/lib/telemetry-host-rules.d.ts.map +1 -0
  71. package/lib/telemetry-host-rules.js +2 -0
  72. package/lib/telemetry-host-rules.js.map +1 -0
  73. package/lib/telemetry-lambda-context.d.ts +17 -0
  74. package/lib/telemetry-lambda-context.d.ts.map +1 -0
  75. package/lib/telemetry-lambda-context.js +2 -0
  76. package/lib/telemetry-lambda-context.js.map +1 -0
  77. package/lib/telemetry-message-context.d.ts +52 -0
  78. package/lib/telemetry-message-context.d.ts.map +1 -0
  79. package/lib/telemetry-message-context.js +2 -0
  80. package/lib/telemetry-message-context.js.map +1 -0
  81. package/lib/telemetry-metrics.d.ts +6 -0
  82. package/lib/telemetry-metrics.d.ts.map +1 -0
  83. package/lib/telemetry-metrics.js +2 -0
  84. package/lib/telemetry-metrics.js.map +1 -0
  85. package/lib/telemetry-name-template.d.ts +13 -0
  86. package/lib/telemetry-name-template.d.ts.map +1 -0
  87. package/lib/telemetry-name-template.js +2 -0
  88. package/lib/telemetry-name-template.js.map +1 -0
  89. package/lib/telemetry-stream.d.ts +9 -0
  90. package/lib/telemetry-stream.d.ts.map +1 -0
  91. package/lib/telemetry-stream.js +2 -0
  92. package/lib/telemetry-stream.js.map +1 -0
  93. package/lib/telemetry-xray.d.ts +28 -0
  94. package/lib/telemetry-xray.d.ts.map +1 -0
  95. package/lib/telemetry-xray.js +2 -0
  96. package/lib/telemetry-xray.js.map +1 -0
  97. package/lib/telemetry.d.ts +269 -0
  98. package/lib/telemetry.d.ts.map +1 -0
  99. package/lib/telemetry.js +3 -0
  100. package/lib/telemetry.js.map +1 -0
  101. package/lib/trait.js +1 -131
  102. package/lib/xml.js +1 -323
  103. package/package.json +1 -3
  104. package/src/annotations.ts +37 -0
  105. package/src/api.ts +130 -30
  106. package/src/category.ts +21 -22
  107. package/src/config.ts +58 -29
  108. package/src/debug.ts +9 -6
  109. package/src/error-category.ts +12 -14
  110. package/src/errors.ts +7 -7
  111. package/src/graphql.ts +123 -18
  112. package/src/index.ts +3 -2
  113. package/src/pagination.ts +119 -6
  114. package/src/protocol-http.ts +63 -43
  115. package/src/protocol-rest.ts +201 -140
  116. package/src/response-validation.ts +4 -3
  117. package/src/telemetry-debug.ts +135 -0
  118. package/src/telemetry-hooks.ts +33 -0
  119. package/src/telemetry-host-rules.ts +39 -0
  120. package/src/telemetry-lambda-context.ts +46 -0
  121. package/src/telemetry-message-context.ts +170 -0
  122. package/src/telemetry-metrics.ts +69 -0
  123. package/src/telemetry-name-template.ts +26 -0
  124. package/src/telemetry-stream.ts +91 -0
  125. package/src/telemetry-xray.ts +66 -0
  126. package/src/telemetry.ts +768 -0
  127. package/lib/api.js.map +0 -1
  128. package/lib/category.js.map +0 -1
  129. package/lib/chunks.js.map +0 -1
  130. package/lib/codegen/boolean-string-enums.d.ts +0 -36
  131. package/lib/codegen/boolean-string-enums.d.ts.map +0 -1
  132. package/lib/codegen/boolean-string-enums.js +0 -147
  133. package/lib/codegen/boolean-string-enums.js.map +0 -1
  134. package/lib/codegen/chunk.d.ts +0 -7
  135. package/lib/codegen/chunk.d.ts.map +0 -1
  136. package/lib/codegen/chunk.js +0 -139
  137. package/lib/codegen/chunk.js.map +0 -1
  138. package/lib/codegen/cli.d.ts +0 -80
  139. package/lib/codegen/cli.d.ts.map +0 -1
  140. package/lib/codegen/cli.js +0 -166
  141. package/lib/codegen/cli.js.map +0 -1
  142. package/lib/codegen/datafy.d.ts +0 -14
  143. package/lib/codegen/datafy.d.ts.map +0 -1
  144. package/lib/codegen/datafy.js +0 -853
  145. package/lib/codegen/datafy.js.map +0 -1
  146. package/lib/codegen/dedupe.d.ts +0 -5
  147. package/lib/codegen/dedupe.d.ts.map +0 -1
  148. package/lib/codegen/dedupe.js +0 -153
  149. package/lib/codegen/dedupe.js.map +0 -1
  150. package/lib/codegen/emit.d.ts +0 -125
  151. package/lib/codegen/emit.d.ts.map +0 -1
  152. package/lib/codegen/emit.js +0 -99
  153. package/lib/codegen/emit.js.map +0 -1
  154. package/lib/codegen/format.d.ts +0 -11
  155. package/lib/codegen/format.d.ts.map +0 -1
  156. package/lib/codegen/format.js +0 -32
  157. package/lib/codegen/format.js.map +0 -1
  158. package/lib/codegen/generated-at.d.ts +0 -29
  159. package/lib/codegen/generated-at.d.ts.map +0 -1
  160. package/lib/codegen/generated-at.js +0 -78
  161. package/lib/codegen/generated-at.js.map +0 -1
  162. package/lib/codegen/generator.d.ts +0 -353
  163. package/lib/codegen/generator.d.ts.map +0 -1
  164. package/lib/codegen/generator.js +0 -810
  165. package/lib/codegen/generator.js.map +0 -1
  166. package/lib/codegen/graph.d.ts +0 -36
  167. package/lib/codegen/graph.d.ts.map +0 -1
  168. package/lib/codegen/graph.js +0 -136
  169. package/lib/codegen/graph.js.map +0 -1
  170. package/lib/codegen/graphql-client.d.ts +0 -70
  171. package/lib/codegen/graphql-client.d.ts.map +0 -1
  172. package/lib/codegen/graphql-client.js +0 -439
  173. package/lib/codegen/graphql-client.js.map +0 -1
  174. package/lib/codegen/graphql.d.ts +0 -207
  175. package/lib/codegen/graphql.d.ts.map +0 -1
  176. package/lib/codegen/graphql.js +0 -786
  177. package/lib/codegen/graphql.js.map +0 -1
  178. package/lib/codegen/latin1.d.ts +0 -3
  179. package/lib/codegen/latin1.d.ts.map +0 -1
  180. package/lib/codegen/latin1.js +0 -126
  181. package/lib/codegen/latin1.js.map +0 -1
  182. package/lib/codegen/members.d.ts +0 -32
  183. package/lib/codegen/members.d.ts.map +0 -1
  184. package/lib/codegen/members.js +0 -62
  185. package/lib/codegen/members.js.map +0 -1
  186. package/lib/codegen/model-diff.d.ts +0 -10
  187. package/lib/codegen/model-diff.d.ts.map +0 -1
  188. package/lib/codegen/model-diff.js +0 -67
  189. package/lib/codegen/model-diff.js.map +0 -1
  190. package/lib/codegen/naming.d.ts +0 -29
  191. package/lib/codegen/naming.d.ts.map +0 -1
  192. package/lib/codegen/naming.js +0 -74
  193. package/lib/codegen/naming.js.map +0 -1
  194. package/lib/codegen/openapi-cli.d.ts +0 -52
  195. package/lib/codegen/openapi-cli.d.ts.map +0 -1
  196. package/lib/codegen/openapi-cli.js +0 -84
  197. package/lib/codegen/openapi-cli.js.map +0 -1
  198. package/lib/codegen/openapi.d.ts +0 -209
  199. package/lib/codegen/openapi.d.ts.map +0 -1
  200. package/lib/codegen/openapi.js +0 -1548
  201. package/lib/codegen/openapi.js.map +0 -1
  202. package/lib/codegen/operations.d.ts +0 -24
  203. package/lib/codegen/operations.d.ts.map +0 -1
  204. package/lib/codegen/operations.js +0 -56
  205. package/lib/codegen/operations.js.map +0 -1
  206. package/lib/codegen/pagination.d.ts +0 -39
  207. package/lib/codegen/pagination.d.ts.map +0 -1
  208. package/lib/codegen/pagination.js +0 -31
  209. package/lib/codegen/pagination.js.map +0 -1
  210. package/lib/codegen/patch-audit.d.ts +0 -84
  211. package/lib/codegen/patch-audit.d.ts.map +0 -1
  212. package/lib/codegen/patch-audit.js +0 -366
  213. package/lib/codegen/patch-audit.js.map +0 -1
  214. package/lib/codegen/patches.d.ts +0 -129
  215. package/lib/codegen/patches.d.ts.map +0 -1
  216. package/lib/codegen/patches.js +0 -472
  217. package/lib/codegen/patches.js.map +0 -1
  218. package/lib/codegen/prelude.d.ts +0 -15
  219. package/lib/codegen/prelude.d.ts.map +0 -1
  220. package/lib/codegen/prelude.js +0 -60
  221. package/lib/codegen/prelude.js.map +0 -1
  222. package/lib/codegen/privatize.d.ts +0 -21
  223. package/lib/codegen/privatize.d.ts.map +0 -1
  224. package/lib/codegen/privatize.js +0 -176
  225. package/lib/codegen/privatize.js.map +0 -1
  226. package/lib/codegen/proto.d.ts +0 -121
  227. package/lib/codegen/proto.d.ts.map +0 -1
  228. package/lib/codegen/proto.js +0 -960
  229. package/lib/codegen/proto.js.map +0 -1
  230. package/lib/codegen/pure.d.ts +0 -6
  231. package/lib/codegen/pure.d.ts.map +0 -1
  232. package/lib/codegen/pure.js +0 -91
  233. package/lib/codegen/pure.js.map +0 -1
  234. package/lib/codegen/rewrite-operation-ids.d.ts +0 -154
  235. package/lib/codegen/rewrite-operation-ids.d.ts.map +0 -1
  236. package/lib/codegen/rewrite-operation-ids.js +0 -1117
  237. package/lib/codegen/rewrite-operation-ids.js.map +0 -1
  238. package/lib/codegen/spec-path.d.ts +0 -16
  239. package/lib/codegen/spec-path.d.ts.map +0 -1
  240. package/lib/codegen/spec-path.js +0 -101
  241. package/lib/codegen/spec-path.js.map +0 -1
  242. package/lib/codegen/table.d.ts +0 -5
  243. package/lib/codegen/table.d.ts.map +0 -1
  244. package/lib/codegen/table.js +0 -249
  245. package/lib/codegen/table.js.map +0 -1
  246. package/lib/config.js.map +0 -1
  247. package/lib/crypto.js.map +0 -1
  248. package/lib/debug.js.map +0 -1
  249. package/lib/error-category.js.map +0 -1
  250. package/lib/errors.js.map +0 -1
  251. package/lib/graphql.js.map +0 -1
  252. package/lib/graphql.types.js.map +0 -1
  253. package/lib/index.js.map +0 -1
  254. package/lib/json-patch.d.ts +0 -58
  255. package/lib/json-patch.d.ts.map +0 -1
  256. package/lib/json-patch.js +0 -227
  257. package/lib/json-patch.js.map +0 -1
  258. package/lib/pagination.js.map +0 -1
  259. package/lib/protocol-http.js.map +0 -1
  260. package/lib/protocol-rest.js.map +0 -1
  261. package/lib/query.js.map +0 -1
  262. package/lib/response-validation-strict.js.map +0 -1
  263. package/lib/response-validation.js.map +0 -1
  264. package/lib/retry-after.js.map +0 -1
  265. package/lib/retry.js.map +0 -1
  266. package/lib/schema-lite-impl.js.map +0 -1
  267. package/lib/schema-lite-typed.js.map +0 -1
  268. package/lib/schema-lite.js.map +0 -1
  269. package/lib/schema.js.map +0 -1
  270. package/lib/testing.d.ts +0 -40
  271. package/lib/testing.d.ts.map +0 -1
  272. package/lib/testing.js +0 -42
  273. package/lib/testing.js.map +0 -1
  274. package/lib/trait.js.map +0 -1
  275. package/lib/xml.js.map +0 -1
  276. package/src/codegen/boolean-string-enums.ts +0 -155
  277. package/src/codegen/chunk.ts +0 -147
  278. package/src/codegen/cli.ts +0 -293
  279. package/src/codegen/datafy.ts +0 -874
  280. package/src/codegen/dedupe.ts +0 -173
  281. package/src/codegen/emit.ts +0 -200
  282. package/src/codegen/format.ts +0 -49
  283. package/src/codegen/generated-at.ts +0 -88
  284. package/src/codegen/generator.ts +0 -1229
  285. package/src/codegen/graph.ts +0 -151
  286. package/src/codegen/graphql-client.ts +0 -545
  287. package/src/codegen/graphql.ts +0 -1145
  288. package/src/codegen/latin1.ts +0 -131
  289. package/src/codegen/members.ts +0 -79
  290. package/src/codegen/model-diff.ts +0 -67
  291. package/src/codegen/naming.ts +0 -85
  292. package/src/codegen/openapi-cli.ts +0 -141
  293. package/src/codegen/openapi.ts +0 -1845
  294. package/src/codegen/operations.ts +0 -73
  295. package/src/codegen/pagination.ts +0 -64
  296. package/src/codegen/patch-audit.ts +0 -480
  297. package/src/codegen/patches.ts +0 -581
  298. package/src/codegen/prelude.ts +0 -70
  299. package/src/codegen/privatize.ts +0 -200
  300. package/src/codegen/proto.ts +0 -1092
  301. package/src/codegen/pure.ts +0 -94
  302. package/src/codegen/rewrite-operation-ids.ts +0 -1219
  303. package/src/codegen/spec-path.ts +0 -112
  304. package/src/codegen/table.ts +0 -254
  305. package/src/json-patch.ts +0 -273
  306. package/src/testing.ts +0 -74
@@ -1,960 +0,0 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
- import { SENSITIVE_FIELD_PATTERNS } from "./openapi.js";
25
- // ============================================================================
26
- // Prelude
27
- // ============================================================================
28
- export const PRELUDE = {
29
- String: "smithy.api#String",
30
- Boolean: "smithy.api#Boolean",
31
- Integer: "smithy.api#Integer",
32
- Long: "smithy.api#Long",
33
- Float: "smithy.api#Float",
34
- Double: "smithy.api#Double",
35
- Timestamp: "smithy.api#Timestamp",
36
- Blob: "smithy.api#Blob",
37
- Document: "smithy.api#Document",
38
- Unit: "smithy.api#Unit",
39
- };
40
- const SCALAR_TARGETS = {
41
- double: PRELUDE.Double,
42
- float: PRELUDE.Float,
43
- int32: PRELUDE.Integer,
44
- int64: PRELUDE.String,
45
- uint32: PRELUDE.Integer,
46
- uint64: PRELUDE.String,
47
- sint32: PRELUDE.Integer,
48
- sint64: PRELUDE.String,
49
- fixed32: PRELUDE.Integer,
50
- fixed64: PRELUDE.String,
51
- sfixed32: PRELUDE.Integer,
52
- sfixed64: PRELUDE.String,
53
- bool: PRELUDE.Boolean,
54
- string: PRELUDE.String,
55
- bytes: PRELUDE.Blob,
56
- };
57
- const WKT_TARGETS = {
58
- "google.protobuf.Timestamp": PRELUDE.Timestamp,
59
- "google.protobuf.Duration": PRELUDE.String,
60
- "google.protobuf.Any": PRELUDE.Document,
61
- "google.protobuf.Struct": PRELUDE.Document,
62
- "google.protobuf.Value": PRELUDE.Document,
63
- "google.protobuf.ListValue": PRELUDE.Document,
64
- "google.protobuf.BoolValue": PRELUDE.Boolean,
65
- "google.protobuf.StringValue": PRELUDE.String,
66
- "google.protobuf.BytesValue": PRELUDE.Blob,
67
- "google.protobuf.Int32Value": PRELUDE.Integer,
68
- "google.protobuf.UInt32Value": PRELUDE.Integer,
69
- "google.protobuf.Int64Value": PRELUDE.String,
70
- "google.protobuf.UInt64Value": PRELUDE.String,
71
- "google.protobuf.FloatValue": PRELUDE.Float,
72
- "google.protobuf.DoubleValue": PRELUDE.Double,
73
- "google.protobuf.FieldMask": PRELUDE.String,
74
- "google.protobuf.Empty": PRELUDE.Unit,
75
- };
76
- // ============================================================================
77
- // Lexer / parser
78
- // ============================================================================
79
- class ProtoParseError extends Error {
80
- constructor(filename, line, col, message) {
81
- super(`${filename}:${line}:${col}: ${message}`);
82
- this.name = "ProtoParseError";
83
- }
84
- }
85
- class Parser {
86
- filename;
87
- src;
88
- i = 0;
89
- line = 1;
90
- col = 1;
91
- lastComment = "";
92
- constructor(src, filename) {
93
- this.src = src;
94
- this.filename = filename;
95
- }
96
- fail(message) {
97
- throw new ProtoParseError(this.filename, this.line, this.col, message);
98
- }
99
- peekChar() {
100
- return this.src[this.i] ?? "";
101
- }
102
- bump() {
103
- const ch = this.src[this.i] ?? "";
104
- this.i++;
105
- if (ch === "\n") {
106
- this.line++;
107
- this.col = 1;
108
- }
109
- else {
110
- this.col++;
111
- }
112
- return ch;
113
- }
114
- skipTrivia() {
115
- const comments = [];
116
- while (this.i < this.src.length) {
117
- const ch = this.peekChar();
118
- if (ch === " " || ch === "\t" || ch === "\r" || ch === "\n") {
119
- this.bump();
120
- continue;
121
- }
122
- if (ch === "/" && this.src[this.i + 1] === "/") {
123
- this.bump();
124
- this.bump();
125
- let text = "";
126
- while (this.i < this.src.length && this.peekChar() !== "\n") {
127
- text += this.bump();
128
- }
129
- comments.push(text.trim());
130
- continue;
131
- }
132
- if (ch === "/" && this.src[this.i + 1] === "*") {
133
- this.bump();
134
- this.bump();
135
- let text = "";
136
- while (this.i < this.src.length) {
137
- if (this.peekChar() === "*" && this.src[this.i + 1] === "/") {
138
- this.bump();
139
- this.bump();
140
- break;
141
- }
142
- text += this.bump();
143
- }
144
- for (const line of text.split("\n")) {
145
- const t = line.replace(/^\s*\*?\s?/, "").trim();
146
- if (t)
147
- comments.push(t);
148
- }
149
- continue;
150
- }
151
- break;
152
- }
153
- if (comments.length > 0)
154
- this.lastComment = comments.join(" ");
155
- }
156
- takeDoc() {
157
- const d = this.lastComment.trim();
158
- this.lastComment = "";
159
- return d || undefined;
160
- }
161
- peekIdent() {
162
- this.skipTrivia();
163
- const ch = this.peekChar();
164
- return /[A-Za-z_]/.test(ch);
165
- }
166
- ident() {
167
- this.skipTrivia();
168
- const ch = this.peekChar();
169
- if (!/[A-Za-z_]/.test(ch))
170
- this.fail(`expected identifier, got ${JSON.stringify(ch)}`);
171
- let out = this.bump();
172
- while (/[A-Za-z0-9_]/.test(this.peekChar()))
173
- out += this.bump();
174
- return out;
175
- }
176
- tryIdent(want) {
177
- this.skipTrivia();
178
- const start = this.i;
179
- const line = this.line;
180
- const col = this.col;
181
- const comment = this.lastComment;
182
- if (!this.peekIdent())
183
- return false;
184
- const got = this.ident();
185
- if (got === want)
186
- return true;
187
- this.i = start;
188
- this.line = line;
189
- this.col = col;
190
- this.lastComment = comment;
191
- return false;
192
- }
193
- dotted() {
194
- let name = this.ident();
195
- while (this.tryChar("."))
196
- name += `.${this.ident()}`;
197
- return name;
198
- }
199
- tryChar(ch) {
200
- this.skipTrivia();
201
- if (this.peekChar() === ch) {
202
- this.bump();
203
- return true;
204
- }
205
- return false;
206
- }
207
- expect(ch) {
208
- this.skipTrivia();
209
- if (this.peekChar() !== ch) {
210
- this.fail(`expected ${JSON.stringify(ch)}, got ${JSON.stringify(this.peekChar())}`);
211
- }
212
- this.bump();
213
- }
214
- stringLit() {
215
- this.skipTrivia();
216
- const q = this.peekChar();
217
- if (q !== '"' && q !== "'")
218
- this.fail("expected string literal");
219
- this.bump();
220
- let out = "";
221
- while (this.i < this.src.length && this.peekChar() !== q) {
222
- const ch = this.bump();
223
- if (ch === "\\" && this.i < this.src.length) {
224
- const n = this.bump();
225
- const esc = {
226
- n: "\n",
227
- t: "\t",
228
- r: "\r",
229
- '"': '"',
230
- "'": "'",
231
- "\\": "\\",
232
- };
233
- out += esc[n] ?? n;
234
- }
235
- else {
236
- out += ch;
237
- }
238
- }
239
- if (this.peekChar() !== q)
240
- this.fail("unterminated string");
241
- this.bump();
242
- return out;
243
- }
244
- number() {
245
- this.skipTrivia();
246
- let s = "";
247
- if (this.peekChar() === "-")
248
- s += this.bump();
249
- if (!/[0-9]/.test(this.peekChar()))
250
- this.fail("expected number");
251
- while (/[0-9]/.test(this.peekChar()))
252
- s += this.bump();
253
- return Number(s);
254
- }
255
- skipUntil(ch) {
256
- this.skipTrivia();
257
- while (this.i < this.src.length && this.peekChar() !== ch) {
258
- if (this.peekChar() === '"' || this.peekChar() === "'")
259
- this.stringLit();
260
- else if (this.peekChar() === "{") {
261
- this.bump();
262
- this.skipUntil("}");
263
- this.expect("}");
264
- }
265
- else {
266
- this.bump();
267
- }
268
- }
269
- }
270
- parseOptions() {
271
- let jsonName;
272
- let deprecated = false;
273
- if (!this.tryChar("["))
274
- return { deprecated };
275
- while (true) {
276
- this.skipTrivia();
277
- if (this.peekChar() === "]")
278
- break;
279
- const key = this.tryChar("(") ? `(${this.dotted()})` : this.dotted();
280
- this.expect("=");
281
- this.skipTrivia();
282
- let value;
283
- if (this.peekChar() === '"' || this.peekChar() === "'")
284
- value = this.stringLit();
285
- else if (this.tryIdent("true"))
286
- value = true;
287
- else if (this.tryIdent("false"))
288
- value = false;
289
- else if (/[0-9-]/.test(this.peekChar()))
290
- value = this.number();
291
- else
292
- value = this.ident();
293
- if (key === "json_name" && typeof value === "string")
294
- jsonName = value;
295
- if (key === "deprecated" && value === true)
296
- deprecated = true;
297
- this.tryChar(",");
298
- }
299
- this.expect("]");
300
- return { jsonName, deprecated };
301
- }
302
- parseField() {
303
- const documentation = this.takeDoc();
304
- let repeated = false;
305
- let optional = false;
306
- if (this.tryIdent("repeated"))
307
- repeated = true;
308
- else if (this.tryIdent("optional"))
309
- optional = true;
310
- let mapKey;
311
- let mapValue;
312
- let type;
313
- if (this.tryIdent("map")) {
314
- this.expect("<");
315
- mapKey = this.dotted();
316
- this.expect(",");
317
- mapValue = this.dotted();
318
- this.expect(">");
319
- type = `map<${mapKey},${mapValue}>`;
320
- }
321
- else {
322
- type = this.dotted();
323
- }
324
- const name = this.ident();
325
- this.expect("=");
326
- this.number();
327
- const opts = this.parseOptions();
328
- this.expect(";");
329
- return {
330
- name,
331
- type,
332
- repeated,
333
- optional,
334
- mapKey,
335
- mapValue,
336
- jsonName: opts.jsonName,
337
- deprecated: opts.deprecated,
338
- documentation,
339
- };
340
- }
341
- parseEnum(pkg, prefix) {
342
- const documentation = this.takeDoc();
343
- const name = this.ident();
344
- const fullName = prefix ? `${prefix}.${name}` : `${pkg}.${name}`;
345
- this.expect("{");
346
- const values = [];
347
- while (true) {
348
- this.skipTrivia();
349
- if (this.peekChar() === "}")
350
- break;
351
- if (this.tryIdent("option") || this.tryIdent("reserved")) {
352
- this.skipUntil(";");
353
- this.expect(";");
354
- continue;
355
- }
356
- const vdoc = this.takeDoc();
357
- const vname = this.ident();
358
- this.expect("=");
359
- const number = this.number();
360
- const opts = this.parseOptions();
361
- this.expect(";");
362
- values.push({
363
- name: vname,
364
- number,
365
- deprecated: opts.deprecated,
366
- documentation: vdoc,
367
- });
368
- }
369
- this.expect("}");
370
- this.tryChar(";");
371
- return { name, fullName, values, documentation };
372
- }
373
- parseMessage(pkg, prefix) {
374
- const documentation = this.takeDoc();
375
- const name = this.ident();
376
- const fullName = prefix ? `${prefix}.${name}` : `${pkg}.${name}`;
377
- this.expect("{");
378
- const fields = [];
379
- const messages = [];
380
- const enums = [];
381
- while (true) {
382
- this.skipTrivia();
383
- if (this.peekChar() === "}")
384
- break;
385
- if (this.tryIdent("option") || this.tryIdent("reserved") || this.tryIdent("extensions")) {
386
- this.skipUntil(";");
387
- this.expect(";");
388
- continue;
389
- }
390
- if (this.tryIdent("message")) {
391
- messages.push(this.parseMessage(pkg, fullName));
392
- continue;
393
- }
394
- if (this.tryIdent("enum")) {
395
- enums.push(this.parseEnum(pkg, fullName));
396
- continue;
397
- }
398
- if (this.tryIdent("oneof")) {
399
- this.ident();
400
- this.expect("{");
401
- while (true) {
402
- this.skipTrivia();
403
- if (this.peekChar() === "}")
404
- break;
405
- if (this.tryIdent("option")) {
406
- this.skipUntil(";");
407
- this.expect(";");
408
- continue;
409
- }
410
- fields.push({ ...this.parseField(), optional: true });
411
- }
412
- this.expect("}");
413
- continue;
414
- }
415
- if (this.peekChar() === ";") {
416
- this.bump();
417
- continue;
418
- }
419
- fields.push(this.parseField());
420
- }
421
- this.expect("}");
422
- this.tryChar(";");
423
- return { name, fullName, fields, messages, enums, documentation };
424
- }
425
- parseRpc() {
426
- const documentation = this.takeDoc();
427
- const name = this.ident();
428
- this.expect("(");
429
- const requestStream = this.tryIdent("stream");
430
- const requestType = this.dotted();
431
- this.expect(")");
432
- if (!this.tryIdent("returns"))
433
- this.fail("expected `returns`");
434
- this.expect("(");
435
- const responseStream = this.tryIdent("stream");
436
- const responseType = this.dotted();
437
- this.expect(")");
438
- let deprecated = false;
439
- if (this.tryChar("{")) {
440
- while (true) {
441
- this.skipTrivia();
442
- if (this.peekChar() === "}")
443
- break;
444
- if (this.tryIdent("option")) {
445
- const start = this.i;
446
- this.skipUntil(";");
447
- const body = this.src.slice(start, this.i);
448
- if (/deprecated\s*=\s*true/.test(body))
449
- deprecated = true;
450
- this.expect(";");
451
- continue;
452
- }
453
- this.skipUntil("}");
454
- }
455
- this.expect("}");
456
- }
457
- else {
458
- this.expect(";");
459
- }
460
- return {
461
- name,
462
- requestType,
463
- responseType,
464
- requestStream,
465
- responseStream,
466
- deprecated,
467
- documentation,
468
- };
469
- }
470
- parseService(pkg) {
471
- const documentation = this.takeDoc();
472
- const name = this.ident();
473
- this.expect("{");
474
- const rpcs = [];
475
- while (true) {
476
- this.skipTrivia();
477
- if (this.peekChar() === "}")
478
- break;
479
- if (this.tryIdent("option") || this.tryIdent("reserved")) {
480
- this.skipUntil(";");
481
- this.expect(";");
482
- continue;
483
- }
484
- if (this.tryIdent("rpc")) {
485
- rpcs.push(this.parseRpc());
486
- continue;
487
- }
488
- this.fail(`unexpected token in service ${name}`);
489
- }
490
- this.expect("}");
491
- this.tryChar(";");
492
- return { name, fullName: `${pkg}.${name}`, rpcs, documentation };
493
- }
494
- parseFile() {
495
- let syntax = "proto2";
496
- let pkg = "";
497
- const imports = [];
498
- const messages = [];
499
- const enums = [];
500
- const services = [];
501
- this.skipTrivia();
502
- while (this.i < this.src.length) {
503
- this.skipTrivia();
504
- if (this.i >= this.src.length)
505
- break;
506
- if (this.tryIdent("syntax")) {
507
- this.expect("=");
508
- syntax = this.stringLit();
509
- this.expect(";");
510
- continue;
511
- }
512
- if (this.tryIdent("package")) {
513
- pkg = this.dotted();
514
- this.expect(";");
515
- continue;
516
- }
517
- if (this.tryIdent("import")) {
518
- this.tryIdent("public");
519
- this.tryIdent("weak");
520
- imports.push(this.stringLit());
521
- this.expect(";");
522
- continue;
523
- }
524
- if (this.tryIdent("option")) {
525
- this.skipUntil(";");
526
- this.expect(";");
527
- continue;
528
- }
529
- if (this.tryIdent("message")) {
530
- messages.push(this.parseMessage(pkg, ""));
531
- continue;
532
- }
533
- if (this.tryIdent("enum")) {
534
- enums.push(this.parseEnum(pkg, ""));
535
- continue;
536
- }
537
- if (this.tryIdent("service")) {
538
- services.push(this.parseService(pkg));
539
- continue;
540
- }
541
- this.fail(`unexpected token ${JSON.stringify(this.peekChar())}`);
542
- }
543
- return {
544
- filename: this.filename,
545
- package: pkg,
546
- syntax,
547
- imports,
548
- messages,
549
- enums,
550
- services,
551
- };
552
- }
553
- }
554
-
555
- export const parseProto = (text, filename = "input.proto") => {
556
- const file = new Parser(text, filename).parseFile();
557
- if (file.syntax !== "proto3") {
558
- throw new Error(`${filename}: expected proto3, got ${JSON.stringify(file.syntax)}`);
559
- }
560
- return file;
561
- };
562
- const walkMessage = (msg, index) => {
563
- index.messages.set(msg.fullName, msg);
564
- for (const nested of msg.messages)
565
- walkMessage(nested, index);
566
- for (const en of msg.enums)
567
- index.enums.set(en.fullName, en);
568
- };
569
- const indexFiles = (files) => {
570
- const index = {
571
- messages: new Map(),
572
- enums: new Map(),
573
- services: [],
574
- };
575
- for (const file of files) {
576
- for (const msg of file.messages)
577
- walkMessage(msg, index);
578
- for (const en of file.enums)
579
- index.enums.set(en.fullName, index.enums.get(en.fullName) ?? en);
580
- index.services.push(...file.services);
581
- }
582
- return index;
583
- };
584
- const resolveName = (name, pkg, scope, index) => {
585
- const stripped = name.startsWith(".") ? name.slice(1) : name;
586
- if (SCALAR_TARGETS[stripped])
587
- return stripped;
588
- if (WKT_TARGETS[stripped] || stripped.startsWith("google.protobuf."))
589
- return stripped;
590
- const candidates = [];
591
- if (name.startsWith(".")) {
592
- candidates.push(stripped);
593
- }
594
- else {
595
- if (scope) {
596
- const parts = scope.split(".");
597
- for (let i = parts.length; i >= 0; i--) {
598
- const prefix = parts.slice(0, i).join(".");
599
- candidates.push(prefix ? `${prefix}.${stripped}` : stripped);
600
- }
601
- }
602
- if (pkg)
603
- candidates.push(`${pkg}.${stripped}`);
604
- candidates.push(stripped);
605
- }
606
- for (const c of candidates) {
607
- if (index.messages.has(c) || index.enums.has(c))
608
- return c;
609
- }
610
- throw new Error(`unresolved proto type ${JSON.stringify(name)} (package ${pkg}, scope ${scope})`);
611
- };
612
- const capitalize = (s) => (s ? s.charAt(0).toUpperCase() + s.slice(1) : s);
613
- const ident = (s) => {
614
- let out = s.replace(/[^A-Za-z0-9_]/g, "_");
615
- if (/^[0-9]/.test(out))
616
- out = `_${out}`;
617
- return out || "_";
618
- };
619
- const camel = (s) => s.replace(/[_-]+([A-Za-z0-9])/g, (_, c) => c.toUpperCase());
620
- const shapeNameFor = (fullName) => {
621
- const parts = fullName.split(".").filter(Boolean);
622
- // Drop the proto package (everything before the first PascalCase type).
623
- const start = parts.findIndex((p) => /^[A-Z]/.test(p));
624
- const typeParts = start >= 0 ? parts.slice(start) : parts.slice(-1);
625
- return ident(typeParts.join(""));
626
- };
627
- const addExact = (bag, name, def) => {
628
- const id = `${bag.namespace}#${name}`;
629
- if (bag.shapes[id] !== undefined) {
630
- throw new Error(`smithy shape ${id} already exists`);
631
- }
632
- bag.shapes[id] = def;
633
- bag.names.add(name);
634
- return id;
635
- };
636
- const addShape = (bag, base, def) => {
637
- let want = ident(capitalize(base));
638
- let name = want;
639
- let n = 2;
640
- while (bag.names.has(name))
641
- name = `${want}${n++}`;
642
- return addExact(bag, name, def);
643
- };
644
- const oneLineDoc = (s) => {
645
- const t = s?.replace(/\s+/g, " ").trim();
646
- return t ? t : undefined;
647
- };
648
- const isSensitive = (name) => SENSITIVE_FIELD_PATTERNS.some((re) => re.test(name));
649
- const EMPTY_STRUCT_ID = "GoogleProtobufEmpty";
650
- const emitEnum = (ctx, en) => {
651
- const cached = ctx.memo.get(en.fullName);
652
- if (cached)
653
- return cached;
654
- const members = {};
655
- const used = new Set();
656
- for (const v of en.values) {
657
- let mn = ident(v.name);
658
- let k = 2;
659
- while (used.has(mn))
660
- mn = `${ident(v.name)}_${k++}`;
661
- used.add(mn);
662
- const traits = { "smithy.api#enumValue": v.name };
663
- const doc = oneLineDoc(v.documentation);
664
- if (doc)
665
- traits["smithy.api#documentation"] = doc;
666
- if (v.deprecated)
667
- traits["smithy.api#deprecated"] = {};
668
- members[mn] = { target: "smithy.api#Unit", traits };
669
- }
670
- const def = { type: "enum", members };
671
- const doc = oneLineDoc(en.documentation);
672
- if (doc)
673
- def.traits = { "smithy.api#documentation": doc };
674
- const id = addShape(ctx.bag, shapeNameFor(en.fullName), def);
675
- ctx.memo.set(en.fullName, id);
676
- return id;
677
- };
678
- const emitEmptyStruct = (ctx) => {
679
- const cached = ctx.memo.get("google.protobuf.Empty.struct");
680
- if (cached)
681
- return cached;
682
- const id = addShape(ctx.bag, EMPTY_STRUCT_ID, {
683
- type: "structure",
684
- members: {},
685
- traits: {
686
- "smithy.api#documentation": "google.protobuf.Empty as a nested field.",
687
- },
688
- });
689
- ctx.memo.set("google.protobuf.Empty.struct", id);
690
- return id;
691
- };
692
- const emitType = (ctx, raw, scope, asField) => {
693
- if (SCALAR_TARGETS[raw])
694
- return SCALAR_TARGETS[raw];
695
- const resolved = resolveName(raw, ctx.pkg, scope, ctx.index);
696
- if (SCALAR_TARGETS[resolved])
697
- return SCALAR_TARGETS[resolved];
698
- if (resolved === "google.protobuf.Empty") {
699
- return asField ? emitEmptyStruct(ctx) : PRELUDE.Unit;
700
- }
701
- if (WKT_TARGETS[resolved])
702
- return WKT_TARGETS[resolved];
703
- const cached = ctx.memo.get(resolved);
704
- if (cached)
705
- return cached;
706
- const en = ctx.index.enums.get(resolved);
707
- if (en)
708
- return emitEnum(ctx, en);
709
- const msg = ctx.index.messages.get(resolved);
710
- if (!msg)
711
- throw new Error(`no message or enum for ${resolved}`);
712
- return emitMessage(ctx, msg);
713
- };
714
- const listOf = (ctx, elem) => {
715
- const cached = ctx.listMemo.get(elem);
716
- if (cached)
717
- return cached;
718
- const local = elem.split("#")[1] ?? "Value";
719
- const id = addShape(ctx.bag, `${local}List`, {
720
- type: "list",
721
- member: { target: elem },
722
- });
723
- ctx.listMemo.set(elem, id);
724
- return id;
725
- };
726
- const mapOf = (ctx, value) => {
727
- const cached = ctx.mapMemo.get(value);
728
- if (cached)
729
- return cached;
730
- const local = value.split("#")[1] ?? "Value";
731
- const id = addShape(ctx.bag, `${local}Map`, {
732
- type: "map",
733
- key: { target: PRELUDE.String },
734
- value: { target: value },
735
- });
736
- ctx.mapMemo.set(value, id);
737
- return id;
738
- };
739
- const fieldTarget = (ctx, field, scope) => {
740
- if (field.mapKey && field.mapValue) {
741
- const value = emitType(ctx, field.mapValue, scope, true);
742
- return mapOf(ctx, value);
743
- }
744
- const inner = emitType(ctx, field.type, scope, true);
745
- return field.repeated ? listOf(ctx, inner) : inner;
746
- };
747
- const memberTraits = (field, tsName) => {
748
- const traits = {};
749
- const doc = oneLineDoc(field.documentation);
750
- if (doc)
751
- traits["smithy.api#documentation"] = doc;
752
- const wire = field.jsonName ?? camel(field.name);
753
- if (wire !== tsName)
754
- traits["smithy.api#jsonName"] = wire;
755
- if (isSensitive(field.name) || isSensitive(tsName)) {
756
- traits["smithy.api#sensitive"] = {};
757
- }
758
- if (field.deprecated)
759
- traits["smithy.api#deprecated"] = {};
760
- return traits;
761
- };
762
- const emitMembers = (ctx, fields, scope) => {
763
- const members = {};
764
- const used = new Set();
765
- for (const field of fields) {
766
- let tsName = ident(camel(field.name));
767
- let k = 2;
768
- while (used.has(tsName))
769
- tsName = `${ident(camel(field.name))}${k++}`;
770
- used.add(tsName);
771
- const traits = memberTraits(field, tsName);
772
- members[tsName] = {
773
- target: fieldTarget(ctx, field, scope),
774
- ...(Object.keys(traits).length ? { traits } : {}),
775
- };
776
- }
777
- return members;
778
- };
779
- const emitMessage = (ctx, msg) => {
780
- const cached = ctx.memo.get(msg.fullName);
781
- if (cached)
782
- return cached;
783
- const def = { type: "structure", members: {} };
784
- const doc = oneLineDoc(msg.documentation);
785
- if (doc)
786
- def.traits = { "smithy.api#documentation": doc };
787
- const id = addShape(ctx.bag, shapeNameFor(msg.fullName), def);
788
- ctx.memo.set(msg.fullName, id);
789
- def.members = emitMembers(ctx, msg.fields, msg.fullName);
790
- return id;
791
- };
792
- const copyIo = (ctx, rpcName, side, typeName) => {
793
- if (SCALAR_TARGETS[typeName]) {
794
- return addShape(ctx.bag, `${rpcName}${side}`, {
795
- type: "structure",
796
- members: {
797
- value: {
798
- target: SCALAR_TARGETS[typeName],
799
- traits: { "smithy.api#required": {} },
800
- },
801
- },
802
- traits: {
803
- [side === "Request" ? "smithy.api#input" : "smithy.api#output"]: {},
804
- },
805
- });
806
- }
807
- const resolved = resolveName(typeName, ctx.pkg, undefined, ctx.index);
808
- if (resolved === "google.protobuf.Empty")
809
- return PRELUDE.Unit;
810
- if (WKT_TARGETS[resolved] && resolved !== "google.protobuf.Empty") {
811
- return addShape(ctx.bag, `${rpcName}${side}`, {
812
- type: "structure",
813
- members: {
814
- value: {
815
- target: WKT_TARGETS[resolved],
816
- traits: { "smithy.api#required": {} },
817
- },
818
- },
819
- traits: {
820
- [side === "Request" ? "smithy.api#input" : "smithy.api#output"]: {},
821
- },
822
- });
823
- }
824
- const en = ctx.index.enums.get(resolved);
825
- if (en) {
826
- return addShape(ctx.bag, `${rpcName}${side}`, {
827
- type: "structure",
828
- members: {
829
- value: {
830
- target: emitEnum(ctx, en),
831
- traits: { "smithy.api#required": {} },
832
- },
833
- },
834
- traits: {
835
- [side === "Request" ? "smithy.api#input" : "smithy.api#output"]: {},
836
- },
837
- });
838
- }
839
- const msg = ctx.index.messages.get(resolved);
840
- if (!msg)
841
- throw new Error(`rpc ${rpcName}: ${side} type ${typeName} is not a message`);
842
- return addShape(ctx.bag, `${rpcName}${side}`, {
843
- type: "structure",
844
- members: emitMembers(ctx, msg.fields, msg.fullName),
845
- traits: {
846
- [side === "Request" ? "smithy.api#input" : "smithy.api#output"]: {},
847
- },
848
- });
849
- };
850
-
851
- export const rpcGroupName = (rpcName) => {
852
- const m = rpcName.match(/^([A-Z][a-z]+|[A-Z]+(?![a-z]))/);
853
- return m?.[1] ?? rpcName;
854
- };
855
- export const convertProtoToSmithy = (options) => {
856
- const index = indexFiles(options.files);
857
- const service = index.services.find((s) => s.fullName === options.protoService);
858
- if (!service) {
859
- throw new Error(`proto service ${options.protoService} not found (have ${index.services
860
- .map((s) => s.fullName)
861
- .join(", ")})`);
862
- }
863
- const file = options.files.find((f) => f.services.some((s) => s.fullName === service.fullName));
864
- const pkg = file?.package ?? service.fullName.split(".").slice(0, -1).join(".");
865
- const bag = {
866
- shapes: {},
867
- names: new Set(),
868
- namespace: options.namespace,
869
- };
870
- const ctx = {
871
- bag,
872
- index,
873
- pkg,
874
- memo: new Map(),
875
- listMemo: new Map(),
876
- mapMemo: new Map(),
877
- };
878
- const skipStreaming = options.skipStreaming ?? true;
879
- const skipDeprecated = options.skipDeprecated ?? true;
880
- let converted = 0;
881
- let skippedStreaming = 0;
882
- let skippedDeprecated = 0;
883
- const serviceOps = [];
884
- // Reserve RPC local names so message/enum shapes that share an RPC's
885
- // PascalCase name (`AppDeploymentHistory`, `DomainList`) uniquify instead
886
- // of being overwritten when the operation is addExact'd. The Smithy
887
- // service shape is `${serviceName}Service` for the same reason (`Image`
888
- // the message vs Image the RPC group).
889
- const serviceShapeName = options.serviceName.endsWith("Service")
890
- ? options.serviceName
891
- : `${options.serviceName}Service`;
892
- bag.names.add(serviceShapeName);
893
- for (const rpc of service.rpcs) {
894
- if (options.rpcNames && !options.rpcNames.has(rpc.name))
895
- continue;
896
- bag.names.add(rpc.name);
897
- }
898
- for (const rpc of service.rpcs) {
899
- if (options.rpcNames && !options.rpcNames.has(rpc.name))
900
- continue;
901
- if (rpc.requestStream || rpc.responseStream) {
902
- if (skipStreaming) {
903
- skippedStreaming++;
904
- continue;
905
- }
906
- }
907
- if (rpc.deprecated && skipDeprecated) {
908
- skippedDeprecated++;
909
- continue;
910
- }
911
- const input = copyIo(ctx, rpc.name, "Request", rpc.requestType);
912
- const output = copyIo(ctx, rpc.name, "Response", rpc.responseType);
913
- const httpUri = `/${service.fullName}/${rpc.name}`;
914
- const traits = {
915
- "smithy.api#http": { method: "POST", uri: httpUri, code: 200 },
916
- };
917
- const doc = oneLineDoc(rpc.documentation);
918
- if (doc)
919
- traits["smithy.api#documentation"] = doc;
920
- if (rpc.deprecated)
921
- traits["smithy.api#deprecated"] = {};
922
- const opId = addExact(bag, rpc.name, {
923
- type: "operation",
924
- input: { target: input },
925
- output: { target: output },
926
- traits,
927
- });
928
- serviceOps.push({ target: opId });
929
- converted++;
930
- }
931
- addExact(bag, serviceShapeName, {
932
- type: "service",
933
- version: options.serviceVersion ?? "1.0",
934
- operations: serviceOps,
935
- traits: {
936
- "smithy.api#title": options.serviceTitle ?? options.serviceName,
937
- ...(options.serviceDocumentation
938
- ? { "smithy.api#documentation": options.serviceDocumentation }
939
- : {}),
940
- },
941
- });
942
- return {
943
- model: {
944
- smithy: "2.0",
945
- metadata: {
946
- suppressions: [
947
- { id: "HttpUriConflict", namespace: "*" },
948
- { id: "HttpMethodSemantics", namespace: "*" },
949
- { id: "UnreferencedShape", namespace: "*" },
950
- ],
951
- },
952
- shapes: bag.shapes,
953
- },
954
- converted,
955
- skippedStreaming,
956
- skippedDeprecated,
957
- shapeCount: Object.keys(bag.shapes).length,
958
- };
959
- };
960
- //# sourceMappingURL=proto.js.map