@coasys/ad4m 0.11.1 → 0.11.2-dev-multi-user

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
@@ -4071,6 +4071,52 @@ exports.AuthInfoInput = __decorate$b([
4071
4071
  InputType(),
4072
4072
  __metadata$b("design:paramtypes", [String, String, String, String, String, Array])
4073
4073
  ], exports.AuthInfoInput);
4074
+ exports.User = class User {
4075
+ constructor(username, did, password) {
4076
+ this.username = username;
4077
+ this.did = did;
4078
+ this.password = password;
4079
+ }
4080
+ };
4081
+ __decorate$b([
4082
+ Field(),
4083
+ __metadata$b("design:type", String)
4084
+ ], exports.User.prototype, "username", void 0);
4085
+ __decorate$b([
4086
+ Field(),
4087
+ __metadata$b("design:type", String)
4088
+ ], exports.User.prototype, "did", void 0);
4089
+ __decorate$b([
4090
+ Field(),
4091
+ __metadata$b("design:type", String)
4092
+ ], exports.User.prototype, "password", void 0);
4093
+ exports.User = __decorate$b([
4094
+ ObjectType(),
4095
+ __metadata$b("design:paramtypes", [String, String, String])
4096
+ ], exports.User);
4097
+ exports.UserCreationResult = class UserCreationResult {
4098
+ constructor(did, success, error) {
4099
+ this.did = did;
4100
+ this.success = success;
4101
+ this.error = error;
4102
+ }
4103
+ };
4104
+ __decorate$b([
4105
+ Field(),
4106
+ __metadata$b("design:type", String)
4107
+ ], exports.UserCreationResult.prototype, "did", void 0);
4108
+ __decorate$b([
4109
+ Field(),
4110
+ __metadata$b("design:type", Boolean)
4111
+ ], exports.UserCreationResult.prototype, "success", void 0);
4112
+ __decorate$b([
4113
+ Field(),
4114
+ __metadata$b("design:type", String)
4115
+ ], exports.UserCreationResult.prototype, "error", void 0);
4116
+ exports.UserCreationResult = __decorate$b([
4117
+ ObjectType(),
4118
+ __metadata$b("design:paramtypes", [String, Boolean, String])
4119
+ ], exports.UserCreationResult);
4074
4120
 
4075
4121
  var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
4076
4122
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -4950,6 +4996,7 @@ class PerspectiveProxy {
4950
4996
  __classPrivateFieldSet$a(this, _PerspectiveProxy_client, ad4m, "f");
4951
4997
  this.uuid = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid;
4952
4998
  this.name = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").name;
4999
+ this.owners = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").owners;
4953
5000
  this.sharedUrl = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").sharedUrl;
4954
5001
  this.neighbourhood = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").neighbourhood;
4955
5002
  this.state = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").state;
@@ -5864,6 +5911,7 @@ uuid
5864
5911
  name
5865
5912
  sharedUrl
5866
5913
  state
5914
+ owners
5867
5915
  neighbourhood {
5868
5916
  data {
5869
5917
  linkLanguage
@@ -6860,6 +6908,29 @@ class AgentClient {
6860
6908
  }));
6861
6909
  return agentSignMessage;
6862
6910
  }
6911
+ // Multi-user methods
6912
+ async createUser(email, password) {
6913
+ const { runtimeCreateUser } = unwrapApolloResult(await __classPrivateFieldGet$8(this, _AgentClient_apolloClient, "f").mutate({
6914
+ mutation: gql `mutation runtimeCreateUser($email: String!, $password: String!) {
6915
+ runtimeCreateUser(email: $email, password: $password) {
6916
+ did
6917
+ success
6918
+ error
6919
+ }
6920
+ }`,
6921
+ variables: { email, password },
6922
+ }));
6923
+ return runtimeCreateUser;
6924
+ }
6925
+ async loginUser(email, password) {
6926
+ const { runtimeLoginUser } = unwrapApolloResult(await __classPrivateFieldGet$8(this, _AgentClient_apolloClient, "f").mutate({
6927
+ mutation: gql `mutation runtimeLoginUser($email: String!, $password: String!) {
6928
+ runtimeLoginUser(email: $email, password: $password)
6929
+ }`,
6930
+ variables: { email, password },
6931
+ }));
6932
+ return runtimeLoginUser;
6933
+ }
6863
6934
  }
6864
6935
  _AgentClient_apolloClient = new WeakMap(), _AgentClient_appsChangedCallback = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap();
6865
6936
 
@@ -7608,6 +7679,36 @@ class RuntimeClient {
7608
7679
  }));
7609
7680
  return runtimeImportPerspective;
7610
7681
  }
7682
+ async multiUserEnabled() {
7683
+ const { runtimeMultiUserEnabled } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").query({
7684
+ query: gql `query runtimeMultiUserEnabled {
7685
+ runtimeMultiUserEnabled
7686
+ }`,
7687
+ }));
7688
+ return runtimeMultiUserEnabled;
7689
+ }
7690
+ async setMultiUserEnabled(enabled) {
7691
+ const { runtimeSetMultiUserEnabled } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
7692
+ mutation: gql `mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
7693
+ runtimeSetMultiUserEnabled(enabled: $enabled)
7694
+ }`,
7695
+ variables: { enabled }
7696
+ }));
7697
+ return runtimeSetMultiUserEnabled;
7698
+ }
7699
+ async listUsers() {
7700
+ const { runtimeListUsers } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").query({
7701
+ query: gql `query runtimeListUsers {
7702
+ runtimeListUsers {
7703
+ email
7704
+ did
7705
+ lastSeen
7706
+ perspectiveCount
7707
+ }
7708
+ }`
7709
+ }));
7710
+ return runtimeListUsers;
7711
+ }
7611
7712
  addNotificationTriggeredCallback(cb) {
7612
7713
  __classPrivateFieldGet$5(this, _RuntimeClient_notificationTriggeredCallbacks, "f").push(cb);
7613
7714
  }
@@ -15733,6 +15834,10 @@ __decorate$2([
15733
15834
  Field(),
15734
15835
  __metadata$2("design:type", exports.NeighbourhoodExpression)
15735
15836
  ], exports.PerspectiveHandle.prototype, "neighbourhood", void 0);
