@coasys/ad4m 0.12.0-rc1-dev.1 → 0.12.0-rc1-dev.2
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/jest.config.js +4 -4
- package/lib/index.cjs +5999 -6046
- package/lib/index.js +5977 -6040
- package/lib/src/Ad4mClient.d.ts +16 -9
- package/lib/src/Ad4mClient.js +25 -46
- package/lib/src/Ad4mClient.test.d.ts +1 -0
- package/lib/src/Ad4mClient.test.js +1204 -0
- package/lib/src/Literal.d.ts +2 -1
- package/lib/src/Literal.js +35 -38
- package/lib/src/Literal.test.d.ts +1 -0
- package/lib/src/Literal.test.js +41 -0
- package/lib/src/SmartLiteral.d.ts +2 -1
- package/lib/src/SmartLiteral.js +15 -30
- package/lib/src/agent/AgentClient.d.ts +4 -1
- package/lib/src/agent/AgentClient.js +99 -79
- package/lib/src/ai/AIClient.d.ts +2 -1
- package/lib/src/ai/AIClient.js +220 -224
- package/lib/src/expression/ExpressionClient.d.ts +1 -1
- package/lib/src/expression/ExpressionClient.js +86 -73
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/language/LanguageClient.d.ts +1 -1
- package/lib/src/language/LanguageClient.js +52 -52
- package/lib/src/model/Ad4mModel.d.ts +157 -937
- package/lib/src/model/Ad4mModel.js +212 -2799
- package/lib/src/model/Ad4mModel.test.js +1002 -561
- package/lib/src/model/decorators.d.ts +94 -426
- package/lib/src/model/decorators.js +333 -741
- package/lib/src/model/mutation.d.ts +81 -0
- package/lib/src/model/mutation.js +317 -0
- package/lib/src/model/parentUtils.d.ts +32 -0
- package/lib/src/model/parentUtils.js +64 -0
- package/lib/src/model/prolog/generatePrologFacts.d.ts +36 -0
- package/lib/src/model/prolog/generatePrologFacts.js +139 -0
- package/lib/src/model/prolog/index.d.ts +1 -0
- package/lib/src/model/prolog/index.js +1 -0
- package/lib/src/model/query/ModelQueryBuilder.d.ts +82 -0
- package/lib/src/model/query/ModelQueryBuilder.js +115 -0
- package/lib/src/model/query/QueryBuilder.d.ts +101 -0
- package/lib/src/model/query/QueryBuilder.js +193 -0
- package/lib/src/model/query/SurrealQueryBuilder.d.ts +48 -0
- package/lib/src/model/query/SurrealQueryBuilder.js +371 -0
- package/lib/src/model/query/fetchInstance.d.ts +24 -0
- package/lib/src/model/query/fetchInstance.js +144 -0
- package/lib/src/model/query/hydration.d.ts +54 -0
- package/lib/src/model/query/hydration.js +214 -0
- package/lib/src/model/query/operations.d.ts +59 -0
- package/lib/src/model/query/operations.js +384 -0
- package/lib/src/model/query/snapshot.d.ts +59 -0
- package/lib/src/model/query/snapshot.js +106 -0
- package/lib/src/model/query/surrealCompiler.d.ts +42 -0
- package/lib/src/model/query/surrealCompiler.js +304 -0
- package/lib/src/model/schema/fromJSONSchema.d.ts +67 -0
- package/lib/src/model/schema/fromJSONSchema.js +264 -0
- package/lib/src/model/schema/metadata.d.ts +15 -0
- package/lib/src/model/schema/metadata.js +112 -0
- package/lib/src/model/subscription.d.ts +47 -0
- package/lib/src/model/subscription.js +231 -0
- package/lib/src/model/transaction.d.ts +27 -0
- package/lib/src/model/transaction.js +32 -0
- package/lib/src/model/types.d.ts +195 -0
- package/lib/src/model/types.js +8 -0
- package/lib/src/model/util.js +7 -7
- package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +5 -1
- package/lib/src/neighbourhood/NeighbourhoodClient.js +263 -181
- package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +2 -1
- package/lib/src/neighbourhood/NeighbourhoodProxy.js +13 -28
- package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +1 -5
- package/lib/src/perspectives/PerspectiveClient.d.ts +9 -9
- package/lib/src/perspectives/PerspectiveClient.js +316 -240
- package/lib/src/perspectives/PerspectiveProxy.d.ts +54 -92
- package/lib/src/perspectives/PerspectiveProxy.js +803 -444
- package/lib/src/runtime/RuntimeClient.d.ts +5 -1
- package/lib/src/runtime/RuntimeClient.js +412 -238
- package/lib/src/shacl/SHACLFlow.test.js +164 -105
- package/lib/src/shacl/SHACLShape.d.ts +17 -3
- package/lib/src/shacl/SHACLShape.js +127 -90
- package/lib/src/shacl/SHACLShape.test.js +244 -176
- package/lib/src/utils.d.ts +8 -0
- package/lib/src/utils.js +21 -7
- package/package.json +8 -13
- package/src/Ad4mClient.test.ts +1564 -1315
- package/src/Ad4mClient.ts +55 -54
- package/src/Literal.test.ts +45 -26
- package/src/Literal.ts +82 -66
- package/src/SmartLiteral.ts +74 -58
- package/src/agent/AgentClient.ts +144 -99
- package/src/ai/AIClient.ts +409 -359
- package/src/expression/ExpressionClient.ts +142 -96
- package/src/index.ts +1 -1
- package/src/language/LanguageClient.ts +137 -113
- package/src/model/Ad4mModel.test.ts +1128 -647
- package/src/model/Ad4mModel.ts +485 -3249
- package/src/model/IMPROVEMENTS.md +482 -0
- package/src/model/PREDICATE_COLLISION_FIX.md +651 -0
- package/src/model/README.md +317 -0
- package/src/model/SHACL_MUTATION_DECOUPLING.md +356 -0
- package/src/model/SUBSCRIPTION_STRATEGY.md +317 -0
- package/src/model/TC39_STAGE_3_DECORATORS.md +609 -0
- package/src/model/decorators.ts +689 -1046
- package/src/model/mutation.ts +461 -0
- package/src/model/parentUtils.ts +91 -0
- package/src/model/prolog/generatePrologFacts.ts +176 -0
- package/src/model/prolog/index.ts +1 -0
- package/src/model/query/ModelQueryBuilder.ts +173 -0
- package/src/model/query/fetchInstance.ts +181 -0
- package/src/model/query/hydration.ts +273 -0
- package/src/model/query/operations.ts +510 -0
- package/src/model/query/snapshot.ts +126 -0
- package/src/model/query/surrealCompiler.ts +376 -0
- package/src/model/schema/fromJSONSchema.ts +411 -0
- package/src/model/schema/metadata.ts +148 -0
- package/src/model/subscription.ts +307 -0
- package/src/model/transaction.ts +60 -0
- package/src/model/types.ts +207 -0
- package/src/model/util.ts +47 -48
- package/src/neighbourhood/NeighbourhoodClient.ts +393 -251
- package/src/neighbourhood/NeighbourhoodProxy.test.ts +3 -7
- package/src/neighbourhood/NeighbourhoodProxy.ts +58 -40
- package/src/perspectives/PerspectiveClient.ts +779 -540
- package/src/perspectives/PerspectiveProxy.ts +2860 -2053
- package/src/runtime/RuntimeClient.ts +775 -476
- package/src/shacl/SHACLFlow.test.ts +196 -129
- package/src/shacl/SHACLShape.test.ts +284 -190
- package/src/shacl/SHACLShape.ts +225 -172
- package/src/utils.ts +31 -17
- package/tsconfig.json +9 -10
- package/src/model/Subject.ts +0 -159
|
@@ -19,7 +19,7 @@ describe("NeighbourhoodProxy", () => {
|
|
|
19
19
|
const neighbourhoodClient = new NeighbourhoodClient(mockApolloClient);
|
|
20
20
|
const neighbourhoodProxy = new NeighbourhoodProxy(
|
|
21
21
|
neighbourhoodClient,
|
|
22
|
-
neighbourhoodURI
|
|
22
|
+
neighbourhoodURI,
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
let callbacks = 0;
|
|
@@ -47,11 +47,7 @@ describe("NeighbourhoodProxy", () => {
|
|
|
47
47
|
const subscriptions = [];
|
|
48
48
|
const subscribe = (args: { next: (result: any) => void }) => {
|
|
49
49
|
subscriptions.push(args);
|
|
50
|
-
|
|
51
|
-
setTimeout(() => {
|
|
52
|
-
resolve({});
|
|
53
|
-
}, 10);
|
|
54
|
-
});
|
|
50
|
+
return { unsubscribe: () => {} };
|
|
55
51
|
};
|
|
56
52
|
|
|
57
53
|
const mockApolloClient = {
|
|
@@ -63,7 +59,7 @@ describe("NeighbourhoodProxy", () => {
|
|
|
63
59
|
const neighbourhoodClient = new NeighbourhoodClient(mockApolloClient);
|
|
64
60
|
const neighbourhoodProxy = new NeighbourhoodProxy(
|
|
65
61
|
neighbourhoodClient,
|
|
66
|
-
neighbourhoodURI
|
|
62
|
+
neighbourhoodURI,
|
|
67
63
|
);
|
|
68
64
|
|
|
69
65
|
let callbacks1 = 0;
|
|
@@ -1,58 +1,76 @@
|
|
|
1
1
|
import { DID } from "../DID";
|
|
2
2
|
import { OnlineAgent } from "../language/Language";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Perspective,
|
|
5
|
+
PerspectiveExpression,
|
|
6
|
+
PerspectiveUnsignedInput,
|
|
7
|
+
} from "../perspectives/Perspective";
|
|
4
8
|
import { NeighbourhoodClient } from "./NeighbourhoodClient";
|
|
5
9
|
|
|
6
10
|
export class NeighbourhoodProxy {
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
private _client: NeighbourhoodClient;
|
|
12
|
+
private _pID: string;
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
constructor(client: NeighbourhoodClient, pID: string) {
|
|
15
|
+
this._client = client;
|
|
16
|
+
this._pID = pID;
|
|
17
|
+
}
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
async otherAgents(): Promise<DID[]> {
|
|
20
|
+
return await this._client.otherAgents(this._pID);
|
|
21
|
+
}
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
async hasTelepresenceAdapter(): Promise<boolean> {
|
|
24
|
+
return await this._client.hasTelepresenceAdapter(this._pID);
|
|
25
|
+
}
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
async onlineAgents(): Promise<OnlineAgent[]> {
|
|
28
|
+
return await this._client.onlineAgents(this._pID);
|
|
29
|
+
}
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
async setOnlineStatus(status: Perspective): Promise<boolean> {
|
|
32
|
+
return await this._client.setOnlineStatus(this._pID, status);
|
|
33
|
+
}
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
async setOnlineStatusU(status: PerspectiveUnsignedInput): Promise<boolean> {
|
|
36
|
+
return await this._client.setOnlineStatusU(this._pID, status);
|
|
37
|
+
}
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
async sendSignal(
|
|
40
|
+
remoteAgentDid: string,
|
|
41
|
+
payload: Perspective,
|
|
42
|
+
): Promise<boolean> {
|
|
43
|
+
return await this._client.sendSignal(this._pID, remoteAgentDid, payload);
|
|
44
|
+
}
|
|
38
45
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
async sendSignalU(
|
|
47
|
+
remoteAgentDid: string,
|
|
48
|
+
payload: PerspectiveUnsignedInput,
|
|
49
|
+
): Promise<boolean> {
|
|
50
|
+
return await this._client.sendSignalU(this._pID, remoteAgentDid, payload);
|
|
51
|
+
}
|
|
42
52
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
async sendBroadcast(
|
|
54
|
+
payload: Perspective,
|
|
55
|
+
loopback: boolean = false,
|
|
56
|
+
): Promise<boolean> {
|
|
57
|
+
return await this._client.sendBroadcast(this._pID, payload, loopback);
|
|
58
|
+
}
|
|
46
59
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
async sendBroadcastU(
|
|
61
|
+
payload: PerspectiveUnsignedInput,
|
|
62
|
+
loopback: boolean = false,
|
|
63
|
+
): Promise<boolean> {
|
|
64
|
+
return await this._client.sendBroadcastU(this._pID, payload, loopback);
|
|
65
|
+
}
|
|
50
66
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
67
|
+
async addSignalHandler(
|
|
68
|
+
handler: (payload: PerspectiveExpression) => void,
|
|
69
|
+
): Promise<void> {
|
|
70
|
+
await this._client.addSignalHandler(this._pID, handler);
|
|
71
|
+
}
|
|
54
72
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
73
|
+
removeSignalHandler(handler: (payload: PerspectiveExpression) => void) {
|
|
74
|
+
this._client.removeSignalHandler(this._pID, handler);
|
|
75
|
+
}
|
|
58
76
|
}
|