@scalebun-release/cli 2.5.0

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 (210) hide show
  1. package/bin/scalebun.js +2 -0
  2. package/lib/api/client.d.ts +52 -0
  3. package/lib/api/client.d.ts.map +1 -0
  4. package/lib/api/client.js +335 -0
  5. package/lib/api/client.js.map +1 -0
  6. package/lib/commands/ci-init.d.ts +3 -0
  7. package/lib/commands/ci-init.d.ts.map +1 -0
  8. package/lib/commands/ci-init.js +348 -0
  9. package/lib/commands/ci-init.js.map +1 -0
  10. package/lib/commands/doctor.d.ts +31 -0
  11. package/lib/commands/doctor.d.ts.map +1 -0
  12. package/lib/commands/doctor.js +559 -0
  13. package/lib/commands/doctor.js.map +1 -0
  14. package/lib/commands/launch.d.ts +3 -0
  15. package/lib/commands/launch.d.ts.map +1 -0
  16. package/lib/commands/launch.js +23 -0
  17. package/lib/commands/launch.js.map +1 -0
  18. package/lib/commands/link.d.ts +16 -0
  19. package/lib/commands/link.d.ts.map +1 -0
  20. package/lib/commands/link.js +164 -0
  21. package/lib/commands/link.js.map +1 -0
  22. package/lib/commands/login.d.ts +12 -0
  23. package/lib/commands/login.d.ts.map +1 -0
  24. package/lib/commands/login.js +124 -0
  25. package/lib/commands/login.js.map +1 -0
  26. package/lib/commands/migrate-codepush.d.ts +13 -0
  27. package/lib/commands/migrate-codepush.d.ts.map +1 -0
  28. package/lib/commands/migrate-codepush.js +98 -0
  29. package/lib/commands/migrate-codepush.js.map +1 -0
  30. package/lib/commands/ota-bundle.d.ts +22 -0
  31. package/lib/commands/ota-bundle.d.ts.map +1 -0
  32. package/lib/commands/ota-bundle.js +253 -0
  33. package/lib/commands/ota-bundle.js.map +1 -0
  34. package/lib/commands/ota-channels.d.ts +3 -0
  35. package/lib/commands/ota-channels.d.ts.map +1 -0
  36. package/lib/commands/ota-channels.js +231 -0
  37. package/lib/commands/ota-channels.js.map +1 -0
  38. package/lib/commands/ota-delete-bundle.d.ts +16 -0
  39. package/lib/commands/ota-delete-bundle.d.ts.map +1 -0
  40. package/lib/commands/ota-delete-bundle.js +96 -0
  41. package/lib/commands/ota-delete-bundle.js.map +1 -0
  42. package/lib/commands/ota-inspect.d.ts +3 -0
  43. package/lib/commands/ota-inspect.d.ts.map +1 -0
  44. package/lib/commands/ota-inspect.js +258 -0
  45. package/lib/commands/ota-inspect.js.map +1 -0
  46. package/lib/commands/ota-keys.d.ts +91 -0
  47. package/lib/commands/ota-keys.d.ts.map +1 -0
  48. package/lib/commands/ota-keys.js +765 -0
  49. package/lib/commands/ota-keys.js.map +1 -0
  50. package/lib/commands/ota-promote.d.ts +3 -0
  51. package/lib/commands/ota-promote.d.ts.map +1 -0
  52. package/lib/commands/ota-promote.js +194 -0
  53. package/lib/commands/ota-promote.js.map +1 -0
  54. package/lib/commands/ota-publish.d.ts +26 -0
  55. package/lib/commands/ota-publish.d.ts.map +1 -0
  56. package/lib/commands/ota-publish.js +892 -0
  57. package/lib/commands/ota-publish.js.map +1 -0
  58. package/lib/commands/ota-rollout.d.ts +3 -0
  59. package/lib/commands/ota-rollout.d.ts.map +1 -0
  60. package/lib/commands/ota-rollout.js +265 -0
  61. package/lib/commands/ota-rollout.js.map +1 -0
  62. package/lib/commands/ota-sign.d.ts +19 -0
  63. package/lib/commands/ota-sign.d.ts.map +1 -0
  64. package/lib/commands/ota-sign.js +245 -0
  65. package/lib/commands/ota-sign.js.map +1 -0
  66. package/lib/commands/push-apns.d.ts +3 -0
  67. package/lib/commands/push-apns.d.ts.map +1 -0
  68. package/lib/commands/push-apns.js +166 -0
  69. package/lib/commands/push-apns.js.map +1 -0
  70. package/lib/commands/quickstart.d.ts +4 -0
  71. package/lib/commands/quickstart.d.ts.map +1 -0
  72. package/lib/commands/quickstart.js +672 -0
  73. package/lib/commands/quickstart.js.map +1 -0
  74. package/lib/commands/shell.d.ts +28 -0
  75. package/lib/commands/shell.d.ts.map +1 -0
  76. package/lib/commands/shell.js +512 -0
  77. package/lib/commands/shell.js.map +1 -0
  78. package/lib/commands/tls-pins.d.ts +27 -0
  79. package/lib/commands/tls-pins.d.ts.map +1 -0
  80. package/lib/commands/tls-pins.js +209 -0
  81. package/lib/commands/tls-pins.js.map +1 -0
  82. package/lib/index.d.ts +2 -0
  83. package/lib/index.d.ts.map +1 -0
  84. package/lib/index.js +233 -0
  85. package/lib/index.js.map +1 -0
  86. package/lib/ui/banner.d.ts +23 -0
  87. package/lib/ui/banner.d.ts.map +1 -0
  88. package/lib/ui/banner.js +162 -0
  89. package/lib/ui/banner.js.map +1 -0
  90. package/lib/ui/graphics.d.ts +18 -0
  91. package/lib/ui/graphics.d.ts.map +1 -0
  92. package/lib/ui/graphics.js +134 -0
  93. package/lib/ui/graphics.js.map +1 -0
  94. package/lib/ui/mark.d.ts +4 -0
  95. package/lib/ui/mark.d.ts.map +1 -0
  96. package/lib/ui/mark.js +21 -0
  97. package/lib/ui/mark.js.map +1 -0
  98. package/lib/ui/menu.d.ts +109 -0
  99. package/lib/ui/menu.d.ts.map +1 -0
  100. package/lib/ui/menu.js +314 -0
  101. package/lib/ui/menu.js.map +1 -0
  102. package/lib/ui/sixel.d.ts +6 -0
  103. package/lib/ui/sixel.d.ts.map +1 -0
  104. package/lib/ui/sixel.js +9 -0
  105. package/lib/ui/sixel.js.map +1 -0
  106. package/lib/utils/apps.d.ts +29 -0
  107. package/lib/utils/apps.d.ts.map +1 -0
  108. package/lib/utils/apps.js +19 -0
  109. package/lib/utils/apps.js.map +1 -0
  110. package/lib/utils/browser.d.ts +9 -0
  111. package/lib/utils/browser.d.ts.map +1 -0
  112. package/lib/utils/browser.js +39 -0
  113. package/lib/utils/browser.js.map +1 -0
  114. package/lib/utils/bundle.d.ts +153 -0
  115. package/lib/utils/bundle.d.ts.map +1 -0
  116. package/lib/utils/bundle.js +459 -0
  117. package/lib/utils/bundle.js.map +1 -0
  118. package/lib/utils/bundleStore.d.ts +128 -0
  119. package/lib/utils/bundleStore.d.ts.map +1 -0
  120. package/lib/utils/bundleStore.js +250 -0
  121. package/lib/utils/bundleStore.js.map +1 -0
  122. package/lib/utils/context.d.ts +88 -0
  123. package/lib/utils/context.d.ts.map +1 -0
  124. package/lib/utils/context.js +247 -0
  125. package/lib/utils/context.js.map +1 -0
  126. package/lib/utils/credentials.d.ts +59 -0
  127. package/lib/utils/credentials.d.ts.map +1 -0
  128. package/lib/utils/credentials.js +147 -0
  129. package/lib/utils/credentials.js.map +1 -0
  130. package/lib/utils/guide.d.ts +63 -0
  131. package/lib/utils/guide.d.ts.map +1 -0
  132. package/lib/utils/guide.js +191 -0
  133. package/lib/utils/guide.js.map +1 -0
  134. package/lib/utils/hash.d.ts +3 -0
  135. package/lib/utils/hash.d.ts.map +1 -0
  136. package/lib/utils/hash.js +44 -0
  137. package/lib/utils/hash.js.map +1 -0
  138. package/lib/utils/native-id.d.ts +17 -0
  139. package/lib/utils/native-id.d.ts.map +1 -0
  140. package/lib/utils/native-id.js +105 -0
  141. package/lib/utils/native-id.js.map +1 -0
  142. package/lib/utils/output.d.ts +96 -0
  143. package/lib/utils/output.d.ts.map +1 -0
  144. package/lib/utils/output.js +135 -0
  145. package/lib/utils/output.js.map +1 -0
  146. package/lib/utils/prompt.d.ts +106 -0
  147. package/lib/utils/prompt.d.ts.map +1 -0
  148. package/lib/utils/prompt.js +457 -0
  149. package/lib/utils/prompt.js.map +1 -0
  150. package/lib/utils/provenance.d.ts +30 -0
  151. package/lib/utils/provenance.d.ts.map +1 -0
  152. package/lib/utils/provenance.js +157 -0
  153. package/lib/utils/provenance.js.map +1 -0
  154. package/lib/utils/resolve.d.ts +81 -0
  155. package/lib/utils/resolve.d.ts.map +1 -0
  156. package/lib/utils/resolve.js +139 -0
  157. package/lib/utils/resolve.js.map +1 -0
  158. package/lib/utils/sdkBin.d.ts +18 -0
  159. package/lib/utils/sdkBin.d.ts.map +1 -0
  160. package/lib/utils/sdkBin.js +76 -0
  161. package/lib/utils/sdkBin.js.map +1 -0
  162. package/lib/utils/signer.d.ts +94 -0
  163. package/lib/utils/signer.d.ts.map +1 -0
  164. package/lib/utils/signer.js +230 -0
  165. package/lib/utils/signer.js.map +1 -0
  166. package/lib/utils/signing.d.ts +102 -0
  167. package/lib/utils/signing.d.ts.map +1 -0
  168. package/lib/utils/signing.js +229 -0
  169. package/lib/utils/signing.js.map +1 -0
  170. package/lib/utils/transportSecurity.d.ts +36 -0
  171. package/lib/utils/transportSecurity.d.ts.map +1 -0
  172. package/lib/utils/transportSecurity.js +74 -0
  173. package/lib/utils/transportSecurity.js.map +1 -0
  174. package/lib/utils/trustAnchor.d.ts +109 -0
  175. package/lib/utils/trustAnchor.d.ts.map +1 -0
  176. package/lib/utils/trustAnchor.js +169 -0
  177. package/lib/utils/trustAnchor.js.map +1 -0
  178. package/lib/utils/ui.d.ts +12 -0
  179. package/lib/utils/ui.d.ts.map +1 -0
  180. package/lib/utils/ui.js +60 -0
  181. package/lib/utils/ui.js.map +1 -0
  182. package/lib/utils/validate.d.ts +62 -0
  183. package/lib/utils/validate.d.ts.map +1 -0
  184. package/lib/utils/validate.js +189 -0
  185. package/lib/utils/validate.js.map +1 -0
  186. package/lib/vendor/ota-protocol/base64.d.ts +11 -0
  187. package/lib/vendor/ota-protocol/base64.d.ts.map +1 -0
  188. package/lib/vendor/ota-protocol/base64.js +39 -0
  189. package/lib/vendor/ota-protocol/base64.js.map +1 -0
  190. package/lib/vendor/ota-protocol/codec.d.ts +26 -0
  191. package/lib/vendor/ota-protocol/codec.d.ts.map +1 -0
  192. package/lib/vendor/ota-protocol/codec.js +349 -0
  193. package/lib/vendor/ota-protocol/codec.js.map +1 -0
  194. package/lib/vendor/ota-protocol/hex.d.ts +8 -0
  195. package/lib/vendor/ota-protocol/hex.d.ts.map +1 -0
  196. package/lib/vendor/ota-protocol/hex.js +31 -0
  197. package/lib/vendor/ota-protocol/hex.js.map +1 -0
  198. package/lib/vendor/ota-protocol/index.d.ts +17 -0
  199. package/lib/vendor/ota-protocol/index.d.ts.map +1 -0
  200. package/lib/vendor/ota-protocol/index.js +41 -0
  201. package/lib/vendor/ota-protocol/index.js.map +1 -0
  202. package/lib/vendor/ota-protocol/limits.d.ts +39 -0
  203. package/lib/vendor/ota-protocol/limits.d.ts.map +1 -0
  204. package/lib/vendor/ota-protocol/limits.js +42 -0
  205. package/lib/vendor/ota-protocol/limits.js.map +1 -0
  206. package/lib/vendor/ota-protocol/types.d.ts +73 -0
  207. package/lib/vendor/ota-protocol/types.d.ts.map +1 -0
  208. package/lib/vendor/ota-protocol/types.js +24 -0
  209. package/lib/vendor/ota-protocol/types.js.map +1 -0
  210. package/package.json +37 -0
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../lib/index.js');
@@ -0,0 +1,52 @@
1
+ import type { Credentials } from '../utils/credentials';
2
+ /**
3
+ * Minimal HTTP client for the Scalebun backend API.
4
+ * Uses PAT-based auth (Authorization: Bearer <token>).
5
+ * No external deps — pure Node stdlib.
6
+ */
7
+ export declare class ApiClient {
8
+ private readonly apiUrl;
9
+ private readonly token;
10
+ constructor(creds: Credentials);
11
+ /** GET request — returns parsed JSON. */
12
+ get<T = unknown>(path: string): Promise<T>;
13
+ /**
14
+ * POST request — sends JSON body, returns parsed JSON.
15
+ *
16
+ * Pass `{ retry: true }` for calls that are safe to repeat after a dropped
17
+ * connection (e.g. presign) so a single network blip does not abort the whole
18
+ * operation. Left off by default: a blind retry of a non-idempotent write
19
+ * could duplicate it.
20
+ */
21
+ post<T = unknown>(path: string, body?: unknown, opts?: {
22
+ retry?: boolean;
23
+ }): Promise<T>;
24
+ /** PATCH request — sends JSON body, returns parsed JSON. */
25
+ patch<T = unknown>(path: string, body?: unknown): Promise<T>;
26
+ /** DELETE request — returns parsed JSON. */
27
+ delete<T = unknown>(path: string): Promise<T>;
28
+ /**
29
+ * Multipart POST to a backend path with extra headers (symbol uploads).
30
+ * Bearer auth is still attached; endpoint-specific headers (e.g. the SDK
31
+ * secret key) ride alongside it.
32
+ */
33
+ postMultipart(path: string, body: Buffer, contentType: string, extraHeaders?: Record<string, string>): Promise<unknown>;
34
+ /** Upload raw bytes via PUT to an arbitrary URL (presigned S3/R2). */
35
+ putBytes(url: string, data: Buffer, contentType: string): Promise<void>;
36
+ /**
37
+ * Perform a request with bounded retries for transient failures.
38
+ *
39
+ * A "socket hang up" (ECONNRESET), a connection timeout, or a 502/503/504 from
40
+ * the gateway means the call never got a real answer — retrying is the correct
41
+ * response, not a duplicate. GETs retry by default; other methods retry only
42
+ * when the caller opts in (`retry: true`), which publish does for presign: it
43
+ * is effectively idempotent (a stray UPLOADING bundle row is superseded on the
44
+ * next attempt), and one network blip should never abort a whole publish.
45
+ */
46
+ private request;
47
+ /** A single request/response round-trip. Rejects with {@link HttpError} on a
48
+ * non-2xx status (carrying the code) and with the raw error on a transport
49
+ * failure, so the retry policy in {@link request} can classify both. */
50
+ private attempt;
51
+ }
52
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AA0ExD;;;;GAIG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAEnB,KAAK,EAAE,WAAW;IAU9B,yCAAyC;IACnC,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAIhD;;;;;;;OAOG;IACG,IAAI,CAAC,CAAC,GAAG,OAAO,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GACzB,OAAO,CAAC,CAAC,CAAC;IAIb,4DAA4D;IACtD,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAIlE,4CAA4C;IACtC,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAInD;;;;OAIG;IACG,aAAa,CACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,YAAY,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACxC,OAAO,CAAC,OAAO,CAAC;IAgDnB,sEAAsE;IAChE,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA+C7E;;;;;;;;;OASG;YACW,OAAO;IA8BrB;;6EAEyE;IACzE,OAAO,CAAC,OAAO;CAgFhB"}
@@ -0,0 +1,335 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ApiClient = void 0;
37
+ const https = __importStar(require("https"));
38
+ const http = __importStar(require("http"));
39
+ const transportSecurity_1 = require("../utils/transportSecurity");
40
+ /**
41
+ * A CLI run makes only a handful of control-plane calls, and often with a long
42
+ * gap between them: Metro bundling and Hermes compilation sit between the
43
+ * warm-up request and the presign request. Node 19+ defaults the global agent
44
+ * to keepAlive:true, so that later request reuses a pooled socket the server
45
+ * (or the Caddy proxy in front of it) has already closed after its idle
46
+ * timeout. The write lands on a half-closed socket and surfaces as an
47
+ * intermittent "socket hang up" (ECONNRESET) — exactly the presign failures.
48
+ *
49
+ * A dedicated agent with keepAlive:false gives every request a fresh
50
+ * connection. At this call volume the extra handshake is irrelevant, and it
51
+ * removes the stale-socket race at the source.
52
+ */
53
+ const httpsAgent = new https.Agent({ keepAlive: false });
54
+ const httpAgent = new http.Agent({ keepAlive: false });
55
+ /** Network error codes worth another attempt — the request never got a reply. */
56
+ const RETRYABLE_CODES = new Set([
57
+ 'ECONNRESET',
58
+ 'ECONNABORTED',
59
+ 'ETIMEDOUT',
60
+ 'EPIPE',
61
+ 'EAI_AGAIN',
62
+ ]);
63
+ /** Transient HTTP statuses (gateway / overload). 4xx and plain 500 are NOT here
64
+ * on purpose — those are deterministic and retrying only hides the real error. */
65
+ const RETRYABLE_STATUS = new Set([429, 502, 503, 504]);
66
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
67
+ /** Carries the HTTP status so the retry policy can tell 4xx from a gateway blip. */
68
+ class HttpError extends Error {
69
+ constructor(message, statusCode) {
70
+ super(message);
71
+ this.statusCode = statusCode;
72
+ this.name = 'HttpError';
73
+ }
74
+ }
75
+ /** A failure is retryable if it never produced a real answer (dropped socket,
76
+ * timeout, DNS blip) or came back as a transient gateway/overload status. */
77
+ function isRetryable(err) {
78
+ if (err instanceof HttpError) {
79
+ return err.statusCode !== undefined && RETRYABLE_STATUS.has(err.statusCode);
80
+ }
81
+ const code = err?.code;
82
+ if (code && RETRYABLE_CODES.has(code))
83
+ return true;
84
+ const msg = err instanceof Error ? err.message : String(err);
85
+ return /socket hang up|ECONNRESET|ECONNABORTED|ETIMEDOUT|EPIPE|timed out/i.test(msg);
86
+ }
87
+ /** Exponential backoff (300ms, 900ms, 2700ms) with ±20% jitter, capped at 5s. */
88
+ function backoffMs(attempt) {
89
+ const base = 300 * Math.pow(3, attempt - 1);
90
+ const jitter = base * 0.2 * (Math.random() * 2 - 1);
91
+ return Math.min(base + jitter, 5000);
92
+ }
93
+ /** Short, human label for the retry notice on stderr. */
94
+ function describeError(err) {
95
+ if (err instanceof HttpError && err.statusCode)
96
+ return `HTTP ${err.statusCode}`;
97
+ const code = err?.code;
98
+ if (code)
99
+ return code;
100
+ return err instanceof Error ? err.message.split('\n')[0] : 'network error';
101
+ }
102
+ /**
103
+ * Minimal HTTP client for the Scalebun backend API.
104
+ * Uses PAT-based auth (Authorization: Bearer <token>).
105
+ * No external deps — pure Node stdlib.
106
+ */
107
+ class ApiClient {
108
+ constructor(creds) {
109
+ // Every request below attaches `Authorization: Bearer <token>`, so the
110
+ // scheme is a security decision, not a formatting one. Refuse a plaintext
111
+ // endpoint here — at construction, before any socket is opened — rather
112
+ // than at each call site, so no future method can quietly skip the check.
113
+ // Loopback is exempt; see transportSecurity.ts.
114
+ this.apiUrl = (0, transportSecurity_1.assertSecureApiUrl)(creds.apiUrl);
115
+ this.token = creds.token;
116
+ }
117
+ /** GET request — returns parsed JSON. */
118
+ async get(path) {
119
+ return this.request('GET', path);
120
+ }
121
+ /**
122
+ * POST request — sends JSON body, returns parsed JSON.
123
+ *
124
+ * Pass `{ retry: true }` for calls that are safe to repeat after a dropped
125
+ * connection (e.g. presign) so a single network blip does not abort the whole
126
+ * operation. Left off by default: a blind retry of a non-idempotent write
127
+ * could duplicate it.
128
+ */
129
+ async post(path, body, opts) {
130
+ return this.request('POST', path, body, opts);
131
+ }
132
+ /** PATCH request — sends JSON body, returns parsed JSON. */
133
+ async patch(path, body) {
134
+ return this.request('PATCH', path, body);
135
+ }
136
+ /** DELETE request — returns parsed JSON. */
137
+ async delete(path) {
138
+ return this.request('DELETE', path);
139
+ }
140
+ /**
141
+ * Multipart POST to a backend path with extra headers (symbol uploads).
142
+ * Bearer auth is still attached; endpoint-specific headers (e.g. the SDK
143
+ * secret key) ride alongside it.
144
+ */
145
+ async postMultipart(path, body, contentType, extraHeaders = {}) {
146
+ return new Promise((resolve, reject) => {
147
+ const parsed = new URL(`${this.apiUrl}${path}`);
148
+ const isHttps = parsed.protocol === 'https:';
149
+ const transport = isHttps ? https : http;
150
+ const req = transport.request({
151
+ hostname: parsed.hostname,
152
+ port: parsed.port || undefined,
153
+ path: parsed.pathname + parsed.search,
154
+ method: 'POST',
155
+ headers: {
156
+ Authorization: `Bearer ${this.token}`,
157
+ Accept: 'application/json',
158
+ 'Content-Type': contentType,
159
+ 'Content-Length': body.length,
160
+ ...extraHeaders,
161
+ },
162
+ agent: isHttps ? httpsAgent : httpAgent,
163
+ timeout: 120000,
164
+ }, (res) => {
165
+ const chunks = [];
166
+ res.on('data', (c) => chunks.push(c));
167
+ res.on('end', () => {
168
+ const raw = Buffer.concat(chunks).toString('utf-8');
169
+ if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
170
+ try {
171
+ resolve(JSON.parse(raw));
172
+ }
173
+ catch {
174
+ resolve(raw);
175
+ }
176
+ }
177
+ else {
178
+ reject(new Error(`API error (HTTP ${res.statusCode}): ${raw.slice(0, 300)}`));
179
+ }
180
+ });
181
+ });
182
+ req.on('error', reject);
183
+ req.on('timeout', () => {
184
+ req.destroy();
185
+ reject(new Error('Multipart upload timed out'));
186
+ });
187
+ req.write(body);
188
+ req.end();
189
+ });
190
+ }
191
+ /** Upload raw bytes via PUT to an arbitrary URL (presigned S3/R2). */
192
+ async putBytes(url, data, contentType) {
193
+ return new Promise((resolve, reject) => {
194
+ const parsed = new URL(url);
195
+ const isHttps = parsed.protocol === 'https:';
196
+ const transport = isHttps ? https : http;
197
+ const req = transport.request({
198
+ hostname: parsed.hostname,
199
+ port: parsed.port || undefined,
200
+ path: parsed.pathname + parsed.search,
201
+ method: 'PUT',
202
+ headers: {
203
+ 'Content-Type': contentType,
204
+ 'Content-Length': data.length,
205
+ },
206
+ agent: isHttps ? httpsAgent : httpAgent,
207
+ timeout: 600000, // 10 minutes
208
+ }, (res) => {
209
+ const chunks = [];
210
+ res.on('data', (c) => chunks.push(c));
211
+ res.on('end', () => {
212
+ if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
213
+ resolve();
214
+ }
215
+ else {
216
+ const body = Buffer.concat(chunks).toString('utf-8');
217
+ reject(new Error(`Upload failed (HTTP ${res.statusCode}): ${body.slice(0, 500)}`));
218
+ }
219
+ });
220
+ });
221
+ req.on('error', reject);
222
+ req.on('timeout', () => {
223
+ req.destroy();
224
+ reject(new Error('Upload timed out after 10 minutes'));
225
+ });
226
+ req.write(data);
227
+ req.end();
228
+ });
229
+ }
230
+ /**
231
+ * Perform a request with bounded retries for transient failures.
232
+ *
233
+ * A "socket hang up" (ECONNRESET), a connection timeout, or a 502/503/504 from
234
+ * the gateway means the call never got a real answer — retrying is the correct
235
+ * response, not a duplicate. GETs retry by default; other methods retry only
236
+ * when the caller opts in (`retry: true`), which publish does for presign: it
237
+ * is effectively idempotent (a stray UPLOADING bundle row is superseded on the
238
+ * next attempt), and one network blip should never abort a whole publish.
239
+ */
240
+ async request(method, path, body, opts) {
241
+ const retry = opts?.retry ?? method === 'GET';
242
+ const maxAttempts = retry ? 4 : 1;
243
+ let lastErr;
244
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
245
+ try {
246
+ return await this.attempt(method, path, body);
247
+ }
248
+ catch (err) {
249
+ lastErr = err;
250
+ if (attempt < maxAttempts && isRetryable(err)) {
251
+ const delay = backoffMs(attempt);
252
+ process.stderr.write(` ↻ ${method} ${path} — ${describeError(err)}; ` +
253
+ `retrying in ${Math.round(delay)}ms (attempt ${attempt + 1}/${maxAttempts})\n`);
254
+ await sleep(delay);
255
+ continue;
256
+ }
257
+ throw err;
258
+ }
259
+ }
260
+ // Unreachable: the loop either returns a value or throws on the last attempt.
261
+ throw lastErr;
262
+ }
263
+ /** A single request/response round-trip. Rejects with {@link HttpError} on a
264
+ * non-2xx status (carrying the code) and with the raw error on a transport
265
+ * failure, so the retry policy in {@link request} can classify both. */
266
+ attempt(method, path, body) {
267
+ return new Promise((resolve, reject) => {
268
+ const fullUrl = `${this.apiUrl}${path}`;
269
+ const parsed = new URL(fullUrl);
270
+ const isHttps = parsed.protocol === 'https:';
271
+ const transport = isHttps ? https : http;
272
+ const headers = {
273
+ Authorization: `Bearer ${this.token}`,
274
+ Accept: 'application/json',
275
+ };
276
+ let payload;
277
+ if (body !== undefined) {
278
+ payload = JSON.stringify(body);
279
+ headers['Content-Type'] = 'application/json';
280
+ headers['Content-Length'] = String(Buffer.byteLength(payload));
281
+ }
282
+ const req = transport.request({
283
+ hostname: parsed.hostname,
284
+ port: parsed.port || undefined,
285
+ path: parsed.pathname + parsed.search,
286
+ method,
287
+ headers,
288
+ agent: isHttps ? httpsAgent : httpAgent,
289
+ timeout: 30000,
290
+ }, (res) => {
291
+ const chunks = [];
292
+ res.on('data', (c) => chunks.push(c));
293
+ res.on('end', () => {
294
+ const raw = Buffer.concat(chunks).toString('utf-8');
295
+ const status = res.statusCode ?? 0;
296
+ if (status >= 200 && status < 300) {
297
+ try {
298
+ resolve(JSON.parse(raw));
299
+ }
300
+ catch {
301
+ resolve(raw);
302
+ }
303
+ }
304
+ else if (status === 401) {
305
+ // The most common cause by far is an expired credential — the old
306
+ // login flow stored 15-minute session JWTs, and CI secrets rot.
307
+ // A bare "Unauthorized" cost real debugging time during the first
308
+ // device run; the fix is one command, so name it.
309
+ reject(new HttpError(`API error (HTTP 401): ${raw.slice(0, 200)}\n` +
310
+ ` Your credential is invalid or has expired.\n` +
311
+ ` → Locally: run \`scalebun login\`\n` +
312
+ ` → In CI: refresh the SCALEBUN_TOKEN secret (create one in the dashboard under Settings → Access Tokens)`, 401));
313
+ }
314
+ else {
315
+ reject(new HttpError(`API error (HTTP ${status}): ${raw.slice(0, 500)}`, status));
316
+ }
317
+ });
318
+ });
319
+ req.on('error', reject);
320
+ req.on('timeout', () => {
321
+ req.destroy();
322
+ // Tag the timeout so isRetryable() treats it like the dropped-socket
323
+ // case rather than an opaque Error.
324
+ const e = new Error('Request timed out');
325
+ e.code = 'ETIMEDOUT';
326
+ reject(e);
327
+ });
328
+ if (payload)
329
+ req.write(payload);
330
+ req.end();
331
+ });
332
+ }
333
+ }
334
+ exports.ApiClient = ApiClient;
335
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,2CAA6B;AAE7B,kEAAgE;AAEhE;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;AACzD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;AAEvD,iFAAiF;AACjF,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,YAAY;IACZ,cAAc;IACd,WAAW;IACX,OAAO;IACP,WAAW;CACZ,CAAC,CAAC;AAEH;mFACmF;AACnF,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,E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AC,CAAC,CAAC;YACL,CAAC,CACF,CAAC;YAEF,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACxB,GAAG,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;gBACrB,GAAG,CAAC,OAAO,EAAE,CAAC;gBACd,qEAAqE;gBACrE,oCAAoC;gBACpC,MAAM,CAAC,GAA0B,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;gBAChE,CAAC,CAAC,IAAI,GAAG,WAAW,CAAC;gBACrB,MAAM,CAAC,CAAC,CAAC,CAAC;YACZ,CAAC,CAAC,CAAC;YACH,IAAI,OAAO;gBAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAChC,GAAG,CAAC,GAAG,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAlRD,8BAkRC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerCiInitCommand(program: Command): void;
3
+ //# sourceMappingURL=ci-init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-init.d.ts","sourceRoot":"","sources":["../../src/commands/ci-init.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuRpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwE5D"}