@sohcah/openapi-generator 0.1.2 → 0.2.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.
@@ -1,3 +1,5 @@
1
+ import { createRequire } from "node:module";
2
+
1
3
  //#region rolldown:runtime
2
4
  var __create = Object.create;
3
5
  var __defProp = Object.defineProperty;
@@ -28,6 +30,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
30
  value: mod,
29
31
  enumerable: true
30
32
  }) : target, mod));
33
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
31
34
 
32
35
  //#endregion
33
- export { __commonJS, __export, __toESM };
36
+ export { __commonJS, __export, __require, __toESM };
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import "./helpers-tkoILkcL.js";
3
- import { generateToFile } from "./src-Di4R7y_C.js";
2
+ import { generateToFile } from "./src-CjChjKnL.js";
3
+ import "./helpers-CqzmoMek.js";
4
4
  import { Command, Options } from "@effect/cli";
5
5
  import { NodeContext, NodeRuntime } from "@effect/platform-node";
6
6
  import { Effect } from "effect";
package/dist/config.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import "./types-DjImZ4S-.js";
2
- import { OpenapiGenerateToFileOptions } from "./index-BOme2BJ_.js";
1
+ import "./types-DMB5w9Tt.js";
2
+ import { OpenapiGenerateToFileOptions } from "./index-DY2v-Q37.js";
3
3
 
4
4
  //#region src/config.d.ts
5
5
  declare const defineConfig: (config: OpenapiGenerateToFileOptions) => OpenapiGenerateToFileOptions;
@@ -1,67 +1,7 @@
1
- import { DocumentContext, HttpMethod, ImportReference, NotImplementedError, OpenApiClientGenerator, OpenApiGenerator, OpenApiParametersSchema, OpenApiResponseSchema, OpenApiSchemaGenerator, OperationKey, OperationObject, SchemaObject, helpers_d_exports } from "../types-DjImZ4S-.js";
1
+ import { DocumentContext, HttpMethod, ImportReference, NotImplementedError, OpenApiClientGenerator, OpenApiGenerator, OpenApiParametersSchema, OpenApiResponseSchema, OpenApiSchemaGenerator, OperationKey, OperationObject, SchemaGeneratorOptions, SchemaObject, createSchemaGenerator, helpers_d_exports } from "../types-DMB5w9Tt.js";
2
2
  import { Effect } from "effect";
3
3
  import * as t from "@babel/types";
4
4
 
5
- //#region src/generators/schema.d.ts
6
-
7
- interface SchemaGeneratorOptions {
8
- /** @default null */
9
- custom?: (schema: SchemaObject) => ImportReference | null;
10
- /** @default false */
11
- experimental_includeTypes?: boolean;
12
- /** @default true */
13
- includeSchemas?: boolean;
14
- /** @default false */
15
- includeOperations?: boolean;
16
- /** @default "unknown" */
17
- deprecationHandling?: "unknown" | "optional";
18
- }
19
- interface DefaultSchemaGeneratorOptions extends SchemaGeneratorOptions {
20
- modifiers: {
21
- lazy: (expression: t.Expression) => t.Expression;
22
- optional: (expression: t.Expression) => t.Expression;
23
- regex: (expression: t.Expression, pattern: string) => t.Expression;
24
- immutable: (expression: t.Expression) => t.Expression;
25
- mutable: (expression: t.Expression) => t.Expression;
26
- nullable: (expression: t.Expression) => t.Expression;
27
- };
28
- types: {
29
- schema: t.TSQualifiedName;
30
- typeDecoded: t.TSQualifiedName;
31
- typeEncoded: t.TSQualifiedName;
32
- };
33
- schema: {
34
- record: (key: t.Expression, value: t.Expression) => t.Expression;
35
- union: (expressions: t.Expression[]) => t.Expression;
36
- enum: (expressions: t.Expression[]) => t.Expression;
37
- instanceOf: t.Expression;
38
- boolean: t.Expression;
39
- string: t.Expression;
40
- number: t.Expression;
41
- integer: t.Expression;
42
- array: t.Expression;
43
- object: t.Expression;
44
- null: t.Expression;
45
- unknown: t.Expression;
46
- };
47
- transformer: (options: {
48
- encoded: t.Expression;
49
- decoded: t.Expression;
50
- decode: t.Expression | t.BlockStatement;
51
- decodeAsync?: boolean;
52
- encode: t.Expression | t.BlockStatement;
53
- encodeAsync?: boolean;
54
- }) => t.Expression;
55
- transformerCatch: (expression: t.Expression) => t.BlockStatement;
56
- methods: {
57
- encode: (schema: t.Expression, value: t.Expression) => t.Expression;
58
- decode: (schema: t.Expression, value: t.Expression) => t.Expression;
59
- parse: (schema: t.Expression, value: t.Expression) => t.Expression;
60
- };
61
- supportsImmutability: boolean;
62
- }
63
- declare function createSchemaGenerator(options: DefaultSchemaGeneratorOptions): OpenApiSchemaGenerator;
64
- //#endregion
65
5
  //#region src/generators/effect.d.ts
