@hf-chimera/adapters-shared 0.2.4 → 0.2.5

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/index.cjs CHANGED
@@ -33,14 +33,16 @@ const CHIMERA_ITEM_UPDATE_EVENTS = [
33
33
 
34
34
  //#endregion
35
35
  //#region params.ts
36
- const isQueryBuilder = (params) => "isChimeraQueryBuilder" in params && params.isChimeraQueryBuilder;
36
+ const isQueryBuilder = (params) => params != null && "isChimeraQueryBuilder" in params && params.isChimeraQueryBuilder;
37
37
  const normalizeParams = (createQueryBuilder, params) => {
38
38
  if (isQueryBuilder(params)) return params.build();
39
39
  if (typeof params === "function") {
40
40
  if (!createQueryBuilder) throw new Error("Query builder creator function provided but no query builder factory was supplied. Either pass a query builder factory as the second argument to createChimeraStoreHooks/createChimeraStoreComposables, or install the official @hf-chimera/query-builder package and use 'createDefaultQueryBuilder'. Alternatively, use plain ChimeraCollectionParams instead of a creator function.");
41
41
  const q = createQueryBuilder();
42
- return (params(q) ?? q).build();
42
+ const result = params(q) ?? q;
43
+ return isQueryBuilder(result) ? result.build() : result;
43
44
  }
45
+ if (params == null) return {};
44
46
  return params;
45
47
  };
46
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../events.ts","../params.ts"],"sourcesContent":["import type {\n\tAnyChimeraCollectionQuery,\n\tAnyChimeraEntityStore,\n\tAnyChimeraItemQuery,\n\tChimeraEventEmitterEventNames,\n} from \"@hf-chimera/store\";\n\nexport const CHIMERA_ENTITY_STORE_UPDATE_EVENTS = [\n\t\"initialized\",\n\t\"updated\",\n\t\"itemAdded\",\n\t\"itemUpdated\",\n\t\"deleted\",\n\t\"itemDeleted\",\n] as const satisfies ChimeraEventEmitterEventNames<AnyChimeraEntityStore>[];\n\nexport const CHIMERA_COLLECTION_UPDATE_EVENTS = [\n\t\"ready\",\n\t\"updated\",\n\t\"selfUpdated\",\n\t\"selfItemCreated\",\n\t\"itemAdded\",\n\t\"itemUpdated\",\n\t\"selfItemUpdated\",\n\t\"itemDeleted\",\n\t\"selfItemDeleted\",\n\t\"error\",\n] as const satisfies ChimeraEventEmitterEventNames<AnyChimeraCollectionQuery>[];\n\nexport const CHIMERA_ITEM_UPDATE_EVENTS = [\n\t\"initialized\",\n\t\"selfCreated\",\n\t\"ready\",\n\t\"updated\",\n\t\"selfUpdated\",\n\t\"deleted\",\n\t\"selfDeleted\",\n\t\"error\",\n] as const satisfies ChimeraEventEmitterEventNames<AnyChimeraItemQuery>[];\n","import type {\n\tAnyChimeraEntityStore,\n\tChimeraCollectionParams,\n\tChimeraEntityStoreEntity,\n\tChimeraEntityStoreOperatorsMap,\n} from \"@hf-chimera/store\";\n\n// Minimal query builder interface that adapters expect\n// This allows using any query builder implementation (including custom ones)\n// The official implementation is available in @hf-chimera/query-builder\nexport interface ChimeraQueryBuilder<TStore extends AnyChimeraEntityStore> {\n\tisChimeraQueryBuilder: true;\n\tbuild(): ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, any>;\n}\n\nexport type QueryBuilderCreator<\n\tTStore extends AnyChimeraEntityStore,\n\tTQueryBuilder extends ChimeraQueryBuilder<TStore> = ChimeraQueryBuilder<TStore>,\n> = (qb: TQueryBuilder) => TQueryBuilder | undefined;\n\nexport type AnyChimeraParams<\n\tTStore extends AnyChimeraEntityStore,\n\tTMeta = any,\n\tTQueryBuilder extends ChimeraQueryBuilder<TStore> = ChimeraQueryBuilder<TStore>,\n> =\n\t| ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta>\n\t| QueryBuilderCreator<TStore, TQueryBuilder>\n\t| ChimeraQueryBuilder<TStore>;\n\nconst isQueryBuilder = <TStore extends AnyChimeraEntityStore, Meta = any>(\n\tparams: AnyChimeraParams<TStore, Meta>,\n): params is ChimeraQueryBuilder<TStore> => \"isChimeraQueryBuilder\" in params && params.isChimeraQueryBuilder;\n\nexport const normalizeParams = <TStore extends AnyChimeraEntityStore, TMeta = any>(\n\tcreateQueryBuilder: (() => ChimeraQueryBuilder<TStore>) | undefined,\n\tparams: AnyChimeraParams<TStore, TMeta>,\n): ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta> => {\n\tif (isQueryBuilder(params)) return params.build();\n\tif (typeof params === \"function\") {\n\t\tif (!createQueryBuilder) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Query builder creator function provided but no query builder factory was supplied. \" +\n\t\t\t\t\t\"Either pass a query builder factory as the second argument to createChimeraStoreHooks/createChimeraStoreComposables, \" +\n\t\t\t\t\t\"or install the official @hf-chimera/query-builder package and use 'createDefaultQueryBuilder'. \" +\n\t\t\t\t\t\"Alternatively, use plain ChimeraCollectionParams instead of a creator function.\",\n\t\t\t);\n\t\t}\n\t\tconst q = createQueryBuilder();\n\t\treturn (params(q) ?? q).build();\n\t}\n\treturn params;\n};\n"],"mappings":";;AAOA,MAAa,qCAAqC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;AAED,MAAa,mCAAmC;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAED,MAAa,6BAA6B;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;ACTD,MAAM,kBACL,WAC2C,2BAA2B,UAAU,OAAO;AAExF,MAAa,mBACZ,oBACA,WAC8G;AAC9G,KAAI,eAAe,OAAO,CAAE,QAAO,OAAO,OAAO;AACjD,KAAI,OAAO,WAAW,YAAY;AACjC,MAAI,CAAC,mBACJ,OAAM,IAAI,MACT,yXAIA;EAEF,MAAM,IAAI,oBAAoB;AAC9B,UAAQ,OAAO,EAAE,IAAI,GAAG,OAAO;;AAEhC,QAAO"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../events.ts","../params.ts"],"sourcesContent":["import type {\n\tAnyChimeraCollectionQuery,\n\tAnyChimeraEntityStore,\n\tAnyChimeraItemQuery,\n\tChimeraEventEmitterEventNames,\n} from \"@hf-chimera/store\";\n\nexport const CHIMERA_ENTITY_STORE_UPDATE_EVENTS = [\n\t\"initialized\",\n\t\"updated\",\n\t\"itemAdded\",\n\t\"itemUpdated\",\n\t\"deleted\",\n\t\"itemDeleted\",\n] as const satisfies ChimeraEventEmitterEventNames<AnyChimeraEntityStore>[];\n\nexport const CHIMERA_COLLECTION_UPDATE_EVENTS = [\n\t\"ready\",\n\t\"updated\",\n\t\"selfUpdated\",\n\t\"selfItemCreated\",\n\t\"itemAdded\",\n\t\"itemUpdated\",\n\t\"selfItemUpdated\",\n\t\"itemDeleted\",\n\t\"selfItemDeleted\",\n\t\"error\",\n] as const satisfies ChimeraEventEmitterEventNames<AnyChimeraCollectionQuery>[];\n\nexport const CHIMERA_ITEM_UPDATE_EVENTS = [\n\t\"initialized\",\n\t\"selfCreated\",\n\t\"ready\",\n\t\"updated\",\n\t\"selfUpdated\",\n\t\"deleted\",\n\t\"selfDeleted\",\n\t\"error\",\n] as const satisfies ChimeraEventEmitterEventNames<AnyChimeraItemQuery>[];\n","import type {\n\tAnyChimeraEntityStore,\n\tChimeraCollectionParams,\n\tChimeraEntityStoreEntity,\n\tChimeraEntityStoreOperatorsMap,\n} from \"@hf-chimera/store\";\n\n// Minimal query builder interface that adapters expect\n// This allows using any query builder implementation (including custom ones)\n// The official implementation is available in @hf-chimera/query-builder\nexport interface ChimeraQueryBuilder<TStore extends AnyChimeraEntityStore> {\n\tisChimeraQueryBuilder: true;\n\tbuild(): ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, any>;\n}\n\nexport type QueryBuilderCreator<\n\tTStore extends AnyChimeraEntityStore,\n\tTQueryBuilder extends ChimeraQueryBuilder<TStore> = ChimeraQueryBuilder<TStore>,\n> = (qb: TQueryBuilder) => TQueryBuilder | void;\n\nexport type AnyChimeraParams<\n\tTStore extends AnyChimeraEntityStore,\n\tTMeta = any,\n\tTQueryBuilder extends ChimeraQueryBuilder<TStore> = ChimeraQueryBuilder<TStore>,\n> =\n\t| ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta>\n\t| QueryBuilderCreator<TStore, TQueryBuilder>\n\t| ChimeraQueryBuilder<TStore>\n\t| (() => ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta>)\n\t| undefined\n\t| null\n\nconst isQueryBuilder = <TStore extends AnyChimeraEntityStore, Meta = any>(\n\tparams: AnyChimeraParams<TStore, Meta>,\n): params is ChimeraQueryBuilder<TStore> => params != null && \"isChimeraQueryBuilder\" in params && params.isChimeraQueryBuilder;\n\nexport const normalizeParams = <TStore extends AnyChimeraEntityStore, TMeta = any>(\n\tcreateQueryBuilder: (() => ChimeraQueryBuilder<TStore>) | undefined,\n\tparams: AnyChimeraParams<TStore, TMeta>,\n): ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta> => {\n\tif (isQueryBuilder(params)) return params.build();\n\tif (typeof params === \"function\") {\n\t\tif (!createQueryBuilder) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Query builder creator function provided but no query builder factory was supplied. \" +\n\t\t\t\t\t\"Either pass a query builder factory as the second argument to createChimeraStoreHooks/createChimeraStoreComposables, \" +\n\t\t\t\t\t\"or install the official @hf-chimera/query-builder package and use 'createDefaultQueryBuilder'. \" +\n\t\t\t\t\t\"Alternatively, use plain ChimeraCollectionParams instead of a creator function.\",\n\t\t\t);\n\t\t}\n\t\tconst q = createQueryBuilder();\n\t\tconst result = (params(q) ?? q)\n\t\treturn isQueryBuilder(result) ? result.build() : result;\n\t}\n\tif (params == null) return {};\n\treturn params;\n};\n"],"mappings":";;AAOA,MAAa,qCAAqC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;AAED,MAAa,mCAAmC;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAED,MAAa,6BAA6B;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;ACND,MAAM,kBACL,WAC2C,UAAU,QAAQ,2BAA2B,UAAU,OAAO;AAE1G,MAAa,mBACZ,oBACA,WAC8G;AAC9G,KAAI,eAAe,OAAO,CAAE,QAAO,OAAO,OAAO;AACjD,KAAI,OAAO,WAAW,YAAY;AACjC,MAAI,CAAC,mBACJ,OAAM,IAAI,MACT,yXAIA;EAEF,MAAM,IAAI,oBAAoB;EAC9B,MAAM,SAAU,OAAO,EAAE,IAAI;AAC7B,SAAO,eAAe,OAAO,GAAG,OAAO,OAAO,GAAG;;AAElD,KAAI,UAAU,KAAM,QAAO,EAAE;AAC7B,QAAO"}
package/dist/index.d.cts CHANGED
@@ -10,8 +10,8 @@ interface ChimeraQueryBuilder<TStore extends AnyChimeraEntityStore> {
10
10
  isChimeraQueryBuilder: true;
11
11
  build(): ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, any>;
12
12
  }
