@lustre/sdk 2.0.0-dev.1 → 2.0.0-dev.3
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.
|
@@ -11,14 +11,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.prepareEntity = void 0;
|
|
13
13
|
const fetchEntity_1 = require("./fetchEntity");
|
|
14
|
-
const prepareEntity = (name,
|
|
15
|
-
return Object.assign({ queryKey: [name,
|
|
14
|
+
const prepareEntity = (name, id, options = {}) => {
|
|
15
|
+
return Object.assign({ queryKey: [name, id && [id]], queryFn: ({ queryKey: [name, idList] }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
16
|
const id = idList && idList[0];
|
|
17
17
|
if (id === undefined) {
|
|
18
18
|
throw new Error("Entity id is undefined");
|
|
19
19
|
}
|
|
20
20
|
return fetchEntity_1.fetchEntity(name, id, options);
|
|
21
|
-
}), enabled:
|
|
21
|
+
}), enabled: id !== undefined }, options);
|
|
22
22
|
};
|
|
23
23
|
exports.prepareEntity = prepareEntity;
|
|
24
24
|
//# sourceMappingURL=prepareEntity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareEntity.js","sourceRoot":"","sources":["../../src/api/prepareEntity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,+CAA+C;AAWxC,MAAM,aAAa,GAAG,CAC3B,IAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"prepareEntity.js","sourceRoot":"","sources":["../../src/api/prepareEntity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,+CAA+C;AAWxC,MAAM,aAAa,GAAG,CAC3B,IAAiB,EACjB,EAAqC,EACrC,UAAgC,EAAE,EACZ,EAAE;IACxB,uBACE,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,EAC5B,OAAO,EAAE,CAAO,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE;YAC9C,MAAM,EAAE,GAAG,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,CAAA;YAC9B,IAAI,EAAE,KAAK,SAAS,EAAE;gBACpB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;aAC1C;YACD,OAAO,yBAAW,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;QACvC,CAAC,CAAA,EACD,OAAO,EAAE,EAAE,KAAK,SAAS,IACtB,OAAO,EACX;AACH,CAAC,CAAA;AAjBY,QAAA,aAAa,iBAiBzB"}
|
package/package.json
CHANGED
|
@@ -4,5 +4,5 @@ import { FetchQueryOptions } from "./fetchQuery";
|
|
|
4
4
|
import { QueryError } from "./QueryError";
|
|
5
5
|
export interface Options<TEntityName extends EntityName> extends UseQueryOptions<EntityResult<TEntityName>, QueryError, EntityResult<TEntityName>, EntityKey<TEntityName>>, FetchQueryOptions {
|
|
6
6
|
}
|
|
7
|
-
export declare const prepareEntity: <TEntityName extends keyof import("..").ApiEntities>(name: TEntityName,
|
|
7
|
+
export declare const prepareEntity: <TEntityName extends keyof import("..").ApiEntities>(name: TEntityName, id: EntityId<TEntityName> | undefined, options?: Options<TEntityName>) => Options<TEntityName>;
|
|
8
8
|
//# sourceMappingURL=prepareEntity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareEntity.d.ts","sourceRoot":"","sources":["../../src/api/prepareEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,qBAAwB;AAChF,OAAO,EAAE,iBAAiB,EAAE,qBAAwB;AACpD,OAAO,EAAE,UAAU,EAAE,qBAAwB;AAG7C,MAAM,WAAW,OAAO,CAAC,WAAW,SAAS,UAAU,CACrD,SAAQ,eAAe,CACnB,YAAY,CAAC,WAAW,CAAC,EACzB,UAAU,EACV,YAAY,CAAC,WAAW,CAAC,EACzB,SAAS,CAAC,WAAW,CAAC,CACvB,EACD,iBAAiB;CAAG;AAExB,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"prepareEntity.d.ts","sourceRoot":"","sources":["../../src/api/prepareEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,qBAAwB;AAChF,OAAO,EAAE,iBAAiB,EAAE,qBAAwB;AACpD,OAAO,EAAE,UAAU,EAAE,qBAAwB;AAG7C,MAAM,WAAW,OAAO,CAAC,WAAW,SAAS,UAAU,CACrD,SAAQ,eAAe,CACnB,YAAY,CAAC,WAAW,CAAC,EACzB,UAAU,EACV,YAAY,CAAC,WAAW,CAAC,EACzB,SAAS,CAAC,WAAW,CAAC,CACvB,EACD,iBAAiB;CAAG;AAExB,eAAO,MAAM,aAAa,wKAiBzB,CAAA"}
|