fetchium 0.4.0 → 0.4.1

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 (39) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/development/{QueryClient-CbG-qdpt.js → QueryClient-D_e76rYS.js} +2 -2
  3. package/dist/cjs/development/QueryClient-D_e76rYS.js.map +1 -0
  4. package/dist/cjs/development/index.js +1 -1
  5. package/dist/cjs/{production/mutation-B0wMYfHP.js → development/mutation-bq06T6Wg.js} +2 -2
  6. package/dist/cjs/{production/mutation-B0wMYfHP.js.map → development/mutation-bq06T6Wg.js.map} +1 -1
  7. package/dist/cjs/development/react/index.js +1 -1
  8. package/dist/cjs/development/rest/index.js +1 -1
  9. package/dist/cjs/development/topic/index.js +1 -1
  10. package/dist/cjs/production/{QueryClient-DGCBmyPp.js → QueryClient-BPdrfgtE.js} +2 -2
  11. package/dist/cjs/production/QueryClient-BPdrfgtE.js.map +1 -0
  12. package/dist/cjs/production/index.js +1 -1
  13. package/dist/cjs/{development/mutation-CFkoRirO.js → production/mutation-BVVlcTsK.js} +2 -2
  14. package/dist/cjs/{development/mutation-CFkoRirO.js.map → production/mutation-BVVlcTsK.js.map} +1 -1
  15. package/dist/cjs/production/react/index.js +1 -1
  16. package/dist/cjs/production/rest/index.js +1 -1
  17. package/dist/cjs/production/topic/index.js +1 -1
  18. package/dist/esm/QueryResult.d.ts.map +1 -1
  19. package/dist/esm/development/{QueryClient-BZY2FTv3.js → QueryClient-CkO_s9Uh.js} +9 -5
  20. package/dist/esm/development/QueryClient-CkO_s9Uh.js.map +1 -0
  21. package/dist/esm/development/index.js +2 -2
  22. package/dist/esm/development/{mutation-Dot2Ejg6.js → mutation-SZTEGudR.js} +2 -2
  23. package/dist/esm/development/{mutation-Dot2Ejg6.js.map → mutation-SZTEGudR.js.map} +1 -1
  24. package/dist/esm/development/react/index.js +1 -1
  25. package/dist/esm/development/rest/index.js +2 -2
  26. package/dist/esm/development/topic/index.js +1 -1
  27. package/dist/esm/production/{QueryClient-WtzRneAd.js → QueryClient--PrsE8Kj.js} +9 -5
  28. package/dist/esm/production/QueryClient--PrsE8Kj.js.map +1 -0
  29. package/dist/esm/production/index.js +2 -2
  30. package/dist/esm/production/{mutation-AXg513Dg.js → mutation-20F2qe90.js} +2 -2
  31. package/dist/esm/production/{mutation-AXg513Dg.js.map → mutation-20F2qe90.js.map} +1 -1
  32. package/dist/esm/production/react/index.js +1 -1
  33. package/dist/esm/production/rest/index.js +2 -2
  34. package/dist/esm/production/topic/index.js +1 -1
  35. package/package.json +1 -1
  36. package/dist/cjs/development/QueryClient-CbG-qdpt.js.map +0 -1
  37. package/dist/cjs/production/QueryClient-DGCBmyPp.js.map +0 -1
  38. package/dist/esm/development/QueryClient-BZY2FTv3.js.map +0 -1
  39. package/dist/esm/production/QueryClient-WtzRneAd.js.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./QueryClient-DGCBmyPp.js"),r=require("./QueryAdapter-DUo338ga.js"),t=require("./mutation-B0wMYfHP.js");exports.ARRAY_KEY=e.ARRAY_KEY;exports.Entity=e.Entity;exports.GcManager=e.GcManager;exports.LiveFieldConfig=e.LiveFieldConfig;exports.LiveFieldType=e.LiveFieldType;exports.Mask=e.Mask;exports.NetworkManager=e.NetworkManager;exports.NetworkManagerContext=e.NetworkManagerContext;exports.NetworkMode=e.NetworkMode;exports.NoOpGcManager=e.NoOpGcManager;exports.NoOpNetworkManager=e.NoOpNetworkManager;exports.QUERY_ID=e.QUERY_ID;exports.Query=e.Query;exports.QueryClient=e.QueryClient;exports.QueryClientContext=e.QueryClientContext;exports.RECORD_KEY=e.RECORD_KEY;exports.defaultNetworkManager=e.defaultNetworkManager;exports.draft=e.draft;exports.fetchQuery=e.fetchQuery;exports.queryKeyForClass=e.queryKeyForClass;exports.registerFormat=e.registerFormat;exports.t=e.t;exports.QueryAdapter=r.QueryAdapter;exports.Mutation=t.Mutation;exports.getMutation=t.getMutation;exports.mutationKeyForClass=t.mutationKeyForClass;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./QueryClient-BPdrfgtE.js"),r=require("./QueryAdapter-DUo338ga.js"),t=require("./mutation-BVVlcTsK.js");exports.ARRAY_KEY=e.ARRAY_KEY;exports.Entity=e.Entity;exports.GcManager=e.GcManager;exports.LiveFieldConfig=e.LiveFieldConfig;exports.LiveFieldType=e.LiveFieldType;exports.Mask=e.Mask;exports.NetworkManager=e.NetworkManager;exports.NetworkManagerContext=e.NetworkManagerContext;exports.NetworkMode=e.NetworkMode;exports.NoOpGcManager=e.NoOpGcManager;exports.NoOpNetworkManager=e.NoOpNetworkManager;exports.QUERY_ID=e.QUERY_ID;exports.Query=e.Query;exports.QueryClient=e.QueryClient;exports.QueryClientContext=e.QueryClientContext;exports.RECORD_KEY=e.RECORD_KEY;exports.defaultNetworkManager=e.defaultNetworkManager;exports.draft=e.draft;exports.fetchQuery=e.fetchQuery;exports.queryKeyForClass=e.queryKeyForClass;exports.registerFormat=e.registerFormat;exports.t=e.t;exports.QueryAdapter=r.QueryAdapter;exports.Mutation=t.Mutation;exports.getMutation=t.getMutation;exports.mutationKeyForClass=t.mutationKeyForClass;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const g=require("signalium"),o=require("./QueryClient-CbG-qdpt.js");class y{static adapter;params;result;optimisticUpdates;config;effects;constructor(){return o.createDefinitionProxy(this)}}const c=new WeakMap,h=t=>{const e=c.get(t);if(e===void 0)throw new Error("Mutation definition not found");return e().id};function D(t){let e=c.get(t);if(e!==void 0)return e;let n;const f=()=>{if(n!==void 0)return n;const d=new t,r=o.extractDefinition(d),{fields:i}=r,p=`mutation:${String(r.methods.getIdentityKey.call(i))}`,a=i.params??{},l=a instanceof o.ValidatorDef?a:o.t.object(a),s=i.result,m=s!==void 0?s instanceof o.ValidatorDef?s:o.t.object(s):void 0,u=t.adapter;if(!u)throw new Error(`Mutation class "${t.name}" must define a static \`adapter\` property. Extend RESTMutation (from fetchium/rest) or set \`static adapter = MyAdapter\` on your mutation class.`);return n={id:p,requestShape:l,responseShape:m,captured:r,optimisticUpdates:i.optimisticUpdates??!1,config:i.config,effects:i.effects,hasGetEffects:typeof r.methods.getEffects=="function",adapterClass:u},n};return c.set(t,f),f}function M(t){const e=D(t),n=g.getContext(o.QueryClientContext);if(n===void 0)throw new Error("QueryClient not found");return n.getMutation(e())}exports.Mutation=y;exports.getMutation=M;exports.mutationKeyForClass=h;