13
- type QueryBuilderCreator<TStore extends AnyChimeraEntityStore, TQueryBuilder extends ChimeraQueryBuilder<TStore> = ChimeraQueryBuilder<TStore>> = (qb: TQueryBuilder) => TQueryBuilder | undefined;
14
- type AnyChimeraParams<TStore extends AnyChimeraEntityStore, TMeta = any, TQueryBuilder extends ChimeraQueryBuilder<TStore> = ChimeraQueryBuilder<TStore>> = ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta> | QueryBuilderCreator<TStore, TQueryBuilder> | ChimeraQueryBuilder<TStore>;
13
+ type QueryBuilderCreator<TStore extends AnyChimeraEntityStore, TQueryBuilder extends ChimeraQueryBuilder<TStore> = ChimeraQueryBuilder<TStore>> = (qb: TQueryBuilder) => TQueryBuilder | void;
14
+ type AnyChimeraParams<TStore extends AnyChimeraEntityStore, TMeta = any, TQueryBuilder extends ChimeraQueryBuilder<TStore> = ChimeraQueryBuilder<TStore>> = ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta> | QueryBuilderCreator<TStore, TQueryBuilder> | ChimeraQueryBuilder<TStore> | (() => ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta>) | undefined | null;
15
15
  declare const normalizeParams: <TStore extends AnyChimeraEntityStore, TMeta = any>(createQueryBuilder: (() => ChimeraQueryBuilder<TStore>) | undefined, params: AnyChimeraParams<TStore, TMeta>) => ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta>;
