@objectstack/client 4.0.5 → 4.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/dist/index.d.mts CHANGED
@@ -676,6 +676,92 @@ declare class ObjectStackClient {
676
676
  updateHostname: (id: string, hostname: string) => Promise<{
677
677
  project: any;
678
678
  }>;
679
+ /**
680
+ * Update the visibility of this project ('private' | 'public').
681
+ * `private` (default) hides the project from /pub/v1 enumeration but
682
+ * still allows anonymous artifact downloads when the URL includes an
683
+ * exact `?commit=<id>` (share-by-link). `public` lists the project and
684
+ * freely exposes all revisions.
685
+ */
686
+ updateVisibility: (id: string, visibility: "private" | "public") => Promise<{
687
+ project: any;
688
+ }>;
689
+ /**
690
+ * List published artifact revisions for a project. Each revision has
691
+ * an immutable commitId (content-addressable) and storage_key.
692
+ * Optional `branch` filter narrows to a single logical branch
693
+ * (default branch `main` also matches rows with NULL `branch`).
694
+ */
695
+ listRevisions: (id: string, opts?: {
696
+ limit?: number;
697
+ cursor?: string;
698
+ branch?: string;
699
+ }) => Promise<{
700
+ items: Array<{
701
+ commitId: string;
702
+ checksum: string;
703
+ storageKey: string;
704
+ sizeBytes: number;
705
+ builtAt: string;
706
+ publishedAt: string;
707
+ publishedBy: string | null;
708
+ note: string | null;
709
+ isCurrent: boolean;
710
+ branch: string;
711
+ isBranchHead: boolean;
712
+ }>;
713
+ nextCursor: string | null;
714
+ branch: string | null;
715
+ }>;
716
+ /**
717
+ * List logical branches for a project. Each branch has a head commit
718
+ * (latest published revision on that branch) and a count of revisions.
719
+ * Branches without a head row (e.g. all rows demoted) are omitted.
720
+ */
721
+ listBranches: (id: string) => Promise<{
722
+ projectId: string;
723
+ branches: Array<{
724
+ branch: string;
725
+ headCommitId: string;
726
+ headRevisionId: string;
727
+ revisionCount: number;
728
+ headPublishedAt: string | null;
729
+ headNote: string | null;
730
+ isCurrent: boolean;
731
+ }>;
732
+ }>;
733
+ /**
734
+ * Rename a branch. Updates every revision row in `from` to `to`.
735
+ * 409 if `to` already has rows.
736
+ */
737
+ renameBranch: (id: string, from: string, to: string) => Promise<{
738
+ projectId: string;
739
+ from: string;
740
+ to: string;
741
+ renamed: number;
742
+ }>;
743
+ /**
744
+ * Delete (demote) a branch. Soft-removal — clears `is_branch_head` on
745
+ * every row in this branch; the revisions themselves remain. The
746
+ * `main` branch and any branch carrying the active revision cannot be
747
+ * deleted.
748
+ */
749
+ deleteBranch: (id: string, name: string) => Promise<{
750
+ projectId: string;
751
+ branch: string;
752
+ demoted: number;
753
+ totalRevisions: number;
754
+ }>;
755
+ /**
756
+ * Activate (rollback to) a previously-published revision by commit id.
757
+ * Marks the target revision is_current=true and demotes the prior one.
758
+ */
759
+ activateRevision: (id: string, commitId: string) => Promise<{
760
+ projectId: string;
761
+ commitId: string;
762
+ activated: boolean;
763
+ previousCommitId: string | null;
764
+ }>;
679
765
  /**
680
766
  * Retry provisioning for a project stuck in `failed` (or
681
767
  * `provisioning`) state. The server re-runs the driver handshake; on
@@ -691,6 +777,35 @@ declare class ObjectStackClient {
691
777
  listMembers: (id: string) => Promise<{
692
778
  members: any[];
693
779
  }>;
780
+ /**
781
+ * Invite a member to a project. Caller must be `owner` or `admin`.
782
+ * Pass either `email` (resolved against the user table) or `user_id`.
783
+ * Returns `{ member, alreadyMember }` — `alreadyMember=true` means the
784
+ * row already existed; the call is idempotent.
785
+ */
786
+ addMember: (id: string, payload: {
787
+ email?: string;
788
+ user_id?: string;
789
+ role?: "owner" | "admin" | "member" | "viewer";
790
+ }) => Promise<{
791
+ member: any;
792
+ alreadyMember: boolean;
793
+ }>;
794
+ /**
795
+ * Update a member's role. Caller must be `owner` or `admin`. Demoting
796
+ * the last `owner` returns 409.
797
+ */
798
+ updateMemberRole: (id: string, memberId: string, role: "owner" | "admin" | "member" | "viewer") => Promise<{
799
+ member: any;
800
+ }>;
801
+ /**
802
+ * Remove a member. Owners/admins may remove anyone; non-privileged
803
+ * users may only remove themselves. Removing the last `owner` returns 409.
804
+ */
805
+ removeMember: (id: string, memberId: string) => Promise<{
806
+ removed: boolean;
807
+ memberId: string;
808
+ }>;
694
809
  /**
695
810
  * List ObjectQL drivers registered on the server. Useful for populating a
696
811
  * driver selector when provisioning a new project (memory / turso /
package/dist/index.d.ts CHANGED
@@ -676,6 +676,92 @@ declare class ObjectStackClient {
676
676
  updateHostname: (id: string, hostname: string) => Promise<{
677
677
  project: any;
678
678
  }>;
679
+ /**
680
+ * Update the visibility of this project ('private' | 'public').
681
+ * `private` (default) hides the project from /pub/v1 enumeration but
682
+ * still allows anonymous artifact downloads when the URL includes an
683
+ * exact `?commit=<id>` (share-by-link). `public` lists the project and
684
+ * freely exposes all revisions.
685
+ */
686
+ updateVisibility: (id: string, visibility: "private" | "public") => Promise<{
687
+ project: any;
688
+ }>;
689
+ /**
690
+ * List published artifact revisions for a project. Each revision has
691
+ * an immutable commitId (content-addressable) and storage_key.
692
+ * Optional `branch` filter narrows to a single logical branch
693
+ * (default branch `main` also matches rows with NULL `branch`).
694
+ */
695
+ listRevisions: (id: string, opts?: {
696
+ limit?: number;
697
+ cursor?: string;
698
+ branch?: string;
699
+ }) => Promise<{
700
+ items: Array<{
701
+ commitId: string;
702
+ checksum: string;
703
+ storageKey: string;
704
+ sizeBytes: number;
705
+ builtAt: string;
706
+ publishedAt: string;
707
+ publishedBy: string | null;
708
+ note: string | null;
709
+ isCurrent: boolean;
710
+ branch: string;
711
+ isBranchHead: boolean;
712
+ }>;
713
+ nextCursor: string | null;
714
+ branch: string | null;
715
+ }>;
716
+ /**
717
+ * List logical branches for a project. Each branch has a head commit
718
+ * (latest published revision on that branch) and a count of revisions.
719
+ * Branches without a head row (e.g. all rows demoted) are omitted.
720
+ */
721
+ listBranches: (id: string) => Promise<{
722
+ projectId: string;
723
+ branches: Array<{
724
+ branch: string;
725
+ headCommitId: string;
726
+ headRevisionId: string;
727
+ revisionCount: number;
728
+ headPublishedAt: string | null;
729
+ headNote: string | null;
730
+ isCurrent: boolean;
731
+ }>;
732
+ }>;
733
+ /**
734
+ * Rename a branch. Updates every revision row in `from` to `to`.
735
+ * 409 if `to` already has rows.
736
+ */
737
+ renameBranch: (id: string, from: string, to: string) => Promise<{
738
+ projectId: string;
739
+ from: string;
740
+ to: string;
741
+ renamed: number;
742
+ }>;
743
+ /**
744
+ * Delete (demote) a branch. Soft-removal — clears `is_branch_head` on
745
+ * every row in this branch; the revisions themselves remain. The
746
+ * `main` branch and any branch carrying the active revision cannot be
747
+ * deleted.
748
+ */
749
+ deleteBranch: (id: string, name: string) => Promise<{
750
+ projectId: string;
751
+ branch: string;
752
+ demoted: number;
753
+ totalRevisions: number;
754
+ }>;
755
+ /**
756
+ * Activate (rollback to) a previously-published revision by commit id.
757
+ * Marks the target revision is_current=true and demotes the prior one.
758
+ */
759
+ activateRevision: (id: string, commitId: string) => Promise<{
760
+ projectId: string;
761
+ commitId: string;
762
+ activated: boolean;
763
+ previousCommitId: string | null;
764
+ }>;
679
765
  /**
680
766
  * Retry provisioning for a project stuck in `failed` (or
681
767
  * `provisioning`) state. The server re-runs the driver handshake; on
@@ -691,6 +777,35 @@ declare class ObjectStackClient {
691
777
  listMembers: (id: string) => Promise<{
692
778
  members: any[];
693
779
  }>;
780
+ /**
781
+ * Invite a member to a project. Caller must be `owner` or `admin`.
782
+ * Pass either `email` (resolved against the user table) or `user_id`.
783
+ * Returns `{ member, alreadyMember }` — `alreadyMember=true` means the
784
+ * row already existed; the call is idempotent.
785
+ */
786
+ addMember: (id: string, payload: {
787
+ email?: string;
788
+ user_id?: string;
789
+ role?: "owner" | "admin" | "member" | "viewer";
790
+ }) => Promise<{
791
+ member: any;
792
+ alreadyMember: boolean;
793
+ }>;
794
+ /**
795
+ * Update a member's role. Caller must be `owner` or `admin`. Demoting
796
+ * the last `owner` returns 409.
797
+ */
798
+ updateMemberRole: (id: string, memberId: string, role: "owner" | "admin" | "member" | "viewer") => Promise<{
799
+ member: any;
800
+ }>;
801
+ /**
802
+ * Remove a member. Owners/admins may remove anyone; non-privileged
803
+ * users may only remove themselves. Removing the last `owner` returns 409.
804
+ */
805
+ removeMember: (id: string, memberId: string) => Promise<{
806
+ removed: boolean;
807
+ memberId: string;
808
+ }>;
694
809
  /**
695
810
  * List ObjectQL drivers registered on the server. Useful for populating a
696
811
  * driver selector when provisioning a new project (memory / turso /
package/dist/index.js CHANGED
@@ -766,6 +766,87 @@ var ObjectStackClient = class {
766
766
  });
767
767
  return this.unwrapResponse(res);
768
768
  },
769
+ /**
770
+ * Update the visibility of this project ('private' | 'public').
771
+ * `private` (default) hides the project from /pub/v1 enumeration but
772
+ * still allows anonymous artifact downloads when the URL includes an
773
+ * exact `?commit=<id>` (share-by-link). `public` lists the project and
774
+ * freely exposes all revisions.
775
+ */
776
+ updateVisibility: async (id, visibility) => {
777
+ const res = await this.fetch(`${this.baseUrl}/api/v1/cloud/projects/${encodeURIComponent(id)}`, {
778
+ method: "PATCH",
779
+ body: JSON.stringify({ visibility })
780
+ });
781
+ return this.unwrapResponse(res);
782
+ },
783
+ /**
784
+ * List published artifact revisions for a project. Each revision has
785
+ * an immutable commitId (content-addressable) and storage_key.
786
+ * Optional `branch` filter narrows to a single logical branch
787
+ * (default branch `main` also matches rows with NULL `branch`).
788
+ */
789
+ listRevisions: async (id, opts) => {
790
+ const params = new URLSearchParams();
791
+ if (opts?.limit) params.set("limit", String(opts.limit));
792
+ if (opts?.cursor) params.set("cursor", opts.cursor);
793
+ if (opts?.branch) params.set("branch", opts.branch);
794
+ const qs = params.toString();
795
+ const res = await this.fetch(
796
+ `${this.baseUrl}/api/v1/cloud/projects/${encodeURIComponent(id)}/revisions${qs ? `?${qs}` : ""}`
797
+ );
798
+ return this.unwrapResponse(res);
799
+ },
800
+ /**
801
+ * List logical branches for a project. Each branch has a head commit
802
+ * (latest published revision on that branch) and a count of revisions.
803
+ * Branches without a head row (e.g. all rows demoted) are omitted.
804
+ */
805
+ listBranches: async (id) => {
806
+ const res = await this.fetch(
807
+ `${this.baseUrl}/api/v1/cloud/projects/${encodeURIComponent(id)}/branches`
808
+ );
809
+ return this.unwrapResponse(res);
810
+ },
811
+ /**
812
+ * Rename a branch. Updates every revision row in `from` to `to`.
813
+ * 409 if `to` already has rows.
814
+ */
815
+ renameBranch: async (id, from, to) => {
816
+ const res = await this.fetch(
817
+ `${this.baseUrl}/api/v1/cloud/projects/${encodeURIComponent(id)}/branches/${encodeURIComponent(from)}/rename`,
818
+ {
819
+ method: "POST",
820
+ headers: { "content-type": "application/json" },
821
+ body: JSON.stringify({ newName: to })
822
+ }
823
+ );
824
+ return this.unwrapResponse(res);
825
+ },
826
+ /**
827
+ * Delete (demote) a branch. Soft-removal — clears `is_branch_head` on
828
+ * every row in this branch; the revisions themselves remain. The
829
+ * `main` branch and any branch carrying the active revision cannot be
830
+ * deleted.
831
+ */
832
+ deleteBranch: async (id, name) => {
833
+ const res = await this.fetch(
834
+ `${this.baseUrl}/api/v1/cloud/projects/${encodeURIComponent(id)}/branches/${encodeURIComponent(name)}`,
835
+ { method: "DELETE" }
836
+ );
837
+ return this.unwrapResponse(res);
838
+ },
839
+ /**
840
+ * Activate (rollback to) a previously-published revision by commit id.
841
+ * Marks the target revision is_current=true and demotes the prior one.
842
+ */
843
+ activateRevision: async (id, commitId) => {
844
+ const res = await this.fetch(
845
+ `${this.baseUrl}/api/v1/cloud/projects/${encodeURIComponent(id)}/revisions/${encodeURIComponent(commitId)}/activate`,
846
+ { method: "POST" }
847
+ );
848
+ return this.unwrapResponse(res);
849
+ },
769
850
  /**
770
851
  * Retry provisioning for a project stuck in `failed` (or
771
852
  * `provisioning`) state. The server re-runs the driver handshake; on
@@ -785,6 +866,46 @@ var ObjectStackClient = class {
785
866
  const res = await this.fetch(`${this.baseUrl}/api/v1/cloud/projects/${encodeURIComponent(id)}/members`);
786
867
  return this.unwrapResponse(res);
787
868
  },
869
+ /**
870
+ * Invite a member to a project. Caller must be `owner` or `admin`.
871
+ * Pass either `email` (resolved against the user table) or `user_id`.
872
+ * Returns `{ member, alreadyMember }` — `alreadyMember=true` means the
873
+ * row already existed; the call is idempotent.
874
+ */
875
+ addMember: async (id, payload) => {
876
+ const res = await this.fetch(`${this.baseUrl}/api/v1/cloud/projects/${encodeURIComponent(id)}/members`, {
877
+ method: "POST",
878
+ headers: { "content-type": "application/json" },
879
+ body: JSON.stringify(payload)
880
+ });
881
+ return this.unwrapResponse(res);
882
+ },
883
+ /**
884
+ * Update a member's role. Caller must be `owner` or `admin`. Demoting
885
+ * the last `owner` returns 409.
886
+ */
887
+ updateMemberRole: async (id, memberId, role) => {
888
+ const res = await this.fetch(
889
+ `${this.baseUrl}/api/v1/cloud/projects/${encodeURIComponent(id)}/members/${encodeURIComponent(memberId)}`,
890
+ {
891
+ method: "PATCH",
892
+ headers: { "content-type": "application/json" },
893
+ body: JSON.stringify({ role })
894
+ }
895
+ );
896
+ return this.unwrapResponse(res);
897
+ },
898
+ /**
899
+ * Remove a member. Owners/admins may remove anyone; non-privileged
900
+ * users may only remove themselves. Removing the last `owner` returns 409.
901
+ */
902
+ removeMember: async (id, memberId) => {
903
+ const res = await this.fetch(
904
+ `${this.baseUrl}/api/v1/cloud/projects/${encodeURIComponent(id)}/members/${encodeURIComponent(memberId)}`,
905
+ { method: "DELETE" }
906
+ );
907
+ return this.unwrapResponse(res);
908
+ },
788
909
  /**
789
910
  * List ObjectQL drivers registered on the server. Useful for populating a
790
911
  * driver selector when provisioning a new project (memory / turso /