@miosa/sdk 1.2.4 → 1.2.6
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.
- package/README.md +75 -3
- package/dist/index.d.ts +323 -175
- package/dist/index.js +441 -386
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
- package/src/client.ts +0 -293
- package/src/errors.ts +0 -136
- package/src/http.test.ts +0 -374
- package/src/http.ts +0 -390
- package/src/index.ts +0 -564
- package/src/resources/admin.ts +0 -359
- package/src/resources/analytics.ts +0 -60
- package/src/resources/api-keys.ts +0 -135
- package/src/resources/audit-log.ts +0 -64
- package/src/resources/benchmarks.ts +0 -104
- package/src/resources/builder-sessions.ts +0 -75
- package/src/resources/channels.ts +0 -143
- package/src/resources/checkpoints.ts +0 -225
- package/src/resources/command-center.ts +0 -73
- package/src/resources/community.ts +0 -103
- package/src/resources/completions.ts +0 -104
- package/src/resources/computer-auto-stop.ts +0 -43
- package/src/resources/computer-env.ts +0 -76
- package/src/resources/computer-logs.ts +0 -50
- package/src/resources/computer-osa.ts +0 -76
- package/src/resources/computer-ports.ts +0 -91
- package/src/resources/computer-terminal.ts +0 -61
- package/src/resources/computer-volumes.ts +0 -64
- package/src/resources/computer.ts +0 -551
- package/src/resources/computers.ts +0 -75
- package/src/resources/credits.ts +0 -43
- package/src/resources/cron-jobs.ts +0 -191
- package/src/resources/custom_domains.ts +0 -123
- package/src/resources/dashboard.ts +0 -49
- package/src/resources/databases.ts +0 -218
- package/src/resources/deployments.test.ts +0 -194
- package/src/resources/deployments.ts +0 -1060
- package/src/resources/desktop.ts +0 -134
- package/src/resources/docker-deploy.test.ts +0 -102
- package/src/resources/docker-deploy.ts +0 -183
- package/src/resources/egress.test.ts +0 -318
- package/src/resources/egressAudit.ts +0 -245
- package/src/resources/egressNetwork.ts +0 -450
- package/src/resources/egressSecrets.ts +0 -577
- package/src/resources/email.ts +0 -212
- package/src/resources/embeddings.ts +0 -36
- package/src/resources/events.ts +0 -296
- package/src/resources/exec.ts +0 -319
- package/src/resources/external-keys.ts +0 -79
- package/src/resources/files.test.ts +0 -339
- package/src/resources/files.ts +0 -220
- package/src/resources/flat-custom-domains.ts +0 -127
- package/src/resources/functions.ts +0 -178
- package/src/resources/governance.test.ts +0 -355
- package/src/resources/governance.ts +0 -528
- package/src/resources/health-checks.ts +0 -165
- package/src/resources/integrations.ts +0 -183
- package/src/resources/mcp.ts +0 -70
- package/src/resources/models.ts +0 -45
- package/src/resources/network_policy.ts +0 -73
- package/src/resources/open-computers/agents.ts +0 -91
- package/src/resources/open-computers/apps.ts +0 -102
- package/src/resources/open-computers/clusters.ts +0 -88
- package/src/resources/open-computers/desktop.ts +0 -34
- package/src/resources/open-computers/files.ts +0 -97
- package/src/resources/open-computers/hosts.ts +0 -85
- package/src/resources/open-computers/index.ts +0 -98
- package/src/resources/open-computers/jobs.ts +0 -75
- package/src/resources/open-computers/open_computers.test.ts +0 -288
- package/src/resources/open-computers/secrets.ts +0 -115
- package/src/resources/open-computers/terminal.ts +0 -33
- package/src/resources/open-computers/tunnels.ts +0 -87
- package/src/resources/open-computers/types.ts +0 -343
- package/src/resources/open-computers/workspaces.ts +0 -135
- package/src/resources/org-invites.ts +0 -189
- package/src/resources/phase1.test.ts +0 -187
- package/src/resources/project-auth.ts +0 -142
- package/src/resources/project-integrations.ts +0 -133
- package/src/resources/provider-defaults.ts +0 -89
- package/src/resources/quotas.ts +0 -77
- package/src/resources/regions.ts +0 -94
- package/src/resources/sandbox-processes.ts +0 -112
- package/src/resources/sandbox-shares.ts +0 -83
- package/src/resources/sandbox-templates.ts +0 -195
- package/src/resources/sandboxes.live.test.ts +0 -92
- package/src/resources/sandboxes.test.ts +0 -653
- package/src/resources/sandboxes.ts +0 -1433
- package/src/resources/settings.ts +0 -143
- package/src/resources/snapshots-standalone.ts +0 -51
- package/src/resources/storage.ts +0 -221
- package/src/resources/tenant-events.ts +0 -32
- package/src/resources/tenant.ts +0 -148
- package/src/resources/usage.ts +0 -85
- package/src/resources/volumes.ts +0 -117
- package/src/resources/webhooks.ts +0 -224
- package/src/resources/workspace-invites.ts +0 -188
- package/src/resources/workspace-members.test.ts +0 -121
- package/src/resources/workspace-members.ts +0 -143
- package/src/resources/workspaces.ts +0 -285
- package/src/types.ts +0 -463
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { randomUUID } from 'crypto';
|
|
2
2
|
import EventEmitter from 'events';
|
|
3
3
|
|
|
4
4
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
@@ -601,6 +601,70 @@ var Admin = class {
|
|
|
601
601
|
}
|
|
602
602
|
};
|
|
603
603
|
|
|
604
|
+
// src/resources/agent-runs.ts
|
|
605
|
+
function stripUndefined(input) {
|
|
606
|
+
return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0));
|
|
607
|
+
}
|
|
608
|
+
function createBody(params) {
|
|
609
|
+
return stripUndefined({
|
|
610
|
+
target_id: params.target_id ?? params.targetId ?? params.sandbox_id ?? params.sandboxId ?? params.computer_id ?? params.computerId,
|
|
611
|
+
target_kind: params.target_kind ?? params.targetKind,
|
|
612
|
+
provider: params.provider,
|
|
613
|
+
prompt: params.prompt,
|
|
614
|
+
instruction: params.instruction,
|
|
615
|
+
command: params.command,
|
|
616
|
+
model: params.model,
|
|
617
|
+
cwd: params.cwd,
|
|
618
|
+
timeout: params.timeout,
|
|
619
|
+
metadata: params.metadata
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
function listQuery(params) {
|
|
623
|
+
return {
|
|
624
|
+
target_id: params.target_id ?? params.targetId ?? params.sandbox_id ?? params.sandboxId ?? params.computer_id ?? params.computerId,
|
|
625
|
+
limit: params.limit
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
function unwrapRun(response) {
|
|
629
|
+
const run = response.data ?? response.run;
|
|
630
|
+
if (!run) {
|
|
631
|
+
throw new Error("Agent run response was empty.");
|
|
632
|
+
}
|
|
633
|
+
return run;
|
|
634
|
+
}
|
|
635
|
+
function unwrapRuns(response) {
|
|
636
|
+
if (Array.isArray(response)) return response;
|
|
637
|
+
return response.data ?? response.runs ?? [];
|
|
638
|
+
}
|
|
639
|
+
var AgentRuns = class {
|
|
640
|
+
constructor(http) {
|
|
641
|
+
this.http = http;
|
|
642
|
+
}
|
|
643
|
+
http;
|
|
644
|
+
/** Dispatch a prompt to a sandbox/computer and persist the run record. */
|
|
645
|
+
async create(params) {
|
|
646
|
+
const response = await this.http.post("/agent-runs", createBody(params));
|
|
647
|
+
return unwrapRun(response);
|
|
648
|
+
}
|
|
649
|
+
/** Alias for create(), matching the product language. */
|
|
650
|
+
async run(params) {
|
|
651
|
+
return this.create(params);
|
|
652
|
+
}
|
|
653
|
+
/** List recent agent runs for the authenticated tenant. */
|
|
654
|
+
async list(params = {}) {
|
|
655
|
+
const response = await this.http.get(
|
|
656
|
+
"/agent-runs",
|
|
657
|
+
listQuery(params)
|
|
658
|
+
);
|
|
659
|
+
return unwrapRuns(response);
|
|
660
|
+
}
|
|
661
|
+
/** Fetch one persisted agent run. */
|
|
662
|
+
async get(runId) {
|
|
663
|
+
const response = await this.http.get(`/agent-runs/${runId}`);
|
|
664
|
+
return unwrapRun(response);
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
|
|
604
668
|
// src/resources/analytics.ts
|
|
605
669
|
function unwrap(payload) {
|
|
606
670
|
if (payload && typeof payload === "object") {
|
|
@@ -611,7 +675,7 @@ function unwrap(payload) {
|
|
|
611
675
|
}
|
|
612
676
|
return payload;
|
|
613
677
|
}
|
|
614
|
-
function
|
|
678
|
+
function stripUndefined2(input) {
|
|
615
679
|
return Object.fromEntries(
|
|
616
680
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
617
681
|
);
|
|
@@ -623,13 +687,13 @@ var Analytics = class {
|
|
|
623
687
|
http;
|
|
624
688
|
/** Get the platform analytics overview. */
|
|
625
689
|
async overview(filters = {}) {
|
|
626
|
-
const query =
|
|
690
|
+
const query = stripUndefined2(filters);
|
|
627
691
|
const data = await this.http.get("/analytics/overview", query);
|
|
628
692
|
return unwrap(data);
|
|
629
693
|
}
|
|
630
694
|
/** Get a timeseries for a metric over a period. */
|
|
631
695
|
async timeseries(params = {}) {
|
|
632
|
-
const query =
|
|
696
|
+
const query = stripUndefined2(params);
|
|
633
697
|
const data = await this.http.get("/analytics/timeseries", query);
|
|
634
698
|
return unwrap(data);
|
|
635
699
|
}
|
|
@@ -650,7 +714,7 @@ function listItems(payload, candidateKeys = ["data", "keys", "api_keys", "items"
|
|
|
650
714
|
}
|
|
651
715
|
return [];
|
|
652
716
|
}
|
|
653
|
-
function
|
|
717
|
+
function stripUndefined3(input) {
|
|
654
718
|
return Object.fromEntries(
|
|
655
719
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
656
720
|
);
|
|
@@ -664,13 +728,13 @@ var ApiKeys = class {
|
|
|
664
728
|
}
|
|
665
729
|
http;
|
|
666
730
|
async list(params = {}) {
|
|
667
|
-
const query =
|
|
731
|
+
const query = stripUndefined3({ ...params });
|
|
668
732
|
const data = await this.http.get("/api-keys", query);
|
|
669
733
|
return listItems(data);
|
|
670
734
|
}
|
|
671
735
|
async create(params) {
|
|
672
736
|
const { idempotencyKey: ikey, expiresAt, ...rest } = params;
|
|
673
|
-
const body =
|
|
737
|
+
const body = stripUndefined3({
|
|
674
738
|
...rest,
|
|
675
739
|
expires_at: expiresAt ?? rest.expires_at
|
|
676
740
|
});
|
|
@@ -683,7 +747,7 @@ var ApiKeys = class {
|
|
|
683
747
|
}
|
|
684
748
|
/** POST /api/v1/api-keys/scoped — L2 delegation token bound to one external user. */
|
|
685
749
|
async createScoped(params) {
|
|
686
|
-
const body =
|
|
750
|
+
const body = stripUndefined3({
|
|
687
751
|
external_user_id: params.externalUserId,
|
|
688
752
|
scopes: params.scopes,
|
|
689
753
|
expires_at: params.expiresAt
|
|
@@ -707,7 +771,7 @@ function unwrap3(payload) {
|
|
|
707
771
|
}
|
|
708
772
|
return payload;
|
|
709
773
|
}
|
|
710
|
-
function
|
|
774
|
+
function stripUndefined4(input) {
|
|
711
775
|
return Object.fromEntries(
|
|
712
776
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
713
777
|
);
|
|
@@ -719,7 +783,7 @@ var AuditLog = class {
|
|
|
719
783
|
http;
|
|
720
784
|
/** List audit-log events with optional filters. */
|
|
721
785
|
async list(params = {}) {
|
|
722
|
-
const query =
|
|
786
|
+
const query = stripUndefined4(params);
|
|
723
787
|
const data = await this.http.get("/audit-log", query);
|
|
724
788
|
const result = unwrap3(data);
|
|
725
789
|
if (Array.isArray(result)) return result;
|
|
@@ -857,7 +921,7 @@ function unwrap6(payload) {
|
|
|
857
921
|
}
|
|
858
922
|
return payload;
|
|
859
923
|
}
|
|
860
|
-
function
|
|
924
|
+
function stripUndefined5(input) {
|
|
861
925
|
return Object.fromEntries(
|
|
862
926
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
863
927
|
);
|
|
@@ -874,7 +938,7 @@ var Channels = class {
|
|
|
874
938
|
http;
|
|
875
939
|
/** List all channels for the tenant. */
|
|
876
940
|
async list(params = {}) {
|
|
877
|
-
const query =
|
|
941
|
+
const query = stripUndefined5(params);
|
|
878
942
|
const data = await this.http.get("/channels", query);
|
|
879
943
|
const result = unwrap6(data);
|
|
880
944
|
if (Array.isArray(result)) return result;
|
|
@@ -1734,7 +1798,7 @@ function unwrapList8(payload) {
|
|
|
1734
1798
|
}
|
|
1735
1799
|
return [];
|
|
1736
1800
|
}
|
|
1737
|
-
function
|
|
1801
|
+
function stripUndefined6(input) {
|
|
1738
1802
|
return Object.fromEntries(
|
|
1739
1803
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
1740
1804
|
);
|
|
@@ -1743,8 +1807,8 @@ function pickFirst(...values) {
|
|
|
1743
1807
|
for (const v of values) if (v !== void 0) return v;
|
|
1744
1808
|
return void 0;
|
|
1745
1809
|
}
|
|
1746
|
-
function
|
|
1747
|
-
return
|
|
1810
|
+
function listQuery2(params) {
|
|
1811
|
+
return stripUndefined6({
|
|
1748
1812
|
resource_id: pickFirst(params.resourceId, params.resource_id),
|
|
1749
1813
|
resource_type: pickFirst(params.resourceType, params.resource_type),
|
|
1750
1814
|
host: params.host,
|
|
@@ -1772,7 +1836,7 @@ var EgressAudit = class {
|
|
|
1772
1836
|
async list(params = {}) {
|
|
1773
1837
|
const data = await this.http.get(
|
|
1774
1838
|
"/egress/audit",
|
|
1775
|
-
|
|
1839
|
+
listQuery2(params)
|
|
1776
1840
|
);
|
|
1777
1841
|
return unwrapList8(data);
|
|
1778
1842
|
}
|
|
@@ -1799,7 +1863,7 @@ var EgressAudit = class {
|
|
|
1799
1863
|
if (since !== void 0) queryParams.since = since;
|
|
1800
1864
|
const data = await this.http.get(
|
|
1801
1865
|
"/egress/audit",
|
|
1802
|
-
|
|
1866
|
+
listQuery2(queryParams)
|
|
1803
1867
|
);
|
|
1804
1868
|
const events = unwrapList8(data);
|
|
1805
1869
|
for (const event of events) {
|
|
@@ -1883,7 +1947,7 @@ function unwrapList9(payload) {
|
|
|
1883
1947
|
}
|
|
1884
1948
|
return [];
|
|
1885
1949
|
}
|
|
1886
|
-
function
|
|
1950
|
+
function stripUndefined7(input) {
|
|
1887
1951
|
return Object.fromEntries(
|
|
1888
1952
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
1889
1953
|
);
|
|
@@ -1893,7 +1957,7 @@ function pickFirst2(...values) {
|
|
|
1893
1957
|
return void 0;
|
|
1894
1958
|
}
|
|
1895
1959
|
function ruleBody(host, params, effect) {
|
|
1896
|
-
return
|
|
1960
|
+
return stripUndefined7({
|
|
1897
1961
|
host,
|
|
1898
1962
|
effect,
|
|
1899
1963
|
methods: params.methods,
|
|
@@ -1928,7 +1992,7 @@ var EgressNetwork = class {
|
|
|
1928
1992
|
}
|
|
1929
1993
|
/** List allowlist rules. */
|
|
1930
1994
|
async rules(params = {}) {
|
|
1931
|
-
const query =
|
|
1995
|
+
const query = stripUndefined7({
|
|
1932
1996
|
policy_id: pickFirst2(params.policyId, params.policy_id),
|
|
1933
1997
|
resource_id: pickFirst2(params.resourceId, params.resource_id),
|
|
1934
1998
|
resource_type: pickFirst2(params.resourceType, params.resource_type)
|
|
@@ -1943,7 +2007,7 @@ var EgressNetwork = class {
|
|
|
1943
2007
|
// ── policies ──────────────────────────────────────────────────────────────
|
|
1944
2008
|
/** List egress policies. */
|
|
1945
2009
|
async policies(params = {}) {
|
|
1946
|
-
const query =
|
|
2010
|
+
const query = stripUndefined7({
|
|
1947
2011
|
resource_id: pickFirst2(params.resourceId, params.resource_id),
|
|
1948
2012
|
resource_type: pickFirst2(params.resourceType, params.resource_type)
|
|
1949
2013
|
});
|
|
@@ -1952,7 +2016,7 @@ var EgressNetwork = class {
|
|
|
1952
2016
|
}
|
|
1953
2017
|
/** Create an egress policy. */
|
|
1954
2018
|
async createPolicy(params) {
|
|
1955
|
-
const body =
|
|
2019
|
+
const body = stripUndefined7({
|
|
1956
2020
|
name: params.name,
|
|
1957
2021
|
mode: params.mode ?? "enforce",
|
|
1958
2022
|
default_effect: pickFirst2(
|
|
@@ -1972,7 +2036,7 @@ var EgressNetwork = class {
|
|
|
1972
2036
|
}
|
|
1973
2037
|
/** Update an egress policy by id. */
|
|
1974
2038
|
async updatePolicy(policyId, params) {
|
|
1975
|
-
const body =
|
|
2039
|
+
const body = stripUndefined7({
|
|
1976
2040
|
mode: params.mode,
|
|
1977
2041
|
default_effect: pickFirst2(params.defaultEffect, params.default_effect),
|
|
1978
2042
|
name: params.name,
|
|
@@ -2000,7 +2064,7 @@ var EgressNetwork = class {
|
|
|
2000
2064
|
if (policyId) {
|
|
2001
2065
|
return this.updatePolicy(policyId, { mode });
|
|
2002
2066
|
}
|
|
2003
|
-
const body = resourceId !== void 0 && resourceType !== void 0 ?
|
|
2067
|
+
const body = resourceId !== void 0 && resourceType !== void 0 ? stripUndefined7({
|
|
2004
2068
|
mode,
|
|
2005
2069
|
resource_id: resourceId,
|
|
2006
2070
|
resource_type: resourceType
|
|
@@ -2014,7 +2078,7 @@ var EgressNetwork = class {
|
|
|
2014
2078
|
// ── suggestions ───────────────────────────────────────────────────────────
|
|
2015
2079
|
/** AI-generated allowlist suggestions from recent denied egress. */
|
|
2016
2080
|
async suggestions(params = {}) {
|
|
2017
|
-
const query =
|
|
2081
|
+
const query = stripUndefined7({
|
|
2018
2082
|
resource_id: pickFirst2(params.resourceId, params.resource_id),
|
|
2019
2083
|
resource_type: pickFirst2(params.resourceType, params.resource_type),
|
|
2020
2084
|
since: params.since ?? "7d"
|
|
@@ -2119,7 +2183,7 @@ function unwrapList10(payload) {
|
|
|
2119
2183
|
}
|
|
2120
2184
|
return [];
|
|
2121
2185
|
}
|
|
2122
|
-
function
|
|
2186
|
+
function stripUndefined8(input) {
|
|
2123
2187
|
return Object.fromEntries(
|
|
2124
2188
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
2125
2189
|
);
|
|
@@ -2129,7 +2193,7 @@ function pickFirst3(...values) {
|
|
|
2129
2193
|
return void 0;
|
|
2130
2194
|
}
|
|
2131
2195
|
function setBody(params) {
|
|
2132
|
-
return
|
|
2196
|
+
return stripUndefined8({
|
|
2133
2197
|
name: params.name,
|
|
2134
2198
|
value: params.value,
|
|
2135
2199
|
type: params.type ?? "api_key",
|
|
@@ -2149,8 +2213,8 @@ function setBody(params) {
|
|
|
2149
2213
|
metadata: params.metadata
|
|
2150
2214
|
});
|
|
2151
2215
|
}
|
|
2152
|
-
function
|
|
2153
|
-
return
|
|
2216
|
+
function listQuery3(params) {
|
|
2217
|
+
return stripUndefined8({
|
|
2154
2218
|
scope: params.scope,
|
|
2155
2219
|
type: params.type,
|
|
2156
2220
|
workspace_id: pickFirst3(params.workspaceId, params.workspace_id),
|
|
@@ -2165,14 +2229,14 @@ function listQuery2(params) {
|
|
|
2165
2229
|
});
|
|
2166
2230
|
}
|
|
2167
2231
|
function rotateBody(params) {
|
|
2168
|
-
return
|
|
2232
|
+
return stripUndefined8({
|
|
2169
2233
|
value: pickFirst3(params.newValue, params.new_value, params.value),
|
|
2170
2234
|
refresh_token: pickFirst3(params.refreshToken, params.refresh_token),
|
|
2171
2235
|
expires_at: pickFirst3(params.expiresAt, params.expires_at)
|
|
2172
2236
|
});
|
|
2173
2237
|
}
|
|
2174
2238
|
function bindingBody(params) {
|
|
2175
|
-
return
|
|
2239
|
+
return stripUndefined8({
|
|
2176
2240
|
secret_id: pickFirst3(params.secretId, params.secret_id),
|
|
2177
2241
|
resource_id: pickFirst3(params.resourceId, params.resource_id),
|
|
2178
2242
|
resource_type: pickFirst3(params.resourceType, params.resource_type),
|
|
@@ -2180,14 +2244,14 @@ function bindingBody(params) {
|
|
|
2180
2244
|
});
|
|
2181
2245
|
}
|
|
2182
2246
|
function bindingQuery(params) {
|
|
2183
|
-
return
|
|
2247
|
+
return stripUndefined8({
|
|
2184
2248
|
resource_id: pickFirst3(params.resourceId, params.resource_id),
|
|
2185
2249
|
resource_type: pickFirst3(params.resourceType, params.resource_type),
|
|
2186
2250
|
secret_id: pickFirst3(params.secretId, params.secret_id)
|
|
2187
2251
|
});
|
|
2188
2252
|
}
|
|
2189
2253
|
function oauthBody(params) {
|
|
2190
|
-
return
|
|
2254
|
+
return stripUndefined8({
|
|
2191
2255
|
provider: params.provider,
|
|
2192
2256
|
expose_as_env: pickFirst3(params.exposeAsEnv, params.expose_as_env),
|
|
2193
2257
|
scope: params.scope,
|
|
@@ -2274,7 +2338,7 @@ var EgressSecrets = class {
|
|
|
2274
2338
|
async list(params = {}) {
|
|
2275
2339
|
const data = await this.http.get(
|
|
2276
2340
|
"/egress/secrets",
|
|
2277
|
-
|
|
2341
|
+
listQuery3(params)
|
|
2278
2342
|
);
|
|
2279
2343
|
return unwrapList10(data);
|
|
2280
2344
|
}
|
|
@@ -3399,7 +3463,7 @@ function listItems2(payload, candidateKeys = ["data", "cron_jobs", "executions",
|
|
|
3399
3463
|
}
|
|
3400
3464
|
return [];
|
|
3401
3465
|
}
|
|
3402
|
-
function
|
|
3466
|
+
function stripUndefined9(input) {
|
|
3403
3467
|
return Object.fromEntries(
|
|
3404
3468
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
3405
3469
|
);
|
|
@@ -3413,7 +3477,7 @@ var CronJobs = class {
|
|
|
3413
3477
|
}
|
|
3414
3478
|
http;
|
|
3415
3479
|
async list(params = {}) {
|
|
3416
|
-
const query =
|
|
3480
|
+
const query = stripUndefined9({ ...params });
|
|
3417
3481
|
const data = await this.http.get("/cron-jobs", query);
|
|
3418
3482
|
return listItems2(data);
|
|
3419
3483
|
}
|
|
@@ -3423,7 +3487,7 @@ var CronJobs = class {
|
|
|
3423
3487
|
}
|
|
3424
3488
|
async create(params) {
|
|
3425
3489
|
const { idempotencyKey: ikey, ...rest } = params;
|
|
3426
|
-
const body =
|
|
3490
|
+
const body = stripUndefined9(rest);
|
|
3427
3491
|
const data = await this.http.request("/cron-jobs", {
|
|
3428
3492
|
method: "POST",
|
|
3429
3493
|
body,
|
|
@@ -3432,7 +3496,7 @@ var CronJobs = class {
|
|
|
3432
3496
|
return unwrap20(data);
|
|
3433
3497
|
}
|
|
3434
3498
|
async update(jobId, params) {
|
|
3435
|
-
const body =
|
|
3499
|
+
const body = stripUndefined9(params);
|
|
3436
3500
|
const data = await this.http.patch(`/cron-jobs/${jobId}`, body);
|
|
3437
3501
|
return unwrap20(data);
|
|
3438
3502
|
}
|
|
@@ -3517,7 +3581,7 @@ function listItems3(payload, candidateKeys = ["data", "databases", "items"]) {
|
|
|
3517
3581
|
}
|
|
3518
3582
|
return [];
|
|
3519
3583
|
}
|
|
3520
|
-
function
|
|
3584
|
+
function stripUndefined10(input) {
|
|
3521
3585
|
return Object.fromEntries(
|
|
3522
3586
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
3523
3587
|
);
|
|
@@ -3531,7 +3595,7 @@ var Databases = class {
|
|
|
3531
3595
|
}
|
|
3532
3596
|
http;
|
|
3533
3597
|
async list(params = {}) {
|
|
3534
|
-
const query =
|
|
3598
|
+
const query = stripUndefined10({ ...params });
|
|
3535
3599
|
const data = await this.http.get("/databases", query);
|
|
3536
3600
|
return listItems3(data);
|
|
3537
3601
|
}
|
|
@@ -3548,7 +3612,7 @@ var Databases = class {
|
|
|
3548
3612
|
size: _deprecatedSize,
|
|
3549
3613
|
...rest
|
|
3550
3614
|
} = params;
|
|
3551
|
-
const body =
|
|
3615
|
+
const body = stripUndefined10({
|
|
3552
3616
|
...rest,
|
|
3553
3617
|
engine_version: engine_version ?? version
|
|
3554
3618
|
});
|
|
@@ -3591,7 +3655,7 @@ var Databases = class {
|
|
|
3591
3655
|
return unwrap22(data);
|
|
3592
3656
|
}
|
|
3593
3657
|
async logs(databaseId, params = {}) {
|
|
3594
|
-
const query =
|
|
3658
|
+
const query = stripUndefined10({
|
|
3595
3659
|
lines: params.lines,
|
|
3596
3660
|
since: params.since
|
|
3597
3661
|
});
|
|
@@ -3634,7 +3698,7 @@ function listItems4(payload, candidateKeys = ["items", "deployments", "versions"
|
|
|
3634
3698
|
}
|
|
3635
3699
|
return [];
|
|
3636
3700
|
}
|
|
3637
|
-
function
|
|
3701
|
+
function stripUndefined11(input) {
|
|
3638
3702
|
return Object.fromEntries(
|
|
3639
3703
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
3640
3704
|
);
|
|
@@ -3645,42 +3709,6 @@ function dockerDeployMetadata(metadata) {
|
|
|
3645
3709
|
deployment_product: "docker_deploy"
|
|
3646
3710
|
};
|
|
3647
3711
|
}
|
|
3648
|
-
function dockerDeployProduct(deployment) {
|
|
3649
|
-
return deployment.deployment_product ?? deployment.metadata?.["deployment_product"];
|
|
3650
|
-
}
|
|
3651
|
-
function dockerDeployHostId(deployment) {
|
|
3652
|
-
const metadataHost = deployment.metadata?.["docker_deploy_host_id"];
|
|
3653
|
-
return deployment.docker_deploy_host_id ?? (typeof metadataHost === "string" ? metadataHost : null);
|
|
3654
|
-
}
|
|
3655
|
-
function dockerDeployApp(deployment) {
|
|
3656
|
-
const app = deployment.metadata?.["docker_deploy"];
|
|
3657
|
-
if (!app || typeof app !== "object" || Array.isArray(app)) return null;
|
|
3658
|
-
return app;
|
|
3659
|
-
}
|
|
3660
|
-
function dockerDeployAppPort(app) {
|
|
3661
|
-
const url = app?.["url"];
|
|
3662
|
-
if (typeof url !== "string") return null;
|
|
3663
|
-
try {
|
|
3664
|
-
const parsed = new URL(url);
|
|
3665
|
-
const port = Number.parseInt(parsed.port, 10);
|
|
3666
|
-
return Number.isInteger(port) ? port : null;
|
|
3667
|
-
} catch {
|
|
3668
|
-
return null;
|
|
3669
|
-
}
|
|
3670
|
-
}
|
|
3671
|
-
function addDoctorCheck(checks, name, ok, message, details) {
|
|
3672
|
-
checks.push({ name, ok, message, ...details ? { details } : {} });
|
|
3673
|
-
}
|
|
3674
|
-
function hostHealthy(host) {
|
|
3675
|
-
return Boolean(
|
|
3676
|
-
host && host.status === "active" && host.appliance_status === "healthy"
|
|
3677
|
-
);
|
|
3678
|
-
}
|
|
3679
|
-
function probeUrl(publicUrl, probePath) {
|
|
3680
|
-
const url = new URL(publicUrl);
|
|
3681
|
-
url.pathname = probePath.startsWith("/") ? probePath : `/${probePath}`;
|
|
3682
|
-
return url.toString();
|
|
3683
|
-
}
|
|
3684
3712
|
var DeploymentVersions = class {
|
|
3685
3713
|
constructor(http, deploymentId) {
|
|
3686
3714
|
this.http = http;
|
|
@@ -3689,7 +3717,7 @@ var DeploymentVersions = class {
|
|
|
3689
3717
|
http;
|
|
3690
3718
|
deploymentId;
|
|
3691
3719
|
async list(params = {}) {
|
|
3692
|
-
const query =
|
|
3720
|
+
const query = stripUndefined11({
|
|
3693
3721
|
state: params.state,
|
|
3694
3722
|
limit: params.limit,
|
|
3695
3723
|
cursor: params.cursor,
|
|
@@ -3708,7 +3736,7 @@ var DeploymentVersions = class {
|
|
|
3708
3736
|
return unwrap23(data);
|
|
3709
3737
|
}
|
|
3710
3738
|
async promote(versionId, opts = {}) {
|
|
3711
|
-
const body =
|
|
3739
|
+
const body = stripUndefined11({ environment: opts.environment });
|
|
3712
3740
|
const data = await this.http.request(
|
|
3713
3741
|
`/deployments/${this.deploymentId}/versions/${versionId}/promote`,
|
|
3714
3742
|
{
|
|
@@ -3795,7 +3823,7 @@ var DeploymentDomains = class {
|
|
|
3795
3823
|
`/deployments/${this.deploymentId}/domains`,
|
|
3796
3824
|
{
|
|
3797
3825
|
method: "POST",
|
|
3798
|
-
body:
|
|
3826
|
+
body: stripUndefined11(body),
|
|
3799
3827
|
headers: { "Idempotency-Key": idempotencyKey4(params.idempotencyKey) }
|
|
3800
3828
|
}
|
|
3801
3829
|
);
|
|
@@ -3827,7 +3855,7 @@ var Deployments = class {
|
|
|
3827
3855
|
http;
|
|
3828
3856
|
async list(params = {}) {
|
|
3829
3857
|
const projectId = params.projectId ?? params.project_id;
|
|
3830
|
-
const query =
|
|
3858
|
+
const query = stripUndefined11({
|
|
3831
3859
|
project_id: projectId,
|
|
3832
3860
|
state: params.state,
|
|
3833
3861
|
limit: params.limit,
|
|
@@ -3845,7 +3873,7 @@ var Deployments = class {
|
|
|
3845
3873
|
return unwrap23(data);
|
|
3846
3874
|
}
|
|
3847
3875
|
async create(params) {
|
|
3848
|
-
const body =
|
|
3876
|
+
const body = stripUndefined11({
|
|
3849
3877
|
name: params.name,
|
|
3850
3878
|
repo_url: params.repoUrl ?? params.repo_url,
|
|
3851
3879
|
branch: params.branch,
|
|
@@ -3874,138 +3902,8 @@ var Deployments = class {
|
|
|
3874
3902
|
metadata: dockerDeployMetadata(params.metadata)
|
|
3875
3903
|
});
|
|
3876
3904
|
}
|
|
3877
|
-
/**
|
|
3878
|
-
* Verify a Docker Deploy deployment before telling a user or agent it is
|
|
3879
|
-
* live. Checks product markers, appliance host health, route metadata, and
|
|
3880
|
-
* optionally probes the public URL.
|
|
3881
|
-
*/
|
|
3882
|
-
async doctorDockerDeploy(deploymentId, params = {}) {
|
|
3883
|
-
const checks = [];
|
|
3884
|
-
const deployment = await this.get(deploymentId);
|
|
3885
|
-
const metadata = deployment.metadata ?? {};
|
|
3886
|
-
const product = dockerDeployProduct(deployment);
|
|
3887
|
-
const hostId = dockerDeployHostId(deployment);
|
|
3888
|
-
addDoctorCheck(
|
|
3889
|
-
checks,
|
|
3890
|
-
"deployment_product",
|
|
3891
|
-
product === "docker_deploy",
|
|
3892
|
-
product === "docker_deploy" ? "Deployment is marked for Docker Deploy." : `Expected deployment_product=docker_deploy, got ${String(product ?? "missing")}.`,
|
|
3893
|
-
{ deployment_product: product ?? null }
|
|
3894
|
-
);
|
|
3895
|
-
addDoctorCheck(
|
|
3896
|
-
checks,
|
|
3897
|
-
"docker_deploy_host_id",
|
|
3898
|
-
Boolean(hostId),
|
|
3899
|
-
hostId ? "Deployment has a Docker Deploy host id." : "Deployment has no docker_deploy_host_id.",
|
|
3900
|
-
{ docker_deploy_host_id: hostId }
|
|
3901
|
-
);
|
|
3902
|
-
let host;
|
|
3903
|
-
if (hostId) {
|
|
3904
|
-
try {
|
|
3905
|
-
const rawHost = await this.http.get(
|
|
3906
|
-
`/docker-deploy/hosts/${hostId}`
|
|
3907
|
-
);
|
|
3908
|
-
host = unwrap23(rawHost);
|
|
3909
|
-
addDoctorCheck(
|
|
3910
|
-
checks,
|
|
3911
|
-
"docker_deploy_host_health",
|
|
3912
|
-
hostHealthy(host),
|
|
3913
|
-
hostHealthy(host) ? "Docker Deploy host is active and healthy." : `Docker Deploy host status=${host.status} appliance=${host.appliance_status}.`,
|
|
3914
|
-
{
|
|
3915
|
-
status: host.status,
|
|
3916
|
-
appliance_status: host.appliance_status
|
|
3917
|
-
}
|
|
3918
|
-
);
|
|
3919
|
-
} catch (error) {
|
|
3920
|
-
addDoctorCheck(
|
|
3921
|
-
checks,
|
|
3922
|
-
"docker_deploy_host_health",
|
|
3923
|
-
false,
|
|
3924
|
-
error instanceof Error ? error.message : String(error)
|
|
3925
|
-
);
|
|
3926
|
-
}
|
|
3927
|
-
}
|
|
3928
|
-
const app = dockerDeployApp(deployment);
|
|
3929
|
-
const appPort = dockerDeployAppPort(app);
|
|
3930
|
-
const appRunning = app?.["status"] === "running" && appPort !== null;
|
|
3931
|
-
addDoctorCheck(
|
|
3932
|
-
checks,
|
|
3933
|
-
"docker_deploy_app",
|
|
3934
|
-
appRunning,
|
|
3935
|
-
appRunning ? "Docker Deploy app metadata points at a running container." : "Deployment is missing running Docker Deploy app metadata.",
|
|
3936
|
-
app ? {
|
|
3937
|
-
app_id: app["app_id"],
|
|
3938
|
-
container_id: app["container_id"],
|
|
3939
|
-
status: app["status"],
|
|
3940
|
-
url: app["url"],
|
|
3941
|
-
expected_port: appPort
|
|
3942
|
-
} : void 0
|
|
3943
|
-
);
|
|
3944
|
-
const runtime = metadata["runtime"];
|
|
3945
|
-
const hasRuntimeRoute = typeof runtime === "object" && runtime !== null && typeof runtime["ip"] === "string" && typeof runtime["port"] === "number";
|
|
3946
|
-
const runtimeRecord = hasRuntimeRoute && typeof runtime === "object" ? runtime : void 0;
|
|
3947
|
-
const routeMatchesContainerPort = hasRuntimeRoute && (appPort === null || runtimeRecord?.["port"] === appPort);
|
|
3948
|
-
addDoctorCheck(
|
|
3949
|
-
checks,
|
|
3950
|
-
"runtime_route",
|
|
3951
|
-
hasRuntimeRoute && routeMatchesContainerPort,
|
|
3952
|
-
hasRuntimeRoute && routeMatchesContainerPort ? "Deployment route points at the Docker container host port." : hasRuntimeRoute && appPort !== null ? `Deployment route port ${String(runtimeRecord?.["port"])} does not match Docker container host port ${appPort}.` : "Deployment is missing appliance runtime route metadata.",
|
|
3953
|
-
runtimeRecord ? {
|
|
3954
|
-
...runtimeRecord,
|
|
3955
|
-
expected_port: appPort,
|
|
3956
|
-
docker_deploy_url: app?.["url"]
|
|
3957
|
-
} : void 0
|
|
3958
|
-
);
|
|
3959
|
-
let probe;
|
|
3960
|
-
const publicUrl = deployment.public_url;
|
|
3961
|
-
const path = params.probePath ?? params.probe_path ?? "/";
|
|
3962
|
-
if (publicUrl && typeof fetch === "function") {
|
|
3963
|
-
const url = probeUrl(publicUrl, path);
|
|
3964
|
-
const controller = new AbortController();
|
|
3965
|
-
const timeout = setTimeout(
|
|
3966
|
-
() => controller.abort(),
|
|
3967
|
-
params.timeoutMs ?? params.timeout_ms ?? 1e4
|
|
3968
|
-
);
|
|
3969
|
-
try {
|
|
3970
|
-
const response = await fetch(url, {
|
|
3971
|
-
method: "GET",
|
|
3972
|
-
signal: controller.signal
|
|
3973
|
-
});
|
|
3974
|
-
probe = { url, ok: response.ok, status: response.status };
|
|
3975
|
-
addDoctorCheck(
|
|
3976
|
-
checks,
|
|
3977
|
-
"public_url_probe",
|
|
3978
|
-
response.ok,
|
|
3979
|
-
response.ok ? `Public URL returned HTTP ${response.status}.` : `Public URL returned HTTP ${response.status}.`,
|
|
3980
|
-
{ url, status: response.status }
|
|
3981
|
-
);
|
|
3982
|
-
} catch (error) {
|
|
3983
|
-
probe = {
|
|
3984
|
-
url,
|
|
3985
|
-
ok: false,
|
|
3986
|
-
error: error instanceof Error ? error.message : String(error)
|
|
3987
|
-
};
|
|
3988
|
-
addDoctorCheck(
|
|
3989
|
-
checks,
|
|
3990
|
-
"public_url_probe",
|
|
3991
|
-
false,
|
|
3992
|
-
probe.error ?? "Public URL probe failed.",
|
|
3993
|
-
{ url }
|
|
3994
|
-
);
|
|
3995
|
-
} finally {
|
|
3996
|
-
clearTimeout(timeout);
|
|
3997
|
-
}
|
|
3998
|
-
}
|
|
3999
|
-
return {
|
|
4000
|
-
ok: checks.every((check) => check.ok),
|
|
4001
|
-
deployment,
|
|
4002
|
-
...host ? { host } : {},
|
|
4003
|
-
checks,
|
|
4004
|
-
...probe ? { probe } : {}
|
|
4005
|
-
};
|
|
4006
|
-
}
|
|
4007
3905
|
async update(deploymentId, params) {
|
|
4008
|
-
const body =
|
|
3906
|
+
const body = stripUndefined11({
|
|
4009
3907
|
name: params.name,
|
|
4010
3908
|
branch: params.branch,
|
|
4011
3909
|
build_command: params.buildCommand ?? params.build_command,
|
|
@@ -4022,7 +3920,7 @@ var Deployments = class {
|
|
|
4022
3920
|
await this.http.delete(`/deployments/${deploymentId}`);
|
|
4023
3921
|
}
|
|
4024
3922
|
async publish(deploymentId, params) {
|
|
4025
|
-
const body =
|
|
3923
|
+
const body = stripUndefined11({
|
|
4026
3924
|
source_sandbox_id: params.sourceSandboxId ?? params.source_sandbox_id,
|
|
4027
3925
|
output_path: params.outputPath ?? params.output_path,
|
|
4028
3926
|
entrypoint: params.entrypoint,
|
|
@@ -4044,7 +3942,7 @@ var Deployments = class {
|
|
|
4044
3942
|
* phase. Prefer `publish()` once Phase 2B/3 lands.
|
|
4045
3943
|
*/
|
|
4046
3944
|
async publishFromSandbox(sandboxId, params = {}) {
|
|
4047
|
-
const body =
|
|
3945
|
+
const body = stripUndefined11({
|
|
4048
3946
|
name: params.name,
|
|
4049
3947
|
deployment_id: params.deploymentId ?? params.deployment_id,
|
|
4050
3948
|
output_path: params.outputPath ?? params.output_path,
|
|
@@ -4064,7 +3962,7 @@ var Deployments = class {
|
|
|
4064
3962
|
return unwrap23(data);
|
|
4065
3963
|
}
|
|
4066
3964
|
async rollback(deploymentId, params = {}) {
|
|
4067
|
-
const body =
|
|
3965
|
+
const body = stripUndefined11({
|
|
4068
3966
|
version_id: params.versionId ?? params.version_id
|
|
4069
3967
|
});
|
|
4070
3968
|
const data = await this.http.request(
|
|
@@ -4096,7 +3994,7 @@ var Deployments = class {
|
|
|
4096
3994
|
return listItems4(data);
|
|
4097
3995
|
}
|
|
4098
3996
|
async setEnv(deploymentId, vars, opts = {}) {
|
|
4099
|
-
const body =
|
|
3997
|
+
const body = stripUndefined11({ env: vars, environment: opts.environment });
|
|
4100
3998
|
const data = await this.http.post(
|
|
4101
3999
|
`/deployments/${deploymentId}/env`,
|
|
4102
4000
|
body
|
|
@@ -4395,7 +4293,7 @@ function unwrap25(payload) {
|
|
|
4395
4293
|
}
|
|
4396
4294
|
return payload;
|
|
4397
4295
|
}
|
|
4398
|
-
function
|
|
4296
|
+
function stripUndefined12(input) {
|
|
4399
4297
|
return Object.fromEntries(
|
|
4400
4298
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
4401
4299
|
);
|
|
@@ -4414,7 +4312,7 @@ var ExternalKeys = class {
|
|
|
4414
4312
|
}
|
|
4415
4313
|
/** Create / register an external provider key. */
|
|
4416
4314
|
async create(params) {
|
|
4417
|
-
const body =
|
|
4315
|
+
const body = stripUndefined12(params);
|
|
4418
4316
|
const data = await this.http.post("/external-keys", body);
|
|
4419
4317
|
return unwrap25(data);
|
|
4420
4318
|
}
|
|
@@ -4449,7 +4347,7 @@ function listItems5(payload, candidateKeys = ["data", "domains", "items"]) {
|
|
|
4449
4347
|
}
|
|
4450
4348
|
return [];
|
|
4451
4349
|
}
|
|
4452
|
-
function
|
|
4350
|
+
function stripUndefined13(input) {
|
|
4453
4351
|
return Object.fromEntries(
|
|
4454
4352
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
4455
4353
|
);
|
|
@@ -4463,7 +4361,7 @@ var FlatCustomDomains = class {
|
|
|
4463
4361
|
}
|
|
4464
4362
|
http;
|
|
4465
4363
|
async list(params = {}) {
|
|
4466
|
-
const query =
|
|
4364
|
+
const query = stripUndefined13({ ...params });
|
|
4467
4365
|
const data = await this.http.get("/custom-domains", query);
|
|
4468
4366
|
return listItems5(data);
|
|
4469
4367
|
}
|
|
@@ -4475,7 +4373,7 @@ var FlatCustomDomains = class {
|
|
|
4475
4373
|
redirectPolicy,
|
|
4476
4374
|
...rest
|
|
4477
4375
|
} = params;
|
|
4478
|
-
const body =
|
|
4376
|
+
const body = stripUndefined13({
|
|
4479
4377
|
...rest,
|
|
4480
4378
|
resource_type: resourceType ?? rest.resource_type,
|
|
4481
4379
|
resource_id: resourceId ?? rest.resource_id,
|
|
@@ -4508,7 +4406,7 @@ function listItems6(payload, candidateKeys = ["data", "functions", "items"]) {
|
|
|
4508
4406
|
}
|
|
4509
4407
|
return [];
|
|
4510
4408
|
}
|
|
4511
|
-
function
|
|
4409
|
+
function stripUndefined14(input) {
|
|
4512
4410
|
return Object.fromEntries(
|
|
4513
4411
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
4514
4412
|
);
|
|
@@ -4522,7 +4420,7 @@ var Functions = class {
|
|
|
4522
4420
|
}
|
|
4523
4421
|
http;
|
|
4524
4422
|
async list(params = {}) {
|
|
4525
|
-
const query =
|
|
4423
|
+
const query = stripUndefined14({ ...params });
|
|
4526
4424
|
const data = await this.http.get("/functions", query);
|
|
4527
4425
|
return listItems6(data);
|
|
4528
4426
|
}
|
|
@@ -4532,7 +4430,7 @@ var Functions = class {
|
|
|
4532
4430
|
}
|
|
4533
4431
|
async create(params) {
|
|
4534
4432
|
const { idempotencyKey: ikey, memoryMb, timeoutSec, ...rest } = params;
|
|
4535
|
-
const body =
|
|
4433
|
+
const body = stripUndefined14({
|
|
4536
4434
|
...rest,
|
|
4537
4435
|
memory_mb: memoryMb ?? rest.memory_mb,
|
|
4538
4436
|
timeout_sec: timeoutSec ?? rest.timeout_sec
|
|
@@ -4546,7 +4444,7 @@ var Functions = class {
|
|
|
4546
4444
|
}
|
|
4547
4445
|
async update(functionId, params) {
|
|
4548
4446
|
const { memoryMb, timeoutSec, ...rest } = params;
|
|
4549
|
-
const body =
|
|
4447
|
+
const body = stripUndefined14({
|
|
4550
4448
|
...rest,
|
|
4551
4449
|
memory_mb: memoryMb ?? rest.memory_mb,
|
|
4552
4450
|
timeout_sec: timeoutSec ?? rest.timeout_sec
|
|
@@ -4592,7 +4490,7 @@ function listItems7(payload, candidateKeys = ["data", "health_checks", "items"])
|
|
|
4592
4490
|
}
|
|
4593
4491
|
return [];
|
|
4594
4492
|
}
|
|
4595
|
-
function
|
|
4493
|
+
function stripUndefined15(input) {
|
|
4596
4494
|
return Object.fromEntries(
|
|
4597
4495
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
4598
4496
|
);
|
|
@@ -4606,7 +4504,7 @@ var HealthChecks = class {
|
|
|
4606
4504
|
}
|
|
4607
4505
|
http;
|
|
4608
4506
|
async list(params = {}) {
|
|
4609
|
-
const query =
|
|
4507
|
+
const query = stripUndefined15({ ...params });
|
|
4610
4508
|
const data = await this.http.get("/health-checks", query);
|
|
4611
4509
|
return listItems7(data);
|
|
4612
4510
|
}
|
|
@@ -4622,7 +4520,7 @@ var HealthChecks = class {
|
|
|
4622
4520
|
expectedStatus,
|
|
4623
4521
|
...rest
|
|
4624
4522
|
} = params;
|
|
4625
|
-
const body =
|
|
4523
|
+
const body = stripUndefined15({
|
|
4626
4524
|
...rest,
|
|
4627
4525
|
interval_sec: intervalSec ?? rest.interval_sec,
|
|
4628
4526
|
timeout_sec: timeoutSec ?? rest.timeout_sec,
|
|
@@ -4637,7 +4535,7 @@ var HealthChecks = class {
|
|
|
4637
4535
|
}
|
|
4638
4536
|
async update(checkId, params) {
|
|
4639
4537
|
const { intervalSec, timeoutSec, expectedStatus, ...rest } = params;
|
|
4640
|
-
const body =
|
|
4538
|
+
const body = stripUndefined15({
|
|
4641
4539
|
...rest,
|
|
4642
4540
|
interval_sec: intervalSec ?? rest.interval_sec,
|
|
4643
4541
|
timeout_sec: timeoutSec ?? rest.timeout_sec,
|
|
@@ -4669,7 +4567,7 @@ function listItems8(payload) {
|
|
|
4669
4567
|
if (Array.isArray(result)) return result;
|
|
4670
4568
|
return [];
|
|
4671
4569
|
}
|
|
4672
|
-
function
|
|
4570
|
+
function stripUndefined16(input) {
|
|
4673
4571
|
return Object.fromEntries(
|
|
4674
4572
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
4675
4573
|
);
|
|
@@ -4721,7 +4619,7 @@ var Integrations = class {
|
|
|
4721
4619
|
// ── Test hooks ─────────────────────────────────────────────────────────────
|
|
4722
4620
|
/** Send a test message to the connected Slack channel. */
|
|
4723
4621
|
async slackSendTest(params = {}) {
|
|
4724
|
-
const body =
|
|
4622
|
+
const body = stripUndefined16(params);
|
|
4725
4623
|
const data = await this.http.post(
|
|
4726
4624
|
"/integrations/slack/send-test",
|
|
4727
4625
|
body
|
|
@@ -4730,7 +4628,7 @@ var Integrations = class {
|
|
|
4730
4628
|
}
|
|
4731
4629
|
/** Send a test message to the connected Discord channel. */
|
|
4732
4630
|
async discordSendTest(params = {}) {
|
|
4733
|
-
const body =
|
|
4631
|
+
const body = stripUndefined16(params);
|
|
4734
4632
|
const data = await this.http.post(
|
|
4735
4633
|
"/integrations/discord/send-test",
|
|
4736
4634
|
body
|
|
@@ -4745,7 +4643,7 @@ var Integrations = class {
|
|
|
4745
4643
|
}
|
|
4746
4644
|
/** Create a Linear issue via the connected workspace. */
|
|
4747
4645
|
async linearCreateIssue(params = {}) {
|
|
4748
|
-
const body =
|
|
4646
|
+
const body = stripUndefined16(params);
|
|
4749
4647
|
const data = await this.http.post(
|
|
4750
4648
|
"/integrations/linear/create-issue",
|
|
4751
4649
|
body
|
|
@@ -4764,7 +4662,7 @@ function unwrap30(payload) {
|
|
|
4764
4662
|
}
|
|
4765
4663
|
return payload;
|
|
4766
4664
|
}
|
|
4767
|
-
function
|
|
4665
|
+
function stripUndefined17(input) {
|
|
4768
4666
|
return Object.fromEntries(
|
|
4769
4667
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
4770
4668
|
);
|
|
@@ -4776,7 +4674,7 @@ var Mcp = class {
|
|
|
4776
4674
|
http;
|
|
4777
4675
|
/** Send a JSON-RPC request to the MCP endpoint. */
|
|
4778
4676
|
async dispatch(params = {}) {
|
|
4779
|
-
const body =
|
|
4677
|
+
const body = stripUndefined17(params);
|
|
4780
4678
|
const data = await this.http.post(
|
|
4781
4679
|
"/mcp",
|
|
4782
4680
|
Object.keys(body).length > 0 ? body : void 0
|
|
@@ -5451,7 +5349,7 @@ function resourcePayload(params) {
|
|
|
5451
5349
|
return { resource_type, resource_id };
|
|
5452
5350
|
}
|
|
5453
5351
|
function authConfig(params) {
|
|
5454
|
-
return
|
|
5352
|
+
return stripUndefined18({
|
|
5455
5353
|
...params.config ?? {},
|
|
5456
5354
|
signup_enabled: params.signup_enabled ?? params.signupEnabled,
|
|
5457
5355
|
email_confirm_required: params.email_confirm_required ?? params.emailConfirmRequired,
|
|
@@ -5459,7 +5357,7 @@ function authConfig(params) {
|
|
|
5459
5357
|
});
|
|
5460
5358
|
}
|
|
5461
5359
|
function requestBody(params) {
|
|
5462
|
-
return
|
|
5360
|
+
return stripUndefined18({
|
|
5463
5361
|
...resourcePayload(params),
|
|
5464
5362
|
config: authConfig(params)
|
|
5465
5363
|
});
|
|
@@ -5473,7 +5371,7 @@ function unwrap32(payload) {
|
|
|
5473
5371
|
}
|
|
5474
5372
|
return payload;
|
|
5475
5373
|
}
|
|
5476
|
-
function
|
|
5374
|
+
function stripUndefined18(input) {
|
|
5477
5375
|
return Object.fromEntries(
|
|
5478
5376
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
5479
5377
|
);
|
|
@@ -5528,7 +5426,7 @@ function listItems9(payload) {
|
|
|
5528
5426
|
if (Array.isArray(result)) return result;
|
|
5529
5427
|
return [];
|
|
5530
5428
|
}
|
|
5531
|
-
function
|
|
5429
|
+
function stripUndefined19(input) {
|
|
5532
5430
|
return Object.fromEntries(
|
|
5533
5431
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
5534
5432
|
);
|
|
@@ -5545,7 +5443,7 @@ var ProjectIntegrations = class {
|
|
|
5545
5443
|
http;
|
|
5546
5444
|
/** List project integrations. */
|
|
5547
5445
|
async list(params = {}) {
|
|
5548
|
-
const query =
|
|
5446
|
+
const query = stripUndefined19(params);
|
|
5549
5447
|
const data = await this.http.get("/project-integrations", query);
|
|
5550
5448
|
return listItems9(data);
|
|
5551
5449
|
}
|
|
@@ -5709,6 +5607,10 @@ function encodeContent(content) {
|
|
|
5709
5607
|
return btoa(bin);
|
|
5710
5608
|
}
|
|
5711
5609
|
var SANDBOX_TEMPLATE = "miosa-sandbox";
|
|
5610
|
+
var AGENT_WORKSPACE_TIMEOUT_SEC = 86400;
|
|
5611
|
+
var AGENT_WORKSPACE_IDLE_TIMEOUT_SEC = 1800;
|
|
5612
|
+
var AGENT_WORKSPACE_SNAPSHOT_EXPIRATION_DAYS = 30;
|
|
5613
|
+
var AGENT_WORKSPACE_KEEP_LAST_SNAPSHOTS = 1;
|
|
5712
5614
|
function unwrap36(payload) {
|
|
5713
5615
|
if (payload !== null && typeof payload === "object" && "data" in payload && payload.data !== void 0) {
|
|
5714
5616
|
return payload.data;
|
|
@@ -5723,19 +5625,30 @@ function listItems11(payload) {
|
|
|
5723
5625
|
if ("items" in payload && Array.isArray(payload.items)) return payload.items;
|
|
5724
5626
|
return [];
|
|
5725
5627
|
}
|
|
5726
|
-
function
|
|
5628
|
+
function createBody2(params = {}) {
|
|
5727
5629
|
const templateId = params.templateId ?? params.template_id ?? params.image ?? SANDBOX_TEMPLATE;
|
|
5728
|
-
|
|
5630
|
+
const persistent = params.persistent;
|
|
5631
|
+
const snapshotExpirationSec = snapshotExpirationSeconds(params);
|
|
5632
|
+
const keepLastSnapshots = params.keepLastSnapshots ?? params.keep_last_snapshots;
|
|
5633
|
+
const metadata = { ...params.metadata ?? {} };
|
|
5634
|
+
if (persistent !== void 0) metadata.miosa_persistent = persistent;
|
|
5635
|
+
if (snapshotExpirationSec !== void 0) {
|
|
5636
|
+
metadata.snapshot_expiration_sec = snapshotExpirationSec;
|
|
5637
|
+
}
|
|
5638
|
+
if (keepLastSnapshots !== void 0) {
|
|
5639
|
+
metadata.keep_last_snapshots = keepLastSnapshots;
|
|
5640
|
+
}
|
|
5641
|
+
return stripUndefined20({
|
|
5729
5642
|
template_id: templateId,
|
|
5730
5643
|
cpu_count: params.cpuCount ?? params.cpu_count,
|
|
5731
5644
|
memory_mb: params.memoryMb ?? params.memory_mb,
|
|
5732
5645
|
disk_mb: params.diskMb ?? params.disk_mb,
|
|
5733
5646
|
disk_size_mb: params.diskSizeMb ?? params.disk_size_mb,
|
|
5734
|
-
timeout_sec: params.timeoutSec ?? params.timeout_sec,
|
|
5735
|
-
idle_timeout_sec: params.idleTimeoutSec ?? params.idle_timeout_sec,
|
|
5647
|
+
timeout_sec: params.timeoutSec ?? params.timeout_sec ?? (persistent === true ? 86400 : void 0),
|
|
5648
|
+
idle_timeout_sec: params.idleTimeoutSec ?? params.idle_timeout_sec ?? (persistent === true ? 1800 : void 0),
|
|
5736
5649
|
always_on: params.alwaysOn ?? params.always_on,
|
|
5737
5650
|
env: params.env,
|
|
5738
|
-
metadata:
|
|
5651
|
+
metadata: Object.keys(metadata).length > 0 ? metadata : void 0,
|
|
5739
5652
|
services: params.services,
|
|
5740
5653
|
readiness_probe: params.readinessProbe ?? params.readiness_probe,
|
|
5741
5654
|
database: params.database,
|
|
@@ -5753,18 +5666,24 @@ function createBody(params = {}) {
|
|
|
5753
5666
|
});
|
|
5754
5667
|
}
|
|
5755
5668
|
function execBody(command, options = {}) {
|
|
5756
|
-
return
|
|
5669
|
+
return stripUndefined20({
|
|
5757
5670
|
command,
|
|
5758
5671
|
cwd: options.cwd ?? options.workingDir ?? options.working_dir,
|
|
5759
5672
|
env: options.env,
|
|
5760
5673
|
timeout: options.timeout ?? options.timeoutSec ?? options.timeout_sec
|
|
5761
5674
|
});
|
|
5762
5675
|
}
|
|
5763
|
-
function
|
|
5676
|
+
function stripUndefined20(input) {
|
|
5764
5677
|
return Object.fromEntries(
|
|
5765
5678
|
Object.entries(input).filter(([, value]) => value !== void 0)
|
|
5766
5679
|
);
|
|
5767
5680
|
}
|
|
5681
|
+
function snapshotExpirationSeconds(params) {
|
|
5682
|
+
const seconds = params.snapshotExpirationSec ?? params.snapshot_expiration_sec;
|
|
5683
|
+
if (seconds !== void 0) return seconds;
|
|
5684
|
+
const days = params.snapshotExpirationDays ?? params.snapshot_expiration_days;
|
|
5685
|
+
return days === void 0 ? void 0 : days * 86400;
|
|
5686
|
+
}
|
|
5768
5687
|
var SandboxCommands = class {
|
|
5769
5688
|
constructor(sandbox) {
|
|
5770
5689
|
this.sandbox = sandbox;
|
|
@@ -6262,10 +6181,25 @@ var Sandbox = class _Sandbox {
|
|
|
6262
6181
|
* PATCH /api/v1/sandboxes/{id} — update mutable sandbox fields.
|
|
6263
6182
|
*/
|
|
6264
6183
|
async update(params) {
|
|
6265
|
-
const
|
|
6266
|
-
|
|
6267
|
-
|
|
6184
|
+
const snapshotExpirationSec = snapshotExpirationSeconds(params);
|
|
6185
|
+
const metadata = { ...params.metadata ?? {} };
|
|
6186
|
+
if (params.persistent !== void 0) metadata.miosa_persistent = params.persistent;
|
|
6187
|
+
if (snapshotExpirationSec !== void 0) {
|
|
6188
|
+
metadata.snapshot_expiration_sec = snapshotExpirationSec;
|
|
6268
6189
|
}
|
|
6190
|
+
const keepLastSnapshots = params.keepLastSnapshots ?? params.keep_last_snapshots;
|
|
6191
|
+
if (keepLastSnapshots !== void 0) {
|
|
6192
|
+
metadata.keep_last_snapshots = keepLastSnapshots;
|
|
6193
|
+
}
|
|
6194
|
+
const body = stripUndefined20({
|
|
6195
|
+
name: params.name,
|
|
6196
|
+
slug: params.slug,
|
|
6197
|
+
tags: params.tags,
|
|
6198
|
+
metadata: Object.keys(metadata).length > 0 ? metadata : void 0,
|
|
6199
|
+
always_on: params.always_on ?? params.alwaysOn,
|
|
6200
|
+
timeout_sec: params.timeout_sec ?? params.timeoutSec,
|
|
6201
|
+
idle_timeout_sec: params.idle_timeout_sec ?? params.idleTimeoutSec
|
|
6202
|
+
});
|
|
6269
6203
|
const data = unwrap36(
|
|
6270
6204
|
await this.http.patch(
|
|
6271
6205
|
`/sandboxes/${this.id}`,
|
|
@@ -6275,6 +6209,16 @@ var Sandbox = class _Sandbox {
|
|
|
6275
6209
|
this.data = data;
|
|
6276
6210
|
return this;
|
|
6277
6211
|
}
|
|
6212
|
+
async extend(timeoutSec) {
|
|
6213
|
+
const data = unwrap36(
|
|
6214
|
+
await this.http.post(
|
|
6215
|
+
`/sandboxes/${this.id}/extend`,
|
|
6216
|
+
{ timeout_sec: timeoutSec }
|
|
6217
|
+
)
|
|
6218
|
+
);
|
|
6219
|
+
this.data = data;
|
|
6220
|
+
return this;
|
|
6221
|
+
}
|
|
6278
6222
|
/**
|
|
6279
6223
|
* POST /api/v1/sandboxes/{id}/preview-token → {token, url, expires_at, scope}
|
|
6280
6224
|
*/
|
|
@@ -6312,7 +6256,7 @@ var Sandbox = class _Sandbox {
|
|
|
6312
6256
|
const idempotencyKey11 = params.idempotencyKey ?? params.idempotency_key;
|
|
6313
6257
|
const requestOptions = {
|
|
6314
6258
|
method: "POST",
|
|
6315
|
-
body:
|
|
6259
|
+
body: stripUndefined20({
|
|
6316
6260
|
name: params.name,
|
|
6317
6261
|
deployment_id: params.deploymentId ?? params.deployment_id,
|
|
6318
6262
|
output_path: params.outputPath ?? params.output_path ?? params.path ?? params.sourcePath ?? params.source_path,
|
|
@@ -6477,11 +6421,37 @@ var Sandboxes = class {
|
|
|
6477
6421
|
this.http = http;
|
|
6478
6422
|
}
|
|
6479
6423
|
http;
|
|
6424
|
+
/**
|
|
6425
|
+
* Create a persistent agent workspace.
|
|
6426
|
+
*
|
|
6427
|
+
* This is the preferred entry point for AI builders, coding agents, and
|
|
6428
|
+
* product workspaces. It gives the sandbox a stable name, a longer interactive
|
|
6429
|
+
* timeout, and metadata that makes the workspace easy to identify later. The
|
|
6430
|
+
* agent should create/edit files in `/workspace`, run installs/tests/builds
|
|
6431
|
+
* inside the sandbox, expose previews from the sandbox, and publish from the
|
|
6432
|
+
* sandbox when ready.
|
|
6433
|
+
*/
|
|
6434
|
+
async createAgentWorkspace(params) {
|
|
6435
|
+
const metadata = {
|
|
6436
|
+
...params.metadata ?? {},
|
|
6437
|
+
miosa_workspace_kind: "agent_workspace"
|
|
6438
|
+
};
|
|
6439
|
+
return this.getOrCreate({
|
|
6440
|
+
persistent: true,
|
|
6441
|
+
timeoutSec: AGENT_WORKSPACE_TIMEOUT_SEC,
|
|
6442
|
+
idleTimeoutSec: AGENT_WORKSPACE_IDLE_TIMEOUT_SEC,
|
|
6443
|
+
snapshotExpirationDays: AGENT_WORKSPACE_SNAPSHOT_EXPIRATION_DAYS,
|
|
6444
|
+
keepLastSnapshots: AGENT_WORKSPACE_KEEP_LAST_SNAPSHOTS,
|
|
6445
|
+
waitUntilReady: true,
|
|
6446
|
+
...params,
|
|
6447
|
+
metadata
|
|
6448
|
+
});
|
|
6449
|
+
}
|
|
6480
6450
|
async create(params = {}) {
|
|
6481
6451
|
const idempotencyKey11 = params.idempotencyKey ?? params.idempotency_key;
|
|
6482
6452
|
const requestOptions = {
|
|
6483
6453
|
method: "POST",
|
|
6484
|
-
body:
|
|
6454
|
+
body: createBody2(params)
|
|
6485
6455
|
};
|
|
6486
6456
|
if (idempotencyKey11) {
|
|
6487
6457
|
requestOptions.headers = { "Idempotency-Key": idempotencyKey11 };
|
|
@@ -6513,6 +6483,37 @@ var Sandboxes = class {
|
|
|
6513
6483
|
connect(id) {
|
|
6514
6484
|
return this.get(id);
|
|
6515
6485
|
}
|
|
6486
|
+
async getByName(name) {
|
|
6487
|
+
const data = unwrap36(
|
|
6488
|
+
await this.http.get(
|
|
6489
|
+
`/sandboxes/by-name/${encodeURIComponent(name)}`
|
|
6490
|
+
)
|
|
6491
|
+
);
|
|
6492
|
+
return new Sandbox(this.http, data);
|
|
6493
|
+
}
|
|
6494
|
+
/**
|
|
6495
|
+
* Idempotently obtain a persistent sandbox by stable name.
|
|
6496
|
+
*
|
|
6497
|
+
* If the sandbox exists, it is returned. If it is paused and `resume !== false`,
|
|
6498
|
+
* it is resumed first. If it does not exist, it is created with the supplied
|
|
6499
|
+
* params. Destroyed sandboxes are permanent and are not resumed by this helper.
|
|
6500
|
+
*/
|
|
6501
|
+
async getOrCreate(params) {
|
|
6502
|
+
let sandbox;
|
|
6503
|
+
try {
|
|
6504
|
+
sandbox = await this.getByName(params.name);
|
|
6505
|
+
} catch (error) {
|
|
6506
|
+
if (!(error instanceof NotFoundError)) throw error;
|
|
6507
|
+
sandbox = await this.create(params);
|
|
6508
|
+
}
|
|
6509
|
+
if (sandbox.state === "paused" && params.resume !== false) {
|
|
6510
|
+
await sandbox.resume();
|
|
6511
|
+
}
|
|
6512
|
+
if (params.waitUntilReady === true) {
|
|
6513
|
+
await sandbox.waitUntilReady({ timeout: params.waitTimeoutSec ?? 60 });
|
|
6514
|
+
}
|
|
6515
|
+
return sandbox;
|
|
6516
|
+
}
|
|
6516
6517
|
async delete(id) {
|
|
6517
6518
|
await this.http.delete(`/sandboxes/${id}`);
|
|
6518
6519
|
}
|
|
@@ -6540,7 +6541,7 @@ var Sandboxes = class {
|
|
|
6540
6541
|
async createTemplate(params) {
|
|
6541
6542
|
const response = await this.http.post(
|
|
6542
6543
|
"/sandbox-templates",
|
|
6543
|
-
|
|
6544
|
+
stripUndefined20({
|
|
6544
6545
|
name: params.name,
|
|
6545
6546
|
slug: params.slug,
|
|
6546
6547
|
description: params.description,
|
|
@@ -6553,7 +6554,7 @@ var Sandboxes = class {
|
|
|
6553
6554
|
async createTemplateBuild(templateId, params = {}) {
|
|
6554
6555
|
const response = await this.http.post(
|
|
6555
6556
|
`/sandbox-templates/${templateId}/builds`,
|
|
6556
|
-
|
|
6557
|
+
stripUndefined20({
|
|
6557
6558
|
build_spec: params.buildSpec ?? params.build_spec,
|
|
6558
6559
|
metadata: params.metadata
|
|
6559
6560
|
})
|
|
@@ -6598,7 +6599,7 @@ function listItems12(payload, candidateKeys = ["data", "templates", "builds", "i
|
|
|
6598
6599
|
}
|
|
6599
6600
|
return [];
|
|
6600
6601
|
}
|
|
6601
|
-
function
|
|
6602
|
+
function stripUndefined21(input) {
|
|
6602
6603
|
return Object.fromEntries(
|
|
6603
6604
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
6604
6605
|
);
|
|
@@ -6635,7 +6636,7 @@ var SandboxTemplates = class {
|
|
|
6635
6636
|
name,
|
|
6636
6637
|
...rest
|
|
6637
6638
|
} = params;
|
|
6638
|
-
const body =
|
|
6639
|
+
const body = stripUndefined21({
|
|
6639
6640
|
name,
|
|
6640
6641
|
build_spec: buildSpec ?? build_spec,
|
|
6641
6642
|
...rest
|
|
@@ -6669,7 +6670,7 @@ var SandboxTemplates = class {
|
|
|
6669
6670
|
}
|
|
6670
6671
|
async createBuild(templateId, params = {}) {
|
|
6671
6672
|
const { idempotencyKey: ikey, ...rest } = params;
|
|
6672
|
-
const body =
|
|
6673
|
+
const body = stripUndefined21(rest);
|
|
6673
6674
|
const data = await this.http.request(
|
|
6674
6675
|
`/sandbox-templates/${templateId}/builds`,
|
|
6675
6676
|
{
|
|
@@ -6703,7 +6704,7 @@ function listItems13(payload) {
|
|
|
6703
6704
|
if (Array.isArray(result)) return result;
|
|
6704
6705
|
return [];
|
|
6705
6706
|
}
|
|
6706
|
-
function
|
|
6707
|
+
function stripUndefined22(input) {
|
|
6707
6708
|
return Object.fromEntries(
|
|
6708
6709
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
6709
6710
|
);
|
|
@@ -6720,7 +6721,7 @@ var Settings = class {
|
|
|
6720
6721
|
}
|
|
6721
6722
|
/** Update tenant settings. */
|
|
6722
6723
|
async update(params) {
|
|
6723
|
-
const body =
|
|
6724
|
+
const body = stripUndefined22(params);
|
|
6724
6725
|
const data = await this.http.put("/settings", body);
|
|
6725
6726
|
return unwrap38(data);
|
|
6726
6727
|
}
|
|
@@ -6732,7 +6733,7 @@ var Settings = class {
|
|
|
6732
6733
|
}
|
|
6733
6734
|
/** Update tenant branding. */
|
|
6734
6735
|
async updateBranding(params) {
|
|
6735
|
-
const body =
|
|
6736
|
+
const body = stripUndefined22(params);
|
|
6736
6737
|
const data = await this.http.put("/settings/branding", body);
|
|
6737
6738
|
return unwrap38(data);
|
|
6738
6739
|
}
|
|
@@ -6765,7 +6766,7 @@ var Settings = class {
|
|
|
6765
6766
|
}
|
|
6766
6767
|
/** Create or update a BYOK provider key. */
|
|
6767
6768
|
async upsertProviderKey(provider, params) {
|
|
6768
|
-
const body =
|
|
6769
|
+
const body = stripUndefined22(params);
|
|
6769
6770
|
const data = await this.http.put(
|
|
6770
6771
|
`/settings/provider-keys/${provider}`,
|
|
6771
6772
|
body
|
|
@@ -6833,7 +6834,7 @@ function listItems14(payload, candidateKeys = ["data", "buckets", "objects", "it
|
|
|
6833
6834
|
}
|
|
6834
6835
|
return [];
|
|
6835
6836
|
}
|
|
6836
|
-
function
|
|
6837
|
+
function stripUndefined23(input) {
|
|
6837
6838
|
return Object.fromEntries(
|
|
6838
6839
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
6839
6840
|
);
|
|
@@ -6850,7 +6851,7 @@ var Storage = class {
|
|
|
6850
6851
|
}
|
|
6851
6852
|
async createBucket(params) {
|
|
6852
6853
|
const { name, public: isPublic, visibility, ...rest } = params;
|
|
6853
|
-
const body =
|
|
6854
|
+
const body = stripUndefined23({
|
|
6854
6855
|
name,
|
|
6855
6856
|
visibility: visibility ?? (isPublic === void 0 ? void 0 : isPublic ? "public" : "private"),
|
|
6856
6857
|
...rest
|
|
@@ -6867,7 +6868,7 @@ var Storage = class {
|
|
|
6867
6868
|
}
|
|
6868
6869
|
// ── Objects ────────────────────────────────────────────────────────────────
|
|
6869
6870
|
async listObjects(bucketId, params = {}) {
|
|
6870
|
-
const query =
|
|
6871
|
+
const query = stripUndefined23({
|
|
6871
6872
|
prefix: params.prefix,
|
|
6872
6873
|
max_keys: params.max_keys ?? params.maxKeys ?? params.limit,
|
|
6873
6874
|
marker: params.marker ?? params.cursor
|
|
@@ -6901,7 +6902,7 @@ var Storage = class {
|
|
|
6901
6902
|
// ── Presigned URLs ─────────────────────────────────────────────────────────
|
|
6902
6903
|
async presign(bucketId, params) {
|
|
6903
6904
|
const operationMethod = params.operation === "put" ? "PUT" : params.operation === "get" ? "GET" : void 0;
|
|
6904
|
-
const body =
|
|
6905
|
+
const body = stripUndefined23({
|
|
6905
6906
|
key: params.key,
|
|
6906
6907
|
method: params.method ?? operationMethod ?? "GET",
|
|
6907
6908
|
expires_in: params.expiresIn ?? params.expires_in ?? params.expiresInSec ?? params.expires_in_sec ?? 3600
|
|
@@ -7003,96 +7004,22 @@ var OrgInvites = class {
|
|
|
7003
7004
|
function unwrap41(payload) {
|
|
7004
7005
|
if (payload && typeof payload === "object") {
|
|
7005
7006
|
const p = payload;
|
|
7006
|
-
for (const k of ["data", "tenant", "
|
|
7007
|
+
for (const k of ["data", "tenant", "items"]) {
|
|
7007
7008
|
if (k in p) return p[k];
|
|
7008
7009
|
}
|
|
7009
7010
|
}
|
|
7010
7011
|
return payload;
|
|
7011
7012
|
}
|
|
7012
|
-
var PreviewDomain = class {
|
|
7013
|
-
constructor(http) {
|
|
7014
|
-
this.http = http;
|
|
7015
|
-
}
|
|
7016
|
-
http;
|
|
7017
|
-
/** Get the tenant's white-label preview domain settings. */
|
|
7018
|
-
async get() {
|
|
7019
|
-
const data = await this.http.get("/tenant/preview-domain");
|
|
7020
|
-
return unwrap41(data);
|
|
7021
|
-
}
|
|
7022
|
-
/** Set the tenant's white-label preview domain. */
|
|
7023
|
-
async set(domain) {
|
|
7024
|
-
const data = await this.http.put("/tenant/preview-domain", {
|
|
7025
|
-
preview_domain: domain
|
|
7026
|
-
});
|
|
7027
|
-
return unwrap41(data);
|
|
7028
|
-
}
|
|
7029
|
-
/** Re-run DNS verification for the configured preview domain. */
|
|
7030
|
-
async verify() {
|
|
7031
|
-
const data = await this.http.post(
|
|
7032
|
-
"/tenant/preview-domain/verify",
|
|
7033
|
-
{}
|
|
7034
|
-
);
|
|
7035
|
-
return unwrap41(data);
|
|
7036
|
-
}
|
|
7037
|
-
/** Remove the tenant's custom preview domain. */
|
|
7038
|
-
async delete() {
|
|
7039
|
-
await this.http.delete("/tenant/preview-domain");
|
|
7040
|
-
}
|
|
7041
|
-
};
|
|
7042
|
-
var Branding = class {
|
|
7043
|
-
constructor(http) {
|
|
7044
|
-
this.http = http;
|
|
7045
|
-
}
|
|
7046
|
-
http;
|
|
7047
|
-
/** Get tenant branding used by white-label hosted surfaces. */
|
|
7048
|
-
async get() {
|
|
7049
|
-
const data = await this.http.get("/tenant/branding");
|
|
7050
|
-
return unwrap41(data);
|
|
7051
|
-
}
|
|
7052
|
-
/** Update tenant branding used by white-label hosted surfaces. */
|
|
7053
|
-
async set(params) {
|
|
7054
|
-
const body = Object.fromEntries(
|
|
7055
|
-
Object.entries(params).filter(([, v]) => v !== void 0)
|
|
7056
|
-
);
|
|
7057
|
-
const data = await this.http.put("/tenant/branding", {
|
|
7058
|
-
branding: body
|
|
7059
|
-
});
|
|
7060
|
-
return unwrap41(data);
|
|
7061
|
-
}
|
|
7062
|
-
/** Reset tenant branding to platform defaults. */
|
|
7063
|
-
async delete() {
|
|
7064
|
-
await this.http.delete("/tenant/branding");
|
|
7065
|
-
}
|
|
7066
|
-
};
|
|
7067
7013
|
var Tenant = class {
|
|
7068
|
-
http;
|
|
7069
|
-
preview_domain;
|
|
7070
|
-
branding;
|
|
7071
|
-
/** camelCase alias for SDK consumers that avoid snake_case properties. */
|
|
7072
|
-
previewDomain;
|
|
7073
7014
|
constructor(http) {
|
|
7074
7015
|
this.http = http;
|
|
7075
|
-
this.preview_domain = new PreviewDomain(http);
|
|
7076
|
-
this.previewDomain = this.preview_domain;
|
|
7077
|
-
this.branding = new Branding(http);
|
|
7078
7016
|
}
|
|
7017
|
+
http;
|
|
7079
7018
|
/** Get the current tenant's plan, limits, and live usage counters. */
|
|
7080
7019
|
async current() {
|
|
7081
7020
|
const data = await this.http.get("/tenant/plan");
|
|
7082
7021
|
return unwrap41(data);
|
|
7083
7022
|
}
|
|
7084
|
-
/** Convenience alias for `tenant.branding.get()`. */
|
|
7085
|
-
async getBranding() {
|
|
7086
|
-
return this.branding.get();
|
|
7087
|
-
}
|
|
7088
|
-
/** Convenience alias for `tenant.branding.set(...)`. */
|
|
7089
|
-
async setBranding(params) {
|
|
7090
|
-
return this.branding.set(params);
|
|
7091
|
-
}
|
|
7092
|
-
/** Convenience alias for `tenant.branding.delete()`. */
|
|
7093
|
-
async deleteBranding() {
|
|
7094
|
-
await this.branding.delete();
|
|
7095
|
-
}
|
|
7096
7023
|
};
|
|
7097
7024
|
|
|
7098
7025
|
// src/resources/usage.ts
|
|
@@ -7105,7 +7032,7 @@ function unwrap42(payload) {
|
|
|
7105
7032
|
}
|
|
7106
7033
|
return payload;
|
|
7107
7034
|
}
|
|
7108
|
-
function
|
|
7035
|
+
function stripUndefined24(input) {
|
|
7109
7036
|
return Object.fromEntries(
|
|
7110
7037
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
7111
7038
|
);
|
|
@@ -7122,7 +7049,7 @@ var Usage = class {
|
|
|
7122
7049
|
}
|
|
7123
7050
|
/** List per-session metering events. */
|
|
7124
7051
|
async sessions(params = {}) {
|
|
7125
|
-
const query =
|
|
7052
|
+
const query = stripUndefined24(params);
|
|
7126
7053
|
const data = await this.http.get("/usage/sessions", query);
|
|
7127
7054
|
const result = unwrap42(data);
|
|
7128
7055
|
if (Array.isArray(result)) return result;
|
|
@@ -7130,7 +7057,7 @@ var Usage = class {
|
|
|
7130
7057
|
}
|
|
7131
7058
|
/** Get a usage report for a period. */
|
|
7132
7059
|
async report(params = {}) {
|
|
7133
|
-
const query =
|
|
7060
|
+
const query = stripUndefined24(params);
|
|
7134
7061
|
const data = await this.http.get("/usage/summary", query);
|
|
7135
7062
|
return unwrap42(data);
|
|
7136
7063
|
}
|
|
@@ -7151,7 +7078,7 @@ function listItems15(payload, candidateKeys = ["data", "volumes", "items"]) {
|
|
|
7151
7078
|
}
|
|
7152
7079
|
return [];
|
|
7153
7080
|
}
|
|
7154
|
-
function
|
|
7081
|
+
function stripUndefined25(input) {
|
|
7155
7082
|
return Object.fromEntries(
|
|
7156
7083
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
7157
7084
|
);
|
|
@@ -7165,7 +7092,7 @@ var Volumes = class {
|
|
|
7165
7092
|
}
|
|
7166
7093
|
http;
|
|
7167
7094
|
async list(params = {}) {
|
|
7168
|
-
const query =
|
|
7095
|
+
const query = stripUndefined25({ ...params });
|
|
7169
7096
|
const data = await this.http.get("/volumes", query);
|
|
7170
7097
|
return listItems15(data);
|
|
7171
7098
|
}
|
|
@@ -7175,7 +7102,7 @@ var Volumes = class {
|
|
|
7175
7102
|
}
|
|
7176
7103
|
async create(params) {
|
|
7177
7104
|
const { idempotencyKey: ikey, sizeGb, ...rest } = params;
|
|
7178
|
-
const body =
|
|
7105
|
+
const body = stripUndefined25({
|
|
7179
7106
|
...rest,
|
|
7180
7107
|
size_gb: sizeGb ?? rest.size_gb
|
|
7181
7108
|
});
|
|
@@ -7206,7 +7133,7 @@ function listItems16(payload, candidateKeys = ["data", "webhooks", "deliveries",
|
|
|
7206
7133
|
}
|
|
7207
7134
|
return [];
|
|
7208
7135
|
}
|
|
7209
|
-
function
|
|
7136
|
+
function stripUndefined26(input) {
|
|
7210
7137
|
return Object.fromEntries(
|
|
7211
7138
|
Object.entries(input).filter(([, v]) => v !== void 0)
|
|
7212
7139
|
);
|
|
@@ -7214,44 +7141,13 @@ function stripUndefined25(input) {
|
|
|
7214
7141
|
function idempotencyKey10(key) {
|
|
7215
7142
|
return key ?? randomUUID();
|
|
7216
7143
|
}
|
|
7217
|
-
function bodyBuffer(body) {
|
|
7218
|
-
if (Buffer.isBuffer(body)) return body;
|
|
7219
|
-
if (typeof body === "string") return Buffer.from(body, "utf8");
|
|
7220
|
-
return Buffer.from(body);
|
|
7221
|
-
}
|
|
7222
|
-
function verifySignature(body, header, secret, toleranceSec = 300) {
|
|
7223
|
-
const parts = Object.fromEntries(
|
|
7224
|
-
header.split(",").map((chunk) => chunk.split("=", 2)).filter(([key, value]) => key && value)
|
|
7225
|
-
);
|
|
7226
|
-
const timestamp = parts.t;
|
|
7227
|
-
const received = parts.v1;
|
|
7228
|
-
if (!timestamp || !received || !secret) return false;
|
|
7229
|
-
const unixSeconds = Number(timestamp);
|
|
7230
|
-
if (!Number.isFinite(unixSeconds)) return false;
|
|
7231
|
-
const ageSec = Math.abs(Date.now() / 1e3 - unixSeconds);
|
|
7232
|
-
if (ageSec > toleranceSec) {
|
|
7233
|
-
throw new Error("webhook timestamp too old");
|
|
7234
|
-
}
|
|
7235
|
-
const rawBody = bodyBuffer(body);
|
|
7236
|
-
const signed = Buffer.concat([Buffer.from(`${timestamp}.`), rawBody]);
|
|
7237
|
-
const expected = createHmac("sha256", secret).update(signed).digest("hex");
|
|
7238
|
-
try {
|
|
7239
|
-
return timingSafeEqual(
|
|
7240
|
-
Buffer.from(expected, "utf8"),
|
|
7241
|
-
Buffer.from(received, "utf8")
|
|
7242
|
-
);
|
|
7243
|
-
} catch {
|
|
7244
|
-
return false;
|
|
7245
|
-
}
|
|
7246
|
-
}
|
|
7247
7144
|
var Webhooks = class {
|
|
7248
7145
|
constructor(http) {
|
|
7249
7146
|
this.http = http;
|
|
7250
7147
|
}
|
|
7251
7148
|
http;
|
|
7252
|
-
static verifySignature = verifySignature;
|
|
7253
7149
|
async list(params = {}) {
|
|
7254
|
-
const query =
|
|
7150
|
+
const query = stripUndefined26({ ...params });
|
|
7255
7151
|
const data = await this.http.get("/webhooks", query);
|
|
7256
7152
|
return listItems16(data);
|
|
7257
7153
|
}
|
|
@@ -7261,7 +7157,7 @@ var Webhooks = class {
|
|
|
7261
7157
|
}
|
|
7262
7158
|
async create(params) {
|
|
7263
7159
|
const { idempotencyKey: ikey, ...rest } = params;
|
|
7264
|
-
const body =
|
|
7160
|
+
const body = stripUndefined26(rest);
|
|
7265
7161
|
const data = await this.http.request("/webhooks", {
|
|
7266
7162
|
method: "POST",
|
|
7267
7163
|
body,
|
|
@@ -7270,7 +7166,7 @@ var Webhooks = class {
|
|
|
7270
7166
|
return unwrap44(data);
|
|
7271
7167
|
}
|
|
7272
7168
|
async update(webhookId, params) {
|
|
7273
|
-
const body =
|
|
7169
|
+
const body = stripUndefined26(params);
|
|
7274
7170
|
const data = await this.http.patch(`/webhooks/${webhookId}`, body);
|
|
7275
7171
|
return unwrap44(data);
|
|
7276
7172
|
}
|
|
@@ -7456,6 +7352,8 @@ var DEFAULT_MAX_RETRIES2 = 3;
|
|
|
7456
7352
|
var Miosa = class {
|
|
7457
7353
|
/** Per-workspace user roster — list, add, update role, remove. */
|
|
7458
7354
|
workspaceMembers;
|
|
7355
|
+
/** Target-agnostic prompt dispatch to sandboxes/computers with durable records. */
|
|
7356
|
+
agentRuns;
|
|
7459
7357
|
/**
|
|
7460
7358
|
* Workspace invite flow — create invite, list, revoke, preview, accept.
|
|
7461
7359
|
* Sending to an email already in the org adds the user directly.
|
|
@@ -7578,6 +7476,7 @@ var Miosa = class {
|
|
|
7578
7476
|
timeout: config.timeout ?? DEFAULT_TIMEOUT2,
|
|
7579
7477
|
maxRetries: config.maxRetries ?? DEFAULT_MAX_RETRIES2
|
|
7580
7478
|
});
|
|
7479
|
+
this.agentRuns = new AgentRuns(this.http);
|
|
7581
7480
|
this.workspaceMembers = new WorkspaceMembers(this.http);
|
|
7582
7481
|
this.workspaceInvites = new WorkspaceInvites(this.http);
|
|
7583
7482
|
this.orgInvites = new OrgInvites(this.http);
|
|
@@ -7627,6 +7526,162 @@ var Miosa = class {
|
|
|
7627
7526
|
}
|
|
7628
7527
|
};
|
|
7629
7528
|
|
|
7630
|
-
|
|
7529
|
+
// src/resources/app-auth.ts
|
|
7530
|
+
function unwrapSession(data) {
|
|
7531
|
+
const d = data && typeof data === "object" && "data" in data ? data.data : data;
|
|
7532
|
+
const userId = d.user_id ?? d.userId;
|
|
7533
|
+
const token = d.token ?? d.access_token;
|
|
7534
|
+
const expiresAt = d.expires_at ?? d.expiresAt ?? "";
|
|
7535
|
+
if (!userId || !token) {
|
|
7536
|
+
throw new Error(
|
|
7537
|
+
`AppAuth: unexpected response shape \u2014 got: ${JSON.stringify(d)}`
|
|
7538
|
+
);
|
|
7539
|
+
}
|
|
7540
|
+
return {
|
|
7541
|
+
userId,
|
|
7542
|
+
token,
|
|
7543
|
+
expiresAt
|
|
7544
|
+
};
|
|
7545
|
+
}
|
|
7546
|
+
function base64UrlDecode(s) {
|
|
7547
|
+
const padded = s.replace(/-/g, "+").replace(/_/g, "/");
|
|
7548
|
+
const bin = atob(padded);
|
|
7549
|
+
const bytes = new Uint8Array(bin.length);
|
|
7550
|
+
for (let i = 0; i < bin.length; i++) {
|
|
7551
|
+
bytes[i] = bin.charCodeAt(i);
|
|
7552
|
+
}
|
|
7553
|
+
return bytes;
|
|
7554
|
+
}
|
|
7555
|
+
var AppAuth = class {
|
|
7556
|
+
baseUrl;
|
|
7557
|
+
resourceType;
|
|
7558
|
+
resourceId;
|
|
7559
|
+
jwtSecret;
|
|
7560
|
+
constructor(config) {
|
|
7561
|
+
const authUrl = config.authUrl ?? (typeof process !== "undefined" ? process.env["AUTH_URL"] : void 0);
|
|
7562
|
+
if (!authUrl) {
|
|
7563
|
+
throw new Error(
|
|
7564
|
+
"AppAuth: authUrl is required. Pass authUrl in config or set AUTH_URL env var."
|
|
7565
|
+
);
|
|
7566
|
+
}
|
|
7567
|
+
if (!config.resourceType || !config.resourceId) {
|
|
7568
|
+
throw new Error("AppAuth: resourceType and resourceId are required.");
|
|
7569
|
+
}
|
|
7570
|
+
this.baseUrl = authUrl.replace(/\/$/, "");
|
|
7571
|
+
this.resourceType = config.resourceType;
|
|
7572
|
+
this.resourceId = config.resourceId;
|
|
7573
|
+
this.jwtSecret = config.jwtSecret ?? (typeof process !== "undefined" ? process.env["AUTH_JWT_SECRET"] : void 0);
|
|
7574
|
+
}
|
|
7575
|
+
/** POST /app-auth/:resourceType/:resourceId/signup */
|
|
7576
|
+
async signup(email, password) {
|
|
7577
|
+
return unwrapSession(await this._post("signup", { email, password }));
|
|
7578
|
+
}
|
|
7579
|
+
/** POST /app-auth/:resourceType/:resourceId/login */
|
|
7580
|
+
async login(email, password) {
|
|
7581
|
+
return unwrapSession(await this._post("login", { email, password }));
|
|
7582
|
+
}
|
|
7583
|
+
/**
|
|
7584
|
+
* POST /app-auth/:resourceType/:resourceId/verify
|
|
7585
|
+
* Verifies an email confirmation or magic-link token issued by the backend.
|
|
7586
|
+
*/
|
|
7587
|
+
async verify(token) {
|
|
7588
|
+
return unwrapSession(await this._post("verify", { token }));
|
|
7589
|
+
}
|
|
7590
|
+
/** POST /app-auth/:resourceType/:resourceId/password-reset */
|
|
7591
|
+
async passwordReset(email) {
|
|
7592
|
+
const data = await this._post("password-reset", { email });
|
|
7593
|
+
return { ok: true, ...data };
|
|
7594
|
+
}
|
|
7595
|
+
/**
|
|
7596
|
+
* POST /app-auth/:resourceType/:resourceId/logout
|
|
7597
|
+
* Invalidates the given bearer token server-side.
|
|
7598
|
+
*/
|
|
7599
|
+
async logout(token) {
|
|
7600
|
+
const data = await this._post("logout", { token });
|
|
7601
|
+
return { ok: true, ...data };
|
|
7602
|
+
}
|
|
7603
|
+
/**
|
|
7604
|
+
* GET /app-auth/:resourceType/:resourceId/me
|
|
7605
|
+
* Returns the session for the bearer token.
|
|
7606
|
+
*/
|
|
7607
|
+
async me(token) {
|
|
7608
|
+
const url = `${this.baseUrl}/app-auth/${this.resourceType}/${this.resourceId}/me`;
|
|
7609
|
+
const resp = await fetch(url, {
|
|
7610
|
+
method: "GET",
|
|
7611
|
+
headers: {
|
|
7612
|
+
"Content-Type": "application/json",
|
|
7613
|
+
Authorization: `Bearer ${token}`
|
|
7614
|
+
}
|
|
7615
|
+
});
|
|
7616
|
+
if (!resp.ok) {
|
|
7617
|
+
const body = await resp.text();
|
|
7618
|
+
throw new Error(`AppAuth me failed (${resp.status}): ${body}`);
|
|
7619
|
+
}
|
|
7620
|
+
return unwrapSession(await resp.json());
|
|
7621
|
+
}
|
|
7622
|
+
/**
|
|
7623
|
+
* Verifies a JWT token locally using HS256 + AUTH_JWT_SECRET.
|
|
7624
|
+
*
|
|
7625
|
+
* Does NOT make a network call. Throws if the signature is invalid or the
|
|
7626
|
+
* token is expired. Returns the decoded payload on success.
|
|
7627
|
+
*/
|
|
7628
|
+
async verifyToken(token) {
|
|
7629
|
+
if (!this.jwtSecret) {
|
|
7630
|
+
throw new Error(
|
|
7631
|
+
"AppAuth.verifyToken: jwtSecret is required. Pass jwtSecret in config or set AUTH_JWT_SECRET env var."
|
|
7632
|
+
);
|
|
7633
|
+
}
|
|
7634
|
+
const parts = token.split(".");
|
|
7635
|
+
if (parts.length !== 3) {
|
|
7636
|
+
throw new Error("AppAuth.verifyToken: malformed JWT \u2014 expected 3 parts");
|
|
7637
|
+
}
|
|
7638
|
+
const [headerB64, payloadB64, signatureB64] = parts;
|
|
7639
|
+
const payloadJson = new TextDecoder().decode(base64UrlDecode(payloadB64));
|
|
7640
|
+
const payload = JSON.parse(payloadJson);
|
|
7641
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
7642
|
+
if (typeof payload.exp === "number" && payload.exp < now) {
|
|
7643
|
+
throw new Error(
|
|
7644
|
+
`AppAuth.verifyToken: token expired at ${new Date(payload.exp * 1e3).toISOString()}`
|
|
7645
|
+
);
|
|
7646
|
+
}
|
|
7647
|
+
const encoder = new TextEncoder();
|
|
7648
|
+
const signingInput = `${headerB64}.${payloadB64}`;
|
|
7649
|
+
const secretBytes = encoder.encode(this.jwtSecret);
|
|
7650
|
+
const key = await crypto.subtle.importKey(
|
|
7651
|
+
"raw",
|
|
7652
|
+
secretBytes,
|
|
7653
|
+
{ name: "HMAC", hash: "SHA-256" },
|
|
7654
|
+
false,
|
|
7655
|
+
["verify"]
|
|
7656
|
+
);
|
|
7657
|
+
const signatureBytes = base64UrlDecode(signatureB64).buffer;
|
|
7658
|
+
const valid = await crypto.subtle.verify(
|
|
7659
|
+
"HMAC",
|
|
7660
|
+
key,
|
|
7661
|
+
signatureBytes,
|
|
7662
|
+
encoder.encode(signingInput)
|
|
7663
|
+
);
|
|
7664
|
+
if (!valid) {
|
|
7665
|
+
throw new Error("AppAuth.verifyToken: invalid JWT signature");
|
|
7666
|
+
}
|
|
7667
|
+
return payload;
|
|
7668
|
+
}
|
|
7669
|
+
// ── Private ──────────────────────────────────────────────────────────────────
|
|
7670
|
+
async _post(action, body) {
|
|
7671
|
+
const url = `${this.baseUrl}/app-auth/${this.resourceType}/${this.resourceId}/${action}`;
|
|
7672
|
+
const resp = await fetch(url, {
|
|
7673
|
+
method: "POST",
|
|
7674
|
+
headers: { "Content-Type": "application/json" },
|
|
7675
|
+
body: JSON.stringify(body)
|
|
7676
|
+
});
|
|
7677
|
+
if (!resp.ok) {
|
|
7678
|
+
const text = await resp.text();
|
|
7679
|
+
throw new Error(`AppAuth ${action} failed (${resp.status}): ${text}`);
|
|
7680
|
+
}
|
|
7681
|
+
return resp.json();
|
|
7682
|
+
}
|
|
7683
|
+
};
|
|
7684
|
+
|
|
7685
|
+
export { Admin, AgentRuns, Analytics, ApiKeys, AppAuth, AuditLog, AuthError, Benchmarks, BuilderSessions, Channels, Checkpoints, CommandCenter, Community, Completions, Computer, ComputerAudit, ComputerAutoStop, ComputerEnv, ComputerInbox, ComputerLogs, ComputerNetwork, ComputerOsa, ComputerPorts, ComputerSecrets, ComputerTerminal, ComputerVolumes, Computers, Credits, CronJobs, Dashboard, Databases, DeploymentDomains, DeploymentReleases, DeploymentRuntimeInstances, DeploymentVersions, Deployments, Desktop, DockerDeploy, EgressAudit, EgressNetwork, EgressSecrets, Email, EmailCampaigns, EmailInbox, EmailTemplates, Embeddings, Exec, ExternalKeys, Files, FlatCustomDomains, Functions, HealthChecks, InsufficientCreditsError, Integrations, Mcp, Miosa, MiosaError, Models, NetworkError, NetworkPolicy, NotFoundError, OAuthFlow, OpenComputers, OrgInvites, ProjectAuth, ProjectIntegrations, ProviderDefaults, RateLimitError, Regions, SANDBOX_TEMPLATE, Sandbox, SandboxArtifacts, SandboxAudit, SandboxCommands, SandboxEnv, SandboxEvents, SandboxFiles, SandboxNetwork, SandboxPreview, SandboxPreviews, SandboxSecrets, SandboxTags, SandboxTemplates, SandboxTerminal, Sandboxes, ScopedFs, Settings, SnapshotsStandalone, Storage, Tenant, TimeoutError, Usage, ValidationError, Volumes, Webhooks, WorkspaceInvites, WorkspaceMembers };
|
|
7631
7686
|
//# sourceMappingURL=index.js.map
|
|
7632
7687
|
//# sourceMappingURL=index.js.map
|