@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.cjs CHANGED
@@ -3119,23 +3119,24 @@ class CollaboratorOperationsImpl {
3119
3119
  return "viewer";
3120
3120
  }
3121
3121
  /**
3122
- * Converts a permission string array to a permissions object.
3122
+ * Normalizes permissions from SDS API format to SDK format.
3123
3123
  *
3124
- * The SDS API returns permissions as an array of strings (e.g., ["read", "create"]).
3125
- * This method converts them to the boolean flag format used by the SDK.
3124
+ * The SDS API returns permissions as an object with boolean flags
3125
+ * (e.g., `{ read: true, create: true, update: false, ... }`).
3126
+ * This method ensures all expected fields are present with default values.
3126
3127
  *
3127
- * @param permissionArray - Array of permission strings from SDS API
3128
- * @returns Permission flags object
3128
+ * @param permissions - Permissions object from SDS API
3129
+ * @returns Normalized permission flags object
3129
3130
  * @internal
3130
3131
  */
3131
- parsePermissions(permissionArray) {
3132
+ parsePermissions(permissions) {
3132
3133
  return {
3133
- read: permissionArray.includes("read"),
3134
- create: permissionArray.includes("create"),
3135
- update: permissionArray.includes("update"),
3136
- delete: permissionArray.includes("delete"),
3137
- admin: permissionArray.includes("admin"),
3138
- owner: permissionArray.includes("owner"),
3134
+ read: permissions.read ?? false,
3135
+ create: permissions.create ?? false,
3136
+ update: permissions.update ?? false,
3137
+ delete: permissions.delete ?? false,
3138
+ admin: permissions.admin ?? false,
3139
+ owner: permissions.owner ?? false,
3139
3140
  };
3140
3141
  }
3141
3142
  /**
@@ -3773,6 +3774,9 @@ class Repository {
3773
3774
  this.logger = logger;
3774
3775
  // Create Agent with OAuth session
3775
3776
  this.agent = new api.Agent(session);
3777
+ // Configure Agent to use the specified server URL (PDS or SDS)
3778
+ // This ensures queries are routed to the correct server
3779
+ this.agent.api.xrpc.uri = new URL(serverUrl);
3776
3780
  this.lexiconRegistry.addToAgent(this.agent);
3777
3781
  // Register hypercert lexicons
3778
3782
  this.lexiconRegistry.registerMany(lexicon.HYPERCERT_LEXICONS);