@coasys/ad4m 0.10.1-release-candidate-3-test-2 → 0.10.1-release-candidate-4-debug-strings

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.cjs CHANGED
@@ -5836,7 +5836,7 @@ class PerspectiveClient {
5836
5836
  }
5837
5837
  try {
5838
5838
  finalResult = JSON.parse(finalResult);
5839
- if (isInit) {
5839
+ if (isInit && typeof finalResult === 'object') {
5840
5840
  finalResult.isInit = true;
5841
5841
  }
5842
5842
  }
@@ -7188,6 +7188,36 @@ class RuntimeClient {
7188
7188
  }));
7189
7189
  return runtimeHcAgentInfos;
7190
7190
  }
7191
+ async getNetworkMetrics() {
7192
+ const { runtimeGetNetworkMetrics } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").query({
7193
+ query: gql `query runtimeGetNetworkMetrics {
7194
+ runtimeGetNetworkMetrics
7195
+ }`,
7196
+ }));
7197
+ return runtimeGetNetworkMetrics;
7198
+ }
7199
+ async debugStrings(neighbourhoodUrl) {
7200
+ const { runtimeDebugStrings } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").query({
7201
+ query: gql `query runtimeDebugStrings($neighbourhoodUrl: String) {
7202
+ runtimeDebugStrings(neighbourhoodUrl: $neighbourhoodUrl) {
7203
+ neighbourhoodUrl
7204
+ debugString
7205
+ operation
7206
+ timestamp
7207
+ }
7208
+ }`,
7209
+ variables: { neighbourhoodUrl }
7210
+ }));
7211
+ return runtimeDebugStrings;
7212
+ }
7213
+ async restartHolochain() {
7214
+ const { runtimeRestartHolochain } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
7215
+ mutation: gql `mutation runtimeRestartHolochain {
7216
+ runtimeRestartHolochain
7217
+ }`,
7218
+ }));
7219
+ return runtimeRestartHolochain;
7220
+ }
7191
7221
  async hcAddAgentInfos(agentInfos) {
7192
7222
  const { runtimeHcAddAgentInfos } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
7193
7223
  mutation: gql `mutation runtimeHcAddAgentInfos($agentInfos: String!) {
@@ -16353,6 +16383,13 @@ input CapabilityInput {
16353
16383
 
16354
16384
  scalar DateTime
16355
16385
 
16386
+ type DebugStringEntry {
16387
+ debugString: String!
16388
+ neighbourhoodUrl: String!
16389
+ operation: String!
16390
+ timestamp: String!
16391
+ }
16392
+
16356
16393
  type EntanglementProof {
16357
16394
  deviceKey: String!
16358
16395
  deviceKeySignedByDid: String!
@@ -16628,6 +16665,7 @@ type Mutation {
16628
16665
  runtimeRemoveKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
16629
16666
  runtimeRemoveNotification(id: String!): Boolean!
16630
16667
  runtimeRequestInstallNotification(notification: NotificationInput!): String!
16668
+ runtimeRestartHolochain: Boolean!
16631
16669
  runtimeSetStatus(status: PerspectiveInput!): Boolean!
16632
16670
  runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
16633
16671
  }
@@ -16728,8 +16766,10 @@ type Query {
16728
16766
  perspectiveQueryProlog(query: String!, uuid: String!): String!
16729
16767
  perspectiveSnapshot(uuid: String!): Perspective
16730
16768
  perspectives: [PerspectiveHandle!]!
16769
+ runtimeDebugStrings(neighbourhoodUrl: String): [DebugStringEntry!]!
16731
16770
  runtimeFriendStatus(did: String!): PerspectiveExpression
16732
16771
  runtimeFriends: [String!]!
16772
+ runtimeGetNetworkMetrics: String!
16733
16773
  runtimeHcAgentInfos: String!
16734
16774
  runtimeInfo: RuntimeInfo!
16735
16775
  runtimeKnownLinkLanguageTemplates: [String!]!
@@ -17016,6 +17056,27 @@ __decorate([
17016
17056
  exports.TriggeredNotification = __decorate([
17017
17057
  ObjectType()
17018
17058
  ], exports.TriggeredNotification);
17059
+ exports.DebugStringEntry = class DebugStringEntry {
17060
+ };
17061
+ __decorate([
17062
+ Field(),
17063
+ __metadata("design:type", String)
17064
+ ], exports.DebugStringEntry.prototype, "neighbourhoodUrl", void 0);
17065
+ __decorate([
17066
+ Field(),
17067
+ __metadata("design:type", String)
17068
+ ], exports.DebugStringEntry.prototype, "debugString", void 0);
17069
+ __decorate([
17070
+ Field(),
17071
+ __metadata("design:type", String)
17072
+ ], exports.DebugStringEntry.prototype, "operation", void 0);
17073
+ __decorate([
17074
+ Field(),
17075
+ __metadata("design:type", String)
17076
+ ], exports.DebugStringEntry.prototype, "timestamp", void 0);
17077
+ exports.DebugStringEntry = __decorate([
17078
+ ObjectType()
17079
+ ], exports.DebugStringEntry);
17019
17080
  exports.ImportStats = class ImportStats {
17020
17081
  };
17021
17082
  __decorate([
@@ -17122,6 +17183,10 @@ let RuntimeResolver = class RuntimeResolver {
17122
17183
  runtimeKnownLinkLanguageTemplates() {
17123
17184
  return ["Qm12345abcdef"];
17124
17185
  }
17186
+ runtimeDebugStrings(neighbourhoodUrl) {
17187
+ // Real implementation will be provided by the executor
17188
+ return [];
17189
+ }
17125
17190
  runtimeAddKnownLinkLanguageTemplates(addresses) {
17126
17191
  return addresses;
17127
17192
  }
@@ -17140,6 +17205,15 @@ let RuntimeResolver = class RuntimeResolver {
17140
17205
  runtimeHcAgentInfos() {
17141
17206
  return JSON.stringify([{ "agent": { "type": "Buffer", "data": [9, 191, 231, 58, 255, 107, 202, 55, 206, 57, 9, 103, 17, 34, 206, 195, 207, 114, 5, 73, 77, 198, 56, 136, 17, 227, 242, 231, 194, 135, 128, 48, 170, 189, 119, 186] }, "signature": { "type": "Buffer", "data": [195, 143, 170, 36, 234, 123, 255, 85, 188, 138, 124, 2, 91, 18, 53, 231, 44, 41, 240, 8, 80, 131, 100, 150, 165, 125, 146, 90, 17, 200, 190, 129, 114, 211, 11, 146, 150, 128, 198, 199, 79, 118, 157, 101, 194, 68, 58, 245, 98, 182, 79, 139, 140, 41, 143, 129, 8, 136, 87, 77, 180, 231, 218, 11] }, "agent_info": { "type": "Buffer", "data": [134, 165, 115, 112, 97, 99, 101, 196, 36, 203, 165, 212, 173, 24, 215, 165, 196, 25, 145, 248, 113, 246, 139, 205, 182, 241, 138, 57, 0, 26, 8, 217, 179, 23, 126, 59, 136, 128, 213, 110, 225, 173, 72, 197, 95, 165, 97, 103, 101, 110, 116, 196, 36, 9, 191, 231, 58, 255, 107, 202, 55, 206, 57, 9, 103, 17, 34, 206, 195, 207, 114, 5, 73, 77, 198, 56, 136, 17, 227, 242, 231, 194, 135, 128, 48, 170, 189, 119, 186, 164, 117, 114, 108, 115, 145, 217, 99, 107, 105, 116, 115, 117, 110, 101, 45, 112, 114, 111, 120, 121, 58, 47, 47, 101, 83, 52, 86, 112, 54, 109, 118, 80, 48, 122, 116, 85, 101, 104, 114, 117, 113, 89, 52, 102, 66, 53, 101, 69, 98, 121, 48, 69, 66, 100, 89, 84, 50, 95, 67, 48, 69, 112, 77, 111, 76, 111, 47, 107, 105, 116, 115, 117, 110, 101, 45, 113, 117, 105, 99, 47, 104, 47, 49, 57, 50, 46, 49, 54, 56, 46, 49, 55, 56, 46, 54, 48, 47, 112, 47, 55, 55, 52, 52, 47, 45, 45, 172, 115, 105, 103, 110, 101, 100, 95, 97, 116, 95, 109, 115, 207, 0, 0, 1, 123, 233, 104, 189, 50, 176, 101, 120, 112, 105, 114, 101, 115, 95, 97, 102, 116, 101, 114, 95, 109, 115, 206, 0, 18, 79, 128, 169, 109, 101, 116, 97, 95, 105, 110, 102, 111, 196, 34, 129, 187, 100, 104, 116, 95, 115, 116, 111, 114, 97, 103, 101, 95, 97, 114, 99, 95, 104, 97, 108, 102, 95, 108, 101, 110, 103, 116, 104, 206, 128, 0, 0, 1] } }, { "agent": { "type": "Buffer", "data": [98, 187, 145, 48, 115, 209, 94, 143, 31, 153, 102, 69, 138, 29, 133, 213, 34, 52, 39, 164, 157, 139, 178, 111, 23, 33, 118, 250, 28, 155, 78, 246, 128, 49, 179, 38] }, "signature": { "type": "Buffer", "data": [233, 192, 38, 3, 59, 248, 124, 231, 57, 255, 40, 154, 50, 60, 119, 252, 68, 198, 154, 109, 175, 155, 106, 217, 211, 155, 109, 223, 249, 91, 221, 210, 17, 132, 72, 230, 11, 230, 247, 119, 72, 244, 145, 91, 75, 7, 67, 5, 130, 151, 44, 231, 52, 220, 28, 154, 212, 82, 58, 90, 203, 211, 236, 4] }, "agent_info": { "type": "Buffer", "data": [134, 165, 115, 112, 97, 99, 101, 196, 36, 203, 165, 212, 173, 24, 215, 165, 196, 25, 145, 248, 113, 246, 139, 205, 182, 241, 138, 57, 0, 26, 8, 217, 179, 23, 126, 59, 136, 128, 213, 110, 225, 173, 72, 197, 95, 165, 97, 103, 101, 110, 116, 196, 36, 98, 187, 145, 48, 115, 209, 94, 143, 31, 153, 102, 69, 138, 29, 133, 213, 34, 52, 39, 164, 157, 139, 178, 111, 23, 33, 118, 250, 28, 155, 78, 246, 128, 49, 179, 38, 164, 117, 114, 108, 115, 145, 217, 99, 107, 105, 116, 115, 117, 110, 101, 45, 112, 114, 111, 120, 121, 58, 47, 47, 55, 101, 77, 106, 48, 73, 83, 72, 56, 56, 81, 56, 45, 89, 51, 74, 89, 70, 53, 76, 72, 57, 83, 54, 68, 119, 71, 73, 49, 88, 45, 115, 87, 53, 68, 104, 66, 87, 121, 71, 119, 78, 115, 47, 107, 105, 116, 115, 117, 110, 101, 45, 113, 117, 105, 99, 47, 104, 47, 49, 57, 50, 46, 49, 54, 56, 46, 49, 55, 56, 46, 54, 48, 47, 112, 47, 55, 55, 52, 52, 47, 45, 45, 172, 115, 105, 103, 110, 101, 100, 95, 97, 116, 95, 109, 115, 207, 0, 0, 1, 123, 233, 103, 45, 197, 176, 101, 120, 112, 105, 114, 101, 115, 95, 97, 102, 116, 101, 114, 95, 109, 115, 206, 0, 18, 79, 128, 169, 109, 101, 116, 97, 95, 105, 110, 102, 111, 196, 34, 129, 187, 100, 104, 116, 95, 115, 116, 111, 114, 97, 103, 101, 95, 97, 114, 99, 95, 104, 97, 108, 102, 95, 108, 101, 110, 103, 116, 104, 206, 128, 0, 0, 1] } }, { "agent": { "type": "Buffer", "data": [181, 101, 115, 45, 214, 127, 198, 153, 159, 184, 30, 87, 67, 224, 208, 184, 203, 176, 130, 158, 236, 127, 153, 125, 243, 183, 188, 167, 154, 25, 118, 254, 101, 145, 210, 109] }, "signature": { "type": "Buffer", "data": [88, 189, 229, 122, 44, 171, 194, 156, 90, 79, 148, 49, 207, 224, 34, 199, 219, 88, 24, 243, 103, 127, 123, 41, 87, 171, 127, 92, 6, 216, 198, 171, 26, 226, 237, 217, 122, 78, 98, 146, 55, 255, 68, 240, 202, 83, 58, 140, 147, 185, 3, 66, 15, 216, 210, 22, 99, 197, 73, 234, 120, 17, 74, 1] }, "agent_info": { "type": "Buffer", "data": [134, 165, 115, 112, 97, 99, 101, 196, 36, 203, 165, 212, 173, 24, 215, 165, 196, 25, 145, 248, 113, 246, 139, 205, 182, 241, 138, 57, 0, 26, 8, 217, 179, 23, 126, 59, 136, 128, 213, 110, 225, 173, 72, 197, 95, 165, 97, 103, 101, 110, 116, 196, 36, 181, 101, 115, 45, 214, 127, 198, 153, 159, 184, 30, 87, 67, 224, 208, 184, 203, 176, 130, 158, 236, 127, 153, 125, 243, 183, 188, 167, 154, 25, 118, 254, 101, 145, 210, 109, 164, 117, 114, 108, 115, 145, 217, 99, 107, 105, 116, 115, 117, 110, 101, 45, 112, 114, 111, 120, 121, 58, 47, 47, 114, 70, 71, 83, 100, 113, 104, 101, 68, 107, 70, 70, 56, 69, 102, 109, 45, 69, 116, 55, 119, 81, 101, 120, 83, 88, 55, 65, 112, 69, 51, 89, 86, 99, 45, 120, 102, 52, 104, 106, 77, 115, 77, 47, 107, 105, 116, 115, 117, 110, 101, 45, 113, 117, 105, 99, 47, 104, 47, 49, 57, 50, 46, 49, 54, 56, 46, 49, 55, 56, 46, 54, 48, 47, 112, 47, 55, 55, 52, 52, 47, 45, 45, 172, 115, 105, 103, 110, 101, 100, 95, 97, 116, 95, 109, 115, 207, 0, 0, 1, 123, 233, 113, 23, 220, 176, 101, 120, 112, 105, 114, 101, 115, 95, 97, 102, 116, 101, 114, 95, 109, 115, 206, 0, 18, 79, 128, 169, 109, 101, 116, 97, 95, 105, 110, 102, 111, 196, 34, 129, 187, 100, 104, 116, 95, 115, 116, 111, 114, 97, 103, 101, 95, 97, 114, 99, 95, 104, 97, 108, 102, 95, 108, 101, 110, 103, 116, 104, 206, 128, 0, 0, 1] } }, { "agent": { "type": "Buffer", "data": [3, 171, 237, 107, 186, 245, 165, 47, 237, 235, 211, 49, 245, 62, 113, 53, 255, 252, 223, 226, 75, 118, 148, 187, 23, 53, 70, 174, 160, 184, 64, 63, 94, 210, 227, 56] }, "signature": { "type": "Buffer", "data": [129, 12, 55, 104, 239, 121, 138, 2, 86, 106, 136, 51, 219, 79, 170, 8, 195, 69, 81, 188, 225, 192, 247, 196, 54, 39, 164, 110, 75, 39, 240, 56, 245, 189, 154, 77, 72, 11, 97, 250, 202, 149, 242, 97, 128, 28, 47, 164, 236, 104, 136, 82, 212, 246, 44, 143, 132, 119, 255, 135, 112, 11, 20, 13] }, "agent_info": { "type": "Buffer", "data": [134, 165, 115, 112, 97, 99, 101, 196, 36, 203, 165, 212, 173, 24, 215, 165, 196, 25, 145, 248, 113, 246, 139, 205, 182, 241, 138, 57, 0, 26, 8, 217, 179, 23, 126, 59, 136, 128, 213, 110, 225, 173, 72, 197, 95, 165, 97, 103, 101, 110, 116, 196, 36, 3, 171, 237, 107, 186, 245, 165, 47, 237, 235, 211, 49, 245, 62, 113, 53, 255, 252, 223, 226, 75, 118, 148, 187, 23, 53, 70, 174, 160, 184, 64, 63, 94, 210, 227, 56, 164, 117, 114, 108, 115, 145, 217, 97, 107, 105, 116, 115, 117, 110, 101, 45, 112, 114, 111, 120, 121, 58, 47, 47, 104, 121, 112, 115, 86, 121, 103, 117, 80, 84, 115, 53, 118, 73, 80, 65, 102, 97, 112, 90, 88, 113, 117, 84, 115, 79, 80, 100, 67, 81, 79, 79, 117, 103, 57, 51, 82, 103, 106, 95, 114, 85, 73, 47, 107, 105, 116, 115, 117, 110, 101, 45, 113, 117, 105, 99, 47, 104, 47, 49, 54, 53, 46, 50, 50, 46, 51, 50, 46, 49, 49, 47, 112, 47, 53, 55, 55, 57, 47, 45, 45, 172, 115, 105, 103, 110, 101, 100, 95, 97, 116, 95, 109, 115, 207, 0, 0, 1, 123, 233, 113, 188, 123, 176, 101, 120, 112, 105, 114, 101, 115, 95, 97, 102, 116, 101, 114, 95, 109, 115, 206, 0, 18, 79, 128, 169, 109, 101, 116, 97, 95, 105, 110, 102, 111, 196, 34, 129, 187, 100, 104, 116, 95, 115, 116, 111, 114, 97, 103, 101, 95, 97, 114, 99, 95, 104, 97, 108, 102, 95, 108, 101, 110, 103, 116, 104, 206, 128, 0, 0, 1] } }]);
17142
17207
  }
17208
+ runtimeGetNetworkMetrics() {
17209
+ return JSON.stringify({
17210
+ "metrics": {},
17211
+ "stats": {}
17212
+ });
17213
+ }
17214
+ runtimeRestartHolochain() {
17215
+ return true;
17216
+ }
17143
17217
  runtimeHcAddAgentInfos(agentInfos) {
17144
17218
  return true;
17145
17219
  }
@@ -17276,6 +17350,13 @@ __decorate([
17276
17350
  __metadata("design:paramtypes", []),
17277
17351
  __metadata("design:returntype", Array)
17278
17352
  ], RuntimeResolver.prototype, "runtimeKnownLinkLanguageTemplates", null);
17353
+ __decorate([
17354
+ Query(),
17355
+ __param(0, Arg()),
17356
+ __metadata("design:type", Function),
17357
+ __metadata("design:paramtypes", [String]),
17358
+ __metadata("design:returntype", Array)
17359
+ ], RuntimeResolver.prototype, "runtimeDebugStrings", null);
17279
17360
  __decorate([
17280
17361
  Mutation(),
17281
17362
  __param(0, Arg()),
@@ -17316,6 +17397,18 @@ __decorate([
17316
17397
  __metadata("design:paramtypes", []),
17317
17398
  __metadata("design:returntype", String)
17318
17399
  ], RuntimeResolver.prototype, "runtimeHcAgentInfos", null);
17400
+ __decorate([
17401
+ Query(),
17402
+ __metadata("design:type", Function),
17403
+ __metadata("design:paramtypes", []),
17404
+ __metadata("design:returntype", String)
17405
+ ], RuntimeResolver.prototype, "runtimeGetNetworkMetrics", null);
17406
+ __decorate([
17407
+ Mutation(),
17408
+ __metadata("design:type", Function),
17409
+ __metadata("design:paramtypes", []),
17410
+ __metadata("design:returntype", Boolean)
17411
+ ], RuntimeResolver.prototype, "runtimeRestartHolochain", null);
17319
17412
  __decorate([
17320
17413
  Mutation(),
17321
17414
  __param(0, Arg()),
@@ -18044,6 +18137,11 @@ class Ad4mModel {
18044
18137
  async save(batchId) {
18045
18138
  // We use createSubject's initialValues to set properties (but not collections)
18046
18139
  // We then later use innerUpdate to set collections
18140
+ let batchCreatedHere = false;
18141
+ if (!batchId) {
18142
+ batchId = await this.perspective.createBatch();
18143
+ batchCreatedHere = true;
18144
+ }
18047
18145
  // First filter out the properties that are not collections (arrays)
18048
18146
  const initialValues = {};
18049
18147
  for (const [key, value] of Object.entries(this)) {
@@ -18057,12 +18155,13 @@ class Ad4mModel {
18057
18155
  await __classPrivateFieldGet(this, _Ad4mModel_perspective, "f").add(new exports.Link({ source: __classPrivateFieldGet(this, _Ad4mModel_source, "f"), predicate: "ad4m://has_child", target: this.baseExpression }), 'shared', batchId);
18058
18156
  // Set collections
18059
18157
  await this.innerUpdate(false, batchId);
18060
- // If we're in batch mode, we don't need to do anything else
18061
- // since the instance won't exist until batch commit
18062
- if (batchId) {
18063
- return;
18158
+ // If we got a batchId passed in, we let the caller decide when to commit.
18159
+ // But then we can call getData() since the instance won't exist in the perspective
18160
+ // until the bacht is committedl
18161
+ if (batchCreatedHere) {
18162
+ await this.perspective.commitBatch(batchId);
18163
+ await this.getData();
18064
18164
  }
18065
- await this.getData();
18066
18165
  }
18067
18166
  cleanCopy() {
18068
18167
  const cleanCopy = {};
package/lib/index.js CHANGED
@@ -5832,7 +5832,7 @@ class PerspectiveClient {
5832
5832
  }
5833
5833
  try {
5834
5834
  finalResult = JSON.parse(finalResult);
5835
- if (isInit) {
5835
+ if (isInit && typeof finalResult === 'object') {
5836
5836
  finalResult.isInit = true;
5837
5837
  }
5838
5838
  }
@@ -7184,6 +7184,36 @@ class RuntimeClient {
7184
7184
  }));
7185
7185
  return runtimeHcAgentInfos;
7186
7186
  }
7187
+ async getNetworkMetrics() {
7188
+ const { runtimeGetNetworkMetrics } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").query({
7189
+ query: gql `query runtimeGetNetworkMetrics {
7190
+ runtimeGetNetworkMetrics
7191
+ }`,
7192
+ }));
7193
+ return runtimeGetNetworkMetrics;
7194
+ }
7195
+ async debugStrings(neighbourhoodUrl) {
7196
+ const { runtimeDebugStrings } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").query({
7197
+ query: gql `query runtimeDebugStrings($neighbourhoodUrl: String) {
7198
+ runtimeDebugStrings(neighbourhoodUrl: $neighbourhoodUrl) {
7199
+ neighbourhoodUrl
7200
+ debugString
7201
+ operation
7202
+ timestamp
7203
+ }
7204
+ }`,
7205
+ variables: { neighbourhoodUrl }
7206
+ }));
7207
+ return runtimeDebugStrings;
7208
+ }
7209
+ async restartHolochain() {
7210
+ const { runtimeRestartHolochain } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
7211
+ mutation: gql `mutation runtimeRestartHolochain {
7212
+ runtimeRestartHolochain
7213
+ }`,
7214
+ }));
7215
+ return runtimeRestartHolochain;
7216
+ }
7187
7217
  async hcAddAgentInfos(agentInfos) {
7188
7218
  const { runtimeHcAddAgentInfos } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
7189
7219
  mutation: gql `mutation runtimeHcAddAgentInfos($agentInfos: String!) {
@@ -16349,6 +16379,13 @@ input CapabilityInput {
16349
16379
 
16350
16380
  scalar DateTime
16351
16381
 
16382
+ type DebugStringEntry {
16383
+ debugString: String!
16384
+ neighbourhoodUrl: String!
16385
+ operation: String!
16386
+ timestamp: String!
16387
+ }
16388
+
16352
16389
  type EntanglementProof {
16353
16390
  deviceKey: String!
16354
16391
  deviceKeySignedByDid: String!
@@ -16624,6 +16661,7 @@ type Mutation {
16624
16661
  runtimeRemoveKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
16625
16662
  runtimeRemoveNotification(id: String!): Boolean!
16626
16663
  runtimeRequestInstallNotification(notification: NotificationInput!): String!
16664
+ runtimeRestartHolochain: Boolean!
16627
16665
  runtimeSetStatus(status: PerspectiveInput!): Boolean!
16628
16666
  runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
16629
16667
  }
@@ -16724,8 +16762,10 @@ type Query {
16724
16762
  perspectiveQueryProlog(query: String!, uuid: String!): String!
16725
16763
  perspectiveSnapshot(uuid: String!): Perspective
16726
16764
  perspectives: [PerspectiveHandle!]!
16765
+ runtimeDebugStrings(neighbourhoodUrl: String): [DebugStringEntry!]!
16727
16766
  runtimeFriendStatus(did: String!): PerspectiveExpression
16728
16767
  runtimeFriends: [String!]!
16768
+ runtimeGetNetworkMetrics: String!
16729
16769
  runtimeHcAgentInfos: String!
16730
16770
  runtimeInfo: RuntimeInfo!
16731
16771
  runtimeKnownLinkLanguageTemplates: [String!]!
@@ -17012,6 +17052,27 @@ __decorate([
17012
17052
  TriggeredNotification = __decorate([
17013
17053
  ObjectType()
17014
17054
  ], TriggeredNotification);
17055
+ let DebugStringEntry = class DebugStringEntry {
17056
+ };
17057
+ __decorate([
17058
+ Field(),
17059
+ __metadata("design:type", String)
17060
+ ], DebugStringEntry.prototype, "neighbourhoodUrl", void 0);
17061
+ __decorate([
17062
+ Field(),
17063
+ __metadata("design:type", String)
17064
+ ], DebugStringEntry.prototype, "debugString", void 0);
17065
+ __decorate([
17066
+ Field(),
17067
+ __metadata("design:type", String)
17068
+ ], DebugStringEntry.prototype, "operation", void 0);
17069
+ __decorate([
17070
+ Field(),
17071
+ __metadata("design:type", String)
17072
+ ], DebugStringEntry.prototype, "timestamp", void 0);
17073
+ DebugStringEntry = __decorate([
17074
+ ObjectType()
17075
+ ], DebugStringEntry);
17015
17076
  let ImportStats = class ImportStats {
17016
17077
  };
17017
17078
  __decorate([
@@ -17118,6 +17179,10 @@ let RuntimeResolver = class RuntimeResolver {
17118
17179
  runtimeKnownLinkLanguageTemplates() {
17119
17180
  return ["Qm12345abcdef"];
17120
17181
  }
17182
+ runtimeDebugStrings(neighbourhoodUrl) {
17183
+ // Real implementation will be provided by the executor
17184
+ return [];
17185
+ }
17121
17186
  runtimeAddKnownLinkLanguageTemplates(addresses) {
17122
17187
  return addresses;
17123
17188
  }
@@ -17136,6 +17201,15 @@ let RuntimeResolver = class RuntimeResolver {
17136
17201
  runtimeHcAgentInfos() {
17137
17202
  return JSON.stringify([{ "agent": { "type": "Buffer", "data": [9, 191, 231, 58, 255, 107, 202, 55, 206, 57, 9, 103, 17, 34, 206, 195, 207, 114, 5, 73, 77, 198, 56, 136, 17, 227, 242, 231, 194, 135, 128, 48, 170, 189, 119, 186] }, "signature": { "type": "Buffer", "data": [195, 143, 170, 36, 234, 123, 255, 85, 188, 138, 124, 2, 91, 18, 53, 231, 44, 41, 240, 8, 80, 131, 100, 150, 165, 125, 146, 90, 17, 200, 190, 129, 114, 211, 11, 146, 150, 128, 198, 199, 79, 118, 157, 101, 194, 68, 58, 245, 98, 182, 79, 139, 140, 41, 143, 129, 8, 136, 87, 77, 180, 231, 218, 11] }, "agent_info": { "type": "Buffer", "data": [134, 165, 115, 112, 97, 99, 101, 196, 36, 203, 165, 212, 173, 24, 215, 165, 196, 25, 145, 248, 113, 246, 139, 205, 182, 241, 138, 57, 0, 26, 8, 217, 179, 23, 126, 59, 136, 128, 213, 110, 225, 173, 72, 197, 95, 165, 97, 103, 101, 110, 116, 196, 36, 9, 191, 231, 58, 255, 107, 202, 55, 206, 57, 9, 103, 17, 34, 206, 195, 207, 114, 5, 73, 77, 198, 56, 136, 17, 227, 242, 231, 194, 135, 128, 48, 170, 189, 119, 186, 164, 117, 114, 108, 115, 145, 217, 99, 107, 105, 116, 115, 117, 110, 101, 45, 112, 114, 111, 120, 121, 58, 47, 47, 101, 83, 52, 86, 112, 54, 109, 118, 80, 48, 122, 116, 85, 101, 104, 114, 117, 113, 89, 52, 102, 66, 53, 101, 69, 98, 121, 48, 69, 66, 100, 89, 84, 50, 95, 67, 48, 69, 112, 77, 111, 76, 111, 47, 107, 105, 116, 115, 117, 110, 101, 45, 113, 117, 105, 99, 47, 104, 47, 49, 57, 50, 46, 49, 54, 56, 46, 49, 55, 56, 46, 54, 48, 47, 112, 47, 55, 55, 52, 52, 47, 45, 45, 172, 115, 105, 103, 110, 101, 100, 95, 97, 116, 95, 109, 115, 207, 0, 0, 1, 123, 233, 104, 189, 50, 176, 101, 120, 112, 105, 114, 101, 115, 95, 97, 102, 116, 101, 114, 95, 109, 115, 206, 0, 18, 79, 128, 169, 109, 101, 116, 97, 95, 105, 110, 102, 111, 196, 34, 129, 187, 100, 104, 116, 95, 115, 116, 111, 114, 97, 103, 101, 95, 97, 114, 99, 95, 104, 97, 108, 102, 95, 108, 101, 110, 103, 116, 104, 206, 128, 0, 0, 1] } }, { "agent": { "type": "Buffer", "data": [98, 187, 145, 48, 115, 209, 94, 143, 31, 153, 102, 69, 138, 29, 133, 213, 34, 52, 39, 164, 157, 139, 178, 111, 23, 33, 118, 250, 28, 155, 78, 246, 128, 49, 179, 38] }, "signature": { "type": "Buffer", "data": [233, 192, 38, 3, 59, 248, 124, 231, 57, 255, 40, 154, 50, 60, 119, 252, 68, 198, 154, 109, 175, 155, 106, 217, 211, 155, 109, 223, 249, 91, 221, 210, 17, 132, 72, 230, 11, 230, 247, 119, 72, 244, 145, 91, 75, 7, 67, 5, 130, 151, 44, 231, 52, 220, 28, 154, 212, 82, 58, 90, 203, 211, 236, 4] }, "agent_info": { "type": "Buffer", "data": [134, 165, 115, 112, 97, 99, 101, 196, 36, 203, 165, 212, 173, 24, 215, 165, 196, 25, 145, 248, 113, 246, 139, 205, 182, 241, 138, 57, 0, 26, 8, 217, 179, 23, 126, 59, 136, 128, 213, 110, 225, 173, 72, 197, 95, 165, 97, 103, 101, 110, 116, 196, 36, 98, 187, 145, 48, 115, 209, 94, 143, 31, 153, 102, 69, 138, 29, 133, 213, 34, 52, 39, 164, 157, 139, 178, 111, 23, 33, 118, 250, 28, 155, 78, 246, 128, 49, 179, 38, 164, 117, 114, 108, 115, 145, 217, 99, 107, 105, 116, 115, 117, 110, 101, 45, 112, 114, 111, 120, 121, 58, 47, 47, 55, 101, 77, 106, 48, 73, 83, 72, 56, 56, 81, 56, 45, 89, 51, 74, 89, 70, 53, 76, 72, 57, 83, 54, 68, 119, 71, 73, 49, 88, 45, 115, 87, 53, 68, 104, 66, 87, 121, 71, 119, 78, 115, 47, 107, 105, 116, 115, 117, 110, 101, 45, 113, 117, 105, 99, 47, 104, 47, 49, 57, 50, 46, 49, 54, 56, 46, 49, 55, 56, 46, 54, 48, 47, 112, 47, 55, 55, 52, 52, 47, 45, 45, 172, 115, 105, 103, 110, 101, 100, 95, 97, 116, 95, 109, 115, 207, 0, 0, 1, 123, 233, 103, 45, 197, 176, 101, 120, 112, 105, 114, 101, 115, 95, 97, 102, 116, 101, 114, 95, 109, 115, 206, 0, 18, 79, 128, 169, 109, 101, 116, 97, 95, 105, 110, 102, 111, 196, 34, 129, 187, 100, 104, 116, 95, 115, 116, 111, 114, 97, 103, 101, 95, 97, 114, 99, 95, 104, 97, 108, 102, 95, 108, 101, 110, 103, 116, 104, 206, 128, 0, 0, 1] } }, { "agent": { "type": "Buffer", "data": [181, 101, 115, 45, 214, 127, 198, 153, 159, 184, 30, 87, 67, 224, 208, 184, 203, 176, 130, 158, 236, 127, 153, 125, 243, 183, 188, 167, 154, 25, 118, 254, 101, 145, 210, 109] }, "signature": { "type": "Buffer", "data": [88, 189, 229, 122, 44, 171, 194, 156, 90, 79, 148, 49, 207, 224, 34, 199, 219, 88, 24, 243, 103, 127, 123, 41, 87, 171, 127, 92, 6, 216, 198, 171, 26, 226, 237, 217, 122, 78, 98, 146, 55, 255, 68, 240, 202, 83, 58, 140, 147, 185, 3, 66, 15, 216, 210, 22, 99, 197, 73, 234, 120, 17, 74, 1] }, "agent_info": { "type": "Buffer", "data": [134, 165, 115, 112, 97, 99, 101, 196, 36, 203, 165, 212, 173, 24, 215, 165, 196, 25, 145, 248, 113, 246, 139, 205, 182, 241, 138, 57, 0, 26, 8, 217, 179, 23, 126, 59, 136, 128, 213, 110, 225, 173, 72, 197, 95, 165, 97, 103, 101, 110, 116, 196, 36, 181, 101, 115, 45, 214, 127, 198, 153, 159, 184, 30, 87, 67, 224, 208, 184, 203, 176, 130, 158, 236, 127, 153, 125, 243, 183, 188, 167, 154, 25, 118, 254, 101, 145, 210, 109, 164, 117, 114, 108, 115, 145, 217, 99, 107, 105, 116, 115, 117, 110, 101, 45, 112, 114, 111, 120, 121, 58, 47, 47, 114, 70, 71, 83, 100, 113, 104, 101, 68, 107, 70, 70, 56, 69, 102, 109, 45, 69, 116, 55, 119, 81, 101, 120, 83, 88, 55, 65, 112, 69, 51, 89, 86, 99, 45, 120, 102, 52, 104, 106, 77, 115, 77, 47, 107, 105, 116, 115, 117, 110, 101, 45, 113, 117, 105, 99, 47, 104, 47, 49, 57, 50, 46, 49, 54, 56, 46, 49, 55, 56, 46, 54, 48, 47, 112, 47, 55, 55, 52, 52, 47, 45, 45, 172, 115, 105, 103, 110, 101, 100, 95, 97, 116, 95, 109, 115, 207, 0, 0, 1, 123, 233, 113, 23, 220, 176, 101, 120, 112, 105, 114, 101, 115, 95, 97, 102, 116, 101, 114, 95, 109, 115, 206, 0, 18, 79, 128, 169, 109, 101, 116, 97, 95, 105, 110, 102, 111, 196, 34, 129, 187, 100, 104, 116, 95, 115, 116, 111, 114, 97, 103, 101, 95, 97, 114, 99, 95, 104, 97, 108, 102, 95, 108, 101, 110, 103, 116, 104, 206, 128, 0, 0, 1] } }, { "agent": { "type": "Buffer", "data": [3, 171, 237, 107, 186, 245, 165, 47, 237, 235, 211, 49, 245, 62, 113, 53, 255, 252, 223, 226, 75, 118, 148, 187, 23, 53, 70, 174, 160, 184, 64, 63, 94, 210, 227, 56] }, "signature": { "type": "Buffer", "data": [129, 12, 55, 104, 239, 121, 138, 2, 86, 106, 136, 51, 219, 79, 170, 8, 195, 69, 81, 188, 225, 192, 247, 196, 54, 39, 164, 110, 75, 39, 240, 56, 245, 189, 154, 77, 72, 11, 97, 250, 202, 149, 242, 97, 128, 28, 47, 164, 236, 104, 136, 82, 212, 246, 44, 143, 132, 119, 255, 135, 112, 11, 20, 13] }, "agent_info": { "type": "Buffer", "data": [134, 165, 115, 112, 97, 99, 101, 196, 36, 203, 165, 212, 173, 24, 215, 165, 196, 25, 145, 248, 113, 246, 139, 205, 182, 241, 138, 57, 0, 26, 8, 217, 179, 23, 126, 59, 136, 128, 213, 110, 225, 173, 72, 197, 95, 165, 97, 103, 101, 110, 116, 196, 36, 3, 171, 237, 107, 186, 245, 165, 47, 237, 235, 211, 49, 245, 62, 113, 53, 255, 252, 223, 226, 75, 118, 148, 187, 23, 53, 70, 174, 160, 184, 64, 63, 94, 210, 227, 56, 164, 117, 114, 108, 115, 145, 217, 97, 107, 105, 116, 115, 117, 110, 101, 45, 112, 114, 111, 120, 121, 58, 47, 47, 104, 121, 112, 115, 86, 121, 103, 117, 80, 84, 115, 53, 118, 73, 80, 65, 102, 97, 112, 90, 88, 113, 117, 84, 115, 79, 80, 100, 67, 81, 79, 79, 117, 103, 57, 51, 82, 103, 106, 95, 114, 85, 73, 47, 107, 105, 116, 115, 117, 110, 101, 45, 113, 117, 105, 99, 47, 104, 47, 49, 54, 53, 46, 50, 50, 46, 51, 50, 46, 49, 49, 47, 112, 47, 53, 55, 55, 57, 47, 45, 45, 172, 115, 105, 103, 110, 101, 100, 95, 97, 116, 95, 109, 115, 207, 0, 0, 1, 123, 233, 113, 188, 123, 176, 101, 120, 112, 105, 114, 101, 115, 95, 97, 102, 116, 101, 114, 95, 109, 115, 206, 0, 18, 79, 128, 169, 109, 101, 116, 97, 95, 105, 110, 102, 111, 196, 34, 129, 187, 100, 104, 116, 95, 115, 116, 111, 114, 97, 103, 101, 95, 97, 114, 99, 95, 104, 97, 108, 102, 95, 108, 101, 110, 103, 116, 104, 206, 128, 0, 0, 1] } }]);
17138
17203
  }
17204
+ runtimeGetNetworkMetrics() {
17205
+ return JSON.stringify({
17206
+ "metrics": {},
17207
+ "stats": {}
17208
+ });
17209
+ }
17210
+ runtimeRestartHolochain() {
17211
+ return true;
17212
+ }
17139
17213
  runtimeHcAddAgentInfos(agentInfos) {
17140
17214
  return true;
17141
17215
  }
@@ -17272,6 +17346,13 @@ __decorate([
17272
17346
  __metadata("design:paramtypes", []),
17273
17347
  __metadata("design:returntype", Array)
17274
17348
  ], RuntimeResolver.prototype, "runtimeKnownLinkLanguageTemplates", null);
17349
+ __decorate([
17350
+ Query(),
17351
+ __param(0, Arg()),
17352
+ __metadata("design:type", Function),
17353
+ __metadata("design:paramtypes", [String]),
17354
+ __metadata("design:returntype", Array)
17355
+ ], RuntimeResolver.prototype, "runtimeDebugStrings", null);
17275
17356
  __decorate([
17276
17357
  Mutation(),
17277
17358
  __param(0, Arg()),
@@ -17312,6 +17393,18 @@ __decorate([
17312
17393
  __metadata("design:paramtypes", []),
17313
17394
  __metadata("design:returntype", String)
17314
17395
  ], RuntimeResolver.prototype, "runtimeHcAgentInfos", null);
17396
+ __decorate([
17397
+ Query(),
17398
+ __metadata("design:type", Function),
17399
+ __metadata("design:paramtypes", []),
17400
+ __metadata("design:returntype", String)
17401
+ ], RuntimeResolver.prototype, "runtimeGetNetworkMetrics", null);
17402
+ __decorate([
17403
+ Mutation(),
17404
+ __metadata("design:type", Function),
17405
+ __metadata("design:paramtypes", []),
17406
+ __metadata("design:returntype", Boolean)
17407
+ ], RuntimeResolver.prototype, "runtimeRestartHolochain", null);
17315
17408
  __decorate([
17316
17409
  Mutation(),
17317
17410
  __param(0, Arg()),
@@ -18040,6 +18133,11 @@ class Ad4mModel {
18040
18133
  async save(batchId) {
18041
18134
  // We use createSubject's initialValues to set properties (but not collections)
18042
18135
  // We then later use innerUpdate to set collections
18136
+ let batchCreatedHere = false;
18137
+ if (!batchId) {
18138
+ batchId = await this.perspective.createBatch();
18139
+ batchCreatedHere = true;
18140
+ }
18043
18141
  // First filter out the properties that are not collections (arrays)
18044
18142
  const initialValues = {};
18045
18143
  for (const [key, value] of Object.entries(this)) {
@@ -18053,12 +18151,13 @@ class Ad4mModel {
18053
18151
  await __classPrivateFieldGet(this, _Ad4mModel_perspective, "f").add(new Link({ source: __classPrivateFieldGet(this, _Ad4mModel_source, "f"), predicate: "ad4m://has_child", target: this.baseExpression }), 'shared', batchId);
18054
18152
  // Set collections
18055
18153
  await this.innerUpdate(false, batchId);
18056
- // If we're in batch mode, we don't need to do anything else
18057
- // since the instance won't exist until batch commit
18058
- if (batchId) {
18059
- return;
18154
+ // If we got a batchId passed in, we let the caller decide when to commit.
18155
+ // But then we can call getData() since the instance won't exist in the perspective
18156
+ // until the bacht is committedl
18157
+ if (batchCreatedHere) {
18158
+ await this.perspective.commitBatch(batchId);
18159
+ await this.getData();
18060
18160
  }
18061
- await this.getData();
18062
18161
  }
18063
18162
  cleanCopy() {
18064
18163
  const cleanCopy = {};
@@ -18533,4 +18632,4 @@ class ModelQueryBuilder {
18533
18632
  }
18534
18633
  }
18535
18634
 
18536
- export { AIClient, AIModelLoadingStatus, AIPromptExamples, AIPromptExamplesInput, AITask, AITaskInput, Ad4mClient, Ad4mModel, Agent, AgentClient, AgentExpression, AgentSignature, AgentStatus, Apps, AuthInfo, AuthInfoInput, Capability, CapabilityInput, Collection, Dna, EntanglementProof, EntanglementProofInput, ExceptionInfo, ExceptionType, Expression, ExpressionGeneric, ExpressionGenericInput, ExpressionProof, ExpressionProofInput, ExpressionRef, ExpressionRendered, Flag, Icon, ImportResult, ImportStats, InstanceQuery, InteractionCall, InteractionMeta, InteractionParameter, LanguageExpression, LanguageHandle, LanguageLanguageInput, LanguageMeta, LanguageMetaInput, LanguageMetaInternal, LanguageRef, Link, LinkExpression, LinkExpressionInput, LinkExpressionMutations, LinkExpressionUpdated, LinkInput, LinkMutations, LinkQuery, Literal, ModelOptions, ModelQueryBuilder, Neighbourhood, NeighbourhoodExpression, NeighbourhoodProxy, Notification, NotificationInput, OnlineAgent, Optional, Perspective, PerspectiveAction, PerspectiveDiff, PerspectiveDiffExpression, PerspectiveExpression, PerspectiveHandle, PerspectiveInput, PerspectiveProxy, PerspectiveState, PerspectiveUnsignedInput, Property, QuerySubscriptionProxy, ReadOnly, Resource, ResourceInput, RuntimeInfo, SMART_LITERAL_CONTENT_PREDICATE, SentMessage, SmartLiteral, Subject, TriggeredNotification, addLink, capSentence, exprRef2String, formatList, hasLink, isExpression, isLink, linkEqual, makeRandomPrologAtom, parseExprUrl, typeDefsString };
18635
+ export { AIClient, AIModelLoadingStatus, AIPromptExamples, AIPromptExamplesInput, AITask, AITaskInput, Ad4mClient, Ad4mModel, Agent, AgentClient, AgentExpression, AgentSignature, AgentStatus, Apps, AuthInfo, AuthInfoInput, Capability, CapabilityInput, Collection, DebugStringEntry, Dna, EntanglementProof, EntanglementProofInput, ExceptionInfo, ExceptionType, Expression, ExpressionGeneric, ExpressionGenericInput, ExpressionProof, ExpressionProofInput, ExpressionRef, ExpressionRendered, Flag, Icon, ImportResult, ImportStats, InstanceQuery, InteractionCall, InteractionMeta, InteractionParameter, LanguageExpression, LanguageHandle, LanguageLanguageInput, LanguageMeta, LanguageMetaInput, LanguageMetaInternal, LanguageRef, Link, LinkExpression, LinkExpressionInput, LinkExpressionMutations, LinkExpressionUpdated, LinkInput, LinkMutations, LinkQuery, Literal, ModelOptions, ModelQueryBuilder, Neighbourhood, NeighbourhoodExpression, NeighbourhoodProxy, Notification, NotificationInput, OnlineAgent, Optional, Perspective, PerspectiveAction, PerspectiveDiff, PerspectiveDiffExpression, PerspectiveExpression, PerspectiveHandle, PerspectiveInput, PerspectiveProxy, PerspectiveState, PerspectiveUnsignedInput, Property, QuerySubscriptionProxy, ReadOnly, Resource, ResourceInput, RuntimeInfo, SMART_LITERAL_CONTENT_PREDICATE, SentMessage, SmartLiteral, Subject, TriggeredNotification, addLink, capSentence, exprRef2String, formatList, hasLink, isExpression, isLink, linkEqual, makeRandomPrologAtom, parseExprUrl, typeDefsString };
@@ -118,6 +118,7 @@ export interface GetAllAdapter {
118
118
  }
119
119
  export type PerspectiveDiffObserver = (diff: PerspectiveDiff) => void;
120
120
  export type SyncStateChangeObserver = (state: PerspectiveState) => void;
121
+ export type DebugStringObserver = (debugString: string, operation: string) => void;
121
122
  /** Interface for "Link Languages" that facilitate the synchronization
122
123
  * between agents' local Perspectives inside a Neighbourhood.
123
124
  * The assumption is that every version of the shared Perspective
@@ -148,6 +149,8 @@ export interface LinkSyncAdapter {
148
149
  addCallback(callback: PerspectiveDiffObserver): any;
149
150
  /** Add a sync state callback method */
150
151
  addSyncStateChangeCallback(callback: SyncStateChangeObserver): any;
152
+ /** Add a debug string callback method for capturing internal debug information */
153
+ addDebugStringCallback?(callback: DebugStringObserver): any;
151
154
  }
152
155
  export type MessageCallback = (message: PerspectiveExpression) => void;
153
156
  export type StatusCallback = (caller: DID) => Perspective;
@@ -591,6 +591,11 @@ export class Ad4mModel {
591
591
  async save(batchId) {
592
592
  // We use createSubject's initialValues to set properties (but not collections)
593
593
  // We then later use innerUpdate to set collections
594
+ let batchCreatedHere = false;
595
+ if (!batchId) {
596
+ batchId = await this.perspective.createBatch();
597
+ batchCreatedHere = true;
598
+ }
594
599
  // First filter out the properties that are not collections (arrays)
595
600
  const initialValues = {};
596
601
  for (const [key, value] of Object.entries(this)) {
@@ -604,12 +609,13 @@ export class Ad4mModel {
604
609
  await __classPrivateFieldGet(this, _Ad4mModel_perspective, "f").add(new Link({ source: __classPrivateFieldGet(this, _Ad4mModel_source, "f"), predicate: "ad4m://has_child", target: this.baseExpression }), 'shared', batchId);
605
610
  // Set collections
606
611
  await this.innerUpdate(false, batchId);
607
- // If we're in batch mode, we don't need to do anything else
608
- // since the instance won't exist until batch commit
609
- if (batchId) {
610
- return;
612
+ // If we got a batchId passed in, we let the caller decide when to commit.
613
+ // But then we can call getData() since the instance won't exist in the perspective
614
+ // until the bacht is committedl
615
+ if (batchCreatedHere) {
616
+ await this.perspective.commitBatch(batchId);
617
+ await this.getData();
611
618
  }
612
- await this.getData();
613
619
  }
614
620
  cleanCopy() {
615
621
  const cleanCopy = {};
@@ -184,7 +184,7 @@ export class PerspectiveClient {
184
184
  }
185
185
  try {
186
186
  finalResult = JSON.parse(finalResult);
187
- if (isInit) {
187
+ if (isInit && typeof finalResult === 'object') {
188
188
  finalResult.isInit = true;
189
189
  }
190
190
  }
@@ -21,6 +21,9 @@ export declare class RuntimeClient {
21
21
  removeFriends(dids: string[]): Promise<string[]>;
22
22
  friends(): Promise<string[]>;
23
23
  hcAgentInfos(): Promise<String>;
24
+ getNetworkMetrics(): Promise<String>;
25
+ debugStrings(neighbourhoodUrl?: string): Promise<any[]>;
26
+ restartHolochain(): Promise<Boolean>;
24
27
  hcAddAgentInfos(agentInfos: String): Promise<void>;
25
28
  verifyStringSignedByDid(did: string, didSigningKeyId: string, data: string, signedData: string): Promise<boolean>;
26
29
  setStatus(perspective: Perspective): Promise<boolean>;
@@ -175,6 +175,36 @@ export class RuntimeClient {
175
175
  }));
176
176
  return runtimeHcAgentInfos;
177
177
  }
178
+ async getNetworkMetrics() {
179
+ const { runtimeGetNetworkMetrics } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
180
+ query: gql `query runtimeGetNetworkMetrics {
181
+ runtimeGetNetworkMetrics
182
+ }`,
183
+ }));
184
+ return runtimeGetNetworkMetrics;
185
+ }
186
+ async debugStrings(neighbourhoodUrl) {
187
+ const { runtimeDebugStrings } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
188
+ query: gql `query runtimeDebugStrings($neighbourhoodUrl: String) {
189
+ runtimeDebugStrings(neighbourhoodUrl: $neighbourhoodUrl) {
190
+ neighbourhoodUrl
191
+ debugString
192
+ operation
193
+ timestamp
194
+ }
195
+ }`,
196
+ variables: { neighbourhoodUrl }
197
+ }));
198
+ return runtimeDebugStrings;
199
+ }
200
+ async restartHolochain() {
201
+ const { runtimeRestartHolochain } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
202
+ mutation: gql `mutation runtimeRestartHolochain {
203
+ runtimeRestartHolochain
204
+ }`,
205
+ }));
206
+ return runtimeRestartHolochain;
207
+ }
178
208
  async hcAddAgentInfos(agentInfos) {
179
209
  const { runtimeHcAddAgentInfos } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
180
210
  mutation: gql `mutation runtimeHcAddAgentInfos($agentInfos: String!) {
@@ -42,6 +42,12 @@ export declare class TriggeredNotification {
42
42
  perspectiveId: string;
43
43
  triggerMatch: string;
44
44
  }
45
+ export declare class DebugStringEntry {
46
+ neighbourhoodUrl: string;
47
+ debugString: string;
48
+ operation: string;
49
+ timestamp: string;
50
+ }
45
51
  export declare class ImportStats {
46
52
  total: number;
47
53
  imported: number;
@@ -76,12 +82,15 @@ export default class RuntimeResolver {
76
82
  deleteTrustedAgents(agents: string[]): string[];
77
83
  getTrustedAgents(): string[];
78
84
  runtimeKnownLinkLanguageTemplates(): string[];
85
+ runtimeDebugStrings(neighbourhoodUrl?: string): DebugStringEntry[];
79
86
  runtimeAddKnownLinkLanguageTemplates(addresses: string[]): string[];
80
87
  runtimeRemoveKnownLinkLanguageTemplates(addresses: string[]): string[];
81
88
  runtimeFriends(): string[];
82
89
  runtimeAddFriends(dids: string[]): string[];
83
90
  runtimeRemoveFriends(dids: string[]): string[];
84
91
  runtimeHcAgentInfos(): String;
92
+ runtimeGetNetworkMetrics(): String;
93
+ runtimeRestartHolochain(): Boolean;
85
94
  runtimeHcAddAgentInfos(agentInfos: any): boolean;
86
95
  runtimeVerifyStringSignedByDid(did: string, didSigningKeyId: string, data: string, signedData: string): boolean;
87
96
  runtimeSetStatus(status: Perspective): boolean;