@sitepong/fastnode 0.3.0 → 0.3.1

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 (64) hide show
  1. package/README.md +6 -0
  2. package/dist/actions/index.cjs +80 -0
  3. package/dist/actions/index.cjs.map +1 -1
  4. package/dist/actions/index.mjs +81 -1
  5. package/dist/actions/index.mjs.map +1 -1
  6. package/dist/cert/index.d.cts +3 -3
  7. package/dist/cert/index.d.ts +3 -3
  8. package/dist/{cert-RvXmdMke.d.ts → cert-ClacRx9y.d.ts} +1 -1
  9. package/dist/{cert-eOoxGMN1.d.cts → cert-DffLKURp.d.cts} +1 -1
  10. package/dist/cli/index.cjs +115 -28
  11. package/dist/cli/index.cjs.map +1 -1
  12. package/dist/cli/index.d.cts +1 -1
  13. package/dist/cli/index.d.ts +1 -1
  14. package/dist/cli/index.mjs +116 -29
  15. package/dist/cli/index.mjs.map +1 -1
  16. package/dist/client/index.cjs +76 -0
  17. package/dist/client/index.cjs.map +1 -1
  18. package/dist/client/index.d.cts +1 -1
  19. package/dist/client/index.d.ts +1 -1
  20. package/dist/client/index.mjs +71 -1
  21. package/dist/client/index.mjs.map +1 -1
  22. package/dist/deliver/index.d.cts +2 -2
  23. package/dist/deliver/index.d.ts +2 -2
  24. package/dist/{index-DGkgRnZp.d.cts → index-925_Ov7X.d.cts} +1 -1
  25. package/dist/{index-DfkIz7i0.d.cts → index-BbVQzSV1.d.cts} +1 -1
  26. package/dist/{index-BaNcf7jt.d.cts → index-BhGaVlK1.d.cts} +1 -1
  27. package/dist/{index-DjC_gmnL.d.ts → index-C-EEYXSE.d.ts} +1 -1
  28. package/dist/{index-D1GHEM3c.d.ts → index-C18cijCd.d.ts} +1 -1
  29. package/dist/{index-rTZOdMRE.d.ts → index-CBM5XZKC.d.ts} +1 -1
  30. package/dist/{index-lsuS2R1T.d.ts → index-CemR3UI9.d.ts} +32 -1
  31. package/dist/{index-laE3_wm9.d.cts → index-CmcFPn_G.d.cts} +1 -1
  32. package/dist/{index-DrmS802s.d.cts → index-CpGV1f0L.d.cts} +32 -1
  33. package/dist/{index-C01Rkrir.d.ts → index-D9YQQ3FM.d.ts} +1 -1
  34. package/dist/{index-C9mHBJED.d.ts → index-Dkf5sH1E.d.ts} +1 -1
  35. package/dist/{index-CAEiXVWd.d.ts → index-N6eV5yym.d.ts} +1 -1
  36. package/dist/{index-icIH5e5V.d.cts → index-O3EMrd5s.d.cts} +3 -3
  37. package/dist/{index-BvyZ4uiw.d.ts → index-Ol0RtbQA.d.ts} +3 -3
  38. package/dist/{index-DLJso7Vs.d.cts → index-_24DRp3a.d.cts} +1 -1
  39. package/dist/{index-DWOLZNlz.d.cts → index-isT08RuY.d.cts} +1 -1
  40. package/dist/{index-BE7bwNff.d.cts → index-on573dnO.d.cts} +1 -1
  41. package/dist/{index-CBf0-NUQ.d.ts → index-s2PigtDM.d.ts} +1 -1
  42. package/dist/index.cjs +118 -31
  43. package/dist/index.cjs.map +1 -1
  44. package/dist/index.d.cts +11 -11
  45. package/dist/index.d.ts +11 -11
  46. package/dist/index.mjs +118 -31
  47. package/dist/index.mjs.map +1 -1
  48. package/dist/lane/index.cjs +80 -0
  49. package/dist/lane/index.cjs.map +1 -1
  50. package/dist/lane/index.mjs +81 -1
  51. package/dist/lane/index.mjs.map +1 -1
  52. package/dist/match/index.d.cts +4 -4
  53. package/dist/match/index.d.ts +4 -4
  54. package/dist/pem/index.d.cts +2 -2
  55. package/dist/pem/index.d.ts +2 -2
  56. package/dist/pilot/index.d.cts +2 -2
  57. package/dist/pilot/index.d.ts +2 -2
  58. package/dist/precheck/index.d.cts +2 -2
  59. package/dist/precheck/index.d.ts +2 -2
  60. package/dist/produce/index.d.cts +2 -2
  61. package/dist/produce/index.d.ts +2 -2
  62. package/dist/sigh/index.d.cts +2 -2
  63. package/dist/sigh/index.d.ts +2 -2
  64. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -1,20 +1,20 @@
