Skip to content

Commit 2e08766

Browse files
authored
Merge pull request #2220 from Shopify/liz/remove-shopify-network-library
[Chore] Remove deprecated package
2 parents b509264 + 00a62a1 commit 2e08766

File tree

11 files changed

+73
-27
lines changed

11 files changed

+73
-27
lines changed

.changeset/pretty-ducks-drum.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@shopify/shopify-api': patch
3+
---
4+
5+
# Remove deprecated package
6+
7+
Removes the deprecated `@shopify/network` package. No change in functionality.

packages/apps/shopify-api/lib/clients/admin/rest/client.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {
22
AdminRestApiClient,
33
createAdminRestApiClient,
44
} from '@shopify/admin-api-client';
5-
import {Method} from '@shopify/network';
65

76
import {
87
clientLoggerFactory,
@@ -33,7 +32,7 @@ import type {
3332
PostRequestParams,
3433
DeleteRequestParams,
3534
} from '../../types';
36-
import {ApiVersion} from '../../../types';
35+
import {ApiVersion, Method} from '../../../types';
3736
import {Session} from '../../../session/session';
3837

3938
export interface RestClientClassParams {

packages/apps/shopify-api/lib/clients/common.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ import {
44
HTTPResponseGraphQLDeprecationNotice,
55
LogContent,
66
} from '@shopify/admin-api-client';
7-
import {StatusCode} from '@shopify/network';
87

98
import * as ShopifyErrors from '../error';
10-
import {LIBRARY_NAME} from '../types';
9+
import {LIBRARY_NAME, StatusCode} from '../types';
1110
import {ConfigInterface} from '../base-types';
1211
import {SHOPIFY_API_LIBRARY_VERSION} from '../version';
1312
import {

packages/apps/shopify-api/lib/clients/types.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ import {
33
ApiClientRequestOptions,
44
SearchParams,
55
} from '@shopify/admin-api-client';
6-
import {Method} from '@shopify/network';
76

87
import {Session} from '../session/session';
9-
import type {ApiVersion} from '../types';
8+
import type {ApiVersion, Method} from '../types';
109
import {Headers} from '../../runtime/http';
1110

1211
import {GraphqlClient} from './admin/graphql/client';

packages/apps/shopify-api/lib/types.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,60 @@ export enum BillingReplacementBehavior {
6969
ApplyOnNextBillingCycle = 'APPLY_ON_NEXT_BILLING_CYCLE',
7070
Standard = 'STANDARD',
7171
}
72+
73+
export enum StatusCode {
74+
Continue = 100,
75+
SwitchingProtocols = 101,
76+
Ok = 200,
77+
Created = 201,
78+
Accepted = 202,
79+
NonAuthoritativeInformation = 203,
80+
NoContent = 204,
81+
ResetContent = 205,
82+
PartialContent = 206,
83+
MultipleChoices = 300,
84+
MovedPermanently = 301,
85+
Found = 302,
86+
SeeOther = 303,
87+
NotModified = 304,
88+
UseProxy = 305,
89+
TemporaryRedirect = 307,
90+
BadRequest = 400,
91+
Unauthorized = 401,
92+
PaymentRequired = 402,
93+
Forbidden = 403,
94+
NotFound = 404,
95+
MethodNotAllowed = 405,
96+
NotAcceptable = 406,
97+
ProxyAuthenticationRequired = 407,
98+
RequestTimeout = 408,
99+
Conflict = 409,
100+
Gone = 410,
101+
LengthRequired = 411,
102+
PreconditionFailed = 412,
103+
RequestEntityTooLarge = 413,
104+
RequestUriTooLong = 414,
105+
UnsupportedMediaType = 415,
106+
RequestedRangeNotSatisfiable = 416,
107+
ExpectationFailed = 417,
108+
ImATeapot = 418,
109+
UnprocessableEntity = 422,
110+
TooManyRequests = 429,
111+
InternalServerError = 500,
112+
NotImplemented = 501,
113+
BadGateway = 502,
114+
ServiceUnavailable = 503,
115+
GatewayTimeout = 504,
116+
HttpVersionNotSupported = 505,
117+
}
118+
119+
export enum Method {
120+
Get = 'GET',
121+
Post = 'POST',
122+
Put = 'PUT',
123+
Patch = 'PATCH',
124+
Delete = 'DELETE',
125+
Head = 'HEAD',
126+
Options = 'OPTIONS',
127+
Connect = 'CONNECT',
128+
}

packages/apps/shopify-api/lib/webhooks/__tests__/index.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import request from 'supertest';
2-
import {StatusCode} from '@shopify/network';
32

43
import {queueMockResponse} from '../../__tests__/test-helper';
54
import {testConfig} from '../../__tests__/test-config';
65
import {HttpWebhookHandlerWithCallback} from '../types';
76
import {InvalidDeliveryMethodError, InvalidWebhookError} from '../../error';
8-
import {LogSeverity} from '../../types';
7+
import {LogSeverity, StatusCode} from '../../types';
98
import {Shopify, shopifyApi} from '../..';
109
import {Session} from '../../session/session';
1110

packages/apps/shopify-api/lib/webhooks/__tests__/process.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import {StatusCode} from '@shopify/network';
21
import request from 'supertest';
32

3+
import {StatusCode} from '../../types';
44
import {InvalidWebhookError} from '../../error';
55
import {testConfig} from '../../__tests__/test-config';
66
import {Shopify, shopifyApi} from '../..';

packages/apps/shopify-api/lib/webhooks/__tests__/register.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import {Method, Header} from '@shopify/network';
2-
31
import {
42
RegisterParams,
53
RegisterReturn,
64
WebhookHandler,
75
WebhookOperation,
86
} from '../types';
9-
import {ApiVersion, privacyTopics, ShopifyHeader} from '../../types';
7+
import {ApiVersion, Method, privacyTopics, ShopifyHeader} from '../../types';
108
import {DataType} from '../../clients/types';
119
import {
1210
queueMockResponse,
@@ -556,7 +554,7 @@ function assertWebhookCheckRequest(
556554
domain: session.shop,
557555
path: `/admin/api/${apiVersion}/graphql.json`,
558556
headers: {
559-
[Header.ContentType]: DataType.JSON.toString(),
557+
'Content-Type': DataType.JSON.toString(),
560558
[ShopifyHeader.AccessToken]: session.accessToken,
561559
},
562560
data: {query},
@@ -589,7 +587,7 @@ function assertWebhookRegistrationRequest(
589587
domain: session.shop,
590588
path: `/admin/api/${apiVersion}/graphql.json`,
591589
headers: {
592-
[Header.ContentType]: DataType.JSON.toString(),
590+
'Content-Type': DataType.JSON.toString(),
593591
[ShopifyHeader.AccessToken]: session.accessToken,
594592
},
595593
data: {query: webhookQuery},

packages/apps/shopify-api/lib/webhooks/process.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import {StatusCode} from '@shopify/network';
2-
1+
import {StatusCode} from '../types';
32
import {
43
abstractConvertResponse,
54
AdapterResponse,

packages/apps/shopify-api/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
"dependencies": {
8282
"@shopify/admin-api-client": "^1.1.1",
8383
"@shopify/graphql-client": "^1.4.1",
84-
"@shopify/network": "^3.3.0",
8584
"@shopify/storefront-api-client": "^1.0.9",
8685
"compare-versions": "^6.1.1",
8786
"isbot": "^5.1.26",

0 commit comments

Comments
 (0)