@fedify/cli 2.3.0-dev.1347 → 2.3.0-dev.1361
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/dist/bench/action.js +29 -189
- package/dist/bench/command.js +13 -43
- package/dist/bench/load/clock.js +2 -20
- package/dist/bench/load/generator.js +9 -42
- package/dist/bench/metrics/stats-client.js +3 -65
- package/dist/bench/mod.js +2 -9
- package/dist/bench/render/markdown.js +0 -1
- package/dist/bench/render/text.js +0 -1
- package/dist/bench/result/build.js +10 -133
- package/dist/bench/result/expect/evaluate.js +1 -1
- package/dist/bench/result/schema.js +3 -353
- package/dist/bench/safety/gate.js +2 -4
- package/dist/bench/scenario/normalize.js +2 -1
- package/dist/bench/scenario/schema.js +9 -50
- package/dist/bench/scenario/validate.js +2 -2
- package/dist/bench/scenarios/inbox.js +12 -4
- package/dist/bench/scenarios/registry.js +1 -19
- package/dist/bench/scenarios/runner.js +1 -21
- package/dist/bench/scenarios/webfinger.js +1 -1
- package/dist/cache.js +1 -1
- package/dist/config.js +1 -1
- package/dist/deno.js +1 -1
- package/dist/docloader.js +1 -1
- package/dist/generate-vocab/action.js +1 -1
- package/dist/generate-vocab/command.js +3 -5
- package/dist/generate-vocab/mod.js +4 -0
- package/dist/imagerenderer.js +2 -2
- package/dist/inbox/command.js +4 -6
- package/dist/inbox.js +4 -4
- package/dist/init/mod.js +3 -0
- package/dist/log.js +2 -2
- package/dist/lookup.js +123 -12
- package/dist/mod.js +23 -2
- package/dist/nodeinfo.js +9 -11
- package/dist/options.js +1 -1
- package/dist/relay/command.js +4 -6
- package/dist/relay.js +2 -2
- package/dist/runner.js +46 -69
- package/dist/tempserver.js +1 -1
- package/dist/tunnel.js +4 -6
- package/dist/utils.js +4 -5
- package/dist/webfinger/action.js +1 -1
- package/dist/webfinger/command.js +4 -6
- package/dist/webfinger/lib.js +1 -1
- package/dist/webfinger/mod.js +4 -0
- package/package.json +12 -13
- package/dist/bench/compare/schema.js +0 -16
- package/dist/bench/compare.js +0 -667
- package/dist/bench/scenarios/actor.js +0 -38
- package/dist/bench/scenarios/failure.js +0 -363
- package/dist/bench/scenarios/fanout.js +0 -261
- package/dist/bench/scenarios/mixed.js +0 -244
- package/dist/bench/scenarios/object-discovery.js +0 -211
- package/dist/bench/scenarios/object.js +0 -54
- package/dist/bench/scenarios/read.js +0 -108
- package/dist/commands.js +0 -110
- package/dist/lookup/command.js +0 -121
package/dist/commands.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import "@js-temporal/polyfill";
|
|
2
|
-
import { benchMetadata, benchOptions } from "./bench/command.js";
|
|
3
|
-
import { generateVocabMetadata, generateVocabOptions } from "./generate-vocab/command.js";
|
|
4
|
-
import { inboxMetadata, inboxOptions } from "./inbox/command.js";
|
|
5
|
-
import { lookupMetadata, lookupOptions } from "./lookup/command.js";
|
|
6
|
-
import { nodeInfoMetadata, nodeInfoOptions, runNodeInfo } from "./nodeinfo.js";
|
|
7
|
-
import { relayMetadata, relayOptions } from "./relay/command.js";
|
|
8
|
-
import { runTunnel, tunnelMetadata, tunnelOptions } from "./tunnel.js";
|
|
9
|
-
import { webFingerMetadata, webFingerOptions } from "./webfinger/command.js";
|
|
10
|
-
import { constant, merge, message, object, optionNames } from "@optique/core";
|
|
11
|
-
import { initOptions, runInit } from "@fedify/init";
|
|
12
|
-
import { defineCommand } from "@optique/discover";
|
|
13
|
-
//#region src/commands.ts
|
|
14
|
-
function defineCliCommand(command) {
|
|
15
|
-
const { run, ...definition } = command;
|
|
16
|
-
return {
|
|
17
|
-
...defineCommand({
|
|
18
|
-
...definition,
|
|
19
|
-
handler: (_value) => {}
|
|
20
|
-
}),
|
|
21
|
-
run
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
const generatingCommands = [defineCliCommand({
|
|
25
|
-
path: ["init"],
|
|
26
|
-
parser: merge(initOptions, object({ command: constant("init") })),
|
|
27
|
-
metadata: {
|
|
28
|
-
brief: message`Initialize a new Fedify project directory.`,
|
|
29
|
-
description: message`Initialize a new Fedify project directory.
|
|
30
|
-
|
|
31
|
-
By default, it initializes the current directory. You can specify a different directory as an argument.
|
|
32
|
-
|
|
33
|
-
Unless you specify all options (${optionNames(["-w", "--web-framework"])}, ${optionNames(["-p", "--package-manager"])}, ${optionNames(["-k", "--kv-store"])}, and ${optionNames(["-m", "--message-queue"])}), it will prompt you to select the options interactively.`
|
|
34
|
-
},
|
|
35
|
-
run: runInit
|
|
36
|
-
}), defineCliCommand({
|
|
37
|
-
path: ["generate-vocab"],
|
|
38
|
-
parser: generateVocabOptions,
|
|
39
|
-
metadata: generateVocabMetadata,
|
|
40
|
-
run: async (value) => {
|
|
41
|
-
const { default: runGenerateVocab } = await import("./generate-vocab/action.js");
|
|
42
|
-
return await runGenerateVocab(value);
|
|
43
|
-
}
|
|
44
|
-
})];
|
|
45
|
-
const activityPubCommands = [
|
|
46
|
-
defineCliCommand({
|
|
47
|
-
path: ["webfinger"],
|
|
48
|
-
parser: webFingerOptions,
|
|
49
|
-
metadata: webFingerMetadata,
|
|
50
|
-
run: async (value) => {
|
|
51
|
-
const { default: runWebFinger } = await import("./webfinger/action.js");
|
|
52
|
-
return await runWebFinger(value);
|
|
53
|
-
}
|
|
54
|
-
}),
|
|
55
|
-
defineCliCommand({
|
|
56
|
-
path: ["lookup"],
|
|
57
|
-
parser: lookupOptions,
|
|
58
|
-
metadata: lookupMetadata,
|
|
59
|
-
run: async (value) => {
|
|
60
|
-
const { runLookup } = await import("./lookup.js");
|
|
61
|
-
return await runLookup(value);
|
|
62
|
-
}
|
|
63
|
-
}),
|
|
64
|
-
defineCliCommand({
|
|
65
|
-
path: ["inbox"],
|
|
66
|
-
parser: inboxOptions,
|
|
67
|
-
metadata: inboxMetadata,
|
|
68
|
-
run: async (value) => {
|
|
69
|
-
const { runInbox } = await import("./inbox.js");
|
|
70
|
-
return await runInbox(value);
|
|
71
|
-
}
|
|
72
|
-
}),
|
|
73
|
-
defineCliCommand({
|
|
74
|
-
path: ["nodeinfo"],
|
|
75
|
-
parser: nodeInfoOptions,
|
|
76
|
-
metadata: nodeInfoMetadata,
|
|
77
|
-
run: runNodeInfo
|
|
78
|
-
}),
|
|
79
|
-
defineCliCommand({
|
|
80
|
-
path: ["relay"],
|
|
81
|
-
parser: relayOptions,
|
|
82
|
-
metadata: relayMetadata,
|
|
83
|
-
run: async (value) => {
|
|
84
|
-
const { runRelay } = await import("./relay.js");
|
|
85
|
-
return await runRelay(value);
|
|
86
|
-
}
|
|
87
|
-
}),
|
|
88
|
-
defineCliCommand({
|
|
89
|
-
path: ["bench"],
|
|
90
|
-
parser: benchOptions,
|
|
91
|
-
metadata: benchMetadata,
|
|
92
|
-
run: async (value) => {
|
|
93
|
-
const { runBench } = await import("./bench/mod.js");
|
|
94
|
-
return await runBench(value);
|
|
95
|
-
}
|
|
96
|
-
})
|
|
97
|
-
];
|
|
98
|
-
const networkCommands = [defineCliCommand({
|
|
99
|
-
path: ["tunnel"],
|
|
100
|
-
parser: tunnelOptions,
|
|
101
|
-
metadata: tunnelMetadata,
|
|
102
|
-
run: runTunnel
|
|
103
|
-
})];
|
|
104
|
-
[
|
|
105
|
-
...generatingCommands,
|
|
106
|
-
...activityPubCommands,
|
|
107
|
-
...networkCommands
|
|
108
|
-
];
|
|
109
|
-
//#endregion
|
|
110
|
-
export { activityPubCommands, generatingCommands, networkCommands };
|
package/dist/lookup/command.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import "@js-temporal/polyfill";
|
|
2
|
-
import { configContext } from "../config.js";
|
|
3
|
-
import { createTunnelServiceOption, userAgentOption } from "../options.js";
|
|
4
|
-
import { argument, choice, command, constant, flag, float, integer, map, merge, message, multiple, object, option, optionNames, optional, or, string, withDefault } from "@optique/core";
|
|
5
|
-
import { path } from "@optique/run";
|
|
6
|
-
import { bindConfig } from "@optique/config";
|
|
7
|
-
//#region src/lookup/command.ts
|
|
8
|
-
const IN_REPLY_TO_IRI = "https://www.w3.org/ns/activitystreams#inReplyTo";
|
|
9
|
-
const QUOTE_IRI = "https://w3id.org/fep/044f#quote";
|
|
10
|
-
const QUOTE_URL_IRI = "https://www.w3.org/ns/activitystreams#quoteUrl";
|
|
11
|
-
const MISSKEY_QUOTE_IRI = "https://misskey-hub.net/ns#_misskey_quote";
|
|
12
|
-
const FEDIBIRD_QUOTE_IRI = "http://fedibird.com/ns#quoteUri";
|
|
13
|
-
const recurseProperties = [
|
|
14
|
-
"replyTarget",
|
|
15
|
-
"quote",
|
|
16
|
-
"quoteUrl",
|
|
17
|
-
IN_REPLY_TO_IRI,
|
|
18
|
-
QUOTE_IRI,
|
|
19
|
-
QUOTE_URL_IRI,
|
|
20
|
-
MISSKEY_QUOTE_IRI,
|
|
21
|
-
FEDIBIRD_QUOTE_IRI
|
|
22
|
-
];
|
|
23
|
-
const suppressErrorsOption = bindConfig(flag("-S", "--suppress-errors", { description: message`Suppress partial errors during traversal or recursion.` }), {
|
|
24
|
-
context: configContext,
|
|
25
|
-
key: (config) => config.lookup?.suppressErrors ?? false,
|
|
26
|
-
default: false
|
|
27
|
-
});
|
|
28
|
-
const allowPrivateAddressOption = bindConfig(flag("-p", "--allow-private-address", { description: message`Allow private IP addresses for URLs discovered \
|
|
29
|
-
during traversal or recursive object fetches. Recursive JSON-LD \
|
|
30
|
-
context URLs always remain blocked. URLs explicitly provided on the \
|
|
31
|
-
command line always allow private addresses.` }), {
|
|
32
|
-
context: configContext,
|
|
33
|
-
key: (config) => config.lookup?.allowPrivateAddress ?? false,
|
|
34
|
-
default: false
|
|
35
|
-
});
|
|
36
|
-
const authorizedFetchOption = withDefault(object("Authorized fetch options", {
|
|
37
|
-
authorizedFetch: bindConfig(map(flag("-a", "--authorized-fetch", { description: message`Sign the request with an one-time key.` }), () => true), {
|
|
38
|
-
context: configContext,
|
|
39
|
-
key: (config) => config.lookup?.authorizedFetch ? true : void 0
|
|
40
|
-
}),
|
|
41
|
-
firstKnock: bindConfig(option("--first-knock", choice(["draft-cavage-http-signatures-12", "rfc9421"]), { description: message`The first-knock spec for ${optionNames(["-a", "--authorized-fetch"])}. It is used for the double-knocking technique.` }), {
|
|
42
|
-
context: configContext,
|
|
43
|
-
key: (config) => config.lookup?.firstKnock ?? "draft-cavage-http-signatures-12",
|
|
44
|
-
default: "draft-cavage-http-signatures-12"
|
|
45
|
-
}),
|
|
46
|
-
tunnelService: optional(createTunnelServiceOption())
|
|
47
|
-
}), {
|
|
48
|
-
authorizedFetch: false,
|
|
49
|
-
firstKnock: void 0,
|
|
50
|
-
tunnelService: void 0
|
|
51
|
-
});
|
|
52
|
-
const lookupModeOption = withDefault(or(object("Recurse options", {
|
|
53
|
-
traverse: constant(false),
|
|
54
|
-
recurse: bindConfig(option("--recurse", choice(recurseProperties, { metavar: "PROPERTY" }), { description: message`Recursively follow a relationship property.` }), {
|
|
55
|
-
context: configContext,
|
|
56
|
-
key: (config) => config.lookup?.recurse
|
|
57
|
-
}),
|
|
58
|
-
recurseDepth: bindConfig(option("--recurse-depth", integer({
|
|
59
|
-
min: 1,
|
|
60
|
-
metavar: "DEPTH"
|
|
61
|
-
}), { description: message`Maximum recursion depth for ${optionNames(["--recurse"])}.` }), {
|
|
62
|
-
context: configContext,
|
|
63
|
-
key: (config) => config.lookup?.recurseDepth,
|
|
64
|
-
default: 20
|
|
65
|
-
}),
|
|
66
|
-
suppressErrors: suppressErrorsOption
|
|
67
|
-
}), object("Traverse options", {
|
|
68
|
-
traverse: bindConfig(flag("-t", "--traverse", { description: message`Traverse the given collection(s) to fetch all items.` }), {
|
|
69
|
-
context: configContext,
|
|
70
|
-
key: (config) => config.lookup?.traverse ?? false,
|
|
71
|
-
default: false
|
|
72
|
-
}),
|
|
73
|
-
recurse: constant(void 0),
|
|
74
|
-
recurseDepth: constant(void 0),
|
|
75
|
-
suppressErrors: suppressErrorsOption
|
|
76
|
-
})), {
|
|
77
|
-
traverse: false,
|
|
78
|
-
recurse: void 0,
|
|
79
|
-
recurseDepth: void 0,
|
|
80
|
-
suppressErrors: false
|
|
81
|
-
});
|
|
82
|
-
const lookupOptions = merge(object({ command: constant("lookup") }), lookupModeOption, authorizedFetchOption, merge("Network options", userAgentOption, object({
|
|
83
|
-
allowPrivateAddress: allowPrivateAddressOption,
|
|
84
|
-
timeout: optional(bindConfig(option("-T", "--timeout", float({
|
|
85
|
-
min: 0,
|
|
86
|
-
metavar: "SECONDS"
|
|
87
|
-
}), { description: message`Set timeout for network requests in seconds.` }), {
|
|
88
|
-
context: configContext,
|
|
89
|
-
key: (config) => config.lookup?.timeout
|
|
90
|
-
}))
|
|
91
|
-
})), object("Arguments", { urls: multiple(argument(string({ metavar: "URL_OR_HANDLE" }), { description: message`One or more URLs or handles to look up.` }), { min: 1 }) }), object("Output options", {
|
|
92
|
-
reverse: bindConfig(flag("--reverse", { description: message`Reverse the output order of fetched objects or items.` }), {
|
|
93
|
-
context: configContext,
|
|
94
|
-
key: (config) => config.lookup?.reverse ?? false,
|
|
95
|
-
default: false
|
|
96
|
-
}),
|
|
97
|
-
format: bindConfig(optional(or(map(flag("-r", "--raw", { description: message`Print the fetched JSON-LD document as is.` }), () => "raw"), map(flag("-C", "--compact", { description: message`Compact the fetched JSON-LD document.` }), () => "compact"), map(flag("-e", "--expand", { description: message`Expand the fetched JSON-LD document.` }), () => "expand"))), {
|
|
98
|
-
context: configContext,
|
|
99
|
-
key: (config) => config.lookup?.defaultFormat ?? "default",
|
|
100
|
-
default: "default"
|
|
101
|
-
}),
|
|
102
|
-
separator: bindConfig(option("-s", "--separator", string({ metavar: "SEPARATOR" }), { description: message`Specify the separator between adjacent output objects or collection items.` }), {
|
|
103
|
-
context: configContext,
|
|
104
|
-
key: (config) => config.lookup?.separator ?? "----",
|
|
105
|
-
default: "----"
|
|
106
|
-
}),
|
|
107
|
-
output: optional(option("-o", "--output", path({
|
|
108
|
-
metavar: "OUTPUT_PATH",
|
|
109
|
-
type: "file",
|
|
110
|
-
allowCreate: true
|
|
111
|
-
}), { description: message`Specify the output file path.` }))
|
|
112
|
-
}));
|
|
113
|
-
const lookupMetadata = {
|
|
114
|
-
brief: message`Look up Activity Streams objects.`,
|
|
115
|
-
description: message`Look up Activity Streams objects by URL or actor handle.
|
|
116
|
-
|
|
117
|
-
The arguments can be either URLs or actor handles (e.g., ${"@username@domain"}), and they can be multiple.`
|
|
118
|
-
};
|
|
119
|
-
command("lookup", lookupOptions, lookupMetadata);
|
|
120
|
-
//#endregion
|
|
121
|
-
export { FEDIBIRD_QUOTE_IRI, IN_REPLY_TO_IRI, MISSKEY_QUOTE_IRI, QUOTE_IRI, QUOTE_URL_IRI, authorizedFetchOption, lookupMetadata, lookupOptions };
|