@coasys/ad4m 0.12.0-rc1-dev.2 → 0.12.0-rc1-dev.4

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 (153) hide show
  1. package/jest.config.js +10 -3
  2. package/lib/index.cjs +6893 -5884
  3. package/lib/index.js +6889 -5872
  4. package/lib/src/Ad4mClient.d.ts +9 -16
  5. package/lib/src/Ad4mClient.js +46 -25
  6. package/lib/src/Literal.d.ts +1 -2
  7. package/lib/src/Literal.js +38 -35
  8. package/lib/src/SmartLiteral.d.ts +1 -2
  9. package/lib/src/SmartLiteral.js +30 -15
  10. package/lib/src/agent/AgentClient.d.ts +1 -4
  11. package/lib/src/agent/AgentClient.js +79 -99
  12. package/lib/src/ai/AIClient.d.ts +1 -2
  13. package/lib/src/ai/AIClient.js +224 -220
  14. package/lib/src/expression/ExpressionClient.d.ts +1 -1
  15. package/lib/src/expression/ExpressionClient.js +73 -86
  16. package/lib/src/index.d.ts +1 -1
  17. package/lib/src/index.js +1 -1
  18. package/lib/src/language/LanguageClient.d.ts +1 -1
  19. package/lib/src/language/LanguageClient.js +52 -52
  20. package/lib/src/model/Ad4mModel.d.ts +1351 -144
  21. package/lib/src/model/Ad4mModel.js +3760 -228
  22. package/lib/src/model/Ad4mModel.test.js +522 -979
  23. package/lib/src/model/Subject.d.ts +3 -3
  24. package/lib/src/model/Subject.js +25 -25
  25. package/lib/src/model/decorators.d.ts +444 -100
  26. package/lib/src/model/decorators.js +686 -321
  27. package/lib/src/model/util.d.ts +6 -6
  28. package/lib/src/model/util.js +24 -24
  29. package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +1 -5
  30. package/lib/src/neighbourhood/NeighbourhoodClient.js +179 -242
  31. package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +1 -2
  32. package/lib/src/neighbourhood/NeighbourhoodProxy.js +28 -13
  33. package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +5 -1
  34. package/lib/src/perspectives/PerspectiveClient.d.ts +9 -9
  35. package/lib/src/perspectives/PerspectiveClient.js +240 -316
  36. package/lib/src/perspectives/PerspectiveProxy.d.ts +99 -61
  37. package/lib/src/perspectives/PerspectiveProxy.js +485 -832
  38. package/lib/src/runtime/RuntimeClient.d.ts +1 -5
  39. package/lib/src/runtime/RuntimeClient.js +238 -412
  40. package/lib/src/shacl/SHACLFlow.test.js +105 -164
  41. package/lib/src/shacl/SHACLShape.d.ts +12 -17
  42. package/lib/src/shacl/SHACLShape.js +115 -128
  43. package/lib/src/shacl/SHACLShape.test.js +176 -244
  44. package/lib/src/shims/reflect-metadata.d.ts +0 -0
  45. package/lib/src/shims/type-graphql.d.ts +32 -0
  46. package/lib/src/src/Ad4mClient.d.ts +28 -0
  47. package/lib/src/src/Address.d.ts +1 -0
  48. package/lib/src/src/DID.d.ts +1 -0
  49. package/lib/src/src/Exception.d.ts +7 -0
  50. package/lib/src/src/Literal.d.ts +7 -0
  51. package/lib/src/src/PubSub.d.ts +17 -0
  52. package/lib/src/src/SmartLiteral.d.ts +12 -0
  53. package/lib/src/src/agent/Agent.d.ts +110 -0
  54. package/lib/src/src/agent/AgentClient.d.ts +62 -0
  55. package/lib/src/src/agent/AgentResolver.d.ts +30 -0
  56. package/lib/src/src/agent/AgentStatus.d.ts +8 -0
  57. package/lib/src/src/ai/AIClient.d.ts +32 -0
  58. package/lib/src/src/ai/AIResolver.d.ts +75 -0
  59. package/lib/src/src/ai/Tasks.d.ts +37 -0
  60. package/lib/src/src/buildSchema.d.ts +1 -0
  61. package/lib/src/src/expression/Expression.d.ts +28 -0
  62. package/lib/src/src/expression/ExpressionClient.d.ts +13 -0
  63. package/lib/src/src/expression/ExpressionRef.d.ts +9 -0
  64. package/lib/src/src/expression/ExpressionResolver.d.ts +10 -0
  65. package/lib/src/src/index.d.ts +35 -0
  66. package/lib/src/src/jestSetup.d.ts +1 -0
  67. package/lib/src/src/language/Icon.d.ts +4 -0
  68. package/lib/src/src/language/Language.d.ts +206 -0
  69. package/lib/src/src/language/LanguageClient.d.ts +17 -0
  70. package/lib/src/src/language/LanguageContext.d.ts +37 -0
  71. package/lib/src/src/language/LanguageHandle.d.ts +9 -0
  72. package/lib/src/src/language/LanguageMeta.d.ts +35 -0
  73. package/lib/src/src/language/LanguageRef.d.ts +6 -0
  74. package/lib/src/src/language/LanguageResolver.d.ts +19 -0
  75. package/lib/src/src/links/Links.d.ts +39 -0
  76. package/lib/src/src/links/Links.test.d.ts +1 -0
  77. package/lib/src/src/model/Ad4mModel.d.ts +1438 -0
  78. package/lib/src/src/model/Ad4mModel.test.d.ts +1 -0
  79. package/lib/src/src/model/Subject.d.ts +25 -0
  80. package/lib/src/src/model/decorators.d.ts +545 -0
  81. package/lib/src/src/model/util.d.ts +12 -0
  82. package/lib/src/src/neighbourhood/Neighbourhood.d.ts +10 -0
  83. package/lib/src/src/neighbourhood/NeighbourhoodClient.d.ts +25 -0
  84. package/lib/src/src/neighbourhood/NeighbourhoodProxy.d.ts +19 -0
  85. package/lib/src/src/neighbourhood/NeighbourhoodProxy.test.d.ts +1 -0
  86. package/lib/src/src/neighbourhood/NeighbourhoodResolver.d.ts +24 -0
  87. package/lib/src/src/perspectives/LinkQuery.d.ts +11 -0
  88. package/lib/src/src/perspectives/Perspective.d.ts +38 -0
  89. package/lib/src/src/perspectives/Perspective.test.d.ts +1 -0
  90. package/lib/src/src/perspectives/PerspectiveClient.d.ts +97 -0
  91. package/lib/src/src/perspectives/PerspectiveDiff.d.ts +9 -0
  92. package/lib/src/src/perspectives/PerspectiveHandle.d.ts +18 -0
  93. package/lib/src/src/perspectives/PerspectiveProxy.d.ts +865 -0
  94. package/lib/src/src/perspectives/PerspectiveResolver.d.ts +57 -0
  95. package/lib/src/src/runtime/RuntimeClient.d.ts +56 -0
  96. package/lib/src/src/runtime/RuntimeResolver.d.ts +132 -0
  97. package/lib/src/src/shacl/SHACLFlow.d.ts +171 -0
  98. package/lib/src/src/shacl/SHACLFlow.test.d.ts +1 -0
  99. package/lib/src/src/shacl/SHACLShape.d.ts +117 -0
  100. package/lib/src/src/shacl/SHACLShape.test.d.ts +1 -0
  101. package/lib/src/src/typeDefs.d.ts +1 -0
  102. package/lib/src/src/unwrapApolloResult.d.ts +2 -0
  103. package/lib/src/src/utils.d.ts +25 -0
  104. package/lib/src/utils.d.ts +0 -8
  105. package/lib/src/utils.js +7 -21
  106. package/package.json +15 -14
  107. package/src/Ad4mClient.test.ts +1315 -1564
  108. package/src/Ad4mClient.ts +54 -55
  109. package/src/Literal.test.ts +26 -45
  110. package/src/Literal.ts +66 -82
  111. package/src/SmartLiteral.ts +58 -74
  112. package/src/agent/AgentClient.ts +99 -144
  113. package/src/ai/AIClient.ts +359 -409
  114. package/src/expression/ExpressionClient.ts +96 -142
  115. package/src/index.ts +1 -1
  116. package/src/language/LanguageClient.ts +113 -137
  117. package/src/model/Ad4mModel.test.ts +616 -1114
  118. package/src/model/Ad4mModel.ts +4386 -451
  119. package/src/model/Subject.ts +159 -0
  120. package/src/model/decorators.ts +1168 -667
  121. package/src/model/util.ts +54 -53
  122. package/src/neighbourhood/NeighbourhoodClient.ts +266 -392
  123. package/src/neighbourhood/NeighbourhoodProxy.test.ts +7 -3
  124. package/src/neighbourhood/NeighbourhoodProxy.ts +40 -58
  125. package/src/perspectives/PerspectiveClient.ts +540 -779
  126. package/src/perspectives/PerspectiveProxy.ts +2067 -2860
  127. package/src/runtime/RuntimeClient.ts +476 -775
  128. package/src/shacl/SHACLFlow.test.ts +129 -196
  129. package/src/shacl/SHACLShape.test.ts +190 -284
  130. package/src/shacl/SHACLShape.ts +200 -224
  131. package/src/utils.ts +17 -31
  132. package/tsconfig.json +10 -9
  133. package/src/model/IMPROVEMENTS.md +0 -482
  134. package/src/model/PREDICATE_COLLISION_FIX.md +0 -651
  135. package/src/model/README.md +0 -317
  136. package/src/model/SHACL_MUTATION_DECOUPLING.md +0 -356
  137. package/src/model/SUBSCRIPTION_STRATEGY.md +0 -317
  138. package/src/model/TC39_STAGE_3_DECORATORS.md +0 -609
  139. package/src/model/mutation.ts +0 -461
  140. package/src/model/parentUtils.ts +0 -91
  141. package/src/model/prolog/generatePrologFacts.ts +0 -176
  142. package/src/model/prolog/index.ts +0 -1
  143. package/src/model/query/ModelQueryBuilder.ts +0 -173
  144. package/src/model/query/fetchInstance.ts +0 -181
  145. package/src/model/query/hydration.ts +0 -273
  146. package/src/model/query/operations.ts +0 -510
  147. package/src/model/query/snapshot.ts +0 -126
  148. package/src/model/query/surrealCompiler.ts +0 -376
  149. package/src/model/schema/fromJSONSchema.ts +0 -411
  150. package/src/model/schema/metadata.ts +0 -148
  151. package/src/model/subscription.ts +0 -307
  152. package/src/model/transaction.ts +0 -60
  153. package/src/model/types.ts +0 -207
