@coasys/ad4m 0.12.0-rc1-dev.4 → 0.12.0-rc2
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 +5052 -4446
- package/lib/index.js +5019 -4442
- package/lib/src/agent/AgentClient.d.ts +4 -0
- package/lib/src/agent/AgentClient.js +34 -0
- package/lib/src/index.d.ts +2 -3
- package/lib/src/index.js +2 -3
- package/lib/src/model/Ad4mModel.d.ts +8 -782
- package/lib/src/model/Ad4mModel.js +160 -2354
- package/lib/src/model/ModelQueryBuilder.d.ts +370 -0
- package/lib/src/model/ModelQueryBuilder.js +556 -0
- package/lib/src/model/decorators.d.ts +71 -23
- package/lib/src/model/decorators.js +133 -384
- package/lib/src/model/hydration.d.ts +102 -0
- package/lib/src/model/hydration.js +709 -0
- package/lib/src/model/index.d.ts +20 -0
- package/lib/src/model/index.js +20 -0
- package/lib/src/model/{schema/fromJSONSchema.d.ts → json-schema.d.ts} +45 -12
- package/lib/src/model/json-schema.js +326 -0
- package/lib/src/model/prolog-facts.d.ts +37 -0
- package/lib/src/model/{prolog/generatePrologFacts.js → prolog-facts.js} +47 -52
- package/lib/src/model/query-common.d.ts +14 -0
- package/lib/src/model/query-common.js +36 -0
- package/lib/src/model/query-prolog.d.ts +15 -0
- package/lib/src/model/query-prolog.js +140 -0
- package/lib/src/model/query-surreal.d.ts +44 -0
- package/lib/src/model/query-surreal.js +249 -0
- package/lib/src/model/relation-filtering.test.js +838 -0
- package/lib/src/model/sdna.d.ts +14 -0
- package/lib/src/model/sdna.js +141 -0
- package/lib/src/model/shacl-gen.d.ts +31 -0
- package/lib/src/model/shacl-gen.js +246 -0
- package/lib/src/model/surreal-utils.d.ts +42 -0
- package/lib/src/model/surreal-utils.js +128 -0
- package/lib/src/model/types.d.ts +75 -96
- package/lib/src/model/types.js +4 -4
- package/lib/src/model/util.d.ts +4 -5
- package/lib/src/model/util.js +12 -32
- package/lib/src/perspectives/PerspectiveClient.d.ts +1 -1
- package/lib/src/perspectives/PerspectiveProxy.d.ts +1 -1
- package/lib/src/perspectives/WakerSubscriptionManager.d.ts +79 -0
- package/lib/src/perspectives/WakerSubscriptionManager.js +196 -0
- package/lib/src/runtime/RuntimeResolver.d.ts +14 -0
- package/lib/src/runtime/RuntimeResolver.js +73 -0
- package/lib/src/schema.gql +14 -0
- package/lib/src/shacl/SHACLShape.d.ts +23 -0
- package/lib/src/shacl/SHACLShape.js +45 -0
- package/lib/src/typeDefs.js +14 -0
- package/package.json +13 -8
- package/src/agent/AgentClient.ts +45 -0
- package/src/index.ts +2 -3
- package/src/model/Ad4mModel.ts +1089 -3686
- package/src/model/ModelQueryBuilder.ts +617 -0
- package/src/model/Subject.ts +1 -1
- package/src/model/decorators.ts +218 -453
- package/src/model/hydration.ts +796 -0
- package/src/model/index.ts +21 -0
- package/src/model/json-schema.ts +424 -0
- package/src/model/prolog-facts.ts +145 -0
- package/src/model/query-common.ts +48 -0
- package/src/model/query-prolog.ts +148 -0
- package/src/model/query-surreal.ts +280 -0
- package/src/model/relation-filtering.test.ts +803 -0
- package/src/model/sdna.ts +170 -0
- package/src/model/shacl-gen.ts +292 -0
- package/src/model/surreal-utils.ts +147 -0
- package/src/model/types.ts +182 -0
- package/src/model/util.ts +13 -36
- package/src/perspectives/PerspectiveClient.ts +1 -1
- package/src/perspectives/PerspectiveProxy.ts +1 -1
- package/src/perspectives/WakerSubscriptionManager.ts +292 -0
- package/src/runtime/RuntimeResolver.ts +53 -0
- package/src/shacl/SHACLShape.ts +83 -0
- package/lib/src/Ad4mClient.test.js +0 -1204
- package/lib/src/Literal.test.d.ts +0 -1
- package/lib/src/Literal.test.js +0 -41
- package/lib/src/model/mutation.d.ts +0 -81
- package/lib/src/model/mutation.js +0 -317
- package/lib/src/model/parentUtils.d.ts +0 -32
- package/lib/src/model/parentUtils.js +0 -64
- package/lib/src/model/prolog/generatePrologFacts.d.ts +0 -36
- package/lib/src/model/prolog/index.d.ts +0 -1
- package/lib/src/model/prolog/index.js +0 -1
- package/lib/src/model/query/ModelQueryBuilder.d.ts +0 -82
- package/lib/src/model/query/ModelQueryBuilder.js +0 -115
- package/lib/src/model/query/QueryBuilder.d.ts +0 -101
- package/lib/src/model/query/QueryBuilder.js +0 -193
- package/lib/src/model/query/SurrealQueryBuilder.d.ts +0 -48
- package/lib/src/model/query/SurrealQueryBuilder.js +0 -371
- package/lib/src/model/query/fetchInstance.d.ts +0 -24
- package/lib/src/model/query/fetchInstance.js +0 -144
- package/lib/src/model/query/hydration.d.ts +0 -54
- package/lib/src/model/query/hydration.js +0 -214
- package/lib/src/model/query/operations.d.ts +0 -59
- package/lib/src/model/query/operations.js +0 -384
- package/lib/src/model/query/snapshot.d.ts +0 -59
- package/lib/src/model/query/snapshot.js +0 -106
- package/lib/src/model/query/surrealCompiler.d.ts +0 -42
- package/lib/src/model/query/surrealCompiler.js +0 -304
- package/lib/src/model/schema/fromJSONSchema.js +0 -264
- package/lib/src/model/schema/metadata.d.ts +0 -15
- package/lib/src/model/schema/metadata.js +0 -112
- package/lib/src/model/subscription.d.ts +0 -47
- package/lib/src/model/subscription.js +0 -231
- package/lib/src/model/transaction.d.ts +0 -27
- package/lib/src/model/transaction.js +0 -32
- package/lib/src/shims/reflect-metadata.d.ts +0 -0
- package/lib/src/shims/type-graphql.d.ts +0 -32
- package/lib/src/src/Ad4mClient.d.ts +0 -28
- package/lib/src/src/Address.d.ts +0 -1
- package/lib/src/src/DID.d.ts +0 -1
- package/lib/src/src/Exception.d.ts +0 -7
- package/lib/src/src/Literal.d.ts +0 -7
- package/lib/src/src/PubSub.d.ts +0 -17
- package/lib/src/src/SmartLiteral.d.ts +0 -12
- package/lib/src/src/agent/Agent.d.ts +0 -110
- package/lib/src/src/agent/AgentClient.d.ts +0 -62
- package/lib/src/src/agent/AgentResolver.d.ts +0 -30
- package/lib/src/src/agent/AgentStatus.d.ts +0 -8
- package/lib/src/src/ai/AIClient.d.ts +0 -32
- package/lib/src/src/ai/AIResolver.d.ts +0 -75
- package/lib/src/src/ai/Tasks.d.ts +0 -37
- package/lib/src/src/buildSchema.d.ts +0 -1
- package/lib/src/src/expression/Expression.d.ts +0 -28
- package/lib/src/src/expression/ExpressionClient.d.ts +0 -13
- package/lib/src/src/expression/ExpressionRef.d.ts +0 -9
- package/lib/src/src/expression/ExpressionResolver.d.ts +0 -10
- package/lib/src/src/index.d.ts +0 -35
- package/lib/src/src/jestSetup.d.ts +0 -1
- package/lib/src/src/language/Icon.d.ts +0 -4
- package/lib/src/src/language/Language.d.ts +0 -206
- package/lib/src/src/language/LanguageClient.d.ts +0 -17
- package/lib/src/src/language/LanguageContext.d.ts +0 -37
- package/lib/src/src/language/LanguageHandle.d.ts +0 -9
- package/lib/src/src/language/LanguageMeta.d.ts +0 -35
- package/lib/src/src/language/LanguageRef.d.ts +0 -6
- package/lib/src/src/language/LanguageResolver.d.ts +0 -19
- package/lib/src/src/links/Links.d.ts +0 -39
- package/lib/src/src/links/Links.test.d.ts +0 -1
- package/lib/src/src/model/Ad4mModel.d.ts +0 -1438
- package/lib/src/src/model/Ad4mModel.test.d.ts +0 -1
- package/lib/src/src/model/Subject.d.ts +0 -25
- package/lib/src/src/model/decorators.d.ts +0 -545
- package/lib/src/src/model/util.d.ts +0 -12
- package/lib/src/src/neighbourhood/Neighbourhood.d.ts +0 -10
- package/lib/src/src/neighbourhood/NeighbourhoodClient.d.ts +0 -25
- package/lib/src/src/neighbourhood/NeighbourhoodProxy.d.ts +0 -19
- package/lib/src/src/neighbourhood/NeighbourhoodProxy.test.d.ts +0 -1
- package/lib/src/src/neighbourhood/NeighbourhoodResolver.d.ts +0 -24
- package/lib/src/src/perspectives/LinkQuery.d.ts +0 -11
- package/lib/src/src/perspectives/Perspective.d.ts +0 -38
- package/lib/src/src/perspectives/Perspective.test.d.ts +0 -1
- package/lib/src/src/perspectives/PerspectiveClient.d.ts +0 -97
- package/lib/src/src/perspectives/PerspectiveDiff.d.ts +0 -9
- package/lib/src/src/perspectives/PerspectiveHandle.d.ts +0 -18
- package/lib/src/src/perspectives/PerspectiveProxy.d.ts +0 -865
- package/lib/src/src/perspectives/PerspectiveResolver.d.ts +0 -57
- package/lib/src/src/runtime/RuntimeClient.d.ts +0 -56
- package/lib/src/src/runtime/RuntimeResolver.d.ts +0 -132
- package/lib/src/src/shacl/SHACLFlow.d.ts +0 -171
- package/lib/src/src/shacl/SHACLFlow.test.d.ts +0 -1
- package/lib/src/src/shacl/SHACLShape.d.ts +0 -117
- package/lib/src/src/shacl/SHACLShape.test.d.ts +0 -1
- package/lib/src/src/typeDefs.d.ts +0 -1
- package/lib/src/src/unwrapApolloResult.d.ts +0 -2
- package/lib/src/src/utils.d.ts +0 -25
- /package/lib/src/{Ad4mClient.test.d.ts → model/relation-filtering.test.d.ts} +0 -0
|
@@ -315,6 +315,49 @@ VerificationRequestResult = __decorate([
|
|
|
315
315
|
ObjectType()
|
|
316
316
|
], VerificationRequestResult);
|
|
317
317
|
export { VerificationRequestResult };
|
|
318
|
+
let HostingUserInfo = class HostingUserInfo {
|
|
319
|
+
constructor(email, remainingCredits, hotWalletAddress) {
|
|
320
|
+
this.email = email;
|
|
321
|
+
this.remainingCredits = remainingCredits;
|
|
322
|
+
this.hotWalletAddress = hotWalletAddress;
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
__decorate([
|
|
326
|
+
Field(),
|
|
327
|
+
__metadata("design:type", String)
|
|
328
|
+
], HostingUserInfo.prototype, "email", void 0);
|
|
329
|
+
__decorate([
|
|
330
|
+
Field(),
|
|
331
|
+
__metadata("design:type", String)
|
|
332
|
+
], HostingUserInfo.prototype, "remainingCredits", void 0);
|
|
333
|
+
__decorate([
|
|
334
|
+
Field({ nullable: true }),
|
|
335
|
+
__metadata("design:type", String)
|
|
336
|
+
], HostingUserInfo.prototype, "hotWalletAddress", void 0);
|
|
337
|
+
HostingUserInfo = __decorate([
|
|
338
|
+
ObjectType(),
|
|
339
|
+
__metadata("design:paramtypes", [String, String, String])
|
|
340
|
+
], HostingUserInfo);
|
|
341
|
+
export { HostingUserInfo };
|
|
342
|
+
let PaymentRequestResult = class PaymentRequestResult {
|
|
343
|
+
constructor(success, message) {
|
|
344
|
+
this.success = success;
|
|
345
|
+
this.message = message;
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
__decorate([
|
|
349
|
+
Field(),
|
|
350
|
+
__metadata("design:type", Boolean)
|
|
351
|
+
], PaymentRequestResult.prototype, "success", void 0);
|
|
352
|
+
__decorate([
|
|
353
|
+
Field(),
|
|
354
|
+
__metadata("design:type", String)
|
|
355
|
+
], PaymentRequestResult.prototype, "message", void 0);
|
|
356
|
+
PaymentRequestResult = __decorate([
|
|
357
|
+
ObjectType(),
|
|
358
|
+
__metadata("design:paramtypes", [Boolean, String])
|
|
359
|
+
], PaymentRequestResult);
|
|
360
|
+
export { PaymentRequestResult };
|
|
318
361
|
/**
|
|
319
362
|
* Resolver classes are used here to define the GraphQL schema
|
|
320
363
|
* (through the type-graphql annotations)
|
|
@@ -523,6 +566,16 @@ let RuntimeResolver = class RuntimeResolver {
|
|
|
523
566
|
// For testing: simulate setting expiry (no-op in mock)
|
|
524
567
|
return true;
|
|
525
568
|
}
|
|
569
|
+
// Hosting mutations & queries
|
|
570
|
+
runtimeHostingUserInfo() {
|
|
571
|
+
return new HostingUserInfo("test@example.com", "100000000", null);
|
|
572
|
+
}
|
|
573
|
+
runtimeSetHotWalletAddress(address) {
|
|
574
|
+
return true;
|
|
575
|
+
}
|
|
576
|
+
runtimeRequestPayment(amountHOT) {
|
|
577
|
+
return new PaymentRequestResult(true, "Mock payment of " + amountHOT + " base units credited");
|
|
578
|
+
}
|
|
526
579
|
};
|
|
527
580
|
__decorate([
|
|
528
581
|
Mutation(returns => Boolean),
|
|
@@ -850,6 +903,26 @@ __decorate([
|
|
|
850
903
|
__metadata("design:paramtypes", [String, String, Number]),
|
|
851
904
|
__metadata("design:returntype", Boolean)
|
|
852
905
|
], RuntimeResolver.prototype, "runtimeEmailTestSetExpiry", null);
|
|
906
|
+
__decorate([
|
|
907
|
+
Query(returns => HostingUserInfo),
|
|
908
|
+
__metadata("design:type", Function),
|
|
909
|
+
__metadata("design:paramtypes", []),
|
|
910
|
+
__metadata("design:returntype", HostingUserInfo)
|
|
911
|
+
], RuntimeResolver.prototype, "runtimeHostingUserInfo", null);
|
|
912
|
+
__decorate([
|
|
913
|
+
Mutation(returns => Boolean),
|
|
914
|
+
__param(0, Arg("address")),
|
|
915
|
+
__metadata("design:type", Function),
|
|
916
|
+
__metadata("design:paramtypes", [String]),
|
|
917
|
+
__metadata("design:returntype", Boolean)
|
|
918
|
+
], RuntimeResolver.prototype, "runtimeSetHotWalletAddress", null);
|
|
919
|
+
__decorate([
|
|
920
|
+
Mutation(returns => PaymentRequestResult),
|
|
921
|
+
__param(0, Arg("amountHOT")),
|
|
922
|
+
__metadata("design:type", Function),
|
|
923
|
+
__metadata("design:paramtypes", [String]),
|
|
924
|
+
__metadata("design:returntype", PaymentRequestResult)
|
|
925
|
+
], RuntimeResolver.prototype, "runtimeRequestPayment", null);
|
|
853
926
|
RuntimeResolver = __decorate([
|
|
854
927
|
Resolver()
|
|
855
928
|
], RuntimeResolver);
|
package/lib/src/schema.gql
CHANGED
|
@@ -144,6 +144,12 @@ type ExpressionRendered {
|
|
|
144
144
|
timestamp: String!
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
type HostingUserInfo {
|
|
148
|
+
email: String!
|
|
149
|
+
hotWalletAddress: String
|
|
150
|
+
remainingCredits: String!
|
|
151
|
+
}
|
|
152
|
+
|
|
147
153
|
type Icon {
|
|
148
154
|
code: String!
|
|
149
155
|
}
|
|
@@ -379,7 +385,9 @@ type Mutation {
|
|
|
379
385
|
runtimeRemoveNotification(id: String!): Boolean!
|
|
380
386
|
runtimeRequestInstallNotification(notification: NotificationInput!): String!
|
|
381
387
|
runtimeRequestLoginVerification(appInfo: AuthInfoInput, email: String!): VerificationRequestResult!
|
|
388
|
+
runtimeRequestPayment(amountHOT: String!): PaymentRequestResult!
|
|
382
389
|
runtimeRestartHolochain: Boolean!
|
|
390
|
+
runtimeSetHotWalletAddress(address: String!): Boolean!
|
|
383
391
|
runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
|
|
384
392
|
runtimeSetStatus(status: PerspectiveInput!): Boolean!
|
|
385
393
|
runtimeTestEmail(to: String!): Boolean!
|
|
@@ -428,6 +436,11 @@ type OnlineAgent {
|
|
|
428
436
|
status: PerspectiveExpression!
|
|
429
437
|
}
|
|
430
438
|
|
|
439
|
+
type PaymentRequestResult {
|
|
440
|
+
message: String!
|
|
441
|
+
success: Boolean!
|
|
442
|
+
}
|
|
443
|
+
|
|
431
444
|
type Perspective {
|
|
432
445
|
links: [LinkExpression!]!
|
|
433
446
|
}
|
|
@@ -489,6 +502,7 @@ type Query {
|
|
|
489
502
|
runtimeFriends: [String!]!
|
|
490
503
|
runtimeGetNetworkMetrics: String!
|
|
491
504
|
runtimeHcAgentInfos: String!
|
|
505
|
+
runtimeHostingUserInfo: HostingUserInfo!
|
|
492
506
|
runtimeInfo: RuntimeInfo!
|
|
493
507
|
runtimeKnownLinkLanguageTemplates: [String!]!
|
|
494
508
|
runtimeListUsers: [UserStatistics!]!
|
|
@@ -9,6 +9,18 @@ export interface AD4MAction {
|
|
|
9
9
|
target: string;
|
|
10
10
|
local?: boolean;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* A single structured conformance condition for relation filtering.
|
|
14
|
+
* DB-agnostic representation that can be translated to any query language.
|
|
15
|
+
*/
|
|
16
|
+
export interface ConformanceCondition {
|
|
17
|
+
/** Type of check: 'flag' (predicate + value) or 'required' (predicate exists) */
|
|
18
|
+
type: 'flag' | 'required';
|
|
19
|
+
/** The predicate URI to check on the target node */
|
|
20
|
+
predicate: string;
|
|
21
|
+
/** For 'flag' conditions: the expected value */
|
|
22
|
+
value?: string;
|
|
23
|
+
}
|
|
12
24
|
/**
|
|
13
25
|
* SHACL Property Shape
|
|
14
26
|
* Represents constraints on a single property path
|
|
@@ -46,6 +58,17 @@ export interface SHACLPropertyShape {
|
|
|
46
58
|
adder?: AD4MAction[];
|
|
47
59
|
/** AD4M-specific: Remover action for collection properties */
|
|
48
60
|
remover?: AD4MAction[];
|
|
61
|
+
/** AD4M-specific: Pre-computed SurrealQL getter expression for reading this relation/property.
|
|
62
|
+
* For relations with a target model, this encodes conformance filtering
|
|
63
|
+
* so that Rust/MCP can execute the exact same query as the JS runtime. */
|
|
64
|
+
getter?: string;
|
|
65
|
+
/** AD4M-specific: Structured conformance conditions (DB-agnostic).
|
|
66
|
+
* Each condition describes a check on the target node (flag match or required property). */
|
|
67
|
+
conformanceConditions?: ConformanceCondition[];
|
|
68
|
+
/** sh:class — the target SHACL node shape URI that linked nodes must conform to.
|
|
69
|
+
* Set automatically when a relation has a `target` model. Enables typed construction
|
|
70
|
+
* on the Rust/MCP side by referencing the full target shape. */
|
|
71
|
+
class?: string;
|
|
49
72
|
}
|
|
50
73
|
/**
|
|
51
74
|
* SHACL Node Shape
|
|
@@ -357,6 +357,27 @@ export class SHACLShape {
|
|
|
357
357
|
target: `literal://string:${JSON.stringify(prop.remover)}`
|
|
358
358
|
});
|
|
359
359
|
}
|
|
360
|
+
if (prop.getter) {
|
|
361
|
+
links.push({
|
|
362
|
+
source: propShapeId,
|
|
363
|
+
predicate: "ad4m://getter",
|
|
364
|
+
target: `literal://string:${prop.getter}`
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
if (prop.conformanceConditions && prop.conformanceConditions.length > 0) {
|
|
368
|
+
links.push({
|
|
369
|
+
source: propShapeId,
|
|
370
|
+
predicate: "ad4m://conformanceConditions",
|
|
371
|
+
target: `literal://string:${JSON.stringify(prop.conformanceConditions)}`
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
if (prop.class) {
|
|
375
|
+
links.push({
|
|
376
|
+
source: propShapeId,
|
|
377
|
+
predicate: "sh://class",
|
|
378
|
+
target: prop.class
|
|
379
|
+
});
|
|
380
|
+
}
|
|
360
381
|
}
|
|
361
382
|
return links;
|
|
362
383
|
}
|
|
@@ -510,6 +531,24 @@ export class SHACLShape {
|
|
|
510
531
|
// Ignore parse errors
|
|
511
532
|
}
|
|
512
533
|
}
|
|
534
|
+
const getterLink = links.find(l => l.source === propShapeId && l.predicate === "ad4m://getter");
|
|
535
|
+
if (getterLink) {
|
|
536
|
+
prop.getter = getterLink.target.replace('literal://string:', '');
|
|
537
|
+
}
|
|
538
|
+
const conditionsLink = links.find(l => l.source === propShapeId && l.predicate === "ad4m://conformanceConditions");
|
|
539
|
+
if (conditionsLink) {
|
|
540
|
+
try {
|
|
541
|
+
const jsonStr = conditionsLink.target.replace('literal://string:', '');
|
|
542
|
+
prop.conformanceConditions = JSON.parse(jsonStr);
|
|
543
|
+
}
|
|
544
|
+
catch (e) {
|
|
545
|
+
// Ignore parse errors
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
const classLink = links.find(l => l.source === propShapeId && l.predicate === "sh://class");
|
|
549
|
+
if (classLink) {
|
|
550
|
+
prop.class = classLink.target;
|
|
551
|
+
}
|
|
513
552
|
shape.addProperty(prop);
|
|
514
553
|
}
|
|
515
554
|
return shape;
|
|
@@ -542,6 +581,9 @@ export class SHACLShape {
|
|
|
542
581
|
setter: p.setter,
|
|
543
582
|
adder: p.adder,
|
|
544
583
|
remover: p.remover,
|
|
584
|
+
getter: p.getter,
|
|
585
|
+
conformance_conditions: p.conformanceConditions,
|
|
586
|
+
class: p.class,
|
|
545
587
|
})),
|
|
546
588
|
constructor_actions: this.constructor_actions,
|
|
547
589
|
destructor_actions: this.destructor_actions,
|
|
@@ -572,6 +614,9 @@ export class SHACLShape {
|
|
|
572
614
|
setter: p.setter,
|
|
573
615
|
adder: p.adder,
|
|
574
616
|
remover: p.remover,
|
|
617
|
+
getter: p.getter,
|
|
618
|
+
conformanceConditions: p.conformance_conditions,
|
|
619
|
+
class: p.class,
|
|
575
620
|
});
|
|
576
621
|
}
|
|
577
622
|
if (json.constructor_actions) {
|
package/lib/src/typeDefs.js
CHANGED
|
@@ -140,6 +140,12 @@ type ExpressionRendered {
|
|
|
140
140
|
timestamp: String!
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
type HostingUserInfo {
|
|
144
|
+
email: String!
|
|
145
|
+
hotWalletAddress: String
|
|
146
|
+
remainingCredits: String!
|
|
147
|
+
}
|
|
148
|
+
|
|
143
149
|
type Icon {
|
|
144
150
|
code: String!
|
|
145
151
|
}
|
|
@@ -375,7 +381,9 @@ type Mutation {
|
|
|
375
381
|
runtimeRemoveNotification(id: String!): Boolean!
|
|
376
382
|
runtimeRequestInstallNotification(notification: NotificationInput!): String!
|
|
377
383
|
runtimeRequestLoginVerification(appInfo: AuthInfoInput, email: String!): VerificationRequestResult!
|
|
384
|
+
runtimeRequestPayment(amountHOT: String!): PaymentRequestResult!
|
|
378
385
|
runtimeRestartHolochain: Boolean!
|
|
386
|
+
runtimeSetHotWalletAddress(address: String!): Boolean!
|
|
379
387
|
runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
|
|
380
388
|
runtimeSetStatus(status: PerspectiveInput!): Boolean!
|
|
381
389
|
runtimeTestEmail(to: String!): Boolean!
|
|
@@ -424,6 +432,11 @@ type OnlineAgent {
|
|
|
424
432
|
status: PerspectiveExpression!
|
|
425
433
|
}
|
|
426
434
|
|
|
435
|
+
type PaymentRequestResult {
|
|
436
|
+
message: String!
|
|
437
|
+
success: Boolean!
|
|
438
|
+
}
|
|
439
|
+
|
|
427
440
|
type Perspective {
|
|
428
441
|
links: [LinkExpression!]!
|
|
429
442
|
}
|
|
@@ -485,6 +498,7 @@ type Query {
|
|
|
485
498
|
runtimeFriends: [String!]!
|
|
486
499
|
runtimeGetNetworkMetrics: String!
|
|
487
500
|
runtimeHcAgentInfos: String!
|
|
501
|
+
runtimeHostingUserInfo: HostingUserInfo!
|
|
488
502
|
runtimeInfo: RuntimeInfo!
|
|
489
503
|
runtimeKnownLinkLanguageTemplates: [String!]!
|
|
490
504
|
runtimeListUsers: [UserStatistics!]!
|
package/package.json
CHANGED
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
"module": "lib/index.js",
|
|
6
6
|
"types": "lib/src/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "patch-package && tsc && pnpm run buildSchema && pnpm run bundle",
|
|
10
|
+
"buildSchema": "tsx lib/src/buildSchema.js",
|
|
11
|
+
"bundle": "rollup -c rollup.config.js",
|
|
12
|
+
"test": "jest --forceExit"
|
|
13
|
+
},
|
|
8
14
|
"repository": {
|
|
9
15
|
"type": "git",
|
|
10
16
|
"url": "git+https://github.com/coasys/ad4m.git"
|
|
@@ -58,11 +64,10 @@
|
|
|
58
64
|
"ws": "8.13.0"
|
|
59
65
|
},
|
|
60
66
|
"patchedDependencies": {},
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
67
|
+
"pnpm": {
|
|
68
|
+
"patchedDependencies": {
|
|
69
|
+
"graphql@15.7.2": "patches/graphql@15.7.2.patch"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"version": "0.12.0-rc2"
|
|
73
|
+
}
|
package/src/agent/AgentClient.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
EntanglementProofInput,
|
|
11
11
|
UserCreationResult,
|
|
12
12
|
} from "./Agent";
|
|
13
|
+
import { HostingUserInfo, PaymentRequestResult } from "../runtime/RuntimeResolver";
|
|
13
14
|
import { AgentStatus } from "./AgentStatus";
|
|
14
15
|
import { LinkMutations } from "../links/Links";
|
|
15
16
|
import { PerspectiveClient } from "../perspectives/PerspectiveClient";
|
|
@@ -588,4 +589,48 @@ export class AgentClient {
|
|
|
588
589
|
);
|
|
589
590
|
return runtimeVerifyEmailCode;
|
|
590
591
|
}
|
|
592
|
+
|
|
593
|
+
// Hosting methods
|
|
594
|
+
|
|
595
|
+
async hostingUserInfo(): Promise<HostingUserInfo> {
|
|
596
|
+
const { runtimeHostingUserInfo } = unwrapApolloResult(
|
|
597
|
+
await this.#apolloClient.query({
|
|
598
|
+
query: gql`query runtimeHostingUserInfo {
|
|
599
|
+
runtimeHostingUserInfo {
|
|
600
|
+
email
|
|
601
|
+
remainingCredits
|
|
602
|
+
hotWalletAddress
|
|
603
|
+
}
|
|
604
|
+
}`,
|
|
605
|
+
})
|
|
606
|
+
);
|
|
607
|
+
return runtimeHostingUserInfo;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
async setHotWalletAddress(address: string): Promise<boolean> {
|
|
611
|
+
const { runtimeSetHotWalletAddress } = unwrapApolloResult(
|
|
612
|
+
await this.#apolloClient.mutate({
|
|
613
|
+
mutation: gql`mutation runtimeSetHotWalletAddress($address: String!) {
|
|
614
|
+
runtimeSetHotWalletAddress(address: $address)
|
|
615
|
+
}`,
|
|
616
|
+
variables: { address },
|
|
617
|
+
})
|
|
618
|
+
);
|
|
619
|
+
return runtimeSetHotWalletAddress;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
async requestPayment(amountHOT: string): Promise<PaymentRequestResult> {
|
|
623
|
+
const { runtimeRequestPayment } = unwrapApolloResult(
|
|
624
|
+
await this.#apolloClient.mutate({
|
|
625
|
+
mutation: gql`mutation runtimeRequestPayment($amountHOT: String!) {
|
|
626
|
+
runtimeRequestPayment(amountHOT: $amountHOT) {
|
|
627
|
+
success
|
|
628
|
+
message
|
|
629
|
+
}
|
|
630
|
+
}`,
|
|
631
|
+
variables: { amountHOT },
|
|
632
|
+
})
|
|
633
|
+
);
|
|
634
|
+
return runtimeRequestPayment;
|
|
635
|
+
}
|
|
591
636
|
}
|
package/src/index.ts
CHANGED
|
@@ -16,11 +16,11 @@ export * from "./Literal";
|
|
|
16
16
|
export * from "./perspectives/Perspective";
|
|
17
17
|
export * from "./perspectives/PerspectiveHandle";
|
|
18
18
|
export * from "./perspectives/PerspectiveProxy";
|
|
19
|
+
export * from "./perspectives/WakerSubscriptionManager";
|
|
19
20
|
export * from "./perspectives/PerspectiveDiff";
|
|
20
21
|
export * from "./perspectives/LinkQuery";
|
|
21
22
|
export * from "./SmartLiteral";
|
|
22
|
-
export * from "./model
|
|
23
|
-
export * from "./model/Subject";
|
|
23
|
+
export * from "./model";
|
|
24
24
|
export * from "./neighbourhood/Neighbourhood";
|
|
25
25
|
export * from "./neighbourhood/NeighbourhoodProxy";
|
|
26
26
|
export * from "./typeDefs";
|
|
@@ -30,6 +30,5 @@ export * from "./agent/AgentClient";
|
|
|
30
30
|
export * from "./ai/AIClient"
|
|
31
31
|
export * from "./ai/Tasks"
|
|
32
32
|
export * from "./runtime/RuntimeResolver"
|
|
33
|
-
export * from './model/Ad4mModel'
|
|
34
33
|
export * from './shacl/SHACLShape'
|
|
35
34
|
export { SHACLFlow, FlowState, FlowTransition, LinkPattern, FlowableCondition } from './shacl/SHACLFlow'
|