@sylphx/management 0.1.0
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 +138 -0
- package/dist/client.d.ts +41 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +91 -0
- package/dist/errors.d.ts +9 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +12 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/request.d.ts +5 -0
- package/dist/request.d.ts.map +1 -0
- package/dist/request.js +1 -0
- package/dist/resources/config.d.ts +30 -0
- package/dist/resources/config.d.ts.map +1 -0
- package/dist/resources/config.js +62 -0
- package/dist/resources/databases.d.ts +26 -0
- package/dist/resources/databases.d.ts.map +1 -0
- package/dist/resources/databases.js +29 -0
- package/dist/resources/deployments.d.ts +24 -0
- package/dist/resources/deployments.d.ts.map +1 -0
- package/dist/resources/deployments.js +30 -0
- package/dist/resources/domains.d.ts +30 -0
- package/dist/resources/domains.d.ts.map +1 -0
- package/dist/resources/domains.js +46 -0
- package/dist/resources/env-vars.d.ts +19 -0
- package/dist/resources/env-vars.d.ts.map +1 -0
- package/dist/resources/env-vars.js +30 -0
- package/dist/resources/environments.d.ts +16 -0
- package/dist/resources/environments.d.ts.map +1 -0
- package/dist/resources/environments.js +24 -0
- package/dist/resources/logs.d.ts +13 -0
- package/dist/resources/logs.d.ts.map +1 -0
- package/dist/resources/logs.js +20 -0
- package/dist/resources/org.d.ts +15 -0
- package/dist/resources/org.d.ts.map +1 -0
- package/dist/resources/org.js +25 -0
- package/dist/resources/projects.d.ts +19 -0
- package/dist/resources/projects.d.ts.map +1 -0
- package/dist/resources/projects.js +19 -0
- package/dist/resources/resources.d.ts +26 -0
- package/dist/resources/resources.d.ts.map +1 -0
- package/dist/resources/resources.js +32 -0
- package/dist/resources/services.d.ts +21 -0
- package/dist/resources/services.d.ts.map +1 -0
- package/dist/resources/services.js +30 -0
- package/dist/resources/storage.d.ts +21 -0
- package/dist/resources/storage.d.ts.map +1 -0
- package/dist/resources/storage.js +25 -0
- package/dist/resources/tasks.d.ts +42 -0
- package/dist/resources/tasks.d.ts.map +1 -0
- package/dist/resources/tasks.js +49 -0
- package/dist/resources/user.d.ts +9 -0
- package/dist/resources/user.d.ts.map +1 -0
- package/dist/resources/user.js +10 -0
- package/dist/resources/volumes.d.ts +20 -0
- package/dist/resources/volumes.d.ts.map +1 -0
- package/dist/resources/volumes.js +19 -0
- package/dist/types.d.ts +269 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/package.json +32 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export class DomainsResource {
|
|
2
|
+
request;
|
|
3
|
+
constructor(request) {
|
|
4
|
+
this.request = request;
|
|
5
|
+
}
|
|
6
|
+
/** List all apex domains for a project environment */
|
|
7
|
+
async list(projectId, envType = 'production') {
|
|
8
|
+
return this.request('GET', `/projects/${projectId}/domains`, {
|
|
9
|
+
query: { envType },
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/** Register an apex domain for a project (full domain object with DNS records) */
|
|
13
|
+
async create(projectId, apexDomain, envType = 'production') {
|
|
14
|
+
return this.request('POST', `/projects/${projectId}/domains`, {
|
|
15
|
+
body: { apexDomain, envType },
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/** Add a hostname binding to an existing domain */
|
|
19
|
+
async addHostname(projectId, domainId, hostname, opts) {
|
|
20
|
+
const { envType = 'production', ...bodyOpts } = opts ?? {};
|
|
21
|
+
return this.request('POST', `/projects/${projectId}/domains/${domainId}/hostnames`, {
|
|
22
|
+
query: { envType },
|
|
23
|
+
body: { hostname, ...bodyOpts },
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** Remove a hostname binding */
|
|
27
|
+
async removeHostname(projectId, domainId, hostnameId) {
|
|
28
|
+
return this.request('DELETE', `/projects/${projectId}/domains/${domainId}/hostnames/${hostnameId}`);
|
|
29
|
+
}
|
|
30
|
+
/** Trigger DNS check for a hostname */
|
|
31
|
+
async checkHostname(projectId, domainId, hostnameId) {
|
|
32
|
+
return this.request('POST', `/projects/${projectId}/domains/${domainId}/hostnames/${hostnameId}/check`);
|
|
33
|
+
}
|
|
34
|
+
/** Enable email sending for a domain (generates DKIM keypair) */
|
|
35
|
+
async enableEmail(projectId, domainId, opts) {
|
|
36
|
+
return this.request('POST', `/projects/${projectId}/domains/${domainId}/email`, { body: opts ?? {} });
|
|
37
|
+
}
|
|
38
|
+
/** Check DKIM DNS propagation and load into Stalwart */
|
|
39
|
+
async checkEmail(projectId, domainId) {
|
|
40
|
+
return this.request('POST', `/projects/${projectId}/domains/${domainId}/email/check`);
|
|
41
|
+
}
|
|
42
|
+
/** Disable email sending for a domain */
|
|
43
|
+
async disableEmail(projectId, domainId) {
|
|
44
|
+
return this.request('DELETE', `/projects/${projectId}/domains/${domainId}/email`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RequestFn } from '../request.js';
|
|
2
|
+
import type { EnvVar } from '../types.js';
|
|
3
|
+
export declare class EnvVarsResource {
|
|
4
|
+
private readonly request;
|
|
5
|
+
constructor(request: RequestFn);
|
|
6
|
+
/** List env vars for a project environment */
|
|
7
|
+
list(projectId: string, envType: string): Promise<EnvVar[]>;
|
|
8
|
+
/** Set a single env var for a project environment */
|
|
9
|
+
set(projectId: string, key: string, value: string, envType: string, secret?: boolean): Promise<void>;
|
|
10
|
+
/** Batch-set env vars for a project environment */
|
|
11
|
+
setMany(projectId: string, vars: Array<{
|
|
12
|
+
key: string;
|
|
13
|
+
value: string;
|
|
14
|
+
secret?: boolean;
|
|
15
|
+
}>, envType: string): Promise<void>;
|
|
16
|
+
/** Delete an env var for a project environment */
|
|
17
|
+
delete(projectId: string, key: string, envType: string): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=env-vars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-vars.d.ts","sourceRoot":"","sources":["../../src/resources/env-vars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,qBAAa,eAAe;IACf,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,SAAS;IAE/C,8CAA8C;IACxC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IASjE,qDAAqD;IAC/C,GAAG,CACR,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO,GACd,OAAO,CAAC,IAAI,CAAC;IAShB,mDAAmD;IAC7C,OAAO,CACZ,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,EAC7D,OAAO,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;IAMhB,kDAAkD;IAC5C,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAO5E"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class EnvVarsResource {
|
|
2
|
+
request;
|
|
3
|
+
constructor(request) {
|
|
4
|
+
this.request = request;
|
|
5
|
+
}
|
|
6
|
+
/** List env vars for a project environment */
|
|
7
|
+
async list(projectId, envType) {
|
|
8
|
+
const res = await this.request('GET', `/projects/${projectId}/env-vars`, { query: { envType } });
|
|
9
|
+
return Array.isArray(res) ? res : (res.data ?? []);
|
|
10
|
+
}
|
|
11
|
+
/** Set a single env var for a project environment */
|
|
12
|
+
async set(projectId, key, value, envType, secret) {
|
|
13
|
+
return this.request('POST', `/projects/${projectId}/env-vars`, {
|
|
14
|
+
body: {
|
|
15
|
+
envType,
|
|
16
|
+
vars: [{ key, value, secret: secret ?? false }],
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/** Batch-set env vars for a project environment */
|
|
21
|
+
async setMany(projectId, vars, envType) {
|
|
22
|
+
return this.request('POST', `/projects/${projectId}/env-vars`, {
|
|
23
|
+
body: { envType, vars },
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** Delete an env var for a project environment */
|
|
27
|
+
async delete(projectId, key, envType) {
|
|
28
|
+
return this.request('DELETE', `/projects/${projectId}/env-vars/${encodeURIComponent(key)}`, { query: { envType } });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { RequestFn } from '../request.js';
|
|
2
|
+
import type { Environment, PromoteResult } from '../types.js';
|
|
3
|
+
export declare class EnvironmentsResource {
|
|
4
|
+
private readonly request;
|
|
5
|
+
constructor(request: RequestFn);
|
|
6
|
+
/** List environments for a project */
|
|
7
|
+
list(projectId: string): Promise<Environment[]>;
|
|
8
|
+
/**
|
|
9
|
+
* Resolve an environment type string (e.g. "production") → its envId for the given project.
|
|
10
|
+
* Returns null if not found.
|
|
11
|
+
*/
|
|
12
|
+
resolveId(projectId: string, envType: string): Promise<string | null>;
|
|
13
|
+
/** Promote an environment (e.g. staging → production). */
|
|
14
|
+
promote(projectId: string, targetEnvId: string, sourceEnvId: string): Promise<PromoteResult>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=environments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environments.d.ts","sourceRoot":"","sources":["../../src/resources/environments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE7D,qBAAa,oBAAoB;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,SAAS;IAE/C,sCAAsC;IAChC,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAQrD;;;OAGG;IACG,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAM3E,0DAA0D;IACpD,OAAO,CACZ,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,aAAa,CAAC;CAOzB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export class EnvironmentsResource {
|
|
2
|
+
request;
|
|
3
|
+
constructor(request) {
|
|
4
|
+
this.request = request;
|
|
5
|
+
}
|
|
6
|
+
/** List environments for a project */
|
|
7
|
+
async list(projectId) {
|
|
8
|
+
const res = await this.request('GET', `/projects/${encodeURIComponent(projectId)}/environments`);
|
|
9
|
+
return Array.isArray(res) ? res : (res.data ?? []);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Resolve an environment type string (e.g. "production") → its envId for the given project.
|
|
13
|
+
* Returns null if not found.
|
|
14
|
+
*/
|
|
15
|
+
async resolveId(projectId, envType) {
|
|
16
|
+
const envs = await this.list(projectId);
|
|
17
|
+
const match = envs.find((e) => (e.envType ?? '').toLowerCase() === envType.toLowerCase());
|
|
18
|
+
return match?.id ?? null;
|
|
19
|
+
}
|
|
20
|
+
/** Promote an environment (e.g. staging → production). */
|
|
21
|
+
async promote(projectId, targetEnvId, sourceEnvId) {
|
|
22
|
+
return this.request('POST', `/projects/${encodeURIComponent(projectId)}/environments/${encodeURIComponent(targetEnvId)}/promote`, { body: { sourceEnvId } });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { LogStream } from '../types.js';
|
|
2
|
+
export declare class LogsResource {
|
|
3
|
+
private readonly baseUrl;
|
|
4
|
+
private readonly token;
|
|
5
|
+
constructor(baseUrl: string, token: string);
|
|
6
|
+
/**
|
|
7
|
+
* Create an SSE log stream for a project environment.
|
|
8
|
+
* Returns the SSE URL and auth token for the caller to connect to.
|
|
9
|
+
* Uses GET /projects/:id/logs?envType=...&stream=true&limit=200
|
|
10
|
+
*/
|
|
11
|
+
stream(projectId: string, envType: string): LogStream;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=logs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../src/resources/logs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,qBAAa,YAAY;IAEvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBADL,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM;IAG/B;;;;OAIG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS;CAOrD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export class LogsResource {
|
|
2
|
+
baseUrl;
|
|
3
|
+
token;
|
|
4
|
+
constructor(baseUrl, token) {
|
|
5
|
+
this.baseUrl = baseUrl;
|
|
6
|
+
this.token = token;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Create an SSE log stream for a project environment.
|
|
10
|
+
* Returns the SSE URL and auth token for the caller to connect to.
|
|
11
|
+
* Uses GET /projects/:id/logs?envType=...&stream=true&limit=200
|
|
12
|
+
*/
|
|
13
|
+
stream(projectId, envType) {
|
|
14
|
+
const params = new URLSearchParams({ envType, stream: 'true', limit: '200' });
|
|
15
|
+
return {
|
|
16
|
+
url: `${this.baseUrl}/v1/projects/${projectId}/logs?${params.toString()}`,
|
|
17
|
+
token: this.token,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RequestFn } from '../request.js';
|
|
2
|
+
import type { Org, OrgMember } from '../types.js';
|
|
3
|
+
export declare class OrgResource {
|
|
4
|
+
private readonly request;
|
|
5
|
+
constructor(request: RequestFn);
|
|
6
|
+
/** Get current org (scoped to management token) */
|
|
7
|
+
current(): Promise<Org>;
|
|
8
|
+
/** List org members */
|
|
9
|
+
listMembers(orgId: string): Promise<OrgMember[]>;
|
|
10
|
+
/** Invite a member to the org by email */
|
|
11
|
+
inviteMember(orgId: string, email: string, role: 'admin' | 'member'): Promise<void>;
|
|
12
|
+
/** Remove a member from the org */
|
|
13
|
+
removeMember(orgId: string, userId: string): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=org.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org.d.ts","sourceRoot":"","sources":["../../src/resources/org.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEjD,qBAAa,WAAW;IACX,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,SAAS;IAE/C,mDAAmD;IAC7C,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;IAI7B,uBAAuB;IACjB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAQtD,0CAA0C;IACpC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAMzF,mCAAmC;IAC7B,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMhE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class OrgResource {
|
|
2
|
+
request;
|
|
3
|
+
constructor(request) {
|
|
4
|
+
this.request = request;
|
|
5
|
+
}
|
|
6
|
+
/** Get current org (scoped to management token) */
|
|
7
|
+
async current() {
|
|
8
|
+
return this.request('GET', '/orgs/me');
|
|
9
|
+
}
|
|
10
|
+
/** List org members */
|
|
11
|
+
async listMembers(orgId) {
|
|
12
|
+
const res = await this.request('GET', `/orgs/${encodeURIComponent(orgId)}/members`);
|
|
13
|
+
return Array.isArray(res) ? res : (res.members ?? []);
|
|
14
|
+
}
|
|
15
|
+
/** Invite a member to the org by email */
|
|
16
|
+
async inviteMember(orgId, email, role) {
|
|
17
|
+
await this.request('POST', `/orgs/${encodeURIComponent(orgId)}/members`, {
|
|
18
|
+
body: { email, role },
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/** Remove a member from the org */
|
|
22
|
+
async removeMember(orgId, userId) {
|
|
23
|
+
await this.request('DELETE', `/orgs/${encodeURIComponent(orgId)}/members/${encodeURIComponent(userId)}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RequestFn } from '../request.js';
|
|
2
|
+
import type { Project } from '../types.js';
|
|
3
|
+
export declare class ProjectsResource {
|
|
4
|
+
private readonly request;
|
|
5
|
+
constructor(request: RequestFn);
|
|
6
|
+
/** List projects (org is scoped to token) */
|
|
7
|
+
list(): Promise<Project[]>;
|
|
8
|
+
/** Create a new project */
|
|
9
|
+
create(data: {
|
|
10
|
+
name: string;
|
|
11
|
+
slug: string;
|
|
12
|
+
gitRepository?: string;
|
|
13
|
+
gitBranch?: string;
|
|
14
|
+
port?: number;
|
|
15
|
+
}): Promise<Project>;
|
|
16
|
+
/** Delete a project */
|
|
17
|
+
delete(id: string): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=projects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/resources/projects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,qBAAa,gBAAgB;IAChB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,SAAS;IAE/C,6CAA6C;IACvC,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAQhC,2BAA2B;IACrB,MAAM,CAAC,IAAI,EAAE;QAClB,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,IAAI,CAAC,EAAE,MAAM,CAAA;KACb,GAAG,OAAO,CAAC,OAAO,CAAC;IAIpB,uBAAuB;IACjB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGvC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class ProjectsResource {
|
|
2
|
+
request;
|
|
3
|
+
constructor(request) {
|
|
4
|
+
this.request = request;
|
|
5
|
+
}
|
|
6
|
+
/** List projects (org is scoped to token) */
|
|
7
|
+
async list() {
|
|
8
|
+
const res = await this.request('GET', '/projects');
|
|
9
|
+
return Array.isArray(res) ? res : (res.data ?? []);
|
|
10
|
+
}
|
|
11
|
+
/** Create a new project */
|
|
12
|
+
async create(data) {
|
|
13
|
+
return this.request('POST', '/projects', { body: data });
|
|
14
|
+
}
|
|
15
|
+
/** Delete a project */
|
|
16
|
+
async delete(id) {
|
|
17
|
+
return this.request('DELETE', `/projects/${encodeURIComponent(id)}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { RequestFn } from '../request.js';
|
|
2
|
+
import type { ResourceBinding } from '../types.js';
|
|
3
|
+
import type { EnvironmentsResource } from './environments.js';
|
|
4
|
+
export declare class ResourceBindingsResource {
|
|
5
|
+
private readonly request;
|
|
6
|
+
private readonly environments;
|
|
7
|
+
constructor(request: RequestFn, environments: EnvironmentsResource);
|
|
8
|
+
/**
|
|
9
|
+
* List bindings for a resource (which envs it's linked to).
|
|
10
|
+
* Backend returns { bindings: [...] }.
|
|
11
|
+
*/
|
|
12
|
+
listBindings(resourceId: string): Promise<ResourceBinding[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Bind a resource to a project environment.
|
|
15
|
+
* Backend expects { appEnvironmentId, role? }.
|
|
16
|
+
* Accepts projectId + envType and resolves to appEnvironmentId automatically.
|
|
17
|
+
*/
|
|
18
|
+
bind(resourceId: string, data: {
|
|
19
|
+
projectId: string;
|
|
20
|
+
envType: string;
|
|
21
|
+
role?: string;
|
|
22
|
+
}): Promise<ResourceBinding>;
|
|
23
|
+
/** Unbind a resource from a project environment */
|
|
24
|
+
unbind(resourceId: string, bindingId: string): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/resources/resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAE7D,qBAAa,wBAAwB;IAEnC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADZ,OAAO,EAAE,SAAS,EAClB,YAAY,EAAE,oBAAoB;IAGpD;;;OAGG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAQlE;;;;OAIG;IACG,IAAI,CACT,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GACzD,OAAO,CAAC,eAAe,CAAC;IAY3B,mDAAmD;IAC7C,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMlE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export class ResourceBindingsResource {
|
|
2
|
+
request;
|
|
3
|
+
environments;
|
|
4
|
+
constructor(request, environments) {
|
|
5
|
+
this.request = request;
|
|
6
|
+
this.environments = environments;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* List bindings for a resource (which envs it's linked to).
|
|
10
|
+
* Backend returns { bindings: [...] }.
|
|
11
|
+
*/
|
|
12
|
+
async listBindings(resourceId) {
|
|
13
|
+
const res = await this.request('GET', `/resources/${encodeURIComponent(resourceId)}/bindings`);
|
|
14
|
+
return res.bindings ?? [];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Bind a resource to a project environment.
|
|
18
|
+
* Backend expects { appEnvironmentId, role? }.
|
|
19
|
+
* Accepts projectId + envType and resolves to appEnvironmentId automatically.
|
|
20
|
+
*/
|
|
21
|
+
async bind(resourceId, data) {
|
|
22
|
+
const appEnvironmentId = await this.environments.resolveId(data.projectId, data.envType);
|
|
23
|
+
if (!appEnvironmentId) {
|
|
24
|
+
throw new Error(`Environment '${data.envType}' not found for project '${data.projectId}'`);
|
|
25
|
+
}
|
|
26
|
+
return this.request('POST', `/resources/${encodeURIComponent(resourceId)}/bindings`, { body: { appEnvironmentId, role: data.role ?? 'primary' } });
|
|
27
|
+
}
|
|
28
|
+
/** Unbind a resource from a project environment */
|
|
29
|
+
async unbind(resourceId, bindingId) {
|
|
30
|
+
return this.request('DELETE', `/resources/${encodeURIComponent(resourceId)}/bindings/${encodeURIComponent(bindingId)}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RequestFn } from '../request.js';
|
|
2
|
+
import type { DeployResult, Service } from '../types.js';
|
|
3
|
+
import type { EnvironmentsResource } from './environments.js';
|
|
4
|
+
export declare class ServicesResource {
|
|
5
|
+
private readonly request;
|
|
6
|
+
private readonly environments;
|
|
7
|
+
constructor(request: RequestFn, environments: EnvironmentsResource);
|
|
8
|
+
/** List services for a project */
|
|
9
|
+
list(projectId: string): Promise<Service[]>;
|
|
10
|
+
/** Get a service by name */
|
|
11
|
+
get(projectId: string, name: string): Promise<Service>;
|
|
12
|
+
/**
|
|
13
|
+
* Deploy a specific service.
|
|
14
|
+
* Backend expects { environmentId?, force?, image? } — NOT envType.
|
|
15
|
+
* Resolves envType → environmentId automatically.
|
|
16
|
+
*/
|
|
17
|
+
deploy(projectId: string, name: string, envType: string): Promise<DeployResult>;
|
|
18
|
+
/** Delete a service */
|
|
19
|
+
delete(projectId: string, name: string): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=services.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/resources/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAE7D,qBAAa,gBAAgB;IAE3B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADZ,OAAO,EAAE,SAAS,EAClB,YAAY,EAAE,oBAAoB;IAGpD,kCAAkC;IAC5B,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAQjD,4BAA4B;IACtB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAO5D;;;;OAIG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IASrF,uBAAuB;IACjB,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAM5D"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class ServicesResource {
|
|
2
|
+
request;
|
|
3
|
+
environments;
|
|
4
|
+
constructor(request, environments) {
|
|
5
|
+
this.request = request;
|
|
6
|
+
this.environments = environments;
|
|
7
|
+
}
|
|
8
|
+
/** List services for a project */
|
|
9
|
+
async list(projectId) {
|
|
10
|
+
const res = await this.request('GET', `/projects/${encodeURIComponent(projectId)}/services`);
|
|
11
|
+
return Array.isArray(res) ? res : (res.data ?? []);
|
|
12
|
+
}
|
|
13
|
+
/** Get a service by name */
|
|
14
|
+
async get(projectId, name) {
|
|
15
|
+
return this.request('GET', `/projects/${encodeURIComponent(projectId)}/services/${encodeURIComponent(name)}`);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Deploy a specific service.
|
|
19
|
+
* Backend expects { environmentId?, force?, image? } — NOT envType.
|
|
20
|
+
* Resolves envType → environmentId automatically.
|
|
21
|
+
*/
|
|
22
|
+
async deploy(projectId, name, envType) {
|
|
23
|
+
const environmentId = await this.environments.resolveId(projectId, envType);
|
|
24
|
+
return this.request('POST', `/projects/${encodeURIComponent(projectId)}/services/${encodeURIComponent(name)}/deploy`, { body: environmentId ? { environmentId } : {} });
|
|
25
|
+
}
|
|
26
|
+
/** Delete a service */
|
|
27
|
+
async delete(projectId, name) {
|
|
28
|
+
return this.request('DELETE', `/projects/${encodeURIComponent(projectId)}/services/${encodeURIComponent(name)}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RequestFn } from '../request.js';
|
|
2
|
+
import type { StorageResource } from '../types.js';
|
|
3
|
+
/** StoragesResource — blob storage management (class name avoids conflict with StorageResource type) */
|
|
4
|
+
export declare class StoragesResource {
|
|
5
|
+
private readonly request;
|
|
6
|
+
constructor(request: RequestFn);
|
|
7
|
+
/**
|
|
8
|
+
* List storage resources for a project.
|
|
9
|
+
* Backend returns a plain array of binding objects.
|
|
10
|
+
* Optionally filter by envType client-side.
|
|
11
|
+
*/
|
|
12
|
+
list(projectId: string, envType?: string): Promise<StorageResource[]>;
|
|
13
|
+
/** Provision blob storage for a project environment */
|
|
14
|
+
create(projectId: string, data: {
|
|
15
|
+
name: string;
|
|
16
|
+
envType: string;
|
|
17
|
+
}): Promise<StorageResource>;
|
|
18
|
+
/** Delete a storage resource */
|
|
19
|
+
delete(projectId: string, storageId: string): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/resources/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,wGAAwG;AACxG,qBAAa,gBAAgB;IAChB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,SAAS;IAE/C;;;;OAIG;IACG,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAS3E,uDAAuD;IACjD,MAAM,CACX,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GACrC,OAAO,CAAC,eAAe,CAAC;IAQ3B,gCAAgC;IAC1B,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMjE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** StoragesResource — blob storage management (class name avoids conflict with StorageResource type) */
|
|
2
|
+
export class StoragesResource {
|
|
3
|
+
request;
|
|
4
|
+
constructor(request) {
|
|
5
|
+
this.request = request;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* List storage resources for a project.
|
|
9
|
+
* Backend returns a plain array of binding objects.
|
|
10
|
+
* Optionally filter by envType client-side.
|
|
11
|
+
*/
|
|
12
|
+
async list(projectId, envType) {
|
|
13
|
+
const res = await this.request('GET', `/projects/${encodeURIComponent(projectId)}/storage`);
|
|
14
|
+
const list = Array.isArray(res) ? res : [];
|
|
15
|
+
return envType ? list.filter((r) => !r.envType || r.envType === envType) : list;
|
|
16
|
+
}
|
|
17
|
+
/** Provision blob storage for a project environment */
|
|
18
|
+
async create(projectId, data) {
|
|
19
|
+
return this.request('POST', `/projects/${encodeURIComponent(projectId)}/storage`, { body: data });
|
|
20
|
+
}
|
|
21
|
+
/** Delete a storage resource */
|
|
22
|
+
async delete(projectId, storageId) {
|
|
23
|
+
return this.request('DELETE', `/projects/${encodeURIComponent(projectId)}/storage/${encodeURIComponent(storageId)}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { RequestFn } from '../request.js';
|
|
2
|
+
import type { Task } from '../types.js';
|
|
3
|
+
import type { EnvironmentsResource } from './environments.js';
|
|
4
|
+
export declare class TasksResource {
|
|
5
|
+
private readonly request;
|
|
6
|
+
private readonly environments;
|
|
7
|
+
constructor(request: RequestFn, environments: EnvironmentsResource);
|
|
8
|
+
/**
|
|
9
|
+
* List task definitions for a project environment.
|
|
10
|
+
* Uses ?envId=<envId> (resolved from envType automatically).
|
|
11
|
+
*/
|
|
12
|
+
list(projectId: string, envType?: string): Promise<Task[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Create or update a task definition (upserts on taskName + environmentId).
|
|
15
|
+
* Backend requires envId — resolves from envType automatically.
|
|
16
|
+
*/
|
|
17
|
+
create(projectId: string, data: {
|
|
18
|
+
taskName: string;
|
|
19
|
+
envType: string;
|
|
20
|
+
executionMode?: 'job' | 'service' | 'cron';
|
|
21
|
+
command?: string[];
|
|
22
|
+
imageRef?: string;
|
|
23
|
+
machineConfig?: {
|
|
24
|
+
cpu?: string;
|
|
25
|
+
memory?: string;
|
|
26
|
+
gpu?: string;
|
|
27
|
+
};
|
|
28
|
+
handlerPath?: string;
|
|
29
|
+
timeoutSeconds?: number;
|
|
30
|
+
retryConfig?: {
|
|
31
|
+
maxAttempts?: number;
|
|
32
|
+
backoff?: 'fixed' | 'exponential';
|
|
33
|
+
};
|
|
34
|
+
}): Promise<Task>;
|
|
35
|
+
/** Get a single task definition */
|
|
36
|
+
get(projectId: string, taskId: string): Promise<Task>;
|
|
37
|
+
/** Update a task definition */
|
|
38
|
+
update(projectId: string, taskId: string, data: Partial<Pick<Task, 'executionMode' | 'command' | 'imageRef' | 'machineConfig' | 'handlerPath' | 'timeoutSeconds' | 'retryConfig'>>): Promise<Task>;
|
|
39
|
+
/** Delete a task definition */
|
|
40
|
+
delete(projectId: string, taskId: string): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/resources/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAE7D,qBAAa,aAAa;IAExB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADZ,OAAO,EAAE,SAAS,EAClB,YAAY,EAAE,oBAAoB;IAGpD;;;OAGG;IACG,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAchE;;;OAGG;IACG,MAAM,CACX,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE;QACL,QAAQ,EAAE,MAAM,CAAA;QAChB,OAAO,EAAE,MAAM,CAAA;QACf,aAAa,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,CAAA;QAC1C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,aAAa,CAAC,EAAE;YAAE,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;QAC/D,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,WAAW,CAAC,EAAE;YAAE,WAAW,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,OAAO,GAAG,aAAa,CAAA;SAAE,CAAA;KACzE,GACC,OAAO,CAAC,IAAI,CAAC;IAchB,mCAAmC;IAC7B,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ3D,+BAA+B;IACzB,MAAM,CACX,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,CACZ,IAAI,CACH,IAAI,EACF,eAAe,GACf,SAAS,GACT,UAAU,GACV,eAAe,GACf,aAAa,GACb,gBAAgB,GAChB,aAAa,CACf,CACD,GACC,OAAO,CAAC,IAAI,CAAC;IAShB,+BAA+B;IACzB,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAM9D"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export class TasksResource {
|
|
2
|
+
request;
|
|
3
|
+
environments;
|
|
4
|
+
constructor(request, environments) {
|
|
5
|
+
this.request = request;
|
|
6
|
+
this.environments = environments;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* List task definitions for a project environment.
|
|
10
|
+
* Uses ?envId=<envId> (resolved from envType automatically).
|
|
11
|
+
*/
|
|
12
|
+
async list(projectId, envType) {
|
|
13
|
+
const query = {};
|
|
14
|
+
if (envType) {
|
|
15
|
+
const envId = await this.environments.resolveId(projectId, envType);
|
|
16
|
+
if (envId)
|
|
17
|
+
query['envId'] = envId;
|
|
18
|
+
}
|
|
19
|
+
const res = await this.request('GET', `/projects/${encodeURIComponent(projectId)}/tasks`, { query });
|
|
20
|
+
return res.tasks ?? [];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Create or update a task definition (upserts on taskName + environmentId).
|
|
24
|
+
* Backend requires envId — resolves from envType automatically.
|
|
25
|
+
*/
|
|
26
|
+
async create(projectId, data) {
|
|
27
|
+
const envId = await this.environments.resolveId(projectId, data.envType);
|
|
28
|
+
if (!envId) {
|
|
29
|
+
throw new Error(`Environment '${data.envType}' not found for project '${projectId}'`);
|
|
30
|
+
}
|
|
31
|
+
const { envType: _drop, ...rest } = data;
|
|
32
|
+
const res = await this.request('POST', `/projects/${encodeURIComponent(projectId)}/tasks`, { body: { ...rest, envId } });
|
|
33
|
+
return res.task;
|
|
34
|
+
}
|
|
35
|
+
/** Get a single task definition */
|
|
36
|
+
async get(projectId, taskId) {
|
|
37
|
+
const res = await this.request('GET', `/projects/${encodeURIComponent(projectId)}/tasks/${encodeURIComponent(taskId)}`);
|
|
38
|
+
return res.task;
|
|
39
|
+
}
|
|
40
|
+
/** Update a task definition */
|
|
41
|
+
async update(projectId, taskId, data) {
|
|
42
|
+
const res = await this.request('PATCH', `/projects/${encodeURIComponent(projectId)}/tasks/${encodeURIComponent(taskId)}`, { body: data });
|
|
43
|
+
return res.task;
|
|
44
|
+
}
|
|
45
|
+
/** Delete a task definition */
|
|
46
|
+
async delete(projectId, taskId) {
|
|
47
|
+
await this.request('DELETE', `/projects/${encodeURIComponent(projectId)}/tasks/${encodeURIComponent(taskId)}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RequestFn } from '../request.js';
|
|
2
|
+
import type { WhoAmI } from '../types.js';
|
|
3
|
+
export declare class UserResource {
|
|
4
|
+
private readonly request;
|
|
5
|
+
constructor(request: RequestFn);
|
|
6
|
+
/** Get current user and orgs */
|
|
7
|
+
whoami(): Promise<WhoAmI>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/resources/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,qBAAa,YAAY;IACZ,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,SAAS;IAE/C,gCAAgC;IAC1B,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;CAG/B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RequestFn } from '../request.js';
|
|
2
|
+
import type { Volume } from '../types.js';
|
|
3
|
+
export declare class VolumesResource {
|
|
4
|
+
private readonly request;
|
|
5
|
+
constructor(request: RequestFn);
|
|
6
|
+
/** List volumes for a project */
|
|
7
|
+
list(projectId: string): Promise<Volume[]>;
|
|
8
|
+
/** Create a volume */
|
|
9
|
+
create(projectId: string, data: {
|
|
10
|
+
name: string;
|
|
11
|
+
sizeGb: number;
|
|
12
|
+
accessMode?: 'ReadWriteOnce' | 'ReadWriteMany';
|
|
13
|
+
mountPath?: string;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
volume: Volume;
|
|
16
|
+
}>;
|
|
17
|
+
/** Delete a volume */
|
|
18
|
+
delete(projectId: string, volId: string): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=volumes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"volumes.d.ts","sourceRoot":"","sources":["../../src/resources/volumes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,qBAAa,eAAe;IACf,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,SAAS;IAE/C,iCAAiC;IAC3B,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAQhD,sBAAsB;IAChB,MAAM,CACX,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;QACd,UAAU,CAAC,EAAE,eAAe,GAAG,eAAe,CAAA;QAC9C,SAAS,CAAC,EAAE,MAAM,CAAA;KAClB,GACC,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAQ9B,sBAAsB;IAChB,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAM7D"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class VolumesResource {
|
|
2
|
+
request;
|
|
3
|
+
constructor(request) {
|
|
4
|
+
this.request = request;
|
|
5
|
+
}
|
|
6
|
+
/** List volumes for a project */
|
|
7
|
+
async list(projectId) {
|
|
8
|
+
const res = await this.request('GET', `/projects/${encodeURIComponent(projectId)}/volumes`);
|
|
9
|
+
return Array.isArray(res) ? res : (res.volumes ?? []);
|
|
10
|
+
}
|
|
11
|
+
/** Create a volume */
|
|
12
|
+
async create(projectId, data) {
|
|
13
|
+
return this.request('POST', `/projects/${encodeURIComponent(projectId)}/volumes`, { body: data });
|
|
14
|
+
}
|
|
15
|
+
/** Delete a volume */
|
|
16
|
+
async delete(projectId, volId) {
|
|
17
|
+
return this.request('DELETE', `/projects/${encodeURIComponent(projectId)}/volumes/${encodeURIComponent(volId)}`);
|
|
18
|
+
}
|
|
19
|
+
}
|