@commercetools/cli-topic-integration-layer 0.5.0 → 0.6.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/README.md +9 -17
- package/dist/commands/integration-layer/allowlist/add.js +2 -2
- package/dist/commands/integration-layer/allowlist/add.js.map +1 -1
- package/dist/commands/integration-layer/config/unset.js +1 -1
- package/dist/commands/integration-layer/config/unset.js.map +1 -1
- package/dist/commands/integration-layer/explore.js +4 -4
- package/dist/commands/integration-layer/explore.js.map +1 -1
- package/dist/commands/integration-layer/extension/push.d.ts +1 -1
- package/dist/commands/integration-layer/extension/push.js +7 -7
- package/dist/commands/integration-layer/extension/push.js.map +1 -1
- package/dist/commands/integration-layer/extension/serve.d.ts +10 -3
- package/dist/commands/integration-layer/extension/serve.js +89 -36
- package/dist/commands/integration-layer/extension/serve.js.map +1 -1
- package/dist/commands/integration-layer/extension/validate.js +3 -3
- package/dist/commands/integration-layer/extension/validate.js.map +1 -1
- package/dist/commands/integration-layer/init.js +7 -7
- package/dist/lib/awaitBundleState.js +3 -3
- package/dist/lib/awaitBundleState.js.map +1 -1
- package/dist/lib/base.d.ts +1 -1
- package/dist/lib/base.js +5 -5
- package/dist/lib/base.js.map +1 -1
- package/dist/lib/ilClient.d.ts +9 -9
- package/dist/lib/ilClient.js +5 -5
- package/dist/lib/ilClient.js.map +1 -1
- package/dist/lib/sourceRevision.d.ts +1 -1
- package/dist/lib/sourceRevision.js +3 -3
- package/dist/lib/sourceRevision.js.map +1 -1
- package/dist/lib/tooling/compose.d.ts +2 -2
- package/dist/lib/tooling/compose.js +3 -3
- package/dist/lib/tooling/compose.js.map +1 -1
- package/dist/lib/tooling/exploreSchema.js +1 -1
- package/dist/lib/tooling/exploreSchema.js.map +1 -1
- package/dist/lib/tooling/explorerPage.js +2 -2
- package/dist/lib/tooling/gateway.d.ts +1 -1
- package/dist/lib/tooling/gateway.js +4 -4
- package/dist/lib/tooling/gateway.js.map +1 -1
- package/dist/lib/tooling/sandboxFetch.d.ts +14 -0
- package/dist/lib/tooling/sandboxFetch.js +100 -0
- package/dist/lib/tooling/sandboxFetch.js.map +1 -0
- package/dist/lib/tooling/session.d.ts +1 -1
- package/dist/lib/tooling/session.js +2 -2
- package/dist/lib/tooling/session.js.map +1 -1
- package/dist/lib/tooling/validateBundle.js +16 -3
- package/dist/lib/tooling/validateBundle.js.map +1 -1
- package/package.json +6 -1
package/dist/lib/base.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Base class for the topic's commands that reach the
|
|
1
|
+
// Base class for the topic's commands that reach the Commerce Integration Layer's
|
|
2
2
|
// `manage_project` boundary. The bearer is the token `commercetools auth login`
|
|
3
3
|
// already persisted to `~/.commercetools/credentials`; we read it back from disk
|
|
4
4
|
// here rather than from the auth plugin's in-memory security context — see below.
|
|
@@ -104,7 +104,7 @@ export function authEdgeUrlForRegion(region) {
|
|
|
104
104
|
export class IntegrationLayerCommand extends AuthCommand {
|
|
105
105
|
/**
|
|
106
106
|
* Whether the command needs a logged-in principal. True for every command that
|
|
107
|
-
* calls the
|
|
107
|
+
* calls the Commerce Integration Layer; a command that only conditionally reaches it (e.g.
|
|
108
108
|
* `serve` in standalone mode) sets this false and relies on {@link resolveIlContext}
|
|
109
109
|
* to fail loudly if the network path is actually taken.
|
|
110
110
|
*/
|
|
@@ -119,11 +119,11 @@ export class IntegrationLayerCommand extends AuthCommand {
|
|
|
119
119
|
"integration-layer-url": Flags.string({
|
|
120
120
|
description: "integration-layer extensions edge base URL (also settable via INTEGRATION_LAYER_URL); overrides the URL derived from your login region",
|
|
121
121
|
env: "INTEGRATION_LAYER_URL",
|
|
122
|
-
helpGroup: "INTEGRATION LAYER",
|
|
122
|
+
helpGroup: "COMMERCE INTEGRATION LAYER",
|
|
123
123
|
}),
|
|
124
124
|
"project-key": Flags.string({
|
|
125
125
|
description: "override the logged-in project key",
|
|
126
|
-
helpGroup: "INTEGRATION LAYER",
|
|
126
|
+
helpGroup: "COMMERCE INTEGRATION LAYER",
|
|
127
127
|
}),
|
|
128
128
|
};
|
|
129
129
|
async init() {
|
|
@@ -161,7 +161,7 @@ export class IntegrationLayerCommand extends AuthCommand {
|
|
|
161
161
|
}
|
|
162
162
|
const baseUrl = flags["integration-layer-url"] ?? edgeUrlForRegion(principal.getRegion());
|
|
163
163
|
if (!baseUrl) {
|
|
164
|
-
throw new Error("could not resolve the
|
|
164
|
+
throw new Error("could not resolve the Commerce Integration Layer URL: pass --integration-layer-url or set " +
|
|
165
165
|
"INTEGRATION_LAYER_URL (the extensions edge base, e.g. " +
|
|
166
166
|
"https://extensions.integration-layer.eu-central-1.aws.commercetools.com)");
|
|
167
167
|
}
|
package/dist/lib/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/lib/base.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/lib/base.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,gFAAgF;AAChF,iFAAiF;AACjF,kFAAkF;AAClF,EAAE;AACF,gFAAgF;AAChF,qFAAqF;AACrF,mFAAmF;AACnF,oFAAoF;AACpF,sFAAsF;AACtF,uFAAuF;AACvF,mFAAmF;AACnF,oFAAoF;AACpF,oFAAoF;AACpF,iFAAiF;AACjF,4EAA4E;AAC5E,EAAE;AACF,uFAAuF;AACvF,oEAAoE;AACpE,yFAAyF;AACzF,uFAAuF;AACvF,wFAAwF;AACxF,oFAAoF;AACpF,qFAAqF;AACrF,uEAAuE;AACvE,2CAA2C;AAE3C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,4BAA4B,EAC5B,iCAAiC,GAClC,MAAM,gCAAgC,CAA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GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC,aAAa,EAAE,CAAC;QACrE,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACb,mGAAmG,CACpG,CAAC;QACJ,CAAC;QAED,MAAM,OAAO,GAAG,KAAK,CAAC,uBAAuB,CAAC,IAAI,gBAAgB,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC;QAC1F,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CACb,4FAA4F;gBAC1F,wDAAwD;gBACxD,0EAA0E,CAC7E,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IACrE,CAAC"}
|
package/dist/lib/ilClient.d.ts
CHANGED
|
@@ -10,11 +10,11 @@ export interface ConfigEntry {
|
|
|
10
10
|
* pending — stored and being handed out, but nothing has confirmed it loads.
|
|
11
11
|
* running — an extension loaded it and published its schema. Once a version
|
|
12
12
|
* reaches this it is never demoted.
|
|
13
|
-
* failed — it could not be loaded (`reason` says why). The
|
|
13
|
+
* failed — it could not be loaded (`reason` says why). The Commerce Integration Layer
|
|
14
14
|
* stops handing it out and the version beneath it takes over.
|
|
15
15
|
*/
|
|
16
16
|
export type ExtensionState = "pending" | "running" | "failed";
|
|
17
|
-
/** The stored bundle's metadata (
|
|
17
|
+
/** The stored bundle's metadata (Commerce Integration Layer `ExtensionMeta`). */
|
|
18
18
|
export interface ExtensionMeta {
|
|
19
19
|
projectKey: string;
|
|
20
20
|
length: number;
|
|
@@ -29,7 +29,7 @@ export interface ExtensionMeta {
|
|
|
29
29
|
*/
|
|
30
30
|
sourceRevision?: string;
|
|
31
31
|
/**
|
|
32
|
-
* Lifecycle state of THIS version. Absent when talking to
|
|
32
|
+
* Lifecycle state of THIS version. Absent when talking to a Commerce Integration Layer
|
|
33
33
|
* that predates bundle state — callers must treat `undefined` as "this deployment
|
|
34
34
|
* can't tell me", not as a failure.
|
|
35
35
|
*/
|
|
@@ -38,12 +38,12 @@ export interface ExtensionMeta {
|
|
|
38
38
|
reason?: string;
|
|
39
39
|
/**
|
|
40
40
|
* The version actually in use, which is NOT always `version`: when the newest
|
|
41
|
-
* upload failed to load, the
|
|
41
|
+
* upload failed to load, the Commerce Integration Layer serves the one beneath it and this
|
|
42
42
|
* reports that older one. `null` when nothing is in use. Returned by the meta read
|
|
43
43
|
* only, not by an upload's response.
|
|
44
44
|
*
|
|
45
45
|
* It carries the source revision as well as the number, because the number is the
|
|
46
|
-
*
|
|
46
|
+
* Commerce Integration Layer's own counter — the commit is what identifies the build to
|
|
47
47
|
* whoever pushed it.
|
|
48
48
|
*/
|
|
49
49
|
served?: {
|
|
@@ -68,9 +68,9 @@ export declare function fetchSubgraphSdl(baseUrl: string, projectKey: string, to
|
|
|
68
68
|
/**
|
|
69
69
|
* GET the project's DEPLOYED composed graph as a PUBLIC API SCHEMA — what the router
|
|
70
70
|
* actually plans and serves (core subgraph + the project's published extension),
|
|
71
|
-
* read from Hive by the
|
|
71
|
+
* read from Hive by the Commerce Integration Layer and reduced there (`GET …/schema/api`).
|
|
72
72
|
*
|
|
73
|
-
* The
|
|
73
|
+
* The Commerce Integration Layer strips the federation machinery before sending, so this is
|
|
74
74
|
* `buildSchema`-able as-is; there is no supergraph to reduce client-side. It is the
|
|
75
75
|
* byte-identical response the Merchant Center console's explorer reads under its
|
|
76
76
|
* own operator JWT — one artifact, two guards.
|
|
@@ -87,7 +87,7 @@ export declare function remoteValidate(baseUrl: string, projectKey: string, toke
|
|
|
87
87
|
* Upload the built bundle, replacing the project's stored one (`PUT …/extension/bundle`).
|
|
88
88
|
*
|
|
89
89
|
* `sourceRevision` (optional) records which of the integrator's revisions this build
|
|
90
|
-
* came from; the
|
|
90
|
+
* came from; the Commerce Integration Layer stores it against the revision, shows it in the
|
|
91
91
|
* Merchant Center, and hands it to the connector.
|
|
92
92
|
*/
|
|
93
93
|
export declare function pushBundle(baseUrl: string, projectKey: string, token: string, bundle: string, filename: string, sourceRevision?: string): Promise<ExtensionMeta>;
|
|
@@ -113,7 +113,7 @@ export declare function getAllowlist(baseUrl: string, projectKey: string, token:
|
|
|
113
113
|
/**
|
|
114
114
|
* Replace the merchant `allow` patterns with `patterns` (`PUT …/extension/allowlist`).
|
|
115
115
|
* The route takes a bare JSON array and REPLACES the whole allow list — the add/remove
|
|
116
|
-
* commands read-modify-write around it. The
|
|
116
|
+
* commands read-modify-write around it. The Commerce Integration Layer validates and normalizes
|
|
117
117
|
* (lowercases, de-dupes, rejects schemes/ports/paths/IPs/over-broad patterns) and
|
|
118
118
|
* returns the stored list plus the config's new monotonic version. The `deny` ceiling
|
|
119
119
|
* is untouched (it has no write route).
|
package/dist/lib/ilClient.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Low-level HTTP client for the
|
|
1
|
+
// Low-level HTTP client for the Commerce Integration Layer's per-project manage-surface
|
|
2
2
|
// routes. Every call is parameterised by (baseUrl, projectKey, token) — the command
|
|
3
3
|
// layer resolves those (`IntegrationLayerCommand.resolveIlContext`, whose token is the
|
|
4
4
|
// `commercetools auth login` principal's) and this module just speaks the wire
|
|
@@ -25,9 +25,9 @@ export async function fetchSubgraphSdl(baseUrl, projectKey, token) {
|
|
|
25
25
|
/**
|
|
26
26
|
* GET the project's DEPLOYED composed graph as a PUBLIC API SCHEMA — what the router
|
|
27
27
|
* actually plans and serves (core subgraph + the project's published extension),
|
|
28
|
-
* read from Hive by the
|
|
28
|
+
* read from Hive by the Commerce Integration Layer and reduced there (`GET …/schema/api`).
|
|
29
29
|
*
|
|
30
|
-
* The
|
|
30
|
+
* The Commerce Integration Layer strips the federation machinery before sending, so this is
|
|
31
31
|
* `buildSchema`-able as-is; there is no supergraph to reduce client-side. It is the
|
|
32
32
|
* byte-identical response the Merchant Center console's explorer reads under its
|
|
33
33
|
* own operator JWT — one artifact, two guards.
|
|
@@ -68,7 +68,7 @@ export async function remoteValidate(baseUrl, projectKey, token, typeDefs) {
|
|
|
68
68
|
* Upload the built bundle, replacing the project's stored one (`PUT …/extension/bundle`).
|
|
69
69
|
*
|
|
70
70
|
* `sourceRevision` (optional) records which of the integrator's revisions this build
|
|
71
|
-
* came from; the
|
|
71
|
+
* came from; the Commerce Integration Layer stores it against the revision, shows it in the
|
|
72
72
|
* Merchant Center, and hands it to the connector.
|
|
73
73
|
*/
|
|
74
74
|
export async function pushBundle(baseUrl, projectKey, token, bundle, filename, sourceRevision) {
|
|
@@ -130,7 +130,7 @@ export async function getAllowlist(baseUrl, projectKey, token) {
|
|
|
130
130
|
/**
|
|
131
131
|
* Replace the merchant `allow` patterns with `patterns` (`PUT …/extension/allowlist`).
|
|
132
132
|
* The route takes a bare JSON array and REPLACES the whole allow list — the add/remove
|
|
133
|
-
* commands read-modify-write around it. The
|
|
133
|
+
* commands read-modify-write around it. The Commerce Integration Layer validates and normalizes
|
|
134
134
|
* (lowercases, de-dupes, rejects schemes/ports/paths/IPs/over-broad patterns) and
|
|
135
135
|
* returns the stored list plus the config's new monotonic version. The `deny` ceiling
|
|
136
136
|
* is untouched (it has no write route).
|
package/dist/lib/ilClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ilClient.js","sourceRoot":"","sources":["../../src/lib/ilClient.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ilClient.js","sourceRoot":"","sources":["../../src/lib/ilClient.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,oFAAoF;AACpF,uFAAuF;AACvF,+EAA+E;AAC/E,kEAAkE;AAClE,sFAAsF;AACtF,oFAAoF;AACpF,kEAAkE;AAwElE,SAAS,OAAO,CAAC,OAAe,EAAE,UAAkB;IAClD,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,UAAU,CAAC,E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IAC1E,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAkB,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAe,EACf,UAAkB,EAClB,KAAa,EACb,OAAuE;IAEvE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,mBAAmB,CAAC;IAC/D,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC3B,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE;QACjE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;KAC9B,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9B,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,kCAAkC,GAAG,CAAC,MAAM,MAAM,IAAI,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAkB,CAAC;AAC3C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Longest revision the
|
|
2
|
+
* Longest revision the Commerce Integration Layer stores — it truncates past this. Applied
|
|
3
3
|
* here too so what the CLI prints is what actually gets stored, rather than a value
|
|
4
4
|
* the server silently shortens.
|
|
5
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Where the bundle being pushed came from — the integrator's OWN version-control
|
|
2
|
-
// revision, recorded against the stored bundle by the
|
|
2
|
+
// revision, recorded against the stored bundle by the Commerce Integration Layer.
|
|
3
3
|
//
|
|
4
4
|
// The point is provenance: with this, the Merchant Center shows which revision a
|
|
5
5
|
// project is running, the connector stamps it on every log line, and
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
// GIT is auto-detected because that's what the examples and (nearly) every
|
|
11
11
|
// integrator use. Any other VCS — hg, svn, Perforce, a CI build id — is supported
|
|
12
12
|
// through `--source-revision` / `EXTENSION_SOURCE_REVISION` rather than a detector
|
|
13
|
-
// per system: the
|
|
13
|
+
// per system: the Commerce Integration Layer treats the value as an OPAQUE string, so
|
|
14
14
|
// whatever identifies a revision to the integrator is the right thing to send.
|
|
15
15
|
import { execFile } from "node:child_process";
|
|
16
16
|
import { promisify } from "node:util";
|
|
17
17
|
const exec = promisify(execFile);
|
|
18
18
|
/**
|
|
19
|
-
* Longest revision the
|
|
19
|
+
* Longest revision the Commerce Integration Layer stores — it truncates past this. Applied
|
|
20
20
|
* here too so what the CLI prints is what actually gets stored, rather than a value
|
|
21
21
|
* the server silently shortens.
|
|
22
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sourceRevision.js","sourceRoot":"","sources":["../../src/lib/sourceRevision.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,
|
|
1
|
+
{"version":3,"file":"sourceRevision.js","sourceRoot":"","sources":["../../src/lib/sourceRevision.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,kFAAkF;AAClF,EAAE;AACF,iFAAiF;AACjF,qEAAqE;AACrE,oFAAoF;AACpF,mFAAmF;AACnF,0BAA0B;AAC1B,EAAE;AACF,2EAA2E;AAC3E,kFAAkF;AAClF,mFAAmF;AACnF,sFAAsF;AACtF,+EAA+E;AAE/E,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEjC;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAyB;IAC9D,IAAI,CA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AG,SAAS,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACjD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,QAA4B,EAC5B,GAAW;IAEX,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IACpE,OAAO,sBAAsB,CAAC,CAAC,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type GraphQLSchema } from "graphql";
|
|
2
|
-
/** The subgraph names the
|
|
2
|
+
/** The subgraph names the Commerce Integration Layer composes under — matched here so the
|
|
3
3
|
* local composition mirrors the deployed one. `integration-layer` is the name an
|
|
4
4
|
* extension's `@override(from: …)` references. */
|
|
5
5
|
export declare const INTEGRATION_LAYER_SERVICE = "integration-layer";
|
|
@@ -17,7 +17,7 @@ export type ComposeResult = {
|
|
|
17
17
|
errors: string[];
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
-
* Compose the
|
|
20
|
+
* Compose the Commerce Integration Layer + the extension into a supergraph and derive the
|
|
21
21
|
* client-facing API schema. Never throws — a composition failure comes back in
|
|
22
22
|
* `errors` so the dev server can surface it and keep serving. The URLs are baked into
|
|
23
23
|
* the supergraph so `--gateway` routes correctly; for `--compose` they're cosmetic.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Compose the local extension subgraph with the project's live integration-layer
|
|
2
|
-
// subgraph — the same two-subgraph composition the
|
|
2
|
+
// subgraph — the same two-subgraph composition the Commerce Integration Layer runs on publish.
|
|
3
3
|
//
|
|
4
4
|
// `composeWithIntegrationLayer` below is the low-level half. Fetching the project's
|
|
5
5
|
// subgraph SDL is a plain authenticated HTTP call, so it lives separately in
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
// layer supplying the token.
|
|
8
8
|
import { parse, printSchema } from "graphql";
|
|
9
9
|
import { composeServices } from "@apollo/composition";
|
|
10
|
-
/** The subgraph names the
|
|
10
|
+
/** The subgraph names the Commerce Integration Layer composes under — matched here so the
|
|
11
11
|
* local composition mirrors the deployed one. `integration-layer` is the name an
|
|
12
12
|
* extension's `@override(from: …)` references. */
|
|
13
13
|
export const INTEGRATION_LAYER_SERVICE = "integration-layer";
|
|
14
14
|
export const EXTENSION_SERVICE = "extensions";
|
|
15
15
|
/**
|
|
16
|
-
* Compose the
|
|
16
|
+
* Compose the Commerce Integration Layer + the extension into a supergraph and derive the
|
|
17
17
|
* client-facing API schema. Never throws — a composition failure comes back in
|
|
18
18
|
* `errors` so the dev server can surface it and keep serving. The URLs are baked into
|
|
19
19
|
* the supergraph so `--gateway` routes correctly; for `--compose` they're cosmetic.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.js","sourceRoot":"","sources":["../../../src/lib/tooling/compose.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF
|
|
1
|
+
{"version":3,"file":"compose.js","sourceRoot":"","sources":["../../../src/lib/tooling/compose.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,+FAA+F;AAC/F,EAAE;AACF,oFAAoF;AACpF,6EAA6E;AAC7E,mFAAmF;AACnF,6BAA6B;AAE7B,OAAO,EAAE,KAAK,EAAE,WAAW,EAAsB,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;mDAEmD;AACnD,MAAM,CAAC,MAAM,yBAAyB,GAAG,mBAAmB,CAAC;AAC7D,MAAM,CAAC,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAc9C;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,mBAA2B,EAC3B,YAAoB,EACpB,IAA2D;IAE3D,IAAI,QAAQ,CAAC;IACb,IAAI,CAAC;QACH,QAAQ,GAAG;YACT,EAAE,IAAI,EAAE,yBAAyB,EAAE,QAAQ,EAAE,KAAK,CAAC,mBAAmB,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,mBAAmB,EAAE;YACxG,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE;SACnF,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,6BAA8B,GAAa,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;IACxF,CAAC;IAED,MAAM,MAAM,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IACzC,gFAAgF;IAChF,6EAA6E;IAC7E,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACpE,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,iBAAiB,EAAE,CAAC;IAClE,OAAO;QACL,EAAE,EAAE,IAAI;QACR,SAAS;QACT,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC;QAC9B,aAAa,EAAE,MAAM,CAAC,aAAa;KACpC,CAAC;AACJ,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// Fast inner loop: edit the extension, restart, see your fields.
|
|
6
6
|
//
|
|
7
7
|
// --deployed the project's DEPLOYED composed graph (GET /schema/api), read from
|
|
8
|
-
// Hive by the
|
|
8
|
+
// Hive by the Commerce Integration Layer and reduced THERE to a public API
|
|
9
9
|
// schema — exactly what the router plans and serves, including
|
|
10
10
|
// whichever extension is actually deployed. The command just
|
|
11
11
|
// buildSchema()s it, so nothing in this module handles that path.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exploreSchema.js","sourceRoot":"","sources":["../../../src/lib/tooling/exploreSchema.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,kFAAkF;AAClF,mFAAmF;AACnF,gFAAgF;AAChF,EAAE;AACF,oFAAoF;AACpF,
|
|
1
|
+
{"version":3,"file":"exploreSchema.js","sourceRoot":"","sources":["../../../src/lib/tooling/exploreSchema.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,kFAAkF;AAClF,mFAAmF;AACnF,gFAAgF;AAChF,EAAE;AACF,oFAAoF;AACpF,0FAA0F;AAC1F,8EAA8E;AAC9E,4EAA4E;AAC5E,iFAAiF;AACjF,EAAE;AACF,qFAAqF;AACrF,sFAAsF;AACtF,kFAAkF;AAClF,oFAAoF;AACpF,oFAAoF;AAEpF,OAAO,EAAE,WAAW,EAAsB,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,GAE1B,MAAM,cAAc,CAAC;AAEtB;;wEAEwE;AACxE,MAAM,YAAY,GAAG,wCAAwC,CAAC;AAC9D,MAAM,mBAAmB,GAAG,gCAAgC,CAAC;AAU7D;;;;GAIG;AACH,SAAS,eAAe,CAAC,OAAe;IACtC,IAAI,QAAQ,CAAC;IACb,IAAI,CAAC;QACH,QAAQ,GAAG;YACT,EAAE,IAAI,EAAE,yBAAyB,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE;SACjF,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,2CAA4C,GAAa,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;IACtG,CAAC;IACD,MAAM,MAAM,GAAG,eAAe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utf-8" />
|
|
15
15
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
16
|
-
<title>GraphQL Explorer · commercetools
|
|
16
|
+
<title>GraphQL Explorer · commercetools Commerce Integration Layer</title>
|
|
17
17
|
<style>
|
|
18
18
|
body { margin: 0; height: 100dvh; overflow: hidden; }
|
|
19
19
|
#graphiql { height: 100dvh; }
|
|
@@ -67,7 +67,7 @@ export const EXPLORER_HTML = String.raw `<!doctype html>
|
|
|
67
67
|
const plugins = [HISTORY_PLUGIN, explorerPlugin()];
|
|
68
68
|
|
|
69
69
|
const DEFAULT_QUERY = [
|
|
70
|
-
'# Local GraphQL explorer for your commercetools
|
|
70
|
+
'# Local GraphQL explorer for your commercetools Commerce Integration Layer.',
|
|
71
71
|
'#',
|
|
72
72
|
'# Operations run against the DEPLOYED edge under the session shown in your',
|
|
73
73
|
'# terminal. Docs and autocomplete come from the schema the CLI resolved.',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApolloGateway } from "@apollo/gateway";
|
|
2
2
|
/**
|
|
3
3
|
* Mint an anonymous session and return its bearer token. The gateway attaches it to
|
|
4
|
-
* every integration-layer subgraph request; the
|
|
4
|
+
* every integration-layer subgraph request; the Commerce Integration Layer 403s a bearer
|
|
5
5
|
* whose project doesn't match the URL, so an anonymous session is the minimum needed
|
|
6
6
|
* to route real queries through. (A 30-day sliding TTL easily outlasts a dev session.)
|
|
7
7
|
*/
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// The `--gateway` half of the local dev server: an executable merged schema that
|
|
2
2
|
// routes each field to its owner — the local extension and the project's deployed
|
|
3
|
-
//
|
|
4
|
-
// resolves `name` from the
|
|
3
|
+
// Commerce Integration Layer — so a query like `{ product(id:…) { name loyaltyPoints(price:…) }}`
|
|
4
|
+
// resolves `name` from the Commerce Integration Layer and `loyaltyPoints` from the local
|
|
5
5
|
// extension in one request, the production topology in miniature.
|
|
6
6
|
//
|
|
7
7
|
// We use Apollo Gateway (the reference Federation
|
|
8
8
|
// implementation) because the extension model leans on `@interfaceObject` and only
|
|
9
9
|
// the reference gateway resolves that correctly. Both subgraphs are reached over
|
|
10
10
|
// HTTP, so the extension runs as a genuine subgraph; the integration-layer data
|
|
11
|
-
// source carries an anonymous session bearer (the
|
|
11
|
+
// source carries an anonymous session bearer (the Commerce Integration Layer re-validates the
|
|
12
12
|
// bearer's project against the URL).
|
|
13
13
|
import { ApolloGateway, RemoteGraphQLDataSource } from "@apollo/gateway";
|
|
14
14
|
import { INTEGRATION_LAYER_SERVICE } from "./compose.js";
|
|
15
15
|
/**
|
|
16
16
|
* Mint an anonymous session and return its bearer token. The gateway attaches it to
|
|
17
|
-
* every integration-layer subgraph request; the
|
|
17
|
+
* every integration-layer subgraph request; the Commerce Integration Layer 403s a bearer
|
|
18
18
|
* whose project doesn't match the URL, so an anonymous session is the minimum needed
|
|
19
19
|
* to route real queries through. (A 30-day sliding TTL easily outlasts a dev session.)
|
|
20
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../../../src/lib/tooling/gateway.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,kFAAkF;AAClF,yFAAyF;AACzF,
|
|
1
|
+
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../../../src/lib/tooling/gateway.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,kFAAkF;AAClF,kGAAkG;AAClG,yFAAyF;AACzF,kEAAkE;AAClE,EAAE;AACF,kDAAkD;AAClD,mFAAmF;AACnF,iFAAiF;AACjF,gFAAgF;AAChF,8FAA8F;AAC9F,qCAAqC;AAErC,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,mBAA2B,EAC3B,UAAkB;IAElB,MAAM,IAAI,GA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vC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC;gBACtF,CAAC;YACH,CAAC;SACF,CAAC;KACL,CAAC,CAAC;IACH,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;IACrB,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Supplies the current allow patterns, re-read on every sandbox `fetch` call. */
|
|
2
|
+
export type AllowlistProvider = () => readonly string[];
|
|
3
|
+
/**
|
|
4
|
+
* Build the allowlist-gated `fetch` the production sandbox endows. Throws a `TypeError`
|
|
5
|
+
* — like `fetch` on failure — when the destination is not on the allow list.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createSandboxFetch(allowlistProvider: AllowlistProvider): typeof fetch;
|
|
8
|
+
/**
|
|
9
|
+
* Route `globalThis.fetch` through the sandbox wrapper when a resolver runs inside
|
|
10
|
+
* {@link wrapResolverMap}. Returns a restore function for shutdown.
|
|
11
|
+
*/
|
|
12
|
+
export declare function installDelegatingFetch(): () => void;
|
|
13
|
+
/** Wrap every resolver so its `fetch` calls use the allowlist-gated wrapper. */
|
|
14
|
+
export declare function wrapResolverMap(resolvers: object, sandboxFetch: typeof fetch): object;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Allowlist-gated `fetch` for the local `serve` dev server — the same merchant
|
|
2
|
+
// `allow` list production enforces, plus loopback hosts (localhost/127.0.0.0/8/::1)
|
|
3
|
+
// which are always permitted locally so an extension can reach a service on the
|
|
4
|
+
// dev machine while you iterate (see isLocalhost). Resolvers run through
|
|
5
|
+
// {@link wrapResolverMap} so only extension code sees this wrapper; the gateway
|
|
6
|
+
// and integration-layer client keep the real Node `fetch`.
|
|
7
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
8
|
+
/** Does `hostname` match any allowlist pattern? */
|
|
9
|
+
function hostAllowed(hostname, allowlist) {
|
|
10
|
+
const host = hostname.toLowerCase();
|
|
11
|
+
return allowlist.some((pattern) => {
|
|
12
|
+
if (pattern.startsWith("*.")) {
|
|
13
|
+
const suffix = pattern.slice(2);
|
|
14
|
+
return host === suffix || host.endsWith(`.${suffix}`);
|
|
15
|
+
}
|
|
16
|
+
return host === pattern;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Loopback hosts served by the developer's own machine. `serve` always permits
|
|
21
|
+
* these regardless of the merchant allow list, so an extension can reach a service
|
|
22
|
+
* running locally (a mock, a companion API) while you iterate. This is a
|
|
23
|
+
* LOCAL-DEV-ONLY affordance: the deployed sandbox enforces only the real allow
|
|
24
|
+
* list, and localhost is never on it — so nothing here loosens production.
|
|
25
|
+
* Covers `localhost` (and any `*.localhost` subdomain), the IPv4 loopback range
|
|
26
|
+
* `127.0.0.0/8`, and IPv6 `::1` (brackets stripped as the WHATWG URL keeps them).
|
|
27
|
+
*/
|
|
28
|
+
function isLocalhost(hostname) {
|
|
29
|
+
const host = hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
30
|
+
if (host === "localhost" || host.endsWith(".localhost"))
|
|
31
|
+
return true;
|
|
32
|
+
if (host === "::1")
|
|
33
|
+
return true;
|
|
34
|
+
return /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(host);
|
|
35
|
+
}
|
|
36
|
+
function requestUrl(input) {
|
|
37
|
+
if (typeof input === "string")
|
|
38
|
+
return input;
|
|
39
|
+
if (input instanceof URL)
|
|
40
|
+
return input.href;
|
|
41
|
+
const url = input.url;
|
|
42
|
+
return typeof url === "string" ? url : String(input);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Build the allowlist-gated `fetch` the production sandbox endows. Throws a `TypeError`
|
|
46
|
+
* — like `fetch` on failure — when the destination is not on the allow list.
|
|
47
|
+
*/
|
|
48
|
+
export function createSandboxFetch(allowlistProvider) {
|
|
49
|
+
const realFetch = globalThis.fetch.bind(globalThis);
|
|
50
|
+
const sandboxFetch = async (input, init) => {
|
|
51
|
+
let parsed;
|
|
52
|
+
try {
|
|
53
|
+
parsed = new URL(requestUrl(input));
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
throw new TypeError(`fetch: invalid URL "${requestUrl(input)}"`);
|
|
57
|
+
}
|
|
58
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
|
|
59
|
+
throw new TypeError(`fetch: unsupported protocol "${parsed.protocol}"`);
|
|
60
|
+
}
|
|
61
|
+
const host = parsed.hostname;
|
|
62
|
+
// Loopback is always reachable locally (see isLocalhost); everything else must
|
|
63
|
+
// be on the merchant allow list, exactly as production enforces.
|
|
64
|
+
if (!isLocalhost(host) && !hostAllowed(host, allowlistProvider())) {
|
|
65
|
+
throw new TypeError(`fetch: host "${host}" is not in the extension HTTP allowlist`);
|
|
66
|
+
}
|
|
67
|
+
return realFetch(input, { ...init, redirect: "manual" });
|
|
68
|
+
};
|
|
69
|
+
return sandboxFetch;
|
|
70
|
+
}
|
|
71
|
+
const sandboxFetchStorage = new AsyncLocalStorage();
|
|
72
|
+
/**
|
|
73
|
+
* Route `globalThis.fetch` through the sandbox wrapper when a resolver runs inside
|
|
74
|
+
* {@link wrapResolverMap}. Returns a restore function for shutdown.
|
|
75
|
+
*/
|
|
76
|
+
export function installDelegatingFetch() {
|
|
77
|
+
const realFetch = globalThis.fetch.bind(globalThis);
|
|
78
|
+
globalThis.fetch = ((input, init) => {
|
|
79
|
+
const fn = sandboxFetchStorage.getStore() ?? realFetch;
|
|
80
|
+
return fn(input, init);
|
|
81
|
+
});
|
|
82
|
+
return () => {
|
|
83
|
+
globalThis.fetch = realFetch;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** Wrap every resolver so its `fetch` calls use the allowlist-gated wrapper. */
|
|
87
|
+
export function wrapResolverMap(resolvers, sandboxFetch) {
|
|
88
|
+
const wrap = (value) => {
|
|
89
|
+
if (typeof value === "function") {
|
|
90
|
+
const fn = value;
|
|
91
|
+
return (...args) => sandboxFetchStorage.run(sandboxFetch, () => fn(...args));
|
|
92
|
+
}
|
|
93
|
+
if (value !== null && typeof value === "object") {
|
|
94
|
+
return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, wrap(v)]));
|
|
95
|
+
}
|
|
96
|
+
return value;
|
|
97
|
+
};
|
|
98
|
+
return wrap(resolvers);
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=sandboxFetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandboxFetch.js","sourceRoot":"","sources":["../../../src/lib/tooling/sandboxFetch.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,oFAAoF;AACpF,gFAAgF;AAChF,yEAAyE;AACzE,gFAAgF;AAChF,2DAA2D;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAKrD,mDAAmD;AACnD,SAAS,WAAW,CAAC,QAAgB,EAAE,SAA4B;IACjE,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IACpC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;QAChC,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAChC,OAAO,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC;QACxD,CAAC;QACD,OAAO,IAAI,KAAK,OAAO,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,WAAW,CAAC,QAAgB;IACnC,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAC5D,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,CAA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ChD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/E,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IACF,OAAO,IAAI,CAAC,SAAS,CAAW,CAAC;AACnC,CAAC"}
|
|
@@ -9,7 +9,7 @@ export type SessionGrant = {
|
|
|
9
9
|
/**
|
|
10
10
|
* An explicit presentment selection, as a storefront's locale/currency switcher
|
|
11
11
|
* would send it. Every field is optional and independently defaulted by the
|
|
12
|
-
*
|
|
12
|
+
* Commerce Integration Layer from the project config, so `{ currency: "EUR" }` alone is
|
|
13
13
|
* valid — it changes the currency and leaves locale and country at the project's.
|
|
14
14
|
*/
|
|
15
15
|
export interface Presentment {
|
|
@@ -33,7 +33,7 @@ export async function mintSession(authUrl, projectKey, grant, presentment = {})
|
|
|
33
33
|
? { grant_type: "anonymous" }
|
|
34
34
|
: { grant_type: "password", email: grant.email, password: grant.password };
|
|
35
35
|
// Currency and country are upper-cased to the canonical form the session will
|
|
36
|
-
// hold (the
|
|
36
|
+
// hold (the Commerce Integration Layer upper-cases them too, so `--currency eur` already
|
|
37
37
|
// worked) — done here so the banner reports the value the session actually got
|
|
38
38
|
// rather than echoing back what was typed. Locale keeps its case: `de-DE` is not
|
|
39
39
|
// `DE-DE`.
|
|
@@ -57,7 +57,7 @@ export async function mintSession(authUrl, projectKey, grant, presentment = {})
|
|
|
57
57
|
});
|
|
58
58
|
const text = await res.text();
|
|
59
59
|
if (!res.ok) {
|
|
60
|
-
// Surface the
|
|
60
|
+
// Surface the Commerce Integration Layer's own error (an OAuth-shaped
|
|
61
61
|
// `{ error, error_description }`) rather than a bare status — a bad password
|
|
62
62
|
// and an unreachable edge should not read the same.
|
|
63
63
|
let detail = text;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/lib/tooling/session.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,+EAA+E;AAC/E,mFAAmF;AACnF,2DAA2D;AAC3D,EAAE;AACF,oFAAoF;AACpF,mFAAmF;AACnF,wEAAwE;AACxE,mFAAmF;AACnF,mFAAmF;AACnF,+BAA+B;AAC/B,EAAE;AACF,kFAAkF;AAClF,oFAAoF;AACpF,mFAAmF;AACnF,gFAAgF;AAChF,kFAAkF;AAClF,6EAA6E;AAC7E,6DAA6D;AA4B7D;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAe,EACf,UAAkB,EAClB,KAAmB,EACnB,cAA2B,EAAE;IAE7B,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzC,MAAM,GAAG,GAAG,GAAG,IAAI,IAAI,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC;IAChE,MAAM,QAAQ,GACZ,KAAK,CAAC,IAAI,KAAK,WAAW;QACxB,CAAC,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE;QAC7B,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC/E,8EAA8E;IAC9E,
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/lib/tooling/session.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,+EAA+E;AAC/E,mFAAmF;AACnF,2DAA2D;AAC3D,EAAE;AACF,oFAAoF;AACpF,mFAAmF;AACnF,wEAAwE;AACxE,mFAAmF;AACnF,mFAAmF;AACnF,+BAA+B;AAC/B,EAAE;AACF,kFAAkF;AAClF,oFAAoF;AACpF,mFAAmF;AACnF,gFAA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AC,CAAC,YAAY,KAAK,CAAC,KAAK,EAAE;QAC9E,WAAW,EAAE,mBAAmB,CAAC,MAAM,CAAC;KACzC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,CAAc;IACzC,MAAM,KAAK,GAAG;QACZ,CAAC,CAAC,MAAM,IAAI,gBAAgB;QAC5B,CAAC,CAAC,QAAQ,IAAI,kBAAkB;QAChC,CAAC,CAAC,OAAO,IAAI,iBAAiB;KAC/B,CAAC;IACF,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,OAAO;QAAE,OAAO,kBAAkB,CAAC;IACtE,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -20,6 +20,17 @@ export class BundleValidationError extends Error {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
const API_EXTENSION_ACTIONS = new Set(['Create', 'Update']);
|
|
23
|
+
/**
|
|
24
|
+
* Does the bundle carry a capability the runtime dispatches directly, rather than
|
|
25
|
+
* through the schema or an API Extension? Such a capability adds nothing to the SDL, so
|
|
26
|
+
* a bundle whose only contribution is one of them is COMPLETE without `typeDefs` — it
|
|
27
|
+
* must not be rejected for having no subgraph. `buildCombinedBundle` already carries
|
|
28
|
+
* these through when it merges bundles; this is the matching check on the way in.
|
|
29
|
+
*/
|
|
30
|
+
function hasDispatchOnlyCapability(mod) {
|
|
31
|
+
const { hooks } = mod;
|
|
32
|
+
return typeof hooks === 'object' && hooks !== null && Object.keys(hooks).length > 0;
|
|
33
|
+
}
|
|
23
34
|
/**
|
|
24
35
|
* Validate the bundle's optional `apiExtensions` export (shape only — a handler's
|
|
25
36
|
* behaviour is the author's to test). Returns the declared keys.
|
|
@@ -83,13 +94,15 @@ export async function validateBundle(bundlePath, sourceFiles) {
|
|
|
83
94
|
}
|
|
84
95
|
const { typeDefs, resolvers } = mod;
|
|
85
96
|
const apiExtensionKeys = validateApiExtensions(mod.apiExtensions);
|
|
86
|
-
// A bundle must contribute
|
|
97
|
+
// A bundle must contribute SOMETHING: a GraphQL subgraph, API Extensions, or a
|
|
98
|
+
// capability the runtime dispatches directly (hasDispatchOnlyCapability).
|
|
87
99
|
const hasTypeDefs = typeof typeDefs === "string" && typeDefs.trim() !== "";
|
|
88
100
|
if (!hasTypeDefs) {
|
|
89
|
-
if (apiExtensionKeys.length === 0) {
|
|
101
|
+
if (apiExtensionKeys.length === 0 && !hasDispatchOnlyCapability(mod)) {
|
|
90
102
|
throw new BundleValidationError("bundle must export a non-empty `typeDefs` string and/or an `apiExtensions` array");
|
|
91
103
|
}
|
|
92
|
-
//
|
|
104
|
+
// Nothing here contributes to the schema: no SDL to check, and nothing to compose
|
|
105
|
+
// remotely. The bundle is still uploaded as-is.
|
|
93
106
|
return { typeDefs: null, resolverTypes: [], apiExtensionKeys };
|
|
94
107
|
}
|
|
95
108
|
if (resolvers === null || typeof resolvers !== "object") {
|