@coasys/ad4m 0.12.0-rc1-dev → 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.
Files changed (128) hide show
  1. package/jest.config.js +4 -4
  2. package/lib/index.cjs +5999 -6044
  3. package/lib/index.js +5977 -6038
  4. package/lib/src/Ad4mClient.d.ts +16 -9
  5. package/lib/src/Ad4mClient.js +25 -46
  6. package/lib/src/Ad4mClient.test.d.ts +1 -0
  7. package/lib/src/Ad4mClient.test.js +1204 -0
  8. package/lib/src/Literal.d.ts +2 -1
  9. package/lib/src/Literal.js +35 -38
  10. package/lib/src/Literal.test.d.ts +1 -0
  11. package/lib/src/Literal.test.js +41 -0
  12. package/lib/src/SmartLiteral.d.ts +2 -1
  13. package/lib/src/SmartLiteral.js +15 -30
  14. package/lib/src/agent/AgentClient.d.ts +4 -1
  15. package/lib/src/agent/AgentClient.js +99 -79
  16. package/lib/src/ai/AIClient.d.ts +2 -1
  17. package/lib/src/ai/AIClient.js +220 -224
  18. package/lib/src/expression/ExpressionClient.d.ts +1 -1
  19. package/lib/src/expression/ExpressionClient.js +86 -73
  20. package/lib/src/index.d.ts +1 -1
  21. package/lib/src/index.js +1 -1
  22. package/lib/src/language/LanguageClient.d.ts +1 -1
  23. package/lib/src/language/LanguageClient.js +52 -52
  24. package/lib/src/model/Ad4mModel.d.ts +157 -937
  25. package/lib/src/model/Ad4mModel.js +212 -2797
  26. package/lib/src/model/Ad4mModel.test.js +1002 -561
  27. package/lib/src/model/decorators.d.ts +94 -426
  28. package/lib/src/model/decorators.js +333 -741
  29. package/lib/src/model/mutation.d.ts +81 -0
  30. package/lib/src/model/mutation.js +317 -0
  31. package/lib/src/model/parentUtils.d.ts +32 -0
  32. package/lib/src/model/parentUtils.js +64 -0
  33. package/lib/src/model/prolog/generatePrologFacts.d.ts +36 -0
  34. package/lib/src/model/prolog/generatePrologFacts.js +139 -0
  35. package/lib/src/model/prolog/index.d.ts +1 -0
  36. package/lib/src/model/prolog/index.js +1 -0
  37. package/lib/src/model/query/ModelQueryBuilder.d.ts +82 -0
  38. package/lib/src/model/query/ModelQueryBuilder.js +115 -0
  39. package/lib/src/model/query/QueryBuilder.d.ts +101 -0
  40. package/lib/src/model/query/QueryBuilder.js +193 -0
  41. package/lib/src/model/query/SurrealQueryBuilder.d.ts +48 -0
  42. package/lib/src/model/query/SurrealQueryBuilder.js +371 -0
  43. package/lib/src/model/query/fetchInstance.d.ts +24 -0
  44. package/lib/src/model/query/fetchInstance.js +144 -0
  45. package/lib/src/model/query/hydration.d.ts +54 -0
  46. package/lib/src/model/query/hydration.js +214 -0
  47. package/lib/src/model/query/operations.d.ts +59 -0
  48. package/lib/src/model/query/operations.js +384 -0
  49. package/lib/src/model/query/snapshot.d.ts +59 -0
  50. package/lib/src/model/query/snapshot.js +106 -0
  51. package/lib/src/model/query/surrealCompiler.d.ts +42 -0
  52. package/lib/src/model/query/surrealCompiler.js +304 -0
  53. package/lib/src/model/schema/fromJSONSchema.d.ts +67 -0
  54. package/lib/src/model/schema/fromJSONSchema.js +264 -0
  55. package/lib/src/model/schema/metadata.d.ts +15 -0
  56. package/lib/src/model/schema/metadata.js +112 -0
  57. package/lib/src/model/subscription.d.ts +47 -0
  58. package/lib/src/model/subscription.js +231 -0
  59. package/lib/src/model/transaction.d.ts +27 -0
  60. package/lib/src/model/transaction.js +32 -0
  61. package/lib/src/model/types.d.ts +195 -0
  62. package/lib/src/model/types.js +8 -0
  63. package/lib/src/model/util.js +7 -7
  64. package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +5 -1
  65. package/lib/src/neighbourhood/NeighbourhoodClient.js +263 -181
  66. package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +2 -1
  67. package/lib/src/neighbourhood/NeighbourhoodProxy.js +13 -28
  68. package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +1 -5
  69. package/lib/src/perspectives/PerspectiveClient.d.ts +9 -9
  70. package/lib/src/perspectives/PerspectiveClient.js +316 -240
  71. package/lib/src/perspectives/PerspectiveProxy.d.ts +54 -92
  72. package/lib/src/perspectives/PerspectiveProxy.js +803 -444
  73. package/lib/src/runtime/RuntimeClient.d.ts +5 -1
  74. package/lib/src/runtime/RuntimeClient.js +412 -238
  75. package/lib/src/shacl/SHACLFlow.test.js +164 -105
  76. package/lib/src/shacl/SHACLShape.d.ts +17 -3
  77. package/lib/src/shacl/SHACLShape.js +127 -90
  78. package/lib/src/shacl/SHACLShape.test.js +244 -176
  79. package/lib/src/utils.d.ts +8 -0
  80. package/lib/src/utils.js +21 -7
  81. package/package.json +8 -13
  82. package/src/Ad4mClient.test.ts +1564 -1315
  83. package/src/Ad4mClient.ts +55 -54
  84. package/src/Literal.test.ts +45 -26
  85. package/src/Literal.ts +82 -66
  86. package/src/SmartLiteral.ts +74 -58
  87. package/src/agent/AgentClient.ts +144 -99
  88. package/src/ai/AIClient.ts +409 -359
  89. package/src/expression/ExpressionClient.ts +142 -96
  90. package/src/index.ts +1 -1
  91. package/src/language/LanguageClient.ts +137 -113
  92. package/src/model/Ad4mModel.test.ts +1128 -647
  93. package/src/model/Ad4mModel.ts +485 -3247
  94. package/src/model/IMPROVEMENTS.md +482 -0
  95. package/src/model/PREDICATE_COLLISION_FIX.md +651 -0
  96. package/src/model/README.md +317 -0
  97. package/src/model/SHACL_MUTATION_DECOUPLING.md +356 -0
  98. package/src/model/SUBSCRIPTION_STRATEGY.md +317 -0
  99. package/src/model/TC39_STAGE_3_DECORATORS.md +609 -0
  100. package/src/model/decorators.ts +689 -1046
  101. package/src/model/mutation.ts +461 -0
  102. package/src/model/parentUtils.ts +91 -0
  103. package/src/model/prolog/generatePrologFacts.ts +176 -0
  104. package/src/model/prolog/index.ts +1 -0
  105. package/src/model/query/ModelQueryBuilder.ts +173 -0
  106. package/src/model/query/fetchInstance.ts +181 -0
  107. package/src/model/query/hydration.ts +273 -0
  108. package/src/model/query/operations.ts +510 -0
  109. package/src/model/query/snapshot.ts +126 -0
  110. package/src/model/query/surrealCompiler.ts +376 -0
  111. package/src/model/schema/fromJSONSchema.ts +411 -0
  112. package/src/model/schema/metadata.ts +148 -0
  113. package/src/model/subscription.ts +307 -0
  114. package/src/model/transaction.ts +60 -0
  115. package/src/model/types.ts +207 -0
  116. package/src/model/util.ts +47 -48
  117. package/src/neighbourhood/NeighbourhoodClient.ts +393 -251
  118. package/src/neighbourhood/NeighbourhoodProxy.test.ts +3 -7
  119. package/src/neighbourhood/NeighbourhoodProxy.ts +58 -40
  120. package/src/perspectives/PerspectiveClient.ts +779 -540
  121. package/src/perspectives/PerspectiveProxy.ts +2860 -2053
  122. package/src/runtime/RuntimeClient.ts +775 -476
  123. package/src/shacl/SHACLFlow.test.ts +196 -129
  124. package/src/shacl/SHACLShape.test.ts +284 -190
  125. package/src/shacl/SHACLShape.ts +225 -172
  126. package/src/utils.ts +31 -17
  127. package/tsconfig.json +9 -10
  128. package/src/model/Subject.ts +0 -159
