asphodelos 0.3.2 → 0.3.3

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/dist/cli.mjs CHANGED
@@ -4,7 +4,7 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
4
4
  import { Console, Effect, FileSystem, Option, Path, Ref, Stream } from "effect";
5
5
  import { CliError, Command, Flag } from "effect/cli";
6
6
  // package.json
7
- var version = "0.3.2";
7
+ var version = "0.3.3";
8
8
  var description = "Asphodelos is a code generator from OpenAPI to Elysia";
9
9
  // src/cli/index.ts
10
10
  const COMMAND_NAME = "asphodelos";
@@ -48,7 +48,7 @@ function runJobs(config) {
48
48
  const [{ parseOpenAPI }, { FormatOptions }, { cleanSplitOutputs, makeJob }] = yield* Effect.promise(() => Promise.all([
49
49
  import("./openapi-4yNuDK_n.mjs").then((n) => n.t),
50
50
  import("./format-DC258z--.mjs").then((n) => n.r),
51
- import("./shared-nkpRcjdg.mjs").then((n) => n.s)
51
+ import("./shared-CgKK5PYq.mjs").then((n) => n.s)
52
52
  ]));
53
53
  const jobs = makeJob(yield* parseOpenAPI(config.input), config);
54
54
  yield* cleanSplitOutputs(jobs);
@@ -86,7 +86,7 @@ function reportJobs(config, previous) {
86
86
  onFailure: (error) => Console.error(`❌ ${error.message}`),
87
87
  onSuccess: (report) => Console.log(report)
88
88
  }));
89
- const { outsideSources } = yield* Effect.promise(() => import("./shared-nkpRcjdg.mjs").then((n) => n.s));
89
+ const { outsideSources } = yield* Effect.promise(() => import("./shared-CgKK5PYq.mjs").then((n) => n.s));
90
90
  const inputDirectory = path.dirname(path.resolve(config.input));
91
91
  return {
92
92
  inputDirectory,
@@ -2726,10 +2726,13 @@ function successType(operation) {
2726
2726
  const ok = Object.entries(operation.responses ?? {}).find(([status]) => status.startsWith("2"));
2727
2727
  if (!ok) return { dataT: "void" };
2728
2728
  const info = responseInfo(ok[1]);
2729
- if (info.ref) return {
2730
- dataT: pascalCase(info.ref),
2731
- importName: pascalCase(info.ref)
2732
- };
2729
+ if (info.ref) {
2730
+ const ident = `${pascalCase(info.ref)}Schema`;
2731
+ return {
2732
+ dataT: `Static<typeof ${ident}>`,
2733
+ importName: ident
2734
+ };
2735
+ }
2733
2736
  if (info.void) return { dataT: "void" };
2734
2737
  return { dataT: "unknown" };
2735
2738
  }
@@ -3137,7 +3140,7 @@ function headerCode(config, client, importPath, body, fetchTypes, schemasImport)
3137
3140
  if (vue.length > 0) lines.push(`import { ${vue.join(", ")} } from 'vue'`);
3138
3141
  if (names("MaybeRefOrGetter")) lines.push("import type { MaybeRefOrGetter } from 'vue'");
3139
3142
  }
3140
- if (fetchTypes.length > 0) lines.push(`import type { ${fetchTypes.join(", ")} } from '${schemasImport}'`);
3143
+ if (fetchTypes.length > 0) lines.push("import type { Static } from 'elysia'", `import type { ${fetchTypes.join(", ")} } from '${schemasImport}'`);
3141
3144
  lines.push(`import { ${client} } from '${importPath}'`);
3142
3145
  return `${lines.join("\n")}\n\n`;
3143
3146
  }
@@ -1,6 +1,6 @@
1
1
  import { INPUT_EXTENSIONS, parseConfig } from "../index.mjs";
2
2
  import { t as FormatOptions } from "../format-DC258z--.mjs";
3
- import { a as makeJob, c as fileSystemLayer, i as jobTargets, n as isInsideDirectory, o as outsideSources, r as isUserCodeJob, t as cleanSplitOutputs } from "../shared-nkpRcjdg.mjs";
3
+ import { a as makeJob, c as fileSystemLayer, i as jobTargets, n as isInsideDirectory, o as outsideSources, r as isUserCodeJob, t as cleanSplitOutputs } from "../shared-CgKK5PYq.mjs";
4
4
  import { n as parseOpenAPI } from "../openapi-4yNuDK_n.mjs";
5
5
  import { Effect, FileSystem, Result } from "effect";
6
6
  import path from "node:path";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asphodelos",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Asphodelos is a code generator from OpenAPI to Elysia",
5
5
  "keywords": [
6
6
  "elysia",