@gadgetinc/ggt 1.0.1 → 1.0.2
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.
|
@@ -113,12 +113,8 @@ var ConnectionStatus;
|
|
|
113
113
|
assert(ctx.app, "app must be set on Client context");
|
|
114
114
|
assert(ctx.env, "env must be set on Client context");
|
|
115
115
|
this.endpoint = endpoint;
|
|
116
|
-
let subdomain = ctx.app.slug;
|
|
117
|
-
if (ctx.app.hasSplitEnvironments) {
|
|
118
|
-
subdomain += "--development";
|
|
119
|
-
}
|
|
120
116
|
this._graphqlWsClient = createClient({
|
|
121
|
-
url: `wss://${
|
|
117
|
+
url: `wss://${ctx.app.slug}.${config.domains.app}/edit/api/graphql-ws`,
|
|
122
118
|
shouldRetry: ()=>true,
|
|
123
119
|
connectionParams: {
|
|
124
120
|
environment: ctx.env.name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/services/app/client.ts"],"sourcesContent":["import type { ExecutionResult } from \"graphql-ws\";\nimport { createClient } from \"graphql-ws\";\nimport assert from \"node:assert\";\nimport type { ClientRequestArgs } from \"node:http\";\nimport PQueue from \"p-queue\";\nimport type { Promisable } from \"type-fest\";\nimport WebSocket from \"ws\";\nimport type { Context } from \"../command/context.js\";\nimport { config } from \"../config/config.js\";\nimport { loadAuthHeaders } from \"../http/auth.js\";\nimport { http, type HttpOptions } from \"../http/http.js\";\nimport { noop, unthunk, type Thunk } from \"../util/function.js\";\nimport { isObject } from \"../util/is.js\";\nimport type { GraphQLMutation, GraphQLQuery, GraphQLSubscription } from \"./edit/operation.js\";\nimport { ClientError } from \"./error.js\";\n\nenum ConnectionStatus {\n CONNECTED,\n DISCONNECTED,\n RECONNECTING,\n}\n\n/**\n * Client is a GraphQL client connected to a Gadget application's\n * given endpoint.\n */\nexport class Client {\n // assume the client is going to connect\n status = ConnectionStatus.CONNECTED;\n\n readonly ctx: Context;\n\n readonly endpoint: string;\n\n private _graphqlWsClient: ReturnType<typeof createClient>;\n\n constructor(ctx: Context, endpoint: string) {\n this.ctx = ctx.child({ name: \"client\" });\n assert(ctx.app, \"app must be set on Client context\");\n assert(ctx.env, \"env must be set on Client context\");\n\n this.endpoint = endpoint;\n\n let subdomain = ctx.app.slug;\n if (ctx.app.hasSplitEnvironments) {\n subdomain += \"--development\";\n }\n\n this._graphqlWsClient = createClient({\n url: `wss://${subdomain}.${config.domains.app}/edit/api/graphql-ws`,\n shouldRetry: () => true,\n connectionParams: {\n environment: ctx.env.name,\n },\n webSocketImpl: class extends WebSocket {\n constructor(address: string | URL, protocols?: string | string[], wsOptions?: WebSocket.ClientOptions | ClientRequestArgs) {\n // this cookie should be available since we were given an app which requires a cookie to load\n const headers = loadAuthHeaders();\n\n assert(headers, \"missing headers when connecting to GraphQL API\");\n\n super(address, protocols, {\n signal: ctx.signal,\n ...wsOptions,\n headers: {\n ...wsOptions?.headers,\n \"user-agent\": config.versionFull,\n ...headers,\n },\n });\n }\n },\n on: {\n connecting: () => {\n switch (this.status) {\n case ConnectionStatus.DISCONNECTED:\n this.status = ConnectionStatus.RECONNECTING;\n this.ctx.log.info(\"reconnecting\");\n break;\n case ConnectionStatus.RECONNECTING:\n this.ctx.log.info(\"retrying\");\n break;\n default:\n this.ctx.log.debug(\"connecting\");\n break;\n }\n },\n connected: () => {\n if (this.status === ConnectionStatus.RECONNECTING) {\n this.ctx.log.info(\"reconnected\");\n } else {\n this.ctx.log.debug(\"connected\");\n }\n\n // let the other on connected listeners see what status we're in\n setImmediate(() => (this.status = ConnectionStatus.CONNECTED));\n },\n closed: () => {\n this.status = ConnectionStatus.DISCONNECTED;\n this.ctx.log.debug(\"disconnected\");\n },\n error: (error) => {\n if (this.status === ConnectionStatus.RECONNECTING) {\n this.ctx.log.error(\"failed to reconnect\", { error });\n } else {\n this.ctx.log.error(\"connection error\", { error });\n }\n },\n },\n });\n }\n\n /**\n * Subscribe to a GraphQL subscription.\n */\n subscribe<Subscription extends GraphQLSubscription>(\n ctx: Context,\n {\n subscription,\n variables,\n onResponse,\n onError: optionsOnError,\n onComplete = noop,\n }: {\n subscription: Subscription;\n variables?: Thunk<Subscription[\"Variables\"]> | null;\n onResponse: (response: ExecutionResult<Subscription[\"Data\"], Subscription[\"Extensions\"]>) => Promisable<void>;\n onError: (error: ClientError) => Promisable<void>;\n onComplete?: () => Promisable<void>;\n },\n ): () => void {\n let request = { query: subscription, variables: unthunk(variables) };\n\n const removeConnectedListener = this._graphqlWsClient.on(\"connected\", () => {\n if (this.status === ConnectionStatus.RECONNECTING) {\n request = { query: subscription, variables: unthunk(variables) };\n ctx.log.info(\"re-subscribing to graphql subscription\");\n }\n });\n\n const queue = new PQueue({ concurrency: 1 });\n const onError = (error: unknown): Promisable<void> => optionsOnError(new ClientError(subscription, error));\n\n const unsubscribe = this._graphqlWsClient.subscribe<Subscription[\"Data\"], Subscription[\"Extensions\"]>(request, {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n next: (response) => queue.add(() => onResponse(response)).catch(onError),\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n error: (error) => queue.add(() => onError(error)),\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n complete: () => queue.add(() => onComplete()).catch(onError),\n });\n\n return () => {\n removeConnectedListener();\n unsubscribe();\n };\n }\n\n /**\n * Execute a GraphQL query or mutation.\n */\n async execute<Operation extends GraphQLQuery | GraphQLMutation>(\n ctx: Context,\n request: {\n operation: Operation;\n variables?: Thunk<Operation[\"Variables\"]> | null;\n http?: HttpOptions;\n },\n ): Promise<ExecutionResult<Operation[\"Data\"], Operation[\"Extensions\"]>> {\n assert(ctx.app, \"missing app when executing GraphQL query\");\n assert(ctx.env, \"missing env when executing GraphQL query\");\n\n const headers = loadAuthHeaders();\n assert(headers, \"missing headers when executing GraphQL request\");\n\n let subdomain = ctx.app.slug;\n if (ctx.app.multiEnvironmentEnabled) {\n subdomain += `--${ctx.env.name}`;\n } else if (ctx.app.hasSplitEnvironments) {\n subdomain += \"--development\";\n }\n\n try {\n const json = await http({\n context: { ctx },\n method: \"POST\",\n url: `https://${subdomain}.${config.domains.app}${this.endpoint}`,\n headers: { ...headers, \"x-gadget-environment\": ctx.env.name },\n json: { query: request.operation, variables: unthunk(request.variables) },\n responseType: \"json\",\n resolveBodyOnly: true,\n throwHttpErrors: false,\n ...request.http,\n });\n\n if (!isObject(json) || (!(\"data\" in json) && !(\"errors\" in json))) {\n ctx.log.error(\"received invalid graphql response\", { error: json });\n throw json;\n }\n\n return json as Operation[\"Response\"];\n } catch (error) {\n throw new ClientError(request.operation, error);\n }\n }\n\n /**\n * Close the connection to the server.\n */\n async dispose(): Promise<void> {\n await this._graphqlWsClient.dispose();\n }\n}\n"],"names":["createClient","assert","PQueue","WebSocket","config","loadAuthHeaders","http","noop","unthunk","isObject","ClientError","ConnectionStatus","Client","subscribe","ctx","subscription","variables","onResponse","onError","optionsOnError","onComplete","request","query","removeConnectedListener","_graphqlWsClient","on","status","log","info","queue","concurrency","error","unsubscribe","next","response","add","catch","complete","execute","app","env","headers","subdomain","slug","multiEnvironmentEnabled","name","hasSplitEnvironments","json","context","method","url","domains","endpoint","operation","responseType","resolveBodyOnly","throwHttpErrors","dispose","constructor","child","shouldRetry","connectionParams","environment","webSocketImpl","address","protocols","wsOptions","signal","versionFull","connecting","debug","connected","setImmediate","closed"],"mappings":";AACA,SAASA,YAAY,QAAQ,aAAa;AAC1C,OAAOC,YAAY,cAAc;AAEjC,OAAOC,YAAY,UAAU;AAE7B,OAAOC,eAAe,KAAK;AAE3B,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,eAAe,QAAQ,kBAAkB;AAClD,SAASC,IAAI,QAA0B,kBAAkB;AACzD,SAASC,IAAI,EAAEC,OAAO,QAAoB,sBAAsB;AAChE,SAASC,QAAQ,QAAQ,gBAAgB;AAEzC,SAASC,WAAW,QAAQ,aAAa;;UAEpCC;;;;GAAAA,qBAAAA;AAML;;;CAGC,GACD,OAAO,MAAMC;I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,gEAAgE;oBAChEE,aAAa,IAAO,IAAI,CAAC9C,MAAM;gBACjC;gBACA+C,QAAQ;oBACN,IAAI,CAAC/C,MAAM;oBACX,IAAI,CAACZ,GAAG,CAACa,GAAG,CAAC2C,KAAK,CAAC;gBACrB;gBACAvC,OAAO,CAACA;oBACN,IAAI,IAAI,CAACL,MAAM,QAAoC;wBACjD,IAAI,CAACZ,GAAG,CAACa,GAAG,CAACI,KAAK,CAAC,uBAAuB;4BAAEA;wBAAM;oBACpD,OAAO;wBACL,IAAI,CAACjB,GAAG,CAACa,GAAG,CAACI,KAAK,CAAC,oBAAoB;4BAAEA;wBAAM;oBACjD;gBACF;YACF;QACF;IACF;AAsGF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/services/app/client.ts"],"sourcesContent":["import type { ExecutionResult } from \"graphql-ws\";\nimport { createClient } from \"graphql-ws\";\nimport assert from \"node:assert\";\nimport type { ClientRequestArgs } from \"node:http\";\nimport PQueue from \"p-queue\";\nimport type { Promisable } from \"type-fest\";\nimport WebSocket from \"ws\";\nimport type { Context } from \"../command/context.js\";\nimport { config } from \"../config/config.js\";\nimport { loadAuthHeaders } from \"../http/auth.js\";\nimport { http, type HttpOptions } from \"../http/http.js\";\nimport { noop, unthunk, type Thunk } from \"../util/function.js\";\nimport { isObject } from \"../util/is.js\";\nimport type { GraphQLMutation, GraphQLQuery, GraphQLSubscription } from \"./edit/operation.js\";\nimport { ClientError } from \"./error.js\";\n\nenum ConnectionStatus {\n CONNECTED,\n DISCONNECTED,\n RECONNECTING,\n}\n\n/**\n * Client is a GraphQL client connected to a Gadget application's\n * given endpoint.\n */\nexport class Client {\n // assume the client is going to connect\n status = ConnectionStatus.CONNECTED;\n\n readonly ctx: Context;\n\n readonly endpoint: string;\n\n private _graphqlWsClient: ReturnType<typeof createClient>;\n\n constructor(ctx: Context, endpoint: string) {\n this.ctx = ctx.child({ name: \"client\" });\n assert(ctx.app, \"app must be set on Client context\");\n assert(ctx.env, \"env must be set on Client context\");\n\n this.endpoint = endpoint;\n\n this._graphqlWsClient = createClient({\n url: `wss://${ctx.app.slug}.${config.domains.app}/edit/api/graphql-ws`,\n shouldRetry: () => true,\n connectionParams: {\n environment: ctx.env.name,\n },\n webSocketImpl: class extends WebSocket {\n constructor(address: string | URL, protocols?: string | string[], wsOptions?: WebSocket.ClientOptions | ClientRequestArgs) {\n // this cookie should be available since we were given an app which requires a cookie to load\n const headers = loadAuthHeaders();\n\n assert(headers, \"missing headers when connecting to GraphQL API\");\n\n super(address, protocols, {\n signal: ctx.signal,\n ...wsOptions,\n headers: {\n ...wsOptions?.headers,\n \"user-agent\": config.versionFull,\n ...headers,\n },\n });\n }\n },\n on: {\n connecting: () => {\n switch (this.status) {\n case ConnectionStatus.DISCONNECTED:\n this.status = ConnectionStatus.RECONNECTING;\n this.ctx.log.info(\"reconnecting\");\n break;\n case ConnectionStatus.RECONNECTING:\n this.ctx.log.info(\"retrying\");\n break;\n default:\n this.ctx.log.debug(\"connecting\");\n break;\n }\n },\n connected: () => {\n if (this.status === ConnectionStatus.RECONNECTING) {\n this.ctx.log.info(\"reconnected\");\n } else {\n this.ctx.log.debug(\"connected\");\n }\n\n // let the other on connected listeners see what status we're in\n setImmediate(() => (this.status = ConnectionStatus.CONNECTED));\n },\n closed: () => {\n this.status = ConnectionStatus.DISCONNECTED;\n this.ctx.log.debug(\"disconnected\");\n },\n error: (error) => {\n if (this.status === ConnectionStatus.RECONNECTING) {\n this.ctx.log.error(\"failed to reconnect\", { error });\n } else {\n this.ctx.log.error(\"connection error\", { error });\n }\n },\n },\n });\n }\n\n /**\n * Subscribe to a GraphQL subscription.\n */\n subscribe<Subscription extends GraphQLSubscription>(\n ctx: Context,\n {\n subscription,\n variables,\n onResponse,\n onError: optionsOnError,\n onComplete = noop,\n }: {\n subscription: Subscription;\n variables?: Thunk<Subscription[\"Variables\"]> | null;\n onResponse: (response: ExecutionResult<Subscription[\"Data\"], Subscription[\"Extensions\"]>) => Promisable<void>;\n onError: (error: ClientError) => Promisable<void>;\n onComplete?: () => Promisable<void>;\n },\n ): () => void {\n let request = { query: subscription, variables: unthunk(variables) };\n\n const removeConnectedListener = this._graphqlWsClient.on(\"connected\", () => {\n if (this.status === ConnectionStatus.RECONNECTING) {\n request = { query: subscription, variables: unthunk(variables) };\n ctx.log.info(\"re-subscribing to graphql subscription\");\n }\n });\n\n const queue = new PQueue({ concurrency: 1 });\n const onError = (error: unknown): Promisable<void> => optionsOnError(new ClientError(subscription, error));\n\n const unsubscribe = this._graphqlWsClient.subscribe<Subscription[\"Data\"], Subscription[\"Extensions\"]>(request, {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n next: (response) => queue.add(() => onResponse(response)).catch(onError),\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n error: (error) => queue.add(() => onError(error)),\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n complete: () => queue.add(() => onComplete()).catch(onError),\n });\n\n return () => {\n removeConnectedListener();\n unsubscribe();\n };\n }\n\n /**\n * Execute a GraphQL query or mutation.\n */\n async execute<Operation extends GraphQLQuery | GraphQLMutation>(\n ctx: Context,\n request: {\n operation: Operation;\n variables?: Thunk<Operation[\"Variables\"]> | null;\n http?: HttpOptions;\n },\n ): Promise<ExecutionResult<Operation[\"Data\"], Operation[\"Extensions\"]>> {\n assert(ctx.app, \"missing app when executing GraphQL query\");\n assert(ctx.env, \"missing env when executing GraphQL query\");\n\n const headers = loadAuthHeaders();\n assert(headers, \"missing headers when executing GraphQL request\");\n\n let subdomain = ctx.app.slug;\n if (ctx.app.multiEnvironmentEnabled) {\n subdomain += `--${ctx.env.name}`;\n } else if (ctx.app.hasSplitEnvironments) {\n subdomain += \"--development\";\n }\n\n try {\n const json = await http({\n context: { ctx },\n method: \"POST\",\n url: `https://${subdomain}.${config.domains.app}${this.endpoint}`,\n headers: { ...headers, \"x-gadget-environment\": ctx.env.name },\n json: { query: request.operation, variables: unthunk(request.variables) },\n responseType: \"json\",\n resolveBodyOnly: true,\n throwHttpErrors: false,\n ...request.http,\n });\n\n if (!isObject(json) || (!(\"data\" in json) && !(\"errors\" in json))) {\n ctx.log.error(\"received invalid graphql response\", { error: json });\n throw json;\n }\n\n return json as Operation[\"Response\"];\n } catch (error) {\n throw new ClientError(request.operation, error);\n }\n }\n\n /**\n * Close the connection to the server.\n */\n async dispose(): Promise<void> {\n await this._graphqlWsClient.dispose();\n }\n}\n"],"names":["createClient","assert","PQueue","WebSocket","config","loadAuthHeaders","http","noop","unthunk","isObject","ClientError","ConnectionStatus","Client","subscribe","ctx","subscription","variables","onResponse","onError","optionsOnError","onComplete","request","query","removeConnectedListener","_graphqlWsClient","on","status","log","info","queue","concurrency","error","unsubscribe","next","response","add","catch","complete","execute","app","env","headers","subdomain","slug","multiEnvironmentEnabled","name","hasSplitEnvironments","json","context","method","url","domains","endpoint","operation","responseType","resolveBodyOnly","throwHttpErrors","dispose","constructor","child","shouldRetry","connectionParams","environment","webSocketImpl","address","protocols","wsOptions","signal","versionFull","connecting","debug","connected","setImmediate","closed"],"mappings":";AACA,SAASA,YAAY,QAAQ,aAAa;AAC1C,OAAOC,YAAY,cAAc;AAEjC,OAAOC,YAAY,UAAU;AAE7B,OAAOC,eAAe,KAAK;AAE3B,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,eAAe,QAAQ,kBAAkB;AAClD,SAASC,IAAI,QAA0B,kBAAkB;AACzD,SAASC,IAAI,EAAEC,OAAO,QAAoB,sBAAsB;AAChE,SAASC,QAAQ,QAAQ,gBAAgB;AAEzC,SAASC,WAAW,QAAQ,aAAa;;UAEpCC;;;;GAAAA,qBAAAA;AAML;;;CAGC,GACD,OAAO,MAAMC;IAiFX;;GAEC,GACDC,UACEC,GAAY,EACZ,EACEC,YAAY,EACZC,SAAS,EACTC,UAAU,EACVC,SAASC,cAAc,EACvBC,aAAab,IAAI,EAOlB,EACW;QACZ,IAAIc,UAAU;YAAEC,OAAOP;YAAcC,WAAWR,QAAQQ;QAAW;QAEnE,MAAMO,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4BAAEA;wBAAM;oBACpD,OAAO;wBACL,IAAI,CAACjB,GAAG,CAACa,GAAG,CAACI,KAAK,CAAC,oBAAoB;4BAAEA;wBAAM;oBACjD;gBACF;YACF;QACF;IACF;AAsGF"}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gadgetinc/ggt",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@gadgetinc/ggt",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.2",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@sentry/node": "^7.107.0",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"remark-toc": "^9.0.0",
|
|
102
102
|
"rimraf": "^5.0.5",
|
|
103
103
|
"type-fest": "^4.13.1",
|
|
104
|
-
"typescript": "^5.4.
|
|
104
|
+
"typescript": "^5.4.3",
|
|
105
105
|
"vitest": "^1.4.0"
|
|
106
106
|
},
|
|
107
107
|
"engines": {
|
|
@@ -16111,9 +16111,9 @@
|
|
|
16111
16111
|
}
|
|
16112
16112
|
},
|
|
16113
16113
|
"node_modules/typescript": {
|
|
16114
|
-
"version": "5.4.
|
|
16115
|
-
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.
|
|
16116
|
-
"integrity": "sha512
|
|
16114
|
+
"version": "5.4.3",
|
|
16115
|
+
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz",
|
|
16116
|
+
"integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==",
|
|
16117
16117
|
"dev": true,
|
|
16118
16118
|
"bin": {
|
|
16119
16119
|
"tsc": "bin/tsc",
|
|
@@ -28509,9 +28509,9 @@
|
|
|
28509
28509
|
}
|
|
28510
28510
|
},
|
|
28511
28511
|
"typescript": {
|
|
28512
|
-
"version": "5.4.
|
|
28513
|
-
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.
|
|
28514
|
-
"integrity": "sha512
|
|
28512
|
+
"version": "5.4.3",
|
|
28513
|
+
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz",
|
|
28514
|
+
"integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==",
|
|
28515
28515
|
"dev": true
|
|
28516
28516
|
},
|
|
28517
28517
|
"ua-parser-js": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gadgetinc/ggt",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "The command-line interface for Gadget",
|
|
5
5
|
"homepage": "https://github.com/gadget-inc/ggt",
|
|
6
6
|
"bugs": {
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"remark-toc": "^9.0.0",
|
|
134
134
|
"rimraf": "^5.0.5",
|
|
135
135
|
"type-fest": "^4.13.1",
|
|
136
|
-
"typescript": "^5.4.
|
|
136
|
+
"typescript": "^5.4.3",
|
|
137
137
|
"vitest": "^1.4.0"
|
|
138
138
|
},
|
|
139
139
|
"engines": {
|