2
- //# sourceMappingURL=mutation-CFkoRirO.js.map
1
+ "use strict";const g=require("signalium"),o=require("./QueryClient-BPdrfgtE.js");class y{static adapter;params;result;optimisticUpdates;config;effects;constructor(){return o.createDefinitionProxy(this)}}const c=new WeakMap,h=t=>{const e=c.get(t);if(e===void 0)throw new Error("Mutation definition not found");return e().id};function D(t){let e=c.get(t);if(e!==void 0)return e;let n;const f=()=>{if(n!==void 0)return n;const d=new t,r=o.extractDefinition(d),{fields:i}=r,p=`mutation:${String(r.methods.getIdentityKey.call(i))}`,a=i.params??{},l=a instanceof o.ValidatorDef?a:o.t.object(a),s=i.result,m=s!==void 0?s instanceof o.ValidatorDef?s:o.t.object(s):void 0,u=t.adapter;if(!u)throw new Error(`Mutation class "${t.name}" must define a static \`adapter\` property. Extend RESTMutation (from fetchium/rest) or set \`static adapter = MyAdapter\` on your mutation class.`);return n={id:p,requestShape:l,responseShape:m,captured:r,optimisticUpdates:i.optimisticUpdates??!1,config:i.config,effects:i.effects,hasGetEffects:typeof r.methods.getEffects=="function",adapterClass:u},n};return c.set(t,f),f}function M(t){const e=D(t),n=g.getContext(o.QueryClientContext);if(n===void 0)throw new Error("QueryClient not found");return n.getMutation(e())}exports.Mutation=y;exports.getMutation=M;exports.mutationKeyForClass=h;
2
+ //# sourceMappingURL=mutation-BVVlcTsK.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mutation-CFkoRirO.js","sources":["../../../src/mutation.ts"],"sourcesContent":["import { getContext, ReactiveTask } from 'signalium';\nimport { ExtractType, InternalTypeDef, MutationEffects, TypeDef, RetryConfig, TypeDefShape } from './types.js';\nimport { QueryClientContext, type QueryContext } from './QueryClient.js';\nimport { ValidatorDef, t } from './typeDefs.js';\nimport { createDefinitionProxy, extractDefinition, type CapturedDefinition } from './fieldRef.js';\nimport type { QueryAdapter, QueryAdapterClass } from './QueryAdapter.js';\n\n// ================================\n// Mutation Definition Types\n// ================================\n\nexport interface MutationConfigOptions {\n retry?: RetryConfig | number | false;\n}\n\nexport interface MutationDefinition<Request, Response> {\n id: string;\n requestShape: InternalTypeDef;\n responseShape: InternalTypeDef | undefined;\n captured: CapturedDefinition<Mutation>;\n optimisticUpdates: boolean;\n config?: MutationConfigOptions;\n effects?: MutationEffects;\n hasGetEffects: boolean;\n adapterClass: QueryAdapterClass;\n}\n\n// ================================\n// Mutation base class\n// ================================\n\nexport abstract class Mutation {\n static adapter?: QueryAdapterClass;\n\n readonly params?: TypeDefShape;\n readonly result?: TypeDefShape;\n readonly optimisticUpdates?: boolean;\n readonly config?: MutationConfigOptions;\n readonly effects?: Readonly<MutationEffects>;\n\n declare context: QueryContext;\n\n abstract getIdentityKey(): unknown;\n\n getEffects?(): MutationEffects;\n\n constructor() {\n return createDefinitionProxy(this);\n }\n}\n\n// ================================\n// Mutation definition cache and lookup\n// ================================\n\nconst mutationDefCache = new WeakMap<new () => Mutation, () => MutationDefinition<any, any>>();\n\nexport const mutationKeyForClass = (cls: new () => Mutation): string => {\n const getMutationDef = mutationDefCache.get(cls);\n\n if (getMutationDef === undefined) {\n throw new Error('Mutation definition not found');\n }\n\n return getMutationDef().id;\n};\n\n// ================================\n// Internal: build mutation definition from class\n// ================================\n\nfunction buildMutationDefinition(MutationClass: new () => Mutation): () => MutationDefinition<any, any> {\n let cached = mutationDefCache.get(MutationClass);\n\n if (cached !== undefined) {\n return cached;\n }\n\n let mutationDefinition: MutationDefinition<any, any> | undefined;\n\n const getter = (): MutationDefinition<any, any> => {\n if (mutationDefinition !== undefined) {\n return mutationDefinition;\n }\n\n const instance = new MutationClass();\n const captured = extractDefinition(instance);\n const { fields } = captured;\n\n const id = `mutation:${String(captured.methods.getIdentityKey.call(fields))}`;\n\n const requestDef = fields.params ?? {};\n const requestShape = (requestDef instanceof ValidatorDef\n ? requestDef\n : t.object(requestDef)) as unknown as InternalTypeDef;\n const responseDef = fields.result;\n const responseShape =\n responseDef !== undefined\n ? ((responseDef instanceof ValidatorDef ? responseDef : t.object(responseDef)) as unknown as InternalTypeDef)\n : undefined;\n\n const adapterClass = (MutationClass as typeof Mutation).adapter;\n if (!adapterClass) {\n throw new Error(\n `Mutation class \"${MutationClass.name}\" must define a static \\`adapter\\` property. ` +\n `Extend RESTMutation (from fetchium/rest) or set \\`static adapter = MyAdapter\\` on your mutation class.`,\n );\n }\n\n mutationDefinition = {\n id,\n requestShape,\n responseShape,\n captured,\n optimisticUpdates: fields.optimisticUpdates ?? false,\n config: fields.config,\n effects: fields.effects,\n hasGetEffects: typeof captured.methods.getEffects === 'function',\n adapterClass,\n };\n\n return mutationDefinition;\n };\n\n mutationDefCache.set(MutationClass, getter);\n return getter;\n}\n\n// ================================\n// Public API\n// ================================\n\nexport function getMutation<T extends Mutation>(\n MutationClass: new () => T,\n): ReactiveTask<Readonly<ExtractType<T['result']>>, [ExtractType<T['params']>]> {\n const getMutationDef = buildMutationDefinition(MutationClass);\n\n const queryClient = getContext(QueryClientContext);\n\n if (queryClient === undefined) {\n throw new Error('QueryClient not found');\n }\n\n return queryClient.getMutation<any, any>(getMutationDef());\n}\n"],"names":["Mutation","createDefinitionProxy","mutationDefCache","mutationKeyForClass","cls","getMutationDef","buildMutationDefinition","MutationClass","cached","mutationDefinition","getter","instance","captured","extractDefinition","fields","id","requestDef","requestShape","ValidatorDef","t","responseDef","responseShape","adapterClass","getMutation","queryClient","getContext","QueryClientContext"],"mappings":"iFA+BO,MAAeA,CAAS,CA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EAAcC,EAAAA,WAAWC,oBAAkB,EAEjD,GAAIF,IAAgB,OAClB,MAAM,IAAI,MAAM,uBAAuB,EAGzC,OAAOA,EAAY,YAAsBnB,GAAgB,CAC3D"}
1
+ {"version":3,"file":"mutation-BVVlcTsK.js","sources":["../../../src/mutation.ts"],"sourcesContent":["import { getContext, ReactiveTask } from 'signalium';\nimport { ExtractType, InternalTypeDef, MutationEffects, TypeDef, RetryConfig, TypeDefShape } from './types.js';\nimport { QueryClientContext, type QueryContext } from './QueryClient.js';\nimport { ValidatorDef, t } from './typeDefs.js';\nimport { createDefinitionProxy, extractDefinition, type CapturedDefinition } from './fieldRef.js';\nimport type { QueryAdapter, QueryAdapterClass } from './QueryAdapter.js';\n\n// ================================\n// Mutation Definition Types\n// ================================\n\nexport interface MutationConfigOptions {\n retry?: RetryConfig | number | false;\n}\n\nexport interface MutationDefinition<Request, Response> {\n id: string;\n requestShape: InternalTypeDef;\n responseShape: InternalTypeDef | undefined;\n captured: CapturedDefinition<Mutation>;\n optimisticUpdates: boolean;\n config?: MutationConfigOptions;\n effects?: MutationEffects;\n hasGetEffects: boolean;\n adapterClass: QueryAdapterClass;\n}\n\n// ================================\n// Mutation base class\n// ================================\n\nexport abstract class Mutation {\n static adapter?: QueryAdapterClass;\n\n readonly params?: TypeDefShape;\n readonly result?: TypeDefShape;\n readonly optimisticUpdates?: boolean;\n readonly config?: MutationConfigOptions;\n readonly effects?: Readonly<MutationEffects>;\n\n declare context: QueryContext;\n\n abstract getIdentityKey(): unknown;\n\n getEffects?(): MutationEffects;\n\n constructor() {\n return createDefinitionProxy(this);\n }\n}\n\n// ================================\n// Mutation definition cache and lookup\n// ================================\n\nconst mutationDefCache = new WeakMap<new () => Mutation, () => MutationDefinition<any, any>>();\n\nexport const mutationKeyForClass = (cls: new () => Mutation): string => {\n const getMutationDef = mutationDefCache.get(cls);\n\n if (getMutationDef === undefined) {\n throw new Error('Mutation definition not found');\n }\n\n return getMutationDef().id;\n};\n\n// ================================\n// Internal: build mutation definition from class\n// ================================\n\nfunction buildMutationDefinition(MutationClass: new () => Mutation): () => MutationDefinition<any, any> {\n let cached = mutationDefCache.get(MutationClass);\n\n if (cached !== undefined) {\n return cached;\n }\n\n let mutationDefinition: MutationDefinition<any, any> | undefined;\n\n const getter = (): MutationDefinition<any, any> => {\n if (mutationDefinition !== undefined) {\n return mutationDefinition;\n }\n\n const instance = new MutationClass();\n const captured = extractDefinition(instance);\n const { fields } = captured;\n\n const id = `mutation:${String(captured.methods.getIdentityKey.call(fields))}`;\n\n const requestDef = fields.params ?? {};\n const requestShape = (requestDef instanceof ValidatorDef\n ? requestDef\n : t.object(requestDef)) as unknown as InternalTypeDef;\n const responseDef = fields.result;\n const responseShape =\n responseDef !== undefined\n ? ((responseDef instanceof ValidatorDef ? responseDef : t.object(responseDef)) as unknown as InternalTypeDef)\n : undefined;\n\n const adapterClass = (MutationClass as typeof Mutation).adapter;\n if (!adapterClass) {\n throw new Error(\n `Mutation class \"${MutationClass.name}\" must define a static \\`adapter\\` property. ` +\n `Extend RESTMutation (from fetchium/rest) or set \\`static adapter = MyAdapter\\` on your mutation class.`,\n );\n }\n\n mutationDefinition = {\n id,\n requestShape,\n responseShape,\n captured,\n optimisticUpdates: fields.optimisticUpdates ?? false,\n config: fields.config,\n effects: fields.effects,\n hasGetEffects: typeof captured.methods.getEffects === 'function',\n adapterClass,\n };\n\n return mutationDefinition;\n };\n\n mutationDefCache.set(MutationClass, getter);\n return getter;\n}\n\n// ================================\n// Public API\n// ================================\n\nexport function getMutation<T extends Mutation>(\n MutationClass: new () => T,\n): ReactiveTask<Readonly<ExtractType<T['result']>>, [ExtractType<T['params']>]> {\n const getMutationDef = buildMutationDefinition(MutationClass);\n\n const queryClient = getContext(QueryClientContext);\n\n if (queryClient === undefined) {\n throw new Error('QueryClient not found');\n }\n\n return queryClient.getMutation<any, any>(getMutationDef());\n}\n"],"names":["Mutation","createDefinitionProxy","mutationDefCache","mutationKeyForClass","cls","getMutationDef","buildMutationDefinition","MutationClass","cached","mutationDefinition","getter","instance","captured","extractDefinition","fields","id","requestDef","requestShape","ValidatorDef","t","responseDef","responseShape","adapterClass","getMutation","queryClient","getContext","QueryClientContext"],"mappings":"iFA+BO,MAAeA,CAAS,CAC7B,OAAO,QAEE,OACA,OACA,kBACA,OACA,QAQT,aAAc,CACZ,OAAOC,EAAAA,sBAAsB,IAAI,CACnC,CACF,CAMA,MAAMC,MAAuB,QAEhBC,EAAuBC,GAAoC,CACtE,MAAMC,EAAiBH,EAAiB,IAAIE,CAAG,EAE/C,GAAIC,IAAmB,OACrB,MAAM,IAAI,MAAM,+BAA+B,EAGjD,OAAOA,IAAiB,EAC1B,EAMA,SAASC,EAAwBC,EAAuE,CACtG,IAAIC,EAASN,EAAiB,IAAIK,CAAa,EAE/C,GAAIC,IAAW,OACb,OAAOA,EAGT,IAAIC,EAEJ,MAAMC,EAAS,IAAoC,CACjD,GAAID,IAAuB,OACzB,OAAOA,EAGT,MAAME,EAAW,IAAIJ,EACfK,EAAWC,EAAAA,kBAAkBF,CAAQ,EACrC,CAAE,OAAAG,GAAWF,EAEbG,EAAK,YAAY,OAAOH,EAAS,QAAQ,eAAe,KAAKE,CAAM,CAAC,CAAC,GAErEE,EAAaF,EAAO,QAAU,CAAA,EAC9BG,EAAgBD,aAAsBE,EAAAA,aACxCF,EACAG,EAAAA,EAAE,OAAOH,CAAU,EACjBI,EAAcN,EAAO,OACrBO,EACJD,IAAgB,OACVA,aAAuBF,EAAAA,aAAeE,EAAcD,IAAE,OAAOC,CAAW,EAC1E,OAEAE,EAAgBf,EAAkC,QACxD,GAAI,CAACe,EACH,MAAM,IAAI,MACR,mBAAmBf,EAAc,IAAI,qJAAA,EAKzC,OAAAE,EAAqB,CACnB,GAAAM,EACA,aAAAE,EACA,cAAAI,EACA,SAAAT,EACA,kBAAmBE,EAAO,mBAAqB,GAC/C,OAAQA,EAAO,OACf,QAASA,EAAO,QAChB,cAAe,OAAOF,EAAS,QAAQ,YAAe,WACtD,aAAAU,CAAA,EAGKb,CACT,EAEA,OAAAP,EAAiB,IAAIK,EAAeG,CAAM,EACnCA,CACT,CAMO,SAASa,EACdhB,EAC8E,CAC9E,MAAMF,EAAiBC,EAAwBC,CAAa,EAEtDiB,EAAcC,EAAAA,WAAWC,oBAAkB,EAEjD,GAAIF,IAAgB,OAClB,MAAM,IAAI,MAAM,uBAAuB,EAGzC,OAAOA,EAAY,YAAsBnB,GAAgB,CAC3D"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("signalium/react"),u=require("../QueryClient-DGCBmyPp.js");function c(e,...r){return t.useReactive(()=>u.fetchQuery(e,...r))}exports.useQuery=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("signalium/react"),u=require("../QueryClient-BPdrfgtE.js");function c(e,...r){return t.useReactive(()=>u.fetchQuery(e,...r))}exports.useQuery=c;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../QueryClient-DGCBmyPp.js"),q=require("../QueryAdapter-DUo338ga.js"),T=require("../mutation-B0wMYfHP.js");class f extends q.QueryAdapter{_fetch;_baseUrl;constructor(e){super(),this._fetch=e?.fetch??globalThis.fetch,this._baseUrl=e?.baseUrl}async send(e,s){return this.executeRequest(e,s)}async sendNext(e,s){const t=this.resolveFetchNext(e);if(t===void 0)throw new Error("fetchNext is not configured for this query");return this.executeRequest(e,s,t)}hasNext(e){const s=this.resolveFetchNext(e);if(s===void 0)return!1;if(s.url!==void 0&&s.url!==null)return!0;if(s.searchParams!==void 0){const t=Object.keys(s.searchParams);if(t.length===0)return!1;for(const r of t)if(s.searchParams[r]===void 0||s.searchParams[r]===null)return!1;return!0}return!1}resolveFetchNext(e){const t=(e.getFetchNext?e.getFetchNext():void 0)??e.rawFetchNext;if(t===void 0)return;const r={params:e.params??{},result:e.resultData};return{url:t.url!==void 0?i.reifyValue(t.url,r):void 0,searchParams:t.searchParams!==void 0?i.reifyValue(t.searchParams,r):void 0}}buildUrl(e,s){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//"))return e;if(e.startsWith("/")){const t=i.resolveBaseUrl(s)??i.resolveBaseUrl(this._baseUrl)??globalThis.location?.origin;if(!t)throw new Error(`RESTQueryAdapter: cannot resolve URL for path "${e}". Set \`baseUrl\` on the query/mutation, pass it to \`new RESTQueryAdapter({ baseUrl })\`, or use an absolute URL.`);return`${t}${e}`}return e}async executeRequest(e,s,t){const r=t?.url??(e.getPath?e.getPath():e.path),u=e.getMethod?e.getMethod():e.method,a=e.getSearchParams?e.getSearchParams():e.searchParams,o=t?.searchParams?{...a,...t.searchParams}:a,n=e.getBody?e.getBody():e.body,h=e.getRequestOptions?e.getRequestOptions():e.requestOptions;if(!r)throw new Error("RESTQuery requires a path. Define `path` as a field or override `getPath()`.");let l=r;if(o){const m=new URLSearchParams;for(const U in o){const c=o[U];c!=null&&m.append(U,String(c))}const v=m.toString();v&&(l+="?"+v)}const p=h?.baseUrl??e.baseUrl,d=this.buildUrl(l,p),{baseUrl:g,signal:P,...R}=h??{},S=n||e.headers?{...n?{"Content-Type":"application/json"}:void 0,...e.headers}:void 0,b=await this._fetch(d,{method:u,headers:S,body:n?JSON.stringify(n):void 0,signal:s,...R});return e.response=b,e.responseNotifier.notify(),b.json()}async sendMutation(e,s){const t=e,r=t.getPath?t.getPath():t.path,u=t.getMethod?t.getMethod():t.method,a=t.getBody?t.getBody():t.body,o=t.getRequestOptions?t.getRequestOptions():t.requestOptions;if(!r)throw new Error("RESTMutation requires a path. Define `path` as a field or override `getPath()`.");const n=o?.baseUrl??t.baseUrl,h=this.buildUrl(r,n),{baseUrl:l,signal:p,...d}=o??{},g={...a!==void 0?{"Content-Type":"application/json"}:{},...t.headers};return(await this._fetch(h,{method:u,headers:g,...a!==void 0?{body:JSON.stringify(a)}:{},signal:s,...d})).json()}}class O extends i.Query{static adapter=f;method="GET";path;baseUrl;searchParams;body;headers;requestOptions;fetchNext;getIdentityKey(){return`${this.method??"GET"}:${this.path??""}`}}class E extends T.Mutation{static adapter=f;path;baseUrl;method="POST";body;headers;requestOptions;getIdentityKey(){return`${this.method??"POST"}:${this.path??""}`}}exports.RESTMutation=E;exports.RESTQuery=O;exports.RESTQueryAdapter=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../QueryClient-BPdrfgtE.js"),q=require("../QueryAdapter-DUo338ga.js"),T=require("../mutation-BVVlcTsK.js");class f extends q.QueryAdapter{_fetch;_baseUrl;constructor(e){super(),this._fetch=e?.fetch??globalThis.fetch,this._baseUrl=e?.baseUrl}async send(e,s){return this.executeRequest(e,s)}async sendNext(e,s){const t=this.resolveFetchNext(e);if(t===void 0)throw new Error("fetchNext is not configured for this query");return this.executeRequest(e,s,t)}hasNext(e){const s=this.resolveFetchNext(e);if(s===void 0)return!1;if(s.url!==void 0&&s.url!==null)return!0;if(s.searchParams!==void 0){const t=Object.keys(s.searchParams);if(t.length===0)return!1;for(const r of t)if(s.searchParams[r]===void 0||s.searchParams[r]===null)return!1;return!0}return!1}resolveFetchNext(e){const t=(e.getFetchNext?e.getFetchNext():void 0)??e.rawFetchNext;if(t===void 0)return;const r={params:e.params??{},result:e.resultData};return{url:t.url!==void 0?i.reifyValue(t.url,r):void 0,searchParams:t.searchParams!==void 0?i.reifyValue(t.searchParams,r):void 0}}buildUrl(e,s){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//"))return e;if(e.startsWith("/")){const t=i.resolveBaseUrl(s)??i.resolveBaseUrl(this._baseUrl)??globalThis.location?.origin;if(!t)throw new Error(`RESTQueryAdapter: cannot resolve URL for path "${e}". Set \`baseUrl\` on the query/mutation, pass it to \`new RESTQueryAdapter({ baseUrl })\`, or use an absolute URL.`);return`${t}${e}`}return e}async executeRequest(e,s,t){const r=t?.url??(e.getPath?e.getPath():e.path),u=e.getMethod?e.getMethod():e.method,a=e.getSearchParams?e.getSearchParams():e.searchParams,o=t?.searchParams?{...a,...t.searchParams}:a,n=e.getBody?e.getBody():e.body,h=e.getRequestOptions?e.getRequestOptions():e.requestOptions;if(!r)throw new Error("RESTQuery requires a path. Define `path` as a field or override `getPath()`.");let l=r;if(o){const m=new URLSearchParams;for(const U in o){const c=o[U];c!=null&&m.append(U,String(c))}const v=m.toString();v&&(l+="?"+v)}const p=h?.baseUrl??e.baseUrl,d=this.buildUrl(l,p),{baseUrl:g,signal:P,...R}=h??{},S=n||e.headers?{...n?{"Content-Type":"application/json"}:void 0,...e.headers}:void 0,b=await this._fetch(d,{method:u,headers:S,body:n?JSON.stringify(n):void 0,signal:s,...R});return e.response=b,e.responseNotifier.notify(),b.json()}async sendMutation(e,s){const t=e,r=t.getPath?t.getPath():t.path,u=t.getMethod?t.getMethod():t.method,a=t.getBody?t.getBody():t.body,o=t.getRequestOptions?t.getRequestOptions():t.requestOptions;if(!r)throw new Error("RESTMutation requires a path. Define `path` as a field or override `getPath()`.");const n=o?.baseUrl??t.baseUrl,h=this.buildUrl(r,n),{baseUrl:l,signal:p,...d}=o??{},g={...a!==void 0?{"Content-Type":"application/json"}:{},...t.headers};return(await this._fetch(h,{method:u,headers:g,...a!==void 0?{body:JSON.stringify(a)}:{},signal:s,...d})).json()}}class O extends i.Query{static adapter=f;method="GET";path;baseUrl;searchParams;body;headers;requestOptions;fetchNext;getIdentityKey(){return`${this.method??"GET"}:${this.path??""}`}}class E extends T.Mutation{static adapter=f;path;baseUrl;method="POST";body;headers;requestOptions;getIdentityKey(){return`${this.method??"POST"}:${this.path??""}`}}exports.RESTMutation=E;exports.RESTQuery=O;exports.RESTQueryAdapter=f;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../QueryClient-DGCBmyPp.js"),h=require("../QueryAdapter-DUo338ga.js");class p extends h.QueryAdapter{_topics=new Map;fulfillTopic(e,s){const t=this._topics.get(e);if(t===void 0){this._topics.set(e,{status:"fulfilled",data:s});return}t.status==="pending"&&(t.status="fulfilled",t.data=s,t.resolve(s))}rejectTopic(e,s){const t=this._topics.get(e);if(t===void 0){this._topics.set(e,{status:"rejected",error:s});return}t.status==="pending"&&(t.status="rejected",t.error=s,t.reject(s))}clearTopic(e){this._topics.delete(e)}clearAll(){this._topics.clear()}async send(e,s){const t=e;t._topicAdapter=this;const r=t.topic,i=this._topics.get(r);if(i)switch(i.status){case"fulfilled":return i.data;case"rejected":throw i.error;case"pending":return i.promise}let c,o;const n=new Promise((u,l)=>{c=u,o=l});return this._topics.set(r,{status:"pending",promise:n,resolve:c,reject:o}),this.subscribe(r),n}sendMutationEvent(e){this.queryClient.applyMutationEvent(e)}}class f extends d.Query{static adapter=p;getIdentityKey(){return`topic:${this.topic}`}getConfig(){return{staleTime:0,subscribe:()=>()=>{this._topicAdapter?.unsubscribe(this.topic)}}}}exports.TopicQuery=f;exports.TopicQueryAdapter=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../QueryClient-BPdrfgtE.js"),h=require("../QueryAdapter-DUo338ga.js");class p extends h.QueryAdapter{_topics=new Map;fulfillTopic(e,s){const t=this._topics.get(e);if(t===void 0){this._topics.set(e,{status:"fulfilled",data:s});return}t.status==="pending"&&(t.status="fulfilled",t.data=s,t.resolve(s))}rejectTopic(e,s){const t=this._topics.get(e);if(t===void 0){this._topics.set(e,{status:"rejected",error:s});return}t.status==="pending"&&(t.status="rejected",t.error=s,t.reject(s))}clearTopic(e){this._topics.delete(e)}clearAll(){this._topics.clear()}async send(e,s){const t=e;t._topicAdapter=this;const r=t.topic,i=this._topics.get(r);if(i)switch(i.status){case"fulfilled":return i.data;case"rejected":throw i.error;case"pending":return i.promise}let c,o;const n=new Promise((u,l)=>{c=u,o=l});return this._topics.set(r,{status:"pending",promise:n,resolve:c,reject:o}),this.subscribe(r),n}sendMutationEvent(e){this.queryClient.applyMutationEvent(e)}}class f extends d.Query{static adapter=p;getIdentityKey(){return`topic:${this.topic}`}getConfig(){return{staleTime:0,subscribe:()=>()=>{this._topicAdapter?.unsubscribe(this.topic)}}}}exports.TopicQuery=f;exports.TopicQueryAdapter=p;
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QueryResult.d.ts","sourceRoot":"","sources":["../../src/QueryResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,eAAe,EAAuB,MAAM,WAAW,CAAC;AACzG,OAAO,EAAe,KAAK,WAAW,EAAkB,MAAM,YAAY,CAAC;AAC3E,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EAIxB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,mBAAmB,EAAsB,MAAM,YAAY,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIrD;;;GAGG;AACH,qBAAa,aAAa,CAAC,CAAC,SAAS,KAAK;IACxC,GAAG,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAM;IAExB,+DAA+D;IAC/D,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhD,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,SAAS,CAAiC;IAClD,OAAO,CAAC,MAAM,CAAsC;IAEpD,OAAO,CAAC,WAAW,CAAC,CAAyB;IAC7C,OAAO,CAAC,eAAe,CAA8C;IAErE,OAAO,CAAC,WAAW,CAAqD;IACxE,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,aAAa,CAAsC;I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ient.getAdapter(t.statics.adapterClass), r = this._abortController?.signal ?? new AbortController().signal;
1640
1640
  return dt(
1641
1641
  async () => {
1642
- const s = await i.send(n, r);
1643
- this.updatedAt = Date.now();
1644
- const o = this.applyData(s, !0);
1645
- return this.saveQueryMetadata(), this.reconcileSubscription(), o;
1642
+ try {
1643
+ const s = await i.send(n, r);
1644
+ this.updatedAt = Date.now();
1645
+ const o = this.applyData(s, !0);
1646
+ return this.saveQueryMetadata(), o;
1647
+ } finally {
1648
+ this.reconcileSubscription();
1649
+ }
1646
1650
  },
1647
1651
  this.retryConfig,
1648
1652
  r
@@ -2622,4 +2626,4 @@ export {
2622
2626
  ne as r,
2623
2627
  sn as t
2624
2628
  };
2625
- //# sourceMappingURL=QueryClient-BZY2FTv3.js.map
2629
+ //# sourceMappingURL=QueryClient-CkO_s9Uh.js.map