@@ -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,14 +16,7 @@ import { AIClient } from "./ai/AIClient";
16
16
  * for the respective functionality.
17
17
  */
18
18
  export declare class Ad4mClient {
19
- private _apolloClient;
20
- private _agentClient;
21
- private _expressionClient;
22
- private _languageClient;
23
- private _neighbourhoodClient;
24
- private _perspectiveClient;
25
- private _runtimeClient;
26
- private _aiClient;
19
+ #private;
27
20
  constructor(client: ApolloClient<any>, subscribe?: boolean);
28
21
  get agent(): AgentClient;
29
22
  get expression(): ExpressionClient;
@@ -1,10 +1,22 @@
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";
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';
8
20
  /**
9
21
  * Client for the Ad4m interface wrapping GraphQL queryies
10
22
  * for convenient use in user facing code.
@@ -16,37 +28,46 @@ import { AIClient } from "./ai/AIClient";
16
28
  */
17
29
  export class Ad4mClient {
18
30
  constructor(client, subscribe = true) {
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);
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");
30
50
  }
31
51
  get agent() {
32
- return this._agentClient;
52
+ return __classPrivateFieldGet(this, _Ad4mClient_agentClient, "f");
33
53
  }
34
54
  get expression() {
35
- return this._expressionClient;
55
+ return __classPrivateFieldGet(this, _Ad4mClient_expressionClient, "f");
36
56
  }
37
57
  get languages() {
38
- return this._languageClient;
58
+ return __classPrivateFieldGet(this, _Ad4mClient_languageClient, "f");
39
59
  }
40
60
  get neighbourhood() {
41
- return this._neighbourhoodClient;
61
+ return __classPrivateFieldGet(this, _Ad4mClient_neighbourhoodClient, "f");
42
62
  }
43
63
  get perspective() {
44
- return this._perspectiveClient;
64
+ return __classPrivateFieldGet(this, _Ad4mClient_perspectiveClient, "f");
45
65
  }
46
66
  get runtime() {
47
- return this._runtimeClient;
67
+ return __classPrivateFieldGet(this, _Ad4mClient_runtimeClient, "f");
48
68
  }
49
69
  get ai() {
50
- return this._aiClient;
70
+ return __classPrivateFieldGet(this, _Ad4mClient_aiClient, "f");
51
71
  }
52
72
  }
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();
@@ -1,6 +1,5 @@
1
1
  export declare class Literal {
2
- private _literal?;
3
- private _url?;
2
+ #private;
4
3
  static fromUrl(url: string): Literal;
5
4
  static from(literal: any): Literal;
6
5
  toUrl(): string;
@@ -1,57 +1,67 @@
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 _Literal_literal, _Literal_url;
1
13
  function encodeRFC3986URIComponent(str) {
2
- return encodeURIComponent(str).replace(/[!'()*]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
14
+ return encodeURIComponent(str)
15
+ .replace(/[!'()*]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
3
16
  }
4
17
  export class Literal {
18
+ constructor() {
19
+ _Literal_literal.set(this, void 0);
20
+ _Literal_url.set(this, void 0);
21
+ }
5
22
  static fromUrl(url) {
6
23
  if (!url || !url.startsWith("literal://"))
7
24
  throw new Error("Can't create Literal from non-literal URL");
8
25
  const l = new Literal();
9
- l._url = url;
26
+ __classPrivateFieldSet(l, _Literal_url, url, "f");
10
27
  return l;
11
28
  }
12
29
  static from(literal) {
13
30
  const l = new Literal();
14
- l._literal = literal;
31
+ __classPrivateFieldSet(l, _Literal_literal, literal, "f");
15
32
  return l;
16
33
  }
17
34
  toUrl() {
18
- if (this._url && !this._literal)
19
- return this._url;
20
- if (!this._url &&
21
- (this._literal === undefined ||
22
- this._literal === "" ||
23
- this._literal === null))
35
+ if (__classPrivateFieldGet(this, _Literal_url, "f") && !__classPrivateFieldGet(this, _Literal_literal, "f"))
36
+ return __classPrivateFieldGet(this, _Literal_url, "f");
37
+ if (!__classPrivateFieldGet(this, _Literal_url, "f") && (__classPrivateFieldGet(this, _Literal_literal, "f") === undefined || __classPrivateFieldGet(this, _Literal_literal, "f") === "" || __classPrivateFieldGet(this, _Literal_literal, "f") === null))
24
38
  throw new Error("Can't turn empty Literal into URL");
25
39
  let encoded;
26
- switch (typeof this._literal) {
27
- case "string":
28
- encoded = `string:${encodeRFC3986URIComponent(this._literal)}`;
40
+ switch (typeof __classPrivateFieldGet(this, _Literal_literal, "f")) {
41
+ case 'string':
42
+ encoded = `string:${encodeRFC3986URIComponent(__classPrivateFieldGet(this, _Literal_literal, "f"))}`;
29
43
  break;
30
- case "number":
31
- encoded = `number:${encodeRFC3986URIComponent(this._literal)}`;
44
+ case 'number':
45
+ encoded = `number:${encodeRFC3986URIComponent(__classPrivateFieldGet(this, _Literal_literal, "f"))}`;
32
46
  break;
33
- case "boolean":
34
- encoded = `boolean:${encodeRFC3986URIComponent(this._literal)}`;
47
+ case 'boolean':
48
+ encoded = `boolean:${encodeRFC3986URIComponent(__classPrivateFieldGet(this, _Literal_literal, "f"))}`;
35
49
  break;
36
- case "object":
37
- encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(this._literal))}`;
50
+ case 'object':
51
+ encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(__classPrivateFieldGet(this, _Literal_literal, "f")))}`;
38
52
  break;
39
- default:
40
- throw new Error(`Literal.toUrl(): unsupported type "${typeof this._literal}" (value: ${String(this._literal)})`);
41
53
  }
42
54
  return `literal://${encoded}`;
43
55
  }
44
56
  get() {
45
- if (this._literal !== undefined &&
46
- this._literal !== null &&
47
- this._literal !== "")
48
- return this._literal;
49
- if (!this._url)
57
+ if (__classPrivateFieldGet(this, _Literal_literal, "f"))
58
+ return __classPrivateFieldGet(this, _Literal_literal, "f");
59
+ if (!__classPrivateFieldGet(this, _Literal_url, "f"))
50
60
  throw new Error("Can't render empty Literal");
51
- if (!this._url.startsWith("literal://"))
61
+ if (!__classPrivateFieldGet(this, _Literal_url, "f").startsWith("literal://"))
52
62
  throw new Error("Can't render Literal from non-literal URL");
53
63
  // get rid of "literal://"
54
- const body = this._url.substring(10);
64
+ const body = __classPrivateFieldGet(this, _Literal_url, "f").substring(10);
55
65
  if (body.startsWith("string:")) {
56
66
  return decodeURIComponent(body.substring(7));
57
67
  }
@@ -59,14 +69,6 @@ export class Literal {
59
69
  const numberString = body.substring(7);
60
70
  return parseFloat(numberString);
61
71
  }
62
- if (body.startsWith("boolean:")) {
63
- const boolStr = body.substring(8).trim();
64
- if (boolStr === "true")
65
- return true;
66
- if (boolStr === "false")
67
- return false;
68
- throw new Error(`Literal.get(): malformed boolean payload "${boolStr}" — expected "true" or "false"`);
69
- }
70
72
  if (body.startsWith("json:")) {
71
73
  const json = body.substring(5);
72
74
  return JSON.parse(decodeURIComponent(json));
@@ -74,3 +76,4 @@ export class Literal {
74
76
  throw new Error(`Can't parse unknown literal: ${body}`);
75
77
  }
76
78
  }
79
+ _Literal_literal = new WeakMap(), _Literal_url = new WeakMap();
@@ -1,8 +1,7 @@
1
1
  import { PerspectiveProxy } from "./perspectives/PerspectiveProxy";
2
2
  export declare const SMART_LITERAL_CONTENT_PREDICATE = "smart_literal://content";
3
3
  export declare class SmartLiteral {
4
- private _perspective;
5
- private _base;
4
+ #private;
6
5
  constructor(perspective: PerspectiveProxy, base: string);
7
6
  get base(): string;
8
7
  static create(perspective: PerspectiveProxy, literal: any): Promise<SmartLiteral>;
@@ -1,10 +1,22 @@
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 _SmartLiteral_perspective, _SmartLiteral_base;
1
13
  import { Link } from "./links/Links";
2
14
  import { Literal } from "./Literal";
3
15
  import { LinkQuery } from "./perspectives/LinkQuery";
4
16
  export const SMART_LITERAL_CONTENT_PREDICATE = "smart_literal://content";
5
17
  function makeRandomStringID(length) {
6
- let result = "";
7
- let characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
18
+ let result = '';
19
+ let characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
8
20
  let charactersLength = characters.length;
9
21
  for (let i = 0; i < length; i++) {
10
22
  result += characters.charAt(Math.floor(Math.random() * charactersLength));
@@ -13,11 +25,13 @@ function makeRandomStringID(length) {
13
25
  }
14
26
  export class SmartLiteral {
15
27
  constructor(perspective, base) {
16
- this._perspective = perspective;
17
- this._base = base;
28
+ _SmartLiteral_perspective.set(this, void 0);
29
+ _SmartLiteral_base.set(this, void 0);
30
+ __classPrivateFieldSet(this, _SmartLiteral_perspective, perspective, "f");
31
+ __classPrivateFieldSet(this, _SmartLiteral_base, base, "f");
18
32
  }
19
33
  get base() {
20
- return this._base;
34
+ return __classPrivateFieldGet(this, _SmartLiteral_base, "f");
21
35
  }
22
36
  static async create(perspective, literal) {
23
37
  const base = Literal.from(makeRandomStringID(10)).toUrl();
@@ -28,32 +42,33 @@ export class SmartLiteral {
28
42
  static async isSmartLiteralBase(perspective, base) {
29
43
  let links = await perspective.get(new LinkQuery({
30
44
  source: base,
31
- predicate: SMART_LITERAL_CONTENT_PREDICATE,
45
+ predicate: SMART_LITERAL_CONTENT_PREDICATE
32
46
  }));
33
47
  return links.length > 0;
34
48
  }
35
49
  static async getAllSmartLiterals(perspective) {
36
50
  let links = await perspective.get(new LinkQuery({
37
- predicate: SMART_LITERAL_CONTENT_PREDICATE,
51
+ predicate: SMART_LITERAL_CONTENT_PREDICATE
38
52
  }));
39
- return links.map((link) => new SmartLiteral(perspective, link.data.source));
53
+ return links.map(link => new SmartLiteral(perspective, link.data.source));
40
54
  }
41
55
  async get() {
42
- let link = await this._perspective.getSingleTarget(new LinkQuery({
43
- source: this._base,
44
- predicate: SMART_LITERAL_CONTENT_PREDICATE,
56
+ let link = await __classPrivateFieldGet(this, _SmartLiteral_perspective, "f").getSingleTarget(new LinkQuery({
57
+ source: __classPrivateFieldGet(this, _SmartLiteral_base, "f"),
58
+ predicate: SMART_LITERAL_CONTENT_PREDICATE
45
59
  }));
46
60
  if (!link) {
47
- throw `No content for smart literal ${this._base}`;
61
+ throw `No content for smart literal ${__classPrivateFieldGet(this, _SmartLiteral_base, "f")}`;
48
62
  }
49
63
  return Literal.fromUrl(link).get();
50
64
  }
51
65
  async set(content) {
52
66
  let literal = Literal.from(content);
53
- await this._perspective.setSingleTarget(new Link({
54
- source: this._base,
67
+ await __classPrivateFieldGet(this, _SmartLiteral_perspective, "f").setSingleTarget(new Link({
68
+ source: __classPrivateFieldGet(this, _SmartLiteral_base, "f"),
55
69
  predicate: SMART_LITERAL_CONTENT_PREDICATE,
56
- target: literal.toUrl(),
70
+ target: literal.toUrl()
57
71
  }));
58
72
  }
59
73
  }
74
+ _SmartLiteral_perspective = new WeakMap(), _SmartLiteral_base = new WeakMap();
@@ -19,10 +19,7 @@ export type AgentAppsUpdatedCallback = () => null;
19
19
  * as well as updating the publicly shared Agent expression.
20
20
  */
21
21
  export declare class AgentClient {
22
- private _apolloClient;
23
- private _appsChangedCallback;
24
- private _updatedCallbacks;
25
- private _agentStatusChangedCallbacks;
22
+ #private;
26
23
  constructor(client: ApolloClient<any>, subscribe?: boolean);
27
24
  /**
28
25
  * Returns the Agent expression of the local agent as it is shared