@hypercerts-org/sdk-core 0.5.0-beta.0 → 0.6.0-beta.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.
Files changed (55) hide show
  1. package/dist/index.cjs +16 -12
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.mjs +16 -12
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +8 -4
  6. package/.turbo/turbo-build.log +0 -40
  7. package/.turbo/turbo-test.log +0 -119
  8. package/CHANGELOG.md +0 -62
  9. package/eslint.config.mjs +0 -22
  10. package/rollup.config.js +0 -75
  11. package/src/auth/OAuthClient.ts +0 -497
  12. package/src/core/SDK.ts +0 -410
  13. package/src/core/config.ts +0 -243
  14. package/src/core/errors.ts +0 -257
  15. package/src/core/interfaces.ts +0 -324
  16. package/src/core/types.ts +0 -282
  17. package/src/errors.ts +0 -57
  18. package/src/index.ts +0 -107
  19. package/src/lexicons.ts +0 -64
  20. package/src/repository/BlobOperationsImpl.ts +0 -199
  21. package/src/repository/CollaboratorOperationsImpl.ts +0 -442
  22. package/src/repository/HypercertOperationsImpl.ts +0 -1146
  23. package/src/repository/LexiconRegistry.ts +0 -332
  24. package/src/repository/OrganizationOperationsImpl.ts +0 -282
  25. package/src/repository/ProfileOperationsImpl.ts +0 -281
  26. package/src/repository/RecordOperationsImpl.ts +0 -340
  27. package/src/repository/Repository.ts +0 -482
  28. package/src/repository/interfaces.ts +0 -909
  29. package/src/repository/types.ts +0 -111
  30. package/src/services/hypercerts/types.ts +0 -87
  31. package/src/storage/InMemorySessionStore.ts +0 -127
  32. package/src/storage/InMemoryStateStore.ts +0 -146
  33. package/src/storage.ts +0 -63
  34. package/src/testing/index.ts +0 -67
  35. package/src/testing/mocks.ts +0 -142
  36. package/src/testing/stores.ts +0 -285
  37. package/src/testing.ts +0 -64
  38. package/src/types.ts +0 -86
  39. package/tests/auth/OAuthClient.test.ts +0 -164
  40. package/tests/core/SDK.test.ts +0 -176
  41. package/tests/core/errors.test.ts +0 -81
  42. package/tests/repository/BlobOperationsImpl.test.ts +0 -155
  43. package/tests/repository/CollaboratorOperationsImpl.test.ts +0 -438
  44. package/tests/repository/HypercertOperationsImpl.test.ts +0 -652
  45. package/tests/repository/LexiconRegistry.test.ts +0 -192
  46. package/tests/repository/OrganizationOperationsImpl.test.ts +0 -240
  47. package/tests/repository/ProfileOperationsImpl.test.ts +0 -254
  48. package/tests/repository/RecordOperationsImpl.test.ts +0 -375
  49. package/tests/repository/Repository.test.ts +0 -149
  50. package/tests/utils/fixtures.ts +0 -117
  51. package/tests/utils/mocks.ts +0 -109
  52. package/tests/utils/repository-fixtures.ts +0 -78
  53. package/tsconfig.json +0 -11
  54. package/tsconfig.tsbuildinfo +0 -1
  55. package/vitest.config.ts +0 -30
package/dist/index.mjs CHANGED
@@ -3118,23 +3118,24 @@ class CollaboratorOperationsImpl {
3118
3118
  return "viewer";
3119
3119
  }
3120
3120
  /**
3121
- * Converts a permission string array to a permissions object.
3121
+ * Normalizes permissions from SDS API format to SDK format.
3122
3122
  *
3123
- * The SDS API returns permissions as an array of strings (e.g., ["read", "create"]).
3124
- * This method converts them to the boolean flag format used by the SDK.
3123
+ * The SDS API returns permissions as an object with boolean flags
3124
+ * (e.g., `{ read: true, create: true, update: false, ... }`).
3125
+ * This method ensures all expected fields are present with default values.
3125
3126
  *
3126
- * @param permissionArray - Array of permission strings from SDS API
3127
- * @returns Permission flags object
3127
+ * @param permissions - Permissions object from SDS API
3128
+ * @returns Normalized permission flags object
3128
3129
  * @internal
3129
3130
  */
3130
- parsePermissions(permissionArray) {
3131
+ parsePermissions(permissions) {
3131
3132
  return {
3132
- read: permissionArray.includes("read"),
3133
- create: permissionArray.includes("create"),
3134
- update: permissionArray.includes("update"),
3135
- delete: permissionArray.includes("delete"),
3136
- admin: permissionArray.includes("admin"),
3137
- owner: permissionArray.includes("owner"),
3133
+ read: permissions.read ?? false,
3134
+ create: permissions.create ?? false,
3135
+ update: permissions.update ?? false,
3136
+ delete: permissions.delete ?? false,
3137
+ admin: permissions.admin ?? false,
3138
+ owner: permissions.owner ?? false,
3138
3139
  };
3139
3140
  }
3140
3141
  /**
@@ -3772,6 +3773,9 @@ class Repository {
3772
3773
  this.logger = logger;
3773
3774
  // Create Agent with OAuth session
3774
3775
  this.agent = new Agent(session);
3776
+ // Configure Agent to use the specified server URL (PDS or SDS)
3777
+ // This ensures queries are routed to the correct server
3778
+ this.agent.api.xrpc.uri = new URL(serverUrl);
3775
3779
  this.lexiconRegistry.addToAgent(this.agent);
3776
3780
  // Register hypercert lexicons
3777
3781
  this.lexiconRegistry.registerMany(HYPERCERT_LEXICONS);