@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.
Files changed (100) hide show
  1. package/README.md +75 -3
  2. package/dist/index.d.ts +323 -175
  3. package/dist/index.js +441 -386
  4. package/dist/index.js.map +1 -1
  5. package/package.json +1 -2
  6. package/src/client.ts +0 -293
  7. package/src/errors.ts +0 -136
  8. package/src/http.test.ts +0 -374
  9. package/src/http.ts +0 -390
  10. package/src/index.ts +0 -564
  11. package/src/resources/admin.ts +0 -359
  12. package/src/resources/analytics.ts +0 -60
  13. package/src/resources/api-keys.ts +0 -135
  14. package/src/resources/audit-log.ts +0 -64
  15. package/src/resources/benchmarks.ts +0 -104
  16. package/src/resources/builder-sessions.ts +0 -75
  17. package/src/resources/channels.ts +0 -143
  18. package/src/resources/checkpoints.ts +0 -225
  19. package/src/resources/command-center.ts +0 -73
  20. package/src/resources/community.ts +0 -103
  21. package/src/resources/completions.ts +0 -104
  22. package/src/resources/computer-auto-stop.ts +0 -43
  23. package/src/resources/computer-env.ts +0 -76
  24. package/src/resources/computer-logs.ts +0 -50
  25. package/src/resources/computer-osa.ts +0 -76
  26. package/src/resources/computer-ports.ts +0 -91
  27. package/src/resources/computer-terminal.ts +0 -61
  28. package/src/resources/computer-volumes.ts +0 -64
  29. package/src/resources/computer.ts +0 -551
  30. package/src/resources/computers.ts +0 -75
  31. package/src/resources/credits.ts +0 -43
  32. package/src/resources/cron-jobs.ts +0 -191
  33. package/src/resources/custom_domains.ts +0 -123
  34. package/src/resources/dashboard.ts +0 -49
  35. package/src/resources/databases.ts +0 -218
  36. package/src/resources/deployments.test.ts +0 -194
  37. package/src/resources/deployments.ts +0 -1060
  38. package/src/resources/desktop.ts +0 -134
  39. package/src/resources/docker-deploy.test.ts +0 -102
  40. package/src/resources/docker-deploy.ts +0 -183
  41. package/src/resources/egress.test.ts +0 -318
  42. package/src/resources/egressAudit.ts +0 -245
  43. package/src/resources/egressNetwork.ts +0 -450
  44. package/src/resources/egressSecrets.ts +0 -577
  45. package/src/resources/email.ts +0 -212
  46. package/src/resources/embeddings.ts +0 -36
  47. package/src/resources/events.ts +0 -296
  48. package/src/resources/exec.ts +0 -319
  49. package/src/resources/external-keys.ts +0 -79
  50. package/src/resources/files.test.ts +0 -339
  51. package/src/resources/files.ts +0 -220
  52. package/src/resources/flat-custom-domains.ts +0 -127
  53. package/src/resources/functions.ts +0 -178
  54. package/src/resources/governance.test.ts +0 -355
  55. package/src/resources/governance.ts +0 -528
  56. package/src/resources/health-checks.ts +0 -165
  57. package/src/resources/integrations.ts +0 -183
  58. package/src/resources/mcp.ts +0 -70
  59. package/src/resources/models.ts +0 -45
  60. package/src/resources/network_policy.ts +0 -73
  61. package/src/resources/open-computers/agents.ts +0 -91
  62. package/src/resources/open-computers/apps.ts +0 -102
  63. package/src/resources/open-computers/clusters.ts +0 -88
  64. package/src/resources/open-computers/desktop.ts +0 -34
  65. package/src/resources/open-computers/files.ts +0 -97
  66. package/src/resources/open-computers/hosts.ts +0 -85
  67. package/src/resources/open-computers/index.ts +0 -98
  68. package/src/resources/open-computers/jobs.ts +0 -75
  69. package/src/resources/open-computers/open_computers.test.ts +0 -288
  70. package/src/resources/open-computers/secrets.ts +0 -115
  71. package/src/resources/open-computers/terminal.ts +0 -33
  72. package/src/resources/open-computers/tunnels.ts +0 -87
  73. package/src/resources/open-computers/types.ts +0 -343
  74. package/src/resources/open-computers/workspaces.ts +0 -135
  75. package/src/resources/org-invites.ts +0 -189
  76. package/src/resources/phase1.test.ts +0 -187
  77. package/src/resources/project-auth.ts +0 -142
  78. package/src/resources/project-integrations.ts +0 -133
  79. package/src/resources/provider-defaults.ts +0 -89
  80. package/src/resources/quotas.ts +0 -77
  81. package/src/resources/regions.ts +0 -94
  82. package/src/resources/sandbox-processes.ts +0 -112
  83. package/src/resources/sandbox-shares.ts +0 -83
  84. package/src/resources/sandbox-templates.ts +0 -195
  85. package/src/resources/sandboxes.live.test.ts +0 -92
  86. package/src/resources/sandboxes.test.ts +0 -653
  87. package/src/resources/sandboxes.ts +0 -1433
  88. package/src/resources/settings.ts +0 -143
  89. package/src/resources/snapshots-standalone.ts +0 -51
  90. package/src/resources/storage.ts +0 -221
  91. package/src/resources/tenant-events.ts +0 -32
  92. package/src/resources/tenant.ts +0 -148
  93. package/src/resources/usage.ts +0 -85
  94. package/src/resources/volumes.ts +0 -117
  95. package/src/resources/webhooks.ts +0 -224
  96. package/src/resources/workspace-invites.ts +0 -188
  97. package/src/resources/workspace-members.test.ts +0 -121
  98. package/src/resources/workspace-members.ts +0 -143
  99. package/src/resources/workspaces.ts +0 -285
  100. package/src/types.ts +0 -463
