@agnostack/next-shopify 1.14.1-beta.21 → 1.14.1-beta.23

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.14.1-beta.23](https://github.com/agnostack/next-shopify/compare/v1.14.1-beta.22...v1.14.1-beta.23) (2023-12-07)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * wip ([db3403c](https://github.com/agnostack/next-shopify/commit/db3403c6fd0ffdefbb5de804c2e830f405ccd3b0))
7
+
8
+ ## [1.14.1-beta.22](https://github.com/agnostack/next-shopify/compare/v1.14.1-beta.21...v1.14.1-beta.22) (2023-12-07)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * wip ([f4c0c70](https://github.com/agnostack/next-shopify/commit/f4c0c701a66e3ad40f0a5de7ce66b322d6f9900d))
14
+
1
15
  ## [1.14.1-beta.21](https://github.com/agnostack/next-shopify/compare/v1.14.1-beta.20...v1.14.1-beta.21) (2023-12-07)
2
16
 
3
17
 
@@ -2,7 +2,7 @@ export * from "./billing";
2
2
  export * from "./crypto";
3
3
  export * from "./firebase";
4
4
  export * from "./headers";
5
- export * from "./request";
5
+ export * from "./rawbody";
6
6
  export * from "./session";
7
7
  export * from "./shopify";
8
8
  export * from "./shopify-api-js/oauth";
@@ -5,7 +5,7 @@ tslib_1.__exportStar(require("./billing"), exports);
5
5
  tslib_1.__exportStar(require("./crypto"), exports);
6
6
  tslib_1.__exportStar(require("./firebase"), exports);
7
7
  tslib_1.__exportStar(require("./headers"), exports);
8
- tslib_1.__exportStar(require("./request"), exports);
8
+ tslib_1.__exportStar(require("./rawbody"), exports);
9
9
  tslib_1.__exportStar(require("./session"), exports);
10
10
  tslib_1.__exportStar(require("./shopify"), exports);
11
11
  tslib_1.__exportStar(require("./shopify-api-js/oauth"), exports);
@@ -0,0 +1,2 @@
1
+ export function ensureRawBody(req: any): Promise<any>;
2
+ //# sourceMappingURL=rawbody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rawbody.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/rawbody.js"],"names":[],"mappings":"AAGO,sDAaN"}
@@ -1,29 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ensureRawBody = exports.prepareRequestOptions = exports.getRequestMethod = exports.CONTENT_TYPES = exports.HEADER_CONTENT_TYPE = void 0;
3
+ exports.ensureRawBody = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const raw_body_1 = tslib_1.__importDefault(require("raw-body"));
6
- const shared_1 = require("../../shared");
7
- exports.HEADER_CONTENT_TYPE = 'Content-Type';
8
- exports.CONTENT_TYPES = {
9
- APPLICATION_JSON: 'application/json',
10
- };
11
- const getRequestMethod = (body, _method) => {
12
- const method = _method !== null && _method !== void 0 ? _method : (body ? 'POST' : 'GET');
13
- return (0, shared_1.uppercase)(method);
14
- };
15
- exports.getRequestMethod = getRequestMethod;
16
- const prepareRequestOptions = (_a = {}) => {
17
- var { body: _body, headers: _header } = _a, requestOptions = tslib_1.__rest(_a, ["body", "headers"]);
18
- const headers = Object.assign({ [exports.HEADER_CONTENT_TYPE]: exports.CONTENT_TYPES.APPLICATION_JSON }, _header);
19
- let body = _body;
20
- if (body && headers[exports.HEADER_CONTENT_TYPE].startsWith(exports.CONTENT_TYPES.APPLICATION_JSON)) {
21
- body = JSON.stringify((0, shared_1.safeParse)(body));
22
- }
23
- return Object.assign({ body,
24
- headers }, requestOptions);
25
- };
26
- exports.prepareRequestOptions = prepareRequestOptions;
27
6
  // TODO: move to req.text() after next 13.5
28
7
  const ensureRawBody = (req) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
29
8
  return ((0, raw_body_1.default)(req)
@@ -52,4 +31,4 @@ exports.ensureRawBody = ensureRawBody;
52
31
  // console.log(`>>> > ensureRawBody > req.rawBody:`, req.rawBody)
53
32
  // return req
54
33
  // }
55
- //# sourceMappingURL=request.js.map
34
+ //# sourceMappingURL=rawbody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rawbody.js","sourceRoot":"","sources":["../../../src/lib/utils/rawbody.js"],"names":[],"mappings":";;;;AAAA,gEAAiC;AAEjC,2CAA2C;AACpC,MAAM,aAAa,GAAG,CAAO,GAAG,EAAE,EAAE;IAAC,OAAA,CAC1C,IAAA,kBAAU,EAAC,GAAG,CAAC;SACZ,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;SACvC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;;QACf,qHAAqH;QACrH,IAAI,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,qBAAqB,CAAC,EAAE;YAC3C,OAAO,CAAC,IAAI,CAAC,wCAAwC,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,EAAE,CAAC,CAAA;YACxF,OAAO,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,mCAAI,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAA;SACjC;QAED,OAAO,CAAC,KAAK,CAAC,+BAA+B,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,GAAG,GAAG,EAAE,KAAK,CAAC,CAAA;QAChE,MAAM,KAAK,CAAA;IACf,CAAC,CAAC,CACH,CAAA;EAAA,CAAA;AAbY,QAAA,aAAa,iBAazB;AAED,8CAA8C;AAC9C,gDAAgD;AAChD,0CAA0C;AAC1C,+CAA+C;AAC/C,4BAA4B;AAC5B,2EAA2E;AAC3E,yBAAyB;AACzB,OAAO;AAEP,0BAA0B;AAC1B,mEAAmE;AAEnE,eAAe;AACf,IAAI"}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getVerificationHelpers = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const shared_1 = require("../../shared");
6
- const request_1 = require("./request");
6
+ const rawbody_1 = require("./rawbody");
7
7
  const getVerificationHelpers = (serverRuntimeConfig) => {
8
8
  const { keyPairs } = serverRuntimeConfig;
9
9
  return (req, params) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
@@ -24,7 +24,7 @@ const getVerificationHelpers = (serverRuntimeConfig) => {
24
24
  (authProtocol === 'HMAC-SHA256'));
25
25
  console.log(`>>> > getVerificationHelpers > isVerifiable: '${uri}'`, { isVerifiable });
26
26
  let verificationKeys;
27
- const rawBody = yield (0, request_1.ensureRawBody)(req);
27
+ const rawBody = yield (0, rawbody_1.ensureRawBody)(req);
28
28
  console.log(`>>> > getVerificationHelpers > rawBody: '${uri}'`, { rawBody });
29
29
  // NOTE: requestBody should be wind up decrypted when isVerifiable (unless disableRecryption, then will pass through)
30
30
  let requestBody = (0, shared_1.safeParse)(rawBody);
@@ -4,6 +4,7 @@ export * from './display';
4
4
  export * from './errors';
5
5
  export * from './graph';
6
6
  export * from './match';
7
+ export * from './request';
7
8
  export * from './shopify';
8
9
  export * from './subtlecrypto';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA"}
@@ -7,6 +7,7 @@ tslib_1.__exportStar(require("./display"), exports);
7
7
  tslib_1.__exportStar(require("./errors"), exports);
8
8
  tslib_1.__exportStar(require("./graph"), exports);
9
9
  tslib_1.__exportStar(require("./match"), exports);
10
+ tslib_1.__exportStar(require("./request"), exports);
10
11
  tslib_1.__exportStar(require("./shopify"), exports);
11
12
  tslib_1.__exportStar(require("./subtlecrypto"), exports);
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":";;;AAAA,sDAA2B;AAC3B,qDAA0B;AAC1B,oDAAyB;AACzB,mDAAwB;AACxB,kDAAuB;AACvB,kDAAuB;AACvB,oDAAyB;AACzB,yDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":";;;AAAA,sDAA2B;AAC3B,qDAA0B;AAC1B,oDAAyB;AACzB,mDAAwB;AACxB,kDAAuB;AACvB,kDAAuB;AACvB,oDAAyB;AACzB,oDAAyB;AACzB,yDAA8B"}
@@ -10,5 +10,4 @@ export function prepareRequestOptions({ body: _body, headers: _header, ...reques
10
10
  body: any;
11
11
  headers: any;
12
12
  };
13
- export function ensureRawBody(req: any): Promise<any>;
14
13
  //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/shared/request.js"],"names":[],"mappings":"AAEA,iDAAiD;;;;AAK1C,kEAIN;AAEM;;;;;;EAgBN"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prepareRequestOptions = exports.getRequestMethod = exports.CONTENT_TYPES = exports.HEADER_CONTENT_TYPE = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const display_1 = require("./display");
6
+ exports.HEADER_CONTENT_TYPE = 'Content-Type';
7
+ exports.CONTENT_TYPES = {
8
+ APPLICATION_JSON: 'application/json',
9
+ };
10
+ const getRequestMethod = (body, _method) => {
11
+ const method = _method !== null && _method !== void 0 ? _method : (body ? 'POST' : 'GET');
12
+ return (0, display_1.uppercase)(method);
13
+ };
14
+ exports.getRequestMethod = getRequestMethod;
15
+ const prepareRequestOptions = (_a = {}) => {
16
+ var { body: _body, headers: _header } = _a, requestOptions = tslib_1.__rest(_a, ["body", "headers"]);
17
+ const headers = Object.assign({ [exports.HEADER_CONTENT_TYPE]: exports.CONTENT_TYPES.APPLICATION_JSON }, _header);
18
+ let body = _body;
19
+ if (body && headers[exports.HEADER_CONTENT_TYPE].startsWith(exports.CONTENT_TYPES.APPLICATION_JSON)) {
20
+ body = JSON.stringify((0, display_1.safeParse)(body));
21
+ }
22
+ return Object.assign({ body,
23
+ headers }, requestOptions);
24
+ };
25
+ exports.prepareRequestOptions = prepareRequestOptions;
26
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/shared/request.js"],"names":[],"mappings":";;;;AAAA,uCAAgD;AAEnC,QAAA,mBAAmB,GAAG,cAAc,CAAA;AACpC,QAAA,aAAa,GAAG;IAC3B,gBAAgB,EAAE,kBAAkB;CACrC,CAAA;AAEM,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;IAChD,MAAM,MAAM,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IAEjD,OAAO,IAAA,mBAAS,EAAC,MAAM,CAAC,CAAA;AAC1B,CAAC,CAAA;AAJY,QAAA,gBAAgB,oBAI5B;AAEM,MAAM,qBAAqB,GAAG,CAAC,KAAuD,EAAE,EAAE,EAAE;QAA7D,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,OAA0B,EAArB,cAAc,sBAAlD,mBAAoD,CAAF;IACtF,MAAM,OAAO,mBACX,CAAC,2BAAmB,CAAC,EAAE,qBAAa,CAAC,gBAAgB,IAClD,OAAO,CACX,CAAA;IAED,IAAI,IAAI,GAAG,KAAK,CAAA;IAChB,IAAI,IAAI,IAAI,OAAO,CAAC,2BAAmB,CAAC,CAAC,UAAU,CAAC,qBAAa,CAAC,gBAAgB,CAAC,EAAE;QACnF,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,CAAC,CAAA;KACvC;IAED,uBACE,IAAI;QACJ,OAAO,IACJ,cAAc,EAClB;AACH,CAAC,CAAA;AAhBY,QAAA,qBAAqB,yBAgBjC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agnostack/next-shopify",
3
- "version": "1.14.1-beta.21",
3
+ "version": "1.14.1-beta.23",
4
4
  "author": "agnoStack Dev <developers@agnostack.com> (https://agnostack.com)",
5
5
  "owner": "agnoStack",
6
6
  "description": "Please contact agnoStack via info@agnostack.com for any questions",
@@ -1 +0,0 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/request.js"],"names":[],"mappings":"AAIA,iDAAiD;;;;AAK1C,kEAIN;AAEM;;;;;;EAgBN;AAGM,sDAaN"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/lib/utils/request.js"],"names":[],"mappings":";;;;AAAA,gEAAiC;AAEjC,yCAAmD;AAEtC,QAAA,mBAAmB,GAAG,cAAc,CAAA;AACpC,QAAA,aAAa,GAAG;IAC3B,gBAAgB,EAAE,kBAAkB;CACrC,CAAA;AAEM,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;IAChD,MAAM,MAAM,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,CAAC,IAAI,CAAC,CAAC,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