@@ -1,11 +1,11 @@
1
- import { ApolloClient } from '@apollo/client/core';
2
- import { AgentClient } from './agent/AgentClient';
3
- import { LanguageClient } from './language/LanguageClient';
4
- import { NeighbourhoodClient } from './neighbourhood/NeighbourhoodClient';
5
- import { PerspectiveClient } from './perspectives/PerspectiveClient';
6
- import { RuntimeClient } from './runtime/RuntimeClient';
7
- import { ExpressionClient } from './expression/ExpressionClient';
8
- import { AIClient } from './ai/AIClient';
1
+ import { ApolloClient } from "@apollo/client/core";
2
+ import { AgentClient } from "./agent/AgentClient";
3
+ import { LanguageClient } from "./language/LanguageClient";
4
+ import { NeighbourhoodClient } from "./neighbourhood/NeighbourhoodClient";
5
+ import { PerspectiveClient } from "./perspectives/PerspectiveClient";
6
+ import { RuntimeClient } from "./runtime/RuntimeClient";
7
+ import { ExpressionClient } from "./expression/ExpressionClient";
8
+ import { AIClient } from "./ai/AIClient";
9
9
  /**
10
10
  * Client for the Ad4m interface wrapping GraphQL queryies
11
11
  * for convenient use in user facing code.
@@ -16,7 +16,14 @@ import { AIClient } from './ai/AIClient';
16
16
  * for the respective functionality.
17
17
  */
