@coasys/ad4m 0.11.0 → 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 +216 -18
- package/lib/index.js +217 -19
- package/lib/src/agent/Agent.d.ts +12 -0
- package/lib/src/agent/Agent.js +48 -0
- package/lib/src/agent/AgentClient.d.ts +3 -1
- package/lib/src/agent/AgentClient.js +23 -0
- package/lib/src/language/Language.d.ts +12 -1
- package/lib/src/model/Ad4mModel.js +46 -18
- 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 +4 -1
- package/lib/src/runtime/RuntimeClient.js +30 -0
- package/lib/src/runtime/RuntimeResolver.d.ts +9 -0
- package/lib/src/runtime/RuntimeResolver.js +55 -0
- package/lib/src/schema.gql +11 -0
- package/lib/src/typeDefs.js +11 -0
- package/package.json +1 -2
- package/src/agent/Agent.ts +36 -0
- package/src/agent/AgentClient.ts +30 -0
- package/src/language/Language.ts +16 -4
- package/src/model/Ad4mModel.ts +41 -17
- 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 +34 -1
- package/src/runtime/RuntimeResolver.ts +35 -0
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);
|
|
@@ -18846,27 +19016,55 @@ WHERE ${whereConditions.join(' AND ')}
|
|
|
18846
19016
|
const isEmptyObject = typeof currentValue === 'object' && currentValue !== null && !Array.isArray(currentValue) && Object.keys(currentValue).length === 0;
|
|
18847
19017
|
if (!currentValue || currentValue === "" || currentValue === 0 || isEmptyObject) {
|
|
18848
19018
|
let convertedValue = target;
|
|
18849
|
-
//
|
|
18850
|
-
if (
|
|
18851
|
-
|
|
18852
|
-
|
|
18853
|
-
|
|
18854
|
-
|
|
19019
|
+
// Only process if target has a value
|
|
19020
|
+
if (target !== undefined && target !== null) {
|
|
19021
|
+
// Check if we need to resolve a non-literal language expression
|
|
19022
|
+
if (propMeta.resolveLanguage != undefined && propMeta.resolveLanguage !== 'literal' && typeof target === 'string') {
|
|
19023
|
+
// For non-literal languages, resolve the expression via perspective.getExpression()
|
|
19024
|
+
// Note: Literals are already parsed by SurrealDB's fn::parse_literal()
|
|
19025
|
+
try {
|
|
19026
|
+
const expression = await perspective.getExpression(target);
|
|
19027
|
+
if (expression) {
|
|
19028
|
+
// Parse the expression data if it's a JSON string
|
|
19029
|
+
try {
|
|
19030
|
+
convertedValue = JSON.parse(expression.data);
|
|
19031
|
+
}
|
|
19032
|
+
catch {
|
|
19033
|
+
// If parsing fails, use the data as-is
|
|
19034
|
+
convertedValue = expression.data;
|
|
19035
|
+
}
|
|
19036
|
+
}
|
|
19037
|
+
}
|
|
19038
|
+
catch (e) {
|
|
19039
|
+
console.warn(`Failed to resolve expression for ${propName}:`, e);
|
|
19040
|
+
convertedValue = target; // Fall back to raw value
|
|
18855
19041
|
}
|
|
18856
19042
|
}
|
|
18857
|
-
|
|
18858
|
-
|
|
18859
|
-
|
|
18860
|
-
|
|
18861
|
-
|
|
18862
|
-
|
|
18863
|
-
|
|
18864
|
-
|
|
18865
|
-
|
|
18866
|
-
|
|
19043
|
+
else if (typeof target === 'string' && target.startsWith('literal://')) {
|
|
19044
|
+
// Fallback: If we somehow got a literal URL that wasn't parsed by SurrealDB, parse it now
|
|
19045
|
+
try {
|
|
19046
|
+
const parsed = Literal.fromUrl(target).get();
|
|
19047
|
+
if (parsed.data !== undefined) {
|
|
19048
|
+
convertedValue = parsed.data;
|
|
19049
|
+
}
|
|
19050
|
+
else {
|
|
19051
|
+
convertedValue = parsed;
|
|
19052
|
+
}
|
|
19053
|
+
}
|
|
19054
|
+
catch (e) {
|
|
19055
|
+
// If literal parsing fails, just use the value as-is (don't bail)
|
|
19056
|
+
convertedValue = target;
|
|
19057
|
+
}
|
|
18867
19058
|
}
|
|
18868
|
-
else if (
|
|
18869
|
-
|
|
19059
|
+
else if (typeof target === 'string') {
|
|
19060
|
+
// Type conversion: check the instance property's current type
|
|
19061
|
+
const expectedType = typeof instance[propName];
|
|
19062
|
+
if (expectedType === 'number') {
|
|
19063
|
+
convertedValue = Number(target);
|
|
19064
|
+
}
|
|
19065
|
+
else if (expectedType === 'boolean') {
|
|
19066
|
+
convertedValue = target === 'true' || target === '1';
|
|
19067
|
+
}
|
|
18870
19068
|
}
|
|
18871
19069
|
}
|
|
18872
19070
|
// Apply transform function if it exists
|
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);
|
|
@@ -18842,27 +19012,55 @@ WHERE ${whereConditions.join(' AND ')}
|
|
|
18842
19012
|
const isEmptyObject = typeof currentValue === 'object' && currentValue !== null && !Array.isArray(currentValue) && Object.keys(currentValue).length === 0;
|
|
18843
19013
|
if (!currentValue || currentValue === "" || currentValue === 0 || isEmptyObject) {
|
|
18844
19014
|
let convertedValue = target;
|
|
18845
|
-
//
|
|
18846
|
-
if (
|
|
18847
|
-
|
|
18848
|
-
|
|
18849
|
-
|
|
18850
|
-
|
|
19015
|
+
// Only process if target has a value
|
|
19016
|
+
if (target !== undefined && target !== null) {
|
|
19017
|
+
// Check if we need to resolve a non-literal language expression
|
|
19018
|
+
if (propMeta.resolveLanguage != undefined && propMeta.resolveLanguage !== 'literal' && typeof target === 'string') {
|
|
19019
|
+
// For non-literal languages, resolve the expression via perspective.getExpression()
|
|
19020
|
+
// Note: Literals are already parsed by SurrealDB's fn::parse_literal()
|
|
19021
|
+
try {
|
|
19022
|
+
const expression = await perspective.getExpression(target);
|
|
19023
|
+
if (expression) {
|
|
19024
|
+
// Parse the expression data if it's a JSON string
|
|
19025
|
+
try {
|
|
19026
|
+
convertedValue = JSON.parse(expression.data);
|
|
19027
|
+
}
|
|
19028
|
+
catch {
|
|
19029
|
+
// If parsing fails, use the data as-is
|
|
19030
|
+
convertedValue = expression.data;
|
|
19031
|
+
}
|
|
19032
|
+
}
|
|
19033
|
+
}
|
|
19034
|
+
catch (e) {
|
|
19035
|
+
console.warn(`Failed to resolve expression for ${propName}:`, e);
|
|
19036
|
+
convertedValue = target; // Fall back to raw value
|
|
18851
19037
|
}
|
|
18852
19038
|
}
|
|
18853
|
-
|
|
18854
|
-
|
|
18855
|
-
|
|
18856
|
-
|
|
18857
|
-
|
|
18858
|
-
|
|
18859
|
-
|
|
18860
|
-
|
|
18861
|
-
|
|
18862
|
-
|
|
19039
|
+
else if (typeof target === 'string' && target.startsWith('literal://')) {
|
|
19040
|
+
// Fallback: If we somehow got a literal URL that wasn't parsed by SurrealDB, parse it now
|
|
19041
|
+
try {
|
|
19042
|
+
const parsed = Literal.fromUrl(target).get();
|
|
19043
|
+
if (parsed.data !== undefined) {
|
|
19044
|
+
convertedValue = parsed.data;
|
|
19045
|
+
}
|
|
19046
|
+
else {
|
|
19047
|
+
convertedValue = parsed;
|
|
19048
|
+
}
|
|
19049
|
+
}
|
|
19050
|
+
catch (e) {
|
|
19051
|
+
// If literal parsing fails, just use the value as-is (don't bail)
|
|
19052
|
+
convertedValue = target;
|
|
19053
|
+
}
|
|
18863
19054
|
}
|
|
18864
|
-
else if (
|
|
18865
|
-
|
|
19055
|
+
else if (typeof target === 'string') {
|
|
19056
|
+
// Type conversion: check the instance property's current type
|
|
19057
|
+
const expectedType = typeof instance[propName];
|
|
19058
|
+
if (expectedType === 'number') {
|
|
19059
|
+
convertedValue = Number(target);
|
|
19060
|
+
}
|
|
19061
|
+
else if (expectedType === 'boolean') {
|
|
19062
|
+
convertedValue = target === 'true' || target === '1';
|
|
19063
|
+
}
|
|
18866
19064
|
}
|
|
18867
19065
|
}
|
|
18868
19066
|
// Apply transform function if it exists
|
|
@@ -20288,4 +20486,4 @@ class ModelQueryBuilder {
|
|
|
20288
20486
|
}
|
|
20289
20487
|
}
|
|
20290
20488
|
|
|
20291
|
-
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 };
|