@commercetools/cli-topic-integration-layer 0.2.1 → 0.3.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 +1 -0
- package/dist/commands/integration-layer/explore.d.ts +20 -0
- package/dist/commands/integration-layer/explore.js +209 -0
- package/dist/commands/integration-layer/explore.js.map +1 -0
- package/dist/commands/integration-layer/extension/build.d.ts +2 -0
- package/dist/commands/integration-layer/extension/build.js +24 -3
- package/dist/commands/integration-layer/extension/build.js.map +1 -1
- package/dist/commands/integration-layer/extension/invoke.d.ts +1 -0
- package/dist/commands/integration-layer/extension/invoke.js +9 -4
- package/dist/commands/integration-layer/extension/invoke.js.map +1 -1
- package/dist/commands/integration-layer/extension/push.d.ts +15 -0
- package/dist/commands/integration-layer/extension/push.js +137 -3
- package/dist/commands/integration-layer/extension/push.js.map +1 -1
- package/dist/commands/integration-layer/extension/serve.d.ts +30 -0
- package/dist/commands/integration-layer/extension/serve.js +244 -6
- package/dist/commands/integration-layer/extension/serve.js.map +1 -1
- package/dist/commands/integration-layer/extension/status.js +4 -0
- package/dist/commands/integration-layer/extension/status.js.map +1 -1
- package/dist/commands/integration-layer/extension/validate.d.ts +2 -0
- package/dist/commands/integration-layer/extension/validate.js +24 -2
- package/dist/commands/integration-layer/extension/validate.js.map +1 -1
- package/dist/commands/integration-layer/init.js +228 -77
- package/dist/commands/integration-layer/init.js.map +1 -1
- package/dist/lib/awaitBundleState.d.ts +33 -0
- package/dist/lib/awaitBundleState.js +77 -0
- package/dist/lib/awaitBundleState.js.map +1 -0
- package/dist/lib/base.d.ts +35 -0
- package/dist/lib/base.js +99 -13
- package/dist/lib/base.js.map +1 -1
- package/dist/lib/ilClient.d.ts +62 -2
- package/dist/lib/ilClient.js +42 -2
- package/dist/lib/ilClient.js.map +1 -1
- package/dist/lib/sourceRevision.d.ts +39 -0
- package/dist/lib/sourceRevision.js +95 -0
- package/dist/lib/sourceRevision.js.map +1 -0
- package/dist/lib/tooling/exploreSchema.d.ts +15 -0
- package/dist/lib/tooling/exploreSchema.js +77 -0
- package/dist/lib/tooling/exploreSchema.js.map +1 -0
- package/dist/lib/tooling/explorerPage.d.ts +1 -0
- package/dist/lib/tooling/explorerPage.js +96 -0
- package/dist/lib/tooling/explorerPage.js.map +1 -0
- package/dist/lib/tooling/explorerServer.d.ts +27 -0
- package/dist/lib/tooling/explorerServer.js +134 -0
- package/dist/lib/tooling/explorerServer.js.map +1 -0
- package/dist/lib/tooling/extensions.d.ts +77 -0
- package/dist/lib/tooling/extensions.js +209 -0
- package/dist/lib/tooling/extensions.js.map +1 -0
- package/dist/lib/tooling/introspectionRequest.d.ts +13 -0
- package/dist/lib/tooling/introspectionRequest.js +47 -0
- package/dist/lib/tooling/introspectionRequest.js.map +1 -0
- package/dist/lib/tooling/session.d.ts +36 -0
- package/dist/lib/tooling/session.js +99 -0
- package/dist/lib/tooling/session.js.map +1 -0
- package/package.json +10 -12
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@ commercetools integration-layer init <DIR> # scaffold an extension
|
|
|
24
24
|
commercetools integration-layer extension build # bundle src/extension.ts -> dist [local]
|
|
25
25
|
commercetools integration-layer extension validate # local checks + remote compose/breaking gate
|
|
26
26
|
commercetools integration-layer extension push [--force] # build + validate + upload the bundle
|
|
27
|
+
[--source-revision <rev> | --no-source-revision] # provenance; default: detected from git
|
|
27
28
|
commercetools integration-layer extension status # show the project's stored bundle
|
|
28
29
|
commercetools integration-layer extension delete [--yes] # remove the extension subgraph
|
|
29
30
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IntegrationLayerCommand } from "../../lib/base.js";
|
|
2
|
+
export default class Explore extends IntegrationLayerCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
port: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
deployed: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
as: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
locale: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
currency: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
country: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
"graphql-url": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
"auth-url": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
/** The schema GraphiQL renders — deployed composed graph, or a local composition. */
|
|
17
|
+
private resolveSchema;
|
|
18
|
+
/** Anonymous, or an ordinary customer login. Never an impersonation. */
|
|
19
|
+
private resolveGrant;
|
|
20
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// `integration-layer explore` — a local GraphQL explorer for your project.
|
|
2
|
+
//
|
|
3
|
+
// One command: it resolves the project's schema, mints a session from your existing
|
|
4
|
+
// login, serves GraphiQL on localhost, and proxies every operation to the deployed
|
|
5
|
+
// edge. No tokens to paste, no headers to hand-edit.
|
|
6
|
+
//
|
|
7
|
+
// It replaces two things that were removed: the Merchant Center console's operator
|
|
8
|
+
// GraphQL Explorer, and the router's `/{project}/graphiql` + `x-developer-mode`
|
|
9
|
+
// introspection gate. The edge now runs `introspection: false`, so the schema is
|
|
10
|
+
// read over an authenticated API instead of being served at the public edge:
|
|
11
|
+
//
|
|
12
|
+
// schema GET <extensions edge>/<project>/schema/api (--deployed), or the
|
|
13
|
+
// core subgraph from /subgraph composed locally with your extension
|
|
14
|
+
// execution proxied to <graphql edge>/<project>/graphql under a session bearer
|
|
15
|
+
//
|
|
16
|
+
// AUTH — deliberately ordinary. Operations run as an anonymous shopper, or as a real
|
|
17
|
+
// customer who logs in with their own email and password (`--as`). There is no
|
|
18
|
+
// impersonation flag and no privileged debug identity: the old console's `x-il-act-as`
|
|
19
|
+
// bar ran under the project's service-account credentials, and that is precisely what
|
|
20
|
+
// is not reimplemented here. To see what a customer sees, log in as them.
|
|
21
|
+
//
|
|
22
|
+
// PRESENTMENT — prices are selected from the session's locale/currency/country, which
|
|
23
|
+
// the integration layer resolves ONCE at mint (it has no per-request override, by
|
|
24
|
+
// design). So `--locale/--currency/--country` are mint-time flags: to explore a
|
|
25
|
+
// different market, restart the explorer. Send none and you get the project's
|
|
26
|
+
// configured defaults, like a storefront with no locale switcher.
|
|
27
|
+
import { access, readFile } from "node:fs/promises";
|
|
28
|
+
import { createInterface } from "node:readline/promises";
|
|
29
|
+
import { Flags } from "@oclif/core";
|
|
30
|
+
import { IntegrationLayerCommand, graphqlEdgeUrlForRegion, authEdgeUrlForRegion } from "../../lib/base.js";
|
|
31
|
+
import { fetchSubgraphSdl, fetchDeployedApiSchemaSdl } from "../../lib/ilClient.js";
|
|
32
|
+
import { buildBundle, defaultEntry, defaultOutfile } from "../../lib/tooling/build.js";
|
|
33
|
+
import { loadBundleSource } from "../../lib/tooling/loadBundle.js";
|
|
34
|
+
import { buildSchema } from "graphql";
|
|
35
|
+
import { composeLocalExplorerSchema, } from "../../lib/tooling/exploreSchema.js";
|
|
36
|
+
import { mintSession } from "../../lib/tooling/session.js";
|
|
37
|
+
import { createExplorerServer } from "../../lib/tooling/explorerServer.js";
|
|
38
|
+
export default class Explore extends IntegrationLayerCommand {
|
|
39
|
+
static description = "Run a local GraphQL explorer in your browser, against your project's deployed edge";
|
|
40
|
+
static examples = [
|
|
41
|
+
"<%= config.bin %> integration-layer explore",
|
|
42
|
+
"<%= config.bin %> integration-layer explore --deployed",
|
|
43
|
+
"<%= config.bin %> integration-layer explore --as alice@example.com",
|
|
44
|
+
"<%= config.bin %> integration-layer explore --currency EUR --country DE --locale de-DE",
|
|
45
|
+
"<%= config.bin %> integration-layer explore --deployed --port 5000",
|
|
46
|
+
];
|
|
47
|
+
static flags = {
|
|
48
|
+
port: Flags.integer({
|
|
49
|
+
char: "p",
|
|
50
|
+
description: "port to serve the explorer on",
|
|
51
|
+
default: 4000,
|
|
52
|
+
}),
|
|
53
|
+
deployed: Flags.boolean({
|
|
54
|
+
description: "render the project's DEPLOYED composed schema (read from Hive) instead of composing the core subgraph with your local extension",
|
|
55
|
+
default: false,
|
|
56
|
+
}),
|
|
57
|
+
as: Flags.string({
|
|
58
|
+
description: "run operations as this customer (an ordinary email/password login; prompts for the password unless IL_CUSTOMER_PASSWORD is set). Omit to run anonymously.",
|
|
59
|
+
}),
|
|
60
|
+
// Presentment. Applied at mint, because that is the only place the integration
|
|
61
|
+
// layer lets it be chosen; omitted flags fall back to the project's config.
|
|
62
|
+
locale: Flags.string({
|
|
63
|
+
description: "locale to run operations in, e.g. de-DE (default: the project's)",
|
|
64
|
+
helpGroup: "PRESENTMENT",
|
|
65
|
+
}),
|
|
66
|
+
currency: Flags.string({
|
|
67
|
+
description: "currency prices are shown in, e.g. EUR (default: the project's)",
|
|
68
|
+
helpGroup: "PRESENTMENT",
|
|
69
|
+
}),
|
|
70
|
+
country: Flags.string({
|
|
71
|
+
description: "country prices are selected for, e.g. DE (default: the project's)",
|
|
72
|
+
helpGroup: "PRESENTMENT",
|
|
73
|
+
}),
|
|
74
|
+
"graphql-url": Flags.string({
|
|
75
|
+
description: "GraphQL edge base URL — the router (also settable via IL_GRAPHQL_URL); overrides the URL derived from your login region",
|
|
76
|
+
env: "IL_GRAPHQL_URL",
|
|
77
|
+
helpGroup: "INTEGRATION LAYER",
|
|
78
|
+
}),
|
|
79
|
+
"auth-url": Flags.string({
|
|
80
|
+
description: "identity edge base URL, where sessions are minted (also settable via IL_AUTH_URL); overrides the URL derived from your login region",
|
|
81
|
+
env: "IL_AUTH_URL",
|
|
82
|
+
helpGroup: "INTEGRATION LAYER",
|
|
83
|
+
}),
|
|
84
|
+
};
|
|
85
|
+
async run() {
|
|
86
|
+
const { flags } = await this.parse(Explore);
|
|
87
|
+
const { baseUrl, projectKey, token } = await this.resolveIlContext(flags);
|
|
88
|
+
const principal = this.requirePrincipal();
|
|
89
|
+
// The three edges are distinct hosts in the deployed topology (extensions./
|
|
90
|
+
// graphql./auth.), so each is resolved from the login region and independently
|
|
91
|
+
// overridable. Fail loudly rather than guess.
|
|
92
|
+
const graphqlUrl = flags["graphql-url"] ?? graphqlEdgeUrlForRegion(principal.getRegion());
|
|
93
|
+
if (!graphqlUrl) {
|
|
94
|
+
throw new Error("could not resolve the GraphQL edge URL: pass --graphql-url or set IL_GRAPHQL_URL " +
|
|
95
|
+
"(e.g. https://graphql.integration-layer.eu-central-1.aws.commercetools.com)");
|
|
96
|
+
}
|
|
97
|
+
const authUrl = flags["auth-url"] ?? authEdgeUrlForRegion(principal.getRegion());
|
|
98
|
+
if (!authUrl) {
|
|
99
|
+
throw new Error("could not resolve the identity edge URL: pass --auth-url or set IL_AUTH_URL " +
|
|
100
|
+
"(e.g. https://auth.integration-layer.eu-central-1.aws.commercetools.com)");
|
|
101
|
+
}
|
|
102
|
+
const resolved = await this.resolveSchema(flags.deployed, baseUrl, projectKey, token);
|
|
103
|
+
const grant = await this.resolveGrant(flags.as);
|
|
104
|
+
const session = await mintSession(authUrl, projectKey, grant, {
|
|
105
|
+
locale: flags.locale,
|
|
106
|
+
currency: flags.currency,
|
|
107
|
+
country: flags.country,
|
|
108
|
+
});
|
|
109
|
+
const endpoint = `${graphqlUrl.replace(/\/+$/, "")}/${encodeURIComponent(projectKey)}/graphql`;
|
|
110
|
+
const server = createExplorerServer({
|
|
111
|
+
schema: resolved.schema,
|
|
112
|
+
endpoint,
|
|
113
|
+
bearer: session.token,
|
|
114
|
+
});
|
|
115
|
+
await new Promise((resolve, reject) => {
|
|
116
|
+
server.once("error", reject);
|
|
117
|
+
server.listen(flags.port, "127.0.0.1", resolve);
|
|
118
|
+
});
|
|
119
|
+
this.log([
|
|
120
|
+
"",
|
|
121
|
+
`🔎 GraphQL explorer for '${projectKey}'`,
|
|
122
|
+
` http://localhost:${flags.port}`,
|
|
123
|
+
"",
|
|
124
|
+
` schema ${resolved.describe}`,
|
|
125
|
+
` operations ${endpoint}`,
|
|
126
|
+
` running as ${session.describe}`,
|
|
127
|
+
` prices in ${session.presentment}`,
|
|
128
|
+
"",
|
|
129
|
+
" Ctrl-C to stop.",
|
|
130
|
+
"",
|
|
131
|
+
].join("\n"));
|
|
132
|
+
// Serve until interrupted.
|
|
133
|
+
await new Promise((resolve) => {
|
|
134
|
+
const stop = () => {
|
|
135
|
+
server.close(() => {
|
|
136
|
+
resolve();
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
process.once("SIGINT", stop);
|
|
140
|
+
process.once("SIGTERM", stop);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/** The schema GraphiQL renders — deployed composed graph, or a local composition. */
|
|
144
|
+
async resolveSchema(deployed, baseUrl, projectKey, token) {
|
|
145
|
+
if (deployed) {
|
|
146
|
+
this.log(`Fetching the deployed composed schema for '${projectKey}' …`);
|
|
147
|
+
// Already a public API schema — the integration layer reduces it before
|
|
148
|
+
// sending, so there is no supergraph to unpick here. (The LOCAL path below
|
|
149
|
+
// still composes, which is why this command keeps a composition dependency.)
|
|
150
|
+
const apiSdl = await fetchDeployedApiSchemaSdl(baseUrl, projectKey, token);
|
|
151
|
+
return {
|
|
152
|
+
schema: buildSchema(apiSdl),
|
|
153
|
+
sdl: apiSdl,
|
|
154
|
+
describe: "deployed composed graph (from Hive)",
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
this.log(`Fetching the core-subgraph SDL for '${projectKey}' …`);
|
|
158
|
+
const coreSdl = await fetchSubgraphSdl(baseUrl, projectKey, token);
|
|
159
|
+
// An extension in the working directory is composed in, so your own fields show
|
|
160
|
+
// up before you have pushed anything. No extension here → core only.
|
|
161
|
+
const entry = defaultEntry();
|
|
162
|
+
if (!(await exists(entry)))
|
|
163
|
+
return composeLocalExplorerSchema(coreSdl, undefined);
|
|
164
|
+
this.log("Building the extension in this directory …");
|
|
165
|
+
const { outfile } = await buildBundle(entry, defaultOutfile());
|
|
166
|
+
const mod = loadBundleSource(await readFile(outfile, "utf8"));
|
|
167
|
+
const { typeDefs } = mod;
|
|
168
|
+
if (typeof typeDefs !== "string" || typeDefs.trim() === "") {
|
|
169
|
+
// A bundle that exports only API-Extension handlers contributes no subgraph;
|
|
170
|
+
// that is a valid extension, so fall back to core rather than failing.
|
|
171
|
+
this.log("· no GraphQL subgraph in this bundle — showing the core schema only.");
|
|
172
|
+
return composeLocalExplorerSchema(coreSdl, undefined);
|
|
173
|
+
}
|
|
174
|
+
return composeLocalExplorerSchema(coreSdl, typeDefs);
|
|
175
|
+
}
|
|
176
|
+
/** Anonymous, or an ordinary customer login. Never an impersonation. */
|
|
177
|
+
async resolveGrant(email) {
|
|
178
|
+
if (!email)
|
|
179
|
+
return { kind: "anonymous" };
|
|
180
|
+
const fromEnv = process.env.IL_CUSTOMER_PASSWORD;
|
|
181
|
+
if (fromEnv)
|
|
182
|
+
return { kind: "password", email, password: fromEnv };
|
|
183
|
+
if (!process.stdin.isTTY) {
|
|
184
|
+
throw new Error(`--as ${email} needs that customer's password: set IL_CUSTOMER_PASSWORD ` +
|
|
185
|
+
"(there is no TTY here to prompt on)");
|
|
186
|
+
}
|
|
187
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
188
|
+
try {
|
|
189
|
+
const password = await rl.question(`Password for ${email}: `);
|
|
190
|
+
if (!password)
|
|
191
|
+
throw new Error("no password entered");
|
|
192
|
+
return { kind: "password", email, password };
|
|
193
|
+
}
|
|
194
|
+
finally {
|
|
195
|
+
rl.close();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/** Whether a path exists (the local extension entry point). */
|
|
200
|
+
async function exists(path) {
|
|
201
|
+
try {
|
|
202
|
+
await access(path);
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=explore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explore.js","sourceRoot":"","sources":["../../../src/commands/integration-layer/explore.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,EAAE;AACF,oFAAoF;AACpF,mFAAmF;AACnF,qDAAqD;AACrD,EAAE;AACF,mFAAmF;AACnF,gFAAgF;AAChF,iFAAiF;AACjF,6EAA6E;AAC7E,EAAE;AACF,kFAAkF;AAClF,kFAAkF;AAClF,mFAAmF;AACnF,EAAE;AACF,qFAAqF;AACrF,+EAA+E;AAC/E,uFAAuF;AACvF,sFAAsF;AACtF,0EAA0E;AAC1E,EAAE;AACF,sFAAsF;AACtF,kFAAkF;AAClF,gFAAgF;AAChF,8EAA8E;AAC9E,kEAAkE;AAElE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC3G,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EACL,0BAA0B,GAE3B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAqB,MAAM,8BAA8B,CAAC;AAC9E,OA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extends Command {
|
|
|
5
5
|
static flags: {
|
|
6
6
|
entry: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
7
|
out: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
all: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
"extensions-dir": import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
10
|
};
|
|
9
11
|
run(): Promise<void>;
|
|
10
12
|
}
|
|
@@ -1,19 +1,40 @@
|
|
|
1
1
|
import { Command, Flags } from "@oclif/core";
|
|
2
|
-
import {
|
|
2
|
+
import { defaultEntry, defaultOutfile } from "../../../lib/tooling/build.js";
|
|
3
|
+
import { bundleForFlags } from "../../../lib/tooling/extensions.js";
|
|
3
4
|
export default class ExtensionBuild extends Command {
|
|
4
5
|
static description = "Bundle src/extension.ts into a single self-contained CommonJS artifact";
|
|
5
6
|
static examples = [
|
|
6
7
|
"<%= config.bin %> integration-layer extension build",
|
|
7
8
|
"<%= config.bin %> integration-layer extension build --entry src/extension.ts --out dist/extension.js",
|
|
9
|
+
"<%= config.bin %> integration-layer extension build --all",
|
|
8
10
|
];
|
|
9
11
|
static flags = {
|
|
10
12
|
entry: Flags.string({ description: "extension entry source file", default: defaultEntry() }),
|
|
11
13
|
out: Flags.string({ description: "bundle output file", default: defaultOutfile() }),
|
|
14
|
+
all: Flags.boolean({
|
|
15
|
+
description: "merge every extension under ./extensions/* into ONE combined bundle (the single artifact a project deploys)",
|
|
16
|
+
default: false,
|
|
17
|
+
}),
|
|
18
|
+
"extensions-dir": Flags.string({
|
|
19
|
+
description: "directory holding the extension packages (used with --all)",
|
|
20
|
+
default: "extensions",
|
|
21
|
+
}),
|
|
12
22
|
};
|
|
13
23
|
async run() {
|
|
14
24
|
const { flags } = await this.parse(ExtensionBuild);
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
let built;
|
|
26
|
+
try {
|
|
27
|
+
built = await bundleForFlags({
|
|
28
|
+
all: flags.all,
|
|
29
|
+
extensionsDir: flags["extensions-dir"],
|
|
30
|
+
entry: flags.entry,
|
|
31
|
+
out: flags.out,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
this.error(err.message);
|
|
36
|
+
}
|
|
37
|
+
this.log(`✓ bundled ${built.describe} → ${built.outfile}`);
|
|
17
38
|
}
|
|
18
39
|
}
|
|
19
40
|
//# sourceMappingURL=build.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../src/commands/integration-layer/extension/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../src/commands/integration-layer/extension/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,OAAO;IACjD,MAAM,CAAU,WAAW,GACzB,wEAAwE,CAAC;IAE3E,MAAM,CAAU,QAAQ,GAAG;QACzB,qDAAqD;QACrD,sGAAsG;QACtG,2DAA2D;KAC5D,CAAC;IAEF,MAAM,CAAU,KAAK,GAAG;QACtB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,CAAC;QAC5F,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,CAAC;QACnF,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC;YACjB,WAAW,EACT,6GAA6G;YAC/G,OAAO,EAAE,KAAK;SACf,CAAC;QACF,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC;YAC7B,WAAW,EAAE,4DAA4D;YACzE,OAAO,EAAE,YAAY;SACtB,CAAC;KACH,CAAC;IAEF,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACnD,IAAI,KAAK,CAAC;QACV,IAAI,CAAC;YACH,KAAK,GAAG,MAAM,cAAc,CAAC;gBAC3B,GAAG,EAAE,KAAK,CAAC,GAAG;gBACd,aAAa,EAAE,KAAK,CAAC,gBAAgB,CAAC;gBACtC,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,GAAG,EAAE,KAAK,CAAC,GAAG;aACf,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,KAAK,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;QACrC,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,aAAa,KAAK,CAAC,QAAQ,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC"}
|
|
@@ -7,6 +7,7 @@ export default class ExtensionInvoke extends Command {
|
|
|
7
7
|
out: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
8
|
action: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
9
|
sku: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
quantity: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
config: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
};
|
|
12
13
|
run(): Promise<void>;
|
|
@@ -3,7 +3,7 @@ import { Command, Flags } from "@oclif/core";
|
|
|
3
3
|
import { buildBundle, defaultEntry, defaultOutfile } from "../../../lib/tooling/build.js";
|
|
4
4
|
import { loadBundleSource } from "../../../lib/tooling/loadBundle.js";
|
|
5
5
|
/** A sample commercetools cart callback payload. */
|
|
6
|
-
function sampleCartInput(action, sku) {
|
|
6
|
+
function sampleCartInput(action, sku, quantity) {
|
|
7
7
|
// A minimal sample callback for local testing. The real payload is the SDK's
|
|
8
8
|
// ExtensionInput (resource: a full Cart Reference); we send just the fields a
|
|
9
9
|
// cart handler reads, cast to the SDK type.
|
|
@@ -14,7 +14,7 @@ function sampleCartInput(action, sku) {
|
|
|
14
14
|
id: "sample-cart",
|
|
15
15
|
obj: {
|
|
16
16
|
id: "sample-cart",
|
|
17
|
-
lineItems: [{ id: "sample-line-item", quantity
|
|
17
|
+
lineItems: [{ id: "sample-line-item", quantity, variant: { sku } }],
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
};
|
|
@@ -35,6 +35,7 @@ export default class ExtensionInvoke extends Command {
|
|
|
35
35
|
static examples = [
|
|
36
36
|
"<%= config.bin %> integration-layer extension invoke",
|
|
37
37
|
"<%= config.bin %> integration-layer extension invoke --action Update --sku BLOCKED-SKU",
|
|
38
|
+
"<%= config.bin %> integration-layer extension invoke --quantity 25 --config MAX_LINE_QUANTITY=10",
|
|
38
39
|
"<%= config.bin %> integration-layer extension invoke --config MAX_QTY=5 --config REGION=eu",
|
|
39
40
|
];
|
|
40
41
|
static flags = {
|
|
@@ -49,6 +50,10 @@ export default class ExtensionInvoke extends Command {
|
|
|
49
50
|
description: "SKU on the sample cart's line item",
|
|
50
51
|
default: "BLOCKED-SKU",
|
|
51
52
|
}),
|
|
53
|
+
quantity: Flags.integer({
|
|
54
|
+
description: "quantity on the sample cart's line item",
|
|
55
|
+
default: 1,
|
|
56
|
+
}),
|
|
52
57
|
config: Flags.string({
|
|
53
58
|
description: "a ctx.config entry as KEY=VALUE (repeatable)",
|
|
54
59
|
multiple: true,
|
|
@@ -72,10 +77,10 @@ export default class ExtensionInvoke extends Command {
|
|
|
72
77
|
this.error("this bundle declares no `apiExtensions`.");
|
|
73
78
|
}
|
|
74
79
|
const action = flags.action;
|
|
75
|
-
const input = sampleCartInput(action, flags.sku);
|
|
80
|
+
const input = sampleCartInput(action, flags.sku, flags.quantity);
|
|
76
81
|
const ctx = { now: () => Date.now(), config };
|
|
77
82
|
this.log(`Invoking ${handlers.length} handler(s) with a ${input.action} on cart ` +
|
|
78
|
-
`(line item SKU '${flags.sku}')`);
|
|
83
|
+
`(line item SKU '${flags.sku}' x${flags.quantity})`);
|
|
79
84
|
for (const h of handlers) {
|
|
80
85
|
if (h.resourceTypeId !== input.resource.typeId || !h.actions.includes(action)) {
|
|
81
86
|
this.log(` · ${h.key}: skipped (does not trigger on cart/${action})`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke.js","sourceRoot":"","sources":["../../../../src/commands/integration-layer/extension/invoke.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAQtE,oDAAoD;AACpD,SAAS,eAAe,
|
|
1
|
+
{"version":3,"file":"invoke.js","sourceRoot":"","sources":["../../../../src/commands/integration-layer/extension/invoke.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC1F,O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ACvE,SAAS;YACX,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YAC3C,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACtD,CAAC;IACH,CAAC"}
|
|
@@ -5,8 +5,23 @@ export default class ExtensionPush extends IntegrationLayerCommand {
|
|
|
5
5
|
static flags: {
|
|
6
6
|
entry: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
7
|
out: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
all: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
"extensions-dir": import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
10
|
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
"source-revision": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
"no-source-revision": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
wait: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
"wait-timeout": import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Report how the pushed version fared and say whether the command should fail.
|
|
18
|
+
*
|
|
19
|
+
* Only a genuine `failed` verdict is an error. Not being ABLE to find out — an
|
|
20
|
+
* older integration layer, an extension that isn't deployed, a metadata read that
|
|
21
|
+
* errored — is reported honestly and left as a success, because the push itself
|
|
22
|
+
* did land and failing it would break workflows that never had this signal.
|
|
23
|
+
*/
|
|
24
|
+
private reportOutcome;
|
|
10
25
|
/** True when the remote result should abort the push. */
|
|
11
26
|
private reportRemote;
|
|
12
27
|
run(): Promise<void>;
|
|
@@ -1,25 +1,114 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { basename } from "node:path";
|
|
3
3
|
import { Flags } from "@oclif/core";
|
|
4
|
-
import {
|
|
4
|
+
import { defaultEntry, defaultOutfile } from "../../../lib/tooling/build.js";
|
|
5
|
+
import { bundleForFlags } from "../../../lib/tooling/extensions.js";
|
|
5
6
|
import { validateBundle, BundleValidationError } from "../../../lib/tooling/validateBundle.js";
|
|
6
7
|
import { pushBundle, remoteValidate } from "../../../lib/ilClient.js";
|
|
8
|
+
import { awaitBundleState } from "../../../lib/awaitBundleState.js";
|
|
9
|
+
import { resolveSourceRevision } from "../../../lib/sourceRevision.js";
|
|
7
10
|
import { IntegrationLayerCommand } from "../../../lib/base.js";
|
|
11
|
+
// How often to re-read the bundle's status while waiting. The extension re-reads its
|
|
12
|
+
// bundle on its own ~30s poll, so a tighter interval just adds requests without
|
|
13
|
+
// learning anything sooner; 5s keeps the command feeling responsive when the
|
|
14
|
+
// extension happens to be mid-poll already.
|
|
15
|
+
const POLL_INTERVAL_MS = 5000;
|
|
16
|
+
/**
|
|
17
|
+
* Name a build the way its author recognises it: the integration layer's version
|
|
18
|
+
* number AND the source revision it was built from. The number is an internal
|
|
19
|
+
* counter — the commit is the identity. Falls back to the bare version when the
|
|
20
|
+
* push recorded no revision.
|
|
21
|
+
*/
|
|
22
|
+
function describeBuild(version, sourceRevision) {
|
|
23
|
+
return sourceRevision
|
|
24
|
+
? `version ${version} (source revision ${sourceRevision})`
|
|
25
|
+
: `version ${version}`;
|
|
26
|
+
}
|
|
8
27
|
export default class ExtensionPush extends IntegrationLayerCommand {
|
|
9
28
|
static description = "Build + validate (local + remote) + upload the bundle, replacing the project's stored one";
|
|
10
29
|
static examples = [
|
|
11
30
|
"<%= config.bin %> integration-layer extension push",
|
|
12
31
|
"<%= config.bin %> integration-layer extension push --force",
|
|
32
|
+
"<%= config.bin %> integration-layer extension push --all",
|
|
33
|
+
"<%= config.bin %> integration-layer extension push --source-revision r48211",
|
|
34
|
+
"<%= config.bin %> integration-layer extension push --no-source-revision",
|
|
13
35
|
];
|
|
14
36
|
static flags = {
|
|
15
37
|
entry: Flags.string({ description: "extension entry source file", default: defaultEntry() }),
|
|
16
38
|
out: Flags.string({ description: "bundle output file", default: defaultOutfile() }),
|
|
39
|
+
all: Flags.boolean({
|
|
40
|
+
description: "merge every extension under ./extensions/* into ONE combined bundle and push that single artifact (the deployed shape)",
|
|
41
|
+
default: false,
|
|
42
|
+
}),
|
|
43
|
+
"extensions-dir": Flags.string({
|
|
44
|
+
description: "directory holding the extension packages (used with --all)",
|
|
45
|
+
default: "extensions",
|
|
46
|
+
}),
|
|
17
47
|
force: Flags.boolean({
|
|
18
48
|
char: "f",
|
|
19
49
|
description: "upload despite a failing REMOTE validation (the local check always hard-fails)",
|
|
20
50
|
default: false,
|
|
21
51
|
}),
|
|
52
|
+
// Provenance. The default is auto-detection from the working copy, so a plain
|
|
53
|
+
// `push` records where the build came from with no ceremony; the flag is for a
|
|
54
|
+
// non-git VCS, a CI build id, or anything else the integrator identifies revisions
|
|
55
|
+
// by (the integration layer stores an opaque string).
|
|
56
|
+
"source-revision": Flags.string({
|
|
57
|
+
description: "version-control revision this build came from (default: detected from the git working copy; also settable via EXTENSION_SOURCE_REVISION)",
|
|
58
|
+
env: "EXTENSION_SOURCE_REVISION",
|
|
59
|
+
exclusive: ["no-source-revision"],
|
|
60
|
+
}),
|
|
61
|
+
"no-source-revision": Flags.boolean({
|
|
62
|
+
description: "push without recording any source revision",
|
|
63
|
+
default: false,
|
|
64
|
+
}),
|
|
65
|
+
// A push only STORES the bundle; the extension loads it on its own poll and
|
|
66
|
+
// reports back. Waiting for that verdict is the default because a push that
|
|
67
|
+
// reports success while the bundle can't actually run is the thing worth
|
|
68
|
+
// catching — especially in CI, where this is the difference between a green
|
|
69
|
+
// pipeline and a green pipeline that shipped a broken extension.
|
|
70
|
+
wait: Flags.boolean({
|
|
71
|
+
description: "wait for the extension to load the pushed version and report back (use --no-wait to return as soon as it is stored)",
|
|
72
|
+
default: true,
|
|
73
|
+
allowNo: true,
|
|
74
|
+
}),
|
|
75
|
+
"wait-timeout": Flags.integer({
|
|
76
|
+
description: "seconds to wait for the pushed version to be confirmed before giving up (the push still stands)",
|
|
77
|
+
default: 180,
|
|
78
|
+
}),
|
|
22
79
|
};
|
|
80
|
+
/**
|
|
81
|
+
* Report how the pushed version fared and say whether the command should fail.
|
|
82
|
+
*
|
|
83
|
+
* Only a genuine `failed` verdict is an error. Not being ABLE to find out — an
|
|
84
|
+
* older integration layer, an extension that isn't deployed, a metadata read that
|
|
85
|
+
* errored — is reported honestly and left as a success, because the push itself
|
|
86
|
+
* did land and failing it would break workflows that never had this signal.
|
|
87
|
+
*/
|
|
88
|
+
reportOutcome(outcome, version) {
|
|
89
|
+
switch (outcome.kind) {
|
|
90
|
+
case "running":
|
|
91
|
+
this.log(`✓ ${describeBuild(version, outcome.meta.sourceRevision)} is running — the extension loaded it and published its schema`);
|
|
92
|
+
return false;
|
|
93
|
+
case "failed": {
|
|
94
|
+
this.logToStderr(`✗ ${describeBuild(version, outcome.meta.sourceRevision)} could not be loaded and is NOT in use.`);
|
|
95
|
+
if (outcome.meta.reason)
|
|
96
|
+
this.logToStderr(` reason: ${outcome.meta.reason}`);
|
|
97
|
+
const served = outcome.meta.served;
|
|
98
|
+
this.logToStderr(served == null
|
|
99
|
+
? " no stored version could be loaded, so this project currently has no extension running."
|
|
100
|
+
: ` ${describeBuild(served.version, served.sourceRevision)} is still in use; fix the bundle and push again.`);
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
case "superseded":
|
|
104
|
+
this.log(`⚠ another push replaced version ${version} with ${describeBuild(outcome.meta.version, outcome.meta.sourceRevision)} while waiting; not reporting on it`);
|
|
105
|
+
return false;
|
|
106
|
+
case "unknown":
|
|
107
|
+
this.log(`⚠ could not confirm version ${version}: ${outcome.reason}`);
|
|
108
|
+
this.log(" the bundle is stored; check the extension panel in the Merchant Center.");
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
23
112
|
/** True when the remote result should abort the push. */
|
|
24
113
|
reportRemote(result) {
|
|
25
114
|
if (!result.composes) {
|
|
@@ -45,7 +134,19 @@ export default class ExtensionPush extends IntegrationLayerCommand {
|
|
|
45
134
|
const { flags } = await this.parse(ExtensionPush);
|
|
46
135
|
// Bundle, then VALIDATE before we touch the store. Local check first — it always
|
|
47
136
|
// hard-fails, regardless of --force.
|
|
48
|
-
|
|
137
|
+
let outfile;
|
|
138
|
+
let sourceFiles;
|
|
139
|
+
try {
|
|
140
|
+
({ outfile, sourceFiles } = await bundleForFlags({
|
|
141
|
+
all: flags.all,
|
|
142
|
+
extensionsDir: flags["extensions-dir"],
|
|
143
|
+
entry: flags.entry,
|
|
144
|
+
out: flags.out,
|
|
145
|
+
}));
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
this.error(err.message);
|
|
149
|
+
}
|
|
49
150
|
let typeDefs;
|
|
50
151
|
try {
|
|
51
152
|
const local = await validateBundle(outfile, sourceFiles);
|
|
@@ -74,10 +175,43 @@ export default class ExtensionPush extends IntegrationLayerCommand {
|
|
|
74
175
|
}
|
|
75
176
|
const bundle = await readFile(outfile, "utf8");
|
|
76
177
|
const filename = `${basename(outfile).replace(/\.[^.]+$/, "")}.cjs`;
|
|
178
|
+
// Which of the integrator's revisions this build came from. Reported so the
|
|
179
|
+
// Merchant Center, the connector's log lines and `{ _extensionBundle }` can all
|
|
180
|
+
// name it. Detected from the working copy unless the caller said otherwise; a
|
|
181
|
+
// build outside version control simply reports none (see sourceRevision.ts).
|
|
182
|
+
const sourceRevision = flags["no-source-revision"]
|
|
183
|
+
? undefined
|
|
184
|
+
: await resolveSourceRevision(flags["source-revision"], process.cwd());
|
|
185
|
+
if (sourceRevision) {
|
|
186
|
+
this.log(`Source revision: ${sourceRevision}`);
|
|
187
|
+
}
|
|
188
|
+
else if (!flags["no-source-revision"]) {
|
|
189
|
+
// Say so rather than staying silent: the operator console and the connector
|
|
190
|
+
// logs will show no revision for this push, and that's worth knowing now.
|
|
191
|
+
this.logToStderr("⚠ no source revision detected (not a git checkout?) — pushing without one. " +
|
|
192
|
+
"Pass --source-revision to record one explicitly.");
|
|
193
|
+
}
|
|
77
194
|
const url = `${baseUrl}/${encodeURIComponent(projectKey)}/extension/bundle`;
|
|
78
195
|
this.log(`Pushing extension bundle (${bundle.length} bytes) → ${url}`);
|
|
79
|
-
const meta = await pushBundle(baseUrl, projectKey, token, bundle, filename);
|
|
196
|
+
const meta = await pushBundle(baseUrl, projectKey, token, bundle, filename, sourceRevision);
|
|
80
197
|
this.log(`✓ stored revision ${meta.version} (${meta.length} bytes, filename ${meta.filename ?? filename})`);
|
|
198
|
+
if (meta.sourceRevision) {
|
|
199
|
+
this.log(` built from ${meta.sourceRevision}`);
|
|
200
|
+
}
|
|
201
|
+
if (!flags.wait) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
// Storing it isn't running it. Wait for the extension to actually load this
|
|
205
|
+
// version and say so, and fail the command if it couldn't — otherwise a bundle
|
|
206
|
+
// the sandbox refuses to run exits 0 and looks like a successful push.
|
|
207
|
+
this.log(`Waiting for the extension to load version ${meta.version}…`);
|
|
208
|
+
const outcome = await awaitBundleState(baseUrl, projectKey, token, meta.version, {
|
|
209
|
+
timeoutMs: flags["wait-timeout"] * 1000,
|
|
210
|
+
intervalMs: POLL_INTERVAL_MS,
|
|
211
|
+
});
|
|
212
|
+
if (this.reportOutcome(outcome, meta.version)) {
|
|
213
|
+
this.error("The pushed bundle could not be loaded.");
|
|
214
|
+
}
|
|
81
215
|
}
|
|
82
216
|
}
|
|
83
217
|
//# sourceMappingURL=push.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../../../src/commands/integration-layer/extension/push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAA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