@commercetools/cli-topic-integration-layer 0.4.0 → 0.5.1
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 +53 -35
- package/dist/commands/integration-layer/allowlist/add.d.ts +10 -0
- package/dist/commands/integration-layer/allowlist/add.js +41 -0
- package/dist/commands/integration-layer/allowlist/add.js.map +1 -0
- package/dist/commands/integration-layer/allowlist/list.d.ts +6 -0
- package/dist/commands/integration-layer/allowlist/list.js +28 -0
- package/dist/commands/integration-layer/allowlist/list.js.map +1 -0
- package/dist/commands/integration-layer/allowlist/remove.d.ts +13 -0
- package/dist/commands/integration-layer/allowlist/remove.js +56 -0
- package/dist/commands/integration-layer/allowlist/remove.js.map +1 -0
- package/dist/commands/integration-layer/allowlist/set.d.ts +13 -0
- package/dist/commands/integration-layer/allowlist/set.js +52 -0
- package/dist/commands/integration-layer/allowlist/set.js.map +1 -0
- 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 +5 -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 +4 -4
- package/dist/commands/integration-layer/extension/serve.js +31 -31
- 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 +32 -41
- package/dist/commands/integration-layer/init.js.map +1 -1
- package/dist/lib/allowlistPrompt.d.ts +16 -0
- package/dist/lib/allowlistPrompt.js +31 -0
- package/dist/lib/allowlistPrompt.js.map +1 -0
- package/dist/lib/awaitBundleState.js +3 -3
- package/dist/lib/awaitBundleState.js.map +1 -1
- package/dist/lib/base.d.ts +13 -13
- package/dist/lib/base.js +17 -17
- package/dist/lib/base.js.map +1 -1
- package/dist/lib/ilClient.d.ts +35 -8
- package/dist/lib/ilClient.js +35 -4
- 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/apiExtension.js +1 -2
- package/dist/lib/tooling/apiExtension.js.map +1 -1
- package/dist/lib/tooling/build.js +3 -6
- package/dist/lib/tooling/build.js.map +1 -1
- package/dist/lib/tooling/compose.d.ts +2 -2
- package/dist/lib/tooling/compose.js +7 -9
- 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/explorerServer.d.ts +6 -0
- package/dist/lib/tooling/explorerServer.js +4 -0
- package/dist/lib/tooling/explorerServer.js.map +1 -1
- package/dist/lib/tooling/gateway.d.ts +1 -1
- package/dist/lib/tooling/gateway.js +5 -6
- package/dist/lib/tooling/gateway.js.map +1 -1
- package/dist/lib/tooling/loadBundle.js +1 -2
- package/dist/lib/tooling/loadBundle.js.map +1 -1
- package/dist/lib/tooling/session.d.ts +2 -2
- package/dist/lib/tooling/session.js +3 -3
- package/dist/lib/tooling/session.js.map +1 -1
- package/dist/lib/tooling/staticAnalysis.js +5 -8
- package/dist/lib/tooling/staticAnalysis.js.map +1 -1
- package/dist/lib/tooling/validateBundle.js +17 -5
- package/dist/lib/tooling/validateBundle.js.map +1 -1
- package/package.json +1 -1
- package/dist/commands/integration-layer/hello.d.ts +0 -6
- package/dist/commands/integration-layer/hello.js +0 -10
- package/dist/commands/integration-layer/hello.js.map +0 -1
package/dist/lib/base.d.ts
CHANGED
|
@@ -21,37 +21,37 @@ export interface IlFlagValues {
|
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Derive the integration-layer EXTENSIONS edge base URL from the authenticated
|
|
24
|
-
* principal's commercetools region. The extensions edge
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* principal's commercetools region. The extensions edge serves the CLI's
|
|
25
|
+
* `/<project>/subgraph` + `/<project>/extension/*` routes and follows the same host
|
|
26
|
+
* convention as the commercetools API itself
|
|
27
27
|
* (`<svc>.<region>.commercetools.com`, cf. the auth client's
|
|
28
28
|
* `auth.<region>.commercetools.com`), so a login in region `eu-central-1.aws`
|
|
29
29
|
* resolves to `https://extensions.integration-layer.eu-central-1.aws.commercetools.com`
|
|
30
30
|
* (the production host). `--integration-layer-url` / `INTEGRATION_LAYER_URL` stays
|
|
31
|
-
* the explicit override — e.g. to point at a local edge or a
|
|
32
|
-
*
|
|
31
|
+
* the explicit override — e.g. to point at a local edge, or at a non-production zone
|
|
32
|
+
* that doesn't follow the convention. Returns undefined
|
|
33
33
|
* only when the region is absent, so resolveIlContext then fails loudly.
|
|
34
34
|
*/
|
|
35
35
|
export declare function edgeUrlForRegion(region: string): string | undefined;
|
|
36
36
|
/**
|
|
37
37
|
* The GRAPHQL edge (the integration-router) for a region — where operations are
|
|
38
38
|
* actually served, at `/{project}/graphql`. A distinct host from the extensions
|
|
39
|
-
* edge above: the extensions edge
|
|
40
|
-
*
|
|
41
|
-
* for
|
|
39
|
+
* edge above: the extensions edge serves the manage_project routes, the graphql edge
|
|
40
|
+
* is the router. `--graphql-url` / `IL_GRAPHQL_URL` overrides it
|
|
41
|
+
* for non-production zones, which don't follow the convention.
|
|
42
42
|
*/
|
|
43
43
|
export declare function graphqlEdgeUrlForRegion(region: string): string | undefined;
|
|
44
44
|
/**
|
|
45
|
-
* The IDENTITY edge
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
45
|
+
* The IDENTITY edge for a region — where sessions are minted, at
|
|
46
|
+
* `POST /{project}/session`. Again a distinct host from both of the above: shopper
|
|
47
|
+
* identity, shopper GraphQL, and the machine surface are served on separate
|
|
48
|
+
* ingresses. `--auth-url` / `IL_AUTH_URL` overrides it.
|
|
49
49
|
*/
|
|
50
50
|
export declare function authEdgeUrlForRegion(region: string): string | undefined;
|
|
51
51
|
export declare abstract class IntegrationLayerCommand extends AuthCommand {
|
|
52
52
|
/**
|
|
53
53
|
* Whether the command needs a logged-in principal. True for every command that
|
|
54
|
-
* calls the
|
|
54
|
+
* calls the Commerce Integration Layer; a command that only conditionally reaches it (e.g.
|
|
55
55
|
* `serve` in standalone mode) sets this false and relies on {@link resolveIlContext}
|
|
56
56
|
* to fail loudly if the network path is actually taken.
|
|
57
57
|
*/
|
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.
|
|
@@ -59,15 +59,15 @@ export async function loadPersistedPrincipal(credentialsFile = CREDENTIALS_FILE)
|
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Derive the integration-layer EXTENSIONS edge base URL from the authenticated
|
|
62
|
-
* principal's commercetools region. The extensions edge
|
|
63
|
-
*
|
|
64
|
-
*
|
|
62
|
+
* principal's commercetools region. The extensions edge serves the CLI's
|
|
63
|
+
* `/<project>/subgraph` + `/<project>/extension/*` routes and follows the same host
|
|
64
|
+
* convention as the commercetools API itself
|
|
65
65
|
* (`<svc>.<region>.commercetools.com`, cf. the auth client's
|
|
66
66
|
* `auth.<region>.commercetools.com`), so a login in region `eu-central-1.aws`
|
|
67
67
|
* resolves to `https://extensions.integration-layer.eu-central-1.aws.commercetools.com`
|
|
68
68
|
* (the production host). `--integration-layer-url` / `INTEGRATION_LAYER_URL` stays
|
|
69
|
-
* the explicit override — e.g. to point at a local edge or a
|
|
70
|
-
*
|
|
69
|
+
* the explicit override — e.g. to point at a local edge, or at a non-production zone
|
|
70
|
+
* that doesn't follow the convention. Returns undefined
|
|
71
71
|
* only when the region is absent, so resolveIlContext then fails loudly.
|
|
72
72
|
*/
|
|
73
73
|
export function edgeUrlForRegion(region) {
|
|
@@ -79,9 +79,9 @@ export function edgeUrlForRegion(region) {
|
|
|
79
79
|
/**
|
|
80
80
|
* The GRAPHQL edge (the integration-router) for a region — where operations are
|
|
81
81
|
* actually served, at `/{project}/graphql`. A distinct host from the extensions
|
|
82
|
-
* edge above: the extensions edge
|
|
83
|
-
*
|
|
84
|
-
* for
|
|
82
|
+
* edge above: the extensions edge serves the manage_project routes, the graphql edge
|
|
83
|
+
* is the router. `--graphql-url` / `IL_GRAPHQL_URL` overrides it
|
|
84
|
+
* for non-production zones, which don't follow the convention.
|
|
85
85
|
*/
|
|
86
86
|
export function graphqlEdgeUrlForRegion(region) {
|
|
87
87
|
const trimmed = region.trim();
|
|
@@ -90,10 +90,10 @@ export function graphqlEdgeUrlForRegion(region) {
|
|
|
90
90
|
return `https://graphql.integration-layer.${trimmed}.commercetools.com`;
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
|
-
* The IDENTITY edge
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
93
|
+
* The IDENTITY edge for a region — where sessions are minted, at
|
|
94
|
+
* `POST /{project}/session`. Again a distinct host from both of the above: shopper
|
|
95
|
+
* identity, shopper GraphQL, and the machine surface are served on separate
|
|
96
|
+
* ingresses. `--auth-url` / `IL_AUTH_URL` overrides it.
|
|
97
97
|
*/
|
|
98
98
|
export function authEdgeUrlForRegion(region) {
|
|
99
99
|
const trimmed = region.trim();
|
|
@@ -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,gF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AI,CAAC,UAAU;YAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,sBAAsB;QAClC,OAAO,sBAAsB,EAAE,CAAC;IAClC,CAAC;IAED,kGAAkG;IACxF,gBAAgB;QACxB,IAAI,IAAI,CAAC,kBAAkB;YAAE,OAAO,IAAI,CAAC,kBAAkB,CAAC;QAC5D,MAAM,IAAI,kBAAkB,CAAC,sDAAsD,CAAC,CAAC;IACvF,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,gBAAgB,CAAC,KAAmB;QAClD,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC1C,MAAM,KAAK,GAAG,SAAS,CAAC,cAAc,EAAE,CAAC,aAAa,EAAE,CAAC;QAEzD,MAAM,UAAU,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>;
|
|
@@ -95,6 +95,33 @@ export declare function pushBundle(baseUrl: string, projectKey: string, token: s
|
|
|
95
95
|
export declare function fetchExtensionMeta(baseUrl: string, projectKey: string, token: string): Promise<ExtensionMeta | null>;
|
|
96
96
|
/** Remove the project's extension subgraph from Hive (`DELETE …/extension/subgraph`). */
|
|
97
97
|
export declare function deleteExtensionSubgraph(baseUrl: string, projectKey: string, token: string): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* The project's extension HTTP allowlist: the merchant-tunable `allow` host patterns
|
|
100
|
+
* the extension sandbox's `fetch` may reach, plus the operator `deny` ceiling. A host
|
|
101
|
+
* is permitted iff it matches `allow` AND not `deny`. Patterns are bare hosts —
|
|
102
|
+
* `api.foo.com` or leading-wildcard `*.foo.com` (no scheme, port, or path).
|
|
103
|
+
*
|
|
104
|
+
* `deny` is read-only over HTTP (the operator's veto, edited out-of-band); only
|
|
105
|
+
* `allow` is writable, and only by full replacement (see {@link putAllowlist}).
|
|
106
|
+
*/
|
|
107
|
+
export interface AllowlistView {
|
|
108
|
+
allow: string[];
|
|
109
|
+
deny: string[];
|
|
110
|
+
}
|
|
111
|
+
/** GET the project's extension HTTP allowlist (`GET …/extension/allowlist`). */
|
|
112
|
+
export declare function getAllowlist(baseUrl: string, projectKey: string, token: string): Promise<AllowlistView>;
|
|
113
|
+
/**
|
|
114
|
+
* Replace the merchant `allow` patterns with `patterns` (`PUT …/extension/allowlist`).
|
|
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 Commerce Integration Layer validates and normalizes
|
|
117
|
+
* (lowercases, de-dupes, rejects schemes/ports/paths/IPs/over-broad patterns) and
|
|
118
|
+
* returns the stored list plus the config's new monotonic version. The `deny` ceiling
|
|
119
|
+
* is untouched (it has no write route).
|
|
120
|
+
*/
|
|
121
|
+
export declare function putAllowlist(baseUrl: string, projectKey: string, token: string, patterns: string[]): Promise<{
|
|
122
|
+
allow: string[];
|
|
123
|
+
version: number;
|
|
124
|
+
}>;
|
|
98
125
|
/** List the project's extension config entries, secret values redacted (`GET …/extension/config`). */
|
|
99
126
|
export declare function listConfig(baseUrl: string, projectKey: string, token: string): Promise<ConfigEntry[]>;
|
|
100
127
|
/**
|
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) {
|
|
@@ -117,6 +117,37 @@ export async function deleteExtensionSubgraph(baseUrl, projectKey, token) {
|
|
|
117
117
|
throw new Error(`DELETE extension/subgraph failed (${res.status}): ${text}`);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
+
/** GET the project's extension HTTP allowlist (`GET …/extension/allowlist`). */
|
|
121
|
+
export async function getAllowlist(baseUrl, projectKey, token) {
|
|
122
|
+
const url = `${apiRoot(baseUrl, projectKey)}/extension/allowlist`;
|
|
123
|
+
const res = await fetch(url, { headers: { accept: "application/json", ...bearer(token) } });
|
|
124
|
+
const text = await res.text();
|
|
125
|
+
if (!res.ok) {
|
|
126
|
+
throw new Error(`GET extension/allowlist failed (${res.status}): ${text}`);
|
|
127
|
+
}
|
|
128
|
+
return JSON.parse(text);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Replace the merchant `allow` patterns with `patterns` (`PUT …/extension/allowlist`).
|
|
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 Commerce Integration Layer validates and normalizes
|
|
134
|
+
* (lowercases, de-dupes, rejects schemes/ports/paths/IPs/over-broad patterns) and
|
|
135
|
+
* returns the stored list plus the config's new monotonic version. The `deny` ceiling
|
|
136
|
+
* is untouched (it has no write route).
|
|
137
|
+
*/
|
|
138
|
+
export async function putAllowlist(baseUrl, projectKey, token, patterns) {
|
|
139
|
+
const url = `${apiRoot(baseUrl, projectKey)}/extension/allowlist`;
|
|
140
|
+
const res = await fetch(url, {
|
|
141
|
+
method: "PUT",
|
|
142
|
+
headers: { "Content-Type": "application/json", ...bearer(token) },
|
|
143
|
+
body: JSON.stringify(patterns),
|
|
144
|
+
});
|
|
145
|
+
const text = await res.text();
|
|
146
|
+
if (!res.ok) {
|
|
147
|
+
throw new Error(`PUT extension/allowlist failed (${res.status}): ${text}`);
|
|
148
|
+
}
|
|
149
|
+
return JSON.parse(text);
|
|
150
|
+
}
|
|
120
151
|
/** List the project's extension config entries, secret values redacted (`GET …/extension/config`). */
|
|
121
152
|
export async function listConfig(baseUrl, projectKey, token) {
|
|
122
153
|
const url = `${apiRoot(baseUrl, projectKey)}/extension/config`;
|
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,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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,C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AAG,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,7 +1,6 @@
|
|
|
1
1
|
// Authoring API for commercetools API Extensions.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
// (packages/tooling/src/apiExtension.ts). An API Extension is the commercetools
|
|
3
|
+
// An API Extension is the commercetools
|
|
5
4
|
// platform feature: a synchronous HTTP callback commercetools makes before
|
|
6
5
|
// persisting a cart/order/… create or update, which can approve, modify, or BLOCK
|
|
7
6
|
// the write. This is a DIFFERENT thing from a GraphQL schema extension (typeDefs +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiExtension.js","sourceRoot":"","sources":["../../../src/lib/tooling/apiExtension.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"apiExtension.js","sourceRoot":"","sources":["../../../src/lib/tooling/apiExtension.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,wCAAwC;AACxC,2EAA2E;AAC3E,kFAAkF;AAClF,mFAAmF;AACnF,mFAAmF;AACnF,mCAAmC;AACnC,EAAE;AACF,mFAAmF;AACnF,oFAAoF;AACpF,oFAAoF;AACpF,uCAAuC;AACvC,EAAE;AACF,mFAAmF;AACnF,oFAAoF;AACpF,oFAAoF;AACpF,6EAA6E;AAC7E,iFAAiF;AACjF,oFAAoF;AACpF,+DAA+D;AA+C/D,gGAAgG;AAChG,MAAM,UAAU,kBAAkB,CAAC,UAAkC;IACnE,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,mCAAmC;AACnC,MAAM,UAAU,OAAO;IACrB,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,KAAK,CAAC,IAAY,EAAE,OAAe;IACjD,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AACzC,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,MAAM,CAAC,OAAkB;IACvC,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
// Bundle an extension source into a single self-contained CommonJS artifact.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// argv/env-driven `buildCommand` wrapper is NOT copied (this plugin's oclif command
|
|
6
|
-
// is the wrapper). esbuild bundles local helper modules inline. The output is
|
|
3
|
+
// A low-level function; the oclif command is the wrapper around it.
|
|
4
|
+
// esbuild bundles local helper modules inline. The output is
|
|
7
5
|
// CommonJS so the runtime can evaluate it as a script and read `module.exports`.
|
|
8
6
|
// `platform: "neutral"` keeps Node built-ins out (an import of one fails the build,
|
|
9
7
|
// not at load time), and `conditions: ["worker"]` steers a bundled SDK to its
|
|
@@ -39,8 +37,7 @@ export async function buildBundle(entry = defaultEntry(), outfile = defaultOutfi
|
|
|
39
37
|
// a resolver — is otherwise unresolvable ("Could not resolve"). Preferring
|
|
40
38
|
// `module` (the fetch-based ESM build, no Node built-ins) then `main` fixes that;
|
|
41
39
|
// packages that DO declare `exports` (e.g. algoliasearch) resolve through it and
|
|
42
|
-
// ignore this.
|
|
43
|
-
// keep the two in sync when it's added there.)
|
|
40
|
+
// ignore this.
|
|
44
41
|
mainFields: ["module", "main"],
|
|
45
42
|
external: HOST_PROVIDED_EXTERNALS,
|
|
46
43
|
metafile: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/lib/tooling/build.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/lib/tooling/build.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,oEAAoE;AACpE,6DAA6D;AAC7D,iFAAiF;AACjF,oFAAoF;AACpF,8EAA8E;AAC9E,sFAAsF;AACtF,gFAAgF;AAChF,oDAAoD;AAEpD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,4EAA4E;AAC5E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,SAAS,CAAC,CAAC;AAEnD,qFAAqF;AACrF,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;AACpD,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,cAAc;IAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;AACrD,CAAC;AAaD,yEAAyE;AACzE,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,QAAgB,YAAY,EAAE,EAC9B,UAAkB,cAAc,EAAE;IAElC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC;QACzB,WAAW,EAAE,CAAC,KAAK,CAAC;QACpB,OAAO;QACP,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,SAAS;QACnB,MAAM,EAAE,QAAQ;QAChB,UAAU,EAAE,CAAC,QAAQ,CAAC;QACtB,gFAAgF;QAChF,kFAAkF;QAClF,kFAAkF;QAClF,2EAA2E;QAC3E,kFAAkF;QAClF,iFAAiF;QACjF,eAAe;QACf,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC9B,QAAQ,EAAE,uBAAuB;QACjC,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,QAAQ;KACnB,CAAC,CAAC;IACH,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;SACpD,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;SAClD,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;IACjD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AAClC,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,21 +1,19 @@
|
|
|
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
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// in `../ilClient.ts` parameterised by (baseUrl, projectKey, token), and the command
|
|
9
|
-
// layer supplies the token.
|
|
4
|
+
// `composeWithIntegrationLayer` below is the low-level half. Fetching the project's
|
|
5
|
+
// subgraph SDL is a plain authenticated HTTP call, so it lives separately in
|
|
6
|
+
// `../ilClient.ts`, parameterised by (baseUrl, projectKey, token) with the command
|
|
7
|
+
// layer supplying the token.
|
|
10
8
|
import { parse, printSchema } from "graphql";
|
|
11
9
|
import { composeServices } from "@apollo/composition";
|
|
12
|
-
/** The subgraph names the
|
|
10
|
+
/** The subgraph names the Commerce Integration Layer composes under — matched here so the
|
|
13
11
|
* local composition mirrors the deployed one. `integration-layer` is the name an
|
|
14
12
|
* extension's `@override(from: …)` references. */
|
|
15
13
|
export const INTEGRATION_LAYER_SERVICE = "integration-layer";
|
|
16
14
|
export const EXTENSION_SERVICE = "extensions";
|
|
17
15
|
/**
|
|
18
|
-
* Compose the
|
|
16
|
+
* Compose the Commerce Integration Layer + the extension into a supergraph and derive the
|
|
19
17
|
* client-facing API schema. Never throws — a composition failure comes back in
|
|
20
18
|
* `errors` so the dev server can surface it and keep serving. The URLs are baked into
|
|
21
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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,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,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,CAAC,IAAI,CAAC,EAAE,CAC5F,CAAC;IACJ,CAAC;IACD,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,SAAS;QACxB,GAAG,EAAE,MAAM,CAAC,MAAM;QAClB,QAAQ,EAAE,YAAY;YACpB,CAAC,CAAC,sDAAsD;YACxD,CAAC,CAAC,qEAAqE;KAC1E,CAAC;AACJ,CAAC"}
|
|
@@ -13,7 +13,7 @@ export const EXPLORER_HTML = String.raw `<!doctype html>
|
|
|
13
13
|
<head>
|
|
14
14
|
<meta charset="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.',
|
|
@@ -6,6 +6,8 @@ export interface GraphQLBody {
|
|
|
6
6
|
variables?: Record<string, unknown>;
|
|
7
7
|
operationName?: string;
|
|
8
8
|
}
|
|
9
|
+
/** Default Hive usage identity when the caller does not override it. */
|
|
10
|
+
export declare const DEFAULT_GRAPHQL_CLIENT_NAME = "commercetools-integration-layer-cli";
|
|
9
11
|
export interface ExplorerServerOptions {
|
|
10
12
|
/** The schema introspection is answered from (docs, autocomplete, validation). */
|
|
11
13
|
schema: GraphQLSchema;
|
|
@@ -13,6 +15,10 @@ export interface ExplorerServerOptions {
|
|
|
13
15
|
endpoint: string;
|
|
14
16
|
/** Session bearer attached to every proxied operation. Never sent to the browser. */
|
|
15
17
|
bearer: string;
|
|
18
|
+
/** Hive `graphql-client-name` on proxied operations (introspection stays local). */
|
|
19
|
+
clientName?: string;
|
|
20
|
+
/** Hive `graphql-client-version` on proxied operations. */
|
|
21
|
+
clientVersion?: string;
|
|
16
22
|
}
|
|
17
23
|
/**
|
|
18
24
|
* Build (but do not listen on) the explorer's server.
|
|
@@ -16,6 +16,8 @@ import { createServer } from "node:http";
|
|
|
16
16
|
import { execute, parse, validate } from "graphql";
|
|
17
17
|
import { EXPLORER_HTML } from "./explorerPage.js";
|
|
18
18
|
import { isIntrospectionRequest } from "./introspectionRequest.js";
|
|
19
|
+
/** Default Hive usage identity when the caller does not override it. */
|
|
20
|
+
export const DEFAULT_GRAPHQL_CLIENT_NAME = "commercetools-integration-layer-cli";
|
|
19
21
|
/**
|
|
20
22
|
* Build (but do not listen on) the explorer's server.
|
|
21
23
|
*
|
|
@@ -110,6 +112,8 @@ async function handle(req, res, opts) {
|
|
|
110
112
|
"content-type": "application/json",
|
|
111
113
|
accept: "application/json",
|
|
112
114
|
authorization: `Bearer ${opts.bearer}`,
|
|
115
|
+
"graphql-client-name": opts.clientName ?? DEFAULT_GRAPHQL_CLIENT_NAME,
|
|
116
|
+
"graphql-client-version": opts.clientVersion ?? "dev",
|
|
113
117
|
},
|
|
114
118
|
body: JSON.stringify(body),
|
|
115
119
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explorerServer.js","sourceRoot":"","sources":["../../../src/lib/tooling/explorerServer.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,EAAE;AACF,kFAAkF;AAClF,EAAE;AACF,sCAAsC;AACtC,oFAAoF;AACpF,kEAAkE;AAClE,iFAAiF;AACjF,EAAE;AACF,iFAAiF;AACjF,0CAA0C;AAC1C,EAAE;AACF,kFAAkF;AAClF,4CAA4C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AAG,EAAE;YACR,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,mBAAmB,IAAI,CAAC,QAAQ,KAAM,GAAa,CAAC,OAAO,EAAE,EAAE,CAAC;SACrF,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,GAAoB;IAC1C,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG;QAAE,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC;IAC5D,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -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
|
*/
|