@sitepong/fastnode 0.3.0 → 0.3.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.
Files changed (127) hide show
  1. package/README.md +6 -0
  2. package/dist/actions/index.cjs +81 -0
  3. package/dist/actions/index.cjs.map +1 -1
  4. package/dist/actions/index.mjs +82 -1
  5. package/dist/actions/index.mjs.map +1 -1
  6. package/dist/{apple-session-jUzBrql5.d.cts → apple-session-D6x7Jo3D.d.cts} +1 -1
  7. package/dist/{apple-session-jUzBrql5.d.ts → apple-session-D6x7Jo3D.d.ts} +1 -1
  8. package/dist/cert/index.cjs +92 -51
  9. package/dist/cert/index.cjs.map +1 -1
  10. package/dist/cert/index.d.cts +5 -5
  11. package/dist/cert/index.d.ts +5 -5
  12. package/dist/cert/index.mjs +92 -51
  13. package/dist/cert/index.mjs.map +1 -1
  14. package/dist/{cert-RvXmdMke.d.ts → cert-C-yRB-sO.d.ts} +2 -2
  15. package/dist/{cert-eOoxGMN1.d.cts → cert-C4hhKH1n.d.cts} +2 -2
  16. package/dist/cli/index.cjs +151 -47
  17. package/dist/cli/index.cjs.map +1 -1
  18. package/dist/cli/index.d.cts +3 -3
  19. package/dist/cli/index.d.ts +3 -3
  20. package/dist/cli/index.mjs +152 -48
  21. package/dist/cli/index.mjs.map +1 -1
  22. package/dist/client/index.cjs +77 -0
  23. package/dist/client/index.cjs.map +1 -1
  24. package/dist/client/index.d.cts +3 -3
  25. package/dist/client/index.d.ts +3 -3
  26. package/dist/client/index.mjs +72 -1
  27. package/dist/client/index.mjs.map +1 -1
  28. package/dist/core/index.d.cts +1 -1
  29. package/dist/core/index.d.ts +1 -1
  30. package/dist/deliver/index.d.cts +4 -4
  31. package/dist/deliver/index.d.ts +4 -4
  32. package/dist/{enums-yXNVh3UI.d.cts → enums-BlpayMTx.d.cts} +1 -1
  33. package/dist/{enums-yXNVh3UI.d.ts → enums-BlpayMTx.d.ts} +1 -1
  34. package/dist/frameit/index.d.cts +1 -1
  35. package/dist/frameit/index.d.ts +1 -1
  36. package/dist/gradle/index.d.cts +1 -1
  37. package/dist/gradle/index.d.ts +1 -1
  38. package/dist/gym/index.d.cts +2 -2
  39. package/dist/gym/index.d.ts +2 -2
  40. package/dist/{index-DnHQ2uT2.d.cts → index-258t9n7v.d.cts} +2 -2
  41. package/dist/{index-BvyZ4uiw.d.ts → index-6LKy36sE.d.ts} +4 -4
  42. package/dist/{index-icIH5e5V.d.cts → index-B74vgav6.d.cts} +4 -4
  43. package/dist/{index-BoU8qt8r.d.cts → index-B7ERdhh8.d.cts} +1 -1
  44. package/dist/{index-BoU8qt8r.d.ts → index-B7ERdhh8.d.ts} +1 -1
  45. package/dist/{index-laE3_wm9.d.cts → index-BIRpj0f2.d.cts} +2 -2
  46. package/dist/{index-CBf0-NUQ.d.ts → index-BJLHWMwL.d.ts} +3 -3
  47. package/dist/{index-mEEB7An6.d.ts → index-B_D_01oz.d.ts} +1 -1
  48. package/dist/{index-D1GHEM3c.d.ts → index-Ba1jHQYg.d.ts} +1 -1
  49. package/dist/{index-DGkgRnZp.d.cts → index-BawZaGqD.d.cts} +3 -3
  50. package/dist/{index-8djTPW8O.d.ts → index-BmrOdmNL.d.ts} +2 -2
  51. package/dist/{index-DjC_gmnL.d.ts → index-C8L03MBu.d.ts} +3 -3
  52. package/dist/{index-Cp6cjtd-.d.ts → index-CHLDQweM.d.cts} +1 -1
  53. package/dist/{index-Cp6cjtd-.d.cts → index-CHLDQweM.d.ts} +1 -1
  54. package/dist/{index-B6-MJpO4.d.cts → index-CRFfLsEG.d.cts} +1 -1
  55. package/dist/{index-CAEiXVWd.d.ts → index-CV6KnSy1.d.ts} +2 -2
  56. package/dist/index-CX2hUvvG.d.cts +287 -0
  57. package/dist/index-CX2hUvvG.d.ts +287 -0
  58. package/dist/{index-C9mHBJED.d.ts → index-ClhWjR7a.d.ts} +2 -2
  59. package/dist/{index-BGhV0gS-.d.ts → index-Cq-xo-9x.d.ts} +2 -2
  60. package/dist/{index-CR3BFPIz.d.ts → index-Cw7ojUY5.d.cts} +1 -1
  61. package/dist/{index-CR3BFPIz.d.cts → index-Cw7ojUY5.d.ts} +1 -1
  62. package/dist/{index-C2yG3wXA.d.cts → index-CwD7lG0y.d.cts} +1 -1
  63. package/dist/{index-C2yG3wXA.d.ts → index-CwD7lG0y.d.ts} +1 -1
  64. package/dist/{index-DLJso7Vs.d.cts → index-CxrqhkVF.d.cts} +1 -1
  65. package/dist/{index-BE7bwNff.d.cts → index-D3zyYCYs.d.cts} +2 -2
  66. package/dist/{index-BaNcf7jt.d.cts → index-DCrSWVMb.d.cts} +3 -3
  67. package/dist/{index-rTZOdMRE.d.ts → index-DP2f5ZsS.d.ts} +3 -3
  68. package/dist/{index-DfkIz7i0.d.cts → index-DRjXV9ej.d.cts} +3 -3
  69. package/dist/{index-Dv-Mek07.d.ts → index-DSXBQeur.d.cts} +1 -1
  70. package/dist/{index-Dv-Mek07.d.cts → index-DSXBQeur.d.ts} +1 -1
  71. package/dist/{index-BYonklf3.d.cts → index-Dvi-3DSM.d.cts} +1 -1
  72. package/dist/{index-BYonklf3.d.ts → index-Dvi-3DSM.d.ts} +1 -1
  73. package/dist/{index-C01Rkrir.d.ts → index-Dy8EWOnt.d.ts} +2 -2
  74. package/dist/{index-DrmS802s.d.cts → index-HWWl6HEL.d.cts} +34 -3
  75. package/dist/{index-DWOLZNlz.d.cts → index-QYgreJV3.d.cts} +2 -2
  76. package/dist/{index-lsuS2R1T.d.ts → index-SyCMBpNN.d.ts} +34 -3
  77. package/dist/{index-DFstwgGK.d.cts → index-yro2MWgt.d.cts} +2 -2
  78. package/dist/index.cjs +1543 -964
  79. package/dist/index.cjs.map +1 -1
  80. package/dist/index.d.cts +23 -23
  81. package/dist/index.d.ts +23 -23
  82. package/dist/index.mjs +1544 -965
  83. package/dist/index.mjs.map +1 -1
  84. package/dist/lane/index.cjs +81 -0
  85. package/dist/lane/index.cjs.map +1 -1
  86. package/dist/lane/index.mjs +82 -1
  87. package/dist/lane/index.mjs.map +1 -1
  88. package/dist/match/index.d.cts +6 -6
  89. package/dist/match/index.d.ts +6 -6
  90. package/dist/match/index.mjs +1 -1
  91. package/dist/pem/index.d.cts +4 -4
  92. package/dist/pem/index.d.ts +4 -4
  93. package/dist/pilot/index.d.cts +4 -4
  94. package/dist/pilot/index.d.ts +4 -4
  95. package/dist/playstore/index.cjs +18208 -1
  96. package/dist/playstore/index.cjs.map +1 -1
  97. package/dist/playstore/index.d.cts +1 -1
  98. package/dist/playstore/index.d.ts +1 -1
  99. package/dist/playstore/index.mjs +18196 -2
  100. package/dist/playstore/index.mjs.map +1 -1
  101. package/dist/precheck/index.d.cts +4 -4
  102. package/dist/precheck/index.d.ts +4 -4
  103. package/dist/privacy/index.cjs +32 -22
  104. package/dist/privacy/index.cjs.map +1 -1
  105. package/dist/privacy/index.d.cts +2 -2
  106. package/dist/privacy/index.d.ts +2 -2
  107. package/dist/privacy/index.mjs +32 -22
  108. package/dist/privacy/index.mjs.map +1 -1
  109. package/dist/produce/index.d.cts +4 -4
  110. package/dist/produce/index.d.ts +4 -4
  111. package/dist/review/index.cjs +32 -22
  112. package/dist/review/index.cjs.map +1 -1
  113. package/dist/review/index.d.cts +2 -2
  114. package/dist/review/index.d.ts +2 -2
  115. package/dist/review/index.mjs +32 -22
  116. package/dist/review/index.mjs.map +1 -1
  117. package/dist/sigh/index.d.cts +4 -4
  118. package/dist/sigh/index.d.ts +4 -4
  119. package/dist/snapshot/index.d.cts +1 -1
  120. package/dist/snapshot/index.d.ts +1 -1
  121. package/dist/trainer/index.d.cts +1 -1
  122. package/dist/trainer/index.d.ts +1 -1
  123. package/dist/xcode/index.d.cts +1 -1
  124. package/dist/xcode/index.d.ts +1 -1
  125. package/package.json +2 -2
  126. package/dist/index-CXJlvmB4.d.cts +0 -63
  127. package/dist/index-CXJlvmB4.d.ts +0 -63
