Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into error-handler
Browse files Browse the repository at this point in the history
  • Loading branch information
5n00p4eg authored Apr 5, 2024
2 parents f0c3608 + 4b31178 commit 47d7bb9
Show file tree
Hide file tree
Showing 166 changed files with 26,772 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/graphql-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"jest-environment-jsdom": "^29.5.0",
"jest-fetch-mock": "^3.0.3",
"regenerator-runtime": "^0.14.1",
"web-streams-polyfill": "^3.3.2"
"web-streams-polyfill": "^4.0.0"
},
"bugs": {
"url": "https://github.com/Shopify/shopify-api-js/issues"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TextEncoder, TextDecoder } from "util";
import { Readable } from "stream";

import { ReadableStream } from "web-streams-polyfill/es2018";
import { ReadableStream } from "web-streams-polyfill";

import { createGraphQLClient } from "../../graphql-client";
import {
Expand Down
7 changes: 7 additions & 0 deletions packages/shopify-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 9.7.0

### Minor Changes

- 3415a8c: Added support for the 2024-04 API version.
- c9dff9f: Add `Shop.current()` method to the REST resources

## 9.6.2

### Patch Changes
Expand Down
3 changes: 2 additions & 1 deletion packages/shopify-api/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ export enum ApiVersion {
July23 = '2023-07',
October23 = '2023-10',
January24 = '2024-01',
April24 = '2024-04',
Unstable = 'unstable',
}

export const LIBRARY_NAME = 'Shopify API Library';
export const LATEST_API_VERSION = ApiVersion.January24;
export const LATEST_API_VERSION = ApiVersion.April24;

/* eslint-disable @shopify/typescript/prefer-pascal-case-enums */
export enum ShopifyHeader {
Expand Down
2 changes: 1 addition & 1 deletion packages/shopify-api/lib/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const SHOPIFY_API_LIBRARY_VERSION = '9.6.2';
export const SHOPIFY_API_LIBRARY_VERSION = '9.7.0';
2 changes: 1 addition & 1 deletion packages/shopify-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shopify/shopify-api",
"version": "9.6.2",
"version": "9.7.0",
"description": "Shopify API Library for Node - accelerate development with support for authentication, graphql proxy, webhooks",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down
16 changes: 16 additions & 0 deletions packages/shopify-api/rest/admin/2022-10/shop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ export class Shop extends Base {
}
];

public static async current(
{
session,
fields = null,
...otherArgs
}: AllArgs
): Promise<Shop | null> {
const result = await this.baseFind<Shop>({
session: session,
urlIds: {},
params: {"fields": fields, ...otherArgs},
});

return result.data ? result.data[0] : null;
}

public static async all(
{
session,
Expand Down
16 changes: 16 additions & 0 deletions packages/shopify-api/rest/admin/2023-01/shop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ export class Shop extends Base {
}
];

public static async current(
{
session,
fields = null,
...otherArgs
}: AllArgs
): Promise<Shop | null> {
const result = await this.baseFind<Shop>({
session: session,
urlIds: {},
params: {"fields": fields, ...otherArgs},
});

return result.data ? result.data[0] : null;
}

public static async all(
{
session,
Expand Down
16 changes: 16 additions & 0 deletions packages/shopify-api/rest/admin/2023-04/shop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ export class Shop extends Base {
}
];

public static async current(
{
session,
fields = null,
...otherArgs
}: AllArgs
): Promise<Shop | null> {
const result = await this.baseFind<Shop>({
session: session,
urlIds: {},
params: {"fields": fields, ...otherArgs},
});

return result.data ? result.data[0] : null;
}

public static async all(
{
session,
Expand Down
16 changes: 16 additions & 0 deletions packages/shopify-api/rest/admin/2023-07/shop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ export class Shop extends Base {
}
];

public static async current(
{
session,
fields = null,
...otherArgs
}: AllArgs
): Promise<Shop | null> {
const result = await this.baseFind<Shop>({
session: session,
urlIds: {},
params: {"fields": fields, ...otherArgs},
});

return result.data ? result.data[0] : null;
}

public static async all(
{
session,
Expand Down
16 changes: 16 additions & 0 deletions packages/shopify-api/rest/admin/2023-10/shop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ export class Shop extends Base {
}
];

public static async current(
{
session,
fields = null,
...otherArgs
}: AllArgs
): Promise<Shop | null> {
const result = await this.baseFind<Shop>({
session: session,
urlIds: {},
params: {"fields": fields, ...otherArgs},
});

return result.data ? result.data[0] : null;
}

public static async all(
{
session,
Expand Down
17 changes: 17 additions & 0 deletions packages/shopify-api/rest/admin/2024-01/shop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@ export class Shop extends Base {
}
];

public static async current(
{
session,
fields = null,
...otherArgs
}: AllArgs
): Promise<Shop | null> {
const result = await this.baseFind<Shop>({
session: session,
urlIds: {},
params: {"fields": fields, ...otherArgs},
});

return result.data ? result.data[0] : null;
}


public static async all(
{
session,
Expand Down
112 changes: 112 additions & 0 deletions packages/shopify-api/rest/admin/2024-04/abandoned_checkout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/***********************************************************************************************************************
* This file is auto-generated. If you have an issue, please create a GitHub issue. *
***********************************************************************************************************************/

import {Base} from '../../base';
import {ResourcePath, ResourceNames} from '../../types';
import {Session} from '../../../lib/session/session';
import {ApiVersion} from '../../../lib/types';

import {Currency} from './currency';
import {Customer} from './customer';
import {DiscountCode} from './discount_code';

interface CheckoutsArgs {
[key: string]: unknown;
session: Session;
since_id?: unknown;
created_at_min?: unknown;
created_at_max?: unknown;
updated_at_min?: unknown;
updated_at_max?: unknown;
status?: unknown;
limit?: unknown;
}

export class AbandonedCheckout extends Base {
public static apiVersion = ApiVersion.April24;

protected static hasOne: {[key: string]: typeof Base} = {
"currency": Currency,
"customer": Customer
};
protected static hasMany: {[key: string]: typeof Base} = {
"discount_codes": DiscountCode
};
protected static paths: ResourcePath[] = [
{"http_method": "get", "operation": "checkouts", "ids": [], "path": "checkouts.json"},
{"http_method": "get", "operation": "checkouts", "ids": [], "path": "checkouts.json"}
];
protected static resourceNames: ResourceNames[] = [
{
"singular": "abandoned_checkout",
"plural": "abandoned_checkouts"
}
];

public static async checkouts(
{
session,
since_id = null,
created_at_min = null,
created_at_max = null,
updated_at_min = null,
updated_at_max = null,
status = null,
limit = null,
...otherArgs
}: CheckoutsArgs
): Promise<unknown> {
const response = await this.request<AbandonedCheckout>({
http_method: "get",
operation: "checkouts",
session: session,
urlIds: {},
params: {"since_id": since_id, "created_at_min": created_at_min, "created_at_max": created_at_max, "updated_at_min": updated_at_min, "updated_at_max": updated_at_max, "status": status, "limit": limit, ...otherArgs},
body: {},
entity: null,
});

return response ? response.body : null;
}

public abandoned_checkout_url: string | null;
public billing_address: {[key: string]: unknown} | null;
public buyer_accepts_marketing: boolean | null;
public buyer_accepts_sms_marketing: boolean | null;
public cart_token: string | null;
public closed_at: string | null;
public completed_at: string | null;
public created_at: string | null;
public currency: Currency | null | {[key: string]: any};
public customer: Customer | null | {[key: string]: any};
public customer_locale: string | null;
public device_id: number | null;
public discount_codes: DiscountCode[] | null | {[key: string]: any};
public email: string | null;
public gateway: string | null;
public id: number | null;
public landing_site: string | null;
public line_items: {[key: string]: unknown} | null;
public location_id: number | null;
public note: string | null;
public phone: string | null;
public presentment_currency: string | null;
public referring_site: string | null;
public shipping_address: {[key: string]: unknown} | null;
public shipping_lines: {[key: string]: unknown} | null;
public sms_marketing_phone: string | null;
public source_name: string | null;
public subtotal_price: string | null;
public tax_lines: {[key: string]: unknown} | null;
public taxes_included: boolean | null;
public token: string | null;
public total_discounts: string | null;
public total_duties: string | null;
public total_line_items_price: string | null;
public total_price: string | null;
public total_tax: string | null;
public total_weight: number | null;
public updated_at: string | null;
public user_id: number | null;
}
48 changes: 48 additions & 0 deletions packages/shopify-api/rest/admin/2024-04/access_scope.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/***********************************************************************************************************************
* This file is auto-generated. If you have an issue, please create a GitHub issue. *
***********************************************************************************************************************/

import {Base, FindAllResponse} from '../../base';
import {ResourcePath, ResourceNames} from '../../types';
import {Session} from '../../../lib/session/session';
import {ApiVersion} from '../../../lib/types';

interface AllArgs {
[key: string]: unknown;
session: Session;
}

export class AccessScope extends Base {
public static apiVersion = ApiVersion.April24;

protected static hasOne: {[key: string]: typeof Base} = {};
protected static hasMany: {[key: string]: typeof Base} = {};
protected static customPrefix: string | null = "/admin/oauth";
protected static paths: ResourcePath[] = [
{"http_method": "get", "operation": "get", "ids": [], "path": "access_scopes.json"}
];
protected static resourceNames: ResourceNames[] = [
{
"singular": "access_scope",
"plural": "access_scopes"
}
];

public static async all(
{
session,
...otherArgs
}: AllArgs
): Promise<FindAllResponse<AccessScope>> {
const response = await this.baseFind<AccessScope>({
session: session,
urlIds: {},
params: {...otherArgs},
});

return response;
}

public handle: string | null;
public access_scopes: {[key: string]: unknown}[] | null;
}
Loading

0 comments on commit 47d7bb9

Please sign in to comment.