@swell/apps-sdk 1.0.116 → 1.0.118
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 +14 -14
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +12 -12
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +14 -14
- package/dist/index.mjs.map +3 -3
- package/dist/src/api.d.ts +2 -1
- package/dist/src/cache/cache.d.ts +3 -1
- package/dist/types/swell.d.ts +5 -0
- package/package.json +1 -1
package/dist/src/api.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import SwellJS from 'swell-js';
|
|
2
2
|
import qs from 'qs';
|
|
3
|
-
import type { SwellApiParams, SwellAppConfig, SwellErrorOptions, SwellMenu, SwellData, CFThemeEnv, SwellAppShopifyCompatibilityConfig } from '../types/swell';
|
|
3
|
+
import type { SwellApiParams, SwellAppConfig, SwellErrorOptions, SwellMenu, SwellData, CFThemeEnv, CFWorkerContext, SwellAppShopifyCompatibilityConfig } from '../types/swell';
|
|
4
4
|
export * from './resources';
|
|
5
5
|
export declare class Swell {
|
|
6
6
|
url: URL;
|
|
7
7
|
headers: Record<string, string | undefined>;
|
|
8
8
|
swellHeaders: Record<string, string | undefined>;
|
|
9
9
|
queryParams: qs.ParsedQs;
|
|
10
|
+
workerCtx?: CFWorkerContext;
|
|
10
11
|
workerEnv?: CFThemeEnv;
|
|
11
12
|
config?: SwellAppConfig;
|
|
12
13
|
shopifyCompatibilityConfig?: SwellAppShopifyCompatibilityConfig;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type CreateCacheOptions as OriginalCreateCacheOptions } from 'cache-manager';
|
|
2
|
-
import type { CFWorkerKV } from 'types/swell';
|
|
2
|
+
import type { CFWorkerKV, CFWorkerContext } from 'types/swell';
|
|
3
3
|
export type CreateCacheOptions = OriginalCreateCacheOptions & {
|
|
4
4
|
kvStore?: CFWorkerKV;
|
|
5
|
+
workerCtx?: CFWorkerContext;
|
|
5
6
|
};
|
|
6
7
|
export declare const CF_KV_NAMESPACE = "THEME";
|
|
7
8
|
/**
|
|
@@ -10,6 +11,7 @@ export declare const CF_KV_NAMESPACE = "THEME";
|
|
|
10
11
|
*/
|
|
11
12
|
export declare class Cache {
|
|
12
13
|
private client;
|
|
14
|
+
private workerCtx?;
|
|
13
15
|
constructor(options?: CreateCacheOptions);
|
|
14
16
|
fetch<T>(key: string, fetchFn: () => T | Promise<T>): Promise<T>;
|
|
15
17
|
fetchSWR<T>(key: string, fetchFn: () => T | Promise<T>, ttl?: number): Promise<T>;
|
package/dist/types/swell.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface SwellApiParams {
|
|
|
11
11
|
serverHeaders?: Headers | Record<string, string | undefined>;
|
|
12
12
|
queryParams?: URLSearchParams | Record<string, string | undefined>;
|
|
13
13
|
workerEnv?: CFThemeEnv;
|
|
14
|
+
workerCtx?: CFWorkerContext;
|
|
14
15
|
isEditor?: boolean;
|
|
15
16
|
getCookie?: (name: string) => string | undefined;
|
|
16
17
|
setCookie?: (name: string, value: string, options: object | undefined, swell: Swell) => void;
|
|
@@ -547,4 +548,8 @@ export interface CFWorkerKV {
|
|
|
547
548
|
export interface CFThemeEnv {
|
|
548
549
|
THEME?: CFWorkerKV;
|
|
549
550
|
}
|
|
551
|
+
export interface CFWorkerContext {
|
|
552
|
+
waitUntil(promise: Promise<any>): void;
|
|
553
|
+
passThroughOnException(): void;
|
|
554
|
+
}
|
|
550
555
|
export {};
|