@shopify/shopify-api 4.1.0 → 5.0.1

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +26 -5
  2. package/dist/auth/oauth/oauth.d.ts.map +1 -1
  3. package/dist/auth/oauth/oauth.js +7 -5
  4. package/dist/auth/session/session_storage.d.ts +12 -0
  5. package/dist/auth/session/session_storage.d.ts.map +1 -1
  6. package/dist/auth/session/storage/custom.d.ts +5 -1
  7. package/dist/auth/session/storage/custom.d.ts.map +1 -1
  8. package/dist/auth/session/storage/custom.js +59 -1
  9. package/dist/auth/session/storage/memory.d.ts +2 -0
  10. package/dist/auth/session/storage/memory.d.ts.map +1 -1
  11. package/dist/auth/session/storage/memory.js +20 -0
  12. package/dist/auth/session/storage/mongodb.d.ts +2 -0
  13. package/dist/auth/session/storage/mongodb.d.ts.map +1 -1
  14. package/dist/auth/session/storage/mongodb.js +41 -6
  15. package/dist/auth/session/storage/mysql.d.ts +2 -0
  16. package/dist/auth/session/storage/mysql.d.ts.map +1 -1
  17. package/dist/auth/session/storage/mysql.js +41 -0
  18. package/dist/auth/session/storage/postgresql.d.ts +2 -0
  19. package/dist/auth/session/storage/postgresql.d.ts.map +1 -1
  20. package/dist/auth/session/storage/postgresql.js +41 -0
  21. package/dist/auth/session/storage/redis.d.ts +4 -1
  22. package/dist/auth/session/storage/redis.d.ts.map +1 -1
  23. package/dist/auth/session/storage/redis.js +68 -3
  24. package/dist/auth/session/storage/sqlite.d.ts +2 -0
  25. package/dist/auth/session/storage/sqlite.d.ts.map +1 -1
  26. package/dist/auth/session/storage/sqlite.js +42 -0
  27. package/dist/base-types.d.ts +1 -0
  28. package/dist/base-types.d.ts.map +1 -1
  29. package/dist/clients/graphql/graphql_client.d.ts.map +1 -1
  30. package/dist/clients/graphql/graphql_client.js +25 -14
  31. package/dist/clients/http_client/http_client.d.ts.map +1 -1
  32. package/dist/clients/http_client/http_client.js +5 -1
  33. package/dist/context.d.ts.map +1 -1
  34. package/dist/context.js +3 -0
  35. package/dist/error.d.ts +13 -0
  36. package/dist/error.d.ts.map +1 -1
  37. package/dist/error.js +20 -1
  38. package/dist/index.d.ts +2 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/utils/delete-offline-session.d.ts.map +1 -1
  41. package/dist/utils/delete-offline-session.js +4 -2
  42. package/dist/utils/get-embedded-app-url.d.ts.map +1 -1
  43. package/dist/utils/get-embedded-app-url.js +2 -1
  44. package/dist/utils/index.d.ts +3 -2
  45. package/dist/utils/index.d.ts.map +1 -1
  46. package/dist/utils/index.js +3 -2
  47. package/dist/utils/load-offline-session.d.ts.map +1 -1
  48. package/dist/utils/load-offline-session.js +4 -2
  49. package/dist/utils/setup-jest.d.ts.map +1 -1
  50. package/dist/utils/setup-jest.js +1 -0
  51. package/dist/utils/shop-validator.d.ts +12 -3
  52. package/dist/utils/shop-validator.d.ts.map +1 -1
  53. package/dist/utils/shop-validator.js +39 -7
  54. package/dist/version.d.ts +1 -1
  55. package/dist/version.js +1 -1
  56. package/dist/webhooks/registry.d.ts.map +1 -1
  57. package/dist/webhooks/registry.js +23 -20
  58. package/package.json +1 -1
  59. package/dist/__tests__/fake-resource-with-custom-prefix.d.ts +0 -21
  60. package/dist/__tests__/fake-resource-with-custom-prefix.d.ts.map +0 -1
  61. package/dist/__tests__/fake-resource-with-custom-prefix.js +0 -46
  62. package/dist/__tests__/fake-resource.d.ts +0 -41
  63. package/dist/__tests__/fake-resource.d.ts.map +0 -1
  64. package/dist/__tests__/fake-resource.js +0 -122
  65. package/dist/auth/session/storage/__tests__/battery-of-tests.d.ts +0 -3
  66. package/dist/auth/session/storage/__tests__/battery-of-tests.d.ts.map +0 -1
  67. package/dist/auth/session/storage/__tests__/battery-of-tests.js +0 -191
  68. package/dist/auth/session/storage/__tests__/utils.d.ts +0 -10
  69. package/dist/auth/session/storage/__tests__/utils.d.ts.map +0 -1
  70. package/dist/auth/session/storage/__tests__/utils.js +0 -87
@@ -1,87 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.connectSocket = exports.waitForData = exports.poll = exports.wait = void 0;
4
- var tslib_1 = require("tslib");
5
- function wait(ms) {
6
- return new Promise(function (resolve) { return setTimeout(function () { return resolve(); }, ms); });
7
- }
8
- exports.wait = wait;
9
- function poll(func, _a) {
10
- var _b = _a === void 0 ? {} : _a, _c = _b.interval, interval = _c === void 0 ? 100 : _c, _d = _b.timeout, timeout = _d === void 0 ? 5000 : _d;
11
- return tslib_1.__awaiter(this, void 0, void 0, function () {
12
- var start, elapsed, success, _e;
13
- return tslib_1.__generator(this, function (_f) {
14
- switch (_f.label) {
15
- case 0:
16
- start = Date.now();
17
- _f.label = 1;
18
- case 1:
19
- if (!true) return [3 /*break*/, 7];
20
- elapsed = Date.now() - start;
21
- if (elapsed > timeout) {
22
- throw Error('Timeout');
23
- }
24
- _f.label = 2;
25
- case 2:
26
- _f.trys.push([2, 4, , 5]);
27
- return [4 /*yield*/, func()];
28
- case 3:
29
- success = _f.sent();
30
- if (success)
31
- return [2 /*return*/];
32
- return [3 /*break*/, 5];
33
- case 4:
34
- _e = _f.sent();
35
- return [3 /*break*/, 5];
36
- case 5: return [4 /*yield*/, wait(interval)];
37
- case 6:
38
- _f.sent();
39
- return [3 /*break*/, 1];
40
- case 7: return [2 /*return*/];
41
- }
42
- });
43
- });
44
- }
45
- exports.poll = poll;
46
- function waitForData(socket) {
47
- return new Promise(function (resolve, reject) {
48
- function data() {
49
- resolve('data');
50
- cleanup();
51
- }
52
- function error(err) {
53
- reject(err);
54
- cleanup();
55
- }
56
- function close() {
57
- resolve('no data');
58
- cleanup();
59
- }
60
- function cleanup() {
61
- socket.off('data', data);
62
- socket.off('error', error);
63
- socket.off('close', close);
64
- }
65
- socket.on('data', data);
66
- socket.on('error', error);
67
- socket.on('close', close);
68
- });
69
- }
70
- exports.waitForData = waitForData;
71
- function connectSocket(socket, opts) {
72
- return new Promise(function (resolve, reject) {
73
- function error(err) {
74
- reject(err);
75
- cleanup();
76
- }
77
- function cleanup() {
78
- socket.off('error', error);
79
- }
80
- socket.on('error', error);
81
- socket.connect(opts, function () {
82
- resolve();
83
- cleanup();
84
- });
85
- });
86
- }
87
- exports.connectSocket = connectSocket;