@skmtc/core 0.0.961 → 0.0.963
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.
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +19 -10
- package/esm/context/ResultsHandler.d.ts.map +1 -1
- package/esm/context/ResultsHandler.js +12 -7
- package/esm/context/generateTypes.d.ts +3 -3
- package/esm/context/generateTypes.d.ts.map +1 -1
- package/esm/dsl/EntityType.d.ts.map +1 -1
- package/esm/dsl/EntityType.js +10 -5
- package/esm/helpers/collateExamples.d.ts.map +1 -1
- package/esm/helpers/collateExamples.js +55 -47
- package/esm/helpers/naming.d.ts.map +1 -1
- package/esm/helpers/naming.js +8 -5
- package/esm/oas/document/Document.d.ts.map +1 -1
- package/esm/oas/document/Document.js +16 -17
- package/esm/oas/object/Object.d.ts.map +1 -1
- package/esm/oas/object/Object.js +11 -5
- package/esm/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/esm/oas/parameter/toParameterV3.js +24 -12
- package/esm/oas/ref/Ref.d.ts.map +1 -1
- package/esm/oas/ref/Ref.js +55 -28
- package/esm/oas/schema/toSchemasV3.d.ts.map +1 -1
- package/esm/oas/schema/toSchemasV3.js +96 -89
- package/esm/oas/securitySchemes/toSecuritySchemes.d.ts.map +1 -1
- package/esm/oas/securitySchemes/toSecuritySchemes.js +59 -60
- package/esm/typescript/FunctionParameter.d.ts.map +1 -1
- package/esm/typescript/FunctionParameter.js +85 -51
- package/esm/typescript/List.d.ts.map +1 -1
- package/esm/typescript/List.js +14 -8
- package/package.json +1 -2
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +19 -10
- package/script/context/ResultsHandler.d.ts.map +1 -1
- package/script/context/ResultsHandler.js +12 -7
- package/script/context/generateTypes.d.ts +3 -3
- package/script/context/generateTypes.d.ts.map +1 -1
- package/script/dsl/EntityType.d.ts.map +1 -1
- package/script/dsl/EntityType.js +10 -5
- package/script/helpers/collateExamples.d.ts.map +1 -1
- package/script/helpers/collateExamples.js +55 -47
- package/script/helpers/naming.d.ts.map +1 -1
- package/script/helpers/naming.js +8 -5
- package/script/oas/document/Document.d.ts.map +1 -1
- package/script/oas/document/Document.js +16 -17
- package/script/oas/object/Object.d.ts.map +1 -1
- package/script/oas/object/Object.js +11 -5
- package/script/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/script/oas/parameter/toParameterV3.js +24 -12
- package/script/oas/ref/Ref.d.ts.map +1 -1
- package/script/oas/ref/Ref.js +55 -28
- package/script/oas/schema/toSchemasV3.d.ts.map +1 -1
- package/script/oas/schema/toSchemasV3.js +96 -89
- package/script/oas/securitySchemes/toSecuritySchemes.d.ts.map +1 -1
- package/script/oas/securitySchemes/toSecuritySchemes.js +59 -60
- package/script/typescript/FunctionParameter.d.ts.map +1 -1
- package/script/typescript/FunctionParameter.js +85 -51
- package/script/typescript/List.d.ts.map +1 -1
- package/script/typescript/List.js +14 -8
|
@@ -34,7 +34,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.toSecuritySchemesV3 = void 0;
|
|
37
|
-
const ts_pattern_1 = require("ts-pattern");
|
|
38
37
|
const SecurityScheme_js_1 = require("./SecurityScheme.js");
|
|
39
38
|
const v = __importStar(require("valibot"));
|
|
40
39
|
const security_scheme_types_js_1 = require("./security-scheme-types.js");
|
|
@@ -57,71 +56,71 @@ const toSecuritySchemeV3 = ({ securityScheme, stackTrail, context }) => {
|
|
|
57
56
|
if ((0, refFns_js_1.isRef)(securityScheme)) {
|
|
58
57
|
return (0, toRefV31_js_1.toRefV31)({ ref: securityScheme, refType: 'securityScheme', stackTrail, context });
|
|
59
58
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
switch (securityScheme.type) {
|
|
60
|
+
case 'http': {
|
|
61
|
+
const { type: _type, description, scheme, bearerFormat, ...skipped } = v.parse(security_scheme_types_js_1.oasHttpSecuritySchemeData, securityScheme);
|
|
62
|
+
if (!(0, isEmpty_js_1.isEmpty)(skipped)) {
|
|
63
|
+
context.logSkippedFields({
|
|
64
|
+
skipped,
|
|
65
|
+
parent: securityScheme,
|
|
66
|
+
stackTrail,
|
|
67
|
+
parentType: 'securityScheme:http'
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return new SecurityScheme_js_1.OasHttpSecurityScheme({
|
|
71
|
+
description,
|
|
72
|
+
scheme,
|
|
73
|
+
bearerFormat
|
|
69
74
|
});
|
|
70
75
|
}
|
|
71
|
-
|
|
72
|
-
description,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
76
|
+
case 'apiKey': {
|
|
77
|
+
const { type: _type, in: location, description, name, ...skipped } = v.parse(security_scheme_types_js_1.oasApiKeySecuritySchemeData, securityScheme);
|
|
78
|
+
if (!(0, isEmpty_js_1.isEmpty)(skipped)) {
|
|
79
|
+
context.logSkippedFields({
|
|
80
|
+
skipped,
|
|
81
|
+
parent: securityScheme,
|
|
82
|
+
stackTrail,
|
|
83
|
+
parentType: 'securityScheme:apiKey'
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return new SecurityScheme_js_1.OasApiKeySecurityScheme({
|
|
87
|
+
description,
|
|
88
|
+
name,
|
|
89
|
+
in: location
|
|
85
90
|
});
|
|
86
91
|
}
|
|
87
|
-
|
|
88
|
-
description,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
parentType: 'securityScheme:oauth2'
|
|
92
|
+
case 'oauth2': {
|
|
93
|
+
const { type: _type, flows, description, ...skipped } = v.parse(security_scheme_types_js_1.oasOAuth2SecuritySchemeData, securityScheme);
|
|
94
|
+
if (!(0, isEmpty_js_1.isEmpty)(skipped)) {
|
|
95
|
+
context.logSkippedFields({
|
|
96
|
+
skipped,
|
|
97
|
+
parent: securityScheme,
|
|
98
|
+
stackTrail,
|
|
99
|
+
parentType: 'securityScheme:oauth2'
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return new SecurityScheme_js_1.OasOAuth2SecurityScheme({
|
|
103
|
+
description,
|
|
104
|
+
flows
|
|
101
105
|
});
|
|
102
106
|
}
|
|
103
|
-
|
|
104
|
-
description,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
107
|
+
case 'openIdConnect': {
|
|
108
|
+
const { type: _type, description, openIdConnectUrl, ...skipped } = v.parse(security_scheme_types_js_1.oasOpenIdSecuritySchemeData, securityScheme);
|
|
109
|
+
if (!(0, isEmpty_js_1.isEmpty)(skipped)) {
|
|
110
|
+
context.logSkippedFields({
|
|
111
|
+
skipped,
|
|
112
|
+
parent: securityScheme,
|
|
113
|
+
stackTrail,
|
|
114
|
+
parentType: 'securityScheme:openIdConnect'
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return new SecurityScheme_js_1.OasOpenIdSecurityScheme({
|
|
118
|
+
description,
|
|
119
|
+
openIdConnectUrl
|
|
116
120
|
});
|
|
117
121
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
})
|
|
123
|
-
.otherwise(other => {
|
|
124
|
-
// TODO: skip ref
|
|
125
|
-
throw new Error(`Unknown security scheme type: ${other}`);
|
|
126
|
-
});
|
|
122
|
+
default:
|
|
123
|
+
// TODO: skip ref
|
|
124
|
+
throw new Error(`Unknown security scheme type: ${securityScheme.type}`);
|
|
125
|
+
}
|
|
127
126
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionParameter.d.ts","sourceRoot":"","sources":["../../src/typescript/FunctionParameter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FunctionParameter.d.ts","sourceRoot":"","sources":["../../src/typescript/FunctionParameter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC/F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,IAAI,EAAwB,MAAM,WAAW,CAAA;AAItD;;GAEG;AACH,KAAK,qBAAqB,GAAG;IAC3B,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4CAA4C;IAC5C,cAAc,EAAE,UAAU,CAAC,gBAAgB,GAAG,cAAc,CAAC,CAAA;IAC7D,mDAAmD;IACnD,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kEAAkE;IAClE,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG,qBAAqB,GAAG,gBAAgB,CAAA;AAE1F;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,cAAc,CAAA;IACpB,cAAc,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAA;IAC5C,QAAQ,EAAE,IAAI,CAAA;CACf,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IAC3C,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkJG;AACH,qBAAa,iBAAiB;IAC5B,sFAAsF;IACtF,UAAU,EAAE,mBAAmB,CAAA;IAE/B,kEAAkE;IAClE,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB;;;;;;;;;;;;;;;;;;;OAmBG;gBACS,IAAI,EAAE,qBAAqB;IAyBvC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAuBlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,cAAc,IAAI,IAAI;IAsBtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,SAAS,IAAI,MAAM;IAsBnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,QAAQ,IAAI,MAAM;CA8BnB"}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FunctionParameter = void 0;
|
|
4
4
|
const helper_validator_identifier_1 = require("@babel/helper-validator-identifier");
|
|
5
5
|
const strings_js_1 = require("../helpers/strings.js");
|
|
6
|
-
const ts_pattern_1 = require("ts-pattern");
|
|
7
6
|
const List_js_1 = require("./List.js");
|
|
8
7
|
const isEmpty_js_1 = require("../helpers/isEmpty.js");
|
|
9
8
|
/**
|
|
@@ -191,21 +190,24 @@ class FunctionParameter {
|
|
|
191
190
|
});
|
|
192
191
|
this.skipEmpty = args.skipEmpty;
|
|
193
192
|
if (args.typeDefinition.value.type === 'object') {
|
|
194
|
-
|
|
195
|
-
.
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
193
|
+
if (args.destructure === true && args.required === true) {
|
|
194
|
+
this.properties = {
|
|
195
|
+
type: 'destructured',
|
|
196
|
+
typeDefinition: args.typeDefinition,
|
|
197
|
+
required: args.required
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
else if (typeof args.name === 'string') {
|
|
201
|
+
this.properties = {
|
|
202
|
+
type: 'regular',
|
|
203
|
+
name: args.name,
|
|
204
|
+
typeDefinition: args.typeDefinition,
|
|
205
|
+
required: args.required ?? false
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
207
209
|
throw new Error('Invalid FunctionParameter');
|
|
208
|
-
}
|
|
210
|
+
}
|
|
209
211
|
}
|
|
210
212
|
else {
|
|
211
213
|
this.properties = { type: 'void' };
|
|
@@ -240,16 +242,23 @@ class FunctionParameter {
|
|
|
240
242
|
* ```
|
|
241
243
|
*/
|
|
242
244
|
hasProperty(name) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
245
|
+
switch (this.properties.type) {
|
|
246
|
+
case 'void':
|
|
247
|
+
return false;
|
|
248
|
+
case 'regular': {
|
|
249
|
+
const { typeDefinition } = this.properties;
|
|
250
|
+
const { value } = typeDefinition;
|
|
251
|
+
return Boolean(value.type === 'object' && value.objectProperties?.properties[name]);
|
|
252
|
+
}
|
|
253
|
+
case 'destructured': {
|
|
254
|
+
const { typeDefinition } = this.properties;
|
|
255
|
+
return Boolean(typeDefinition.value.objectProperties?.properties[name]);
|
|
256
|
+
}
|
|
257
|
+
default: {
|
|
258
|
+
const _exhaustive = this.properties;
|
|
259
|
+
throw new Error(`Unhandled properties type: ${_exhaustive.type}`);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
253
262
|
}
|
|
254
263
|
/**
|
|
255
264
|
* Generates a List of property names from the parameter.
|
|
@@ -283,13 +292,22 @@ class FunctionParameter {
|
|
|
283
292
|
* ```
|
|
284
293
|
*/
|
|
285
294
|
toPropertyList() {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
295
|
+
switch (this.properties.type) {
|
|
296
|
+
case 'void':
|
|
297
|
+
return List_js_1.List.toEmpty();
|
|
298
|
+
case 'regular': {
|
|
299
|
+
const { name } = this.properties;
|
|
300
|
+
return List_js_1.List.toSingle(name);
|
|
301
|
+
}
|
|
302
|
+
case 'destructured': {
|
|
303
|
+
const { typeDefinition } = this.properties;
|
|
304
|
+
return List_js_1.List.fromKeys(typeDefinition.value.objectProperties?.properties).toObjectPlain();
|
|
305
|
+
}
|
|
306
|
+
default: {
|
|
307
|
+
const _exhaustive = this.properties;
|
|
308
|
+
throw new Error(`Unhandled properties type: ${_exhaustive.type}`);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
293
311
|
}
|
|
294
312
|
/**
|
|
295
313
|
* Generates the inbound parameter syntax for function calls.
|
|
@@ -321,13 +339,22 @@ class FunctionParameter {
|
|
|
321
339
|
* ```
|
|
322
340
|
*/
|
|
323
341
|
toInbound() {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
342
|
+
switch (this.properties.type) {
|
|
343
|
+
case 'void':
|
|
344
|
+
return '';
|
|
345
|
+
case 'regular': {
|
|
346
|
+
const { name } = this.properties;
|
|
347
|
+
return `${name}`;
|
|
348
|
+
}
|
|
349
|
+
case 'destructured': {
|
|
350
|
+
const { typeDefinition } = this.properties;
|
|
351
|
+
return toDestructured(typeDefinition, { skipEmpty: this.skipEmpty }).toString();
|
|
352
|
+
}
|
|
353
|
+
default: {
|
|
354
|
+
const _exhaustive = this.properties;
|
|
355
|
+
throw new Error(`Unhandled properties type: ${_exhaustive.type}`);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
331
358
|
}
|
|
332
359
|
/**
|
|
333
360
|
* Generates the complete function parameter declaration syntax.
|
|
@@ -366,20 +393,27 @@ class FunctionParameter {
|
|
|
366
393
|
* ```
|
|
367
394
|
*/
|
|
368
395
|
toString() {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
396
|
+
switch (this.properties.type) {
|
|
397
|
+
case 'void':
|
|
398
|
+
return '';
|
|
399
|
+
case 'regular': {
|
|
400
|
+
const { name, typeDefinition, required } = this.properties;
|
|
401
|
+
return `${name}${required ? '' : '?'}: ${typeDefinition.identifier}`;
|
|
402
|
+
}
|
|
403
|
+
case 'destructured': {
|
|
404
|
+
const { typeDefinition } = this.properties;
|
|
405
|
+
if (this.skipEmpty) {
|
|
406
|
+
if ((0, isEmpty_js_1.isEmpty)(typeDefinition.value.objectProperties?.properties ?? {})) {
|
|
407
|
+
return '';
|
|
408
|
+
}
|
|
378
409
|
}
|
|
410
|
+
return List_js_1.List.toKeyValue(toDestructured(typeDefinition, { skipEmpty: this.skipEmpty }).toString(), typeDefinition.identifier).toString();
|
|
379
411
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
412
|
+
default: {
|
|
413
|
+
const _exhaustive = this.properties;
|
|
414
|
+
throw new Error(`Unhandled properties type: ${_exhaustive.type}`);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
383
417
|
}
|
|
384
418
|
}
|
|
385
419
|
exports.FunctionParameter = FunctionParameter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/typescript/List.ts"],"names":[],"mappings":"AAAA,OAAO,KA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,CAAC,CAAC,EAAE,CAAA;IAEnB;;;;OAIG;gBACS,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE;IAI/B;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,SAAS,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAItE;;;;;OAKG;IACH,OAAO,CAAC,CAAC,SAAS,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IAIpE;;;;;OAKG;IACH,OAAO,CAAC,CAAC,SAAS,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;CAGrE"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EntryList = exports.KeyList = exports.List = void 0;
|
|
4
|
-
const ts_pattern_1 = require("ts-pattern");
|
|
5
4
|
/**
|
|
6
5
|
* A powerful utility class for building formatted lists of stringable items.
|
|
7
6
|
*
|
|
@@ -152,13 +151,20 @@ class List {
|
|
|
152
151
|
return '';
|
|
153
152
|
}
|
|
154
153
|
const joined = this.values.map(value => value.toString()).join(this.separator);
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
154
|
+
switch (this.bookends) {
|
|
155
|
+
case '[]':
|
|
156
|
+
return `[${joined}]`;
|
|
157
|
+
case '{}':
|
|
158
|
+
return `{${joined}}`;
|
|
159
|
+
case '()':
|
|
160
|
+
return `(${joined})`;
|
|
161
|
+
case 'none':
|
|
162
|
+
return joined;
|
|
163
|
+
default: {
|
|
164
|
+
const _exhaustive = this.bookends;
|
|
165
|
+
throw new Error(`Unhandled bookends type: ${_exhaustive}`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
162
168
|
}
|
|
163
169
|
}
|
|
164
170
|
exports.List = List;
|