@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
@@ -1,5 +1,5 @@
1
- export { C as CertOptions, a as CertResult, c as createCertificate, d as downloadCertificate, f as findValidCertificates, r as revokeCertificate, b as revokeExpiredCertificates } from '../cert-eOoxGMN1.cjs';
2
- export { B as BundleP12Options, C as CertExpiryInfo, b as bundleP12, g as generateCSR, a as generateRSACSR, p as parseCertificateExpiry } from '../index-DLJso7Vs.cjs';
3
- import '../index-DrmS802s.cjs';
1
+ export { C as CertOptions, a as CertResult, c as createCertificate, d as downloadCertificate, f as findValidCertificates, r as revokeCertificate, b as revokeExpiredCertificates } from '../cert-DffLKURp.cjs';
2
+ export { B as BundleP12Options, C as CertExpiryInfo, b as bundleP12, g as generateCSR, a as generateRSACSR, p as parseCertificateExpiry } from '../index-_24DRp3a.cjs';
3
+ import '../index-CpGV1f0L.cjs';
4
4
  import '../enums-yXNVh3UI.cjs';
5
5
  import '../apple-session-jUzBrql5.cjs';
@@ -1,5 +1,5 @@
1
- export { C as CertOptions, a as CertResult, c as createCertificate, d as downloadCertificate, f as findValidCertificates, r as revokeCertificate, b as revokeExpiredCertificates } from '../cert-RvXmdMke.js';
2
- export { B as BundleP12Options, C as CertExpiryInfo, b as bundleP12, g as generateCSR, a as generateRSACSR, p as parseCertificateExpiry } from '../index-D1GHEM3c.js';
3
- import '../index-lsuS2R1T.js';
1
+ export { C as CertOptions, a as CertResult, c as createCertificate, d as downloadCertificate, f as findValidCertificates, r as revokeCertificate, b as revokeExpiredCertificates } from '../cert-ClacRx9y.js';
2
+ export { B as BundleP12Options, C as CertExpiryInfo, b as bundleP12, g as generateCSR, a as generateRSACSR, p as parseCertificateExpiry } from '../index-C18cijCd.js';
3
+ import '../index-CemR3UI9.js';
4
4
  import '../enums-yXNVh3UI.js';
5
5
  import '../apple-session-jUzBrql5.js';
@@ -1,4 +1,4 @@
1
- import { A as AppStoreConnectClient, C as Certificate } from './index-lsuS2R1T.js';
1
+ import { A as AppStoreConnectClient, C as Certificate } from './index-CemR3UI9.js';
2
2
  import { C as CertificateType } from './enums-yXNVh3UI.js';
3
3
 
