@alpic-ai/sdk 1.144.0 → 1.145.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.
@@ -14,6 +14,10 @@ export declare class AlpicAuth {
14
14
  isAuthenticated(): Promise<boolean>;
15
15
  getToken(): Promise<string | undefined>;
16
16
  getUserAccessToken(): Promise<string | undefined>;
17
+ getUserInfo(): Promise<{
18
+ email: string | undefined;
19
+ name: string | undefined;
20
+ } | null>;
17
21
  login(opts?: LoginOptions): Promise<{
18
22
  sub: string;
19
23
  }>;
@@ -22,6 +22,17 @@ export class AlpicAuth {
22
22
  async getUserAccessToken() {
23
23
  return (await getOAuthClient().getValidAccessToken())?.access_token;
24
24
  }
25
+ async getUserInfo() {
26
+ const credentials = await getOAuthClient().getValidAccessToken();
27
+ if (!credentials) {
28
+ return null;
29
+ }
30
+ const userInfo = await getOAuthClient().fetchUserInfo(credentials);
31
+ if (!userInfo) {
32
+ return null;
33
+ }
34
+ return { email: userInfo.email, name: userInfo.name };
35
+ }
25
36
  async login(opts) {
26
37
  const result = await oauthLogin(opts);
27
38
  this.events.emit("authenticated", { sub: result.sub });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAqB,UAAU,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAoB,WAAW,EAAE,MAAM,YAAY,CAAC;AAQ3D,MAAM,OAAO,SAAS;IACH,MAAM,GAAG,IAAI,iBAAiB,EAAc,CAAC;IAE9D,EAAE,CAA6B,KAAQ,EAAE,QAA0C;QACjF,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED,GAAG,CAA6B,KAAQ,EAAE,Q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AI,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACvD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,MAAM;QACV,WAAW,CAAC,gBAAgB,EAAE,CAAC;IACjC,CAAC;CACF"}
package/dist/client.d.ts CHANGED
@@ -1,9 +1,13 @@
1
1
  import { type AlpicApi } from "./api/client.js";
2
2
  import { AlpicAuth } from "./auth/index.js";
3
+ import { Deployments } from "./deploy/deployments.js";
3
4
  import { Tunnel } from "./tunnel/tunnel.js";
5
+ import { type WhoamiInfo } from "./whoami.js";
4
6
  export declare class Alpic {
5
7
  readonly auth: AlpicAuth;
6
8
  readonly api: AlpicApi;
7
9
  readonly tunnel: Tunnel;
10
+ readonly deployments: Deployments;
8
11
  constructor();
12
+ whoami(): Promise<WhoamiInfo>;
9
13
  }
package/dist/client.js CHANGED
@@ -1,11 +1,14 @@
1
1
  import { createApiClient } from "./api/client.js";
2
2
  import { AlpicAuth } from "./auth/index.js";
3
+ import { Deployments } from "./deploy/deployments.js";
3
4
  import { env } from "./env.js";
4
5
  import { Tunnel } from "./tunnel/tunnel.js";
6
+ import { whoami } from "./whoami.js";
5
7
  export class Alpic {
6
8
  auth;
7
9
  api;
8
10
  tunnel;
11
+ deployments;
9
12
  constructor() {
10
13
  this.auth = new AlpicAuth();
11
14
  this.api = createApiClient({
@@ -13,6 +16,10 @@ export class Alpic {
13
16
  auth: this.auth,
14
17
  });
15
18
  this.tunnel = new Tunnel({ api: this.api });
19
+ this.deployments = new Deployments({ api: this.api });
20
+ }
21
+ whoami() {
22
+ return whoami(this.auth, this.api);
16
23
  }
17
24
  }
18
25
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,E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,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAC5C,IAAI,CAAC,WAAW,GAAG,IAAI,WAAW,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,MAAM;QACJ,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ export declare function ensureGitAvailable(): void;
2
+ export declare function getGitFiles(): string[];
3
+ export declare function getFilesToPack(): string[];
4
+ export declare function createTarArchive(files: string[]): Promise<{
5
+ tmpDir: string;
6
+ archivePath: string;
7
+ }>;
@@ -0,0 +1,54 @@
1
+ import { execSync } from "node:child_process";
2
+ import { existsSync, mkdtempSync, rmSync } from "node:fs";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ import { create as tarCreate } from "tar";
6
+ const GIT_FILES_MAX_BUFFER = 10 * 1024 * 1024;
7
+ function isGitRepository() {
8
+ return existsSync(join(process.cwd(), ".git"));
9
+ }
10
+ export function ensureGitAvailable() {
11
+ try {
12
+ execSync("git --version", { stdio: "ignore" });
13
+ }
14
+ catch {
15
+ throw new Error("Git is required to deploy. Please install git and ensure it is available in your PATH.");
16
+ }
17
+ }
18
+ export function getGitFiles() {
19
+ const output = execSync("git ls-files -z --cached --others --exclude-standard -- .", {
20
+ encoding: "utf8",
21
+ maxBuffer: GIT_FILES_MAX_BUFFER,
22
+ });
23
+ const files = output.split("\0").filter(Boolean);
24
+ if (files.length === 0) {
25
+ throw new Error("No tracked or untracked files found. Ensure you are in a git repository with files to deploy.");
26
+ }
27
+ return files;
28
+ }
29
+ export function getFilesToPack() {
30
+ if (isGitRepository()) {
31
+ return getGitFiles();
32
+ }
33
+ ensureGitAvailable();
34
+ execSync("git init", { stdio: "ignore" });
35
+ try {
36
+ return getGitFiles();
37
+ }
38
+ finally {
39
+ rmSync(join(process.cwd(), ".git"), { recursive: true, force: true });
40
+ }
41
+ }
42
+ export async function createTarArchive(files) {
43
+ const tmpDir = mkdtempSync(join(tmpdir(), "alpic-deploy-"));
44
+ const archivePath = join(tmpDir, "source.tar.gz");
45
+ try {
46
+ await tarCreate({ gzip: true, file: archivePath }, files);
47
+ }
48
+ catch (error) {
49
+ rmSync(tmpDir, { recursive: true, force: true });
50
+ throw error;
51
+ }
52
+ return { tmpDir, archivePath };
53
+ }
54
+ //# sourceMappingURL=archive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archive.js","sourceRoot":"","sources":["../../src/deploy/archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,KAAK,CAAC;AAE1C,MAAM,oBAAoB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C,SAAS,eAAe;IACtB,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,IAAI,CAAC;QACH,QAAQ,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,wFAAwF,CAAC,CAAC;IAC5G,CAAC;AACH,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,MAAM,MAAM,GAAG,QAAQ,CAAC,2DAA2D,EAAE;QACnF,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE,oBAAoB;KAChC,CAAC,CAAC;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AACjC,CAAC"}
@@ -0,0 +1,43 @@
1
+ import type { RouterOutput } from "@alpic-ai/api";
2
+ import type { AlpicApi } from "../api/client.js";
3
+ export type Deployment = RouterOutput["deployments"]["get"]["v1"];
4
+ export type DeploymentStatus = Deployment["status"];
5
+ export type DeployOptions = {
6
+ environmentId: string;
7
+ teamId: string;
8
+ onProgress?: (event: DeployEvent) => void;
9
+ };
10
+ export type DeployResult = {
11
+ deploymentId: string;
12
+ status: DeploymentStatus;
13
+ mcpServerUrl: string;
14
+ domains: string[];
15
+ deploymentPageUrl: string | null;
16
+ elapsedMs: number;
17
+ };
18
+ export type DeployEvent = {
19
+ type: "collecting";
20
+ } | {
21
+ type: "collected";
22
+ fileCount: number;
23
+ } | {
24
+ type: "uploading";
25
+ } | {
26
+ type: "triggering";
27
+ } | {
28
+ type: "deploying";
29
+ status: DeploymentStatus;
30
+ elapsedMs: number;
31
+ deploymentPageUrl: string | null;
32
+ };
33
+ export type DeploymentsDeps = {
34
+ api: AlpicApi;
35
+ };
36
+ export declare class Deployments {
37
+ private readonly api;
38
+ constructor(deps: DeploymentsDeps);
39
+ getLatestForEnvironment(environmentId: string): Promise<Deployment>;
40
+ watch(deploymentId: string): Promise<Deployment>;
41
+ private pollUntilFinal;
42
+ deploy({ environmentId, teamId, onProgress }: DeployOptions): Promise<DeployResult>;
43
+ }
@@ -0,0 +1,89 @@
1
+ import { readFileSync, rmSync } from "node:fs";
2
+ import { createTarArchive, getFilesToPack } from "./archive.js";
3
+ import { pollIntervalMs, sleep } from "./poll.js";
4
+ import { uploadToPresignedUrl } from "./upload.js";
5
+ const FINAL_STATUSES = new Set(["deployed", "failed", "canceled"]);
6
+ const TIMEOUT_MS = 15 * 60 * 1000;
7
+ const DEPLOY_POLL_MS = 10_000;
8
+ const WATCH_POLL_MS = 3_000;
9
+ export class Deployments {
10
+ api;
11
+ constructor(deps) {
12
+ this.api = deps.api;
13
+ }
14
+ async getLatestForEnvironment(environmentId) {
15
+ const environment = await this.api.environments.get.v1({ environmentId });
16
+ const deployments = await this.api.deployments.list.v1({
17
+ projectId: environment.projectId,
18
+ environmentId,
19
+ });
20
+ const latest = deployments[0];
21
+ if (!latest) {
22
+ throw new Error(`No deployments found for environment ${environmentId}.`);
23
+ }
24
+ return latest;
25
+ }
26
+ watch(deploymentId) {
27
+ return this.pollUntilFinal(deploymentId, WATCH_POLL_MS);
28
+ }
29
+ async pollUntilFinal(deploymentId, intervalMs) {
30
+ const startedAt = Date.now();
31
+ let current = await this.api.deployments.get.v1({ deploymentId });
32
+ while (!FINAL_STATUSES.has(current.status)) {
33
+ if (Date.now() - startedAt >= TIMEOUT_MS) {
34
+ throw new Error("Deployment did not reach a final state within 15 minutes.");
35
+ }
36
+ await sleep(pollIntervalMs(intervalMs));
37
+ current = await this.api.deployments.get.v1({ deploymentId });
38
+ }
39
+ return current;
40
+ }
41
+ async deploy({ environmentId, teamId, onProgress }) {
42
+ const emit = onProgress ?? (() => { });
43
+ let tmpDir;
44
+ const startedAt = Date.now();
45
+ try {
46
+ emit({ type: "collecting" });
47
+ const files = getFilesToPack();
48
+ emit({ type: "collected", fileCount: files.length });
49
+ const archive = await createTarArchive(files);
50
+ tmpDir = archive.tmpDir;
51
+ const { uploadUrl, token } = await this.api.deployments.uploadArtifact.v1({ teamId });
52
+ emit({ type: "uploading" });
53
+ await uploadToPresignedUrl(uploadUrl, readFileSync(archive.archivePath));
54
+ emit({ type: "triggering" });
55
+ const initial = await this.api.environments.deploy.v1({ environmentId, token });
56
+ let deployment = initial;
57
+ const deploymentPageUrl = deployment.deploymentPageUrl ?? null;
58
+ const emitDeploying = () => emit({ type: "deploying", status: deployment.status, elapsedMs: Date.now() - startedAt, deploymentPageUrl });
59
+ emitDeploying();
60
+ while (deployment.status === "ongoing") {
61
+ if (Date.now() - startedAt >= TIMEOUT_MS) {
62
+ throw new Error(deploymentPageUrl
63
+ ? `Deployment aborted after 15 minutes. View status: ${deploymentPageUrl}`
64
+ : "Deployment aborted after 15 minutes.");
65
+ }
66
+ deployment = await this.api.deployments.get.v1({ deploymentId: deployment.id });
67
+ emitDeploying();
68
+ if (deployment.status === "ongoing") {
69
+ await sleep(pollIntervalMs(DEPLOY_POLL_MS));
70
+ }
71
+ }
72
+ const environment = await this.api.environments.get.v1({ environmentId });
73
+ return {
74
+ deploymentId: deployment.id,
75
+ status: deployment.status,
76
+ mcpServerUrl: environment.mcpServerUrl,
77
+ domains: environment.domains,
78
+ deploymentPageUrl: deployment.deploymentPageUrl ?? null,
79
+ elapsedMs: Date.now() - startedAt,
80
+ };
81
+ }
82
+ finally {
83
+ if (tmpDir) {
84
+ rmSync(tmpDir, { recursive: true, force: true });
85
+ }
86
+ }
87
+ }
88
+ }
89
+ //# sourceMappingURL=deployments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployments.js","sourceRoot":"","sources":["../../src/deploy/deployments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAKnD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAmB,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AACrF,MAAM,UAAU,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAClC,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,MAAM,aAAa,GAAG,KAAK,CAAC;AA4B5B,MAAM,OAAO,WAAW;IACL,GAAG,CAAW;IAE/B,YAAY,IAAqB;QAC/B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,uBAAuB,CAAC,aAAqB;QACjD,MAAM,WAAW,GAAG,MAAM,IAAI,CA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,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export declare function pollIntervalMs(defaultMs: number): number;
2
+ export declare const sleep: (ms: number) => Promise<void>;
@@ -0,0 +1,10 @@
1
+ export function pollIntervalMs(defaultMs) {
2
+ const override = process.env.ALPIC_POLL_INTERVAL_MS;
3
+ if (override !== undefined) {
4
+ const parsed = Number.parseInt(override, 10);
5
+ return Number.isNaN(parsed) ? defaultMs : parsed;
6
+ }
7
+ return defaultMs;
8
+ }
9
+ export const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
10
+ //# sourceMappingURL=poll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poll.js","sourceRoot":"","sources":["../../src/deploy/poll.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;IACpD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC7C,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;IACnD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function uploadToPresignedUrl(uploadUrl: string, buffer: Buffer): Promise<void>;
@@ -0,0 +1,13 @@
1
+ export async function uploadToPresignedUrl(uploadUrl, buffer) {
2
+ const res = await fetch(uploadUrl, {
3
+ method: "PUT",
4
+ headers: {
5
+ "Content-Type": "application/gzip",
6
+ },
7
+ body: new Uint8Array(buffer),
8
+ });
9
+ if (!res.ok) {
10
+ throw new Error(`Upload failed: ${res.status} ${res.statusText}`);
11
+ }
12
+ }
13
+ //# sourceMappingURL=upload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../src/deploy/upload.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,SAAiB,EAAE,MAAc;IAC1E,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,SAAS,EAAE;QACjC,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,UAAU,CAAC,MAAM,CAAC;KAC7B,CAAC,CAAC;IACH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,kBAAkB,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;IACpE,CAAC;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -4,4 +4,6 @@ export { AlpicAuth } from "./auth/index.js";
4
4
  export { getOAuthClient } from "./auth/oauth-client.js";
5
5
  export { GlobalStore, globalStore } from "./auth/store.js";
6
6
  export { Alpic } from "./client.js";
7
+ export type { DeployEvent, Deployment, DeploymentStatus, DeployOptions, DeployResult } from "./deploy/deployments.js";
7
8
  export type { OpenTunnelOptions, TunnelCloseInfo, TunnelHandle, TunnelRequest } from "./tunnel/tunnel.js";
9
+ export type { Team, WhoamiInfo } from "./whoami.js";
@@ -9978,9 +9978,20 @@ var require_es_set_tostringtag = __commonJS({
9978
9978
  }
9979
9979
  });
9980
9980
 
9981
- // ../../node_modules/.pnpm/form-data@4.0.5/node_modules/form-data/lib/populate.js
9981
+ // ../../node_modules/.pnpm/hasown@2.0.4/node_modules/hasown/index.js
9982
+ var require_hasown2 = __commonJS({
9983
+ "../../node_modules/.pnpm/hasown@2.0.4/node_modules/hasown/index.js"(exports, module) {
9984
+ "use strict";
9985
+ var call = Function.prototype.call;
9986
+ var $hasOwn = Object.prototype.hasOwnProperty;
9987
+ var bind2 = require_function_bind();
9988
+ module.exports = bind2.call(call, $hasOwn);
9989
+ }
9990
+ });
9991
+
9992
+ // ../../node_modules/.pnpm/form-data@4.0.6/node_modules/form-data/lib/populate.js
9982
9993
  var require_populate = __commonJS({
9983
- "../../node_modules/.pnpm/form-data@4.0.5/node_modules/form-data/lib/populate.js"(exports, module) {
9994
+ "../../node_modules/.pnpm/form-data@4.0.6/node_modules/form-data/lib/populate.js"(exports, module) {
9984
9995
  "use strict";
9985
9996
  module.exports = function(dst, src) {
9986
9997
  Object.keys(src).forEach(function(prop) {
@@ -9991,9 +10002,9 @@ var require_populate = __commonJS({
9991
10002
  }
9992
10003
  });
9993
10004
 
9994
- // ../../node_modules/.pnpm/form-data@4.0.5/node_modules/form-data/lib/form_data.js
10005
+ // ../../node_modules/.pnpm/form-data@4.0.6/node_modules/form-data/lib/form_data.js
9995
10006
  var require_form_data = __commonJS({
9996
- "../../node_modules/.pnpm/form-data@4.0.5/node_modules/form-data/lib/form_data.js"(exports, module) {
10007
+ "../../node_modules/.pnpm/form-data@4.0.6/node_modules/form-data/lib/form_data.js"(exports, module) {
9997
10008
  "use strict";
9998
10009
  var CombinedStream = require_combined_stream();
9999
10010
  var util3 = __require("util");
@@ -10007,8 +10018,11 @@ var require_form_data = __commonJS({
10007
10018
  var mime = require_mime_types();
10008
10019
  var asynckit = require_asynckit();
10009
10020
  var setToStringTag = require_es_set_tostringtag();
10010
- var hasOwn = require_hasown();
10021
+ var hasOwn = require_hasown2();
10011
10022
  var populate = require_populate();
10023
+ function escapeHeaderParam(str) {
10024
+ return String(str).replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/"/g, "%22");
10025
+ }
10012
10026
  function FormData3(options) {
10013
10027
  if (!(this instanceof FormData3)) {
10014
10028
  return new FormData3(options);
@@ -10098,7 +10112,7 @@ var require_form_data = __commonJS({
10098
10112
  var contents = "";
10099
10113
  var headers = {
10100
10114
  // add custom disposition as third element or keep it two elements if not
10101
- "Content-Disposition": ["form-data", 'name="' + field + '"'].concat(contentDisposition || []),
10115
+ "Content-Disposition": ["form-data", 'name="' + escapeHeaderParam(field) + '"'].concat(contentDisposition || []),
10102
10116
  // if no content type. allow it to be empty array
10103
10117
  "Content-Type": [].concat(contentType || [])
10104
10118
  };
@@ -10132,7 +10146,7 @@ var require_form_data = __commonJS({
10132
10146
  filename = path.basename(value.client._httpMessage.path || "");
10133
10147
  }
10134
10148
  if (filename) {
10135
- return 'filename="' + filename + '"';
10149
+ return 'filename="' + escapeHeaderParam(filename) + '"';
10136
10150
  }
10137
10151
  };
10138
10152
  FormData3.prototype._getContentType = function(value, options) {
@@ -10426,9 +10440,9 @@ var require_ms = __commonJS({
10426
10440
  }
10427
10441
  });
10428
10442
 
10429
- // ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js
10443
+ // ../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js
10430
10444
  var require_common = __commonJS({
10431
- "../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js"(exports, module) {
10445
+ "../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js"(exports, module) {
10432
10446
  function setup(env) {
10433
10447
  createDebug.debug = createDebug;
10434
10448
  createDebug.default = createDebug;
@@ -10603,9 +10617,9 @@ var require_common = __commonJS({
10603
10617
  }
10604
10618
  });
10605
10619
 
10606
- // ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js
10620
+ // ../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js
10607
10621
  var require_browser = __commonJS({
10608
- "../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js"(exports, module) {
10622
+ "../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js"(exports, module) {
10609
10623
  exports.formatArgs = formatArgs;
10610
10624
  exports.save = save;
10611
10625
  exports.load = load;
@@ -10900,9 +10914,9 @@ var require_supports_color = __commonJS({
10900
10914
  }
10901
10915
  });
10902
10916
 
10903
- // ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/node.js
10917
+ // ../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js
10904
10918
  var require_node = __commonJS({
10905
- "../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/node.js"(exports, module) {
10919
+ "../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js"(exports, module) {
10906
10920
  var tty = __require("tty");
10907
10921
  var util3 = __require("util");
10908
10922
  exports.init = init;
@@ -11074,9 +11088,9 @@ var require_node = __commonJS({
11074
11088
  }
11075
11089
  });
11076
11090
 
11077
- // ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js
11091
+ // ../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js
11078
11092
  var require_src = __commonJS({
11079
- "../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js"(exports, module) {
11093
+ "../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js"(exports, module) {
11080
11094
  if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
11081
11095
  module.exports = require_browser();
11082
11096
  } else {
@@ -11085,9 +11099,9 @@ var require_src = __commonJS({
11085
11099
  }
11086
11100
  });
11087
11101
 
11088
- // ../../node_modules/.pnpm/agent-base@6.0.2/node_modules/agent-base/dist/src/promisify.js
11102
+ // ../../node_modules/.pnpm/agent-base@6.0.2_supports-color@8.1.1/node_modules/agent-base/dist/src/promisify.js
11089
11103
  var require_promisify = __commonJS({
11090
- "../../node_modules/.pnpm/agent-base@6.0.2/node_modules/agent-base/dist/src/promisify.js"(exports) {
11104
+ "../../node_modules/.pnpm/agent-base@6.0.2_supports-color@8.1.1/node_modules/agent-base/dist/src/promisify.js"(exports) {
11091
11105
  "use strict";
11092
11106
  Object.defineProperty(exports, "__esModule", { value: true });
11093
11107
  function promisify(fn) {
@@ -11107,9 +11121,9 @@ var require_promisify = __commonJS({
11107
11121
  }
11108
11122
  });
11109
11123
 
11110
- // ../../node_modules/.pnpm/agent-base@6.0.2/node_modules/agent-base/dist/src/index.js
11124
+ // ../../node_modules/.pnpm/agent-base@6.0.2_supports-color@8.1.1/node_modules/agent-base/dist/src/index.js
11111
11125
  var require_src2 = __commonJS({
11112
- "../../node_modules/.pnpm/agent-base@6.0.2/node_modules/agent-base/dist/src/index.js"(exports, module) {
11126
+ "../../node_modules/.pnpm/agent-base@6.0.2_supports-color@8.1.1/node_modules/agent-base/dist/src/index.js"(exports, module) {
11113
11127
  "use strict";
11114
11128
  var __importDefault = exports && exports.__importDefault || function(mod) {
11115
11129
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -11290,9 +11304,9 @@ var require_src2 = __commonJS({
11290
11304
  }
11291
11305
  });
11292
11306
 
11293
- // ../../node_modules/.pnpm/https-proxy-agent@5.0.1/node_modules/https-proxy-agent/dist/parse-proxy-response.js
11307
+ // ../../node_modules/.pnpm/https-proxy-agent@5.0.1_supports-color@8.1.1/node_modules/https-proxy-agent/dist/parse-proxy-response.js
11294
11308
  var require_parse_proxy_response = __commonJS({
11295
- "../../node_modules/.pnpm/https-proxy-agent@5.0.1/node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports) {
11309
+ "../../node_modules/.pnpm/https-proxy-agent@5.0.1_supports-color@8.1.1/node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports) {
11296
11310
  "use strict";
11297
11311
  var __importDefault = exports && exports.__importDefault || function(mod) {
11298
11312
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -11356,9 +11370,9 @@ var require_parse_proxy_response = __commonJS({
11356
11370
  }
11357
11371
  });
11358
11372
 
11359
- // ../../node_modules/.pnpm/https-proxy-agent@5.0.1/node_modules/https-proxy-agent/dist/agent.js
11373
+ // ../../node_modules/.pnpm/https-proxy-agent@5.0.1_supports-color@8.1.1/node_modules/https-proxy-agent/dist/agent.js
11360
11374
  var require_agent = __commonJS({
11361
- "../../node_modules/.pnpm/https-proxy-agent@5.0.1/node_modules/https-proxy-agent/dist/agent.js"(exports) {
11375
+ "../../node_modules/.pnpm/https-proxy-agent@5.0.1_supports-color@8.1.1/node_modules/https-proxy-agent/dist/agent.js"(exports) {
11362
11376
  "use strict";
11363
11377
  var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
11364
11378
  function adopt(value) {
@@ -11516,9 +11530,9 @@ var require_agent = __commonJS({
11516
11530
  }
11517
11531
  });
11518
11532
 
11519
- // ../../node_modules/.pnpm/https-proxy-agent@5.0.1/node_modules/https-proxy-agent/dist/index.js
11533
+ // ../../node_modules/.pnpm/https-proxy-agent@5.0.1_supports-color@8.1.1/node_modules/https-proxy-agent/dist/index.js
11520
11534
  var require_dist = __commonJS({
11521
- "../../node_modules/.pnpm/https-proxy-agent@5.0.1/node_modules/https-proxy-agent/dist/index.js"(exports, module) {
11535
+ "../../node_modules/.pnpm/https-proxy-agent@5.0.1_supports-color@8.1.1/node_modules/https-proxy-agent/dist/index.js"(exports, module) {
11522
11536
  "use strict";
11523
11537
  var __importDefault = exports && exports.__importDefault || function(mod) {
11524
11538
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -16571,18 +16585,18 @@ var {
16571
16585
  create
16572
16586
  } = axios_default;
16573
16587
 
16574
- // ../../node_modules/.pnpm/pipenet@1.4.0_patch_hash=24bd89f8b5bea6a63243b7a7d4ad888dcf7049e36eac19b10006403b29758c35/node_modules/pipenet/dist/Tunnel.js
16588
+ // ../../node_modules/.pnpm/pipenet@1.4.2_patch_hash=4a969c2edb33b7885d9a25490aa8b87f86e8fd86455a95c8e3c8aa4bdac720b9/node_modules/pipenet/dist/Tunnel.js
16575
16589
  var import_debug2 = __toESM(require_src(), 1);
16576
16590
  import { EventEmitter as EventEmitter3 } from "events";
16577
16591
 
16578
- // ../../node_modules/.pnpm/pipenet@1.4.0_patch_hash=24bd89f8b5bea6a63243b7a7d4ad888dcf7049e36eac19b10006403b29758c35/node_modules/pipenet/dist/TunnelCluster.js
16592
+ // ../../node_modules/.pnpm/pipenet@1.4.2_patch_hash=4a969c2edb33b7885d9a25490aa8b87f86e8fd86455a95c8e3c8aa4bdac720b9/node_modules/pipenet/dist/TunnelCluster.js
16579
16593
  var import_debug = __toESM(require_src(), 1);
16580
16594
  import { EventEmitter as EventEmitter2 } from "events";
16581
16595
  import fs from "fs";
16582
16596
  import net from "net";
16583
16597
  import tls from "tls";
16584
16598
 
16585
- // ../../node_modules/.pnpm/pipenet@1.4.0_patch_hash=24bd89f8b5bea6a63243b7a7d4ad888dcf7049e36eac19b10006403b29758c35/node_modules/pipenet/dist/HeaderHostTransformer.js
16599
+ // ../../node_modules/.pnpm/pipenet@1.4.2_patch_hash=4a969c2edb33b7885d9a25490aa8b87f86e8fd86455a95c8e3c8aa4bdac720b9/node_modules/pipenet/dist/HeaderHostTransformer.js
16586
16600
  import { Transform } from "stream";
16587
16601
  var HeaderHostTransformer = class extends Transform {
16588
16602
  host;
@@ -16600,7 +16614,7 @@ var HeaderHostTransformer = class extends Transform {
16600
16614
  }
16601
16615
  };
16602
16616
 
16603
- // ../../node_modules/.pnpm/pipenet@1.4.0_patch_hash=24bd89f8b5bea6a63243b7a7d4ad888dcf7049e36eac19b10006403b29758c35/node_modules/pipenet/dist/TunnelCluster.js
16617
+ // ../../node_modules/.pnpm/pipenet@1.4.2_patch_hash=4a969c2edb33b7885d9a25490aa8b87f86e8fd86455a95c8e3c8aa4bdac720b9/node_modules/pipenet/dist/TunnelCluster.js
16604
16618
  var log = (0, import_debug.default)("pipenet:client");
16605
16619
  var TunnelCluster = class extends EventEmitter2 {
16606
16620
  opts;
@@ -16633,18 +16647,10 @@ var TunnelCluster = class extends EventEmitter2 {
16633
16647
  }
16634
16648
  remote.end();
16635
16649
  });
16636
- let deadEmitted = false;
16637
- const emitDead = () => {
16638
- if (deadEmitted) {
16639
- return;
16640
- }
16641
- deadEmitted = true;
16642
- this.emit("dead", remote);
16643
- };
16644
16650
  const connLocal = () => {
16645
16651
  if (remote.destroyed) {
16646
16652
  log("remote destroyed");
16647
- emitDead();
16653
+ this.emit("dead", remote);
16648
16654
  return;
16649
16655
  }
16650
16656
  log("connecting locally to %s://%s:%d", localProtocol, localHost, localPort);
@@ -16660,7 +16666,7 @@ var TunnelCluster = class extends EventEmitter2 {
16660
16666
  const local = opt.localHttps ? tls.connect({ host: localHost, port: localPort, ...getLocalCertOpts() }) : net.connect({ host: localHost, port: localPort });
16661
16667
  const remoteClose = () => {
16662
16668
  log("remote close");
16663
- emitDead();
16669
+ this.emit("dead", remote);
16664
16670
  local.end();
16665
16671
  };
16666
16672
  remote.once("close", remoteClose);
@@ -16708,7 +16714,7 @@ var TunnelCluster = class extends EventEmitter2 {
16708
16714
  }
16709
16715
  };
16710
16716
 
16711
- // ../../node_modules/.pnpm/pipenet@1.4.0_patch_hash=24bd89f8b5bea6a63243b7a7d4ad888dcf7049e36eac19b10006403b29758c35/node_modules/pipenet/dist/Tunnel.js
16717
+ // ../../node_modules/.pnpm/pipenet@1.4.2_patch_hash=4a969c2edb33b7885d9a25490aa8b87f86e8fd86455a95c8e3c8aa4bdac720b9/node_modules/pipenet/dist/Tunnel.js
16712
16718
  var log2 = (0, import_debug2.default)("pipenet:client");
16713
16719
  var Tunnel = class extends EventEmitter3 {
16714
16720
  cachedUrl;
@@ -16856,7 +16862,7 @@ var Tunnel = class extends EventEmitter3 {
16856
16862
  }
16857
16863
  };
16858
16864
 
16859
- // ../../node_modules/.pnpm/pipenet@1.4.0_patch_hash=24bd89f8b5bea6a63243b7a7d4ad888dcf7049e36eac19b10006403b29758c35/node_modules/pipenet/dist/pipenet.js
16865
+ // ../../node_modules/.pnpm/pipenet@1.4.2_patch_hash=4a969c2edb33b7885d9a25490aa8b87f86e8fd86455a95c8e3c8aa4bdac720b9/node_modules/pipenet/dist/pipenet.js
16860
16866
  function pipenet(arg1, arg2, arg3) {
16861
16867
  const options = typeof arg1 === "object" ? arg1 : { ...arg2, port: arg1 };
16862
16868
  const callback = typeof arg1 === "object" ? arg2 : arg3;