New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@shopify/shopify-api

Package Overview
Dependencies
Maintainers
19
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/shopify-api - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

14

CHANGELOG.md

@@ -10,3 +10,17 @@ # Changelog

## [1.2.0] - 2021-03-16
### Added
- Allow plain objects to be returned from the `loadCallback` on `CustomSessionStorage` [#126](https://github.com/shopify/shopify-node-api/pull/126)
### Fixed
- Throw a different error for a missing cookie upon OAuth return [#131](https://github.com/shopify/shopify-node-api/pull/131)
- Improved documentation for GraphQL and Rest Clients. [#123](https://github.com/Shopify/shopify-node-api/pull/123)
- Made Docs directory more browseable in GitHub. [#136](https://github.com/Shopify/shopify-node-api/pull/136)
- Make sure `CustomSessionStorage` converts the `expires` field from a string to `Date`. [#132](https://github.com/Shopify/shopify-node-api/pull/132)
### Fixed
## [1.1.0] - 2021-03-02
- Minor text/doc changes

@@ -13,0 +27,0 @@ - Added `2021-01` API version to enum. [#117](https://github.com/shopify/shopify-node-api/pull/117)

26

dist/auth/oauth/oauth.js

@@ -86,3 +86,3 @@ "use strict";

return tslib_1.__awaiter(this, void 0, void 0, function () {
var cookies, currentSession, sessionCookie, body, postParams, client, postResponse, responseBody, access_token, scope, rest, sessionExpiration, responseBody, oauthSessionExpiration, onlineInfo, jwtSessionId, jwtSession, sessionStored;
var cookies, sessionCookie, currentSession, body, postParams, client, postResponse, responseBody, access_token, scope, rest, sessionExpiration, responseBody, oauthSessionExpiration, onlineInfo, jwtSessionId, jwtSession, sessionStored;
return tslib_1.__generator(this, function (_a) {

@@ -98,8 +98,8 @@ switch (_a.label) {

sessionCookie = this.getCookieSessionId(request, response);
if (!sessionCookie) return [3 /*break*/, 2];
if (!sessionCookie) {
throw new ShopifyErrors.CookieNotFound("Cannot complete OAuth process. Could not find an OAuth cookie for shop url: " + query.shop);
}
return [4 /*yield*/, context_1.Context.SESSION_STORAGE.loadSession(sessionCookie)];
case 1:
currentSession = _a.sent();
_a.label = 2;
case 2:
if (!currentSession) {

@@ -123,3 +123,3 @@ throw new ShopifyErrors.SessionNotFound("Cannot complete OAuth process. No session found for the specified shop url: " + query.shop);

return [4 /*yield*/, client.post(postParams)];
case 3:
case 2:
postResponse = _a.sent();

@@ -141,7 +141,7 @@ if (currentSession.isOnline) {

oauthSessionExpiration = currentSession.expires;
if (!!currentSession.isOnline) return [3 /*break*/, 4];
if (!!currentSession.isOnline) return [3 /*break*/, 3];
oauthSessionExpiration = new Date();
return [3 /*break*/, 6];
case 4:
if (!context_1.Context.IS_EMBEDDED_APP) return [3 /*break*/, 6];
return [3 /*break*/, 5];
case 3:
if (!context_1.Context.IS_EMBEDDED_APP) return [3 /*break*/, 5];
onlineInfo = currentSession.onlineAccessInfo;

@@ -151,3 +151,3 @@ jwtSessionId = this.getJwtSessionId(currentSession.shop, "" + onlineInfo.associated_user.id);

return [4 /*yield*/, context_1.Context.SESSION_STORAGE.storeSession(jwtSession)];
case 5:
case 4:
_a.sent();

@@ -157,4 +157,4 @@ // Make sure the current OAuth session expires along with the cookie

currentSession.expires = oauthSessionExpiration;
_a.label = 6;
case 6:
_a.label = 5;
case 5:
cookies.set(ShopifyOAuth.SESSION_COOKIE_NAME, currentSession.id, {

@@ -167,3 +167,3 @@ signed: true,

return [4 /*yield*/, context_1.Context.SESSION_STORAGE.storeSession(currentSession)];
case 7:
case 6:
sessionStored = _a.sent();

@@ -170,0 +170,0 @@ if (!sessionStored) {

@@ -5,5 +5,5 @@ import { Session } from '../session';

readonly storeCallback: (session: Session) => Promise<boolean>;
readonly loadCallback: (id: string) => Promise<Session | undefined>;
readonly loadCallback: (id: string) => Promise<Session | Record<string, unknown> | undefined>;
readonly deleteCallback: (id: string) => Promise<boolean>;
constructor(storeCallback: (session: Session) => Promise<boolean>, loadCallback: (id: string) => Promise<Session | undefined>, deleteCallback: (id: string) => Promise<boolean>);
constructor(storeCallback: (session: Session) => Promise<boolean>, loadCallback: (id: string) => Promise<Session | Record<string, unknown> | undefined>, deleteCallback: (id: string) => Promise<boolean>);
storeSession(session: Session): Promise<boolean>;

@@ -10,0 +10,0 @@ loadSession(id: string): Promise<Session | undefined>;

@@ -35,3 +35,3 @@ "use strict";

return tslib_1.__awaiter(this, void 0, void 0, function () {
var result, error_2;
var result, error_2, session;
return tslib_1.__generator(this, function (_a) {

@@ -51,4 +51,15 @@ switch (_a.label) {

if (result instanceof session_1.Session) {
if (result.expires && typeof result.expires === 'string') {
result.expires = new Date(result.expires);
}
return [2 /*return*/, result];
}
else if (result instanceof Object && 'id' in result) {
session = new session_1.Session(result.id);
session = tslib_1.__assign(tslib_1.__assign({}, session), result);
if (session.expires && typeof session.expires === 'string') {
session.expires = new Date(session.expires);
}
return [2 /*return*/, session];
}
else {

@@ -55,0 +66,0 @@ throw new ShopifyErrors.SessionStorageError("Expected return to be instanceof Session, but received instanceof " + result.constructor.name + ".");

@@ -39,2 +39,4 @@ declare class ShopifyError extends Error {

}
declare class CookieNotFound extends ShopifyError {
}
declare class InvalidSession extends ShopifyError {

@@ -50,3 +52,3 @@ }

}
export { ShopifyError, InvalidHmacError, InvalidShopError, InvalidJwtError, MissingJwtTokenError, SafeCompareError, HttpRequestError, HttpMaxRetriesError, HttpResponseError, HttpRetriableError, HttpInternalError, HttpThrottlingError, UninitializedContextError, InvalidOAuthError, SessionNotFound, InvalidSession, InvalidWebhookError, MissingRequiredArgument, UnsupportedClientType, SessionStorageError, PrivateAppError, };
export { ShopifyError, InvalidHmacError, InvalidShopError, InvalidJwtError, MissingJwtTokenError, SafeCompareError, HttpRequestError, HttpMaxRetriesError, HttpResponseError, HttpRetriableError, HttpInternalError, HttpThrottlingError, UninitializedContextError, InvalidOAuthError, SessionNotFound, CookieNotFound, InvalidSession, InvalidWebhookError, MissingRequiredArgument, UnsupportedClientType, SessionStorageError, PrivateAppError, };
//# sourceMappingURL=error.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PrivateAppError = exports.SessionStorageError = exports.UnsupportedClientType = exports.MissingRequiredArgument = exports.InvalidWebhookError = exports.InvalidSession = exports.SessionNotFound = exports.InvalidOAuthError = exports.UninitializedContextError = exports.HttpThrottlingError = exports.HttpInternalError = exports.HttpRetriableError = exports.HttpResponseError = exports.HttpMaxRetriesError = exports.HttpRequestError = exports.SafeCompareError = exports.MissingJwtTokenError = exports.InvalidJwtError = exports.InvalidShopError = exports.InvalidHmacError = exports.ShopifyError = void 0;
exports.PrivateAppError = exports.SessionStorageError = exports.UnsupportedClientType = exports.MissingRequiredArgument = exports.InvalidWebhookError = exports.InvalidSession = exports.CookieNotFound = exports.SessionNotFound = exports.InvalidOAuthError = exports.UninitializedContextError = exports.HttpThrottlingError = exports.HttpInternalError = exports.HttpRetriableError = exports.HttpResponseError = exports.HttpMaxRetriesError = exports.HttpRequestError = exports.SafeCompareError = exports.MissingJwtTokenError = exports.InvalidJwtError = exports.InvalidShopError = exports.InvalidHmacError = exports.ShopifyError = void 0;
var tslib_1 = require("tslib");

@@ -145,2 +145,10 @@ var ShopifyError = /** @class */ (function (_super) {

exports.SessionNotFound = SessionNotFound;
var CookieNotFound = /** @class */ (function (_super) {
tslib_1.__extends(CookieNotFound, _super);
function CookieNotFound() {
return _super !== null && _super.apply(this, arguments) || this;
}
return CookieNotFound;
}(ShopifyError));
exports.CookieNotFound = CookieNotFound;
var InvalidSession = /** @class */ (function (_super) {

@@ -147,0 +155,0 @@ tslib_1.__extends(InvalidSession, _super);

/// <reference types="node" />
import * as ShopifyErrors from './error';
declare const Shopify: {
export declare const Shopify: {
Context: import("./context").ContextInterface;

@@ -5,0 +5,0 @@ Auth: {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Shopify = void 0;
var tslib_1 = require("tslib");

@@ -11,3 +12,3 @@ var context_1 = require("./context");

var webhooks_1 = tslib_1.__importDefault(require("./webhooks"));
var Shopify = {
exports.Shopify = {
Context: context_1.Context,

@@ -21,3 +22,3 @@ Auth: oauth_1.default,

};
exports.default = Shopify;
exports.default = exports.Shopify;
tslib_1.__exportStar(require("./types"), exports);

@@ -1,2 +0,2 @@

export declare const SHOPIFY_API_LIBRARY_VERSION = "1.1.0";
export declare const SHOPIFY_API_LIBRARY_VERSION = "1.2.0";
//# sourceMappingURL=version.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SHOPIFY_API_LIBRARY_VERSION = void 0;
exports.SHOPIFY_API_LIBRARY_VERSION = '1.1.0';
exports.SHOPIFY_API_LIBRARY_VERSION = '1.2.0';
{
"name": "@shopify/shopify-api",
"version": "1.1.0",
"version": "1.2.0",
"description": "Shopify Admin API Library for Node - accelerate development with support for authentication, graphql proxy, webhooks",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -27,6 +27,6 @@ # `@shopify/shopify-api`

<!-- Make sure this section is in sync with docs/index.md -->
<!-- Make sure this section is in sync with docs/README.md -->
# Getting started
You can follow our [getting started guide](docs/index.md), which will provide instructions on how to create an app using plain Node.js code, or the [Express](https://expressjs.com/) framework. Both examples are written in Typescript.
You can follow our [getting started guide](docs/), which will provide instructions on how to create an app using plain Node.js code, or the [Express](https://expressjs.com/) framework. Both examples are written in Typescript.

@@ -33,0 +33,0 @@ - [Getting started](docs/getting_started.md)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc