@constatic/base 0.0.7 → 0.0.9
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.
|
@@ -18,11 +18,12 @@ class CommandManager extends BaseManager {
|
|
|
18
18
|
if (command.data.autocomplete) {
|
|
19
19
|
this.autocompleteRunners.set(path, command.data.autocomplete);
|
|
20
20
|
}
|
|
21
|
-
const
|
|
21
|
+
const type = command.data.type;
|
|
22
|
+
const [icon, label] = this.getTitle(type);
|
|
22
23
|
this.logs.push([
|
|
23
24
|
styleText("green", `${icon} ${label}`),
|
|
24
25
|
styleText("gray", `>`),
|
|
25
|
-
styleText(["blue", "underline"], command.data.name),
|
|
26
|
+
styleText(["blue", "underline"], (type === ApplicationCommandType.ChatInput ? "/" : "") + command.data.name),
|
|
26
27
|
styleText("green", "✓")
|
|
27
28
|
].join(" "));
|
|
28
29
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/creators/events/manager.ts
|
|
2
2
|
import { Collection } from "discord.js";
|
|
3
|
+
import { styleText } from "node:util";
|
|
3
4
|
import { BaseManager } from "../manager.js";
|
|
4
5
|
|
|
5
6
|
class EventManager extends BaseManager {
|
|
@@ -16,6 +17,14 @@ class EventManager extends BaseManager {
|
|
|
16
17
|
add(event) {
|
|
17
18
|
const events = this.getEvents(event.data.event);
|
|
18
19
|
events.set(event.data.name, event);
|
|
20
|
+
this.logs.push([
|
|
21
|
+
styleText("yellow", `✦ Event`),
|
|
22
|
+
styleText("gray", `>`),
|
|
23
|
+
styleText(["yellow"], event.data.event),
|
|
24
|
+
styleText("gray", `>`),
|
|
25
|
+
styleText(["blue", "underline"], event.data.name),
|
|
26
|
+
styleText("green", "✓")
|
|
27
|
+
].join(" "));
|
|
19
28
|
}
|
|
20
29
|
async onEvent(event, args) {
|
|
21
30
|
const { middleware, onError } = this.config;
|
package/dist/env.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { StandardSchemaV1 } from "
|
|
2
|
-
type Schema = StandardSchemaV1;
|
|
3
|
-
type Out<T extends Schema> = StandardSchemaV1.InferOutput<T>;
|
|
1
|
+
import type { StandardSchemaV1 } from "./standard-schema.js";
|
|
4
2
|
/**
|
|
5
3
|
* Validates the current process environment variables using a StandardSchema.
|
|
6
4
|
*
|
|
@@ -24,5 +22,4 @@ type Out<T extends Schema> = StandardSchemaV1.InferOutput<T>;
|
|
|
24
22
|
* BOT_TOKEN: "string > 0"
|
|
25
23
|
* }));
|
|
26
24
|
*/
|
|
27
|
-
export declare function validateEnv<T extends
|
|
28
|
-
export {};
|
|
25
|
+
export declare function validateEnv<const T extends StandardSchemaV1>(schema: T): Promise<StandardSchemaV1.InferOutput<T>>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** The Standard Schema interface. */
|
|
2
|
+
export interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
3
|
+
/** The Standard Schema properties. */
|
|
4
|
+
readonly '~standard': StandardSchemaV1.Props<Input, Output>;
|
|
5
|
+
}
|
|
6
|
+
export declare namespace StandardSchemaV1 {
|
|
7
|
+
/** The Standard Schema properties interface. */
|
|
8
|
+
interface Props<Input = unknown, Output = Input> {
|
|
9
|
+
/** The version number of the standard. */
|
|
10
|
+
readonly version: 1;
|
|
11
|
+
/** The vendor name of the schema library. */
|
|
12
|
+
readonly vendor: string;
|
|
13
|
+
/** Validates unknown input values. */
|
|
14
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
15
|
+
/** Inferred types associated with the schema. */
|
|
16
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
17
|
+
}
|
|
18
|
+
/** The result interface of the validate function. */
|
|
19
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
20
|
+
/** The result interface if validation succeeds. */
|
|
21
|
+
interface SuccessResult<Output> {
|
|
22
|
+
/** The typed output value. */
|
|
23
|
+
readonly value: Output;
|
|
24
|
+
/** A falsy value for `issues` indicates success. */
|
|
25
|
+
readonly issues?: undefined;
|
|
26
|
+
}
|
|
27
|
+
interface Options {
|
|
28
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
29
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
30
|
+
}
|
|
31
|
+
/** The result interface if validation fails. */
|
|
32
|
+
interface FailureResult {
|
|
33
|
+
/** The issues of failed validation. */
|
|
34
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
35
|
+
}
|
|
36
|
+
/** The issue interface of the failure output. */
|
|
37
|
+
interface Issue {
|
|
38
|
+
/** The error message of the issue. */
|
|
39
|
+
readonly message: string;
|
|
40
|
+
/** The path of the issue, if any. */
|
|
41
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
42
|
+
}
|
|
43
|
+
/** The path segment interface of the issue. */
|
|
44
|
+
interface PathSegment {
|
|
45
|
+
/** The key representing a path segment. */
|
|
46
|
+
readonly key: PropertyKey;
|
|
47
|
+
}
|
|
48
|
+
/** The Standard Schema types interface. */
|
|
49
|
+
interface Types<Input = unknown, Output = Input> {
|
|
50
|
+
/** The input type of the schema. */
|
|
51
|
+
readonly input: Input;
|
|
52
|
+
/** The output type of the schema. */
|
|
53
|
+
readonly output: Output;
|
|
54
|
+
}
|
|
55
|
+
/** Infers the input type of a Standard Schema. */
|
|
56
|
+
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
|
|
57
|
+
/** Infers the output type of a Standard Schema. */
|
|
58
|
+
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
|
|
59
|
+
}
|
|
File without changes
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constatic/base",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Library with structures and functions for creating modern Discord applications.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@constatic/config": "*",
|
|
45
|
-
"@standard-schema/spec": "^1.1.0",
|
|
46
45
|
"typescript": "^5.8.2"
|
|
47
46
|
},
|
|
48
47
|
"exports": {
|
|
@@ -70,10 +69,10 @@
|
|
|
70
69
|
"dev": "bun run ./playground/index.ts"
|
|
71
70
|
},
|
|
72
71
|
"peerDependencies": {
|
|
73
|
-
"discord.js": "^14.
|
|
72
|
+
"discord.js": "^14.26.3"
|
|
74
73
|
},
|
|
75
74
|
"dependencies": {
|
|
76
|
-
"rou3": "^0.
|
|
77
|
-
"tinyglobby": "^0.2.
|
|
75
|
+
"rou3": "^0.8.1",
|
|
76
|
+
"tinyglobby": "^0.2.16"
|
|
78
77
|
}
|
|
79
78
|
}
|