@swell/apps-sdk 1.0.149 → 1.0.151
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 +1101 -446
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +1079 -446
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +1090 -446
- package/dist/index.mjs.map +4 -4
- package/dist/src/cache/constants.d.ts +7 -0
- package/dist/src/cache/index.d.ts +4 -0
- package/dist/src/cache/kv-variety.d.ts +10 -0
- package/dist/src/cache/theme-file-storage.d.ts +88 -0
- package/dist/src/cache/worker-cache-proxy.d.ts +31 -0
- package/dist/src/compatibility/drops/all_products.d.ts +1 -1
- package/dist/src/compatibility/drops/articles.d.ts +1 -1
- package/dist/src/compatibility/drops/blogs.d.ts +1 -1
- package/dist/src/compatibility/drops/collections.d.ts +2 -3
- package/dist/src/compatibility/drops/images.d.ts +1 -1
- package/dist/src/compatibility/drops/pages.d.ts +2 -3
- package/dist/src/compatibility/shopify-objects/collections.d.ts +2 -2
- package/dist/src/content.d.ts +3 -3
- package/dist/src/liquid/filters/shopify/default_pagination.d.ts +1 -1
- package/dist/src/resources/account.d.ts +4 -4
- package/dist/src/resources/addresses.d.ts +7 -0
- package/dist/src/resources/blog.d.ts +5 -4
- package/dist/src/resources/blog_category.d.ts +5 -4
- package/dist/src/resources/cart.d.ts +4 -4
- package/dist/src/resources/categories.d.ts +7 -0
- package/dist/src/resources/category.d.ts +5 -4
- package/dist/src/resources/index.d.ts +18 -9
- package/dist/src/resources/order.d.ts +5 -4
- package/dist/src/resources/orders.d.ts +7 -0
- package/dist/src/resources/page.d.ts +5 -4
- package/dist/src/resources/predictive_search.d.ts +6 -0
- package/dist/src/resources/product.d.ts +5 -19
- package/dist/src/resources/product_helpers.d.ts +12 -2
- package/dist/src/resources/product_recommendations.d.ts +6 -0
- package/dist/src/resources/search.d.ts +6 -0
- package/dist/src/resources/subscription.d.ts +7 -0
- package/dist/src/resources/subscriptions.d.ts +7 -0
- package/dist/src/resources/swell_types.d.ts +66 -9
- package/dist/src/resources/variant.d.ts +8 -8
- package/dist/src/resources.d.ts +11 -12
- package/dist/src/theme/theme-loader.d.ts +36 -44
- package/dist/src/theme.d.ts +22 -7
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/kv-flavor.d.ts +7 -0
- package/dist/types/cloudflare.d.ts +14 -3
- package/dist/types/shopify.d.ts +2 -2
- package/dist/types/swell.d.ts +3 -1
- package/package.json +1 -1
package/dist/src/resources.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Swell } from './api';
|
|
2
2
|
import type { ShopifyCompatibility } from './compatibility/shopify';
|
|
3
|
-
import type { SwellData, SwellRecord, SwellCollection, InferSwellCollection, SwellCollectionPages, StorefrontResourceGetter, StorefrontCollectionGetter } from '../types/swell';
|
|
3
|
+
import type { SwellData, SwellRecord, SwellCollection, InferSwellCollection, SwellCollectionPages, StorefrontResourceGetter, StorefrontCollectionGetter, StorefrontSingletonGetter, StorefrontRecordGetter } from '../types/swell';
|
|
4
4
|
export declare const MAX_QUERY_PAGE_LIMIT = 100;
|
|
5
5
|
export declare const DEFAULT_QUERY_PAGE_LIMIT = 15;
|
|
6
6
|
export declare class StorefrontResource<T extends SwellData = SwellData> {
|
|
@@ -12,7 +12,6 @@ export declare class StorefrontResource<T extends SwellData = SwellData> {
|
|
|
12
12
|
constructor(getter?: StorefrontResourceGetter<T>);
|
|
13
13
|
_getProxy(): StorefrontResource<T>;
|
|
14
14
|
_getCollectionResultOrProp(instance: StorefrontResource<T>, prop: string | number): unknown;
|
|
15
|
-
_transformResult(result?: T | null): T | null | undefined;
|
|
16
15
|
_get(..._args: unknown[]): Promise<T | null | undefined>;
|
|
17
16
|
_setGetter(getter: StorefrontResourceGetter<T>): void;
|
|
18
17
|
_resolve(): Promise<T | null>;
|
|
@@ -50,9 +49,9 @@ export declare class SwellStorefrontResource<T extends SwellData = SwellData> ex
|
|
|
50
49
|
_getProxy(): SwellStorefrontResource<T>;
|
|
51
50
|
getResourceObject(): StorefrontResourceFetcher<T>;
|
|
52
51
|
}
|
|
53
|
-
export declare class SwellStorefrontCollection<T extends
|
|
52
|
+
export declare class SwellStorefrontCollection<T extends SwellData = SwellData> extends SwellStorefrontResource<SwellCollection<T>> {
|
|
54
53
|
length: number;
|
|
55
|
-
results?:
|
|
54
|
+
results?: T[];
|
|
56
55
|
count?: number;
|
|
57
56
|
page?: number;
|
|
58
57
|
pages?: SwellCollectionPages;
|
|
@@ -62,30 +61,30 @@ export declare class SwellStorefrontCollection<T extends SwellCollection<SwellDa
|
|
|
62
61
|
constructor(swell: Swell, collection: string, query?: SwellData, getter?: StorefrontCollectionGetter<T>);
|
|
63
62
|
_getProxy(): SwellStorefrontCollection<T>;
|
|
64
63
|
_initQuery(query: SwellData): SwellData;
|
|
65
|
-
_defaultGetter(): StorefrontResourceGetter<T
|
|
66
|
-
_get(query?: SwellData): Promise<T | null | undefined>;
|
|
64
|
+
_defaultGetter(): StorefrontResourceGetter<SwellCollection<T>>;
|
|
65
|
+
_get(query?: SwellData): Promise<SwellCollection<T> | null | undefined>;
|
|
67
66
|
get size(): Promise<number> | number;
|
|
68
|
-
[Symbol.iterator](): ArrayIterator<
|
|
69
|
-
iterator(): ArrayIterator<
|
|
67
|
+
[Symbol.iterator](): ArrayIterator<T> | Promise<ArrayIterator<T>>;
|
|
68
|
+
iterator(): ArrayIterator<T> | Promise<ArrayIterator<T>>;
|
|
70
69
|
private makeIterator;
|
|
71
70
|
_clone(newProps?: SwellData): SwellStorefrontCollection<T>;
|
|
72
|
-
_cloneWithCompatibilityResult<R extends
|
|
71
|
+
_cloneWithCompatibilityResult<R extends SwellData = SwellData>(compatibilityGetter: (result: SwellCollection<T>) => SwellCollection<R>): SwellStorefrontCollection<R>;
|
|
73
72
|
}
|
|
74
73
|
export declare class SwellStorefrontRecord<T extends SwellData = SwellRecord> extends SwellStorefrontResource<T> {
|
|
75
74
|
_id: string;
|
|
76
75
|
_params: SwellData;
|
|
77
|
-
constructor(swell: Swell, collection: string, id: string, query?: SwellData, getter?:
|
|
76
|
+
constructor(swell: Swell, collection: string, id: string, query?: SwellData, getter?: StorefrontRecordGetter<T>);
|
|
78
77
|
_getProxy(): SwellStorefrontRecord<T>;
|
|
79
78
|
_defaultGetter(): StorefrontResourceGetter<T>;
|
|
80
79
|
_get(id: string, query?: SwellData): Promise<T | null | undefined>;
|
|
81
80
|
}
|
|
82
81
|
export declare class SwellStorefrontSingleton<T extends SwellData = SwellData> extends SwellStorefrontResource<T> {
|
|
83
|
-
constructor(swell: Swell, collection: string, getter?:
|
|
82
|
+
constructor(swell: Swell, collection: string, getter?: StorefrontSingletonGetter<T>);
|
|
84
83
|
_getProxy(): SwellStorefrontSingleton<T>;
|
|
85
84
|
_defaultGetter(): StorefrontResourceGetter<T>;
|
|
86
85
|
_get(): Promise<T | null | undefined>;
|
|
87
86
|
}
|
|
88
|
-
export declare class SwellStorefrontPagination<T extends
|
|
87
|
+
export declare class SwellStorefrontPagination<T extends SwellData = SwellData> {
|
|
89
88
|
_resource: SwellStorefrontCollection<T>;
|
|
90
89
|
count: number;
|
|
91
90
|
page: number;
|
|
@@ -1,80 +1,72 @@
|
|
|
1
|
-
import { ThemeCache } from '../cache';
|
|
2
1
|
import type { Swell } from '@/api';
|
|
2
|
+
import type { PutFilesResult } from '../cache';
|
|
3
3
|
import type { SwellThemeConfig, SwellThemePreload } from 'types/swell';
|
|
4
4
|
/**
|
|
5
|
-
* Responsible for loading
|
|
5
|
+
* Responsible for loading and managing theme configurations.
|
|
6
|
+
* Uses a single batch loading strategy for optimal performance.
|
|
6
7
|
*/
|
|
7
8
|
export declare class ThemeLoader {
|
|
8
|
-
private static cache;
|
|
9
9
|
private swell;
|
|
10
|
-
private manifest;
|
|
11
10
|
private configs;
|
|
12
|
-
private configPaths;
|
|
13
11
|
constructor(swell: Swell);
|
|
14
|
-
init(themeConfigs?: Map<string, SwellThemeConfig>): Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
* Loads theme configs for this version.
|
|
17
|
-
*/
|
|
18
|
-
loadTheme(): Promise<SwellThemeConfig[]>;
|
|
19
|
-
/**
|
|
20
|
-
* Returns the cache instance for this theme loader.
|
|
21
|
-
*/
|
|
22
|
-
getCache(): ThemeCache;
|
|
23
12
|
/**
|
|
24
|
-
*
|
|
13
|
+
* Initialize the theme loader with all configurations.
|
|
14
|
+
* Either uses provided configs (editor mode) or loads from storage.
|
|
25
15
|
*/
|
|
26
|
-
|
|
16
|
+
init(themeConfigs?: Map<string, SwellThemeConfig>): Promise<void>;
|
|
27
17
|
/**
|
|
28
|
-
*
|
|
18
|
+
* Get a single config by file path (synchronous).
|
|
19
|
+
* Returns null if config not found.
|
|
29
20
|
*/
|
|
30
|
-
|
|
21
|
+
getConfig(filePath: string): SwellThemeConfig | null;
|
|
31
22
|
/**
|
|
32
|
-
*
|
|
23
|
+
* Get all loaded configs.
|
|
24
|
+
* Used by theme getter to expose configs to editor/tests.
|
|
33
25
|
*/
|
|
34
|
-
|
|
35
|
-
fetchThemeConfigsByPath(pathPrefix: string, pathSuffix?: string): Promise<SwellThemeConfig[]>;
|
|
26
|
+
getConfigs(): Map<string, SwellThemeConfig>;
|
|
36
27
|
/**
|
|
37
|
-
*
|
|
28
|
+
* Get multiple configs by path pattern (synchronous).
|
|
29
|
+
* Filters configs by prefix and optional suffix.
|
|
38
30
|
*/
|
|
39
|
-
|
|
31
|
+
getConfigsByPath(pathPrefix: string, pathSuffix?: string): SwellThemeConfig[];
|
|
40
32
|
/**
|
|
41
|
-
* Load theme configs
|
|
42
|
-
*
|
|
43
|
-
* This approach has the following optimizations:
|
|
44
|
-
* - cached manifests and configs can be shared by other clients
|
|
45
|
-
* - when fetching from source, only fetch the missing records
|
|
33
|
+
* Load theme configs from internal data, typically in the editor.
|
|
34
|
+
* Used when configs are provided externally (e.g., from editor).
|
|
46
35
|
*/
|
|
47
|
-
|
|
36
|
+
setConfigs(themeConfigs: Map<string, SwellThemeConfig>): void;
|
|
48
37
|
/**
|
|
49
|
-
*
|
|
38
|
+
* Updates KV with file_data for provided theme configs (warmup path).
|
|
39
|
+
* Uses the new ThemeFileStorage abstraction for optimized operations.
|
|
50
40
|
*/
|
|
51
|
-
|
|
41
|
+
updateThemeCache(payload: SwellThemePreload): Promise<PutFilesResult>;
|
|
52
42
|
/**
|
|
53
|
-
*
|
|
43
|
+
* Main loading logic - loads all configs at once.
|
|
44
|
+
* 1. Fetches lightweight metadata (cached when possible)
|
|
45
|
+
* 2. Batch hydrates file_data from KV
|
|
46
|
+
* 3. Fetches missing file_data from API if needed
|
|
54
47
|
*/
|
|
55
|
-
private
|
|
48
|
+
private loadAllConfigs;
|
|
56
49
|
/**
|
|
57
|
-
*
|
|
50
|
+
* Fetch lightweight config metadata from API or cache.
|
|
51
|
+
* Does NOT include file_data to minimize payload size.
|
|
58
52
|
*/
|
|
59
|
-
private
|
|
53
|
+
private fetchConfigMetadata;
|
|
60
54
|
/**
|
|
61
|
-
*
|
|
55
|
+
* Helper to ensure all configs have file_data.
|
|
56
|
+
* Fetches missing data from API and updates KV cache.
|
|
62
57
|
*/
|
|
63
|
-
private
|
|
58
|
+
private ensureConfigsHaveData;
|
|
64
59
|
/**
|
|
65
|
-
* Fetches
|
|
60
|
+
* Fetches theme configs with file_data from Swell Backend API.
|
|
61
|
+
* Used to retrieve missing file_data for configs.
|
|
66
62
|
*/
|
|
67
63
|
private fetchThemeConfigsFromSource;
|
|
68
64
|
/**
|
|
69
|
-
*
|
|
70
|
-
* This is used when a hash entry cannot be found.
|
|
71
|
-
* We may override the cached hash in order to ensure it is found on reload,
|
|
72
|
-
* but we probably need to find why that happens in the first place (TODO).
|
|
65
|
+
* Get the current theme ID from headers.
|
|
73
66
|
*/
|
|
74
|
-
private fetchThemeConfigsFromSourceByPath;
|
|
75
67
|
private getThemeId;
|
|
76
68
|
/**
|
|
77
|
-
*
|
|
69
|
+
* Generate a Swell API query filter for this theme version.
|
|
78
70
|
*/
|
|
79
71
|
private themeVersionQueryFilter;
|
|
80
72
|
}
|
package/dist/src/theme.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Swell, StorefrontResource, SwellStorefrontCollection, SwellStorefrontRe
|
|
|
2
2
|
import { ShopifyCompatibility } from './compatibility/shopify';
|
|
3
3
|
import { LiquidSwell, ThemeFont, ThemeForm } from './liquid';
|
|
4
4
|
import { ThemeLoader } from './theme/theme-loader';
|
|
5
|
+
import type { PutFilesResult } from './cache';
|
|
5
6
|
import type { FormatInput } from 'swell-js';
|
|
6
7
|
import type { ThemeGlobals, ThemeConfigs, ThemeSettings, ThemeResources, ThemeFormConfig, ThemeInitGlobalsOptions, ThemeFormErrorMessages, ThemeLocaleConfig, ThemePresetSchema, ThemeSectionGroup, ThemeSectionGroupInfo, ThemeSectionSchema, ThemeSectionConfig, ThemeSectionSettings, ThemeSettingFieldSchema, ThemeSettingSectionSchema, ThemePage, ThemePageSectionSchema, ThemePageTemplateConfig, ThemeLayoutSectionGroupConfig, SwellData, SwellMenu, SwellRecord, SwellAppConfig, SwellThemeConfig, SwellThemePreload, SwellAppStorefrontThemeProps, SwellAppShopifyCompatibilityConfig, SwellPageRequest, SwellSettingsGeo } from '../types/swell';
|
|
7
8
|
export declare class SwellTheme {
|
|
@@ -12,7 +13,6 @@ export declare class SwellTheme {
|
|
|
12
13
|
resources?: ThemeResources;
|
|
13
14
|
liquidSwell: LiquidSwell;
|
|
14
15
|
themeLoader: ThemeLoader;
|
|
15
|
-
themeConfigs: Map<string, SwellThemeConfig> | null;
|
|
16
16
|
page?: ThemePage;
|
|
17
17
|
pageId: string | undefined;
|
|
18
18
|
shopifyCompatibility: ShopifyCompatibility | null;
|
|
@@ -28,6 +28,16 @@ export declare class SwellTheme {
|
|
|
28
28
|
globals?: ThemeGlobals;
|
|
29
29
|
shopifyCompatibilityClass?: typeof ShopifyCompatibility;
|
|
30
30
|
});
|
|
31
|
+
/**
|
|
32
|
+
* Getter for theme configs - returns the configs from the loader.
|
|
33
|
+
* Used by editor and tests to access loaded configs.
|
|
34
|
+
*/
|
|
35
|
+
get themeConfigs(): Map<string, SwellThemeConfig> | null;
|
|
36
|
+
/**
|
|
37
|
+
* Setter for theme configs - directly sets configs in the loader.
|
|
38
|
+
* Used by editor and tests to inject configs without API/KV loading.
|
|
39
|
+
*/
|
|
40
|
+
set themeConfigs(configs: Map<string, SwellThemeConfig> | null);
|
|
31
41
|
getSwellAppThemeProps(swellConfig?: SwellAppConfig): SwellAppStorefrontThemeProps;
|
|
32
42
|
initGlobals(pageId: string, options?: ThemeInitGlobalsOptions): Promise<void>;
|
|
33
43
|
setGlobals(globals: Partial<ThemeGlobals>): void;
|
|
@@ -106,15 +116,20 @@ export declare class SwellTheme {
|
|
|
106
116
|
resolveFontSetting(value: string): ThemeFont;
|
|
107
117
|
resolveUrlSetting(value: string): string;
|
|
108
118
|
resolveImageSetting(value: string): string;
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Preloads updated theme configs. Used to optimize initial theme load.
|
|
112
|
-
*/
|
|
113
|
-
preloadThemeConfigs(payload: SwellThemePreload): Promise<void>;
|
|
119
|
+
preloadThemeConfigs(payload: SwellThemePreload): Promise<PutFilesResult>;
|
|
114
120
|
getPageConfigPath(pageId: string, altTemplate?: string): string | null;
|
|
115
121
|
getThemeConfig(filePath: string): Promise<SwellThemeConfig | null>;
|
|
116
|
-
getThemeConfigsByPath(pathPrefix: string, pathSuffix?: string):
|
|
122
|
+
getThemeConfigsByPath(pathPrefix: string, pathSuffix?: string): Map<string, SwellThemeConfig>;
|
|
117
123
|
getThemeTemplateConfig(filePath: string): Promise<SwellThemeConfig | null>;
|
|
124
|
+
/**
|
|
125
|
+
* Internal synchronous helper for getting template configs by type.
|
|
126
|
+
* Used internally within theme.ts to avoid async overhead.
|
|
127
|
+
*/
|
|
128
|
+
private _getTemplateConfigByType;
|
|
129
|
+
/**
|
|
130
|
+
* Internal synchronous helper for getting template configs.
|
|
131
|
+
*/
|
|
132
|
+
private _getTemplateConfig;
|
|
118
133
|
getThemeTemplateConfigByType(type: string, name: string, suffix?: string): Promise<SwellThemeConfig | null>;
|
|
119
134
|
getAssetConfig(assetName: string): Promise<SwellThemeConfig | null>;
|
|
120
135
|
getAssetUrl(filePath: string): Promise<string | null>;
|
|
@@ -2,6 +2,7 @@ import { CURRENCY_COUNTRIES } from '../constants';
|
|
|
2
2
|
import type { SwellData, SwellLocale, SwellThemeConfig, ThemeLayoutSectionGroupConfig, ThemePageSectionSchema, ThemeSectionConfig, ThemeSectionGroup, ThemeSectionSchema, ThemeSettings } from 'types/swell';
|
|
3
3
|
export * from './md5';
|
|
4
4
|
export { configureSdkLogger, type SdkLoggerConfig } from './logger';
|
|
5
|
+
export { getKVFlavor, resetKVFlavorCache } from './kv-flavor';
|
|
5
6
|
export declare function getAllSections(themeConfigs: Map<string, SwellThemeConfig>, renderTemplateSchema: (config: SwellThemeConfig) => Promise<ThemeSectionSchema | undefined>): Promise<ThemePageSectionSchema[]>;
|
|
6
7
|
export declare function getLayoutSectionGroups(allSections: Map<string, SwellThemeConfig>, renderTemplateSchema: (config: SwellThemeConfig) => Promise<Partial<ThemeSectionSchema> | undefined>): Promise<ThemeLayoutSectionGroupConfig[]>;
|
|
7
8
|
export declare function getPageSections(sectionGroup: ThemeSectionGroup, getSchema: (type: string) => Promise<Partial<ThemeSectionSchema> | undefined>): Promise<ThemeSectionConfig[]>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { KVFlavor } from '../cache';
|
|
2
|
+
import type { CFThemeEnv } from '../../types/cloudflare';
|
|
3
|
+
/**
|
|
4
|
+
* Get KV storage flavor. Priority: KV_FLAVOR env var > auto-detection > miniflare default
|
|
5
|
+
*/
|
|
6
|
+
export declare function getKVFlavor(workerEnv?: CFThemeEnv): KVFlavor;
|
|
7
|
+
export declare function resetKVFlavorCache(): void;
|
|
@@ -4,15 +4,16 @@ export interface CFWorkerContext {
|
|
|
4
4
|
}
|
|
5
5
|
export interface CFThemeEnv {
|
|
6
6
|
THEME?: CFWorkerKV;
|
|
7
|
+
KV_FLAVOR?: string;
|
|
7
8
|
}
|
|
8
9
|
export type CFWorkerKVGetType = 'text' | 'json' | 'arrayBuffer' | 'stream';
|
|
9
10
|
export interface CFWorkerKVGetOptions<T extends CFWorkerKVGetType> {
|
|
10
|
-
cacheTtl
|
|
11
|
-
type
|
|
11
|
+
cacheTtl?: number;
|
|
12
|
+
type?: T;
|
|
12
13
|
}
|
|
13
14
|
export interface CFWorkerKVGetMetadataResponse<T> {
|
|
14
15
|
value: T | null;
|
|
15
|
-
metadata: string | null;
|
|
16
|
+
metadata: string | Record<string, unknown> | null;
|
|
16
17
|
}
|
|
17
18
|
export interface CFWorkerKVPutOptions {
|
|
18
19
|
expiration?: number;
|
|
@@ -39,10 +40,20 @@ export interface CFWorkerKV {
|
|
|
39
40
|
get(key: string, type?: 'arrayBuffer', options?: CFWorkerKVGetOptions<'arrayBuffer'>): Promise<ArrayBuffer | null>;
|
|
40
41
|
get(key: string, type?: 'stream', options?: CFWorkerKVGetOptions<'stream'>): Promise<ReadableStream<Uint8Array> | null>;
|
|
41
42
|
get<T>(key: string, type?: 'json', options?: CFWorkerKVGetOptions<'json'>): Promise<T | null>;
|
|
43
|
+
get(keys: string[], type?: 'text', options?: CFWorkerKVGetOptions<'text'>): Promise<Map<string, string | null>>;
|
|
44
|
+
get(keys: string[], type?: 'json', options?: CFWorkerKVGetOptions<'json'>): Promise<Map<string, object | null>>;
|
|
42
45
|
getWithMetadata(key: string, type?: 'text', options?: CFWorkerKVGetOptions<'text'>): Promise<CFWorkerKVGetMetadataResponse<string>>;
|
|
43
46
|
getWithMetadata(key: string, type?: 'arrayBuffer', options?: CFWorkerKVGetOptions<'arrayBuffer'>): Promise<CFWorkerKVGetMetadataResponse<ArrayBuffer>>;
|
|
44
47
|
getWithMetadata(key: string, type?: 'stream', options?: CFWorkerKVGetOptions<'stream'>): Promise<CFWorkerKVGetMetadataResponse<ReadableStream<Uint8Array>>>;
|
|
45
48
|
getWithMetadata<T>(key: string, type?: 'json', options?: CFWorkerKVGetOptions<'json'>): Promise<CFWorkerKVGetMetadataResponse<T>>;
|
|
49
|
+
getWithMetadata(keys: string[], type?: 'text', options?: CFWorkerKVGetOptions<'text'>): Promise<Map<string, {
|
|
50
|
+
value: string | null;
|
|
51
|
+
metadata: string | Record<string, unknown> | null;
|
|
52
|
+
}>>;
|
|
53
|
+
getWithMetadata(keys: string[], type?: 'json', options?: CFWorkerKVGetOptions<'json'>): Promise<Map<string, {
|
|
54
|
+
value: object | null;
|
|
55
|
+
metadata: string | Record<string, unknown> | null;
|
|
56
|
+
}>>;
|
|
46
57
|
put(key: string, value: string | ReadableStream | ArrayBuffer, options?: CFWorkerKVPutOptions): Promise<void>;
|
|
47
58
|
delete(key: string): Promise<void>;
|
|
48
59
|
list(options?: CFWorkerKVListOptions): Promise<CFWorkerKVListResponse>;
|
package/dist/types/shopify.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SwellData,
|
|
1
|
+
import type { SwellData, ThemeSectionEnabledDisabled } from './swell';
|
|
2
2
|
import type { ShopifyResource } from '../src/compatibility/shopify-objects/resource';
|
|
3
3
|
import type { ShopifyCompatibility } from '../src/compatibility/shopify';
|
|
4
4
|
import type { StorefrontResource, SwellStorefrontCollection } from '../src/resources';
|
|
@@ -446,7 +446,7 @@ export interface ShopifyCollection {
|
|
|
446
446
|
metafields: Record<string, unknown>;
|
|
447
447
|
next_product?: ShopifyProduct;
|
|
448
448
|
previous_product?: ShopifyProduct;
|
|
449
|
-
products: SwellStorefrontCollection<
|
|
449
|
+
products: SwellStorefrontCollection<ShopifyResource<ShopifyProduct>>;
|
|
450
450
|
products_count: number;
|
|
451
451
|
published_at: string;
|
|
452
452
|
sort_by?: string;
|
package/dist/types/swell.d.ts
CHANGED
|
@@ -245,7 +245,9 @@ export interface SwellMenuItem {
|
|
|
245
245
|
}
|
|
246
246
|
export type QueryParams = import('qs').ParsedQs;
|
|
247
247
|
export type StorefrontResourceGetter<T extends SwellData = SwellData> = (this: SwellStorefrontResource<T>) => Promise<T | null> | T | null;
|
|
248
|
-
export type
|
|
248
|
+
export type StorefrontRecordGetter<T extends SwellData = SwellData> = (this: SwellStorefrontRecord<T>) => Promise<T | null> | T | null;
|
|
249
|
+
export type StorefrontSingletonGetter<T extends SwellData = SwellData> = (this: SwellStorefrontSingleton<T>) => Promise<T | null> | T | null;
|
|
250
|
+
export type StorefrontCollectionGetter<T extends SwellData = SwellData> = (this: SwellStorefrontCollection<T>) => Promise<SwellCollection<T> | null> | SwellCollection<T> | null;
|
|
249
251
|
export interface ThemeSettings {
|
|
250
252
|
[key: string]: any;
|
|
251
253
|
}
|