@coasys/ad4m 0.11.1 → 0.11.2-dev-multi-user-email
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 +369 -0
- package/lib/index.js +370 -1
- package/lib/src/agent/Agent.d.ts +6 -0
- package/lib/src/agent/Agent.js +24 -0
- package/lib/src/agent/AgentClient.d.ts +6 -1
- package/lib/src/agent/AgentClient.js +45 -0
- package/lib/src/language/Language.d.ts +12 -1
- package/lib/src/perspectives/PerspectiveClient.js +1 -0
- package/lib/src/perspectives/PerspectiveHandle.d.ts +1 -0
- package/lib/src/perspectives/PerspectiveHandle.js +4 -0
- package/lib/src/perspectives/PerspectiveProxy.d.ts +2 -0
- package/lib/src/perspectives/PerspectiveProxy.js +1 -0
- package/lib/src/runtime/RuntimeClient.d.ts +9 -1
- package/lib/src/runtime/RuntimeClient.js +72 -0
- package/lib/src/runtime/RuntimeResolver.d.ts +25 -0
- package/lib/src/runtime/RuntimeResolver.js +193 -0
- package/lib/src/schema.gql +33 -0
- package/lib/src/typeDefs.js +33 -0
- package/package.json +2 -2
- package/src/agent/Agent.ts +19 -0
- package/src/agent/AgentClient.ts +59 -0
- package/src/language/Language.ts +16 -4
- package/src/perspectives/PerspectiveClient.ts +1 -0
- package/src/perspectives/PerspectiveHandle.ts +3 -0
- package/src/perspectives/PerspectiveProxy.ts +4 -0
- package/src/runtime/RuntimeClient.ts +81 -1
- package/src/runtime/RuntimeResolver.ts +130 -0
package/lib/index.js
CHANGED
|
@@ -4067,6 +4067,29 @@ AuthInfoInput = __decorate$b([
|
|
|
4067
4067
|
InputType(),
|
|
4068
4068
|
__metadata$b("design:paramtypes", [String, String, String, String, String, Array])
|
|
4069
4069
|
], AuthInfoInput);
|
|
4070
|
+
let UserCreationResult = class UserCreationResult {
|
|
4071
|
+
constructor(did, success, error) {
|
|
4072
|
+
this.did = did;
|
|
4073
|
+
this.success = success;
|
|
4074
|
+
this.error = error;
|
|
4075
|
+
}
|
|
4076
|
+
};
|
|
4077
|
+
__decorate$b([
|
|
4078
|
+
Field(),
|
|
4079
|
+
__metadata$b("design:type", String)
|
|
4080
|
+
], UserCreationResult.prototype, "did", void 0);
|
|
4081
|
+
__decorate$b([
|
|
4082
|
+
Field(),
|
|
4083
|
+
__metadata$b("design:type", Boolean)
|
|
4084
|
+
], UserCreationResult.prototype, "success", void 0);
|
|
4085
|
+
__decorate$b([
|
|
4086
|
+
Field(),
|
|
4087
|
+
__metadata$b("design:type", String)
|
|
4088
|
+
], UserCreationResult.prototype, "error", void 0);
|
|
4089
|
+
UserCreationResult = __decorate$b([
|
|
4090
|
+
ObjectType(),
|
|
4091
|
+
__metadata$b("design:paramtypes", [String, Boolean, String])
|
|
4092
|
+
], UserCreationResult);
|
|
4070
4093
|
|
|
4071
4094
|
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
4072
4095
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -4946,6 +4969,7 @@ class PerspectiveProxy {
|
|
|
4946
4969
|
__classPrivateFieldSet$a(this, _PerspectiveProxy_client, ad4m, "f");
|
|
4947
4970
|
this.uuid = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid;
|
|
4948
4971
|
this.name = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").name;
|
|
4972
|
+
this.owners = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").owners;
|
|
4949
4973
|
this.sharedUrl = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").sharedUrl;
|
|
4950
4974
|
this.neighbourhood = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").neighbourhood;
|
|
4951
4975
|
this.state = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").state;
|
|
@@ -5860,6 +5884,7 @@ uuid
|
|
|
5860
5884
|
name
|
|
5861
5885
|
sharedUrl
|
|
5862
5886
|
state
|
|
5887
|
+
owners
|
|
5863
5888
|
neighbourhood {
|
|
5864
5889
|
data {
|
|
5865
5890
|
linkLanguage
|
|
@@ -6856,6 +6881,51 @@ class AgentClient {
|
|
|
6856
6881
|
}));
|
|
6857
6882
|
return agentSignMessage;
|
|
6858
6883
|
}
|
|
6884
|
+
// Multi-user methods
|
|
6885
|
+
async createUser(email, password, appInfo) {
|
|
6886
|
+
const { runtimeCreateUser } = unwrapApolloResult(await __classPrivateFieldGet$8(this, _AgentClient_apolloClient, "f").mutate({
|
|
6887
|
+
mutation: gql `mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
|
|
6888
|
+
runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
|
|
6889
|
+
did
|
|
6890
|
+
success
|
|
6891
|
+
error
|
|
6892
|
+
}
|
|
6893
|
+
}`,
|
|
6894
|
+
variables: { email, password, appInfo },
|
|
6895
|
+
}));
|
|
6896
|
+
return runtimeCreateUser;
|
|
6897
|
+
}
|
|
6898
|
+
async loginUser(email, password) {
|
|
6899
|
+
const { runtimeLoginUser } = unwrapApolloResult(await __classPrivateFieldGet$8(this, _AgentClient_apolloClient, "f").mutate({
|
|
6900
|
+
mutation: gql `mutation runtimeLoginUser($email: String!, $password: String!) {
|
|
6901
|
+
runtimeLoginUser(email: $email, password: $password)
|
|
6902
|
+
}`,
|
|
6903
|
+
variables: { email, password },
|
|
6904
|
+
}));
|
|
6905
|
+
return runtimeLoginUser;
|
|
6906
|
+
}
|
|
6907
|
+
async requestLoginVerification(email, appInfo) {
|
|
6908
|
+
const { runtimeRequestLoginVerification } = unwrapApolloResult(await __classPrivateFieldGet$8(this, _AgentClient_apolloClient, "f").mutate({
|
|
6909
|
+
mutation: gql `mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
|
|
6910
|
+
runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
|
|
6911
|
+
success
|
|
6912
|
+
message
|
|
6913
|
+
requiresPassword
|
|
6914
|
+
}
|
|
6915
|
+
}`,
|
|
6916
|
+
variables: { email, appInfo },
|
|
6917
|
+
}));
|
|
6918
|
+
return runtimeRequestLoginVerification;
|
|
6919
|
+
}
|
|
6920
|
+
async verifyEmailCode(email, code, verificationType) {
|
|
6921
|
+
const { runtimeVerifyEmailCode } = unwrapApolloResult(await __classPrivateFieldGet$8(this, _AgentClient_apolloClient, "f").mutate({
|
|
6922
|
+
mutation: gql `mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
|
|
6923
|
+
runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
|
|
6924
|
+
}`,
|
|
6925
|
+
variables: { email, code, verificationType },
|
|
6926
|
+
}));
|
|
6927
|
+
return runtimeVerifyEmailCode;
|
|
6928
|
+
}
|
|
6859
6929
|
}
|
|
6860
6930
|
_AgentClient_apolloClient = new WeakMap(), _AgentClient_appsChangedCallback = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap();
|
|
6861
6931
|
|
|
@@ -7604,6 +7674,78 @@ class RuntimeClient {
|
|
|
7604
7674
|
}));
|
|
7605
7675
|
return runtimeImportPerspective;
|
|
7606
7676
|
}
|
|
7677
|
+
async multiUserEnabled() {
|
|
7678
|
+
const { runtimeMultiUserEnabled } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").query({
|
|
7679
|
+
query: gql `query runtimeMultiUserEnabled {
|
|
7680
|
+
runtimeMultiUserEnabled
|
|
7681
|
+
}`,
|
|
7682
|
+
}));
|
|
7683
|
+
return runtimeMultiUserEnabled;
|
|
7684
|
+
}
|
|
7685
|
+
async setMultiUserEnabled(enabled) {
|
|
7686
|
+
const { runtimeSetMultiUserEnabled } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
7687
|
+
mutation: gql `mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
|
|
7688
|
+
runtimeSetMultiUserEnabled(enabled: $enabled)
|
|
7689
|
+
}`,
|
|
7690
|
+
variables: { enabled }
|
|
7691
|
+
}));
|
|
7692
|
+
return runtimeSetMultiUserEnabled;
|
|
7693
|
+
}
|
|
7694
|
+
async listUsers() {
|
|
7695
|
+
const { runtimeListUsers } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").query({
|
|
7696
|
+
query: gql `query runtimeListUsers {
|
|
7697
|
+
runtimeListUsers {
|
|
7698
|
+
email
|
|
7699
|
+
did
|
|
7700
|
+
lastSeen
|
|
7701
|
+
perspectiveCount
|
|
7702
|
+
}
|
|
7703
|
+
}`
|
|
7704
|
+
}));
|
|
7705
|
+
return runtimeListUsers;
|
|
7706
|
+
}
|
|
7707
|
+
async emailTestModeEnable() {
|
|
7708
|
+
const { runtimeEmailTestModeEnable } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
7709
|
+
mutation: gql `mutation runtimeEmailTestModeEnable {
|
|
7710
|
+
runtimeEmailTestModeEnable
|
|
7711
|
+
}`
|
|
7712
|
+
}));
|
|
7713
|
+
return runtimeEmailTestModeEnable;
|
|
7714
|
+
}
|
|
7715
|
+
async emailTestModeDisable() {
|
|
7716
|
+
const { runtimeEmailTestModeDisable } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
7717
|
+
mutation: gql `mutation runtimeEmailTestModeDisable {
|
|
7718
|
+
runtimeEmailTestModeDisable
|
|
7719
|
+
}`
|
|
7720
|
+
}));
|
|
7721
|
+
return runtimeEmailTestModeDisable;
|
|
7722
|
+
}
|
|
7723
|
+
async emailTestGetCode(email) {
|
|
7724
|
+
const { runtimeEmailTestGetCode } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
7725
|
+
mutation: gql `mutation runtimeEmailTestGetCode($email: String!) {
|
|
7726
|
+
runtimeEmailTestGetCode(email: $email)
|
|
7727
|
+
}`,
|
|
7728
|
+
variables: { email }
|
|
7729
|
+
}));
|
|
7730
|
+
return runtimeEmailTestGetCode;
|
|
7731
|
+
}
|
|
7732
|
+
async emailTestClearCodes() {
|
|
7733
|
+
const { runtimeEmailTestClearCodes } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
7734
|
+
mutation: gql `mutation runtimeEmailTestClearCodes {
|
|
7735
|
+
runtimeEmailTestClearCodes
|
|
7736
|
+
}`
|
|
7737
|
+
}));
|
|
7738
|
+
return runtimeEmailTestClearCodes;
|
|
7739
|
+
}
|
|
7740
|
+
async emailTestSetExpiry(email, verificationType, expiresAt) {
|
|
7741
|
+
const { runtimeEmailTestSetExpiry } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
7742
|
+
mutation: gql `mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
|
|
7743
|
+
runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
|
|
7744
|
+
}`,
|
|
7745
|
+
variables: { email, verificationType, expiresAt }
|
|
7746
|
+
}));
|
|
7747
|
+
return runtimeEmailTestSetExpiry;
|
|
7748
|
+
}
|
|
7607
7749
|
addNotificationTriggeredCallback(cb) {
|
|
7608
7750
|
__classPrivateFieldGet$5(this, _RuntimeClient_notificationTriggeredCallbacks, "f").push(cb);
|
|
7609
7751
|
}
|
|
@@ -15729,6 +15871,10 @@ __decorate$2([
|
|
|
15729
15871
|
Field(),
|
|
15730
15872
|
__metadata$2("design:type", NeighbourhoodExpression)
|
|
15731
15873
|
], PerspectiveHandle.prototype, "neighbourhood", void 0);
|
|
15874
|
+
__decorate$2([
|
|
15875
|
+
Field(),
|
|
15876
|
+
__metadata$2("design:type", Array)
|
|
15877
|
+
], PerspectiveHandle.prototype, "owners", void 0);
|
|
15732
15878
|
PerspectiveHandle = __decorate$2([
|
|
15733
15879
|
ObjectType(),
|
|
15734
15880
|
__metadata$2("design:paramtypes", [String, String, String])
|
|
@@ -16871,6 +17017,12 @@ type Mutation {
|
|
|
16871
17017
|
perspectiveUpdateLink(batchId: String, newLink: LinkInput!, oldLink: LinkExpressionInput!, uuid: String!): LinkExpression!
|
|
16872
17018
|
runtimeAddFriends(dids: [String!]!): [String!]!
|
|
16873
17019
|
runtimeAddKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
|
|
17020
|
+
runtimeCreateUser(appInfo: AuthInfoInput, email: String!, password: String!): UserCreationResult!
|
|
17021
|
+
runtimeEmailTestClearCodes: Boolean!
|
|
17022
|
+
runtimeEmailTestGetCode(email: String!): String
|
|
17023
|
+
runtimeEmailTestModeDisable: Boolean!
|
|
17024
|
+
runtimeEmailTestModeEnable: Boolean!
|
|
17025
|
+
runtimeEmailTestSetExpiry(email: String!, expiresAt: Float!, verificationType: String!): Boolean!
|
|
16874
17026
|
runtimeExportDb(filePath: String!): Boolean!
|
|
16875
17027
|
runtimeExportPerspective(filePath: String!, perspectiveUuid: String!): Boolean!
|
|
16876
17028
|
runtimeFriendSendMessage(did: String!, message: PerspectiveInput!): Boolean!
|
|
@@ -16878,15 +17030,20 @@ type Mutation {
|
|
|
16878
17030
|
runtimeHcAddAgentInfos(agentInfos: String!): Boolean!
|
|
16879
17031
|
runtimeImportDb(filePath: String!): Boolean!
|
|
16880
17032
|
runtimeImportPerspective(filePath: String!): Boolean!
|
|
17033
|
+
runtimeLoginUser(email: String!, password: String!): String!
|
|
16881
17034
|
runtimeOpenLink(url: String!): Boolean!
|
|
16882
17035
|
runtimeQuit: Boolean!
|
|
16883
17036
|
runtimeRemoveFriends(dids: [String!]!): [String!]!
|
|
16884
17037
|
runtimeRemoveKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
|
|
16885
17038
|
runtimeRemoveNotification(id: String!): Boolean!
|
|
16886
17039
|
runtimeRequestInstallNotification(notification: NotificationInput!): String!
|
|
17040
|
+
runtimeRequestLoginVerification(appInfo: AuthInfoInput, email: String!): VerificationRequestResult!
|
|
16887
17041
|
runtimeRestartHolochain: Boolean!
|
|
17042
|
+
runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
|
|
16888
17043
|
runtimeSetStatus(status: PerspectiveInput!): Boolean!
|
|
17044
|
+
runtimeTestEmail(to: String!): Boolean!
|
|
16889
17045
|
runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
|
|
17046
|
+
runtimeVerifyEmailCode(code: String!, email: String!, verificationType: String!): String!
|
|
16890
17047
|
}
|
|
16891
17048
|
|
|
16892
17049
|
type Neighbourhood {
|
|
@@ -16944,6 +17101,7 @@ type PerspectiveExpression {
|
|
|
16944
17101
|
type PerspectiveHandle {
|
|
16945
17102
|
name: String!
|
|
16946
17103
|
neighbourhood: NeighbourhoodExpression
|
|
17104
|
+
owners: [String!]
|
|
16947
17105
|
sharedUrl: String
|
|
16948
17106
|
state: String!
|
|
16949
17107
|
uuid: String!
|
|
@@ -16992,8 +17150,10 @@ type Query {
|
|
|
16992
17150
|
runtimeHcAgentInfos: String!
|
|
16993
17151
|
runtimeInfo: RuntimeInfo!
|
|
16994
17152
|
runtimeKnownLinkLanguageTemplates: [String!]!
|
|
17153
|
+
runtimeListUsers: [UserStatistics!]!
|
|
16995
17154
|
runtimeMessageInbox(filter: String): [PerspectiveExpression!]!
|
|
16996
17155
|
runtimeMessageOutbox(filter: String): [SentMessage!]!
|
|
17156
|
+
runtimeMultiUserEnabled: Boolean!
|
|
16997
17157
|
runtimeNotifications: [Notification!]!
|
|
16998
17158
|
runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
|
|
16999
17159
|
}
|
|
@@ -17061,6 +17221,25 @@ type TriggeredNotification {
|
|
|
17061
17221
|
triggerMatch: String!
|
|
17062
17222
|
}
|
|
17063
17223
|
|
|
17224
|
+
type UserCreationResult {
|
|
17225
|
+
did: String!
|
|
17226
|
+
error: String
|
|
17227
|
+
success: Boolean!
|
|
17228
|
+
}
|
|
17229
|
+
|
|
17230
|
+
type UserStatistics {
|
|
17231
|
+
did: String!
|
|
17232
|
+
email: String!
|
|
17233
|
+
lastSeen: String
|
|
17234
|
+
perspectiveCount: Int!
|
|
17235
|
+
}
|
|
17236
|
+
|
|
17237
|
+
type VerificationRequestResult {
|
|
17238
|
+
message: String!
|
|
17239
|
+
requiresPassword: Boolean!
|
|
17240
|
+
success: Boolean!
|
|
17241
|
+
}
|
|
17242
|
+
|
|
17064
17243
|
input VoiceActivityParamsInput {
|
|
17065
17244
|
endThreshold: Float
|
|
17066
17245
|
endWindow: Float
|
|
@@ -17349,6 +17528,44 @@ __decorate([
|
|
|
17349
17528
|
ImportResult = __decorate([
|
|
17350
17529
|
ObjectType()
|
|
17351
17530
|
], ImportResult);
|
|
17531
|
+
let UserStatistics = class UserStatistics {
|
|
17532
|
+
};
|
|
17533
|
+
__decorate([
|
|
17534
|
+
Field(),
|
|
17535
|
+
__metadata("design:type", String)
|
|
17536
|
+
], UserStatistics.prototype, "email", void 0);
|
|
17537
|
+
__decorate([
|
|
17538
|
+
Field(),
|
|
17539
|
+
__metadata("design:type", String)
|
|
17540
|
+
], UserStatistics.prototype, "did", void 0);
|
|
17541
|
+
__decorate([
|
|
17542
|
+
Field(),
|
|
17543
|
+
__metadata("design:type", String)
|
|
17544
|
+
], UserStatistics.prototype, "lastSeen", void 0);
|
|
17545
|
+
__decorate([
|
|
17546
|
+
Field(),
|
|
17547
|
+
__metadata("design:type", Number)
|
|
17548
|
+
], UserStatistics.prototype, "perspectiveCount", void 0);
|
|
17549
|
+
UserStatistics = __decorate([
|
|
17550
|
+
ObjectType()
|
|
17551
|
+
], UserStatistics);
|
|
17552
|
+
let VerificationRequestResult = class VerificationRequestResult {
|
|
17553
|
+
};
|
|
17554
|
+
__decorate([
|
|
17555
|
+
Field(),
|
|
17556
|
+
__metadata("design:type", Boolean)
|
|
17557
|
+
], VerificationRequestResult.prototype, "success", void 0);
|
|
17558
|
+
__decorate([
|
|
17559
|
+
Field(),
|
|
17560
|
+
__metadata("design:type", String)
|
|
17561
|
+
], VerificationRequestResult.prototype, "message", void 0);
|
|
17562
|
+
__decorate([
|
|
17563
|
+
Field(),
|
|
17564
|
+
__metadata("design:type", Boolean)
|
|
17565
|
+
], VerificationRequestResult.prototype, "requiresPassword", void 0);
|
|
17566
|
+
VerificationRequestResult = __decorate([
|
|
17567
|
+
ObjectType()
|
|
17568
|
+
], VerificationRequestResult);
|
|
17352
17569
|
/**
|
|
17353
17570
|
* Resolver classes are used here to define the GraphQL schema
|
|
17354
17571
|
* (through the type-graphql annotations)
|
|
@@ -17498,6 +17715,64 @@ let RuntimeResolver = class RuntimeResolver {
|
|
|
17498
17715
|
runtimeImportPerspective(filePath) {
|
|
17499
17716
|
return true;
|
|
17500
17717
|
}
|
|
17718
|
+
runtimeMultiUserEnabled() {
|
|
17719
|
+
return false;
|
|
17720
|
+
}
|
|
17721
|
+
runtimeSetMultiUserEnabled(enabled) {
|
|
17722
|
+
return enabled;
|
|
17723
|
+
}
|
|
17724
|
+
runtimeListUsers() {
|
|
17725
|
+
return [{
|
|
17726
|
+
email: "test@example.com",
|
|
17727
|
+
did: "did:key:test123",
|
|
17728
|
+
lastSeen: new Date().toISOString(),
|
|
17729
|
+
perspectiveCount: 5
|
|
17730
|
+
}];
|
|
17731
|
+
}
|
|
17732
|
+
runtimeRequestLoginVerification(email, appInfo) {
|
|
17733
|
+
// For testing: simulate existing user
|
|
17734
|
+
return {
|
|
17735
|
+
success: true,
|
|
17736
|
+
message: "Verification email sent",
|
|
17737
|
+
requiresPassword: false
|
|
17738
|
+
};
|
|
17739
|
+
}
|
|
17740
|
+
runtimeVerifyEmailCode(email, code, verificationType) {
|
|
17741
|
+
// For testing: return a test JWT token
|
|
17742
|
+
return "test-jwt-token-from-email-verification";
|
|
17743
|
+
}
|
|
17744
|
+
runtimeTestEmail(to) {
|
|
17745
|
+
// For testing: simulate successful email send
|
|
17746
|
+
return true;
|
|
17747
|
+
}
|
|
17748
|
+
runtimeCreateUser(email, password, appInfo) {
|
|
17749
|
+
// For testing: simulate successful user creation (email verification flow)
|
|
17750
|
+
return new UserCreationResult("did:key:test123", true);
|
|
17751
|
+
}
|
|
17752
|
+
runtimeLoginUser(email, password) {
|
|
17753
|
+
// For testing: return a test JWT token
|
|
17754
|
+
return "test-jwt-token-from-password-login";
|
|
17755
|
+
}
|
|
17756
|
+
runtimeEmailTestModeEnable() {
|
|
17757
|
+
// For testing: enable test mode
|
|
17758
|
+
return true;
|
|
17759
|
+
}
|
|
17760
|
+
runtimeEmailTestModeDisable() {
|
|
17761
|
+
// For testing: disable test mode
|
|
17762
|
+
return true;
|
|
17763
|
+
}
|
|
17764
|
+
runtimeEmailTestGetCode(email) {
|
|
17765
|
+
// For testing: return a mock code
|
|
17766
|
+
return "123456";
|
|
17767
|
+
}
|
|
17768
|
+
runtimeEmailTestClearCodes() {
|
|
17769
|
+
// For testing: clear codes
|
|
17770
|
+
return true;
|
|
17771
|
+
}
|
|
17772
|
+
runtimeEmailTestSetExpiry(email, verificationType, expiresAt) {
|
|
17773
|
+
// For testing: simulate setting expiry (no-op in mock)
|
|
17774
|
+
return true;
|
|
17775
|
+
}
|
|
17501
17776
|
};
|
|
17502
17777
|
__decorate([
|
|
17503
17778
|
Mutation(),
|
|
@@ -17731,6 +18006,100 @@ __decorate([
|
|
|
17731
18006
|
__metadata("design:paramtypes", [String]),
|
|
17732
18007
|
__metadata("design:returntype", Boolean)
|
|
17733
18008
|
], RuntimeResolver.prototype, "runtimeImportPerspective", null);
|
|
18009
|
+
__decorate([
|
|
18010
|
+
Query(),
|
|
18011
|
+
__metadata("design:type", Function),
|
|
18012
|
+
__metadata("design:paramtypes", []),
|
|
18013
|
+
__metadata("design:returntype", Boolean)
|
|
18014
|
+
], RuntimeResolver.prototype, "runtimeMultiUserEnabled", null);
|
|
18015
|
+
__decorate([
|
|
18016
|
+
Mutation(),
|
|
18017
|
+
__param(0, Arg()),
|
|
18018
|
+
__metadata("design:type", Function),
|
|
18019
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
18020
|
+
__metadata("design:returntype", Boolean)
|
|
18021
|
+
], RuntimeResolver.prototype, "runtimeSetMultiUserEnabled", null);
|
|
18022
|
+
__decorate([
|
|
18023
|
+
Query(),
|
|
18024
|
+
__metadata("design:type", Function),
|
|
18025
|
+
__metadata("design:paramtypes", []),
|
|
18026
|
+
__metadata("design:returntype", Array)
|
|
18027
|
+
], RuntimeResolver.prototype, "runtimeListUsers", null);
|
|
18028
|
+
__decorate([
|
|
18029
|
+
Mutation(),
|
|
18030
|
+
__param(0, Arg()),
|
|
18031
|
+
__param(1, Arg()),
|
|
18032
|
+
__metadata("design:type", Function),
|
|
18033
|
+
__metadata("design:paramtypes", [String, AuthInfoInput]),
|
|
18034
|
+
__metadata("design:returntype", VerificationRequestResult)
|
|
18035
|
+
], RuntimeResolver.prototype, "runtimeRequestLoginVerification", null);
|
|
18036
|
+
__decorate([
|
|
18037
|
+
Mutation(),
|
|
18038
|
+
__param(0, Arg()),
|
|
18039
|
+
__param(1, Arg()),
|
|
18040
|
+
__param(2, Arg()),
|
|
18041
|
+
__metadata("design:type", Function),
|
|
18042
|
+
__metadata("design:paramtypes", [String, String, String]),
|
|
18043
|
+
__metadata("design:returntype", String)
|
|
18044
|
+
], RuntimeResolver.prototype, "runtimeVerifyEmailCode", null);
|
|
18045
|
+
__decorate([
|
|
18046
|
+
Mutation(),
|
|
18047
|
+
__param(0, Arg()),
|
|
18048
|
+
__metadata("design:type", Function),
|
|
18049
|
+
__metadata("design:paramtypes", [String]),
|
|
18050
|
+
__metadata("design:returntype", Boolean)
|
|
18051
|
+
], RuntimeResolver.prototype, "runtimeTestEmail", null);
|
|
18052
|
+
__decorate([
|
|
18053
|
+
Mutation(),
|
|
18054
|
+
__param(0, Arg()),
|
|
18055
|
+
__param(1, Arg()),
|
|
18056
|
+
__param(2, Arg()),
|
|
18057
|
+
__metadata("design:type", Function),
|
|
18058
|
+
__metadata("design:paramtypes", [String, String, AuthInfoInput]),
|
|
18059
|
+
__metadata("design:returntype", UserCreationResult)
|
|
18060
|
+
], RuntimeResolver.prototype, "runtimeCreateUser", null);
|
|
18061
|
+
__decorate([
|
|
18062
|
+
Mutation(),
|
|
18063
|
+
__param(0, Arg()),
|
|
18064
|
+
__param(1, Arg()),
|
|
18065
|
+
__metadata("design:type", Function),
|
|
18066
|
+
__metadata("design:paramtypes", [String, String]),
|
|
18067
|
+
__metadata("design:returntype", String)
|
|
18068
|
+
], RuntimeResolver.prototype, "runtimeLoginUser", null);
|
|
18069
|
+
__decorate([
|
|
18070
|
+
Mutation(),
|
|
18071
|
+
__metadata("design:type", Function),
|
|
18072
|
+
__metadata("design:paramtypes", []),
|
|
18073
|
+
__metadata("design:returntype", Boolean)
|
|
18074
|
+
], RuntimeResolver.prototype, "runtimeEmailTestModeEnable", null);
|
|
18075
|
+
__decorate([
|
|
18076
|
+
Mutation(),
|
|
18077
|
+
__metadata("design:type", Function),
|
|
18078
|
+
__metadata("design:paramtypes", []),
|
|
18079
|
+
__metadata("design:returntype", Boolean)
|
|
18080
|
+
], RuntimeResolver.prototype, "runtimeEmailTestModeDisable", null);
|
|
18081
|
+
__decorate([
|
|
18082
|
+
Mutation(),
|
|
18083
|
+
__param(0, Arg()),
|
|
18084
|
+
__metadata("design:type", Function),
|
|
18085
|
+
__metadata("design:paramtypes", [String]),
|
|
18086
|
+
__metadata("design:returntype", String)
|
|
18087
|
+
], RuntimeResolver.prototype, "runtimeEmailTestGetCode", null);
|
|
18088
|
+
__decorate([
|
|
18089
|
+
Mutation(),
|
|
18090
|
+
__metadata("design:type", Function),
|
|
18091
|
+
__metadata("design:paramtypes", []),
|
|
18092
|
+
__metadata("design:returntype", Boolean)
|
|
18093
|
+
], RuntimeResolver.prototype, "runtimeEmailTestClearCodes", null);
|
|
18094
|
+
__decorate([
|
|
18095
|
+
Mutation(),
|
|
18096
|
+
__param(0, Arg()),
|
|
18097
|
+
__param(1, Arg()),
|
|
18098
|
+
__param(2, Arg()),
|
|
18099
|
+
__metadata("design:type", Function),
|
|
18100
|
+
__metadata("design:paramtypes", [String, String, Number]),
|
|
18101
|
+
__metadata("design:returntype", Boolean)
|
|
18102
|
+
], RuntimeResolver.prototype, "runtimeEmailTestSetExpiry", null);
|
|
17734
18103
|
RuntimeResolver = __decorate([
|
|
17735
18104
|
Resolver()
|
|
17736
18105
|
], RuntimeResolver);
|
|
@@ -20316,4 +20685,4 @@ class ModelQueryBuilder {
|
|
|
20316
20685
|
}
|
|
20317
20686
|
}
|
|
20318
20687
|
|
|
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 };
|
|
20688
|
+
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, UserCreationResult, UserStatistics, VerificationRequestResult, addLink, capSentence, exprRef2String, formatList, hasLink, isExpression, isLink, linkEqual, makeRandomPrologAtom, parseExprUrl, typeDefsString };
|
package/lib/src/agent/Agent.d.ts
CHANGED
|
@@ -101,4 +101,10 @@ 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 UserCreationResult {
|
|
105
|
+
did: string;
|
|
106
|
+
success: boolean;
|
|
107
|
+
error?: string;
|
|
108
|
+
constructor(did: string, success: boolean, error?: string);
|
|
109
|
+
}
|
|
104
110
|
export {};
|
package/lib/src/agent/Agent.js
CHANGED
|
@@ -335,3 +335,27 @@ AuthInfoInput = __decorate([
|
|
|
335
335
|
__metadata("design:paramtypes", [String, String, String, String, String, Array])
|
|
336
336
|
], AuthInfoInput);
|
|
337
337
|
export { AuthInfoInput };
|
|
338
|
+
let UserCreationResult = class UserCreationResult {
|
|
339
|
+
constructor(did, success, error) {
|
|
340
|
+
this.did = did;
|
|
341
|
+
this.success = success;
|
|
342
|
+
this.error = error;
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
__decorate([
|
|
346
|
+
Field(),
|
|
347
|
+
__metadata("design:type", String)
|
|
348
|
+
], UserCreationResult.prototype, "did", void 0);
|
|
349
|
+
__decorate([
|
|
350
|
+
Field(),
|
|
351
|
+
__metadata("design:type", Boolean)
|
|
352
|
+
], UserCreationResult.prototype, "success", void 0);
|
|
353
|
+
__decorate([
|
|
354
|
+
Field({ nullable: true }),
|
|
355
|
+
__metadata("design:type", String)
|
|
356
|
+
], UserCreationResult.prototype, "error", void 0);
|
|
357
|
+
UserCreationResult = __decorate([
|
|
358
|
+
ObjectType(),
|
|
359
|
+
__metadata("design:paramtypes", [String, Boolean, String])
|
|
360
|
+
], UserCreationResult);
|
|
361
|
+
export { UserCreationResult };
|
|
@@ -1,8 +1,9 @@
|
|
|
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
|
+
import { VerificationRequestResult } from "../runtime/RuntimeResolver";
|
|
6
7
|
export interface InitializeArgs {
|
|
7
8
|
did: string;
|
|
8
9
|
didDocument: string;
|
|
@@ -54,4 +55,8 @@ export declare class AgentClient {
|
|
|
54
55
|
revokeToken(requestId: string): Promise<Apps[]>;
|
|
55
56
|
isLocked(): Promise<boolean>;
|
|
56
57
|
signMessage(message: string): Promise<string>;
|
|
58
|
+
createUser(email: string, password: string, appInfo?: AuthInfoInput): Promise<UserCreationResult>;
|
|
59
|
+
loginUser(email: string, password: string): Promise<string>;
|
|
60
|
+
requestLoginVerification(email: string, appInfo?: AuthInfoInput): Promise<VerificationRequestResult>;
|
|
61
|
+
verifyEmailCode(email: string, code: string, verificationType: string): Promise<string>;
|
|
57
62
|
}
|
|
@@ -427,5 +427,50 @@ export class AgentClient {
|
|
|
427
427
|
}));
|
|
428
428
|
return agentSignMessage;
|
|
429
429
|
}
|
|
430
|
+
// Multi-user methods
|
|
431
|
+
async createUser(email, password, appInfo) {
|
|
432
|
+
const { runtimeCreateUser } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
|
|
433
|
+
mutation: gql `mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
|
|
434
|
+
runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
|
|
435
|
+
did
|
|
436
|
+
success
|
|
437
|
+
error
|
|
438
|
+
}
|
|
439
|
+
}`,
|
|
440
|
+
variables: { email, password, appInfo },
|
|
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
|
+
}
|
|
453
|
+
async requestLoginVerification(email, appInfo) {
|
|
454
|
+
const { runtimeRequestLoginVerification } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
|
|
455
|
+
mutation: gql `mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
|
|
456
|
+
runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
|
|
457
|
+
success
|
|
458
|
+
message
|
|
459
|
+
requiresPassword
|
|
460
|
+
}
|
|
461
|
+
}`,
|
|
462
|
+
variables: { email, appInfo },
|
|
463
|
+
}));
|
|
464
|
+
return runtimeRequestLoginVerification;
|
|
465
|
+
}
|
|
466
|
+
async verifyEmailCode(email, code, verificationType) {
|
|
467
|
+
const { runtimeVerifyEmailCode } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
|
|
468
|
+
mutation: gql `mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
|
|
469
|
+
runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
|
|
470
|
+
}`,
|
|
471
|
+
variables: { email, code, verificationType },
|
|
472
|
+
}));
|
|
473
|
+
return runtimeVerifyEmailCode;
|
|
474
|
+
}
|
|
430
475
|
}
|
|
431
476
|
_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[]>;
|
|
@@ -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;
|