@nice-code/action 0.15.0 → 0.16.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.
Files changed (34) hide show
  1. package/README.md +582 -582
  2. package/build/{ActionDevtoolsCore-CCRLYASa.d.cts → ActionDevtoolsCore-B3JwSaRH.d.cts} +3 -3
  3. package/build/{ActionDevtoolsCore-9PsnscvK.mjs → ActionDevtoolsCore-BcItqP-C.mjs} +7 -7
  4. package/build/ActionDevtoolsCore-BcItqP-C.mjs.map +1 -0
  5. package/build/{ActionDevtoolsCore-CYGD2o6C.d.mts → ActionDevtoolsCore-C4TDUY7-.d.mts} +3 -3
  6. package/build/{ActionDevtoolsCore-DtgXwPBZ.cjs → ActionDevtoolsCore-Cb_QR44N.cjs} +7 -7
  7. package/build/ActionDevtoolsCore-Cb_QR44N.cjs.map +1 -0
  8. package/build/{ActionPayload.types-BN-rXFBK.d.cts → ActionPayload.types-CO_hXlBc.d.cts} +1452 -941
  9. package/build/{ActionPayload.types-D28ELKXC.d.mts → ActionPayload.types-fieMKAgt.d.mts} +1452 -941
  10. package/build/devtools/browser/index.cjs +5 -5
  11. package/build/devtools/browser/index.cjs.map +1 -1
  12. package/build/devtools/browser/index.d.cts +1 -1
  13. package/build/devtools/browser/index.d.mts +1 -1
  14. package/build/devtools/browser/index.mjs +5 -5
  15. package/build/devtools/browser/index.mjs.map +1 -1
  16. package/build/devtools/server/index.cjs +1 -1
  17. package/build/devtools/server/index.cjs.map +1 -1
  18. package/build/devtools/server/index.d.cts +1 -1
  19. package/build/devtools/server/index.d.mts +1 -1
  20. package/build/devtools/server/index.mjs +1 -1
  21. package/build/devtools/server/index.mjs.map +1 -1
  22. package/build/index.cjs +2733 -1963
  23. package/build/index.cjs.map +1 -1
  24. package/build/index.d.cts +2 -2
  25. package/build/index.d.mts +2 -2
  26. package/build/index.mjs +2706 -1950
  27. package/build/index.mjs.map +1 -1
  28. package/build/react-query/index.cjs.map +1 -1
  29. package/build/react-query/index.d.cts +1 -1
  30. package/build/react-query/index.d.mts +1 -1
  31. package/build/react-query/index.mjs.map +1 -1
  32. package/package.json +4 -4
  33. package/build/ActionDevtoolsCore-9PsnscvK.mjs.map +0 -1
  34. package/build/ActionDevtoolsCore-DtgXwPBZ.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../../src/react-query/hooks/useActionMutation.ts","../../src/react-query/hooks/useActionQuery.ts"],"sourcesContent":["import {\r\n type UseMutationOptions,\r\n type UseMutationResult,\r\n useMutation,\r\n} from \"@tanstack/react-query\";\r\nimport { useRef } from \"react\";\r\nimport type { ActionCore } from \"../../ActionDefinition/Action/Core/ActionCore\";\r\nimport type {\r\n IActionDomain,\r\n TInferInputFromSchema,\r\n TInferOutputFromSchema,\r\n} from \"../../ActionDefinition/Domain/ActionDomain.types\";\r\nimport type { ActionSchema, TInferActionError } from \"../../ActionDefinition/Schema/ActionSchema\";\r\n\r\n/** When an action has no input schema (Input = never), use void so mutate() needs no arguments. */\r\nexport type TActionMutationVars<SCH extends ActionSchema<any, any, any>> = [\r\n TInferInputFromSchema<SCH>[\"Input\"],\r\n] extends [never]\r\n ? void\r\n : TInferInputFromSchema<SCH>[\"Input\"];\r\n\r\nexport type TUseNiceMutationOptions<\r\n DOM extends IActionDomain,\r\n ID extends keyof DOM[\"actionSchema\"] & string,\r\n SCH extends DOM[\"actionSchema\"][ID] = DOM[\"actionSchema\"][ID],\r\n TContext = unknown,\r\n> = Omit<\r\n UseMutationOptions<\r\n TInferOutputFromSchema<SCH>[\"Output\"],\r\n TInferActionError<SCH>,\r\n TActionMutationVars<SCH>,\r\n TContext\r\n >,\r\n \"mutationFn\"\r\n>;\r\n\r\nexport function useActionMutation<\r\n DOM extends IActionDomain,\r\n ID extends keyof DOM[\"actionSchema\"] & string,\r\n SCH extends DOM[\"actionSchema\"][ID],\r\n TContext = unknown,\r\n>(\r\n action: ActionCore<DOM, ID>,\r\n options?: TUseNiceMutationOptions<DOM, ID, SCH, TContext>,\r\n): UseMutationResult<\r\n TInferOutputFromSchema<SCH>[\"Output\"],\r\n TInferActionError<SCH>,\r\n TActionMutationVars<SCH>,\r\n TContext\r\n> {\r\n const mutationOptions = options ?? {};\r\n\r\n // Side-channel for the call site: mutate() writes it synchronously, mutationFn reads it.\r\n // React Query calls mutationFn synchronously within mutate(), so the ref is always fresh.\r\n const callSiteRef = useRef<string | undefined>(undefined);\r\n\r\n const result = useMutation({\r\n mutationFn: (input: TActionMutationVars<SCH>) => {\r\n const req = action.request(input as unknown as TInferInputFromSchema<SCH>[\"Input\"]);\r\n req._callSite = callSiteRef.current;\r\n callSiteRef.current = undefined;\r\n return req.runToOutput();\r\n },\r\n ...mutationOptions,\r\n });\r\n\r\n // Wrap mutate/mutateAsync so the call site is captured at the user's invocation point.\r\n // By the time mutationFn runs inside React Query's scheduler the user's frames are gone.\r\n return {\r\n ...result,\r\n mutate: (...args: Parameters<typeof result.mutate>) => {\r\n callSiteRef.current = new Error().stack;\r\n return result.mutate(...args);\r\n },\r\n mutateAsync: (...args: Parameters<typeof result.mutateAsync>) => {\r\n callSiteRef.current = new Error().stack;\r\n return result.mutateAsync(...args);\r\n },\r\n };\r\n}\r\n","import {\n type QueryKey,\n type UseQueryOptions,\n type UseQueryResult,\n useQuery,\n} from \"@tanstack/react-query\";\nimport { useRef } from \"react\";\nimport type { ActionCore } from \"../../ActionDefinition/Action/Core/ActionCore\";\nimport type {\n IActionDomain,\n TInferInputFromSchema,\n TInferOutputFromSchema,\n} from \"../../ActionDefinition/Domain/ActionDomain.types\";\nimport type { TInferActionError } from \"../../ActionDefinition/Schema/ActionSchema\";\n\nexport function actionQueryKey<\n DOM extends IActionDomain,\n ID extends keyof DOM[\"actionSchema\"] & string,\n>(action: ActionCore<DOM, ID>): readonly [\"nice-action\", DOM[\"domain\"], DOM[\"allDomains\"], ID];\n\nexport function actionQueryKey<\n DOM extends IActionDomain,\n ID extends keyof DOM[\"actionSchema\"] & string,\n>(\n action: ActionCore<DOM, ID>,\n input: TInferInputFromSchema<DOM[\"actionSchema\"][ID]>[\"Input\"],\n): readonly [\n \"nice-action\",\n DOM[\"domain\"],\n DOM[\"allDomains\"],\n ID,\n TInferInputFromSchema<DOM[\"actionSchema\"][ID]>[\"Input\"],\n];\n\nexport function actionQueryKey(action: ActionCore<any, any>, input?: unknown): QueryKey {\n if (input === undefined) {\n return [\"nice-action\", action.domain, action.allDomains, action.id] as const;\n }\n\n return [\"nice-action\", action.domain, action.allDomains, action.id, input] as const;\n}\n\nexport type TUseActionQueryOptions<\n DOM extends IActionDomain,\n ID extends keyof DOM[\"actionSchema\"] & string,\n SCH extends DOM[\"actionSchema\"][ID] = DOM[\"actionSchema\"][ID],\n TSelect = TInferOutputFromSchema<SCH>[\"Output\"],\n> = Omit<\n UseQueryOptions<TInferOutputFromSchema<SCH>[\"Output\"], TInferActionError<SCH>, TSelect, QueryKey>,\n \"queryKey\" | \"queryFn\"\n>;\n\nexport function useActionQuery<\n DOM extends IActionDomain,\n ID extends keyof DOM[\"actionSchema\"] & string,\n SCH extends DOM[\"actionSchema\"][ID],\n TSelect = TInferOutputFromSchema<SCH>[\"Output\"],\n>(\n action: ActionCore<DOM, ID>,\n ...args: [TInferInputFromSchema<SCH>[\"Input\"]] extends [never]\n ? [options?: TUseActionQueryOptions<DOM, ID, SCH, TSelect>]\n : [\n input: TInferInputFromSchema<SCH>[\"Input\"] | null | undefined,\n options?: TUseActionQueryOptions<DOM, ID, SCH, TSelect>,\n ]\n): UseQueryResult<TSelect, TInferActionError<SCH>> {\n const hasInputSchema = action.schema.inputSchema != null;\n\n let input: TInferInputFromSchema<SCH>[\"Input\"] | null | undefined;\n let options: TUseActionQueryOptions<DOM, ID, SCH, TSelect> | undefined;\n\n if (hasInputSchema) {\n [input, options] = args as [\n TInferInputFromSchema<SCH>[\"Input\"] | null | undefined,\n TUseActionQueryOptions<DOM, ID, SCH, TSelect>?,\n ];\n } else {\n [options] = args as [TUseActionQueryOptions<DOM, ID, SCH, TSelect>?];\n }\n\n const { enabled, ...queryOptions } = options ?? {};\n\n // Capture the call site synchronously here — the user's component frame is on the\n // stack now. By the time queryFn runs inside React Query's scheduler it's gone.\n const callSiteRef = useRef(new Error().stack);\n\n return useQuery({\n queryKey: input != null ? actionQueryKey(action, input) : actionQueryKey(action),\n queryFn: () => {\n const req = (action.request as (input: any) => any)(input);\n req._callSite = callSiteRef.current;\n return req.runToOutput();\n },\n enabled: hasInputSchema ? input != null && (enabled ?? true) : (enabled ?? true),\n ...queryOptions,\n } as UseQueryOptions<TInferOutputFromSchema<SCH>[\"Output\"], TInferActionError<SCH>, TSelect>);\n}\n"],"mappings":";;;;AAoCA,SAAgB,kBAMd,QACA,SAMA;CACA,MAAM,kBAAkB,WAAW,CAAC;CAIpC,MAAM,eAAA,GAAA,MAAA,OAAA,CAAyC,KAAA,CAAS;CAExD,MAAM,UAAA,GAAA,sBAAA,YAAA,CAAqB;EACzB,aAAa,UAAoC;GAC/C,MAAM,MAAM,OAAO,QAAQ,KAAuD;GAClF,IAAI,YAAY,YAAY;GAC5B,YAAY,UAAU,KAAA;GACtB,OAAO,IAAI,YAAY;EACzB;EACA,GAAG;CACL,CAAC;CAID,OAAO;EACL,GAAG;EACH,SAAS,GAAG,SAA2C;GACrD,YAAY,2BAAU,IAAI,MAAM,EAAA,CAAE;GAClC,OAAO,OAAO,OAAO,GAAG,IAAI;EAC9B;EACA,cAAc,GAAG,SAAgD;GAC/D,YAAY,2BAAU,IAAI,MAAM,EAAA,CAAE;GAClC,OAAO,OAAO,YAAY,GAAG,IAAI;EACnC;CACF;AACF;;;AC7CA,SAAgB,eAAe,QAA8B,OAA2B;CACtF,IAAI,UAAU,KAAA,GACZ,OAAO;EAAC;EAAe,OAAO;EAAQ,OAAO;EAAY,OAAO;CAAE;CAGpE,OAAO;EAAC;EAAe,OAAO;EAAQ,OAAO;EAAY,OAAO;EAAI;CAAK;AAC3E;AAYA,SAAgB,eAMd,QACA,GAAG,MAM8C;CACjD,MAAM,iBAAiB,OAAO,OAAO,eAAe;CAEpD,IAAI;CACJ,IAAI;CAEJ,IAAI,gBACF,CAAC,OAAO,WAAW;MAKnB,CAAC,WAAW;CAGd,MAAM,EAAE,SAAS,GAAG,iBAAiB,WAAW,CAAC;CAIjD,MAAM,eAAA,GAAA,MAAA,OAAA,kBAAqB,IAAI,MAAM,EAAA,CAAE,KAAK;CAE5C,QAAA,GAAA,sBAAA,SAAA,CAAgB;EACd,UAAU,SAAS,OAAO,eAAe,QAAQ,KAAK,IAAI,eAAe,MAAM;EAC/E,eAAe;GACb,MAAM,MAAO,OAAO,QAAgC,KAAK;GACzD,IAAI,YAAY,YAAY;GAC5B,OAAO,IAAI,YAAY;EACzB;EACA,SAAS,iBAAiB,SAAS,SAAS,WAAW,QAAS,WAAW;EAC3E,GAAG;CACL,CAA4F;AAC9F"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../src/react-query/hooks/useActionMutation.ts","../../src/react-query/hooks/useActionQuery.ts"],"sourcesContent":["import {\r\n type UseMutationOptions,\r\n type UseMutationResult,\r\n useMutation,\r\n} from \"@tanstack/react-query\";\r\nimport { useRef } from \"react\";\r\nimport type { ActionCore } from \"../../ActionDefinition/Action/Core/ActionCore\";\r\nimport type {\r\n IActionDomain,\r\n TInferInputFromSchema,\r\n TInferOutputFromSchema,\r\n} from \"../../ActionDefinition/Domain/ActionDomain.types\";\r\nimport type { ActionSchema, TInferActionError } from \"../../ActionDefinition/Schema/ActionSchema\";\r\n\r\n/** When an action has no input schema (Input = never), use void so mutate() needs no arguments. */\r\nexport type TActionMutationVars<SCH extends ActionSchema<any, any, any>> = [\r\n TInferInputFromSchema<SCH>[\"Input\"],\r\n] extends [never]\r\n ? void\r\n : TInferInputFromSchema<SCH>[\"Input\"];\r\n\r\nexport type TUseNiceMutationOptions<\r\n DOM extends IActionDomain,\r\n ID extends keyof DOM[\"actionSchema\"] & string,\r\n SCH extends DOM[\"actionSchema\"][ID] = DOM[\"actionSchema\"][ID],\r\n TContext = unknown,\r\n> = Omit<\r\n UseMutationOptions<\r\n TInferOutputFromSchema<SCH>[\"Output\"],\r\n TInferActionError<SCH>,\r\n TActionMutationVars<SCH>,\r\n TContext\r\n >,\r\n \"mutationFn\"\r\n>;\r\n\r\nexport function useActionMutation<\r\n DOM extends IActionDomain,\r\n ID extends keyof DOM[\"actionSchema\"] & string,\r\n SCH extends DOM[\"actionSchema\"][ID],\r\n TContext = unknown,\r\n>(\r\n action: ActionCore<DOM, ID>,\r\n options?: TUseNiceMutationOptions<DOM, ID, SCH, TContext>,\r\n): UseMutationResult<\r\n TInferOutputFromSchema<SCH>[\"Output\"],\r\n TInferActionError<SCH>,\r\n TActionMutationVars<SCH>,\r\n TContext\r\n> {\r\n const mutationOptions = options ?? {};\r\n\r\n // Side-channel for the call site: mutate() writes it synchronously, mutationFn reads it.\r\n // React Query calls mutationFn synchronously within mutate(), so the ref is always fresh.\r\n const callSiteRef = useRef<string | undefined>(undefined);\r\n\r\n const result = useMutation({\r\n mutationFn: (input: TActionMutationVars<SCH>) => {\r\n const req = action.request(input as unknown as TInferInputFromSchema<SCH>[\"Input\"]);\r\n req._callSite = callSiteRef.current;\r\n callSiteRef.current = undefined;\r\n return req.runToOutput();\r\n },\r\n ...mutationOptions,\r\n });\r\n\r\n // Wrap mutate/mutateAsync so the call site is captured at the user's invocation point.\r\n // By the time mutationFn runs inside React Query's scheduler the user's frames are gone.\r\n return {\r\n ...result,\r\n mutate: (...args: Parameters<typeof result.mutate>) => {\r\n callSiteRef.current = new Error().stack;\r\n return result.mutate(...args);\r\n },\r\n mutateAsync: (...args: Parameters<typeof result.mutateAsync>) => {\r\n callSiteRef.current = new Error().stack;\r\n return result.mutateAsync(...args);\r\n },\r\n };\r\n}\r\n","import {\r\n type QueryKey,\r\n type UseQueryOptions,\r\n type UseQueryResult,\r\n useQuery,\r\n} from \"@tanstack/react-query\";\r\nimport { useRef } from \"react\";\r\nimport type { ActionCore } from \"../../ActionDefinition/Action/Core/ActionCore\";\r\nimport type {\r\n IActionDomain,\r\n TInferInputFromSchema,\r\n TInferOutputFromSchema,\r\n} from \"../../ActionDefinition/Domain/ActionDomain.types\";\r\nimport type { TInferActionError } from \"../../ActionDefinition/Schema/ActionSchema\";\r\n\r\nexport function actionQueryKey<\r\n DOM extends IActionDomain,\r\n ID extends keyof DOM[\"actionSchema\"] & string,\r\n>(action: ActionCore<DOM, ID>): readonly [\"nice-action\", DOM[\"domain\"], DOM[\"allDomains\"], ID];\r\n\r\nexport function actionQueryKey<\r\n DOM extends IActionDomain,\r\n ID extends keyof DOM[\"actionSchema\"] & string,\r\n>(\r\n action: ActionCore<DOM, ID>,\r\n input: TInferInputFromSchema<DOM[\"actionSchema\"][ID]>[\"Input\"],\r\n): readonly [\r\n \"nice-action\",\r\n DOM[\"domain\"],\r\n DOM[\"allDomains\"],\r\n ID,\r\n TInferInputFromSchema<DOM[\"actionSchema\"][ID]>[\"Input\"],\r\n];\r\n\r\nexport function actionQueryKey(action: ActionCore<any, any>, input?: unknown): QueryKey {\r\n if (input === undefined) {\r\n return [\"nice-action\", action.domain, action.allDomains, action.id] as const;\r\n }\r\n\r\n return [\"nice-action\", action.domain, action.allDomains, action.id, input] as const;\r\n}\r\n\r\nexport type TUseActionQueryOptions<\r\n DOM extends IActionDomain,\r\n ID extends keyof DOM[\"actionSchema\"] & string,\r\n SCH extends DOM[\"actionSchema\"][ID] = DOM[\"actionSchema\"][ID],\r\n TSelect = TInferOutputFromSchema<SCH>[\"Output\"],\r\n> = Omit<\r\n UseQueryOptions<TInferOutputFromSchema<SCH>[\"Output\"], TInferActionError<SCH>, TSelect, QueryKey>,\r\n \"queryKey\" | \"queryFn\"\r\n>;\r\n\r\nexport function useActionQuery<\r\n DOM extends IActionDomain,\r\n ID extends keyof DOM[\"actionSchema\"] & string,\r\n SCH extends DOM[\"actionSchema\"][ID],\r\n TSelect = TInferOutputFromSchema<SCH>[\"Output\"],\r\n>(\r\n action: ActionCore<DOM, ID>,\r\n ...args: [TInferInputFromSchema<SCH>[\"Input\"]] extends [never]\r\n ? [options?: TUseActionQueryOptions<DOM, ID, SCH, TSelect>]\r\n : [\r\n input: TInferInputFromSchema<SCH>[\"Input\"] | null | undefined,\r\n options?: TUseActionQueryOptions<DOM, ID, SCH, TSelect>,\r\n ]\r\n): UseQueryResult<TSelect, TInferActionError<SCH>> {\r\n const hasInputSchema = action.schema.inputSchema != null;\r\n\r\n let input: TInferInputFromSchema<SCH>[\"Input\"] | null | undefined;\r\n let options: TUseActionQueryOptions<DOM, ID, SCH, TSelect> | undefined;\r\n\r\n if (hasInputSchema) {\r\n [input, options] = args as [\r\n TInferInputFromSchema<SCH>[\"Input\"] | null | undefined,\r\n TUseActionQueryOptions<DOM, ID, SCH, TSelect>?,\r\n ];\r\n } else {\r\n [options] = args as [TUseActionQueryOptions<DOM, ID, SCH, TSelect>?];\r\n }\r\n\r\n const { enabled, ...queryOptions } = options ?? {};\r\n\r\n // Capture the call site synchronously here — the user's component frame is on the\r\n // stack now. By the time queryFn runs inside React Query's scheduler it's gone.\r\n const callSiteRef = useRef(new Error().stack);\r\n\r\n return useQuery({\r\n queryKey: input != null ? actionQueryKey(action, input) : actionQueryKey(action),\r\n queryFn: () => {\r\n const req = (action.request as (input: any) => any)(input);\r\n req._callSite = callSiteRef.current;\r\n return req.runToOutput();\r\n },\r\n enabled: hasInputSchema ? input != null && (enabled ?? true) : (enabled ?? true),\r\n ...queryOptions,\r\n } as UseQueryOptions<TInferOutputFromSchema<SCH>[\"Output\"], TInferActionError<SCH>, TSelect>);\r\n}\r\n"],"mappings":";;;;AAoCA,SAAgB,kBAMd,QACA,SAMA;CACA,MAAM,kBAAkB,WAAW,CAAC;CAIpC,MAAM,eAAA,GAAA,MAAA,OAAA,CAAyC,KAAA,CAAS;CAExD,MAAM,UAAA,GAAA,sBAAA,YAAA,CAAqB;EACzB,aAAa,UAAoC;GAC/C,MAAM,MAAM,OAAO,QAAQ,KAAuD;GAClF,IAAI,YAAY,YAAY;GAC5B,YAAY,UAAU,KAAA;GACtB,OAAO,IAAI,YAAY;EACzB;EACA,GAAG;CACL,CAAC;CAID,OAAO;EACL,GAAG;EACH,SAAS,GAAG,SAA2C;GACrD,YAAY,2BAAU,IAAI,MAAM,EAAA,CAAE;GAClC,OAAO,OAAO,OAAO,GAAG,IAAI;EAC9B;EACA,cAAc,GAAG,SAAgD;GAC/D,YAAY,2BAAU,IAAI,MAAM,EAAA,CAAE;GAClC,OAAO,OAAO,YAAY,GAAG,IAAI;EACnC;CACF;AACF;;;AC7CA,SAAgB,eAAe,QAA8B,OAA2B;CACtF,IAAI,UAAU,KAAA,GACZ,OAAO;EAAC;EAAe,OAAO;EAAQ,OAAO;EAAY,OAAO;CAAE;CAGpE,OAAO;EAAC;EAAe,OAAO;EAAQ,OAAO;EAAY,OAAO;EAAI;CAAK;AAC3E;AAYA,SAAgB,eAMd,QACA,GAAG,MAM8C;CACjD,MAAM,iBAAiB,OAAO,OAAO,eAAe;CAEpD,IAAI;CACJ,IAAI;CAEJ,IAAI,gBACF,CAAC,OAAO,WAAW;MAKnB,CAAC,WAAW;CAGd,MAAM,EAAE,SAAS,GAAG,iBAAiB,WAAW,CAAC;CAIjD,MAAM,eAAA,GAAA,MAAA,OAAA,kBAAqB,IAAI,MAAM,EAAA,CAAE,KAAK;CAE5C,QAAA,GAAA,sBAAA,SAAA,CAAgB;EACd,UAAU,SAAS,OAAO,eAAe,QAAQ,KAAK,IAAI,eAAe,MAAM;EAC/E,eAAe;GACb,MAAM,MAAO,OAAO,QAAgC,KAAK;GACzD,IAAI,YAAY,YAAY;GAC5B,OAAO,IAAI,YAAY;EACzB;EACA,SAAS,iBAAiB,SAAS,SAAS,WAAW,QAAS,WAAW;EAC3E,GAAG;CACL,CAA4F;AAC9F"}
