asphodelos 0.3.3 → 0.4.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.
package/README.md CHANGED
@@ -338,7 +338,7 @@ Every operation is named by its method and path: a GET on `/users/{id}` becomes
338
338
  `getUsersIdQueryKey` and `getUsersIdQueryOptions` beside it; a POST on `/users` becomes
339
339
  `usePostUsers`, with `getPostUsersMutationKey` and `getPostUsersMutationOptions`. Path parameters
340
340
  come first, then one `options` object, then the library's own trailing argument (a `QueryClient`,
341
- or Angular's inject options):
341
+ or an accessor of one in Solid and Svelte; SWR and Angular Query take none):
342
342
 
343
343
  ```ts
344
344
  const user = useUsersId(
@@ -358,6 +358,11 @@ your own over the generated one. SWR hooks take `{ swr, options }` instead, wher
358
358
  `swrKey` (replaces the generated key) and `enabled` (a `false` turns the key into `null`), and
359
359
  return the key they used beside SWR's result.
360
360
 
361
+ Angular Query hooks import `@tanstack/angular-query`, which needs Angular 20.1 or later. Projects
362
+ on the deprecated `@tanstack/angular-query-experimental` install `@tanstack/angular-query` in its
363
+ place before regenerating. The hooks take no `{ injector }` argument: outside an injection context,
364
+ wrap the call in Angular's `runInInjectionContext(injector, () => injectUsersId(...))`.
365
+
361
366
  ### Infinite Query (`x-pagination`)
362
367
 
363
368
  Set `x-pagination: true` on a GET operation to generate infinite query hooks.
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.3";
7
+ var version = "0.4.0";
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-CgKK5PYq.mjs").then((n) => n.s)
51
+ import("./shared-27xlBR7-.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-CgKK5PYq.mjs").then((n) => n.s));
89
+ const { outsideSources } = yield* Effect.promise(() => import("./shared-27xlBR7-.mjs").then((n) => n.s));
90
90
  const inputDirectory = path.dirname(path.resolve(config.input));
91
91
  return {
92
92
  inputDirectory,
package/dist/index.mjs CHANGED
@@ -432,7 +432,7 @@ const ConfigSchema = Schema.Struct({
432
432
  })),
433
433
  "angular-query": Schema.optionalKey(HooksSchema.annotate({
434
434
  title: "Angular Query hooks output",
435
- description: "Generates `@tanstack/angular-query-experimental` hooks per operation.",
435
+ description: "Generates `@tanstack/angular-query` hooks per operation (Angular 20.1 or later).",
436
436
  examples: [{ output: "./src/angular-query.ts" }]
437
437
  }))
438
438
  }).check(Schema.makeFilter((v) => {
@@ -3174,17 +3174,6 @@ const QUERY_CLIENT_ACCESSOR_TAIL = {
3174
3174
  mutation: "() => QueryClient",
3175
3175
  imports: ["QueryClient"]
3176
3176
  };
3177
- const INJECT_OPTIONS_TAIL = {
3178
- name: "injectOptions",
3179
- query: "InjectQueryOptions",
3180
- infinite: "InjectInfiniteQueryOptions",
3181
- mutation: "InjectMutationOptions",
3182
- imports: [
3183
- "InjectQueryOptions",
3184
- "InjectInfiniteQueryOptions",
3185
- "InjectMutationOptions"
3186
- ]
3187
- };
3188
3177
  const TANSTACK = {
3189
3178
  label: "tanstack-query",
3190
3179
  packageName: "@tanstack/react-query",
@@ -3265,7 +3254,7 @@ const HOOK_CONFIGS = {
3265
3254
  },
3266
3255
  "angular-query": {
3267
3256
  label: "angular-query",
3268
- packageName: "@tanstack/angular-query-experimental",
3257
+ packageName: "@tanstack/angular-query",
3269
3258
  hookPrefix: "inject",
3270
3259
  queryFn: "injectQuery",
3271
3260
  mutationFn: "injectMutation",
@@ -3273,8 +3262,7 @@ const HOOK_CONFIGS = {
3273
3262
  useThunk: true,
3274
3263
  queryOptionsType: "CreateQueryOptions",
3275
3264
  mutationOptionsType: "CreateMutationOptions",
3276
- infiniteOptionsType: "CreateInfiniteQueryOptions",
3277
- hookTail: INJECT_OPTIONS_TAIL
3265
+ infiniteOptionsType: "CreateInfiniteQueryOptions"
3278
3266
  }
3279
3267
  };
3280
3268
  /**
@@ -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-CgKK5PYq.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-27xlBR7-.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.3",
3
+ "version": "0.4.0",
4
4
  "description": "Asphodelos is a code generator from OpenAPI to Elysia",
5
5
  "keywords": [
6
6
  "elysia",