@amodalai/amodal 0.3.89 → 0.3.90
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/CHANGELOG.md +33 -0
- package/dist/src/commands/build.d.ts +23 -5
- package/dist/src/commands/build.d.ts.map +1 -1
- package/dist/src/commands/build.js +52 -33
- package/dist/src/commands/build.js.map +1 -1
- package/dist/src/commands/chat.d.ts +1 -1
- package/dist/src/commands/chat.js +5 -5
- package/dist/src/commands/chat.js.map +1 -1
- package/dist/src/commands/serve.d.ts +2 -11
- package/dist/src/commands/serve.d.ts.map +1 -1
- package/dist/src/commands/serve.js +44 -87
- package/dist/src/commands/serve.js.map +1 -1
- package/dist/src/shared/platform-client.d.ts +6 -19
- package/dist/src/shared/platform-client.d.ts.map +1 -1
- package/dist/src/shared/platform-client.js +4 -21
- package/dist/src/shared/platform-client.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/commands/build.test.ts +14 -9
- package/src/commands/build.ts +72 -32
- package/src/commands/chat.ts +5 -5
- package/src/commands/serve.ts +46 -93
- package/src/e2e-commands.test.ts +18 -17
- package/src/shared/platform-client.test.ts +0 -36
- package/src/shared/platform-client.ts +10 -34
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type {DeploySnapshot} from '@amodalai/core';
|
|
8
7
|
import {readProjectLink} from '../commands/link.js';
|
|
9
8
|
import {readRcFile} from '../commands/login.js';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
|
-
* Metadata returned for a
|
|
11
|
+
* Metadata returned for a deployment by the platform API.
|
|
13
12
|
*/
|
|
14
|
-
export interface
|
|
13
|
+
export interface DeploymentMeta {
|
|
15
14
|
id: string;
|
|
16
15
|
environment: string;
|
|
17
16
|
isActive: boolean;
|
|
@@ -21,7 +20,6 @@ export interface SnapshotDeploymentMeta {
|
|
|
21
20
|
commitSha?: string;
|
|
22
21
|
branch?: string;
|
|
23
22
|
message?: string;
|
|
24
|
-
snapshotSize: number;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
/**
|
|
@@ -180,20 +178,6 @@ export class PlatformClient {
|
|
|
180
178
|
}
|
|
181
179
|
}
|
|
182
180
|
|
|
183
|
-
/**
|
|
184
|
-
* Upload a snapshot and deploy it.
|
|
185
|
-
*/
|
|
186
|
-
async uploadSnapshot(snapshot: DeploySnapshot, options: {
|
|
187
|
-
environment?: string;
|
|
188
|
-
appId?: string;
|
|
189
|
-
} = {}): Promise<SnapshotDeploymentMeta> {
|
|
190
|
-
return this.request<SnapshotDeploymentMeta>('POST', '/api/snapshot-deployments', {
|
|
191
|
-
snapshot,
|
|
192
|
-
environment: options.environment ?? 'production',
|
|
193
|
-
appId: options.appId,
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
|
|
197
181
|
/**
|
|
198
182
|
* Trigger a runtime-app build on the build server.
|
|
199
183
|
* Sends the repo tarball to the build server which builds the SPA and uploads to R2.
|
|
@@ -319,12 +303,12 @@ export class PlatformClient {
|
|
|
319
303
|
async listDeployments(options: {
|
|
320
304
|
environment?: string;
|
|
321
305
|
limit?: number;
|
|
322
|
-
} = {}): Promise<
|
|
306
|
+
} = {}): Promise<DeploymentMeta[]> {
|
|
323
307
|
const params = new URLSearchParams();
|
|
324
308
|
if (options.environment) params.set('environment', options.environment);
|
|
325
309
|
if (options.limit) params.set('limit', String(options.limit));
|
|
326
310
|
const qs = params.toString();
|
|
327
|
-
return this.request<
|
|
311
|
+
return this.request<DeploymentMeta[]>('GET', `/api/deployments${qs ? `?${qs}` : ''}`);
|
|
328
312
|
}
|
|
329
313
|
|
|
330
314
|
/**
|
|
@@ -333,8 +317,8 @@ export class PlatformClient {
|
|
|
333
317
|
async rollback(options: {
|
|
334
318
|
deployId?: string;
|
|
335
319
|
environment?: string;
|
|
336
|
-
} = {}): Promise<
|
|
337
|
-
return this.request<
|
|
320
|
+
} = {}): Promise<DeploymentMeta> {
|
|
321
|
+
return this.request<DeploymentMeta>('POST', '/api/deployments/rollback', {
|
|
338
322
|
deployId: options.deployId,
|
|
339
323
|
environment: options.environment ?? 'production',
|
|
340
324
|
});
|
|
@@ -343,8 +327,8 @@ export class PlatformClient {
|
|
|
343
327
|
/**
|
|
344
328
|
* Promote a deployment from one environment to another.
|
|
345
329
|
*/
|
|
346
|
-
async promote(fromEnv: string, toEnv: string = 'production'): Promise<
|
|
347
|
-
return this.request<
|
|
330
|
+
async promote(fromEnv: string, toEnv: string = 'production'): Promise<DeploymentMeta> {
|
|
331
|
+
return this.request<DeploymentMeta>('POST', '/api/deployments/promote', {
|
|
348
332
|
fromEnvironment: fromEnv,
|
|
349
333
|
toEnvironment: toEnv,
|
|
350
334
|
});
|
|
@@ -353,15 +337,7 @@ export class PlatformClient {
|
|
|
353
337
|
/**
|
|
354
338
|
* Get status of a specific deployment.
|
|
355
339
|
*/
|
|
356
|
-
async getStatus(deployId: string): Promise<
|
|
357
|
-
return this.request<
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* Get the active snapshot for an environment.
|
|
362
|
-
*/
|
|
363
|
-
async getActiveSnapshot(environment: string = 'production'): Promise<DeploySnapshot> {
|
|
364
|
-
const params = new URLSearchParams({environment});
|
|
365
|
-
return this.request<DeploySnapshot>('GET', `/api/snapshot-deployments/active?${params.toString()}`);
|
|
340
|
+
async getStatus(deployId: string): Promise<DeploymentMeta> {
|
|
341
|
+
return this.request<DeploymentMeta>('GET', `/api/deployments/${deployId}`);
|
|
366
342
|
}
|
|
367
343
|
}
|