anbaric-tsapi 1.18.0 → 1.19.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.
package/package.json
CHANGED
package/src/api/actors/Actor.ts
CHANGED
|
@@ -8,12 +8,12 @@ class Agent implements Actor {
|
|
|
8
8
|
|
|
9
9
|
readonly type = "AGENT" as const;
|
|
10
10
|
readonly id : string;
|
|
11
|
-
readonly
|
|
11
|
+
readonly roles : Array<string>;
|
|
12
12
|
readonly client : Agent.Client;
|
|
13
13
|
|
|
14
|
-
constructor(id : string,
|
|
14
|
+
constructor(id : string, roles : Array<string> | string, client : Agent.Client) {
|
|
15
15
|
this.id = id;
|
|
16
|
-
this.
|
|
16
|
+
this.roles = typeof roles === "string" ? [roles] : roles;
|
|
17
17
|
this.client = client;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -10,7 +10,7 @@ type WorkflowDefinition = {
|
|
|
10
10
|
states : Array<{
|
|
11
11
|
id : string,
|
|
12
12
|
isTerminal : boolean,
|
|
13
|
-
actions : Array<{ name : string, description : string, actor : { id : string, type : string,
|
|
13
|
+
actions : Array<{ name : string, description : string, actor : { id : string, type : string, roles : Array<string> } }>,
|
|
14
14
|
transitions : Array<{ to : string }>,
|
|
15
15
|
}>,
|
|
16
16
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* The identity behind a platform session token, as resolved by the platform. */
|
|
2
|
+
type ResolvedSession = {
|
|
3
|
+
|
|
4
|
+
id : string,
|
|
5
|
+
roles : Array<string>,
|
|
6
|
+
tenant? : string,
|
|
7
|
+
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/* Resolves a platform session token (the anbaric_session cookie) into the
|
|
11
|
+
user's identity. A deployed app cannot verify the token itself - it is signed
|
|
12
|
+
with a platform-only secret - so the resolution is a call to the platform.
|
|
13
|
+
Returns undefined when the token is missing, invalid or expired. */
|
|
14
|
+
interface SessionResolver {
|
|
15
|
+
|
|
16
|
+
resolve(sessionToken : string) : Promise<ResolvedSession | undefined>;
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type { SessionResolver, ResolvedSession }
|
package/src/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from "./api/auditing/NoOpAuditor"
|
|
|
14
14
|
export * from "./api/transitions/Transition"
|
|
15
15
|
export * from "./api/actors/Actor"
|
|
16
16
|
export * from "./api/actors/SystemActor"
|
|
17
|
+
export * from "./api/sessions/SessionResolver"
|
|
17
18
|
export * from "./api/documents/JsonStore"
|
|
18
19
|
export * from "./api/secrets/SecretStore"
|
|
19
20
|
export * from "./api/sql/SqlStore"
|