1
- import { A as AppStoreConnectClient } from './index-DrmS802s.cjs';
2
- export { i as App, Q as AppAssetLibrariesResource, S as AppAssetLibrary, Z as AppAssetLibraryDimensions, a0 as AppAssetLibraryImage, X as AppAssetLibraryImageSpec, _ as AppAssetLibraryImagesResource, a5 as AppAssetLibraryPlacement, a4 as AppAssetLibraryPlacementsResource, V as AppAssetLibraryRefDatum, W as AppAssetLibraryRefDatumAttributes, a1 as AppAssetLibraryVideo, Y as AppAssetLibraryVideoSpec, $ as AppAssetLibraryVideosResource, I as AppScreenshot, K as AppScreenshotSet, H as AppScreenshotsResource, c as AppStoreConnectConfig, a as AppStoreConnectError, F as AppStoreVersion, G as AppStoreVersionLocalization, O as AppStoreVersionSubmission, E as AppStoreVersionsResource, w as AppsResource, l as BetaBuildLocalization, k as BetaGroup, y as BetaGroupsResource, j as Build, m as BuildBetaDetail, x as BuildsResource, B as BundleId, o as BundleIdCapability, u as BundleIdsResource, z as CapabilitiesResource, r as CapabilityOption, q as CapabilitySetting, p as CapabilitySettingInput, C as Certificate, s as CertificatesResource, a2 as CreateAssetParams, D as Device, v as DevicesResource, h as JsonApiError, g as JsonApiListResponse, J as JsonApiResource, f as JsonApiResponse, L as ListParams, a6 as PlacementTarget, a7 as PlacementTargetKind, n as PreReleaseVersion, P as Profile, t as ProfilesResource, b as RateLimitError, R as RequestClient, e as RequestOptions, N as ReviewSubmission, M as ReviewSubmissionsResource, d as TokenConfig, T as TokenManager, a3 as UpdateAssetAttributes, U as UploadOperation } from './index-DrmS802s.cjs';
1
+ import { A as AppStoreConnectClient } from './index-CpGV1f0L.cjs';
2
+ export { i as App, Q as AppAssetLibrariesResource, S as AppAssetLibrary, Z as AppAssetLibraryDimensions, a0 as AppAssetLibraryImage, X as AppAssetLibraryImageSpec, _ as AppAssetLibraryImagesResource, a5 as AppAssetLibraryPlacement, a4 as AppAssetLibraryPlacementsResource, V as AppAssetLibraryRefDatum, W as AppAssetLibraryRefDatumAttributes, a1 as AppAssetLibraryVideo, Y as AppAssetLibraryVideoSpec, $ as AppAssetLibraryVideosResource, I as AppScreenshot, K as AppScreenshotSet, H as AppScreenshotsResource, c as AppStoreConnectConfig, a as AppStoreConnectError, F as AppStoreVersion, G as AppStoreVersionLocalization, O as AppStoreVersionSubmission, E as AppStoreVersionsResource, w as AppsResource, l as BetaBuildLocalization, k as BetaGroup, y as BetaGroupsResource, j as Build, m as BuildBetaDetail, x as BuildsResource, B as BundleId, o as BundleIdCapability, u as BundleIdsResource, z as CapabilitiesResource, r as CapabilityOption, q as CapabilitySetting, p as CapabilitySettingInput, C as Certificate, s as CertificatesResource, a2 as CreateAssetParams, D as Device, v as DevicesResource, h as JsonApiError, g as JsonApiListResponse, J as JsonApiResource, f as JsonApiResponse, L as ListParams, a6 as PlacementTarget, a7 as PlacementTargetKind, n as PreReleaseVersion, P as Profile, t as ProfilesResource, b as RateLimitError, R as RequestClient, e as RequestOptions, N as ReviewSubmission, M as ReviewSubmissionsResource, d as TokenConfig, T as TokenManager, a3 as UpdateAssetAttributes, U as UploadOperation } from './index-CpGV1f0L.cjs';
3
3
  export { j as AppAssetLibraryAssetCategory, m as AppAssetLibraryAssetState, o as AppAssetLibraryFeature, k as AppAssetLibraryMediaType, p as AppAssetLibraryPlacementPlatform, n as AppAssetLibraryPlacementState, l as AppAssetLibraryPlacementType, A as AppStoreVersionState, i as BetaReviewState, h as BuildProcessingState, B as BundleIdPlatform, f as CapabilityOptionKey, e as CapabilitySettingsKey, d as CapabilityType, C as CertificateType, g as ContentRightsDeclaration, D as DeviceClass, c as DeviceStatus, E as ExportMethod, b as Platform, a as ProfileState, P as ProfileType, R as ReleaseType } from './enums-yXNVh3UI.cjs';
