@coasys/ad4m 0.12.1-dev → 0.13.0-test-1
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 +75 -2
- package/lib/index.js +75 -2
- package/lib/src/agent/AgentClient.d.ts +3 -0
- package/lib/src/agent/AgentClient.js +27 -2
- package/lib/src/runtime/RuntimeClient.d.ts +2 -0
- package/lib/src/runtime/RuntimeClient.js +17 -0
- package/lib/src/runtime/RuntimeResolver.d.ts +3 -0
- package/lib/src/runtime/RuntimeResolver.js +28 -0
- package/lib/src/schema.gql +3 -0
- package/lib/src/typeDefs.js +3 -0
- package/package.json +1 -1
- package/src/agent/AgentClient.ts +28 -0
- package/src/runtime/RuntimeClient.ts +19 -0
- package/src/runtime/RuntimeResolver.ts +15 -0
package/lib/index.cjs
CHANGED
|
@@ -9376,7 +9376,7 @@ var __classPrivateFieldGet$7 = (undefined && undefined.__classPrivateFieldGet) |
|
|
|
9376
9376
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
9377
9377
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
9378
9378
|
};
|
|
9379
|
-
var _AgentClient_apolloClient, _AgentClient_appsChangedCallback, _AgentClient_updatedCallbacks, _AgentClient_agentStatusChangedCallbacks;
|
|
9379
|
+
var _AgentClient_apolloClient, _AgentClient_appsChangedCallback, _AgentClient_updatedCallbacks, _AgentClient_agentStatusChangedCallbacks, _AgentClient_hostingUserInfoChangedCallbacks;
|
|
9380
9380
|
const AGENT_SUBITEMS = `
|
|
9381
9381
|
did
|
|
9382
9382
|
directMessageLanguage
|
|
@@ -9439,10 +9439,12 @@ class AgentClient {
|
|
|
9439
9439
|
_AgentClient_appsChangedCallback.set(this, void 0);
|
|
9440
9440
|
_AgentClient_updatedCallbacks.set(this, void 0);
|
|
9441
9441
|
_AgentClient_agentStatusChangedCallbacks.set(this, void 0);
|
|
9442
|
+
_AgentClient_hostingUserInfoChangedCallbacks.set(this, void 0);
|
|
9442
9443
|
__classPrivateFieldSet$7(this, _AgentClient_apolloClient, client, "f");
|
|
9443
9444
|
__classPrivateFieldSet$7(this, _AgentClient_updatedCallbacks, [], "f");
|
|
9444
9445
|
__classPrivateFieldSet$7(this, _AgentClient_agentStatusChangedCallbacks, [], "f");
|
|
9445
9446
|
__classPrivateFieldSet$7(this, _AgentClient_appsChangedCallback, [], "f");
|
|
9447
|
+
__classPrivateFieldSet$7(this, _AgentClient_hostingUserInfoChangedCallbacks, [], "f");
|
|
9446
9448
|
if (subscribe) {
|
|
9447
9449
|
this.subscribeAgentUpdated();
|
|
9448
9450
|
this.subscribeAgentStatusChanged();
|
|
@@ -9703,6 +9705,29 @@ class AgentClient {
|
|
|
9703
9705
|
error: (e) => console.error(e),
|
|
9704
9706
|
});
|
|
9705
9707
|
}
|
|
9708
|
+
addHostingUserInfoChangedListener(listener) {
|
|
9709
|
+
__classPrivateFieldGet$7(this, _AgentClient_hostingUserInfoChangedCallbacks, "f").push(listener);
|
|
9710
|
+
}
|
|
9711
|
+
subscribeHostingUserInfoChanged() {
|
|
9712
|
+
__classPrivateFieldGet$7(this, _AgentClient_apolloClient, "f")
|
|
9713
|
+
.subscribe({
|
|
9714
|
+
query: gql `subscription {
|
|
9715
|
+
runtimeHostingUserInfoChanged {
|
|
9716
|
+
email
|
|
9717
|
+
remainingCredits
|
|
9718
|
+
hotWalletAddress
|
|
9719
|
+
freeAccess
|
|
9720
|
+
}
|
|
9721
|
+
}`,
|
|
9722
|
+
})
|
|
9723
|
+
.subscribe({
|
|
9724
|
+
next: (result) => {
|
|
9725
|
+
const info = result.data.runtimeHostingUserInfoChanged;
|
|
9726
|
+
__classPrivateFieldGet$7(this, _AgentClient_hostingUserInfoChangedCallbacks, "f").forEach((cb) => cb(info));
|
|
9727
|
+
},
|
|
9728
|
+
error: (e) => console.error(e),
|
|
9729
|
+
});
|
|
9730
|
+
}
|
|
9706
9731
|
async requestCapability(authInfo) {
|
|
9707
9732
|
const { agentRequestCapability } = unwrapApolloResult(await __classPrivateFieldGet$7(this, _AgentClient_apolloClient, "f").mutate({
|
|
9708
9733
|
mutation: gql `
|
|
@@ -9871,7 +9896,7 @@ class AgentClient {
|
|
|
9871
9896
|
return runtimeRequestPayment;
|
|
9872
9897
|
}
|
|
9873
9898
|
}
|
|
9874
|
-
_AgentClient_apolloClient = new WeakMap(), _AgentClient_appsChangedCallback = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap();
|
|
9899
|
+
_AgentClient_apolloClient = new WeakMap(), _AgentClient_appsChangedCallback = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap(), _AgentClient_hostingUserInfoChangedCallbacks = new WeakMap();
|
|
9875
9900
|
|
|
9876
9901
|
var __classPrivateFieldSet$6 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
9877
9902
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
@@ -10662,6 +10687,23 @@ class RuntimeClient {
|
|
|
10662
10687
|
}));
|
|
10663
10688
|
return runtimeSetMultiUserEnabled;
|
|
10664
10689
|
}
|
|
10690
|
+
async freeHostingEnabled() {
|
|
10691
|
+
const { runtimeFreeHostingEnabled } = unwrapApolloResult(await __classPrivateFieldGet$4(this, _RuntimeClient_apolloClient, "f").query({
|
|
10692
|
+
query: gql `query runtimeFreeHostingEnabled {
|
|
10693
|
+
runtimeFreeHostingEnabled
|
|
10694
|
+
}`
|
|
10695
|
+
}));
|
|
10696
|
+
return runtimeFreeHostingEnabled;
|
|
10697
|
+
}
|
|
10698
|
+
async setFreeHostingEnabled(enabled) {
|
|
10699
|
+
const { runtimeSetFreeHostingEnabled } = unwrapApolloResult(await __classPrivateFieldGet$4(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
10700
|
+
mutation: gql `mutation runtimeSetFreeHostingEnabled($enabled: Boolean!) {
|
|
10701
|
+
runtimeSetFreeHostingEnabled(enabled: $enabled)
|
|
10702
|
+
}`,
|
|
10703
|
+
variables: { enabled }
|
|
10704
|
+
}));
|
|
10705
|
+
return runtimeSetFreeHostingEnabled;
|
|
10706
|
+
}
|
|
10665
10707
|
async listUsers() {
|
|
10666
10708
|
const { runtimeListUsers } = unwrapApolloResult(await __classPrivateFieldGet$4(this, _RuntimeClient_apolloClient, "f").query({
|
|
10667
10709
|
query: gql `query runtimeListUsers {
|
|
@@ -23513,6 +23555,7 @@ type Mutation {
|
|
|
23513
23555
|
runtimeRequestPayment(amountHOT: String!): PaymentRequestResult!
|
|
23514
23556
|
runtimeRestartHolochain: Boolean!
|
|
23515
23557
|
runtimeSendHot(amount: String!, recipient: String!): PaymentRequestResult!
|
|
23558
|
+
runtimeSetFreeHostingEnabled(enabled: Boolean!): Boolean!
|
|
23516
23559
|
runtimeSetHotWalletAddress(address: String!): Boolean!
|
|
23517
23560
|
runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
|
|
23518
23561
|
runtimeSetStatus(status: PerspectiveInput!): Boolean!
|
|
@@ -23627,6 +23670,7 @@ type Query {
|
|
|
23627
23670
|
perspectiveQuerySurrealDB(query: String!, uuid: String!): String!
|
|
23628
23671
|
perspectiveSnapshot(uuid: String!): Perspective
|
|
23629
23672
|
perspectives: [PerspectiveHandle!]!
|
|
23673
|
+
runtimeFreeHostingEnabled: Boolean!
|
|
23630
23674
|
runtimeFriendStatus(did: String!): PerspectiveExpression
|
|
23631
23675
|
runtimeFriends: [String!]!
|
|
23632
23676
|
runtimeGetNetworkMetrics: String!
|
|
@@ -23642,6 +23686,7 @@ type Query {
|
|
|
23642
23686
|
runtimeMessageOutbox(filter: String): [SentMessage!]!
|
|
23643
23687
|
runtimeMultiUserEnabled: Boolean!
|
|
23644
23688
|
runtimeNotifications: [Notification!]!
|
|
23689
|
+
runtimeUnytAgentKey: String!
|
|
23645
23690
|
runtimeUnytVersionInfo: String!
|
|
23646
23691
|
runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
|
|
23647
23692
|
}
|
|
@@ -24254,6 +24299,12 @@ let RuntimeResolver = class RuntimeResolver {
|
|
|
24254
24299
|
runtimeSetMultiUserEnabled(enabled) {
|
|
24255
24300
|
return enabled;
|
|
24256
24301
|
}
|
|
24302
|
+
runtimeFreeHostingEnabled() {
|
|
24303
|
+
return true;
|
|
24304
|
+
}
|
|
24305
|
+
runtimeSetFreeHostingEnabled(enabled) {
|
|
24306
|
+
return enabled;
|
|
24307
|
+
}
|
|
24257
24308
|
runtimeListUsers() {
|
|
24258
24309
|
return [{
|
|
24259
24310
|
email: "test@example.com",
|
|
@@ -24343,6 +24394,9 @@ let RuntimeResolver = class RuntimeResolver {
|
|
|
24343
24394
|
runtimeHotAgentPubkey() {
|
|
24344
24395
|
return "";
|
|
24345
24396
|
}
|
|
24397
|
+
runtimeUnytAgentKey() {
|
|
24398
|
+
return "";
|
|
24399
|
+
}
|
|
24346
24400
|
runtimeUnytVersionInfo() {
|
|
24347
24401
|
return "";
|
|
24348
24402
|
}
|
|
@@ -24592,6 +24646,19 @@ __decorate([
|
|
|
24592
24646
|
__metadata("design:paramtypes", [Boolean]),
|
|
24593
24647
|
__metadata("design:returntype", Boolean)
|
|
24594
24648
|
], RuntimeResolver.prototype, "runtimeSetMultiUserEnabled", null);
|
|
24649
|
+
__decorate([
|
|
24650
|
+
Query(),
|
|
24651
|
+
__metadata("design:type", Function),
|
|
24652
|
+
__metadata("design:paramtypes", []),
|
|
24653
|
+
__metadata("design:returntype", Boolean)
|
|
24654
|
+
], RuntimeResolver.prototype, "runtimeFreeHostingEnabled", null);
|
|
24655
|
+
__decorate([
|
|
24656
|
+
Mutation(),
|
|
24657
|
+
__param(0, Arg()),
|
|
24658
|
+
__metadata("design:type", Function),
|
|
24659
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
24660
|
+
__metadata("design:returntype", Boolean)
|
|
24661
|
+
], RuntimeResolver.prototype, "runtimeSetFreeHostingEnabled", null);
|
|
24595
24662
|
__decorate([
|
|
24596
24663
|
Query(),
|
|
24597
24664
|
__metadata("design:type", Function),
|
|
@@ -24750,6 +24817,12 @@ __decorate([
|
|
|
24750
24817
|
__metadata("design:paramtypes", []),
|
|
24751
24818
|
__metadata("design:returntype", String)
|
|
24752
24819
|
], RuntimeResolver.prototype, "runtimeHotAgentPubkey", null);
|
|
24820
|
+
__decorate([
|
|
24821
|
+
Query(),
|
|
24822
|
+
__metadata("design:type", Function),
|
|
24823
|
+
__metadata("design:paramtypes", []),
|
|
24824
|
+
__metadata("design:returntype", String)
|
|
24825
|
+
], RuntimeResolver.prototype, "runtimeUnytAgentKey", null);
|
|
24753
24826
|
__decorate([
|
|
24754
24827
|
Query(),
|
|
24755
24828
|
__metadata("design:type", Function),
|
package/lib/index.js
CHANGED
|
@@ -9372,7 +9372,7 @@ var __classPrivateFieldGet$7 = (undefined && undefined.__classPrivateFieldGet) |
|
|
|
9372
9372
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
9373
9373
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
9374
9374
|
};
|
|
9375
|
-
var _AgentClient_apolloClient, _AgentClient_appsChangedCallback, _AgentClient_updatedCallbacks, _AgentClient_agentStatusChangedCallbacks;
|
|
9375
|
+
var _AgentClient_apolloClient, _AgentClient_appsChangedCallback, _AgentClient_updatedCallbacks, _AgentClient_agentStatusChangedCallbacks, _AgentClient_hostingUserInfoChangedCallbacks;
|
|
9376
9376
|
const AGENT_SUBITEMS = `
|
|
9377
9377
|
did
|
|
9378
9378
|
directMessageLanguage
|
|
@@ -9435,10 +9435,12 @@ class AgentClient {
|
|
|
9435
9435
|
_AgentClient_appsChangedCallback.set(this, void 0);
|
|
9436
9436
|
_AgentClient_updatedCallbacks.set(this, void 0);
|
|
9437
9437
|
_AgentClient_agentStatusChangedCallbacks.set(this, void 0);
|
|
9438
|
+
_AgentClient_hostingUserInfoChangedCallbacks.set(this, void 0);
|
|
9438
9439
|
__classPrivateFieldSet$7(this, _AgentClient_apolloClient, client, "f");
|
|
9439
9440
|
__classPrivateFieldSet$7(this, _AgentClient_updatedCallbacks, [], "f");
|
|
9440
9441
|
__classPrivateFieldSet$7(this, _AgentClient_agentStatusChangedCallbacks, [], "f");
|
|
9441
9442
|
__classPrivateFieldSet$7(this, _AgentClient_appsChangedCallback, [], "f");
|
|
9443
|
+
__classPrivateFieldSet$7(this, _AgentClient_hostingUserInfoChangedCallbacks, [], "f");
|
|
9442
9444
|
if (subscribe) {
|
|
9443
9445
|
this.subscribeAgentUpdated();
|
|
9444
9446
|
this.subscribeAgentStatusChanged();
|
|
@@ -9699,6 +9701,29 @@ class AgentClient {
|
|
|
9699
9701
|
error: (e) => console.error(e),
|
|
9700
9702
|
});
|
|
9701
9703
|
}
|
|
9704
|
+
addHostingUserInfoChangedListener(listener) {
|
|
9705
|
+
__classPrivateFieldGet$7(this, _AgentClient_hostingUserInfoChangedCallbacks, "f").push(listener);
|
|
9706
|
+
}
|
|
9707
|
+
subscribeHostingUserInfoChanged() {
|
|
9708
|
+
__classPrivateFieldGet$7(this, _AgentClient_apolloClient, "f")
|
|
9709
|
+
.subscribe({
|
|
9710
|
+
query: gql `subscription {
|
|
9711
|
+
runtimeHostingUserInfoChanged {
|
|
9712
|
+
email
|
|
9713
|
+
remainingCredits
|
|
9714
|
+
hotWalletAddress
|
|
9715
|
+
freeAccess
|
|
9716
|
+
}
|
|
9717
|
+
}`,
|
|
9718
|
+
})
|
|
9719
|
+
.subscribe({
|
|
9720
|
+
next: (result) => {
|
|
9721
|
+
const info = result.data.runtimeHostingUserInfoChanged;
|
|
9722
|
+
__classPrivateFieldGet$7(this, _AgentClient_hostingUserInfoChangedCallbacks, "f").forEach((cb) => cb(info));
|
|
9723
|
+
},
|
|
9724
|
+
error: (e) => console.error(e),
|
|
9725
|
+
});
|
|
9726
|
+
}
|
|
9702
9727
|
async requestCapability(authInfo) {
|
|
9703
9728
|
const { agentRequestCapability } = unwrapApolloResult(await __classPrivateFieldGet$7(this, _AgentClient_apolloClient, "f").mutate({
|
|
9704
9729
|
mutation: gql `
|
|
@@ -9867,7 +9892,7 @@ class AgentClient {
|
|
|
9867
9892
|
return runtimeRequestPayment;
|
|
9868
9893
|
}
|
|
9869
9894
|
}
|
|
9870
|
-
_AgentClient_apolloClient = new WeakMap(), _AgentClient_appsChangedCallback = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap();
|
|
9895
|
+
_AgentClient_apolloClient = new WeakMap(), _AgentClient_appsChangedCallback = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap(), _AgentClient_hostingUserInfoChangedCallbacks = new WeakMap();
|
|
9871
9896
|
|
|
9872
9897
|
var __classPrivateFieldSet$6 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
9873
9898
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
@@ -10658,6 +10683,23 @@ class RuntimeClient {
|
|
|
10658
10683
|
}));
|
|
10659
10684
|
return runtimeSetMultiUserEnabled;
|
|
10660
10685
|
}
|
|
10686
|
+
async freeHostingEnabled() {
|
|
10687
|
+
const { runtimeFreeHostingEnabled } = unwrapApolloResult(await __classPrivateFieldGet$4(this, _RuntimeClient_apolloClient, "f").query({
|
|
10688
|
+
query: gql `query runtimeFreeHostingEnabled {
|
|
10689
|
+
runtimeFreeHostingEnabled
|
|
10690
|
+
}`
|
|
10691
|
+
}));
|
|
10692
|
+
return runtimeFreeHostingEnabled;
|
|
10693
|
+
}
|
|
10694
|
+
async setFreeHostingEnabled(enabled) {
|
|
10695
|
+
const { runtimeSetFreeHostingEnabled } = unwrapApolloResult(await __classPrivateFieldGet$4(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
10696
|
+
mutation: gql `mutation runtimeSetFreeHostingEnabled($enabled: Boolean!) {
|
|
10697
|
+
runtimeSetFreeHostingEnabled(enabled: $enabled)
|
|
10698
|
+
}`,
|
|
10699
|
+
variables: { enabled }
|
|
10700
|
+
}));
|
|
10701
|
+
return runtimeSetFreeHostingEnabled;
|
|
10702
|
+
}
|
|
10661
10703
|
async listUsers() {
|
|
10662
10704
|
const { runtimeListUsers } = unwrapApolloResult(await __classPrivateFieldGet$4(this, _RuntimeClient_apolloClient, "f").query({
|
|
10663
10705
|
query: gql `query runtimeListUsers {
|
|
@@ -23509,6 +23551,7 @@ type Mutation {
|
|
|
23509
23551
|
runtimeRequestPayment(amountHOT: String!): PaymentRequestResult!
|
|
23510
23552
|
runtimeRestartHolochain: Boolean!
|
|
23511
23553
|
runtimeSendHot(amount: String!, recipient: String!): PaymentRequestResult!
|
|
23554
|
+
runtimeSetFreeHostingEnabled(enabled: Boolean!): Boolean!
|
|
23512
23555
|
runtimeSetHotWalletAddress(address: String!): Boolean!
|
|
23513
23556
|
runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
|
|
23514
23557
|
runtimeSetStatus(status: PerspectiveInput!): Boolean!
|
|
@@ -23623,6 +23666,7 @@ type Query {
|
|
|
23623
23666
|
perspectiveQuerySurrealDB(query: String!, uuid: String!): String!
|
|
23624
23667
|
perspectiveSnapshot(uuid: String!): Perspective
|
|
23625
23668
|
perspectives: [PerspectiveHandle!]!
|
|
23669
|
+
runtimeFreeHostingEnabled: Boolean!
|
|
23626
23670
|
runtimeFriendStatus(did: String!): PerspectiveExpression
|
|
23627
23671
|
runtimeFriends: [String!]!
|
|
23628
23672
|
runtimeGetNetworkMetrics: String!
|
|
@@ -23638,6 +23682,7 @@ type Query {
|
|
|
23638
23682
|
runtimeMessageOutbox(filter: String): [SentMessage!]!
|
|
23639
23683
|
runtimeMultiUserEnabled: Boolean!
|
|
23640
23684
|
runtimeNotifications: [Notification!]!
|
|
23685
|
+
runtimeUnytAgentKey: String!
|
|
23641
23686
|
runtimeUnytVersionInfo: String!
|
|
23642
23687
|
runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
|
|
23643
23688
|
}
|
|
@@ -24250,6 +24295,12 @@ let RuntimeResolver = class RuntimeResolver {
|
|
|
24250
24295
|
runtimeSetMultiUserEnabled(enabled) {
|
|
24251
24296
|
return enabled;
|
|
24252
24297
|
}
|
|
24298
|
+
runtimeFreeHostingEnabled() {
|
|
24299
|
+
return true;
|
|
24300
|
+
}
|
|
24301
|
+
runtimeSetFreeHostingEnabled(enabled) {
|
|
24302
|
+
return enabled;
|
|
24303
|
+
}
|
|
24253
24304
|
runtimeListUsers() {
|
|
24254
24305
|
return [{
|
|
24255
24306
|
email: "test@example.com",
|
|
@@ -24339,6 +24390,9 @@ let RuntimeResolver = class RuntimeResolver {
|
|
|
24339
24390
|
runtimeHotAgentPubkey() {
|
|
24340
24391
|
return "";
|
|
24341
24392
|
}
|
|
24393
|
+
runtimeUnytAgentKey() {
|
|
24394
|
+
return "";
|
|
24395
|
+
}
|
|
24342
24396
|
runtimeUnytVersionInfo() {
|
|
24343
24397
|
return "";
|
|
24344
24398
|
}
|
|
@@ -24588,6 +24642,19 @@ __decorate([
|
|
|
24588
24642
|
__metadata("design:paramtypes", [Boolean]),
|
|
24589
24643
|
__metadata("design:returntype", Boolean)
|
|
24590
24644
|
], RuntimeResolver.prototype, "runtimeSetMultiUserEnabled", null);
|
|
24645
|
+
__decorate([
|
|
24646
|
+
Query(),
|
|
24647
|
+
__metadata("design:type", Function),
|
|
24648
|
+
__metadata("design:paramtypes", []),
|
|
24649
|
+
__metadata("design:returntype", Boolean)
|
|
24650
|
+
], RuntimeResolver.prototype, "runtimeFreeHostingEnabled", null);
|
|
24651
|
+
__decorate([
|
|
24652
|
+
Mutation(),
|
|
24653
|
+
__param(0, Arg()),
|
|
24654
|
+
__metadata("design:type", Function),
|
|
24655
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
24656
|
+
__metadata("design:returntype", Boolean)
|
|
24657
|
+
], RuntimeResolver.prototype, "runtimeSetFreeHostingEnabled", null);
|
|
24591
24658
|
__decorate([
|
|
24592
24659
|
Query(),
|
|
24593
24660
|
__metadata("design:type", Function),
|
|
@@ -24746,6 +24813,12 @@ __decorate([
|
|
|
24746
24813
|
__metadata("design:paramtypes", []),
|
|
24747
24814
|
__metadata("design:returntype", String)
|
|
24748
24815
|
], RuntimeResolver.prototype, "runtimeHotAgentPubkey", null);
|
|
24816
|
+
__decorate([
|
|
24817
|
+
Query(),
|
|
24818
|
+
__metadata("design:type", Function),
|
|
24819
|
+
__metadata("design:paramtypes", []),
|
|
24820
|
+
__metadata("design:returntype", String)
|
|
24821
|
+
], RuntimeResolver.prototype, "runtimeUnytAgentKey", null);
|
|
24749
24822
|
__decorate([
|
|
24750
24823
|
Query(),
|
|
24751
24824
|
__metadata("design:type", Function),
|
|
@@ -14,6 +14,7 @@ export interface InitializeArgs {
|
|
|
14
14
|
export type AgentUpdatedCallback = (agent: Agent) => null;
|
|
15
15
|
export type AgentStatusChangedCallback = (agent: Agent) => null;
|
|
16
16
|
export type AgentAppsUpdatedCallback = () => null;
|
|
17
|
+
export type HostingUserInfoChangedCallback = (info: HostingUserInfo) => void;
|
|
17
18
|
/**
|
|
18
19
|
* Provides access to all functions regarding the local agent,
|
|
19
20
|
* such as generating, locking, unlocking, importing the DID keystore,
|
|
@@ -48,6 +49,8 @@ export declare class AgentClient {
|
|
|
48
49
|
subscribeAppsChanged(): void;
|
|
49
50
|
addAgentStatusChangedListener(listener: any): void;
|
|
50
51
|
subscribeAgentStatusChanged(): void;
|
|
52
|
+
addHostingUserInfoChangedListener(listener: HostingUserInfoChangedCallback): void;
|
|
53
|
+
subscribeHostingUserInfoChanged(): void;
|
|
51
54
|
requestCapability(authInfo: AuthInfoInput): Promise<string>;
|
|
52
55
|
permitCapability(auth: string): Promise<string>;
|
|
53
56
|
generateJwt(requestId: string, rand: string): Promise<string>;
|
|
@@ -9,7 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _AgentClient_apolloClient, _AgentClient_appsChangedCallback, _AgentClient_updatedCallbacks, _AgentClient_agentStatusChangedCallbacks;
|
|
12
|
+
var _AgentClient_apolloClient, _AgentClient_appsChangedCallback, _AgentClient_updatedCallbacks, _AgentClient_agentStatusChangedCallbacks, _AgentClient_hostingUserInfoChangedCallbacks;
|
|
13
13
|
import { gql } from "@apollo/client/core";
|
|
14
14
|
import unwrapApolloResult from "../unwrapApolloResult";
|
|
15
15
|
import { Agent, } from "./Agent";
|
|
@@ -77,10 +77,12 @@ export class AgentClient {
|
|
|
77
77
|
_AgentClient_appsChangedCallback.set(this, void 0);
|
|
78
78
|
_AgentClient_updatedCallbacks.set(this, void 0);
|
|
79
79
|
_AgentClient_agentStatusChangedCallbacks.set(this, void 0);
|
|
80
|
+
_AgentClient_hostingUserInfoChangedCallbacks.set(this, void 0);
|
|
80
81
|
__classPrivateFieldSet(this, _AgentClient_apolloClient, client, "f");
|
|
81
82
|
__classPrivateFieldSet(this, _AgentClient_updatedCallbacks, [], "f");
|
|
82
83
|
__classPrivateFieldSet(this, _AgentClient_agentStatusChangedCallbacks, [], "f");
|
|
83
84
|
__classPrivateFieldSet(this, _AgentClient_appsChangedCallback, [], "f");
|
|
85
|
+
__classPrivateFieldSet(this, _AgentClient_hostingUserInfoChangedCallbacks, [], "f");
|
|
84
86
|
if (subscribe) {
|
|
85
87
|
this.subscribeAgentUpdated();
|
|
86
88
|
this.subscribeAgentStatusChanged();
|
|
@@ -341,6 +343,29 @@ export class AgentClient {
|
|
|
341
343
|
error: (e) => console.error(e),
|
|
342
344
|
});
|
|
343
345
|
}
|
|
346
|
+
addHostingUserInfoChangedListener(listener) {
|
|
347
|
+
__classPrivateFieldGet(this, _AgentClient_hostingUserInfoChangedCallbacks, "f").push(listener);
|
|
348
|
+
}
|
|
349
|
+
subscribeHostingUserInfoChanged() {
|
|
350
|
+
__classPrivateFieldGet(this, _AgentClient_apolloClient, "f")
|
|
351
|
+
.subscribe({
|
|
352
|
+
query: gql `subscription {
|
|
353
|
+
runtimeHostingUserInfoChanged {
|
|
354
|
+
email
|
|
355
|
+
remainingCredits
|
|
356
|
+
hotWalletAddress
|
|
357
|
+
freeAccess
|
|
358
|
+
}
|
|
359
|
+
}`,
|
|
360
|
+
})
|
|
361
|
+
.subscribe({
|
|
362
|
+
next: (result) => {
|
|
363
|
+
const info = result.data.runtimeHostingUserInfoChanged;
|
|
364
|
+
__classPrivateFieldGet(this, _AgentClient_hostingUserInfoChangedCallbacks, "f").forEach((cb) => cb(info));
|
|
365
|
+
},
|
|
366
|
+
error: (e) => console.error(e),
|
|
367
|
+
});
|
|
368
|
+
}
|
|
344
369
|
async requestCapability(authInfo) {
|
|
345
370
|
const { agentRequestCapability } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
|
|
346
371
|
mutation: gql `
|
|
@@ -509,4 +534,4 @@ export class AgentClient {
|
|
|
509
534
|
return runtimeRequestPayment;
|
|
510
535
|
}
|
|
511
536
|
}
|
|
512
|
-
_AgentClient_apolloClient = new WeakMap(), _AgentClient_appsChangedCallback = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap();
|
|
537
|
+
_AgentClient_apolloClient = new WeakMap(), _AgentClient_appsChangedCallback = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap(), _AgentClient_hostingUserInfoChangedCallbacks = new WeakMap();
|
|
@@ -42,6 +42,8 @@ export declare class RuntimeClient {
|
|
|
42
42
|
importPerspective(filePath: string): Promise<boolean>;
|
|
43
43
|
multiUserEnabled(): Promise<boolean>;
|
|
44
44
|
setMultiUserEnabled(enabled: boolean): Promise<boolean>;
|
|
45
|
+
freeHostingEnabled(): Promise<boolean>;
|
|
46
|
+
setFreeHostingEnabled(enabled: boolean): Promise<boolean>;
|
|
45
47
|
listUsers(): Promise<UserStatistics[]>;
|
|
46
48
|
userWalletAddress(email: string): Promise<string | null>;
|
|
47
49
|
emailTestModeEnable(): Promise<boolean>;
|
|
@@ -376,6 +376,23 @@ export class RuntimeClient {
|
|
|
376
376
|
}));
|
|
377
377
|
return runtimeSetMultiUserEnabled;
|
|
378
378
|
}
|
|
379
|
+
async freeHostingEnabled() {
|
|
380
|
+
const { runtimeFreeHostingEnabled } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
|
|
381
|
+
query: gql `query runtimeFreeHostingEnabled {
|
|
382
|
+
runtimeFreeHostingEnabled
|
|
383
|
+
}`
|
|
384
|
+
}));
|
|
385
|
+
return runtimeFreeHostingEnabled;
|
|
386
|
+
}
|
|
387
|
+
async setFreeHostingEnabled(enabled) {
|
|
388
|
+
const { runtimeSetFreeHostingEnabled } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
389
|
+
mutation: gql `mutation runtimeSetFreeHostingEnabled($enabled: Boolean!) {
|
|
390
|
+
runtimeSetFreeHostingEnabled(enabled: $enabled)
|
|
391
|
+
}`,
|
|
392
|
+
variables: { enabled }
|
|
393
|
+
}));
|
|
394
|
+
return runtimeSetFreeHostingEnabled;
|
|
395
|
+
}
|
|
379
396
|
async listUsers() {
|
|
380
397
|
const { runtimeListUsers } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
|
|
381
398
|
query: gql `query runtimeListUsers {
|
|
@@ -133,6 +133,8 @@ export default class RuntimeResolver {
|
|
|
133
133
|
runtimeImportPerspective(filePath: string): boolean;
|
|
134
134
|
runtimeMultiUserEnabled(): boolean;
|
|
135
135
|
runtimeSetMultiUserEnabled(enabled: boolean): boolean;
|
|
136
|
+
runtimeFreeHostingEnabled(): boolean;
|
|
137
|
+
runtimeSetFreeHostingEnabled(enabled: boolean): boolean;
|
|
136
138
|
runtimeListUsers(): UserStatistics[];
|
|
137
139
|
runtimeRequestLoginVerification(email: string, appInfo?: AuthInfoInput): VerificationRequestResult;
|
|
138
140
|
runtimeVerifyEmailCode(email: string, code: string, verificationType: string): string;
|
|
@@ -155,5 +157,6 @@ export default class RuntimeResolver {
|
|
|
155
157
|
runtimeHotWalletBalance(): string;
|
|
156
158
|
runtimeHotWalletHistory(page?: number, perPage?: number): string;
|
|
157
159
|
runtimeHotAgentPubkey(): string;
|
|
160
|
+
runtimeUnytAgentKey(): string;
|
|
158
161
|
runtimeUnytVersionInfo(): string;
|
|
159
162
|
}
|
|
@@ -530,6 +530,12 @@ let RuntimeResolver = class RuntimeResolver {
|
|
|
530
530
|
runtimeSetMultiUserEnabled(enabled) {
|
|
531
531
|
return enabled;
|
|
532
532
|
}
|
|
533
|
+
runtimeFreeHostingEnabled() {
|
|
534
|
+
return true;
|
|
535
|
+
}
|
|
536
|
+
runtimeSetFreeHostingEnabled(enabled) {
|
|
537
|
+
return enabled;
|
|
538
|
+
}
|
|
533
539
|
runtimeListUsers() {
|
|
534
540
|
return [{
|
|
535
541
|
email: "test@example.com",
|
|
@@ -619,6 +625,9 @@ let RuntimeResolver = class RuntimeResolver {
|
|
|
619
625
|
runtimeHotAgentPubkey() {
|
|
620
626
|
return "";
|
|
621
627
|
}
|
|
628
|
+
runtimeUnytAgentKey() {
|
|
629
|
+
return "";
|
|
630
|
+
}
|
|
622
631
|
runtimeUnytVersionInfo() {
|
|
623
632
|
return "";
|
|
624
633
|
}
|
|
@@ -868,6 +877,19 @@ __decorate([
|
|
|
868
877
|
__metadata("design:paramtypes", [Boolean]),
|
|
869
878
|
__metadata("design:returntype", Boolean)
|
|
870
879
|
], RuntimeResolver.prototype, "runtimeSetMultiUserEnabled", null);
|
|
880
|
+
__decorate([
|
|
881
|
+
Query(returns => Boolean),
|
|
882
|
+
__metadata("design:type", Function),
|
|
883
|
+
__metadata("design:paramtypes", []),
|
|
884
|
+
__metadata("design:returntype", Boolean)
|
|
885
|
+
], RuntimeResolver.prototype, "runtimeFreeHostingEnabled", null);
|
|
886
|
+
__decorate([
|
|
887
|
+
Mutation(returns => Boolean),
|
|
888
|
+
__param(0, Arg("enabled")),
|
|
889
|
+
__metadata("design:type", Function),
|
|
890
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
891
|
+
__metadata("design:returntype", Boolean)
|
|
892
|
+
], RuntimeResolver.prototype, "runtimeSetFreeHostingEnabled", null);
|
|
871
893
|
__decorate([
|
|
872
894
|
Query(returns => [UserStatistics]),
|
|
873
895
|
__metadata("design:type", Function),
|
|
@@ -1026,6 +1048,12 @@ __decorate([
|
|
|
1026
1048
|
__metadata("design:paramtypes", []),
|
|
1027
1049
|
__metadata("design:returntype", String)
|
|
1028
1050
|
], RuntimeResolver.prototype, "runtimeHotAgentPubkey", null);
|
|
1051
|
+
__decorate([
|
|
1052
|
+
Query(returns => String),
|
|
1053
|
+
__metadata("design:type", Function),
|
|
1054
|
+
__metadata("design:paramtypes", []),
|
|
1055
|
+
__metadata("design:returntype", String)
|
|
1056
|
+
], RuntimeResolver.prototype, "runtimeUnytAgentKey", null);
|
|
1029
1057
|
__decorate([
|
|
1030
1058
|
Query(returns => String),
|
|
1031
1059
|
__metadata("design:type", Function),
|
package/lib/src/schema.gql
CHANGED
|
@@ -390,6 +390,7 @@ type Mutation {
|
|
|
390
390
|
runtimeRequestPayment(amountHOT: String!): PaymentRequestResult!
|
|
391
391
|
runtimeRestartHolochain: Boolean!
|
|
392
392
|
runtimeSendHot(amount: String!, recipient: String!): PaymentRequestResult!
|
|
393
|
+
runtimeSetFreeHostingEnabled(enabled: Boolean!): Boolean!
|
|
393
394
|
runtimeSetHotWalletAddress(address: String!): Boolean!
|
|
394
395
|
runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
|
|
395
396
|
runtimeSetStatus(status: PerspectiveInput!): Boolean!
|
|
@@ -504,6 +505,7 @@ type Query {
|
|
|
504
505
|
perspectiveQuerySurrealDB(query: String!, uuid: String!): String!
|
|
505
506
|
perspectiveSnapshot(uuid: String!): Perspective
|
|
506
507
|
perspectives: [PerspectiveHandle!]!
|
|
508
|
+
runtimeFreeHostingEnabled: Boolean!
|
|
507
509
|
runtimeFriendStatus(did: String!): PerspectiveExpression
|
|
508
510
|
runtimeFriends: [String!]!
|
|
509
511
|
runtimeGetNetworkMetrics: String!
|
|
@@ -519,6 +521,7 @@ type Query {
|
|
|
519
521
|
runtimeMessageOutbox(filter: String): [SentMessage!]!
|
|
520
522
|
runtimeMultiUserEnabled: Boolean!
|
|
521
523
|
runtimeNotifications: [Notification!]!
|
|
524
|
+
runtimeUnytAgentKey: String!
|
|
522
525
|
runtimeUnytVersionInfo: String!
|
|
523
526
|
runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
|
|
524
527
|
}
|
package/lib/src/typeDefs.js
CHANGED
|
@@ -386,6 +386,7 @@ type Mutation {
|
|
|
386
386
|
runtimeRequestPayment(amountHOT: String!): PaymentRequestResult!
|
|
387
387
|
runtimeRestartHolochain: Boolean!
|
|
388
388
|
runtimeSendHot(amount: String!, recipient: String!): PaymentRequestResult!
|
|
389
|
+
runtimeSetFreeHostingEnabled(enabled: Boolean!): Boolean!
|
|
389
390
|
runtimeSetHotWalletAddress(address: String!): Boolean!
|
|
390
391
|
runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
|
|
391
392
|
runtimeSetStatus(status: PerspectiveInput!): Boolean!
|
|
@@ -500,6 +501,7 @@ type Query {
|
|
|
500
501
|
perspectiveQuerySurrealDB(query: String!, uuid: String!): String!
|
|
501
502
|
perspectiveSnapshot(uuid: String!): Perspective
|
|
502
503
|
perspectives: [PerspectiveHandle!]!
|
|
504
|
+
runtimeFreeHostingEnabled: Boolean!
|
|
503
505
|
runtimeFriendStatus(did: String!): PerspectiveExpression
|
|
504
506
|
runtimeFriends: [String!]!
|
|
505
507
|
runtimeGetNetworkMetrics: String!
|
|
@@ -515,6 +517,7 @@ type Query {
|
|
|
515
517
|
runtimeMessageOutbox(filter: String): [SentMessage!]!
|
|
516
518
|
runtimeMultiUserEnabled: Boolean!
|
|
517
519
|
runtimeNotifications: [Notification!]!
|
|
520
|
+
runtimeUnytAgentKey: String!
|
|
518
521
|
runtimeUnytVersionInfo: String!
|
|
519
522
|
runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
|
|
520
523
|
}
|
package/package.json
CHANGED
package/src/agent/AgentClient.ts
CHANGED
|
@@ -82,6 +82,7 @@ export interface InitializeArgs {
|
|
|
82
82
|
export type AgentUpdatedCallback = (agent: Agent) => null;
|
|
83
83
|
export type AgentStatusChangedCallback = (agent: Agent) => null;
|
|
84
84
|
export type AgentAppsUpdatedCallback = () => null;
|
|
85
|
+
export type HostingUserInfoChangedCallback = (info: HostingUserInfo) => void;
|
|
85
86
|
/**
|
|
86
87
|
* Provides access to all functions regarding the local agent,
|
|
87
88
|
* such as generating, locking, unlocking, importing the DID keystore,
|
|
@@ -92,12 +93,14 @@ export class AgentClient {
|
|
|
92
93
|
#appsChangedCallback: AgentAppsUpdatedCallback[];
|
|
93
94
|
#updatedCallbacks: AgentUpdatedCallback[];
|
|
94
95
|
#agentStatusChangedCallbacks: AgentStatusChangedCallback[];
|
|
96
|
+
#hostingUserInfoChangedCallbacks: HostingUserInfoChangedCallback[];
|
|
95
97
|
|
|
96
98
|
constructor(client: ApolloClient<any>, subscribe: boolean = true) {
|
|
97
99
|
this.#apolloClient = client;
|
|
98
100
|
this.#updatedCallbacks = [];
|
|
99
101
|
this.#agentStatusChangedCallbacks = [];
|
|
100
102
|
this.#appsChangedCallback = [];
|
|
103
|
+
this.#hostingUserInfoChangedCallbacks = [];
|
|
101
104
|
|
|
102
105
|
if (subscribe) {
|
|
103
106
|
this.subscribeAgentUpdated();
|
|
@@ -422,6 +425,31 @@ export class AgentClient {
|
|
|
422
425
|
});
|
|
423
426
|
}
|
|
424
427
|
|
|
428
|
+
addHostingUserInfoChangedListener(listener: HostingUserInfoChangedCallback) {
|
|
429
|
+
this.#hostingUserInfoChangedCallbacks.push(listener);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
subscribeHostingUserInfoChanged() {
|
|
433
|
+
this.#apolloClient
|
|
434
|
+
.subscribe({
|
|
435
|
+
query: gql`subscription {
|
|
436
|
+
runtimeHostingUserInfoChanged {
|
|
437
|
+
email
|
|
438
|
+
remainingCredits
|
|
439
|
+
hotWalletAddress
|
|
440
|
+
freeAccess
|
|
441
|
+
}
|
|
442
|
+
}`,
|
|
443
|
+
})
|
|
444
|
+
.subscribe({
|
|
445
|
+
next: (result) => {
|
|
446
|
+
const info = result.data.runtimeHostingUserInfoChanged;
|
|
447
|
+
this.#hostingUserInfoChangedCallbacks.forEach((cb) => cb(info));
|
|
448
|
+
},
|
|
449
|
+
error: (e) => console.error(e),
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
|
|
425
453
|
async requestCapability(authInfo: AuthInfoInput): Promise<string> {
|
|
426
454
|
const { agentRequestCapability } = unwrapApolloResult(
|
|
427
455
|
await this.#apolloClient.mutate({
|
|
@@ -414,6 +414,25 @@ export class RuntimeClient {
|
|
|
414
414
|
return runtimeSetMultiUserEnabled
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
+
async freeHostingEnabled(): Promise<boolean> {
|
|
418
|
+
const { runtimeFreeHostingEnabled } = unwrapApolloResult(await this.#apolloClient.query({
|
|
419
|
+
query: gql`query runtimeFreeHostingEnabled {
|
|
420
|
+
runtimeFreeHostingEnabled
|
|
421
|
+
}`
|
|
422
|
+
}))
|
|
423
|
+
return runtimeFreeHostingEnabled
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
async setFreeHostingEnabled(enabled: boolean): Promise<boolean> {
|
|
427
|
+
const { runtimeSetFreeHostingEnabled } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
428
|
+
mutation: gql`mutation runtimeSetFreeHostingEnabled($enabled: Boolean!) {
|
|
429
|
+
runtimeSetFreeHostingEnabled(enabled: $enabled)
|
|
430
|
+
}`,
|
|
431
|
+
variables: { enabled }
|
|
432
|
+
}))
|
|
433
|
+
return runtimeSetFreeHostingEnabled
|
|
434
|
+
}
|
|
435
|
+
|
|
417
436
|
async listUsers(): Promise<UserStatistics[]> {
|
|
418
437
|
const { runtimeListUsers } = unwrapApolloResult(await this.#apolloClient.query({
|
|
419
438
|
query: gql`query runtimeListUsers {
|
|
@@ -513,6 +513,16 @@ export default class RuntimeResolver {
|
|
|
513
513
|
return enabled
|
|
514
514
|
}
|
|
515
515
|
|
|
516
|
+
@Query(returns => Boolean)
|
|
517
|
+
runtimeFreeHostingEnabled(): boolean {
|
|
518
|
+
return true
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
@Mutation(returns => Boolean)
|
|
522
|
+
runtimeSetFreeHostingEnabled(@Arg("enabled") enabled: boolean): boolean {
|
|
523
|
+
return enabled
|
|
524
|
+
}
|
|
525
|
+
|
|
516
526
|
@Query(returns => [UserStatistics])
|
|
517
527
|
runtimeListUsers(): UserStatistics[] {
|
|
518
528
|
return [{
|
|
@@ -683,6 +693,11 @@ export default class RuntimeResolver {
|
|
|
683
693
|
return ""
|
|
684
694
|
}
|
|
685
695
|
|
|
696
|
+
@Query(returns => String)
|
|
697
|
+
runtimeUnytAgentKey(): string {
|
|
698
|
+
return ""
|
|
699
|
+
}
|
|
700
|
+
|
|
686
701
|
@Query(returns => String)
|
|
687
702
|
runtimeUnytVersionInfo(): string {
|
|
688
703
|
return ""
|