@shopify/cli-kit 3.0.18 → 3.0.21
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/CHANGELOG.md +20 -0
- package/assets/auth-error.html +25 -0
- package/assets/empty-url.html +25 -0
- package/assets/favicon.svg +26 -0
- package/assets/missing-code.html +25 -0
- package/assets/missing-state.html +25 -0
- package/assets/style.css +61 -0
- package/assets/success.html +20 -0
- package/dist/{index-46c26c7f.js → index-21b8e2fe.js} +275 -114
- package/dist/index-21b8e2fe.js.map +1 -0
- package/dist/index.d.ts +45 -14
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/{multipart-parser-247e7258.js → multipart-parser-6958f711.js} +4 -3
- package/dist/multipart-parser-6958f711.js.map +1 -0
- package/package.json +6 -4
- package/dist/index-46c26c7f.js.map +0 -1
- package/dist/multipart-parser-247e7258.js.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import require$$0$2, { sep as sep$1, extname as extname$1, resolve as resolve$4, dirname as dirname$2 } from 'path';
|
|
2
|
+
import Url, { fileURLToPath as fileURLToPath$1 } from 'url';
|
|
2
3
|
import path$I from 'node:path';
|
|
3
4
|
import url$2, { fileURLToPath, pathToFileURL, format as format$6 } from 'node:url';
|
|
4
5
|
import process$2, { platform as platform$2 } from 'node:process';
|
|
@@ -28,9 +29,8 @@ import http$4 from 'node:http';
|
|
|
28
29
|
import https$3 from 'node:https';
|
|
29
30
|
import zlib$2 from 'node:zlib';
|
|
30
31
|
import { isIP } from 'node:net';
|
|
31
|
-
import
|
|
32
|
+
import require$$4 from 'http';
|
|
32
33
|
import require$$1$3 from 'https';
|
|
33
|
-
import Url from 'url';
|
|
34
34
|
import require$$0$b from 'readline';
|
|
35
35
|
import inquirer from 'inquirer';
|
|
36
36
|
import require$$0$c from 'dns';
|
|
@@ -40,6 +40,7 @@ import require$$1$4 from 'tls';
|
|
|
40
40
|
import require$$0$e, { createServer } from 'net';
|
|
41
41
|
import require$$0$f from 'punycode';
|
|
42
42
|
import { parse as parse$i, stringify as stringify$f } from 'envfile';
|
|
43
|
+
import Fastify__default from 'fastify';
|
|
43
44
|
import { createRequire } from 'module';
|
|
44
45
|
|
|
45
46
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -7127,10 +7128,14 @@ function relativize(path) {
|
|
|
7127
7128
|
return relativePath;
|
|
7128
7129
|
}
|
|
7129
7130
|
}
|
|
7131
|
+
function moduleDirectory(moduleURL) {
|
|
7132
|
+
return dirname$1(fileURLToPath$1(moduleURL));
|
|
7133
|
+
}
|
|
7130
7134
|
|
|
7131
7135
|
var path$w = /*#__PURE__*/Object.freeze({
|
|
7132
7136
|
__proto__: null,
|
|
7133
7137
|
relativize: relativize,
|
|
7138
|
+
moduleDirectory: moduleDirectory,
|
|
7134
7139
|
findUp: findUp$2,
|
|
7135
7140
|
glob: out,
|
|
7136
7141
|
pathToFileURL: pathToFileURL,
|
|
@@ -7151,7 +7156,7 @@ var path$w = /*#__PURE__*/Object.freeze({
|
|
|
7151
7156
|
});
|
|
7152
7157
|
|
|
7153
7158
|
var name = "@shopify/cli-kit";
|
|
7154
|
-
var version$2 = "3.0.
|
|
7159
|
+
var version$2 = "3.0.21";
|
|
7155
7160
|
var description$1 = "A set of utilities, interfaces, and models that are common across all the platform features";
|
|
7156
7161
|
var keywords = [
|
|
7157
7162
|
"shopify",
|
|
@@ -7169,7 +7174,8 @@ var exports = {
|
|
|
7169
7174
|
}
|
|
7170
7175
|
};
|
|
7171
7176
|
var files = [
|
|
7172
|
-
"/dist"
|
|
7177
|
+
"/dist",
|
|
7178
|
+
"/assets"
|
|
7173
7179
|
];
|
|
7174
7180
|
var publishConfig = {
|
|
7175
7181
|
access: "public",
|
|
@@ -7206,7 +7212,8 @@ var dependencies$1 = {
|
|
|
7206
7212
|
open: "^8.4.0",
|
|
7207
7213
|
prettier: "^2.6.2",
|
|
7208
7214
|
"source-map-support": "^0.5.21",
|
|
7209
|
-
stacktracey: "^2.1.8"
|
|
7215
|
+
stacktracey: "^2.1.8",
|
|
7216
|
+
fastify: "^4.0.0-rc.4"
|
|
7210
7217
|
};
|
|
7211
7218
|
var devDependencies = {
|
|
7212
7219
|
"@iarna/toml": "^2.2.5",
|
|
@@ -7247,7 +7254,7 @@ var devDependencies = {
|
|
|
7247
7254
|
tempy: "^2.0.0",
|
|
7248
7255
|
"term-size": "^3.0.1",
|
|
7249
7256
|
"terminal-link": "^3.0.0",
|
|
7250
|
-
vitest: "0.
|
|
7257
|
+
vitest: "^0.15.1",
|
|
7251
7258
|
zod: "^3.17.3"
|
|
7252
7259
|
};
|
|
7253
7260
|
var cliKitPackageJson = {
|
|
@@ -13352,51 +13359,65 @@ async function inTemporaryDirectory(callback) {
|
|
|
13352
13359
|
return tempy.directory.task(callback);
|
|
13353
13360
|
}
|
|
13354
13361
|
async function read$1(path, options = { encoding: "utf-8" }) {
|
|
13355
|
-
|
|
13356
|
-
|
|
13362
|
+
debug$5(content`Reading the content of file at ${token.path(path)}...`);
|
|
13363
|
+
const content$1 = await fs$j.readFile(path, options);
|
|
13364
|
+
return content$1;
|
|
13357
13365
|
}
|
|
13358
13366
|
function readSync(path, options = { encoding: "utf-8" }) {
|
|
13359
|
-
|
|
13360
|
-
|
|
13367
|
+
debug$5(content`Sync-reading the content of file at ${token.path(path)}...`);
|
|
13368
|
+
const content$1 = fs$j.readFileSync(path, options);
|
|
13369
|
+
return content$1.toString();
|
|
13361
13370
|
}
|
|
13362
13371
|
async function copy(from, to) {
|
|
13372
|
+
debug$5(content`Copying file from ${token.path(from)} to ${token.path(to)}...`);
|
|
13363
13373
|
await fs$j.copy(from, to);
|
|
13364
13374
|
}
|
|
13365
13375
|
async function touch(path) {
|
|
13376
|
+
debug$5(content`Creating an empty file at ${token.path(path)}...`);
|
|
13366
13377
|
await fs$j.ensureFile(path);
|
|
13367
13378
|
}
|
|
13368
13379
|
async function write$1(path, data) {
|
|
13380
|
+
debug$5(content`Writing some content to file at ${token.path(path)}...`);
|
|
13369
13381
|
await fs$j.writeFile(path, data);
|
|
13370
13382
|
}
|
|
13371
13383
|
function writeSync(path, data) {
|
|
13384
|
+
debug$5(content`File-writing some content to file at ${token.path(path)}...`);
|
|
13372
13385
|
fs$j.writeFileSync(path, data);
|
|
13373
13386
|
}
|
|
13374
13387
|
async function append$2(path, data) {
|
|
13375
13388
|
await fs$j.appendFile(path, data);
|
|
13376
13389
|
}
|
|
13377
13390
|
async function mkdir(path) {
|
|
13391
|
+
debug$5(content`Creating directory at ${token.path(path)}...`);
|
|
13378
13392
|
await fs$j.mkdirp(path);
|
|
13379
13393
|
}
|
|
13380
13394
|
function mkdirSync(path) {
|
|
13395
|
+
debug$5(content`Sync-reating directory at ${token.path(path)}...`);
|
|
13381
13396
|
fs$j.mkdirpSync(path);
|
|
13382
13397
|
}
|
|
13383
13398
|
async function remove$4(path) {
|
|
13399
|
+
debug$5(content`Removing file at ${token.path(path)}...`);
|
|
13384
13400
|
await fs$j.remove(path);
|
|
13385
13401
|
}
|
|
13386
13402
|
async function rmdir(path, { force } = {}) {
|
|
13403
|
+
debug$5(content`Removing directory at ${token.path(path)}...`);
|
|
13387
13404
|
await del$1(path, { force });
|
|
13388
13405
|
}
|
|
13389
13406
|
async function mkTmpDir() {
|
|
13407
|
+
debug$5(content`Creating a temporary directory...`);
|
|
13390
13408
|
const directory = await fs$j.mkdtemp("tmp-");
|
|
13391
13409
|
return directory;
|
|
13392
13410
|
}
|
|
13393
13411
|
async function isDirectory(path) {
|
|
13412
|
+
debug$5(content`Checking if ${token.path(path)} is a directory...`);
|
|
13394
13413
|
return (await fs$j.promises.lstat(path)).isDirectory();
|
|
13395
13414
|
}
|
|
13396
13415
|
async function size$1(path) {
|
|
13416
|
+
debug$5(content`Getting the size of file file at ${token.path(path)}...`);
|
|
13397
13417
|
return (await fs$j.stat(path)).size;
|
|
13398
13418
|
}
|
|
13399
13419
|
function sizeSync(path) {
|
|
13420
|
+
debug$5(content`Sync-getting the size of file file at ${token.path(path)}...`);
|
|
13400
13421
|
return fs$j.statSync(path).size;
|
|
13401
13422
|
}
|
|
13402
13423
|
async function move(src, dest, options = {}) {
|
|
@@ -16679,6 +16700,7 @@ const getUsernameFromOsUserInfo = () => {
|
|
|
16679
16700
|
const cleanWindowsCommand = (value) => value.replace(/^.*\\/, "");
|
|
16680
16701
|
const makeUsernameFromId = (userId) => `no-username-${userId}`;
|
|
16681
16702
|
const username = async (platform = platform$2) => {
|
|
16703
|
+
debug$5(content`Obtaining user name...`);
|
|
16682
16704
|
const environmentVariable = getEnvironmentVariable();
|
|
16683
16705
|
if (environmentVariable) {
|
|
16684
16706
|
return environmentVariable;
|
|
@@ -16803,15 +16825,31 @@ var system = /*#__PURE__*/Object.freeze({
|
|
|
16803
16825
|
page: page
|
|
16804
16826
|
});
|
|
16805
16827
|
|
|
16828
|
+
const SpinInstanceNotFound = (spinInstance, error) => {
|
|
16829
|
+
const errorMessage = content`${token.genericShellCommand(`spin`)} yielded the following error trying to obtain the fully qualified domain name of the Spin instance:
|
|
16830
|
+
${error}
|
|
16831
|
+
`;
|
|
16832
|
+
let nextSteps;
|
|
16833
|
+
if (spinInstance) {
|
|
16834
|
+
nextSteps = `Make sure ${spinInstance} is the instance name and not a fully qualified domain name`;
|
|
16835
|
+
}
|
|
16836
|
+
return new Abort(errorMessage, nextSteps);
|
|
16837
|
+
};
|
|
16806
16838
|
async function fqdn$1(env = process.env) {
|
|
16807
16839
|
const spinInstance = await instance(env);
|
|
16808
|
-
const showResponse = await show(spinInstance
|
|
16840
|
+
const showResponse = await show(spinInstance, env);
|
|
16809
16841
|
return showResponse.fqdn;
|
|
16810
16842
|
}
|
|
16811
|
-
async function show(
|
|
16843
|
+
async function show(spinInstance, env = process.env) {
|
|
16844
|
+
const latest = spinInstance === void 0;
|
|
16812
16845
|
const args = latest ? ["show", "--latest", "--json"] : ["show", "--json"];
|
|
16813
|
-
const output = await captureOutput("spin", args);
|
|
16814
|
-
|
|
16846
|
+
const output = await captureOutput("spin", args, { env });
|
|
16847
|
+
const json = JSON.parse(output);
|
|
16848
|
+
if (json.error) {
|
|
16849
|
+
throw SpinInstanceNotFound(spinInstance, json.error);
|
|
16850
|
+
} else {
|
|
16851
|
+
return json;
|
|
16852
|
+
}
|
|
16815
16853
|
}
|
|
16816
16854
|
function isSpin(env = process.env) {
|
|
16817
16855
|
return isTruthy$1(env[constants$2.environmentVariables.spin]);
|
|
@@ -16841,9 +16879,8 @@ function isVerbose(env = process.env) {
|
|
|
16841
16879
|
return isTruthy$1(env[constants$2.environmentVariables.verbose]) || process.argv.includes("--verbose");
|
|
16842
16880
|
}
|
|
16843
16881
|
async function isShopify(env = process.env) {
|
|
16844
|
-
|
|
16845
|
-
|
|
16846
|
-
return false;
|
|
16882
|
+
if (Object.prototype.hasOwnProperty.call(env, constants$2.environmentVariables.runAsUser)) {
|
|
16883
|
+
return !isTruthy$1(env[constants$2.environmentVariables.runAsUser]);
|
|
16847
16884
|
}
|
|
16848
16885
|
const devInstalled = await exists$1(constants$2.paths.executables.dev);
|
|
16849
16886
|
return devInstalled || isSpin();
|
|
@@ -21839,7 +21876,7 @@ class Body$1 {
|
|
|
21839
21876
|
return formData;
|
|
21840
21877
|
}
|
|
21841
21878
|
|
|
21842
|
-
const {toFormData} = await import('./multipart-parser-
|
|
21879
|
+
const {toFormData} = await import('./multipart-parser-6958f711.js');
|
|
21843
21880
|
return toFormData(this.body, ct);
|
|
21844
21881
|
}
|
|
21845
21882
|
|
|
@@ -35220,7 +35257,7 @@ var populate$3 = function(dst, src) {
|
|
|
35220
35257
|
var CombinedStream$1 = combined_stream;
|
|
35221
35258
|
var util$3 = require$$0$3;
|
|
35222
35259
|
var path$9 = require$$0$2;
|
|
35223
|
-
var http$3 =
|
|
35260
|
+
var http$3 = require$$4;
|
|
35224
35261
|
var https$2 = require$$1$3;
|
|
35225
35262
|
var parseUrl$1 = Url.parse;
|
|
35226
35263
|
var fs$a = require$$0$5;
|
|
@@ -46230,8 +46267,8 @@ async function execCLI(args, adminSession) {
|
|
|
46230
46267
|
};
|
|
46231
46268
|
spawn$1("bundle", ["exec", "shopify"].concat(args), {
|
|
46232
46269
|
stdio: "inherit",
|
|
46233
|
-
shell: true,
|
|
46234
46270
|
cwd: shopifyCLIDirectory(),
|
|
46271
|
+
shell: true,
|
|
46235
46272
|
env
|
|
46236
46273
|
});
|
|
46237
46274
|
}
|
|
@@ -57611,10 +57648,14 @@ const cliKit = new Conf({
|
|
|
57611
57648
|
projectVersion: cliKitPackageJson.version
|
|
57612
57649
|
});
|
|
57613
57650
|
function getAppInfo(directory) {
|
|
57651
|
+
debug$5(content`Reading cached app information for directory ${token.path(directory)}...`);
|
|
57614
57652
|
const apps = cliKit.get("appInfo") ?? [];
|
|
57615
57653
|
return apps.find((app) => app.directory === directory);
|
|
57616
57654
|
}
|
|
57617
57655
|
function setAppInfo(options) {
|
|
57656
|
+
debug$5(content`Storing app information for directory ${token.path(options.directory)}:
|
|
57657
|
+
${token.json(options)}
|
|
57658
|
+
`);
|
|
57618
57659
|
const apps = cliKit.get("appInfo") ?? [];
|
|
57619
57660
|
const index = apps.findIndex((saved) => saved.directory === options.directory);
|
|
57620
57661
|
if (index === -1) {
|
|
@@ -57632,6 +57673,7 @@ function setAppInfo(options) {
|
|
|
57632
57673
|
cliKit.set("appInfo", apps);
|
|
57633
57674
|
}
|
|
57634
57675
|
function clearAppInfo(directory) {
|
|
57676
|
+
debug$5(content`Clearning app information for directory ${token.path(directory)}...`);
|
|
57635
57677
|
const apps = cliKit.get("appInfo") ?? [];
|
|
57636
57678
|
const index = apps.findIndex((saved) => saved.directory === directory);
|
|
57637
57679
|
if (index !== -1) {
|
|
@@ -57640,9 +57682,11 @@ function clearAppInfo(directory) {
|
|
|
57640
57682
|
cliKit.set("appInfo", apps);
|
|
57641
57683
|
}
|
|
57642
57684
|
function getThemeStore() {
|
|
57685
|
+
debug$5(content`Getting theme store...`);
|
|
57643
57686
|
return cliKit.get("themeStore");
|
|
57644
57687
|
}
|
|
57645
57688
|
function setThemeStore(store) {
|
|
57689
|
+
debug$5(content`Setting theme store...`);
|
|
57646
57690
|
cliKit.set("themeStore", store);
|
|
57647
57691
|
}
|
|
57648
57692
|
|
|
@@ -62423,7 +62467,7 @@ var calculateServerName$1 = options => {
|
|
|
62423
62467
|
return servername;
|
|
62424
62468
|
};
|
|
62425
62469
|
|
|
62426
|
-
const http$1 =
|
|
62470
|
+
const http$1 = require$$4;
|
|
62427
62471
|
const https$1 = require$$1$3;
|
|
62428
62472
|
const resolveALPN = resolveAlpn;
|
|
62429
62473
|
const QuickLRU = quickLru;
|
|
@@ -63100,8 +63144,8 @@ const util_1 = require$$0$3;
|
|
|
63100
63144
|
const stream_1 = require$$0$4;
|
|
63101
63145
|
const fs_1 = require$$0$5;
|
|
63102
63146
|
const url_1 = Url;
|
|
63103
|
-
const http =
|
|
63104
|
-
const http_1 =
|
|
63147
|
+
const http = require$$4;
|
|
63148
|
+
const http_1 = require$$4;
|
|
63105
63149
|
const https = require$$1$3;
|
|
63106
63150
|
const http_timer_1 = source$3.exports;
|
|
63107
63151
|
const cacheable_lookup_1 = source$1.exports;
|
|
@@ -66281,7 +66325,7 @@ function getLegacyAuthToken (tok) {
|
|
|
66281
66325
|
return { token: token, type: 'Basic' }
|
|
66282
66326
|
}
|
|
66283
66327
|
|
|
66284
|
-
const {Agent: HttpAgent} =
|
|
66328
|
+
const {Agent: HttpAgent} = require$$4;
|
|
66285
66329
|
const {Agent: HttpsAgent} = require$$1$3;
|
|
66286
66330
|
const got = source$4.exports;
|
|
66287
66331
|
const registryUrl = registryUrl$2.exports;
|
|
@@ -66400,6 +66444,7 @@ async function latestVersion(packageName, options) {
|
|
|
66400
66444
|
}
|
|
66401
66445
|
|
|
66402
66446
|
async function latestNpmPackageVersion(name) {
|
|
66447
|
+
debug$5(content`Getting the latest version of NPM package: ${token.raw(name)}`);
|
|
66403
66448
|
return latestVersion(name);
|
|
66404
66449
|
}
|
|
66405
66450
|
function cliVersion() {
|
|
@@ -66424,7 +66469,7 @@ const reportEvent = async (command, args) => {
|
|
|
66424
66469
|
const headers = buildHeaders$1(currentTime);
|
|
66425
66470
|
const response = await fetch$3(url, { method: "POST", body, headers });
|
|
66426
66471
|
if (response.status === 200) {
|
|
66427
|
-
debug$5(`Analytics event sent: ${
|
|
66472
|
+
debug$5(content`Analytics event sent: ${token.json(payload)}`);
|
|
66428
66473
|
} else {
|
|
66429
66474
|
debug$5(`Failed to report usage analytics: ${response.statusText}`);
|
|
66430
66475
|
}
|
|
@@ -147317,7 +147362,7 @@ function createHeadersLenient(obj) {
|
|
|
147317
147362
|
const INTERNALS$1 = Symbol('Response internals');
|
|
147318
147363
|
|
|
147319
147364
|
// fix an issue where "STATUS_CODES" aren't a named export for node <10
|
|
147320
|
-
const STATUS_CODES =
|
|
147365
|
+
const STATUS_CODES = require$$4.STATUS_CODES;
|
|
147321
147366
|
|
|
147322
147367
|
/**
|
|
147323
147368
|
* Response class
|
|
@@ -147713,7 +147758,7 @@ function fetch$2(url, opts) {
|
|
|
147713
147758
|
const request = new Request(url, opts);
|
|
147714
147759
|
const options = getNodeRequestOptions(request);
|
|
147715
147760
|
|
|
147716
|
-
const send = (options.protocol === 'https:' ? require$$1$3 :
|
|
147761
|
+
const send = (options.protocol === 'https:' ? require$$1$3 : require$$4).request;
|
|
147717
147762
|
const signal = request.signal;
|
|
147718
147763
|
|
|
147719
147764
|
let response = null;
|
|
@@ -152382,7 +152427,7 @@ var populate$1 = function(dst, src) {
|
|
|
152382
152427
|
var CombinedStream = combined_stream;
|
|
152383
152428
|
var util$1 = require$$0$3;
|
|
152384
152429
|
var path$2 = require$$0$2;
|
|
152385
|
-
var http =
|
|
152430
|
+
var http = require$$4;
|
|
152386
152431
|
var https = require$$1$3;
|
|
152387
152432
|
var parseUrl = Url.parse;
|
|
152388
152433
|
var fs$4 = require$$0$5;
|
|
@@ -153914,6 +153959,7 @@ const FindOrganizationQuery = dist$3.gql`
|
|
|
153914
153959
|
id
|
|
153915
153960
|
title
|
|
153916
153961
|
apiKey
|
|
153962
|
+
organizationId
|
|
153917
153963
|
apiSecretKeys {
|
|
153918
153964
|
secret
|
|
153919
153965
|
}
|
|
@@ -153933,17 +153979,6 @@ const AllOrganizationsQuery = dist$3.gql`
|
|
|
153933
153979
|
businessName
|
|
153934
153980
|
website
|
|
153935
153981
|
appsNext
|
|
153936
|
-
apps {
|
|
153937
|
-
nodes {
|
|
153938
|
-
id
|
|
153939
|
-
title
|
|
153940
|
-
apiKey
|
|
153941
|
-
apiSecretKeys {
|
|
153942
|
-
secret
|
|
153943
|
-
}
|
|
153944
|
-
appType
|
|
153945
|
-
}
|
|
153946
|
-
}
|
|
153947
153982
|
}
|
|
153948
153983
|
}
|
|
153949
153984
|
}
|
|
@@ -153997,6 +154032,7 @@ const FindAppQuery = dist$3.gql`
|
|
|
153997
154032
|
id
|
|
153998
154033
|
title
|
|
153999
154034
|
apiKey
|
|
154035
|
+
organizationId
|
|
154000
154036
|
apiSecretKeys {
|
|
154001
154037
|
secret
|
|
154002
154038
|
}
|
|
@@ -154209,6 +154245,7 @@ const AppFunctionSetMutation = dist$3.gql`
|
|
|
154209
154245
|
$library: LibraryInput
|
|
154210
154246
|
$inputQuery: String
|
|
154211
154247
|
$appBridge: AppBridgeInput
|
|
154248
|
+
$apiVersion: String
|
|
154212
154249
|
) {
|
|
154213
154250
|
appScriptSet(
|
|
154214
154251
|
uuid: $uuid
|
|
@@ -154225,6 +154262,7 @@ const AppFunctionSetMutation = dist$3.gql`
|
|
|
154225
154262
|
library: $library
|
|
154226
154263
|
inputQuery: $inputQuery
|
|
154227
154264
|
appBridge: $appBridge
|
|
154265
|
+
apiVersion: $apiVersion
|
|
154228
154266
|
) {
|
|
154229
154267
|
userErrors {
|
|
154230
154268
|
field
|
|
@@ -154242,6 +154280,19 @@ const AppFunctionSetMutation = dist$3.gql`
|
|
|
154242
154280
|
}
|
|
154243
154281
|
`;
|
|
154244
154282
|
|
|
154283
|
+
const FindOrganizationBasicQuery = dist$3.gql`
|
|
154284
|
+
query FindOrganization($id: ID!) {
|
|
154285
|
+
organizations(id: $id, first: 1) {
|
|
154286
|
+
nodes {
|
|
154287
|
+
id
|
|
154288
|
+
businessName
|
|
154289
|
+
website
|
|
154290
|
+
appsNext
|
|
154291
|
+
}
|
|
154292
|
+
}
|
|
154293
|
+
}
|
|
154294
|
+
`;
|
|
154295
|
+
|
|
154245
154296
|
var index = /*#__PURE__*/Object.freeze({
|
|
154246
154297
|
__proto__: null,
|
|
154247
154298
|
FindOrganizationQuery: FindOrganizationQuery,
|
|
@@ -154261,7 +154312,8 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
154261
154312
|
ScriptServiceProxyQuery: ScriptServiceProxyQuery,
|
|
154262
154313
|
GetAppFunctionsQuery: GetAppFunctionsQuery,
|
|
154263
154314
|
ModuleUploadUrlGenerateMutation: ModuleUploadUrlGenerateMutation,
|
|
154264
|
-
AppFunctionSetMutation: AppFunctionSetMutation
|
|
154315
|
+
AppFunctionSetMutation: AppFunctionSetMutation,
|
|
154316
|
+
FindOrganizationBasicQuery: FindOrganizationBasicQuery
|
|
154265
154317
|
});
|
|
154266
154318
|
|
|
154267
154319
|
async function request(query, token$1, variables) {
|
|
@@ -154496,6 +154548,7 @@ function getUnzipArgs (inPath, outPath) {
|
|
|
154496
154548
|
}
|
|
154497
154549
|
|
|
154498
154550
|
async function zip(inputDirectory, outputZipPath) {
|
|
154551
|
+
debug$5(content`Zipping ${token.path(inputDirectory)} into ${token.path(outputZipPath)}`);
|
|
154499
154552
|
const cwd = process.cwd();
|
|
154500
154553
|
process.chdir(inputDirectory);
|
|
154501
154554
|
await new Promise((resolve, reject) => {
|
|
@@ -154567,6 +154620,7 @@ const InvalidChecksumError = ({ file, expected, got }) => {
|
|
|
154567
154620
|
return new Abort(`The validation of ${file} failed. We expected the checksum ${expected}, but got ${got})`);
|
|
154568
154621
|
};
|
|
154569
154622
|
async function validateMD5({ file, md5FileURL }) {
|
|
154623
|
+
debug$5(`Checking MD5 of file ${token.path(file)} against the MD5 in ${token.link("URL", md5FileURL)}`);
|
|
154570
154624
|
const md5Digest = await md5File$1(file);
|
|
154571
154625
|
const md5Response = await fetch$3(md5FileURL);
|
|
154572
154626
|
const md5Contents = await md5Response.text();
|
|
@@ -154621,6 +154675,7 @@ function dependencyManagerUsedForCreating(env = process.env) {
|
|
|
154621
154675
|
}
|
|
154622
154676
|
}
|
|
154623
154677
|
async function getDependencyManager(directory) {
|
|
154678
|
+
debug$5(content`Obtaining the dependency manager in directory ${token.path(directory)}...`);
|
|
154624
154679
|
const yarnLockPath = join$3(directory, genericConfigurationFileNames.yarn.lockfile);
|
|
154625
154680
|
const pnpmLockPath = join$3(directory, genericConfigurationFileNames.pnpm.lockfile);
|
|
154626
154681
|
if (await exists$1(yarnLockPath)) {
|
|
@@ -154664,6 +154719,7 @@ async function getDependencies(packageJsonPath) {
|
|
|
154664
154719
|
return { ...dependencies, ...devDependencies };
|
|
154665
154720
|
}
|
|
154666
154721
|
async function checkForNewVersion(dependency, currentVersion) {
|
|
154722
|
+
debug$5(content`Checking if there's a version of ${dependency} newer than ${currentVersion}`);
|
|
154667
154723
|
try {
|
|
154668
154724
|
const lastVersion = await latestNpmPackageVersion(dependency);
|
|
154669
154725
|
if (lastVersion && new semver$3(currentVersion).compare(lastVersion) < 0) {
|
|
@@ -154686,29 +154742,38 @@ async function packageJSONContents(packageJsonPath) {
|
|
|
154686
154742
|
return JSON.parse(await read$1(packageJsonPath));
|
|
154687
154743
|
}
|
|
154688
154744
|
async function addNPMDependenciesIfNeeded(dependencies, options) {
|
|
154745
|
+
debug$5(content`Adding the following dependencies if needed:
|
|
154746
|
+
${token.json(dependencies)}
|
|
154747
|
+
With options:
|
|
154748
|
+
${token.json(options)}
|
|
154749
|
+
`);
|
|
154689
154750
|
const packageJsonPath = join$3(options.directory, "package.json");
|
|
154690
154751
|
if (!await exists$1(packageJsonPath)) {
|
|
154691
154752
|
throw PackageJsonNotFoundError(options.directory);
|
|
154692
154753
|
}
|
|
154693
154754
|
const existingDependencies = Object.keys(await getDependencies(packageJsonPath));
|
|
154694
154755
|
const dependenciesToAdd = dependencies.filter((dep) => {
|
|
154695
|
-
return !existingDependencies.includes(dep);
|
|
154756
|
+
return !existingDependencies.includes(dep.name);
|
|
154696
154757
|
});
|
|
154697
154758
|
if (dependenciesToAdd.length === 0) {
|
|
154698
154759
|
return;
|
|
154699
154760
|
}
|
|
154700
154761
|
let args;
|
|
154762
|
+
const depedenciesWithVersion = dependenciesToAdd.map((dep) => {
|
|
154763
|
+
return dep.version ? `${dep.name}@${dep.version}` : dep.name;
|
|
154764
|
+
});
|
|
154701
154765
|
switch (options.dependencyManager) {
|
|
154702
154766
|
case "npm":
|
|
154703
|
-
args = argumentsToAddDependenciesWithNPM(
|
|
154767
|
+
args = argumentsToAddDependenciesWithNPM(depedenciesWithVersion, options.type);
|
|
154704
154768
|
break;
|
|
154705
154769
|
case "yarn":
|
|
154706
|
-
args = argumentsToAddDependenciesWithYarn(
|
|
154770
|
+
args = argumentsToAddDependenciesWithYarn(depedenciesWithVersion, options.type);
|
|
154707
154771
|
break;
|
|
154708
154772
|
case "pnpm":
|
|
154709
|
-
args = argumentsToAddDependenciesWithPNPM(
|
|
154773
|
+
args = argumentsToAddDependenciesWithPNPM(depedenciesWithVersion, options.type);
|
|
154710
154774
|
break;
|
|
154711
154775
|
}
|
|
154776
|
+
options.stdout?.write(`Executing...${args.join(" ")}`);
|
|
154712
154777
|
await exec$2(options.dependencyManager, args, {
|
|
154713
154778
|
cwd: options.directory,
|
|
154714
154779
|
stdout: options.stdout,
|
|
@@ -154716,8 +154781,15 @@ async function addNPMDependenciesIfNeeded(dependencies, options) {
|
|
|
154716
154781
|
signal: options.signal
|
|
154717
154782
|
});
|
|
154718
154783
|
}
|
|
154784
|
+
async function addNPMDependenciesWithoutVersionIfNeeded(dependencies, options) {
|
|
154785
|
+
await addNPMDependenciesIfNeeded(dependencies.map((dependency) => {
|
|
154786
|
+
return { name: dependency, version: void 0 };
|
|
154787
|
+
}), options);
|
|
154788
|
+
}
|
|
154719
154789
|
async function addLatestNPMDependencies(dependencies, options) {
|
|
154720
|
-
await addNPMDependenciesIfNeeded(dependencies.map((dependency) =>
|
|
154790
|
+
await addNPMDependenciesIfNeeded(dependencies.map((dependency) => {
|
|
154791
|
+
return { name: dependency, version: "latest" };
|
|
154792
|
+
}), options);
|
|
154721
154793
|
}
|
|
154722
154794
|
function argumentsToAddDependenciesWithNPM(dependencies, type) {
|
|
154723
154795
|
let command = ["install"];
|
|
@@ -154783,6 +154855,7 @@ var dependency = /*#__PURE__*/Object.freeze({
|
|
|
154783
154855
|
getOutputUpdateCLIReminder: getOutputUpdateCLIReminder,
|
|
154784
154856
|
packageJSONContents: packageJSONContents,
|
|
154785
154857
|
addNPMDependenciesIfNeeded: addNPMDependenciesIfNeeded,
|
|
154858
|
+
addNPMDependenciesWithoutVersionIfNeeded: addNPMDependenciesWithoutVersionIfNeeded,
|
|
154786
154859
|
addLatestNPMDependencies: addLatestNPMDependencies
|
|
154787
154860
|
});
|
|
154788
154861
|
|
|
@@ -154790,13 +154863,14 @@ const DotEnvNotFoundError = (path) => {
|
|
|
154790
154863
|
return new Abort(`The environment file at ${path} does not exist.`);
|
|
154791
154864
|
};
|
|
154792
154865
|
async function read(path) {
|
|
154866
|
+
debug$5(content`Reading the .env file at ${token.path(path)}`);
|
|
154793
154867
|
if (!await exists$1(path)) {
|
|
154794
154868
|
throw DotEnvNotFoundError(path);
|
|
154795
154869
|
}
|
|
154796
|
-
const content = await read$1(path);
|
|
154870
|
+
const content$1 = await read$1(path);
|
|
154797
154871
|
return {
|
|
154798
154872
|
path,
|
|
154799
|
-
variables: parse$i(content)
|
|
154873
|
+
variables: parse$i(content$1)
|
|
154800
154874
|
};
|
|
154801
154875
|
}
|
|
154802
154876
|
async function write(file) {
|
|
@@ -159586,17 +159660,32 @@ const GitNotPresentError = () => {
|
|
|
159586
159660
|
return new Abort(`Git is necessary in the environment to continue`, content`Install ${token.link("git", "https://git-scm.com/book/en/v2/Getting-Started-Installing-Git")}`);
|
|
159587
159661
|
};
|
|
159588
159662
|
async function initializeRepository(directory) {
|
|
159663
|
+
debug$5(content`Initializing git repository at ${token.path(directory)}...`);
|
|
159589
159664
|
await ensurePresentOrAbort();
|
|
159590
159665
|
await esm_default(directory).init();
|
|
159591
159666
|
}
|
|
159592
|
-
async function downloadRepository({
|
|
159667
|
+
async function downloadRepository({
|
|
159668
|
+
repoUrl,
|
|
159669
|
+
destination,
|
|
159670
|
+
progressUpdater,
|
|
159671
|
+
shallow
|
|
159672
|
+
}) {
|
|
159673
|
+
debug$5(content`Git-cloning repository ${repoUrl} into ${token.path(destination)}...`);
|
|
159593
159674
|
await ensurePresentOrAbort();
|
|
159594
159675
|
const [repository, branch] = repoUrl.split("#");
|
|
159595
159676
|
const options = { "--recurse-submodules": null };
|
|
159596
159677
|
if (branch) {
|
|
159597
159678
|
options["--branch"] = branch;
|
|
159598
159679
|
}
|
|
159599
|
-
|
|
159680
|
+
if (shallow) {
|
|
159681
|
+
options["--depth"] = 1;
|
|
159682
|
+
}
|
|
159683
|
+
const progress = ({ stage, progress: progress2, processed, total }) => {
|
|
159684
|
+
const updateString = `${stage}, ${processed}/${total} objects (${progress2}% complete)`;
|
|
159685
|
+
if (progressUpdater)
|
|
159686
|
+
progressUpdater(updateString);
|
|
159687
|
+
};
|
|
159688
|
+
await esm_default({ progress }).clone(repository, destination, options, (err) => {
|
|
159600
159689
|
if (err) {
|
|
159601
159690
|
const abortError = new Abort(err.message);
|
|
159602
159691
|
abortError.stack = err.stack;
|
|
@@ -159625,6 +159714,7 @@ class GitHubClientError extends Error {
|
|
|
159625
159714
|
}
|
|
159626
159715
|
}
|
|
159627
159716
|
async function getLatestRelease(user, repo, { filter } = { filter: () => true }) {
|
|
159717
|
+
debug$5(content`Getting the latest release of GitHub repository ${user}/${repo}...`);
|
|
159628
159718
|
const url = `https://api.github.com/repos/${user}/${repo}/releases`;
|
|
159629
159719
|
const fetchResult = await fetch$3(url);
|
|
159630
159720
|
const jsonBody = await fetchResult.json();
|
|
@@ -159650,10 +159740,12 @@ function parseRepoUrl(src) {
|
|
|
159650
159740
|
const user = match[4];
|
|
159651
159741
|
const name = match[5].replace(/\.git$/, "");
|
|
159652
159742
|
const subDirectory = match[6]?.slice(1);
|
|
159653
|
-
const ref = match[7]
|
|
159743
|
+
const ref = match[7];
|
|
159744
|
+
const branch = ref ? `#${ref}` : "";
|
|
159654
159745
|
const ssh = `git@${normalizedSite}:${user}/${name}`;
|
|
159655
159746
|
const http = `https://${normalizedSite}/${user}/${name}`;
|
|
159656
|
-
|
|
159747
|
+
const full = ["https:/", normalizedSite, user, name, subDirectory].join("/").concat(branch);
|
|
159748
|
+
return { full, site: normalizedSite, user, name, ref, subDirectory, ssh, http };
|
|
159657
159749
|
}
|
|
159658
159750
|
function parseGithubRepoReference(src) {
|
|
159659
159751
|
const url = new URL(src);
|
|
@@ -160752,11 +160844,13 @@ var id = /*#__PURE__*/Object.freeze({
|
|
|
160752
160844
|
});
|
|
160753
160845
|
|
|
160754
160846
|
async function readPackageJSON(directory) {
|
|
160847
|
+
debug$5(content`Reading and decoding the content from package.json at ${token.path(directory)}...`);
|
|
160755
160848
|
const packagePath = join$3(directory, "package.json");
|
|
160756
160849
|
const packageJSON = JSON.parse(await read$1(packagePath));
|
|
160757
160850
|
return packageJSON;
|
|
160758
160851
|
}
|
|
160759
160852
|
async function writePackageJSON(directory, packageJSON) {
|
|
160853
|
+
debug$5(content`JSON-encoding and writing content to package.json at ${token.path(directory)}...`);
|
|
160760
160854
|
const packagePath = join$3(directory, "package.json");
|
|
160761
160855
|
await write$1(packagePath, JSON.stringify(packageJSON, null, 2));
|
|
160762
160856
|
}
|
|
@@ -160774,6 +160868,7 @@ var npm = /*#__PURE__*/Object.freeze({
|
|
|
160774
160868
|
|
|
160775
160869
|
const TUNNEL_PLUGINS = ["@shopify/plugin-ngrok"];
|
|
160776
160870
|
async function lookupTunnelPlugin(plugins) {
|
|
160871
|
+
debug$5(content`Looking up the Ngrok tunnel plugin...`);
|
|
160777
160872
|
const tunnelPlugin = plugins.find((plugin) => TUNNEL_PLUGINS.includes(plugin.name));
|
|
160778
160873
|
if (!tunnelPlugin)
|
|
160779
160874
|
return void 0;
|
|
@@ -160986,7 +161081,10 @@ function getLocalHosts(additional) {
|
|
|
160986
161081
|
}
|
|
160987
161082
|
|
|
160988
161083
|
async function getRandomPort() {
|
|
160989
|
-
|
|
161084
|
+
debug$5(content`Getting a random port...`);
|
|
161085
|
+
const randomPort = await getRandomPort$1();
|
|
161086
|
+
debug$5(content`Random port obtained: ${token.raw(`${randomPort}`)}`);
|
|
161087
|
+
return randomPort;
|
|
160990
161088
|
}
|
|
160991
161089
|
|
|
160992
161090
|
var port = /*#__PURE__*/Object.freeze({
|
|
@@ -164150,68 +164248,109 @@ function buildApplicationToken(result) {
|
|
|
164150
164248
|
};
|
|
164151
164249
|
}
|
|
164152
164250
|
|
|
164153
|
-
const
|
|
164154
|
-
const
|
|
164155
|
-
|
|
164251
|
+
const HTMLFileNames = ["empty-url.html", "auth-error.html", "missing-code.html", "missing-state.html", "success.html"];
|
|
164252
|
+
const StylesheetFilename = "style.css";
|
|
164253
|
+
const FaviconFileName = "favicon.svg";
|
|
164254
|
+
const getFilePath = async (fileName) => {
|
|
164255
|
+
const filePath = await findUp$2(`assets/${fileName}`, {
|
|
164256
|
+
type: "file",
|
|
164257
|
+
cwd: moduleDirectory(import.meta.url)
|
|
164258
|
+
});
|
|
164259
|
+
if (!filePath) {
|
|
164260
|
+
throw RedirectPageAssetNotFoundError();
|
|
164261
|
+
}
|
|
164262
|
+
return filePath;
|
|
164263
|
+
};
|
|
164264
|
+
const getEmptyUrlHTML = async () => {
|
|
164265
|
+
const filePath = await getFilePath(HTMLFileNames[0]);
|
|
164266
|
+
return read$1(filePath);
|
|
164267
|
+
};
|
|
164268
|
+
const getAuthErrorHTML = async () => {
|
|
164269
|
+
const filePath = await getFilePath(HTMLFileNames[1]);
|
|
164270
|
+
return read$1(filePath);
|
|
164271
|
+
};
|
|
164272
|
+
const getMissingCodeHTML = async () => {
|
|
164273
|
+
const filePath = await getFilePath(HTMLFileNames[2]);
|
|
164274
|
+
return read$1(filePath);
|
|
164275
|
+
};
|
|
164276
|
+
const getMissingStateHTML = async () => {
|
|
164277
|
+
const filePath = await getFilePath(HTMLFileNames[3]);
|
|
164278
|
+
return read$1(filePath);
|
|
164279
|
+
};
|
|
164280
|
+
const getSuccessHTML = async () => {
|
|
164281
|
+
const filePath = await getFilePath(HTMLFileNames[4]);
|
|
164282
|
+
return read$1(filePath);
|
|
164156
164283
|
};
|
|
164157
|
-
const
|
|
164158
|
-
const
|
|
164159
|
-
|
|
164284
|
+
const getStylesheet = async () => {
|
|
164285
|
+
const filePath = await getFilePath(StylesheetFilename);
|
|
164286
|
+
return read$1(filePath);
|
|
164287
|
+
};
|
|
164288
|
+
const getFavicon = async () => {
|
|
164289
|
+
const filePath = await getFilePath(FaviconFileName);
|
|
164290
|
+
return read$1(filePath);
|
|
164291
|
+
};
|
|
164292
|
+
const EmptyUrlString = "We received the authentication redirect but the URL is empty.";
|
|
164293
|
+
const MissingCodeString = "The authentication can't continue because the redirect doesn't include the code.";
|
|
164294
|
+
const MissingStateString = "The authentication can't continue because the redirect doesn't include the state.";
|
|
164295
|
+
const RedirectPageAssetNotFoundError = () => new Bug(`Redirect page asset not found`);
|
|
164296
|
+
|
|
164160
164297
|
const ResponseTimeoutSeconds = 10;
|
|
164298
|
+
const ServerStopDelaySeconds = 0.5;
|
|
164161
164299
|
class RedirectListener {
|
|
164162
164300
|
static createServer(callback) {
|
|
164163
|
-
|
|
164301
|
+
const server = Fastify__default().get("*", async (request, reply) => {
|
|
164164
164302
|
const requestUrl = request.url;
|
|
164165
|
-
if (requestUrl === "/favicon.
|
|
164303
|
+
if (requestUrl === "/favicon.svg") {
|
|
164304
|
+
const faviconFile = await getFavicon();
|
|
164305
|
+
reply.header("Content-Type", "image/svg+xml").send(faviconFile);
|
|
164306
|
+
return {};
|
|
164307
|
+
} else if (requestUrl === "/style.css") {
|
|
164308
|
+
const stylesheetFile = await getStylesheet();
|
|
164309
|
+
reply.header("Content-Type", "text/css").send(stylesheetFile);
|
|
164310
|
+
return {};
|
|
164311
|
+
}
|
|
164312
|
+
const respond = (contents, error, state, code) => {
|
|
164313
|
+
reply.header("Content-Type", "text/html").send(contents);
|
|
164314
|
+
callback(error, state, code);
|
|
164166
164315
|
return {};
|
|
164167
|
-
const respond = () => {
|
|
164168
|
-
response.writeHead(200, { "Content-Type": "text/html" });
|
|
164169
|
-
response.end(redirectResponseBody);
|
|
164170
164316
|
};
|
|
164171
164317
|
if (!requestUrl) {
|
|
164172
|
-
|
|
164173
|
-
|
|
164318
|
+
const file2 = await getEmptyUrlHTML();
|
|
164319
|
+
const err = new Bug(EmptyUrlString);
|
|
164320
|
+
return respond(file2, err, void 0, void 0);
|
|
164174
164321
|
}
|
|
164175
164322
|
const queryObject = Url.parse(requestUrl, true).query;
|
|
164176
164323
|
if (queryObject.error && queryObject.error_description) {
|
|
164177
|
-
|
|
164178
|
-
|
|
164324
|
+
const file2 = await getAuthErrorHTML();
|
|
164325
|
+
const err = new Abort(`${queryObject.error_description}`);
|
|
164326
|
+
return respond(file2, err, void 0, void 0);
|
|
164179
164327
|
}
|
|
164180
164328
|
if (!queryObject.code) {
|
|
164181
|
-
|
|
164182
|
-
|
|
164329
|
+
const file2 = await getMissingCodeHTML();
|
|
164330
|
+
const err = new Bug(MissingCodeString);
|
|
164331
|
+
return respond(file2, err, void 0, void 0);
|
|
164183
164332
|
}
|
|
164184
164333
|
if (!queryObject.state) {
|
|
164185
|
-
|
|
164186
|
-
|
|
164334
|
+
const file2 = await getMissingStateHTML();
|
|
164335
|
+
const err = new Bug(MissingStateString);
|
|
164336
|
+
return respond(file2, err, void 0, void 0);
|
|
164187
164337
|
}
|
|
164188
|
-
|
|
164189
|
-
return
|
|
164338
|
+
const file = await getSuccessHTML();
|
|
164339
|
+
return respond(file, void 0, `${queryObject.code}`, `${queryObject.state}`);
|
|
164190
164340
|
});
|
|
164341
|
+
return server;
|
|
164191
164342
|
}
|
|
164192
164343
|
constructor(options) {
|
|
164193
164344
|
this.port = options.port;
|
|
164194
164345
|
this.host = options.host;
|
|
164195
164346
|
this.server = RedirectListener.createServer(options.callback);
|
|
164196
164347
|
}
|
|
164197
|
-
|
|
164198
|
-
|
|
164199
|
-
this.server.listen(this.port, this.host, void 0, () => {
|
|
164200
|
-
resolve();
|
|
164201
|
-
});
|
|
164348
|
+
start() {
|
|
164349
|
+
this.server.listen({ port: this.port, host: this.host }, () => {
|
|
164202
164350
|
});
|
|
164203
164351
|
}
|
|
164204
164352
|
async stop() {
|
|
164205
|
-
await
|
|
164206
|
-
this.server.setTimeout(1);
|
|
164207
|
-
this.server.close((error) => {
|
|
164208
|
-
if (error) {
|
|
164209
|
-
reject(error);
|
|
164210
|
-
} else {
|
|
164211
|
-
resolve();
|
|
164212
|
-
}
|
|
164213
|
-
});
|
|
164214
|
-
});
|
|
164353
|
+
await this.server.close();
|
|
164215
164354
|
}
|
|
164216
164355
|
}
|
|
164217
164356
|
async function listenRedirect(host, port, url2) {
|
|
@@ -164220,22 +164359,17 @@ async function listenRedirect(host, port, url2) {
|
|
|
164220
164359
|
const message = "\nAuto-open timed out. Open the login page: ";
|
|
164221
164360
|
info(content`${message}${token.link("Log in to Shopify Partners", url2)}\n`);
|
|
164222
164361
|
}, ResponseTimeoutSeconds * 1e3);
|
|
164223
|
-
const
|
|
164224
|
-
|
|
164225
|
-
|
|
164226
|
-
callback: (error, code, state) => {
|
|
164227
|
-
clearTimeout(timeout);
|
|
164362
|
+
const callback = async (error, code, state) => {
|
|
164363
|
+
clearTimeout(timeout);
|
|
164364
|
+
setTimeout(() => {
|
|
164228
164365
|
redirectListener.stop();
|
|
164229
|
-
if (error)
|
|
164366
|
+
if (error)
|
|
164230
164367
|
reject(error);
|
|
164231
|
-
|
|
164232
|
-
resolve({
|
|
164233
|
-
|
|
164234
|
-
|
|
164235
|
-
|
|
164236
|
-
}
|
|
164237
|
-
}
|
|
164238
|
-
});
|
|
164368
|
+
else
|
|
164369
|
+
resolve({ code, state });
|
|
164370
|
+
}, ServerStopDelaySeconds * 1e3);
|
|
164371
|
+
};
|
|
164372
|
+
const redirectListener = new RedirectListener({ host, port, callback });
|
|
164239
164373
|
redirectListener.start();
|
|
164240
164374
|
});
|
|
164241
164375
|
return result;
|
|
@@ -164420,15 +164554,18 @@ const SessionSchema = mod.object({}).catchall(mod.object({
|
|
|
164420
164554
|
}));
|
|
164421
164555
|
|
|
164422
164556
|
async function fetch$1(identifier) {
|
|
164557
|
+
debug$5(content`Reading ${identifier} from the secure store...`);
|
|
164423
164558
|
const keytar = await import('keytar');
|
|
164424
|
-
const content = await keytar.getPassword(constants$2.keychain.service, identifier);
|
|
164425
|
-
return content;
|
|
164559
|
+
const content$1 = await keytar.getPassword(constants$2.keychain.service, identifier);
|
|
164560
|
+
return content$1;
|
|
164426
164561
|
}
|
|
164427
|
-
async function store$1(identifier, content) {
|
|
164562
|
+
async function store$1(identifier, content$1) {
|
|
164563
|
+
debug$5(content`Updating ${identifier} in the secure store with new content...`);
|
|
164428
164564
|
const keytar = await import('keytar');
|
|
164429
|
-
await keytar.default.setPassword(constants$2.keychain.service, identifier, content);
|
|
164565
|
+
await keytar.default.setPassword(constants$2.keychain.service, identifier, content$1);
|
|
164430
164566
|
}
|
|
164431
164567
|
async function remove$2(identifier) {
|
|
164568
|
+
debug$5(content`Removing ${identifier} from the secure store...`);
|
|
164432
164569
|
const keytar = await import('keytar');
|
|
164433
164570
|
const result = await keytar.default.deletePassword(constants$2.keychain.service, identifier);
|
|
164434
164571
|
return result;
|
|
@@ -164462,6 +164599,9 @@ const MissingPartnerTokenError = new Bug("No partners token found after ensuring
|
|
|
164462
164599
|
const MissingAdminTokenError = new Bug("No admin token found after ensuring authenticated");
|
|
164463
164600
|
const MissingStorefrontTokenError = new Bug("No storefront token found after ensuring authenticated");
|
|
164464
164601
|
async function ensureAuthenticatedPartners(scopes = [], env = process.env) {
|
|
164602
|
+
debug$5(content`Ensuring that the user is authenticated with the Partners API with the following scopes:
|
|
164603
|
+
${token.json(scopes)}
|
|
164604
|
+
`);
|
|
164465
164605
|
const envToken = env[constants$2.environmentVariables.partnersToken];
|
|
164466
164606
|
if (envToken) {
|
|
164467
164607
|
return (await exchangeCustomPartnerToken(envToken)).accessToken;
|
|
@@ -164473,6 +164613,9 @@ async function ensureAuthenticatedPartners(scopes = [], env = process.env) {
|
|
|
164473
164613
|
return tokens.partners;
|
|
164474
164614
|
}
|
|
164475
164615
|
async function ensureAuthenticatedStorefront(scopes = []) {
|
|
164616
|
+
debug$5(content`Ensuring that the user is authenticated with the Storefront API with the following scopes:
|
|
164617
|
+
${token.json(scopes)}
|
|
164618
|
+
`);
|
|
164476
164619
|
const tokens = await ensureAuthenticated({ storefrontRendererApi: { scopes } });
|
|
164477
164620
|
if (!tokens.storefront) {
|
|
164478
164621
|
throw MissingStorefrontTokenError;
|
|
@@ -164480,6 +164623,9 @@ async function ensureAuthenticatedStorefront(scopes = []) {
|
|
|
164480
164623
|
return tokens.storefront;
|
|
164481
164624
|
}
|
|
164482
164625
|
async function ensureAuthenticatedAdmin(store, scopes = []) {
|
|
164626
|
+
debug$5(content`Ensuring that the user is authenticated with the Admin API with the following scopes for the store ${token.raw(store)}:
|
|
164627
|
+
${token.json(scopes)}
|
|
164628
|
+
`);
|
|
164483
164629
|
const tokens = await ensureAuthenticated({ adminApi: { scopes, storeFqdn: store } });
|
|
164484
164630
|
if (!tokens.admin) {
|
|
164485
164631
|
throw MissingAdminTokenError;
|
|
@@ -164494,11 +164640,18 @@ async function ensureAuthenticated(applications, env = process.env) {
|
|
|
164494
164640
|
const currentSession = await fetch() || {};
|
|
164495
164641
|
const fqdnSession = currentSession[fqdn];
|
|
164496
164642
|
const scopes = getFlattenScopes(applications);
|
|
164643
|
+
debug$5(content`Validating existing session against the scopes:
|
|
164644
|
+
${token.json(scopes)}
|
|
164645
|
+
For applications:
|
|
164646
|
+
${token.json(applications)}
|
|
164647
|
+
`);
|
|
164497
164648
|
const validationResult = await validateSession(scopes, applications, fqdnSession);
|
|
164498
164649
|
let newSession = {};
|
|
164499
164650
|
if (validationResult === "needs_full_auth") {
|
|
164651
|
+
debug$5(content`Initiating the full authentication flow...`);
|
|
164500
164652
|
newSession = await executeCompleteFlow(applications, fqdn);
|
|
164501
164653
|
} else if (validationResult === "needs_refresh") {
|
|
164654
|
+
debug$5(content`The current session is valid but needs refresh. Refreshing...`);
|
|
164502
164655
|
try {
|
|
164503
164656
|
newSession = await refreshTokens(fqdnSession.identity, applications, fqdn);
|
|
164504
164657
|
} catch (error) {
|
|
@@ -164522,8 +164675,11 @@ async function executeCompleteFlow(applications, identityFqdn2) {
|
|
|
164522
164675
|
const scopes = getFlattenScopes(applications);
|
|
164523
164676
|
const exchangeScopes = getExchangeScopes(applications);
|
|
164524
164677
|
const store = applications.adminApi?.storeFqdn;
|
|
164678
|
+
debug$5(content`Authorizing through Identity's website...`);
|
|
164525
164679
|
const code = await authorize(scopes);
|
|
164680
|
+
debug$5(content`Authorization code received. Exchanging it for a CLI token...`);
|
|
164526
164681
|
const identityToken = await exchangeCodeForAccessToken(code);
|
|
164682
|
+
debug$5(content`CLI token received. Exchanging it for application tokens...`);
|
|
164527
164683
|
const result = await exchangeAccessForApplicationTokens(identityToken, exchangeScopes, store);
|
|
164528
164684
|
const session = {
|
|
164529
164685
|
[identityFqdn2]: {
|
|
@@ -164534,8 +164690,8 @@ async function executeCompleteFlow(applications, identityFqdn2) {
|
|
|
164534
164690
|
completed("Logged in");
|
|
164535
164691
|
return session;
|
|
164536
164692
|
}
|
|
164537
|
-
async function refreshTokens(
|
|
164538
|
-
const identityToken = await refreshAccessToken(
|
|
164693
|
+
async function refreshTokens(token2, applications, fqdn) {
|
|
164694
|
+
const identityToken = await refreshAccessToken(token2);
|
|
164539
164695
|
const exchangeScopes = getExchangeScopes(applications);
|
|
164540
164696
|
const applicationTokens = await exchangeAccessForApplicationTokens(identityToken, exchangeScopes, applications.adminApi?.storeFqdn);
|
|
164541
164697
|
return {
|
|
@@ -164554,9 +164710,9 @@ async function tokensFor(applications, session, fqdn) {
|
|
|
164554
164710
|
if (applications.adminApi) {
|
|
164555
164711
|
const appId = applicationId("admin");
|
|
164556
164712
|
const realAppId = `${applications.adminApi.storeFqdn}-${appId}`;
|
|
164557
|
-
const
|
|
164558
|
-
if (
|
|
164559
|
-
tokens.admin = { token, storeFqdn: applications.adminApi.storeFqdn };
|
|
164713
|
+
const token2 = fqdnSession.applications[realAppId]?.accessToken;
|
|
164714
|
+
if (token2) {
|
|
164715
|
+
tokens.admin = { token: token2, storeFqdn: applications.adminApi.storeFqdn };
|
|
164560
164716
|
}
|
|
164561
164717
|
}
|
|
164562
164718
|
if (applications.partnersApi) {
|
|
@@ -169077,6 +169233,7 @@ function create(templateContent) {
|
|
|
169077
169233
|
};
|
|
169078
169234
|
}
|
|
169079
169235
|
async function recursiveDirectoryCopy(from, to, data) {
|
|
169236
|
+
debug$5(content`Copying template from directory ${token.path(from)} to ${token.path(to)}`);
|
|
169080
169237
|
const templateFiles = await out(join$3(from, "**/*"), { dot: true });
|
|
169081
169238
|
const sortedTemplateFiles = templateFiles.map((path) => path.split("/")).sort((lhs, rhs) => lhs.length < rhs.length ? 1 : -1).map((components) => components.join("/"));
|
|
169082
169239
|
await Promise.all(sortedTemplateFiles.map(async (templateItemPath) => {
|
|
@@ -169085,8 +169242,8 @@ async function recursiveDirectoryCopy(from, to, data) {
|
|
|
169085
169242
|
await mkdir(outputPath);
|
|
169086
169243
|
} else if (templateItemPath.endsWith(".liquid")) {
|
|
169087
169244
|
await mkdir(dirname$1(outputPath));
|
|
169088
|
-
const
|
|
169089
|
-
const contentOutput = await create(
|
|
169245
|
+
const content2 = await read$1(templateItemPath);
|
|
169246
|
+
const contentOutput = await create(content2)(data);
|
|
169090
169247
|
const isExecutable = await hasExecutablePermissions(templateItemPath);
|
|
169091
169248
|
const outputPathWithoutLiquid = outputPath.replace(".liquid", "");
|
|
169092
169249
|
await copy(templateItemPath, outputPathWithoutLiquid);
|
|
@@ -171192,6 +171349,7 @@ var toml = /*#__PURE__*/Object.freeze({
|
|
|
171192
171349
|
});
|
|
171193
171350
|
|
|
171194
171351
|
const isVSCode = async (root = process.cwd()) => {
|
|
171352
|
+
debug$5(content`Checking if the directory ${token.path(root)} or any of its parents has a .vscode directory... `);
|
|
171195
171353
|
const config = await findUp$2(join$3(root, ".vscode"), { type: "directory" });
|
|
171196
171354
|
if (!config) {
|
|
171197
171355
|
return false;
|
|
@@ -171199,6 +171357,9 @@ const isVSCode = async (root = process.cwd()) => {
|
|
|
171199
171357
|
return exists$1(config);
|
|
171200
171358
|
};
|
|
171201
171359
|
async function addRecommendedExtensions(directory, recommendations) {
|
|
171360
|
+
debug$5(content`Adding VSCode recommended extensions at ${token.path(directory)}:
|
|
171361
|
+
${token.json(recommendations)}
|
|
171362
|
+
`);
|
|
171202
171363
|
const extensionsPath = join$3(directory, ".vscode/extensions.json");
|
|
171203
171364
|
if (await isVSCode(directory)) {
|
|
171204
171365
|
let originalExtensionsJson = { recommendations: [] };
|
|
@@ -175026,4 +175187,4 @@ var yaml = /*#__PURE__*/Object.freeze({
|
|
|
175026
175187
|
});
|
|
175027
175188
|
|
|
175028
175189
|
export { semver$2 as A, session as B, store$2 as C, string as D, system as E, FormData$3 as F, template as G, temporary as H, toml as I, ui as J, version as K, vscode as L, yaml as M, File$1 as a, abort$3 as b, constants$2 as c, analytics as d, api as e, archiver as f, checksum as g, cli as h, dependency as i, dotEnv as j, environment as k, error$k as l, file$1 as m, git as n, github as o, haiku as p, http$2 as q, id as r, npm as s, os$3 as t, output as u, path$w as v, plugins as w, port as x, ruby as y, schema$1 as z };
|
|
175029
|
-
//# sourceMappingURL=index-
|
|
175190
|
+
//# sourceMappingURL=index-21b8e2fe.js.map
|