16
16
  //#endregion
17
17
  export { AnyChimeraParams, CHIMERA_COLLECTION_UPDATE_EVENTS, CHIMERA_ENTITY_STORE_UPDATE_EVENTS, CHIMERA_ITEM_UPDATE_EVENTS, ChimeraQueryBuilder, QueryBuilderCreator, normalizeParams };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../events.ts","../params.ts"],"sourcesContent":[],"mappings":";;;cAOa;cASA;cAaA;;;UCnBI,mCAAmC;;EDHvC,KAAA,EAAA,ECKH,uBDLG,CCKqB,8BDEyC,CCFV,MDEU,CAAA,ECFD,wBDEC,CCFwB,MDExB,CAAA,EAAA,GAAA,CAAA;AAE3E;AAaa,KCdD,mBDcC,CAAA,eCbG,qBDsByD,EAAA,sBCrBlD,mBDqBkD,CCrB9B,MDqB8B,CAAA,GCrBpB,mBDqBoB,CCrBA,MDqBA,CAAA,CAAA,GAAA,CAAA,EAAA,ECpBhE,aDoBgE,EAAA,GCpB9C,aDoB8C,GAAA,SAAA;KClB7D,gCACI,0DAEO,oBAAoB,UAAU,oBAAoB,WAEtE,wBAAwB,+BAA+B,SAAS,yBAAyB,SAAS,SAClG,oBAAoB,QAAQ,iBAC5B,oBAAoB;cAMV,iCAAkC,+DACnB,oBAAoB,8BACvC,iBAAiB,QAAQ,WAC/B,wBAAwB,+BAA+B,SAAS,yBAAyB,SAAS"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../events.ts","../params.ts"],"sourcesContent":[],"mappings":";;;cAOa;cASA;cAaA;;;UCnBI,mCAAmC;;EDHvC,KAAA,EAAA,ECKH,uBDLG,CCKqB,8BDEyC,CCFV,MDEU,CAAA,ECFD,wBDEC,CCFwB,MDExB,CAAA,EAAA,GAAA,CAAA;AAE3E;AAaa,KCdD,mBDcC,CAAA,eCbG,qBDsByD,EAAA,sBCrBlD,mBDqBkD,CCrB9B,MDqB8B,CAAA,GCrBpB,mBDqBoB,CCrBA,MDqBA,CAAA,CAAA,GAAA,CAAA,EAAA,ECpBhE,aDoBgE,EAAA,GCpB9C,aDoB8C,GAAA,IAAA;KClB7D,gCACI,0DAEO,oBAAoB,UAAU,oBAAoB,WAEtE,wBAAwB,+BAA+B,SAAS,yBAAyB,SAAS,SAClG,oBAAoB,QAAQ,iBAC5B,oBAAoB,iBACb,wBAAwB,+BAA+B,SAAS,yBAAyB,SAAS;cAQ/F,iCAAkC,+DACnB,oBAAoB,8BACvC,iBAAiB,QAAQ,WAC/B,wBAAwB,+BAA+B,SAAS,yBAAyB,SAAS"}
