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