@swell/apps-sdk 1.0.146 → 1.0.147
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 +33 -15
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +33 -15
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +33 -15
- package/dist/index.mjs.map +2 -2
- package/dist/src/resources.d.ts +11 -7
- package/package.json +1 -1
package/dist/src/resources.d.ts
CHANGED
|
@@ -35,19 +35,20 @@ export declare class StorefrontResource<T extends SwellData = SwellData> {
|
|
|
35
35
|
* and then `_compatibilityProps` requests a property from `StorefrontResource` via a deferred handler.
|
|
36
36
|
*/
|
|
37
37
|
export declare function cloneStorefrontResource<T extends SwellData = SwellData>(input: StorefrontResource<T>): StorefrontResource<T>;
|
|
38
|
+
interface StorefrontResourceFetcher<T extends SwellData = SwellRecord> {
|
|
39
|
+
get: (id?: string, query?: SwellData) => Promise<InferSwellCollection<T> | null>;
|
|
40
|
+
list: (query?: SwellData) => Promise<T extends SwellCollection ? T : SwellCollection<T>>;
|
|
41
|
+
}
|
|
38
42
|
export declare class SwellStorefrontResource<T extends SwellData = SwellData> extends StorefrontResource<T> {
|
|
39
43
|
_swell: Swell;
|
|
40
|
-
_resource
|
|
44
|
+
_resource?: StorefrontResourceFetcher<T>;
|
|
41
45
|
_resourceName: string;
|
|
42
46
|
readonly _collection: string;
|
|
43
47
|
_query: SwellData;
|
|
44
48
|
_compatibilityInstance: ShopifyCompatibility | null;
|
|
45
49
|
constructor(swell: Swell, collection: string, getter?: StorefrontResourceGetter<T>);
|
|
46
50
|
_getProxy(): SwellStorefrontResource<T>;
|
|
47
|
-
getResourceObject():
|
|
48
|
-
get: (id?: string, query?: SwellData) => Promise<InferSwellCollection<T> | null>;
|
|
49
|
-
list: (query?: SwellData) => Promise<T extends SwellCollection ? T : SwellCollection<T>>;
|
|
50
|
-
};
|
|
51
|
+
getResourceObject(): StorefrontResourceFetcher<T>;
|
|
51
52
|
}
|
|
52
53
|
export declare class SwellStorefrontCollection<T extends SwellCollection<SwellData> = SwellCollection<SwellData>> extends SwellStorefrontResource<T> {
|
|
53
54
|
length: number;
|
|
@@ -63,8 +64,10 @@ export declare class SwellStorefrontCollection<T extends SwellCollection<SwellDa
|
|
|
63
64
|
_initQuery(query: SwellData): SwellData;
|
|
64
65
|
_defaultGetter(): StorefrontResourceGetter<T>;
|
|
65
66
|
_get(query?: SwellData): Promise<T | null | undefined>;
|
|
66
|
-
|
|
67
|
-
iterator(): ArrayIterator<InferSwellCollection<T
|
|
67
|
+
get size(): Promise<number> | number;
|
|
68
|
+
[Symbol.iterator](): ArrayIterator<InferSwellCollection<T>> | Promise<ArrayIterator<InferSwellCollection<T>>>;
|
|
69
|
+
iterator(): ArrayIterator<InferSwellCollection<T>> | Promise<ArrayIterator<InferSwellCollection<T>>>;
|
|
70
|
+
private makeIterator;
|
|
68
71
|
_clone(newProps?: SwellData): SwellStorefrontCollection<T>;
|
|
69
72
|
_cloneWithCompatibilityResult<R extends SwellCollection<SwellData> = SwellCollection<SwellData>>(compatibilityGetter: (result: T) => R): SwellStorefrontCollection<R>;
|
|
70
73
|
}
|
|
@@ -108,3 +111,4 @@ export declare class SwellStorefrontPagination<T extends SwellCollection = Swell
|
|
|
108
111
|
getPageUrl(page: number): string;
|
|
109
112
|
setCompatibilityProps(props: SwellData): void;
|
|
110
113
|
}
|
|
114
|
+
export {};
|