4
- export { C as CertExpiryInfo, i as cert, p as parseCertificateExpiry } from './index-DLJso7Vs.cjs';
5
- export { i as sigh } from './index-DWOLZNlz.cjs';
6
- export { i as match } from './index-icIH5e5V.cjs';
7
- export { i as produce } from './index-DfkIz7i0.cjs';
8
- export { i as pilot } from './index-laE3_wm9.cjs';
9
- export { i as deliver } from './index-BaNcf7jt.cjs';
10
- export { i as pem } from './index-DGkgRnZp.cjs';
4
+ export { C as CertExpiryInfo, i as cert, p as parseCertificateExpiry } from './index-_24DRp3a.cjs';
5
+ export { i as sigh } from './index-isT08RuY.cjs';
6
+ export { i as match } from './index-O3EMrd5s.cjs';
7
+ export { i as produce } from './index-BbVQzSV1.cjs';
8
+ export { i as pilot } from './index-CmcFPn_G.cjs';
9
+ export { i as deliver } from './index-BhGaVlK1.cjs';
10
+ export { i as pem } from './index-925_Ov7X.cjs';
11
11
  export { i as gym } from './index-B6-MJpO4.cjs';
12
12
  export { i as gradle } from './index-Dv-Mek07.cjs';
13
13
  export { i as playstore } from './index-CXJlvmB4.cjs';
14
14
  export { i as scan } from './index-BimqCmY8.cjs';
15
15
  export { i as snapshot } from './index-CR3BFPIz.cjs';
16
16
  export { i as trainer } from './index-BoU8qt8r.cjs';
17
- export { i as precheck } from './index-BE7bwNff.cjs';
17
+ export { i as precheck } from './index-on573dnO.cjs';
18
18
  export { i as privacy } from './index-DnHQ2uT2.cjs';
19
19
  export { i as review } from './index-DFstwgGK.cjs';
20
20
  export { i as frameit } from './index-BYonklf3.cjs';
@@ -25,7 +25,7 @@ export { L as LaneContext } from './context-CymLkfrS.cjs';
25
25
  export { ActionDefinition, action, ensureActionsRegistered, getAction, listActions, registerAction } from './actions/index.cjs';
26
26
  import { A as AppleSession } from './apple-session-jUzBrql5.cjs';
27
27
  export { createCli } from './cli/index.cjs';
28
- import './cert-eOoxGMN1.cjs';
28
+ import './cert-DffLKURp.cjs';
29
29
  import 'commander';
30
30
 