@@ -1,7 +1,7 @@
1
1
  import { Command } from 'commander';
2
- import { A as AppStoreConnectClient } from '../index-DrmS802s.cjs';
3
- import '../enums-yXNVh3UI.cjs';
4
- import '../apple-session-jUzBrql5.cjs';
2
+ import { A as AppStoreConnectClient } from '../index-HWWl6HEL.cjs';
3
+ import '../enums-BlpayMTx.cjs';
4
+ import '../apple-session-D6x7Jo3D.cjs';
5
5
 
6
6
  declare function resolveClientFromEnv(): Promise<AppStoreConnectClient>;
7
7
 
@@ -1,7 +1,7 @@
1
1
  import { Command } from 'commander';
2
- import { A as AppStoreConnectClient } from '../index-lsuS2R1T.js';
3
- import '../enums-yXNVh3UI.js';
4
- import '../apple-session-jUzBrql5.js';
2
+ import { A as AppStoreConnectClient } from '../index-SyCMBpNN.js';
3
+ import '../enums-BlpayMTx.js';
4
+ import '../apple-session-D6x7Jo3D.js';
5
5
 
6
6
  declare function resolveClientFromEnv(): Promise<AppStoreConnectClient>;
7
7
 
@@ -1,7 +1,7 @@
1
1
  import * as x509 from '@peculiar/x509';
