@coasys/ad4m 0.12.0-rc1-dev.5 → 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.
Files changed (161) hide show
  1. package/lib/index.cjs +4968 -4805
  2. package/lib/index.js +4936 -4801
  3. package/lib/src/agent/AgentClient.d.ts +4 -0
  4. package/lib/src/agent/AgentClient.js +34 -0
  5. package/lib/src/index.d.ts +2 -3
  6. package/lib/src/index.js +2 -3
  7. package/lib/src/model/Ad4mModel.d.ts +8 -812
  8. package/lib/src/model/Ad4mModel.js +78 -2390
  9. package/lib/src/model/ModelQueryBuilder.d.ts +370 -0
  10. package/lib/src/model/ModelQueryBuilder.js +556 -0
  11. package/lib/src/model/decorators.d.ts +2 -20
  12. package/lib/src/model/decorators.js +5 -410
  13. package/lib/src/model/hydration.d.ts +102 -0
  14. package/lib/src/model/hydration.js +709 -0
  15. package/lib/src/model/index.d.ts +20 -0
  16. package/lib/src/model/index.js +20 -0
  17. package/lib/src/model/{schema/fromJSONSchema.d.ts → json-schema.d.ts} +45 -12
  18. package/lib/src/model/json-schema.js +326 -0
  19. package/lib/src/model/prolog-facts.d.ts +37 -0
  20. package/lib/src/model/{prolog/generatePrologFacts.js → prolog-facts.js} +47 -52
  21. package/lib/src/model/query-common.d.ts +14 -0
  22. package/lib/src/model/query-common.js +36 -0
  23. package/lib/src/model/query-prolog.d.ts +15 -0
  24. package/lib/src/model/query-prolog.js +140 -0
  25. package/lib/src/model/query-surreal.d.ts +44 -0
  26. package/lib/src/model/query-surreal.js +249 -0
  27. package/lib/src/model/sdna.d.ts +14 -0
  28. package/lib/src/model/sdna.js +141 -0
  29. package/lib/src/model/shacl-gen.d.ts +31 -0
  30. package/lib/src/model/shacl-gen.js +246 -0
  31. package/lib/src/model/surreal-utils.d.ts +1 -1
  32. package/lib/src/model/types.d.ts +75 -96
  33. package/lib/src/model/types.js +4 -4
  34. package/lib/src/model/util.d.ts +4 -5
  35. package/lib/src/model/util.js +12 -32
  36. package/lib/src/perspectives/PerspectiveClient.d.ts +1 -1
  37. package/lib/src/perspectives/PerspectiveProxy.d.ts +1 -1
  38. package/lib/src/perspectives/WakerSubscriptionManager.d.ts +79 -0
  39. package/lib/src/perspectives/WakerSubscriptionManager.js +196 -0
  40. package/lib/src/runtime/RuntimeResolver.d.ts +14 -0
  41. package/lib/src/runtime/RuntimeResolver.js +73 -0
  42. package/lib/src/schema.gql +14 -0
  43. package/lib/src/typeDefs.js +14 -0
  44. package/package.json +13 -8
  45. package/src/agent/AgentClient.ts +45 -0
  46. package/src/index.ts +2 -3
  47. package/src/model/Ad4mModel.ts +1084 -3818
  48. package/src/model/ModelQueryBuilder.ts +617 -0
  49. package/src/model/Subject.ts +1 -1
  50. package/src/model/decorators.ts +17 -475
  51. package/src/model/hydration.ts +796 -0
  52. package/src/model/index.ts +21 -0
  53. package/src/model/json-schema.ts +424 -0
  54. package/src/model/prolog-facts.ts +145 -0
  55. package/src/model/query-common.ts +48 -0
  56. package/src/model/query-prolog.ts +148 -0
  57. package/src/model/query-surreal.ts +280 -0
  58. package/src/model/relation-filtering.test.ts +0 -1
  59. package/src/model/sdna.ts +170 -0
  60. package/src/model/shacl-gen.ts +292 -0
  61. package/src/model/surreal-utils.ts +1 -1
  62. package/src/model/types.ts +182 -0
  63. package/src/model/util.ts +13 -36
  64. package/src/perspectives/PerspectiveClient.ts +1 -1
  65. package/src/perspectives/PerspectiveProxy.ts +1 -1
  66. package/src/perspectives/WakerSubscriptionManager.ts +292 -0
  67. package/src/runtime/RuntimeResolver.ts +53 -0
  68. package/lib/src/Ad4mClient.test.d.ts +0 -1
  69. package/lib/src/Ad4mClient.test.js +0 -1204
  70. package/lib/src/Literal.test.d.ts +0 -1
  71. package/lib/src/Literal.test.js +0 -41
  72. package/lib/src/model/mutation.d.ts +0 -81
  73. package/lib/src/model/mutation.js +0 -317
  74. package/lib/src/model/parentUtils.d.ts +0 -32
  75. package/lib/src/model/parentUtils.js +0 -64
  76. package/lib/src/model/prolog/generatePrologFacts.d.ts +0 -36
  77. package/lib/src/model/prolog/index.d.ts +0 -1
  78. package/lib/src/model/prolog/index.js +0 -1
  79. package/lib/src/model/query/ModelQueryBuilder.d.ts +0 -82
  80. package/lib/src/model/query/ModelQueryBuilder.js +0 -115
  81. package/lib/src/model/query/QueryBuilder.d.ts +0 -101
  82. package/lib/src/model/query/QueryBuilder.js +0 -193
  83. package/lib/src/model/query/SurrealQueryBuilder.d.ts +0 -48
  84. package/lib/src/model/query/SurrealQueryBuilder.js +0 -371
  85. package/lib/src/model/query/fetchInstance.d.ts +0 -24
  86. package/lib/src/model/query/fetchInstance.js +0 -144
  87. package/lib/src/model/query/hydration.d.ts +0 -54
  88. package/lib/src/model/query/hydration.js +0 -214
  89. package/lib/src/model/query/operations.d.ts +0 -59
  90. package/lib/src/model/query/operations.js +0 -384
  91. package/lib/src/model/query/snapshot.d.ts +0 -59
  92. package/lib/src/model/query/snapshot.js +0 -106
  93. package/lib/src/model/query/surrealCompiler.d.ts +0 -42
  94. package/lib/src/model/query/surrealCompiler.js +0 -304
  95. package/lib/src/model/schema/fromJSONSchema.js +0 -264
  96. package/lib/src/model/schema/metadata.d.ts +0 -15
  97. package/lib/src/model/schema/metadata.js +0 -112
  98. package/lib/src/model/subscription.d.ts +0 -47
  99. package/lib/src/model/subscription.js +0 -231
  100. package/lib/src/model/transaction.d.ts +0 -27
  101. package/lib/src/model/transaction.js +0 -32
  102. package/lib/src/shims/reflect-metadata.d.ts +0 -0
  103. package/lib/src/shims/type-graphql.d.ts +0 -32
  104. package/lib/src/src/Ad4mClient.d.ts +0 -28
  105. package/lib/src/src/Address.d.ts +0 -1
  106. package/lib/src/src/DID.d.ts +0 -1
  107. package/lib/src/src/Exception.d.ts +0 -7
  108. package/lib/src/src/Literal.d.ts +0 -7
  109. package/lib/src/src/PubSub.d.ts +0 -17
  110. package/lib/src/src/SmartLiteral.d.ts +0 -12
  111. package/lib/src/src/agent/Agent.d.ts +0 -110
  112. package/lib/src/src/agent/AgentClient.d.ts +0 -62
  113. package/lib/src/src/agent/AgentResolver.d.ts +0 -30
  114. package/lib/src/src/agent/AgentStatus.d.ts +0 -8
  115. package/lib/src/src/ai/AIClient.d.ts +0 -32
  116. package/lib/src/src/ai/AIResolver.d.ts +0 -75
  117. package/lib/src/src/ai/Tasks.d.ts +0 -37
  118. package/lib/src/src/buildSchema.d.ts +0 -1
  119. package/lib/src/src/expression/Expression.d.ts +0 -28
  120. package/lib/src/src/expression/ExpressionClient.d.ts +0 -13
  121. package/lib/src/src/expression/ExpressionRef.d.ts +0 -9
  122. package/lib/src/src/expression/ExpressionResolver.d.ts +0 -10
  123. package/lib/src/src/index.d.ts +0 -35
  124. package/lib/src/src/jestSetup.d.ts +0 -1
  125. package/lib/src/src/language/Icon.d.ts +0 -4
  126. package/lib/src/src/language/Language.d.ts +0 -206
  127. package/lib/src/src/language/LanguageClient.d.ts +0 -17
  128. package/lib/src/src/language/LanguageContext.d.ts +0 -37
  129. package/lib/src/src/language/LanguageHandle.d.ts +0 -9
  130. package/lib/src/src/language/LanguageMeta.d.ts +0 -35
  131. package/lib/src/src/language/LanguageRef.d.ts +0 -6
  132. package/lib/src/src/language/LanguageResolver.d.ts +0 -19
  133. package/lib/src/src/links/Links.d.ts +0 -39
  134. package/lib/src/src/links/Links.test.d.ts +0 -1
  135. package/lib/src/src/model/Ad4mModel.d.ts +0 -1438
  136. package/lib/src/src/model/Ad4mModel.test.d.ts +0 -1
  137. package/lib/src/src/model/Subject.d.ts +0 -25
  138. package/lib/src/src/model/decorators.d.ts +0 -545
  139. package/lib/src/src/model/util.d.ts +0 -12
  140. package/lib/src/src/neighbourhood/Neighbourhood.d.ts +0 -10
  141. package/lib/src/src/neighbourhood/NeighbourhoodClient.d.ts +0 -25
  142. package/lib/src/src/neighbourhood/NeighbourhoodProxy.d.ts +0 -19
  143. package/lib/src/src/neighbourhood/NeighbourhoodProxy.test.d.ts +0 -1
  144. package/lib/src/src/neighbourhood/NeighbourhoodResolver.d.ts +0 -24
  145. package/lib/src/src/perspectives/LinkQuery.d.ts +0 -11
  146. package/lib/src/src/perspectives/Perspective.d.ts +0 -38
  147. package/lib/src/src/perspectives/Perspective.test.d.ts +0 -1
  148. package/lib/src/src/perspectives/PerspectiveClient.d.ts +0 -97
  149. package/lib/src/src/perspectives/PerspectiveDiff.d.ts +0 -9
  150. package/lib/src/src/perspectives/PerspectiveHandle.d.ts +0 -18
  151. package/lib/src/src/perspectives/PerspectiveProxy.d.ts +0 -865
  152. package/lib/src/src/perspectives/PerspectiveResolver.d.ts +0 -57
  153. package/lib/src/src/runtime/RuntimeClient.d.ts +0 -56
  154. package/lib/src/src/runtime/RuntimeResolver.d.ts +0 -132
  155. package/lib/src/src/shacl/SHACLFlow.d.ts +0 -171
  156. package/lib/src/src/shacl/SHACLFlow.test.d.ts +0 -1
  157. package/lib/src/src/shacl/SHACLShape.d.ts +0 -117
  158. package/lib/src/src/shacl/SHACLShape.test.d.ts +0 -1
  159. package/lib/src/src/typeDefs.d.ts +0 -1
  160. package/lib/src/src/unwrapApolloResult.d.ts +0 -2
  161. package/lib/src/src/utils.d.ts +0 -25
