@zapier/zapier-sdk-cli 0.58.0 → 0.58.2

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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @zapier/zapier-sdk-cli
2
2
 
3
+ ## 0.58.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 745e172: Include client id and auth mechanism in client-side telemetry
8
+ - Updated dependencies [745e172]
9
+ - @zapier/zapier-sdk@0.76.1
10
+ - @zapier/zapier-sdk-mcp@0.14.4
11
+
12
+ ## 0.58.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [a7d2646]
17
+ - @zapier/zapier-sdk@0.76.0
18
+ - @zapier/zapier-sdk-mcp@0.14.3
19
+
3
20
  ## 0.58.0
4
21
 
5
22
  ### Minor Changes
package/dist/cli.cjs CHANGED
@@ -1576,7 +1576,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
1576
1576
 
1577
1577
  // package.json
1578
1578
  var package_default = {
1579
- version: "0.58.0"};
1579
+ version: "0.58.2"};
1580
1580
 
1581
1581
  // src/telemetry/builders.ts
1582
1582
  function createCliBaseEvent(context = {}) {
@@ -1586,6 +1586,8 @@ function createCliBaseEvent(context = {}) {
1586
1586
  release_id: zapierSdk.getReleaseId(),
1587
1587
  customuser_id: context.customuser_id ?? null,
1588
1588
  account_id: context.account_id ?? null,
1589
+ client_id: context.client_id ?? null,
1590
+ auth_mechanism: context.auth_mechanism ?? null,
1589
1591
  identity_id: context.identity_id ?? null,
1590
1592
  visitor_id: context.visitor_id ?? null,
1591
1593
  correlation_id: context.correlation_id ?? null
@@ -4504,7 +4506,7 @@ async function saveClientCredentials({
4504
4506
  useApprovals,
4505
4507
  cleanupLogPrefix
4506
4508
  }) {
4507
- await setupClientCredentials({
4509
+ const { clientId } = await setupClientCredentials({
4508
4510
  api: api2,
4509
4511
  name,
4510
4512
  credentialsBaseUrl: credentialsBaseUrl2,
@@ -4518,10 +4520,12 @@ async function saveClientCredentials({
4518
4520
  err
4519
4521
  );
4520
4522
  }
4523
+ return { clientId };
4521
4524
  }
4522
4525
  function emitAccountAuthSuccess({
4523
4526
  sdk,
4524
- profile
4527
+ profile,
4528
+ clientId
4525
4529
  }) {
4526
4530
  sdk.context.eventEmission.emit(
4527
4531
  "platform.sdk.ApplicationLifecycleEvent",
@@ -4529,7 +4533,9 @@ function emitAccountAuthSuccess({
4529
4533
  { lifecycle_event_type: "login_success" },
4530
4534
  {
4531
4535
  customuser_id: profile.user_id,
4532
- account_id: profile.roles[0]?.account_id ?? null
4536
+ account_id: profile.roles[0]?.account_id ?? null,
4537
+ client_id: clientId,
4538
+ auth_mechanism: zapierSdk.AuthMechanism.ClientCredentials
4533
4539
  }
4534
4540
  )
4535
4541
  );
@@ -4637,7 +4643,7 @@ async function runAccountAuth({
4637
4643
  entryPoint
4638
4644
  });
4639
4645
  const useApprovals = options.useApprovals === true;
4640
- await saveClientCredentials({
4646
+ const { clientId } = await saveClientCredentials({
4641
4647
  api: scopedApi,
4642
4648
  name: credentialName,
4643
4649
  credentialsBaseUrl: credentialsBaseUrl2,
@@ -4650,7 +4656,7 @@ async function runAccountAuth({
4650
4656
  if (useApprovals) {
4651
4657
  console.log("\u{1F510} Approvals are enabled for these credentials.");
4652
4658
  }
4653
- emitAccountAuthSuccess({ sdk, profile });
4659
+ emitAccountAuthSuccess({ sdk, profile, clientId });
4654
4660
  }
4655
4661
  var LoginSchema = zod.z.object({
4656
4662
  name: zod.z.string().optional().describe(
@@ -7261,7 +7267,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
7261
7267
  // package.json with { type: 'json' }
7262
7268
  var package_default2 = {
7263
7269
  name: "@zapier/zapier-sdk-cli",
7264
- version: "0.58.0"};
7270
+ version: "0.58.2"};
7265
7271
 
7266
7272
  // src/sdk.ts
7267
7273
  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, runWithCallerContext, isPositional, runWithTelemetryContext, buildCapabilityMessage, formatErrorMessage, getOsInfo, getPlatformVersions, getAgent, getTtyContext, getCiPlatform, isCi, getReleaseId, getCurrentTimestamp, generateEventId, ZapierApprovalError } 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, AuthMechanism, ZapierAuthenticationError, runWithCallerContext, isPositional, runWithTelemetryContext, buildCapabilityMessage, formatErrorMessage, getOsInfo, getPlatformVersions, getAgent, getTtyContext, getCiPlatform, isCi, getReleaseId, getCurrentTimestamp, generateEventId, ZapierApprovalError } from '@zapier/zapier-sdk';
5
5
  import inquirer from 'inquirer';
6
6
  import search from '@inquirer/search';
7
7
  import chalk from 'chalk';
@@ -1533,7 +1533,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
1533
1533
 
1534
1534
  // package.json
1535
1535
  var package_default = {
1536
- version: "0.58.0"};
1536
+ version: "0.58.2"};
1537
1537
 
1538
1538
  // src/telemetry/builders.ts
1539
1539
  function createCliBaseEvent(context = {}) {
@@ -1543,6 +1543,8 @@ function createCliBaseEvent(context = {}) {
1543
1543
  release_id: getReleaseId(),
1544
1544
  customuser_id: context.customuser_id ?? null,
1545
1545
  account_id: context.account_id ?? null,
1546
+ client_id: context.client_id ?? null,
1547
+ auth_mechanism: context.auth_mechanism ?? null,
1546
1548
  identity_id: context.identity_id ?? null,
1547
1549
  visitor_id: context.visitor_id ?? null,
1548
1550
  correlation_id: context.correlation_id ?? null
@@ -4461,7 +4463,7 @@ async function saveClientCredentials({
4461
4463
  useApprovals,
4462
4464
  cleanupLogPrefix
4463
4465
  }) {
4464
- await setupClientCredentials({
4466
+ const { clientId } = await setupClientCredentials({
4465
4467
  api: api2,
4466
4468
  name,
4467
4469
  credentialsBaseUrl: credentialsBaseUrl2,
@@ -4475,10 +4477,12 @@ async function saveClientCredentials({
4475
4477
  err
4476
4478
  );
4477
4479
  }
4480
+ return { clientId };
4478
4481
  }
4479
4482
  function emitAccountAuthSuccess({
4480
4483
  sdk,
4481
- profile
4484
+ profile,
4485
+ clientId
4482
4486
  }) {
4483
4487
  sdk.context.eventEmission.emit(
4484
4488
  "platform.sdk.ApplicationLifecycleEvent",
@@ -4486,7 +4490,9 @@ function emitAccountAuthSuccess({
4486
4490
  { lifecycle_event_type: "login_success" },
4487
4491
  {
4488
4492
  customuser_id: profile.user_id,
4489
- account_id: profile.roles[0]?.account_id ?? null
4493
+ account_id: profile.roles[0]?.account_id ?? null,
4494
+ client_id: clientId,
4495
+ auth_mechanism: AuthMechanism.ClientCredentials
4490
4496
  }
4491
4497
  )
4492
4498
  );
@@ -4594,7 +4600,7 @@ async function runAccountAuth({
4594
4600
  entryPoint
4595
4601
  });
4596
4602
  const useApprovals = options.useApprovals === true;
4597
- await saveClientCredentials({
4603
+ const { clientId } = await saveClientCredentials({
4598
4604
  api: scopedApi,
4599
4605
  name: credentialName,
4600
4606
  credentialsBaseUrl: credentialsBaseUrl2,
@@ -4607,7 +4613,7 @@ async function runAccountAuth({
4607
4613
  if (useApprovals) {
4608
4614
  console.log("\u{1F510} Approvals are enabled for these credentials.");
4609
4615
  }
4610
- emitAccountAuthSuccess({ sdk, profile });
4616
+ emitAccountAuthSuccess({ sdk, profile, clientId });
4611
4617
  }
4612
4618
  var LoginSchema = z.object({
4613
4619
  name: z.string().optional().describe(
@@ -7218,7 +7224,7 @@ var watchTriggerInboxCliPlugin = definePlugin(
7218
7224
  // package.json with { type: 'json' }
7219
7225
  var package_default2 = {
7220
7226
  name: "@zapier/zapier-sdk-cli",
7221
- version: "0.58.0"};
7227
+ version: "0.58.2"};
7222
7228
 
7223
7229
  // src/sdk.ts
7224
7230
  injectCliLogin(login_exports);
@@ -1850,7 +1850,7 @@ async function saveClientCredentials({
1850
1850
  useApprovals,
1851
1851
  cleanupLogPrefix
1852
1852
  }) {
1853
- await setupClientCredentials({
1853
+ const { clientId } = await setupClientCredentials({
1854
1854
  api: api2,
1855
1855
  name,
1856
1856
  credentialsBaseUrl,
@@ -1864,10 +1864,12 @@ async function saveClientCredentials({
1864
1864
  err
1865
1865
  );
1866
1866
  }
1867
+ return { clientId };
1867
1868
  }
1868
1869
  function emitAccountAuthSuccess({
1869
1870
  sdk,
1870
- profile
1871
+ profile,
1872
+ clientId
1871
1873
  }) {
1872
1874
  sdk.context.eventEmission.emit(
1873
1875
  "platform.sdk.ApplicationLifecycleEvent",
@@ -1875,7 +1877,9 @@ function emitAccountAuthSuccess({
1875
1877
  { lifecycle_event_type: "login_success" },
1876
1878
  {
1877
1879
  customuser_id: profile.user_id,
1878
- account_id: profile.roles[0]?.account_id ?? null
1880
+ account_id: profile.roles[0]?.account_id ?? null,
1881
+ client_id: clientId,
1882
+ auth_mechanism: zapierSdk.AuthMechanism.ClientCredentials
1879
1883
  }
1880
1884
  )
1881
1885
  );
@@ -1983,7 +1987,7 @@ async function runAccountAuth({
1983
1987
  entryPoint
1984
1988
  });
1985
1989
  const useApprovals = options.useApprovals === true;
1986
- await saveClientCredentials({
1990
+ const { clientId } = await saveClientCredentials({
1987
1991
  api: scopedApi,
1988
1992
  name: credentialName,
1989
1993
  credentialsBaseUrl,
@@ -1996,7 +2000,7 @@ async function runAccountAuth({
1996
2000
  if (useApprovals) {
1997
2001
  console.log("\u{1F510} Approvals are enabled for these credentials.");
1998
2002
  }
1999
- emitAccountAuthSuccess({ sdk, profile });
2003
+ emitAccountAuthSuccess({ sdk, profile, clientId });
2000
2004
  }
2001
2005
  var LoginSchema = zod.z.object({
2002
2006
  name: zod.z.string().optional().describe(
@@ -4590,7 +4594,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
4590
4594
  // package.json with { type: 'json' }
4591
4595
  var package_default = {
4592
4596
  name: "@zapier/zapier-sdk-cli",
4593
- version: "0.58.0"};
4597
+ version: "0.58.2"};
4594
4598
 
4595
4599
  // src/experimental.ts
4596
4600
  experimental.injectCliLogin(login_exports);
@@ -7,7 +7,7 @@ import crypto, { createHash } from 'crypto';
7
7
  import * as path from 'path';
8
8
  import { resolve, join, dirname, basename, relative, extname } from 'path';
9
9
  import * as lockfile from 'proper-lockfile';
10
- import { definePlugin, createPluginMethod, OutputPropertySchema, ZapierBundleError, DEFAULT_CONFIG_PATH, ZapierValidationError, ZapierUnknownError, ZapierReleaseTriggerMessageSignal, getOrCreateApiClient, isPermanentHttpError, invalidateCachedToken, batch, toSnakeCase, ZapierAbortDrainSignal, isCredentialsObject, buildApplicationLifecycleEvent, ZapierAuthenticationError, ZapierError } from '@zapier/zapier-sdk';
10
+ import { definePlugin, createPluginMethod, OutputPropertySchema, ZapierBundleError, DEFAULT_CONFIG_PATH, ZapierValidationError, ZapierUnknownError, ZapierReleaseTriggerMessageSignal, getOrCreateApiClient, isPermanentHttpError, invalidateCachedToken, batch, toSnakeCase, ZapierAbortDrainSignal, isCredentialsObject, buildApplicationLifecycleEvent, AuthMechanism, ZapierAuthenticationError, ZapierError } from '@zapier/zapier-sdk';
11
11
  import { z } from 'zod';
12
12
  import { injectCliLogin, createZapierSdkStack, addPlugin } from '@zapier/zapier-sdk/experimental';
13
13
  import { hostname } from 'os';
@@ -1814,7 +1814,7 @@ async function saveClientCredentials({
1814
1814
  useApprovals,
1815
1815
  cleanupLogPrefix
1816
1816
  }) {
1817
- await setupClientCredentials({
1817
+ const { clientId } = await setupClientCredentials({
1818
1818
  api: api2,
1819
1819
  name,
1820
1820
  credentialsBaseUrl,
@@ -1828,10 +1828,12 @@ async function saveClientCredentials({
1828
1828
  err
1829
1829
  );
1830
1830
  }
1831
+ return { clientId };
1831
1832
  }
1832
1833
  function emitAccountAuthSuccess({
1833
1834
  sdk,
1834
- profile
1835
+ profile,
1836
+ clientId
1835
1837
  }) {
1836
1838
  sdk.context.eventEmission.emit(
1837
1839
  "platform.sdk.ApplicationLifecycleEvent",
@@ -1839,7 +1841,9 @@ function emitAccountAuthSuccess({
1839
1841
  { lifecycle_event_type: "login_success" },
1840
1842
  {
1841
1843
  customuser_id: profile.user_id,
1842
- account_id: profile.roles[0]?.account_id ?? null
1844
+ account_id: profile.roles[0]?.account_id ?? null,
1845
+ client_id: clientId,
1846
+ auth_mechanism: AuthMechanism.ClientCredentials
1843
1847
  }
1844
1848
  )
1845
1849
  );
@@ -1947,7 +1951,7 @@ async function runAccountAuth({
1947
1951
  entryPoint
1948
1952
  });
1949
1953
  const useApprovals = options.useApprovals === true;
1950
- await saveClientCredentials({
1954
+ const { clientId } = await saveClientCredentials({
1951
1955
  api: scopedApi,
1952
1956
  name: credentialName,
1953
1957
  credentialsBaseUrl,
@@ -1960,7 +1964,7 @@ async function runAccountAuth({
1960
1964
  if (useApprovals) {
1961
1965
  console.log("\u{1F510} Approvals are enabled for these credentials.");
1962
1966
  }
1963
- emitAccountAuthSuccess({ sdk, profile });
1967
+ emitAccountAuthSuccess({ sdk, profile, clientId });
1964
1968
  }
1965
1969
  var LoginSchema = z.object({
1966
1970
  name: z.string().optional().describe(
@@ -4554,7 +4558,7 @@ var watchTriggerInboxCliPlugin = definePlugin(
4554
4558
  // package.json with { type: 'json' }
4555
4559
  var package_default = {
4556
4560
  name: "@zapier/zapier-sdk-cli",
4557
- version: "0.58.0"};
4561
+ version: "0.58.2"};
4558
4562
 
4559
4563
  // src/experimental.ts
4560
4564
  injectCliLogin(login_exports);
package/dist/index.cjs CHANGED
@@ -1849,7 +1849,7 @@ async function saveClientCredentials({
1849
1849
  useApprovals,
1850
1850
  cleanupLogPrefix
1851
1851
  }) {
1852
- await setupClientCredentials({
1852
+ const { clientId } = await setupClientCredentials({
1853
1853
  api: api2,
1854
1854
  name,
1855
1855
  credentialsBaseUrl,
@@ -1863,10 +1863,12 @@ async function saveClientCredentials({
1863
1863
  err
1864
1864
  );
1865
1865
  }
1866
+ return { clientId };
1866
1867
  }
1867
1868
  function emitAccountAuthSuccess({
1868
1869
  sdk,
1869
- profile
1870
+ profile,
1871
+ clientId
1870
1872
  }) {
1871
1873
  sdk.context.eventEmission.emit(
1872
1874
  "platform.sdk.ApplicationLifecycleEvent",
@@ -1874,7 +1876,9 @@ function emitAccountAuthSuccess({
1874
1876
  { lifecycle_event_type: "login_success" },
1875
1877
  {
1876
1878
  customuser_id: profile.user_id,
1877
- account_id: profile.roles[0]?.account_id ?? null
1879
+ account_id: profile.roles[0]?.account_id ?? null,
1880
+ client_id: clientId,
1881
+ auth_mechanism: zapierSdk.AuthMechanism.ClientCredentials
1878
1882
  }
1879
1883
  )
1880
1884
  );
@@ -1982,7 +1986,7 @@ async function runAccountAuth({
1982
1986
  entryPoint
1983
1987
  });
1984
1988
  const useApprovals = options.useApprovals === true;
1985
- await saveClientCredentials({
1989
+ const { clientId } = await saveClientCredentials({
1986
1990
  api: scopedApi,
1987
1991
  name: credentialName,
1988
1992
  credentialsBaseUrl,
@@ -1995,7 +1999,7 @@ async function runAccountAuth({
1995
1999
  if (useApprovals) {
1996
2000
  console.log("\u{1F510} Approvals are enabled for these credentials.");
1997
2001
  }
1998
- emitAccountAuthSuccess({ sdk, profile });
2002
+ emitAccountAuthSuccess({ sdk, profile, clientId });
1999
2003
  }
2000
2004
  var LoginSchema = zod.z.object({
2001
2005
  name: zod.z.string().optional().describe(
@@ -4589,7 +4593,7 @@ zapierSdk.definePlugin(
4589
4593
  // package.json with { type: 'json' }
4590
4594
  var package_default = {
4591
4595
  name: "@zapier/zapier-sdk-cli",
4592
- version: "0.58.0"};
4596
+ version: "0.58.2"};
4593
4597
 
4594
4598
  // src/sdk.ts
4595
4599
  zapierSdk.injectCliLogin(login_exports);
@@ -4617,7 +4621,7 @@ function createZapierCliSdk(options = {}) {
4617
4621
 
4618
4622
  // package.json
4619
4623
  var package_default2 = {
4620
- version: "0.58.0"};
4624
+ version: "0.58.2"};
4621
4625
 
4622
4626
  // src/telemetry/builders.ts
4623
4627
  function createCliBaseEvent(context = {}) {
@@ -4627,6 +4631,8 @@ function createCliBaseEvent(context = {}) {
4627
4631
  release_id: zapierSdk.getReleaseId(),
4628
4632
  customuser_id: context.customuser_id ?? null,
4629
4633
  account_id: context.account_id ?? null,
4634
+ client_id: context.client_id ?? null,
4635
+ auth_mechanism: context.auth_mechanism ?? null,
4630
4636
  identity_id: context.identity_id ?? null,
4631
4637
  visitor_id: context.visitor_id ?? null,
4632
4638
  correlation_id: context.correlation_id ?? null
package/dist/index.d.mts CHANGED
@@ -69,6 +69,8 @@ interface CliCommandExecutedEvent extends BaseEvent {
69
69
  interface CliEventContext {
70
70
  customuser_id?: number | null;
71
71
  account_id?: number | null;
72
+ client_id?: string | null;
73
+ auth_mechanism?: string | null;
72
74
  identity_id?: number | null;
73
75
  visitor_id?: string | null;
74
76
  correlation_id?: string | null;
package/dist/index.d.ts CHANGED
@@ -69,6 +69,8 @@ interface CliCommandExecutedEvent extends BaseEvent {
69
69
  interface CliEventContext {
70
70
  customuser_id?: number | null;
71
71
  account_id?: number | null;
72
+ client_id?: string | null;
73
+ auth_mechanism?: string | null;
72
74
  identity_id?: number | null;
73
75
  visitor_id?: string | null;
74
76
  correlation_id?: string | null;
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import crypto, { createHash } from 'crypto';
7
7
  import * as path from 'path';
8
8
  import { resolve, join, dirname, basename, relative, extname } from 'path';
9
9
  import * as lockfile from 'proper-lockfile';
10
- import { definePlugin, createPluginMethod, OutputPropertySchema, ZapierBundleError, DEFAULT_CONFIG_PATH, ZapierValidationError, ZapierUnknownError, ZapierReleaseTriggerMessageSignal, injectCliLogin, getOrCreateApiClient, isPermanentHttpError, invalidateCachedToken, batch, toSnakeCase, ZapierAbortDrainSignal, isCredentialsObject, buildApplicationLifecycleEvent, ZapierAuthenticationError, ZapierError, createZapierSdkStack, addPlugin, getOsInfo, getPlatformVersions, getAgent, getTtyContext, getCiPlatform, isCi, getReleaseId, getCurrentTimestamp, generateEventId } from '@zapier/zapier-sdk';
10
+ import { definePlugin, createPluginMethod, OutputPropertySchema, ZapierBundleError, DEFAULT_CONFIG_PATH, ZapierValidationError, ZapierUnknownError, ZapierReleaseTriggerMessageSignal, injectCliLogin, getOrCreateApiClient, isPermanentHttpError, invalidateCachedToken, batch, toSnakeCase, ZapierAbortDrainSignal, isCredentialsObject, buildApplicationLifecycleEvent, AuthMechanism, ZapierAuthenticationError, ZapierError, createZapierSdkStack, addPlugin, getOsInfo, getPlatformVersions, getAgent, getTtyContext, getCiPlatform, isCi, getReleaseId, getCurrentTimestamp, generateEventId } from '@zapier/zapier-sdk';
11
11
  import { z } from 'zod';
12
12
  import { hostname } from 'os';
13
13
  import inquirer from 'inquirer';
@@ -1813,7 +1813,7 @@ async function saveClientCredentials({
1813
1813
  useApprovals,
1814
1814
  cleanupLogPrefix
1815
1815
  }) {
1816
- await setupClientCredentials({
1816
+ const { clientId } = await setupClientCredentials({
1817
1817
  api: api2,
1818
1818
  name,
1819
1819
  credentialsBaseUrl,
@@ -1827,10 +1827,12 @@ async function saveClientCredentials({
1827
1827
  err
1828
1828
  );
1829
1829
  }
1830
+ return { clientId };
1830
1831
  }
1831
1832
  function emitAccountAuthSuccess({
1832
1833
  sdk,
1833
- profile
1834
+ profile,
1835
+ clientId
1834
1836
  }) {
1835
1837
  sdk.context.eventEmission.emit(
1836
1838
  "platform.sdk.ApplicationLifecycleEvent",
@@ -1838,7 +1840,9 @@ function emitAccountAuthSuccess({
1838
1840
  { lifecycle_event_type: "login_success" },
1839
1841
  {
1840
1842
  customuser_id: profile.user_id,
1841
- account_id: profile.roles[0]?.account_id ?? null
1843
+ account_id: profile.roles[0]?.account_id ?? null,
1844
+ client_id: clientId,
1845
+ auth_mechanism: AuthMechanism.ClientCredentials
1842
1846
  }
1843
1847
  )
1844
1848
  );
@@ -1946,7 +1950,7 @@ async function runAccountAuth({
1946
1950
  entryPoint
1947
1951
  });
1948
1952
  const useApprovals = options.useApprovals === true;
1949
- await saveClientCredentials({
1953
+ const { clientId } = await saveClientCredentials({
1950
1954
  api: scopedApi,
1951
1955
  name: credentialName,
1952
1956
  credentialsBaseUrl,
@@ -1959,7 +1963,7 @@ async function runAccountAuth({
1959
1963
  if (useApprovals) {
1960
1964
  console.log("\u{1F510} Approvals are enabled for these credentials.");
1961
1965
  }
1962
- emitAccountAuthSuccess({ sdk, profile });
1966
+ emitAccountAuthSuccess({ sdk, profile, clientId });
1963
1967
  }
1964
1968
  var LoginSchema = z.object({
1965
1969
  name: z.string().optional().describe(
@@ -4553,7 +4557,7 @@ definePlugin(
4553
4557
  // package.json with { type: 'json' }
4554
4558
  var package_default = {
4555
4559
  name: "@zapier/zapier-sdk-cli",
4556
- version: "0.58.0"};
4560
+ version: "0.58.2"};
4557
4561
 
4558
4562
  // src/sdk.ts
4559
4563
  injectCliLogin(login_exports);
@@ -4581,7 +4585,7 @@ function createZapierCliSdk(options = {}) {
4581
4585
 
4582
4586
  // package.json
4583
4587
  var package_default2 = {
4584
- version: "0.58.0"};
4588
+ version: "0.58.2"};
4585
4589
 
4586
4590
  // src/telemetry/builders.ts
4587
4591
  function createCliBaseEvent(context = {}) {
@@ -4591,6 +4595,8 @@ function createCliBaseEvent(context = {}) {
4591
4595
  release_id: getReleaseId(),
4592
4596
  customuser_id: context.customuser_id ?? null,
4593
4597
  account_id: context.account_id ?? null,
4598
+ client_id: context.client_id ?? null,
4599
+ auth_mechanism: context.auth_mechanism ?? null,
4594
4600
  identity_id: context.identity_id ?? null,
4595
4601
  visitor_id: context.visitor_id ?? null,
4596
4602
  correlation_id: context.correlation_id ?? null
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk-cli",
3
- "version": "0.58.0",
3
+ "version": "0.58.2",
4
4
  "description": "Command line interface for Zapier SDK",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -8,6 +8,8 @@ import type { CliCommandExecutedEvent } from "./events";
8
8
  export interface CliEventContext {
9
9
  customuser_id?: number | null;
10
10
  account_id?: number | null;
11
+ client_id?: string | null;
12
+ auth_mechanism?: string | null;
11
13
  identity_id?: number | null;
12
14
  visitor_id?: string | null;
13
15
  correlation_id?: string | null;
@@ -14,6 +14,8 @@ function createCliBaseEvent(context = {}) {
14
14
  release_id: getReleaseId(),
15
15
  customuser_id: context.customuser_id ?? null,
16
16
  account_id: context.account_id ?? null,
17
+ client_id: context.client_id ?? null,
18
+ auth_mechanism: context.auth_mechanism ?? null,
17
19
  identity_id: context.identity_id ?? null,
18
20
  visitor_id: context.visitor_id ?? null,
19
21
  correlation_id: context.correlation_id ?? null,
@@ -1,6 +1,6 @@
1
1
  import { hostname } from "node:os";
2
2
  import inquirer from "inquirer";
3
- import { buildApplicationLifecycleEvent, getOrCreateApiClient, isCredentialsObject, } from "@zapier/zapier-sdk";
3
+ import { AuthMechanism, buildApplicationLifecycleEvent, getOrCreateApiClient, isCredentialsObject, } from "@zapier/zapier-sdk";
4
4
  import { revokeCredentials } from "../../login/credentials-revoke";
5
5
  import { credentialNameExists, deleteStoredClientCredentials, getActiveCredentials, resolveAvailableCredentialName, } from "../../login/credentials-store";
6
6
  import { clearLegacyJwtState, hasLegacyJwtConfig, } from "../../login/legacy-jwt";
@@ -168,7 +168,7 @@ async function getProfile(api) {
168
168
  });
169
169
  }
170
170
  async function saveClientCredentials({ api, name, credentialsBaseUrl, useApprovals, cleanupLogPrefix, }) {
171
- await setupClientCredentials({
171
+ const { clientId } = await setupClientCredentials({
172
172
  api,
173
173
  name,
174
174
  credentialsBaseUrl,
@@ -180,11 +180,14 @@ async function saveClientCredentials({ api, name, credentialsBaseUrl, useApprova
180
180
  catch (err) {
181
181
  console.error(`[${cleanupLogPrefix}] Best-effort legacy JWT cleanup failed:`, err);
182
182
  }
183
+ return { clientId };
183
184
  }
184
- function emitAccountAuthSuccess({ sdk, profile, }) {
185
+ function emitAccountAuthSuccess({ sdk, profile, clientId, }) {
185
186
  sdk.context.eventEmission.emit("platform.sdk.ApplicationLifecycleEvent", buildApplicationLifecycleEvent({ lifecycle_event_type: "login_success" }, {
186
187
  customuser_id: profile.user_id,
187
188
  account_id: profile.roles[0]?.account_id ?? null,
189
+ client_id: clientId,
190
+ auth_mechanism: AuthMechanism.ClientCredentials,
188
191
  }));
189
192
  }
190
193
  function emitSignupSuccess({ sdk, }) {
@@ -284,7 +287,7 @@ export async function runAccountAuth({ sdk, options, entryPoint, }) {
284
287
  entryPoint,
285
288
  }));
286
289
  const useApprovals = options.useApprovals === true;
287
- await saveClientCredentials({
290
+ const { clientId } = await saveClientCredentials({
288
291
  api: scopedApi,
289
292
  name: credentialName,
290
293
  credentialsBaseUrl,
@@ -295,5 +298,5 @@ export async function runAccountAuth({ sdk, options, entryPoint, }) {
295
298
  if (useApprovals) {
296
299
  console.log("🔐 Approvals are enabled for these credentials.");
297
300
  }
298
- emitAccountAuthSuccess({ sdk, profile });
301
+ emitAccountAuthSuccess({ sdk, profile, clientId });
299
302
  }