@miosa/sdk 1.2.0 → 1.2.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.
- package/README.md +1 -1
- package/dist/index.d.ts +10 -18
- package/dist/index.js +8 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/resources/admin.ts +0 -11
- package/src/resources/api-keys.ts +0 -16
- package/src/resources/computer.ts +9 -4
- package/src/resources/custom_domains.ts +1 -1
- package/src/resources/sandboxes.test.ts +10 -7
- package/src/types.ts +5 -2
- package/src/resources/governance.test.ts +0 -355
- package/src/resources/governance.ts +0 -528
- package/src/resources/phase1.test.ts +0 -187
- package/src/resources/quotas.ts +0 -77
- package/src/resources/sandbox-processes.ts +0 -112
- package/src/resources/sandbox-shares.ts +0 -83
- package/src/resources/tenant-events.ts +0 -32
- package/src/resources/workspaces.ts +0 -285
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ console.log(result.stdout); // hello from miosa
|
|
|
38
38
|
|
|
39
39
|
// Expose a live preview URL
|
|
40
40
|
const url = await sbx.expose(3000);
|
|
41
|
-
console.log(url); // https://3000-<slug>.sandbox
|
|
41
|
+
console.log(url); // https://3000-<slug>.sandbox.<tenant-domain>
|
|
42
42
|
|
|
43
43
|
await sbx.destroy();
|
|
44
44
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -155,13 +155,6 @@ declare class Admin {
|
|
|
155
155
|
optimalStatus(): Promise<Json>;
|
|
156
156
|
listOptimalModels(): Promise<Json>;
|
|
157
157
|
switchOptimalModel(modelId: string): Promise<Json>;
|
|
158
|
-
/** POST /api/v1/admin/impersonate — returns {token, expires_at}. */
|
|
159
|
-
impersonate(externalUserId: string, options?: {
|
|
160
|
-
ttlSec?: number;
|
|
161
|
-
}): Promise<{
|
|
162
|
-
token: string;
|
|
163
|
-
expires_at: string;
|
|
164
|
-
}>;
|
|
165
158
|
}
|
|
166
159
|
|
|
167
160
|
/**
|
|
@@ -228,12 +221,6 @@ declare class ApiKeys {
|
|
|
228
221
|
constructor(http: HttpClient);
|
|
229
222
|
list(params?: ApiKeyListParams): Promise<ApiKeyData[]>;
|
|
230
223
|
create(params: ApiKeyCreateParams): Promise<ApiKeyCreateResult>;
|
|
231
|
-
/** POST /api/v1/api-keys/scoped — L2 delegation token bound to one external user. */
|
|
232
|
-
createScoped(params: {
|
|
233
|
-
externalUserId: string;
|
|
234
|
-
scopes: string[];
|
|
235
|
-
expiresAt?: string;
|
|
236
|
-
}): Promise<ApiKeyCreateResult>;
|
|
237
224
|
delete(keyId: string): Promise<void>;
|
|
238
225
|
}
|
|
239
226
|
|
|
@@ -652,7 +639,7 @@ interface CustomDomainData$1 {
|
|
|
652
639
|
* // 1. Register the domain
|
|
653
640
|
* const domain = await computer.domains.register("app.example.com");
|
|
654
641
|
* console.log(domain.instructions);
|
|
655
|
-
* // => "Add a CNAME record: app.example.com → <slug>.sandbox
|
|
642
|
+
* // => "Add a CNAME record: app.example.com → <slug>.sandbox.<tenant-domain>"
|
|
656
643
|
*
|
|
657
644
|
* // 2. Add the CNAME in your DNS registrar, then...
|
|
658
645
|
*
|
|
@@ -768,7 +755,8 @@ interface ComputerData {
|
|
|
768
755
|
id: ComputerId;
|
|
769
756
|
name: string;
|
|
770
757
|
/**
|
|
771
|
-
* URL-safe identifier used in preview URLs:
|
|
758
|
+
* URL-safe identifier used in preview URLs:
|
|
759
|
+
* `https://{port}-{slug}.sandbox.{preview_domain}`.
|
|
772
760
|
* Falls back to the computer id when no slug is assigned.
|
|
773
761
|
*/
|
|
774
762
|
slug: string;
|
|
@@ -780,8 +768,10 @@ interface ComputerData {
|
|
|
780
768
|
metadata: Record<string, string>;
|
|
781
769
|
/** Controls who can access the HTTP preview URL. Defaults to `"public"`. */
|
|
782
770
|
visibility: ComputerVisibility;
|
|
783
|
-
/** Public ingress root, e.g. `https://<slug>.sandbox
|
|
771
|
+
/** Public ingress root, e.g. `https://<slug>.sandbox.<preview_domain>`. */
|
|
784
772
|
sandbox_url?: string;
|
|
773
|
+
/** Tenant's white-label preview/base domain, e.g. `cliniciq.com`. */
|
|
774
|
+
preview_domain?: string;
|
|
785
775
|
/** KasmVNC URL for desktop templates. */
|
|
786
776
|
desktop_url?: string;
|
|
787
777
|
created_at: string;
|
|
@@ -2184,16 +2174,18 @@ declare class Computer {
|
|
|
2184
2174
|
* ```ts
|
|
2185
2175
|
* await computer.exec.bash("npm run dev &");
|
|
2186
2176
|
* const url = computer.previewUrl(3000);
|
|
2187
|
-
* // => https://3000-<slug>.sandbox
|
|
2177
|
+
* // => https://3000-<slug>.sandbox.<tenant-domain>
|
|
2188
2178
|
* ```
|
|
2189
2179
|
*
|
|
2190
2180
|
* Works for any TCP HTTP listener. Public (no auth required); anyone with
|
|
2191
2181
|
* the URL can see it. Served over the ingress proxy so it inherits the
|
|
2192
|
-
*
|
|
2182
|
+
* tenant's white-label preview domain — no per-sandbox certs to manage.
|
|
2193
2183
|
*/
|
|
2194
2184
|
previewUrl(port: number, path?: string): string;
|
|
2195
2185
|
/** Root preview URL — serves whatever is on the default app port. */
|
|
2196
2186
|
get publicUrl(): string;
|
|
2187
|
+
/** Tenant's preview/base domain, white-label aware. */
|
|
2188
|
+
get previewDomain(): string;
|
|
2197
2189
|
/** Start the computer. */
|
|
2198
2190
|
start(): Promise<Computer>;
|
|
2199
2191
|
/** Stop the computer. */
|
package/dist/index.js
CHANGED
|
@@ -592,13 +592,6 @@ var Admin = class {
|
|
|
592
592
|
model_id: modelId
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
|
-
/** POST /api/v1/admin/impersonate — returns {token, expires_at}. */
|
|
596
|
-
impersonate(externalUserId, options = {}) {
|
|
597
|
-
return this.http.post("/admin/impersonate", {
|
|
598
|
-
external_user_id: externalUserId,
|
|
599
|
-
ttl_sec: options.ttlSec ?? 3600
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
595
|
};
|
|
603
596
|
|
|
604
597
|
// src/resources/analytics.ts
|
|
@@ -681,17 +674,6 @@ var ApiKeys = class {
|
|
|
681
674
|
});
|
|
682
675
|
return unwrap2(data);
|
|
683
676
|
}
|
|
684
|
-
/** POST /api/v1/api-keys/scoped — L2 delegation token bound to one external user. */
|
|
685
|
-
async createScoped(params) {
|
|
686
|
-
const body = stripUndefined2({
|
|
687
|
-
external_user_id: params.externalUserId,
|
|
688
|
-
scopes: params.scopes,
|
|
689
|
-
expires_at: params.expiresAt
|
|
690
|
-
});
|
|
691
|
-
return unwrap2(
|
|
692
|
-
await this.http.post("/api-keys/scoped", body)
|
|
693
|
-
);
|
|
694
|
-
}
|
|
695
677
|
async delete(keyId) {
|
|
696
678
|
await this.http.delete(`/api-keys/${keyId}`);
|
|
697
679
|
}
|
|
@@ -3004,20 +2986,24 @@ var Computer = class _Computer {
|
|
|
3004
2986
|
* ```ts
|
|
3005
2987
|
* await computer.exec.bash("npm run dev &");
|
|
3006
2988
|
* const url = computer.previewUrl(3000);
|
|
3007
|
-
* // => https://3000-<slug>.sandbox
|
|
2989
|
+
* // => https://3000-<slug>.sandbox.<tenant-domain>
|
|
3008
2990
|
* ```
|
|
3009
2991
|
*
|
|
3010
2992
|
* Works for any TCP HTTP listener. Public (no auth required); anyone with
|
|
3011
2993
|
* the URL can see it. Served over the ingress proxy so it inherits the
|
|
3012
|
-
*
|
|
2994
|
+
* tenant's white-label preview domain — no per-sandbox certs to manage.
|
|
3013
2995
|
*/
|
|
3014
2996
|
previewUrl(port, path = "/") {
|
|
3015
2997
|
const p = path.startsWith("/") ? path : `/${path}`;
|
|
3016
|
-
return `https://${port}-${this.slug}.sandbox.
|
|
2998
|
+
return `https://${port}-${this.slug}.sandbox.${this.previewDomain}${p}`;
|
|
3017
2999
|
}
|
|
3018
3000
|
/** Root preview URL — serves whatever is on the default app port. */
|
|
3019
3001
|
get publicUrl() {
|
|
3020
|
-
return `https://${this.slug}.sandbox.
|
|
3002
|
+
return `https://${this.slug}.sandbox.${this.previewDomain}`;
|
|
3003
|
+
}
|
|
3004
|
+
/** Tenant's preview/base domain, white-label aware. */
|
|
3005
|
+
get previewDomain() {
|
|
3006
|
+
return this.data.preview_domain || "miosa.app";
|
|
3021
3007
|
}
|
|
3022
3008
|
// ─── Lifecycle ─────────────────────────────────────────────────────────────
|
|
3023
3009
|
/** Start the computer. */
|