66
6
  declare const createEffectSchemaGenerator: (options: SchemaGeneratorOptions) => {
67
7
  initialize: () => Effect.Effect<void, never, DocumentContext>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/generators/schema.ts","../../../src/generators/effect.ts","../../../src/generators/zod.ts","../../../src/generators/client.ts"],"sourcesContent":[],"mappings":";;;;;;AAoBuC,UAAtB,sBAAA,CAAsB;EAAA;EAEP,MAAK,CAAA,EAAA,CAAA,MAAA,EAAjB,YAAiB,EAAA,GAAA,eAAA,GAAA,IAAA;EAAe;EAenC,yBAAA,CAAA,EAAA,OAA8B;EAAA;EAAA,cAEtB,CAAA,EAAA,OAAA;EAAU;EAAiB,iBACvB,CAAA,EAAA,OAAA;EAAU;EAAiB,mBAC9B,CAAA,EAAA,SAAA,GAAA,UAAA;;AACE,UALX,6BAAA,SAAsC,sBAKzB,CAAA;EAAU,SAAO,EAAA;IACrB,IAAE,EAAA,CAAA,UAAA,EAJL,CAAA,CAAE,UAIG,EAAA,GAJY,CAAA,CAAE,UAId;IAAe,QAAE,EAAA,CAAA,UAAA,EAHlB,CAAA,CAAE,UAGgB,EAAA,GAHD,CAAA,CAAE,UAGD;IAClB,KAAE,EAAA,CAAA,UAAA,EAHL,CAAA,CAAE,UAGG,EAAA,OAAA,EAAA,MAAA,EAAA,GAH6B,CAAA,CAAE,UAG/B;IAAe,SAAE,EAAA,CAAA,UAAA,EAFlB,CAAA,CAAE,UAEgB,EAAA,GAFD,CAAA,CAAE,UAED;IAGlC,OAAE,EAAA,CAAA,UAAA,EAJY,CAAA,CAAE,UAId,EAAA,GAJ6B,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A,iBAAA,EAAA,gBAAA,CAAA,IAAA,uCAAA;CAAU;;;UE/BlB,yBAAA,SAAkC;EFYlC;EAAsB,IAAA,CAAA,EAAA,OAAA;;AAEF,cETxB,wBFSwB,EAAA,CAAA;EAAA,IAAA;EAAA,GAAA;AAAA,CAAA,EENlC,yBFMkC,EAAA,GAAA;EAAe,UAAA,EAAA,GAAA,gBAAA,CAAA,IAAA,EAAA,KAAA,EENxB,eAAA,CFMwB;EAenC,cAAA,EAAA,CAAA,MAAA,cAA8B,EAAA,QAAA,cAAA,EAAA,gBAAA,aAAA,CAAA;EAAA,gBAAA,EAAA,CAAA,MAAA,cAAA,EAAA,UAAA,cAAA,EAAA,gBAAA,aAAA,CAAA;EAAA,sBAEtB,EAAA,CAAA,YAAA,cAAA,EAAA,SAAA,iBAAA,EAAA,IAAA,EAAA,MAAA,EAAA,gBAAA,+DAAA;EAAU,oBAAO,EAAA,CAAA,YAAA,cAAA,EAAA,SAAA,iBAAA,EAAA,gBAAA,6DAAA;EAAU,UACvB,gBAAA;EAAU,aAAO,CAAA,EAAA,CAAA,MAAA,cAAA,EAAA,gBAAA,CAAA,IAAA,uCAAA;EAAU,gBAC9B,CAAA,EAAA,CAAA,YAAA,cAAA,EAAA,IAAA,EAAA,MAAA,EAAA,MAAA,YAAA,EAAA,SAAA,iBAAA,EAAA,gBAAA,CAAA,IAAA,uCAAA;CAAU;;;UG/BnB,6BAAA;UACP;;iBAGM,+BAAA,UACL,gCACR"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/generators/effect.ts","../../../src/generators/zod.ts","../../../src/generators/client.ts"],"sourcesContent":[],"mappings":";;;;;cAQa,uCACF;EADE,UAAA,EAAA,GAAA,gBAqNX,CAAA,IAAA,EAAA,KAAA,EApN+B,eAAA,CAoN/B;EAAA,cAAA,EAAA,CAAA,MAAA,cAAA,EAAA,QAAA,cAAA,EAAA,gBAAA,aAAA,CAAA;EAAA,gBApNS,EAAA,CAAA,MAAA,cAAA,EAAA,UAAA,cAAA,EAAA,gBAAA,aAAA,CAAA;EAAsB,sBAAA,EAAA,CAAA,YAAA,cAAA,EAAA,SAAA,iBAAA,EAAA,IAAA,EAAA,MAAA,EAAA,gBAAA,+DAAA;;;;;;;;UCDhB,yBAAA,SAAkC;EDAtC;EAqNX,IAAA,CAAA,EAAA,OAAA;;AApN+B,cCIpB,wBDJoB,EAAA,CAAA;EAAA,IAAA;EAAA,GAAA;AAAA,CAAA,ECO9B,yBDP8B,EAAA,GAAA;+CCOL,eAAA;;;;;;;;;;;UCNX,6BAAA;UACP;;iBAGM,+BAAA,UACL,gCACR"}