15837
+ __decorate$2([
15838
+ Field(),
15839
+ __metadata$2("design:type", Array)
15840
+ ], exports.PerspectiveHandle.prototype, "owners", void 0);
15736
15841
  exports.PerspectiveHandle = __decorate$2([
15737
15842
  ObjectType(),
15738
15843
  __metadata$2("design:paramtypes", [String, String, String])
@@ -16889,6 +16994,7 @@ type Mutation {
16889
16994
  runtimeRemoveNotification(id: String!): Boolean!
16890
16995
  runtimeRequestInstallNotification(notification: NotificationInput!): String!
16891
16996
  runtimeRestartHolochain: Boolean!
16997
+ runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
16892
16998
  runtimeSetStatus(status: PerspectiveInput!): Boolean!
16893
16999
  runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
16894
17000
  }
@@ -16948,6 +17054,7 @@ type PerspectiveExpression {
16948
17054
  type PerspectiveHandle {
16949
17055
  name: String!
16950
17056
  neighbourhood: NeighbourhoodExpression
17057
+ owners: [String!]
16951
17058
  sharedUrl: String
16952
17059
  state: String!
16953
17060
  uuid: String!
@@ -16996,8 +17103,10 @@ type Query {
16996
17103
  runtimeHcAgentInfos: String!
16997
17104
  runtimeInfo: RuntimeInfo!
16998
17105
  runtimeKnownLinkLanguageTemplates: [String!]!
17106
+ runtimeListUsers: [UserStatistics!]!
16999
17107
  runtimeMessageInbox(filter: String): [PerspectiveExpression!]!
17000
17108
  runtimeMessageOutbox(filter: String): [SentMessage!]!
17109
+ runtimeMultiUserEnabled: Boolean!
17001
17110
  runtimeNotifications: [Notification!]!
17002
17111
  runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
17003
17112
  }
@@ -17065,6 +17174,13 @@ type TriggeredNotification {
17065
17174
  triggerMatch: String!
17066
17175
  }
17067
17176
 
17177
+ type UserStatistics {
17178
+ did: String!
17179
+ email: String!
17180
+ lastSeen: String
17181
+ perspectiveCount: Int!
17182
+ }
17183
+
17068
17184
  input VoiceActivityParamsInput {
17069
17185
  endThreshold: Float
17070
17186
  endWindow: Float
@@ -17353,6 +17469,27 @@ __decorate([
17353
17469
  exports.ImportResult = __decorate([
17354
17470
  ObjectType()
17355
17471
  ], exports.ImportResult);
17472
+ exports.UserStatistics = class UserStatistics {
17473
+ };
17474
+ __decorate([
17475
+ Field(),
17476
+ __metadata("design:type", String)
17477
+ ], exports.UserStatistics.prototype, "email", void 0);
17478
+ __decorate([
17479
+ Field(),
17480
+ __metadata("design:type", String)
17481
+ ], exports.UserStatistics.prototype, "did", void 0);
17482
+ __decorate([
17483
+ Field(),
17484
+ __metadata("design:type", String)
17485
+ ], exports.UserStatistics.prototype, "lastSeen", void 0);
17486
+ __decorate([
17487
+ Field(),
17488
+ __metadata("design:type", Number)
17489
+ ], exports.UserStatistics.prototype, "perspectiveCount", void 0);
17490
+ exports.UserStatistics = __decorate([
17491
+ ObjectType()
17492
+ ], exports.UserStatistics);
17356
17493
  /**
17357
17494
  * Resolver classes are used here to define the GraphQL schema
17358
17495
  * (through the type-graphql annotations)
@@ -17502,6 +17639,20 @@ let RuntimeResolver = class RuntimeResolver {
17502
17639
  runtimeImportPerspective(filePath) {
17503
17640
  return true;
17504
17641
  }
17642
+ runtimeMultiUserEnabled() {
17643
+ return false;
17644
+ }
17645
+ runtimeSetMultiUserEnabled(enabled) {
17646
+ return enabled;
17647
+ }
17648
+ runtimeListUsers() {
17649
+ return [{
17650
+ email: "test@example.com",
17651
+ did: "did:key:test123",
17652
+ lastSeen: new Date().toISOString(),
17653
+ perspectiveCount: 5
17654
+ }];
17655
+ }
17505
17656
  };
17506
17657
  __decorate([
17507
17658
  Mutation(),
@@ -17735,6 +17886,25 @@ __decorate([
17735
17886
  __metadata("design:paramtypes", [String]),
17736
17887
  __metadata("design:returntype", Boolean)
17737
17888
  ], RuntimeResolver.prototype, "runtimeImportPerspective", null);
17889
+ __decorate([
17890
+ Query(),
17891
+ __metadata("design:type", Function),
17892
+ __metadata("design:paramtypes", []),
17893
+ __metadata("design:returntype", Boolean)
17894
+ ], RuntimeResolver.prototype, "runtimeMultiUserEnabled", null);
17895
+ __decorate([
17896
+ Mutation(),
17897
+ __param(0, Arg()),
17898
+ __metadata("design:type", Function),
17899
+ __metadata("design:paramtypes", [Boolean]),
17900
+ __metadata("design:returntype", Boolean)
17901
+ ], RuntimeResolver.prototype, "runtimeSetMultiUserEnabled", null);
17902
+ __decorate([
17903
+ Query(),
17904
+ __metadata("design:type", Function),
17905
+ __metadata("design:paramtypes", []),
17906
+ __metadata("design:returntype", Array)
17907
+ ], RuntimeResolver.prototype, "runtimeListUsers", null);
17738
17908
  RuntimeResolver = __decorate([
17739
17909
  Resolver()
17740
17910
  ], RuntimeResolver);
package/lib/index.js CHANGED
@@ -4067,6 +4067,52 @@ AuthInfoInput = __decorate$b([
4067
4067
  InputType(),
4068
4068
  __metadata$b("design:paramtypes", [String, String, String, String, String, Array])
4069
4069
  ], AuthInfoInput);
4070
+ let User = class User {
4071
+ constructor(username, did, password) {
4072
+ this.username = username;
4073
+ this.did = did;
4074
+ this.password = password;
4075
+ }
4076
+ };
4077
+ __decorate$b([
4078
+ Field(),
4079
+ __metadata$b("design:type", String)
4080
+ ], User.prototype, "username", void 0);
4081
+ __decorate$b([
4082
+ Field(),
4083
+ __metadata$b("design:type", String)
4084
+ ], User.prototype, "did", void 0);
4085
+ __decorate$b([
4086
+ Field(),
4087
+ __metadata$b("design:type", String)
4088
+ ], User.prototype, "password", void 0);
4089
+ User = __decorate$b([
4090
+ ObjectType(),
4091
+ __metadata$b("design:paramtypes", [String, String, String])
4092
+ ], User);
4093
+ let UserCreationResult = class UserCreationResult {
4094
+ constructor(did, success, error) {
4095
+ this.did = did;
4096
+ this.success = success;
4097
+ this.error = error;
4098
+ }
4099
+ };
4100
+ __decorate$b([
4101
+ Field(),
4102
+ __metadata$b("design:type", String)
4103
+ ], UserCreationResult.prototype, "did", void 0);
4104
+ __decorate$b([
4105
+ Field(),
4106
+ __metadata$b("design:type", Boolean)
4107
+ ], UserCreationResult.prototype, "success", void 0);
4108
+ __decorate$b([
4109
+ Field(),
4110
+ __metadata$b("design:type", String)
4111
+ ], UserCreationResult.prototype, "error", void 0);
4112
+ UserCreationResult = __decorate$b([
4113
+ ObjectType(),
4114
+ __metadata$b("design:paramtypes", [String, Boolean, String])
4115
+ ], UserCreationResult);
4070
4116
 
4071
4117
  var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
4072
4118
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -4946,6 +4992,7 @@ class PerspectiveProxy {
4946
4992
  __classPrivateFieldSet$a(this, _PerspectiveProxy_client, ad4m, "f");
4947
4993
  this.uuid = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid;
4948
4994
  this.name = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").name;
4995
+ this.owners = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").owners;
4949
4996
  this.sharedUrl = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").sharedUrl;
4950
4997
  this.neighbourhood = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").neighbourhood;
4951
4998
  this.state = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").state;
@@ -5860,6 +5907,7 @@ uuid
5860
5907
  name
5861
5908
  sharedUrl
5862
5909
  state
5910
+ owners
5863
5911
  neighbourhood {
5864
5912
  data {
5865
5913
  linkLanguage
@@ -6856,6 +6904,29 @@ class AgentClient {
6856
6904
  }));
6857
6905
  return agentSignMessage;
6858
6906
  }
6907
+ // Multi-user methods
6908
+ async createUser(email, password) {
6909
+ const { runtimeCreateUser } = unwrapApolloResult(await __classPrivateFieldGet$8(this, _AgentClient_apolloClient, "f").mutate({
6910
+ mutation: gql `mutation runtimeCreateUser($email: String!, $password: String!) {
6911
+ runtimeCreateUser(email: $email, password: $password) {
6912
+ did
6913
+ success
6914
+ error
6915
+ }
6916
+ }`,
6917
+ variables: { email, password },
6918
+ }));
6919
+ return runtimeCreateUser;
6920
+ }
6921
+ async loginUser(email, password) {
6922
+ const { runtimeLoginUser } = unwrapApolloResult(await __classPrivateFieldGet$8(this, _AgentClient_apolloClient, "f").mutate({
6923
+ mutation: gql `mutation runtimeLoginUser($email: String!, $password: String!) {
6924
+ runtimeLoginUser(email: $email, password: $password)
6925
+ }`,
6926
+ variables: { email, password },
6927
+ }));
6928
+ return runtimeLoginUser;
6929
+ }
6859
6930
  }
6860
6931
  _AgentClient_apolloClient = new WeakMap(), _AgentClient_appsChangedCallback = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap();
6861
6932
 
@@ -7604,6 +7675,36 @@ class RuntimeClient {
7604
7675
  }));
7605
7676
  return runtimeImportPerspective;
7606
7677
  }
7678
+ async multiUserEnabled() {
7679
+ const { runtimeMultiUserEnabled } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").query({
7680
+ query: gql `query runtimeMultiUserEnabled {
7681
+ runtimeMultiUserEnabled
7682
+ }`,
7683
+ }));
7684
+ return runtimeMultiUserEnabled;
7685
+ }
7686
+ async setMultiUserEnabled(enabled) {
7687
+ const { runtimeSetMultiUserEnabled } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
7688
+ mutation: gql `mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
7689
+ runtimeSetMultiUserEnabled(enabled: $enabled)
7690
+ }`,
7691
+ variables: { enabled }
7692
+ }));
7693
+ return runtimeSetMultiUserEnabled;
7694
+ }
7695
+ async listUsers() {
7696
+ const { runtimeListUsers } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").query({
7697
+ query: gql `query runtimeListUsers {
7698
+ runtimeListUsers {
7699
+ email
7700
+ did
7701
+ lastSeen
7702
+ perspectiveCount
7703
+ }
7704
+ }`
7705
+ }));
7706
+ return runtimeListUsers;
7707
+ }
7607
7708
  addNotificationTriggeredCallback(cb) {
7608
7709
  __classPrivateFieldGet$5(this, _RuntimeClient_notificationTriggeredCallbacks, "f").push(cb);
7609
7710
  }
@@ -15729,6 +15830,10 @@ __decorate$2([
15729
15830
  Field(),
15730
15831
  __metadata$2("design:type", NeighbourhoodExpression)
15731
15832
  ], PerspectiveHandle.prototype, "neighbourhood", void 0);
15833
+ __decorate$2([
15834
+ Field(),
15835
+ __metadata$2("design:type", Array)
15836
+ ], PerspectiveHandle.prototype, "owners", void 0);
15732
15837
  PerspectiveHandle = __decorate$2([
15733
15838
  ObjectType(),
15734
15839
  __metadata$2("design:paramtypes", [String, String, String])
@@ -16885,6 +16990,7 @@ type Mutation {
16885
16990
  runtimeRemoveNotification(id: String!): Boolean!
16886
16991
  runtimeRequestInstallNotification(notification: NotificationInput!): String!
16887
16992
  runtimeRestartHolochain: Boolean!
16993
+ runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
16888
16994
  runtimeSetStatus(status: PerspectiveInput!): Boolean!
16889
16995
  runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
16890
16996
  }
@@ -16944,6 +17050,7 @@ type PerspectiveExpression {
16944
17050
  type PerspectiveHandle {
16945
17051
  name: String!
16946
17052
  neighbourhood: NeighbourhoodExpression
17053
+ owners: [String!]
16947
17054
  sharedUrl: String
16948
17055
  state: String!
16949
17056
  uuid: String!
@@ -16992,8 +17099,10 @@ type Query {
16992
17099
  runtimeHcAgentInfos: String!
16993
17100
  runtimeInfo: RuntimeInfo!
16994
17101
  runtimeKnownLinkLanguageTemplates: [String!]!
17102
+ runtimeListUsers: [UserStatistics!]!
16995
17103
  runtimeMessageInbox(filter: String): [PerspectiveExpression!]!
16996
17104
  runtimeMessageOutbox(filter: String): [SentMessage!]!
17105
+ runtimeMultiUserEnabled: Boolean!
16997
17106
  runtimeNotifications: [Notification!]!
16998
17107
  runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
16999
17108
  }
@@ -17061,6 +17170,13 @@ type TriggeredNotification {
17061
17170
  triggerMatch: String!
17062
17171
  }
17063
17172
 
17173
+ type UserStatistics {
17174
+ did: String!
17175
+ email: String!
17176
+ lastSeen: String
17177
+ perspectiveCount: Int!
17178
+ }
17179
+
17064
17180
  input VoiceActivityParamsInput {
17065
17181
  endThreshold: Float
17066
17182
  endWindow: Float
@@ -17349,6 +17465,27 @@ __decorate([
17349
17465
  ImportResult = __decorate([
17350
17466
  ObjectType()
17351
17467
  ], ImportResult);
17468
+ let UserStatistics = class UserStatistics {
17469
+ };
17470
+ __decorate([
17471
+ Field(),
17472
+ __metadata("design:type", String)
17473
+ ], UserStatistics.prototype, "email", void 0);
17474
+ __decorate([
17475
+ Field(),
17476
+ __metadata("design:type", String)
17477
+ ], UserStatistics.prototype, "did", void 0);
17478
+ __decorate([
17479
+ Field(),
17480
+ __metadata("design:type", String)
17481
+ ], UserStatistics.prototype, "lastSeen", void 0);
17482
+ __decorate([
17483
+ Field(),
17484
+ __metadata("design:type", Number)
17485
+ ], UserStatistics.prototype, "perspectiveCount", void 0);
17486
+ UserStatistics = __decorate([
17487
+ ObjectType()
17488
+ ], UserStatistics);
17352
17489
  /**
17353
17490
  * Resolver classes are used here to define the GraphQL schema
17354
17491
  * (through the type-graphql annotations)
@@ -17498,6 +17635,20 @@ let RuntimeResolver = class RuntimeResolver {
17498
17635
  runtimeImportPerspective(filePath) {
17499
17636
  return true;
17500
17637
  }
17638
+ runtimeMultiUserEnabled() {
17639
+ return false;
17640
+ }
17641
+ runtimeSetMultiUserEnabled(enabled) {
17642
+ return enabled;
17643
+ }
17644
+ runtimeListUsers() {
17645
+ return [{
17646
+ email: "test@example.com",
17647
+ did: "did:key:test123",
17648
+ lastSeen: new Date().toISOString(),
17649
+ perspectiveCount: 5
17650
+ }];
17651
+ }
17501
17652
  };
17502
17653
  __decorate([
17503
17654
  Mutation(),
@@ -17731,6 +17882,25 @@ __decorate([
17731
17882
  __metadata("design:paramtypes", [String]),
17732
17883
  __metadata("design:returntype", Boolean)
17733
17884
  ], RuntimeResolver.prototype, "runtimeImportPerspective", null);
17885
+ __decorate([
17886
+ Query(),
17887
+ __metadata("design:type", Function),
17888
+ __metadata("design:paramtypes", []),
17889
+ __metadata("design:returntype", Boolean)
17890
+ ], RuntimeResolver.prototype, "runtimeMultiUserEnabled", null);
17891
+ __decorate([
17892
+ Mutation(),
17893
+ __param(0, Arg()),
17894
+ __metadata("design:type", Function),
17895
+ __metadata("design:paramtypes", [Boolean]),
17896
+ __metadata("design:returntype", Boolean)
17897
+ ], RuntimeResolver.prototype, "runtimeSetMultiUserEnabled", null);
17898
+ __decorate([
17899
+ Query(),
17900
+ __metadata("design:type", Function),
17901
+ __metadata("design:paramtypes", []),
17902
+ __metadata("design:returntype", Array)
17903
+ ], RuntimeResolver.prototype, "runtimeListUsers", null);
17734
17904
  RuntimeResolver = __decorate([
17735
17905
  Resolver()
17736
17906
  ], RuntimeResolver);
@@ -20316,4 +20486,4 @@ class ModelQueryBuilder {
20316
20486
  }
20317
20487
  }
20318
20488
 
20319
- 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 };
20489
+ 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, User, UserCreationResult, UserStatistics, addLink, capSentence, exprRef2String, formatList, hasLink, isExpression, isLink, linkEqual, makeRandomPrologAtom, parseExprUrl, typeDefsString };
@@ -101,4 +101,16 @@ export declare class AuthInfoInput {
101
101
  capabilities?: CapabilityInput[];
102
102
  constructor(appName: string, appDesc: string, appDomain: string, appUrl?: string, appIconPath?: string, capabilities?: CapabilityInput[]);
103
103
  }
104
+ export declare class User {
105
+ username: string;
106
+ did: string;
107
+ password: string;
108
+ constructor(username: string, did: string, password: string);
109
+ }
110
+ export declare class UserCreationResult {
111
+ did: string;
112
+ success: boolean;
113
+ error?: string;
114
+ constructor(did: string, success: boolean, error?: string);
115
+ }
104
116
  export {};
@@ -335,3 +335,51 @@ AuthInfoInput = __decorate([
335
335
  __metadata("design:paramtypes", [String, String, String, String, String, Array])
336
336
  ], AuthInfoInput);
337
337
  export { AuthInfoInput };
338
+ let User = class User {
339
+ constructor(username, did, password) {
340
+ this.username = username;
341
+ this.did = did;
342
+ this.password = password;
343
+ }
344
+ };
345
+ __decorate([
346
+ Field(),
347
+ __metadata("design:type", String)
348
+ ], User.prototype, "username", void 0);
349
+ __decorate([
350
+ Field(),
351
+ __metadata("design:type", String)
352
+ ], User.prototype, "did", void 0);
353
+ __decorate([
354
+ Field(),
355
+ __metadata("design:type", String)
356
+ ], User.prototype, "password", void 0);
357
+ User = __decorate([
358
+ ObjectType(),
359
+ __metadata("design:paramtypes", [String, String, String])
360
+ ], User);
361
+ export { User };
362
+ let UserCreationResult = class UserCreationResult {
363
+ constructor(did, success, error) {
364
+ this.did = did;
365
+ this.success = success;
366
+ this.error = error;
367
+ }
368
+ };
369
+ __decorate([
370
+ Field(),
371
+ __metadata("design:type", String)
372
+ ], UserCreationResult.prototype, "did", void 0);
373
+ __decorate([
374
+ Field(),
375
+ __metadata("design:type", Boolean)
376
+ ], UserCreationResult.prototype, "success", void 0);
377
+ __decorate([
378
+ Field({ nullable: true }),
379
+ __metadata("design:type", String)
380
+ ], UserCreationResult.prototype, "error", void 0);
381
+ UserCreationResult = __decorate([
382
+ ObjectType(),
383
+ __metadata("design:paramtypes", [String, Boolean, String])
384
+ ], UserCreationResult);
385
+ export { UserCreationResult };
@@ -1,6 +1,6 @@
1
1
  import { ApolloClient } from "@apollo/client/core";
2
2
  import { PerspectiveInput } from "../perspectives/Perspective";
3
- import { Agent, Apps, AuthInfoInput, EntanglementProof, EntanglementProofInput } from "./Agent";
3
+ import { Agent, Apps, AuthInfoInput, EntanglementProof, EntanglementProofInput, UserCreationResult } from "./Agent";
4
4
  import { AgentStatus } from "./AgentStatus";
5
5
  import { LinkMutations } from "../links/Links";
6
6
  export interface InitializeArgs {
@@ -54,4 +54,6 @@ export declare class AgentClient {
54
54
  revokeToken(requestId: string): Promise<Apps[]>;
55
55
  isLocked(): Promise<boolean>;
56
56
  signMessage(message: string): Promise<string>;
57
+ createUser(email: string, password: string): Promise<UserCreationResult>;
58
+ loginUser(email: string, password: string): Promise<string>;
57
59
  }
@@ -427,5 +427,28 @@ export class AgentClient {
427
427
  }));
428
428
  return agentSignMessage;
429
429
  }
430
+ // Multi-user methods
431
+ async createUser(email, password) {
432
+ const { runtimeCreateUser } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
433
+ mutation: gql `mutation runtimeCreateUser($email: String!, $password: String!) {
434
+ runtimeCreateUser(email: $email, password: $password) {
435
+ did
436
+ success
437
+ error
438
+ }
439
+ }`,
440
+ variables: { email, password },
441
+ }));
442
+ return runtimeCreateUser;
443
+ }
444
+ 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
+ variables: { email, password },
450
+ }));
451
+ return runtimeLoginUser;
452
+ }
430
453
  }
431
454
  _AgentClient_apolloClient = new WeakMap(), _AgentClient_appsChangedCallback = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap();
@@ -148,6 +148,17 @@ export interface LinkSyncAdapter {
148
148
  addCallback(callback: PerspectiveDiffObserver): any;
149
149
  /** Add a sync state callback method */
150
150
  addSyncStateChangeCallback(callback: SyncStateChangeObserver): any;
151
+ /**
152
+ * Set the local agents (DIDs) that own this perspective/neighbourhood.
153
+ * This is used to determine which agents should be registered in the DHT.
154
+ * Optional - if not implemented, all local agents may be registered.
155
+ *
156
+ * This is a temporary hack to support multiple users on one node joining the same neighbourhood.
157
+ * Once we migrate the LanguageController to Rust and run Languages per user, each user will get their
158
+ * own language instance and we won't need to explicitly set local agents. This will provide better
159
+ * isolation and avoid the need to share language state between users.
160
+ */
161
+ setLocalAgents?(agents: DID[]): void;
151
162
  }
152
163
  export type MessageCallback = (message: PerspectiveExpression) => void;
153
164
  export type StatusCallback = (caller: DID) => Perspective;
@@ -185,7 +196,7 @@ export declare class OnlineAgent {
185
196
  did: DID;
186
197
  status: PerspectiveExpression;
187
198
  }
188
- export type TelepresenceSignalCallback = (payload: PerspectiveExpression) => void;
199
+ export type TelepresenceSignalCallback = (payload: PerspectiveExpression, recipientDid?: string) => void;
189
200
  export interface TelepresenceAdapter {
190
201
  setOnlineStatus(status: PerspectiveExpression): Promise<void>;
191
202
  getOnlineAgents(): Promise<OnlineAgent[]>;
@@ -26,6 +26,7 @@ uuid
26
26
  name
27
27
  sharedUrl
28
28
  state
29
+ owners
29
30
  neighbourhood {
30
31
  data {
31
32
  linkLanguage
@@ -13,5 +13,6 @@ export declare class PerspectiveHandle {
13
13
  state: PerspectiveState;
14
14
  sharedUrl?: string;
15
15
  neighbourhood?: NeighbourhoodExpression;
16
+ owners?: string[];
16
17
  constructor(uuid?: string, name?: string, state?: PerspectiveState);
17
18
  }
@@ -53,6 +53,10 @@ __decorate([
53
53
  Field(type => NeighbourhoodExpression, { nullable: true }),
54
54
  __metadata("design:type", NeighbourhoodExpression)
55
55
  ], PerspectiveHandle.prototype, "neighbourhood", void 0);
56
+ __decorate([
57
+ Field(type => [String], { nullable: true }),
58
+ __metadata("design:type", Array)
59
+ ], PerspectiveHandle.prototype, "owners", void 0);
56
60
  PerspectiveHandle = __decorate([
57
61
  ObjectType(),
58
62
  __metadata("design:paramtypes", [String, String, String])
@@ -172,6 +172,8 @@ export declare class PerspectiveProxy {
172
172
  neighbourhood: NeighbourhoodExpression | null;
173
173
  /** Current sync state if this perspective is shared */
174
174
  state: PerspectiveState | null;
175
+ /** List of owners of this perspective */
176
+ owners?: string[];
175
177
  /**
176
178
  * Creates a new PerspectiveProxy instance.
177
179
  * Note: Don't create this directly, use ad4m.perspective.add() instead.
@@ -349,6 +349,7 @@ export class PerspectiveProxy {
349
349
  __classPrivateFieldSet(this, _PerspectiveProxy_client, ad4m, "f");
350
350
  this.uuid = __classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").uuid;
351
351
  this.name = __classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").name;
352
+ this.owners = __classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").owners;
352
353
  this.sharedUrl = __classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").sharedUrl;
353
354
  this.neighbourhood = __classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").neighbourhood;
354
355
  this.state = __classPrivateFieldGet(this, _PerspectiveProxy_handle, "f").state;
@@ -1,6 +1,6 @@
1
1
  import { ApolloClient } from "@apollo/client/core";
2
2
  import { Perspective, PerspectiveExpression } from "../perspectives/Perspective";
3
- import { RuntimeInfo, ExceptionInfo, SentMessage, NotificationInput, Notification, TriggeredNotification, ImportResult } from "./RuntimeResolver";
3
+ import { RuntimeInfo, ExceptionInfo, SentMessage, NotificationInput, Notification, TriggeredNotification, ImportResult, UserStatistics } from "./RuntimeResolver";
4
4
  export type MessageCallback = (message: PerspectiveExpression) => null;
5
5
  export type ExceptionCallback = (info: ExceptionInfo) => null;
6
6
  export type NotificationTriggeredCallback = (notification: TriggeredNotification) => null;
@@ -39,6 +39,9 @@ export declare class RuntimeClient {
39
39
  removeNotification(id: string): Promise<boolean>;
40
40
  exportPerspective(uuid: string, filePath: string): Promise<boolean>;
41
41
  importPerspective(filePath: string): Promise<boolean>;
42
+ multiUserEnabled(): Promise<boolean>;
43
+ setMultiUserEnabled(enabled: boolean): Promise<boolean>;
44
+ listUsers(): Promise<UserStatistics[]>;
42
45
  addNotificationTriggeredCallback(cb: NotificationTriggeredCallback): void;
43
46
  subscribeNotificationTriggered(): void;
44
47
  addMessageCallback(cb: MessageCallback): void;
@@ -351,6 +351,36 @@ export class RuntimeClient {
351
351
  }));
352
352
  return runtimeImportPerspective;
353
353
  }
354
+ async multiUserEnabled() {
355
+ const { runtimeMultiUserEnabled } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
356
+ query: gql `query runtimeMultiUserEnabled {
357
+ runtimeMultiUserEnabled
358
+ }`,
359
+ }));
360
+ return runtimeMultiUserEnabled;
361
+ }
362
+ async setMultiUserEnabled(enabled) {
363
+ const { runtimeSetMultiUserEnabled } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
364
+ mutation: gql `mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
365
+ runtimeSetMultiUserEnabled(enabled: $enabled)
366
+ }`,
367
+ variables: { enabled }
368
+ }));
369
+ return runtimeSetMultiUserEnabled;
370
+ }
371
+ async listUsers() {
372
+ const { runtimeListUsers } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
373
+ query: gql `query runtimeListUsers {
374
+ runtimeListUsers {
375
+ email
376
+ did
377
+ lastSeen
378
+ perspectiveCount
379
+ }
380
+ }`
381
+ }));
382
+ return runtimeListUsers;
383
+ }
354
384
  addNotificationTriggeredCallback(cb) {
355
385
  __classPrivateFieldGet(this, _RuntimeClient_notificationTriggeredCallbacks, "f").push(cb);
356
386
  }
@@ -62,6 +62,12 @@ export declare class ImportResult {
62
62
  trustedAgents: ImportStats;
63
63
  knownLinkLanguages: ImportStats;
64
64
  }
65
+ export declare class UserStatistics {
66
+ email: string;
67
+ did: string;
68
+ lastSeen?: string;
69
+ perspectiveCount: number;
70
+ }
65
71
  /**
66
72
  * Resolver classes are used here to define the GraphQL schema
67
73
  * (through the type-graphql annotations)
@@ -103,4 +109,7 @@ export default class RuntimeResolver {
103
109
  runtimeImportDb(filePath: string): boolean;
104
110
  runtimeExportPerspective(perspectiveUuid: string, filePath: string): boolean;
105
111
  runtimeImportPerspective(filePath: string): boolean;
112
+ runtimeMultiUserEnabled(): boolean;
113
+ runtimeSetMultiUserEnabled(enabled: boolean): boolean;
114
+ runtimeListUsers(): UserStatistics[];
106
115
  }
@@ -270,6 +270,28 @@ ImportResult = __decorate([
270
270
  ObjectType()
271
271
  ], ImportResult);
272
272
  export { ImportResult };
273
+ let UserStatistics = class UserStatistics {
274
+ };
275
+ __decorate([
276
+ Field(),
277
+ __metadata("design:type", String)
278
+ ], UserStatistics.prototype, "email", void 0);
279
+ __decorate([
280
+ Field(),
281
+ __metadata("design:type", String)
282
+ ], UserStatistics.prototype, "did", void 0);
283
+ __decorate([
284
+ Field({ nullable: true }),
285
+ __metadata("design:type", String)
286
+ ], UserStatistics.prototype, "lastSeen", void 0);
287
+ __decorate([
288
+ Field(type => Int),
289
+ __metadata("design:type", Number)
290
+ ], UserStatistics.prototype, "perspectiveCount", void 0);
291
+ UserStatistics = __decorate([
292
+ ObjectType()
293
+ ], UserStatistics);
294
+ export { UserStatistics };
273
295
  /**
274
296
  * Resolver classes are used here to define the GraphQL schema
275
297
  * (through the type-graphql annotations)
@@ -419,6 +441,20 @@ let RuntimeResolver = class RuntimeResolver {
419
441
  runtimeImportPerspective(filePath) {
420
442
  return true;
421
443
  }
444
+ runtimeMultiUserEnabled() {
445
+ return false;
446
+ }
447
+ runtimeSetMultiUserEnabled(enabled) {
448
+ return enabled;
449
+ }
450
+ runtimeListUsers() {
451
+ return [{
452
+ email: "test@example.com",
453
+ did: "did:key:test123",
454
+ lastSeen: new Date().toISOString(),
455
+ perspectiveCount: 5
456
+ }];
457
+ }
422
458
  };
423
459
  __decorate([
424
460
  Mutation(returns => Boolean),
@@ -652,6 +688,25 @@ __decorate([
652
688
  __metadata("design:paramtypes", [String]),
653
689
  __metadata("design:returntype", Boolean)
654
690
  ], RuntimeResolver.prototype, "runtimeImportPerspective", null);
691
+ __decorate([
692
+ Query(returns => Boolean),
693
+ __metadata("design:type", Function),
694
+ __metadata("design:paramtypes", []),
695
+ __metadata("design:returntype", Boolean)
696
+ ], RuntimeResolver.prototype, "runtimeMultiUserEnabled", null);
697
+ __decorate([
698
+ Mutation(returns => Boolean),
699
+ __param(0, Arg("enabled")),
700
+ __metadata("design:type", Function),
701
+ __metadata("design:paramtypes", [Boolean]),
702
+ __metadata("design:returntype", Boolean)
703
+ ], RuntimeResolver.prototype, "runtimeSetMultiUserEnabled", null);
704
+ __decorate([
705
+ Query(returns => [UserStatistics]),
706
+ __metadata("design:type", Function),
707
+ __metadata("design:paramtypes", []),
708
+ __metadata("design:returntype", Array)
709
+ ], RuntimeResolver.prototype, "runtimeListUsers", null);
655
710
  RuntimeResolver = __decorate([
656
711
  Resolver()
657
712
  ], RuntimeResolver);
@@ -372,6 +372,7 @@ type Mutation {
372
372
  runtimeRemoveNotification(id: String!): Boolean!
373
373
  runtimeRequestInstallNotification(notification: NotificationInput!): String!
374
374
  runtimeRestartHolochain: Boolean!
375
+ runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
375
376
  runtimeSetStatus(status: PerspectiveInput!): Boolean!
376
377
  runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
377
378
  }
@@ -431,6 +432,7 @@ type PerspectiveExpression {
431
432
  type PerspectiveHandle {
432
433
  name: String!
433
434
  neighbourhood: NeighbourhoodExpression
435
+ owners: [String!]
434
436
  sharedUrl: String
435
437
  state: String!
436
438
  uuid: String!
@@ -479,8 +481,10 @@ type Query {
479
481
  runtimeHcAgentInfos: String!
480
482
  runtimeInfo: RuntimeInfo!
481
483
  runtimeKnownLinkLanguageTemplates: [String!]!
484
+ runtimeListUsers: [UserStatistics!]!
482
485
  runtimeMessageInbox(filter: String): [PerspectiveExpression!]!
483
486
  runtimeMessageOutbox(filter: String): [SentMessage!]!
487
+ runtimeMultiUserEnabled: Boolean!
484
488
  runtimeNotifications: [Notification!]!
485
489
  runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
486
490
  }
@@ -548,6 +552,13 @@ type TriggeredNotification {
548
552
  triggerMatch: String!
549
553
  }
550
554
 
555
+ type UserStatistics {
556
+ did: String!
557
+ email: String!
558
+ lastSeen: String
559
+ perspectiveCount: Int!
560
+ }
561
+
551
562
  input VoiceActivityParamsInput {
552
563
  endThreshold: Float
553
564
  endWindow: Float
@@ -368,6 +368,7 @@ type Mutation {
368
368
  runtimeRemoveNotification(id: String!): Boolean!
369
369
  runtimeRequestInstallNotification(notification: NotificationInput!): String!
370
370
  runtimeRestartHolochain: Boolean!
371
+ runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
371
372
  runtimeSetStatus(status: PerspectiveInput!): Boolean!
372
373
  runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
373
374
  }
@@ -427,6 +428,7 @@ type PerspectiveExpression {
427
428
  type PerspectiveHandle {
428
429
  name: String!
429
430
  neighbourhood: NeighbourhoodExpression
431
+ owners: [String!]
430
432
  sharedUrl: String
431
433
  state: String!
432
434
  uuid: String!
@@ -475,8 +477,10 @@ type Query {
475
477
  runtimeHcAgentInfos: String!
476
478
  runtimeInfo: RuntimeInfo!
477
479
  runtimeKnownLinkLanguageTemplates: [String!]!
480
+ runtimeListUsers: [UserStatistics!]!
478
481
  runtimeMessageInbox(filter: String): [PerspectiveExpression!]!
479
482
  runtimeMessageOutbox(filter: String): [SentMessage!]!
483
+ runtimeMultiUserEnabled: Boolean!
480
484
  runtimeNotifications: [Notification!]!
481
485
  runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
482
486
  }
@@ -544,6 +548,13 @@ type TriggeredNotification {
544
548
  triggerMatch: String!
545
549
  }
546
550
 
551
+ type UserStatistics {
552
+ did: String!
553
+ email: String!
554
+ lastSeen: String
555
+ perspectiveCount: Int!
556
+ }
557
+
547
558
  input VoiceActivityParamsInput {
548
559
  endThreshold: Float
549
560
  endWindow: Float
package/package.json CHANGED
@@ -5,7 +5,6 @@
5
5
  "module": "lib/index.js",
6
6
  "types": "lib/src/index.d.ts",
7
7
  "type": "module",
8
- "private": false,
9
8
  "scripts": {
10
9
  "build": "patch-package && tsc && pnpm run buildSchema && pnpm run bundle",
11
10
  "buildSchema": "node --es-module-specifier-resolution=node lib/src/buildSchema.js",
@@ -69,5 +68,5 @@
69
68
  "graphql@15.7.2": "patches/graphql@15.7.2.patch"
70
69
  }
71
70
  },
72
- "version": "0.11.1"
71
+ "version": "0.11.2-dev-multi-user"
73
72
  }
@@ -291,3 +291,39 @@ export class AuthInfoInput {
291
291
  this.appIconPath = appIconPath;
292
292
  }
293
293
  }
294
+
295
+ @ObjectType()
296
+ export class User {
297
+ @Field()
298
+ username: string;
299
+
300
+ @Field()
301
+ did: string;
302
+
303
+ @Field()
304
+ password: string;
305
+
306
+ constructor(username: string, did: string, password: string) {
307
+ this.username = username;
308
+ this.did = did;
309
+ this.password = password;
310
+ }
311
+ }
312
+
313
+ @ObjectType()
314
+ export class UserCreationResult {
315
+ @Field()
316
+ did: string;
317
+
318
+ @Field()
319
+ success: boolean;
320
+
321
+ @Field({ nullable: true })
322
+ error?: string;
323
+
324
+ constructor(did: string, success: boolean, error?: string) {
325
+ this.did = did;
326
+ this.success = success;
327
+ this.error = error;
328
+ }
329
+ }
@@ -8,6 +8,7 @@ import {
8
8
  AuthInfoInput,
9
9
  EntanglementProof,
10
10
  EntanglementProofInput,
11
+ UserCreationResult,
11
12
  } from "./Agent";
12
13
  import { AgentStatus } from "./AgentStatus";
13
14
  import { LinkMutations } from "../links/Links";
@@ -528,4 +529,33 @@ export class AgentClient {
528
529
  );
529
530
  return agentSignMessage;
530
531
  }
532
+
533
+ // Multi-user methods
534
+ async createUser(email: string, password: string): Promise<UserCreationResult> {
535
+ const { runtimeCreateUser } = unwrapApolloResult(
536
+ await this.#apolloClient.mutate({
537
+ mutation: gql`mutation runtimeCreateUser($email: String!, $password: String!) {
538
+ runtimeCreateUser(email: $email, password: $password) {
539
+ did
540
+ success
541
+ error
542
+ }
543
+ }`,
544
+ variables: { email, password },
545
+ })
546
+ );
547
+ return runtimeCreateUser;
548
+ }
549
+
550
+ async loginUser(email: string, password: string): Promise<string> {
551
+ const { runtimeLoginUser } = unwrapApolloResult(
552
+ await this.#apolloClient.mutate({
553
+ mutation: gql`mutation runtimeLoginUser($email: String!, $password: String!) {
554
+ runtimeLoginUser(email: $email, password: $password)
555
+ }`,
556
+ variables: { email, password },
557
+ })
558
+ );
559
+ return runtimeLoginUser;
560
+ }
531
561
  }
@@ -168,10 +168,10 @@ export interface LinkSyncAdapter {
168
168
  /** What revision are we on now -> what changes are included in output of render() */
169
169
  currentRevision(): Promise<string>;
170
170
 
171
- /**
172
- * Check for and get new changes,
171
+ /**
172
+ * Check for and get new changes,
173
173
  * notify others of local changes.
174
- * This function will be called every
174
+ * This function will be called every
175
175
  * few seconds by the ad4m-executor.
176
176
  * */
177
177
  sync(): Promise<PerspectiveDiff>;
@@ -187,6 +187,18 @@ export interface LinkSyncAdapter {
187
187
 
188
188
  /** Add a sync state callback method */
189
189
  addSyncStateChangeCallback(callback: SyncStateChangeObserver);
190
+
191
+ /**
192
+ * Set the local agents (DIDs) that own this perspective/neighbourhood.
193
+ * This is used to determine which agents should be registered in the DHT.
194
+ * Optional - if not implemented, all local agents may be registered.
195
+ *
196
+ * This is a temporary hack to support multiple users on one node joining the same neighbourhood.
197
+ * Once we migrate the LanguageController to Rust and run Languages per user, each user will get their
198
+ * own language instance and we won't need to explicitly set local agents. This will provide better
199
+ * isolation and avoid the need to share language state between users.
200
+ */
201
+ setLocalAgents?(agents: DID[]): void;
190
202
  }
191
203
 
192
204
  export type MessageCallback = (message: PerspectiveExpression) => void;
@@ -255,7 +267,7 @@ export class OnlineAgent {
255
267
  status: PerspectiveExpression
256
268
  }
257
269
 
258
- export type TelepresenceSignalCallback = (payload: PerspectiveExpression) => void;
270
+ export type TelepresenceSignalCallback = (payload: PerspectiveExpression, recipientDid?: string) => void;
259
271
  export interface TelepresenceAdapter {
260
272
  setOnlineStatus(status: PerspectiveExpression): Promise<void>;
261
273
  getOnlineAgents(): Promise<OnlineAgent[]>;
@@ -25,6 +25,7 @@ uuid
25
25
  name
26
26
  sharedUrl
27
27
  state
28
+ owners
28
29
  neighbourhood {
29
30
  data {
30
31
  linkLanguage
@@ -27,6 +27,9 @@ export class PerspectiveHandle {
27
27
  @Field(type => NeighbourhoodExpression, {nullable: true})
28
28
  neighbourhood?: NeighbourhoodExpression
29
29
 
30
+ @Field(type => [String], {nullable: true})
31
+ owners?: string[]
32
+
30
33
  constructor(uuid?: string, name?: string, state?: PerspectiveState) {
31
34
  this.uuid = uuid
32
35
  this.name = name
@@ -379,6 +379,9 @@ export class PerspectiveProxy {
379
379
  /** Current sync state if this perspective is shared */
380
380
  state: PerspectiveState|null;
381
381
 
382
+ /** List of owners of this perspective */
383
+ owners?: string[]
384
+
382
385
  #handle: PerspectiveHandle
383
386
  #client: PerspectiveClient
384
387
  #perspectiveLinkAddedCallbacks: LinkCallback[]
@@ -399,6 +402,7 @@ export class PerspectiveProxy {
399
402
  this.#client = ad4m
400
403
  this.uuid = this.#handle.uuid;
401
404
  this.name = this.#handle.name;
405
+ this.owners = this.#handle.owners;
402
406
  this.sharedUrl = this.#handle.sharedUrl;
403
407
  this.neighbourhood = this.#handle.neighbourhood;
404
408
  this.state = this.#handle.state;
@@ -1,7 +1,7 @@
1
1
  import { ApolloClient, gql } from "@apollo/client/core"
2
2
  import { Perspective, PerspectiveExpression } from "../perspectives/Perspective"
3
3
  import unwrapApolloResult from "../unwrapApolloResult"
4
- import { RuntimeInfo, ExceptionInfo, SentMessage, NotificationInput, Notification, TriggeredNotification, ImportResult } from "./RuntimeResolver"
4
+ import { RuntimeInfo, ExceptionInfo, SentMessage, NotificationInput, Notification, TriggeredNotification, ImportResult, UserStatistics } from "./RuntimeResolver"
5
5
 
6
6
  const PERSPECTIVE_EXPRESSION_FIELDS = `
7
7
  author
@@ -386,6 +386,39 @@ export class RuntimeClient {
386
386
  return runtimeImportPerspective
387
387
  }
388
388
 
389
+ async multiUserEnabled(): Promise<boolean> {
390
+ const { runtimeMultiUserEnabled } = unwrapApolloResult(await this.#apolloClient.query({
391
+ query: gql`query runtimeMultiUserEnabled {
392
+ runtimeMultiUserEnabled
393
+ }`,
394
+ }))
395
+ return runtimeMultiUserEnabled
396
+ }
397
+
398
+ async setMultiUserEnabled(enabled: boolean): Promise<boolean> {
399
+ const { runtimeSetMultiUserEnabled } = unwrapApolloResult(await this.#apolloClient.mutate({
400
+ mutation: gql`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
401
+ runtimeSetMultiUserEnabled(enabled: $enabled)
402
+ }`,
403
+ variables: { enabled }
404
+ }))
405
+ return runtimeSetMultiUserEnabled
406
+ }
407
+
408
+ async listUsers(): Promise<UserStatistics[]> {
409
+ const { runtimeListUsers } = unwrapApolloResult(await this.#apolloClient.query({
410
+ query: gql`query runtimeListUsers {
411
+ runtimeListUsers {
412
+ email
413
+ did
414
+ lastSeen
415
+ perspectiveCount
416
+ }
417
+ }`
418
+ }))
419
+ return runtimeListUsers
420
+ }
421
+
389
422
  addNotificationTriggeredCallback(cb: NotificationTriggeredCallback) {
390
423
  this.#notificationTriggeredCallbacks.push(cb)
391
424
  }
@@ -192,6 +192,21 @@ export class ImportResult {
192
192
  knownLinkLanguages: ImportStats;
193
193
  }
194
194
 
195
+ @ObjectType()
196
+ export class UserStatistics {
197
+ @Field()
198
+ email: string;
199
+
200
+ @Field()
201
+ did: string;
202
+
203
+ @Field({nullable: true})
204
+ lastSeen?: string;
205
+
206
+ @Field(type => Int)
207
+ perspectiveCount: number;
208
+ }
209
+
195
210
  /**
196
211
  * Resolver classes are used here to define the GraphQL schema
197
212
  * (through the type-graphql annotations)
@@ -426,5 +441,25 @@ export default class RuntimeResolver {
426
441
  runtimeImportPerspective(@Arg("filePath", type => String) filePath: string): boolean {
427
442
  return true
428
443
  }
444
+
445
+ @Query(returns => Boolean)
446
+ runtimeMultiUserEnabled(): boolean {
447
+ return false
448
+ }
449
+
450
+ @Mutation(returns => Boolean)
451
+ runtimeSetMultiUserEnabled(@Arg("enabled") enabled: boolean): boolean {
452
+ return enabled
453
+ }
454
+
455
+ @Query(returns => [UserStatistics])
456
+ runtimeListUsers(): UserStatistics[] {
457
+ return [{
458
+ email: "test@example.com",
459
+ did: "did:key:test123",
460
+ lastSeen: new Date().toISOString(),
461
+ perspectiveCount: 5
462
+ }]
463
+ }
429
464
  }
430
465