31
31
  /**
package/dist/index.d.ts CHANGED
@@ -1,20 +1,20 @@
1
- import { A as AppStoreConnectClient } from './index-lsuS2R1T.js';
2
- export { i as App, Q as AppAssetLibrariesResource, S as AppAssetLibrary, Z as AppAssetLibraryDimensions, a0 as AppAssetLibraryImage, X as AppAssetLibraryImageSpec, _ as AppAssetLibraryImagesResource, a5 as AppAssetLibraryPlacement, a4 as AppAssetLibraryPlacementsResource, V as AppAssetLibraryRefDatum, W as AppAssetLibraryRefDatumAttributes, a1 as AppAssetLibraryVideo, Y as AppAssetLibraryVideoSpec, $ as AppAssetLibraryVideosResource, I as AppScreenshot, K as AppScreenshotSet, H as AppScreenshotsResource, c as AppStoreConnectConfig, a as AppStoreConnectError, F as AppStoreVersion, G as AppStoreVersionLocalization, O as AppStoreVersionSubmission, E as AppStoreVersionsResource, w as AppsResource, l as BetaBuildLocalization, k as BetaGroup, y as BetaGroupsResource, j as Build, m as BuildBetaDetail, x as BuildsResource, B as BundleId, o as BundleIdCapability, u as BundleIdsResource, z as CapabilitiesResource, r as CapabilityOption, q as CapabilitySetting, p as CapabilitySettingInput, C as Certificate, s as CertificatesResource, a2 as CreateAssetParams, D as Device, v as DevicesResource, h as JsonApiError, g as JsonApiListResponse, J as JsonApiResource, f as JsonApiResponse, L as ListParams, a6 as PlacementTarget, a7 as PlacementTargetKind, n as PreReleaseVersion, P as Profile, t as ProfilesResource, b as RateLimitError, R as RequestClient, e as RequestOptions, N as ReviewSubmission, M as ReviewSubmissionsResource, d as TokenConfig, T as TokenManager, a3 as UpdateAssetAttributes, U as UploadOperation } from './index-lsuS2R1T.js';
1
+ import { A as AppStoreConnectClient } from './index-CemR3UI9.js';
2
+ export { i as App, Q as AppAssetLibrariesResource, S as AppAssetLibrary, Z as AppAssetLibraryDimensions, a0 as AppAssetLibraryImage, X as AppAssetLibraryImageSpec, _ as AppAssetLibraryImagesResource, a5 as AppAssetLibraryPlacement, a4 as AppAssetLibraryPlacementsResource, V as AppAssetLibraryRefDatum, W as AppAssetLibraryRefDatumAttributes, a1 as AppAssetLibraryVideo, Y as AppAssetLibraryVideoSpec, $ as AppAssetLibraryVideosResource, I as AppScreenshot, K as AppScreenshotSet, H as AppScreenshotsResource, c as AppStoreConnectConfig, a as AppStoreConnectError, F as AppStoreVersion, G as AppStoreVersionLocalization, O as AppStoreVersionSubmission, E as AppStoreVersionsResource, w as AppsResource, l as BetaBuildLocalization, k as BetaGroup, y as BetaGroupsResource, j as Build, m as BuildBetaDetail, x as BuildsResource, B as BundleId, o as BundleIdCapability, u as BundleIdsResource, z as CapabilitiesResource, r as CapabilityOption, q as CapabilitySetting, p as CapabilitySettingInput, C as Certificate, s as CertificatesResource, a2 as CreateAssetParams, D as Device, v as DevicesResource, h as JsonApiError, g as JsonApiListResponse, J as JsonApiResource, f as JsonApiResponse, L as ListParams, a6 as PlacementTarget, a7 as PlacementTargetKind, n as PreReleaseVersion, P as Profile, t as ProfilesResource, b as RateLimitError, R as RequestClient, e as RequestOptions, N as ReviewSubmission, M as ReviewSubmissionsResource, d as TokenConfig, T as TokenManager, a3 as UpdateAssetAttributes, U as UploadOperation } from './index-CemR3UI9.js';
3
3
  export { j as AppAssetLibraryAssetCategory, m as AppAssetLibraryAssetState, o as AppAssetLibraryFeature, k as AppAssetLibraryMediaType, p as AppAssetLibraryPlacementPlatform, n as AppAssetLibraryPlacementState, l as AppAssetLibraryPlacementType, A as AppStoreVersionState, i as BetaReviewState, h as BuildProcessingState, B as BundleIdPlatform, f as CapabilityOptionKey, e as CapabilitySettingsKey, d as CapabilityType, C as CertificateType, g as ContentRightsDeclaration, D as DeviceClass, c as DeviceStatus, E as ExportMethod, b as Platform, a as ProfileState, P as ProfileType, R as ReleaseType } from './enums-yXNVh3UI.js';
4
- export { C as CertExpiryInfo, i as cert, p as parseCertificateExpiry } from './index-D1GHEM3c.js';
5
- export { i as sigh } from './index-C01Rkrir.js';
6
- export { i as match } from './index-BvyZ4uiw.js';
7
- export { i as produce } from './index-DjC_gmnL.js';
8
- export { i as pilot } from './index-CAEiXVWd.js';
9
- export { i as deliver } from './index-CBf0-NUQ.js';
10
- export { i as pem } from './index-rTZOdMRE.js';
4
+ export { C as CertExpiryInfo, i as cert, p as parseCertificateExpiry } from './index-C18cijCd.js';
5
+ export { i as sigh } from './index-D9YQQ3FM.js';
6
+ export { i as match } from './index-Ol0RtbQA.js';
7
+ export { i as produce } from './index-C-EEYXSE.js';
8
+ export { i as pilot } from './index-N6eV5yym.js';
9
+ export { i as deliver } from './index-s2PigtDM.js';
10
+ export { i as pem } from './index-CBM5XZKC.js';
11
11
  export { i as gym } from './index-mEEB7An6.js';
12
12
  export { i as gradle } from './index-Dv-Mek07.js';
13
13
  export { i as playstore } from './index-CXJlvmB4.js';
14
14
  export { i as scan } from './index-BimqCmY8.js';
15
15
  export { i as snapshot } from './index-CR3BFPIz.js';
16
16
  export { i as trainer } from './index-BoU8qt8r.js';
17
- export { i as precheck } from './index-C9mHBJED.js';
17
+ export { i as precheck } from './index-Dkf5sH1E.js';
18
18
  export { i as privacy } from './index-8djTPW8O.js';
19
19
  export { i as review } from './index-BGhV0gS-.js';
20
20
  export { i as frameit } from './index-BYonklf3.js';
@@ -25,7 +25,7 @@ export { L as LaneContext } from './context-CymLkfrS.js';
25
25
  export { ActionDefinition, action, ensureActionsRegistered, getAction, listActions, registerAction } from './actions/index.js';
26
26
  import { A as AppleSession } from './apple-session-jUzBrql5.js';
27
27
  export { createCli } from './cli/index.js';
28
- import './cert-RvXmdMke.js';
28
+ import './cert-ClacRx9y.js';
29
29
  import 'commander';
30
30
 
31
31
  /**
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  import { importPKCS8, SignJWT } from 'jose';
2
2
  import { webcrypto, createHash, randomUUID, randomBytes, X509Certificate, pbkdf2Sync, createCipheriv, createDecipheriv, generateKeyPairSync } from 'crypto';
3
3
  import { createInterface } from 'readline';
4
+ import { writeFileSync, chmodSync, existsSync, unlinkSync, readFileSync, mkdirSync, readdirSync, copyFileSync, mkdtempSync, rmSync } from 'fs';
5
+ import { homedir, tmpdir } from 'os';
6
+ import { join, extname, resolve, basename, relative } from 'path';
4
7
  import * as x509 from '@peculiar/x509';
5
8
  import { execFile, spawn, execSync, execFileSync } from 'child_process';
6
- import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync, copyFileSync, unlinkSync, mkdtempSync, rmSync, chmodSync } from 'fs';
7
- import { join, extname, resolve, basename, relative } from 'path';
8
- import { homedir, tmpdir } from 'os';
9
9
  import { promisify } from 'util';
10
10
  import { mkdir, writeFile, readFile, readdir, mkdtemp, unlink, stat, rm, chmod, copyFile } from 'fs/promises';
11
11
  import emojiRegex from 'emoji-regex';
@@ -220,20 +220,6 @@ var init_srp = __esm({
220
220
  };
221
221
  }
222
222
  });
223
-
224
- // src/client/apple-session.ts
225
- var apple_session_exports = {};
226
- __export(apple_session_exports, {
227
- ProgramLicenseAgreementError: () => ProgramLicenseAgreementError,
228
- appleJson: () => appleJson,
229
- beginLogin: () => beginLogin,
230
- checkPortalResponse: () => checkPortalResponse,
231
- fetchServiceKey: () => fetchServiceKey,
232
- loginWithAppleId: () => loginWithAppleId,
233
- requestSmsCode: () => requestSmsCode,
234
- serviceKeyFromLocation: () => serviceKeyFromLocation,
235
- submitTwoFactorCode: () => submitTwoFactorCode
236
- });
237
223
  async function appleJson(res, what) {
238
224
  const text = await res.text();
239
225
  try {
@@ -2785,6 +2771,90 @@ var init_app_asset_library_placements = __esm({
2785
2771
  }
2786
2772
  });
2787
2773
 
2774
+ // src/client/session-store.ts
2775
+ var session_store_exports = {};
2776
+ __export(session_store_exports, {
2777
+ clearAppleSession: () => clearAppleSession,
2778
+ lastAppleId: () => lastAppleId,
2779
+ loadAppleSession: () => loadAppleSession,
2780
+ saveAppleSession: () => saveAppleSession,
2781
+ sessionDir: () => sessionDir,
2782
+ signInWithAppleId: () => signInWithAppleId
2783
+ });
2784
+ function sessionDir() {
2785
+ return process.env.FASTNODE_SESSION_DIR || join(homedir(), ".fastnode", "sessions");
2786
+ }
2787
+ function fileFor(email) {
2788
+ const key = createHash("sha256").update(email.trim().toLowerCase()).digest("hex").slice(0, 16);
2789
+ return join(sessionDir(), `${key}.json`);
2790
+ }
2791
+ function ensureDir() {
2792
+ const dir = sessionDir();
2793
+ if (!existsSync(dir)) mkdirSync(dir, { recursive: true, mode: 448 });
2794
+ chmodSync(dir, 448);
2795
+ }
2796
+ function saveAppleSession(session) {
2797
+ ensureDir();
2798
+ const stored = { email: session.userEmail, savedAt: (/* @__PURE__ */ new Date()).toISOString(), session };
2799
+ const path = fileFor(session.userEmail);
2800
+ writeFileSync(path, JSON.stringify(stored), { mode: 384 });
2801
+ chmodSync(path, 384);
2802
+ writeFileSync(join(sessionDir(), "last-apple-id"), session.userEmail, { mode: 384 });
2803
+ }
2804
+ function clearAppleSession(email) {
2805
+ const path = fileFor(email);
2806
+ if (existsSync(path)) unlinkSync(path);
2807
+ }
2808
+ function lastAppleId() {
2809
+ try {
2810
+ return readFileSync(join(sessionDir(), "last-apple-id"), "utf8").trim() || null;
2811
+ } catch {
2812
+ return null;
2813
+ }
2814
+ }
2815
+ async function loadAppleSession(email, fetchImpl = fetch) {
2816
+ const path = fileFor(email);
2817
+ if (!existsSync(path)) return null;
2818
+ let stored;
2819
+ try {
2820
+ stored = JSON.parse(readFileSync(path, "utf8"));
2821
+ } catch {
2822
+ return null;
2823
+ }
2824
+ const cookie = Object.entries(stored.session.cookies).map(([k, v]) => `${k}=${v}`).join("; ");
2825
+ try {
2826
+ const res = await fetchImpl(OLYMPUS_SESSION2, { headers: { Cookie: cookie, Accept: "application/json" } });
2827
+ if (!res.ok) {
2828
+ clearAppleSession(email);
2829
+ return null;
2830
+ }
2831
+ } catch {
2832
+ return null;
2833
+ }
2834
+ return stored.session;
2835
+ }
2836
+ async function signInWithAppleId(options) {
2837
+ const email = options.email || lastAppleId() || await options.askEmail();
2838
+ if (!options.fresh) {
2839
+ const saved = await loadAppleSession(email);
2840
+ if (saved) {
2841
+ options.onLog?.(`Using saved Apple ID session for ${email}`);
2842
+ return saved;
2843
+ }
2844
+ }
2845
+ const password = await options.askPassword(email);
2846
+ const session = await loginWithAppleId({ email, password, onLog: options.onLog });
2847
+ saveAppleSession(session);
2848
+ return session;
2849
+ }
2850
+ var OLYMPUS_SESSION2;
2851
+ var init_session_store = __esm({
2852
+ "src/client/session-store.ts"() {
2853
+ init_apple_session();
2854
+ OLYMPUS_SESSION2 = "https://appstoreconnect.apple.com/olympus/v1/session";
2855
+ }
2856
+ });
2857
+
2788
2858
  // src/client/portal.ts
