@kunk/api 3.0.1 → 3.0.2
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/.turbo/turbo-build.log +17 -12
- package/.turbo/turbo-deploy.log +0 -0
- package/.turbo/turbo-version$colon$patch.log +4 -0
- package/CHANGELOG.md +0 -6
- package/dist/index.d.mts +83 -7
- package/package.json +4 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
[
|
|
3
|
-
[34mℹ[39m
|
|
4
|
-
[34mℹ[39m
|
|
5
|
-
[34mℹ[39m
|
|
6
|
-
[34mℹ[39m
|
|
7
|
-
[34mℹ[39m
|
|
8
|
-
[34mℹ[39m
|
|
9
|
-
|
|
10
|
-
[
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
|
|
2
|
+
[0m[2m[35m$[0m [2m[1mtsdown[0m
|
|
3
|
+
[34mℹ[39m tsdown [2mv0.20.3[22m powered by rolldown [2mv1.0.0-rc.3[22m
|
|
4
|
+
[34mℹ[39m config file: [4m/Users/ag/auxo/kunk/packages/api/tsdown.config.ts[24m
|
|
5
|
+
[34mℹ[39m entry: [34msrc/index.ts[39m
|
|
6
|
+
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
7
|
+
[34mℹ[39m Build start
|
|
8
|
+
[34mℹ[39m Cleaning 2 files
|
|
9
|
+
|
|
10
|
+
[43m WARN [49m Consider adding [34minlineOnly[39m option to avoid unintended bundling of dependencies, or set [34minlineOnly: false[39m to disable this warning.
|
|
11
|
+
Detected dependencies in bundle:
|
|
12
|
+
- [33m@standard-schema/spec[39m
|
|
13
|
+
|
|
14
|
+
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m0.65 kB[22m [2m│ gzip: 0.40 kB[22m
|
|
15
|
+
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m7.41 kB[22m [2m│ gzip: 2.03 kB[22m
|
|
16
|
+
[34mℹ[39m 2 files, total: 8.06 kB
|
|
17
|
+
[32m✔[39m Build complete in [32m1126ms[39m
|
|
File without changes
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { StandardSchemaV1, StandardSchemaV1 as StandardSchemaV1$1 } from "@standard-schema/spec";
|
|
2
|
-
|
|
3
1
|
//#region src/contracts/ContextData.d.ts
|
|
4
2
|
declare class ContextData {
|
|
5
3
|
readonly tenantId?: string;
|
|
@@ -28,8 +26,86 @@ declare class Validator {
|
|
|
28
26
|
validate(...asserts: Array<Promise<IError> | IError>): Promise<void>;
|
|
29
27
|
}
|
|
30
28
|
//#endregion
|
|
29
|
+
//#region ../../node_modules/@standard-schema/spec/dist/index.d.ts
|
|
30
|
+
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
31
|
+
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
32
|
+
/** The Standard properties. */
|
|
33
|
+
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
34
|
+
}
|
|
35
|
+
declare namespace StandardTypedV1 {
|
|
36
|
+
/** The Standard Typed properties interface. */
|
|
37
|
+
interface Props<Input = unknown, Output = Input> {
|
|
38
|
+
/** The version number of the standard. */
|
|
39
|
+
readonly version: 1;
|
|
40
|
+
/** The vendor name of the schema library. */
|
|
41
|
+
readonly vendor: string;
|
|
42
|
+
/** Inferred types associated with the schema. */
|
|
43
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
44
|
+
}
|
|
45
|
+
/** The Standard Typed types interface. */
|
|
46
|
+
interface Types<Input = unknown, Output = Input> {
|
|
47
|
+
/** The input type of the schema. */
|
|
48
|
+
readonly input: Input;
|
|
49
|
+
/** The output type of the schema. */
|
|
50
|
+
readonly output: Output;
|
|
51
|
+
}
|
|
52
|
+
/** Infers the input type of a Standard Typed. */
|
|
53
|
+
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
54
|
+
/** Infers the output type of a Standard Typed. */
|
|
55
|
+
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
56
|
+
}
|
|
57
|
+
/** The Standard Schema interface. */
|
|
58
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
59
|
+
/** The Standard Schema properties. */
|
|
60
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
61
|
+
}
|
|
62
|
+
declare namespace StandardSchemaV1 {
|
|
63
|
+
/** The Standard Schema properties interface. */
|
|
64
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
65
|
+
/** Validates unknown input values. */
|
|
66
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
67
|
+
}
|
|
68
|
+
/** The result interface of the validate function. */
|
|
69
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
70
|
+
/** The result interface if validation succeeds. */
|
|
71
|
+
interface SuccessResult<Output> {
|
|
72
|
+
/** The typed output value. */
|
|
73
|
+
readonly value: Output;
|
|
74
|
+
/** A falsy value for `issues` indicates success. */
|
|
75
|
+
readonly issues?: undefined;
|
|
76
|
+
}
|
|
77
|
+
interface Options {
|
|
78
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
79
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
80
|
+
}
|
|
81
|
+
/** The result interface if validation fails. */
|
|
82
|
+
interface FailureResult {
|
|
83
|
+
/** The issues of failed validation. */
|
|
84
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
85
|
+
}
|
|
86
|
+
/** The issue interface of the failure output. */
|
|
87
|
+
interface Issue {
|
|
88
|
+
/** The error message of the issue. */
|
|
89
|
+
readonly message: string;
|
|
90
|
+
/** The path of the issue, if any. */
|
|
91
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
92
|
+
}
|
|
93
|
+
/** The path segment interface of the issue. */
|
|
94
|
+
interface PathSegment {
|
|
95
|
+
/** The key representing a path segment. */
|
|
96
|
+
readonly key: PropertyKey;
|
|
97
|
+
}
|
|
98
|
+
/** The Standard types interface. */
|
|
99
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
|
|
100
|
+
/** Infers the input type of a Standard. */
|
|
101
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
102
|
+
/** Infers the output type of a Standard. */
|
|
103
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
104
|
+
}
|
|
105
|
+
/** The Standard JSON Schema interface. */
|
|
106
|
+
//#endregion
|
|
31
107
|
//#region src/interfaces/ICommand.d.ts
|
|
32
|
-
interface ICommand<IN extends StandardSchemaV1
|
|
108
|
+
interface ICommand<IN extends StandardSchemaV1 = StandardSchemaV1, OUT extends StandardSchemaV1 = StandardSchemaV1> {
|
|
33
109
|
"~type": "kunk:command";
|
|
34
110
|
name: string;
|
|
35
111
|
input: IN;
|
|
@@ -50,7 +126,7 @@ type BuiltIn = Primitive | Date | RegExp | Error | Map<any, any> | Set<any> | We
|
|
|
50
126
|
* Remove undefined de um tipo union
|
|
51
127
|
*/
|
|
52
128
|
type RemoveUndefined<T> = T extends undefined ? never : T;
|
|
53
|
-
type DeepKey<T, D extends number = 10> = T extends StandardSchemaV1
|
|
129
|
+
type DeepKey<T, D extends number = 10> = T extends StandardSchemaV1 ? DeepKey<StandardSchemaV1.InferOutput<T>, D> : [D] extends [never] ? never : T extends BuiltIn ? never : T extends object ? { [K in keyof T]-?: K extends string | number ? RemoveUndefined<T[K]> extends BuiltIn ? `${K}` : RemoveUndefined<T[K]> extends Array<infer U> ? `${K}` | (U extends BuiltIn ? never : `${K}.${number}` | `${K}.${DeepKey<U, Prev[D]>}`) : RemoveUndefined<T[K]> extends object ? `${K}` | `${K}.${DeepKey<RemoveUndefined<T[K]>, Prev[D]>}` : `${K}` : never }[keyof T] : any;
|
|
54
130
|
type DeepValue<T, P extends string> = P extends keyof T ? T[P] : P extends `${infer First}.${infer Rest}` ? First extends keyof T ? Rest extends `${number}` ? RemoveUndefined<T[First]> extends Array<infer U> ? U : never : Rest extends `${number}.${infer After}` ? RemoveUndefined<T[First]> extends Array<infer U> ? DeepValue<U, After> : never : DeepValue<RemoveUndefined<T[First]>, Rest> : any : any;
|
|
55
131
|
//#endregion
|
|
56
132
|
//#region src/utils/error.d.ts
|
|
@@ -77,7 +153,7 @@ declare namespace I {
|
|
|
77
153
|
} ? Input<INPUT> : T extends {
|
|
78
154
|
"~type": "kunk:schema";
|
|
79
155
|
input: infer INPUT;
|
|
80
|
-
} ? Input<INPUT> : T extends StandardSchemaV1
|
|
156
|
+
} ? Input<INPUT> : T extends StandardSchemaV1 ? StandardSchemaV1.InferInput<T> : T extends object ? { [K in keyof T]: I.Input<T[K]> } : never;
|
|
81
157
|
type Output<T> = T extends {
|
|
82
158
|
"~type": "kunk:aggregate";
|
|
83
159
|
schema: infer SCHEMA;
|
|
@@ -87,7 +163,7 @@ declare namespace I {
|
|
|
87
163
|
} ? Output<OUTPUT> : T extends {
|
|
88
164
|
"~type": "kunk:schema";
|
|
89
165
|
output: infer OUTPUT;
|
|
90
|
-
} ? Output<OUTPUT> : T extends StandardSchemaV1
|
|
166
|
+
} ? Output<OUTPUT> : T extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<T> : T extends object ? { [K in keyof T]: I.Output<T[K]> } : never;
|
|
91
167
|
}
|
|
92
168
|
//#endregion
|
|
93
|
-
export { ContextData, DeepKey, DeepValue, Generator, I, ICommand, IThrowable, Logger,
|
|
169
|
+
export { ContextData, DeepKey, DeepValue, Generator, I, ICommand, IThrowable, Logger, StandardSchemaV1, Throwable, Validator };
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kunk/api",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
7
7
|
"module": "./src/index.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "tsdown"
|
|
9
|
+
"build": "tsdown",
|
|
10
|
+
"version:patch": "bun pm version patch",
|
|
11
|
+
"deploy": "bun publish"
|
|
10
12
|
},
|
|
11
13
|
"dependencies": {
|
|
12
14
|
"@inversifyjs/common": "^1.5.2"
|