@ehrenkind/shopify-lib 0.1.0 → 0.2.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/generated-api-types/2025-04/admin.generated.d.ts +74 -0
- package/dist/generated-api-types/2025-04/admin.generated.d.ts.map +1 -1
- package/dist/generated-api-types/2025-04/admin.types.d.ts +4 -4
- package/dist/generated-api-types/2025-04/admin.types.d.ts.map +1 -1
- package/dist/generated-api-types/2025-04/admin.types.js +4 -4
- package/dist/generated-api-types/2025-04/admin.types.js.map +1 -1
- package/dist/index.cjs +319 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +214 -5
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +318 -37
- package/dist/index.mjs.map +1 -1
- package/dist/queries/orders/getOrderById.d.ts +136 -0
- package/dist/queries/orders/getOrderById.d.ts.map +1 -0
- package/dist/queries/orders/getOrderById.js +125 -0
- package/dist/queries/orders/getOrderById.js.map +1 -0
- package/dist/queries/orders/getOrderById.mock.d.ts +82 -0
- package/dist/queries/orders/getOrderById.mock.d.ts.map +1 -0
- package/dist/queries/orders/getOrderById.mock.js +204 -0
- package/dist/queries/orders/getOrderById.mock.js.map +1 -0
- package/dist/queries/orders/getOrderById.queries.d.ts +3 -0
- package/dist/queries/orders/getOrderById.queries.d.ts.map +1 -0
- package/dist/queries/orders/getOrderById.queries.js +174 -0
- package/dist/queries/orders/getOrderById.queries.js.map +1 -0
- package/dist/queries/orders/getOrderById.test.d.ts +2 -0
- package/dist/queries/orders/getOrderById.test.d.ts.map +1 -0
- package/dist/queries/orders/getOrderById.test.js +46 -0
- package/dist/queries/orders/getOrderById.test.js.map +1 -0
- package/dist/queries/orders/getOrderByName.d.ts +5 -5
- package/dist/queries/orders/getOrderByName.d.ts.map +1 -1
- package/dist/queries/orders/getOrderByName.js +1 -1
- package/dist/queries/orders/getOrderByName.js.map +1 -1
- package/dist/queries/orders/getOrderByName.test.js +6 -4
- package/dist/queries/orders/getOrderByName.test.js.map +1 -1
- package/dist/queries/orders/getOrderPaymentDetails.mock.d.ts +12 -0
- package/dist/queries/orders/getOrderPaymentDetails.mock.d.ts.map +1 -0
- package/dist/queries/orders/getOrderPaymentDetails.mock.js +24 -0
- package/dist/queries/orders/getOrderPaymentDetails.mock.js.map +1 -0
- package/dist/queries/orders/getOrderPaymentDetails.test.d.ts +2 -0
- package/dist/queries/orders/getOrderPaymentDetails.test.d.ts.map +1 -0
- package/dist/queries/orders/getOrderPaymentDetails.test.js +19 -0
- package/dist/queries/orders/getOrderPaymentDetails.test.js.map +1 -0
- package/dist/utils/mswHandlers.d.ts.map +1 -1
- package/dist/utils/mswHandlers.js +5 -0
- package/dist/utils/mswHandlers.js.map +1 -1
- package/package.json +6 -4
package/dist/index.d.cts
CHANGED
|
@@ -12275,15 +12275,15 @@ declare enum OrderTransactionErrorCode {
|
|
|
12275
12275
|
ExpiredCard = "EXPIRED_CARD",
|
|
12276
12276
|
/** There was an unknown error with processing the payment. */
|
|
12277
12277
|
GenericError = "GENERIC_ERROR",
|
|
12278
|
-
/** The address
|
|
12278
|
+
/** The address is incorrect. */
|
|
12279
12279
|
IncorrectAddress = "INCORRECT_ADDRESS",
|
|
12280
|
-
/** The
|
|
12280
|
+
/** The card security code (CVC/CVV) is incorrect. */
|
|
12281
12281
|
IncorrectCvc = "INCORRECT_CVC",
|
|
12282
12282
|
/** The card number is incorrect. */
|
|
12283
12283
|
IncorrectNumber = "INCORRECT_NUMBER",
|
|
12284
|
-
/** The entered
|
|
12284
|
+
/** The PIN entered is incorrect. */
|
|
12285
12285
|
IncorrectPin = "INCORRECT_PIN",
|
|
12286
|
-
/** The ZIP or postal code
|
|
12286
|
+
/** The ZIP or postal code doesn't match the one on file. */
|
|
12287
12287
|
IncorrectZip = "INCORRECT_ZIP",
|
|
12288
12288
|
/** The amount is either too high or too low for the provider. */
|
|
12289
12289
|
InvalidAmount = "INVALID_AMOUNT",
|
|
@@ -18517,6 +18517,74 @@ type ConnectMetaObjectToProductVariantMutation = {
|
|
|
18517
18517
|
userErrors: Array<Pick<ProductVariantsBulkUpdateUserError, 'field' | 'message'>>;
|
|
18518
18518
|
}>;
|
|
18519
18519
|
};
|
|
18520
|
+
type OrderByIdQueryVariables = Exact<{
|
|
18521
|
+
id: Scalars['ID']['input'];
|
|
18522
|
+
}>;
|
|
18523
|
+
type OrderByIdQuery = {
|
|
18524
|
+
order?: Maybe<(Pick<Order, 'id' | 'name' | 'createdAt' | 'updatedAt' | 'cancelledAt' | 'cancelReason' | 'displayFinancialStatus' | 'displayFulfillmentStatus'> & {
|
|
18525
|
+
totalPriceSet: {
|
|
18526
|
+
shopMoney: Pick<MoneyV2, 'amount' | 'currencyCode'>;
|
|
18527
|
+
};
|
|
18528
|
+
customer?: Maybe<(Pick<Customer, 'id' | 'lastName' | 'displayName' | 'firstName'> & {
|
|
18529
|
+
defaultEmailAddress?: Maybe<Pick<CustomerEmailAddress, 'emailAddress'>>;
|
|
18530
|
+
})>;
|
|
18531
|
+
shippingAddress?: Maybe<Pick<MailingAddress, 'firstName' | 'lastName' | 'address1' | 'address2' | 'city' | 'province' | 'country' | 'zip'>>;
|
|
18532
|
+
})>;
|
|
18533
|
+
};
|
|
18534
|
+
type OrderByIdFullQueryVariables = Exact<{
|
|
18535
|
+
id: Scalars['ID']['input'];
|
|
18536
|
+
}>;
|
|
18537
|
+
type OrderByIdFullQuery = {
|
|
18538
|
+
order?: Maybe<(Pick<Order, 'id' | 'name' | 'createdAt' | 'updatedAt' | 'processedAt' | 'closedAt' | 'cancelledAt' | 'cancelReason' | 'displayFinancialStatus' | 'displayFulfillmentStatus' | 'discountCodes'> & {
|
|
18539
|
+
totalPriceSet: {
|
|
18540
|
+
shopMoney: Pick<MoneyV2, 'amount' | 'currencyCode'>;
|
|
18541
|
+
};
|
|
18542
|
+
customer?: Maybe<(Pick<Customer, 'id' | 'lastName' | 'displayName' | 'firstName' | 'phone'> & {
|
|
18543
|
+
defaultEmailAddress?: Maybe<Pick<CustomerEmailAddress, 'emailAddress'>>;
|
|
18544
|
+
})>;
|
|
18545
|
+
shippingAddress?: Maybe<Pick<MailingAddress, 'firstName' | 'lastName' | 'address1' | 'address2' | 'city' | 'province' | 'country' | 'zip'>>;
|
|
18546
|
+
billingAddress?: Maybe<Pick<MailingAddress, 'firstName' | 'lastName' | 'address1' | 'address2' | 'city' | 'province' | 'country' | 'zip'>>;
|
|
18547
|
+
lineItems: {
|
|
18548
|
+
edges: Array<{
|
|
18549
|
+
node: (Pick<LineItem, 'id' | 'sku' | 'title' | 'variantTitle' | 'quantity' | 'vendor'> & {
|
|
18550
|
+
customAttributes: Array<Pick<Attribute, 'key' | 'value'>>;
|
|
18551
|
+
originalUnitPriceSet: {
|
|
18552
|
+
shopMoney: Pick<MoneyV2, 'amount' | 'currencyCode'>;
|
|
18553
|
+
};
|
|
18554
|
+
image?: Maybe<Pick<Image, 'url' | 'width' | 'height' | 'altText'>>;
|
|
18555
|
+
});
|
|
18556
|
+
}>;
|
|
18557
|
+
};
|
|
18558
|
+
fulfillments: Array<(Pick<Fulfillment, 'id' | 'name' | 'totalQuantity' | 'status' | 'createdAt' | 'estimatedDeliveryAt' | 'deliveredAt'> & {
|
|
18559
|
+
trackingInfo: Array<Pick<FulfillmentTrackingInfo, 'company' | 'number' | 'url'>>;
|
|
18560
|
+
fulfillmentLineItems: {
|
|
18561
|
+
edges: Array<{
|
|
18562
|
+
node: (Pick<FulfillmentLineItem, 'id' | 'quantity'> & {
|
|
18563
|
+
lineItem: Pick<LineItem, 'id'>;
|
|
18564
|
+
});
|
|
18565
|
+
}>;
|
|
18566
|
+
};
|
|
18567
|
+
})>;
|
|
18568
|
+
shippingLine?: Maybe<{
|
|
18569
|
+
originalPriceSet: {
|
|
18570
|
+
shopMoney: Pick<MoneyV2, 'amount' | 'currencyCode'>;
|
|
18571
|
+
};
|
|
18572
|
+
}>;
|
|
18573
|
+
taxLines: Array<{
|
|
18574
|
+
priceSet: {
|
|
18575
|
+
shopMoney: Pick<MoneyV2, 'amount' | 'currencyCode'>;
|
|
18576
|
+
};
|
|
18577
|
+
}>;
|
|
18578
|
+
totalDiscountsSet?: Maybe<{
|
|
18579
|
+
shopMoney: Pick<MoneyV2, 'amount' | 'currencyCode'>;
|
|
18580
|
+
}>;
|
|
18581
|
+
refunds: Array<{
|
|
18582
|
+
totalRefundedSet: {
|
|
18583
|
+
shopMoney: Pick<MoneyV2, 'amount' | 'currencyCode'>;
|
|
18584
|
+
};
|
|
18585
|
+
}>;
|
|
18586
|
+
})>;
|
|
18587
|
+
};
|
|
18520
18588
|
type OrdersByNameQueryVariables = Exact<{
|
|
18521
18589
|
first: Scalars['Int']['input'];
|
|
18522
18590
|
queryFilter: Scalars['String']['input'];
|
|
@@ -18665,6 +18733,14 @@ type ProductHandlesQuery = {
|
|
|
18665
18733
|
};
|
|
18666
18734
|
};
|
|
18667
18735
|
interface GeneratedQueryTypes {
|
|
18736
|
+
"#graphql\n query orderById($id: ID!) {\n order(id: $id) {\n id\n name\n createdAt\n updatedAt\n cancelledAt\n cancelReason\n totalPriceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n customer {\n id\n lastName\n defaultEmailAddress {\n emailAddress\n }\n displayName\n firstName\n }\n displayFinancialStatus\n displayFulfillmentStatus\n shippingAddress {\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n }\n }\n }\n": {
|
|
18737
|
+
return: OrderByIdQuery;
|
|
18738
|
+
variables: OrderByIdQueryVariables;
|
|
18739
|
+
};
|
|
18740
|
+
"#graphql\n query orderByIdFull($id: ID!) {\n order(id: $id) {\n id\n name\n createdAt\n updatedAt\n processedAt\n closedAt\n cancelledAt\n cancelReason\n totalPriceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n customer {\n id\n lastName\n defaultEmailAddress {\n emailAddress\n }\n displayName\n firstName\n phone\n }\n displayFinancialStatus\n displayFulfillmentStatus\n shippingAddress {\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n }\n billingAddress {\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n }\n lineItems(first: 100) {\n edges {\n node {\n id\n sku\n title\n variantTitle\n quantity\n customAttributes {\n key\n value\n }\n originalUnitPriceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n vendor\n image {\n url\n width\n height\n altText\n }\n }\n }\n }\n fulfillments {\n id\n name\n totalQuantity\n status\n createdAt\n estimatedDeliveryAt\n deliveredAt\n trackingInfo {\n company\n number\n url\n }\n fulfillmentLineItems(first: 100) {\n edges {\n node {\n id\n quantity\n lineItem {\n id\n }\n }\n }\n }\n }\n shippingLine {\n originalPriceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n taxLines {\n priceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n totalDiscountsSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n discountCodes\n refunds {\n totalRefundedSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n }\n }\n": {
|
|
18741
|
+
return: OrderByIdFullQuery;
|
|
18742
|
+
variables: OrderByIdFullQueryVariables;
|
|
18743
|
+
};
|
|
18668
18744
|
"#graphql\n query ordersByName($first: Int!, $queryFilter: String!) {\n orders(first: $first, query: $queryFilter) {\n edges {\n node {\n id\n name\n createdAt\n updatedAt\n totalPriceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n customer {\n id\n lastName\n defaultEmailAddress {\n emailAddress\n }\n displayName\n firstName\n }\n displayFinancialStatus\n displayFulfillmentStatus\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n": {
|
|
18669
18745
|
return: OrdersByNameQuery;
|
|
18670
18746
|
variables: OrdersByNameQueryVariables;
|
|
@@ -18704,6 +18780,139 @@ declare module '@shopify/admin-api-client' {
|
|
|
18704
18780
|
}
|
|
18705
18781
|
}
|
|
18706
18782
|
|
|
18783
|
+
declare const GetLeanOrderByIdReturn: z.ZodNullable<z.ZodObject<{
|
|
18784
|
+
id: z.ZodString;
|
|
18785
|
+
name: z.ZodString;
|
|
18786
|
+
createdAt: z.ZodString;
|
|
18787
|
+
updatedAt: z.ZodString;
|
|
18788
|
+
cancelledAt: z.ZodNullable<z.ZodString>;
|
|
18789
|
+
cancelReason: z.ZodNullable<z.ZodString>;
|
|
18790
|
+
totalPrice: z.ZodObject<{
|
|
18791
|
+
amount: z.ZodString;
|
|
18792
|
+
currencyCode: z.ZodString;
|
|
18793
|
+
}, "strip", z.ZodTypeAny, {
|
|
18794
|
+
currencyCode: string;
|
|
18795
|
+
amount: string;
|
|
18796
|
+
}, {
|
|
18797
|
+
currencyCode: string;
|
|
18798
|
+
amount: string;
|
|
18799
|
+
}>;
|
|
18800
|
+
customer: z.ZodNullable<z.ZodObject<{
|
|
18801
|
+
id: z.ZodString;
|
|
18802
|
+
displayName: z.ZodString;
|
|
18803
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
18804
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
18805
|
+
emailAddress: z.ZodNullable<z.ZodString>;
|
|
18806
|
+
}, "strip", z.ZodTypeAny, {
|
|
18807
|
+
id: string;
|
|
18808
|
+
displayName: string;
|
|
18809
|
+
lastName: string | null;
|
|
18810
|
+
firstName: string | null;
|
|
18811
|
+
emailAddress: string | null;
|
|
18812
|
+
}, {
|
|
18813
|
+
id: string;
|
|
18814
|
+
displayName: string;
|
|
18815
|
+
lastName: string | null;
|
|
18816
|
+
firstName: string | null;
|
|
18817
|
+
emailAddress: string | null;
|
|
18818
|
+
}>>;
|
|
18819
|
+
financialStatus: z.ZodNullable<z.ZodString>;
|
|
18820
|
+
fulfillmentStatus: z.ZodNullable<z.ZodString>;
|
|
18821
|
+
shippingAddress: z.ZodNullable<z.ZodObject<{
|
|
18822
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
18823
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
18824
|
+
address1: z.ZodNullable<z.ZodString>;
|
|
18825
|
+
address2: z.ZodNullable<z.ZodString>;
|
|
18826
|
+
city: z.ZodNullable<z.ZodString>;
|
|
18827
|
+
province: z.ZodNullable<z.ZodString>;
|
|
18828
|
+
country: z.ZodNullable<z.ZodString>;
|
|
18829
|
+
zip: z.ZodNullable<z.ZodString>;
|
|
18830
|
+
}, "strip", z.ZodTypeAny, {
|
|
18831
|
+
lastName: string | null;
|
|
18832
|
+
firstName: string | null;
|
|
18833
|
+
address1: string | null;
|
|
18834
|
+
address2: string | null;
|
|
18835
|
+
city: string | null;
|
|
18836
|
+
province: string | null;
|
|
18837
|
+
country: string | null;
|
|
18838
|
+
zip: string | null;
|
|
18839
|
+
}, {
|
|
18840
|
+
lastName: string | null;
|
|
18841
|
+
firstName: string | null;
|
|
18842
|
+
address1: string | null;
|
|
18843
|
+
address2: string | null;
|
|
18844
|
+
city: string | null;
|
|
18845
|
+
province: string | null;
|
|
18846
|
+
country: string | null;
|
|
18847
|
+
zip: string | null;
|
|
18848
|
+
}>>;
|
|
18849
|
+
}, "strip", z.ZodTypeAny, {
|
|
18850
|
+
id: string;
|
|
18851
|
+
createdAt: string;
|
|
18852
|
+
updatedAt: string;
|
|
18853
|
+
name: string;
|
|
18854
|
+
cancelledAt: string | null;
|
|
18855
|
+
cancelReason: string | null;
|
|
18856
|
+
customer: {
|
|
18857
|
+
id: string;
|
|
18858
|
+
displayName: string;
|
|
18859
|
+
lastName: string | null;
|
|
18860
|
+
firstName: string | null;
|
|
18861
|
+
emailAddress: string | null;
|
|
18862
|
+
} | null;
|
|
18863
|
+
shippingAddress: {
|
|
18864
|
+
lastName: string | null;
|
|
18865
|
+
firstName: string | null;
|
|
18866
|
+
address1: string | null;
|
|
18867
|
+
address2: string | null;
|
|
18868
|
+
city: string | null;
|
|
18869
|
+
province: string | null;
|
|
18870
|
+
country: string | null;
|
|
18871
|
+
zip: string | null;
|
|
18872
|
+
} | null;
|
|
18873
|
+
totalPrice: {
|
|
18874
|
+
currencyCode: string;
|
|
18875
|
+
amount: string;
|
|
18876
|
+
};
|
|
18877
|
+
fulfillmentStatus: string | null;
|
|
18878
|
+
financialStatus: string | null;
|
|
18879
|
+
}, {
|
|
18880
|
+
id: string;
|
|
18881
|
+
createdAt: string;
|
|
18882
|
+
updatedAt: string;
|
|
18883
|
+
name: string;
|
|
18884
|
+
cancelledAt: string | null;
|
|
18885
|
+
cancelReason: string | null;
|
|
18886
|
+
customer: {
|
|
18887
|
+
id: string;
|
|
18888
|
+
displayName: string;
|
|
18889
|
+
lastName: string | null;
|
|
18890
|
+
firstName: string | null;
|
|
18891
|
+
emailAddress: string | null;
|
|
18892
|
+
} | null;
|
|
18893
|
+
shippingAddress: {
|
|
18894
|
+
lastName: string | null;
|
|
18895
|
+
firstName: string | null;
|
|
18896
|
+
address1: string | null;
|
|
18897
|
+
address2: string | null;
|
|
18898
|
+
city: string | null;
|
|
18899
|
+
province: string | null;
|
|
18900
|
+
country: string | null;
|
|
18901
|
+
zip: string | null;
|
|
18902
|
+
} | null;
|
|
18903
|
+
totalPrice: {
|
|
18904
|
+
currencyCode: string;
|
|
18905
|
+
amount: string;
|
|
18906
|
+
};
|
|
18907
|
+
fulfillmentStatus: string | null;
|
|
18908
|
+
financialStatus: string | null;
|
|
18909
|
+
}>>;
|
|
18910
|
+
type LeanOrder = z.infer<typeof GetLeanOrderByIdReturn>;
|
|
18911
|
+
type FullOrder = NonNullable<OrderByIdFullQuery['order']> | null;
|
|
18912
|
+
declare function getOrderById(id: bigint): Promise<LeanOrder>;
|
|
18913
|
+
declare function getOrderById(id: bigint, detailLevel: 'lean'): Promise<LeanOrder>;
|
|
18914
|
+
declare function getOrderById(id: bigint, detailLevel: 'full'): Promise<FullOrder>;
|
|
18915
|
+
|
|
18707
18916
|
declare const GetLeanOrderByNameReturn: z.ZodNullable<z.ZodObject<{
|
|
18708
18917
|
id: z.ZodString;
|
|
18709
18918
|
name: z.ZodString;
|
|
@@ -18932,4 +19141,4 @@ type GetOrderPaymentDetailsByIdReturnType = z.infer<typeof GetOrderPaymentDetail
|
|
|
18932
19141
|
*/
|
|
18933
19142
|
declare function getOrderPaymentDetailsById(id: bigint): Promise<GetOrderPaymentDetailsByIdReturnType | null>;
|
|
18934
19143
|
|
|
18935
|
-
export { deleteCustomerById, getLeanProductVariants, getOrderByName, getOrderPaymentDetailsById };
|
|
19144
|
+
export { type FullOrder, type LeanOrder, deleteCustomerById, getLeanProductVariants, getOrderById, getOrderByName, getOrderPaymentDetailsById };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { deleteCustomerById } from './mutations/customers/deleteCustomerById.js';
|
|
2
|
-
export {
|
|
2
|
+
export { getOrderById, type FullOrder, type LeanOrder, } from './queries/orders/getOrderById.js';
|
|
3
|
+
export { getOrderByName, type FullOrderByName, type LeanOrderByName, } from './queries/orders/getOrderByName.js';
|
|
3
4
|
export { getLeanProductVariants } from './queries/productVariants/getLeanProductVariants.js';
|
|
4
5
|
export { getOrderPaymentDetailsById } from './queries/orders/getOrderPaymentDetails.js';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAChF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAChF,OAAO,EACL,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,SAAS,GACf,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAA;AAC5F,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { deleteCustomerById } from './mutations/customers/deleteCustomerById.js';
|
|
2
|
-
export {
|
|
2
|
+
export { getOrderById, } from './queries/orders/getOrderById.js';
|
|
3
|
+
export { getOrderByName, } from './queries/orders/getOrderByName.js';
|
|
3
4
|
export { getLeanProductVariants } from './queries/productVariants/getLeanProductVariants.js';
|
|
4
5
|
export { getOrderPaymentDetailsById } from './queries/orders/getOrderPaymentDetails.js';
|
|
5
6
|
//# 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,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAChF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAChF,OAAO,EACL,YAAY,GAGb,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,cAAc,GAGf,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAA;AAC5F,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -244,9 +244,289 @@ async function deleteCustomerById(customerId) {
|
|
|
244
244
|
);
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
// src/queries/orders/
|
|
247
|
+
// src/queries/orders/getOrderById.ts
|
|
248
248
|
import z4 from "zod";
|
|
249
249
|
|
|
250
|
+
// src/queries/orders/getOrderById.queries.ts
|
|
251
|
+
var queryOrderById = gql`#graphql
|
|
252
|
+
query orderById($id: ID!) {
|
|
253
|
+
order(id: $id) {
|
|
254
|
+
id
|
|
255
|
+
name
|
|
256
|
+
createdAt
|
|
257
|
+
updatedAt
|
|
258
|
+
cancelledAt
|
|
259
|
+
cancelReason
|
|
260
|
+
totalPriceSet {
|
|
261
|
+
shopMoney {
|
|
262
|
+
amount
|
|
263
|
+
currencyCode
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
customer {
|
|
267
|
+
id
|
|
268
|
+
lastName
|
|
269
|
+
defaultEmailAddress {
|
|
270
|
+
emailAddress
|
|
271
|
+
}
|
|
272
|
+
displayName
|
|
273
|
+
firstName
|
|
274
|
+
}
|
|
275
|
+
displayFinancialStatus
|
|
276
|
+
displayFulfillmentStatus
|
|
277
|
+
shippingAddress {
|
|
278
|
+
firstName
|
|
279
|
+
lastName
|
|
280
|
+
address1
|
|
281
|
+
address2
|
|
282
|
+
city
|
|
283
|
+
province
|
|
284
|
+
country
|
|
285
|
+
zip
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
`;
|
|
290
|
+
var queryOrderByIdFull = gql`#graphql
|
|
291
|
+
query orderByIdFull($id: ID!) {
|
|
292
|
+
order(id: $id) {
|
|
293
|
+
id
|
|
294
|
+
name
|
|
295
|
+
createdAt
|
|
296
|
+
updatedAt
|
|
297
|
+
processedAt
|
|
298
|
+
closedAt
|
|
299
|
+
cancelledAt
|
|
300
|
+
cancelReason
|
|
301
|
+
totalPriceSet {
|
|
302
|
+
shopMoney {
|
|
303
|
+
amount
|
|
304
|
+
currencyCode
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
customer {
|
|
308
|
+
id
|
|
309
|
+
lastName
|
|
310
|
+
defaultEmailAddress {
|
|
311
|
+
emailAddress
|
|
312
|
+
}
|
|
313
|
+
displayName
|
|
314
|
+
firstName
|
|
315
|
+
phone
|
|
316
|
+
}
|
|
317
|
+
displayFinancialStatus
|
|
318
|
+
displayFulfillmentStatus
|
|
319
|
+
shippingAddress {
|
|
320
|
+
firstName
|
|
321
|
+
lastName
|
|
322
|
+
address1
|
|
323
|
+
address2
|
|
324
|
+
city
|
|
325
|
+
province
|
|
326
|
+
country
|
|
327
|
+
zip
|
|
328
|
+
}
|
|
329
|
+
billingAddress {
|
|
330
|
+
firstName
|
|
331
|
+
lastName
|
|
332
|
+
address1
|
|
333
|
+
address2
|
|
334
|
+
city
|
|
335
|
+
province
|
|
336
|
+
country
|
|
337
|
+
zip
|
|
338
|
+
}
|
|
339
|
+
lineItems(first: 100) {
|
|
340
|
+
edges {
|
|
341
|
+
node {
|
|
342
|
+
id
|
|
343
|
+
sku
|
|
344
|
+
title
|
|
345
|
+
variantTitle
|
|
346
|
+
quantity
|
|
347
|
+
customAttributes {
|
|
348
|
+
key
|
|
349
|
+
value
|
|
350
|
+
}
|
|
351
|
+
originalUnitPriceSet {
|
|
352
|
+
shopMoney {
|
|
353
|
+
amount
|
|
354
|
+
currencyCode
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
vendor
|
|
358
|
+
image {
|
|
359
|
+
url
|
|
360
|
+
width
|
|
361
|
+
height
|
|
362
|
+
altText
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
fulfillments {
|
|
368
|
+
id
|
|
369
|
+
name
|
|
370
|
+
totalQuantity
|
|
371
|
+
status
|
|
372
|
+
createdAt
|
|
373
|
+
estimatedDeliveryAt
|
|
374
|
+
deliveredAt
|
|
375
|
+
trackingInfo {
|
|
376
|
+
company
|
|
377
|
+
number
|
|
378
|
+
url
|
|
379
|
+
}
|
|
380
|
+
fulfillmentLineItems(first: 100) {
|
|
381
|
+
edges {
|
|
382
|
+
node {
|
|
383
|
+
id
|
|
384
|
+
quantity
|
|
385
|
+
lineItem {
|
|
386
|
+
id
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
shippingLine {
|
|
393
|
+
originalPriceSet {
|
|
394
|
+
shopMoney {
|
|
395
|
+
amount
|
|
396
|
+
currencyCode
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
taxLines {
|
|
401
|
+
priceSet {
|
|
402
|
+
shopMoney {
|
|
403
|
+
amount
|
|
404
|
+
currencyCode
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
totalDiscountsSet {
|
|
409
|
+
shopMoney {
|
|
410
|
+
amount
|
|
411
|
+
currencyCode
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
discountCodes
|
|
415
|
+
refunds {
|
|
416
|
+
totalRefundedSet {
|
|
417
|
+
shopMoney {
|
|
418
|
+
amount
|
|
419
|
+
currencyCode
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
`;
|
|
426
|
+
|
|
427
|
+
// src/queries/orders/getOrderById.ts
|
|
428
|
+
var AddressSchema = z4.object({
|
|
429
|
+
firstName: z4.string().nullable(),
|
|
430
|
+
lastName: z4.string().nullable(),
|
|
431
|
+
address1: z4.string().nullable(),
|
|
432
|
+
address2: z4.string().nullable(),
|
|
433
|
+
city: z4.string().nullable(),
|
|
434
|
+
province: z4.string().nullable(),
|
|
435
|
+
country: z4.string().nullable(),
|
|
436
|
+
zip: z4.string().nullable()
|
|
437
|
+
}).nullable();
|
|
438
|
+
var GetLeanOrderByIdReturn = z4.object({
|
|
439
|
+
id: z4.string(),
|
|
440
|
+
name: z4.string(),
|
|
441
|
+
createdAt: z4.string(),
|
|
442
|
+
updatedAt: z4.string(),
|
|
443
|
+
cancelledAt: z4.string().nullable(),
|
|
444
|
+
cancelReason: z4.string().nullable(),
|
|
445
|
+
totalPrice: z4.object({
|
|
446
|
+
amount: z4.string(),
|
|
447
|
+
currencyCode: z4.string()
|
|
448
|
+
}),
|
|
449
|
+
customer: z4.object({
|
|
450
|
+
id: z4.string(),
|
|
451
|
+
displayName: z4.string(),
|
|
452
|
+
firstName: z4.string().nullable(),
|
|
453
|
+
lastName: z4.string().nullable(),
|
|
454
|
+
emailAddress: z4.string().nullable()
|
|
455
|
+
}).nullable(),
|
|
456
|
+
financialStatus: z4.string().nullable(),
|
|
457
|
+
fulfillmentStatus: z4.string().nullable(),
|
|
458
|
+
shippingAddress: AddressSchema
|
|
459
|
+
}).nullable();
|
|
460
|
+
async function getOrderById(id, detailLevel = "lean") {
|
|
461
|
+
if (detailLevel === "lean") {
|
|
462
|
+
return getLeanOrderById(id);
|
|
463
|
+
}
|
|
464
|
+
return getFullOrderById(id);
|
|
465
|
+
}
|
|
466
|
+
async function getLeanOrderById(id) {
|
|
467
|
+
const variables = {
|
|
468
|
+
id: convertIdIntoGid(id, "Order")
|
|
469
|
+
};
|
|
470
|
+
const response = await fetchShopifyGraphql({
|
|
471
|
+
query: queryOrderById,
|
|
472
|
+
variables
|
|
473
|
+
});
|
|
474
|
+
if (!response.order) {
|
|
475
|
+
logger.debug(`No order found with ID: ${id}`);
|
|
476
|
+
return null;
|
|
477
|
+
}
|
|
478
|
+
const order = response.order;
|
|
479
|
+
const leanOrder = {
|
|
480
|
+
id: order.id,
|
|
481
|
+
name: order.name,
|
|
482
|
+
createdAt: order.createdAt,
|
|
483
|
+
updatedAt: order.updatedAt,
|
|
484
|
+
cancelledAt: order.cancelledAt ?? null,
|
|
485
|
+
cancelReason: order.cancelReason ?? null,
|
|
486
|
+
totalPrice: {
|
|
487
|
+
amount: order.totalPriceSet?.shopMoney?.amount ?? "",
|
|
488
|
+
currencyCode: order.totalPriceSet?.shopMoney?.currencyCode ?? ""
|
|
489
|
+
},
|
|
490
|
+
customer: order.customer ? {
|
|
491
|
+
id: order.customer.id,
|
|
492
|
+
displayName: order.customer.displayName,
|
|
493
|
+
firstName: order.customer.firstName ?? null,
|
|
494
|
+
lastName: order.customer.lastName ?? null,
|
|
495
|
+
emailAddress: order.customer.defaultEmailAddress?.emailAddress ?? null
|
|
496
|
+
} : null,
|
|
497
|
+
financialStatus: order.displayFinancialStatus ?? null,
|
|
498
|
+
fulfillmentStatus: order.displayFulfillmentStatus ?? null,
|
|
499
|
+
shippingAddress: order.shippingAddress ? {
|
|
500
|
+
firstName: order.shippingAddress.firstName ?? null,
|
|
501
|
+
lastName: order.shippingAddress.lastName ?? null,
|
|
502
|
+
address1: order.shippingAddress.address1 ?? null,
|
|
503
|
+
address2: order.shippingAddress.address2 ?? null,
|
|
504
|
+
city: order.shippingAddress.city ?? null,
|
|
505
|
+
province: order.shippingAddress.province ?? null,
|
|
506
|
+
country: order.shippingAddress.country ?? null,
|
|
507
|
+
zip: order.shippingAddress.zip ?? null
|
|
508
|
+
} : null
|
|
509
|
+
};
|
|
510
|
+
return await returnOutputParsed(leanOrder, GetLeanOrderByIdReturn);
|
|
511
|
+
}
|
|
512
|
+
async function getFullOrderById(id) {
|
|
513
|
+
const variables = {
|
|
514
|
+
id: convertIdIntoGid(id, "Order")
|
|
515
|
+
};
|
|
516
|
+
const response = await fetchShopifyGraphql({
|
|
517
|
+
query: queryOrderByIdFull,
|
|
518
|
+
variables
|
|
519
|
+
});
|
|
520
|
+
if (!response.order) {
|
|
521
|
+
logger.debug(`No order found with ID: ${id}`);
|
|
522
|
+
return null;
|
|
523
|
+
}
|
|
524
|
+
return response.order;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// src/queries/orders/getOrderByName.ts
|
|
528
|
+
import z5 from "zod";
|
|
529
|
+
|
|
250
530
|
// src/queries/orders/getOrderByName.queries.ts
|
|
251
531
|
var queryOrdersByName = gql`#graphql
|
|
252
532
|
query ordersByName($first: Int!, $queryFilter: String!) {
|
|
@@ -583,22 +863,22 @@ var queryOrdersByNameFull = gql`#graphql
|
|
|
583
863
|
`;
|
|
584
864
|
|
|
585
865
|
// src/queries/orders/getOrderByName.ts
|
|
586
|
-
var GetLeanOrderByNameReturn =
|
|
587
|
-
id:
|
|
588
|
-
name:
|
|
589
|
-
createdAt:
|
|
590
|
-
updatedAt:
|
|
591
|
-
totalPrice:
|
|
592
|
-
amount:
|
|
593
|
-
currencyCode:
|
|
866
|
+
var GetLeanOrderByNameReturn = z5.object({
|
|
867
|
+
id: z5.string(),
|
|
868
|
+
name: z5.string(),
|
|
869
|
+
createdAt: z5.string(),
|
|
870
|
+
updatedAt: z5.string(),
|
|
871
|
+
totalPrice: z5.object({
|
|
872
|
+
amount: z5.string(),
|
|
873
|
+
currencyCode: z5.string()
|
|
594
874
|
}),
|
|
595
|
-
customer:
|
|
596
|
-
id:
|
|
597
|
-
displayName:
|
|
598
|
-
emailAddress:
|
|
875
|
+
customer: z5.object({
|
|
876
|
+
id: z5.string(),
|
|
877
|
+
displayName: z5.string(),
|
|
878
|
+
emailAddress: z5.string().nullable()
|
|
599
879
|
}).nullable(),
|
|
600
|
-
financialStatus:
|
|
601
|
-
fulfillmentStatus:
|
|
880
|
+
financialStatus: z5.string().nullable(),
|
|
881
|
+
fulfillmentStatus: z5.string().nullable()
|
|
602
882
|
}).nullable();
|
|
603
883
|
async function getOrderByName(orderName, detailLevel = "lean") {
|
|
604
884
|
if (detailLevel === "lean") {
|
|
@@ -689,14 +969,14 @@ async function getFullOrderByName(orderName) {
|
|
|
689
969
|
}
|
|
690
970
|
|
|
691
971
|
// src/queries/productVariants/getLeanProductVariants.ts
|
|
692
|
-
import
|
|
693
|
-
var GetLeanProductVariantsReturn =
|
|
694
|
-
|
|
695
|
-
productId:
|
|
696
|
-
productTitle:
|
|
697
|
-
variantId:
|
|
698
|
-
variantTitle:
|
|
699
|
-
sku:
|
|
972
|
+
import z6 from "zod";
|
|
973
|
+
var GetLeanProductVariantsReturn = z6.array(
|
|
974
|
+
z6.object({
|
|
975
|
+
productId: z6.string(),
|
|
976
|
+
productTitle: z6.string(),
|
|
977
|
+
variantId: z6.string(),
|
|
978
|
+
variantTitle: z6.string(),
|
|
979
|
+
sku: z6.string()
|
|
700
980
|
})
|
|
701
981
|
);
|
|
702
982
|
async function getLeanProductVariants(skus) {
|
|
@@ -765,7 +1045,7 @@ async function getLeanProductVariants(skus) {
|
|
|
765
1045
|
}
|
|
766
1046
|
|
|
767
1047
|
// src/queries/orders/getOrderPaymentDetails.ts
|
|
768
|
-
import
|
|
1048
|
+
import z7 from "zod";
|
|
769
1049
|
|
|
770
1050
|
// src/queries/orders/getOrderPaymentDetails.queries.ts
|
|
771
1051
|
var queryOrderPaymentDetails = gql`#graphql
|
|
@@ -789,21 +1069,21 @@ var queryOrderPaymentDetails = gql`#graphql
|
|
|
789
1069
|
`;
|
|
790
1070
|
|
|
791
1071
|
// src/queries/orders/getOrderPaymentDetails.ts
|
|
792
|
-
var GetOrderPaymentDetailsByIdReturn =
|
|
793
|
-
order:
|
|
794
|
-
transactions:
|
|
795
|
-
|
|
796
|
-
amountSet:
|
|
797
|
-
shopMoney:
|
|
798
|
-
amount:
|
|
799
|
-
currencyCode:
|
|
1072
|
+
var GetOrderPaymentDetailsByIdReturn = z7.object({
|
|
1073
|
+
order: z7.object({
|
|
1074
|
+
transactions: z7.array(
|
|
1075
|
+
z7.object({
|
|
1076
|
+
amountSet: z7.object({
|
|
1077
|
+
shopMoney: z7.object({
|
|
1078
|
+
amount: z7.string(),
|
|
1079
|
+
currencyCode: z7.string()
|
|
800
1080
|
})
|
|
801
1081
|
}),
|
|
802
|
-
createdAt:
|
|
803
|
-
gateway:
|
|
804
|
-
formattedGateway:
|
|
805
|
-
kind:
|
|
806
|
-
paymentId:
|
|
1082
|
+
createdAt: z7.string(),
|
|
1083
|
+
gateway: z7.string(),
|
|
1084
|
+
formattedGateway: z7.string(),
|
|
1085
|
+
kind: z7.string(),
|
|
1086
|
+
paymentId: z7.string()
|
|
807
1087
|
})
|
|
808
1088
|
)
|
|
809
1089
|
})
|
|
@@ -825,6 +1105,7 @@ async function getOrderPaymentDetailsById(id) {
|
|
|
825
1105
|
export {
|
|
826
1106
|
deleteCustomerById,
|
|
827
1107
|
getLeanProductVariants,
|
|
1108
|
+
getOrderById,
|
|
828
1109
|
getOrderByName,
|
|
829
1110
|
getOrderPaymentDetailsById
|
|
830
1111
|
};
|