@lizard-build/sdk 0.1.62 → 0.1.63
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/dist/index.d.mts +31 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +19 -0
- package/dist/index.mjs +19 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -124,6 +124,10 @@ declare class AddonsAPI {
|
|
|
124
124
|
pause(projectId: string, addonId: string): Promise<PauseState>;
|
|
125
125
|
/** Resume a paused database: same host, port, password and data. */
|
|
126
126
|
resume(projectId: string, addonId: string): Promise<PauseState>;
|
|
127
|
+
/** Serverless setting of a database (Postgres, Redis). */
|
|
128
|
+
getSleep(projectId: string, addonId: string): Promise<SleepSetting>;
|
|
129
|
+
/** Make a database serverless (sleep when idle, wake on the next connection) or always on. */
|
|
130
|
+
setSleep(projectId: string, addonId: string, opts: SleepOpts): Promise<SleepSetting>;
|
|
127
131
|
rename(projectId: string, addonId: string, name: string): Promise<unknown>;
|
|
128
132
|
secrets(projectId: string, addonId: string): Promise<Array<{
|
|
129
133
|
key: string;
|
|
@@ -157,6 +161,26 @@ interface PauseResult {
|
|
|
157
161
|
reason: string;
|
|
158
162
|
}>;
|
|
159
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Serverless ("sleep when idle"): after `idleMinutes` with no traffic the service sleeps with
|
|
166
|
+
* its memory saved, and the next request or connection wakes it in about a second.
|
|
167
|
+
*/
|
|
168
|
+
interface SleepSetting {
|
|
169
|
+
enabled: boolean;
|
|
170
|
+
idleMinutes: number;
|
|
171
|
+
lastSleptAt: number | null;
|
|
172
|
+
lastWokeAt: number | null;
|
|
173
|
+
lastError: string | null;
|
|
174
|
+
sleeps: number;
|
|
175
|
+
wakes: number;
|
|
176
|
+
/** On a change: whether the service restarted to apply it. */
|
|
177
|
+
restarted?: boolean;
|
|
178
|
+
}
|
|
179
|
+
/** Turn serverless on (`idleMinutes` 5-1440, default 15) or off. */
|
|
180
|
+
interface SleepOpts {
|
|
181
|
+
enabled: boolean;
|
|
182
|
+
idleMinutes?: number;
|
|
183
|
+
}
|
|
160
184
|
/** What pausing or resuming one service answers. */
|
|
161
185
|
interface PauseState {
|
|
162
186
|
ok: boolean;
|
|
@@ -363,6 +387,13 @@ declare class ServicesAPI {
|
|
|
363
387
|
pause(id: string): Promise<PauseState>;
|
|
364
388
|
/** Resume a paused service: it starts again from the same image, with its data. */
|
|
365
389
|
resume(id: string): Promise<PauseState>;
|
|
390
|
+
/** Serverless setting of a service: whether it sleeps when idle, and how often it did. */
|
|
391
|
+
getSleep(id: string): Promise<SleepSetting>;
|
|
392
|
+
/**
|
|
393
|
+
* Make a service serverless (sleep when idle, wake in about a second on the next request) or
|
|
394
|
+
* always on. Turning it on restarts it once. Needs one replica and a port.
|
|
395
|
+
*/
|
|
396
|
+
setSleep(id: string, opts: SleepOpts): Promise<SleepSetting>;
|
|
366
397
|
/** Scale a service. */
|
|
367
398
|
scale(id: string, opts: ScaleOpts): Promise<void>;
|
|
368
399
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -124,6 +124,10 @@ declare class AddonsAPI {
|
|
|
124
124
|
pause(projectId: string, addonId: string): Promise<PauseState>;
|
|
125
125
|
/** Resume a paused database: same host, port, password and data. */
|
|
126
126
|
resume(projectId: string, addonId: string): Promise<PauseState>;
|
|
127
|
+
/** Serverless setting of a database (Postgres, Redis). */
|
|
128
|
+
getSleep(projectId: string, addonId: string): Promise<SleepSetting>;
|
|
129
|
+
/** Make a database serverless (sleep when idle, wake on the next connection) or always on. */
|
|
130
|
+
setSleep(projectId: string, addonId: string, opts: SleepOpts): Promise<SleepSetting>;
|
|
127
131
|
rename(projectId: string, addonId: string, name: string): Promise<unknown>;
|
|
128
132
|
secrets(projectId: string, addonId: string): Promise<Array<{
|
|
129
133
|
key: string;
|
|
@@ -157,6 +161,26 @@ interface PauseResult {
|
|
|
157
161
|
reason: string;
|
|
158
162
|
}>;
|
|
159
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Serverless ("sleep when idle"): after `idleMinutes` with no traffic the service sleeps with
|
|
166
|
+
* its memory saved, and the next request or connection wakes it in about a second.
|
|
167
|
+
*/
|
|
168
|
+
interface SleepSetting {
|
|
169
|
+
enabled: boolean;
|
|
170
|
+
idleMinutes: number;
|
|
171
|
+
lastSleptAt: number | null;
|
|
172
|
+
lastWokeAt: number | null;
|
|
173
|
+
lastError: string | null;
|
|
174
|
+
sleeps: number;
|
|
175
|
+
wakes: number;
|
|
176
|
+
/** On a change: whether the service restarted to apply it. */
|
|
177
|
+
restarted?: boolean;
|
|
178
|
+
}
|
|
179
|
+
/** Turn serverless on (`idleMinutes` 5-1440, default 15) or off. */
|
|
180
|
+
interface SleepOpts {
|
|
181
|
+
enabled: boolean;
|
|
182
|
+
idleMinutes?: number;
|
|
183
|
+
}
|
|
160
184
|
/** What pausing or resuming one service answers. */
|
|
161
185
|
interface PauseState {
|
|
162
186
|
ok: boolean;
|
|
@@ -363,6 +387,13 @@ declare class ServicesAPI {
|
|
|
363
387
|
pause(id: string): Promise<PauseState>;
|
|
364
388
|
/** Resume a paused service: it starts again from the same image, with its data. */
|
|
365
389
|
resume(id: string): Promise<PauseState>;
|
|
390
|
+
/** Serverless setting of a service: whether it sleeps when idle, and how often it did. */
|
|
391
|
+
getSleep(id: string): Promise<SleepSetting>;
|
|
392
|
+
/**
|
|
393
|
+
* Make a service serverless (sleep when idle, wake in about a second on the next request) or
|
|
394
|
+
* always on. Turning it on restarts it once. Needs one replica and a port.
|
|
395
|
+
*/
|
|
396
|
+
setSleep(id: string, opts: SleepOpts): Promise<SleepSetting>;
|
|
366
397
|
/** Scale a service. */
|
|
367
398
|
scale(id: string, opts: ScaleOpts): Promise<void>;
|
|
368
399
|
/**
|
package/dist/index.js
CHANGED
|
@@ -418,6 +418,17 @@ var ServicesAPI = class {
|
|
|
418
418
|
resume(id) {
|
|
419
419
|
return this.client.post(`/api/apps/${id}/resume`, {});
|
|
420
420
|
}
|
|
421
|
+
/** Serverless setting of a service: whether it sleeps when idle, and how often it did. */
|
|
422
|
+
getSleep(id) {
|
|
423
|
+
return this.client.get(`/api/apps/${id}/sleep`);
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Make a service serverless (sleep when idle, wake in about a second on the next request) or
|
|
427
|
+
* always on. Turning it on restarts it once. Needs one replica and a port.
|
|
428
|
+
*/
|
|
429
|
+
setSleep(id, opts) {
|
|
430
|
+
return this.client.put(`/api/apps/${id}/sleep`, opts);
|
|
431
|
+
}
|
|
421
432
|
/** Scale a service. */
|
|
422
433
|
async scale(id, opts) {
|
|
423
434
|
if (opts.storageMi !== void 0) throw new LizardError("Storage scaling is only supported for addons");
|
|
@@ -1506,6 +1517,14 @@ var AddonsAPI = class {
|
|
|
1506
1517
|
resume(projectId, addonId) {
|
|
1507
1518
|
return this.client.post(`/api/projects/${projectId}/addons/${addonId}/resume`, {});
|
|
1508
1519
|
}
|
|
1520
|
+
/** Serverless setting of a database (Postgres, Redis). */
|
|
1521
|
+
getSleep(projectId, addonId) {
|
|
1522
|
+
return this.client.get(`/api/projects/${projectId}/addons/${addonId}/sleep`);
|
|
1523
|
+
}
|
|
1524
|
+
/** Make a database serverless (sleep when idle, wake on the next connection) or always on. */
|
|
1525
|
+
setSleep(projectId, addonId, opts) {
|
|
1526
|
+
return this.client.put(`/api/projects/${projectId}/addons/${addonId}/sleep`, opts);
|
|
1527
|
+
}
|
|
1509
1528
|
rename(projectId, addonId, name) {
|
|
1510
1529
|
return this.client.patch(`/api/projects/${projectId}/addons/${addonId}`, { name });
|
|
1511
1530
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -365,6 +365,17 @@ var ServicesAPI = class {
|
|
|
365
365
|
resume(id) {
|
|
366
366
|
return this.client.post(`/api/apps/${id}/resume`, {});
|
|
367
367
|
}
|
|
368
|
+
/** Serverless setting of a service: whether it sleeps when idle, and how often it did. */
|
|
369
|
+
getSleep(id) {
|
|
370
|
+
return this.client.get(`/api/apps/${id}/sleep`);
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Make a service serverless (sleep when idle, wake in about a second on the next request) or
|
|
374
|
+
* always on. Turning it on restarts it once. Needs one replica and a port.
|
|
375
|
+
*/
|
|
376
|
+
setSleep(id, opts) {
|
|
377
|
+
return this.client.put(`/api/apps/${id}/sleep`, opts);
|
|
378
|
+
}
|
|
368
379
|
/** Scale a service. */
|
|
369
380
|
async scale(id, opts) {
|
|
370
381
|
if (opts.storageMi !== void 0) throw new LizardError("Storage scaling is only supported for addons");
|
|
@@ -1453,6 +1464,14 @@ var AddonsAPI = class {
|
|
|
1453
1464
|
resume(projectId, addonId) {
|
|
1454
1465
|
return this.client.post(`/api/projects/${projectId}/addons/${addonId}/resume`, {});
|
|
1455
1466
|
}
|
|
1467
|
+
/** Serverless setting of a database (Postgres, Redis). */
|
|
1468
|
+
getSleep(projectId, addonId) {
|
|
1469
|
+
return this.client.get(`/api/projects/${projectId}/addons/${addonId}/sleep`);
|
|
1470
|
+
}
|
|
1471
|
+
/** Make a database serverless (sleep when idle, wake on the next connection) or always on. */
|
|
1472
|
+
setSleep(projectId, addonId, opts) {
|
|
1473
|
+
return this.client.put(`/api/projects/${projectId}/addons/${addonId}/sleep`, opts);
|
|
1474
|
+
}
|
|
1456
1475
|
rename(projectId, addonId, name) {
|
|
1457
1476
|
return this.client.patch(`/api/projects/${projectId}/addons/${addonId}`, { name });
|
|
1458
1477
|
}
|
package/package.json
CHANGED