cogsbox-state 0.5.457 → 0.5.458
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/CogsState.d.ts +8 -3
- package/dist/CogsState.d.ts.map +1 -1
- package/dist/CogsState.jsx +70 -70
- package/dist/CogsState.jsx.map +1 -1
- package/package.json +1 -1
- package/src/CogsState.tsx +13 -10
package/package.json
CHANGED
package/src/CogsState.tsx
CHANGED
|
@@ -426,7 +426,7 @@ export type OptionsType<T extends unknown = unknown, TApiParams = never> = {
|
|
|
426
426
|
syncUpdate?: Partial<UpdateTypeDetail>;
|
|
427
427
|
|
|
428
428
|
defaultState?: T;
|
|
429
|
-
|
|
429
|
+
|
|
430
430
|
dependencies?: any[];
|
|
431
431
|
};
|
|
432
432
|
|
|
@@ -708,7 +708,9 @@ export function createCogsStateFromSync<
|
|
|
708
708
|
string,
|
|
709
709
|
{
|
|
710
710
|
schemas: { defaultValues: any };
|
|
711
|
-
|
|
711
|
+
api?: {
|
|
712
|
+
queryData?: any;
|
|
713
|
+
};
|
|
712
714
|
[key: string]: any;
|
|
713
715
|
}
|
|
714
716
|
>;
|
|
@@ -721,10 +723,12 @@ export function createCogsStateFromSync<
|
|
|
721
723
|
[K in keyof TSyncSchema['schemas']]: TSyncSchema['schemas'][K]['schemas']['defaultValues'];
|
|
722
724
|
},
|
|
723
725
|
{
|
|
724
|
-
[K in keyof TSyncSchema['schemas']]: TSyncSchema['schemas'][K]['
|
|
725
|
-
infer
|
|
726
|
-
|
|
727
|
-
? P
|
|
726
|
+
[K in keyof TSyncSchema['schemas']]: TSyncSchema['schemas'][K]['api'] extends {
|
|
727
|
+
queryData: infer Q;
|
|
728
|
+
}
|
|
729
|
+
? Q extends { _paramType: infer P }
|
|
730
|
+
? P
|
|
731
|
+
: never
|
|
728
732
|
: never;
|
|
729
733
|
}
|
|
730
734
|
> {
|
|
@@ -737,9 +741,9 @@ export function createCogsStateFromSync<
|
|
|
737
741
|
const entry = schemas[key];
|
|
738
742
|
initialState[key] = entry?.schemas?.defaultValues || {};
|
|
739
743
|
|
|
740
|
-
//
|
|
741
|
-
if (entry?.
|
|
742
|
-
apiParamsMap[key] = entry.
|
|
744
|
+
// Extract apiParams from the api.queryData._paramType
|
|
745
|
+
if (entry?.api?.queryData?._paramType) {
|
|
746
|
+
apiParamsMap[key] = entry.api.queryData._paramType;
|
|
743
747
|
}
|
|
744
748
|
}
|
|
745
749
|
|
|
@@ -750,7 +754,6 @@ export function createCogsStateFromSync<
|
|
|
750
754
|
__apiParamsMap: apiParamsMap,
|
|
751
755
|
}) as any;
|
|
752
756
|
}
|
|
753
|
-
|
|
754
757
|
const {
|
|
755
758
|
getInitialOptions,
|
|
756
759
|
getValidationErrors,
|