@legendapp/state 3.0.0-beta.11 → 3.0.0-beta.12
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/package.json
CHANGED
package/sync-plugins/crud.d.mts
CHANGED
|
@@ -5,11 +5,13 @@ type CrudAsOption = 'Map' | 'object' | 'value' | 'array';
|
|
|
5
5
|
type CrudResult<T> = T;
|
|
6
6
|
interface SyncedCrudPropsSingle<TRemote extends object, TLocal> {
|
|
7
7
|
get?: (params: SyncedGetParams<TRemote>) => Promise<CrudResult<TRemote | null>> | CrudResult<TRemote | null>;
|
|
8
|
+
list?: never | undefined;
|
|
8
9
|
initial?: InitialValue<TLocal, 'value'>;
|
|
9
10
|
as?: never | 'value';
|
|
10
11
|
}
|
|
11
12
|
interface SyncedCrudPropsMany<TRemote extends object, TLocal, TAsOption extends CrudAsOption> {
|
|
12
13
|
list?: (params: SyncedGetParams<TRemote>) => Promise<CrudResult<TRemote[] | null>> | CrudResult<TRemote[] | null>;
|
|
14
|
+
get?: never | undefined;
|
|
13
15
|
as?: TAsOption;
|
|
14
16
|
initial?: InitialValue<TLocal, TAsOption>;
|
|
15
17
|
}
|
|
@@ -45,7 +47,8 @@ type SyncedCrudReturnType<TLocal, TAsOption extends CrudAsOption> = TAsOption ex
|
|
|
45
47
|
} ? number : string, TLocal> : TAsOption extends 'object' ? Record<TLocal extends {
|
|
46
48
|
id: number;
|
|
47
49
|
} ? number : string, TLocal> : TAsOption extends 'value' ? TLocal : TLocal[];
|
|
48
|
-
declare function syncedCrud<TRemote extends object, TLocal = TRemote>(props:
|
|
49
|
-
declare function syncedCrud<TRemote extends object, TLocal = TRemote, TAsOption extends CrudAsOption = 'object'>(props:
|
|
50
|
+
declare function syncedCrud<TRemote extends object, TLocal = TRemote>(props: SyncedCrudPropsSingle<TRemote, TLocal> & SyncedCrudPropsBase<TRemote, TLocal>): SyncedCrudReturnType<TLocal, 'value'>;
|
|
51
|
+
declare function syncedCrud<TRemote extends object, TLocal = TRemote, TAsOption extends CrudAsOption = 'object'>(props: SyncedCrudPropsMany<TRemote, TLocal, TAsOption> & SyncedCrudPropsBase<TRemote, TLocal>): SyncedCrudReturnType<TLocal, Exclude<TAsOption, 'value'>>;
|
|
52
|
+
declare function syncedCrud<TRemote extends object, TLocal = TRemote, TAsOption extends CrudAsOption = 'object'>(props: (SyncedCrudPropsSingle<TRemote, TLocal> | SyncedCrudPropsMany<TRemote, TLocal, TAsOption>) & SyncedCrudPropsBase<TRemote, TLocal>): SyncedCrudReturnType<TLocal, TAsOption>;
|
|
50
53
|
|
|
51
54
|
export { type CrudAsOption, type CrudResult, type SyncedCrudOnSavedParams, type SyncedCrudPropsBase, type SyncedCrudPropsMany, type SyncedCrudPropsSingle, type SyncedCrudReturnType, type WaitForSetCrudFnParams, syncedCrud };
|
package/sync-plugins/crud.d.ts
CHANGED
|
@@ -5,11 +5,13 @@ type CrudAsOption = 'Map' | 'object' | 'value' | 'array';
|
|
|
5
5
|
type CrudResult<T> = T;
|
|
6
6
|
interface SyncedCrudPropsSingle<TRemote extends object, TLocal> {
|
|
7
7
|
get?: (params: SyncedGetParams<TRemote>) => Promise<CrudResult<TRemote | null>> | CrudResult<TRemote | null>;
|
|
8
|
+
list?: never | undefined;
|
|
8
9
|
initial?: InitialValue<TLocal, 'value'>;
|
|
9
10
|
as?: never | 'value';
|
|
10
11
|
}
|
|
11
12
|
interface SyncedCrudPropsMany<TRemote extends object, TLocal, TAsOption extends CrudAsOption> {
|
|
12
13
|
list?: (params: SyncedGetParams<TRemote>) => Promise<CrudResult<TRemote[] | null>> | CrudResult<TRemote[] | null>;
|
|
14
|
+
get?: never | undefined;
|
|
13
15
|
as?: TAsOption;
|
|
14
16
|
initial?: InitialValue<TLocal, TAsOption>;
|
|
15
17
|
}
|
|
@@ -45,7 +47,8 @@ type SyncedCrudReturnType<TLocal, TAsOption extends CrudAsOption> = TAsOption ex
|
|
|
45
47
|
} ? number : string, TLocal> : TAsOption extends 'object' ? Record<TLocal extends {
|
|
46
48
|
id: number;
|
|
47
49
|
} ? number : string, TLocal> : TAsOption extends 'value' ? TLocal : TLocal[];
|
|
48
|
-
declare function syncedCrud<TRemote extends object, TLocal = TRemote>(props:
|
|
49
|
-
declare function syncedCrud<TRemote extends object, TLocal = TRemote, TAsOption extends CrudAsOption = 'object'>(props:
|
|
50
|
+
declare function syncedCrud<TRemote extends object, TLocal = TRemote>(props: SyncedCrudPropsSingle<TRemote, TLocal> & SyncedCrudPropsBase<TRemote, TLocal>): SyncedCrudReturnType<TLocal, 'value'>;
|
|
51
|
+
declare function syncedCrud<TRemote extends object, TLocal = TRemote, TAsOption extends CrudAsOption = 'object'>(props: SyncedCrudPropsMany<TRemote, TLocal, TAsOption> & SyncedCrudPropsBase<TRemote, TLocal>): SyncedCrudReturnType<TLocal, Exclude<TAsOption, 'value'>>;
|
|
52
|
+
declare function syncedCrud<TRemote extends object, TLocal = TRemote, TAsOption extends CrudAsOption = 'object'>(props: (SyncedCrudPropsSingle<TRemote, TLocal> | SyncedCrudPropsMany<TRemote, TLocal, TAsOption>) & SyncedCrudPropsBase<TRemote, TLocal>): SyncedCrudReturnType<TLocal, TAsOption>;
|
|
50
53
|
|
|
51
54
|
export { type CrudAsOption, type CrudResult, type SyncedCrudOnSavedParams, type SyncedCrudPropsBase, type SyncedCrudPropsMany, type SyncedCrudPropsSingle, type SyncedCrudReturnType, type WaitForSetCrudFnParams, syncedCrud };
|
package/sync-plugins/keel.js
CHANGED
|
@@ -274,6 +274,7 @@ function syncedKeel(props) {
|
|
|
274
274
|
} : subscribeParam;
|
|
275
275
|
return crud.syncedCrud({
|
|
276
276
|
...rest,
|
|
277
|
+
// Workaround for type errors
|
|
277
278
|
as: asType,
|
|
278
279
|
mode: mode || "merge",
|
|
279
280
|
list,
|
|
@@ -299,7 +300,6 @@ function syncedKeel(props) {
|
|
|
299
300
|
updatePartial: true,
|
|
300
301
|
subscribe,
|
|
301
302
|
generateId: generateKeelId,
|
|
302
|
-
// @ts-expect-error This errors because of the get/list union type
|
|
303
303
|
get
|
|
304
304
|
});
|
|
305
305
|
}
|
package/sync-plugins/keel.mjs
CHANGED
|
@@ -268,6 +268,7 @@ function syncedKeel(props) {
|
|
|
268
268
|
} : subscribeParam;
|
|
269
269
|
return syncedCrud({
|
|
270
270
|
...rest,
|
|
271
|
+
// Workaround for type errors
|
|
271
272
|
as: asType,
|
|
272
273
|
mode: mode || "merge",
|
|
273
274
|
list,
|
|
@@ -293,7 +294,6 @@ function syncedKeel(props) {
|
|
|
293
294
|
updatePartial: true,
|
|
294
295
|
subscribe,
|
|
295
296
|
generateId: generateKeelId,
|
|
296
|
-
// @ts-expect-error This errors because of the get/list union type
|
|
297
297
|
get
|
|
298
298
|
});
|
|
299
299
|
}
|