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

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 +6872 -5886
  3. package/lib/index.js +6868 -5874
  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 +3737 -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 +4361 -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,6 +1,17 @@
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 _AgentClient_apolloClient, _AgentClient_appsChangedCallback, _AgentClient_updatedCallbacks, _AgentClient_agentStatusChangedCallbacks;
1
13
  import { gql } from "@apollo/client/core";
2
14
  import unwrapApolloResult from "../unwrapApolloResult";
3
- import { isSocketCloseError } from "../utils";
4
15
  import { Agent, } from "./Agent";
5
16
  import { AgentStatus } from "./AgentStatus";
6
17
  import { PerspectiveClient } from "../perspectives/PerspectiveClient";
@@ -62,10 +73,14 @@ const AGENT_SIGNATURE_FIELDS = `
62
73
  */
63
74
  export class AgentClient {
64
75
  constructor(client, subscribe = true) {
65
- this._apolloClient = client;
66
- this._updatedCallbacks = [];
67
- this._agentStatusChangedCallbacks = [];
68
- this._appsChangedCallback = [];
76
+ _AgentClient_apolloClient.set(this, void 0);
77
+ _AgentClient_appsChangedCallback.set(this, void 0);
78
+ _AgentClient_updatedCallbacks.set(this, void 0);
79
+ _AgentClient_agentStatusChangedCallbacks.set(this, void 0);
80
+ __classPrivateFieldSet(this, _AgentClient_apolloClient, client, "f");
81
+ __classPrivateFieldSet(this, _AgentClient_updatedCallbacks, [], "f");
82
+ __classPrivateFieldSet(this, _AgentClient_agentStatusChangedCallbacks, [], "f");
83
+ __classPrivateFieldSet(this, _AgentClient_appsChangedCallback, [], "f");
69
84
  if (subscribe) {
70
85
  this.subscribeAgentUpdated();
71
86
  this.subscribeAgentStatusChanged();
@@ -79,7 +94,7 @@ export class AgentClient {
79
94
  * I.e. this is the users profile.
80
95
  */
81
96
  async me() {
82
- const { agent } = unwrapApolloResult(await this._apolloClient.query({
97
+ const { agent } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").query({
83
98
  query: gql `query agent { agent { ${AGENT_SUBITEMS} } }`,
84
99
  }));
85
100
  let agentObject = new Agent(agent.did, agent.perspective);
@@ -87,7 +102,7 @@ export class AgentClient {
87
102
  return agentObject;
88
103
  }
89
104
  async status() {
90
- const { agentStatus } = unwrapApolloResult(await this._apolloClient.query({
105
+ const { agentStatus } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").query({
91
106
  query: gql `query agentStatus {
92
107
  agentStatus {
93
108
  ${AGENT_STATUS_FIELDS}
@@ -97,7 +112,7 @@ export class AgentClient {
97
112
  return new AgentStatus(agentStatus);
98
113
  }
99
114
  async generate(passphrase) {
100
- const { agentGenerate } = unwrapApolloResult(await this._apolloClient.mutate({
115
+ const { agentGenerate } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
101
116
  mutation: gql `mutation agentGenerate(
102
117
  $passphrase: String!
103
118
  ) {
@@ -111,7 +126,7 @@ export class AgentClient {
111
126
  }
112
127
  async import(args) {
113
128
  let { did, didDocument, keystore, passphrase } = args;
114
- const { agentImport } = unwrapApolloResult(await this._apolloClient.mutate({
129
+ const { agentImport } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
115
130
  mutation: gql `mutation agentImport(
116
131
  $did: String!,
117
132
  $didDocument: String!,
@@ -127,7 +142,7 @@ export class AgentClient {
127
142
  return new AgentStatus(agentImport);
128
143
  }
129
144
  async lock(passphrase) {
130
- const { agentLock } = unwrapApolloResult(await this._apolloClient.mutate({
145
+ const { agentLock } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
131
146
  mutation: gql `mutation agentLock($passphrase: String!) {
132
147
  agentLock(passphrase: $passphrase) {
133
148
  ${AGENT_STATUS_FIELDS}
@@ -138,7 +153,7 @@ export class AgentClient {
138
153
  return new AgentStatus(agentLock);
139
154
  }
140
155
  async unlock(passphrase, holochain = true) {
141
- const { agentUnlock } = unwrapApolloResult(await this._apolloClient.mutate({
156
+ const { agentUnlock } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
142
157
  mutation: gql `mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
143
158
  agentUnlock(passphrase: $passphrase, holochain: $holochain) {
144
159
  ${AGENT_STATUS_FIELDS}
@@ -149,7 +164,7 @@ export class AgentClient {
149
164
  return new AgentStatus(agentUnlock);
150
165
  }
151
166
  async byDID(did) {
152
- const { agentByDID } = unwrapApolloResult(await this._apolloClient.query({
167
+ const { agentByDID } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").query({
153
168
  query: gql `query agentByDID($did: String!) {
154
169
  agentByDID(did: $did) {
155
170
  ${AGENT_SUBITEMS}
@@ -168,7 +183,7 @@ export class AgentClient {
168
183
  delete link.proof.__typename;
169
184
  delete link.status;
170
185
  });
171
- const { agentUpdatePublicPerspective } = unwrapApolloResult(await this._apolloClient.mutate({
186
+ const { agentUpdatePublicPerspective } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
172
187
  mutation: gql `mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
173
188
  agentUpdatePublicPerspective(perspective: $perspective) {
174
189
  ${AGENT_SUBITEMS}
@@ -182,8 +197,8 @@ export class AgentClient {
182
197
  return agent;
183
198
  }
184
199
  async mutatePublicPerspective(mutations) {
185
- const perspectiveClient = new PerspectiveClient(this._apolloClient);
186
- const agentClient = new AgentClient(this._apolloClient);
200
+ const perspectiveClient = new PerspectiveClient(__classPrivateFieldGet(this, _AgentClient_apolloClient, "f"));
201
+ const agentClient = new AgentClient(__classPrivateFieldGet(this, _AgentClient_apolloClient, "f"));
187
202
  //Create the proxy perspective and load existing links
188
203
  const proxyPerspective = await perspectiveClient.add("Agent Perspective Proxy");
189
204
  const agentMe = await agentClient.me();
@@ -206,7 +221,7 @@ export class AgentClient {
206
221
  return agent;
207
222
  }
208
223
  async updateDirectMessageLanguage(directMessageLanguage) {
209
- const { agentUpdateDirectMessageLanguage } = unwrapApolloResult(await this._apolloClient.mutate({
224
+ const { agentUpdateDirectMessageLanguage } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
210
225
  mutation: gql `mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
211
226
  agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
212
227
  ${AGENT_SUBITEMS}
@@ -220,7 +235,7 @@ export class AgentClient {
220
235
  return agent;
221
236
  }
222
237
  async addEntanglementProofs(proofs) {
223
- const { agentAddEntanglementProofs } = unwrapApolloResult(await this._apolloClient.mutate({
238
+ const { agentAddEntanglementProofs } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
224
239
  mutation: gql `mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
225
240
  agentAddEntanglementProofs(proofs: $proofs) {
226
241
  ${ENTANGLEMENT_PROOF_FIELDS}
@@ -231,7 +246,7 @@ export class AgentClient {
231
246
  return agentAddEntanglementProofs;
232
247
  }
233
248
  async deleteEntanglementProofs(proofs) {
234
- const { agentDeleteEntanglementProofs } = unwrapApolloResult(await this._apolloClient.mutate({
249
+ const { agentDeleteEntanglementProofs } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
235
250
  mutation: gql `mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
236
251
  agentDeleteEntanglementProofs(proofs: $proofs) {
237
252
  ${ENTANGLEMENT_PROOF_FIELDS}
@@ -242,7 +257,7 @@ export class AgentClient {
242
257
  return agentDeleteEntanglementProofs;
243
258
  }
244
259
  async getEntanglementProofs() {
245
- const { agentGetEntanglementProofs } = unwrapApolloResult(await this._apolloClient.query({
260
+ const { agentGetEntanglementProofs } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").query({
246
261
  query: gql `query agentGetEntanglementProofs {
247
262
  agentGetEntanglementProofs {
248
263
  ${ENTANGLEMENT_PROOF_FIELDS}
@@ -252,7 +267,7 @@ export class AgentClient {
252
267
  return agentGetEntanglementProofs;
253
268
  }
254
269
  async entanglementProofPreFlight(deviceKey, deviceKeyType) {
255
- const { agentEntanglementProofPreFlight } = unwrapApolloResult(await this._apolloClient.mutate({
270
+ const { agentEntanglementProofPreFlight } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
256
271
  mutation: gql `mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
257
272
  agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
258
273
  ${ENTANGLEMENT_PROOF_FIELDS}
@@ -263,13 +278,13 @@ export class AgentClient {
263
278
  return agentEntanglementProofPreFlight;
264
279
  }
265
280
  addUpdatedListener(listener) {
266
- this._updatedCallbacks.push(listener);
281
+ __classPrivateFieldGet(this, _AgentClient_updatedCallbacks, "f").push(listener);
267
282
  }
268
283
  addAppChangedListener(listener) {
269
- this._appsChangedCallback.push(listener);
284
+ __classPrivateFieldGet(this, _AgentClient_appsChangedCallback, "f").push(listener);
270
285
  }
271
286
  subscribeAgentUpdated() {
272
- this._apolloClient
287
+ __classPrivateFieldGet(this, _AgentClient_apolloClient, "f")
273
288
  .subscribe({
274
289
  query: gql ` subscription {
275
290
  agentUpdated { ${AGENT_SUBITEMS} }
@@ -279,18 +294,15 @@ export class AgentClient {
279
294
  .subscribe({
280
295
  next: (result) => {
281
296
  const agent = result.data.agentUpdated;
282
- this._updatedCallbacks.forEach((cb) => {
297
+ __classPrivateFieldGet(this, _AgentClient_updatedCallbacks, "f").forEach((cb) => {
283
298
  cb(agent);
284
299
  });
285
300
  },
286
- error: (e) => {
287
- if (!isSocketCloseError(e))
288
- console.error(e);
289
- },
301
+ error: (e) => console.error(e),
290
302
  });
291
303
  }
292
304
  subscribeAppsChanged() {
293
- this._apolloClient
305
+ __classPrivateFieldGet(this, _AgentClient_apolloClient, "f")
294
306
  .subscribe({
295
307
  query: gql ` subscription {
296
308
  agentAppsChanged {
@@ -301,21 +313,18 @@ export class AgentClient {
301
313
  })
302
314
  .subscribe({
303
315
  next: (result) => {
304
- this._appsChangedCallback.forEach((cb) => {
316
+ __classPrivateFieldGet(this, _AgentClient_appsChangedCallback, "f").forEach((cb) => {
305
317
  cb();
306
318
  });
307
319
  },
308
- error: (e) => {
309
- if (!isSocketCloseError(e))
310
- console.error(e);
311
- },
320
+ error: (e) => console.error(e),
312
321
  });
313
322
  }
314
323
  addAgentStatusChangedListener(listener) {
315
- this._agentStatusChangedCallbacks.push(listener);
324
+ __classPrivateFieldGet(this, _AgentClient_agentStatusChangedCallbacks, "f").push(listener);
316
325
  }
317
326
  subscribeAgentStatusChanged() {
318
- this._apolloClient
327
+ __classPrivateFieldGet(this, _AgentClient_apolloClient, "f")
319
328
  .subscribe({
320
329
  query: gql ` subscription {
321
330
  agentStatusChanged { ${AGENT_STATUS_FIELDS} }
@@ -325,18 +334,15 @@ export class AgentClient {
325
334
  .subscribe({
326
335
  next: (result) => {
327
336
  const agent = result.data.agentStatusChanged;
328
- this._agentStatusChangedCallbacks.forEach((cb) => {
337
+ __classPrivateFieldGet(this, _AgentClient_agentStatusChangedCallbacks, "f").forEach((cb) => {
329
338
  cb(agent);
330
339
  });
331
340
  },
332
- error: (e) => {
333
- if (!isSocketCloseError(e))
334
- console.error(e);
335
- },
341
+ error: (e) => console.error(e),
336
342
  });
337
343
  }
338
344
  async requestCapability(authInfo) {
339
- const { agentRequestCapability } = unwrapApolloResult(await this._apolloClient.mutate({
345
+ const { agentRequestCapability } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
340
346
  mutation: gql `
341
347
  mutation agentRequestCapability($authInfo: AuthInfoInput!) {
342
348
  agentRequestCapability(authInfo: $authInfo)
@@ -347,7 +353,7 @@ export class AgentClient {
347
353
  return agentRequestCapability;
348
354
  }
349
355
  async permitCapability(auth) {
350
- const { agentPermitCapability } = unwrapApolloResult(await this._apolloClient.mutate({
356
+ const { agentPermitCapability } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
351
357
  mutation: gql `
352
358
  mutation agentPermitCapability($auth: String!) {
353
359
  agentPermitCapability(auth: $auth)
@@ -358,7 +364,7 @@ export class AgentClient {
358
364
  return agentPermitCapability;
359
365
  }
360
366
  async generateJwt(requestId, rand) {
361
- const { agentGenerateJwt } = unwrapApolloResult(await this._apolloClient.mutate({
367
+ const { agentGenerateJwt } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
362
368
  mutation: gql `
363
369
  mutation agentGenerateJwt($requestId: String!, $rand: String!) {
364
370
  agentGenerateJwt(requestId: $requestId, rand: $rand)
@@ -369,7 +375,7 @@ export class AgentClient {
369
375
  return agentGenerateJwt;
370
376
  }
371
377
  async getApps() {
372
- const { agentGetApps } = unwrapApolloResult(await this._apolloClient.mutate({
378
+ const { agentGetApps } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
373
379
  mutation: gql `query agentGetApps {
374
380
  agentGetApps {
375
381
  ${Apps_FIELDS}
@@ -379,7 +385,7 @@ export class AgentClient {
379
385
  return agentGetApps;
380
386
  }
381
387
  async removeApp(requestId) {
382
- const { agentRemoveApp } = unwrapApolloResult(await this._apolloClient.mutate({
388
+ const { agentRemoveApp } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
383
389
  mutation: gql `mutation agentRemoveApp($requestId: String!) {
384
390
  agentRemoveApp(requestId: $requestId) {
385
391
  ${Apps_FIELDS}
@@ -390,7 +396,7 @@ export class AgentClient {
390
396
  return agentRemoveApp;
391
397
  }
392
398
  async revokeToken(requestId) {
393
- const { agentRevokeToken } = unwrapApolloResult(await this._apolloClient.mutate({
399
+ const { agentRevokeToken } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
394
400
  mutation: gql `mutation agentRevokeToken($requestId: String!) {
395
401
  agentRevokeToken(requestId: $requestId) {
396
402
  ${Apps_FIELDS}
@@ -401,7 +407,7 @@ export class AgentClient {
401
407
  return agentRevokeToken;
402
408
  }
403
409
  async isLocked() {
404
- const { agentIsLocked } = unwrapApolloResult(await this._apolloClient.mutate({
410
+ const { agentIsLocked } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
405
411
  mutation: gql `
406
412
  query agentIsLocked {
407
413
  agentIsLocked
@@ -411,7 +417,7 @@ export class AgentClient {
411
417
  return agentIsLocked;
412
418
  }
413
419
  async signMessage(message) {
414
- const { agentSignMessage } = unwrapApolloResult(await this._apolloClient.mutate({
420
+ const { agentSignMessage } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
415
421
  mutation: gql `mutation agentSignMessage($message: String!) {
416
422
  agentSignMessage(message: $message) {
417
423
  ${AGENT_SIGNATURE_FIELDS}
@@ -423,75 +429,49 @@ export class AgentClient {
423
429
  }
424
430
  // Multi-user methods
425
431
  async createUser(email, password, appInfo) {
426
- const { runtimeCreateUser } = unwrapApolloResult(await this._apolloClient.mutate({
427
- mutation: gql `
428
- mutation runtimeCreateUser(
429
- $email: String!
430
- $password: String!
431
- $appInfo: AuthInfoInput
432
- ) {
433
- runtimeCreateUser(
434
- email: $email
435
- password: $password
436
- appInfo: $appInfo
437
- ) {
438
- did
439
- success
440
- error
441
- }
432
+ const { runtimeCreateUser } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
433
+ mutation: gql `mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
434
+ runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
435
+ did
436
+ success
437
+ error
442
438
  }
443
- `,
439
+ }`,
444
440
  variables: { email, password, appInfo },
445
441
  }));
446
442
  return runtimeCreateUser;
447
443
  }
448
444
  async loginUser(email, password) {
449
- const { runtimeLoginUser } = unwrapApolloResult(await this._apolloClient.mutate({
450
- mutation: gql `
451
- mutation runtimeLoginUser($email: String!, $password: String!) {
452
- runtimeLoginUser(email: $email, password: $password)
453
- }
454
- `,
445
+ const { runtimeLoginUser } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
446
+ mutation: gql `mutation runtimeLoginUser($email: String!, $password: String!) {
447
+ runtimeLoginUser(email: $email, password: $password)
448
+ }`,
455
449
  variables: { email, password },
456
450
  }));
457
451
  return runtimeLoginUser;
458
452
  }
459
453
  async requestLoginVerification(email, appInfo) {
460
- const { runtimeRequestLoginVerification } = unwrapApolloResult(await this._apolloClient.mutate({
461
- mutation: gql `
462
- mutation runtimeRequestLoginVerification(
463
- $email: String!
464
- $appInfo: AuthInfoInput
465
- ) {
466
- runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
467
- success
468
- message
469
- requiresPassword
470
- isExistingUser
471
- }
454
+ const { runtimeRequestLoginVerification } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
455
+ mutation: gql `mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
456
+ runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
457
+ success
458
+ message
459
+ requiresPassword
460
+ isExistingUser
472
461
  }
473
- `,
462
+ }`,
474
463
  variables: { email, appInfo },
475
464
  }));
476
465
  return runtimeRequestLoginVerification;
477
466
  }
478
467
  async verifyEmailCode(email, code, verificationType) {
479
- const { runtimeVerifyEmailCode } = unwrapApolloResult(await this._apolloClient.mutate({
480
- mutation: gql `
481
- mutation runtimeVerifyEmailCode(
482
- $email: String!
483
- $code: String!
484
- $verificationType: String!
485
- ) {
486
- runtimeVerifyEmailCode(
487
- email: $email
488
- code: $code
489
- verificationType: $verificationType
490
- )
491
- }
492
- `,
468
+ const { runtimeVerifyEmailCode } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
469
+ mutation: gql `mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
470
+ runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
471
+ }`,
493
472
  variables: { email, code, verificationType },
494
473
  }));
495
474
  return runtimeVerifyEmailCode;
496
475
  }
497
476
  }
477
+ _AgentClient_apolloClient = new WeakMap(), _AgentClient_appsChangedCallback = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap();
@@ -2,8 +2,7 @@ import { ApolloClient } from "@apollo/client";
2
2
  import { AIModelLoadingStatus, AITask } from "./Tasks";
3
3
  import { ModelInput, Model, ModelType } from "./AIResolver";
4
4
  export declare class AIClient {
5
- private _apolloClient;
6
- private _transcriptionSubscriptions;
5
+ #private;
7
6
  constructor(apolloClient: ApolloClient<any>, subscribe?: boolean);
8
7
  getModels(): Promise<Model[]>;
9
8
  addModel(model: ModelInput): Promise<string>;