@pintahub/shopify-next 0.7.0 → 0.8.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/dist/commands/collections/GetCollectionCommand.d.ts +7 -2
- package/dist/commands/collections/GetCollectionCommand.js +3 -0
- package/dist/commands/collections/GetCollectionCommand.js.map +1 -1
- package/dist/commands/fulfillments/UpdateFulfillmentTrackingCommand.d.ts +22 -0
- package/dist/commands/fulfillments/UpdateFulfillmentTrackingCommand.js +40 -0
- package/dist/commands/fulfillments/UpdateFulfillmentTrackingCommand.js.map +1 -0
- package/dist/commands/fulfillments/index.d.ts +1 -0
- package/dist/commands/fulfillments/index.js +18 -0
- package/dist/commands/fulfillments/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -28,6 +28,11 @@ export interface GetCollectionOutput {
|
|
|
28
28
|
} | null;
|
|
29
29
|
image: CollectionImage | null;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
/** Sentinel returned when the collection no longer exists (deleted on Shopify). */
|
|
32
|
+
export interface CollectionNotFound {
|
|
33
|
+
status: 'not_found';
|
|
34
|
+
}
|
|
35
|
+
export type GetCollectionResult = GetCollectionOutput | CollectionNotFound;
|
|
36
|
+
export declare class GetCollectionCommand extends Command<GetCollectionInput, GetCollectionResult> {
|
|
37
|
+
execute(client: AdminApiClient): Promise<GetCollectionResult>;
|
|
33
38
|
}
|
|
@@ -38,6 +38,9 @@ class GetCollectionCommand extends Command_1.Command {
|
|
|
38
38
|
(0, handleErrors_1.handleErrors)(errors);
|
|
39
39
|
if (!data)
|
|
40
40
|
throw new Error('GetCollectionCommand: no data returned');
|
|
41
|
+
if (data.collection === null) {
|
|
42
|
+
return { status: 'not_found' };
|
|
43
|
+
}
|
|
41
44
|
return data.collection;
|
|
42
45
|
}
|
|
43
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetCollectionCommand.js","sourceRoot":"","sources":["../../../src/commands/collections/GetCollectionCommand.ts"],"names":[],"mappings":";;;AACA,kDAA4C;AAC5C,2DAAqD;AACrD,mDAAgD;AAEhD,MAAM,KAAK,GAAG,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B3B,CAAA;
|
|
1
|
+
{"version":3,"file":"GetCollectionCommand.js","sourceRoot":"","sources":["../../../src/commands/collections/GetCollectionCommand.ts"],"names":[],"mappings":";;;AACA,kDAA4C;AAC5C,2DAAqD;AACrD,mDAAgD;AAEhD,MAAM,KAAK,GAAG,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B3B,CAAA;AA0CD,MAAa,oBAAqB,SAAQ,iBAGzC;IACC,KAAK,CAAC,OAAO,CAAC,MAAsB;QAClC,MAAM,SAAS,GAAG,EAAC,EAAE,EAAE,IAAA,sBAAW,EAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,YAAY,CAAC,EAAC,CAAA;QAChE,MAAM,EAAC,IAAI,EAAE,MAAM,EAAC,GAAG,MAAM,MAAM,CAAC,OAAO,CAAgB,KAAK,EAAE,EAAC,SAAS,EAAC,CAAC,CAAA;QAC9E,IAAA,2BAAY,EAAC,MAAM,CAAC,CAAA;QACpB,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;QAEpE,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;YAC7B,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,CAAA;QAC9B,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;CACF;AAhBD,oDAgBC","sourcesContent":["import type {AdminApiClient} from '@shopify/admin-api-client'\nimport {Command} from '../../client/Command'\nimport {handleErrors} from '../../utils/handleErrors'\nimport {getGlobalID} from '../../utils/globalId'\n\nconst QUERY = /* GraphQL */ `\n query GetCollection($id: ID!) {\n collection(id: $id) {\n id\n handle\n title\n updatedAt\n description\n descriptionHtml\n seo {\n title\n description\n }\n productsCount {\n count\n precision\n }\n image {\n id\n url\n altText\n height\n width\n }\n }\n }\n`\n\nexport interface GetCollectionInput {\n id: string\n}\n\nexport interface CollectionImage {\n id: string | null\n url: string\n altText: string | null\n height: number | null\n width: number | null\n}\n\nexport interface CollectionSEO {\n title: string | null\n description: string | null\n}\n\nexport interface GetCollectionOutput {\n id: string\n handle: string\n title: string\n updatedAt: string\n description: string\n descriptionHtml: string\n seo: CollectionSEO\n productsCount: {count: number; precision: string} | null\n image: CollectionImage | null\n}\n\n/** Sentinel returned when the collection no longer exists (deleted on Shopify). */\nexport interface CollectionNotFound {\n status: 'not_found'\n}\n\nexport type GetCollectionResult = GetCollectionOutput | CollectionNotFound\n\ninterface QueryResponse {\n collection: GetCollectionOutput | null\n}\n\nexport class GetCollectionCommand extends Command<\n GetCollectionInput,\n GetCollectionResult\n> {\n async execute(client: AdminApiClient): Promise<GetCollectionResult> {\n const variables = {id: getGlobalID(this.input.id, 'Collection')}\n const {data, errors} = await client.request<QueryResponse>(QUERY, {variables})\n handleErrors(errors)\n if (!data) throw new Error('GetCollectionCommand: no data returned')\n\n if (data.collection === null) {\n return {status: 'not_found'}\n }\n\n return data.collection\n }\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AdminApiClient } from '@shopify/admin-api-client';
|
|
2
|
+
import { Command } from '../../client/Command';
|
|
3
|
+
export interface FulfillmentTrackingInput {
|
|
4
|
+
number?: string;
|
|
5
|
+
url?: string;
|
|
6
|
+
company?: string;
|
|
7
|
+
numbers?: string[];
|
|
8
|
+
urls?: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface UpdateFulfillmentTrackingInput {
|
|
11
|
+
fulfillmentId: string;
|
|
12
|
+
trackingInfo: FulfillmentTrackingInput;
|
|
13
|
+
notifyCustomer?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface UpdateFulfillmentTrackingOutput {
|
|
16
|
+
id: string;
|
|
17
|
+
/** Enum: PENDING | OPEN | SUCCESS | CANCELLED | ERROR | FAILURE */
|
|
18
|
+
status: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class UpdateFulfillmentTrackingCommand extends Command<UpdateFulfillmentTrackingInput, UpdateFulfillmentTrackingOutput> {
|
|
21
|
+
execute(client: AdminApiClient): Promise<UpdateFulfillmentTrackingOutput>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateFulfillmentTrackingCommand = void 0;
|
|
4
|
+
const Command_1 = require("../../client/Command");
|
|
5
|
+
const handleErrors_1 = require("../../utils/handleErrors");
|
|
6
|
+
const globalId_1 = require("../../utils/globalId");
|
|
7
|
+
const MUTATION = /* GraphQL */ `
|
|
8
|
+
mutation UpdateFulfillmentTracking($fulfillmentId: ID!, $trackingInfoInput: FulfillmentTrackingInput!, $notifyCustomer: Boolean) {
|
|
9
|
+
fulfillmentTrackingInfoUpdate(fulfillmentId: $fulfillmentId, trackingInfoInput: $trackingInfoInput, notifyCustomer: $notifyCustomer) {
|
|
10
|
+
fulfillment {
|
|
11
|
+
id
|
|
12
|
+
status
|
|
13
|
+
}
|
|
14
|
+
userErrors {
|
|
15
|
+
field
|
|
16
|
+
message
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
class UpdateFulfillmentTrackingCommand extends Command_1.Command {
|
|
22
|
+
async execute(client) {
|
|
23
|
+
const variables = {
|
|
24
|
+
fulfillmentId: (0, globalId_1.getGlobalID)(this.input.fulfillmentId, 'Fulfillment'),
|
|
25
|
+
trackingInfoInput: this.input.trackingInfo,
|
|
26
|
+
notifyCustomer: this.input.notifyCustomer,
|
|
27
|
+
};
|
|
28
|
+
const { data, errors } = await client.request(MUTATION, { variables });
|
|
29
|
+
(0, handleErrors_1.handleErrors)(errors);
|
|
30
|
+
if (!data)
|
|
31
|
+
throw new Error('UpdateFulfillmentTrackingCommand: no data returned');
|
|
32
|
+
const { fulfillment, userErrors } = data.fulfillmentTrackingInfoUpdate;
|
|
33
|
+
(0, handleErrors_1.assertNoUserErrors)(userErrors, 'UpdateFulfillmentTrackingCommand');
|
|
34
|
+
if (!fulfillment)
|
|
35
|
+
throw new Error('UpdateFulfillmentTrackingCommand: fulfillment is null');
|
|
36
|
+
return fulfillment;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.UpdateFulfillmentTrackingCommand = UpdateFulfillmentTrackingCommand;
|
|
40
|
+
//# sourceMappingURL=UpdateFulfillmentTrackingCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UpdateFulfillmentTrackingCommand.js","sourceRoot":"","sources":["../../../src/commands/fulfillments/UpdateFulfillmentTrackingCommand.ts"],"names":[],"mappings":";;;AACA,kDAA4C;AAC5C,2DAAyF;AACzF,mDAAgD;AAEhD,MAAM,QAAQ,GAAG,aAAa,CAAC;;;;;;;;;;;;;CAa9B,CAAA;AA8BD,MAAa,gCAAiC,SAAQ,iBAGrD;IACC,KAAK,CAAC,OAAO,CAAC,MAAsB;QAClC,MAAM,SAAS,GAAG;YAChB,aAAa,EAAE,IAAA,sBAAW,EAAC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,aAAa,CAAC;YACnE,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;YAC1C,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc;SAC1C,CAAA;QAED,MAAM,EAAC,IAAI,EAAE,MAAM,EAAC,GAAG,MAAM,MAAM,CAAC,OAAO,CAAmB,QAAQ,EAAE,EAAC,SAAS,EAAC,CAAC,CAAA;QACpF,IAAA,2BAAY,EAAC,MAAM,CAAC,CAAA;QACpB,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;QAEhF,MAAM,EAAC,WAAW,EAAE,UAAU,EAAC,GAAG,IAAI,CAAC,6BAA6B,CAAA;QACpE,IAAA,iCAAkB,EAAC,UAAU,EAAE,kCAAkC,CAAC,CAAA;QAClE,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;QAE1F,OAAO,WAAW,CAAA;IACpB,CAAC;CACF;AArBD,4EAqBC","sourcesContent":["import type {AdminApiClient} from '@shopify/admin-api-client'\nimport {Command} from '../../client/Command'\nimport {handleErrors, assertNoUserErrors, type UserError} from '../../utils/handleErrors'\nimport {getGlobalID} from '../../utils/globalId'\n\nconst MUTATION = /* GraphQL */ `\n mutation UpdateFulfillmentTracking($fulfillmentId: ID!, $trackingInfoInput: FulfillmentTrackingInput!, $notifyCustomer: Boolean) {\n fulfillmentTrackingInfoUpdate(fulfillmentId: $fulfillmentId, trackingInfoInput: $trackingInfoInput, notifyCustomer: $notifyCustomer) {\n fulfillment {\n id\n status\n }\n userErrors {\n field\n message\n }\n }\n }\n`\n\n// Provide either single tracking (number/url) or multi-package (numbers/urls), not both.\nexport interface FulfillmentTrackingInput {\n number?: string\n url?: string\n company?: string\n numbers?: string[]\n urls?: string[]\n}\n\nexport interface UpdateFulfillmentTrackingInput {\n fulfillmentId: string\n trackingInfo: FulfillmentTrackingInput\n notifyCustomer?: boolean\n}\n\nexport interface UpdateFulfillmentTrackingOutput {\n id: string\n /** Enum: PENDING | OPEN | SUCCESS | CANCELLED | ERROR | FAILURE */\n status: string\n}\n\ninterface MutationResponse {\n fulfillmentTrackingInfoUpdate: {\n fulfillment: UpdateFulfillmentTrackingOutput | null\n userErrors: UserError[]\n }\n}\n\nexport class UpdateFulfillmentTrackingCommand extends Command<\n UpdateFulfillmentTrackingInput,\n UpdateFulfillmentTrackingOutput\n> {\n async execute(client: AdminApiClient): Promise<UpdateFulfillmentTrackingOutput> {\n const variables = {\n fulfillmentId: getGlobalID(this.input.fulfillmentId, 'Fulfillment'),\n trackingInfoInput: this.input.trackingInfo,\n notifyCustomer: this.input.notifyCustomer,\n }\n\n const {data, errors} = await client.request<MutationResponse>(MUTATION, {variables})\n handleErrors(errors)\n if (!data) throw new Error('UpdateFulfillmentTrackingCommand: no data returned')\n\n const {fulfillment, userErrors} = data.fulfillmentTrackingInfoUpdate\n assertNoUserErrors(userErrors, 'UpdateFulfillmentTrackingCommand')\n if (!fulfillment) throw new Error('UpdateFulfillmentTrackingCommand: fulfillment is null')\n\n return fulfillment\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './UpdateFulfillmentTrackingCommand';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./UpdateFulfillmentTrackingCommand"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/fulfillments/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qEAAkD","sourcesContent":["export * from './UpdateFulfillmentTrackingCommand'\n"]}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -31,4 +31,5 @@ __exportStar(require("./commands/payments"), exports);
|
|
|
31
31
|
__exportStar(require("./commands/menus"), exports);
|
|
32
32
|
__exportStar(require("./commands/orders"), exports);
|
|
33
33
|
__exportStar(require("./commands/collections"), exports);
|
|
34
|
+
__exportStar(require("./commands/fulfillments"), exports);
|
|
34
35
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wDAK+B;AAJ7B,8GAAA,aAAa,OAAA;AAKf,4CAAwC;AAAhC,kGAAA,OAAO,OAAA;AACf,qDAM6B;AAL3B,4GAAA,YAAY,OAAA;AACZ,kHAAA,kBAAkB,OAAA;AAKpB,6CAAmE;AAA3D,uGAAA,WAAW,OAAA;AAAE,iHAAA,qBAAqB,OAAA;AAG1C,gCAAgC;AAChC,uDAAoC;AACpC,sDAAmC;AACnC,mDAAgC;AAChC,oDAAiC;AACjC,yDAAsC","sourcesContent":["export {\n ShopifyClient,\n type ShopifyClientOptions,\n type StoreId,\n type Middleware,\n} from './client/ShopifyClient'\nexport {Command} from './client/Command'\nexport {\n handleErrors,\n assertNoUserErrors,\n type GraphQLError,\n type ResponseErrors,\n type UserError,\n} from './utils/handleErrors'\nexport {getGlobalID, extractIdFromGlobalID} from './utils/globalId'\nexport type {MoneyV2} from './utils/money'\n\n// Commands grouped by namespace\nexport * from './commands/customers'\nexport * from './commands/payments'\nexport * from './commands/menus'\nexport * from './commands/orders'\nexport * from './commands/collections'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wDAK+B;AAJ7B,8GAAA,aAAa,OAAA;AAKf,4CAAwC;AAAhC,kGAAA,OAAO,OAAA;AACf,qDAM6B;AAL3B,4GAAA,YAAY,OAAA;AACZ,kHAAA,kBAAkB,OAAA;AAKpB,6CAAmE;AAA3D,uGAAA,WAAW,OAAA;AAAE,iHAAA,qBAAqB,OAAA;AAG1C,gCAAgC;AAChC,uDAAoC;AACpC,sDAAmC;AACnC,mDAAgC;AAChC,oDAAiC;AACjC,yDAAsC;AACtC,0DAAuC","sourcesContent":["export {\n ShopifyClient,\n type ShopifyClientOptions,\n type StoreId,\n type Middleware,\n} from './client/ShopifyClient'\nexport {Command} from './client/Command'\nexport {\n handleErrors,\n assertNoUserErrors,\n type GraphQLError,\n type ResponseErrors,\n type UserError,\n} from './utils/handleErrors'\nexport {getGlobalID, extractIdFromGlobalID} from './utils/globalId'\nexport type {MoneyV2} from './utils/money'\n\n// Commands grouped by namespace\nexport * from './commands/customers'\nexport * from './commands/payments'\nexport * from './commands/menus'\nexport * from './commands/orders'\nexport * from './commands/collections'\nexport * from './commands/fulfillments'\n"]}
|