package/dist/index.d.mts CHANGED
@@ -10,8 +10,8 @@ interface ChimeraQueryBuilder<TStore extends AnyChimeraEntityStore> {
10
10
  isChimeraQueryBuilder: true;
11
11
  build(): ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, any>;
12
12
  }
13
- type QueryBuilderCreator<TStore extends AnyChimeraEntityStore, TQueryBuilder extends ChimeraQueryBuilder<TStore> = ChimeraQueryBuilder<TStore>> = (qb: TQueryBuilder) => TQueryBuilder | undefined;
14
- type AnyChimeraParams<TStore extends AnyChimeraEntityStore, TMeta = any, TQueryBuilder extends ChimeraQueryBuilder<TStore> = ChimeraQueryBuilder<TStore>> = ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta> | QueryBuilderCreator<TStore, TQueryBuilder> | ChimeraQueryBuilder<TStore>;
13
+ type QueryBuilderCreator<TStore extends AnyChimeraEntityStore, TQueryBuilder extends ChimeraQueryBuilder<TStore> = ChimeraQueryBuilder<TStore>> = (qb: TQueryBuilder) => TQueryBuilder | void;
14
+ type AnyChimeraParams<TStore extends AnyChimeraEntityStore, TMeta = any, TQueryBuilder extends ChimeraQueryBuilder<TStore> = ChimeraQueryBuilder<TStore>> = ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta> | QueryBuilderCreator<TStore, TQueryBuilder> | ChimeraQueryBuilder<TStore> | (() => ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta>) | undefined | null;
15
15
  declare const normalizeParams: <TStore extends AnyChimeraEntityStore, TMeta = any>(createQueryBuilder: (() => ChimeraQueryBuilder<TStore>) | undefined, params: AnyChimeraParams<TStore, TMeta>) => ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta>;
16
16
  //#endregion
17
17
  export { AnyChimeraParams, CHIMERA_COLLECTION_UPDATE_EVENTS, CHIMERA_ENTITY_STORE_UPDATE_EVENTS, CHIMERA_ITEM_UPDATE_EVENTS, ChimeraQueryBuilder, QueryBuilderCreator, normalizeParams };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../events.ts","../params.ts"],"sourcesContent":[],"mappings":";;;cAOa;cASA;cAaA;;;UCnBI,mCAAmC;;EDHvC,KAAA,EAAA,ECKH,uBDLG,CCKqB,8BDEyC,CCFV,MDEU,CAAA,ECFD,wBDEC,CCFwB,MDExB,CAAA,EAAA,GAAA,CAAA;AAE3E;AAaa,KCdD,mBDcC,CAAA,eCbG,qBDsByD,EAAA,sBCrBlD,mBDqBkD,CCrB9B,MDqB8B,CAAA,GCrBpB,mBDqBoB,CCrBA,MDqBA,CAAA,CAAA,GAAA,CAAA,EAAA,ECpBhE,aDoBgE,EAAA,GCpB9C,aDoB8C,GAAA,SAAA;KClB7D,gCACI,0DAEO,oBAAoB,UAAU,oBAAoB,WAEtE,wBAAwB,+BAA+B,SAAS,yBAAyB,SAAS,SAClG,oBAAoB,QAAQ,iBAC5B,oBAAoB;cAMV,iCAAkC,+DACnB,oBAAoB,8BACvC,iBAAiB,QAAQ,WAC/B,wBAAwB,+BAA+B,SAAS,yBAAyB,SAAS"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../events.ts","../params.ts"],"sourcesContent":[],"mappings":";;;cAOa;cASA;cAaA;;;UCnBI,mCAAmC;;EDHvC,KAAA,EAAA,ECKH,uBDLG,CCKqB,8BDEyC,CCFV,MDEU,CAAA,ECFD,wBDEC,CCFwB,MDExB,CAAA,EAAA,GAAA,CAAA;AAE3E;AAaa,KCdD,mBDcC,CAAA,eCbG,qBDsByD,EAAA,sBCrBlD,mBDqBkD,CCrB9B,MDqB8B,CAAA,GCrBpB,mBDqBoB,CCrBA,MDqBA,CAAA,CAAA,GAAA,CAAA,EAAA,ECpBhE,aDoBgE,EAAA,GCpB9C,aDoB8C,GAAA,IAAA;KClB7D,gCACI,0DAEO,oBAAoB,UAAU,oBAAoB,WAEtE,wBAAwB,+BAA+B,SAAS,yBAAyB,SAAS,SAClG,oBAAoB,QAAQ,iBAC5B,oBAAoB,iBACb,wBAAwB,+BAA+B,SAAS,yBAAyB,SAAS;cAQ/F,iCAAkC,+DACnB,oBAAoB,8BACvC,iBAAiB,QAAQ,WAC/B,wBAAwB,+BAA+B,SAAS,yBAAyB,SAAS"}
