dfx 0.0.2 → 0.0.5
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/DiscordREST/types.d.ts +7 -0
- package/DiscordShard/commands.d.ts +7 -0
- package/DiscordShard/commands.js +38 -0
- package/DiscordShard/commands.js.map +1 -0
- package/DiscordShard/commands.ts +40 -0
- package/DiscordShard/heartbeats.d.ts +7 -0
- package/DiscordShard/heartbeats.js +33 -0
- package/DiscordShard/heartbeats.js.map +1 -0
- package/DiscordShard/heartbeats.ts +70 -0
- package/DiscordShard/identify.d.ts +16 -0
- package/DiscordShard/identify.js +35 -0
- package/DiscordShard/identify.js.map +1 -0
- package/DiscordShard/identify.ts +76 -0
- package/DiscordShard/index.d.ts +32 -0
- package/DiscordShard/index.js +60 -0
- package/DiscordShard/index.js.map +1 -0
- package/DiscordShard/index.ts +110 -0
- package/DiscordShard/invalidSession.d.ts +7 -0
- package/DiscordShard/invalidSession.js +17 -0
- package/DiscordShard/invalidSession.js.map +1 -0
- package/DiscordShard/invalidSession.ts +25 -0
- package/DiscordShard/utils.d.ts +9 -0
- package/DiscordShard/utils.js +24 -0
- package/DiscordShard/utils.js.map +1 -0
- package/DiscordShard/utils.ts +47 -0
- package/DiscordWS/index.d.ts +32 -0
- package/DiscordWS/index.js +35 -0
- package/DiscordWS/index.js.map +1 -1
- package/DiscordWS/index.ts +79 -0
- package/Log/index.d.ts +12 -0
- package/Log/index.js +19 -0
- package/Log/index.js.map +1 -0
- package/Log/index.ts +20 -0
- package/WS/index.d.ts +32 -0
- package/WS/index.js +12 -13
- package/WS/index.js.map +1 -1
- package/WS/index.ts +19 -27
- package/bot.d.ts +1 -0
- package/bot.js +33 -0
- package/bot.js.map +1 -0
- package/bot.ts +51 -0
- package/mod.d.ts +3 -0
- package/mod.js +5 -7
- package/mod.js.map +1 -1
- package/mod.ts +6 -22
- package/package.json +22 -3
- package/types.d.ts +3584 -0
- package/discord-api-docs/ci/checkLinks.ts +0 -177
- package/discord-api-docs/index.js +0 -1
- package/websocket.js +0 -11
- package/websocket.js.map +0 -1
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { readdirSync, statSync, readFileSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import chalk from "chalk";
|
|
4
|
-
import * as github from "@actions/core";
|
|
5
|
-
const cwd = process.env.GITHUB_ACTIONS ? process.env.GITHUB_WORKSPACE! : process.cwd();
|
|
6
|
-
|
|
7
|
-
function importDirectory(directory: string, extension: string, subdirectories = true) {
|
|
8
|
-
try {
|
|
9
|
-
const output = new Map<string, string>();
|
|
10
|
-
const files = readdirSync(directory);
|
|
11
|
-
for (const fileOrPath of files) {
|
|
12
|
-
const currentPath = path.join(directory, fileOrPath);
|
|
13
|
-
if (statSync(currentPath).isDirectory()) {
|
|
14
|
-
if (!subdirectories) continue;
|
|
15
|
-
const subdir = importDirectory(currentPath, extension, subdirectories);
|
|
16
|
-
if (!subdir) continue;
|
|
17
|
-
for (const [name, read] of subdir) {
|
|
18
|
-
output.set(`/${fileOrPath}${name}`, read);
|
|
19
|
-
}
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
if (!fileOrPath.endsWith(extension)) continue;
|
|
23
|
-
const read = readFileSync(currentPath, "utf8");
|
|
24
|
-
output.set(`/${fileOrPath}`, read);
|
|
25
|
-
}
|
|
26
|
-
return output;
|
|
27
|
-
} catch {
|
|
28
|
-
// Directory likely does not exist, we should be able to safely discard this error
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function printResults(resultMap: Map<string, github.AnnotationProperties[]>): void {
|
|
34
|
-
let output = "\n";
|
|
35
|
-
let total = 0;
|
|
36
|
-
for (const [resultFile, resultArr] of resultMap) {
|
|
37
|
-
if (resultArr.length <= 0) continue;
|
|
38
|
-
const filePath = path.join(cwd, resultFile);
|
|
39
|
-
output += `${chalk.underline(filePath)}\n`;
|
|
40
|
-
output += resultArr.reduce<string>((result, props) => {
|
|
41
|
-
total += 1;
|
|
42
|
-
return `${result} ${props.startLine ?? ""}:${props.startColumn ?? ""}-${props.endColumn ?? ""} ${chalk.yellow(
|
|
43
|
-
"warning"
|
|
44
|
-
)} ${props.title ?? ""}\n`;
|
|
45
|
-
}, "");
|
|
46
|
-
output += "\n";
|
|
47
|
-
}
|
|
48
|
-
output += "\n";
|
|
49
|
-
if (total > 0) {
|
|
50
|
-
output += chalk.red.bold(`\u2716 ${total} problem${total === 1 ? "" : "s"}\n`);
|
|
51
|
-
}
|
|
52
|
-
console.log(output);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function annotateResults(resultMap: Map<string, github.AnnotationProperties[]>): void {
|
|
56
|
-
let total = 0;
|
|
57
|
-
for (const [resultFile, resultArr] of resultMap) {
|
|
58
|
-
if (resultArr.length <= 0) continue;
|
|
59
|
-
github.startGroup(resultFile);
|
|
60
|
-
for (const result of resultArr) {
|
|
61
|
-
total += 1;
|
|
62
|
-
console.log(
|
|
63
|
-
`::warning file=${resultFile},title=Invalid Link,line=${result.startLine ?? 0},endLine=${
|
|
64
|
-
result.startLine ?? 0
|
|
65
|
-
},col=${result.startColumn ?? 0},endColumn=${result.endColumn ?? result.startColumn ?? 0}::${
|
|
66
|
-
result.title ?? "Invalid Link"
|
|
67
|
-
}`
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
github.endGroup();
|
|
71
|
-
}
|
|
72
|
-
if (total > 0) {
|
|
73
|
-
github.setFailed("One or more links are invalid!");
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const docFiles = importDirectory(path.join(cwd, "docs"), ".md");
|
|
78
|
-
|
|
79
|
-
if (!docFiles) {
|
|
80
|
-
console.error("No doc files found!");
|
|
81
|
-
process.exit(1);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const validLinks = new Map<string, string[]>([
|
|
85
|
-
["APPLICATIONS", []],
|
|
86
|
-
["SERVERS", []],
|
|
87
|
-
["TEAMS", []],
|
|
88
|
-
]);
|
|
89
|
-
|
|
90
|
-
const extLength = ".md".length;
|
|
91
|
-
|
|
92
|
-
// Gather valid links
|
|
93
|
-
for (const [name, raw] of docFiles) {
|
|
94
|
-
const keyName = `DOCS${name.slice(0, -extLength).replaceAll("/", "_").toUpperCase()}`;
|
|
95
|
-
if (!validLinks.has(keyName)) {
|
|
96
|
-
validLinks.set(keyName, []);
|
|
97
|
-
}
|
|
98
|
-
const validAnchors = validLinks.get(keyName)!;
|
|
99
|
-
|
|
100
|
-
let parentAnchor = "";
|
|
101
|
-
let multilineCode = false;
|
|
102
|
-
for (const line of raw.split("\n")) {
|
|
103
|
-
if (line.trim().startsWith("```")) {
|
|
104
|
-
multilineCode = !multilineCode;
|
|
105
|
-
if (line.trim().length > 3 && line.trim().endsWith("```")) multilineCode = !multilineCode;
|
|
106
|
-
}
|
|
107
|
-
if (multilineCode || !line.startsWith("#")) continue;
|
|
108
|
-
const anchor = line
|
|
109
|
-
.split("%")[0]
|
|
110
|
-
.replace(/[^ A-Z0-9]/gi, "")
|
|
111
|
-
.trim()
|
|
112
|
-
.replace(/ +/g, "-")
|
|
113
|
-
.toLowerCase();
|
|
114
|
-
if (/^#{1,4}(?!#)/.test(line.trim())) {
|
|
115
|
-
parentAnchor = `${anchor}-`;
|
|
116
|
-
validAnchors.push(anchor);
|
|
117
|
-
continue;
|
|
118
|
-
}
|
|
119
|
-
validAnchors.push(`${parentAnchor}${anchor}`);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const results = new Map<string, github.AnnotationProperties[]>();
|
|
124
|
-
|
|
125
|
-
// Check Links
|
|
126
|
-
for (const [name, raw] of docFiles) {
|
|
127
|
-
const fileName = `docs${name}`;
|
|
128
|
-
const file = raw.split("\n");
|
|
129
|
-
if (!results.has(fileName)) {
|
|
130
|
-
results.set(fileName, []);
|
|
131
|
-
}
|
|
132
|
-
const ownResults = results.get(fileName)!;
|
|
133
|
-
let multilineCode = false;
|
|
134
|
-
file.forEach((line, lineNum) => {
|
|
135
|
-
if (line.trim().startsWith("```")) {
|
|
136
|
-
multilineCode = !multilineCode;
|
|
137
|
-
if (line.trim().length > 3 && line.trim().endsWith("```")) multilineCode = !multilineCode;
|
|
138
|
-
}
|
|
139
|
-
if (multilineCode) return;
|
|
140
|
-
const matches = line.matchAll(/(?<![!`])\[.+?\]\((?!https?|mailto)(.+?)\)(?!`)/g);
|
|
141
|
-
|
|
142
|
-
for (const match of matches) {
|
|
143
|
-
const split = match[1].split("#")[1].split("/");
|
|
144
|
-
const page = split[0];
|
|
145
|
-
const anchor = split[1];
|
|
146
|
-
if (!validLinks.has(page)) {
|
|
147
|
-
ownResults.push({
|
|
148
|
-
title: `Base url ${chalk.blueBright(page)} does not exist`,
|
|
149
|
-
startLine: lineNum + 1,
|
|
150
|
-
startColumn: match.index,
|
|
151
|
-
endColumn: (match.index ?? 0) + match[0].length,
|
|
152
|
-
});
|
|
153
|
-
continue;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (!anchor) continue;
|
|
157
|
-
if (!validLinks.get(page)!.includes(anchor)) {
|
|
158
|
-
const suggestions = validLinks.get(page)!.filter((a) => a.includes(anchor));
|
|
159
|
-
const suggestionText = suggestions.length > 0 ? ` Did you mean one of (${suggestions.join(", ")})?` : "";
|
|
160
|
-
ownResults.push({
|
|
161
|
-
title: `Anchor ${chalk.cyan(anchor)} does not exist on ${chalk.blueBright(page)}${suggestionText}`,
|
|
162
|
-
startLine: lineNum + 1,
|
|
163
|
-
startColumn: match.index,
|
|
164
|
-
endColumn: (match.index ?? 0) + match[0].length,
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (results.size > 0) {
|
|
172
|
-
if (process.env.GITHUB_ACTIONS) {
|
|
173
|
-
annotateResults(results);
|
|
174
|
-
} else {
|
|
175
|
-
printResults(results);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = {};
|
package/websocket.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as tracing_1 from "@effect-ts/core/Tracing";
|
|
2
|
-
const fileName_1 = "websocket.ts";
|
|
3
|
-
import * as Ws from "ws";
|
|
4
|
-
import * as H from "@effect-ts/core/Effect/Hub";
|
|
5
|
-
import * as S from "@effect-ts/core/Effect/Experimental/Stream";
|
|
6
|
-
export const create = (url, options) => {
|
|
7
|
-
const ws = new Ws.WebSocket(url, options);
|
|
8
|
-
const hub = H.makeUnbounded();
|
|
9
|
-
S.fromHub;
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=websocket.js.map
|
package/websocket.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"websocket.js","sourceRoot":"","sources":["websocket.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAExB,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAA;AAC/C,OAAO,KAAK,CAAC,MAAM,4CAA4C,CAAA;AAE/D,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,OAA0B,EAAE,EAAE;IAChE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAEzC,MAAM,GAAG,GAAG,CAAC,CAAC,aAAa,EAAI,CAAA;IAE/B,CAAC,CAAC,OAAO,CAAA;AACX,CAAC,CAAA"}
|