@usesocial/cli 0.11.1 → 0.11.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,11 @@
1
1
  # @usesocial/cli
2
2
 
3
+ ## 0.11.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#46](https://github.com/usesocial/monorepo/pull/46) [`88f7b42`](https://github.com/usesocial/monorepo/commit/88f7b42abaec62175fb6ca030e301c8497601901) Thanks [@CyrusNuevoDia](https://github.com/CyrusNuevoDia)! - Fix `social account connect x` so it finishes when OAuth refreshes an already-connected X account instead of waiting until timeout.
8
+
3
9
  ## 0.11.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.mjs CHANGED
@@ -18702,6 +18702,7 @@ const prepareAccountConnect = async (deps) => {
18702
18702
  await pollForSeat$1(deps);
18703
18703
  };
18704
18704
  const accountKey = (account) => account.profileId;
18705
+ const timestampMS = (value) => value instanceof Date ? value.getTime() : void 0;
18705
18706
  const normalizeIdentifier = (value) => value.trim().replace(/^@+/, "").toLowerCase();
18706
18707
  const accountSelectorFor$1 = (account) => account.username ? `@${account.username.replace(/^@+/, "")}` : `profile_id:${account.profileId}`;
18707
18708
  const assertXAccountSelector = (target) => {
@@ -18733,13 +18734,20 @@ const createXConnectURL = (deps, reconnectProfileId) => connectURLFor(deps, reco
18733
18734
  const connectXAccount = async (deps) => {
18734
18735
  const before = await listXLifecycleAccounts(deps, true);
18735
18736
  const connectedBefore = new Set(before.filter((account) => account.status === "connected").map(accountKey));
18737
+ const lastSeenBefore = new Map(before.filter((account) => account.status === "connected").map((account) => [accountKey(account), timestampMS(account.lastSeenAt)]));
18736
18738
  await prepareAccountConnect(deps);
18737
18739
  const authURL = await authURLFor(deps, () => connectURLFor(deps));
18738
18740
  await openOrPrint(deps, authURL.url, { log: !authURL.openingLogged });
18739
18741
  return {
18740
18742
  platform: "x",
18741
18743
  status: "connected",
18742
- account: await pollForAccount(deps, (candidate) => candidate.status === "connected" && !connectedBefore.has(candidate.profileId))
18744
+ account: await pollForAccount(deps, (candidate) => {
18745
+ if (candidate.status !== "connected") return false;
18746
+ if (!connectedBefore.has(candidate.profileId)) return true;
18747
+ const previousLastSeen = lastSeenBefore.get(candidate.profileId);
18748
+ const currentLastSeen = timestampMS(candidate.lastSeenAt);
18749
+ return previousLastSeen !== void 0 && currentLastSeen !== void 0 && currentLastSeen > previousLastSeen;
18750
+ })
18743
18751
  };
18744
18752
  };
18745
18753
  const reconnectXAccount = async (deps, args) => {
@@ -21414,7 +21422,7 @@ function createEnv(opts) {
21414
21422
  }
21415
21423
  //#endregion
21416
21424
  //#region package.json
21417
- var version$1 = "0.11.1";
21425
+ var version$1 = "0.11.2";
21418
21426
  //#endregion
21419
21427
  //#region src/lib/env.ts
21420
21428
  const URLWithTrailingSlash = url().transform(ensureTrailingSlash);