jazz-tools 0.14.9 → 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.
- package/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +14 -0
- package/dist/{chunk-ORL6R2EV.js → chunk-GRIN3FQP.js} +43 -3
- package/dist/chunk-GRIN3FQP.js.map +1 -0
- package/dist/coValues/extensions/imageDef.d.ts +2 -2
- package/dist/coValues/extensions/imageDef.d.ts.map +1 -1
- package/dist/exports.d.ts +1 -1
- package/dist/exports.d.ts.map +1 -1
- package/dist/implementation/ContextManager.d.ts +5 -2
- package/dist/implementation/ContextManager.d.ts.map +1 -1
- package/dist/implementation/createContext.d.ts +1 -1
- package/dist/implementation/createContext.d.ts.map +1 -1
- package/dist/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.d.ts +1 -1
- package/dist/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.d.ts.map +1 -1
- package/dist/implementation/zodSchema/schemaTypes/CoListSchema.d.ts +1 -0
- package/dist/implementation/zodSchema/schemaTypes/CoListSchema.d.ts.map +1 -1
- package/dist/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts +1 -0
- package/dist/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts.map +1 -1
- package/dist/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts +1 -0
- package/dist/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts.map +1 -1
- package/dist/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchema.d.ts +1 -1
- package/dist/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchema.d.ts.map +1 -1
- package/dist/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchemaCoValuesNullable.d.ts +1 -1
- package/dist/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchemaCoValuesNullable.d.ts.map +1 -1
- package/dist/implementation/zodSchema/zodCo.d.ts.map +1 -1
- package/dist/implementation/zodSchema/zodReExport.d.ts +1 -1
- package/dist/implementation/zodSchema/zodReExport.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/subscribe/SubscriptionScope.d.ts +1 -0
- package/dist/subscribe/SubscriptionScope.d.ts.map +1 -1
- package/dist/testing.js +1 -1
- package/package.json +1 -1
- package/src/coValues/extensions/imageDef.ts +2 -7
- package/src/exports.ts +1 -0
- package/src/implementation/ContextManager.ts +34 -2
- package/src/implementation/createContext.ts +2 -2
- package/src/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.ts +21 -1
- package/src/implementation/zodSchema/schemaTypes/CoListSchema.ts +1 -0
- package/src/implementation/zodSchema/schemaTypes/CoMapSchema.ts +1 -0
- package/src/implementation/zodSchema/schemaTypes/CoRecordSchema.ts +1 -0
- package/src/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchema.ts +9 -1
- package/src/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchemaCoValuesNullable.ts +9 -1
- package/src/implementation/zodSchema/zodCo.ts +3 -0
- package/src/implementation/zodSchema/zodReExport.ts +2 -0
- package/src/subscribe/SubscriptionScope.ts +6 -0
- package/src/tests/zod.test.ts +35 -17
- package/dist/chunk-ORL6R2EV.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> jazz-tools@0.14.
|
2
|
+
> jazz-tools@0.14.14 build /home/runner/_work/jazz/jazz/packages/jazz-tools
|
3
3
|
> tsup && pnpm types
|
4
4
|
|
5
5
|
[34mCLI[39m Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
|
@@ -9,14 +9,14 @@
|
|
9
9
|
[34mCLI[39m Target: es2021
|
10
10
|
[34mCLI[39m Cleaning output folder
|
11
11
|
[34mESM[39m Build start
|
12
|
-
[32mESM[39m [1mdist/index.js [22m[32m11.
|
12
|
+
[32mESM[39m [1mdist/index.js [22m[32m11.11 KB[39m
|
13
13
|
[32mESM[39m [1mdist/testing.js [22m[32m6.31 KB[39m
|
14
|
-
[32mESM[39m [1mdist/chunk-
|
14
|
+
[32mESM[39m [1mdist/chunk-GRIN3FQP.js [22m[32m133.77 KB[39m
|
15
15
|
[32mESM[39m [1mdist/index.js.map [22m[32m18.38 KB[39m
|
16
16
|
[32mESM[39m [1mdist/testing.js.map [22m[32m12.57 KB[39m
|
17
|
-
[32mESM[39m [1mdist/chunk-
|
18
|
-
[32mESM[39m ⚡️ Build success in
|
17
|
+
[32mESM[39m [1mdist/chunk-GRIN3FQP.js.map [22m[32m309.59 KB[39m
|
18
|
+
[32mESM[39m ⚡️ Build success in 59ms
|
19
19
|
|
20
|
-
> jazz-tools@0.14.
|
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,19 @@
|
|
1
1
|
# jazz-tools
|
2
2
|
|
3
|
+
## 0.14.14
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- e32a1f7: Add useAnonymousFallback option in JazzContextManager
|
8
|
+
|
9
|
+
## 0.14.10
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- dc746a2: Make the react peerDependency definition more relaxed
|
14
|
+
- f869d9a: Deprecated the withHelpers method in favor of standalone functions
|
15
|
+
- 3fe6832: Add support for z.catch/default. We ignore them for the moment and flag a warning.
|
16
|
+
|
3
17
|
## 0.14.9
|
4
18
|
|
5
19
|
### 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
|
-
|
3411
|
+
function createAnonymousJazzContext({
|
3407
3412
|
peersToLoadFrom,
|
3408
3413
|
crypto
|
3409
3414
|
}) {
|
@@ -3783,6 +3788,13 @@ function zodFieldToCoFieldDef(schema) {
|
|
3783
3788
|
return zodFieldToCoFieldDef(
|
3784
3789
|
schema.unwrap()
|
3785
3790
|
);
|
3791
|
+
} else if (schema._zod.def.type === "default" || schema._zod.def.type === "catch") {
|
3792
|
+
console.warn(
|
3793
|
+
"z.default()/z.catch() are not supported in collaborative schemas. They will be ignored."
|
3794
|
+
);
|
3795
|
+
return zodFieldToCoFieldDef(
|
3796
|
+
schema.def.innerType
|
3797
|
+
);
|
3786
3798
|
} else if (schema._zod.def.type === "literal") {
|
3787
3799
|
if (schema._zod.def.values.some(
|
3788
3800
|
(literal2) => typeof literal2 === "undefined"
|
@@ -3983,6 +3995,7 @@ var ImageDefinition = ImageDefinitionBase.withHelpers((Self) => ({
|
|
3983
3995
|
|
3984
3996
|
// src/implementation/ContextManager.ts
|
3985
3997
|
import { cojsonInternals as cojsonInternals4 } from "cojson";
|
3998
|
+
import { PureJSCrypto } from "cojson/dist/crypto/PureJSCrypto";
|
3986
3999
|
|
3987
4000
|
// src/auth/KvStoreContext.ts
|
3988
4001
|
var KvStoreContext = class _KvStoreContext {
|
@@ -4146,8 +4159,28 @@ var InMemoryKVStore = class {
|
|
4146
4159
|
};
|
4147
4160
|
|
4148
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
|
+
}
|
4149
4182
|
var JazzContextManager = class {
|
4150
|
-
constructor() {
|
4183
|
+
constructor(opts) {
|
4151
4184
|
this.authSecretStorage = new AuthSecretStorage();
|
4152
4185
|
this.keepContextOpen = false;
|
4153
4186
|
this.logOut = async () => {
|
@@ -4224,6 +4257,9 @@ var JazzContextManager = class {
|
|
4224
4257
|
};
|
4225
4258
|
};
|
4226
4259
|
KvStoreContext.getInstance().initialize(this.getKvStore());
|
4260
|
+
if (opts?.useAnonymousFallback) {
|
4261
|
+
this.value = getAnonymousFallback();
|
4262
|
+
}
|
4227
4263
|
}
|
4228
4264
|
getKvStore() {
|
4229
4265
|
return new InMemoryKVStore();
|
@@ -4275,6 +4311,9 @@ var JazzContextManager = class {
|
|
4275
4311
|
getCurrentValue() {
|
4276
4312
|
return this.value;
|
4277
4313
|
}
|
4314
|
+
setCurrentValue(value) {
|
4315
|
+
this.value = value;
|
4316
|
+
}
|
4278
4317
|
getAuthSecretStorage() {
|
4279
4318
|
return this.authSecretStorage;
|
4280
4319
|
}
|
@@ -4620,6 +4659,7 @@ export {
|
|
4620
4659
|
activeAccountContext,
|
4621
4660
|
Encoders,
|
4622
4661
|
coField,
|
4662
|
+
SubscriptionScope,
|
4623
4663
|
randomSessionProvider,
|
4624
4664
|
createJazzContextFromExistingCredentials,
|
4625
4665
|
createJazzContextForNewAccount,
|
@@ -4635,4 +4675,4 @@ export {
|
|
4635
4675
|
JazzContextManager
|
4636
4676
|
};
|
4637
4677
|
/* istanbul ignore file -- @preserve */
|
4638
|
-
//# sourceMappingURL=chunk-
|
4678
|
+
//# sourceMappingURL=chunk-GRIN3FQP.js.map
|