@agnostack/next-shopify 4.0.0-canary.8 → 4.0.0
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/CHANGELOG.md +98 -0
- package/dist/esm/lib/handlers/api/billing.js +3 -2
- package/dist/esm/lib/handlers/api/callback.js +4 -3
- package/dist/esm/lib/handlers/api/uninstall.js +3 -2
- package/dist/esm/lib/handlers/api/verifiable/appInstallation.js +3 -2
- package/dist/esm/lib/handlers/api/verifiable/graph.js +3 -2
- package/dist/esm/lib/handlers/api/verifiable/proxy.js +3 -2
- package/dist/esm/lib/handlers/api/webhook.js +3 -2
- package/dist/esm/lib/handlers/ssr/protect.js +3 -2
- package/dist/esm/lib/index.js +0 -1
- package/dist/esm/lib/utils/session.js +18 -22
- package/dist/esm/shared/index.js +2 -0
- package/dist/esm/shared/storage.js +35 -0
- package/dist/esm/shared/types.js +3 -0
- package/dist/lib/handlers/api/billing.d.ts +1 -1
- package/dist/lib/handlers/api/billing.js +3 -2
- package/dist/lib/handlers/api/callback.d.ts +1 -1
- package/dist/lib/handlers/api/callback.js +4 -3
- package/dist/lib/handlers/api/uninstall.d.ts +1 -1
- package/dist/lib/handlers/api/uninstall.js +3 -2
- package/dist/lib/handlers/api/verifiable/appInstallation.d.ts +1 -1
- package/dist/lib/handlers/api/verifiable/appInstallation.js +3 -2
- package/dist/lib/handlers/api/verifiable/graph.d.ts +1 -1
- package/dist/lib/handlers/api/verifiable/graph.js +3 -2
- package/dist/lib/handlers/api/verifiable/proxy.d.ts +1 -1
- package/dist/lib/handlers/api/verifiable/proxy.js +3 -2
- package/dist/lib/handlers/api/webhook.d.ts +1 -1
- package/dist/lib/handlers/api/webhook.js +3 -2
- package/dist/lib/handlers/ssr/protect.d.ts +1 -1
- package/dist/lib/handlers/ssr/protect.js +3 -2
- package/dist/lib/index.d.ts +0 -1
- package/dist/lib/index.js +0 -1
- package/dist/lib/utils/session.d.ts +2 -4
- package/dist/lib/utils/session.js +18 -22
- package/dist/lib/utils/types.d.ts +20 -16
- package/dist/shared/index.d.ts +2 -0
- package/dist/shared/index.js +2 -0
- package/dist/shared/storage.d.ts +2 -0
- package/dist/shared/storage.js +39 -0
- package/dist/shared/types.d.ts +72 -1
- package/dist/shared/types.js +2 -0
- package/package.json +4 -31
- package/dist/esm/storage/firestore/index.js +0 -77
- package/dist/esm/storage/index.js +0 -54
- package/dist/storage/firestore/index.d.ts +0 -4
- package/dist/storage/firestore/index.js +0 -81
- package/dist/storage/index.d.ts +0 -61
- package/dist/storage/index.js +0 -58
package/dist/storage/index.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shop and session ids are nullable: `sanitizeShop` returns null for anything it does not
|
|
3
|
-
* recognise, and the core forwards that rather than guarding.
|
|
4
|
-
*
|
|
5
|
-
* @typedef {string | null | undefined} ShopId
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* What the session layer needs from a store. Two entities, sessions and state, both scoped to a
|
|
9
|
-
* shop. Nothing here is Firestore-specific: `@agnostack/next-shopify/firestore` is one
|
|
10
|
-
* implementation, and an app can supply its own.
|
|
11
|
-
*
|
|
12
|
-
* ⚠️ Values arrive ALREADY ENCRYPTED and already stripped of anything that must not be persisted.
|
|
13
|
-
* An implementation stores and returns what it is handed - it must not inspect, reshape or
|
|
14
|
-
* re-encrypt, or the core's crypto and DPA guarantees stop holding.
|
|
15
|
-
*
|
|
16
|
-
* ⚠️ `findSessionIds` returns `[]` rather than erroring for an unknown shop - that is what an
|
|
17
|
-
* initial install looks like.
|
|
18
|
-
*
|
|
19
|
-
* @typedef {object} SessionStorage
|
|
20
|
-
* @property {(shopId: ShopId, sessionId: ShopId) => Promise<any>} loadSession
|
|
21
|
-
* @property {(shopId: ShopId, session: any) => Promise<any>} updateSession
|
|
22
|
-
* MERGES into the stored session. The core writes partial sessions, so a replacing write
|
|
23
|
-
* would silently drop fields it did not send.
|
|
24
|
-
* @property {(shopId: ShopId, sessionIds: any) => Promise<any>} deleteSessions
|
|
25
|
-
* @property {(shopId: ShopId) => Promise<string[]>} findSessionIds
|
|
26
|
-
* @property {(shop: ShopId) => Promise<any>} loadState
|
|
27
|
-
* @property {(shop: ShopId, state: any) => Promise<any>} storeState
|
|
28
|
-
* @property {(shop: ShopId) => Promise<any>} deleteState
|
|
29
|
-
*/
|
|
30
|
-
export const STORAGE_METHODS: string[];
|
|
31
|
-
export function ensureStorage(storage: any): SessionStorage;
|
|
32
|
-
/**
|
|
33
|
-
* Shop and session ids are nullable: `sanitizeShop` returns null for anything it does not
|
|
34
|
-
* recognise, and the core forwards that rather than guarding.
|
|
35
|
-
*/
|
|
36
|
-
export type ShopId = string | null | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* What the session layer needs from a store. Two entities, sessions and state, both scoped to a
|
|
39
|
-
* shop. Nothing here is Firestore-specific: `@agnostack/next-shopify/firestore` is one
|
|
40
|
-
* implementation, and an app can supply its own.
|
|
41
|
-
*
|
|
42
|
-
* ⚠️ Values arrive ALREADY ENCRYPTED and already stripped of anything that must not be persisted.
|
|
43
|
-
* An implementation stores and returns what it is handed - it must not inspect, reshape or
|
|
44
|
-
* re-encrypt, or the core's crypto and DPA guarantees stop holding.
|
|
45
|
-
*
|
|
46
|
-
* ⚠️ `findSessionIds` returns `[]` rather than erroring for an unknown shop - that is what an
|
|
47
|
-
* initial install looks like.
|
|
48
|
-
*/
|
|
49
|
-
export type SessionStorage = {
|
|
50
|
-
loadSession: (shopId: ShopId, sessionId: ShopId) => Promise<any>;
|
|
51
|
-
/**
|
|
52
|
-
* MERGES into the stored session. The core writes partial sessions, so a replacing write
|
|
53
|
-
* would silently drop fields it did not send.
|
|
54
|
-
*/
|
|
55
|
-
updateSession: (shopId: ShopId, session: any) => Promise<any>;
|
|
56
|
-
deleteSessions: (shopId: ShopId, sessionIds: any) => Promise<any>;
|
|
57
|
-
findSessionIds: (shopId: ShopId) => Promise<string[]>;
|
|
58
|
-
loadState: (shop: ShopId) => Promise<any>;
|
|
59
|
-
storeState: (shop: ShopId, state: any) => Promise<any>;
|
|
60
|
-
deleteState: (shop: ShopId) => Promise<any>;
|
|
61
|
-
};
|
package/dist/storage/index.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ensureStorage = exports.STORAGE_METHODS = void 0;
|
|
4
|
-
const index_js_1 = require("../shared/index.js");
|
|
5
|
-
/**
|
|
6
|
-
* Shop and session ids are nullable: `sanitizeShop` returns null for anything it does not
|
|
7
|
-
* recognise, and the core forwards that rather than guarding.
|
|
8
|
-
*
|
|
9
|
-
* @typedef {string | null | undefined} ShopId
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* What the session layer needs from a store. Two entities, sessions and state, both scoped to a
|
|
13
|
-
* shop. Nothing here is Firestore-specific: `@agnostack/next-shopify/firestore` is one
|
|
14
|
-
* implementation, and an app can supply its own.
|
|
15
|
-
*
|
|
16
|
-
* ⚠️ Values arrive ALREADY ENCRYPTED and already stripped of anything that must not be persisted.
|
|
17
|
-
* An implementation stores and returns what it is handed - it must not inspect, reshape or
|
|
18
|
-
* re-encrypt, or the core's crypto and DPA guarantees stop holding.
|
|
19
|
-
*
|
|
20
|
-
* ⚠️ `findSessionIds` returns `[]` rather than erroring for an unknown shop - that is what an
|
|
21
|
-
* initial install looks like.
|
|
22
|
-
*
|
|
23
|
-
* @typedef {object} SessionStorage
|
|
24
|
-
* @property {(shopId: ShopId, sessionId: ShopId) => Promise<any>} loadSession
|
|
25
|
-
* @property {(shopId: ShopId, session: any) => Promise<any>} updateSession
|
|
26
|
-
* MERGES into the stored session. The core writes partial sessions, so a replacing write
|
|
27
|
-
* would silently drop fields it did not send.
|
|
28
|
-
* @property {(shopId: ShopId, sessionIds: any) => Promise<any>} deleteSessions
|
|
29
|
-
* @property {(shopId: ShopId) => Promise<string[]>} findSessionIds
|
|
30
|
-
* @property {(shop: ShopId) => Promise<any>} loadState
|
|
31
|
-
* @property {(shop: ShopId, state: any) => Promise<any>} storeState
|
|
32
|
-
* @property {(shop: ShopId) => Promise<any>} deleteState
|
|
33
|
-
*/
|
|
34
|
-
exports.STORAGE_METHODS = [
|
|
35
|
-
'loadState',
|
|
36
|
-
'storeState',
|
|
37
|
-
'deleteState',
|
|
38
|
-
'loadSession',
|
|
39
|
-
'updateSession',
|
|
40
|
-
'deleteSessions',
|
|
41
|
-
'findSessionIds'
|
|
42
|
-
];
|
|
43
|
-
/**
|
|
44
|
-
* Fails at composition rather than at the first OAuth round-trip. Nothing automated covers the
|
|
45
|
-
* Shopify auth flow, so a missing method would otherwise surface as a runtime TypeError in a
|
|
46
|
-
* callback that needs a real dev store to reach.
|
|
47
|
-
*
|
|
48
|
-
* @param {any} storage
|
|
49
|
-
* @returns {SessionStorage}
|
|
50
|
-
*/
|
|
51
|
-
const ensureStorage = (storage) => {
|
|
52
|
-
const missing = (0, index_js_1.ensureArray)(exports.STORAGE_METHODS).filter((method) => (typeof (storage === null || storage === void 0 ? void 0 : storage[method]) !== 'function'));
|
|
53
|
-
if (missing.length) {
|
|
54
|
-
throw new Error(`Invalid session storage, missing: ${missing.join(', ')}`);
|
|
55
|
-
}
|
|
56
|
-
return storage;
|
|
57
|
-
};
|
|
58
|
-
exports.ensureStorage = ensureStorage;
|