2
2
  import { randomUUID, createHash, webcrypto, randomBytes, pbkdf2Sync, createCipheriv, createDecipheriv } from 'crypto';
3
3
  import { spawn, execFile, execFileSync } from 'child_process';
4
- import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync, copyFileSync, mkdtempSync, rmSync, chmodSync } from 'fs';
4
+ import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync, chmodSync, unlinkSync, copyFileSync, mkdtempSync, rmSync } from 'fs';
5
5
  import { join, extname, resolve, basename, relative } from 'path';
6
6
  import { homedir, tmpdir } from 'os';
7
7
  import { promisify } from 'util';
@@ -1755,20 +1755,6 @@ var init_srp = __esm({
1755
1755
  };
1756
1756
  }
1757
1757
  });
1758
-
1759
- // src/client/apple-session.ts
1760
- var apple_session_exports = {};
1761
- __export(apple_session_exports, {
1762
- ProgramLicenseAgreementError: () => ProgramLicenseAgreementError,
1763
- appleJson: () => appleJson,
1764
- beginLogin: () => beginLogin,
1765
- checkPortalResponse: () => checkPortalResponse,
1766
- fetchServiceKey: () => fetchServiceKey,
1767
- loginWithAppleId: () => loginWithAppleId,
1768
- requestSmsCode: () => requestSmsCode,
1769
- serviceKeyFromLocation: () => serviceKeyFromLocation,
1770
- submitTwoFactorCode: () => submitTwoFactorCode
1771
- });
1772
1758
  async function appleJson(res, what) {
1773
1759
  const text = await res.text();
1774
1760
  try {
@@ -6975,6 +6961,90 @@ var init_app_asset_library_placements = __esm({
6975
6961
  }
6976
6962
  });
6977
6963
 
6964
+ // src/client/session-store.ts
6965
+ var session_store_exports = {};
6966
+ __export(session_store_exports, {
6967
+ clearAppleSession: () => clearAppleSession,
6968
+ lastAppleId: () => lastAppleId,
6969
+ loadAppleSession: () => loadAppleSession,
6970
+ saveAppleSession: () => saveAppleSession,
6971
+ sessionDir: () => sessionDir,
6972
+ signInWithAppleId: () => signInWithAppleId
6973
+ });
6974
+ function sessionDir() {
6975
+ return process.env.FASTNODE_SESSION_DIR || join(homedir(), ".fastnode", "sessions");
6976
+ }
6977
+ function fileFor(email) {
6978
+ const key = createHash("sha256").update(email.trim().toLowerCase()).digest("hex").slice(0, 16);
6979
+ return join(sessionDir(), `${key}.json`);
6980
+ }
6981
+ function ensureDir() {
6982
+ const dir = sessionDir();
6983
+ if (!existsSync(dir)) mkdirSync(dir, { recursive: true, mode: 448 });
6984
+ chmodSync(dir, 448);
6985
+ }
6986
+ function saveAppleSession(session) {
6987
+ ensureDir();
6988
+ const stored = { email: session.userEmail, savedAt: (/* @__PURE__ */ new Date()).toISOString(), session };
6989
+ const path = fileFor(session.userEmail);
6990
+ writeFileSync(path, JSON.stringify(stored), { mode: 384 });
6991
+ chmodSync(path, 384);
6992
+ writeFileSync(join(sessionDir(), "last-apple-id"), session.userEmail, { mode: 384 });
6993
+ }
6994
+ function clearAppleSession(email) {
6995
+ const path = fileFor(email);
6996
+ if (existsSync(path)) unlinkSync(path);
6997
+ }
6998
+ function lastAppleId() {
6999
+ try {
7000
+ return readFileSync(join(sessionDir(), "last-apple-id"), "utf8").trim() || null;
7001
+ } catch {
7002
+ return null;
7003
+ }
7004
+ }
7005
+ async function loadAppleSession(email, fetchImpl = fetch) {
7006
+ const path = fileFor(email);
7007
+ if (!existsSync(path)) return null;
7008
+ let stored;
7009
+ try {
7010
+ stored = JSON.parse(readFileSync(path, "utf8"));
7011
+ } catch {
7012
+ return null;
7013
+ }
7014
+ const cookie = Object.entries(stored.session.cookies).map(([k, v]) => `${k}=${v}`).join("; ");
7015
+ try {
7016
+ const res = await fetchImpl(OLYMPUS_SESSION2, { headers: { Cookie: cookie, Accept: "application/json" } });
7017
+ if (!res.ok) {
7018
+ clearAppleSession(email);
7019
+ return null;
7020
+ }
7021
+ } catch {
7022
+ return null;
7023
+ }
7024
+ return stored.session;
7025
+ }
7026
+ async function signInWithAppleId(options) {
7027
+ const email = options.email || lastAppleId() || await options.askEmail();
7028
+ if (!options.fresh) {
7029
+ const saved = await loadAppleSession(email);
7030
+ if (saved) {
7031
+ options.onLog?.(`Using saved Apple ID session for ${email}`);
7032
+ return saved;
7033
+ }
7034
+ }
7035
+ const password = await options.askPassword(email);
7036
+ const session = await loginWithAppleId({ email, password, onLog: options.onLog });
7037
+ saveAppleSession(session);
7038
+ return session;
7039
+ }
7040
+ var OLYMPUS_SESSION2;
7041
+ var init_session_store = __esm({
7042
+ "src/client/session-store.ts"() {
7043
+ init_apple_session();
7044
+ OLYMPUS_SESSION2 = "https://appstoreconnect.apple.com/olympus/v1/session";
7045
+ }
7046
+ });
7047
+
6978
7048
  // src/client/portal.ts
6979
7049
  function pickUniqueKeyName(base, taken) {
6980
7050
  if (!taken.has(base)) return base;
@@ -7742,6 +7812,7 @@ var init_iris = __esm({
7742
7812
  session;
7743
7813
  cookieStr;
7744
7814
  buildHeaders() {
7815
+ this.cookieStr = Object.entries(this.session.cookies).map(([k, v]) => `${k}=${v}`).join("; ");
7745
7816
  return {
7746
7817
  Cookie: this.cookieStr,
7747
7818
  Accept: "application/vnd.api+json, application/json, text/plain, */*",
@@ -8052,8 +8123,14 @@ __export(client_exports, {
8052
8123
  TokenManager: () => TokenManager,
8053
8124
  beginLogin: () => beginLogin,
8054
8125
  checkPortalResponse: () => checkPortalResponse,
8126
+ clearAppleSession: () => clearAppleSession,
8127
+ lastAppleId: () => lastAppleId,
8128
+ loadAppleSession: () => loadAppleSession,
8055
8129
  loginWithAppleId: () => loginWithAppleId,
8056
8130
  requestSmsCode: () => requestSmsCode,
8131
+ saveAppleSession: () => saveAppleSession,
8132
+ sessionDir: () => sessionDir,
8133
+ signInWithAppleId: () => signInWithAppleId,
8057
8134
  submitTwoFactorCode: () => submitTwoFactorCode
8058
8135
  });
8059
8136
  var AppStoreConnectClient;
@@ -8101,6 +8178,7 @@ var init_client = __esm({
8101
8178
  init_auth();
8102
8179
  init_request();
8103
8180
  init_apple_session();
8181
+ init_session_store();
8104
8182
  init_portal();
8105
8183
  init_iris();
8106
8184
  AppStoreConnectClient = class {
@@ -9351,6 +9429,41 @@ var init_options = __esm({
9351
9429
  }
9352
9430
  });
9353
9431
 
9432
+ // src/client/providers.ts
9433
+ function cookieHeader(session) {
9434
+ return Object.entries(session.cookies).map(([k, v]) => `${k}=${v}`).join("; ");
9435
+ }
9436
+ function absorbCookies(session, res) {
9437
+ for (const raw of res.headers.getSetCookie?.() ?? []) {
9438
+ const m = raw.match(/^([^=]+)=([^;]*)/);
9439
+ if (m) session.cookies[m[1]] = m[2];
9440
+ }
9441
+ }
9442
+ async function listProviders(session) {
9443
+ const res = await fetch(OLYMPUS_SESSION3, { headers: { Cookie: cookieHeader(session), Accept: "application/json" } });
9444
+ absorbCookies(session, res);
9445
+ const info = await res.json().catch(() => null);
9446
+ const pick = (p) => p?.providerId != null ? { providerId: Number(p.providerId), name: String(p.name ?? p.providerId) } : null;
9447
+ const providers = (info?.availableProviders ?? []).map(pick).filter((p) => !!p);
9448
+ return { current: pick(info?.provider), providers };
9449
+ }
9450
+ async function switchProvider(session, providerId) {
9451
+ const res = await fetch(OLYMPUS_SESSION3, {
9452
+ method: "POST",
9453
+ headers: { Cookie: cookieHeader(session), "Content-Type": "application/json", Accept: "application/json" },
9454
+ body: JSON.stringify({ provider: { providerId } })
9455
+ });
9456
+ absorbCookies(session, res);
9457
+ if (res.ok) session.teamId = String(providerId);
9458
+ return res.ok;
9459
+ }
9460
+ var OLYMPUS_SESSION3;
9461
+ var init_providers = __esm({
9462
+ "src/client/providers.ts"() {
9463
+ OLYMPUS_SESSION3 = "https://appstoreconnect.apple.com/olympus/v1/session";
9464
+ }
9465
+ });
9466
+
9354
9467
  // src/privacy/index.ts
9355
9468
  var privacy_exports = {};
9356
9469
  __export(privacy_exports, {
@@ -9386,15 +9499,6 @@ async function iris(session, method, path, body) {
9386
9499
  }
9387
9500
  return { status: res.status, body: parsed, text };
9388
9501
  }
9389
- function cookieHeader(session) {
9390
- return Object.entries(session.cookies).map(([k, v]) => `${k}=${v}`).join("; ");
9391
- }
9392
- function absorbCookies(session, res) {
9393
- for (const raw of res.headers.getSetCookie?.() ?? []) {
9394
- const m = raw.match(/^([^=]+)=([^;]*)/);
9395
- if (m) session.cookies[m[1]] = m[2];
9396
- }
9397
- }
9398
9502
  function fail(what, r) {
9399
9503
  const detail = r.body?.errors?.map((e) => e.detail ?? e.title).join("; ") || r.text.slice(0, 300);
9400
9504
  throw new Error(`${what} failed (HTTP ${r.status}): ${detail}`);
@@ -9402,20 +9506,10 @@ function fail(what, r) {
9402
9506
  async function selectProviderForApp(session, appId, onLog) {
9403
9507
  const owns = async () => (await iris(session, "GET", `/apps/${appId}?fields[apps]=name`)).status === 200;
9404
9508
  if (await owns()) return;
9405
- const res = await fetch(OLYMPUS_SESSION2, { headers: { Cookie: cookieHeader(session), Accept: "application/json" } });
9406
- absorbCookies(session, res);
9407
- const info = await res.json().catch(() => null);
9408
- const providers = info?.availableProviders ?? [];
9509
+ const { providers } = await listProviders(session);
9409
9510
  for (const p of providers) {
9410
- const sw = await fetch(OLYMPUS_SESSION2, {
9411
- method: "POST",
9412
- headers: { Cookie: cookieHeader(session), "Content-Type": "application/json", Accept: "application/json" },
9413
- body: JSON.stringify({ provider: { providerId: p.providerId } })
9414
- });
9415
- absorbCookies(session, sw);
9416
- if (sw.ok && await owns()) {
9511
+ if (await switchProvider(session, p.providerId) && await owns()) {
9417
9512
  onLog?.(`Switched to team "${p.name}"`);
9418
- session.teamId = String(p.providerId);
9419
9513
  return;
9420
9514
  }
9421
9515
  }
@@ -9506,11 +9600,11 @@ function validateUsages(usages) {
9506
9600
  if (linked && unlinked) throw new Error(`${u.category} cannot be both linked and not linked to the user.`);
9507
9601
  }
9508
9602
  }
9509
- var IRIS_BASE2, OLYMPUS_SESSION2, DATA_USAGE_CATEGORIES, DATA_USAGE_PURPOSES, DATA_PROTECTIONS;
9603
+ var IRIS_BASE2, DATA_USAGE_CATEGORIES, DATA_USAGE_PURPOSES, DATA_PROTECTIONS;
9510
9604
  var init_privacy = __esm({
9511
9605
  "src/privacy/index.ts"() {
9606
+ init_providers();
9512
9607
  IRIS_BASE2 = "https://appstoreconnect.apple.com/iris/v1";
9513
- OLYMPUS_SESSION2 = "https://appstoreconnect.apple.com/olympus/v1/session";
9514
9608
  DATA_USAGE_CATEGORIES = [
9515
9609
  "PAYMENT_INFORMATION",
9516
9610
  "CREDIT_AND_FRAUD",
@@ -9939,14 +10033,18 @@ function createLanesCommand() {
9939
10033
  });
9940
10034
  }
9941
10035
  function createPrivacyCommand() {
9942
- return new Command("privacy").description("Upload App Privacy details (nutrition labels) to App Store Connect").requiredOption("--app-id <id>", "App Store Connect app id (numeric Apple ID)").requiredOption("-j, --json-path <path>", "Fastlane-format app_privacy_details.json").option("-u, --username <email>", "Apple ID", process.env.FASTNODE_USER ?? process.env.FASTLANE_USER).option("--skip-publish", "Save the answers without publishing them", false).action(async (opts) => {
9943
- const { loginWithAppleId: loginWithAppleId2 } = await Promise.resolve().then(() => (init_apple_session(), apple_session_exports));
10036
+ return new Command("privacy").description("Upload App Privacy details (nutrition labels) to App Store Connect").requiredOption("--app-id <id>", "App Store Connect app id (numeric Apple ID)").requiredOption("-j, --json-path <path>", "Fastlane-format app_privacy_details.json").option("-u, --username <email>", "Apple ID (defaults to the last one signed in)", process.env.FASTNODE_USER ?? process.env.FASTLANE_USER).option("--fresh-login", "Ignore the saved Apple ID session and sign in again", false).option("--skip-publish", "Save the answers without publishing them", false).action(async (opts) => {
10037
+ const { signInWithAppleId: signInWithAppleId2, saveAppleSession: saveAppleSession2 } = await Promise.resolve().then(() => (init_session_store(), session_store_exports));
9944
10038
  const { uploadAppPrivacyDetails: uploadAppPrivacyDetails2, validateUsages: validateUsages2 } = await Promise.resolve().then(() => (init_privacy(), privacy_exports));
9945
10039
  const usages = JSON.parse(readFileSync(opts.jsonPath, "utf8"));
9946
10040
  validateUsages2(usages);
9947
- const email = opts.username || await ask("Apple ID: ");
9948
- const password = process.env.FASTNODE_PASSWORD ?? process.env.FASTLANE_PASSWORD ?? await ask(`Password for ${email}: `, true);
9949
- const session = await loginWithAppleId2({ email, password, onLog: (m) => console.log(m) });
10041
+ const session = await signInWithAppleId2({
10042
+ email: opts.username,
10043
+ askEmail: () => ask("Apple ID: "),
10044
+ askPassword: async (email) => process.env.FASTNODE_PASSWORD ?? process.env.FASTLANE_PASSWORD ?? await ask(`Password for ${email}: `, true),
10045
+ fresh: opts.freshLogin,
10046
+ onLog: (m) => console.log(m)
10047
+ });
9950
10048
  const result = await uploadAppPrivacyDetails2({
9951
10049
  session,
9952
10050
  appId: opts.appId,
@@ -9954,6 +10052,7 @@ function createPrivacyCommand() {
9954
10052
  skipPublish: opts.skipPublish,
9955
10053
  onLog: (m) => console.log(m)
9956
10054
  });
10055
+ saveAppleSession2(session);
9957
10056
  console.log(`Done: ${result.created} answers${result.published ? ", published" : ""}.`);
9958
10057
  });
9959
10058
  }
@@ -9976,12 +10075,16 @@ function ask(question, secret = false) {
9976
10075
  });
9977
10076
  }
9978
10077
  function createRejectionsCommand() {
9979
- return new Command("rejections").description("Show App Review's Resolution Center messages and rejection reasons").requiredOption("--app-id <ids...>", "App Store Connect app id(s) (numeric Apple ID)").option("-u, --username <email>", "Apple ID", process.env.FASTNODE_USER ?? process.env.FASTLANE_USER).option("--all", "Include resolved submissions, not just ones awaiting you", false).option("--json", "Print JSON instead of text", false).action(async (opts) => {
9980
- const { loginWithAppleId: loginWithAppleId2 } = await Promise.resolve().then(() => (init_apple_session(), apple_session_exports));
10078
+ return new Command("rejections").description("Show App Review's Resolution Center messages and rejection reasons").requiredOption("--app-id <ids...>", "App Store Connect app id(s) (numeric Apple ID)").option("-u, --username <email>", "Apple ID (defaults to the last one signed in)", process.env.FASTNODE_USER ?? process.env.FASTLANE_USER).option("--fresh-login", "Ignore the saved Apple ID session and sign in again", false).option("--all", "Include resolved submissions, not just ones awaiting you", false).option("--json", "Print JSON instead of text", false).action(async (opts) => {
10079
+ const { signInWithAppleId: signInWithAppleId2, saveAppleSession: saveAppleSession2 } = await Promise.resolve().then(() => (init_session_store(), session_store_exports));
9981
10080
  const { getReviewFeedback: getReviewFeedback2 } = await Promise.resolve().then(() => (init_review(), review_exports));
9982
- const email = opts.username || await ask2("Apple ID: ");
9983
- const password = process.env.FASTNODE_PASSWORD ?? process.env.FASTLANE_PASSWORD ?? await ask2(`Password for ${email}: `, true);
9984
- const session = await loginWithAppleId2({ email, password, onLog: (m) => console.error(m) });
10081
+ const session = await signInWithAppleId2({
10082
+ email: opts.username,
10083
+ askEmail: () => ask2("Apple ID: "),
10084
+ askPassword: async (email) => process.env.FASTNODE_PASSWORD ?? process.env.FASTLANE_PASSWORD ?? await ask2(`Password for ${email}: `, true),
10085
+ fresh: opts.freshLogin,
10086
+ onLog: (m) => console.error(m)
10087
+ });
9985
10088
  const all = {};
9986
10089
  for (const appId of opts.appId) {
9987
10090
  const feedback = await getReviewFeedback2(session, appId, { onlyOpen: !opts.all, onLog: (m) => console.error(m) });
@@ -10004,6 +10107,7 @@ Submission ${s.submissionId} \u2014 ${s.state} (submitted ${s.submittedDate ?? "
10004
10107
  }
10005
10108
  }
10006
10109
  }
10110
+ saveAppleSession2(session);
10007
10111
  if (opts.json) console.log(JSON.stringify(all, null, 2));
10008
10112
  });
10009
10113
  }