@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,5 +1,5 @@
1
- import { A as AppStoreConnectClient, C as Certificate } from './index-lsuS2R1T.js';
2
- import { C as CertificateType } from './enums-yXNVh3UI.js';
1
+ import { A as AppStoreConnectClient, M as Certificate } from './index-SyCMBpNN.js';
2
+ import { l as CertificateType } from './enums-BlpayMTx.js';
3
3
 
4
4
  interface CertOptions {
5
5
  client: AppStoreConnectClient;
@@ -1,5 +1,5 @@
1
- import { A as AppStoreConnectClient, C as Certificate } from './index-DrmS802s.cjs';
2
- import { C as CertificateType } from './enums-yXNVh3UI.cjs';
1
+ import { A as AppStoreConnectClient, M as Certificate } from './index-HWWl6HEL.cjs';
2
+ import { l as CertificateType } from './enums-BlpayMTx.cjs';
3
3
 
4
4
  interface CertOptions {
5
5
  client: AppStoreConnectClient;
@@ -1780,20 +1780,6 @@ var init_srp = __esm({
1780
1780
  };
1781
1781
  }
1782
1782
  });
1783
-
1784
- // src/client/apple-session.ts
1785
- var apple_session_exports = {};
1786
- __export(apple_session_exports, {
1787
- ProgramLicenseAgreementError: () => ProgramLicenseAgreementError,
1788
- appleJson: () => appleJson,
1789
- beginLogin: () => beginLogin,
1790
- checkPortalResponse: () => checkPortalResponse,
1791
- fetchServiceKey: () => fetchServiceKey,
1792
- loginWithAppleId: () => loginWithAppleId,
1793
- requestSmsCode: () => requestSmsCode,
1794
- serviceKeyFromLocation: () => serviceKeyFromLocation,
1795
- submitTwoFactorCode: () => submitTwoFactorCode
1796
- });
1797
1783
  async function appleJson(res, what) {
1798
1784
  const text = await res.text();
1799
1785
  try {
@@ -7000,6 +6986,90 @@ var init_app_asset_library_placements = __esm({
7000
6986
  }
7001
6987
  });
7002
6988
 
6989
+ // src/client/session-store.ts
6990
+ var session_store_exports = {};
6991
+ __export(session_store_exports, {
6992
+ clearAppleSession: () => clearAppleSession,
6993
+ lastAppleId: () => lastAppleId,
6994
+ loadAppleSession: () => loadAppleSession,
6995
+ saveAppleSession: () => saveAppleSession,
6996
+ sessionDir: () => sessionDir,
6997
+ signInWithAppleId: () => signInWithAppleId
6998
+ });
6999
+ function sessionDir() {
7000
+ return process.env.FASTNODE_SESSION_DIR || path.join(os.homedir(), ".fastnode", "sessions");
7001
+ }
7002
+ function fileFor(email) {
7003
+ const key = crypto.createHash("sha256").update(email.trim().toLowerCase()).digest("hex").slice(0, 16);
7004
+ return path.join(sessionDir(), `${key}.json`);
7005
+ }
7006
+ function ensureDir() {
7007
+ const dir = sessionDir();
7008
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true, mode: 448 });
7009
+ fs.chmodSync(dir, 448);
7010
+ }
7011
+ function saveAppleSession(session) {
7012
+ ensureDir();
7013
+ const stored = { email: session.userEmail, savedAt: (/* @__PURE__ */ new Date()).toISOString(), session };
7014
+ const path$1 = fileFor(session.userEmail);
7015
+ fs.writeFileSync(path$1, JSON.stringify(stored), { mode: 384 });
7016
+ fs.chmodSync(path$1, 384);
7017
+ fs.writeFileSync(path.join(sessionDir(), "last-apple-id"), session.userEmail, { mode: 384 });
7018
+ }
7019
+ function clearAppleSession(email) {
7020
+ const path = fileFor(email);
7021
+ if (fs.existsSync(path)) fs.unlinkSync(path);
7022
+ }
7023
+ function lastAppleId() {
7024
+ try {
7025
+ return fs.readFileSync(path.join(sessionDir(), "last-apple-id"), "utf8").trim() || null;
7026
+ } catch {
7027
+ return null;
7028
+ }
7029
+ }
7030
+ async function loadAppleSession(email, fetchImpl = fetch) {
7031
+ const path = fileFor(email);
7032
+ if (!fs.existsSync(path)) return null;
7033
+ let stored;
7034
+ try {
7035
+ stored = JSON.parse(fs.readFileSync(path, "utf8"));
7036
+ } catch {
7037
+ return null;
7038
+ }
7039
+ const cookie = Object.entries(stored.session.cookies).map(([k, v]) => `${k}=${v}`).join("; ");
7040
+ try {
7041
+ const res = await fetchImpl(OLYMPUS_SESSION2, { headers: { Cookie: cookie, Accept: "application/json" } });
7042
+ if (!res.ok) {
7043
+ clearAppleSession(email);
7044
+ return null;
7045
+ }
7046
+ } catch {
7047
+ return null;
7048
+ }
7049
+ return stored.session;
7050
+ }
7051
+ async function signInWithAppleId(options) {
7052
+ const email = options.email || lastAppleId() || await options.askEmail();
7053
+ if (!options.fresh) {
7054
+ const saved = await loadAppleSession(email);
7055
+ if (saved) {
7056
+ options.onLog?.(`Using saved Apple ID session for ${email}`);
7057
+ return saved;
7058
+ }
7059
+ }
7060
+ const password = await options.askPassword(email);
7061
+ const session = await loginWithAppleId({ email, password, onLog: options.onLog });
7062
+ saveAppleSession(session);
7063
+ return session;
7064
+ }
7065
+ var OLYMPUS_SESSION2;
7066
+ var init_session_store = __esm({
7067
+ "src/client/session-store.ts"() {
7068
+ init_apple_session();
7069
+ OLYMPUS_SESSION2 = "https://appstoreconnect.apple.com/olympus/v1/session";
7070
+ }
7071
+ });
7072
+
7003
7073
  // src/client/portal.ts
