@shopify/shopify-api 1.4.3 → 2.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 CHANGED
@@ -7,6 +7,20 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## [2.0.0] - 2021-10-28
11
+
12
+ ### Added
13
+
14
+ - Add a 5 second `clockTolerance` to fix `jwt not active` error [#227](https://github.com/Shopify/shopify-node-api/pull/227)
15
+ - [Breaking] Change default for OAuth.beginAuth to online sessions [#203](https://github.com/Shopify/shopify-node-api/pull/203)
16
+ - see [oauth.md](https://github.com/Shopify/shopify-node-api/blob/main/docs/usage/oauth.md) for updated docs
17
+ - [Breaking] Return and delete session in `validateAuthCallback` [#217](https://github.com/Shopify/shopify-node-api/pull/217)
18
+ - see [oauth.md](https://github.com/Shopify/shopify-node-api/blob/main/docs/usage/oauth.md) for updated usage
19
+ - [Breaking] Extract `addHandler` and `getHandler` methods for webhooks out of `register` [#205](https://github.com/Shopify/shopify-node-api/pull/205)
20
+ - [Breaking] Sessions no longer default to `false` for `isOnline` [#169](https://github.com/Shopify/shopify-node-api/pull/169)
21
+ - Required `Session` arguments must be passed to the constructor [#169](https://github.com/Shopify/shopify-node-api/pull/169)
22
+ - Allow `undefined` in `AuthScopes` [#169](https://github.com/Shopify/shopify-node-api/pull/169)
23
+
10
24
  ## [1.4.3] - 2021-10-22
11
25
 
12
26
  ### Fixed
@@ -1,4 +1,5 @@
1
1
  import http from 'http';
2
+ import { SessionInterface } from '../session/types';
2
3
  import { AuthQuery } from './types';
3
4
  declare const ShopifyOAuth: {
4
5
  SESSION_COOKIE_NAME: string;
@@ -11,7 +12,7 @@ declare const ShopifyOAuth: {
11
12
  * @param redirect Redirect url for callback
12
13
  * @param isOnline Boolean value. If true, appends 'per-user' grant options to authorization url to receive online access token.
13
14
  * During final oauth request, will receive back the online access token and current online session information.
14
- * Defaults to offline access.
15
+ * Defaults to online access.
15
16
  */
16
17
  beginAuth(request: http.IncomingMessage, response: http.ServerResponse, shop: string, redirectPath: string, isOnline?: boolean): Promise<string>;
17
18
  /**
@@ -23,8 +24,9 @@ declare const ShopifyOAuth: {
23
24
  * @param response Current HTTP Response
24
25
  * @param query Current HTTP Request Query, containing the information to be validated.
25
26
  * Depending on framework, this may need to be cast as "unknown" before being passed.
27
+ * @returns SessionInterface
26
28
  */
27
- validateAuthCallback(request: http.IncomingMessage, response: http.ServerResponse, query: AuthQuery): Promise<void>;
29
+ validateAuthCallback(request: http.IncomingMessage, response: http.ServerResponse, query: AuthQuery): Promise<SessionInterface>;
28
30
  /**
29
31
  * Loads the current session id from the session cookie.
30
32
  *
@@ -1 +1 @@
1
- {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../src/auth/oauth/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAiBxB,OAAO,EACL,SAAS,EAIV,MAAM,SAAS,CAAC;AAEjB,QAAA,MAAM,YAAY;;IAGhB;;;;;;;;;;OAUG;uBAEQ,IAAI,CAAC,eAAe,YACnB,IAAI,CAAC,cAAc,QACvB,MAAM,gBACE,MAAM,uBAEnB,OAAO,CAAC,MAAM,CAAC;IAgDlB;;;;;;;;;OASG;kCAEQ,IAAI,CAAC,eAAe,YACnB,IAAI,CAAC,cAAc,SACtB,SAAS,GACf,OAAO,CAAC,IAAI,CAAC;IAqGhB;;;;;OAKG;gCAEQ,IAAI,CAAC,eAAe,YACnB,IAAI,CAAC,cAAc,GAC5B,MAAM,GAAG,SAAS;IAQrB;;;;;OAKG;0BACmB,MAAM,UAAU,MAAM,GAAG,MAAM;IAIrD;;;;OAIG;8BACuB,MAAM,GAAG,MAAM;IAIzC;;;;;;OAMG;iCAEQ,IAAI,CAAC,eAAe,YACnB,IAAI,CAAC,cAAc,uBAE5B,MAAM,GAAG,SAAS;CAiCtB,CAAC;AAgBF,OAAO,EAAC,YAAY,EAAC,CAAC"}
1
+ {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../src/auth/oauth/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAgBxB,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAElD,OAAO,EACL,SAAS,EAIV,MAAM,SAAS,CAAC;AAEjB,QAAA,MAAM,YAAY;;IAGhB;;;;;;;;;;OAUG;uBAEQ,IAAI,CAAC,eAAe,YACnB,IAAI,CAAC,cAAc,QACvB,MAAM,gBACE,MAAM,uBAEnB,OAAO,CAAC,MAAM,CAAC;IAgDlB;;;;;;;;;;OAUG;kCAEQ,IAAI,CAAC,eAAe,YACnB,IAAI,CAAC,cAAc,SACtB,SAAS,GACf,OAAO,CAAC,gBAAgB,CAAC;IAmG5B;;;;;OAKG;gCAEQ,IAAI,CAAC,eAAe,YACnB,IAAI,CAAC,cAAc,GAC5B,MAAM,GAAG,SAAS;IAQrB;;;;;OAKG;0BACmB,MAAM,UAAU,MAAM,GAAG,MAAM;IAIrD;;;;OAIG;8BACuB,MAAM,GAAG,MAAM;IAIzC;;;;;;OAMG;iCAEQ,IAAI,CAAC,eAAe,YACnB,IAAI,CAAC,cAAc,uBAE5B,MAAM,GAAG,SAAS;CAiCtB,CAAC;AAgBF,OAAO,EAAC,YAAY,EAAC,CAAC"}
@@ -26,10 +26,10 @@ var ShopifyOAuth = {
26
26
  * @param redirect Redirect url for callback
27
27
  * @param isOnline Boolean value. If true, appends 'per-user' grant options to authorization url to receive online access token.
28
28
  * During final oauth request, will receive back the online access token and current online session information.
29
- * Defaults to offline access.
29
+ * Defaults to online access.
30
30
  */
31
31
  beginAuth: function (request, response, shop, redirectPath, isOnline) {
32
- if (isOnline === void 0) { isOnline = false; }
32
+ if (isOnline === void 0) { isOnline = true; }
33
33
  return tslib_1.__awaiter(this, void 0, void 0, function () {
34
34
  var cookies, state, session, sessionStored, query, queryString;
35
35
  return tslib_1.__generator(this, function (_a) {
@@ -42,10 +42,7 @@ var ShopifyOAuth = {
42
42
  secure: true,
43
43
  });
44
44
  state = nonce_1.default();
45
- session = new session_1.Session(isOnline ? uuid_1.v4() : this.getOfflineSessionId(shop));
46
- session.shop = shop;
47
- session.state = state;
48
- session.isOnline = isOnline;
45
+ session = new session_1.Session(isOnline ? uuid_1.v4() : this.getOfflineSessionId(shop), shop, state, isOnline);
49
46
  return [4 /*yield*/, context_1.Context.SESSION_STORAGE.storeSession(session)];
50
47
  case 1:
51
48
  sessionStored = _a.sent();
@@ -80,10 +77,11 @@ var ShopifyOAuth = {
80
77
  * @param response Current HTTP Response
81
78
  * @param query Current HTTP Request Query, containing the information to be validated.
82
79
  * Depending on framework, this may need to be cast as "unknown" before being passed.
80
+ * @returns SessionInterface
83
81
  */
84
82
  validateAuthCallback: function (request, response, query) {
85
83
  return tslib_1.__awaiter(this, void 0, void 0, function () {
86
- var cookies, sessionCookie, currentSession, body, postParams, client, postResponse, responseBody, access_token, scope, rest, sessionExpiration, responseBody, oauthSessionExpiration, onlineInfo, jwtSessionId, jwtSession, sessionStored;
84
+ var cookies, sessionCookie, currentSession, body, postParams, client, postResponse, responseBody, access_token, scope, rest, sessionExpiration, onlineInfo, jwtSessionId, jwtSession, sessionDeleted, responseBody, sessionStored;
87
85
  return tslib_1.__generator(this, function (_a) {
88
86
  switch (_a.label) {
89
87
  case 0:
@@ -120,50 +118,46 @@ var ShopifyOAuth = {
120
118
  return [4 /*yield*/, client.post(postParams)];
121
119
  case 2:
122
120
  postResponse = _a.sent();
123
- if (currentSession.isOnline) {
124
- responseBody = postResponse.body;
125
- access_token = responseBody.access_token, scope = responseBody.scope, rest = tslib_1.__rest(responseBody, ["access_token", "scope"]);
126
- sessionExpiration = new Date(Date.now() + responseBody.expires_in * 1000);
127
- currentSession.accessToken = access_token;
128
- currentSession.expires = sessionExpiration;
129
- currentSession.scope = scope;
130
- currentSession.onlineAccessInfo = rest;
131
- }
132
- else {
133
- responseBody = postResponse.body;
134
- currentSession.accessToken = responseBody.access_token;
135
- currentSession.scope = responseBody.scope;
136
- }
137
- oauthSessionExpiration = currentSession.expires;
138
- if (!!currentSession.isOnline) return [3 /*break*/, 3];
139
- oauthSessionExpiration = new Date();
140
- return [3 /*break*/, 5];
141
- case 3:
142
- if (!context_1.Context.IS_EMBEDDED_APP) return [3 /*break*/, 5];
121
+ if (!currentSession.isOnline) return [3 /*break*/, 5];
122
+ responseBody = postResponse.body;
123
+ access_token = responseBody.access_token, scope = responseBody.scope, rest = tslib_1.__rest(responseBody, ["access_token", "scope"]);
124
+ sessionExpiration = new Date(Date.now() + responseBody.expires_in * 1000);
125
+ currentSession.accessToken = access_token;
126
+ currentSession.expires = sessionExpiration;
127
+ currentSession.scope = scope;
128
+ currentSession.onlineAccessInfo = rest;
129
+ if (!context_1.Context.IS_EMBEDDED_APP) return [3 /*break*/, 4];
143
130
  onlineInfo = currentSession.onlineAccessInfo;
144
131
  jwtSessionId = this.getJwtSessionId(currentSession.shop, "" + onlineInfo.associated_user.id);
145
132
  jwtSession = session_1.Session.cloneSession(currentSession, jwtSessionId);
146
- return [4 /*yield*/, context_1.Context.SESSION_STORAGE.storeSession(jwtSession)];
147
- case 4:
148
- _a.sent();
149
- // Make sure the current OAuth session expires along with the cookie
150
- oauthSessionExpiration = new Date(Date.now() + 30000);
151
- currentSession.expires = oauthSessionExpiration;
152
- _a.label = 5;
133
+ return [4 /*yield*/, context_1.Context.SESSION_STORAGE.deleteSession(currentSession.id)];
134
+ case 3:
135
+ sessionDeleted = _a.sent();
136
+ if (!sessionDeleted) {
137
+ throw new ShopifyErrors.SessionStorageError('OAuth Session could not be deleted. Please check your session storage functionality.');
138
+ }
139
+ currentSession = jwtSession;
140
+ _a.label = 4;
141
+ case 4: return [3 /*break*/, 6];
153
142
  case 5:
143
+ responseBody = postResponse.body;
144
+ currentSession.accessToken = responseBody.access_token;
145
+ currentSession.scope = responseBody.scope;
146
+ _a.label = 6;
147
+ case 6:
154
148
  cookies.set(ShopifyOAuth.SESSION_COOKIE_NAME, currentSession.id, {
155
149
  signed: true,
156
- expires: oauthSessionExpiration,
150
+ expires: context_1.Context.IS_EMBEDDED_APP ? new Date() : currentSession.expires,
157
151
  sameSite: 'lax',
158
152
  secure: true,
159
153
  });
160
154
  return [4 /*yield*/, context_1.Context.SESSION_STORAGE.storeSession(currentSession)];
161
- case 6:
155
+ case 7:
162
156
  sessionStored = _a.sent();
163
157
  if (!sessionStored) {
164
158
  throw new ShopifyErrors.SessionStorageError('OAuth Session could not be saved. Please check your session storage functionality.');
165
159
  }
166
- return [2 /*return*/];
160
+ return [2 /*return*/, currentSession];
167
161
  }
168
162
  });
169
163
  });
@@ -2,9 +2,9 @@ declare class AuthScopes {
2
2
  static SCOPE_DELIMITER: string;
3
3
  private compressedScopes;
4
4
  private expandedScopes;
5
- constructor(scopes: string | string[]);
6
- has(scope: string | string[] | AuthScopes): boolean;
7
- equals(otherScopes: string | string[] | AuthScopes): boolean;
5
+ constructor(scopes: string | string[] | undefined);
6
+ has(scope: string | string[] | AuthScopes | undefined): boolean;
7
+ equals(otherScopes: string | string[] | AuthScopes | undefined): boolean;
8
8
  toString(): string;
9
9
  toArray(): string[];
10
10
  private getImpliedScopes;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/scopes/index.ts"],"names":[],"mappings":"AAAA,cAAM,UAAU;IACd,OAAc,eAAe,SAAO;IAEpC,OAAO,CAAC,gBAAgB,CAAc;IACtC,OAAO,CAAC,cAAc,CAAc;gBAExB,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE;IAyB9B,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAczC,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAelD,QAAQ;IAIR,OAAO;IAId,OAAO,CAAC,gBAAgB;CAUzB;AAED,OAAO,EAAC,UAAU,EAAC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/scopes/index.ts"],"names":[],"mappings":"AACA,cAAM,UAAU;IACd,OAAc,eAAe,SAAO;IAEpC,OAAO,CAAC,gBAAgB,CAAc;IACtC,OAAO,CAAC,cAAc,CAAc;gBAExB,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS;IAyB1C,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU,GAAG,SAAS;IAcrD,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU,GAAG,SAAS;IAe9D,QAAQ;IAIR,OAAO;IAId,OAAO,CAAC,gBAAgB;CAUzB;AAED,OAAO,EAAC,UAAU,EAAC,CAAC"}
@@ -8,7 +8,7 @@ var AuthScopes = /** @class */ (function () {
8
8
  if (typeof scopes === 'string') {
9
9
  scopesArray = scopes.split(new RegExp(AuthScopes.SCOPE_DELIMITER + "\\s*"));
10
10
  }
11
- else {
11
+ else if (scopes) {
12
12
  scopesArray = scopes;
13
13
  }
14
14
  scopesArray = scopesArray
@@ -5,15 +5,15 @@ import { SessionInterface } from './types';
5
5
  */
6
6
  declare class Session implements SessionInterface {
7
7
  readonly id: string;
8
- static cloneSession(session: Session, newId: string): Session;
9
8
  shop: string;
10
9
  state: string;
11
- scope: string;
10
+ isOnline: boolean;
11
+ static cloneSession(session: Session, newId: string): Session;
12
+ scope?: string;
12
13
  expires?: Date;
13
- isOnline?: boolean;
14
14
  accessToken?: string;
15
15
  onlineAccessInfo?: OnlineAccessInfo;
16
- constructor(id: string);
16
+ constructor(id: string, shop: string, state: string, isOnline: boolean);
17
17
  isActive(): boolean;
18
18
  }
19
19
  export { Session };
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/auth/session/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;A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W3B;AAED,OAAO,EAAC,OAAO,EAAC,CAAC"}
@@ -6,16 +6,16 @@ var context_1 = require("../../context");
6
6
  * Stores App information from logged in merchants so they can make authenticated requests to the Admin API.
7
7
  */
8
8
  var Session = /** @class */ (function () {
9
- function Session(id) {
9
+ function Session(id, shop, state, isOnline) {
10
10
  this.id = id;
11
+ this.shop = shop;
12
+ this.state = state;
13
+ this.isOnline = isOnline;
11
14
  }
12
15
  Session.cloneSession = function (session, newId) {
13
- var newSession = new Session(newId);
14
- newSession.shop = session.shop;
15
- newSession.state = session.state;
16
+ var newSession = new Session(newId, session.shop, session.state, session.isOnline);
16
17
  newSession.scope = session.scope;
17
18
  newSession.expires = session.expires;
18
- newSession.isOnline = session.isOnline;
19
19
  newSession.accessToken = session.accessToken;
20
20
  newSession.onlineAccessInfo = session.onlineAccessInfo;
21
21
  return newSession;
@@ -1 +1 @@
1
- {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../../../src/auth/session/storage/custom.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAGlD,qBAAa,oBAAqB,YAAW,cAAc;IAEvD,QAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,OAAO,CAAC;IACvE,QAAQ,CAAC,YAAY,EAAE,CACrB,EAAE,EAAE,MAAM,KACP,OAAO,CAAC,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IACpE,QAAQ,CAAC,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC;gBAJhD,aAAa,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,OAAO,CAAC,EAC9D,YAAY,EAAE,CACrB,EAAE,EAAE,MAAM,KACP,OAAO,CAAC,gBAAgB,GAAG,MA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C;IAUzD,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IA0C9D,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CASzD"}
@@ -53,7 +53,7 @@ var CustomSessionStorage = /** @class */ (function () {
53
53
  return [2 /*return*/, result];
54
54
  }
55
55
  else if (result instanceof Object && 'id' in result) {
56
- session = new session_1.Session(result.id);
56
+ session = new session_1.Session(result.id, result.shop, result.state, result.isOnline);
57
57
  session = tslib_1.__assign(tslib_1.__assign({}, session), result);
58
58
  if (session.expires && typeof session.expires === 'string') {
59
59
  session.expires = new Date(session.expires);
@@ -3,9 +3,9 @@ export interface SessionInterface {
3
3
  readonly id: string;
4
4
  shop: string;
5
5
  state: string;
6
- scope: string;
6
+ isOnline: boolean;
7
+ scope?: string;
7
8
  expires?: Date;
8
- isOnline?: boolean;
9
9
  accessToken?: string;
10
10
  onlineAccessInfo?: OnlineAccessInfo;
11
11
  isActive(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/auth/session/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAEhD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,QAAQ,IAAI,OAAO,CAAC;CACrB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/auth/session/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAEhD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,QAAQ,IAAI,OAAO,CAAC;CACrB"}
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export declare const Shopify: {
5
5
  Auth: {
6
6
  SESSION_COOKIE_NAME: string;
7
7
  beginAuth(request: import("http").IncomingMessage, response: import("http").ServerResponse, shop: string, redirectPath: string, isOnline?: boolean): Promise<string>;
8
- validateAuthCallback(request: import("http").IncomingMessage, response: import("http").ServerResponse, query: import("./types").AuthQuery): Promise<void>;
8
+ validateAuthCallback(request: import("http").IncomingMessage, response: import("http").ServerResponse, query: import("./types").AuthQuery): Promise<import("./types").SessionInterface>;
9
9
  getCookieSessionId(request: import("http").IncomingMessage, response: import("http").ServerResponse): string | undefined;
10
10
  getJwtSessionId(shop: string, userId: string): string;
11
11
  getOfflineSessionId(shop: string): string;
@@ -1 +1 @@
1
- {"version":3,"file":"decode-session-token.d.ts","sourceRoot":"","sources":["../../src/utils/decode-session-token.ts"],"names":[],"mappings":"AAOA,UAAU,UAAU;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;GAIG;AACH,iBAAS,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAyBrD;AAED,eAAe,kBAAkB,CAAC;AAElC,OAAO,EAAC,kBAAkB,EAAE,UAAU,EAAC,CAAC"}
1
+ {"version":3,"file":"decode-session-token.d.ts","sourceRoot":"","sources":["../../src/utils/decode-session-token.ts"],"names":[],"mappings":"AASA,UAAU,UAAU;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;GAIG;AACH,iBAAS,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CA0BrD;AAED,eAAe,kBAAkB,CAAC;AAElC,OAAO,EAAC,kBAAkB,EAAE,UAAU,EAAC,CAAC"}
@@ -6,6 +6,7 @@ var jsonwebtoken_1 = tslib_1.__importDefault(require("jsonwebtoken"));
6
6
  var context_1 = require("../context");
7
7
  var ShopifyErrors = tslib_1.__importStar(require("../error"));
8
8
  var shop_validator_1 = tslib_1.__importDefault(require("./shop-validator"));
9
+ var JWT_PERMITTED_CLOCK_TOLERANCE = 5;
9
10
  /**
10
11
  * Decodes the given session token, and extracts the session information from it
11
12
  *
@@ -16,6 +17,7 @@ function decodeSessionToken(token) {
16
17
  try {
17
18
  payload = jsonwebtoken_1.default.verify(token, context_1.Context.API_SECRET_KEY, {
18
19
  algorithms: ['HS256'],
20
+ clockTolerance: JWT_PERMITTED_CLOCK_TOLERANCE,
19
21
  });
20
22
  }
21
23
  catch (error) {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const SHOPIFY_API_LIBRARY_VERSION = "1.4.3";
1
+ export declare const SHOPIFY_API_LIBRARY_VERSION = "2.0.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SHOPIFY_API_LIBRARY_VERSION = void 0;
4
- exports.SHOPIFY_API_LIBRARY_VERSION = '1.4.3';
4
+ exports.SHOPIFY_API_LIBRARY_VERSION = '2.0.0';
@@ -1,14 +1,48 @@
1
1
  /// <reference types="node" />
2
2
  import http from 'http';
3
- import { DeliveryMethod, RegisterOptions, RegisterReturn, WebhookRegistryEntry } from './types';
3
+ import { DeliveryMethod, RegisterOptions, RegisterReturn, WebhookRegistryEntry, ShortenedRegisterOptions } from './types';
4
+ interface AddHandlersProps {
5
+ [topic: string]: WebhookRegistryEntry;
6
+ }
4
7
  interface RegistryInterface {
5
- webhookRegistry: WebhookRegistryEntry[];
8
+ webhookRegistry: {
9
+ [topic: string]: WebhookRegistryEntry;
10
+ };
11
+ /**
12
+ * Sets the handler for the given topic. If a handler was previously set for the same topic, it will be overridden.
13
+ *
14
+ * @param topic String used to add a handler
15
+ * @param options Paramters to add a handler which are path and webHookHandler
16
+ */
17
+ addHandler(topic: string, options: WebhookRegistryEntry): void;
18
+ /**
19
+ * Sets a list of handlers for the given topics using the `addHandler` function
20
+ *
21
+ * @param handlers Object in format {topic: WebhookRegistryEntry}
22
+ */
23
+ addHandlers(handlers: AddHandlersProps): void;
24
+ /**
25
+ * Fetches the handler for the given topic. Returns null if no handler was registered.
26
+ *
27
+ * @param topic The topic to check
28
+ */
29
+ getHandler(topic: string): WebhookRegistryEntry | null;
30
+ /**
31
+ * Gets all topics
32
+ */
33
+ getTopics(): string[];
6
34
  /**
7
35
  * Registers a Webhook Handler function for a given topic.
8
36
  *
9
- * @param options Parameters to register a handler, including topic, listening address, handler function
37
+ * @param options Parameters to register a handler, including topic, listening address, delivery method
10
38
  */
11
39
  register(options: RegisterOptions): Promise<RegisterReturn>;
40
+ /**
41
+ * Registers multiple Webhook Handler functions.
42
+ *
43
+ * @param options Parameters to register a handler, including topic, listening address, delivery method
44
+ */
45
+ registerAll(options: ShortenedRegisterOptions): Promise<RegisterReturn>;
12
46
  /**
13
47
  * Processes the webhook request received from the Shopify API
14
48
  *
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/webhooks/registry.ts"],"names":[],"mappings":";AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AAUxB,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,oBAAoB,EAGrB,MAAM,SAAS,CAAC;AAEjB,UAAU,iBAAiB;IACzB,eAAe,EAAE,oBAAoB,EAAE,CAAC;IAExC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE5D;;;;;OAKG;IACH,OAAO,CACL,OAAO,EAAE,IAAI,CAAC,eAAe,EAC7B,QAAQ,EAAE,IAAI,CAAC,cAAc,GAC5B,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACtC;AAwDD,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAwC9C;AAED,iBAAS,UAAU,CACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,GAAE,cAAoC,EACpD,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAmDR;AAED,QAAA,MAAM,gBAAgB,EAAE,iBAyLvB,CAAC;AAEF,OAAO,EAAC,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAC,CAAC"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/webhooks/registry.ts"],"names":[],"mappings":";AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AAUxB,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,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,UAAU,EAAC,CAAC"}
@@ -100,14 +100,32 @@ function buildQuery(topic, address, deliveryMethod, webhookId) {
100
100
  }
101
101
  exports.buildQuery = buildQuery;
102
102
  var WebhooksRegistry = {
103
- webhookRegistry: [],
103
+ webhookRegistry: {},
104
+ addHandler: function (topic, _a) {
105
+ var path = _a.path, webhookHandler = _a.webhookHandler;
106
+ WebhooksRegistry.webhookRegistry[topic] = { path: path, webhookHandler: webhookHandler };
107
+ },
108
+ addHandlers: function (handlers) {
109
+ for (var topic in handlers) {
110
+ if ({}.hasOwnProperty.call(handlers, topic)) {
111
+ WebhooksRegistry.addHandler(topic, handlers[topic]);
112
+ }
113
+ }
114
+ },
115
+ getHandler: function (topic) {
116
+ return topic in WebhooksRegistry.webhookRegistry ? WebhooksRegistry.webhookRegistry[topic] : null;
117
+ },
118
+ getTopics: function () {
119
+ return Object.keys(WebhooksRegistry.webhookRegistry);
120
+ },
104
121
  register: function (_a) {
105
- var path = _a.path, topic = _a.topic, accessToken = _a.accessToken, shop = _a.shop, _b = _a.deliveryMethod, deliveryMethod = _b === void 0 ? types_1.DeliveryMethod.Http : _b, webhookHandler = _a.webhookHandler;
122
+ var path = _a.path, topic = _a.topic, accessToken = _a.accessToken, shop = _a.shop, _b = _a.deliveryMethod, deliveryMethod = _b === void 0 ? types_1.DeliveryMethod.Http : _b;
106
123
  return tslib_1.__awaiter(this, void 0, void 0, function () {
107
- var client, address, checkResult, webhookId, mustRegister, node, endpointAddress, success, body, result;
124
+ var registerReturn, client, address, checkResult, webhookId, mustRegister, node, endpointAddress, result;
108
125
  return tslib_1.__generator(this, function (_c) {
109
126
  switch (_c.label) {
110
127
  case 0:
128
+ registerReturn = {};
111
129
  validateDeliveryMethod(deliveryMethod);
112
130
  client = new graphql_client_1.GraphqlClient(shop, accessToken);
113
131
  address = deliveryMethod === types_1.DeliveryMethod.Http
@@ -144,21 +162,70 @@ var WebhooksRegistry = {
144
162
  })];
145
163
  case 2:
146
164
  result = _c.sent();
147
- success = isSuccess(result.body, deliveryMethod, webhookId);
148
- body = result.body;
165
+ registerReturn[topic] = {
166
+ success: isSuccess(result.body, deliveryMethod, webhookId),
167
+ result: result.body,
168
+ };
149
169
  return [3 /*break*/, 4];
150
170
  case 3:
151
- success = true;
152
- body = {};
171
+ registerReturn[topic] = {
172
+ success: true,
173
+ result: {},
174
+ };
153
175
  _c.label = 4;
176
+ case 4: return [2 /*return*/, registerReturn];
177
+ }
178
+ });
179
+ });
180
+ },
181
+ registerAll: function (_a) {
182
+ var accessToken = _a.accessToken, shop = _a.shop, _b = _a.deliveryMethod, deliveryMethod = _b === void 0 ? types_1.DeliveryMethod.Http : _b;
183
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
184
+ var registerReturn, topics, topics_1, topics_1_1, topic, handler, path, webhook, returnedRegister, e_1_1;
185
+ var e_1, _c;
186
+ return tslib_1.__generator(this, function (_d) {
187
+ switch (_d.label) {
188
+ case 0:
189
+ registerReturn = {};
190
+ topics = WebhooksRegistry.getTopics();
191
+ _d.label = 1;
192
+ case 1:
193
+ _d.trys.push([1, 6, 7, 8]);
194
+ topics_1 = tslib_1.__values(topics), topics_1_1 = topics_1.next();
195
+ _d.label = 2;
196
+ case 2:
197
+ if (!!topics_1_1.done) return [3 /*break*/, 5];
198
+ topic = topics_1_1.value;
199
+ handler = WebhooksRegistry.getHandler(topic);
200
+ if (!handler) return [3 /*break*/, 4];
201
+ path = handler.path;
202
+ webhook = {
203
+ path: path,
204
+ topic: topic,
205
+ accessToken: accessToken,
206
+ shop: shop,
207
+ deliveryMethod: deliveryMethod,
208
+ };
209
+ return [4 /*yield*/, WebhooksRegistry.register(webhook)];
210
+ case 3:
211
+ returnedRegister = _d.sent();
212
+ registerReturn = tslib_1.__assign(tslib_1.__assign({}, registerReturn), returnedRegister);
213
+ _d.label = 4;
154
214
  case 4:
155
- if (success) {
156
- // Remove this topic from the registry if it is already there
157
- WebhooksRegistry.webhookRegistry =
158
- WebhooksRegistry.webhookRegistry.filter(function (item) { return item.topic !== topic; });
159
- WebhooksRegistry.webhookRegistry.push({ path: path, topic: topic, webhookHandler: webhookHandler });
215
+ topics_1_1 = topics_1.next();
216
+ return [3 /*break*/, 2];
217
+ case 5: return [3 /*break*/, 8];
218
+ case 6:
219
+ e_1_1 = _d.sent();
220
+ e_1 = { error: e_1_1 };
221
+ return [3 /*break*/, 8];
222
+ case 7:
223
+ try {
224
+ if (topics_1_1 && !topics_1_1.done && (_c = topics_1.return)) _c.call(topics_1);
160
225
  }
161
- return [2 /*return*/, { success: success, result: body }];
226
+ finally { if (e_1) throw e_1.error; }
227
+ return [7 /*endfinally*/];
228
+ case 8: return [2 /*return*/, registerReturn];
162
229
  }
163
230
  });
164
231
  });
@@ -174,7 +241,7 @@ var WebhooksRegistry = {
174
241
  reqBody += chunk;
175
242
  });
176
243
  request.on('end', function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
177
- var hmac, topic, domain, missingHeaders, statusCode, responseError, headers, generatedHash, graphqlTopic_1, webhookEntry, error_1;
244
+ var hmac, topic, domain, missingHeaders, statusCode, responseError, headers, generatedHash, graphqlTopic, webhookEntry, error_1;
178
245
  return tslib_1.__generator(this, function (_a) {
179
246
  switch (_a.label) {
180
247
  case 0:
@@ -217,15 +284,13 @@ var WebhooksRegistry = {
217
284
  .update(reqBody, 'utf8')
218
285
  .digest('base64');
219
286
  if (!utils_1.default.safeCompare(generatedHash, hmac)) return [3 /*break*/, 7];
220
- graphqlTopic_1 = topic
221
- .toUpperCase()
222
- .replace(/\//g, '_');
223
- webhookEntry = WebhooksRegistry.webhookRegistry.find(function (entry) { return entry.topic === graphqlTopic_1; });
287
+ graphqlTopic = topic.toUpperCase().replace(/\//g, '_');
288
+ webhookEntry = WebhooksRegistry.getHandler(graphqlTopic);
224
289
  if (!webhookEntry) return [3 /*break*/, 5];
225
290
  _a.label = 1;
226
291
  case 1:
227
292
  _a.trys.push([1, 3, , 4]);
228
- return [4 /*yield*/, webhookEntry.webhookHandler(graphqlTopic_1, domain, reqBody)];
293
+ return [4 /*yield*/, webhookEntry.webhookHandler(graphqlTopic, domain, reqBody)];
229
294
  case 2:
230
295
  _a.sent();
231
296
  statusCode = network_1.StatusCode.Ok;
@@ -264,7 +329,12 @@ var WebhooksRegistry = {
264
329
  });
265
330
  },
266
331
  isWebhookPath: function (path) {
267
- return Boolean(WebhooksRegistry.webhookRegistry.find(function (entry) { return entry.path === path; }));
332
+ for (var key in WebhooksRegistry.webhookRegistry) {
333
+ if (WebhooksRegistry.webhookRegistry[key].path === path) {
334
+ return true;
335
+ }
336
+ }
337
+ return false;
268
338
  },
269
339
  };
270
340
  exports.WebhooksRegistry = WebhooksRegistry;
@@ -9,16 +9,21 @@ export interface RegisterOptions {
9
9
  path: string;
10
10
  shop: string;
11
11
  accessToken: string;
12
- webhookHandler: WebhookHandlerFunction;
12
+ deliveryMethod?: DeliveryMethod;
13
+ }
14
+ export interface ShortenedRegisterOptions {
15
+ shop: string;
16
+ accessToken: string;
13
17
  deliveryMethod?: DeliveryMethod;
14
18
  }
15
19
  export interface RegisterReturn {
16
- success: boolean;
17
- result: unknown;
20
+ [topic: string]: {
21
+ success: boolean;
22
+ result: unknown;
23
+ };
18
24
  }
19
25
  export interface WebhookRegistryEntry {
20
26
  path: string;
21
- topic: string;
22
27
  webhookHandler: WebhookHandlerFunction;
23
28
  }
24
29
  interface WebhookCheckResponseNode<T = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/webhooks/types.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,IAAI,SAAS;IACb,WAAW,gBAAgB;IAC3B,MAAM,WAAW;CAClB;AAED,aAAK,sBAAsB,GAAG,CAC5B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,KACT,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,WAAW,eAAe;IAE9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE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AAE,CAAC;SACZ,CAAC;KACH,CAAC;CACH;AAED,oBAAY,0BAA0B,GACpC,oBAAoB,CAAC,8BAA8B,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopify/shopify-api",
3
- "version": "1.4.3",
3
+ "version": "2.0.0",
4
4
  "description": "Shopify API Library for Node - accelerate development with support for authentication, graphql proxy, webhooks",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",