@@ -1,194 +0,0 @@
1
- import { beforeEach, describe, expect, it, vi } from "vitest";
2
- import type { HttpClient } from "../http.js";
3
- import { Deployments } from "./deployments.js";
4
-
5
- const mockRequest = vi.fn();
6
- const mockGet = vi.fn();
7
-
8
- function makeHttp(): HttpClient {
9
- const http = {} as HttpClient;
10
- http.request = mockRequest;
11
- http.get = mockGet;
12
- return http;
13
- }
14
-
15
- beforeEach(() => {
16
- vi.clearAllMocks();
17
- vi.unstubAllGlobals();
18
- });
19
-
20
- describe("Deployments", () => {
21
- it("createDockerDeploy() marks the deployment for Docker Deploy", async () => {
22
- mockRequest.mockResolvedValue({
23
- data: {
24
- id: "dep_123",
25
- tenant_id: "ten_123",
26
- name: "Clinic Intake",
27
- slug: "clinic-intake",
28
- state: "pending",
29
- deployment_product: "docker_deploy",
30
- docker_deploy_host_id: "ddh_123",
31
- metadata: { deployment_product: "docker_deploy", client: "clinic-iq" },
32
- },
33
- });
34
-
35
- const deployment = await new Deployments(makeHttp()).createDockerDeploy({
36
- name: "Clinic Intake",
37
- repoUrl: "https://github.com/clinic-iq/intake",
38
- externalWorkspaceId: "dr-smith",
39
- externalProjectId: "lead-magnet",
40
- metadata: { client: "clinic-iq" },
41
- idempotencyKey: "idem-123",
42
- });
43
-
44
- expect(mockRequest).toHaveBeenCalledWith("/deployments", {
45
- method: "POST",
46
- body: {
47
- name: "Clinic Intake",
48
- repo_url: "https://github.com/clinic-iq/intake",
49
- metadata: { client: "clinic-iq", deployment_product: "docker_deploy" },
50
- external_workspace_id: "dr-smith",
51
- external_project_id: "lead-magnet",
52
- },
53
- headers: { "Idempotency-Key": "idem-123" },
54
- });
55
- expect(deployment.deployment_product).toBe("docker_deploy");
56
- expect(deployment.docker_deploy_host_id).toBe("ddh_123");
57
- });
58
-
59
- it("doctorDockerDeploy verifies host, route metadata, and public URL", async () => {
60
- mockGet.mockImplementation(async (path: string) => {
61
- if (path === "/deployments/dep_123") {
62
- return {
63
- data: {
64
- id: "dep_123",
65
- tenant_id: "ten_123",
66
- name: "Clinic Intake",
67
- slug: "clinic-intake",
68
- state: "running",
69
- deployment_product: "docker_deploy",
70
- docker_deploy_host_id: "ddh_123",
71
- public_url: "https://clinic-intake.osa.miosa.app",
72
- metadata: {
73
- deployment_product: "docker_deploy",
74
- runtime: { ip: "172.16.74.246", port: 23906 },
75
- docker_deploy: {
76
- app_id: "miosa-clinic-intake",
77
- container_id: "container_123",
78
- status: "running",
79
- url: "http://127.0.0.1:23906",
80
- },
81
- },
82
- },
83
- };
84
- }
85
-
86
- if (path === "/docker-deploy/hosts/ddh_123") {
87
- return {
88
- data: {
89
- id: "ddh_123",
90
- tenant_id: "ten_123",
91
- workspace_id: "ws_123",
92
- status: "active",
93
- size: "medium",
94
- region: "us",
95
- appliance_status: "healthy",
96
- },
97
- };
98
- }
99
-
100
- throw new Error(`unexpected path ${path}`);
101
- });
102
- vi.stubGlobal(
103
- "fetch",
104
- vi.fn().mockResolvedValue({ ok: true, status: 200 }),
105
- );
106
-
107
- const result = await new Deployments(makeHttp()).doctorDockerDeploy(
108
- "dep_123",
109
- { probePath: "/health" },
110
- );
111
-
112
- expect(result.ok).toBe(true);
113
- expect(mockGet).toHaveBeenCalledWith("/deployments/dep_123");
114
- expect(mockGet).toHaveBeenCalledWith("/docker-deploy/hosts/ddh_123");
115
- expect(fetch).toHaveBeenCalledWith(
116
- "https://clinic-intake.osa.miosa.app/health",
117
- expect.objectContaining({ method: "GET" }),
118
- );
119
- expect(result.checks.map((check) => check.name)).toEqual([
120
- "deployment_product",
121
- "docker_deploy_host_id",
122
- "docker_deploy_host_health",
123
- "docker_deploy_app",
124
- "runtime_route",
125
- "public_url_probe",
126
- ]);
127
- });
128
-
129
- it("doctorDockerDeploy fails when route metadata does not point at the Docker container port", async () => {
130
- mockGet.mockImplementation(async (path: string) => {
131
- if (path === "/deployments/dep_123") {
132
- return {
133
- data: {
134
- id: "dep_123",
135
- tenant_id: "ten_123",
136
- name: "Clinic Intake",
137
- slug: "clinic-intake",
138
- state: "running",
139
- deployment_product: "docker_deploy",
140
- docker_deploy_host_id: "ddh_123",
141
- public_url: "https://clinic-intake.osa.miosa.app",
142
- metadata: {
143
- deployment_product: "docker_deploy",
144
- runtime: { ip: "172.16.74.246", port: 8080 },
145
- docker_deploy: {
146
- app_id: "miosa-clinic-intake",
147
- container_id: "container_123",
148
- status: "running",
149
- url: "http://127.0.0.1:23906",
150
- },
151
- },
152
- },
153
- };
154
- }
155
-
156
- if (path === "/docker-deploy/hosts/ddh_123") {
157
- return {
158
- data: {
159
- id: "ddh_123",
160
- tenant_id: "ten_123",
161
- workspace_id: "ws_123",
162
- status: "active",
163
- size: "medium",
164
- region: "us",
165
- appliance_status: "healthy",
166
- },
167
- };
168
- }
169
-
170
- throw new Error(`unexpected path ${path}`);
171
- });
172
- vi.stubGlobal(
173
- "fetch",
174
- vi.fn().mockResolvedValue({ ok: true, status: 200 }),
175
- );
176
-
177
- const result = await new Deployments(makeHttp()).doctorDockerDeploy(
178
- "dep_123",
179
- { probePath: "/health" },
180
- );
181
-
182
- expect(result.ok).toBe(false);
183
- expect(result.checks).toEqual(
184
- expect.arrayContaining([
185
- expect.objectContaining({
186
- name: "runtime_route",
187
- ok: false,
188
- message:
189
- "Deployment route port 8080 does not match Docker container host port 23906.",
190
- }),
191
- ]),
192
- );
193
- });
194
- });