18
18
  export declare class Ad4mClient {
19
- #private;
19
+ private _apolloClient;
20
+ private _agentClient;
21
+ private _expressionClient;
22
+ private _languageClient;
23
+ private _neighbourhoodClient;
24
+ private _perspectiveClient;
25
+ private _runtimeClient;
26
+ private _aiClient;
20
27
  constructor(client: ApolloClient<any>, subscribe?: boolean);
21
28
  get agent(): AgentClient;
22
29
  get expression(): ExpressionClient;
@@ -1,22 +1,10 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _Ad4mClient_apolloClient, _Ad4mClient_agentClient, _Ad4mClient_expressionClient, _Ad4mClient_languageClient, _Ad4mClient_neighbourhoodClient, _Ad4mClient_perspectiveClient, _Ad4mClient_runtimeClient, _Ad4mClient_aiClient;
13
- import { AgentClient } from './agent/AgentClient';
14
- import { LanguageClient } from './language/LanguageClient';
15
- import { NeighbourhoodClient } from './neighbourhood/NeighbourhoodClient';
16
- import { PerspectiveClient } from './perspectives/PerspectiveClient';
17
- import { RuntimeClient } from './runtime/RuntimeClient';
18
- import { ExpressionClient } from './expression/ExpressionClient';
19
- import { AIClient } from './ai/AIClient';
1
+ import { AgentClient } from "./agent/AgentClient";
2
+ import { LanguageClient } from "./language/LanguageClient";
3
+ import { NeighbourhoodClient } from "./neighbourhood/NeighbourhoodClient";
4
+ import { PerspectiveClient } from "./perspectives/PerspectiveClient";
5
+ import { RuntimeClient } from "./runtime/RuntimeClient";
6
+ import { ExpressionClient } from "./expression/ExpressionClient";
7
+ import { AIClient } from "./ai/AIClient";
20
8
  /**
21
9
  * Client for the Ad4m interface wrapping GraphQL queryies
22
10
  * for convenient use in user facing code.
@@ -28,46 +16,37 @@ import { AIClient } from './ai/AIClient';
28
16
  */
29
17
  export class Ad4mClient {
30
18
  constructor(client, subscribe = true) {
31
- _Ad4mClient_apolloClient.set(this, void 0);
32
- _Ad4mClient_agentClient.set(this, void 0);
33
- _Ad4mClient_expressionClient.set(this, void 0);
34
- _Ad4mClient_languageClient.set(this, void 0);
35
- _Ad4mClient_neighbourhoodClient.set(this, void 0);
36
- _Ad4mClient_perspectiveClient.set(this, void 0);
37
- _Ad4mClient_runtimeClient.set(this, void 0);
38
- _Ad4mClient_aiClient.set(this, void 0);
39
- __classPrivateFieldSet(this, _Ad4mClient_apolloClient, client, "f");
40
- __classPrivateFieldSet(this, _Ad4mClient_agentClient, new AgentClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
41
- __classPrivateFieldSet(this, _Ad4mClient_expressionClient, new ExpressionClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f")), "f");
42
- __classPrivateFieldSet(this, _Ad4mClient_languageClient, new LanguageClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f")), "f");
43
- __classPrivateFieldSet(this, _Ad4mClient_neighbourhoodClient, new NeighbourhoodClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f")), "f");
44
- __classPrivateFieldSet(this, _Ad4mClient_aiClient, new AIClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
45
- __classPrivateFieldSet(this, _Ad4mClient_perspectiveClient, new PerspectiveClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
46
- __classPrivateFieldGet(this, _Ad4mClient_perspectiveClient, "f").setExpressionClient(__classPrivateFieldGet(this, _Ad4mClient_expressionClient, "f"));
47
- __classPrivateFieldGet(this, _Ad4mClient_perspectiveClient, "f").setNeighbourhoodClient(__classPrivateFieldGet(this, _Ad4mClient_neighbourhoodClient, "f"));
48
- __classPrivateFieldGet(this, _Ad4mClient_perspectiveClient, "f").setAIClient(__classPrivateFieldGet(this, _Ad4mClient_aiClient, "f"));
49
- __classPrivateFieldSet(this, _Ad4mClient_runtimeClient, new RuntimeClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
19
+ this._apolloClient = client;
20
+ this._agentClient = new AgentClient(this._apolloClient, subscribe);
21
+ this._expressionClient = new ExpressionClient(this._apolloClient);
22
+ this._languageClient = new LanguageClient(this._apolloClient);
23
+ this._neighbourhoodClient = new NeighbourhoodClient(this._apolloClient);
24
+ this._aiClient = new AIClient(this._apolloClient, subscribe);
25
+ this._perspectiveClient = new PerspectiveClient(this._apolloClient, subscribe);
26
+ this._perspectiveClient.setExpressionClient(this._expressionClient);
27
+ this._perspectiveClient.setNeighbourhoodClient(this._neighbourhoodClient);
28
+ this._perspectiveClient.setAIClient(this._aiClient);
29
+ this._runtimeClient = new RuntimeClient(this._apolloClient, subscribe);
50
30
  }
51
31
  get agent() {
52
- return __classPrivateFieldGet(this, _Ad4mClient_agentClient, "f");
32
+ return this._agentClient;
53
33
  }
54
34
  get expression() {
55
- return __classPrivateFieldGet(this, _Ad4mClient_expressionClient, "f");
35
+ return this._expressionClient;
56
36
  }
57
37
  get languages() {
58
- return __classPrivateFieldGet(this, _Ad4mClient_languageClient, "f");
38
+ return this._languageClient;
59
39
  }
60
40
  get neighbourhood() {
61
- return __classPrivateFieldGet(this, _Ad4mClient_neighbourhoodClient, "f");
41
+ return this._neighbourhoodClient;
62
42
  }
63
43
  get perspective() {
64
- return __classPrivateFieldGet(this, _Ad4mClient_perspectiveClient, "f");
44
+ return this._perspectiveClient;
65
45
  }
66
46
  get runtime() {
67
- return __classPrivateFieldGet(this, _Ad4mClient_runtimeClient, "f");
47
+ return this._runtimeClient;
68
48
  }
69
49
  get ai() {
70
- return __classPrivateFieldGet(this, _Ad4mClient_aiClient, "f");
50
+ return this._aiClient;
71
51
  }
72
52
  }
73
- _Ad4mClient_apolloClient = new WeakMap(), _Ad4mClient_agentClient = new WeakMap(), _Ad4mClient_expressionClient = new WeakMap(), _Ad4mClient_languageClient = new WeakMap(), _Ad4mClient_neighbourhoodClient = new WeakMap(), _Ad4mClient_perspectiveClient = new WeakMap(), _Ad4mClient_runtimeClient = new WeakMap(), _Ad4mClient_aiClient = new WeakMap();
@@ -0,0 +1 @@
1
+ export {};