@@ -1,5 +1,5 @@
1
- import { __toESM } from "../chunk-51aI8Tpl.js";
2
- import { DocumentContext, NotImplementedError, ensureImport, ensureNamespaceImport, getKey, helpers_exports, notImplementedStatement, require_lib } from "../helpers-tkoILkcL.js";
1
+ import { __toESM } from "../chunk-DYFKRlHt.js";
2
+ import { DocumentContext, NotImplementedError, ensureImport, ensureNamespaceImport, getKey, helpers_exports, notImplementedStatement, require_lib } from "../helpers-CqzmoMek.js";
3
3
  import { Context, Effect } from "effect";
4
4
  import escapeRegex from "regex-escape";
5
5
 
@@ -177,13 +177,14 @@ function createSchemaGenerator(options) {
177
177
  const schemaKeyIdentifier = import_lib$3.identifier(schemaKey.upper);
178
178
  if (options.experimental_includeTypes) schemaKeyIdentifier.typeAnnotation = import_lib$3.tsTypeAnnotation(import_lib$3.tsTypeReference(options.types.schema, import_lib$3.tsTypeParameterInstantiation([schemaExpression.typeDecoded, schemaExpression.typeEncoded])));
179
179
  ctx.schemas.set(schemaName, [import_lib$3.exportNamedDeclaration(import_lib$3.variableDeclaration("const", [import_lib$3.variableDeclarator(schemaKeyIdentifier, schemaExpression.expression)])), import_lib$3.exportNamedDeclaration(import_lib$3.tsTypeAliasDeclaration(import_lib$3.identifier(schemaKey.upper), null, import_lib$3.tsTypeReference(options.types.typeDecoded, import_lib$3.tsTypeParameterInstantiation([import_lib$3.tsTypeQuery(import_lib$3.identifier(schemaKey.upper))]))))]);
180
+ ctx.schemaTypeMeta.set(schemaName, schemaExpression.typeMeta);
180
181
  ctx.processingSchemas.delete(schemaName);
181
182
  }
182
183
  return {
183
184
  expression: import_lib$3.identifier(schemaKey.upper),
184
185
  typeDecoded: import_lib$3.tsTypeReference(options.types.typeDecoded, import_lib$3.tsTypeParameterInstantiation([import_lib$3.tsTypeQuery(import_lib$3.identifier(schemaKey.upper))])),
185
186
  typeEncoded: import_lib$3.tsTypeReference(options.types.typeEncoded, import_lib$3.tsTypeParameterInstantiation([import_lib$3.tsTypeQuery(import_lib$3.identifier(schemaKey.upper))])),
186
- typeMeta
187
+ typeMeta: ctx.schemaTypeMeta.get(schemaName)
187
188
  };
188
189
  }
189
190
  if (schema.deprecated) if (options.deprecationHandling === "optional") typeMeta.optional = true;
