oblien 2.0.3 → 2.0.4
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/client.d.ts +3 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +4 -0
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/namespace.d.ts +232 -0
- package/dist/namespace.d.ts.map +1 -0
- package/dist/namespace.js +338 -0
- package/dist/namespace.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/namespace.d.ts +169 -0
- package/dist/types/namespace.d.ts.map +1 -0
- package/dist/types/namespace.js +3 -0
- package/dist/types/namespace.js.map +1 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HttpClient } from './http.js';
|
|
2
2
|
import { Workspace } from './workspace.js';
|
|
3
3
|
import { WorkspaceHandle } from './workspace-handle.js';
|
|
4
|
+
import { Namespace } from './namespace.js';
|
|
4
5
|
import type { OblienOptions } from './types/index.js';
|
|
5
6
|
/**
|
|
6
7
|
* Oblien API client.
|
|
@@ -28,6 +29,8 @@ export declare class Oblien {
|
|
|
28
29
|
readonly _http: HttpClient;
|
|
29
30
|
/** Workspace operations (CRUD, power, quota, and sub-resources). */
|
|
30
31
|
readonly workspaces: Workspace;
|
|
32
|
+
/** Namespace operations (CRUD, lifecycle, activity, usage). */
|
|
33
|
+
readonly namespaces: Namespace;
|
|
31
34
|
constructor(options: OblienOptions);
|
|
32
35
|
/**
|
|
33
36
|
* Get a scoped {@link WorkspaceHandle} bound to a single workspace ID.
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,MAAM;IACjB,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAE3B,oEAAoE;IACpE,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;gBAEnB,OAAO,EAAE,aAAa;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,MAAM;IACjB,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAE3B,oEAAoE;IACpE,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAE/B,+DAA+D;IAC/D,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;gBAEnB,OAAO,EAAE,aAAa;IAMlC;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe;CAGhD"}
|
package/dist/client.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HttpClient } from './http.js';
|
|
2
2
|
import { Workspace } from './workspace.js';
|
|
3
3
|
import { WorkspaceHandle } from './workspace-handle.js';
|
|
4
|
+
import { Namespace } from './namespace.js';
|
|
4
5
|
/**
|
|
5
6
|
* Oblien API client.
|
|
6
7
|
*
|
|
@@ -27,9 +28,12 @@ export class Oblien {
|
|
|
27
28
|
_http;
|
|
28
29
|
/** Workspace operations (CRUD, power, quota, and sub-resources). */
|
|
29
30
|
workspaces;
|
|
31
|
+
/** Namespace operations (CRUD, lifecycle, activity, usage). */
|
|
32
|
+
namespaces;
|
|
30
33
|
constructor(options) {
|
|
31
34
|
this._http = new HttpClient(options);
|
|
32
35
|
this.workspaces = new Workspace(this);
|
|
36
|
+
this.namespaces = new Namespace(this);
|
|
33
37
|
}
|
|
34
38
|
/**
|
|
35
39
|
* Get a scoped {@link WorkspaceHandle} bound to a single workspace ID.
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,MAAM;IACjB,kEAAkE;IACzD,KAAK,CAAa;IAE3B,oEAAoE;IAC3D,UAAU,CAAY;IAE/B,+DAA+D;IACtD,UAAU,CAAY;IAE/B,YAAY,OAAsB;QAChC,IAAI,CAAC,KAAK,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,UAAU,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,WAAmB;QAC3B,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ export { Oblien as default } from './client.js';
|
|
|
2
2
|
export { Oblien } from './client.js';
|
|
3
3
|
export { Workspace } from './workspace.js';
|
|
4
4
|
export { WorkspaceHandle } from './workspace-handle.js';
|
|
5
|
+
export { Namespace } from './namespace.js';
|
|
5
6
|
export { Runtime } from './runtime.js';
|
|
6
7
|
export { RuntimeWebSocket } from './runtime/ws.js';
|
|
7
8
|
export { OblienError, AuthenticationError, NotFoundError, RateLimitError, ValidationError, PaymentRequiredError, ConflictError, } from './error.js';
|
|
8
|
-
export type { OblienOptions, RequestOptions, ApiResponse, WorkspaceCreateParams, WorkspaceUpdateParams, WorkspaceListParams, WorkspaceListResponse, WorkspaceData, ResourceSpec, LifecycleSpec, NetworkSpec, FirewallRule, PrivateLink, RuntimeOptions, FileListParams, FileEntry, FileListResponse, FileReadParams, FileReadResponse, FileWriteParams, FileWriteResponse, FileMkdirParams, FileStatParams, FileStatResponse, FileDeleteParams, ContentSearchParams, SearchMatch, ContentSearchResponse, FileSearchParams, FileSearchResponse, SearchStatusResponse, SearchInitResponse, ExecRunParams, ExecTask, ExecListResponse, ExecStreamEvent, TerminalCreateParams, TerminalSession, TerminalListResponse, TerminalScrollbackResponse, WatcherCreateParams, WatcherInfo, WatcherListResponse, WSOptions, WSMessage, WSTerminalResize, WSTerminalExit, WSTerminalEvent, WSWatcherChange, WSWatcherReady, WSWatcherOverflow, WSWatcherEvent, LifecycleStatus, MakeTemporaryParams, UpdateTtlParams, SshStatus, SshPasswordParams, SshKeyParams, PublicAccessPort, ExposePortParams, SnapshotParams, ArchiveCreateParams, ArchiveInfo, WorkloadCreateParams, WorkloadUpdateParams, WorkloadInfo, WorkloadListParams, UsageParams, UpdateResourcesParams, UpdateMetadataParams, ApiAccessStatus, RawTokenResponse, NetworkUpdateParams, NetworkConfig, LogsParams, LogFile, LogStreamEvent, StatsEvent, WorkloadStatsEvent, WorkloadLogEntry, ImagesListParams, } from './types/index.js';
|
|
9
|
+
export type { OblienOptions, RequestOptions, ApiResponse, WorkspaceCreateParams, WorkspaceUpdateParams, WorkspaceListParams, WorkspaceListResponse, WorkspaceData, ResourceSpec, LifecycleSpec, NetworkSpec, FirewallRule, PrivateLink, RuntimeOptions, FileListParams, FileEntry, FileListResponse, FileReadParams, FileReadResponse, FileWriteParams, FileWriteResponse, FileMkdirParams, FileStatParams, FileStatResponse, FileDeleteParams, ContentSearchParams, SearchMatch, ContentSearchResponse, FileSearchParams, FileSearchResponse, SearchStatusResponse, SearchInitResponse, ExecRunParams, ExecTask, ExecListResponse, ExecStreamEvent, TerminalCreateParams, TerminalSession, TerminalListResponse, TerminalScrollbackResponse, WatcherCreateParams, WatcherInfo, WatcherListResponse, WSOptions, WSMessage, WSTerminalResize, WSTerminalExit, WSTerminalEvent, WSWatcherChange, WSWatcherReady, WSWatcherOverflow, WSWatcherEvent, LifecycleStatus, MakeTemporaryParams, UpdateTtlParams, SshStatus, SshPasswordParams, SshKeyParams, PublicAccessPort, ExposePortParams, SnapshotParams, ArchiveCreateParams, ArchiveInfo, WorkloadCreateParams, WorkloadUpdateParams, WorkloadInfo, WorkloadListParams, UsageParams, UpdateResourcesParams, UpdateMetadataParams, ApiAccessStatus, RawTokenResponse, NetworkUpdateParams, NetworkConfig, LogsParams, LogFile, LogStreamEvent, StatsEvent, WorkloadStatsEvent, WorkloadLogEntry, ImagesListParams, NamespaceStatus, NamespaceType, NamespaceResourceLimits, NamespaceData, NamespaceCreateParams, NamespaceUpdateParams, NamespaceListParams, NamespaceListResponse, NamespaceActivity, NamespaceActivityParams, NamespaceUsageParams, NamespaceDeleteParams, QuotaPeriod, OverdraftAction, NamespaceQuota, SetNamespaceQuotaParams, ResetNamespaceQuotaParams, NamespaceListWithQuotasParams, NamespaceDetailsParams, DefaultQuotaConfig, SetDefaultQuotaParams, ToggleDefaultQuotaAutoApplyParams, DeleteDefaultQuotaParams, } from './types/index.js';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGnD,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,aAAa,GACd,MAAM,YAAY,CAAC;AAGpB,YAAY,EAEV,aAAa,EACb,cAAc,EACd,WAAW,EAEX,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,WAAW,EAEX,cAAc,EACd,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EAEnB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,cAAc,EAEd,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,OAAO,EACP,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGnD,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,aAAa,GACd,MAAM,YAAY,CAAC;AAGpB,YAAY,EAEV,aAAa,EACb,cAAc,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B,6BAA6B,EAC7B,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,iCAAiC,EACjC,wBAAwB,GACzB,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { Oblien as default } from './client.js';
|
|
|
4
4
|
export { Oblien } from './client.js';
|
|
5
5
|
export { Workspace } from './workspace.js';
|
|
6
6
|
export { WorkspaceHandle } from './workspace-handle.js';
|
|
7
|
+
export { Namespace } from './namespace.js';
|
|
7
8
|
export { Runtime } from './runtime.js';
|
|
8
9
|
export { RuntimeWebSocket } from './runtime/ws.js';
|
|
9
10
|
// Errors
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAEhD,sEAAsE;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,SAAS;AACT,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,aAAa,GACd,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAEhD,sEAAsE;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,SAAS;AACT,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,aAAa,GACd,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import type { HttpClient } from './http.js';
|
|
2
|
+
import type { ApiResponse } from './types/common.js';
|
|
3
|
+
import type { NamespaceData, NamespaceCreateParams, NamespaceUpdateParams, NamespaceListParams, NamespaceListResponse, NamespaceActivityParams, NamespaceUsageParams, NamespaceDeleteParams, SetNamespaceQuotaParams, ResetNamespaceQuotaParams, NamespaceListWithQuotasParams, NamespaceDetailsParams, SetDefaultQuotaParams } from './types/namespace.js';
|
|
4
|
+
/**
|
|
5
|
+
* Namespace operations — CRUD, lifecycle actions, activity, and usage.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import Oblien from 'oblien';
|
|
9
|
+
* const client = new Oblien({ clientId, clientSecret });
|
|
10
|
+
*
|
|
11
|
+
* // Create
|
|
12
|
+
* const ns = await client.namespaces.create({ name: 'production' });
|
|
13
|
+
*
|
|
14
|
+
* // List
|
|
15
|
+
* const { data } = await client.namespaces.list({ status: 'active' });
|
|
16
|
+
*
|
|
17
|
+
* // Suspend / Activate
|
|
18
|
+
* await client.namespaces.suspend(ns.data.id);
|
|
19
|
+
* await client.namespaces.activate(ns.data.id);
|
|
20
|
+
*
|
|
21
|
+
* // Delete
|
|
22
|
+
* await client.namespaces.delete(ns.data.id, { deleteWorkspaces: true });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare class Namespace {
|
|
26
|
+
/** @internal */
|
|
27
|
+
readonly _http: HttpClient;
|
|
28
|
+
private readonly _base;
|
|
29
|
+
constructor(client: {
|
|
30
|
+
_http: HttpClient;
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* Create a new namespace.
|
|
34
|
+
*
|
|
35
|
+
* ```ts
|
|
36
|
+
* const res = await client.namespaces.create({
|
|
37
|
+
* name: 'my-project',
|
|
38
|
+
* type: 'production',
|
|
39
|
+
* tags: ['api', 'v2'],
|
|
40
|
+
* });
|
|
41
|
+
* console.log(res.data.slug); // 'my-project'
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
create(params: NamespaceCreateParams): Promise<ApiResponse & {
|
|
45
|
+
data: NamespaceData;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* List namespaces with optional filtering, search, and pagination.
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* const { data, pagination } = await client.namespaces.list({
|
|
52
|
+
* status: 'active',
|
|
53
|
+
* search: 'prod',
|
|
54
|
+
* limit: 20,
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
list(params?: NamespaceListParams): Promise<NamespaceListResponse>;
|
|
59
|
+
/**
|
|
60
|
+
* Get a namespace by ID or slug.
|
|
61
|
+
*
|
|
62
|
+
* ```ts
|
|
63
|
+
* const ns = await client.namespaces.get('my-project');
|
|
64
|
+
* console.log(ns.data.status); // 'active'
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
get(idOrSlug: string): Promise<ApiResponse & {
|
|
68
|
+
data: NamespaceData;
|
|
69
|
+
}>;
|
|
70
|
+
/**
|
|
71
|
+
* Update a namespace.
|
|
72
|
+
*
|
|
73
|
+
* ```ts
|
|
74
|
+
* await client.namespaces.update('ns_abc', {
|
|
75
|
+
* description: 'Production workloads',
|
|
76
|
+
* tags: ['production', 'critical'],
|
|
77
|
+
* });
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
update(id: string, params: NamespaceUpdateParams): Promise<ApiResponse & {
|
|
81
|
+
data: NamespaceData;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* Delete a namespace. Optionally delete all its workspaces.
|
|
85
|
+
*
|
|
86
|
+
* ```ts
|
|
87
|
+
* await client.namespaces.delete('ns_abc', { deleteWorkspaces: true });
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
delete(id: string, params?: NamespaceDeleteParams): Promise<ApiResponse>;
|
|
91
|
+
/**
|
|
92
|
+
* Suspend a namespace — stops all running workspaces and sets status to `suspended`.
|
|
93
|
+
*
|
|
94
|
+
* ```ts
|
|
95
|
+
* await client.namespaces.suspend('ns_abc');
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
suspend(id: string): Promise<ApiResponse>;
|
|
99
|
+
/**
|
|
100
|
+
* Activate a suspended namespace — sets status back to `active`.
|
|
101
|
+
*
|
|
102
|
+
* ```ts
|
|
103
|
+
* await client.namespaces.activate('ns_abc');
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
activate(id: string): Promise<ApiResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* Stop all running workspaces in a namespace without changing namespace status.
|
|
109
|
+
*
|
|
110
|
+
* ```ts
|
|
111
|
+
* await client.namespaces.stopWorkspaces('ns_abc');
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
stopWorkspaces(id: string): Promise<ApiResponse>;
|
|
115
|
+
/**
|
|
116
|
+
* Get namespace activity log.
|
|
117
|
+
*
|
|
118
|
+
* ```ts
|
|
119
|
+
* const { data } = await client.namespaces.activity('ns_abc', { limit: 20 });
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
activity(id: string, params?: NamespaceActivityParams): Promise<ApiResponse>;
|
|
123
|
+
/**
|
|
124
|
+
* Get namespace usage statistics.
|
|
125
|
+
*
|
|
126
|
+
* ```ts
|
|
127
|
+
* const { data } = await client.namespaces.usage('ns_abc', { days: 30 });
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
usage(id: string, params?: NamespaceUsageParams): Promise<ApiResponse>;
|
|
131
|
+
/**
|
|
132
|
+
* Set or update a namespace quota for a service.
|
|
133
|
+
*
|
|
134
|
+
* Configures spending limits with optional overdraft (grace zone beyond the
|
|
135
|
+
* hard limit). When usage exceeds `quotaLimit + overdraft`, the
|
|
136
|
+
* `onOverdraftAction` fires — either blocking new requests or stopping all
|
|
137
|
+
* running workspaces in the namespace.
|
|
138
|
+
*
|
|
139
|
+
* ```ts
|
|
140
|
+
* await client.namespaces.setQuota({
|
|
141
|
+
* namespace: 'production',
|
|
142
|
+
* service: 'sandbox',
|
|
143
|
+
* quotaLimit: 500,
|
|
144
|
+
* period: 'monthly',
|
|
145
|
+
* overdraft: 50,
|
|
146
|
+
* onOverdraftAction: 'stop_workspaces',
|
|
147
|
+
* });
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
setQuota(params: SetNamespaceQuotaParams): Promise<ApiResponse>;
|
|
151
|
+
/**
|
|
152
|
+
* Reset quota usage to zero for a namespace + service.
|
|
153
|
+
*
|
|
154
|
+
* ```ts
|
|
155
|
+
* await client.namespaces.resetQuota({ namespace: 'production', service: 'sandbox' });
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
resetQuota(params: ResetNamespaceQuotaParams): Promise<ApiResponse>;
|
|
159
|
+
/**
|
|
160
|
+
* List namespaces enriched with quota and spending data.
|
|
161
|
+
*
|
|
162
|
+
* Returns namespace entities merged with financial info — total spent,
|
|
163
|
+
* active quotas, and per-service breakdown.
|
|
164
|
+
*
|
|
165
|
+
* ```ts
|
|
166
|
+
* const res = await client.namespaces.listWithQuotas({ status: 'active', limit: 20 });
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
listWithQuotas(params?: NamespaceListWithQuotasParams): Promise<ApiResponse>;
|
|
170
|
+
/**
|
|
171
|
+
* Get comprehensive namespace details — quotas, usage stats, service breakdown,
|
|
172
|
+
* daily timeline, and recent transactions.
|
|
173
|
+
*
|
|
174
|
+
* ```ts
|
|
175
|
+
* const details = await client.namespaces.getDetails('production', { days: 30 });
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
getDetails(namespace: string, params?: NamespaceDetailsParams): Promise<ApiResponse>;
|
|
179
|
+
/**
|
|
180
|
+
* Set a default quota configuration.
|
|
181
|
+
*
|
|
182
|
+
* Default quotas are automatically applied to new namespaces when
|
|
183
|
+
* `autoApply` is enabled. Useful for SaaS platforms that assign a standard
|
|
184
|
+
* spending limit to every customer namespace.
|
|
185
|
+
*
|
|
186
|
+
* ```ts
|
|
187
|
+
* await client.namespaces.setDefaultQuota({
|
|
188
|
+
* service: 'sandbox',
|
|
189
|
+
* quotaLimit: 100,
|
|
190
|
+
* period: 'monthly',
|
|
191
|
+
* overdraft: 10,
|
|
192
|
+
* onOverdraftAction: 'block',
|
|
193
|
+
* autoApply: true,
|
|
194
|
+
* });
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
setDefaultQuota(params: SetDefaultQuotaParams): Promise<ApiResponse>;
|
|
198
|
+
/**
|
|
199
|
+
* Get the default quota configuration for a service.
|
|
200
|
+
*
|
|
201
|
+
* ```ts
|
|
202
|
+
* const config = await client.namespaces.getDefaultQuota('sandbox');
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
getDefaultQuota(service: string): Promise<ApiResponse>;
|
|
206
|
+
/**
|
|
207
|
+
* Get all default quota configurations.
|
|
208
|
+
*
|
|
209
|
+
* ```ts
|
|
210
|
+
* const configs = await client.namespaces.getAllDefaultQuotas();
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
getAllDefaultQuotas(): Promise<ApiResponse>;
|
|
214
|
+
/**
|
|
215
|
+
* Delete a default quota configuration for a service.
|
|
216
|
+
*
|
|
217
|
+
* ```ts
|
|
218
|
+
* await client.namespaces.deleteDefaultQuota('sandbox');
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
deleteDefaultQuota(service: string): Promise<ApiResponse>;
|
|
222
|
+
/**
|
|
223
|
+
* Toggle auto-apply for a default quota. When enabled, the default quota
|
|
224
|
+
* is automatically assigned to new namespaces that don't have one yet.
|
|
225
|
+
*
|
|
226
|
+
* ```ts
|
|
227
|
+
* await client.namespaces.toggleDefaultQuotaAutoApply('sandbox', true);
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
toggleDefaultQuotaAutoApply(service: string, autoApply: boolean): Promise<ApiResponse>;
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../src/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,SAAS;IACpB,gBAAgB;IAChB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAE3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiB;gBAE3B,MAAM,EAAE;QAAE,KAAK,EAAE,UAAU,CAAA;KAAE;IAMzC;;;;;;;;;;;OAWG;IACG,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,GAAG;QAAE,IAAI,EAAE,aAAa,CAAA;KAAE,CAAC;IAQ3F;;;;;;;;;;O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;;;;;;OAOG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,GAAE,sBAA2B,GAAG,OAAO,CAAC,WAAW,CAAC;IAU9F;;;;;;;;;;;;;;;;;OAiBG;IACG,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;IAQ1E;;;;;;OAMG;IACG,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAQ5D;;;;;;OAMG;IACG,mBAAmB,IAAI,OAAO,CAAC,WAAW,CAAC;IAQjD;;;;;;OAMG;IACG,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAQ/D;;;;;;;OAOG;IACG,2BAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC;CAO7F"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Namespace operations — CRUD, lifecycle actions, activity, and usage.
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* import Oblien from 'oblien';
|
|
6
|
+
* const client = new Oblien({ clientId, clientSecret });
|
|
7
|
+
*
|
|
8
|
+
* // Create
|
|
9
|
+
* const ns = await client.namespaces.create({ name: 'production' });
|
|
10
|
+
*
|
|
11
|
+
* // List
|
|
12
|
+
* const { data } = await client.namespaces.list({ status: 'active' });
|
|
13
|
+
*
|
|
14
|
+
* // Suspend / Activate
|
|
15
|
+
* await client.namespaces.suspend(ns.data.id);
|
|
16
|
+
* await client.namespaces.activate(ns.data.id);
|
|
17
|
+
*
|
|
18
|
+
* // Delete
|
|
19
|
+
* await client.namespaces.delete(ns.data.id, { deleteWorkspaces: true });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export class Namespace {
|
|
23
|
+
/** @internal */
|
|
24
|
+
_http;
|
|
25
|
+
_base = '/namespaces';
|
|
26
|
+
constructor(client) {
|
|
27
|
+
this._http = client._http;
|
|
28
|
+
}
|
|
29
|
+
// ── CRUD ──────────────────────────────────────────────────────────
|
|
30
|
+
/**
|
|
31
|
+
* Create a new namespace.
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* const res = await client.namespaces.create({
|
|
35
|
+
* name: 'my-project',
|
|
36
|
+
* type: 'production',
|
|
37
|
+
* tags: ['api', 'v2'],
|
|
38
|
+
* });
|
|
39
|
+
* console.log(res.data.slug); // 'my-project'
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
async create(params) {
|
|
43
|
+
return this._http.request({
|
|
44
|
+
method: 'POST',
|
|
45
|
+
path: this._base,
|
|
46
|
+
body: params,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* List namespaces with optional filtering, search, and pagination.
|
|
51
|
+
*
|
|
52
|
+
* ```ts
|
|
53
|
+
* const { data, pagination } = await client.namespaces.list({
|
|
54
|
+
* status: 'active',
|
|
55
|
+
* search: 'prod',
|
|
56
|
+
* limit: 20,
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
async list(params = {}) {
|
|
61
|
+
return this._http.request({
|
|
62
|
+
method: 'GET',
|
|
63
|
+
path: this._base,
|
|
64
|
+
query: params,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get a namespace by ID or slug.
|
|
69
|
+
*
|
|
70
|
+
* ```ts
|
|
71
|
+
* const ns = await client.namespaces.get('my-project');
|
|
72
|
+
* console.log(ns.data.status); // 'active'
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
async get(idOrSlug) {
|
|
76
|
+
return this._http.request({
|
|
77
|
+
method: 'GET',
|
|
78
|
+
path: `${this._base}/${idOrSlug}`,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Update a namespace.
|
|
83
|
+
*
|
|
84
|
+
* ```ts
|
|
85
|
+
* await client.namespaces.update('ns_abc', {
|
|
86
|
+
* description: 'Production workloads',
|
|
87
|
+
* tags: ['production', 'critical'],
|
|
88
|
+
* });
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
async update(id, params) {
|
|
92
|
+
return this._http.request({
|
|
93
|
+
method: 'PUT',
|
|
94
|
+
path: `${this._base}/${id}`,
|
|
95
|
+
body: params,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Delete a namespace. Optionally delete all its workspaces.
|
|
100
|
+
*
|
|
101
|
+
* ```ts
|
|
102
|
+
* await client.namespaces.delete('ns_abc', { deleteWorkspaces: true });
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
async delete(id, params = {}) {
|
|
106
|
+
return this._http.request({
|
|
107
|
+
method: 'DELETE',
|
|
108
|
+
path: `${this._base}/${id}`,
|
|
109
|
+
body: params,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
// ── Lifecycle actions ─────────────────────────────────────────────
|
|
113
|
+
/**
|
|
114
|
+
* Suspend a namespace — stops all running workspaces and sets status to `suspended`.
|
|
115
|
+
*
|
|
116
|
+
* ```ts
|
|
117
|
+
* await client.namespaces.suspend('ns_abc');
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
async suspend(id) {
|
|
121
|
+
return this._http.request({
|
|
122
|
+
method: 'POST',
|
|
123
|
+
path: `${this._base}/${id}/suspend`,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Activate a suspended namespace — sets status back to `active`.
|
|
128
|
+
*
|
|
129
|
+
* ```ts
|
|
130
|
+
* await client.namespaces.activate('ns_abc');
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
async activate(id) {
|
|
134
|
+
return this._http.request({
|
|
135
|
+
method: 'POST',
|
|
136
|
+
path: `${this._base}/${id}/activate`,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Stop all running workspaces in a namespace without changing namespace status.
|
|
141
|
+
*
|
|
142
|
+
* ```ts
|
|
143
|
+
* await client.namespaces.stopWorkspaces('ns_abc');
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
async stopWorkspaces(id) {
|
|
147
|
+
return this._http.request({
|
|
148
|
+
method: 'POST',
|
|
149
|
+
path: `${this._base}/${id}/stop-workspaces`,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
// ── Activity & Usage ──────────────────────────────────────────────
|
|
153
|
+
/**
|
|
154
|
+
* Get namespace activity log.
|
|
155
|
+
*
|
|
156
|
+
* ```ts
|
|
157
|
+
* const { data } = await client.namespaces.activity('ns_abc', { limit: 20 });
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
async activity(id, params = {}) {
|
|
161
|
+
return this._http.request({
|
|
162
|
+
method: 'GET',
|
|
163
|
+
path: `${this._base}/${id}/activity`,
|
|
164
|
+
query: params,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Get namespace usage statistics.
|
|
169
|
+
*
|
|
170
|
+
* ```ts
|
|
171
|
+
* const { data } = await client.namespaces.usage('ns_abc', { days: 30 });
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
async usage(id, params = {}) {
|
|
175
|
+
return this._http.request({
|
|
176
|
+
method: 'GET',
|
|
177
|
+
path: `${this._base}/${id}/usage`,
|
|
178
|
+
query: params,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
// ── Quotas & Overdraft ────────────────────────────────────────────
|
|
182
|
+
/**
|
|
183
|
+
* Set or update a namespace quota for a service.
|
|
184
|
+
*
|
|
185
|
+
* Configures spending limits with optional overdraft (grace zone beyond the
|
|
186
|
+
* hard limit). When usage exceeds `quotaLimit + overdraft`, the
|
|
187
|
+
* `onOverdraftAction` fires — either blocking new requests or stopping all
|
|
188
|
+
* running workspaces in the namespace.
|
|
189
|
+
*
|
|
190
|
+
* ```ts
|
|
191
|
+
* await client.namespaces.setQuota({
|
|
192
|
+
* namespace: 'production',
|
|
193
|
+
* service: 'sandbox',
|
|
194
|
+
* quotaLimit: 500,
|
|
195
|
+
* period: 'monthly',
|
|
196
|
+
* overdraft: 50,
|
|
197
|
+
* onOverdraftAction: 'stop_workspaces',
|
|
198
|
+
* });
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
async setQuota(params) {
|
|
202
|
+
return this._http.request({
|
|
203
|
+
method: 'POST',
|
|
204
|
+
path: '/credits/namespace-quota',
|
|
205
|
+
body: params,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Reset quota usage to zero for a namespace + service.
|
|
210
|
+
*
|
|
211
|
+
* ```ts
|
|
212
|
+
* await client.namespaces.resetQuota({ namespace: 'production', service: 'sandbox' });
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
async resetQuota(params) {
|
|
216
|
+
return this._http.request({
|
|
217
|
+
method: 'POST',
|
|
218
|
+
path: '/credits/reset-quota',
|
|
219
|
+
body: params,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* List namespaces enriched with quota and spending data.
|
|
224
|
+
*
|
|
225
|
+
* Returns namespace entities merged with financial info — total spent,
|
|
226
|
+
* active quotas, and per-service breakdown.
|
|
227
|
+
*
|
|
228
|
+
* ```ts
|
|
229
|
+
* const res = await client.namespaces.listWithQuotas({ status: 'active', limit: 20 });
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
async listWithQuotas(params = {}) {
|
|
233
|
+
return this._http.request({
|
|
234
|
+
method: 'GET',
|
|
235
|
+
path: '/credits/namespaces',
|
|
236
|
+
query: params,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Get comprehensive namespace details — quotas, usage stats, service breakdown,
|
|
241
|
+
* daily timeline, and recent transactions.
|
|
242
|
+
*
|
|
243
|
+
* ```ts
|
|
244
|
+
* const details = await client.namespaces.getDetails('production', { days: 30 });
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
async getDetails(namespace, params = {}) {
|
|
248
|
+
return this._http.request({
|
|
249
|
+
method: 'GET',
|
|
250
|
+
path: `/credits/namespaces/${namespace}`,
|
|
251
|
+
query: params,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
// ── Default Quotas ────────────────────────────────────────────────
|
|
255
|
+
/**
|
|
256
|
+
* Set a default quota configuration.
|
|
257
|
+
*
|
|
258
|
+
* Default quotas are automatically applied to new namespaces when
|
|
259
|
+
* `autoApply` is enabled. Useful for SaaS platforms that assign a standard
|
|
260
|
+
* spending limit to every customer namespace.
|
|
261
|
+
*
|
|
262
|
+
* ```ts
|
|
263
|
+
* await client.namespaces.setDefaultQuota({
|
|
264
|
+
* service: 'sandbox',
|
|
265
|
+
* quotaLimit: 100,
|
|
266
|
+
* period: 'monthly',
|
|
267
|
+
* overdraft: 10,
|
|
268
|
+
* onOverdraftAction: 'block',
|
|
269
|
+
* autoApply: true,
|
|
270
|
+
* });
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
async setDefaultQuota(params) {
|
|
274
|
+
return this._http.request({
|
|
275
|
+
method: 'POST',
|
|
276
|
+
path: '/credits/defaults',
|
|
277
|
+
body: { ...params, level: 'namespace' },
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Get the default quota configuration for a service.
|
|
282
|
+
*
|
|
283
|
+
* ```ts
|
|
284
|
+
* const config = await client.namespaces.getDefaultQuota('sandbox');
|
|
285
|
+
* ```
|
|
286
|
+
*/
|
|
287
|
+
async getDefaultQuota(service) {
|
|
288
|
+
return this._http.request({
|
|
289
|
+
method: 'GET',
|
|
290
|
+
path: '/credits/defaults',
|
|
291
|
+
query: { level: 'namespace', service },
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Get all default quota configurations.
|
|
296
|
+
*
|
|
297
|
+
* ```ts
|
|
298
|
+
* const configs = await client.namespaces.getAllDefaultQuotas();
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
301
|
+
async getAllDefaultQuotas() {
|
|
302
|
+
return this._http.request({
|
|
303
|
+
method: 'GET',
|
|
304
|
+
path: '/credits/defaults/all',
|
|
305
|
+
query: { level: 'namespace' },
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Delete a default quota configuration for a service.
|
|
310
|
+
*
|
|
311
|
+
* ```ts
|
|
312
|
+
* await client.namespaces.deleteDefaultQuota('sandbox');
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
315
|
+
async deleteDefaultQuota(service) {
|
|
316
|
+
return this._http.request({
|
|
317
|
+
method: 'DELETE',
|
|
318
|
+
path: '/credits/defaults',
|
|
319
|
+
body: { level: 'namespace', service },
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Toggle auto-apply for a default quota. When enabled, the default quota
|
|
324
|
+
* is automatically assigned to new namespaces that don't have one yet.
|
|
325
|
+
*
|
|
326
|
+
* ```ts
|
|
327
|
+
* await client.namespaces.toggleDefaultQuotaAutoApply('sandbox', true);
|
|
328
|
+
* ```
|
|
329
|
+
*/
|
|
330
|
+
async toggleDefaultQuotaAutoApply(service, autoApply) {
|
|
331
|
+
return this._http.request({
|
|
332
|
+
method: 'POST',
|
|
333
|
+
path: '/credits/defaults/toggle-auto-apply',
|
|
334
|
+
body: { level: 'namespace', service, autoApply },
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
//# sourceMappingURL=namespace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.js","sourceRoot":"","sources":["../src/namespace.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,SAAS;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G;IACH,KAAK,CAAC,eAAe,CAAC,OAAe;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YACxB,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE;SACvC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,mBAAmB;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YACxB,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,uBAAuB;YAC7B,KAAK,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE;SAC9B,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,kBAAkB,CAAC,OAAe;QACtC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YACxB,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE;SACtC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,2BAA2B,CAAC,OAAe,EAAE,SAAkB;QACnE,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YACxB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,qCAAqC;YAC3C,IAAI,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE;SACjD,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ export type { NetworkSpec, FirewallRule, PrivateLink } from './network.js';
|
|
|
5
5
|
export type { ResourceSpec, LifecycleSpec } from './resources.js';
|
|
6
6
|
export type { RuntimeOptions, FileListParams, FileEntry, FileListResponse, FileReadParams, FileReadResponse, FileWriteParams, FileWriteResponse, FileMkdirParams, FileStatParams, FileStatResponse, FileDeleteParams, ContentSearchParams, SearchMatch, ContentSearchResponse, FileSearchParams, FileSearchResponse, SearchStatusResponse, SearchInitResponse, ExecRunParams, ExecTask, ExecListResponse, ExecStreamEvent, TerminalCreateParams, TerminalSession, TerminalListResponse, TerminalScrollbackResponse, WatcherCreateParams, WatcherInfo, WatcherListResponse, WSOptions, WSMessage, WSTerminalResize, WSTerminalExit, WSTerminalEvent, WSWatcherChange, WSWatcherReady, WSWatcherOverflow, WSWatcherEvent, } from './runtime.js';
|
|
7
7
|
export type { LifecycleStatus, MakeTemporaryParams, UpdateTtlParams, SshStatus, SshPasswordParams, SshKeyParams, PublicAccessPort, ExposePortParams, SnapshotParams, ArchiveCreateParams, ArchiveInfo, WorkloadCreateParams, WorkloadUpdateParams, WorkloadInfo, WorkloadListParams, UsageParams, UpdateResourcesParams, UpdateMetadataParams, ApiAccessStatus, RawTokenResponse, NetworkUpdateParams, NetworkConfig, LogsParams, LogFile, LogStreamEvent, StatsEvent, WorkloadStatsEvent, WorkloadLogEntry, ImagesListParams, } from './workspace-resources.js';
|
|
8
|
+
export type { NamespaceStatus, NamespaceType, NamespaceResourceLimits, NamespaceData, NamespaceCreateParams, NamespaceUpdateParams, NamespaceListParams, NamespaceListResponse, NamespaceActivity, NamespaceActivityParams, NamespaceUsageParams, NamespaceDeleteParams, QuotaPeriod, OverdraftAction, NamespaceQuota, SetNamespaceQuotaParams, ResetNamespaceQuotaParams, NamespaceListWithQuotasParams, NamespaceDetailsParams, DefaultQuotaConfig, SetDefaultQuotaParams, ToggleDefaultQuotaAutoApplyParams, DeleteDefaultQuotaParams, } from './namespace.js';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3E,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGlE,YAAY,EACV,cAAc,EACd,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EAEnB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,cAAc,GACf,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,OAAO,EACP,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types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,EACd,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAGlC,YAAY,EACV,eAAe,EACf,aAAa,EACb,uBAAuB,EACvB,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC7B,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,iCAAiC,EACjC,wBAAwB,GACzB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
export type NamespaceStatus = 'active' | 'inactive' | 'suspended';
|
|
2
|
+
export type NamespaceType = 'default' | 'production' | 'staging' | 'development' | 'testing';
|
|
3
|
+
/** Per-namespace workspace resource caps. `null` = inherit from account plan. */
|
|
4
|
+
export interface NamespaceResourceLimits {
|
|
5
|
+
max_workspaces?: number | null;
|
|
6
|
+
max_vcpus?: number | null;
|
|
7
|
+
max_ram_mb?: number | null;
|
|
8
|
+
max_disk_gb?: number | null;
|
|
9
|
+
}
|
|
10
|
+
/** Namespace entity returned by the API. */
|
|
11
|
+
export interface NamespaceData {
|
|
12
|
+
id: string;
|
|
13
|
+
client_id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
slug: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
status: NamespaceStatus;
|
|
18
|
+
type: string;
|
|
19
|
+
is_default: boolean;
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
tags?: string[];
|
|
22
|
+
resource_limits?: NamespaceResourceLimits | null;
|
|
23
|
+
created_at: string;
|
|
24
|
+
updated_at: string;
|
|
25
|
+
last_active_at?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Parameters for creating a namespace. */
|
|
28
|
+
export interface NamespaceCreateParams {
|
|
29
|
+
name: string;
|
|
30
|
+
slug?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
type?: NamespaceType;
|
|
33
|
+
isDefault?: boolean;
|
|
34
|
+
metadata?: Record<string, unknown>;
|
|
35
|
+
tags?: string[];
|
|
36
|
+
resource_limits?: NamespaceResourceLimits;
|
|
37
|
+
}
|
|
38
|
+
/** Parameters for updating a namespace. */
|
|
39
|
+
export interface NamespaceUpdateParams {
|
|
40
|
+
name?: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
status?: NamespaceStatus;
|
|
43
|
+
type?: NamespaceType;
|
|
44
|
+
tags?: string[];
|
|
45
|
+
metadata?: Record<string, unknown>;
|
|
46
|
+
resource_limits?: NamespaceResourceLimits;
|
|
47
|
+
}
|
|
48
|
+
/** Parameters for listing namespaces. */
|
|
49
|
+
export interface NamespaceListParams {
|
|
50
|
+
limit?: number;
|
|
51
|
+
offset?: number;
|
|
52
|
+
status?: NamespaceStatus;
|
|
53
|
+
type?: NamespaceType;
|
|
54
|
+
search?: string;
|
|
55
|
+
sortBy?: 'created_at' | 'updated_at' | 'name';
|
|
56
|
+
sortOrder?: 'ASC' | 'DESC';
|
|
57
|
+
}
|
|
58
|
+
/** Response from listing namespaces. */
|
|
59
|
+
export interface NamespaceListResponse {
|
|
60
|
+
success: boolean;
|
|
61
|
+
data: NamespaceData[];
|
|
62
|
+
pagination: {
|
|
63
|
+
total: number;
|
|
64
|
+
limit: number;
|
|
65
|
+
offset: number;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** Activity log entry. */
|
|
69
|
+
export interface NamespaceActivity {
|
|
70
|
+
id: number;
|
|
71
|
+
namespace_id: string;
|
|
72
|
+
user_id?: string;
|
|
73
|
+
action: string;
|
|
74
|
+
description?: string;
|
|
75
|
+
changes?: Record<string, unknown>;
|
|
76
|
+
ip_address?: string;
|
|
77
|
+
user_agent?: string;
|
|
78
|
+
created_at: string;
|
|
79
|
+
}
|
|
80
|
+
/** Parameters for fetching activity log. */
|
|
81
|
+
export interface NamespaceActivityParams {
|
|
82
|
+
limit?: number;
|
|
83
|
+
offset?: number;
|
|
84
|
+
}
|
|
85
|
+
/** Parameters for fetching usage. */
|
|
86
|
+
export interface NamespaceUsageParams {
|
|
87
|
+
service?: string;
|
|
88
|
+
days?: number;
|
|
89
|
+
}
|
|
90
|
+
/** Parameters for deleting a namespace. */
|
|
91
|
+
export interface NamespaceDeleteParams {
|
|
92
|
+
deleteWorkspaces?: boolean;
|
|
93
|
+
}
|
|
94
|
+
export type QuotaPeriod = 'daily' | 'monthly' | 'unlimited';
|
|
95
|
+
export type OverdraftAction = 'block' | 'stop_workspaces';
|
|
96
|
+
/** A namespace quota for a specific service. */
|
|
97
|
+
export interface NamespaceQuota {
|
|
98
|
+
id: number;
|
|
99
|
+
client_id: string;
|
|
100
|
+
namespace: string;
|
|
101
|
+
service: string;
|
|
102
|
+
quota_limit: number | null;
|
|
103
|
+
quota_used: number;
|
|
104
|
+
overdraft: number;
|
|
105
|
+
on_overdraft_action: OverdraftAction;
|
|
106
|
+
period: QuotaPeriod;
|
|
107
|
+
period_start?: string;
|
|
108
|
+
period_end?: string;
|
|
109
|
+
enabled: boolean;
|
|
110
|
+
created_at: string;
|
|
111
|
+
updated_at: string;
|
|
112
|
+
}
|
|
113
|
+
/** Parameters for setting a namespace quota. */
|
|
114
|
+
export interface SetNamespaceQuotaParams {
|
|
115
|
+
namespace: string;
|
|
116
|
+
service: string;
|
|
117
|
+
quotaLimit: number;
|
|
118
|
+
period?: QuotaPeriod;
|
|
119
|
+
overdraft?: number;
|
|
120
|
+
onOverdraftAction?: OverdraftAction;
|
|
121
|
+
}
|
|
122
|
+
/** Parameters for resetting quota usage. */
|
|
123
|
+
export interface ResetNamespaceQuotaParams {
|
|
124
|
+
namespace: string;
|
|
125
|
+
service: string;
|
|
126
|
+
}
|
|
127
|
+
/** Parameters for listing namespaces with quota/spending data. */
|
|
128
|
+
export interface NamespaceListWithQuotasParams {
|
|
129
|
+
limit?: number;
|
|
130
|
+
offset?: number;
|
|
131
|
+
search?: string;
|
|
132
|
+
status?: NamespaceStatus;
|
|
133
|
+
}
|
|
134
|
+
/** Parameters for getting detailed namespace quota info. */
|
|
135
|
+
export interface NamespaceDetailsParams {
|
|
136
|
+
days?: number;
|
|
137
|
+
}
|
|
138
|
+
/** Default quota configuration. */
|
|
139
|
+
export interface DefaultQuotaConfig {
|
|
140
|
+
id: number;
|
|
141
|
+
client_id: string;
|
|
142
|
+
level: 'namespace' | 'end_user';
|
|
143
|
+
service: string;
|
|
144
|
+
quota_limit: number;
|
|
145
|
+
overdraft: number;
|
|
146
|
+
on_overdraft_action: OverdraftAction;
|
|
147
|
+
period: QuotaPeriod;
|
|
148
|
+
auto_apply: boolean;
|
|
149
|
+
enabled: boolean;
|
|
150
|
+
}
|
|
151
|
+
/** Parameters for setting a default quota. */
|
|
152
|
+
export interface SetDefaultQuotaParams {
|
|
153
|
+
service: string;
|
|
154
|
+
quotaLimit: number;
|
|
155
|
+
period?: QuotaPeriod;
|
|
156
|
+
overdraft?: number;
|
|
157
|
+
onOverdraftAction?: OverdraftAction;
|
|
158
|
+
autoApply?: boolean;
|
|
159
|
+
}
|
|
160
|
+
/** Parameters for toggling auto-apply on a default quota. */
|
|
161
|
+
export interface ToggleDefaultQuotaAutoApplyParams {
|
|
162
|
+
service: string;
|
|
163
|
+
autoApply: boolean;
|
|
164
|
+
}
|
|
165
|
+
/** Parameters for deleting a default quota. */
|
|
166
|
+
export interface DeleteDefaultQuotaParams {
|
|
167
|
+
service: string;
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../src/types/namespace.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,YAAY,GAAG,S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