jazz-tools 0.10.6 → 0.10.7
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 +10 -0
- package/dist/{chunk-DPW23T6J.js → chunk-TSEO4KAO.js} +23 -7
- package/dist/chunk-TSEO4KAO.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/testing.js +21 -13
- package/dist/testing.js.map +1 -1
- package/package.json +2 -2
- package/src/auth/AuthSecretStorage.ts +9 -2
- package/src/implementation/ContextManager.ts +23 -4
- package/src/implementation/createContext.ts +0 -3
- package/src/testing.ts +22 -12
- package/src/tests/AuthSecretStorage.test.ts +192 -66
- package/src/tests/ContextManager.test.ts +14 -9
- package/src/types.ts +2 -0
- package/dist/chunk-DPW23T6J.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> jazz-tools@0.10.
|
2
|
+
> jazz-tools@0.10.7 build /home/runner/_work/jazz/jazz/packages/jazz-tools
|
3
3
|
> tsup
|
4
4
|
|
5
5
|
[34mCLI[39m Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
|
@@ -10,9 +10,9 @@
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
11
11
|
[34mESM[39m Build start
|
12
12
|
[32mESM[39m [1mdist/index.js [22m[32m1.50 KB[39m
|
13
|
-
[32mESM[39m [1mdist/testing.js [22m[32m6.
|
14
|
-
[32mESM[39m [1mdist/chunk-
|
13
|
+
[32mESM[39m [1mdist/testing.js [22m[32m6.28 KB[39m
|
14
|
+
[32mESM[39m [1mdist/chunk-TSEO4KAO.js [22m[32m113.17 KB[39m
|
15
15
|
[32mESM[39m [1mdist/index.js.map [22m[32m259.00 B[39m
|
16
|
-
[32mESM[39m [1mdist/testing.js.map [22m[32m12.
|
17
|
-
[32mESM[39m [1mdist/chunk-
|
18
|
-
[32mESM[39m ⚡️ Build success in
|
16
|
+
[32mESM[39m [1mdist/testing.js.map [22m[32m12.41 KB[39m
|
17
|
+
[32mESM[39m [1mdist/chunk-TSEO4KAO.js.map [22m[32m271.81 KB[39m
|
18
|
+
[32mESM[39m ⚡️ Build success in 42ms
|
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# jazz-tools
|
2
2
|
|
3
|
+
## 0.10.7
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 1136d9b: Fixed isAuthenticated out-of-sync with the account state during the logOut and authenticate flows
|
8
|
+
- 0eed228: Fixes clerk auth flow
|
9
|
+
- Updated dependencies [0f83320]
|
10
|
+
- Updated dependencies [012022d]
|
11
|
+
- cojson@0.10.7
|
12
|
+
|
3
13
|
## 0.10.6
|
4
14
|
|
5
15
|
### Patch Changes
|
@@ -528,7 +528,6 @@ async function createJazzContext(options) {
|
|
528
528
|
authSecretStorage.clear();
|
529
529
|
}
|
530
530
|
});
|
531
|
-
authSecretStorage.emitUpdate(credentials);
|
532
531
|
} else {
|
533
532
|
const secretSeed = options.crypto.newRandomSecretSeed();
|
534
533
|
const initialAgentSecret = options.newAccountProps?.secret ?? crypto.agentSecretFromSecretSeed(secretSeed);
|
@@ -3437,6 +3436,7 @@ var KvStoreContext_default = KvStoreContext;
|
|
3437
3436
|
var STORAGE_KEY = "jazz-logged-in-secret";
|
3438
3437
|
var AuthSecretStorage = class {
|
3439
3438
|
constructor() {
|
3439
|
+
this.notify = false;
|
3440
3440
|
this.listeners = /* @__PURE__ */ new Set();
|
3441
3441
|
this.isAuthenticated = false;
|
3442
3442
|
}
|
@@ -3512,7 +3512,9 @@ var AuthSecretStorage = class {
|
|
3512
3512
|
provider: payload.provider
|
3513
3513
|
})
|
3514
3514
|
);
|
3515
|
-
this.
|
3515
|
+
if (this.notify) {
|
3516
|
+
this.emitUpdate(payload);
|
3517
|
+
}
|
3516
3518
|
}
|
3517
3519
|
getIsAuthenticated(data) {
|
3518
3520
|
if (!data) return false;
|
@@ -3535,7 +3537,9 @@ var AuthSecretStorage = class {
|
|
3535
3537
|
async clear() {
|
3536
3538
|
const kvStore = KvStoreContext_default.getInstance().getStorage();
|
3537
3539
|
await kvStore.delete(STORAGE_KEY);
|
3538
|
-
this.
|
3540
|
+
if (this.notify) {
|
3541
|
+
this.emitUpdate(null);
|
3542
|
+
}
|
3539
3543
|
}
|
3540
3544
|
};
|
3541
3545
|
|
@@ -3565,13 +3569,17 @@ import { cojsonInternals as cojsonInternals4 } from "cojson";
|
|
3565
3569
|
var JazzContextManager = class {
|
3566
3570
|
constructor() {
|
3567
3571
|
this.authSecretStorage = new AuthSecretStorage();
|
3572
|
+
this.authSecretStorageWithNotify = Object.assign(
|
3573
|
+
Object.create(this.authSecretStorage),
|
3574
|
+
{ notify: true }
|
3575
|
+
);
|
3568
3576
|
this.authenticating = false;
|
3569
3577
|
this.logOut = async () => {
|
3570
3578
|
if (!this.context || !this.props) {
|
3571
3579
|
return;
|
3572
3580
|
}
|
3581
|
+
await this.props.onLogOut?.();
|
3573
3582
|
await this.context.logOut();
|
3574
|
-
this.props.onLogOut?.();
|
3575
3583
|
return this.createContext(this.props);
|
3576
3584
|
};
|
3577
3585
|
this.done = () => {
|
@@ -3580,6 +3588,9 @@ var JazzContextManager = class {
|
|
3580
3588
|
}
|
3581
3589
|
this.context.done();
|
3582
3590
|
};
|
3591
|
+
/**
|
3592
|
+
* Authenticates the user with the given credentials
|
3593
|
+
*/
|
3583
3594
|
this.authenticate = async (credentials) => {
|
3584
3595
|
if (!this.props) {
|
3585
3596
|
throw new Error("Props required");
|
@@ -3631,7 +3642,7 @@ var JazzContextManager = class {
|
|
3631
3642
|
authProps;
|
3632
3643
|
throw new Error("Not implemented");
|
3633
3644
|
}
|
3634
|
-
updateContext(props, context) {
|
3645
|
+
async updateContext(props, context, authProps) {
|
3635
3646
|
if (!this.authenticating) {
|
3636
3647
|
this.context?.done();
|
3637
3648
|
}
|
@@ -3643,6 +3654,11 @@ var JazzContextManager = class {
|
|
3643
3654
|
authenticate: this.authenticate,
|
3644
3655
|
logOut: this.logOut
|
3645
3656
|
};
|
3657
|
+
if (authProps?.credentials) {
|
3658
|
+
this.authSecretStorage.emitUpdate(authProps.credentials);
|
3659
|
+
} else {
|
3660
|
+
this.authSecretStorage.emitUpdate(await this.authSecretStorage.get());
|
3661
|
+
}
|
3646
3662
|
this.notify();
|
3647
3663
|
}
|
3648
3664
|
propsChanged(props) {
|
@@ -3653,7 +3669,7 @@ var JazzContextManager = class {
|
|
3653
3669
|
return this.value;
|
3654
3670
|
}
|
3655
3671
|
getAuthSecretStorage() {
|
3656
|
-
return this.
|
3672
|
+
return this.authSecretStorageWithNotify;
|
3657
3673
|
}
|
3658
3674
|
notify() {
|
3659
3675
|
for (const listener of this.listeners) {
|
@@ -3956,4 +3972,4 @@ export {
|
|
3956
3972
|
consumeInviteLink
|
3957
3973
|
};
|
3958
3974
|
/* istanbul ignore file -- @preserve */
|
3959
|
-
//# sourceMappingURL=chunk-
|
3975
|
+
//# sourceMappingURL=chunk-TSEO4KAO.js.map
|