@objectstack/client 5.2.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +26 -26
- package/dist/index.d.ts +26 -26
- package/dist/index.js +52 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -52
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -264,13 +264,13 @@ interface ClientConfig {
|
|
|
264
264
|
*/
|
|
265
265
|
debug?: boolean;
|
|
266
266
|
/**
|
|
267
|
-
* Active project id (UUID of `
|
|
268
|
-
* client injects an `X-
|
|
267
|
+
* Active project id (UUID of `sys_environment`). When present, the
|
|
268
|
+
* client injects an `X-Environment-Id` header on every request so the
|
|
269
269
|
* server's tenant router can resolve the physical data-plane database.
|
|
270
270
|
*
|
|
271
271
|
* @see docs/adr/0002-project-database-isolation.md
|
|
272
272
|
*/
|
|
273
|
-
|
|
273
|
+
environmentId?: string;
|
|
274
274
|
}
|
|
275
275
|
/**
|
|
276
276
|
* Discovery Result
|
|
@@ -374,7 +374,7 @@ interface StandardError {
|
|
|
374
374
|
declare class ObjectStackClient {
|
|
375
375
|
private baseUrl;
|
|
376
376
|
private token?;
|
|
377
|
-
private
|
|
377
|
+
private environmentId?;
|
|
378
378
|
private fetchImpl;
|
|
379
379
|
private discoveryInfo?;
|
|
380
380
|
private logger;
|
|
@@ -607,12 +607,12 @@ declare class ObjectStackClient {
|
|
|
607
607
|
* through this API.
|
|
608
608
|
*
|
|
609
609
|
* Endpoints:
|
|
610
|
-
* - GET /api/v1/cloud/
|
|
611
|
-
* - GET /api/v1/cloud/
|
|
612
|
-
* - POST /api/v1/cloud/
|
|
613
|
-
* - PATCH /api/v1/cloud/
|
|
614
|
-
* - POST /api/v1/cloud/
|
|
615
|
-
* - POST /api/v1/cloud/
|
|
610
|
+
* - GET /api/v1/cloud/environments → list environments
|
|
611
|
+
* - GET /api/v1/cloud/environments/:id → get one (with database info)
|
|
612
|
+
* - POST /api/v1/cloud/environments → provision a new project
|
|
613
|
+
* - PATCH /api/v1/cloud/environments/:id → update (displayName, plan, status, …)
|
|
614
|
+
* - POST /api/v1/cloud/environments/:id/activate → set as session's active project
|
|
615
|
+
* - POST /api/v1/cloud/environments/:id/credentials/rotate → rotate credential
|
|
616
616
|
*
|
|
617
617
|
* @see docs/adr/0002-project-database-isolation.md
|
|
618
618
|
*/
|
|
@@ -655,7 +655,7 @@ declare class ObjectStackClient {
|
|
|
655
655
|
is_default?: boolean;
|
|
656
656
|
is_system?: boolean;
|
|
657
657
|
storage_limit_mb?: number;
|
|
658
|
-
|
|
658
|
+
clone_from_environment_id?: string;
|
|
659
659
|
template_id?: string;
|
|
660
660
|
metadata?: Record<string, unknown>;
|
|
661
661
|
}) => Promise<{
|
|
@@ -671,13 +671,13 @@ declare class ObjectStackClient {
|
|
|
671
671
|
/**
|
|
672
672
|
* Cascade-delete a project: cleans up credential/member/package_installation
|
|
673
673
|
* rows, releases the physical database via the provisioning adapter, and
|
|
674
|
-
* removes the `
|
|
674
|
+
* removes the `sys_environment` row. Default projects require `force: true`.
|
|
675
675
|
*/
|
|
676
676
|
delete: (id: string, opts?: {
|
|
677
677
|
force?: boolean;
|
|
678
678
|
}) => Promise<{
|
|
679
679
|
deleted: boolean;
|
|
680
|
-
|
|
680
|
+
environmentId: string;
|
|
681
681
|
warnings: string[];
|
|
682
682
|
}>;
|
|
683
683
|
/**
|
|
@@ -745,7 +745,7 @@ declare class ObjectStackClient {
|
|
|
745
745
|
* Branches without a head row (e.g. all rows demoted) are omitted.
|
|
746
746
|
*/
|
|
747
747
|
listBranches: (id: string) => Promise<{
|
|
748
|
-
|
|
748
|
+
environmentId: string;
|
|
749
749
|
branches: Array<{
|
|
750
750
|
branch: string;
|
|
751
751
|
headCommitId: string;
|
|
@@ -761,7 +761,7 @@ declare class ObjectStackClient {
|
|
|
761
761
|
* 409 if `to` already has rows.
|
|
762
762
|
*/
|
|
763
763
|
renameBranch: (id: string, from: string, to: string) => Promise<{
|
|
764
|
-
|
|
764
|
+
environmentId: string;
|
|
765
765
|
from: string;
|
|
766
766
|
to: string;
|
|
767
767
|
renamed: number;
|
|
@@ -773,7 +773,7 @@ declare class ObjectStackClient {
|
|
|
773
773
|
* deleted.
|
|
774
774
|
*/
|
|
775
775
|
deleteBranch: (id: string, name: string) => Promise<{
|
|
776
|
-
|
|
776
|
+
environmentId: string;
|
|
777
777
|
branch: string;
|
|
778
778
|
demoted: number;
|
|
779
779
|
totalRevisions: number;
|
|
@@ -783,7 +783,7 @@ declare class ObjectStackClient {
|
|
|
783
783
|
* Marks the target revision is_current=true and demotes the prior one.
|
|
784
784
|
*/
|
|
785
785
|
activateRevision: (id: string, commitId: string) => Promise<{
|
|
786
|
-
|
|
786
|
+
environmentId: string;
|
|
787
787
|
commitId: string;
|
|
788
788
|
activated: boolean;
|
|
789
789
|
previousCommitId: string | null;
|
|
@@ -904,12 +904,12 @@ declare class ObjectStackClient {
|
|
|
904
904
|
* Project-scoped client factory.
|
|
905
905
|
*
|
|
906
906
|
* Returns a thin wrapper around the data / meta / packages namespaces that
|
|
907
|
-
* prefixes every request with `/api/v1/
|
|
907
|
+
* prefixes every request with `/api/v1/environments/:environmentId/...`. Use this
|
|
908
908
|
* when the server has `enableProjectScoping: true` in its REST API config.
|
|
909
909
|
*
|
|
910
910
|
* Backward compatibility: `client.data.*`, `client.meta.*`, and
|
|
911
911
|
* `client.packages.*` continue to work unchanged; they hit unscoped routes
|
|
912
|
-
* and rely on hostname / `X-
|
|
912
|
+
* and rely on hostname / `X-Environment-Id` header / session resolution.
|
|
913
913
|
*
|
|
914
914
|
* @example
|
|
915
915
|
* ```ts
|
|
@@ -918,7 +918,7 @@ declare class ObjectStackClient {
|
|
|
918
918
|
* const objects = await scoped.meta.getItems('object');
|
|
919
919
|
* ```
|
|
920
920
|
*/
|
|
921
|
-
project(
|
|
921
|
+
project(environmentId: string): ScopedProjectClient;
|
|
922
922
|
/** @internal */
|
|
923
923
|
_baseUrl(): string;
|
|
924
924
|
/** @internal */
|
|
@@ -1241,7 +1241,7 @@ declare class ObjectStackClient {
|
|
|
1241
1241
|
* Update the active project id used for subsequent requests.
|
|
1242
1242
|
* Pass `undefined` to clear (falls back to the session default).
|
|
1243
1243
|
*/
|
|
1244
|
-
setProjectId(
|
|
1244
|
+
setProjectId(environmentId: string | undefined): void;
|
|
1245
1245
|
/**
|
|
1246
1246
|
* Current active project id (if set).
|
|
1247
1247
|
*/
|
|
@@ -1924,7 +1924,7 @@ declare class ObjectStackClient {
|
|
|
1924
1924
|
* Project-scoped sub-client.
|
|
1925
1925
|
*
|
|
1926
1926
|
* Wraps an {@link ObjectStackClient} and prefixes every request with
|
|
1927
|
-
* `/api/v1/
|
|
1927
|
+
* `/api/v1/environments/:environmentId/...` so a single client instance can talk to
|
|
1928
1928
|
* multiple projects without mutating global state.
|
|
1929
1929
|
*
|
|
1930
1930
|
* The scoped client exposes the same shape as the `data`, `meta`, `batch`,
|
|
@@ -1935,9 +1935,9 @@ declare class ObjectStackClient {
|
|
|
1935
1935
|
*/
|
|
1936
1936
|
declare class ScopedProjectClient {
|
|
1937
1937
|
private readonly parent;
|
|
1938
|
-
private readonly
|
|
1939
|
-
constructor(parent: ObjectStackClient,
|
|
1940
|
-
/** The
|
|
1938
|
+
private readonly environmentId;
|
|
1939
|
+
constructor(parent: ObjectStackClient, environmentId: string);
|
|
1940
|
+
/** The environmentId this client is scoped to. */
|
|
1941
1941
|
getProjectId(): string;
|
|
1942
1942
|
/** Prefix segment inserted between the baseUrl and the resource path. */
|
|
1943
1943
|
private scope;
|
|
@@ -2005,7 +2005,7 @@ declare class ScopedProjectClient {
|
|
|
2005
2005
|
* Automation (Flow) operations scoped to this project.
|
|
2006
2006
|
*
|
|
2007
2007
|
* Thin wrapper around the dispatcher's automation routes, mounted under
|
|
2008
|
-
* `/api/v1/
|
|
2008
|
+
* `/api/v1/environments/:environmentId/automation/...`. Surface mirrors the methods
|
|
2009
2009
|
* needed by Studio's Flow viewer: read flow definition, execute (trigger),
|
|
2010
2010
|
* list runs, fetch a single run.
|
|
2011
2011
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -264,13 +264,13 @@ interface ClientConfig {
|
|
|
264
264
|
*/
|
|
265
265
|
debug?: boolean;
|
|
266
266
|
/**
|
|
267
|
-
* Active project id (UUID of `
|
|
268
|
-
* client injects an `X-
|
|
267
|
+
* Active project id (UUID of `sys_environment`). When present, the
|
|
268
|
+
* client injects an `X-Environment-Id` header on every request so the
|
|
269
269
|
* server's tenant router can resolve the physical data-plane database.
|
|
270
270
|
*
|
|
271
271
|
* @see docs/adr/0002-project-database-isolation.md
|
|
272
272
|
*/
|
|
273
|
-
|
|
273
|
+
environmentId?: string;
|
|
274
274
|
}
|
|
275
275
|
/**
|
|
276
276
|
* Discovery Result
|
|
@@ -374,7 +374,7 @@ interface StandardError {
|
|
|
374
374
|
declare class ObjectStackClient {
|
|
375
375
|
private baseUrl;
|
|
376
376
|
private token?;
|
|
377
|
-
private
|
|
377
|
+
private environmentId?;
|
|
378
378
|
private fetchImpl;
|
|
379
379
|
private discoveryInfo?;
|
|
380
380
|
private logger;
|
|
@@ -607,12 +607,12 @@ declare class ObjectStackClient {
|
|
|
607
607
|
* through this API.
|
|
608
608
|
*
|
|
609
609
|
* Endpoints:
|
|
610
|
-
* - GET /api/v1/cloud/
|
|
611
|
-
* - GET /api/v1/cloud/
|
|
612
|
-
* - POST /api/v1/cloud/
|
|
613
|
-
* - PATCH /api/v1/cloud/
|
|
614
|
-
* - POST /api/v1/cloud/
|
|
615
|
-
* - POST /api/v1/cloud/
|
|
610
|
+
* - GET /api/v1/cloud/environments → list environments
|
|
611
|
+
* - GET /api/v1/cloud/environments/:id → get one (with database info)
|
|
612
|
+
* - POST /api/v1/cloud/environments → provision a new project
|
|
613
|
+
* - PATCH /api/v1/cloud/environments/:id → update (displayName, plan, status, …)
|
|
614
|
+
* - POST /api/v1/cloud/environments/:id/activate → set as session's active project
|
|
615
|
+
* - POST /api/v1/cloud/environments/:id/credentials/rotate → rotate credential
|
|
616
616
|
*
|
|
617
617
|
* @see docs/adr/0002-project-database-isolation.md
|
|
618
618
|
*/
|
|
@@ -655,7 +655,7 @@ declare class ObjectStackClient {
|
|
|
655
655
|
is_default?: boolean;
|
|
656
656
|
is_system?: boolean;
|
|
657
657
|
storage_limit_mb?: number;
|
|
658
|
-
|
|
658
|
+
clone_from_environment_id?: string;
|
|
659
659
|
template_id?: string;
|
|
660
660
|
metadata?: Record<string, unknown>;
|
|
661
661
|
}) => Promise<{
|
|
@@ -671,13 +671,13 @@ declare class ObjectStackClient {
|
|
|
671
671
|
/**
|
|
672
672
|
* Cascade-delete a project: cleans up credential/member/package_installation
|
|
673
673
|
* rows, releases the physical database via the provisioning adapter, and
|
|
674
|
-
* removes the `
|
|
674
|
+
* removes the `sys_environment` row. Default projects require `force: true`.
|
|
675
675
|
*/
|
|
676
676
|
delete: (id: string, opts?: {
|
|
677
677
|
force?: boolean;
|
|
678
678
|
}) => Promise<{
|
|
679
679
|
deleted: boolean;
|
|
680
|
-
|
|
680
|
+
environmentId: string;
|
|
681
681
|
warnings: string[];
|
|
682
682
|
}>;
|
|
683
683
|
/**
|
|
@@ -745,7 +745,7 @@ declare class ObjectStackClient {
|
|
|
745
745
|
* Branches without a head row (e.g. all rows demoted) are omitted.
|
|
746
746
|
*/
|
|
747
747
|
listBranches: (id: string) => Promise<{
|
|
748
|
-
|
|
748
|
+
environmentId: string;
|
|
749
749
|
branches: Array<{
|
|
750
750
|
branch: string;
|
|
751
751
|
headCommitId: string;
|
|
@@ -761,7 +761,7 @@ declare class ObjectStackClient {
|
|
|
761
761
|
* 409 if `to` already has rows.
|
|
762
762
|
*/
|
|
763
763
|
renameBranch: (id: string, from: string, to: string) => Promise<{
|
|
764
|
-
|
|
764
|
+
environmentId: string;
|
|
765
765
|
from: string;
|
|
766
766
|
to: string;
|
|
767
767
|
renamed: number;
|
|
@@ -773,7 +773,7 @@ declare class ObjectStackClient {
|
|
|
773
773
|
* deleted.
|
|
774
774
|
*/
|
|
775
775
|
deleteBranch: (id: string, name: string) => Promise<{
|
|
776
|
-
|
|
776
|
+
environmentId: string;
|
|
777
777
|
branch: string;
|
|
778
778
|
demoted: number;
|
|
779
779
|
totalRevisions: number;
|
|
@@ -783,7 +783,7 @@ declare class ObjectStackClient {
|
|
|
783
783
|
* Marks the target revision is_current=true and demotes the prior one.
|
|
784
784
|
*/
|
|
785
785
|
activateRevision: (id: string, commitId: string) => Promise<{
|
|
786
|
-
|
|
786
|
+
environmentId: string;
|
|
787
787
|
commitId: string;
|
|
788
788
|
activated: boolean;
|
|
789
789
|
previousCommitId: string | null;
|
|
@@ -904,12 +904,12 @@ declare class ObjectStackClient {
|
|
|
904
904
|
* Project-scoped client factory.
|
|
905
905
|
*
|
|
906
906
|
* Returns a thin wrapper around the data / meta / packages namespaces that
|
|
907
|
-
* prefixes every request with `/api/v1/
|
|
907
|
+
* prefixes every request with `/api/v1/environments/:environmentId/...`. Use this
|
|
908
908
|
* when the server has `enableProjectScoping: true` in its REST API config.
|
|
909
909
|
*
|
|
910
910
|
* Backward compatibility: `client.data.*`, `client.meta.*`, and
|
|
911
911
|
* `client.packages.*` continue to work unchanged; they hit unscoped routes
|
|
912
|
-
* and rely on hostname / `X-
|
|
912
|
+
* and rely on hostname / `X-Environment-Id` header / session resolution.
|
|
913
913
|
*
|
|
914
914
|
* @example
|
|
915
915
|
* ```ts
|
|
@@ -918,7 +918,7 @@ declare class ObjectStackClient {
|
|
|
918
918
|
* const objects = await scoped.meta.getItems('object');
|
|
919
919
|
* ```
|
|
920
920
|
*/
|
|
921
|
-
project(
|
|
921
|
+
project(environmentId: string): ScopedProjectClient;
|
|
922
922
|
/** @internal */
|
|
923
923
|
_baseUrl(): string;
|
|
924
924
|
/** @internal */
|
|
@@ -1241,7 +1241,7 @@ declare class ObjectStackClient {
|
|
|
1241
1241
|
* Update the active project id used for subsequent requests.
|
|
1242
1242
|
* Pass `undefined` to clear (falls back to the session default).
|
|
1243
1243
|
*/
|
|
1244
|
-
setProjectId(
|
|
1244
|
+
setProjectId(environmentId: string | undefined): void;
|
|
1245
1245
|
/**
|
|
1246
1246
|
* Current active project id (if set).
|
|
1247
1247
|
*/
|
|
@@ -1924,7 +1924,7 @@ declare class ObjectStackClient {
|
|
|
1924
1924
|
* Project-scoped sub-client.
|
|
1925
1925
|
*
|
|
1926
1926
|
* Wraps an {@link ObjectStackClient} and prefixes every request with
|
|
1927
|
-
* `/api/v1/
|
|
1927
|
+
* `/api/v1/environments/:environmentId/...` so a single client instance can talk to
|
|
1928
1928
|
* multiple projects without mutating global state.
|
|
1929
1929
|
*
|
|
1930
1930
|
* The scoped client exposes the same shape as the `data`, `meta`, `batch`,
|
|
@@ -1935,9 +1935,9 @@ declare class ObjectStackClient {
|
|
|
1935
1935
|
*/
|
|
1936
1936
|
declare class ScopedProjectClient {
|
|
1937
1937
|
private readonly parent;
|
|
1938
|
-
private readonly
|
|
1939
|
-
constructor(parent: ObjectStackClient,
|
|
1940
|
-
/** The
|
|
1938
|
+
private readonly environmentId;
|
|
1939
|
+
constructor(parent: ObjectStackClient, environmentId: string);
|
|
1940
|
+
/** The environmentId this client is scoped to. */
|
|
1941
1941
|
getProjectId(): string;
|
|
1942
1942
|
/** Prefix segment inserted between the baseUrl and the resource path. */
|
|
1943
1943
|
private scope;
|
|
@@ -2005,7 +2005,7 @@ declare class ScopedProjectClient {
|
|
|
2005
2005
|
* Automation (Flow) operations scoped to this project.
|
|
2006
2006
|
*
|
|
2007
2007
|
* Thin wrapper around the dispatcher's automation routes, mounted under
|
|
2008
|
-
* `/api/v1/
|
|
2008
|
+
* `/api/v1/environments/:environmentId/automation/...`. Surface mirrors the methods
|
|
2009
2009
|
* needed by Studio's Flow viewer: read flow definition, execute (trigger),
|
|
2010
2010
|
* list runs, fetch a single run.
|
|
2011
2011
|
*/
|