oblien 2.0.2 → 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 +27 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +30 -6
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -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/dist/workspace-handle.d.ts +112 -0
- package/dist/workspace-handle.d.ts.map +1 -0
- package/dist/workspace-handle.js +141 -0
- package/dist/workspace-handle.js.map +1 -0
- package/dist/workspace.d.ts +17 -7
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +47 -12
- package/dist/workspace.js.map +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { HttpClient } from './http.js';
|
|
2
2
|
import { Workspace } from './workspace.js';
|
|
3
|
+
import { WorkspaceHandle } from './workspace-handle.js';
|
|
4
|
+
import { Namespace } from './namespace.js';
|
|
3
5
|
import type { OblienOptions } from './types/index.js';
|
|
4
6
|
/**
|
|
5
7
|
* Oblien API client.
|
|
@@ -12,20 +14,39 @@ import type { OblienOptions } from './types/index.js';
|
|
|
12
14
|
* clientSecret: process.env.OBLIEN_CLIENT_SECRET!,
|
|
13
15
|
* });
|
|
14
16
|
*
|
|
15
|
-
* //
|
|
17
|
+
* // Collection-level operations (list, create, quota)
|
|
16
18
|
* const data = await client.workspaces.create({ image: 'node' });
|
|
17
|
-
* await client.workspaces.start(data.id);
|
|
18
19
|
*
|
|
19
|
-
* //
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* // Scoped handle — bind to a single workspace
|
|
21
|
+
* const ws = client.workspace(data.id);
|
|
22
|
+
* await ws.start();
|
|
23
|
+
* const rt = await ws.runtime();
|
|
24
|
+
* await rt.exec.run(['node', '--version']);
|
|
22
25
|
* ```
|
|
23
26
|
*/
|
|
24
27
|
export declare class Oblien {
|
|
25
28
|
/** @internal — used by resource classes to make HTTP requests. */
|
|
26
29
|
readonly _http: HttpClient;
|
|
27
|
-
/** Workspace operations (CRUD, power, quota). */
|
|
30
|
+
/** Workspace operations (CRUD, power, quota, and sub-resources). */
|
|
28
31
|
readonly workspaces: Workspace;
|
|
32
|
+
/** Namespace operations (CRUD, lifecycle, activity, usage). */
|
|
33
|
+
readonly namespaces: Namespace;
|
|
29
34
|
constructor(options: OblienOptions);
|
|
35
|
+
/**
|
|
36
|
+
* Get a scoped {@link WorkspaceHandle} bound to a single workspace ID.
|
|
37
|
+
*
|
|
38
|
+
* Every method on the handle delegates to `client.workspaces` with
|
|
39
|
+
* the ID pre-filled, so you never have to pass it again.
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* const ws = client.workspace('ws_abc');
|
|
43
|
+
*
|
|
44
|
+
* await ws.start();
|
|
45
|
+
* const rt = await ws.runtime();
|
|
46
|
+
* await rt.files.list({ dirPath: '/' });
|
|
47
|
+
* await ws.stop();
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
workspace(workspaceId: string): WorkspaceHandle;
|
|
30
51
|
}
|
|
31
52
|
//# sourceMappingURL=client.d.ts.map
|
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,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD
|
|
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,5 +1,7 @@
|
|
|
1
1
|
import { HttpClient } from './http.js';
|
|
2
2
|
import { Workspace } from './workspace.js';
|
|
3
|
+
import { WorkspaceHandle } from './workspace-handle.js';
|
|
4
|
+
import { Namespace } from './namespace.js';
|
|
3
5
|
/**
|
|
4
6
|
* Oblien API client.
|
|
5
7
|
*
|
|
@@ -11,23 +13,45 @@ import { Workspace } from './workspace.js';
|
|
|
11
13
|
* clientSecret: process.env.OBLIEN_CLIENT_SECRET!,
|
|
12
14
|
* });
|
|
13
15
|
*
|
|
14
|
-
* //
|
|
16
|
+
* // Collection-level operations (list, create, quota)
|
|
15
17
|
* const data = await client.workspaces.create({ image: 'node' });
|
|
16
|
-
* await client.workspaces.start(data.id);
|
|
17
18
|
*
|
|
18
|
-
* //
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* // Scoped handle — bind to a single workspace
|
|
20
|
+
* const ws = client.workspace(data.id);
|
|
21
|
+
* await ws.start();
|
|
22
|
+
* const rt = await ws.runtime();
|
|
23
|
+
* await rt.exec.run(['node', '--version']);
|
|
21
24
|
* ```
|
|
22
25
|
*/
|
|
23
26
|
export class Oblien {
|
|
24
27
|
/** @internal — used by resource classes to make HTTP requests. */
|
|
25
28
|
_http;
|
|
26
|
-
/** Workspace operations (CRUD, power, quota). */
|
|
29
|
+
/** Workspace operations (CRUD, power, quota, and sub-resources). */
|
|
27
30
|
workspaces;
|
|
31
|
+
/** Namespace operations (CRUD, lifecycle, activity, usage). */
|
|
32
|
+
namespaces;
|
|
28
33
|
constructor(options) {
|
|
29
34
|
this._http = new HttpClient(options);
|
|
30
35
|
this.workspaces = new Workspace(this);
|
|
36
|
+
this.namespaces = new Namespace(this);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get a scoped {@link WorkspaceHandle} bound to a single workspace ID.
|
|
40
|
+
*
|
|
41
|
+
* Every method on the handle delegates to `client.workspaces` with
|
|
42
|
+
* the ID pre-filled, so you never have to pass it again.
|
|
43
|
+
*
|
|
44
|
+
* ```ts
|
|
45
|
+
* const ws = client.workspace('ws_abc');
|
|
46
|
+
*
|
|
47
|
+
* await ws.start();
|
|
48
|
+
* const rt = await ws.runtime();
|
|
49
|
+
* await rt.files.list({ dirPath: '/' });
|
|
50
|
+
* await ws.stop();
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
workspace(workspaceId) {
|
|
54
|
+
return new WorkspaceHandle(this.workspaces, workspaceId);
|
|
31
55
|
}
|
|
32
56
|
}
|
|
33
57
|
//# sourceMappingURL=client.js.map
|
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;AAG3C
|
|
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
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { Oblien as default } from './client.js';
|
|
2
2
|
export { Oblien } from './client.js';
|
|
3
3
|
export { Workspace } from './workspace.js';
|
|
4
|
+
export { WorkspaceHandle } from './workspace-handle.js';
|
|
5
|
+
export { Namespace } from './namespace.js';
|
|
4
6
|
export { Runtime } from './runtime.js';
|
|
5
7
|
export { RuntimeWebSocket } from './runtime/ws.js';
|
|
6
8
|
export { OblienError, AuthenticationError, NotFoundError, RateLimitError, ValidationError, PaymentRequiredError, ConflictError, } from './error.js';
|
|
7
|
-
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';
|
|
8
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,OAAO,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gB,
|
|
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,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,EAEhB,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,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,8 @@ export { Oblien as default } from './client.js';
|
|
|
3
3
|
// ── Named exports ──────────────────────────────────────────────────
|
|
4
4
|
export { Oblien } from './client.js';
|
|
5
5
|
export { Workspace } from './workspace.js';
|
|
6
|
+
export { WorkspaceHandle } from './workspace-handle.js';
|
|
7
|
+
export { Namespace } from './namespace.js';
|
|
6
8
|
export { Runtime } from './runtime.js';
|
|
7
9
|
export { RuntimeWebSocket } from './runtime/ws.js';
|
|
8
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,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,KAA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