7004
7074
  function pickUniqueKeyName(base, taken) {
7005
7075
  if (!taken.has(base)) return base;
@@ -7767,6 +7837,7 @@ var init_iris = __esm({
7767
7837
  session;
7768
7838
  cookieStr;
7769
7839
  buildHeaders() {
7840
+ this.cookieStr = Object.entries(this.session.cookies).map(([k, v]) => `${k}=${v}`).join("; ");
7770
7841
  return {
7771
7842
  Cookie: this.cookieStr,
7772
7843
  Accept: "application/vnd.api+json, application/json, text/plain, */*",
@@ -8077,8 +8148,14 @@ __export(client_exports, {
8077
8148
  TokenManager: () => TokenManager,
8078
8149
  beginLogin: () => beginLogin,
8079
8150
  checkPortalResponse: () => checkPortalResponse,
8151
+ clearAppleSession: () => clearAppleSession,
8152
+ lastAppleId: () => lastAppleId,
8153
+ loadAppleSession: () => loadAppleSession,
8080
8154
  loginWithAppleId: () => loginWithAppleId,
8081
8155
  requestSmsCode: () => requestSmsCode,
8156
+ saveAppleSession: () => saveAppleSession,
8157
+ sessionDir: () => sessionDir,
8158
+ signInWithAppleId: () => signInWithAppleId,
8082
8159
  submitTwoFactorCode: () => submitTwoFactorCode
8083
8160
  });
8084
8161
  var AppStoreConnectClient;
@@ -8126,6 +8203,7 @@ var init_client = __esm({
8126
8203
  init_auth();
8127
8204
  init_request();
8128
8205
  init_apple_session();
8206
+ init_session_store();
8129
8207
  init_portal();
8130
8208
  init_iris();
8131
8209
  AppStoreConnectClient = class {
@@ -9376,6 +9454,41 @@ var init_options = __esm({
9376
9454
  }
9377
9455
  });
9378
9456
 
9457
+ // src/client/providers.ts
9458
+ function cookieHeader(session) {
9459
+ return Object.entries(session.cookies).map(([k, v]) => `${k}=${v}`).join("; ");
9460
+ }
9461
+ function absorbCookies(session, res) {
9462
+ for (const raw of res.headers.getSetCookie?.() ?? []) {
9463
+ const m = raw.match(/^([^=]+)=([^;]*)/);
9464
+ if (m) session.cookies[m[1]] = m[2];
9465
+ }
9466
+ }
9467
+ async function listProviders(session) {
9468
+ const res = await fetch(OLYMPUS_SESSION3, { headers: { Cookie: cookieHeader(session), Accept: "application/json" } });
9469
+ absorbCookies(session, res);
9470
+ const info = await res.json().catch(() => null);
9471
+ const pick = (p) => p?.providerId != null ? { providerId: Number(p.providerId), name: String(p.name ?? p.providerId) } : null;
9472
+ const providers = (info?.availableProviders ?? []).map(pick).filter((p) => !!p);
9473
+ return { current: pick(info?.provider), providers };
9474
+ }
9475
+ async function switchProvider(session, providerId) {
9476
+ const res = await fetch(OLYMPUS_SESSION3, {
9477
+ method: "POST",
9478
+ headers: { Cookie: cookieHeader(session), "Content-Type": "application/json", Accept: "application/json" },
9479
+ body: JSON.stringify({ provider: { providerId } })
9480
+ });
9481
+ absorbCookies(session, res);
9482
+ if (res.ok) session.teamId = String(providerId);
9483
+ return res.ok;
9484
+ }
9485
+ var OLYMPUS_SESSION3;
9486
+ var init_providers = __esm({
9487
+ "src/client/providers.ts"() {
9488
+ OLYMPUS_SESSION3 = "https://appstoreconnect.apple.com/olympus/v1/session";
9489
+ }
9490
+ });
9491
+
9379
9492
  // src/privacy/index.ts
9380
9493
  var privacy_exports = {};
9381
9494
  __export(privacy_exports, {
@@ -9411,15 +9524,6 @@ async function iris(session, method, path, body) {
9411
9524
  }
9412
9525
  return { status: res.status, body: parsed, text };
9413
9526
  }
9414
- function cookieHeader(session) {
9415
- return Object.entries(session.cookies).map(([k, v]) => `${k}=${v}`).join("; ");
9416
- }
9417
- function absorbCookies(session, res) {
9418
- for (const raw of res.headers.getSetCookie?.() ?? []) {
9419
- const m = raw.match(/^([^=]+)=([^;]*)/);
9420
- if (m) session.cookies[m[1]] = m[2];
9421
- }
9422
- }
9423
9527
  function fail(what, r) {
9424
9528
  const detail = r.body?.errors?.map((e) => e.detail ?? e.title).join("; ") || r.text.slice(0, 300);
9425
9529
  throw new Error(`${what} failed (HTTP ${r.status}): ${detail}`);
@@ -9427,20 +9531,10 @@ function fail(what, r) {
9427
9531
  async function selectProviderForApp(session, appId, onLog) {
9428
9532
  const owns = async () => (await iris(session, "GET", `/apps/${appId}?fields[apps]=name`)).status === 200;
9429
9533
  if (await owns()) return;
9430
- const res = await fetch(OLYMPUS_SESSION2, { headers: { Cookie: cookieHeader(session), Accept: "application/json" } });
9431
- absorbCookies(session, res);
9432
- const info = await res.json().catch(() => null);
9433
- const providers = info?.availableProviders ?? [];
9534
+ const { providers } = await listProviders(session);
9434
9535
  for (const p of providers) {
9435
- const sw = await fetch(OLYMPUS_SESSION2, {
9436
- method: "POST",
9437
- headers: { Cookie: cookieHeader(session), "Content-Type": "application/json", Accept: "application/json" },
9438
- body: JSON.stringify({ provider: { providerId: p.providerId } })
9439
- });
9440
- absorbCookies(session, sw);
9441
- if (sw.ok && await owns()) {
9536
+ if (await switchProvider(session, p.providerId) && await owns()) {
9442
9537
  onLog?.(`Switched to team "${p.name}"`);
9443
- session.teamId = String(p.providerId);
9444
9538
  return;
9445
9539
  }
9446
9540
  }
@@ -9531,11 +9625,11 @@ function validateUsages(usages) {
9531
9625
  if (linked && unlinked) throw new Error(`${u.category} cannot be both linked and not linked to the user.`);
9532
9626
  }
9533
9627
  }
9534
- var IRIS_BASE2, OLYMPUS_SESSION2, DATA_USAGE_CATEGORIES, DATA_USAGE_PURPOSES, DATA_PROTECTIONS;
9628
+ var IRIS_BASE2, DATA_USAGE_CATEGORIES, DATA_USAGE_PURPOSES, DATA_PROTECTIONS;
9535
9629
  var init_privacy = __esm({
9536
9630
  "src/privacy/index.ts"() {
9631
+ init_providers();
9537
9632
  IRIS_BASE2 = "https://appstoreconnect.apple.com/iris/v1";
9538
- OLYMPUS_SESSION2 = "https://appstoreconnect.apple.com/olympus/v1/session";
9539
9633
  DATA_USAGE_CATEGORIES = [
9540
9634
  "PAYMENT_INFORMATION",
9541
9635
  "CREDIT_AND_FRAUD",
@@ -9964,14 +10058,18 @@ function createLanesCommand() {
9964
10058
  });
9965
10059
  }
9966
10060
  function createPrivacyCommand() {
9967
- return new commander.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) => {
9968
- const { loginWithAppleId: loginWithAppleId2 } = await Promise.resolve().then(() => (init_apple_session(), apple_session_exports));
10061
+ return new commander.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) => {
10062
+ const { signInWithAppleId: signInWithAppleId2, saveAppleSession: saveAppleSession2 } = await Promise.resolve().then(() => (init_session_store(), session_store_exports));
9969
10063
  const { uploadAppPrivacyDetails: uploadAppPrivacyDetails2, validateUsages: validateUsages2 } = await Promise.resolve().then(() => (init_privacy(), privacy_exports));
9970
10064
  const usages = JSON.parse(fs.readFileSync(opts.jsonPath, "utf8"));
9971
10065
  validateUsages2(usages);
9972
- const email = opts.username || await ask("Apple ID: ");
9973
- const password = process.env.FASTNODE_PASSWORD ?? process.env.FASTLANE_PASSWORD ?? await ask(`Password for ${email}: `, true);
9974
- const session = await loginWithAppleId2({ email, password, onLog: (m) => console.log(m) });
10066
+ const session = await signInWithAppleId2({
10067
+ email: opts.username,
10068
+ askEmail: () => ask("Apple ID: "),
10069
+ askPassword: async (email) => process.env.FASTNODE_PASSWORD ?? process.env.FASTLANE_PASSWORD ?? await ask(`Password for ${email}: `, true),
10070
+ fresh: opts.freshLogin,
10071
+ onLog: (m) => console.log(m)
10072
+ });
9975
10073
  const result = await uploadAppPrivacyDetails2({
9976
10074
  session,
9977
10075
  appId: opts.appId,
@@ -9979,6 +10077,7 @@ function createPrivacyCommand() {
9979
10077
  skipPublish: opts.skipPublish,
9980
10078
  onLog: (m) => console.log(m)
9981
10079
  });
10080
+ saveAppleSession2(session);
9982
10081
  console.log(`Done: ${result.created} answers${result.published ? ", published" : ""}.`);
9983
10082
  });
9984
10083
  }
@@ -10001,12 +10100,16 @@ function ask(question, secret = false) {
10001
10100
  });
10002
10101
  }
10003
10102
  function createRejectionsCommand() {
10004
- return new commander.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) => {
10005
- const { loginWithAppleId: loginWithAppleId2 } = await Promise.resolve().then(() => (init_apple_session(), apple_session_exports));
10103
+ return new commander.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) => {
10104
+ const { signInWithAppleId: signInWithAppleId2, saveAppleSession: saveAppleSession2 } = await Promise.resolve().then(() => (init_session_store(), session_store_exports));
10006
10105
  const { getReviewFeedback: getReviewFeedback2 } = await Promise.resolve().then(() => (init_review(), review_exports));
10007
- const email = opts.username || await ask2("Apple ID: ");
10008
- const password = process.env.FASTNODE_PASSWORD ?? process.env.FASTLANE_PASSWORD ?? await ask2(`Password for ${email}: `, true);
10009
- const session = await loginWithAppleId2({ email, password, onLog: (m) => console.error(m) });
10106
+ const session = await signInWithAppleId2({
10107
+ email: opts.username,
10108
+ askEmail: () => ask2("Apple ID: "),
10109
+ askPassword: async (email) => process.env.FASTNODE_PASSWORD ?? process.env.FASTLANE_PASSWORD ?? await ask2(`Password for ${email}: `, true),
10110
+ fresh: opts.freshLogin,
10111
+ onLog: (m) => console.error(m)
10112
+ });
10010
10113
  const all = {};
10011
10114
  for (const appId of opts.appId) {
10012
10115
  const feedback = await getReviewFeedback2(session, appId, { onlyOpen: !opts.all, onLog: (m) => console.error(m) });
@@ -10029,6 +10132,7 @@ Submission ${s.submissionId} \u2014 ${s.state} (submitted ${s.submittedDate ?? "
10029
10132
  }
10030
10133
  }
10031
10134
  }
10135
+ saveAppleSession2(session);
10032
10136
  if (opts.json) console.log(JSON.stringify(all, null, 2));
10033
10137
  });
10034
10138
  }