4
4
  interface CertOptions {
@@ -1,4 +1,4 @@
1
- import { A as AppStoreConnectClient, C as Certificate } from './index-DrmS802s.cjs';
1
+ import { A as AppStoreConnectClient, C as Certificate } from './index-CpGV1f0L.cjs';
2
2
  import { C as CertificateType } from './enums-yXNVh3UI.cjs';
3
3
 
4
4
  interface CertOptions {
@@ -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;
@@ -8077,8 +8147,14 @@ __export(client_exports, {
8077
8147
  TokenManager: () => TokenManager,
8078
8148
  beginLogin: () => beginLogin,
8079
8149
  checkPortalResponse: () => checkPortalResponse,
8150
+ clearAppleSession: () => clearAppleSession,
8151
+ lastAppleId: () => lastAppleId,
8152
+ loadAppleSession: () => loadAppleSession,
8080
8153
  loginWithAppleId: () => loginWithAppleId,
8081
8154
  requestSmsCode: () => requestSmsCode,
8155
+ saveAppleSession: () => saveAppleSession,
8156
+ sessionDir: () => sessionDir,
8157
+ signInWithAppleId: () => signInWithAppleId,
8082
8158
  submitTwoFactorCode: () => submitTwoFactorCode
8083
8159
  });
8084
8160
  var AppStoreConnectClient;
@@ -8126,6 +8202,7 @@ var init_client = __esm({
8126
8202
  init_auth();
8127
8203
  init_request();
8128
8204
  init_apple_session();
8205
+ init_session_store();
8129
8206
  init_portal();
8130
8207
  init_iris();
8131
8208
  AppStoreConnectClient = class {
@@ -9427,12 +9504,12 @@ function fail(what, r) {
9427
9504
  async function selectProviderForApp(session, appId, onLog) {
9428
9505
  const owns = async () => (await iris(session, "GET", `/apps/${appId}?fields[apps]=name`)).status === 200;
9429
9506
  if (await owns()) return;
9430
- const res = await fetch(OLYMPUS_SESSION2, { headers: { Cookie: cookieHeader(session), Accept: "application/json" } });
9507
+ const res = await fetch(OLYMPUS_SESSION3, { headers: { Cookie: cookieHeader(session), Accept: "application/json" } });
9431
9508
  absorbCookies(session, res);
9432
9509
  const info = await res.json().catch(() => null);
9433
9510
  const providers = info?.availableProviders ?? [];
9434
9511
  for (const p of providers) {
9435
- const sw = await fetch(OLYMPUS_SESSION2, {
9512
+ const sw = await fetch(OLYMPUS_SESSION3, {
9436
9513
  method: "POST",
9437
9514
  headers: { Cookie: cookieHeader(session), "Content-Type": "application/json", Accept: "application/json" },
9438
9515
  body: JSON.stringify({ provider: { providerId: p.providerId } })
@@ -9531,11 +9608,11 @@ function validateUsages(usages) {
9531
9608
  if (linked && unlinked) throw new Error(`${u.category} cannot be both linked and not linked to the user.`);
9532
9609
  }
9533
9610
  }
9534
- var IRIS_BASE2, OLYMPUS_SESSION2, DATA_USAGE_CATEGORIES, DATA_USAGE_PURPOSES, DATA_PROTECTIONS;
9611
+ var IRIS_BASE2, OLYMPUS_SESSION3, DATA_USAGE_CATEGORIES, DATA_USAGE_PURPOSES, DATA_PROTECTIONS;
9535
9612
  var init_privacy = __esm({
9536
9613
  "src/privacy/index.ts"() {
9537
9614
  IRIS_BASE2 = "https://appstoreconnect.apple.com/iris/v1";
9538
- OLYMPUS_SESSION2 = "https://appstoreconnect.apple.com/olympus/v1/session";
9615
+ OLYMPUS_SESSION3 = "https://appstoreconnect.apple.com/olympus/v1/session";
9539
9616
  DATA_USAGE_CATEGORIES = [
9540
9617
  "PAYMENT_INFORMATION",
9541
9618
  "CREDIT_AND_FRAUD",
@@ -9964,14 +10041,18 @@ function createLanesCommand() {
9964
10041
  });
9965
10042
  }
9966
10043
  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));
10044
+ 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) => {
10045
+ const { signInWithAppleId: signInWithAppleId2, saveAppleSession: saveAppleSession2 } = await Promise.resolve().then(() => (init_session_store(), session_store_exports));
9969
10046
  const { uploadAppPrivacyDetails: uploadAppPrivacyDetails2, validateUsages: validateUsages2 } = await Promise.resolve().then(() => (init_privacy(), privacy_exports));
9970
10047
  const usages = JSON.parse(fs.readFileSync(opts.jsonPath, "utf8"));
9971
10048
  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) });
10049
+ const session = await signInWithAppleId2({
10050
+ email: opts.username,
10051
+ askEmail: () => ask("Apple ID: "),
10052
+ askPassword: async (email) => process.env.FASTNODE_PASSWORD ?? process.env.FASTLANE_PASSWORD ?? await ask(`Password for ${email}: `, true),
10053
+ fresh: opts.freshLogin,
10054
+ onLog: (m) => console.log(m)
10055
+ });
9975
10056
  const result = await uploadAppPrivacyDetails2({
9976
10057
  session,
9977
10058
  appId: opts.appId,
@@ -9979,6 +10060,7 @@ function createPrivacyCommand() {
9979
10060
  skipPublish: opts.skipPublish,
9980
10061
  onLog: (m) => console.log(m)
9981
10062
  });
10063
+ saveAppleSession2(session);
9982
10064
  console.log(`Done: ${result.created} answers${result.published ? ", published" : ""}.`);
9983
10065
  });
9984
10066
  }
@@ -10001,12 +10083,16 @@ function ask(question, secret = false) {
10001
10083
  });
10002
10084
  }
10003
10085
  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));
10086
+ 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) => {
10087
+ const { signInWithAppleId: signInWithAppleId2, saveAppleSession: saveAppleSession2 } = await Promise.resolve().then(() => (init_session_store(), session_store_exports));
10006
10088
  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) });
10089
+ const session = await signInWithAppleId2({
10090
+ email: opts.username,
10091
+ askEmail: () => ask2("Apple ID: "),
10092
+ askPassword: async (email) => process.env.FASTNODE_PASSWORD ?? process.env.FASTLANE_PASSWORD ?? await ask2(`Password for ${email}: `, true),
10093
+ fresh: opts.freshLogin,
10094
+ onLog: (m) => console.error(m)
10095
+ });
10010
10096
  const all = {};
10011
10097
  for (const appId of opts.appId) {
10012
10098
  const feedback = await getReviewFeedback2(session, appId, { onlyOpen: !opts.all, onLog: (m) => console.error(m) });
@@ -10029,6 +10115,7 @@ Submission ${s.submissionId} \u2014 ${s.state} (submitted ${s.submittedDate ?? "
10029
10115
  }
10030
10116
  }
10031
10117
  }
10118
+ saveAppleSession2(session);
10032
10119
  if (opts.json) console.log(JSON.stringify(all, null, 2));
10033
10120
  });
10034
10121
  }