@drfed/graphql 0.2.0-dev.714 → 0.2.0-dev.717
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/README.md +47 -3
- package/dist/account.mjs +1 -1
- package/dist/activity-delivery/entry.mjs +2 -2
- package/dist/{actor-B1FAD_C_.mjs → actor-Bd7xAMeW.mjs} +6 -30
- package/dist/actor-Bd7xAMeW.mjs.map +1 -0
- package/dist/actor.mjs +1 -1
- package/dist/{builder-BLioFAdv.mjs → builder-BrcxJqIz.mjs} +6 -4
- package/dist/builder-BrcxJqIz.mjs.map +1 -0
- package/dist/builder-CSxRffRp.d.mts.map +1 -1
- package/dist/builder.mjs +1 -1
- package/dist/classification.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/instance.mjs +1 -1
- package/dist/object.d.mts.map +1 -1
- package/dist/object.mjs +26 -8
- package/dist/object.mjs.map +1 -1
- package/dist/readable.d.mts +177 -0
- package/dist/readable.d.mts.map +1 -0
- package/dist/readable.mjs +339 -0
- package/dist/readable.mjs.map +1 -0
- package/dist/schema-DRjGCIYI.mjs +765 -0
- package/dist/schema-DRjGCIYI.mjs.map +1 -0
- package/dist/schema.d.mts.map +1 -1
- package/dist/schema.mjs +1 -1
- package/package.json +13 -8
- package/dist/actor-B1FAD_C_.mjs.map +0 -1
- package/dist/builder-BLioFAdv.mjs.map +0 -1
- package/dist/readable-CSN0MPlO.mjs +0 -140
- package/dist/readable-CSN0MPlO.mjs.map +0 -1
- package/dist/schema-f-SnZVb9.mjs +0 -275
- package/dist/schema-f-SnZVb9.mjs.map +0 -1
|
@@ -0,0 +1,765 @@
|
|
|
1
|
+
import { n as builder } from "./builder-BrcxJqIz.mjs";
|
|
2
|
+
import { readableResourceNode, readableRevision } from "./readable.mjs";
|
|
3
|
+
import "./instance.mjs";
|
|
4
|
+
import "./account.mjs";
|
|
5
|
+
import { a as Resource } from "./actor-Bd7xAMeW.mjs";
|
|
6
|
+
import "./object.mjs";
|
|
7
|
+
import "./activity-delivery/entry.mjs";
|
|
8
|
+
import { getLogger } from "@logtape/logtape";
|
|
9
|
+
import { sessions } from "@drfed/models/schema";
|
|
10
|
+
import { eq } from "drizzle-orm/sql/expressions";
|
|
11
|
+
import { schema } from "@drfed/models";
|
|
12
|
+
import "@fedify/uri-template";
|
|
13
|
+
import { GraphQLError } from "graphql";
|
|
14
|
+
import { uuidV7 } from "@drfed/models/uuid";
|
|
15
|
+
import { and as and$1, eq as eq$1, inArray } from "drizzle-orm";
|
|
16
|
+
import { LoginChallengeError, consumeLoginChallenge, findLoginChallenge, generateLoginChallengeCode } from "@drfed/models/login";
|
|
17
|
+
import { createMessage } from "@upyo/core";
|
|
18
|
+
import { Buffer } from "node:buffer";
|
|
19
|
+
import { timingSafeEqual } from "node:crypto";
|
|
20
|
+
import { RELATION_PROPERTIES, interpretDocument } from "@drfed/federation/document";
|
|
21
|
+
import { validateDocument } from "@drfed/models/document";
|
|
22
|
+
//#region src/auth/hash.ts
|
|
23
|
+
const hashSecret = async (raw) => new Uint8Array(await crypto.subtle.digest("SHA-256", textEncoder.encode(raw))).toHex();
|
|
24
|
+
const textEncoder = new TextEncoder();
|
|
25
|
+
const ACCESS_TOKEN_BYTES = 32;
|
|
26
|
+
const generateAccessToken = () => crypto.getRandomValues(new Uint8Array(ACCESS_TOKEN_BYTES)).toBase64({
|
|
27
|
+
alphabet: "base64url",
|
|
28
|
+
omitPadding: true
|
|
29
|
+
});
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/auth/expand.ts
|
|
32
|
+
function expandVerifyUrl({ template, challengeId, code, loginOrigins }) {
|
|
33
|
+
assertVariable(template, "challengeId");
|
|
34
|
+
assertVariable(template, "code");
|
|
35
|
+
let url;
|
|
36
|
+
try {
|
|
37
|
+
url = new URL(template.expand({
|
|
38
|
+
challengeId,
|
|
39
|
+
code
|
|
40
|
+
}));
|
|
41
|
+
} catch {
|
|
42
|
+
throw invalidVerifyUrl("Verify URL template must expand to an absolute URL.");
|
|
43
|
+
}
|
|
44
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") throw invalidVerifyUrl("Verify URL must use HTTP or HTTPS.");
|
|
45
|
+
if (!loginOrigins.has(url.origin)) throw invalidVerifyUrl(`Verify URL origin is not allowed: ${url.origin}.`);
|
|
46
|
+
return url.href;
|
|
47
|
+
}
|
|
48
|
+
function assertVariable(template, name) {
|
|
49
|
+
if (!template.tokens.some((token) => token.kind === "expression" && token.vars.some((variable) => variable.name === name && variable.prefix == null))) throw invalidVerifyUrl(`Verify URL template must include {${name}}.`);
|
|
50
|
+
}
|
|
51
|
+
const invalidVerifyUrl = (message) => new GraphQLError(message, { extensions: { code: "BAD_USER_INPUT" } });
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/auth/mail.ts
|
|
54
|
+
/** Send login mail without exposing non-cancellation provider failures. */
|
|
55
|
+
async function sendMail(to, loginUrl, ctx) {
|
|
56
|
+
const signal = ctx.operationSignal ?? ctx.request.signal;
|
|
57
|
+
if (signal.aborted) throw new DOMException("Mail sending cancelled.", "AbortError");
|
|
58
|
+
try {
|
|
59
|
+
const receipt = await ctx.mailer.send(createMessage({
|
|
60
|
+
from: ctx.emailFrom,
|
|
61
|
+
to,
|
|
62
|
+
subject: "Sign in to DrFed",
|
|
63
|
+
content: renderLoginEmail(loginUrl)
|
|
64
|
+
}), { signal });
|
|
65
|
+
if (signal.aborted) throw new DOMException("Mail sending cancelled.", "AbortError");
|
|
66
|
+
logReceipt(receipt);
|
|
67
|
+
} catch {
|
|
68
|
+
if (signal.aborted) throw new DOMException("Mail sending cancelled.", "AbortError");
|
|
69
|
+
logger.warn("Login mail delivery failed.", { outcome: "exception" });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const renderLoginEmail = (loginUrl) => ({ text: `Hello, Welcome to DrFed! If you request to login to DrFed, please visit:
|
|
73
|
+
|
|
74
|
+
open ${loginUrl}
|
|
75
|
+
|
|
76
|
+
Otherwise, please just ignore this mail.` });
|
|
77
|
+
function logReceipt(receipt) {
|
|
78
|
+
if (receipt.successful) {
|
|
79
|
+
logger.debug("Login mail delivery succeeded.", { outcome: "sent" });
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
logger.warn("Login mail delivery failed.", { outcome: "failed" });
|
|
83
|
+
}
|
|
84
|
+
const logger = getLogger([
|
|
85
|
+
"drfed",
|
|
86
|
+
"graphql",
|
|
87
|
+
"auth"
|
|
88
|
+
]);
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/auth/magic-link.ts
|
|
91
|
+
const LoginChallengeRef = builder.objectRef("LoginChallenge").implement({
|
|
92
|
+
description: "An email login challenge.",
|
|
93
|
+
fields: (t) => ({ challengeId: t.expose("challengeId", {
|
|
94
|
+
type: "UUID",
|
|
95
|
+
description: "The public identifier of the login challenge."
|
|
96
|
+
}) })
|
|
97
|
+
});
|
|
98
|
+
builder.mutationFields((t) => ({ loginByEmail: t.field({
|
|
99
|
+
type: LoginChallengeRef,
|
|
100
|
+
description: "Send a magic link without revealing whether the account exists.",
|
|
101
|
+
args: {
|
|
102
|
+
email: t.arg({
|
|
103
|
+
type: "Email",
|
|
104
|
+
required: true,
|
|
105
|
+
description: "The email address of the `Account`."
|
|
106
|
+
}),
|
|
107
|
+
verifyUrl: t.arg({
|
|
108
|
+
type: "URITemplate",
|
|
109
|
+
required: true,
|
|
110
|
+
description: "Use {challengeId} and {code} variables. The URL's origin must be in the server's login allowlist."
|
|
111
|
+
})
|
|
112
|
+
},
|
|
113
|
+
async resolve(_root, { email, verifyUrl }, ctx) {
|
|
114
|
+
const challengeId = uuidV7();
|
|
115
|
+
const code = generateLoginChallengeCode();
|
|
116
|
+
const loginUrl = expandVerifyUrl({
|
|
117
|
+
challengeId,
|
|
118
|
+
code,
|
|
119
|
+
loginOrigins: ctx.loginOrigins,
|
|
120
|
+
template: verifyUrl
|
|
121
|
+
});
|
|
122
|
+
const account = await findAccount(email, ctx);
|
|
123
|
+
if (account == null) return { challengeId };
|
|
124
|
+
const verifier = {
|
|
125
|
+
challengeId,
|
|
126
|
+
code
|
|
127
|
+
};
|
|
128
|
+
await insertChallenge(account.id, verifier, ctx);
|
|
129
|
+
await sendMail(account.email, loginUrl, ctx);
|
|
130
|
+
return { challengeId };
|
|
131
|
+
}
|
|
132
|
+
}) }));
|
|
133
|
+
const findAccount = async (email, ctx) => await ctx.db.query.accounts.findFirst({ where: { email } });
|
|
134
|
+
const insertChallenge = async (accountId, { challengeId, code }, ctx) => await ctx.db.insert(schema.loginChallenges).values({
|
|
135
|
+
id: challengeId,
|
|
136
|
+
accountId,
|
|
137
|
+
code
|
|
138
|
+
});
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/auth/challenge.ts
|
|
141
|
+
const SessionRef = builder.drizzleObject("sessions", {
|
|
142
|
+
name: "Session",
|
|
143
|
+
fields: (t) => ({
|
|
144
|
+
id: t.expose("id", { type: "UUID" }),
|
|
145
|
+
accessToken: t.string({
|
|
146
|
+
nullable: true,
|
|
147
|
+
resolve(session) {
|
|
148
|
+
const accessToken = "accessToken" in session ? session.accessToken : null;
|
|
149
|
+
return typeof accessToken === "string" ? accessToken : null;
|
|
150
|
+
}
|
|
151
|
+
}),
|
|
152
|
+
account: t.relation("account", { grantScopes: ["ownAccount"] }),
|
|
153
|
+
created: t.expose("created", { type: "DateTime" }),
|
|
154
|
+
expires: t.expose("expires", { type: "DateTime" })
|
|
155
|
+
})
|
|
156
|
+
});
|
|
157
|
+
builder.mutationFields((t) => ({ completeLoginChallenge: t.drizzleField({
|
|
158
|
+
type: SessionRef,
|
|
159
|
+
nullable: true,
|
|
160
|
+
description: "Complete login challenge.",
|
|
161
|
+
args: {
|
|
162
|
+
challengeId: t.arg({
|
|
163
|
+
type: "UUID",
|
|
164
|
+
required: true
|
|
165
|
+
}),
|
|
166
|
+
code: t.arg({
|
|
167
|
+
type: "String",
|
|
168
|
+
required: true
|
|
169
|
+
})
|
|
170
|
+
},
|
|
171
|
+
async resolve(query, _root, { challengeId, code }, ctx) {
|
|
172
|
+
try {
|
|
173
|
+
const now = Temporal.Now.instant();
|
|
174
|
+
const row = await findLoginChallenge(ctx.db, challengeId, now);
|
|
175
|
+
const id = crypto.randomUUID();
|
|
176
|
+
const accessToken = generateAccessToken();
|
|
177
|
+
const accessHash = await hashSecret(accessToken);
|
|
178
|
+
const providedCode = Buffer.from(code.toLowerCase());
|
|
179
|
+
const expectedCode = Buffer.from(row.code);
|
|
180
|
+
if (providedCode.length !== expectedCode.length || !timingSafeEqual(providedCode, expectedCode)) throw new LoginChallengeError("The provided code does not match.");
|
|
181
|
+
await ctx.db.transaction(async (tx) => {
|
|
182
|
+
await consumeLoginChallenge(tx, row.id, now);
|
|
183
|
+
await insertSession(id, row.accountId, accessHash, tx);
|
|
184
|
+
});
|
|
185
|
+
const session = await ctx.db.query.sessions.findFirst(query({ where: { id } }));
|
|
186
|
+
return session == null ? null : {
|
|
187
|
+
...session,
|
|
188
|
+
accessToken
|
|
189
|
+
};
|
|
190
|
+
} catch (error) {
|
|
191
|
+
if (error instanceof LoginChallengeError) return null;
|
|
192
|
+
throw error;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}) }));
|
|
196
|
+
const insertSession = async (id, accountId, tokenHash, tx) => await tx.insert(sessions).values({
|
|
197
|
+
id,
|
|
198
|
+
accountId,
|
|
199
|
+
tokenHash
|
|
200
|
+
});
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/auth/revoke.ts
|
|
203
|
+
builder.mutationFields((t) => ({ revokeSession: t.field({
|
|
204
|
+
type: LogoutSuccessRef,
|
|
205
|
+
description: "Revokes a session. Return always `revoke: true`.",
|
|
206
|
+
authScopes: { authenticated: true },
|
|
207
|
+
async resolve(_query, _, ctx) {
|
|
208
|
+
if (ctx.session?.id) await deleteSession(ctx);
|
|
209
|
+
return { revoke: true };
|
|
210
|
+
}
|
|
211
|
+
}) }));
|
|
212
|
+
const LogoutSuccessRef = builder.objectRef("LogoutSuccess").implement({
|
|
213
|
+
description: "The session revoked.",
|
|
214
|
+
fields: (t) => ({ revoke: t.expose("revoke", {
|
|
215
|
+
type: "Boolean",
|
|
216
|
+
description: "Revoking status."
|
|
217
|
+
}) })
|
|
218
|
+
});
|
|
219
|
+
const deleteSession = (ctx) => ctx.db.delete(sessions).where(eq(sessions.id, ctx.session.id));
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/auth/entry.ts
|
|
222
|
+
builder.queryFields((t) => ({ viewer: t.drizzleField({
|
|
223
|
+
type: "accounts",
|
|
224
|
+
nullable: true,
|
|
225
|
+
description: "`Account` if authorized, else `null`",
|
|
226
|
+
resolve: (query, _root, _args, ctx) => ctx.session == null ? null : ctx.db.query.accounts.findFirst(query({ where: { id: ctx.session.accountId } }))
|
|
227
|
+
}) }));
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/revision.ts
|
|
230
|
+
const ACTIVITY_STREAMS = "https://www.w3.org/ns/activitystreams#";
|
|
231
|
+
const ResourceRevisionKind = builder.enumType("ResourceRevisionKind", {
|
|
232
|
+
description: "What a revision records.",
|
|
233
|
+
values: {
|
|
234
|
+
snapshot: { description: "A saved document." },
|
|
235
|
+
unavailable: { description: "A legacy typed row that had no retained document; nothing replaces it." },
|
|
236
|
+
whiteout: { description: "A deletion: its time and the types the resource had, but no document." }
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
const ResourceRevisionCapture = builder.enumType("ResourceRevisionCapture", {
|
|
240
|
+
description: "How DrFed came to store a revision. Neither proves ownership nor grants access.",
|
|
241
|
+
values: {
|
|
242
|
+
local: { description: "Saved by DrFed for a local actor." },
|
|
243
|
+
received: { description: "Received in an inbound activity." },
|
|
244
|
+
embedded: { description: "Embedded in another received document." },
|
|
245
|
+
fetched: { description: "Fetched apart from an activity. For legacy data, a conservative flag that is no proof an HTTP fetch occurred." }
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
const DocumentNodeKindEnum = builder.enumType("DocumentNodeKind", {
|
|
249
|
+
description: "The vocabulary category of a document's type.",
|
|
250
|
+
values: {
|
|
251
|
+
activity: {},
|
|
252
|
+
actor: {},
|
|
253
|
+
collection: {},
|
|
254
|
+
link: {},
|
|
255
|
+
object: {}
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
const RelationProperty = builder.enumType("RelationProperty", {
|
|
259
|
+
description: "A property that relates a document to another resource.",
|
|
260
|
+
values: RELATION_PROPERTIES
|
|
261
|
+
});
|
|
262
|
+
const AddressingProperty = builder.enumType("AddressingProperty", {
|
|
263
|
+
description: "A property that addresses a document's recipients.",
|
|
264
|
+
values: schema.addressingPropertyEnum.enumValues
|
|
265
|
+
});
|
|
266
|
+
const RelationRepresentation = builder.enumType("RelationRepresentation", {
|
|
267
|
+
description: "How a value names what it stands for.",
|
|
268
|
+
values: {
|
|
269
|
+
reference: { description: "An IRI." },
|
|
270
|
+
embedded: { description: "An embedded document." },
|
|
271
|
+
link: { description: "An embedded `Link`, which names it by `href`." }
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
const DiagnosticCategoryEnum = builder.enumType("DiagnosticCategory", { values: {
|
|
275
|
+
vocabulary: { description: "The document breaks a vocabulary or JSON-LD rule." },
|
|
276
|
+
authority: { description: "The document claims what it may not." },
|
|
277
|
+
support: { description: "DrFed's validator cannot check it." },
|
|
278
|
+
compatibility: { description: "Valid, but other implementations may read it otherwise." }
|
|
279
|
+
} });
|
|
280
|
+
const DiagnosticSeverityEnum = builder.enumType("DiagnosticSeverity", { values: {
|
|
281
|
+
error: {},
|
|
282
|
+
warning: {}
|
|
283
|
+
} });
|
|
284
|
+
const DocumentExtension = builder.objectRef("DocumentExtension");
|
|
285
|
+
DocumentExtension.implement({
|
|
286
|
+
description: "A custom extension property, preserved as opaque JSON.",
|
|
287
|
+
fields: (t) => ({
|
|
288
|
+
key: t.exposeString("key", { description: "The key in its source spelling." }),
|
|
289
|
+
value: t.expose("value", {
|
|
290
|
+
type: "JSON",
|
|
291
|
+
description: "As saved."
|
|
292
|
+
})
|
|
293
|
+
})
|
|
294
|
+
});
|
|
295
|
+
const DocumentDiagnostic = builder.objectRef("DocumentDiagnostic");
|
|
296
|
+
DocumentDiagnostic.implement({
|
|
297
|
+
description: "A finding of the document validator.",
|
|
298
|
+
fields: (t) => ({
|
|
299
|
+
reason: t.exposeString("reason", { description: "A stable classification, such as `unsupported_property`. Use it for decisions rather than `message`." }),
|
|
300
|
+
category: t.expose("category", { type: DiagnosticCategoryEnum }),
|
|
301
|
+
severity: t.expose("severity", { type: DiagnosticSeverityEnum }),
|
|
302
|
+
path: t.expose("path", {
|
|
303
|
+
type: "JSON",
|
|
304
|
+
description: "The source keys and list indexes leading to the finding; `[]` is the root."
|
|
305
|
+
}),
|
|
306
|
+
message: t.exposeString("message", { description: "For people; it may change." })
|
|
307
|
+
})
|
|
308
|
+
});
|
|
309
|
+
const DocumentSourceRelation = builder.enumType("DocumentSourceRelation", {
|
|
310
|
+
description: "How an embedded document relates to the revision it came from, as recorded when the document embedding it was saved.",
|
|
311
|
+
values: {
|
|
312
|
+
snapshot: { description: "It keeps the source revision's contents, apart from the context it inherits from the document embedding it." },
|
|
313
|
+
derived: { description: "It started from the source revision and was changed, as a test input with other addressing or an altered property." }
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
const DocumentSourceStatus = builder.enumType("DocumentSourceStatus", {
|
|
317
|
+
description: "Where the source revision stands in its resource's history. It compares revisions, not contents.",
|
|
318
|
+
values: {
|
|
319
|
+
current: { description: "It is the resource's current revision." },
|
|
320
|
+
superseded: { description: "A later revision is current, which may have the same contents." },
|
|
321
|
+
deleted: { description: "The resource's current revision is a whiteout." }
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
const DocumentSource = builder.objectRef("DocumentSource");
|
|
325
|
+
const DocumentNode = builder.objectRef("DocumentNode");
|
|
326
|
+
const DocumentPollChoice = builder.objectRef("DocumentPollChoice");
|
|
327
|
+
const DocumentRelation = builder.objectRef("DocumentRelation");
|
|
328
|
+
const DocumentRecipient = builder.objectRef("DocumentRecipient");
|
|
329
|
+
const resourceLookups = /* @__PURE__ */ new WeakMap();
|
|
330
|
+
/**
|
|
331
|
+
* Finds the resource registered under an IRI, as `Activity.object` opens
|
|
332
|
+
* it: only when the viewer may read it or one of its revisions. A deleted
|
|
333
|
+
* one is found too, since its revisions stay readable. Lookups are shared within a request, since
|
|
334
|
+
* a document may name one IRI many times.
|
|
335
|
+
* @returns The resource, or null.
|
|
336
|
+
*/
|
|
337
|
+
function registeredResource(ctx, iri) {
|
|
338
|
+
if (iri == null) return Promise.resolve(null);
|
|
339
|
+
let lookups = resourceLookups.get(ctx);
|
|
340
|
+
if (lookups == null) {
|
|
341
|
+
lookups = /* @__PURE__ */ new Map();
|
|
342
|
+
resourceLookups.set(ctx, lookups);
|
|
343
|
+
}
|
|
344
|
+
let lookup = lookups.get(iri);
|
|
345
|
+
if (lookup == null) {
|
|
346
|
+
lookup = (async () => await ctx.db.query.resources.findFirst({ where: {
|
|
347
|
+
iri,
|
|
348
|
+
RAW: (table) => readableResourceNode(ctx, table.id)
|
|
349
|
+
} }) ?? null)();
|
|
350
|
+
lookups.set(iri, lookup);
|
|
351
|
+
}
|
|
352
|
+
return lookup;
|
|
353
|
+
}
|
|
354
|
+
const nodeRevisions = /* @__PURE__ */ new WeakMap();
|
|
355
|
+
const sourceLookups = /* @__PURE__ */ new WeakMap();
|
|
356
|
+
/**
|
|
357
|
+
* Tells where a source revision stands against its resource's current
|
|
358
|
+
* revision. An `unavailable` current revision, a legacy typed row without a
|
|
359
|
+
* retained document, is a later revision like any other.
|
|
360
|
+
* @param revision The source revision.
|
|
361
|
+
* @param current The current revision of its resource, when the viewer may
|
|
362
|
+
* read it.
|
|
363
|
+
* @returns The status, or null without a readable current revision.
|
|
364
|
+
*/
|
|
365
|
+
const statusOf = (revision, current) => current == null ? null : current.id === revision.id ? "current" : current.kind === "whiteout" ? "deleted" : "superseded";
|
|
366
|
+
/**
|
|
367
|
+
* Loads the recorded sources of a revision's embedded documents that the
|
|
368
|
+
* viewer may read, with where each stands, in two queries per revision
|
|
369
|
+
* whatever the number of documents it embeds. Lookups are shared within a
|
|
370
|
+
* request.
|
|
371
|
+
* @returns The sources, keyed by the JSON of the embedded documents' paths.
|
|
372
|
+
*/
|
|
373
|
+
function sourcesOf(ctx, revisionId) {
|
|
374
|
+
let lookups = sourceLookups.get(ctx);
|
|
375
|
+
if (lookups == null) {
|
|
376
|
+
lookups = /* @__PURE__ */ new Map();
|
|
377
|
+
sourceLookups.set(ctx, lookups);
|
|
378
|
+
}
|
|
379
|
+
let lookup = lookups.get(revisionId);
|
|
380
|
+
if (lookup == null) {
|
|
381
|
+
lookup = (async () => {
|
|
382
|
+
const embeddings = await ctx.db.select({
|
|
383
|
+
path: schema.revisionEmbeddings.path,
|
|
384
|
+
relation: schema.revisionEmbeddings.relation,
|
|
385
|
+
revision: schema.resourceRevisions
|
|
386
|
+
}).from(schema.revisionEmbeddings).innerJoin(schema.resourceRevisions, eq$1(schema.resourceRevisions.id, schema.revisionEmbeddings.sourceRevisionId)).where(and$1(eq$1(schema.revisionEmbeddings.revisionId, revisionId), readableRevision(ctx, schema.resourceRevisions.id)));
|
|
387
|
+
const resourceIds = [...new Set(embeddings.map(({ revision }) => revision.resourceId))];
|
|
388
|
+
const heads = resourceIds.length === 0 ? [] : await ctx.db.select({
|
|
389
|
+
resourceId: schema.resourceHeads.resourceId,
|
|
390
|
+
id: schema.resourceRevisions.id,
|
|
391
|
+
kind: schema.resourceRevisions.kind
|
|
392
|
+
}).from(schema.resourceHeads).innerJoin(schema.resourceRevisions, eq$1(schema.resourceRevisions.id, schema.resourceHeads.revisionId)).where(and$1(inArray(schema.resourceHeads.resourceId, resourceIds), readableRevision(ctx, schema.resourceRevisions.id)));
|
|
393
|
+
const current = new Map(heads.map((head) => [head.resourceId, head]));
|
|
394
|
+
return new Map(embeddings.map(({ path, relation, revision }) => [JSON.stringify(path), {
|
|
395
|
+
relation,
|
|
396
|
+
revision,
|
|
397
|
+
status: statusOf(revision, current.get(revision.resourceId))
|
|
398
|
+
}]));
|
|
399
|
+
})();
|
|
400
|
+
lookups.set(revisionId, lookup);
|
|
401
|
+
}
|
|
402
|
+
return lookup;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Finds the recorded source of an embedded document, when the viewer may
|
|
406
|
+
* read the source revision. Whatever it finds, the document itself reads
|
|
407
|
+
* as the revision embedding it does.
|
|
408
|
+
* @returns The source, or null for the root, for a document whose source is
|
|
409
|
+
* unknown, and for a source the viewer may not read, which are not
|
|
410
|
+
* told apart.
|
|
411
|
+
*/
|
|
412
|
+
async function sourceOf(ctx, node) {
|
|
413
|
+
const revisionId = nodeRevisions.get(node);
|
|
414
|
+
if (revisionId == null || node.path.length === 0) return null;
|
|
415
|
+
return (await sourcesOf(ctx, revisionId)).get(JSON.stringify(node.path)) ?? null;
|
|
416
|
+
}
|
|
417
|
+
const occurrenceFields = {
|
|
418
|
+
representation: { description: "Whether the value is an IRI, an embedded document or a `Link`." },
|
|
419
|
+
iri: "A reference's IRI, an embedded document's `id`, or a `Link`'s `href`, with a compact IRI expanded; null for an anonymous embedded value.",
|
|
420
|
+
node: "The embedded document or `Link` as the saved document embeds it, which may differ from the resource's current revision; null for a reference.",
|
|
421
|
+
resource: "The resource currently registered under `iri`, or null when there is none, or when the viewer may read neither it nor any of its revisions. A deleted resource is returned too, since its revisions stay readable. It is never fetched."
|
|
422
|
+
};
|
|
423
|
+
DocumentRelation.implement({
|
|
424
|
+
description: "One value of a relation property, in source order including duplicates.",
|
|
425
|
+
fields: (t) => ({
|
|
426
|
+
property: t.expose("property", { type: RelationProperty }),
|
|
427
|
+
path: t.expose("path", {
|
|
428
|
+
type: "JSON",
|
|
429
|
+
description: "The source path of the value from the root of the saved document, such as `[\"object\", 0]`."
|
|
430
|
+
}),
|
|
431
|
+
representation: t.expose("representation", {
|
|
432
|
+
type: RelationRepresentation,
|
|
433
|
+
...occurrenceFields.representation
|
|
434
|
+
}),
|
|
435
|
+
iri: t.expose("iri", {
|
|
436
|
+
type: "URL",
|
|
437
|
+
nullable: true,
|
|
438
|
+
description: occurrenceFields.iri
|
|
439
|
+
}),
|
|
440
|
+
node: t.expose("node", {
|
|
441
|
+
type: DocumentNode,
|
|
442
|
+
nullable: true,
|
|
443
|
+
description: occurrenceFields.node
|
|
444
|
+
}),
|
|
445
|
+
resource: t.field({
|
|
446
|
+
type: Resource,
|
|
447
|
+
nullable: true,
|
|
448
|
+
description: occurrenceFields.resource,
|
|
449
|
+
resolve: (occurrence, _, ctx) => registeredResource(ctx, occurrence.iri)
|
|
450
|
+
})
|
|
451
|
+
})
|
|
452
|
+
});
|
|
453
|
+
DocumentRecipient.implement({
|
|
454
|
+
description: "One value of an addressing property, in source order including duplicates and anonymous embedded recipients.",
|
|
455
|
+
fields: (t) => ({
|
|
456
|
+
property: t.expose("property", { type: AddressingProperty }),
|
|
457
|
+
position: t.exposeInt("position", { description: "The index of the value in its property's list, or 0 for a value written alone." }),
|
|
458
|
+
path: t.expose("path", {
|
|
459
|
+
type: "JSON",
|
|
460
|
+
description: "The source path of the value from the root of the saved document."
|
|
461
|
+
}),
|
|
462
|
+
representation: t.expose("representation", {
|
|
463
|
+
type: RelationRepresentation,
|
|
464
|
+
...occurrenceFields.representation
|
|
465
|
+
}),
|
|
466
|
+
iri: t.expose("iri", {
|
|
467
|
+
type: "URL",
|
|
468
|
+
nullable: true,
|
|
469
|
+
description: occurrenceFields.iri
|
|
470
|
+
}),
|
|
471
|
+
node: t.expose("node", {
|
|
472
|
+
type: DocumentNode,
|
|
473
|
+
nullable: true,
|
|
474
|
+
description: occurrenceFields.node
|
|
475
|
+
}),
|
|
476
|
+
resource: t.field({
|
|
477
|
+
type: Resource,
|
|
478
|
+
nullable: true,
|
|
479
|
+
description: occurrenceFields.resource,
|
|
480
|
+
resolve: (occurrence, _, ctx) => registeredResource(ctx, occurrence.iri)
|
|
481
|
+
})
|
|
482
|
+
})
|
|
483
|
+
});
|
|
484
|
+
const PollChoiceMode = builder.enumType("PollChoiceMode", {
|
|
485
|
+
description: "How a Question's choices may be answered.",
|
|
486
|
+
values: {
|
|
487
|
+
exclusive: { description: "A single-choice poll, from `oneOf`." },
|
|
488
|
+
inclusive: { description: "A multiple-choice poll, from `anyOf`." }
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
DocumentPollChoice.implement({
|
|
492
|
+
description: "One of a Question's choices as saved in this revision.",
|
|
493
|
+
fields: (t) => ({
|
|
494
|
+
path: t.expose("path", {
|
|
495
|
+
type: "JSON",
|
|
496
|
+
description: "The choice's source path from the root of the revision."
|
|
497
|
+
}),
|
|
498
|
+
iri: t.expose("iri", {
|
|
499
|
+
type: "URL",
|
|
500
|
+
nullable: true,
|
|
501
|
+
description: "The choice's IRI, or null for an anonymous embedded choice."
|
|
502
|
+
}),
|
|
503
|
+
node: t.expose("node", {
|
|
504
|
+
type: DocumentNode,
|
|
505
|
+
nullable: true,
|
|
506
|
+
description: "The choice's saved document, or null for an IRI reference."
|
|
507
|
+
})
|
|
508
|
+
})
|
|
509
|
+
});
|
|
510
|
+
const DocumentPoll = builder.objectRef("DocumentPoll");
|
|
511
|
+
DocumentPoll.implement({
|
|
512
|
+
description: "The poll fields of a saved Question.",
|
|
513
|
+
fields: (t) => ({
|
|
514
|
+
mode: t.expose("mode", {
|
|
515
|
+
type: PollChoiceMode,
|
|
516
|
+
nullable: true,
|
|
517
|
+
description: "The choice mode, or null for a Question without choices."
|
|
518
|
+
}),
|
|
519
|
+
choices: t.expose("choices", {
|
|
520
|
+
type: [DocumentPollChoice],
|
|
521
|
+
description: "Choices sorted by source key, then by list position, including duplicates."
|
|
522
|
+
}),
|
|
523
|
+
closed: t.boolean({
|
|
524
|
+
nullable: true,
|
|
525
|
+
description: "The saved boolean closing value, or null if there is none.",
|
|
526
|
+
resolve: ({ closed }) => typeof closed === "boolean" ? closed : null
|
|
527
|
+
}),
|
|
528
|
+
closedTime: t.field({
|
|
529
|
+
type: "DateTime",
|
|
530
|
+
nullable: true,
|
|
531
|
+
description: "The saved closing instant, or null if there is none.",
|
|
532
|
+
resolve: ({ closed }) => typeof closed === "string" ? Temporal.Instant.from(closed) : null
|
|
533
|
+
})
|
|
534
|
+
})
|
|
535
|
+
});
|
|
536
|
+
DocumentNode.implement({
|
|
537
|
+
description: "A vocabulary document of a saved revision, the root or one embedded in it at any depth, read by meaning, whatever keys spell its properties. It may be anonymous.",
|
|
538
|
+
fields: (t) => ({
|
|
539
|
+
path: t.expose("path", {
|
|
540
|
+
type: "JSON",
|
|
541
|
+
description: "The source path from the root, such as `[\"object\", 0]`; `[]` is the root."
|
|
542
|
+
}),
|
|
543
|
+
property: t.exposeString("property", {
|
|
544
|
+
nullable: true,
|
|
545
|
+
description: "The standard name of the property that embeds it, whatever its source spelling; null for the root."
|
|
546
|
+
}),
|
|
547
|
+
type: t.expose("type", {
|
|
548
|
+
type: "URL",
|
|
549
|
+
description: "The type IRI, such as `…/activitystreams#Note`."
|
|
550
|
+
}),
|
|
551
|
+
kind: t.expose("kind", { type: DocumentNodeKindEnum }),
|
|
552
|
+
iri: t.expose("iri", {
|
|
553
|
+
type: "URL",
|
|
554
|
+
nullable: true,
|
|
555
|
+
description: "Its `id`, or the `href` of a `Link`, with a compact IRI expanded; null when it has none."
|
|
556
|
+
}),
|
|
557
|
+
document: t.expose("value", {
|
|
558
|
+
type: "JSON",
|
|
559
|
+
description: "Its JSON as saved, with everything it embeds."
|
|
560
|
+
}),
|
|
561
|
+
poll: t.expose("poll", {
|
|
562
|
+
type: DocumentPoll,
|
|
563
|
+
nullable: true,
|
|
564
|
+
description: "The saved poll fields, or null for a type other than Question."
|
|
565
|
+
}),
|
|
566
|
+
relations: t.field({
|
|
567
|
+
type: [DocumentRelation],
|
|
568
|
+
args: { property: t.arg({ type: RelationProperty }) },
|
|
569
|
+
description: "Its own `actor`, `object`, `target`, `origin`, `result`, `instrument` and `attributedTo` values, or those of one property, in that order, then in source order including duplicates. Empty for a property it does not have.",
|
|
570
|
+
resolve: (node, { property }) => property == null ? node.relations : node.relations.filter((entry) => entry.property === property)
|
|
571
|
+
}),
|
|
572
|
+
addressing: t.field({
|
|
573
|
+
type: [DocumentRecipient],
|
|
574
|
+
args: { property: t.arg({ type: AddressingProperty }) },
|
|
575
|
+
description: "Its own `to`, `cc`, `bto`, `bcc` and `audience` values, or those of one property, in that order, then in source order including duplicates.",
|
|
576
|
+
resolve: (node, { property }) => property == null ? node.addressing : node.addressing.filter((entry) => entry.property === property)
|
|
577
|
+
}),
|
|
578
|
+
extensions: t.expose("extensions", {
|
|
579
|
+
type: [DocumentExtension],
|
|
580
|
+
description: "Its own custom extension properties, by their source keys, sorted."
|
|
581
|
+
}),
|
|
582
|
+
source: t.field({
|
|
583
|
+
type: DocumentSource,
|
|
584
|
+
nullable: true,
|
|
585
|
+
description: "The revision this embedded document came from, as recorded when the document embedding it was saved. Null for the root, for an embedded document whose source is unknown, such as one saved before sources were recorded or pasted without one, and when the viewer may not read the source revision, which are not told apart. It hides nothing else: the document reads as the revision embedding it does, whatever its source.",
|
|
586
|
+
resolve: (node, _, ctx) => sourceOf(ctx, node)
|
|
587
|
+
})
|
|
588
|
+
})
|
|
589
|
+
});
|
|
590
|
+
DocumentSource.implement({
|
|
591
|
+
description: "The revision an embedded document came from, which the viewer may read.",
|
|
592
|
+
fields: (t) => ({
|
|
593
|
+
relation: t.expose("relation", { type: DocumentSourceRelation }),
|
|
594
|
+
revision: t.field({
|
|
595
|
+
type: ResourceRevisionRef,
|
|
596
|
+
description: "The source revision, of the resource the document names.",
|
|
597
|
+
resolve: (source) => source.revision
|
|
598
|
+
}),
|
|
599
|
+
status: t.field({
|
|
600
|
+
type: DocumentSourceStatus,
|
|
601
|
+
nullable: true,
|
|
602
|
+
description: "Whether the source revision is still current, or a later revision or a deletion followed it; null when the viewer may not read the resource's current revision.",
|
|
603
|
+
resolve: (source) => source.status
|
|
604
|
+
})
|
|
605
|
+
})
|
|
606
|
+
});
|
|
607
|
+
const interpretations = /* @__PURE__ */ new WeakMap();
|
|
608
|
+
const validations = /* @__PURE__ */ new WeakMap();
|
|
609
|
+
/**
|
|
610
|
+
* Interprets a revision's document once per loaded row.
|
|
611
|
+
* @returns The root, or null unless the revision is a snapshot whose
|
|
612
|
+
* document the validator reads without errors.
|
|
613
|
+
*/
|
|
614
|
+
function rootOf(revision) {
|
|
615
|
+
if (!interpretations.has(revision)) {
|
|
616
|
+
const nodes = revision.kind === "snapshot" ? interpretDocument(revision.document) : null;
|
|
617
|
+
for (const node of nodes ?? []) nodeRevisions.set(node, revision.id);
|
|
618
|
+
interpretations.set(revision, nodes?.[0] ?? null);
|
|
619
|
+
}
|
|
620
|
+
return interpretations.get(revision);
|
|
621
|
+
}
|
|
622
|
+
function diagnosticsOf(revision) {
|
|
623
|
+
let diagnostics = validations.get(revision);
|
|
624
|
+
if (diagnostics == null) {
|
|
625
|
+
diagnostics = revision.kind === "snapshot" ? validateDocument(revision.document).diagnostics : [];
|
|
626
|
+
validations.set(revision, diagnostics);
|
|
627
|
+
}
|
|
628
|
+
return diagnostics;
|
|
629
|
+
}
|
|
630
|
+
const content = { columns: {
|
|
631
|
+
id: true,
|
|
632
|
+
kind: true,
|
|
633
|
+
document: true
|
|
634
|
+
} };
|
|
635
|
+
const ResourceRevisionRef = builder.drizzleNode("resourceRevisions", {
|
|
636
|
+
name: "ResourceRevision",
|
|
637
|
+
description: "An immutable revision of a resource. Each revision, past ones included, is readable by evidence of its own, not by the current state of its resource: one saved by DrFed for a local actor by anyone, blind recipients and unpublished activities included; one addressed to the public by anyone; one a receipt links to a delivery to a local instance the viewer is a member of by its members; and the current revision of a resource with a legacy typed row as `Activity` and `Object` tell. Where its embedded documents came from never hides it. Administrators read every revision. A later restriction or deletion of the resource hides no earlier revision. A revision the viewer may not read is left out as if it did not exist.",
|
|
638
|
+
select: { columns: {
|
|
639
|
+
id: true,
|
|
640
|
+
resourceId: true
|
|
641
|
+
} },
|
|
642
|
+
id: { column: (revision) => revision.id },
|
|
643
|
+
fields: (t) => ({
|
|
644
|
+
resource: t.relation("resource"),
|
|
645
|
+
sequence: t.exposeInt("sequence", { description: "Increases with each revision of the resource." }),
|
|
646
|
+
kind: t.expose("kind", { type: ResourceRevisionKind }),
|
|
647
|
+
capture: t.expose("capture", { type: ResourceRevisionCapture }),
|
|
648
|
+
backfilled: t.exposeBoolean("backfilled", { description: "Whether the migration from legacy typed rows created it." }),
|
|
649
|
+
created: t.expose("created", {
|
|
650
|
+
type: "DateTime",
|
|
651
|
+
description: "When DrFed stored the revision."
|
|
652
|
+
}),
|
|
653
|
+
document: t.expose("document", {
|
|
654
|
+
type: "JSON",
|
|
655
|
+
nullable: true,
|
|
656
|
+
description: "The saved JSON as is, `bto` and `bcc` included for local resources. Read `root` instead of parsing it by keys, which aliases and contexts may spell otherwise. Null unless `kind` is `snapshot`, or for a snapshot of JSON null."
|
|
657
|
+
}),
|
|
658
|
+
interpreted: t.boolean({
|
|
659
|
+
description: "Whether `root` could be derived from `document`. When false, `root` is null and, for a snapshot, `diagnostics` explain why.",
|
|
660
|
+
select: content,
|
|
661
|
+
resolve: (revision) => rootOf(revision) != null
|
|
662
|
+
}),
|
|
663
|
+
root: t.field({
|
|
664
|
+
type: DocumentNode,
|
|
665
|
+
nullable: true,
|
|
666
|
+
description: "The root document read by meaning; null unless `interpreted`.",
|
|
667
|
+
select: content,
|
|
668
|
+
resolve: (revision) => rootOf(revision)
|
|
669
|
+
}),
|
|
670
|
+
diagnostics: t.field({
|
|
671
|
+
type: [DocumentDiagnostic],
|
|
672
|
+
description: "What the current validator finds in the saved document, which may differ from what it found when the revision was stored. Empty unless `kind` is `snapshot`.",
|
|
673
|
+
select: content,
|
|
674
|
+
resolve: (revision) => diagnosticsOf(revision)
|
|
675
|
+
}),
|
|
676
|
+
deleted: t.expose("deleted", {
|
|
677
|
+
type: "DateTime",
|
|
678
|
+
nullable: true,
|
|
679
|
+
description: "The deletion time of a whiteout; null otherwise."
|
|
680
|
+
}),
|
|
681
|
+
formerTypes: t.field({
|
|
682
|
+
type: ["URL"],
|
|
683
|
+
nullable: true,
|
|
684
|
+
description: "The type IRIs the resource had, for a whiteout; null otherwise. Stored ActivityStreams names, such as `\"Note\"`, are expanded with `https://www.w3.org/ns/activitystreams#`.",
|
|
685
|
+
select: { columns: { formerTypes: true } },
|
|
686
|
+
resolve: (revision) => revision.formerTypes?.map((type) => type.includes(":") ? type : `${ACTIVITY_STREAMS}${type}`) ?? null
|
|
687
|
+
})
|
|
688
|
+
})
|
|
689
|
+
});
|
|
690
|
+
builder.drizzleObjectField("resources", "currentRevision", (t) => t.field({
|
|
691
|
+
type: ResourceRevisionRef,
|
|
692
|
+
nullable: true,
|
|
693
|
+
description: "The current revision; null for a resource without revisions, or when the viewer may not read the current revision.",
|
|
694
|
+
select: { columns: { id: true } },
|
|
695
|
+
resolve: async (resource, _, ctx) => await ctx.db.query.resourceRevisions.findFirst({ where: { RAW: (table) => and$1(inArray(table.id, ctx.db.select({ id: schema.resourceHeads.revisionId }).from(schema.resourceHeads).where(eq$1(schema.resourceHeads.resourceId, resource.id))), readableRevision(ctx, table.id)) } }) ?? null
|
|
696
|
+
}));
|
|
697
|
+
builder.drizzleObjectField("resources", "revision", (t) => t.field({
|
|
698
|
+
type: ResourceRevisionRef,
|
|
699
|
+
nullable: true,
|
|
700
|
+
args: { sequence: t.arg.int({ required: true }) },
|
|
701
|
+
description: "The revision with the given sequence; null when there is none, or when the viewer may not read it, which are not told apart.",
|
|
702
|
+
select: { columns: { id: true } },
|
|
703
|
+
resolve: async (resource, { sequence }, ctx) => await ctx.db.query.resourceRevisions.findFirst({ where: {
|
|
704
|
+
resourceId: resource.id,
|
|
705
|
+
sequence,
|
|
706
|
+
RAW: (table) => readableRevision(ctx, table.id)
|
|
707
|
+
} }) ?? null
|
|
708
|
+
}));
|
|
709
|
+
builder.drizzleObjectField("resources", "revisions", (t) => t.relatedConnection("revisions", {
|
|
710
|
+
description: "The revisions the viewer may read, newest first. Others are left out, so sequences may skip.",
|
|
711
|
+
query: (_, ctx) => ({
|
|
712
|
+
where: { RAW: (table) => readableRevision(ctx, table.id) },
|
|
713
|
+
orderBy: { sequence: "desc" }
|
|
714
|
+
})
|
|
715
|
+
}, { name: "ResourceRevisionConnection" }, { name: "ResourceRevisionEdge" }));
|
|
716
|
+
builder.drizzleNode("keys", {
|
|
717
|
+
name: "Key",
|
|
718
|
+
description: "A remote public key, identified by its IRI. Readable by any authenticated viewer, since it holds public material only.",
|
|
719
|
+
authScopes: { authenticated: true },
|
|
720
|
+
runScopesOnType: true,
|
|
721
|
+
id: { column: (key) => key.id },
|
|
722
|
+
fields: (t) => ({
|
|
723
|
+
uuid: t.expose("id", { type: "UUID" }),
|
|
724
|
+
iri: t.expose("iri", { type: "URL" }),
|
|
725
|
+
created: t.expose("created", { type: "DateTime" }),
|
|
726
|
+
versions: t.relatedConnection("versions", {
|
|
727
|
+
description: "The observed versions of the key, oldest first.",
|
|
728
|
+
query: { orderBy: {
|
|
729
|
+
firstSeen: "asc",
|
|
730
|
+
id: "asc"
|
|
731
|
+
} }
|
|
732
|
+
})
|
|
733
|
+
})
|
|
734
|
+
});
|
|
735
|
+
const observationDescription = "DrFed observation time, not the remote key rotation time; does not imply continuous use between observations.";
|
|
736
|
+
builder.drizzleNode("keyVersions", {
|
|
737
|
+
name: "KeyVersion",
|
|
738
|
+
description: "Immutable public key material observed under a `Key`. Readable by any authenticated viewer.",
|
|
739
|
+
authScopes: { authenticated: true },
|
|
740
|
+
runScopesOnType: true,
|
|
741
|
+
id: { column: (version) => version.id },
|
|
742
|
+
fields: (t) => ({
|
|
743
|
+
uuid: t.expose("id", { type: "UUID" }),
|
|
744
|
+
key: t.relation("key"),
|
|
745
|
+
publicKey: t.expose("publicKey", { type: "JSON" }),
|
|
746
|
+
fingerprint: t.exposeString("fingerprint"),
|
|
747
|
+
firstSeen: t.expose("firstSeen", {
|
|
748
|
+
type: "DateTime",
|
|
749
|
+
description: `First ${observationDescription}`
|
|
750
|
+
}),
|
|
751
|
+
lastSeen: t.expose("lastSeen", {
|
|
752
|
+
type: "DateTime",
|
|
753
|
+
description: `Last ${observationDescription}`
|
|
754
|
+
})
|
|
755
|
+
})
|
|
756
|
+
});
|
|
757
|
+
//#endregion
|
|
758
|
+
//#region src/schema.ts
|
|
759
|
+
builder.queryType({});
|
|
760
|
+
builder.mutationType({});
|
|
761
|
+
const schema$1 = builder.toSchema();
|
|
762
|
+
//#endregion
|
|
763
|
+
export { hashSecret as n, schema$1 as t };
|
|
764
|
+
|
|
765
|
+
//# sourceMappingURL=schema-DRjGCIYI.mjs.map
|