@usesocial/cli 0.19.3 → 0.19.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/dist/index.mjs CHANGED
@@ -11042,13 +11042,20 @@ function uniqueIndex(name) {
11042
11042
  //#endregion
11043
11043
  //#region ../../packages/db/src/domain.ts
11044
11044
  const PLATFORMS = ["linkedin", "x"];
11045
- const CONNECTED_ACCOUNT_STATUSES = [
11045
+ const MATERIALIZED_CONNECTED_ACCOUNT_STATUSES = [
11046
11046
  "connected",
11047
11047
  "credentials",
11048
11048
  "connecting",
11049
11049
  "disconnected",
11050
11050
  "error"
11051
11051
  ];
11052
+ const CONNECTED_ACCOUNT_STATUSES = [
11053
+ ...MATERIALIZED_CONNECTED_ACCOUNT_STATUSES,
11054
+ "pending_billing",
11055
+ "pending_approval",
11056
+ "failed",
11057
+ "expired"
11058
+ ];
11052
11059
  const ACCOUNT_CONNECT_ATTEMPT_LANES = ["provider", "legacy"];
11053
11060
  const ACCOUNT_CONNECT_ATTEMPT_STATUSES = [
11054
11061
  "pending_billing",
@@ -11118,6 +11125,7 @@ const WEBHOOK_OPERATION_STATES = [
11118
11125
  ];
11119
11126
  _enum(PLATFORMS);
11120
11127
  _enum(CONNECTED_ACCOUNT_STATUSES);
11128
+ _enum(MATERIALIZED_CONNECTED_ACCOUNT_STATUSES);
11121
11129
  _enum(ACCOUNT_CONNECT_ATTEMPT_LANES);
11122
11130
  _enum(ACCOUNT_CONNECT_ATTEMPT_STATUSES);
11123
11131
  _enum(PROXY_SURFACES);
@@ -11294,23 +11302,36 @@ const connectedAccounts = pgTable("connected_accounts", {
11294
11302
  id: text$1("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
11295
11303
  userId: text$1("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
11296
11304
  platform: text$1("platform", { enum: PLATFORMS }).notNull(),
11297
- platformAccountId: text$1("platform_account_id").notNull(),
11298
- platformProfileId: text$1("platform_profile_id").notNull(),
11299
- username: text$1("username").notNull(),
11300
- displayName: text$1("display_name").notNull(),
11305
+ platformAccountId: text$1("platform_account_id"),
11306
+ platformProfileId: text$1("platform_profile_id"),
11307
+ username: text$1("username"),
11308
+ displayName: text$1("display_name"),
11301
11309
  profileImageURL: text$1("profile_image_url"),
11302
11310
  status: text$1("status", { enum: CONNECTED_ACCOUNT_STATUSES }).notNull().default("connected"),
11303
11311
  platformData: jsonb("platform_data").$type().notNull().default(sql`'{}'::jsonb`),
11304
- connectedAt: timestamptz("connected_at").notNull().defaultNow(),
11305
- lastSeenAt: timestamptz("last_seen_at").notNull().defaultNow()
11312
+ connectExpiresAt: timestamptz("connect_expires_at"),
11313
+ connectURL: text$1("connect_url"),
11314
+ billingPaymentURL: text$1("billing_payment_url"),
11315
+ billingRequiredAction: jsonb("billing_required_action").$type(),
11316
+ failureCode: text$1("failure_code"),
11317
+ failureStage: text$1("failure_stage"),
11318
+ connectedAt: timestamptz("connected_at"),
11319
+ lastSeenAt: timestamptz("last_seen_at"),
11320
+ createdAt: timestamptz("created_at").notNull().defaultNow(),
11321
+ updatedAt: timestamptz("updated_at").notNull().defaultNow().$onUpdate(() => /* @__PURE__ */ new Date())
11306
11322
  }, (table) => [
11307
11323
  uniqueIndex("connected_accounts_platform_account_pkey").on(table.platform, table.platformAccountId),
11324
+ uniqueIndex("connected_accounts_platform_profile_pkey").on(table.platform, table.platformProfileId).where(sql`${table.platformProfileId} is not null`),
11308
11325
  uniqueIndex("connected_accounts_user_platform_pkey").on(table.userId, table.platform, table.platformAccountId),
11309
11326
  uniqueIndex("connected_accounts_user_platform_id_key").on(table.userId, table.platform, table.id),
11310
11327
  index("connected_accounts_user_platform_idx").on(table.userId, table.platform).where(sql`${table.status} = 'connected'`),
11311
11328
  index("connected_accounts_user_username_idx").on(table.userId, table.platform, table.username),
11329
+ uniqueIndex("connected_accounts_active_partial_user_platform_key").on(table.userId, table.platform).where(sql`${table.status} in ('pending_billing', 'pending_approval')`),
11330
+ index("connected_accounts_partial_expiry_idx").on(table.connectExpiresAt).where(sql`${table.status} in ('pending_billing', 'pending_approval')`),
11331
+ index("connected_accounts_terminal_updated_idx").on(table.updatedAt).where(sql`${table.status} in ('failed', 'expired')`),
11312
11332
  check("connected_accounts_platform_check", sqlCheckIn(table.platform, PLATFORMS)),
11313
- check("connected_accounts_status_check", sqlCheckIn(table.status, CONNECTED_ACCOUNT_STATUSES))
11333
+ check("connected_accounts_status_check", sqlCheckIn(table.status, CONNECTED_ACCOUNT_STATUSES)),
11334
+ check("connected_accounts_materialized_fields_check", sql`${table.status} in ('pending_billing', 'pending_approval', 'failed', 'expired') or (${table.platformAccountId} is not null and ${table.platformProfileId} is not null and ${table.username} is not null and ${table.displayName} is not null and ${table.connectedAt} is not null and ${table.lastSeenAt} is not null)`)
11314
11335
  ]);
11315
11336
  pgTable("account_connect_attempts", {
11316
11337
  id: text$1("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
@@ -11323,6 +11344,8 @@ pgTable("account_connect_attempts", {
11323
11344
  operationKey: text$1("operation_key").notNull(),
11324
11345
  billingPaymentURL: text$1("billing_payment_url"),
11325
11346
  billingRequiredAction: jsonb("billing_required_action").$type(),
11347
+ failureCode: text$1("failure_code"),
11348
+ failureStage: text$1("failure_stage"),
11326
11349
  hostedAuthBindingId: text$1("hosted_auth_binding_id"),
11327
11350
  hostedAuthAccountId: text$1("hosted_auth_account_id"),
11328
11351
  hostedAuthBoundAt: timestamptz("hosted_auth_bound_at"),
@@ -13223,19 +13246,20 @@ const LINKEDIN_OPERATIONS = [
13223
13246
  },
13224
13247
  parameters: [
13225
13248
  {
13226
- name: "limit",
13249
+ name: "cursor",
13227
13250
  in: "query",
13228
13251
  required: false,
13229
- kind: "integer",
13230
- max: 20,
13231
- description: "Rows to return (1-20)"
13252
+ kind: "string",
13253
+ description: "Pagination cursor"
13232
13254
  },
13233
13255
  {
13234
- name: "cursor",
13256
+ name: "limit",
13235
13257
  in: "query",
13236
13258
  required: false,
13237
- kind: "string",
13238
- description: "Pagination cursor"
13259
+ kind: "integer",
13260
+ min: 1,
13261
+ max: 20,
13262
+ description: "Rows to return (1-20)"
13239
13263
  },
13240
13264
  {
13241
13265
  name: "before",
@@ -13314,18 +13338,19 @@ const LINKEDIN_OPERATIONS = [
13314
13338
  description: "An offset used for pagination, if supported by the provider, else use cursor."
13315
13339
  },
13316
13340
  {
13317
- name: "limit",
13341
+ name: "cursor",
13318
13342
  in: "query",
13319
13343
  required: false,
13320
- kind: "integer",
13321
- description: "Rows to return (1-250)"
13344
+ kind: "string",
13345
+ description: "Pagination cursor"
13322
13346
  },
13323
13347
  {
13324
- name: "cursor",
13348
+ name: "limit",
13325
13349
  in: "query",
13326
13350
  required: false,
13327
- kind: "string",
13328
- description: "Pagination cursor"
13351
+ kind: "integer",
13352
+ min: 1,
13353
+ description: "Rows to return (1-250)"
13329
13354
  },
13330
13355
  {
13331
13356
  name: "chat_id",
@@ -13412,6 +13437,8 @@ const LINKEDIN_OPERATIONS = [
13412
13437
  in: "query",
13413
13438
  required: false,
13414
13439
  kind: "integer",
13440
+ min: 1,
13441
+ max: 100,
13415
13442
  description: "Rows to return (1-100)"
13416
13443
  },
13417
13444
  {
@@ -13514,6 +13541,7 @@ const LINKEDIN_OPERATIONS = [
13514
13541
  in: "query",
13515
13542
  required: false,
13516
13543
  kind: "integer",
13544
+ min: 1,
13517
13545
  description: "Rows to return (1-100)"
13518
13546
  },
13519
13547
  {
@@ -13576,6 +13604,7 @@ const LINKEDIN_OPERATIONS = [
13576
13604
  in: "query",
13577
13605
  required: false,
13578
13606
  kind: "integer",
13607
+ min: 1,
13579
13608
  description: "Rows to return (1-100)"
13580
13609
  },
13581
13610
  {
@@ -13607,9 +13636,9 @@ const LINKEDIN_OPERATIONS = [
13607
13636
  capability: "read",
13608
13637
  mutates: false,
13609
13638
  pagination: {
13610
- style: "offset",
13611
- limitParam: "limit",
13612
- offsetParam: "offset",
13639
+ style: "cursor",
13640
+ cursorParam: "cursor",
13641
+ cursorPath: "next_cursor",
13613
13642
  totalCountPath: "total_count",
13614
13643
  itemsPath: "data"
13615
13644
  },
@@ -13617,29 +13646,19 @@ const LINKEDIN_OPERATIONS = [
13617
13646
  billingCategory: "user_read",
13618
13647
  kind: "search"
13619
13648
  },
13620
- parameters: [
13621
- {
13622
- name: "offset",
13623
- in: "query",
13624
- required: false,
13625
- kind: "integer",
13626
- description: "Pagination offset"
13627
- },
13628
- {
13629
- name: "limit",
13630
- in: "query",
13631
- required: false,
13632
- kind: "integer",
13633
- description: "Rows to return (1-100)"
13634
- },
13635
- {
13636
- name: "keywords",
13637
- in: "query",
13638
- required: true,
13639
- kind: "string",
13640
- description: "Search keywords"
13641
- }
13642
- ]
13649
+ parameters: [{
13650
+ name: "cursor",
13651
+ in: "query",
13652
+ required: false,
13653
+ kind: "string",
13654
+ description: "Pagination cursor"
13655
+ }, {
13656
+ name: "keywords",
13657
+ in: "query",
13658
+ required: true,
13659
+ kind: "string",
13660
+ description: "Search keywords"
13661
+ }]
13643
13662
  },
13644
13663
  {
13645
13664
  schemaBaseName: "SearchJobs",
@@ -13683,6 +13702,8 @@ const LINKEDIN_OPERATIONS = [
13683
13702
  in: "query",
13684
13703
  required: false,
13685
13704
  kind: "integer",
13705
+ min: 1,
13706
+ max: 100,
13686
13707
  description: "Rows to return (1-100)"
13687
13708
  },
13688
13709
  {
@@ -13713,9 +13734,9 @@ const LINKEDIN_OPERATIONS = [
13713
13734
  capability: "read",
13714
13735
  mutates: false,
13715
13736
  pagination: {
13716
- style: "offset",
13717
- limitParam: "limit",
13718
- offsetParam: "offset",
13737
+ style: "cursor",
13738
+ cursorParam: "cursor",
13739
+ cursorPath: "next_cursor",
13719
13740
  totalCountPath: "total_count",
13720
13741
  itemsPath: "data"
13721
13742
  },
@@ -13723,29 +13744,19 @@ const LINKEDIN_OPERATIONS = [
13723
13744
  billingCategory: "user_read",
13724
13745
  kind: "search"
13725
13746
  },
13726
- parameters: [
13727
- {
13728
- name: "offset",
13729
- in: "query",
13730
- required: false,
13731
- kind: "integer",
13732
- description: "Pagination offset"
13733
- },
13734
- {
13735
- name: "limit",
13736
- in: "query",
13737
- required: false,
13738
- kind: "integer",
13739
- description: "Rows to return (1-100)"
13740
- },
13741
- {
13742
- name: "keywords",
13743
- in: "query",
13744
- required: true,
13745
- kind: "string",
13746
- description: "Search keywords"
13747
- }
13748
- ]
13747
+ parameters: [{
13748
+ name: "cursor",
13749
+ in: "query",
13750
+ required: false,
13751
+ kind: "string",
13752
+ description: "Pagination cursor"
13753
+ }, {
13754
+ name: "keywords",
13755
+ in: "query",
13756
+ required: true,
13757
+ kind: "string",
13758
+ description: "Search keywords"
13759
+ }]
13749
13760
  },
13750
13761
  {
13751
13762
  schemaBaseName: "SearchPosts",
@@ -13766,9 +13777,9 @@ const LINKEDIN_OPERATIONS = [
13766
13777
  capability: "read",
13767
13778
  mutates: false,
13768
13779
  pagination: {
13769
- style: "offset",
13770
- limitParam: "limit",
13771
- offsetParam: "offset",
13780
+ style: "cursor",
13781
+ cursorParam: "cursor",
13782
+ cursorPath: "next_cursor",
13772
13783
  totalCountPath: "total_count",
13773
13784
  itemsPath: "data"
13774
13785
  },
@@ -13776,29 +13787,19 @@ const LINKEDIN_OPERATIONS = [
13776
13787
  billingCategory: "posts_read",
13777
13788
  kind: "search"
13778
13789
  },
13779
- parameters: [
13780
- {
13781
- name: "offset",
13782
- in: "query",
13783
- required: false,
13784
- kind: "integer",
13785
- description: "Pagination offset"
13786
- },
13787
- {
13788
- name: "limit",
13789
- in: "query",
13790
- required: false,
13791
- kind: "integer",
13792
- description: "Rows to return (1-100)"
13793
- },
13794
- {
13795
- name: "keywords",
13796
- in: "query",
13797
- required: true,
13798
- kind: "string",
13799
- description: "Search keywords"
13800
- }
13801
- ]
13790
+ parameters: [{
13791
+ name: "cursor",
13792
+ in: "query",
13793
+ required: false,
13794
+ kind: "string",
13795
+ description: "Pagination cursor"
13796
+ }, {
13797
+ name: "keywords",
13798
+ in: "query",
13799
+ required: true,
13800
+ kind: "string",
13801
+ description: "Search keywords"
13802
+ }]
13802
13803
  },
13803
13804
  {
13804
13805
  schemaBaseName: "UserProfile",
@@ -13881,18 +13882,19 @@ const LINKEDIN_OPERATIONS = [
13881
13882
  },
13882
13883
  parameters: [
13883
13884
  {
13884
- name: "limit",
13885
+ name: "cursor",
13885
13886
  in: "query",
13886
13887
  required: false,
13887
- kind: "integer",
13888
- description: "Rows to return (1-100)"
13888
+ kind: "string",
13889
+ description: "Pagination cursor"
13889
13890
  },
13890
13891
  {
13891
- name: "cursor",
13892
+ name: "limit",
13892
13893
  in: "query",
13893
13894
  required: false,
13894
- kind: "string",
13895
- description: "Pagination cursor"
13895
+ kind: "integer",
13896
+ min: 1,
13897
+ description: "Rows to return (1-100)"
13896
13898
  },
13897
13899
  {
13898
13900
  name: "identifier",
@@ -13938,18 +13940,19 @@ const LINKEDIN_OPERATIONS = [
13938
13940
  },
13939
13941
  parameters: [
13940
13942
  {
13941
- name: "limit",
13943
+ name: "cursor",
13942
13944
  in: "query",
13943
13945
  required: false,
13944
- kind: "integer",
13945
- description: "Rows to return (1-1000)"
13946
+ kind: "string",
13947
+ description: "Pagination cursor"
13946
13948
  },
13947
13949
  {
13948
- name: "cursor",
13950
+ name: "limit",
13949
13951
  in: "query",
13950
13952
  required: false,
13951
- kind: "string",
13952
- description: "Pagination cursor"
13953
+ kind: "integer",
13954
+ min: 1,
13955
+ description: "Rows to return (1-1000)"
13953
13956
  },
13954
13957
  {
13955
13958
  name: "user_id",
@@ -14006,6 +14009,7 @@ const LINKEDIN_OPERATIONS = [
14006
14009
  in: "query",
14007
14010
  required: false,
14008
14011
  kind: "integer",
14012
+ min: 1,
14009
14013
  description: "Rows to return (1-100)"
14010
14014
  }]
14011
14015
  },
@@ -14047,6 +14051,7 @@ const LINKEDIN_OPERATIONS = [
14047
14051
  in: "query",
14048
14052
  required: false,
14049
14053
  kind: "integer",
14054
+ min: 1,
14050
14055
  description: "Rows to return (1-100)"
14051
14056
  }]
14052
14057
  },
@@ -14532,8 +14537,8 @@ const dataWithAuditableWriteTarget = (op, data, body) => {
14532
14537
  //#endregion
14533
14538
  //#region ../../packages/linkedin/src/cli/types.ts
14534
14539
  const MessagesListInput = object({
14535
- limit: union([string(), number()]).optional(),
14536
14540
  cursor: string().optional(),
14541
+ limit: union([string(), number()]).optional(),
14537
14542
  before: string().optional(),
14538
14543
  after: string().optional()
14539
14544
  });
@@ -14547,8 +14552,8 @@ const MessagesReadInput = object({
14547
14552
  after: string().optional(),
14548
14553
  user_id: string().optional(),
14549
14554
  offset: union([string(), number()]).optional(),
14550
- limit: union([string(), number()]).optional(),
14551
14555
  cursor: string().optional(),
14556
+ limit: union([string(), number()]).optional(),
14552
14557
  chat_id: string()
14553
14558
  });
14554
14559
  const MessagesReadOutput = object({
@@ -14596,8 +14601,7 @@ const PostsReactionsOutput = object({
14596
14601
  next_cursor: string().optional()
14597
14602
  }).passthrough();
14598
14603
  const SearchCompaniesInput = object({
14599
- offset: union([string(), number()]).optional(),
14600
- limit: union([string(), number()]).optional(),
14604
+ cursor: string().optional(),
14601
14605
  keywords: string()
14602
14606
  });
14603
14607
  const SearchCompaniesOutput = object({
@@ -14616,8 +14620,7 @@ const SearchJobsOutput = object({
14616
14620
  next_cursor: string().optional()
14617
14621
  }).passthrough();
14618
14622
  const SearchPeopleInput = object({
14619
- offset: union([string(), number()]).optional(),
14620
- limit: union([string(), number()]).optional(),
14623
+ cursor: string().optional(),
14621
14624
  keywords: string()
14622
14625
  });
14623
14626
  const SearchPeopleOutput = object({
@@ -14626,8 +14629,7 @@ const SearchPeopleOutput = object({
14626
14629
  next_cursor: string().optional()
14627
14630
  }).passthrough();
14628
14631
  const SearchPostsInput = object({
14629
- offset: union([string(), number()]).optional(),
14630
- limit: union([string(), number()]).optional(),
14632
+ cursor: string().optional(),
14631
14633
  keywords: string()
14632
14634
  });
14633
14635
  const SearchPostsOutput = object({
@@ -14642,8 +14644,8 @@ const UserProfileInput = object({
14642
14644
  });
14643
14645
  const UserProfileOutput = record(string(), unknown());
14644
14646
  const UserPostsInput = object({
14645
- limit: union([string(), number()]).optional(),
14646
14647
  cursor: string().optional(),
14648
+ limit: union([string(), number()]).optional(),
14647
14649
  identifier: string()
14648
14650
  });
14649
14651
  const UserPostsOutput = object({
@@ -14652,8 +14654,8 @@ const UserPostsOutput = object({
14652
14654
  next_cursor: string().optional()
14653
14655
  }).passthrough();
14654
14656
  const UserConnectionsInput = object({
14655
- limit: union([string(), number()]).optional(),
14656
14657
  cursor: string().optional(),
14658
+ limit: union([string(), number()]).optional(),
14657
14659
  user_id: string().optional(),
14658
14660
  filter: string().optional()
14659
14661
  });
@@ -14765,6 +14767,8 @@ const PostsCommentOutput = object({
14765
14767
  ]),
14766
14768
  public_identifier: string().optional(),
14767
14769
  display_name: string(),
14770
+ first_name: string().optional(),
14771
+ last_name: string().optional(),
14768
14772
  profile_url: string().optional(),
14769
14773
  public_picture_url: string().optional(),
14770
14774
  private_picture_download_url: string().optional(),
@@ -14878,11 +14882,13 @@ const schemas$1 = {
14878
14882
  ]),
14879
14883
  public_identifier: string().optional(),
14880
14884
  display_name: string(),
14885
+ first_name: string().optional(),
14886
+ last_name: string().optional(),
14881
14887
  profile_url: string().optional(),
14882
14888
  public_picture_url: string().optional(),
14883
14889
  private_picture_download_url: string().optional(),
14884
14890
  description: string().optional(),
14885
- specifics: unknown().optional()
14891
+ specifics: union([record(string(), unknown()), record(string(), unknown())]).optional()
14886
14892
  }).passthrough().optional()
14887
14893
  }).passthrough(),
14888
14894
  RequestsAcceptInput: object({ request_id: string() }),
@@ -22851,18 +22857,18 @@ const resolveDisconnectTarget = async (deps, identifier) => {
22851
22857
  if (ae.isError(account)) throw account.error;
22852
22858
  return account.value;
22853
22859
  };
22854
- const connectLinkedinAccount = async (deps, attemptId) => {
22860
+ const connectLinkedinAccount = async (deps, accountId) => {
22855
22861
  const intervalMs = deps.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
22856
22862
  const sleep = deps.sleep ?? setTimeout$1;
22857
22863
  const startedAt = Date.now();
22858
- let currentAttemptId = attemptId;
22864
+ let currentAccountId = accountId;
22859
22865
  const surfacedURLs = /* @__PURE__ */ new Set();
22860
22866
  while (Date.now() - startedAt < CONNECT_POLL_TIMEOUT_MS) {
22861
22867
  const state = await deps.client.connectStep({
22862
22868
  platform: LINKEDIN_PLATFORM,
22863
- ...currentAttemptId ? { attemptId: currentAttemptId } : {}
22869
+ ...currentAccountId ? { accountId: currentAccountId } : {}
22864
22870
  });
22865
- currentAttemptId = state.attemptId;
22871
+ currentAccountId = state.accountId;
22866
22872
  if (state.status === "connected") return {
22867
22873
  platform: LINKEDIN_PLATFORM,
22868
22874
  status: "connected",
@@ -23028,18 +23034,18 @@ const listXLifecycleAccounts = async (deps, includeDisconnected) => ae.ok(await
23028
23034
  platform: "x",
23029
23035
  includeDisconnected
23030
23036
  }));
23031
- const connectXAccount = async (deps, attemptId) => {
23037
+ const connectXAccount = async (deps, accountId) => {
23032
23038
  const sleep = deps.sleep ?? defaultSleep;
23033
23039
  const now = deps.now ?? Date.now;
23034
23040
  const startedAt = now();
23035
- let currentAttemptId = attemptId;
23041
+ let currentAccountId = accountId;
23036
23042
  const surfacedURLs = /* @__PURE__ */ new Set();
23037
23043
  while (now() - startedAt < CONNECT_TIMEOUT_MS) {
23038
23044
  const state = await deps.client.connectStep({
23039
23045
  platform: "x",
23040
- ...currentAttemptId ? { attemptId: currentAttemptId } : {}
23046
+ ...currentAccountId ? { accountId: currentAccountId } : {}
23041
23047
  });
23042
- currentAttemptId = state.attemptId;
23048
+ currentAccountId = state.accountId;
23043
23049
  if (state.status === "connected") return ae.ok({
23044
23050
  platform: "x",
23045
23051
  status: "connected",
@@ -24504,7 +24510,7 @@ function createEnv(opts) {
24504
24510
  }
24505
24511
  //#endregion
24506
24512
  //#region package.json
24507
- var version$1 = "0.19.3";
24513
+ var version$1 = "0.19.5";
24508
24514
  //#endregion
24509
24515
  //#region src/lib/env.ts
24510
24516
  const URLWithTrailingSlash = url().transform(ensureTrailingSlash);
@@ -33676,13 +33682,13 @@ const AccountDefaultSetInput = AccountDefaultGetInput.extend({ account: string()
33676
33682
  const AccountConnectStateOutput = discriminatedUnion("status", [
33677
33683
  object({
33678
33684
  status: literal("connected"),
33679
- attemptId: uuid$1(),
33685
+ accountId: uuid$1(),
33680
33686
  platform: _enum(["linkedin", "x"]),
33681
33687
  account: LifecycleAccountOutput
33682
33688
  }),
33683
33689
  object({
33684
33690
  status: literal("pending_billing"),
33685
- attemptId: uuid$1(),
33691
+ accountId: uuid$1(),
33686
33692
  platform: _enum(["linkedin", "x"]),
33687
33693
  plan: object({
33688
33694
  id: string(),
@@ -33701,14 +33707,14 @@ const AccountConnectStateOutput = discriminatedUnion("status", [
33701
33707
  }),
33702
33708
  object({
33703
33709
  status: literal("pending_approval"),
33704
- attemptId: uuid$1(),
33710
+ accountId: uuid$1(),
33705
33711
  platform: _enum(["linkedin", "x"]),
33706
33712
  connectURL: string().nullable(),
33707
33713
  expiresAt: string()
33708
33714
  }),
33709
33715
  object({
33710
33716
  status: _enum(["expired", "failed"]),
33711
- attemptId: uuid$1(),
33717
+ accountId: uuid$1(),
33712
33718
  platform: _enum(["linkedin", "x"]),
33713
33719
  code: string(),
33714
33720
  retryable: boolean$1()
@@ -33803,12 +33809,12 @@ const lifecycleConnectContract = writeCLIContract({
33803
33809
  responseShaping: { supported: false },
33804
33810
  idempotency: {
33805
33811
  idempotent: false,
33806
- retrySafeWith: "attemptId"
33812
+ retrySafeWith: "accountId"
33807
33813
  },
33808
- idField: "attemptId",
33814
+ idField: "accountId",
33809
33815
  hazards: [{
33810
33816
  code: "account_connect_billing",
33811
- message: "The first call can start provider billing; pass the returned attemptId when polling so retries cannot start another charge."
33817
+ message: "The first call can start provider billing; pass the returned accountId when polling so retries cannot start another charge."
33812
33818
  }]
33813
33819
  });
33814
33820
  const usernameLabelFor = (account) => account.username.startsWith("@") ? account.username : `@${account.username}`;
@@ -33840,11 +33846,11 @@ const runConnectOutput = async (deps, connect) => {
33840
33846
  writeText(deps, `${usernameLabelFor(result.account)} connected!`);
33841
33847
  };
33842
33848
  const isInteractiveConnect = (deps) => deps.isInteractiveTerminal?.() === true;
33843
- /** One retry-safe connect step for a non-TTY caller; the JSON carries its next attempt ID. */
33844
- const runConnectStep = async (deps, platform, attemptId) => {
33849
+ /** One retry-safe connect step for a non-TTY caller; the JSON carries its account ID. */
33850
+ const runConnectStep = async (deps, platform, accountId) => {
33845
33851
  const state = await deps.client.connectStep({
33846
33852
  platform,
33847
- ...attemptId ? { attemptId } : {}
33853
+ ...accountId ? { accountId } : {}
33848
33854
  });
33849
33855
  await writeOutput(deps, state);
33850
33856
  };
@@ -33856,12 +33862,13 @@ const createConnectPlatformCommand = (platform, run) => defineCommand({
33856
33862
  contract: lifecycleConnectContract,
33857
33863
  mutates: true
33858
33864
  }),
33859
- args: { attempt: {
33865
+ args: { "account-id": {
33860
33866
  type: "string",
33861
- description: "Resume the exact connect attempt returned by a previous call."
33867
+ description: "Resume the exact connection returned by a previous call."
33862
33868
  } },
33863
- run: async ({ args }) => {
33864
- await run({ attempt: typeof args.attempt === "string" ? args.attempt : void 0 });
33869
+ run: async ({ args, rawArgs }) => {
33870
+ if (rawArgs?.includes("--attempt") || rawArgs?.some((arg) => arg.startsWith("--attempt="))) throw new UsageError("--attempt was removed; use --account-id.");
33871
+ await run({ accountId: typeof args["account-id"] === "string" ? args["account-id"] : void 0 });
33865
33872
  }
33866
33873
  });
33867
33874
  const createAccountPlatformCommand = (platform, description, run, options = {}) => defineCommand({
@@ -33947,23 +33954,23 @@ const createAccountCommand = (deps, accountSetupCommand = setupCommand) => {
33947
33954
  description: "Connect a LinkedIn or X account."
33948
33955
  },
33949
33956
  subCommands: {
33950
- linkedin: createConnectPlatformCommand("linkedin", async ({ attempt }) => {
33957
+ linkedin: createConnectPlatformCommand("linkedin", async ({ accountId }) => {
33951
33958
  if (isInteractiveConnect(deps)) {
33952
- await runConnectOutput(deps, (connectDeps) => connectLinkedinAccount(connectDeps, attempt));
33959
+ await runConnectOutput(deps, (connectDeps) => connectLinkedinAccount(connectDeps, accountId));
33953
33960
  return;
33954
33961
  }
33955
- await runConnectStep(deps, "linkedin", attempt);
33962
+ await runConnectStep(deps, "linkedin", accountId);
33956
33963
  }),
33957
- x: createConnectPlatformCommand("x", async ({ attempt }) => {
33964
+ x: createConnectPlatformCommand("x", async ({ accountId }) => {
33958
33965
  if (isInteractiveConnect(deps)) {
33959
33966
  await runConnectOutput(deps, async (connectDeps) => {
33960
- const result = await connectXAccount(connectDeps, attempt);
33967
+ const result = await connectXAccount(connectDeps, accountId);
33961
33968
  if (ae.isError(result)) throwXLifecycleError(result.error);
33962
33969
  return result.value;
33963
33970
  });
33964
33971
  return;
33965
33972
  }
33966
- await runConnectStep(deps, "x", attempt);
33973
+ await runConnectStep(deps, "x", accountId);
33967
33974
  })
33968
33975
  }
33969
33976
  });