package/dist/index.mjs CHANGED
@@ -32,14 +32,16 @@ const CHIMERA_ITEM_UPDATE_EVENTS = [
32
32
 
33
33
  //#endregion
34
34
  //#region params.ts
35
- const isQueryBuilder = (params) => "isChimeraQueryBuilder" in params && params.isChimeraQueryBuilder;
35
+ const isQueryBuilder = (params) => params != null && "isChimeraQueryBuilder" in params && params.isChimeraQueryBuilder;
36
36
  const normalizeParams = (createQueryBuilder, params) => {
37
37
  if (isQueryBuilder(params)) return params.build();
38
38
  if (typeof params === "function") {
39
39
  if (!createQueryBuilder) throw new Error("Query builder creator function provided but no query builder factory was supplied. Either pass a query builder factory as the second argument to createChimeraStoreHooks/createChimeraStoreComposables, or install the official @hf-chimera/query-builder package and use 'createDefaultQueryBuilder'. Alternatively, use plain ChimeraCollectionParams instead of a creator function.");
40
40
  const q = createQueryBuilder();
41
- return (params(q) ?? q).build();
41
+ const result = params(q) ?? q;
42
+ return isQueryBuilder(result) ? result.build() : result;
42
43
  }
44
+ if (params == null) return {};
43
45
  return params;
44
46
  };
45
47
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../events.ts","../params.ts"],"sourcesContent":["import type {\n\tAnyChimeraCollectionQuery,\n\tAnyChimeraEntityStore,\n\tAnyChimeraItemQuery,\n\tChimeraEventEmitterEventNames,\n} from \"@hf-chimera/store\";\n\nexport const CHIMERA_ENTITY_STORE_UPDATE_EVENTS = [\n\t\"initialized\",\n\t\"updated\",\n\t\"itemAdded\",\n\t\"itemUpdated\",\n\t\"deleted\",\n\t\"itemDeleted\",\n] as const satisfies ChimeraEventEmitterEventNames<AnyChimeraEntityStore>[];\n\nexport const CHIMERA_COLLECTION_UPDATE_EVENTS = [\n\t\"ready\",\n\t\"updated\",\n\t\"selfUpdated\",\n\t\"selfItemCreated\",\n\t\"itemAdded\",\n\t\"itemUpdated\",\n\t\"selfItemUpdated\",\n\t\"itemDeleted\",\n\t\"selfItemDeleted\",\n\t\"error\",\n] as const satisfies ChimeraEventEmitterEventNames<AnyChimeraCollectionQuery>[];\n\nexport const CHIMERA_ITEM_UPDATE_EVENTS = [\n\t\"initialized\",\n\t\"selfCreated\",\n\t\"ready\",\n\t\"updated\",\n\t\"selfUpdated\",\n\t\"deleted\",\n\t\"selfDeleted\",\n\t\"error\",\n] as const satisfies ChimeraEventEmitterEventNames<AnyChimeraItemQuery>[];\n","import type {\n\tAnyChimeraEntityStore,\n\tChimeraCollectionParams,\n\tChimeraEntityStoreEntity,\n\tChimeraEntityStoreOperatorsMap,\n} from \"@hf-chimera/store\";\n\n// Minimal query builder interface that adapters expect\n// This allows using any query builder implementation (including custom ones)\n// The official implementation is available in @hf-chimera/query-builder\nexport interface ChimeraQueryBuilder<TStore extends AnyChimeraEntityStore> {\n\tisChimeraQueryBuilder: true;\n\tbuild(): ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, any>;\n}\n\nexport type QueryBuilderCreator<\n\tTStore extends AnyChimeraEntityStore,\n\tTQueryBuilder extends ChimeraQueryBuilder<TStore> = ChimeraQueryBuilder<TStore>,\n> = (qb: TQueryBuilder) => TQueryBuilder | undefined;\n\nexport type AnyChimeraParams<\n\tTStore extends AnyChimeraEntityStore,\n\tTMeta = any,\n\tTQueryBuilder extends ChimeraQueryBuilder<TStore> = ChimeraQueryBuilder<TStore>,\n> =\n\t| ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta>\n\t| QueryBuilderCreator<TStore, TQueryBuilder>\n\t| ChimeraQueryBuilder<TStore>;\n\nconst isQueryBuilder = <TStore extends AnyChimeraEntityStore, Meta = any>(\n\tparams: AnyChimeraParams<TStore, Meta>,\n): params is ChimeraQueryBuilder<TStore> => \"isChimeraQueryBuilder\" in params && params.isChimeraQueryBuilder;\n\nexport const normalizeParams = <TStore extends AnyChimeraEntityStore, TMeta = any>(\n\tcreateQueryBuilder: (() => ChimeraQueryBuilder<TStore>) | undefined,\n\tparams: AnyChimeraParams<TStore, TMeta>,\n): ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta> => {\n\tif (isQueryBuilder(params)) return params.build();\n\tif (typeof params === \"function\") {\n\t\tif (!createQueryBuilder) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Query builder creator function provided but no query builder factory was supplied. \" +\n\t\t\t\t\t\"Either pass a query builder factory as the second argument to createChimeraStoreHooks/createChimeraStoreComposables, \" +\n\t\t\t\t\t\"or install the official @hf-chimera/query-builder package and use 'createDefaultQueryBuilder'. \" +\n\t\t\t\t\t\"Alternatively, use plain ChimeraCollectionParams instead of a creator function.\",\n\t\t\t);\n\t\t}\n\t\tconst q = createQueryBuilder();\n\t\treturn (params(q) ?? q).build();\n\t}\n\treturn params;\n};\n"],"mappings":";AAOA,MAAa,qCAAqC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;AAED,MAAa,mCAAmC;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAED,MAAa,6BAA6B;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;ACTD,MAAM,kBACL,WAC2C,2BAA2B,UAAU,OAAO;AAExF,MAAa,mBACZ,oBACA,WAC8G;AAC9G,KAAI,eAAe,OAAO,CAAE,QAAO,OAAO,OAAO;AACjD,KAAI,OAAO,WAAW,YAAY;AACjC,MAAI,CAAC,mBACJ,OAAM,IAAI,MACT,yXAIA;EAEF,MAAM,IAAI,oBAAoB;AAC9B,UAAQ,OAAO,EAAE,IAAI,GAAG,OAAO;;AAEhC,QAAO"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../events.ts","../params.ts"],"sourcesContent":["import type {\n\tAnyChimeraCollectionQuery,\n\tAnyChimeraEntityStore,\n\tAnyChimeraItemQuery,\n\tChimeraEventEmitterEventNames,\n} from \"@hf-chimera/store\";\n\nexport const CHIMERA_ENTITY_STORE_UPDATE_EVENTS = [\n\t\"initialized\",\n\t\"updated\",\n\t\"itemAdded\",\n\t\"itemUpdated\",\n\t\"deleted\",\n\t\"itemDeleted\",\n] as const satisfies ChimeraEventEmitterEventNames<AnyChimeraEntityStore>[];\n\nexport const CHIMERA_COLLECTION_UPDATE_EVENTS = [\n\t\"ready\",\n\t\"updated\",\n\t\"selfUpdated\",\n\t\"selfItemCreated\",\n\t\"itemAdded\",\n\t\"itemUpdated\",\n\t\"selfItemUpdated\",\n\t\"itemDeleted\",\n\t\"selfItemDeleted\",\n\t\"error\",\n] as const satisfies ChimeraEventEmitterEventNames<AnyChimeraCollectionQuery>[];\n\nexport const CHIMERA_ITEM_UPDATE_EVENTS = [\n\t\"initialized\",\n\t\"selfCreated\",\n\t\"ready\",\n\t\"updated\",\n\t\"selfUpdated\",\n\t\"deleted\",\n\t\"selfDeleted\",\n\t\"error\",\n] as const satisfies ChimeraEventEmitterEventNames<AnyChimeraItemQuery>[];\n","import type {\n\tAnyChimeraEntityStore,\n\tChimeraCollectionParams,\n\tChimeraEntityStoreEntity,\n\tChimeraEntityStoreOperatorsMap,\n} from \"@hf-chimera/store\";\n\n// Minimal query builder interface that adapters expect\n// This allows using any query builder implementation (including custom ones)\n// The official implementation is available in @hf-chimera/query-builder\nexport interface ChimeraQueryBuilder<TStore extends AnyChimeraEntityStore> {\n\tisChimeraQueryBuilder: true;\n\tbuild(): ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, any>;\n}\n\nexport type QueryBuilderCreator<\n\tTStore extends AnyChimeraEntityStore,\n\tTQueryBuilder extends ChimeraQueryBuilder<TStore> = ChimeraQueryBuilder<TStore>,\n> = (qb: TQueryBuilder) => TQueryBuilder | void;\n\nexport type AnyChimeraParams<\n\tTStore extends AnyChimeraEntityStore,\n\tTMeta = any,\n\tTQueryBuilder extends ChimeraQueryBuilder<TStore> = ChimeraQueryBuilder<TStore>,\n> =\n\t| ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta>\n\t| QueryBuilderCreator<TStore, TQueryBuilder>\n\t| ChimeraQueryBuilder<TStore>\n\t| (() => ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta>)\n\t| undefined\n\t| null\n\nconst isQueryBuilder = <TStore extends AnyChimeraEntityStore, Meta = any>(\n\tparams: AnyChimeraParams<TStore, Meta>,\n): params is ChimeraQueryBuilder<TStore> => params != null && \"isChimeraQueryBuilder\" in params && params.isChimeraQueryBuilder;\n\nexport const normalizeParams = <TStore extends AnyChimeraEntityStore, TMeta = any>(\n\tcreateQueryBuilder: (() => ChimeraQueryBuilder<TStore>) | undefined,\n\tparams: AnyChimeraParams<TStore, TMeta>,\n): ChimeraCollectionParams<ChimeraEntityStoreOperatorsMap<TStore>, ChimeraEntityStoreEntity<TStore>, TMeta> => {\n\tif (isQueryBuilder(params)) return params.build();\n\tif (typeof params === \"function\") {\n\t\tif (!createQueryBuilder) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Query builder creator function provided but no query builder factory was supplied. \" +\n\t\t\t\t\t\"Either pass a query builder factory as the second argument to createChimeraStoreHooks/createChimeraStoreComposables, \" +\n\t\t\t\t\t\"or install the official @hf-chimera/query-builder package and use 'createDefaultQueryBuilder'. \" +\n\t\t\t\t\t\"Alternatively, use plain ChimeraCollectionParams instead of a creator function.\",\n\t\t\t);\n\t\t}\n\t\tconst q = createQueryBuilder();\n\t\tconst result = (params(q) ?? q)\n\t\treturn isQueryBuilder(result) ? result.build() : result;\n\t}\n\tif (params == null) return {};\n\treturn params;\n};\n"],"mappings":";AAOA,MAAa,qCAAqC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;AAED,MAAa,mCAAmC;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAED,MAAa,6BAA6B;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;ACND,MAAM,kBACL,WAC2C,UAAU,QAAQ,2BAA2B,UAAU,OAAO;AAE1G,MAAa,mBACZ,oBACA,WAC8G;AAC9G,KAAI,eAAe,OAAO,CAAE,QAAO,OAAO,OAAO;AACjD,KAAI,OAAO,WAAW,YAAY;AACjC,MAAI,CAAC,mBACJ,OAAM,IAAI,MACT,yXAIA;EAEF,MAAM,IAAI,oBAAoB;EAC9B,MAAM,SAAU,OAAO,EAAE,IAAI;AAC7B,SAAO,eAAe,OAAO,GAAG,OAAO,OAAO,GAAG;;AAElD,KAAI,UAAU,KAAM,QAAO,EAAE;AAC7B,QAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hf-chimera/adapters-shared",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Cross-end reactivity API - Shared adapter utilities",
5
5
  "license": "MIT",
6
6
  "author": "hewston",