@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,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, copyFileSync, chmodSync, unlinkSync, 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';
@@ -6928,6 +6928,79 @@ var init_app_asset_library_placements = __esm({
6928
6928
  };
6929
6929
  }
6930
6930
  });
6931
+ function sessionDir() {
6932
+ return process.env.FASTNODE_SESSION_DIR || join(homedir(), ".fastnode", "sessions");
6933
+ }
6934
+ function fileFor(email) {
6935
+ const key = createHash("sha256").update(email.trim().toLowerCase()).digest("hex").slice(0, 16);
6936
+ return join(sessionDir(), `${key}.json`);
6937
+ }
6938
+ function ensureDir() {
6939
+ const dir = sessionDir();
6940
+ if (!existsSync(dir)) mkdirSync(dir, { recursive: true, mode: 448 });
6941
+ chmodSync(dir, 448);
6942
+ }
6943
+ function saveAppleSession(session) {
6944
+ ensureDir();
6945
+ const stored = { email: session.userEmail, savedAt: (/* @__PURE__ */ new Date()).toISOString(), session };
6946
+ const path = fileFor(session.userEmail);
6947
+ writeFileSync(path, JSON.stringify(stored), { mode: 384 });
6948
+ chmodSync(path, 384);
6949
+ writeFileSync(join(sessionDir(), "last-apple-id"), session.userEmail, { mode: 384 });
6950
+ }
6951
+ function clearAppleSession(email) {
6952
+ const path = fileFor(email);
6953
+ if (existsSync(path)) unlinkSync(path);
6954
+ }
6955
+ function lastAppleId() {
6956
+ try {
6957
+ return readFileSync(join(sessionDir(), "last-apple-id"), "utf8").trim() || null;
6958
+ } catch {
6959
+ return null;
6960
+ }
6961
+ }
6962
+ async function loadAppleSession(email, fetchImpl = fetch) {
6963
+ const path = fileFor(email);
6964
+ if (!existsSync(path)) return null;
6965
+ let stored;
6966
+ try {
6967
+ stored = JSON.parse(readFileSync(path, "utf8"));
6968
+ } catch {
6969
+ return null;
6970
+ }
6971
+ const cookie = Object.entries(stored.session.cookies).map(([k, v]) => `${k}=${v}`).join("; ");
6972
+ try {
6973
+ const res = await fetchImpl(OLYMPUS_SESSION2, { headers: { Cookie: cookie, Accept: "application/json" } });
6974
+ if (!res.ok) {
6975
+ clearAppleSession(email);
6976
+ return null;
6977
+ }
6978
+ } catch {
6979
+ return null;
6980
+ }
6981
+ return stored.session;
6982
+ }
6983
+ async function signInWithAppleId(options) {
6984
+ const email = options.email || lastAppleId() || await options.askEmail();
6985
+ if (!options.fresh) {
6986
+ const saved = await loadAppleSession(email);
6987
+ if (saved) {
6988
+ options.onLog?.(`Using saved Apple ID session for ${email}`);
6989
+ return saved;
6990
+ }
6991
+ }
6992
+ const password = await options.askPassword(email);
6993
+ const session = await loginWithAppleId({ email, password, onLog: options.onLog });
6994
+ saveAppleSession(session);
6995
+ return session;
6996
+ }
6997
+ var OLYMPUS_SESSION2;
6998
+ var init_session_store = __esm({
6999
+ "src/client/session-store.ts"() {
7000
+ init_apple_session();
7001
+ OLYMPUS_SESSION2 = "https://appstoreconnect.apple.com/olympus/v1/session";
7002
+ }
7003
+ });
6931
7004
 
6932
7005
  // src/client/portal.ts
6933
7006
  function pickUniqueKeyName(base, taken) {
@@ -8006,8 +8079,14 @@ __export(client_exports, {
8006
8079
  TokenManager: () => TokenManager,
8007
8080
  beginLogin: () => beginLogin,
8008
8081
  checkPortalResponse: () => checkPortalResponse,
8082
+ clearAppleSession: () => clearAppleSession,
8083
+ lastAppleId: () => lastAppleId,
8084
+ loadAppleSession: () => loadAppleSession,
8009
8085
  loginWithAppleId: () => loginWithAppleId,
8010
8086
  requestSmsCode: () => requestSmsCode,
8087
+ saveAppleSession: () => saveAppleSession,
8088
+ sessionDir: () => sessionDir,
8089
+ signInWithAppleId: () => signInWithAppleId,
8011
8090
  submitTwoFactorCode: () => submitTwoFactorCode
8012
8091
  });
8013
8092
  var AppStoreConnectClient;
@@ -8055,6 +8134,7 @@ var init_client = __esm({
8055
8134
  init_auth();
8056
8135
  init_request();
8057
8136
  init_apple_session();
8137
+ init_session_store();
8058
8138
  init_portal();
8059
8139
  init_iris();
8060
8140
  AppStoreConnectClient = class {