@zapier/zapier-sdk-cli 0.55.3 → 0.55.5
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 +16 -0
- package/README.md +2 -1
- package/dist/cli.cjs +47 -6
- package/dist/cli.mjs +48 -7
- package/dist/experimental.cjs +44 -5
- package/dist/experimental.mjs +44 -5
- package/dist/index.cjs +47 -6
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +48 -7
- package/dist/package.json +1 -1
- package/dist/src/login/credentials-store.d.ts +9 -0
- package/dist/src/login/credentials-store.js +9 -0
- package/dist/src/plugins/login/index.d.ts +1 -0
- package/dist/src/plugins/login/schemas.d.ts +1 -0
- package/dist/src/plugins/login/schemas.js +4 -0
- package/dist/src/telemetry/builders.js +3 -1
- package/dist/src/telemetry/events.d.ts +3 -0
- package/dist/src/utils/auth/account-auth.d.ts +1 -0
- package/dist/src/utils/auth/account-auth.js +41 -12
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @zapier/zapier-sdk-cli
|
|
2
2
|
|
|
3
|
+
## 0.55.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- aca0385: `login` now accepts a `--name` flag to label credentials without the interactive prompt — useful in CI and non-interactive environments. After trimming, the provided name is honored as given in both interactive and non-interactive modes — it is never auto-suffixed.
|
|
8
|
+
|
|
9
|
+
## 0.55.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- b83f0b6: Add TTY and agent caller context to SDK telemetry events
|
|
14
|
+
- Updated dependencies [b83f0b6]
|
|
15
|
+
- Updated dependencies [3fa4bbe]
|
|
16
|
+
- @zapier/zapier-sdk@0.70.3
|
|
17
|
+
- @zapier/zapier-sdk-mcp@0.13.31
|
|
18
|
+
|
|
3
19
|
## 0.55.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -200,6 +200,7 @@ Log in to Zapier to access your account
|
|
|
200
200
|
|
|
201
201
|
| Option | Type | Required | Default | Possible Values | Description |
|
|
202
202
|
| ------------------- | --------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
203
|
+
| `--name` | `string` | ❌ | — | — | Name to identify these credentials (defaults to <email>@<hostname>). Provide this to set a custom name without the interactive prompt. |
|
|
203
204
|
| `--timeout` | `string` | ❌ | — | — | Login timeout in seconds (default: 300) |
|
|
204
205
|
| `--use-approvals` | `boolean` | ❌ | — | — | Require approvals for actions performed with these credentials |
|
|
205
206
|
| `--non-interactive` | `boolean` | ❌ | — | — | Skip interactive prompts. Uses defaults where possible; errors instead of prompting when input is required. Useful in CI, piped output, or environments where TTY detection is unreliable. |
|
|
@@ -207,7 +208,7 @@ Log in to Zapier to access your account
|
|
|
207
208
|
**Usage:**
|
|
208
209
|
|
|
209
210
|
```bash
|
|
210
|
-
npx zapier-sdk login [--timeout] [--use-approvals] [--non-interactive]
|
|
211
|
+
npx zapier-sdk login [--name] [--timeout] [--use-approvals] [--non-interactive]
|
|
211
212
|
```
|
|
212
213
|
|
|
213
214
|
#### `logout`
|
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.5"};
|
|
1577
1577
|
|
|
1578
1578
|
// src/telemetry/builders.ts
|
|
1579
1579
|
function createCliBaseEvent(context = {}) {
|
|
@@ -1617,6 +1617,8 @@ function buildCliCommandExecutedEvent({
|
|
|
1617
1617
|
requires_auth: null,
|
|
1618
1618
|
is_ci_environment: zapierSdk.isCi(),
|
|
1619
1619
|
ci_platform: zapierSdk.getCiPlatform(),
|
|
1620
|
+
...zapierSdk.getTtyContext(),
|
|
1621
|
+
agent: zapierSdk.getAgent(),
|
|
1620
1622
|
package_manager: data.package_manager ?? "pnpm",
|
|
1621
1623
|
// Default based on project setup
|
|
1622
1624
|
made_network_requests: data.made_network_requests ?? null,
|
|
@@ -3042,6 +3044,15 @@ function resolveAvailableCredentialName({
|
|
|
3042
3044
|
);
|
|
3043
3045
|
return firstAvailableCredentialName({ baseName, taken });
|
|
3044
3046
|
}
|
|
3047
|
+
function credentialNameExists({
|
|
3048
|
+
name,
|
|
3049
|
+
baseUrl: baseUrl2
|
|
3050
|
+
}) {
|
|
3051
|
+
const resolvedBaseUrl = normalizeBaseUrl(baseUrl2);
|
|
3052
|
+
return readRegistry().some(
|
|
3053
|
+
(e) => e.name === name && e.baseUrl === resolvedBaseUrl
|
|
3054
|
+
);
|
|
3055
|
+
}
|
|
3045
3056
|
async function storeClientCredentials({
|
|
3046
3057
|
name,
|
|
3047
3058
|
clientId,
|
|
@@ -4347,6 +4358,21 @@ function resolveDefaultCredentialsName({
|
|
|
4347
4358
|
}) {
|
|
4348
4359
|
return validateCredentialsName(defaultCredentialsName(email));
|
|
4349
4360
|
}
|
|
4361
|
+
async function resolveCredentialName({
|
|
4362
|
+
email,
|
|
4363
|
+
interactive,
|
|
4364
|
+
baseUrl: baseUrl2,
|
|
4365
|
+
entryPoint
|
|
4366
|
+
}) {
|
|
4367
|
+
if (interactive) {
|
|
4368
|
+
return promptCredentialsName({
|
|
4369
|
+
email,
|
|
4370
|
+
promptMessage: getCredentialsPromptMessage(entryPoint)
|
|
4371
|
+
});
|
|
4372
|
+
}
|
|
4373
|
+
const baseName = resolveDefaultCredentialsName({ email });
|
|
4374
|
+
return resolveAvailableCredentialName({ baseName, baseUrl: baseUrl2 });
|
|
4375
|
+
}
|
|
4350
4376
|
function toPkceCredentials(credentials2) {
|
|
4351
4377
|
if (credentials2 && zapierSdk.isCredentialsObject(credentials2) && !("clientSecret" in credentials2)) {
|
|
4352
4378
|
return {
|
|
@@ -4543,6 +4569,17 @@ async function runAccountAuth({
|
|
|
4543
4569
|
...sdk.context,
|
|
4544
4570
|
resolvedCredentials
|
|
4545
4571
|
});
|
|
4572
|
+
const providedName = options.name !== void 0 ? validateCredentialsName(options.name) : void 0;
|
|
4573
|
+
if (providedName !== void 0) {
|
|
4574
|
+
const activeCredentials = getActiveCredentials({
|
|
4575
|
+
baseUrl: credentialsBaseUrl2
|
|
4576
|
+
});
|
|
4577
|
+
if (activeCredentials?.name !== providedName && credentialNameExists({ name: providedName, baseUrl: credentialsBaseUrl2 })) {
|
|
4578
|
+
throw new ZapierCliValidationError(
|
|
4579
|
+
`A credential named "${providedName}" already exists. Choose a different --name.`
|
|
4580
|
+
);
|
|
4581
|
+
}
|
|
4582
|
+
}
|
|
4546
4583
|
if (!await clearExistingAuthState({
|
|
4547
4584
|
sdk,
|
|
4548
4585
|
baseUrl: credentialsBaseUrl2,
|
|
@@ -4569,11 +4606,12 @@ async function runAccountAuth({
|
|
|
4569
4606
|
console.log(
|
|
4570
4607
|
"\nGenerating credentials so this machine can make authenticated requests on your behalf."
|
|
4571
4608
|
);
|
|
4572
|
-
const
|
|
4609
|
+
const credentialName = providedName ?? await resolveCredentialName({
|
|
4573
4610
|
email: profile.email,
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4611
|
+
interactive,
|
|
4612
|
+
baseUrl: credentialsBaseUrl2,
|
|
4613
|
+
entryPoint
|
|
4614
|
+
});
|
|
4577
4615
|
const useApprovals = options.useApprovals === true;
|
|
4578
4616
|
await saveClientCredentials({
|
|
4579
4617
|
api: scopedApi,
|
|
@@ -4591,6 +4629,9 @@ async function runAccountAuth({
|
|
|
4591
4629
|
emitAccountAuthSuccess({ sdk, profile });
|
|
4592
4630
|
}
|
|
4593
4631
|
var LoginSchema = zod.z.object({
|
|
4632
|
+
name: zod.z.string().optional().describe(
|
|
4633
|
+
"Name to identify these credentials (defaults to <email>@<hostname>). Provide this to set a custom name without the interactive prompt."
|
|
4634
|
+
),
|
|
4594
4635
|
timeout: zod.z.string().optional().describe("Login timeout in seconds (default: 300)"),
|
|
4595
4636
|
useApprovals: zod.z.boolean().optional().describe(
|
|
4596
4637
|
"Require approvals for actions performed with these credentials"
|
|
@@ -7196,7 +7237,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
|
|
|
7196
7237
|
// package.json with { type: 'json' }
|
|
7197
7238
|
var package_default2 = {
|
|
7198
7239
|
name: "@zapier/zapier-sdk-cli",
|
|
7199
|
-
version: "0.55.
|
|
7240
|
+
version: "0.55.5"};
|
|
7200
7241
|
|
|
7201
7242
|
// src/sdk.ts
|
|
7202
7243
|
zapierSdk.injectCliLogin(login_exports);
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command, CommanderError, Option } from 'commander';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { definePlugin, createPluginMethod, OutputPropertySchema, ZapierBundleError, DEFAULT_CONFIG_PATH, ZapierValidationError, ZapierUnknownError, ZapierReleaseTriggerMessageSignal, injectCliLogin, BaseSdkOptionsSchema, getOrCreateApiClient, isPermanentHttpError, invalidateCachedToken, batch, toSnakeCase, ZapierAbortDrainSignal, createZapierSdkStack as createZapierSdkStack$1, addPlugin as addPlugin$1, ZapierError, isCredentialsObject, buildApplicationLifecycleEvent, ZapierAuthenticationError, isPositional, runWithTelemetryContext, buildCapabilityMessage, formatErrorMessage, getOsInfo, getPlatformVersions, getCiPlatform, isCi, getReleaseId, getCurrentTimestamp, generateEventId } from '@zapier/zapier-sdk';
|
|
4
|
+
import { definePlugin, createPluginMethod, OutputPropertySchema, ZapierBundleError, DEFAULT_CONFIG_PATH, ZapierValidationError, ZapierUnknownError, ZapierReleaseTriggerMessageSignal, injectCliLogin, BaseSdkOptionsSchema, getOrCreateApiClient, isPermanentHttpError, invalidateCachedToken, batch, toSnakeCase, ZapierAbortDrainSignal, createZapierSdkStack as createZapierSdkStack$1, addPlugin as addPlugin$1, ZapierError, isCredentialsObject, buildApplicationLifecycleEvent, ZapierAuthenticationError, isPositional, runWithTelemetryContext, buildCapabilityMessage, formatErrorMessage, getOsInfo, getPlatformVersions, getAgent, getTtyContext, getCiPlatform, isCi, getReleaseId, getCurrentTimestamp, generateEventId } from '@zapier/zapier-sdk';
|
|
5
5
|
import inquirer from 'inquirer';
|
|
6
6
|
import search from '@inquirer/search';
|
|
7
7
|
import chalk from 'chalk';
|
|
@@ -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.5"};
|
|
1535
1535
|
|
|
1536
1536
|
// src/telemetry/builders.ts
|
|
1537
1537
|
function createCliBaseEvent(context = {}) {
|
|
@@ -1575,6 +1575,8 @@ function buildCliCommandExecutedEvent({
|
|
|
1575
1575
|
requires_auth: null,
|
|
1576
1576
|
is_ci_environment: isCi(),
|
|
1577
1577
|
ci_platform: getCiPlatform(),
|
|
1578
|
+
...getTtyContext(),
|
|
1579
|
+
agent: getAgent(),
|
|
1578
1580
|
package_manager: data.package_manager ?? "pnpm",
|
|
1579
1581
|
// Default based on project setup
|
|
1580
1582
|
made_network_requests: data.made_network_requests ?? null,
|
|
@@ -3000,6 +3002,15 @@ function resolveAvailableCredentialName({
|
|
|
3000
3002
|
);
|
|
3001
3003
|
return firstAvailableCredentialName({ baseName, taken });
|
|
3002
3004
|
}
|
|
3005
|
+
function credentialNameExists({
|
|
3006
|
+
name,
|
|
3007
|
+
baseUrl: baseUrl2
|
|
3008
|
+
}) {
|
|
3009
|
+
const resolvedBaseUrl = normalizeBaseUrl(baseUrl2);
|
|
3010
|
+
return readRegistry().some(
|
|
3011
|
+
(e) => e.name === name && e.baseUrl === resolvedBaseUrl
|
|
3012
|
+
);
|
|
3013
|
+
}
|
|
3003
3014
|
async function storeClientCredentials({
|
|
3004
3015
|
name,
|
|
3005
3016
|
clientId,
|
|
@@ -4305,6 +4316,21 @@ function resolveDefaultCredentialsName({
|
|
|
4305
4316
|
}) {
|
|
4306
4317
|
return validateCredentialsName(defaultCredentialsName(email));
|
|
4307
4318
|
}
|
|
4319
|
+
async function resolveCredentialName({
|
|
4320
|
+
email,
|
|
4321
|
+
interactive,
|
|
4322
|
+
baseUrl: baseUrl2,
|
|
4323
|
+
entryPoint
|
|
4324
|
+
}) {
|
|
4325
|
+
if (interactive) {
|
|
4326
|
+
return promptCredentialsName({
|
|
4327
|
+
email,
|
|
4328
|
+
promptMessage: getCredentialsPromptMessage(entryPoint)
|
|
4329
|
+
});
|
|
4330
|
+
}
|
|
4331
|
+
const baseName = resolveDefaultCredentialsName({ email });
|
|
4332
|
+
return resolveAvailableCredentialName({ baseName, baseUrl: baseUrl2 });
|
|
4333
|
+
}
|
|
4308
4334
|
function toPkceCredentials(credentials2) {
|
|
4309
4335
|
if (credentials2 && isCredentialsObject(credentials2) && !("clientSecret" in credentials2)) {
|
|
4310
4336
|
return {
|
|
@@ -4501,6 +4527,17 @@ async function runAccountAuth({
|
|
|
4501
4527
|
...sdk.context,
|
|
4502
4528
|
resolvedCredentials
|
|
4503
4529
|
});
|
|
4530
|
+
const providedName = options.name !== void 0 ? validateCredentialsName(options.name) : void 0;
|
|
4531
|
+
if (providedName !== void 0) {
|
|
4532
|
+
const activeCredentials = getActiveCredentials({
|
|
4533
|
+
baseUrl: credentialsBaseUrl2
|
|
4534
|
+
});
|
|
4535
|
+
if (activeCredentials?.name !== providedName && credentialNameExists({ name: providedName, baseUrl: credentialsBaseUrl2 })) {
|
|
4536
|
+
throw new ZapierCliValidationError(
|
|
4537
|
+
`A credential named "${providedName}" already exists. Choose a different --name.`
|
|
4538
|
+
);
|
|
4539
|
+
}
|
|
4540
|
+
}
|
|
4504
4541
|
if (!await clearExistingAuthState({
|
|
4505
4542
|
sdk,
|
|
4506
4543
|
baseUrl: credentialsBaseUrl2,
|
|
@@ -4527,11 +4564,12 @@ async function runAccountAuth({
|
|
|
4527
4564
|
console.log(
|
|
4528
4565
|
"\nGenerating credentials so this machine can make authenticated requests on your behalf."
|
|
4529
4566
|
);
|
|
4530
|
-
const
|
|
4567
|
+
const credentialName = providedName ?? await resolveCredentialName({
|
|
4531
4568
|
email: profile.email,
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4569
|
+
interactive,
|
|
4570
|
+
baseUrl: credentialsBaseUrl2,
|
|
4571
|
+
entryPoint
|
|
4572
|
+
});
|
|
4535
4573
|
const useApprovals = options.useApprovals === true;
|
|
4536
4574
|
await saveClientCredentials({
|
|
4537
4575
|
api: scopedApi,
|
|
@@ -4549,6 +4587,9 @@ async function runAccountAuth({
|
|
|
4549
4587
|
emitAccountAuthSuccess({ sdk, profile });
|
|
4550
4588
|
}
|
|
4551
4589
|
var LoginSchema = z.object({
|
|
4590
|
+
name: z.string().optional().describe(
|
|
4591
|
+
"Name to identify these credentials (defaults to <email>@<hostname>). Provide this to set a custom name without the interactive prompt."
|
|
4592
|
+
),
|
|
4552
4593
|
timeout: z.string().optional().describe("Login timeout in seconds (default: 300)"),
|
|
4553
4594
|
useApprovals: z.boolean().optional().describe(
|
|
4554
4595
|
"Require approvals for actions performed with these credentials"
|
|
@@ -7154,7 +7195,7 @@ var watchTriggerInboxCliPlugin = definePlugin(
|
|
|
7154
7195
|
// package.json with { type: 'json' }
|
|
7155
7196
|
var package_default2 = {
|
|
7156
7197
|
name: "@zapier/zapier-sdk-cli",
|
|
7157
|
-
version: "0.55.
|
|
7198
|
+
version: "0.55.5"};
|
|
7158
7199
|
|
|
7159
7200
|
// src/sdk.ts
|
|
7160
7201
|
injectCliLogin(login_exports);
|
package/dist/experimental.cjs
CHANGED
|
@@ -414,6 +414,15 @@ function resolveAvailableCredentialName({
|
|
|
414
414
|
);
|
|
415
415
|
return firstAvailableCredentialName({ baseName, taken });
|
|
416
416
|
}
|
|
417
|
+
function credentialNameExists({
|
|
418
|
+
name,
|
|
419
|
+
baseUrl
|
|
420
|
+
}) {
|
|
421
|
+
const resolvedBaseUrl = normalizeBaseUrl(baseUrl);
|
|
422
|
+
return readRegistry().some(
|
|
423
|
+
(e) => e.name === name && e.baseUrl === resolvedBaseUrl
|
|
424
|
+
);
|
|
425
|
+
}
|
|
417
426
|
async function storeClientCredentials({
|
|
418
427
|
name,
|
|
419
428
|
clientId,
|
|
@@ -1719,6 +1728,21 @@ function resolveDefaultCredentialsName({
|
|
|
1719
1728
|
}) {
|
|
1720
1729
|
return validateCredentialsName(defaultCredentialsName(email));
|
|
1721
1730
|
}
|
|
1731
|
+
async function resolveCredentialName({
|
|
1732
|
+
email,
|
|
1733
|
+
interactive,
|
|
1734
|
+
baseUrl,
|
|
1735
|
+
entryPoint
|
|
1736
|
+
}) {
|
|
1737
|
+
if (interactive) {
|
|
1738
|
+
return promptCredentialsName({
|
|
1739
|
+
email,
|
|
1740
|
+
promptMessage: getCredentialsPromptMessage(entryPoint)
|
|
1741
|
+
});
|
|
1742
|
+
}
|
|
1743
|
+
const baseName = resolveDefaultCredentialsName({ email });
|
|
1744
|
+
return resolveAvailableCredentialName({ baseName, baseUrl });
|
|
1745
|
+
}
|
|
1722
1746
|
function toPkceCredentials(credentials) {
|
|
1723
1747
|
if (credentials && zapierSdk.isCredentialsObject(credentials) && !("clientSecret" in credentials)) {
|
|
1724
1748
|
return {
|
|
@@ -1915,6 +1939,17 @@ async function runAccountAuth({
|
|
|
1915
1939
|
...sdk.context,
|
|
1916
1940
|
resolvedCredentials
|
|
1917
1941
|
});
|
|
1942
|
+
const providedName = options.name !== void 0 ? validateCredentialsName(options.name) : void 0;
|
|
1943
|
+
if (providedName !== void 0) {
|
|
1944
|
+
const activeCredentials = getActiveCredentials({
|
|
1945
|
+
baseUrl: credentialsBaseUrl
|
|
1946
|
+
});
|
|
1947
|
+
if (activeCredentials?.name !== providedName && credentialNameExists({ name: providedName, baseUrl: credentialsBaseUrl })) {
|
|
1948
|
+
throw new ZapierCliValidationError(
|
|
1949
|
+
`A credential named "${providedName}" already exists. Choose a different --name.`
|
|
1950
|
+
);
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1918
1953
|
if (!await clearExistingAuthState({
|
|
1919
1954
|
sdk,
|
|
1920
1955
|
baseUrl: credentialsBaseUrl,
|
|
@@ -1941,11 +1976,12 @@ async function runAccountAuth({
|
|
|
1941
1976
|
console.log(
|
|
1942
1977
|
"\nGenerating credentials so this machine can make authenticated requests on your behalf."
|
|
1943
1978
|
);
|
|
1944
|
-
const
|
|
1979
|
+
const credentialName = providedName ?? await resolveCredentialName({
|
|
1945
1980
|
email: profile.email,
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1981
|
+
interactive,
|
|
1982
|
+
baseUrl: credentialsBaseUrl,
|
|
1983
|
+
entryPoint
|
|
1984
|
+
});
|
|
1949
1985
|
const useApprovals = options.useApprovals === true;
|
|
1950
1986
|
await saveClientCredentials({
|
|
1951
1987
|
api: scopedApi,
|
|
@@ -1963,6 +1999,9 @@ async function runAccountAuth({
|
|
|
1963
1999
|
emitAccountAuthSuccess({ sdk, profile });
|
|
1964
2000
|
}
|
|
1965
2001
|
var LoginSchema = zod.z.object({
|
|
2002
|
+
name: zod.z.string().optional().describe(
|
|
2003
|
+
"Name to identify these credentials (defaults to <email>@<hostname>). Provide this to set a custom name without the interactive prompt."
|
|
2004
|
+
),
|
|
1966
2005
|
timeout: zod.z.string().optional().describe("Login timeout in seconds (default: 300)"),
|
|
1967
2006
|
useApprovals: zod.z.boolean().optional().describe(
|
|
1968
2007
|
"Require approvals for actions performed with these credentials"
|
|
@@ -4551,7 +4590,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
|
|
|
4551
4590
|
// package.json with { type: 'json' }
|
|
4552
4591
|
var package_default = {
|
|
4553
4592
|
name: "@zapier/zapier-sdk-cli",
|
|
4554
|
-
version: "0.55.
|
|
4593
|
+
version: "0.55.5"};
|
|
4555
4594
|
|
|
4556
4595
|
// src/experimental.ts
|
|
4557
4596
|
experimental.injectCliLogin(login_exports);
|
package/dist/experimental.mjs
CHANGED
|
@@ -378,6 +378,15 @@ function resolveAvailableCredentialName({
|
|
|
378
378
|
);
|
|
379
379
|
return firstAvailableCredentialName({ baseName, taken });
|
|
380
380
|
}
|
|
381
|
+
function credentialNameExists({
|
|
382
|
+
name,
|
|
383
|
+
baseUrl
|
|
384
|
+
}) {
|
|
385
|
+
const resolvedBaseUrl = normalizeBaseUrl(baseUrl);
|
|
386
|
+
return readRegistry().some(
|
|
387
|
+
(e) => e.name === name && e.baseUrl === resolvedBaseUrl
|
|
388
|
+
);
|
|
389
|
+
}
|
|
381
390
|
async function storeClientCredentials({
|
|
382
391
|
name,
|
|
383
392
|
clientId,
|
|
@@ -1683,6 +1692,21 @@ function resolveDefaultCredentialsName({
|
|
|
1683
1692
|
}) {
|
|
1684
1693
|
return validateCredentialsName(defaultCredentialsName(email));
|
|
1685
1694
|
}
|
|
1695
|
+
async function resolveCredentialName({
|
|
1696
|
+
email,
|
|
1697
|
+
interactive,
|
|
1698
|
+
baseUrl,
|
|
1699
|
+
entryPoint
|
|
1700
|
+
}) {
|
|
1701
|
+
if (interactive) {
|
|
1702
|
+
return promptCredentialsName({
|
|
1703
|
+
email,
|
|
1704
|
+
promptMessage: getCredentialsPromptMessage(entryPoint)
|
|
1705
|
+
});
|
|
1706
|
+
}
|
|
1707
|
+
const baseName = resolveDefaultCredentialsName({ email });
|
|
1708
|
+
return resolveAvailableCredentialName({ baseName, baseUrl });
|
|
1709
|
+
}
|
|
1686
1710
|
function toPkceCredentials(credentials) {
|
|
1687
1711
|
if (credentials && isCredentialsObject(credentials) && !("clientSecret" in credentials)) {
|
|
1688
1712
|
return {
|
|
@@ -1879,6 +1903,17 @@ async function runAccountAuth({
|
|
|
1879
1903
|
...sdk.context,
|
|
1880
1904
|
resolvedCredentials
|
|
1881
1905
|
});
|
|
1906
|
+
const providedName = options.name !== void 0 ? validateCredentialsName(options.name) : void 0;
|
|
1907
|
+
if (providedName !== void 0) {
|
|
1908
|
+
const activeCredentials = getActiveCredentials({
|
|
1909
|
+
baseUrl: credentialsBaseUrl
|
|
1910
|
+
});
|
|
1911
|
+
if (activeCredentials?.name !== providedName && credentialNameExists({ name: providedName, baseUrl: credentialsBaseUrl })) {
|
|
1912
|
+
throw new ZapierCliValidationError(
|
|
1913
|
+
`A credential named "${providedName}" already exists. Choose a different --name.`
|
|
1914
|
+
);
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1882
1917
|
if (!await clearExistingAuthState({
|
|
1883
1918
|
sdk,
|
|
1884
1919
|
baseUrl: credentialsBaseUrl,
|
|
@@ -1905,11 +1940,12 @@ async function runAccountAuth({
|
|
|
1905
1940
|
console.log(
|
|
1906
1941
|
"\nGenerating credentials so this machine can make authenticated requests on your behalf."
|
|
1907
1942
|
);
|
|
1908
|
-
const
|
|
1943
|
+
const credentialName = providedName ?? await resolveCredentialName({
|
|
1909
1944
|
email: profile.email,
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1945
|
+
interactive,
|
|
1946
|
+
baseUrl: credentialsBaseUrl,
|
|
1947
|
+
entryPoint
|
|
1948
|
+
});
|
|
1913
1949
|
const useApprovals = options.useApprovals === true;
|
|
1914
1950
|
await saveClientCredentials({
|
|
1915
1951
|
api: scopedApi,
|
|
@@ -1927,6 +1963,9 @@ async function runAccountAuth({
|
|
|
1927
1963
|
emitAccountAuthSuccess({ sdk, profile });
|
|
1928
1964
|
}
|
|
1929
1965
|
var LoginSchema = z.object({
|
|
1966
|
+
name: z.string().optional().describe(
|
|
1967
|
+
"Name to identify these credentials (defaults to <email>@<hostname>). Provide this to set a custom name without the interactive prompt."
|
|
1968
|
+
),
|
|
1930
1969
|
timeout: z.string().optional().describe("Login timeout in seconds (default: 300)"),
|
|
1931
1970
|
useApprovals: z.boolean().optional().describe(
|
|
1932
1971
|
"Require approvals for actions performed with these credentials"
|
|
@@ -4515,7 +4554,7 @@ var watchTriggerInboxCliPlugin = definePlugin(
|
|
|
4515
4554
|
// package.json with { type: 'json' }
|
|
4516
4555
|
var package_default = {
|
|
4517
4556
|
name: "@zapier/zapier-sdk-cli",
|
|
4518
|
-
version: "0.55.
|
|
4557
|
+
version: "0.55.5"};
|
|
4519
4558
|
|
|
4520
4559
|
// src/experimental.ts
|
|
4521
4560
|
injectCliLogin(login_exports);
|
package/dist/index.cjs
CHANGED
|
@@ -413,6 +413,15 @@ function resolveAvailableCredentialName({
|
|
|
413
413
|
);
|
|
414
414
|
return firstAvailableCredentialName({ baseName, taken });
|
|
415
415
|
}
|
|
416
|
+
function credentialNameExists({
|
|
417
|
+
name,
|
|
418
|
+
baseUrl
|
|
419
|
+
}) {
|
|
420
|
+
const resolvedBaseUrl = normalizeBaseUrl(baseUrl);
|
|
421
|
+
return readRegistry().some(
|
|
422
|
+
(e) => e.name === name && e.baseUrl === resolvedBaseUrl
|
|
423
|
+
);
|
|
424
|
+
}
|
|
416
425
|
async function storeClientCredentials({
|
|
417
426
|
name,
|
|
418
427
|
clientId,
|
|
@@ -1718,6 +1727,21 @@ function resolveDefaultCredentialsName({
|
|
|
1718
1727
|
}) {
|
|
1719
1728
|
return validateCredentialsName(defaultCredentialsName(email));
|
|
1720
1729
|
}
|
|
1730
|
+
async function resolveCredentialName({
|
|
1731
|
+
email,
|
|
1732
|
+
interactive,
|
|
1733
|
+
baseUrl,
|
|
1734
|
+
entryPoint
|
|
1735
|
+
}) {
|
|
1736
|
+
if (interactive) {
|
|
1737
|
+
return promptCredentialsName({
|
|
1738
|
+
email,
|
|
1739
|
+
promptMessage: getCredentialsPromptMessage(entryPoint)
|
|
1740
|
+
});
|
|
1741
|
+
}
|
|
1742
|
+
const baseName = resolveDefaultCredentialsName({ email });
|
|
1743
|
+
return resolveAvailableCredentialName({ baseName, baseUrl });
|
|
1744
|
+
}
|
|
1721
1745
|
function toPkceCredentials(credentials) {
|
|
1722
1746
|
if (credentials && zapierSdk.isCredentialsObject(credentials) && !("clientSecret" in credentials)) {
|
|
1723
1747
|
return {
|
|
@@ -1914,6 +1938,17 @@ async function runAccountAuth({
|
|
|
1914
1938
|
...sdk.context,
|
|
1915
1939
|
resolvedCredentials
|
|
1916
1940
|
});
|
|
1941
|
+
const providedName = options.name !== void 0 ? validateCredentialsName(options.name) : void 0;
|
|
1942
|
+
if (providedName !== void 0) {
|
|
1943
|
+
const activeCredentials = getActiveCredentials({
|
|
1944
|
+
baseUrl: credentialsBaseUrl
|
|
1945
|
+
});
|
|
1946
|
+
if (activeCredentials?.name !== providedName && credentialNameExists({ name: providedName, baseUrl: credentialsBaseUrl })) {
|
|
1947
|
+
throw new ZapierCliValidationError(
|
|
1948
|
+
`A credential named "${providedName}" already exists. Choose a different --name.`
|
|
1949
|
+
);
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1917
1952
|
if (!await clearExistingAuthState({
|
|
1918
1953
|
sdk,
|
|
1919
1954
|
baseUrl: credentialsBaseUrl,
|
|
@@ -1940,11 +1975,12 @@ async function runAccountAuth({
|
|
|
1940
1975
|
console.log(
|
|
1941
1976
|
"\nGenerating credentials so this machine can make authenticated requests on your behalf."
|
|
1942
1977
|
);
|
|
1943
|
-
const
|
|
1978
|
+
const credentialName = providedName ?? await resolveCredentialName({
|
|
1944
1979
|
email: profile.email,
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1980
|
+
interactive,
|
|
1981
|
+
baseUrl: credentialsBaseUrl,
|
|
1982
|
+
entryPoint
|
|
1983
|
+
});
|
|
1948
1984
|
const useApprovals = options.useApprovals === true;
|
|
1949
1985
|
await saveClientCredentials({
|
|
1950
1986
|
api: scopedApi,
|
|
@@ -1962,6 +1998,9 @@ async function runAccountAuth({
|
|
|
1962
1998
|
emitAccountAuthSuccess({ sdk, profile });
|
|
1963
1999
|
}
|
|
1964
2000
|
var LoginSchema = zod.z.object({
|
|
2001
|
+
name: zod.z.string().optional().describe(
|
|
2002
|
+
"Name to identify these credentials (defaults to <email>@<hostname>). Provide this to set a custom name without the interactive prompt."
|
|
2003
|
+
),
|
|
1965
2004
|
timeout: zod.z.string().optional().describe("Login timeout in seconds (default: 300)"),
|
|
1966
2005
|
useApprovals: zod.z.boolean().optional().describe(
|
|
1967
2006
|
"Require approvals for actions performed with these credentials"
|
|
@@ -4550,7 +4589,7 @@ zapierSdk.definePlugin(
|
|
|
4550
4589
|
// package.json with { type: 'json' }
|
|
4551
4590
|
var package_default = {
|
|
4552
4591
|
name: "@zapier/zapier-sdk-cli",
|
|
4553
|
-
version: "0.55.
|
|
4592
|
+
version: "0.55.5"};
|
|
4554
4593
|
|
|
4555
4594
|
// src/sdk.ts
|
|
4556
4595
|
zapierSdk.injectCliLogin(login_exports);
|
|
@@ -4578,7 +4617,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
4578
4617
|
|
|
4579
4618
|
// package.json
|
|
4580
4619
|
var package_default2 = {
|
|
4581
|
-
version: "0.55.
|
|
4620
|
+
version: "0.55.5"};
|
|
4582
4621
|
|
|
4583
4622
|
// src/telemetry/builders.ts
|
|
4584
4623
|
function createCliBaseEvent(context = {}) {
|
|
@@ -4622,6 +4661,8 @@ function buildCliCommandExecutedEvent({
|
|
|
4622
4661
|
requires_auth: data.requires_auth ?? null,
|
|
4623
4662
|
is_ci_environment: zapierSdk.isCi(),
|
|
4624
4663
|
ci_platform: zapierSdk.getCiPlatform(),
|
|
4664
|
+
...zapierSdk.getTtyContext(),
|
|
4665
|
+
agent: zapierSdk.getAgent(),
|
|
4625
4666
|
package_manager: data.package_manager ?? "pnpm",
|
|
4626
4667
|
// Default based on project setup
|
|
4627
4668
|
made_network_requests: data.made_network_requests ?? null,
|
package/dist/index.d.mts
CHANGED
|
@@ -54,6 +54,9 @@ interface CliCommandExecutedEvent extends BaseEvent {
|
|
|
54
54
|
peak_memory_usage_bytes?: number | null;
|
|
55
55
|
cpu_time_ms?: number | null;
|
|
56
56
|
subprocess_count?: number | null;
|
|
57
|
+
stdin_is_tty?: boolean | null;
|
|
58
|
+
stdout_is_tty?: boolean | null;
|
|
59
|
+
agent?: string | null;
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -54,6 +54,9 @@ interface CliCommandExecutedEvent extends BaseEvent {
|
|
|
54
54
|
peak_memory_usage_bytes?: number | null;
|
|
55
55
|
cpu_time_ms?: number | null;
|
|
56
56
|
subprocess_count?: number | null;
|
|
57
|
+
stdin_is_tty?: boolean | null;
|
|
58
|
+
stdout_is_tty?: boolean | null;
|
|
59
|
+
agent?: string | null;
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
/**
|