jazz-tools 0.8.14 → 0.8.15
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +6 -0
- package/dist/native/exports.js.map +1 -1
- package/dist/native/implementation/createContext.js +8 -0
- package/dist/native/implementation/createContext.js.map +1 -1
- package/dist/web/exports.js.map +1 -1
- package/dist/web/implementation/createContext.js +8 -0
- package/dist/web/implementation/createContext.js.map +1 -1
- package/package.json +1 -1
- package/src/exports.ts +1 -0
- package/src/implementation/createContext.ts +18 -5
package/CHANGELOG.md
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAkB,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAEzF,OAAO,
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAkB,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAEzF,OAAO,EAIH,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,GACxB,MAAM,eAAe,CAAC"}
|
@@ -5,6 +5,7 @@ export const fixedCredentialsAuth = (credentials) => {
|
|
5
5
|
start: async () => ({
|
6
6
|
type: "existing",
|
7
7
|
credentials,
|
8
|
+
saveCredentials: async () => { },
|
8
9
|
onSuccess: () => { },
|
9
10
|
onError: () => { },
|
10
11
|
logOut: () => { },
|
@@ -67,6 +68,13 @@ export async function createJazzContext(options) {
|
|
67
68
|
},
|
68
69
|
});
|
69
70
|
const account = AccountSchema.fromNode(node);
|
71
|
+
if (authResult.saveCredentials) {
|
72
|
+
await authResult.saveCredentials({
|
73
|
+
accountID: node.account
|
74
|
+
.id,
|
75
|
+
secret: node.account.agentSecret,
|
76
|
+
});
|
77
|
+
}
|
70
78
|
authResult.onSuccess();
|
71
79
|
return {
|
72
80
|
account,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../../src/implementation/createContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,eAAe,EAEf,SAAS,GAKZ,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,OAAO,EAAoB,MAAM,gBAAgB,CAAC;
|
1
|
+
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../../src/implementation/createContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,eAAe,EAEf,SAAS,G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AAG,IAAI,eAAe,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAE1D,MAAM,IAAI,GAAG,IAAI,SAAS,CACtB,QAAQ,EACR,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,EACtC,MAAM,CACT,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;QACjC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,OAAO;QACH,KAAK,EAAE,IAAI,kBAAkB,CAAC,IAAI,CAAC;QACnC,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;QACd,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;KACnB,CAAC;AACN,CAAC"}
|
package/dist/web/exports.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAkB,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAEzF,OAAO,
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAkB,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAEzF,OAAO,EAIH,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,GACxB,MAAM,eAAe,CAAC"}
|
@@ -5,6 +5,7 @@ export const fixedCredentialsAuth = (credentials) => {
|
|
5
5
|
start: async () => ({
|
6
6
|
type: "existing",
|
7
7
|
credentials,
|
8
|
+
saveCredentials: async () => { },
|
8
9
|
onSuccess: () => { },
|
9
10
|
onError: () => { },
|
10
11
|
logOut: () => { },
|
@@ -67,6 +68,13 @@ export async function createJazzContext(options) {
|
|
67
68
|
},
|
68
69
|
});
|
69
70
|
const account = AccountSchema.fromNode(node);
|
71
|
+
if (authResult.saveCredentials) {
|
72
|
+
await authResult.saveCredentials({
|
73
|
+
accountID: node.account
|
74
|
+
.id,
|
75
|
+
secret: node.account.agentSecret,
|
76
|
+
});
|
77
|
+
}
|
70
78
|
authResult.onSuccess();
|
71
79
|
return {
|
72
80
|
account,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../../src/implementation/createContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,eAAe,EAEf,SAAS,GAKZ,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,OAAO,EAAoB,MAAM,gBAAgB,CAAC;
|
1
|
+
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../../src/implementation/createContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,eAAe,EAEf,SAAS,GAKZ,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,OAAO,EAAoB,MAAM,gBAAgB,CAAC;AA8B3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,WAGpC,EAAc,EAAE;IACb,OAAO;QACH,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;YAChB,IAAI,EAAE,UAAU;YAChB,WAAW;YACX,eAAe,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;YAC/B,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;YACnB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;YACjB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;SACnB,CAAC;KACL,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAe,EAAE;IACrD,OAAO;QACH,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;YAChB,IAAI,EAAE,KAAK;YACX,aAAa,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;YACpC,eAAe,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;YAC/B,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;YACnB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;YACjB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;SACnB,CAAC;KACL,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACvC,SAAsB,EACtB,MAAsB;IAEtB,OAAO;QACH,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAChC,SAAoC,CACvC;QACD,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;KACxB,CAAC;AACN,CAAC;AA8CD,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IAAI,CAAW;IAAG,CAAC;CACzC;AAED,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,EAC7C,eAAe,EACf,MAAM,GAIT;IACG,MAAM,WAAW,GAAG,MAAM,CAAC,oBAAoB,EAAE,CAAC;IAClD,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAE1D,MAAM,IAAI,GAAG,IAAI,SAAS,CACtB,QAAQ,EACR,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,EACtC,MAAM,CACT,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;QACjC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,OAAO;QACH,KAAK,EAAE,IAAI,kBAAkB,CAAC,IAAI,CAAC;QACnC,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;QACd,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;KACnB,CAAC;AACN,CAAC"}
|
package/package.json
CHANGED
package/src/exports.ts
CHANGED
@@ -11,10 +11,16 @@ import {
|
|
11
11
|
} from "cojson";
|
12
12
|
import { Account, AccountClass, ID } from "../internal.js";
|
13
13
|
|
14
|
+
export type Credentials = {
|
15
|
+
accountID: ID<Account>;
|
16
|
+
secret: AgentSecret;
|
17
|
+
};
|
18
|
+
|
14
19
|
export type AuthResult =
|
15
20
|
| {
|
16
21
|
type: "existing";
|
17
|
-
credentials:
|
22
|
+
credentials: Credentials;
|
23
|
+
saveCredentials?: (credentials: Credentials) => Promise<void>;
|
18
24
|
onSuccess: () => void;
|
19
25
|
onError: (error: string | Error) => void;
|
20
26
|
logOut: () => void;
|
@@ -23,10 +29,7 @@ export type AuthResult =
|
|
23
29
|
type: "new";
|
24
30
|
creationProps: { name: string };
|
25
31
|
initialSecret?: AgentSecret;
|
26
|
-
saveCredentials: (credentials:
|
27
|
-
accountID: ID<Account>;
|
28
|
-
secret: AgentSecret;
|
29
|
-
}) => Promise<void>;
|
32
|
+
saveCredentials: (credentials: Credentials) => Promise<void>;
|
30
33
|
onSuccess: () => void;
|
31
34
|
onError: (error: string | Error) => void;
|
32
35
|
logOut: () => void;
|
@@ -44,6 +47,7 @@ export const fixedCredentialsAuth = (credentials: {
|
|
44
47
|
start: async () => ({
|
45
48
|
type: "existing",
|
46
49
|
credentials,
|
50
|
+
saveCredentials: async () => {},
|
47
51
|
onSuccess: () => {},
|
48
52
|
onError: () => {},
|
49
53
|
logOut: () => {},
|
@@ -168,6 +172,15 @@ export async function createJazzContext<Acc extends Account>(
|
|
168
172
|
});
|
169
173
|
|
170
174
|
const account = AccountSchema.fromNode(node);
|
175
|
+
|
176
|
+
if (authResult.saveCredentials) {
|
177
|
+
await authResult.saveCredentials({
|
178
|
+
accountID: node.account
|
179
|
+
.id as unknown as ID<Account>,
|
180
|
+
secret: node.account.agentSecret,
|
181
|
+
});
|
182
|
+
}
|
183
|
+
|
171
184
|
authResult.onSuccess();
|
172
185
|
|
173
186
|
return {
|