@@ -203,6 +204,23 @@ function createSchemaGenerator(options) {
203
204
  typeMeta
204
205
  };
205
206
  }
207
+ if (schema.allOf) {
208
+ const results = yield* Effect.forEach((schema$1) => ensureSchema(schema$1))(schema.allOf);
209
+ let result;
210
+ if (results.length === 1) result = results[0];
211
+ else result = {
212
+ expression: options.schema[results.every((i) => i.typeMeta.isObject) ? "objectExtend" : "intersection"](results.map((result$1) => result$1.expression)),
213
+ typeDecoded: import_lib$3.tsIntersectionType(results.map((result$1) => result$1.typeDecoded)),
214
+ typeEncoded: import_lib$3.tsIntersectionType(results.map((result$1) => result$1.typeEncoded)),
215
+ typeMeta
216
+ };
217
+ if ("nullable" in schema && schema.nullable) {
218
+ result.expression = options.modifiers.nullable(result.expression);
219
+ result.typeDecoded = import_lib$3.tsUnionType([result.typeDecoded, import_lib$3.tsNullKeyword()]);
220
+ result.typeEncoded = import_lib$3.tsUnionType([result.typeEncoded, import_lib$3.tsNullKeyword()]);
221
+ }
222
+ return result;
223
+ }
206
224
  if (schema.enum) {
207
225
  const unsupportedEnumValue = schema.enum.find((i) => typeof i !== "string" && typeof i !== "number" && typeof i !== "boolean" && i !== null);
208
226
  if (unsupportedEnumValue !== void 0) return yield* new NotImplementedError({ message: `Unsupported 'enum' value: ${JSON.stringify(unsupportedEnumValue)}` });
@@ -248,6 +266,7 @@ function createSchemaGenerator(options) {
248
266
  typeMeta
249
267
  };
250
268
  case "object": {
269
+ typeMeta.isObject = true;
251
270
  const object = import_lib$3.objectExpression([]);
252
271
  const objectTypeDecoded = import_lib$3.tsTypeLiteral([]);
253
272
  const objectTypeEncoded = import_lib$3.tsTypeLiteral([]);
@@ -292,11 +311,13 @@ function createSchemaGenerator(options) {
292
311
  typeMeta
293
312
  };
294
313
  }
295
- case "null": return {
296
- expression: options.schema.null,
297
- ...equivalentType(import_lib$3.tsNullKeyword()),
298
- typeMeta
299
- };
314
+ case "null":
315
+ typeMeta.isNull = true;
316
+ return {
317
+ expression: options.schema.null,
318
+ ...equivalentType(import_lib$3.tsNullKeyword()),
319
+ typeMeta
320
+ };
300
321
  case void 0: return {
301
322
  expression: options.schema.unknown,
302
323
  ...equivalentType(import_lib$3.tsUnknownKeyword()),
@@ -310,11 +331,6 @@ function createSchemaGenerator(options) {
310
331
  const applyModifiers = Effect.fn(function* (expression, schema) {
311
332
  if ("$ref" in schema) return expression;
312
333
  const modified = { ...expression };
313
- if ("nullable" in schema && schema.nullable) {
314
- modified.expression = options.modifiers.nullable(modified.expression);
315
- modified.typeDecoded = import_lib$3.tsUnionType([modified.typeDecoded, import_lib$3.tsNullKeyword()]);
316
- modified.typeEncoded = import_lib$3.tsUnionType([modified.typeEncoded, import_lib$3.tsNullKeyword()]);
317
- }
318
334
  if (options.supportsImmutability) if (schema.readOnly) {
319
335
  modified.expression = options.modifiers.immutable(modified.expression);
320
336
  modified.typeMeta ??= {};
@@ -328,6 +344,7 @@ function createSchemaGenerator(options) {
328
344
  if (schema$1.oneOf) return schema$1.oneOf;
329
345
  return [schema$1];
330
346
  }).flatMap((schema$1) => {
347
+ if (typeof schema$1 === "boolean") return [];
331
348
  if ("$ref" in schema$1) return [schema$1];
332
349
  if (Array.isArray(schema$1.type)) return schema$1.type.map((type) => ({
333
350
  ...schema$1,
@@ -335,15 +352,27 @@ function createSchemaGenerator(options) {
335
352
  }));
336
353
  return [schema$1];
337
354
  });
338
- const expressions = [];
355
+ let expressions = [];
339
356
  for (const schema$1 of schemas) expressions.push(yield* applyModifiers(yield* getBaseEffectSchema(schema$1), schema$1));
340
- if (expressions.length !== 1) return {
357
+ let isNullable = false;
358
+ if (expressions.some((e) => e.typeMeta?.isNull)) {
359
+ isNullable = true;
360
+ expressions = expressions.filter((e) => !e.typeMeta?.isNull);
361
+ }
362
+ let result;
363
+ if (expressions.length === 1) result = expressions[0];
364
+ else result = {
341
365
  expression: options.schema.union(expressions.map((e) => e.expression)),
342
366
  typeDecoded: import_lib$3.tsUnionType(expressions.map((e) => e.typeDecoded)),
343
367
  typeEncoded: import_lib$3.tsUnionType(expressions.map((e) => e.typeEncoded)),
344
368
  typeMeta: {}
345
369
  };
346
- return expressions[0];
370
+ if (isNullable) {
371
+ result.expression = options.modifiers.nullable(result.expression);
372
+ result.typeDecoded = import_lib$3.tsUnionType([result.typeDecoded, import_lib$3.tsNullKeyword()]);
373
+ result.typeEncoded = import_lib$3.tsUnionType([result.typeEncoded, import_lib$3.tsNullKeyword()]);
374
+ }
375
+ return result;
347
376
  });
348
377
  const ensureParametersSchema = Effect.fn(function* (operationKey, method, path) {
349
378
  const ctx = yield* DocumentContext;
@@ -512,6 +541,8 @@ const createEffectSchemaGenerator = (options) => ({
512
541
  schema: {
513
542
  record: (key, value) => import_lib$2.callExpression(import_lib$2.memberExpression(import_lib$2.identifier("Schema"), import_lib$2.identifier("Record")), [import_lib$2.objectExpression([import_lib$2.objectProperty(import_lib$2.identifier("key"), key), import_lib$2.objectProperty(import_lib$2.identifier("value"), value)])]),
514
543
  union: (expressions) => import_lib$2.callExpression(import_lib$2.memberExpression(import_lib$2.identifier("Schema"), import_lib$2.identifier("Union")), expressions),
544
+ intersection: (expressions) => expressions.reduce((a, b) => import_lib$2.callExpression(import_lib$2.memberExpression(import_lib$2.identifier("Schema"), import_lib$2.identifier("extend")), [a, b])),
545
+ objectExtend: (expressions) => expressions.reduce((a, b) => import_lib$2.callExpression(import_lib$2.memberExpression(import_lib$2.identifier("Schema"), import_lib$2.identifier("extend")), [a, b])),
515
546
  enum: (expressions) => import_lib$2.callExpression(import_lib$2.memberExpression(import_lib$2.identifier("Schema"), import_lib$2.identifier("Literal")), expressions),
516
547
  instanceOf: import_lib$2.memberExpression(import_lib$2.identifier("Schema"), import_lib$2.identifier("instanceOf")),
517
548
  boolean: import_lib$2.memberExpression(import_lib$2.identifier("Schema"), import_lib$2.identifier("Boolean")),
@@ -582,6 +613,8 @@ const createZodSchemaGenerator = ({ mini = false,...options }) => {
582
613
  schema: {
583
614
  record: (key, value) => import_lib$1.callExpression(import_lib$1.memberExpression(z, import_lib$1.identifier("record")), [key, value]),
584
615
  union: (expressions) => import_lib$1.callExpression(import_lib$1.memberExpression(z, import_lib$1.identifier("union")), [import_lib$1.arrayExpression(expressions)]),
616
+ intersection: (expressions) => expressions.reduce((a, b) => import_lib$1.callExpression(import_lib$1.memberExpression(z, import_lib$1.identifier("intersection")), [a, b])),
617
+ objectExtend: (expressions) => expressions.reduce((a, b) => import_lib$1.callExpression(import_lib$1.memberExpression(mini ? z : a, import_lib$1.identifier("extend")), [...mini ? [a] : [], b])),
585
618
  enum: (expressions) => import_lib$1.callExpression(import_lib$1.memberExpression(z, import_lib$1.identifier("enum")), [import_lib$1.arrayExpression(expressions)]),
586
619
  instanceOf: import_lib$1.memberExpression(z, import_lib$1.identifier("instanceof")),
587
620
  boolean: import_lib$1.callExpression(import_lib$1.memberExpression(z, import_lib$1.identifier("boolean")), []),