@@ -0,0 +1,292 @@
1
+ /**
2
+ * WakerSubscriptionManager — manages live SurrealDB subscriptions for the waker.
3
+ *
4
+ * Lives in core so it can be imported by both the plugin and integration tests
5
+ * without ESM/CJS import issues.
6
+ *
7
+ * NOTE: keep in sync with plugins/ad4m/wakerSubscriptionManager.ts
8
+ */
9
+
10
+ export interface WakerSubscription {
11
+ id: string;
12
+ type: "mention" | "channel-messages";
13
+ perspective: string;
14
+ channel: string;
15
+ query: string;
16
+ neighbourhood?: string;
17
+ }
18
+
19
+ /** Per-message parent resolution result for mention subscriptions. */
20
+ export interface MentionMessage {
21
+ /** The message's expression address (source of the body link). */
22
+ address: string;
23
+ /** All parent addresses this message belongs to (channels, conversations, etc.). */
24
+ parents: string[];
25
+ }
26
+
27
+ export interface WakerLogger {
28
+ info(msg: string): void;
29
+ warn(msg: string): void;
30
+ error(msg: string): void;
31
+ debug(msg: string): void;
32
+ }
33
+
34
+ export interface WakerSubscriptionManagerOptions {
35
+ /** PerspectiveClient from Ad4mClient (provides perspectiveSubscribeSurrealQuery etc.) */
36
+ perspectiveClient: any;
37
+ /** Logger instance */
38
+ logger: WakerLogger;
39
+ /** Debounce interval in ms before firing the wake callback (default 2000) */
40
+ debounceMs?: number;
41
+ /** Called when a subscription fires (after debounce). Return value is ignored.
42
+ * For mention subs, `mentions` contains per-message parent info. */
43
+ onWake: (sub: WakerSubscription, result: any, mentions?: MentionMessage[]) => void;
44
+ /** Called when the active subscription list changes (for persistence). */
45
+ onPersist?: (subscriptions: WakerSubscription[], seenMessages: Record<string, string[]>) => void;
46
+ /** Previously persisted seen message IDs per subscription. Seeds seenMessages on resubscribe to avoid duplicate wakes. */
47
+ previousSeenMessages?: Record<string, string[]>;
48
+ /** Optional: provide QuerySubscriptionProxy class directly (avoids require("@coasys/ad4m") at runtime). */
49
+ QuerySubscriptionProxy?: any;
50
+ }
51
+
52
+ export class WakerSubscriptionManager {
53
+ private perspectiveClient: any;
54
+ private logger: WakerLogger;
55
+ private debounceMs: number;
56
+ private onWake: (sub: WakerSubscription, result: any, mentions?: MentionMessage[]) => void;
57
+ private onPersist?: (subscriptions: WakerSubscription[], seenMessages: Record<string, string[]>) => void;
58
+ private QuerySubscriptionProxyCtor: any;
59
+ private previousSeenMessages: Record<string, string[]>;
60
+
61
+ private proxies = new Map<string, any>();
62
+ private activeSubscriptions = new Map<string, WakerSubscription>();
63
+ private debounceTimers = new Map<string, ReturnType<typeof setTimeout>>();
64
+ /** Per-subscription set of already-processed message addresses (for mention subs)
65
+ * or serialized result hash (for channel-messages subs). */
66
+ private seenMessages = new Map<string, Set<string>>();
67
+
68
+ constructor(options: WakerSubscriptionManagerOptions) {
69
+ this.perspectiveClient = options.perspectiveClient;
70
+ this.logger = options.logger;
71
+ this.debounceMs = options.debounceMs ?? 2000;
72
+ this.onWake = options.onWake;
73
+ this.onPersist = options.onPersist;
74
+ this.QuerySubscriptionProxyCtor = options.QuerySubscriptionProxy ?? null;
75
+ this.previousSeenMessages = options.previousSeenMessages ?? {};
76
+ }
77
+
78
+ /**
79
+ * Create a live SurrealDB subscription.
80
+ * If a subscription with the same id already exists, it is disposed first.
81
+ */
82
+ async subscribe(sub: WakerSubscription): Promise<void> {
83
+ // Dispose existing subscription with same id if any
84
+ this.dispose(sub.id, false);
85
+
86
+ if (!this.QuerySubscriptionProxyCtor) {
87
+ throw new Error("WakerSubscriptionManager: QuerySubscriptionProxy must be provided via constructor options");
88
+ }
89
+ const QuerySubscriptionProxy = this.QuerySubscriptionProxyCtor;
90
+
91
+ this.logger.info(
92
+ `[waker] ${sub.id}: creating subscription (perspective=${sub.perspective}, type=${sub.type})`,
93
+ );
94
+ this.logger.info(`[waker] ${sub.id}: SurrealQL query:\n${sub.query}`);
95
+
96
+ const proxy = new QuerySubscriptionProxy(
97
+ sub.perspective,
98
+ sub.query,
99
+ this.perspectiveClient,
100
+ );
101
+ proxy.isSurrealDB = true;
102
+ // Suppress unhandled rejection from proxy.initialized — QuerySubscriptionProxy
103
+ // rejects this promise internally when subscribe() fails, and if nobody catches
104
+ // it before the next microtask it crashes the process.
105
+ if (proxy.initialized && typeof proxy.initialized.catch === "function") {
106
+ proxy.initialized.catch(() => {});
107
+ }
108
+ try {
109
+ await proxy.subscribe();
110
+ await proxy.initialized;
111
+ } catch (err: any) {
112
+ const msg = err?.message ?? String(err);
113
+ this.logger.warn(
114
+ `[waker] ${sub.id}: subscription failed — ${msg}`,
115
+ );
116
+ try { proxy.dispose(); } catch {}
117
+ // Remove from active state so it doesn't get persisted/retried
118
+ this.activeSubscriptions.delete(sub.id);
119
+ this.seenMessages.delete(sub.id);
120
+ this.persist();
121
+ return; // Don't throw — caller should not crash
122
+ }
123
+ this.logger.info(`[waker] ${sub.id}: subscription initialized successfully`);
124
+
125
+ // Seed from persisted seen messages so we don't re-wake after restart
126
+ const seen = new Set<string>(this.previousSeenMessages[sub.id] ?? []);
127
+ this.seenMessages.set(sub.id, seen);
128
+ if (seen.size > 0) {
129
+ this.logger.info(`[waker] ${sub.id}: seeded ${seen.size} seen message(s) from persisted state`);
130
+ }
131
+
132
+ proxy.onResult(async (result: any) => {
133
+ this.logger.info(
134
+ `[waker] ${sub.id}: onResult fired — type=${typeof result}, isArray=${Array.isArray(result)}, value=${String(JSON.stringify(result)).substring(0, 500)}`,
135
+ );
136
+
137
+ // SurrealDB can deliver non-array values (e.g. false) on disconnect/reconnect — ignore them
138
+ if (!Array.isArray(result)) {
139
+ this.logger.warn(
140
+ `[waker] ${sub.id}: ignoring non-array result: ${JSON.stringify(result)}`,
141
+ );
142
+ return;
143
+ }
144
+
145
+ if (sub.type === "mention") {
146
+ // For mention subscriptions: track seen message addresses.
147
+ // Only wake for messages we haven't seen before.
148
+ const currentSeen = this.seenMessages.get(sub.id) ?? new Set<string>();
149
+ const newMessages: string[] = [];
150
+
151
+ for (const item of result) {
152
+ if (item && item.source && !currentSeen.has(item.source)) {
153
+ newMessages.push(item.source);
154
+ }
155
+ }
156
+
157
+ if (newMessages.length === 0) {
158
+ this.logger.info(
159
+ `[waker] ${sub.id}: all ${result.length} items already seen, skipping`,
160
+ );
161
+ return;
162
+ }
163
+
164
+ this.logger.info(
165
+ `[waker] ${sub.id}: ${newMessages.length} new message(s) out of ${result.length} total`,
166
+ );
167
+
168
+ // Resolve parents per new message
169
+ const mentions: MentionMessage[] = [];
170
+ for (const msgAddr of newMessages) {
171
+ const parents: string[] = [];
172
+ try {
173
+ const escaped = msgAddr.replace(/'/g, "\\'");
174
+ const parentQuery = `SELECT * FROM link WHERE predicate = 'ad4m://has_child' AND target = '${escaped}'`;
175
+ this.logger.info(`[waker] ${sub.id}: resolving parents for ${msgAddr}`);
176
+ const parentResult = await this.perspectiveClient.querySurrealDB(sub.perspective, parentQuery);
177
+ if (Array.isArray(parentResult)) {
178
+ for (const link of parentResult) {
179
+ if (link && link.source) {
180
+ parents.push(link.source);
181
+ }
182
+ }
183
+ }
184
+ } catch (err: any) {
185
+ this.logger.warn(
186
+ `[waker] ${sub.id}: parent resolution failed for ${msgAddr} — ${err?.message ?? err}`,
187
+ );
188
+ }
189
+ this.logger.info(
190
+ `[waker] ${sub.id}: message ${msgAddr} has ${parents.length} parent(s): ${parents.join(", ")}`,
191
+ );
192
+ mentions.push({ address: msgAddr, parents });
193
+ }
194
+
195
+ // Mark all new messages as seen
196
+ for (const addr of newMessages) {
197
+ currentSeen.add(addr);
198
+ }
199
+ this.seenMessages.set(sub.id, currentSeen);
200
+
201
+ // Debounce the wake callback
202
+ const existing = this.debounceTimers.get(sub.id);
203
+ if (existing) clearTimeout(existing);
204
+
205
+ this.debounceTimers.set(
206
+ sub.id,
207
+ setTimeout(() => {
208
+ this.onWake(sub, result, mentions);
209
+ this.debounceTimers.delete(sub.id);
210
+ this.persist();
211
+ }, this.debounceMs),
212
+ );
213
+ } else {
214
+ // For channel-messages: always notify the agent on every subscription push.
215
+ // No deduplication — the agent reads recent messages itself.
216
+ this.logger.info(
217
+ `[waker] ${sub.id}: channel update (${result.length} items)`,
218
+ );
219
+
220
+ const existing = this.debounceTimers.get(sub.id);
221
+ if (existing) clearTimeout(existing);
222
+
223
+ this.debounceTimers.set(
224
+ sub.id,
225
+ setTimeout(() => {
226
+ this.onWake(sub, result);
227
+ this.debounceTimers.delete(sub.id);
228
+ }, this.debounceMs),
229
+ );
230
+ }
231
+ });
232
+
233
+ this.proxies.set(sub.id, proxy);
234
+ this.activeSubscriptions.set(sub.id, sub);
235
+ this.persist();
236
+
237
+ this.logger.info(
238
+ `[waker] Subscription ${sub.id} active (type=${sub.type}, perspective=${sub.perspective})`,
239
+ );
240
+ }
241
+
242
+ /**
243
+ * Dispose a single subscription.
244
+ * @param persist — if false, skip calling onPersist (used during batch cleanup).
245
+ */
246
+ dispose(id: string, persist = true): void {
247
+ const proxy = this.proxies.get(id);
248
+ if (proxy) {
249
+ try {
250
+ proxy.dispose();
251
+ } catch {
252
+ /* ignore */
253
+ }
254
+ this.proxies.delete(id);
255
+ }
256
+ const timer = this.debounceTimers.get(id);
257
+ if (timer) {
258
+ clearTimeout(timer);
259
+ this.debounceTimers.delete(id);
260
+ }
261
+ this.activeSubscriptions.delete(id);
262
+ this.seenMessages.delete(id);
263
+ if (persist) this.persist();
264
+ }
265
+
266
+ /** Dispose all active subscriptions. */
267
+ disposeAll(): void {
268
+ for (const [id] of this.proxies) {
269
+ this.dispose(id, false);
270
+ }
271
+ }
272
+
273
+ /** Get all active subscriptions. */
274
+ getActive(): WakerSubscription[] {
275
+ return Array.from(this.activeSubscriptions.values());
276
+ }
277
+
278
+ /** Check if a subscription exists. */
279
+ has(id: string): boolean {
280
+ return this.activeSubscriptions.has(id);
281
+ }
282
+
283
+ private persist(): void {
284
+ if (this.onPersist) {
285
+ const seen: Record<string, string[]> = {};
286
+ for (const [id, set] of this.seenMessages) {
287
+ seen[id] = Array.from(set);
288
+ }
289
+ this.onPersist(this.getActive(), seen);
290
+ }
291
+ }
292
+ }
@@ -223,6 +223,38 @@ export class VerificationRequestResult {
223
223
  isExistingUser: boolean;
224
224
  }
225
225
 
226
+ @ObjectType()
227
+ export class HostingUserInfo {
228
+ @Field()
229
+ email: string;
230
+
231
+ @Field()
232
+ remainingCredits: string;
233
+
234
+ @Field({ nullable: true })
235
+ hotWalletAddress?: string;
236
+
237
+ constructor(email: string, remainingCredits: string, hotWalletAddress?: string) {
238
+ this.email = email;
239
+ this.remainingCredits = remainingCredits;
240
+ this.hotWalletAddress = hotWalletAddress;
241
+ }
242
+ }
243
+
244
+ @ObjectType()
245
+ export class PaymentRequestResult {
246
+ @Field()
247
+ success: boolean;
248
+
249
+ @Field()
250
+ message: string;
251
+
252
+ constructor(success: boolean, message: string) {
253
+ this.success = success;
254
+ this.message = message;
255
+ }
256
+ }
257
+
226
258
  /**
227
259
  * Resolver classes are used here to define the GraphQL schema
228
260
  * (through the type-graphql annotations)
@@ -560,5 +592,26 @@ export default class RuntimeResolver {
560
592
  // For testing: simulate setting expiry (no-op in mock)
561
593
  return true
562
594
  }
595
+
596
+ // Hosting mutations & queries
597
+
598
+ @Query(returns => HostingUserInfo)
599
+ runtimeHostingUserInfo(): HostingUserInfo {
600
+ return new HostingUserInfo("test@example.com", "100000000", null)
601
+ }
602
+
603
+ @Mutation(returns => Boolean)
604
+ runtimeSetHotWalletAddress(
605
+ @Arg("address") address: string
606
+ ): boolean {
607
+ return true
608
+ }
609
+
610
+ @Mutation(returns => PaymentRequestResult)
611
+ runtimeRequestPayment(
612
+ @Arg("amountHOT") amountHOT: string
613
+ ): PaymentRequestResult {
614
+ return new PaymentRequestResult(true, "Mock payment of " + amountHOT + " base units credited")
615
+ }
563
616
  }
564
617
 
@@ -1 +0,0 @@
1
- export {};