@zapier/zapier-sdk-cli 0.55.1 → 0.55.3
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 +14 -0
- package/dist/cli.cjs +30 -6
- package/dist/cli.mjs +30 -6
- package/dist/experimental.cjs +57 -31
- package/dist/experimental.mjs +57 -31
- package/dist/index.cjs +58 -32
- package/dist/index.mjs +58 -32
- package/dist/login.cjs +2 -0
- package/dist/login.mjs +2 -0
- package/dist/package.json +1 -1
- package/dist/src/login/credentials-store.d.ts +22 -0
- package/dist/src/login/credentials-store.js +33 -0
- package/dist/src/utils/auth/account-auth.js +11 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @zapier/zapier-sdk-cli
|
|
2
2
|
|
|
3
|
+
## 0.55.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 036fb94: Non-interactive `login` and `signup` now append an incrementing suffix (`<name>-1`, `<name>-2`, …) when the default credential name (`<email>@<hostname>`) already exists locally, instead of silently overwriting the existing credential's local entry and keychain secret. Interactive logins are unchanged.
|
|
8
|
+
|
|
9
|
+
## 0.55.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [cafad12]
|
|
14
|
+
- @zapier/zapier-sdk@0.70.2
|
|
15
|
+
- @zapier/zapier-sdk-mcp@0.13.30
|
|
16
|
+
|
|
3
17
|
## 0.55.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/cli.cjs
CHANGED
|
@@ -1573,7 +1573,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
|
|
|
1573
1573
|
|
|
1574
1574
|
// package.json
|
|
1575
1575
|
var package_default = {
|
|
1576
|
-
version: "0.55.
|
|
1576
|
+
version: "0.55.3"};
|
|
1577
1577
|
|
|
1578
1578
|
// src/telemetry/builders.ts
|
|
1579
1579
|
function createCliBaseEvent(context = {}) {
|
|
@@ -3018,6 +3018,30 @@ function getActiveCredentials(options) {
|
|
|
3018
3018
|
if (!name) return void 0;
|
|
3019
3019
|
return findEntry(readRegistry(), name, normalizeBaseUrl(options?.baseUrl));
|
|
3020
3020
|
}
|
|
3021
|
+
var MAX_CREDENTIAL_NAME_ATTEMPTS = 500;
|
|
3022
|
+
function firstAvailableCredentialName({
|
|
3023
|
+
baseName,
|
|
3024
|
+
taken
|
|
3025
|
+
}) {
|
|
3026
|
+
if (!taken.has(baseName)) return baseName;
|
|
3027
|
+
for (let i = 1; i <= MAX_CREDENTIAL_NAME_ATTEMPTS; i++) {
|
|
3028
|
+
const candidate = `${baseName}-${i}`;
|
|
3029
|
+
if (!taken.has(candidate)) return candidate;
|
|
3030
|
+
}
|
|
3031
|
+
throw new ZapierCliValidationError(
|
|
3032
|
+
`Could not find an available credential name for "${baseName}" after ${MAX_CREDENTIAL_NAME_ATTEMPTS} attempts.`
|
|
3033
|
+
);
|
|
3034
|
+
}
|
|
3035
|
+
function resolveAvailableCredentialName({
|
|
3036
|
+
baseName,
|
|
3037
|
+
baseUrl: baseUrl2
|
|
3038
|
+
}) {
|
|
3039
|
+
const resolvedBaseUrl = normalizeBaseUrl(baseUrl2);
|
|
3040
|
+
const taken = new Set(
|
|
3041
|
+
readRegistry().filter((e) => e.baseUrl === resolvedBaseUrl).map((e) => e.name)
|
|
3042
|
+
);
|
|
3043
|
+
return firstAvailableCredentialName({ baseName, taken });
|
|
3044
|
+
}
|
|
3021
3045
|
async function storeClientCredentials({
|
|
3022
3046
|
name,
|
|
3023
3047
|
clientId,
|
|
@@ -4545,11 +4569,11 @@ async function runAccountAuth({
|
|
|
4545
4569
|
console.log(
|
|
4546
4570
|
"\nGenerating credentials so this machine can make authenticated requests on your behalf."
|
|
4547
4571
|
);
|
|
4548
|
-
const
|
|
4549
|
-
email,
|
|
4572
|
+
const baseName = interactive ? await promptCredentialsName({
|
|
4573
|
+
email: profile.email,
|
|
4550
4574
|
promptMessage: getCredentialsPromptMessage(entryPoint)
|
|
4551
|
-
}) : resolveDefaultCredentialsName;
|
|
4552
|
-
const credentialName =
|
|
4575
|
+
}) : resolveDefaultCredentialsName({ email: profile.email });
|
|
4576
|
+
const credentialName = interactive ? baseName : resolveAvailableCredentialName({ baseName, baseUrl: credentialsBaseUrl2 });
|
|
4553
4577
|
const useApprovals = options.useApprovals === true;
|
|
4554
4578
|
await saveClientCredentials({
|
|
4555
4579
|
api: scopedApi,
|
|
@@ -7172,7 +7196,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
|
|
|
7172
7196
|
// package.json with { type: 'json' }
|
|
7173
7197
|
var package_default2 = {
|
|
7174
7198
|
name: "@zapier/zapier-sdk-cli",
|
|
7175
|
-
version: "0.55.
|
|
7199
|
+
version: "0.55.3"};
|
|
7176
7200
|
|
|
7177
7201
|
// src/sdk.ts
|
|
7178
7202
|
zapierSdk.injectCliLogin(login_exports);
|
package/dist/cli.mjs
CHANGED
|
@@ -1531,7 +1531,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
|
|
|
1531
1531
|
|
|
1532
1532
|
// package.json
|
|
1533
1533
|
var package_default = {
|
|
1534
|
-
version: "0.55.
|
|
1534
|
+
version: "0.55.3"};
|
|
1535
1535
|
|
|
1536
1536
|
// src/telemetry/builders.ts
|
|
1537
1537
|
function createCliBaseEvent(context = {}) {
|
|
@@ -2976,6 +2976,30 @@ function getActiveCredentials(options) {
|
|
|
2976
2976
|
if (!name) return void 0;
|
|
2977
2977
|
return findEntry(readRegistry(), name, normalizeBaseUrl(options?.baseUrl));
|
|
2978
2978
|
}
|
|
2979
|
+
var MAX_CREDENTIAL_NAME_ATTEMPTS = 500;
|
|
2980
|
+
function firstAvailableCredentialName({
|
|
2981
|
+
baseName,
|
|
2982
|
+
taken
|
|
2983
|
+
}) {
|
|
2984
|
+
if (!taken.has(baseName)) return baseName;
|
|
2985
|
+
for (let i = 1; i <= MAX_CREDENTIAL_NAME_ATTEMPTS; i++) {
|
|
2986
|
+
const candidate = `${baseName}-${i}`;
|
|
2987
|
+
if (!taken.has(candidate)) return candidate;
|
|
2988
|
+
}
|
|
2989
|
+
throw new ZapierCliValidationError(
|
|
2990
|
+
`Could not find an available credential name for "${baseName}" after ${MAX_CREDENTIAL_NAME_ATTEMPTS} attempts.`
|
|
2991
|
+
);
|
|
2992
|
+
}
|
|
2993
|
+
function resolveAvailableCredentialName({
|
|
2994
|
+
baseName,
|
|
2995
|
+
baseUrl: baseUrl2
|
|
2996
|
+
}) {
|
|
2997
|
+
const resolvedBaseUrl = normalizeBaseUrl(baseUrl2);
|
|
2998
|
+
const taken = new Set(
|
|
2999
|
+
readRegistry().filter((e) => e.baseUrl === resolvedBaseUrl).map((e) => e.name)
|
|
3000
|
+
);
|
|
3001
|
+
return firstAvailableCredentialName({ baseName, taken });
|
|
3002
|
+
}
|
|
2979
3003
|
async function storeClientCredentials({
|
|
2980
3004
|
name,
|
|
2981
3005
|
clientId,
|
|
@@ -4503,11 +4527,11 @@ async function runAccountAuth({
|
|
|
4503
4527
|
console.log(
|
|
4504
4528
|
"\nGenerating credentials so this machine can make authenticated requests on your behalf."
|
|
4505
4529
|
);
|
|
4506
|
-
const
|
|
4507
|
-
email,
|
|
4530
|
+
const baseName = interactive ? await promptCredentialsName({
|
|
4531
|
+
email: profile.email,
|
|
4508
4532
|
promptMessage: getCredentialsPromptMessage(entryPoint)
|
|
4509
|
-
}) : resolveDefaultCredentialsName;
|
|
4510
|
-
const credentialName =
|
|
4533
|
+
}) : resolveDefaultCredentialsName({ email: profile.email });
|
|
4534
|
+
const credentialName = interactive ? baseName : resolveAvailableCredentialName({ baseName, baseUrl: credentialsBaseUrl2 });
|
|
4511
4535
|
const useApprovals = options.useApprovals === true;
|
|
4512
4536
|
await saveClientCredentials({
|
|
4513
4537
|
api: scopedApi,
|
|
@@ -7130,7 +7154,7 @@ var watchTriggerInboxCliPlugin = definePlugin(
|
|
|
7130
7154
|
// package.json with { type: 'json' }
|
|
7131
7155
|
var package_default2 = {
|
|
7132
7156
|
name: "@zapier/zapier-sdk-cli",
|
|
7133
|
-
version: "0.55.
|
|
7157
|
+
version: "0.55.3"};
|
|
7134
7158
|
|
|
7135
7159
|
// src/sdk.ts
|
|
7136
7160
|
injectCliLogin(login_exports);
|
package/dist/experimental.cjs
CHANGED
|
@@ -326,6 +326,34 @@ function createCache() {
|
|
|
326
326
|
}
|
|
327
327
|
};
|
|
328
328
|
}
|
|
329
|
+
var ZapierCliError = class extends zapierSdk.ZapierError {
|
|
330
|
+
};
|
|
331
|
+
var ZapierCliUserCancellationError = class extends ZapierCliError {
|
|
332
|
+
constructor(message = "Operation cancelled by user") {
|
|
333
|
+
super(message);
|
|
334
|
+
this.name = "ZapierCliUserCancellationError";
|
|
335
|
+
this.code = "ZAPIER_CLI_USER_CANCELLATION";
|
|
336
|
+
this.exitCode = 0;
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
var ZapierCliExitError = class extends ZapierCliError {
|
|
340
|
+
constructor(message, exitCode = 1) {
|
|
341
|
+
super(message);
|
|
342
|
+
this.name = "ZapierCliExitError";
|
|
343
|
+
this.code = "ZAPIER_CLI_EXIT";
|
|
344
|
+
this.exitCode = exitCode;
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
var ZapierCliValidationError = class extends ZapierCliError {
|
|
348
|
+
constructor(message) {
|
|
349
|
+
super(message);
|
|
350
|
+
this.name = "ZapierCliValidationError";
|
|
351
|
+
this.code = "ZAPIER_CLI_VALIDATION_ERROR";
|
|
352
|
+
this.exitCode = 1;
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
// src/login/credentials-store.ts
|
|
329
357
|
var SERVICE3 = "zapier-sdk-cli";
|
|
330
358
|
var CREDENTIALS_KEY = "credentials";
|
|
331
359
|
var REGISTRY_KEY = "credentialsRegistry";
|
|
@@ -362,6 +390,30 @@ function getActiveCredentials(options) {
|
|
|
362
390
|
if (!name) return void 0;
|
|
363
391
|
return findEntry(readRegistry(), name, normalizeBaseUrl(options?.baseUrl));
|
|
364
392
|
}
|
|
393
|
+
var MAX_CREDENTIAL_NAME_ATTEMPTS = 500;
|
|
394
|
+
function firstAvailableCredentialName({
|
|
395
|
+
baseName,
|
|
396
|
+
taken
|
|
397
|
+
}) {
|
|
398
|
+
if (!taken.has(baseName)) return baseName;
|
|
399
|
+
for (let i = 1; i <= MAX_CREDENTIAL_NAME_ATTEMPTS; i++) {
|
|
400
|
+
const candidate = `${baseName}-${i}`;
|
|
401
|
+
if (!taken.has(candidate)) return candidate;
|
|
402
|
+
}
|
|
403
|
+
throw new ZapierCliValidationError(
|
|
404
|
+
`Could not find an available credential name for "${baseName}" after ${MAX_CREDENTIAL_NAME_ATTEMPTS} attempts.`
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
function resolveAvailableCredentialName({
|
|
408
|
+
baseName,
|
|
409
|
+
baseUrl
|
|
410
|
+
}) {
|
|
411
|
+
const resolvedBaseUrl = normalizeBaseUrl(baseUrl);
|
|
412
|
+
const taken = new Set(
|
|
413
|
+
readRegistry().filter((e) => e.baseUrl === resolvedBaseUrl).map((e) => e.name)
|
|
414
|
+
);
|
|
415
|
+
return firstAvailableCredentialName({ baseName, taken });
|
|
416
|
+
}
|
|
365
417
|
async function storeClientCredentials({
|
|
366
418
|
name,
|
|
367
419
|
clientId,
|
|
@@ -928,32 +980,6 @@ async function resolveCredentialsBaseUrl(context) {
|
|
|
928
980
|
function resolveNonInteractive(options) {
|
|
929
981
|
return options.nonInteractive === true || options.skipPrompts === true || !process.stdin.isTTY || !process.stdout.isTTY;
|
|
930
982
|
}
|
|
931
|
-
var ZapierCliError = class extends zapierSdk.ZapierError {
|
|
932
|
-
};
|
|
933
|
-
var ZapierCliUserCancellationError = class extends ZapierCliError {
|
|
934
|
-
constructor(message = "Operation cancelled by user") {
|
|
935
|
-
super(message);
|
|
936
|
-
this.name = "ZapierCliUserCancellationError";
|
|
937
|
-
this.code = "ZAPIER_CLI_USER_CANCELLATION";
|
|
938
|
-
this.exitCode = 0;
|
|
939
|
-
}
|
|
940
|
-
};
|
|
941
|
-
var ZapierCliExitError = class extends ZapierCliError {
|
|
942
|
-
constructor(message, exitCode = 1) {
|
|
943
|
-
super(message);
|
|
944
|
-
this.name = "ZapierCliExitError";
|
|
945
|
-
this.code = "ZAPIER_CLI_EXIT";
|
|
946
|
-
this.exitCode = exitCode;
|
|
947
|
-
}
|
|
948
|
-
};
|
|
949
|
-
var ZapierCliValidationError = class extends ZapierCliError {
|
|
950
|
-
constructor(message) {
|
|
951
|
-
super(message);
|
|
952
|
-
this.name = "ZapierCliValidationError";
|
|
953
|
-
this.code = "ZAPIER_CLI_VALIDATION_ERROR";
|
|
954
|
-
this.exitCode = 1;
|
|
955
|
-
}
|
|
956
|
-
};
|
|
957
983
|
|
|
958
984
|
// src/utils/auth/client-credentials.ts
|
|
959
985
|
var CREDENTIALS_SCOPES = ["external", "credentials"];
|
|
@@ -1915,11 +1941,11 @@ async function runAccountAuth({
|
|
|
1915
1941
|
console.log(
|
|
1916
1942
|
"\nGenerating credentials so this machine can make authenticated requests on your behalf."
|
|
1917
1943
|
);
|
|
1918
|
-
const
|
|
1919
|
-
email,
|
|
1944
|
+
const baseName = interactive ? await promptCredentialsName({
|
|
1945
|
+
email: profile.email,
|
|
1920
1946
|
promptMessage: getCredentialsPromptMessage(entryPoint)
|
|
1921
|
-
}) : resolveDefaultCredentialsName;
|
|
1922
|
-
const credentialName =
|
|
1947
|
+
}) : resolveDefaultCredentialsName({ email: profile.email });
|
|
1948
|
+
const credentialName = interactive ? baseName : resolveAvailableCredentialName({ baseName, baseUrl: credentialsBaseUrl });
|
|
1923
1949
|
const useApprovals = options.useApprovals === true;
|
|
1924
1950
|
await saveClientCredentials({
|
|
1925
1951
|
api: scopedApi,
|
|
@@ -4525,7 +4551,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
|
|
|
4525
4551
|
// package.json with { type: 'json' }
|
|
4526
4552
|
var package_default = {
|
|
4527
4553
|
name: "@zapier/zapier-sdk-cli",
|
|
4528
|
-
version: "0.55.
|
|
4554
|
+
version: "0.55.3"};
|
|
4529
4555
|
|
|
4530
4556
|
// src/experimental.ts
|
|
4531
4557
|
experimental.injectCliLogin(login_exports);
|
package/dist/experimental.mjs
CHANGED
|
@@ -290,6 +290,34 @@ function createCache() {
|
|
|
290
290
|
}
|
|
291
291
|
};
|
|
292
292
|
}
|
|
293
|
+
var ZapierCliError = class extends ZapierError {
|
|
294
|
+
};
|
|
295
|
+
var ZapierCliUserCancellationError = class extends ZapierCliError {
|
|
296
|
+
constructor(message = "Operation cancelled by user") {
|
|
297
|
+
super(message);
|
|
298
|
+
this.name = "ZapierCliUserCancellationError";
|
|
299
|
+
this.code = "ZAPIER_CLI_USER_CANCELLATION";
|
|
300
|
+
this.exitCode = 0;
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
var ZapierCliExitError = class extends ZapierCliError {
|
|
304
|
+
constructor(message, exitCode = 1) {
|
|
305
|
+
super(message);
|
|
306
|
+
this.name = "ZapierCliExitError";
|
|
307
|
+
this.code = "ZAPIER_CLI_EXIT";
|
|
308
|
+
this.exitCode = exitCode;
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
var ZapierCliValidationError = class extends ZapierCliError {
|
|
312
|
+
constructor(message) {
|
|
313
|
+
super(message);
|
|
314
|
+
this.name = "ZapierCliValidationError";
|
|
315
|
+
this.code = "ZAPIER_CLI_VALIDATION_ERROR";
|
|
316
|
+
this.exitCode = 1;
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
// src/login/credentials-store.ts
|
|
293
321
|
var SERVICE3 = "zapier-sdk-cli";
|
|
294
322
|
var CREDENTIALS_KEY = "credentials";
|
|
295
323
|
var REGISTRY_KEY = "credentialsRegistry";
|
|
@@ -326,6 +354,30 @@ function getActiveCredentials(options) {
|
|
|
326
354
|
if (!name) return void 0;
|
|
327
355
|
return findEntry(readRegistry(), name, normalizeBaseUrl(options?.baseUrl));
|
|
328
356
|
}
|
|
357
|
+
var MAX_CREDENTIAL_NAME_ATTEMPTS = 500;
|
|
358
|
+
function firstAvailableCredentialName({
|
|
359
|
+
baseName,
|
|
360
|
+
taken
|
|
361
|
+
}) {
|
|
362
|
+
if (!taken.has(baseName)) return baseName;
|
|
363
|
+
for (let i = 1; i <= MAX_CREDENTIAL_NAME_ATTEMPTS; i++) {
|
|
364
|
+
const candidate = `${baseName}-${i}`;
|
|
365
|
+
if (!taken.has(candidate)) return candidate;
|
|
366
|
+
}
|
|
367
|
+
throw new ZapierCliValidationError(
|
|
368
|
+
`Could not find an available credential name for "${baseName}" after ${MAX_CREDENTIAL_NAME_ATTEMPTS} attempts.`
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
function resolveAvailableCredentialName({
|
|
372
|
+
baseName,
|
|
373
|
+
baseUrl
|
|
374
|
+
}) {
|
|
375
|
+
const resolvedBaseUrl = normalizeBaseUrl(baseUrl);
|
|
376
|
+
const taken = new Set(
|
|
377
|
+
readRegistry().filter((e) => e.baseUrl === resolvedBaseUrl).map((e) => e.name)
|
|
378
|
+
);
|
|
379
|
+
return firstAvailableCredentialName({ baseName, taken });
|
|
380
|
+
}
|
|
329
381
|
async function storeClientCredentials({
|
|
330
382
|
name,
|
|
331
383
|
clientId,
|
|
@@ -892,32 +944,6 @@ async function resolveCredentialsBaseUrl(context) {
|
|
|
892
944
|
function resolveNonInteractive(options) {
|
|
893
945
|
return options.nonInteractive === true || options.skipPrompts === true || !process.stdin.isTTY || !process.stdout.isTTY;
|
|
894
946
|
}
|
|
895
|
-
var ZapierCliError = class extends ZapierError {
|
|
896
|
-
};
|
|
897
|
-
var ZapierCliUserCancellationError = class extends ZapierCliError {
|
|
898
|
-
constructor(message = "Operation cancelled by user") {
|
|
899
|
-
super(message);
|
|
900
|
-
this.name = "ZapierCliUserCancellationError";
|
|
901
|
-
this.code = "ZAPIER_CLI_USER_CANCELLATION";
|
|
902
|
-
this.exitCode = 0;
|
|
903
|
-
}
|
|
904
|
-
};
|
|
905
|
-
var ZapierCliExitError = class extends ZapierCliError {
|
|
906
|
-
constructor(message, exitCode = 1) {
|
|
907
|
-
super(message);
|
|
908
|
-
this.name = "ZapierCliExitError";
|
|
909
|
-
this.code = "ZAPIER_CLI_EXIT";
|
|
910
|
-
this.exitCode = exitCode;
|
|
911
|
-
}
|
|
912
|
-
};
|
|
913
|
-
var ZapierCliValidationError = class extends ZapierCliError {
|
|
914
|
-
constructor(message) {
|
|
915
|
-
super(message);
|
|
916
|
-
this.name = "ZapierCliValidationError";
|
|
917
|
-
this.code = "ZAPIER_CLI_VALIDATION_ERROR";
|
|
918
|
-
this.exitCode = 1;
|
|
919
|
-
}
|
|
920
|
-
};
|
|
921
947
|
|
|
922
948
|
// src/utils/auth/client-credentials.ts
|
|
923
949
|
var CREDENTIALS_SCOPES = ["external", "credentials"];
|
|
@@ -1879,11 +1905,11 @@ async function runAccountAuth({
|
|
|
1879
1905
|
console.log(
|
|
1880
1906
|
"\nGenerating credentials so this machine can make authenticated requests on your behalf."
|
|
1881
1907
|
);
|
|
1882
|
-
const
|
|
1883
|
-
email,
|
|
1908
|
+
const baseName = interactive ? await promptCredentialsName({
|
|
1909
|
+
email: profile.email,
|
|
1884
1910
|
promptMessage: getCredentialsPromptMessage(entryPoint)
|
|
1885
|
-
}) : resolveDefaultCredentialsName;
|
|
1886
|
-
const credentialName =
|
|
1911
|
+
}) : resolveDefaultCredentialsName({ email: profile.email });
|
|
1912
|
+
const credentialName = interactive ? baseName : resolveAvailableCredentialName({ baseName, baseUrl: credentialsBaseUrl });
|
|
1887
1913
|
const useApprovals = options.useApprovals === true;
|
|
1888
1914
|
await saveClientCredentials({
|
|
1889
1915
|
api: scopedApi,
|
|
@@ -4489,7 +4515,7 @@ var watchTriggerInboxCliPlugin = definePlugin(
|
|
|
4489
4515
|
// package.json with { type: 'json' }
|
|
4490
4516
|
var package_default = {
|
|
4491
4517
|
name: "@zapier/zapier-sdk-cli",
|
|
4492
|
-
version: "0.55.
|
|
4518
|
+
version: "0.55.3"};
|
|
4493
4519
|
|
|
4494
4520
|
// src/experimental.ts
|
|
4495
4521
|
injectCliLogin(login_exports);
|
package/dist/index.cjs
CHANGED
|
@@ -325,6 +325,34 @@ function createCache() {
|
|
|
325
325
|
}
|
|
326
326
|
};
|
|
327
327
|
}
|
|
328
|
+
var ZapierCliError = class extends zapierSdk.ZapierError {
|
|
329
|
+
};
|
|
330
|
+
var ZapierCliUserCancellationError = class extends ZapierCliError {
|
|
331
|
+
constructor(message = "Operation cancelled by user") {
|
|
332
|
+
super(message);
|
|
333
|
+
this.name = "ZapierCliUserCancellationError";
|
|
334
|
+
this.code = "ZAPIER_CLI_USER_CANCELLATION";
|
|
335
|
+
this.exitCode = 0;
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
var ZapierCliExitError = class extends ZapierCliError {
|
|
339
|
+
constructor(message, exitCode = 1) {
|
|
340
|
+
super(message);
|
|
341
|
+
this.name = "ZapierCliExitError";
|
|
342
|
+
this.code = "ZAPIER_CLI_EXIT";
|
|
343
|
+
this.exitCode = exitCode;
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
var ZapierCliValidationError = class extends ZapierCliError {
|
|
347
|
+
constructor(message) {
|
|
348
|
+
super(message);
|
|
349
|
+
this.name = "ZapierCliValidationError";
|
|
350
|
+
this.code = "ZAPIER_CLI_VALIDATION_ERROR";
|
|
351
|
+
this.exitCode = 1;
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
// src/login/credentials-store.ts
|
|
328
356
|
var SERVICE3 = "zapier-sdk-cli";
|
|
329
357
|
var CREDENTIALS_KEY = "credentials";
|
|
330
358
|
var REGISTRY_KEY = "credentialsRegistry";
|
|
@@ -361,6 +389,30 @@ function getActiveCredentials(options) {
|
|
|
361
389
|
if (!name) return void 0;
|
|
362
390
|
return findEntry(readRegistry(), name, normalizeBaseUrl(options?.baseUrl));
|
|
363
391
|
}
|
|
392
|
+
var MAX_CREDENTIAL_NAME_ATTEMPTS = 500;
|
|
393
|
+
function firstAvailableCredentialName({
|
|
394
|
+
baseName,
|
|
395
|
+
taken
|
|
396
|
+
}) {
|
|
397
|
+
if (!taken.has(baseName)) return baseName;
|
|
398
|
+
for (let i = 1; i <= MAX_CREDENTIAL_NAME_ATTEMPTS; i++) {
|
|
399
|
+
const candidate = `${baseName}-${i}`;
|
|
400
|
+
if (!taken.has(candidate)) return candidate;
|
|
401
|
+
}
|
|
402
|
+
throw new ZapierCliValidationError(
|
|
403
|
+
`Could not find an available credential name for "${baseName}" after ${MAX_CREDENTIAL_NAME_ATTEMPTS} attempts.`
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
function resolveAvailableCredentialName({
|
|
407
|
+
baseName,
|
|
408
|
+
baseUrl
|
|
409
|
+
}) {
|
|
410
|
+
const resolvedBaseUrl = normalizeBaseUrl(baseUrl);
|
|
411
|
+
const taken = new Set(
|
|
412
|
+
readRegistry().filter((e) => e.baseUrl === resolvedBaseUrl).map((e) => e.name)
|
|
413
|
+
);
|
|
414
|
+
return firstAvailableCredentialName({ baseName, taken });
|
|
415
|
+
}
|
|
364
416
|
async function storeClientCredentials({
|
|
365
417
|
name,
|
|
366
418
|
clientId,
|
|
@@ -927,32 +979,6 @@ async function resolveCredentialsBaseUrl(context) {
|
|
|
927
979
|
function resolveNonInteractive(options) {
|
|
928
980
|
return options.nonInteractive === true || options.skipPrompts === true || !process.stdin.isTTY || !process.stdout.isTTY;
|
|
929
981
|
}
|
|
930
|
-
var ZapierCliError = class extends zapierSdk.ZapierError {
|
|
931
|
-
};
|
|
932
|
-
var ZapierCliUserCancellationError = class extends ZapierCliError {
|
|
933
|
-
constructor(message = "Operation cancelled by user") {
|
|
934
|
-
super(message);
|
|
935
|
-
this.name = "ZapierCliUserCancellationError";
|
|
936
|
-
this.code = "ZAPIER_CLI_USER_CANCELLATION";
|
|
937
|
-
this.exitCode = 0;
|
|
938
|
-
}
|
|
939
|
-
};
|
|
940
|
-
var ZapierCliExitError = class extends ZapierCliError {
|
|
941
|
-
constructor(message, exitCode = 1) {
|
|
942
|
-
super(message);
|
|
943
|
-
this.name = "ZapierCliExitError";
|
|
944
|
-
this.code = "ZAPIER_CLI_EXIT";
|
|
945
|
-
this.exitCode = exitCode;
|
|
946
|
-
}
|
|
947
|
-
};
|
|
948
|
-
var ZapierCliValidationError = class extends ZapierCliError {
|
|
949
|
-
constructor(message) {
|
|
950
|
-
super(message);
|
|
951
|
-
this.name = "ZapierCliValidationError";
|
|
952
|
-
this.code = "ZAPIER_CLI_VALIDATION_ERROR";
|
|
953
|
-
this.exitCode = 1;
|
|
954
|
-
}
|
|
955
|
-
};
|
|
956
982
|
|
|
957
983
|
// src/utils/auth/client-credentials.ts
|
|
958
984
|
var CREDENTIALS_SCOPES = ["external", "credentials"];
|
|
@@ -1914,11 +1940,11 @@ async function runAccountAuth({
|
|
|
1914
1940
|
console.log(
|
|
1915
1941
|
"\nGenerating credentials so this machine can make authenticated requests on your behalf."
|
|
1916
1942
|
);
|
|
1917
|
-
const
|
|
1918
|
-
email,
|
|
1943
|
+
const baseName = interactive ? await promptCredentialsName({
|
|
1944
|
+
email: profile.email,
|
|
1919
1945
|
promptMessage: getCredentialsPromptMessage(entryPoint)
|
|
1920
|
-
}) : resolveDefaultCredentialsName;
|
|
1921
|
-
const credentialName =
|
|
1946
|
+
}) : resolveDefaultCredentialsName({ email: profile.email });
|
|
1947
|
+
const credentialName = interactive ? baseName : resolveAvailableCredentialName({ baseName, baseUrl: credentialsBaseUrl });
|
|
1922
1948
|
const useApprovals = options.useApprovals === true;
|
|
1923
1949
|
await saveClientCredentials({
|
|
1924
1950
|
api: scopedApi,
|
|
@@ -4524,7 +4550,7 @@ zapierSdk.definePlugin(
|
|
|
4524
4550
|
// package.json with { type: 'json' }
|
|
4525
4551
|
var package_default = {
|
|
4526
4552
|
name: "@zapier/zapier-sdk-cli",
|
|
4527
|
-
version: "0.55.
|
|
4553
|
+
version: "0.55.3"};
|
|
4528
4554
|
|
|
4529
4555
|
// src/sdk.ts
|
|
4530
4556
|
zapierSdk.injectCliLogin(login_exports);
|
|
@@ -4552,7 +4578,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
4552
4578
|
|
|
4553
4579
|
// package.json
|
|
4554
4580
|
var package_default2 = {
|
|
4555
|
-
version: "0.55.
|
|
4581
|
+
version: "0.55.3"};
|
|
4556
4582
|
|
|
4557
4583
|
// src/telemetry/builders.ts
|
|
4558
4584
|
function createCliBaseEvent(context = {}) {
|
package/dist/index.mjs
CHANGED
|
@@ -289,6 +289,34 @@ function createCache() {
|
|
|
289
289
|
}
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
|
+
var ZapierCliError = class extends ZapierError {
|
|
293
|
+
};
|
|
294
|
+
var ZapierCliUserCancellationError = class extends ZapierCliError {
|
|
295
|
+
constructor(message = "Operation cancelled by user") {
|
|
296
|
+
super(message);
|
|
297
|
+
this.name = "ZapierCliUserCancellationError";
|
|
298
|
+
this.code = "ZAPIER_CLI_USER_CANCELLATION";
|
|
299
|
+
this.exitCode = 0;
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
var ZapierCliExitError = class extends ZapierCliError {
|
|
303
|
+
constructor(message, exitCode = 1) {
|
|
304
|
+
super(message);
|
|
305
|
+
this.name = "ZapierCliExitError";
|
|
306
|
+
this.code = "ZAPIER_CLI_EXIT";
|
|
307
|
+
this.exitCode = exitCode;
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
var ZapierCliValidationError = class extends ZapierCliError {
|
|
311
|
+
constructor(message) {
|
|
312
|
+
super(message);
|
|
313
|
+
this.name = "ZapierCliValidationError";
|
|
314
|
+
this.code = "ZAPIER_CLI_VALIDATION_ERROR";
|
|
315
|
+
this.exitCode = 1;
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
// src/login/credentials-store.ts
|
|
292
320
|
var SERVICE3 = "zapier-sdk-cli";
|
|
293
321
|
var CREDENTIALS_KEY = "credentials";
|
|
294
322
|
var REGISTRY_KEY = "credentialsRegistry";
|
|
@@ -325,6 +353,30 @@ function getActiveCredentials(options) {
|
|
|
325
353
|
if (!name) return void 0;
|
|
326
354
|
return findEntry(readRegistry(), name, normalizeBaseUrl(options?.baseUrl));
|
|
327
355
|
}
|
|
356
|
+
var MAX_CREDENTIAL_NAME_ATTEMPTS = 500;
|
|
357
|
+
function firstAvailableCredentialName({
|
|
358
|
+
baseName,
|
|
359
|
+
taken
|
|
360
|
+
}) {
|
|
361
|
+
if (!taken.has(baseName)) return baseName;
|
|
362
|
+
for (let i = 1; i <= MAX_CREDENTIAL_NAME_ATTEMPTS; i++) {
|
|
363
|
+
const candidate = `${baseName}-${i}`;
|
|
364
|
+
if (!taken.has(candidate)) return candidate;
|
|
365
|
+
}
|
|
366
|
+
throw new ZapierCliValidationError(
|
|
367
|
+
`Could not find an available credential name for "${baseName}" after ${MAX_CREDENTIAL_NAME_ATTEMPTS} attempts.`
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
function resolveAvailableCredentialName({
|
|
371
|
+
baseName,
|
|
372
|
+
baseUrl
|
|
373
|
+
}) {
|
|
374
|
+
const resolvedBaseUrl = normalizeBaseUrl(baseUrl);
|
|
375
|
+
const taken = new Set(
|
|
376
|
+
readRegistry().filter((e) => e.baseUrl === resolvedBaseUrl).map((e) => e.name)
|
|
377
|
+
);
|
|
378
|
+
return firstAvailableCredentialName({ baseName, taken });
|
|
379
|
+
}
|
|
328
380
|
async function storeClientCredentials({
|
|
329
381
|
name,
|
|
330
382
|
clientId,
|
|
@@ -891,32 +943,6 @@ async function resolveCredentialsBaseUrl(context) {
|
|
|
891
943
|
function resolveNonInteractive(options) {
|
|
892
944
|
return options.nonInteractive === true || options.skipPrompts === true || !process.stdin.isTTY || !process.stdout.isTTY;
|
|
893
945
|
}
|
|
894
|
-
var ZapierCliError = class extends ZapierError {
|
|
895
|
-
};
|
|
896
|
-
var ZapierCliUserCancellationError = class extends ZapierCliError {
|
|
897
|
-
constructor(message = "Operation cancelled by user") {
|
|
898
|
-
super(message);
|
|
899
|
-
this.name = "ZapierCliUserCancellationError";
|
|
900
|
-
this.code = "ZAPIER_CLI_USER_CANCELLATION";
|
|
901
|
-
this.exitCode = 0;
|
|
902
|
-
}
|
|
903
|
-
};
|
|
904
|
-
var ZapierCliExitError = class extends ZapierCliError {
|
|
905
|
-
constructor(message, exitCode = 1) {
|
|
906
|
-
super(message);
|
|
907
|
-
this.name = "ZapierCliExitError";
|
|
908
|
-
this.code = "ZAPIER_CLI_EXIT";
|
|
909
|
-
this.exitCode = exitCode;
|
|
910
|
-
}
|
|
911
|
-
};
|
|
912
|
-
var ZapierCliValidationError = class extends ZapierCliError {
|
|
913
|
-
constructor(message) {
|
|
914
|
-
super(message);
|
|
915
|
-
this.name = "ZapierCliValidationError";
|
|
916
|
-
this.code = "ZAPIER_CLI_VALIDATION_ERROR";
|
|
917
|
-
this.exitCode = 1;
|
|
918
|
-
}
|
|
919
|
-
};
|
|
920
946
|
|
|
921
947
|
// src/utils/auth/client-credentials.ts
|
|
922
948
|
var CREDENTIALS_SCOPES = ["external", "credentials"];
|
|
@@ -1878,11 +1904,11 @@ async function runAccountAuth({
|
|
|
1878
1904
|
console.log(
|
|
1879
1905
|
"\nGenerating credentials so this machine can make authenticated requests on your behalf."
|
|
1880
1906
|
);
|
|
1881
|
-
const
|
|
1882
|
-
email,
|
|
1907
|
+
const baseName = interactive ? await promptCredentialsName({
|
|
1908
|
+
email: profile.email,
|
|
1883
1909
|
promptMessage: getCredentialsPromptMessage(entryPoint)
|
|
1884
|
-
}) : resolveDefaultCredentialsName;
|
|
1885
|
-
const credentialName =
|
|
1910
|
+
}) : resolveDefaultCredentialsName({ email: profile.email });
|
|
1911
|
+
const credentialName = interactive ? baseName : resolveAvailableCredentialName({ baseName, baseUrl: credentialsBaseUrl });
|
|
1886
1912
|
const useApprovals = options.useApprovals === true;
|
|
1887
1913
|
await saveClientCredentials({
|
|
1888
1914
|
api: scopedApi,
|
|
@@ -4488,7 +4514,7 @@ definePlugin(
|
|
|
4488
4514
|
// package.json with { type: 'json' }
|
|
4489
4515
|
var package_default = {
|
|
4490
4516
|
name: "@zapier/zapier-sdk-cli",
|
|
4491
|
-
version: "0.55.
|
|
4517
|
+
version: "0.55.3"};
|
|
4492
4518
|
|
|
4493
4519
|
// src/sdk.ts
|
|
4494
4520
|
injectCliLogin(login_exports);
|
|
@@ -4516,7 +4542,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
4516
4542
|
|
|
4517
4543
|
// package.json
|
|
4518
4544
|
var package_default2 = {
|
|
4519
|
-
version: "0.55.
|
|
4545
|
+
version: "0.55.3"};
|
|
4520
4546
|
|
|
4521
4547
|
// src/telemetry/builders.ts
|
|
4522
4548
|
function createCliBaseEvent(context = {}) {
|
package/dist/login.cjs
CHANGED
package/dist/login.mjs
CHANGED