@drfed/graphql 0.0.0-stage → 0.1.0-dev.561
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/LICENSE +661 -0
- package/README.md +254 -2
- package/dist/account.d.mts +6 -0
- package/dist/account.d.mts.map +1 -0
- package/dist/account.mjs +168 -0
- package/dist/account.mjs.map +1 -0
- package/dist/activity-delivery/entry.d.mts +6 -0
- package/dist/activity-delivery/entry.d.mts.map +1 -0
- package/dist/activity-delivery/entry.mjs +291 -0
- package/dist/activity-delivery/entry.mjs.map +1 -0
- package/dist/actor-BJvviz6Q.mjs +600 -0
- package/dist/actor-BJvviz6Q.mjs.map +1 -0
- package/dist/actor.d.mts +7 -0
- package/dist/actor.d.mts.map +1 -0
- package/dist/actor.mjs +2 -0
- package/dist/builder-BLioFAdv.mjs +152 -0
- package/dist/builder-BLioFAdv.mjs.map +1 -0
- package/dist/builder-CSxRffRp.d.mts +134 -0
- package/dist/builder-CSxRffRp.d.mts.map +1 -0
- package/dist/builder.d.mts +2 -0
- package/dist/builder.mjs +2 -0
- package/dist/classification.d.mts +62 -0
- package/dist/classification.d.mts.map +1 -0
- package/dist/classification.mjs +65 -0
- package/dist/classification.mjs.map +1 -0
- package/dist/index.d.mts +55 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +86 -0
- package/dist/index.mjs.map +1 -0
- package/dist/instance.d.mts +32 -0
- package/dist/instance.d.mts.map +1 -0
- package/dist/instance.mjs +176 -0
- package/dist/instance.mjs.map +1 -0
- package/dist/object.d.mts +6 -0
- package/dist/object.d.mts.map +1 -0
- package/dist/object.mjs +321 -0
- package/dist/object.mjs.map +1 -0
- package/dist/readable-CSN0MPlO.mjs +140 -0
- package/dist/readable-CSN0MPlO.mjs.map +1 -0
- package/dist/schema-ZeV-COPn.mjs +275 -0
- package/dist/schema-ZeV-COPn.mjs.map +1 -0
- package/dist/schema.d.mts +11 -0
- package/dist/schema.d.mts.map +1 -0
- package/dist/schema.mjs +2 -0
- package/package.json +154 -3
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { a as ServerContext, c as OperationTracker, o as UserContext } from "./builder-CSxRffRp.mjs";
|
|
2
|
+
import { YogaServerInstance } from "graphql-yoga";
|
|
3
|
+
import { Database } from "@drfed/models";
|
|
4
|
+
import { Transport } from "@upyo/core";
|
|
5
|
+
import { Federation } from "@fedify/fedify";
|
|
6
|
+
//#region src/index.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Options for Yoga server.
|
|
9
|
+
*/
|
|
10
|
+
interface YogaServerOptions {
|
|
11
|
+
/** Runtime shutdown cancellation, combined with each request signal. */
|
|
12
|
+
shutdownSignal?: AbortSignal | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Track context loading and field resolvers until their actual work settles,
|
|
15
|
+
* including resolvers still running after Yoga cancels the HTTP response.
|
|
16
|
+
*/
|
|
17
|
+
trackOperation?: OperationTracker | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Email sending services.
|
|
20
|
+
*/
|
|
21
|
+
mailer?: Transport | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* The address login mail is sent from. Defaults to `noreply@` at the root
|
|
24
|
+
* origin's host name.
|
|
25
|
+
*/
|
|
26
|
+
emailFrom?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Origins for login.
|
|
29
|
+
*/
|
|
30
|
+
loginOrigins: ReadonlySet<string>;
|
|
31
|
+
/**
|
|
32
|
+
* The root origin of this deployment. Every instance is served from a
|
|
33
|
+
* subdomain of it, so `https://drfed.net` puts the instance `foo-bar` at
|
|
34
|
+
* `https://foo-bar.drfed.net`. Required: there is no sensible default for
|
|
35
|
+
* installed software, and guessing one would silently hand out subdomains
|
|
36
|
+
* of somebody else's domain.
|
|
37
|
+
*/
|
|
38
|
+
rootOrigin: URL;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Creates a Yoga server instance with the provided schema and context.
|
|
42
|
+
* @param {Database} db The database instance.
|
|
43
|
+
* @param {Federation<unknown>} federation The federation instance. It must
|
|
44
|
+
* already have every dispatcher registered (see `createFederation()`
|
|
45
|
+
* in `@drfed/federation`); this function only stores it in
|
|
46
|
+
* the resolver context and never mutates it, so the same instance can
|
|
47
|
+
* be shared by several servers.
|
|
48
|
+
* @param {YogaServerOptions} rawOptions Options for server.
|
|
49
|
+
* @returns A `YogaServerInstance` configured with the schema and context for
|
|
50
|
+
* handling GraphQL requests.
|
|
51
|
+
*/
|
|
52
|
+
declare function createYogaServer(db: Database, federation: Federation<unknown>, rawOptions: YogaServerOptions): YogaServerInstance<ServerContext, UserContext>;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { type OperationTracker, YogaServerOptions, createYogaServer };
|
|
55
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;UAsCiB;;EAEf,iBAAiB;;;;;EAMjB,iBAAiB;;;;EAKjB,SAAS;;;;;EAMT;;;;EAKA,cAAc;;;;;;;;EASd,YAAY;;;;;;;;;;;;;;iBAeE,iBACd,IAAI,UACJ,YAAY,qBACZ,YAAY,oBACX,mBAAmB,eAAe"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { n as hashSecret, t as schema } from "./schema-ZeV-COPn.mjs";
|
|
2
|
+
import { canonicalHostname } from "@drfed/federation/origin";
|
|
3
|
+
import { getYogaLogger } from "@logtape/graphql-yoga";
|
|
4
|
+
import { getLogger } from "@logtape/logtape";
|
|
5
|
+
import { MockTransport } from "@upyo/mock";
|
|
6
|
+
import { createYoga, useExecutionCancellation } from "graphql-yoga";
|
|
7
|
+
//#region src/index.ts
|
|
8
|
+
/**
|
|
9
|
+
* Creates a Yoga server instance with the provided schema and context.
|
|
10
|
+
* @param {Database} db The database instance.
|
|
11
|
+
* @param {Federation<unknown>} federation The federation instance. It must
|
|
12
|
+
* already have every dispatcher registered (see `createFederation()`
|
|
13
|
+
* in `@drfed/federation`); this function only stores it in
|
|
14
|
+
* the resolver context and never mutates it, so the same instance can
|
|
15
|
+
* be shared by several servers.
|
|
16
|
+
* @param {YogaServerOptions} rawOptions Options for server.
|
|
17
|
+
* @returns A `YogaServerInstance` configured with the schema and context for
|
|
18
|
+
* handling GraphQL requests.
|
|
19
|
+
*/
|
|
20
|
+
function createYogaServer(db, federation, rawOptions) {
|
|
21
|
+
const options = fillOptions(rawOptions);
|
|
22
|
+
return createYoga({
|
|
23
|
+
cors: false,
|
|
24
|
+
async context(ctx) {
|
|
25
|
+
const loadContext = async () => {
|
|
26
|
+
const anonymous = {
|
|
27
|
+
db,
|
|
28
|
+
federation,
|
|
29
|
+
request: ctx.request,
|
|
30
|
+
...options,
|
|
31
|
+
operationSignal: rawOptions.shutdownSignal == null ? ctx.request.signal : AbortSignal.any([ctx.request.signal, rawOptions.shutdownSignal])
|
|
32
|
+
};
|
|
33
|
+
const accessToken = getAccessToken(ctx.request.headers);
|
|
34
|
+
if (accessToken == null) return anonymous;
|
|
35
|
+
const authenticated = await findSession(accessToken, db);
|
|
36
|
+
if (authenticated == null) return anonymous;
|
|
37
|
+
const { account, ...session } = authenticated;
|
|
38
|
+
return {
|
|
39
|
+
...anonymous,
|
|
40
|
+
session,
|
|
41
|
+
account
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
return rawOptions.trackOperation == null ? await loadContext() : await rawOptions.trackOperation(loadContext);
|
|
45
|
+
},
|
|
46
|
+
plugins: [useExecutionCancellation()],
|
|
47
|
+
schema,
|
|
48
|
+
logging: getYogaLogger()
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function mockTransport() {
|
|
52
|
+
logger.warn("Without `mailer` option, use default `MockTransport` as mailer. With default `MockTransport`, you can't read any mails.");
|
|
53
|
+
return new MockTransport();
|
|
54
|
+
}
|
|
55
|
+
const fillOptions = (opt) => {
|
|
56
|
+
const loginOrigins = /* @__PURE__ */ new Set();
|
|
57
|
+
for (const loginOrigin of opt.loginOrigins) {
|
|
58
|
+
const url = new URL(loginOrigin);
|
|
59
|
+
url.hostname = canonicalHostname(url);
|
|
60
|
+
loginOrigins.add(url.origin);
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
trackOperation: opt.trackOperation,
|
|
64
|
+
mailer: opt.mailer ?? mockTransport(),
|
|
65
|
+
emailFrom: opt.emailFrom ?? `noreply@${canonicalHostname(opt.rootOrigin)}`,
|
|
66
|
+
loginOrigins,
|
|
67
|
+
rootOrigin: opt.rootOrigin
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
const getAccessToken = (headers) => /^Bearer (?<token>[^\s]+)$/u.exec(headers.get("Authorization") ?? "")?.groups?.token ?? null;
|
|
71
|
+
const findSession = async (accessToken, db) => await db.query.sessions.findFirst({
|
|
72
|
+
where: {
|
|
73
|
+
tokenHash: await hashSecret(accessToken),
|
|
74
|
+
expires: { gt: Temporal.Now.instant() }
|
|
75
|
+
},
|
|
76
|
+
with: { account: true }
|
|
77
|
+
});
|
|
78
|
+
const logger = getLogger([
|
|
79
|
+
"drfed",
|
|
80
|
+
"graphql",
|
|
81
|
+
"yoga"
|
|
82
|
+
]);
|
|
83
|
+
//#endregion
|
|
84
|
+
export { createYogaServer };
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["// DrFed: A web-based platform for developing and debugging ActivityPub apps\n// Copyright (C) 2026 DrFed team\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n\nimport { canonicalHostname } from \"@drfed/federation/origin\";\nimport type { Database } from \"@drfed/models\";\nimport type { Federation } from \"@fedify/fedify\";\nimport { getYogaLogger } from \"@logtape/graphql-yoga\";\nimport { getLogger } from \"@logtape/logtape\";\nimport type { Transport } from \"@upyo/core\";\nimport { MockTransport } from \"@upyo/mock\";\nimport {\n type YogaServerInstance,\n createYoga,\n useExecutionCancellation,\n} from \"graphql-yoga\";\n\nimport { hashSecret } from \"./auth/hash.ts\";\nimport type { ServerContext, UserContext } from \"./builder.ts\";\nimport type { OperationTracker } from \"./operations.ts\";\nimport { schema } from \"./schema.ts\";\n\nexport type { OperationTracker } from \"./operations.ts\";\n/**\n * Options for Yoga server.\n */\nexport interface YogaServerOptions {\n /** Runtime shutdown cancellation, combined with each request signal. */\n shutdownSignal?: AbortSignal | undefined;\n\n /**\n * Track context loading and field resolvers until their actual work settles,\n * including resolvers still running after Yoga cancels the HTTP response.\n */\n trackOperation?: OperationTracker | undefined;\n\n /**\n * Email sending services.\n */\n mailer?: Transport | undefined;\n\n /**\n * The address login mail is sent from. Defaults to `noreply@` at the root\n * origin's host name.\n */\n emailFrom?: string | undefined;\n\n /**\n * Origins for login.\n */\n loginOrigins: ReadonlySet<string>;\n\n /**\n * The root origin of this deployment. Every instance is served from a\n * subdomain of it, so `https://drfed.net` puts the instance `foo-bar` at\n * `https://foo-bar.drfed.net`. Required: there is no sensible default for\n * installed software, and guessing one would silently hand out subdomains\n * of somebody else's domain.\n */\n rootOrigin: URL;\n}\n\n/**\n * Creates a Yoga server instance with the provided schema and context.\n * @param {Database} db The database instance.\n * @param {Federation<unknown>} federation The federation instance. It must\n * already have every dispatcher registered (see `createFederation()`\n * in `@drfed/federation`); this function only stores it in\n * the resolver context and never mutates it, so the same instance can\n * be shared by several servers.\n * @param {YogaServerOptions} rawOptions Options for server.\n * @returns A `YogaServerInstance` configured with the schema and context for\n * handling GraphQL requests.\n */\nexport function createYogaServer(\n db: Database,\n federation: Federation<unknown>,\n rawOptions: YogaServerOptions,\n): YogaServerInstance<ServerContext, UserContext> {\n const options = fillOptions(rawOptions);\n return createYoga({\n cors: false,\n async context(ctx) {\n const loadContext = async (): Promise<UserContext> => {\n const anonymous = {\n db,\n federation,\n request: ctx.request,\n ...options,\n operationSignal:\n rawOptions.shutdownSignal == null\n ? ctx.request.signal\n : AbortSignal.any([\n ctx.request.signal,\n rawOptions.shutdownSignal,\n ]),\n };\n const accessToken = getAccessToken(ctx.request.headers);\n if (accessToken == null) {\n return anonymous;\n }\n const authenticated = await findSession(accessToken, db);\n if (authenticated == null) {\n return anonymous;\n }\n const { account, ...session } = authenticated;\n return { ...anonymous, session, account };\n };\n return rawOptions.trackOperation == null\n ? await loadContext()\n : await rawOptions.trackOperation(loadContext);\n },\n plugins: [useExecutionCancellation()],\n schema,\n logging: getYogaLogger(),\n });\n}\n\nfunction mockTransport() {\n logger.warn(\n \"Without `mailer` option, use default `MockTransport` as mailer. \" +\n \"With default `MockTransport`, you can't read any mails.\",\n );\n return new MockTransport();\n}\n\nconst fillOptions = (\n opt: YogaServerOptions,\n): Omit<ServerContext, \"db\" | \"request\" | \"federation\"> => {\n const loginOrigins = new Set<string>();\n\n for (const loginOrigin of opt.loginOrigins) {\n const url = new URL(loginOrigin);\n url.hostname = canonicalHostname(url);\n loginOrigins.add(url.origin);\n }\n\n return {\n trackOperation: opt.trackOperation,\n mailer: opt.mailer ?? mockTransport(),\n // Derived from the deployment's own domain rather than the project's, so\n // that the operator's mail server is authorized to send it. A From address\n // at drfed.org would fail the SPF and DMARC checks of every deployment but\n // the project's own, and the login mail would be rejected or junked.\n emailFrom: opt.emailFrom ?? `noreply@${canonicalHostname(opt.rootOrigin)}`,\n loginOrigins,\n rootOrigin: opt.rootOrigin,\n };\n};\n\nconst getAccessToken = (headers: Headers) =>\n /^Bearer (?<token>[^\\s]+)$/u.exec(headers.get(\"Authorization\") ?? \"\")?.groups\n ?.token ?? null;\n\nconst findSession = async (accessToken: string, db: Database) =>\n await db.query.sessions.findFirst({\n where: {\n tokenHash: await hashSecret(accessToken),\n expires: { gt: Temporal.Now.instant() },\n },\n with: { account: true },\n });\n\nconst logger = getLogger([\"drfed\", \"graphql\", \"yoga\"]);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsFA,SAAgB,iBACd,IACA,YACA,YACgD;CAChD,MAAM,UAAU,YAAY,UAAU;CACtC,OAAO,WAAW;EAChB,MAAM;EACN,MAAM,QAAQ,KAAK;GACjB,MAAM,cAAc,YAAkC;IACpD,MAAM,YAAY;KAChB;KACA;KACA,SAAS,IAAI;KACb,GAAG;KACH,iBACE,WAAW,kBAAkB,OACzB,IAAI,QAAQ,SACZ,YAAY,IAAI,CACd,IAAI,QAAQ,QACZ,WAAW,cACb,CAAC;IACT;IACA,MAAM,cAAc,eAAe,IAAI,QAAQ,OAAO;IACtD,IAAI,eAAe,MACjB,OAAO;IAET,MAAM,gBAAgB,MAAM,YAAY,aAAa,EAAE;IACvD,IAAI,iBAAiB,MACnB,OAAO;IAET,MAAM,EAAE,SAAS,GAAG,YAAY;IAChC,OAAO;KAAE,GAAG;KAAW;KAAS;IAAQ;GAC1C;GACA,OAAO,WAAW,kBAAkB,OAChC,MAAM,YAAY,IAClB,MAAM,WAAW,eAAe,WAAW;EACjD;EACA,SAAS,CAAC,yBAAyB,CAAC;EACpC;EACA,SAAS,cAAc;CACzB,CAAC;AACH;AAEA,SAAS,gBAAgB;CACvB,OAAO,KACL,yHAEF;CACA,OAAO,IAAI,cAAc;AAC3B;AAEA,MAAM,eACJ,QACyD;CACzD,MAAM,+BAAe,IAAI,IAAY;CAErC,KAAK,MAAM,eAAe,IAAI,cAAc;EAC1C,MAAM,MAAM,IAAI,IAAI,WAAW;EAC/B,IAAI,WAAW,kBAAkB,GAAG;EACpC,aAAa,IAAI,IAAI,MAAM;CAC7B;CAEA,OAAO;EACL,gBAAgB,IAAI;EACpB,QAAQ,IAAI,UAAU,cAAc;EAKpC,WAAW,IAAI,aAAa,WAAW,kBAAkB,IAAI,UAAU;EACvE;EACA,YAAY,IAAI;CAClB;AACF;AAEA,MAAM,kBAAkB,YACtB,6BAA6B,KAAK,QAAQ,IAAI,eAAe,KAAK,EAAE,CAAC,EAAE,QACnE,SAAS;AAEf,MAAM,cAAc,OAAO,aAAqB,OAC9C,MAAM,GAAG,MAAM,SAAS,UAAU;CAChC,OAAO;EACL,WAAW,MAAM,WAAW,WAAW;EACvC,SAAS,EAAE,IAAI,SAAS,IAAI,QAAQ,EAAE;CACxC;CACA,MAAM,EAAE,SAAS,KAAK;AACxB,CAAC;AAEH,MAAM,SAAS,UAAU;CAAC;CAAS;CAAW;AAAM,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { i as SchemaTypes, t as DrFedObjectRef } from "./builder-CSxRffRp.mjs";
|
|
2
|
+
//#region src/instance.d.ts
|
|
3
|
+
declare const Instance: DrFedObjectRef;
|
|
4
|
+
declare const LocalInstance: DrFedObjectRef;
|
|
5
|
+
declare const CreateInstanceErrorType: PothosSchemaTypes.EnumRef<PothosSchemaTypes.ExtendDefaultTypes<SchemaTypes>, "InvalidSlug" | "SlugAlreadyTaken" | "TooManyInstances", "InvalidSlug" | "SlugAlreadyTaken" | "TooManyInstances">;
|
|
6
|
+
interface CreateInstanceError {
|
|
7
|
+
readonly type: typeof CreateInstanceErrorType.$inferType;
|
|
8
|
+
readonly message: string;
|
|
9
|
+
}
|
|
10
|
+
declare const CreateInstanceErrorRef: PothosSchemaTypes.ImplementableObjectRef<PothosSchemaTypes.ExtendDefaultTypes<SchemaTypes>, CreateInstanceError, CreateInstanceError>;
|
|
11
|
+
declare const CreateInstanceResult: PothosSchemaTypes.UnionRef<PothosSchemaTypes.ExtendDefaultTypes<SchemaTypes>, CreateInstanceError | {
|
|
12
|
+
created: Temporal.Instant;
|
|
13
|
+
host: string;
|
|
14
|
+
id: `${string}-${string}-${string}-${string}-${string}`;
|
|
15
|
+
localId: `${string}-${string}-${string}-${string}-${string}` | null;
|
|
16
|
+
nodeInfoUrl: string | null;
|
|
17
|
+
software: string | null;
|
|
18
|
+
softwareVersion: string | null;
|
|
19
|
+
} | {
|
|
20
|
+
$pothosQueryFor: "instances" | undefined;
|
|
21
|
+
}, CreateInstanceError | {
|
|
22
|
+
created: Temporal.Instant;
|
|
23
|
+
host: string;
|
|
24
|
+
id: `${string}-${string}-${string}-${string}-${string}`;
|
|
25
|
+
localId: `${string}-${string}-${string}-${string}-${string}` | null;
|
|
26
|
+
nodeInfoUrl: string | null;
|
|
27
|
+
software: string | null;
|
|
28
|
+
softwareVersion: string | null;
|
|
29
|
+
}>;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { CreateInstanceErrorRef, CreateInstanceErrorType, CreateInstanceResult, Instance, LocalInstance };
|
|
32
|
+
//# sourceMappingURL=instance.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance.d.mts","names":[],"sources":["../src/instance.ts"],"mappings":";;cAsEa,UAAU;cA8CV,eAAe;cA4Cf,yBAAuB,kBAAA,QAAA,kBAAA,mBAAvB;UAOH;WACC,aAAa,wBAAwB;WACrC;;cAGE,wBAAsB,kBAAA,uBAAA,kBAAA,mBAAtB,cAAsB,qBAAA;cAsBtB,sBAAoB,kBAAA,SAAA,kBAAA,mBAApB,cAAoB"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { n as builder } from "./builder-BLioFAdv.mjs";
|
|
2
|
+
import { instanceHost } from "@drfed/federation/origin";
|
|
3
|
+
import { eq } from "drizzle-orm/sql/expressions";
|
|
4
|
+
import { schema } from "@drfed/models";
|
|
5
|
+
import { uuidV7 } from "@drfed/models/uuid";
|
|
6
|
+
import { DrizzleQueryError } from "drizzle-orm";
|
|
7
|
+
import { isValidSlug } from "@drfed/models/slug";
|
|
8
|
+
//#region src/instance.ts
|
|
9
|
+
const InstanceRef = builder.drizzleNode("instances", {
|
|
10
|
+
name: "Instance",
|
|
11
|
+
description: "Represents an `Instance` in the DrFed platform.",
|
|
12
|
+
id: {
|
|
13
|
+
column(instance) {
|
|
14
|
+
return instance.id;
|
|
15
|
+
},
|
|
16
|
+
description: "The unique identifier of the `Instance`."
|
|
17
|
+
},
|
|
18
|
+
fields: (t) => ({
|
|
19
|
+
uuid: t.expose("id", { type: "UUID" }),
|
|
20
|
+
host: t.exposeString("host"),
|
|
21
|
+
url: t.string({
|
|
22
|
+
description: "The absolute origin the `Instance` is served at, e.g. `https://foo-bar.drfed.net`. Local instances follow this deployment's root origin, so a development deployment yields an `http:` URL carrying its port; remote instances are always `https:`.",
|
|
23
|
+
resolve(instance, _args, ctx) {
|
|
24
|
+
return `${instance.localId == null ? "https:" : ctx.rootOrigin.protocol}//${instance.host}`;
|
|
25
|
+
}
|
|
26
|
+
}),
|
|
27
|
+
created: t.expose("created", {
|
|
28
|
+
type: "DateTime",
|
|
29
|
+
description: "The creation date/time of the `Instance`."
|
|
30
|
+
}),
|
|
31
|
+
nodeInfoUrl: t.exposeString("nodeInfoUrl", { nullable: true }),
|
|
32
|
+
software: t.exposeString("software", { nullable: true }),
|
|
33
|
+
softwareVersion: t.exposeString("softwareVersion", { nullable: true })
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
const Instance = InstanceRef;
|
|
37
|
+
const LocalInstanceRef = builder.drizzleNode("localInstances", {
|
|
38
|
+
name: "LocalInstance",
|
|
39
|
+
description: "Represents a `LocalInstance`, i.e., an `Instance` hosted by this DrFed deployment. Only accepted members of the `Instance` it backs, and site administrators, can read it, because it carries operational details such as the expiry date and the actor quota.",
|
|
40
|
+
authScopes(localInstance) {
|
|
41
|
+
return { $any: {
|
|
42
|
+
admin: true,
|
|
43
|
+
localInstanceMember: localInstance.id
|
|
44
|
+
} };
|
|
45
|
+
},
|
|
46
|
+
runScopesOnType: true,
|
|
47
|
+
id: {
|
|
48
|
+
column(instance) {
|
|
49
|
+
return instance.id;
|
|
50
|
+
},
|
|
51
|
+
description: "The unique identifier of the `LocalInstance`."
|
|
52
|
+
},
|
|
53
|
+
fields: (t) => ({
|
|
54
|
+
uuid: t.expose("id", {
|
|
55
|
+
type: "UUID",
|
|
56
|
+
description: "The UUID of the `LocalInstance`."
|
|
57
|
+
}),
|
|
58
|
+
slug: t.exposeString("slug"),
|
|
59
|
+
expires: t.expose("expires", {
|
|
60
|
+
type: "DateTime",
|
|
61
|
+
description: "The expire date of the instance."
|
|
62
|
+
}),
|
|
63
|
+
maxActors: t.exposeInt("maxActors")
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
const LocalInstance = LocalInstanceRef;
|
|
67
|
+
builder.drizzleObjectField(InstanceRef, "localInstance", (t) => t.relation("localInstance", {
|
|
68
|
+
nullable: true,
|
|
69
|
+
description: "The `LocalInstance` backing the `Instance` when it is hosted by this DrFed deployment. `null` if the `Instance` is remote, i.e., hosted by another server on the fediverse."
|
|
70
|
+
}));
|
|
71
|
+
builder.drizzleObjectField(LocalInstanceRef, "instance", (t) => t.relation("instance", {
|
|
72
|
+
nullable: true,
|
|
73
|
+
description: "The `Instance` this `LocalInstance` backs, which carries the federation-facing data such as the host name."
|
|
74
|
+
}));
|
|
75
|
+
builder.queryFields((t) => ({ localInstanceBySlug: t.drizzleField({
|
|
76
|
+
type: LocalInstanceRef,
|
|
77
|
+
nullable: true,
|
|
78
|
+
description: "Get a `LocalInstance` by its slug. Returns `null` if no `LocalInstance` has the given slug.",
|
|
79
|
+
authScopes: { authenticated: true },
|
|
80
|
+
args: { slug: t.arg({
|
|
81
|
+
type: "String",
|
|
82
|
+
required: true,
|
|
83
|
+
description: "The slug of the `LocalInstance` to retrieve, i.e., the label that forms the first part of its host name."
|
|
84
|
+
}) },
|
|
85
|
+
resolve(query, _root, { slug }, ctx) {
|
|
86
|
+
return ctx.db.query.localInstances.findFirst(query({ where: { slug } }));
|
|
87
|
+
}
|
|
88
|
+
}) }));
|
|
89
|
+
const CreateInstanceErrorType = builder.enumType("CreateInstanceErrorType", { values: [
|
|
90
|
+
"InvalidSlug",
|
|
91
|
+
"SlugAlreadyTaken",
|
|
92
|
+
"TooManyInstances"
|
|
93
|
+
] });
|
|
94
|
+
const CreateInstanceErrorRef = builder.objectRef("CreateInstanceError");
|
|
95
|
+
CreateInstanceErrorRef.implement({
|
|
96
|
+
description: "Represents an error that occurred while creating an `Instance`.",
|
|
97
|
+
fields: (t) => ({
|
|
98
|
+
type: t.expose("type", {
|
|
99
|
+
type: CreateInstanceErrorType,
|
|
100
|
+
description: "The type of the error. Use this for programmatic error handling."
|
|
101
|
+
}),
|
|
102
|
+
message: t.exposeString("message", { description: "A human-readable message describing the error. Don't use this for programmatic error handling, use the `type` field instead." })
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
const CreateInstanceResult = builder.unionType("CreateInstanceResult", {
|
|
106
|
+
types: [InstanceRef, CreateInstanceErrorRef],
|
|
107
|
+
resolveType(value) {
|
|
108
|
+
if ("message" in value) return CreateInstanceErrorRef;
|
|
109
|
+
return InstanceRef;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
builder.mutationFields((t) => ({ createInstance: t.field({
|
|
113
|
+
type: CreateInstanceResult,
|
|
114
|
+
description: "Create an instance.",
|
|
115
|
+
authScopes: { authenticated: true },
|
|
116
|
+
args: { slug: t.arg({
|
|
117
|
+
type: "String",
|
|
118
|
+
required: true,
|
|
119
|
+
description: "A unique instance slug, which becomes the leftmost label of the instance's domain name, e.g. `slug` in `slug.example.com`."
|
|
120
|
+
}) },
|
|
121
|
+
async resolve(_query, { slug }, ctx) {
|
|
122
|
+
if (ctx.account == null) throw new Error("You must be authenticated to create an instance.");
|
|
123
|
+
const { account } = ctx;
|
|
124
|
+
const host = instanceHost(ctx.rootOrigin, slug);
|
|
125
|
+
if (!isValidSlug(slug)) return {
|
|
126
|
+
type: "InvalidSlug",
|
|
127
|
+
message: `The slug ${JSON.stringify(slug)} is not usable as a domain name label. It must be 4 to 63 characters of lowercase letters, digits and hyphens, and start and end with a letter or a digit.`
|
|
128
|
+
};
|
|
129
|
+
if (!URL.canParse(`${ctx.rootOrigin.protocol}//${host}`)) return {
|
|
130
|
+
type: "InvalidSlug",
|
|
131
|
+
message: `The slug ${JSON.stringify(slug)} composes the host name ${JSON.stringify(host)}, which this server cannot parse. A slug beginning with \`xn--\` has to be decodable Punycode.`
|
|
132
|
+
};
|
|
133
|
+
let tooManyInstances = false;
|
|
134
|
+
try {
|
|
135
|
+
return await ctx.db.transaction(async (tx) => {
|
|
136
|
+
const [local] = await tx.insert(schema.localInstances).values({
|
|
137
|
+
id: uuidV7(),
|
|
138
|
+
slug,
|
|
139
|
+
expires: Temporal.Now.instant().add({ hours: YEAR_BY_HOURS })
|
|
140
|
+
}).returning();
|
|
141
|
+
if (local == null) throw new Error("Failed to create local instance.");
|
|
142
|
+
const [instance] = await tx.insert(schema.instances).values({
|
|
143
|
+
id: uuidV7(),
|
|
144
|
+
localId: local.id,
|
|
145
|
+
host
|
|
146
|
+
}).returning();
|
|
147
|
+
if (instance == null) throw new Error("Failed to create instance.");
|
|
148
|
+
await tx.insert(schema.instanceMembers).values({
|
|
149
|
+
instanceId: instance.id,
|
|
150
|
+
accountId: account.id,
|
|
151
|
+
accepted: Temporal.Now.instant()
|
|
152
|
+
});
|
|
153
|
+
if (await tx.$count(schema.instanceMembers, eq(schema.instanceMembers.accountId, account.id)) > account.maxInstances) {
|
|
154
|
+
tooManyInstances = true;
|
|
155
|
+
tx.rollback();
|
|
156
|
+
}
|
|
157
|
+
return instance;
|
|
158
|
+
});
|
|
159
|
+
} catch (e) {
|
|
160
|
+
if (tooManyInstances) return {
|
|
161
|
+
type: "TooManyInstances",
|
|
162
|
+
message: `You have reached the maximum number of instances (${account.maxInstances}).`
|
|
163
|
+
};
|
|
164
|
+
if (e instanceof DrizzleQueryError && e.cause != null && "constraint" in e.cause && e.cause.constraint === "local_instances_slug_key") return {
|
|
165
|
+
message: `The slug ${JSON.stringify(slug)} is already taken.`,
|
|
166
|
+
type: "SlugAlreadyTaken"
|
|
167
|
+
};
|
|
168
|
+
throw e;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}) }));
|
|
172
|
+
const YEAR_BY_HOURS = 8760;
|
|
173
|
+
//#endregion
|
|
174
|
+
export { CreateInstanceErrorRef, CreateInstanceErrorType, CreateInstanceResult, Instance, LocalInstance };
|
|
175
|
+
|
|
176
|
+
//# sourceMappingURL=instance.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance.mjs","names":["uuid"],"sources":["../src/instance.ts"],"sourcesContent":["// DrFed: A web-based platform for developing and debugging ActivityPub apps\n// Copyright (C) 2026 DrFed team\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n\nimport { instanceHost } from \"@drfed/federation/origin\";\nimport { schema } from \"@drfed/models\";\nimport { isValidSlug } from \"@drfed/models/slug\";\nimport { uuidV7 as uuid } from \"@drfed/models/uuid\";\nimport { DrizzleQueryError } from \"drizzle-orm\";\nimport { eq } from \"drizzle-orm/sql/expressions\";\n\nimport builder, { type DrFedObjectRef } from \"./builder.ts\";\n\nconst InstanceRef = builder.drizzleNode(\"instances\", {\n name: \"Instance\",\n description: \"Represents an `Instance` in the DrFed platform.\",\n id: {\n column(instance) {\n return instance.id;\n },\n description: \"The unique identifier of the `Instance`.\",\n },\n fields: (t) => ({\n uuid: t.expose(\"id\", {\n type: \"UUID\",\n }),\n host: t.exposeString(\"host\"),\n url: t.string({\n description:\n \"The absolute origin the `Instance` is served at, e.g. \" +\n \"`https://foo-bar.drfed.net`. Local instances follow this \" +\n \"deployment's root origin, so a development deployment yields an \" +\n \"`http:` URL carrying its port; remote instances are always `https:`.\",\n resolve(instance, _args, ctx) {\n // Built by concatenation rather than through `URL`, so that a host\n // which is not a parseable authority yields a useless string instead\n // of throwing in the middle of a query.\n const scheme =\n instance.localId == null ? \"https:\" : ctx.rootOrigin.protocol;\n return `${scheme}//${instance.host}`;\n },\n }),\n created: t.expose(\"created\", {\n type: \"DateTime\",\n description: \"The creation date/time of the `Instance`.\",\n }),\n nodeInfoUrl: t.exposeString(\"nodeInfoUrl\", {\n nullable: true,\n }),\n software: t.exposeString(\"software\", {\n nullable: true,\n }),\n softwareVersion: t.exposeString(\"softwareVersion\", {\n nullable: true,\n }),\n }),\n});\n\nexport const Instance: DrFedObjectRef = InstanceRef;\n\nconst LocalInstanceRef = builder.drizzleNode(\"localInstances\", {\n name: \"LocalInstance\",\n description:\n \"Represents a `LocalInstance`, i.e., an `Instance` hosted by this DrFed \" +\n \"deployment. Only accepted members of the `Instance` it backs, and \" +\n \"site administrators, can read it, because it carries operational \" +\n \"details such as the expiry date and the actor quota.\",\n authScopes(localInstance) {\n return {\n $any: {\n admin: true,\n localInstanceMember: localInstance.id,\n },\n };\n },\n // Check the scopes on the type itself rather than only on each field.\n // Without this, a selection that touches no scoped field still resolves, so\n // `node(id: $id) { __typename }` would answer `\"LocalInstance\"` to a viewer\n // who may not read one. Note this closes the data channel only: the\n // presence of the authorization error still tells such a viewer that the ID\n // resolves to an existing `LocalInstance`, since an unknown ID yields a\n // plain `null` with no error. That residual signal is accepted, as it is\n // for slugs, and it additionally requires already knowing a UUID.\n runScopesOnType: true,\n id: {\n column(instance) {\n return instance.id;\n },\n description: \"The unique identifier of the `LocalInstance`.\",\n },\n fields: (t) => ({\n uuid: t.expose(\"id\", {\n type: \"UUID\",\n description: \"The UUID of the `LocalInstance`.\",\n }),\n slug: t.exposeString(\"slug\"),\n expires: t.expose(\"expires\", {\n type: \"DateTime\",\n description: \"The expire date of the instance.\",\n }),\n maxActors: t.exposeInt(\"maxActors\"),\n }),\n});\n\nexport const LocalInstance: DrFedObjectRef = LocalInstanceRef;\n\nbuilder.drizzleObjectField(InstanceRef, \"localInstance\", (t) =>\n t.relation(\"localInstance\", {\n nullable: true,\n description:\n \"The `LocalInstance` backing the `Instance` when it is hosted by \" +\n \"this DrFed deployment. `null` if the `Instance` is remote, i.e., \" +\n \"hosted by another server on the fediverse.\",\n }),\n);\n\nbuilder.drizzleObjectField(LocalInstanceRef, \"instance\", (t) =>\n t.relation(\"instance\", {\n nullable: true,\n description:\n \"The `Instance` this `LocalInstance` backs, which carries the \" +\n \"federation-facing data such as the host name.\",\n }),\n);\n\nbuilder.queryFields((t) => ({\n localInstanceBySlug: t.drizzleField({\n type: LocalInstanceRef,\n nullable: true,\n description:\n \"Get a `LocalInstance` by its slug. Returns `null` if no \" +\n \"`LocalInstance` has the given slug.\",\n authScopes: { authenticated: true },\n args: {\n slug: t.arg({\n type: \"String\",\n required: true,\n description:\n \"The slug of the `LocalInstance` to retrieve, i.e., the label \" +\n \"that forms the first part of its host name.\",\n }),\n },\n resolve(query, _root, { slug }, ctx) {\n return ctx.db.query.localInstances.findFirst(query({ where: { slug } }));\n },\n }),\n}));\n\nexport const CreateInstanceErrorType = builder.enumType(\n \"CreateInstanceErrorType\",\n {\n values: [\"InvalidSlug\", \"SlugAlreadyTaken\", \"TooManyInstances\"] as const,\n },\n);\n\ninterface CreateInstanceError {\n readonly type: typeof CreateInstanceErrorType.$inferType;\n readonly message: string;\n}\n\nexport const CreateInstanceErrorRef = builder.objectRef<CreateInstanceError>(\n \"CreateInstanceError\",\n);\n\nCreateInstanceErrorRef.implement({\n description:\n \"Represents an error that occurred while creating an `Instance`.\",\n fields: (t) => ({\n type: t.expose(\"type\", {\n type: CreateInstanceErrorType,\n description:\n \"The type of the error. Use this for programmatic error handling.\",\n }),\n message: t.exposeString(\"message\", {\n description:\n \"A human-readable message describing the error. \" +\n \"Don't use this for programmatic error handling, \" +\n \"use the `type` field instead.\",\n }),\n }),\n});\n\nexport const CreateInstanceResult = builder.unionType(\"CreateInstanceResult\", {\n types: [InstanceRef, CreateInstanceErrorRef],\n resolveType(value) {\n if (\"message\" in value) return CreateInstanceErrorRef;\n return InstanceRef;\n },\n});\n\nbuilder.mutationFields((t) => ({\n createInstance: t.field({\n type: CreateInstanceResult,\n description: \"Create an instance.\",\n authScopes: { authenticated: true },\n args: {\n slug: t.arg({\n type: \"String\",\n required: true,\n description:\n \"A unique instance slug, which becomes the leftmost label of the \" +\n \"instance's domain name, e.g. `slug` in `slug.example.com`.\",\n }),\n },\n async resolve(_query, { slug }, ctx) {\n if (ctx.account == null) {\n // Note that the following error is not expected to be thrown,\n // because the `authScopes` option above should prevent this resolver\n throw new Error(\"You must be authenticated to create an instance.\");\n }\n const { account } = ctx;\n // Checked here rather than left to the database constraint, which\n // surfaces as an unhandled query error. The second half catches what\n // the shape rules cannot: an `xn--` label that is not decodable\n // Punycode composes a host this runtime refuses to parse, and an\n // instance nothing can address is worse than a rejected slug. Whether\n // a label decodes is answered by the runtime's own ICU, so it is asked\n // of the composed host here rather than baked into `isValidSlug()`,\n // which every deployment has to agree on.\n // Composed as a string, not through `instanceOrigin()`, which builds a\n // `URL` and would throw here rather than answer.\n const host = instanceHost(ctx.rootOrigin, slug);\n if (!isValidSlug(slug)) {\n return {\n type: \"InvalidSlug\" as const,\n message:\n `The slug ${JSON.stringify(slug)} is not usable as a ` +\n \"domain name label. It must be 4 to 63 characters of lowercase \" +\n \"letters, digits and hyphens, and start and end with a letter \" +\n \"or a digit.\",\n };\n }\n if (!URL.canParse(`${ctx.rootOrigin.protocol}//${host}`)) {\n // Reached by a slug that satisfies every rule above, so it needs its\n // own message: the shape text would name conditions this slug meets.\n return {\n type: \"InvalidSlug\" as const,\n message:\n `The slug ${JSON.stringify(slug)} composes the host name ` +\n `${JSON.stringify(host)}, which this server cannot parse. A ` +\n \"slug beginning with `xn--` has to be decodable Punycode.\",\n };\n }\n let tooManyInstances = false;\n try {\n return await ctx.db.transaction(async (tx) => {\n const [local] = await tx\n .insert(schema.localInstances)\n .values({\n id: uuid(),\n slug,\n expires: Temporal.Now.instant().add({ hours: YEAR_BY_HOURS }),\n })\n .returning();\n if (local == null) {\n throw new Error(\"Failed to create local instance.\");\n }\n const [instance] = await tx\n .insert(schema.instances)\n .values({ id: uuid(), localId: local.id, host })\n .returning();\n if (instance == null) throw new Error(\"Failed to create instance.\");\n await tx.insert(schema.instanceMembers).values({\n instanceId: instance.id,\n accountId: account.id,\n accepted: Temporal.Now.instant(),\n });\n const instances = await tx.$count(\n schema.instanceMembers,\n eq(schema.instanceMembers.accountId, account.id),\n );\n if (instances > account.maxInstances) {\n tooManyInstances = true;\n tx.rollback();\n }\n return instance;\n });\n } catch (e) {\n if (tooManyInstances) {\n return {\n type: \"TooManyInstances\" as const,\n message: `You have reached the maximum number of instances (${account.maxInstances}).`,\n };\n }\n if (\n e instanceof DrizzleQueryError &&\n e.cause != null &&\n \"constraint\" in e.cause &&\n e.cause.constraint === \"local_instances_slug_key\"\n ) {\n return {\n message: `The slug ${JSON.stringify(slug)} is already taken.`,\n type: \"SlugAlreadyTaken\" as const,\n };\n }\n throw e;\n }\n },\n }),\n}));\n\nconst YEAR_BY_HOURS = 8760;\n"],"mappings":";;;;;;;;AAyBA,MAAM,cAAc,QAAQ,YAAY,aAAa;CACnD,MAAM;CACN,aAAa;CACb,IAAI;EACF,OAAO,UAAU;GACf,OAAO,SAAS;EAClB;EACA,aAAa;CACf;CACA,SAAS,OAAO;EACd,MAAM,EAAE,OAAO,MAAM,EACnB,MAAM,OACR,CAAC;EACD,MAAM,EAAE,aAAa,MAAM;EAC3B,KAAK,EAAE,OAAO;GACZ,aACE;GAIF,QAAQ,UAAU,OAAO,KAAK;IAM5B,OAAO,GADL,SAAS,WAAW,OAAO,WAAW,IAAI,WAAW,SACtC,IAAI,SAAS;GAChC;EACF,CAAC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