2789
2859
  function pickUniqueKeyName(base, taken) {
2790
2860
  if (!taken.has(base)) return base;
@@ -3862,8 +3932,14 @@ __export(client_exports, {
3862
3932
  TokenManager: () => TokenManager,
3863
3933
  beginLogin: () => beginLogin,
3864
3934
  checkPortalResponse: () => checkPortalResponse,
3935
+ clearAppleSession: () => clearAppleSession,
3936
+ lastAppleId: () => lastAppleId,
3937
+ loadAppleSession: () => loadAppleSession,
3865
3938
  loginWithAppleId: () => loginWithAppleId,
3866
3939
  requestSmsCode: () => requestSmsCode,
3940
+ saveAppleSession: () => saveAppleSession,
3941
+ sessionDir: () => sessionDir,
3942
+ signInWithAppleId: () => signInWithAppleId,
3867
3943
  submitTwoFactorCode: () => submitTwoFactorCode
3868
3944
  });
3869
3945
  var AppStoreConnectClient;
@@ -3911,6 +3987,7 @@ var init_client = __esm({
3911
3987
  init_auth();
3912
3988
  init_request();
3913
3989
  init_apple_session();
3990
+ init_session_store();
3914
3991
  init_portal();
3915
3992
  init_iris();
3916
3993
  AppStoreConnectClient = class {
@@ -25789,12 +25866,12 @@ function fail(what, r) {
25789
25866
  async function selectProviderForApp(session, appId, onLog) {
25790
25867
  const owns = async () => (await iris(session, "GET", `/apps/${appId}?fields[apps]=name`)).status === 200;
25791
25868
  if (await owns()) return;
25792
- const res = await fetch(OLYMPUS_SESSION2, { headers: { Cookie: cookieHeader(session), Accept: "application/json" } });
25869
+ const res = await fetch(OLYMPUS_SESSION3, { headers: { Cookie: cookieHeader(session), Accept: "application/json" } });
25793
25870
  absorbCookies(session, res);
25794
25871
  const info = await res.json().catch(() => null);
25795
25872
  const providers = info?.availableProviders ?? [];
25796
25873
  for (const p of providers) {
25797
- const sw = await fetch(OLYMPUS_SESSION2, {
25874
+ const sw = await fetch(OLYMPUS_SESSION3, {
25798
25875
  method: "POST",
25799
25876
  headers: { Cookie: cookieHeader(session), "Content-Type": "application/json", Accept: "application/json" },
25800
25877
  body: JSON.stringify({ provider: { providerId: p.providerId } })
@@ -25893,11 +25970,11 @@ function validateUsages(usages) {
25893
25970
  if (linked && unlinked) throw new Error(`${u.category} cannot be both linked and not linked to the user.`);
25894
25971
  }
25895
25972
  }
25896
- var IRIS_BASE2, OLYMPUS_SESSION2, DATA_USAGE_CATEGORIES, DATA_USAGE_PURPOSES, DATA_PROTECTIONS;
25973
+ var IRIS_BASE2, OLYMPUS_SESSION3, DATA_USAGE_CATEGORIES, DATA_USAGE_PURPOSES, DATA_PROTECTIONS;
25897
25974
  var init_privacy = __esm({
25898
25975
  "src/privacy/index.ts"() {
25899
25976
  IRIS_BASE2 = "https://appstoreconnect.apple.com/iris/v1";
25900
- OLYMPUS_SESSION2 = "https://appstoreconnect.apple.com/olympus/v1/session";
25977
+ OLYMPUS_SESSION3 = "https://appstoreconnect.apple.com/olympus/v1/session";
25901
25978
  DATA_USAGE_CATEGORIES = [
25902
25979
  "PAYMENT_INFORMATION",
25903
25980
  "CREDIT_AND_FRAUD",
@@ -29831,14 +29908,18 @@ function createLanesCommand() {
29831
29908
  });
29832
29909
  }
29833
29910
  function createPrivacyCommand() {
29834
- 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) => {
29835
- const { loginWithAppleId: loginWithAppleId2 } = await Promise.resolve().then(() => (init_apple_session(), apple_session_exports));
29911
+ 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) => {
29912
+ const { signInWithAppleId: signInWithAppleId2, saveAppleSession: saveAppleSession2 } = await Promise.resolve().then(() => (init_session_store(), session_store_exports));
29836
29913
  const { uploadAppPrivacyDetails: uploadAppPrivacyDetails2, validateUsages: validateUsages2 } = await Promise.resolve().then(() => (init_privacy(), privacy_exports));
29837
29914
  const usages = JSON.parse(readFileSync(opts.jsonPath, "utf8"));
29838
29915
  validateUsages2(usages);
29839
- const email = opts.username || await ask("Apple ID: ");
29840
- const password = process.env.FASTNODE_PASSWORD ?? process.env.FASTLANE_PASSWORD ?? await ask(`Password for ${email}: `, true);
29841
- const session = await loginWithAppleId2({ email, password, onLog: (m) => console.log(m) });
29916
+ const session = await signInWithAppleId2({
29917
+ email: opts.username,
29918
+ askEmail: () => ask("Apple ID: "),
29919
+ askPassword: async (email) => process.env.FASTNODE_PASSWORD ?? process.env.FASTLANE_PASSWORD ?? await ask(`Password for ${email}: `, true),
29920
+ fresh: opts.freshLogin,
29921
+ onLog: (m) => console.log(m)
29922
+ });
29842
29923
  const result = await uploadAppPrivacyDetails2({
29843
29924
  session,
29844
29925
  appId: opts.appId,
@@ -29846,6 +29927,7 @@ function createPrivacyCommand() {
29846
29927
  skipPublish: opts.skipPublish,
29847
29928
  onLog: (m) => console.log(m)
29848
29929
  });
29930
+ saveAppleSession2(session);
29849
29931
  console.log(`Done: ${result.created} answers${result.published ? ", published" : ""}.`);
29850
29932
  });
29851
29933
  }
@@ -29868,12 +29950,16 @@ function ask(question, secret = false) {
29868
29950
  });
29869
29951
  }
29870
29952
  function createRejectionsCommand() {
29871
- 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) => {
29872
- const { loginWithAppleId: loginWithAppleId2 } = await Promise.resolve().then(() => (init_apple_session(), apple_session_exports));
29953
+ 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) => {
29954
+ const { signInWithAppleId: signInWithAppleId2, saveAppleSession: saveAppleSession2 } = await Promise.resolve().then(() => (init_session_store(), session_store_exports));
29873
29955
  const { getReviewFeedback: getReviewFeedback2 } = await Promise.resolve().then(() => (init_review(), review_exports));
29874
- const email = opts.username || await ask2("Apple ID: ");
29875
- const password = process.env.FASTNODE_PASSWORD ?? process.env.FASTLANE_PASSWORD ?? await ask2(`Password for ${email}: `, true);
29876
- const session = await loginWithAppleId2({ email, password, onLog: (m) => console.error(m) });
29956
+ const session = await signInWithAppleId2({
29957
+ email: opts.username,
29958
+ askEmail: () => ask2("Apple ID: "),
29959
+ askPassword: async (email) => process.env.FASTNODE_PASSWORD ?? process.env.FASTLANE_PASSWORD ?? await ask2(`Password for ${email}: `, true),
29960
+ fresh: opts.freshLogin,
29961
+ onLog: (m) => console.error(m)
29962
+ });
29877
29963
  const all = {};
29878
29964
  for (const appId of opts.appId) {
29879
29965
  const feedback = await getReviewFeedback2(session, appId, { onlyOpen: !opts.all, onLog: (m) => console.error(m) });
@@ -29896,6 +29982,7 @@ Submission ${s.submissionId} \u2014 ${s.state} (submitted ${s.submittedDate ?? "
29896
29982
  }
29897
29983
  }
29898
29984
  }
29985
+ saveAppleSession2(session);
29899
29986
  if (opts.json) console.log(JSON.stringify(all, null, 2));
29900
29987
  });
29901
29988
  }