jazz-tools 0.14.10 → 0.14.14

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > jazz-tools@0.14.10 build /home/runner/_work/jazz/jazz/packages/jazz-tools
2
+ > jazz-tools@0.14.14 build /home/runner/_work/jazz/jazz/packages/jazz-tools
3
3
  > tsup && pnpm types
4
4
 
5
5
  CLI Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
@@ -9,14 +9,14 @@
9
9
  CLI Target: es2021
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
- ESM dist/index.js 11.07 KB
12
+ ESM dist/index.js 11.11 KB
13
13
  ESM dist/testing.js 6.31 KB
14
- ESM dist/chunk-YLZ5746T.js 132.99 KB
14
+ ESM dist/chunk-GRIN3FQP.js 133.77 KB
15
15
  ESM dist/index.js.map 18.38 KB
16
16
  ESM dist/testing.js.map 12.57 KB
17
- ESM dist/chunk-YLZ5746T.js.map 307.99 KB
18
- ESM ⚡️ Build success in 79ms
17
+ ESM dist/chunk-GRIN3FQP.js.map 309.59 KB
18
+ ESM ⚡️ Build success in 59ms
19
19
 
20
- > jazz-tools@0.14.10 types /home/runner/_work/jazz/jazz/packages/jazz-tools
20
+ > jazz-tools@0.14.14 types /home/runner/_work/jazz/jazz/packages/jazz-tools
21
21
  > tsc --outDir dist
22
22
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.14.14
4
+
5
+ ### Patch Changes
6
+
7
+ - e32a1f7: Add useAnonymousFallback option in JazzContextManager
8
+
3
9
  ## 0.14.10
4
10
 
5
11
  ### Patch Changes
@@ -2970,6 +2970,11 @@ var SubscriptionScope = class _SubscriptionScope {
2970
2970
  }
2971
2971
  return true;
2972
2972
  }
2973
+ getCurrentValue() {
2974
+ if (!this.shouldSendUpdates()) return;
2975
+ if (this.errorFromChildren) return this.errorFromChildren;
2976
+ return this.value;
2977
+ }
2973
2978
  triggerUpdate() {
2974
2979
  if (!this.shouldSendUpdates()) return;
2975
2980
  if (!this.dirty) return;
@@ -3403,7 +3408,7 @@ async function createJazzContext(options) {
3403
3408
  authSecretStorage
3404
3409
  };
3405
3410
  }
3406
- async function createAnonymousJazzContext({
3411
+ function createAnonymousJazzContext({
3407
3412
  peersToLoadFrom,
3408
3413
  crypto
3409
3414
  }) {
@@ -3990,6 +3995,7 @@ var ImageDefinition = ImageDefinitionBase.withHelpers((Self) => ({
3990
3995
 
3991
3996
  // src/implementation/ContextManager.ts
3992
3997
  import { cojsonInternals as cojsonInternals4 } from "cojson";
3998
+ import { PureJSCrypto } from "cojson/dist/crypto/PureJSCrypto";
3993
3999
 
3994
4000
  // src/auth/KvStoreContext.ts
3995
4001
  var KvStoreContext = class _KvStoreContext {
@@ -4153,8 +4159,28 @@ var InMemoryKVStore = class {
4153
4159
  };
4154
4160
 
4155
4161
  // src/implementation/ContextManager.ts
4162
+ function getAnonymousFallback() {
4163
+ const context = createAnonymousJazzContext({
4164
+ peersToLoadFrom: [],
4165
+ crypto: new PureJSCrypto()
4166
+ });
4167
+ return {
4168
+ guest: context.agent,
4169
+ node: context.agent.node,
4170
+ done: () => {
4171
+ },
4172
+ logOut: async () => {
4173
+ },
4174
+ isAuthenticated: false,
4175
+ authenticate: async () => {
4176
+ },
4177
+ register: async () => {
4178
+ throw new Error("Not implemented");
4179
+ }
4180
+ };
4181
+ }
4156
4182
  var JazzContextManager = class {
4157
- constructor() {
4183
+ constructor(opts) {
4158
4184
  this.authSecretStorage = new AuthSecretStorage();
4159
4185
  this.keepContextOpen = false;
4160
4186
  this.logOut = async () => {
@@ -4231,6 +4257,9 @@ var JazzContextManager = class {
4231
4257
  };
4232
4258
  };
4233
4259
  KvStoreContext.getInstance().initialize(this.getKvStore());
4260
+ if (opts?.useAnonymousFallback) {
4261
+ this.value = getAnonymousFallback();
4262
+ }
4234
4263
  }
4235
4264
  getKvStore() {
4236
4265
  return new InMemoryKVStore();
@@ -4282,6 +4311,9 @@ var JazzContextManager = class {
4282
4311
  getCurrentValue() {
4283
4312
  return this.value;
4284
4313
  }
4314
+ setCurrentValue(value) {
4315
+ this.value = value;
4316
+ }
4285
4317
  getAuthSecretStorage() {
4286
4318
  return this.authSecretStorage;
4287
4319
  }
@@ -4627,6 +4659,7 @@ export {
4627
4659
  activeAccountContext,
4628
4660
  Encoders,
4629
4661
  coField,
4662
+ SubscriptionScope,
4630
4663
  randomSessionProvider,
4631
4664
  createJazzContextFromExistingCredentials,
4632
4665
  createJazzContextForNewAccount,
@@ -4642,4 +4675,4 @@ export {
4642
4675
  JazzContextManager
4643
4676
  };
4644
4677
  /* istanbul ignore file -- @preserve */
4645
- //# sourceMappingURL=chunk-YLZ5746T.js.map
4678
+ //# sourceMappingURL=chunk-GRIN3FQP.js.map