@hypercerts-org/sdk-core 0.10.0-beta.3 → 0.10.0-beta.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/index.d.ts CHANGED
@@ -1203,6 +1203,22 @@ interface CreateHypercertParams {
1203
1203
  */
1204
1204
  onProgress?: (step: ProgressStep) => void;
1205
1205
  }
1206
+ interface CreateOrganizationParams {
1207
+ /**
1208
+ * Name of the organization
1209
+ */
1210
+ name: string;
1211
+ /**
1212
+ * The handle of the organization without attaching the SDS domain
1213
+ *
1214
+ * @example: "gainforest" for "gainforest.sds.hypercerts.org"
1215
+ */
1216
+ handlePrefix: string;
1217
+ /**
1218
+ * Optional description of the organization
1219
+ */
1220
+ description?: string;
1221
+ }
1206
1222
  /**
1207
1223
  * Result of creating a hypercert.
1208
1224
  *
@@ -1774,6 +1790,16 @@ interface HypercertOperations extends EventEmitter<HypercertEvents> {
1774
1790
  * await repo.collaborators.revoke({ userDid: "did:plc:former-user" });
1775
1791
  * ```
1776
1792
  */
1793
+ interface GrantAccessParams {
1794
+ /**
1795
+ * DID of the user to grant access to
1796
+ */
1797
+ userDid: string;
1798
+ /**
1799
+ * Role to assign
1800
+ */
1801
+ role: RepositoryRole;
1802
+ }
1777
1803
  interface CollaboratorOperations {
1778
1804
  /**
1779
1805
  * Grants repository access to a user.
@@ -1782,10 +1808,7 @@ interface CollaboratorOperations {
1782
1808
  * @param params.userDid - DID of the user to grant access to
1783
1809
  * @param params.role - Role to assign
1784
1810
  */
1785
- grant(params: {
1786
- userDid: string;
1787
- role: RepositoryRole;
1788
- }): Promise<void>;
1811
+ grant(params: GrantAccessParams): Promise<void>;
1789
1812
  /**
1790
1813
  * Revokes repository access from a user.
1791
1814
  *
@@ -1867,17 +1890,10 @@ interface OrganizationOperations {
1867
1890
  /**
1868
1891
  * Creates a new organization.
1869
1892
  *
1870
- * @param params - Organization parameters
1871
- * @param params.name - Organization name
1872
- * @param params.description - Optional description
1873
- * @param params.handle - Optional custom handle
1893
+ * @param params - Organization creation parameters
1874
1894
  * @returns Promise resolving to organization info
1875
1895
  */
1876
- create(params: {
1877
- name: string;
1878
- description?: string;
1879
- handle?: string;
1880
- }): Promise<OrganizationInfo>;
1896
+ create(params: CreateOrganizationParams): Promise<OrganizationInfo>;
1881
1897
  /**
1882
1898
  * Gets an organization by DID.
1883
1899
  *
package/dist/index.mjs CHANGED
@@ -3499,11 +3499,6 @@ class HypercertOperationsImpl extends EventEmitter {
3499
3499
  if (!result.success) {
3500
3500
  throw new NetworkError("Failed to get hypercert");
3501
3501
  }
3502
- // Validate with lexicon (more lenient - doesn't require $type)
3503
- const validation = validate(result.data.value, HYPERCERT_COLLECTIONS.CLAIM, "main", false);
3504
- if (!validation.success) {
3505
- throw new ValidationError(`Invalid hypercert record format: ${validation.error?.message}`);
3506
- }
3507
3502
  return {
3508
3503
  uri: result.data.uri,
3509
3504
  cid: result.data.cid ?? "",
@@ -4599,6 +4594,12 @@ class OrganizationOperationsImpl {
4599
4594
  if (!userDid) {
4600
4595
  throw new NetworkError("No authenticated user found");
4601
4596
  }
4597
+ if (!params.handlePrefix) {
4598
+ throw new ValidationError("Missing handlePrefix");
4599
+ }
4600
+ if (!params.name) {
4601
+ throw new ValidationError("Missing name");
4602
+ }
4602
4603
  const response = await this.session.fetchHandler(`${this.serverUrl}/xrpc/com.sds.organization.create`, {
4603
4604
  method: "POST",
4604
4605
  headers: { "Content-Type": "application/json" },