@@ -1,4 +1,4 @@
1
- import { $n as TInferOutputFromSchema, Kn as IActionDomain, Pt as ActionCore, Qn as TInferInputFromSchema, nr as ActionSchema, rr as TInferActionError } from "../ActionPayload.types-BN-rXFBK.cjs";
1
+ import { Fr as ActionSchema, Lr as TInferActionError, Mr as TInferOutputFromSchema, Tr as IActionDomain, Yt as ActionCore, jr as TInferInputFromSchema } from "../ActionPayload.types-CO_hXlBc.cjs";
2
2
  import { QueryKey, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
3
3
 
4
4
  //#region src/react-query/hooks/useActionMutation.d.ts
@@ -1,4 +1,4 @@
1
- import { $n as TInferOutputFromSchema, Kn as IActionDomain, Pt as ActionCore, Qn as TInferInputFromSchema, nr as ActionSchema, rr as TInferActionError } from "../ActionPayload.types-D28ELKXC.mjs";
1
+ import { Fr as ActionSchema, Lr as TInferActionError, Mr as TInferOutputFromSchema, Tr as IActionDomain, Yt as ActionCore, jr as TInferInputFromSchema } from "../ActionPayload.types-fieMKAgt.mjs";
2
2
  import { QueryKey, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
3
3
 
4
4
  //#region src/react-query/hooks/useActionMutation.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/react-query/hooks/useActionMutation.ts","../../src/react-query/hooks/useActionQuery.ts"],"sourcesContent":["import {\r\n type UseMutationOptions,\r\n type UseMutationResult,\r\n useMutation,\r\n} from \"@tanstack/react-query\";\r\nimport { useRef } from \"react\";\r\nimport type { ActionCore } from \"../../ActionDefinition/Action/Core/ActionCore\";\r\nimport type {\r\n IActionDomain,\r\n TInferInputFromSchema,\r\n TInferOutputFromSchema,\r\n} from \"../../ActionDefinition/Domain/ActionDomain.types\";\r\nimport type { ActionSchema, TInferActionError } from \"../../ActionDefinition/Schema/ActionSchema\";\r\n\r\n/** When an action has no input schema (Input = never), use void so mutate() needs no arguments. */\r\nexport type TActionMutationVars<SCH extends ActionSchema<any, any, any>> = [\r\n TInferInputFromSchema<SCH>[\"Input\"],\r\n] extends [never]\r\n ? void\r\n : TInferInputFromSchema<SCH>[\"Input\"];\r\n\r\nexport type TUseNiceMutationOptions<\r\n DOM extends IActionDomain,\r\n ID extends keyof DOM[\"actionSchema\"] & string,\r\n SCH extends DOM[\"actionSchema\"][ID] = DOM[\"actionSchema\"][ID],\r\n TContext = unknown,\r\n> = Omit<\r\n UseMutationOptions<\r\n TInferOutputFromSchema<SCH>[\"Output\"],\r\n TInferActionError<SCH>,\r\n TActionMutationVars<SCH>,\r\n TContext\r\n >,\r\n \"mutationFn\"\r\n>;\r\n\r\nexport function useActionMutation<\r\n DOM extends IActionDomain,\r\n ID extends keyof DOM[\"actionSchema\"] & string,\r\n SCH extends DOM[\"actionSchema\"][ID],\r\n TContext = unknown,\r\n>(\r\n action: ActionCore<DOM, ID>,\r\n options?: TUseNiceMutationOptions<DOM, ID, SCH, TContext>,\r\n): UseMutationResult<\r\n TInferOutputFromSchema<SCH>[\"Output\"],\r\n TInferActionError<SCH>,\r\n TActionMutationVars<SCH>,\r\n TContext\r\n> {\r\n const mutationOptions = options ?? {};\r\n\r\n // Side-channel for the call site: mutate() writes it synchronously, mutationFn reads it.\r\n // React Query calls mutationFn synchronously within mutate(), so the ref is always fresh.\r\n const callSiteRef = useRef<string | undefined>(undefined);\r\n\r\n const result = useMutation({\r\n mutationFn: (input: TActionMutationVars<SCH>) => {\r\n const req = action.request(input as unknown as TInferInputFromSchema<SCH>[\"Input\"]);\r\n req._callSite = callSiteRef.current;\r\n callSiteRef.current = undefined;\r\n return req.runToOutput();\r\n },\r\n ...mutationOptions,\r\n });\r\n\r\n // Wrap mutate/mutateAsync so the call site is captured at the user's invocation point.\r\n // By the time mutationFn runs inside React Query's scheduler the user's frames are gone.\r\n return {\r\n ...result,\r\n mutate: (...args: Parameters<typeof result.mutate>) => {\r\n callSiteRef.current = new Error().stack;\r\n return result.mutate(...args);\r\n },\r\n mutateAsync: (...args: Parameters<typeof result.mutateAsync>) => {\r\n callSiteRef.current = new Error().stack;\r\n return result.mutateAsync(...args);\r\n },\r\n };\r\n}\r\n","import {\n type QueryKey,\n type UseQueryOptions,\n type UseQueryResult,\n useQuery,\n} from \"@tanstack/react-query\";\nimport { useRef } from \"react\";\nimport type { ActionCore } from \"../../ActionDefinition/Action/Core/ActionCore\";\nimport type {\n IActionDomain,\n TInferInputFromSchema,\n TInferOutputFromSchema,\n} from \"../../ActionDefinition/Domain/ActionDomain.types\";\nimport type { TInferActionError } from \"../../ActionDefinition/Schema/ActionSchema\";\n\nexport function actionQueryKey<\n DOM extends IActionDomain,\n ID extends keyof DOM[\"actionSchema\"] & string,\n>(action: ActionCore<DOM, ID>): readonly [\"nice-action\", DOM[\"domain\"], DOM[\"allDomains\"], ID];\n\nexport function actionQueryKey<\n DOM extends IActionDomain,\n ID extends keyof DOM[\"actionSchema\"] & string,\n>(\n action: ActionCore<DOM, ID>,\n input: TInferInputFromSchema<DOM[\"actionSchema\"][ID]>[\"Input\"],\n): readonly [\n \"nice-action\",\n DOM[\"domain\"],\n DOM[\"allDomains\"],\n ID,\n TInferInputFromSchema<DOM[\"actionSchema\"][ID]>[\"Input\"],\n];\n\nexport function actionQueryKey(action: ActionCore<any, any>, input?: unknown): QueryKey {\n if (input === undefined) {\n return [\"nice-action\", action.domain, action.allDomains, action.id] as const;\n }\n\n return [\"nice-action\", action.domain, action.allDomains, action.id, input] as const;\n}\n\nexport type TUseActionQueryOptions<\n DOM extends IActionDomain,\n ID extends keyof DOM[\"actionSchema\"] & string,\n SCH extends DOM[\"actionSchema\"][ID] = DOM[\"actionSchema\"][ID],\n TSelect = TInferOutputFromSchema<SCH>[\"Output\"],\n> = Omit<\n UseQueryOptions<TInferOutputFromSchema<SCH>[\"Output\"], TInferActionError<SCH>, TSelect, QueryKey>,\n \"queryKey\" | \"queryFn\"\n>;\n\nexport function useActionQuery<\n DOM extends IActionDomain,\n ID extends keyof DOM[\"actionSchema\"] & string,\n SCH extends DOM[\"actionSchema\"][ID],\n TSelect = TInferOutputFromSchema<SCH>[\"Output\"],\n>(\n action: ActionCore<DOM, ID>,\n ...args: [TInferInputFromSchema<SCH>[\"Input\"]] extends [never]\n ? [options?: TUseActionQueryOptions<DOM, ID, SCH, TSelect>]\n : [\n input: TInferInputFromSchema<SCH>[\"Input\"] | null | undefined,\n options?: TUseActionQueryOptions<DOM, ID, SCH, TSelect>,\n ]\n): UseQueryResult<TSelect, TInferActionError<SCH>> {\n const hasInputSchema = action.schema.inputSchema != null;\n\n let input: TInferInputFromSchema<SCH>[\"Input\"] | null | undefined;\n let options: TUseActionQueryOptions<DOM, ID, SCH, TSelect> | undefined;\n\n if (hasInputSchema) {\n [input, options] = args as [\n TInferInputFromSchema<SCH>[\"Input\"] | null | undefined,\n TUseActionQueryOptions<DOM, ID, SCH, TSelect>?,\n ];\n } else {\n [options] = args as [TUseActionQueryOptions<DOM, ID, SCH, TSelect>?];\n }\n\n const { enabled, ...queryOptions } = options ?? {};\n\n // Capture the call site synchronously here — the user's component frame is on the\n // stack now. By the time queryFn runs inside React Query's scheduler it's gone.\n const callSiteRef = useRef(new Error().stack);\n\n return useQuery({\n queryKey: input != null ? actionQueryKey(action, input) : actionQueryKey(action),\n queryFn: () => {\n const req = (action.request as (input: any) => any)(input);\n req._callSite = callSiteRef.current;\n return req.runToOutput();\n },\n enabled: hasInputSchema ? input != null && (enabled ?? true) : (enabled ?? true),\n ...queryOptions,\n } as UseQueryOptions<TInferOutputFromSchema<SCH>[\"Output\"], TInferActionError<SCH>, TSelect>);\n}\n"],"mappings":";;;AAoCA,SAAgB,kBAMd,QACA,SAMA;CACA,MAAM,kBAAkB,WAAW,CAAC;CAIpC,MAAM,cAAc,OAA2B,KAAA,CAAS;CAExD,MAAM,SAAS,YAAY;EACzB,aAAa,UAAoC;GAC/C,MAAM,MAAM,OAAO,QAAQ,KAAuD;GAClF,IAAI,YAAY,YAAY;GAC5B,YAAY,UAAU,KAAA;GACtB,OAAO,IAAI,YAAY;EACzB;EACA,GAAG;CACL,CAAC;CAID,OAAO;EACL,GAAG;EACH,SAAS,GAAG,SAA2C;GACrD,YAAY,2BAAU,IAAI,MAAM,EAAA,CAAE;GAClC,OAAO,OAAO,OAAO,GAAG,IAAI;EAC9B;EACA,cAAc,GAAG,SAAgD;GAC/D,YAAY,2BAAU,IAAI,MAAM,EAAA,CAAE;GAClC,OAAO,OAAO,YAAY,GAAG,IAAI;EACnC;CACF;AACF;;;AC7CA,SAAgB,eAAe,QAA8B,OAA2B;CACtF,IAAI,UAAU,KAAA,GACZ,OAAO;EAAC;EAAe,OAAO;EAAQ,OAAO;EAAY,OAAO;CAAE;CAGpE,OAAO;EAAC;EAAe,OAAO;EAAQ,OAAO;EAAY,OAAO;EAAI;CAAK;AAC3E;AAYA,SAAgB,eAMd,QACA,GAAG,MAM8C;CACjD,MAAM,iBAAiB,OAAO,OAAO,eAAe;CAEpD,IAAI;CACJ,IAAI;CAEJ,IAAI,gBACF,CAAC,OAAO,WAAW;MAKnB,CAAC,WAAW;CAGd,MAAM,EAAE,SAAS,GAAG,iBAAiB,WAAW,CAAC;CAIjD,MAAM,cAAc,wBAAO,IAAI,MAAM,EAAA,CAAE,KAAK;CAE5C,OAAO,SAAS;EACd,UAAU,SAAS,OAAO,eAAe,QAAQ,KAAK,IAAI,eAAe,MAAM;EAC/E,eAAe;GACb,MAAM,MAAO,OAAO,QAAgC,KAAK;GACzD,IAAI,YAAY,YAAY;GAC5B,OAAO,IAAI,YAAY;EACzB;EACA,SAAS,iBAAiB,SAAS,SAAS,WAAW,QAAS,WAAW;EAC3E,GAAG;CACL,CAA4F;AAC9F"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/react-query/hooks/useActionMutation.ts","../../src/react-query/hooks/useActionQuery.ts"],"sourcesContent":["import {\r\n type UseMutationOptions,\r\n type UseMutationResult,\r\n useMutation,\r\n} from \"@tanstack/react-query\";\r\nimport { useRef } from \"react\";\r\nimport type { ActionCore } from \"../../ActionDefinition/Action/Core/ActionCore\";\r\nimport type {\r\n IActionDomain,\r\n TInferInputFromSchema,\r\n TInferOutputFromSchema,\r\n} from \"../../ActionDefinition/Domain/ActionDomain.types\";\r\nimport type { ActionSchema, TInferActionError } from \"../../ActionDefinition/Schema/ActionSchema\";\r\n\r\n/** When an action has no input schema (Input = never), use void so mutate() needs no arguments. */\r\nexport type TActionMutationVars<SCH extends ActionSchema<any, any, any>> = [\r\n TInferInputFromSchema<SCH>[\"Input\"],\r\n] extends [never]\r\n ? void\r\n : TInferInputFromSchema<SCH>[\"Input\"];\r\n\r\nexport type TUseNiceMutationOptions<\r\n DOM extends IActionDomain,\r\n ID extends keyof DOM[\"actionSchema\"] & string,\r\n SCH extends DOM[\"actionSchema\"][ID] = DOM[\"actionSchema\"][ID],\r\n TContext = unknown,\r\n> = Omit<\r\n UseMutationOptions<\r\n TInferOutputFromSchema<SCH>[\"Output\"],\r\n TInferActionError<SCH>,\r\n TActionMutationVars<SCH>,\r\n TContext\r\n >,\r\n \"mutationFn\"\r\n>;\r\n\r\nexport function useActionMutation<\r\n DOM extends IActionDomain,\r\n ID extends keyof DOM[\"actionSchema\"] & string,\r\n SCH extends DOM[\"actionSchema\"][ID],\r\n TContext = unknown,\r\n>(\r\n action: ActionCore<DOM, ID>,\r\n options?: TUseNiceMutationOptions<DOM, ID, SCH, TContext>,\r\n): UseMutationResult<\r\n TInferOutputFromSchema<SCH>[\"Output\"],\r\n TInferActionError<SCH>,\r\n TActionMutationVars<SCH>,\r\n TContext\r\n> {\r\n const mutationOptions = options ?? {};\r\n\r\n // Side-channel for the call site: mutate() writes it synchronously, mutationFn reads it.\r\n // React Query calls mutationFn synchronously within mutate(), so the ref is always fresh.\r\n const callSiteRef = useRef<string | undefined>(undefined);\r\n\r\n const result = useMutation({\r\n mutationFn: (input: TActionMutationVars<SCH>) => {\r\n const req = action.request(input as unknown as TInferInputFromSchema<SCH>[\"Input\"]);\r\n req._callSite = callSiteRef.current;\r\n callSiteRef.current = undefined;\r\n return req.runToOutput();\r\n },\r\n ...mutationOptions,\r\n });\r\n\r\n // Wrap mutate/mutateAsync so the call site is captured at the user's invocation point.\r\n // By the time mutationFn runs inside React Query's scheduler the user's frames are gone.\r\n return {\r\n ...result,\r\n mutate: (...args: Parameters<typeof result.mutate>) => {\r\n callSiteRef.current = new Error().stack;\r\n return result.mutate(...args);\r\n },\r\n mutateAsync: (...args: Parameters<typeof result.mutateAsync>) => {\r\n callSiteRef.current = new Error().stack;\r\n return result.mutateAsync(...args);\r\n },\r\n };\r\n}\r\n","import {\r\n type QueryKey,\r\n type UseQueryOptions,\r\n type UseQueryResult,\r\n useQuery,\r\n} from \"@tanstack/react-query\";\r\nimport { useRef } from \"react\";\r\nimport type { ActionCore } from \"../../ActionDefinition/Action/Core/ActionCore\";\r\nimport type {\r\n IActionDomain,\r\n TInferInputFromSchema,\r\n TInferOutputFromSchema,\r\n} from \"../../ActionDefinition/Domain/ActionDomain.types\";\r\nimport type { TInferActionError } from \"../../ActionDefinition/Schema/ActionSchema\";\r\n\r\nexport function actionQueryKey<\r\n DOM extends IActionDomain,\r\n ID extends keyof DOM[\"actionSchema\"] & string,\r\n>(action: ActionCore<DOM, ID>): readonly [\"nice-action\", DOM[\"domain\"], DOM[\"allDomains\"], ID];\r\n\r\nexport function actionQueryKey<\r\n DOM extends IActionDomain,\r\n ID extends keyof DOM[\"actionSchema\"] & string,\r\n>(\r\n action: ActionCore<DOM, ID>,\r\n input: TInferInputFromSchema<DOM[\"actionSchema\"][ID]>[\"Input\"],\r\n): readonly [\r\n \"nice-action\",\r\n DOM[\"domain\"],\r\n DOM[\"allDomains\"],\r\n ID,\r\n TInferInputFromSchema<DOM[\"actionSchema\"][ID]>[\"Input\"],\r\n];\r\n\r\nexport function actionQueryKey(action: ActionCore<any, any>, input?: unknown): QueryKey {\r\n if (input === undefined) {\r\n return [\"nice-action\", action.domain, action.allDomains, action.id] as const;\r\n }\r\n\r\n return [\"nice-action\", action.domain, action.allDomains, action.id, input] as const;\r\n}\r\n\r\nexport type TUseActionQueryOptions<\r\n DOM extends IActionDomain,\r\n ID extends keyof DOM[\"actionSchema\"] & string,\r\n SCH extends DOM[\"actionSchema\"][ID] = DOM[\"actionSchema\"][ID],\r\n TSelect = TInferOutputFromSchema<SCH>[\"Output\"],\r\n> = Omit<\r\n UseQueryOptions<TInferOutputFromSchema<SCH>[\"Output\"], TInferActionError<SCH>, TSelect, QueryKey>,\r\n \"queryKey\" | \"queryFn\"\r\n>;\r\n\r\nexport function useActionQuery<\r\n DOM extends IActionDomain,\r\n ID extends keyof DOM[\"actionSchema\"] & string,\r\n SCH extends DOM[\"actionSchema\"][ID],\r\n TSelect = TInferOutputFromSchema<SCH>[\"Output\"],\r\n>(\r\n action: ActionCore<DOM, ID>,\r\n ...args: [TInferInputFromSchema<SCH>[\"Input\"]] extends [never]\r\n ? [options?: TUseActionQueryOptions<DOM, ID, SCH, TSelect>]\r\n : [\r\n input: TInferInputFromSchema<SCH>[\"Input\"] | null | undefined,\r\n options?: TUseActionQueryOptions<DOM, ID, SCH, TSelect>,\r\n ]\r\n): UseQueryResult<TSelect, TInferActionError<SCH>> {\r\n const hasInputSchema = action.schema.inputSchema != null;\r\n\r\n let input: TInferInputFromSchema<SCH>[\"Input\"] | null | undefined;\r\n let options: TUseActionQueryOptions<DOM, ID, SCH, TSelect> | undefined;\r\n\r\n if (hasInputSchema) {\r\n [input, options] = args as [\r\n TInferInputFromSchema<SCH>[\"Input\"] | null | undefined,\r\n TUseActionQueryOptions<DOM, ID, SCH, TSelect>?,\r\n ];\r\n } else {\r\n [options] = args as [TUseActionQueryOptions<DOM, ID, SCH, TSelect>?];\r\n }\r\n\r\n const { enabled, ...queryOptions } = options ?? {};\r\n\r\n // Capture the call site synchronously here — the user's component frame is on the\r\n // stack now. By the time queryFn runs inside React Query's scheduler it's gone.\r\n const callSiteRef = useRef(new Error().stack);\r\n\r\n return useQuery({\r\n queryKey: input != null ? actionQueryKey(action, input) : actionQueryKey(action),\r\n queryFn: () => {\r\n const req = (action.request as (input: any) => any)(input);\r\n req._callSite = callSiteRef.current;\r\n return req.runToOutput();\r\n },\r\n enabled: hasInputSchema ? input != null && (enabled ?? true) : (enabled ?? true),\r\n ...queryOptions,\r\n } as UseQueryOptions<TInferOutputFromSchema<SCH>[\"Output\"], TInferActionError<SCH>, TSelect>);\r\n}\r\n"],"mappings":";;;AAoCA,SAAgB,kBAMd,QACA,SAMA;CACA,MAAM,kBAAkB,WAAW,CAAC;CAIpC,MAAM,cAAc,OAA2B,KAAA,CAAS;CAExD,MAAM,SAAS,YAAY;EACzB,aAAa,UAAoC;GAC/C,MAAM,MAAM,OAAO,QAAQ,KAAuD;GAClF,IAAI,YAAY,YAAY;GAC5B,YAAY,UAAU,KAAA;GACtB,OAAO,IAAI,YAAY;EACzB;EACA,GAAG;CACL,CAAC;CAID,OAAO;EACL,GAAG;EACH,SAAS,GAAG,SAA2C;GACrD,YAAY,2BAAU,IAAI,MAAM,EAAA,CAAE;GAClC,OAAO,OAAO,OAAO,GAAG,IAAI;EAC9B;EACA,cAAc,GAAG,SAAgD;GAC/D,YAAY,2BAAU,IAAI,MAAM,EAAA,CAAE;GAClC,OAAO,OAAO,YAAY,GAAG,IAAI;EACnC;CACF;AACF;;;AC7CA,SAAgB,eAAe,QAA8B,OAA2B;CACtF,IAAI,UAAU,KAAA,GACZ,OAAO;EAAC;EAAe,OAAO;EAAQ,OAAO;EAAY,OAAO;CAAE;CAGpE,OAAO;EAAC;EAAe,OAAO;EAAQ,OAAO;EAAY,OAAO;EAAI;CAAK;AAC3E;AAYA,SAAgB,eAMd,QACA,GAAG,MAM8C;CACjD,MAAM,iBAAiB,OAAO,OAAO,eAAe;CAEpD,IAAI;CACJ,IAAI;CAEJ,IAAI,gBACF,CAAC,OAAO,WAAW;MAKnB,CAAC,WAAW;CAGd,MAAM,EAAE,SAAS,GAAG,iBAAiB,WAAW,CAAC;CAIjD,MAAM,cAAc,wBAAO,IAAI,MAAM,EAAA,CAAE,KAAK;CAE5C,OAAO,SAAS;EACd,UAAU,SAAS,OAAO,eAAe,QAAQ,KAAK,IAAI,eAAe,MAAM;EAC/E,eAAe;GACb,MAAM,MAAO,OAAO,QAAgC,KAAK;GACzD,IAAI,YAAY,YAAY;GAC5B,OAAO,IAAI,YAAY;EACzB;EACA,SAAS,iBAAiB,SAAS,SAAS,WAAW,QAAS,WAAW;EAC3E,GAAG;CACL,CAA4F;AAC9F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice-code/action",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "main": "./build/index.cjs",
5
5
  "module": "./build/index.mjs",
6
6
  "types": "./build/index.d.cts",
@@ -75,9 +75,9 @@
75
75
  },
76
76
  "type": "module",
77
77
  "dependencies": {
78
- "@nice-code/common-errors": "0.15.0",
79
- "@nice-code/error": "0.15.0",
80
- "@nice-code/util": "0.15.0",
78
+ "@nice-code/common-errors": "0.16.0",
79
+ "@nice-code/error": "0.16.0",
80
+ "@nice-code/util": "0.16.0",
81
81
  "@standard-schema/spec": "^1.1.0",
82
82
  "@tanstack/react-virtual": "^3.13.26",
83
83
  "http-status-codes": "^2.3.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"ActionDevtoolsCore-9PsnscvK.mjs","names":[],"sources":["../src/devtools/core/ActionDevtoolsCore.ts"],"sourcesContent":["import {\r\n ERunningActionFinishedType,\r\n ERunningActionUpdateType,\r\n} from \"../../ActionDefinition/Action/RunningAction.types\";\r\nimport type {\r\n IDevtoolsActionEntry,\r\n IDevtoolsActionMeta,\r\n IDevtoolsObservableDomain,\r\n IDevtoolsRouteItem,\r\n TDevtoolsListener,\r\n} from \"./ActionDevtools.types\";\r\n\r\nexport interface IActionDevtoolsCoreOptions {\r\n /** Max root entries to retain. Older entries (and their children) are evicted. */\r\n maxEntries?: number;\r\n}\r\n\r\nfunction serializeErrorForDisplay(error: unknown): unknown {\r\n if (\r\n error != null &&\r\n typeof error === \"object\" &&\r\n (error as any).name === \"NiceError\" &&\r\n typeof (error as any).toJsonObject === \"function\"\r\n ) {\r\n return (error as any).toJsonObject();\r\n }\r\n return error;\r\n}\r\n\r\nfunction extractRouting(context: any): IDevtoolsRouteItem[] {\r\n return (context?.routing ?? []).map((item: any): IDevtoolsRouteItem => {\r\n const handler = item.handler;\r\n const isExternal = handler?.type === \"external\";\r\n return {\r\n runtime: {\r\n envId: item.runtime?.envId ?? \"unknown\",\r\n perId: item.runtime?.perId,\r\n insId: item.runtime?.insId,\r\n },\r\n handlerType: isExternal ? \"external\" : \"local\",\r\n handlerClient:\r\n isExternal && handler.client != null\r\n ? {\r\n envId: handler.client.envId ?? \"unknown\",\r\n perId: handler.client.perId,\r\n insId: handler.client.insId,\r\n }\r\n : undefined,\r\n transport: isExternal ? handler.transType : undefined,\r\n transportSummary: isExternal ? handler.transInfo?.summary : undefined,\r\n transportUrl: isExternal ? handler.transInfo?.url : undefined,\r\n time: item.time,\r\n };\r\n });\r\n}\r\n\r\nfunction extractMeta(context: any): IDevtoolsActionMeta {\r\n return {\r\n timeCreated: context?.timeCreated ?? Date.now(),\r\n originClient: {\r\n envId: context?.originClient?.envId ?? \"unknown\",\r\n perId: context?.originClient?.perId,\r\n insId: context?.originClient?.insId,\r\n },\r\n routing: extractRouting(context),\r\n };\r\n}\r\n\r\nexport class ActionDevtoolsCore {\r\n private _entries: IDevtoolsActionEntry[] = [];\r\n private _listeners: Set<TDevtoolsListener> = new Set();\r\n private readonly _maxEntries: number;\r\n\r\n constructor(options: IActionDevtoolsCoreOptions = {}) {\r\n this._maxEntries = options.maxEntries ?? 500;\r\n }\r\n\r\n attachToDomain(domain: IDevtoolsObservableDomain): () => void {\r\n return domain.addActionListener((update) => {\r\n const { runningAction, type, time } = update;\r\n\r\n if (type === ERunningActionUpdateType.started) {\r\n const entry: IDevtoolsActionEntry = {\r\n cuid: runningAction.cuid,\r\n actionId: runningAction.id,\r\n domain: runningAction.domain,\r\n allDomains: [...runningAction.allDomains],\r\n status: \"running\",\r\n startTime: time,\r\n input: runningAction.state?.request?.input,\r\n inputHash: runningAction.state?.request?.inputHash,\r\n progressUpdates: [],\r\n meta: extractMeta(runningAction.context),\r\n parentCuid: runningAction.parentCuid,\r\n callSite: runningAction.callSite,\r\n };\r\n this._entries = [entry, ...this._entries];\r\n // Bound retention: entries are newest-first, so the oldest fall off the tail.\r\n // Grouping already renders any child whose parent is gone as its own root, so\r\n // dropping an old parent never breaks the surviving children's display.\r\n if (this._entries.length > this._maxEntries) {\r\n this._entries.length = this._maxEntries;\r\n }\r\n this._notify();\r\n } else if (type === ERunningActionUpdateType.progress) {\r\n this._updateEntry(runningAction.cuid, (e) => ({\r\n ...e,\r\n progressUpdates: [...e.progressUpdates, update.progress],\r\n }));\r\n } else if (type === ERunningActionUpdateType.finished) {\r\n this._updateEntry(runningAction.cuid, (e) => {\r\n // On success the result payload's context may carry the full routing from the handling\r\n // runtime (including backend hops) — richer than the local context, which only has this\r\n // side's outgoing hops. Prefer it *only when it's actually richer*: the optimized binary\r\n // WS session strips routing from the wire and reconstructs an empty array, so an empty\r\n // response routing must never clobber the real local hops (otherwise the entry renders as\r\n // \"call\"/\"local\" instead of \"→ ws → backend\").\r\n const responseRouting = extractRouting((update as any).response?.context);\r\n const localRouting = extractRouting(runningAction.context);\r\n const routing =\r\n responseRouting.length >= localRouting.length ? responseRouting : localRouting;\r\n const base: IDevtoolsActionEntry = {\r\n ...e,\r\n endTime: time,\r\n meta: { ...e.meta, routing },\r\n };\r\n const finishType: string = update.finishType;\r\n\r\n if (finishType === ERunningActionFinishedType.success) {\r\n const result = update.response?.result;\r\n const outputHash: string | undefined = update.response?.outputHash;\r\n if (result != null && !result.ok) {\r\n const rawError = result.error;\r\n const errorStack = rawError instanceof Error ? rawError.stack : undefined;\r\n return {\r\n ...base,\r\n status: \"action-error\",\r\n outputHash,\r\n error: serializeErrorForDisplay(rawError),\r\n errorStack,\r\n };\r\n }\r\n return { ...base, status: \"success\", output: result?.output, outputHash };\r\n }\r\n if (finishType === ERunningActionFinishedType.failed) {\r\n const rawError = (update as any).error;\r\n const errorStack = rawError instanceof Error ? rawError.stack : undefined;\r\n return {\r\n ...base,\r\n status: \"failed\",\r\n error: serializeErrorForDisplay(rawError),\r\n errorStack,\r\n };\r\n }\r\n const abortReason = update.reason;\r\n const errorStack = abortReason instanceof Error ? abortReason.stack : undefined;\r\n return {\r\n ...base,\r\n status: \"aborted\",\r\n abortReason: serializeErrorForDisplay(abortReason),\r\n errorStack,\r\n };\r\n });\r\n }\r\n });\r\n }\r\n\r\n getEntries(): readonly IDevtoolsActionEntry[] {\r\n return this._entries;\r\n }\r\n\r\n subscribe(listener: TDevtoolsListener): () => void {\r\n this._listeners.add(listener);\r\n listener(this._entries);\r\n return () => {\r\n this._listeners.delete(listener);\r\n };\r\n }\r\n\r\n clear(): void {\r\n this._entries = [];\r\n this._notify();\r\n }\r\n\r\n private _updateEntry(\r\n cuid: string,\r\n updater: (entry: IDevtoolsActionEntry) => IDevtoolsActionEntry,\r\n ): void {\r\n this._entries = this._entries.map((e) => (e.cuid === cuid ? updater(e) : e));\r\n this._notify();\r\n }\r\n\r\n private _notify(): void {\r\n const snapshot = this._entries;\r\n for (const listener of this._listeners) listener(snapshot);\r\n }\r\n}\r\n"],"mappings":";;AAiBA,SAAS,yBAAyB,OAAyB;CACzD,IACE,SAAS,QACT,OAAO,UAAU,YAChB,MAAc,SAAS,eACxB,OAAQ,MAAc,iBAAiB,YAEvC,OAAQ,MAAc,aAAa;CAErC,OAAO;AACT;AAEA,SAAS,eAAe,SAAoC;CAC1D,QAAQ,SAAS,WAAW,CAAC,EAAA,CAAG,KAAK,SAAkC;EACrE,MAAM,UAAU,KAAK;EACrB,MAAM,aAAa,SAAS,SAAS;EACrC,OAAO;GACL,SAAS;IACP,OAAO,KAAK,SAAS,SAAS;IAC9B,OAAO,KAAK,SAAS;IACrB,OAAO,KAAK,SAAS;GACvB;GACA,aAAa,aAAa,aAAa;GACvC,eACE,cAAc,QAAQ,UAAU,OAC5B;IACE,OAAO,QAAQ,OAAO,SAAS;IAC/B,OAAO,QAAQ,OAAO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CAAC;EACjB,KAAK,QAAQ;CACf;CAEA,aACE,MACA,SACM;EACN,KAAK,WAAW,KAAK,SAAS,KAAK,MAAO,EAAE,SAAS,OAAO,QAAQ,CAAC,IAAI,CAAE;EAC3E,KAAK,QAAQ;CACf;CAEA,UAAwB;EACtB,MAAM,WAAW,KAAK;EACtB,KAAK,MAAM,YAAY,KAAK,YAAY,SAAS,QAAQ;CAC3D;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ActionDevtoolsCore-DtgXwPBZ.cjs","names":[],"sources":["../src/devtools/core/ActionDevtoolsCore.ts"],"sourcesContent":["import {\r\n ERunningActionFinishedType,\r\n ERunningActionUpdateType,\r\n} from \"../../ActionDefinition/Action/RunningAction.types\";\r\nimport type {\r\n IDevtoolsActionEntry,\r\n IDevtoolsActionMeta,\r\n IDevtoolsObservableDomain,\r\n IDevtoolsRouteItem,\r\n TDevtoolsListener,\r\n} from \"./ActionDevtools.types\";\r\n\r\nexport interface IActionDevtoolsCoreOptions {\r\n /** Max root entries to retain. Older entries (and their children) are evicted. */\r\n maxEntries?: number;\r\n}\r\n\r\nfunction serializeErrorForDisplay(error: unknown): unknown {\r\n if (\r\n error != null &&\r\n typeof error === \"object\" &&\r\n (error as any).name === \"NiceError\" &&\r\n typeof (error as any).toJsonObject === \"function\"\r\n ) {\r\n return (error as any).toJsonObject();\r\n }\r\n return error;\r\n}\r\n\r\nfunction extractRouting(context: any): IDevtoolsRouteItem[] {\r\n return (context?.routing ?? []).map((item: any): IDevtoolsRouteItem => {\r\n const handler = item.handler;\r\n const isExternal = handler?.type === \"external\";\r\n return {\r\n runtime: {\r\n envId: item.runtime?.envId ?? \"unknown\",\r\n perId: item.runtime?.perId,\r\n insId: item.runtime?.insId,\r\n },\r\n handlerType: isExternal ? \"external\" : \"local\",\r\n handlerClient:\r\n isExternal && handler.client != null\r\n ? {\r\n envId: handler.client.envId ?? \"unknown\",\r\n perId: handler.client.perId,\r\n insId: handler.client.insId,\r\n }\r\n : undefined,\r\n transport: isExternal ? handler.transType : undefined,\r\n transportSummary: isExternal ? handler.transInfo?.summary : undefined,\r\n transportUrl: isExternal ? handler.transInfo?.url : undefined,\r\n time: item.time,\r\n };\r\n });\r\n}\r\n\r\nfunction extractMeta(context: any): IDevtoolsActionMeta {\r\n return {\r\n timeCreated: context?.timeCreated ?? Date.now(),\r\n originClient: {\r\n envId: context?.originClient?.envId ?? \"unknown\",\r\n perId: context?.originClient?.perId,\r\n insId: context?.originClient?.insId,\r\n },\r\n routing: extractRouting(context),\r\n };\r\n}\r\n\r\nexport class ActionDevtoolsCore {\r\n private _entries: IDevtoolsActionEntry[] = [];\r\n private _listeners: Set<TDevtoolsListener> = new Set();\r\n private readonly _maxEntries: number;\r\n\r\n constructor(options: IActionDevtoolsCoreOptions = {}) {\r\n this._maxEntries = options.maxEntries ?? 500;\r\n }\r\n\r\n attachToDomain(domain: IDevtoolsObservableDomain): () => void {\r\n return domain.addActionListener((update) => {\r\n const { runningAction, type, time } = update;\r\n\r\n if (type === ERunningActionUpdateType.started) {\r\n const entry: IDevtoolsActionEntry = {\r\n cuid: runningAction.cuid,\r\n actionId: runningAction.id,\r\n domain: runningAction.domain,\r\n allDomains: [...runningAction.allDomains],\r\n status: \"running\",\r\n startTime: time,\r\n input: runningAction.state?.request?.input,\r\n inputHash: runningAction.state?.request?.inputHash,\r\n progressUpdates: [],\r\n meta: extractMeta(runningAction.context),\r\n parentCuid: runningAction.parentCuid,\r\n callSite: runningAction.callSite,\r\n };\r\n this._entries = [entry, ...this._entries];\r\n // Bound retention: entries are newest-first, so the oldest fall off the tail.\r\n // Grouping already renders any child whose parent is gone as its own root, so\r\n // dropping an old parent never breaks the surviving children's display.\r\n if (this._entries.length > this._maxEntries) {\r\n this._entries.length = this._maxEntries;\r\n }\r\n this._notify();\r\n } else if (type === ERunningActionUpdateType.progress) {\r\n this._updateEntry(runningAction.cuid, (e) => ({\r\n ...e,\r\n progressUpdates: [...e.progressUpdates, update.progress],\r\n }));\r\n } else if (type === ERunningActionUpdateType.finished) {\r\n this._updateEntry(runningAction.cuid, (e) => {\r\n // On success the result payload's context may carry the full routing from the handling\r\n // runtime (including backend hops) — richer than the local context, which only has this\r\n // side's outgoing hops. Prefer it *only when it's actually richer*: the optimized binary\r\n // WS session strips routing from the wire and reconstructs an empty array, so an empty\r\n // response routing must never clobber the real local hops (otherwise the entry renders as\r\n // \"call\"/\"local\" instead of \"→ ws → backend\").\r\n const responseRouting = extractRouting((update as any).response?.context);\r\n const localRouting = extractRouting(runningAction.context);\r\n const routing =\r\n responseRouting.length >= localRouting.length ? responseRouting : localRouting;\r\n const base: IDevtoolsActionEntry = {\r\n ...e,\r\n endTime: time,\r\n meta: { ...e.meta, routing },\r\n };\r\n const finishType: string = update.finishType;\r\n\r\n if (finishType === ERunningActionFinishedType.success) {\r\n const result = update.response?.result;\r\n const outputHash: string | undefined = update.response?.outputHash;\r\n if (result != null && !result.ok) {\r\n const rawError = result.error;\r\n const errorStack = rawError instanceof Error ? rawError.stack : undefined;\r\n return {\r\n ...base,\r\n status: \"action-error\",\r\n outputHash,\r\n error: serializeErrorForDisplay(rawError),\r\n errorStack,\r\n };\r\n }\r\n return { ...base, status: \"success\", output: result?.output, outputHash };\r\n }\r\n if (finishType === ERunningActionFinishedType.failed) {\r\n const rawError = (update as any).error;\r\n const errorStack = rawError instanceof Error ? rawError.stack : undefined;\r\n return {\r\n ...base,\r\n status: \"failed\",\r\n error: serializeErrorForDisplay(rawError),\r\n errorStack,\r\n };\r\n }\r\n const abortReason = update.reason;\r\n const errorStack = abortReason instanceof Error ? abortReason.stack : undefined;\r\n return {\r\n ...base,\r\n status: \"aborted\",\r\n abortReason: serializeErrorForDisplay(abortReason),\r\n errorStack,\r\n };\r\n });\r\n }\r\n });\r\n }\r\n\r\n getEntries(): readonly IDevtoolsActionEntry[] {\r\n return this._entries;\r\n }\r\n\r\n subscribe(listener: TDevtoolsListener): () => void {\r\n this._listeners.add(listener);\r\n listener(this._entries);\r\n return () => {\r\n this._listeners.delete(listener);\r\n };\r\n }\r\n\r\n clear(): void {\r\n this._entries = [];\r\n this._notify();\r\n }\r\n\r\n private _updateEntry(\r\n cuid: string,\r\n updater: (entry: IDevtoolsActionEntry) => IDevtoolsActionEntry,\r\n ): void {\r\n this._entries = this._entries.map((e) => (e.cuid === cuid ? updater(e) : e));\r\n this._notify();\r\n }\r\n\r\n private _notify(): void {\r\n const snapshot = this._entries;\r\n for (const listener of this._listeners) listener(snapshot);\r\n }\r\n}\r\n"],"mappings":";;AAiBA,SAAS,yBAAyB,OAAyB;CACzD,IACE,SAAS,QACT,OAAO,UAAU,YAChB,MAAc,SAAS,eACxB,OAAQ,MAAc,iBAAiB,YAEvC,OAAQ,MAAc,aAAa;CAErC,OAAO;AACT;AAEA,SAAS,eAAe,SAAoC;CAC1D,QAAQ,SAAS,WAAW,CAAC,EAAA,CAAG,KAAK,SAAkC;EACrE,MAAM,UAAU,KAAK;EACrB,MAAM,aAAa,SAAS,SAAS;EACrC,OAAO;GACL,SAAS;IACP,OAAO,KAAK,SAAS,SAAS;IAC9B,OAAO,KAAK,SAAS;IACrB,OAAO,KAAK,SAAS;GACvB;GACA,aAAa,aAAa,aAAa;GACvC,eACE,cAAc,QAAQ,UAAU,OAC5B;IACE,OAAO,QAAQ,OAAO,SAAS;IAC/B,OAAO,QAAQ,OAAO;IACtB,OAAO,QAAQ,OAAO;GACxB,IACA,KAAA;GACN,WAAW,aAAa,QAAQ,YAAY,KAAA;GAC5C,kBAAkB,aAAa,QAAQ,WAAW,UAAU,KAAA;GAC5D,cAAc,aAAa,QAAQ,WAAW,MAAM,KAAA;GACpD,MAAM,KAAK;EACb;CACF,CAAC;AACH;AAEA,SAAS,YAAY,SAAmC;CACtD,OAAO;EACL,aAAa,SAAS,eAAe,KAAK,IAAI;EAC9C,cAAc;GACZ,OAAO,SAAS,cAAc,SAAS;GACvC,OAAO,SAAS,cAAc;GAC9B,OAAO,SAAS,cAAc;EAChC;EACA,SAAS,eAAe,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