@milkio/astra 1.0.0-alpha.2 → 1.0.0-alpha.33
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/index.ts +18 -8
- package/package.json +1 -1
- package/utils/cookbook-dto-checks.ts +7 -3
- package/utils/cookbook-dto-types.ts +1 -0
package/index.ts
CHANGED
|
@@ -70,30 +70,30 @@ export const createAstra = async <AstraOptions extends AstraOptionsInit, Generat
|
|
|
70
70
|
return projectStatus.get(projectName)!.resolve(undefined);
|
|
71
71
|
}
|
|
72
72
|
} catch (error) {}
|
|
73
|
-
},
|
|
73
|
+
}, 100);
|
|
74
74
|
}
|
|
75
75
|
return Array.from(projectStatus.values()).map((v) => v.promise);
|
|
76
76
|
})(),
|
|
77
77
|
]);
|
|
78
78
|
|
|
79
|
-
type Execute = <Path extends keyof Generated["routeSchema"]
|
|
79
|
+
type Execute = <Path extends keyof Generated["routeSchema"]>(
|
|
80
80
|
path: Path,
|
|
81
81
|
options?: Mixin<
|
|
82
82
|
ExecuteOptions,
|
|
83
83
|
| {
|
|
84
|
-
params?: Generated["routeSchema"]["
|
|
84
|
+
params?: Generated["routeSchema"][Path]["types"]["params"];
|
|
85
85
|
}
|
|
86
86
|
| {
|
|
87
|
-
params?: Partial<Generated["routeSchema"]["
|
|
87
|
+
params?: Partial<Generated["routeSchema"][Path]["types"]["params"]>;
|
|
88
88
|
generateParams: true;
|
|
89
89
|
}
|
|
90
90
|
>,
|
|
91
91
|
) => Promise<
|
|
92
|
-
Generated["routeSchema"]["
|
|
92
|
+
Generated["routeSchema"][Path]["types"]["🐣"] extends boolean
|
|
93
93
|
? // action
|
|
94
|
-
[Partial<Generated["rejectCode"]>, null, ExecuteResultsOption] | [null, Generated["routeSchema"]["
|
|
94
|
+
[Partial<Generated["rejectCode"]>, null, ExecuteResultsOption] | [null, Generated["routeSchema"][Path]["types"]["result"], ExecuteResultsOption]
|
|
95
95
|
: // stream
|
|
96
|
-
[Partial<Generated["rejectCode"]>, null, ExecuteResultsOption] | [null, AsyncGenerator<[Partial<Generated["rejectCode"]>, null] | [null, GeneratorGeneric<Generated["routeSchema"]["
|
|
96
|
+
[Partial<Generated["rejectCode"]>, null, ExecuteResultsOption] | [null, AsyncGenerator<[Partial<Generated["rejectCode"]>, null] | [null, GeneratorGeneric<Generated["routeSchema"][Path]["types"]["result"]>], ExecuteResultsOption>]
|
|
97
97
|
>;
|
|
98
98
|
|
|
99
99
|
type MirrorWorld = Mixin<
|
|
@@ -208,7 +208,17 @@ export const createAstra = async <AstraOptions extends AstraOptionsInit, Generat
|
|
|
208
208
|
} as any;
|
|
209
209
|
|
|
210
210
|
const reject = (...params: Array<unknown>): Error => {
|
|
211
|
-
const output: Array<any> = [
|
|
211
|
+
const output: Array<any> = [
|
|
212
|
+
"[REJECT]",
|
|
213
|
+
...params.map((param) => {
|
|
214
|
+
try {
|
|
215
|
+
const result = TSON.stringify(param);
|
|
216
|
+
return result;
|
|
217
|
+
} catch (error) {
|
|
218
|
+
return error?.toString?.() ?? typeof error;
|
|
219
|
+
}
|
|
220
|
+
}),
|
|
221
|
+
];
|
|
212
222
|
console.log(...output);
|
|
213
223
|
for (let index = 1; index < output.length; index++) {
|
|
214
224
|
if (typeof output[index] === "object") {
|
package/package.json
CHANGED
|
@@ -28,8 +28,8 @@ export const checkCookbookOptions = async (cookbookTomlParsed: any): Promise<[
|
|
|
28
28
|
if (undefined === value)
|
|
29
29
|
return true;
|
|
30
30
|
return "object" === typeof value && null !== value && $io2(value, true && _exceptionable);
|
|
31
|
-
}); const $io2 = (input: any, _exceptionable: boolean = true): boolean => ("milkio" === input.type || "other" === input.type) && "number" === typeof input.port && (Array.isArray(input.start) && input.start.every((elem: any, _index1: number) => "string" === typeof elem)) && (Array.isArray(input.build) && input.build.every((elem: any, _index2: number) => "string" === typeof elem)) && (undefined === input.lazyRoutes || "boolean" === typeof input.lazyRoutes) && (undefined === input.typiaMode || "generation" === input.typiaMode || "bundler" === input.typiaMode) && (undefined === input.significant || Array.isArray(input.significant) && input.significant.every((elem: any, _index3: number) => "string" === typeof elem)) && (undefined === input.insignificant || Array.isArray(input.insignificant) && input.insignificant.every((elem: any, _index4: number) => "string" === typeof elem)) && (4 === Object.keys(input).length || Object.keys(input).every((key: any) => {
|
|
32
|
-
if (["type", "port", "start", "build", "lazyRoutes", "typiaMode", "significant", "insignificant"].some((prop: any) => key === prop))
|
|
31
|
+
}); const $io2 = (input: any, _exceptionable: boolean = true): boolean => ("milkio" === input.type || "other" === input.type) && "number" === typeof input.port && (Array.isArray(input.start) && input.start.every((elem: any, _index1: number) => "string" === typeof elem)) && (Array.isArray(input.build) && input.build.every((elem: any, _index2: number) => "string" === typeof elem)) && (undefined === input.watch || "boolean" === typeof input.watch) && (undefined === input.lazyRoutes || "boolean" === typeof input.lazyRoutes) && (undefined === input.typiaMode || "generation" === input.typiaMode || "bundler" === input.typiaMode) && (undefined === input.significant || Array.isArray(input.significant) && input.significant.every((elem: any, _index3: number) => "string" === typeof elem)) && (undefined === input.insignificant || Array.isArray(input.insignificant) && input.insignificant.every((elem: any, _index4: number) => "string" === typeof elem)) && (4 === Object.keys(input).length || Object.keys(input).every((key: any) => {
|
|
32
|
+
if (["type", "port", "start", "build", "watch", "lazyRoutes", "typiaMode", "significant", "insignificant"].some((prop: any) => key === prop))
|
|
33
33
|
return true;
|
|
34
34
|
const value = input[key];
|
|
35
35
|
if (undefined === value)
|
|
@@ -114,6 +114,10 @@ export const checkCookbookOptions = async (cookbookTomlParsed: any): Promise<[
|
|
|
114
114
|
path: _path + ".build",
|
|
115
115
|
expected: "Array<string>",
|
|
116
116
|
value: input.build
|
|
117
|
+
}), undefined === input.watch || "boolean" === typeof input.watch || $report(_exceptionable, {
|
|
118
|
+
path: _path + ".watch",
|
|
119
|
+
expected: "(boolean | undefined)",
|
|
120
|
+
value: input.watch
|
|
117
121
|
}), undefined === input.lazyRoutes || "boolean" === typeof input.lazyRoutes || $report(_exceptionable, {
|
|
118
122
|
path: _path + ".lazyRoutes",
|
|
119
123
|
expected: "(boolean | undefined)",
|
|
@@ -147,7 +151,7 @@ export const checkCookbookOptions = async (cookbookTomlParsed: any): Promise<[
|
|
|
147
151
|
expected: "(Array<string> | undefined)",
|
|
148
152
|
value: input.insignificant
|
|
149
153
|
}), 4 === Object.keys(input).length || (false === _exceptionable || Object.keys(input).map((key: any) => {
|
|
150
|
-
if (["type", "port", "start", "build", "lazyRoutes", "typiaMode", "significant", "insignificant"].some((prop: any) => key === prop))
|
|
154
|
+
if (["type", "port", "start", "build", "watch", "lazyRoutes", "typiaMode", "significant", "insignificant"].some((prop: any) => key === prop))
|
|
151
155
|
return true;
|
|
152
156
|
const value = input[key];
|
|
153
157
|
if (undefined === value)
|