@knowlearning/agents 0.9.135 → 0.9.137

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.
@@ -6,14 +6,15 @@ export default function(scope='[]', user, domain, { keyToSubscriptionId, watcher
6
6
  let metadataPromise = new Promise(resolve => resolveMetadataPromise = resolve)
7
7
 
8
8
  const statePromise = new Promise(async (resolveState, rejectState) => {
9
- const qualifiedScope = isUUID(scope) ? scope : `${domain || ''}/${user || ''}/${scope}`
9
+ const { auth: { user: u }, domain: d, session } = await environment()
10
+
11
+ const qualifiedScope = isUUID(scope) ? scope : `${!domain || domain === d ? '' : domain}/${!user || user === u ? '' : user}/${scope}`
10
12
  if (!keyToSubscriptionId[qualifiedScope]) {
11
13
  const id = uuid()
12
14
 
13
15
  keyToSubscriptionId[qualifiedScope] = id
14
16
  watchers[qualifiedScope] = []
15
17
  states[qualifiedScope] = new Promise(async (resolve, reject) => {
16
- const { session } = await environment()
17
18
  await new Promise(r => setTimeout(r))
18
19
  interact('sessions', [{
19
20
  op: 'add',
package/browser.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ export interface AgentAuthInfo {
2
+ name?: string;
3
+ picture?: string;
4
+ }
5
+
6
+ export interface AgentAuth {
7
+ user: string;
8
+ provider: string;
9
+ info?: AgentAuthInfo;
10
+ }
11
+
12
+ export interface AgentEnvironment {
13
+ auth: AgentAuth;
14
+ domain: string;
15
+ server: string;
16
+ session: string;
17
+ context: string[];
18
+ }
19
+
20
+ export interface Agent {
21
+ environment(userId?: string): Promise<AgentEnvironment>;
22
+ state(ns?: string, user?: string, domain?: string): any;
23
+ upload(userId?: string): Promise<string>;
24
+ download(userId?: string): Promise<string>;
25
+ close(): void;
26
+ reset(ns: string): Promise<void>;
27
+ synced(): Promise<void>;
28
+ }
29
+
30
+ export default Agent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowlearning/agents",
3
- "version": "0.9.135",
3
+ "version": "0.9.137",
4
4
  "description": "API for embedding applications in KnowLearning systems.",
5
5
  "main": "node.js",
6
6
  "browser": "browser.js",