Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
{ "ignoreConsecutiveComments": true }
],
"eslint/curly": ["error", "multi-line"],
"node/no-top-level-await": "off",
"oxc/no-optional-chaining": "off",
"oxc/no-async-await": "off",
"eslint/eqeqeq": ["off", "smart"],
"eslint/func-style": ["off"],
"eslint/max-lines-per-function": "off",
"eslint/max-lines": "off",
"eslint/id-length": ["warn", { "exceptionPatterns": ["^_", "^[Tertv]$"] }],
"eslint/init-declarations": "off",
"eslint/max-params": ["warn", { "max": 4 }],
Expand All @@ -41,6 +41,7 @@
"eslint/no-eq-null": "off",
"eslint/no-magic-numbers": "off",
"eslint/no-ternary": "off",
"eslint/no-negated-condition": "off",
"eslint/no-nested-ternary": "off",
"eslint/no-undefined": "off",
"eslint/no-void": "off",
Expand Down Expand Up @@ -68,6 +69,7 @@
"import/prefer-default-export": "off",
"jsdoc/require-param-type": "off",
"jsdoc/require-returns-type": "off",
"node/no-top-level-await": "off",
"promise/avoid-new": "warn"
},
"overrides": [
Expand Down
1 change: 1 addition & 0 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ min_version = "2026.6.10"
"aqua:dahlia/hongdown" = "0.4.3"
"github:nushell/nushell" = "0.114.1"
node = "26"
"npm:@fedify/cli" = "2.4.0-dev.1758"
"npm:oxlint" = "1.75.0"
"npm:oxlint-tsgolint" = "7.0.2001"
"npm:pglite-cli" = "0.0.1"
Expand Down
5 changes: 2 additions & 3 deletions packages/drfed/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ async function runServer(options: ServerOptions) {
if (options.seed) {
await seedData(options.drizzle.db);
}
const { mailer } = options;
const yogaServer = createYogaServer(options.drizzle.db, { mailer });
const { mailer, root } = options;
const yogaServer = createYogaServer(options.drizzle.db, { root, mailer });
const server = serve({
fetch: yogaServer.fetch.bind(yogaServer),
hostname: options.address.host,
Expand Down Expand Up @@ -76,7 +76,6 @@ async function runSchemaGenerator(
await writeFile(options.outputFile, schemaCode, { encoding: "utf-8" });
}

// oxlint-disable-next-line max-lines-per-function
export async function main(): Promise<void> {
const options: Options = run(program, {
help: "option",
Expand Down
9 changes: 8 additions & 1 deletion packages/drfed/src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { message, optionNames } from "@optique/core/message";
import { map, optional, withDefault } from "@optique/core/modifiers";
import type { InferValue } from "@optique/core/parser";
import { flag, option } from "@optique/core/primitives";
import { socketAddress, url } from "@optique/core/valueparser";
import { domain, socketAddress, url } from "@optique/core/valueparser";
import { loggingOptions } from "@optique/logtape";
import { path } from "@optique/run/valueparser";
import { LogTapeTransport } from "@upyo/logtape";
Expand Down Expand Up @@ -105,6 +105,12 @@ const seedParser = option("--dev-seed", {
hidden: true,
});

const rootParser = optional(
option("--root-domain", "-r", domain({ lowercase: true }), {
description: message`The root domain of host.`,
}),
);

const serverParser = object("DrFed server", {
address: withDefault(
option("--listen", "-l", socketAddress({ requirePort: true }), {
Expand All @@ -126,6 +132,7 @@ const serverParser = object("DrFed server", {
),
}),
),
root: rootParser,
mailer: smtpParser,
seed: seedParser,
});
Expand Down
5 changes: 5 additions & 0 deletions packages/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
"types": "./dist/account.d.mts",
"default": "./dist/account.mjs"
},
"./actor": {
"types": "./dist/actor.d.mts",
"default": "./dist/actor.mjs"
},
"./builder": {
"types": "./dist/builder.d.mts",
"default": "./dist/builder.mjs"
Expand All @@ -71,6 +75,7 @@
"entry": [
"src/index.ts",
"src/account.ts",
"src/actor.ts",
"src/builder.ts",
"src/instance.ts",
"src/schema.ts"
Expand Down
48 changes: 32 additions & 16 deletions packages/graphql/src/account.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ const accountInstancesQuery = `
admin
node {
uuid
slug
location
host
}
}
}
Expand Down Expand Up @@ -82,7 +83,8 @@ const accountInstancesResponse = {
admin: true,
node: {
uuid: acceptedInstanceId,
slug: "test-instance",
location: "Local",
host: "test-instance.drfed.org",
},
},
],
Expand Down Expand Up @@ -148,20 +150,7 @@ async function seedAccounts(db: Database): Promise<void> {

async function seedMembershipGraph(db: Database): Promise<void> {
await seedAccounts(db);
await db.insert(schema.instances).values([
{
id: acceptedInstanceId,
slug: "test-instance",
created,
expires,
},
{
id: pendingInstanceId,
slug: "pending-instance",
created,
expires,
},
]);
await seedLocalInstances(db);
await db.insert(schema.instanceMembers).values([
{
accountId,
Expand Down Expand Up @@ -193,3 +182,30 @@ async function seedMembershipGraph(db: Database): Promise<void> {
},
]);
}

async function seedLocalInstances(db: Database): Promise<void> {
await db.insert(schema.instances).values([
{
id: acceptedInstanceId,
location: "Local",
created,
},
{
id: pendingInstanceId,
location: "Local",
created,
},
]);
await db.insert(schema.localInstances).values([
{
id: acceptedInstanceId,
slug: "test-instance",
expires,
},
{
id: pendingInstanceId,
slug: "pending-instance",
expires,
},
]);
}
1 change: 0 additions & 1 deletion packages/graphql/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ const accountInstancesConnection = drizzleConnectionHelpers(
},
);

// oxlint-disable-next-line max-lines-per-function
builder.drizzleObjectField(AccountRef, "instances", (t) =>
t.connection(
{
Expand Down
Loading