@pikku/cli 0.6.11 → 0.6.13
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/CHANGELOG.md +17 -0
- package/bin/pikku-all.ts +15 -6
- package/bin/pikku-channels-map.ts +8 -6
- package/bin/pikku-channels.ts +7 -6
- package/bin/pikku-fetch.ts +1 -0
- package/bin/pikku-function-types.ts +18 -10
- package/bin/{pikku-routes.ts → pikku-http.ts} +11 -10
- package/bin/pikku-nextjs.ts +7 -2
- package/bin/pikku-openapi.ts +8 -9
- package/bin/pikku-routes-map.ts +7 -6
- package/bin/pikku-scheduler.ts +8 -7
- package/bin/pikku-schemas.ts +2 -1
- package/bin/pikku-websocket.ts +1 -0
- package/bin/pikku.ts +1 -1
- package/dist/bin/pikku-all.js +7 -6
- package/dist/bin/pikku-channels-map.js +2 -6
- package/dist/bin/pikku-channels.js +2 -6
- package/dist/bin/pikku-fetch.js +1 -1
- package/dist/bin/pikku-function-types.js +10 -10
- package/dist/bin/{pikku-routes.d.ts → pikku-http.d.ts} +1 -1
- package/dist/bin/{pikku-routes.js → pikku-http.js} +5 -9
- package/dist/bin/pikku-nextjs.js +5 -4
- package/dist/bin/pikku-openapi.js +3 -9
- package/dist/bin/pikku-routes-map.js +2 -6
- package/dist/bin/pikku-scheduler.js +3 -7
- package/dist/bin/pikku-schemas.js +1 -1
- package/dist/bin/pikku-websocket.js +1 -1
- package/dist/bin/pikku.js +1 -1
- package/dist/src/core/serialize-pikku-types.d.ts +1 -1
- package/dist/src/core/serialize-pikku-types.js +11 -9
- package/dist/src/http/serialize-fetch-wrapper.js +22 -12
- package/dist/src/inspector-glob.d.ts +2 -2
- package/dist/src/inspector-glob.js +2 -2
- package/dist/src/nextjs/serialize-nextjs-wrapper.d.ts +1 -1
- package/dist/src/nextjs/serialize-nextjs-wrapper.js +60 -12
- package/dist/src/pikku-cli-config.d.ts +3 -1
- package/dist/src/pikku-cli-config.js +8 -4
- package/dist/src/utils.d.ts +4 -1
- package/dist/src/utils.js +5 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/core/serialize-pikku-types.ts +12 -8
- package/src/http/serialize-fetch-wrapper.ts +22 -12
- package/src/inspector-glob.ts +4 -3
- package/src/nextjs/serialize-nextjs-wrapper.ts +61 -12
- package/src/pikku-cli-config.ts +12 -0
- package/src/utils.ts +15 -3
|
@@ -15,7 +15,7 @@ async function action({ config }) {
|
|
|
15
15
|
'schemaDirectory',
|
|
16
16
|
'tsconfig',
|
|
17
17
|
]);
|
|
18
|
-
const visitState = await inspectorGlob(cliConfig.rootDir, cliConfig.routeDirectories);
|
|
18
|
+
const visitState = await inspectorGlob(cliConfig.rootDir, cliConfig.routeDirectories, cliConfig.filters);
|
|
19
19
|
await pikkuSchemas(cliConfig, visitState);
|
|
20
20
|
}
|
|
21
21
|
export const schemas = (program) => {
|
|
@@ -16,7 +16,7 @@ export const pikkuWebSocket = async ({ websocketFile, channelsMapDeclarationFile
|
|
|
16
16
|
};
|
|
17
17
|
export const action = async (options) => {
|
|
18
18
|
logPikkuLogo();
|
|
19
|
-
const cliConfig = await getPikkuCLIConfig(options.config, ['rootDir', 'schemaDirectory', 'configDir', 'fetchFile'], true);
|
|
19
|
+
const cliConfig = await getPikkuCLIConfig(options.config, ['rootDir', 'schemaDirectory', 'configDir', 'fetchFile'], options.tags, true);
|
|
20
20
|
await pikkuWebSocket(cliConfig);
|
|
21
21
|
};
|
|
22
22
|
export const websocket = (program) => {
|
package/dist/bin/pikku.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import { schemas } from './pikku-schemas.js';
|
|
4
|
-
import { routes } from './pikku-
|
|
4
|
+
import { routes } from './pikku-http.js';
|
|
5
5
|
import { nextjs } from './pikku-nextjs.js';
|
|
6
6
|
import { all } from './pikku-all.js';
|
|
7
7
|
import { functionTypes } from './pikku-function-types.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
3
|
*/
|
|
4
|
-
export declare const serializePikkuTypes: (userSessionTypeImport: string, userSessionTypeName: string, sessionServicesTypeImport: string, servicesTypeName: string) => string;
|
|
4
|
+
export declare const serializePikkuTypes: (userSessionTypeImport: string, userSessionTypeName: string, singletonServicesTypeImport: string, singletonServicesTypeName: string, sessionServicesTypeImport: string, servicesTypeName: string) => string;
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
3
|
*/
|
|
4
|
-
export const serializePikkuTypes = (userSessionTypeImport, userSessionTypeName, sessionServicesTypeImport, servicesTypeName) => {
|
|
4
|
+
export const serializePikkuTypes = (userSessionTypeImport, userSessionTypeName, singletonServicesTypeImport, singletonServicesTypeName, sessionServicesTypeImport, servicesTypeName) => {
|
|
5
5
|
return `/**
|
|
6
6
|
* This is used to provide the application types in the typescript project
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { CoreAPIFunction, CoreAPIFunctionSessionless, CoreAPIPermission } from '@pikku/core'
|
|
9
|
+
import { CoreAPIFunction, CoreAPIFunctionSessionless, CoreAPIPermission, PikkuMiddleware } from '@pikku/core'
|
|
10
10
|
import { CoreHTTPFunctionRoute, AssertRouteParams, addRoute as addCoreHTTP } from '@pikku/core/http'
|
|
11
11
|
import { CoreScheduledTask, addScheduledTask as addCoreScheduledTask } from '@pikku/core/scheduler'
|
|
12
12
|
import { CoreAPIChannel, PikkuChannel, addChannel as addCoreChannel } from '@pikku/core/channel'
|
|
13
13
|
|
|
14
14
|
${userSessionTypeImport}
|
|
15
|
+
${singletonServicesTypeImport}
|
|
15
16
|
${sessionServicesTypeImport}
|
|
16
17
|
|
|
17
|
-
export type APIPermission<In = unknown, RequiredServices = ${
|
|
18
|
+
export type APIPermission<In = unknown, RequiredServices extends ${singletonServicesTypeName} = ${singletonServicesTypeName}> = CoreAPIPermission<In, RequiredServices, ${userSessionTypeName}>
|
|
19
|
+
export type APIMiddleware<RequiredServices extends ${singletonServicesTypeName} = ${singletonServicesTypeName}> = PikkuMiddleware<RequiredServices, ${userSessionTypeName}>
|
|
18
20
|
|
|
19
|
-
export type APIFunctionSessionless<In = unknown, Out = never, RequiredServices = ${servicesTypeName}> = CoreAPIFunctionSessionless<In, Out, RequiredServices, ${userSessionTypeName}>
|
|
20
|
-
export type APIFunction<In = unknown, Out = never, RequiredServices = ${servicesTypeName}> = CoreAPIFunction<In, Out, RequiredServices, ${userSessionTypeName}>
|
|
21
|
-
type APIRoute<In, Out, Route extends string> = CoreHTTPFunctionRoute<In, Out, Route, APIFunction<In, Out>, APIFunctionSessionless<In, Out>, APIPermission<In
|
|
21
|
+
export type APIFunctionSessionless<In = unknown, Out = never, RequiredServices extends ${servicesTypeName} = ${servicesTypeName}> = CoreAPIFunctionSessionless<In, Out, RequiredServices, ${userSessionTypeName}>
|
|
22
|
+
export type APIFunction<In = unknown, Out = never, RequiredServices extends ${servicesTypeName} = ${servicesTypeName}> = CoreAPIFunction<In, Out, RequiredServices, ${userSessionTypeName}>
|
|
23
|
+
type APIRoute<In, Out, Route extends string> = CoreHTTPFunctionRoute<In, Out, Route, APIFunction<In, Out>, APIFunctionSessionless<In, Out>, APIPermission<In>, APIMiddleware>
|
|
22
24
|
|
|
23
|
-
export type ChannelConnection<Out = unknown, ChannelData = unknown, RequiredServices extends ${servicesTypeName} = ${servicesTypeName}> = (services: RequiredServices, channel: PikkuChannel
|
|
24
|
-
export type ChannelDisconnection<ChannelData = unknown, RequiredServices extends ${servicesTypeName} = ${servicesTypeName}> = (services: RequiredServices, channel: PikkuChannel
|
|
25
|
-
export type ChannelMessage<In, Out = unknown, ChannelData = unknown, RequiredServices extends ${servicesTypeName} = ${servicesTypeName}> = (services: RequiredServices, channel: PikkuChannel
|
|
25
|
+
export type ChannelConnection<Out = unknown, ChannelData = unknown, RequiredServices extends ${servicesTypeName} = ${servicesTypeName}> = (services: RequiredServices, channel: PikkuChannel<ChannelData, Out>) => Promise<void>
|
|
26
|
+
export type ChannelDisconnection<ChannelData = unknown, RequiredServices extends ${servicesTypeName} = ${servicesTypeName}> = (services: RequiredServices, channel: PikkuChannel<ChannelData, never>) => Promise<void>
|
|
27
|
+
export type ChannelMessage<In, Out = unknown, ChannelData = unknown, RequiredServices extends ${servicesTypeName} = ${servicesTypeName}> = (services: RequiredServices, channel: PikkuChannel<ChannelData, Out>, data: In) => Promise<Out | void>
|
|
26
28
|
type APIChannel<ChannelData, Channel extends string> = CoreAPIChannel<ChannelData, Channel, ChannelConnection, ChannelDisconnection, ChannelMessage<any, any, ChannelData>, ChannelMessage<any, any, ChannelData>, APIPermission>
|
|
27
29
|
|
|
28
30
|
type ScheduledTask = CoreScheduledTask<APIFunctionSessionless<void, void>, ${userSessionTypeName}>
|
|
@@ -6,41 +6,51 @@ import type { RoutesMap, RouteHandlerOf, RoutesWithMethod } from '${routesMapPat
|
|
|
6
6
|
export class PikkuFetch extends CorePikkuFetch {
|
|
7
7
|
public async post<Route extends RoutesWithMethod<'POST'>>(
|
|
8
8
|
route: Route,
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
...args: null extends RouteHandlerOf<Route, 'POST'>['input']
|
|
10
|
+
? [data?: Exclude<RouteHandlerOf<Route, 'POST'>['input'], null>, options?: Omit<RequestInit, 'body'>]
|
|
11
|
+
: [data: RouteHandlerOf<Route, 'POST'>['input'], options?: Omit<RequestInit, 'body'>]
|
|
11
12
|
): Promise<RouteHandlerOf<Route, 'POST'>['output']> {
|
|
13
|
+
const [data, options] = args;
|
|
12
14
|
return super.api(route, 'POST', data, options);
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
public async get<Route extends RoutesWithMethod<'GET'>>(
|
|
16
18
|
route: Route,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
...args: null extends RouteHandlerOf<Route, 'GET'>['input']
|
|
20
|
+
? [data?: Exclude<RouteHandlerOf<Route, 'GET'>['input'], null>, options?: Omit<RequestInit, 'body'>]
|
|
21
|
+
: [data: RouteHandlerOf<Route, 'GET'>['input'], options?: Omit<RequestInit, 'body'>]
|
|
19
22
|
): Promise<RouteHandlerOf<Route, 'GET'>['output']> {
|
|
23
|
+
const [data, options] = args;
|
|
20
24
|
return super.api(route, 'GET', data, options);
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
public async patch<Route extends RoutesWithMethod<'PATCH'>>(
|
|
24
28
|
route: Route,
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
...args: null extends RouteHandlerOf<Route, 'PATCH'>['input']
|
|
30
|
+
? [data?: Exclude<RouteHandlerOf<Route, 'PATCH'>['input'], null>, options?: Omit<RequestInit, 'body'>]
|
|
31
|
+
: [data: RouteHandlerOf<Route, 'PATCH'>['input'], options?: Omit<RequestInit, 'body'>]
|
|
27
32
|
): Promise<RouteHandlerOf<Route, 'PATCH'>['output']> {
|
|
33
|
+
const [data, options] = args;
|
|
28
34
|
return super.api(route, 'PATCH', data, options);
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
public async head<Route extends RoutesWithMethod<'HEAD'>>(
|
|
32
38
|
route: Route,
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
...args: null extends RouteHandlerOf<Route, 'HEAD'>['input']
|
|
40
|
+
? [data?: Exclude<RouteHandlerOf<Route, 'HEAD'>['input'], null>, options?: Omit<RequestInit, 'body'>]
|
|
41
|
+
: [data: RouteHandlerOf<Route, 'HEAD'>['input'], options?: Omit<RequestInit, 'body'>]
|
|
35
42
|
): Promise<RouteHandlerOf<Route, 'HEAD'>['output']> {
|
|
43
|
+
const [data, options] = args;
|
|
36
44
|
return super.api(route, 'HEAD', data, options);
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
public async delete<Route extends RoutesWithMethod<'DELETE'>>(
|
|
40
48
|
route: Route,
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
...args: null extends RouteHandlerOf<Route, 'DELETE'>['input']
|
|
50
|
+
? [data?: Exclude<RouteHandlerOf<Route, 'DELETE'>['input'], null>, options?: Omit<RequestInit, 'body'>]
|
|
51
|
+
: [data: RouteHandlerOf<Route, 'DELETE'>['input'], options?: Omit<RequestInit, 'body'>]
|
|
43
52
|
): Promise<RouteHandlerOf<Route, 'DELETE'>['output']> {
|
|
53
|
+
const [data, options] = args;
|
|
44
54
|
return super.api(route, 'DELETE', data, options);
|
|
45
55
|
}
|
|
46
56
|
|
|
@@ -48,10 +58,10 @@ export class PikkuFetch extends CorePikkuFetch {
|
|
|
48
58
|
Route extends keyof RoutesMap,
|
|
49
59
|
Method extends keyof RoutesMap[Route]
|
|
50
60
|
>(route: Route, method: Method, data: RouteHandlerOf<Route, Method>['input'], options?: Omit<RequestInit, 'body'>): Promise<Response> {
|
|
51
|
-
return await super.fetch(route, method as HTTPMethod, data, options)
|
|
61
|
+
return await super.fetch(route, method as HTTPMethod, data, options);
|
|
52
62
|
}
|
|
53
63
|
}
|
|
54
64
|
|
|
55
|
-
export const pikkuFetch = new PikkuFetch()
|
|
65
|
+
export const pikkuFetch = new PikkuFetch();
|
|
56
66
|
`;
|
|
57
67
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { InspectorState } from '@pikku/inspector';
|
|
2
|
-
export declare const inspectorGlob: (rootDir: string, routeDirectories: string[]) => Promise<InspectorState>;
|
|
1
|
+
import { InspectorFilters, InspectorState } from '@pikku/inspector';
|
|
2
|
+
export declare const inspectorGlob: (rootDir: string, routeDirectories: string[], filters: InspectorFilters) => Promise<InspectorState>;
|
|
@@ -2,11 +2,11 @@ import * as path from 'path';
|
|
|
2
2
|
import { glob } from 'glob';
|
|
3
3
|
import { inspect } from '@pikku/inspector';
|
|
4
4
|
import { logCommandInfoAndTime } from './utils.js';
|
|
5
|
-
export const inspectorGlob = async (rootDir, routeDirectories) => {
|
|
5
|
+
export const inspectorGlob = async (rootDir, routeDirectories, filters) => {
|
|
6
6
|
let result;
|
|
7
7
|
await logCommandInfoAndTime('Inspecting codebase', 'Inspected codebase', [false], async () => {
|
|
8
8
|
const routeFiles = (await Promise.all(routeDirectories.map((dir) => glob(`${path.join(rootDir, dir)}/**/*.ts`)))).flat();
|
|
9
|
-
result = await inspect(routeFiles);
|
|
9
|
+
result = await inspect(routeFiles, filters);
|
|
10
10
|
});
|
|
11
11
|
return result;
|
|
12
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const serializeNextJsWrapper: (routesPath: string, routesMapPath: string, schemasPath: string, configImport: string, singleServicesFactoryImport: string, sessionServicesImport: string) => string;
|
|
1
|
+
export declare const serializeNextJsWrapper: (routesPath: string, routesMapPath: string, schemasPath: string, configImport: string, singleServicesFactoryImport: string, sessionServicesImport: string, userSessionTypeImport: string) => string;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
export const serializeNextJsWrapper = (routesPath, routesMapPath, schemasPath, configImport, singleServicesFactoryImport, sessionServicesImport) => {
|
|
1
|
+
export const serializeNextJsWrapper = (routesPath, routesMapPath, schemasPath, configImport, singleServicesFactoryImport, sessionServicesImport, userSessionTypeImport) => {
|
|
2
2
|
return `'server-only'
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
/**
|
|
5
5
|
* This file provides a wrapper around the PikkuNextJS class to allow for methods to be type checked against your routes.
|
|
6
|
-
*
|
|
6
|
+
* It ensures type safety for route handling methods when integrating with the @pikku/core framework.
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { PikkuMiddleware } from '@pikku/core'
|
|
9
|
+
import { PikkuNextJS, PikkuNextRequest } from '@pikku/next'
|
|
9
10
|
import type { RoutesMap, RouteHandlerOf, RoutesWithMethod } from '${routesMapPath}'
|
|
10
11
|
|
|
11
12
|
${configImport}
|
|
12
13
|
${singleServicesFactoryImport}
|
|
13
14
|
${sessionServicesImport}
|
|
15
|
+
${userSessionTypeImport}
|
|
14
16
|
|
|
15
17
|
import '${routesPath}'
|
|
16
18
|
import '${schemasPath}'
|
|
@@ -20,7 +22,7 @@ let _pikku: PikkuNextJS | undefined
|
|
|
20
22
|
/**
|
|
21
23
|
* Initializes and returns an instance of PikkuNextJS with helper methods for handling route requests.
|
|
22
24
|
*
|
|
23
|
-
* @returns An object containing methods for making dynamic and static action requests.
|
|
25
|
+
* @returns An object containing methods for making dynamic and static action requests, as well as session retrieval.
|
|
24
26
|
*/
|
|
25
27
|
export const pikku = () => {
|
|
26
28
|
if (!_pikku) {
|
|
@@ -31,14 +33,28 @@ export const pikku = () => {
|
|
|
31
33
|
)
|
|
32
34
|
}
|
|
33
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves the user session using the current PikkuNextJS instance.
|
|
38
|
+
*
|
|
39
|
+
* @param request - The Next.js request object.
|
|
40
|
+
* @param middleware - An array of middleware functions to process the request.
|
|
41
|
+
* @returns A promise that resolves to the user session.
|
|
42
|
+
*/
|
|
43
|
+
const getSession = async (
|
|
44
|
+
request: PikkuNextRequest,
|
|
45
|
+
middleware: PikkuMiddleware[]
|
|
46
|
+
): Promise<UserSession | undefined> => {
|
|
47
|
+
return _pikku!.getSession(request, middleware) as any
|
|
48
|
+
}
|
|
49
|
+
|
|
34
50
|
/**
|
|
35
51
|
* Makes a dynamic action request for a specified route and method.
|
|
36
|
-
* Dynamic requests may access headers and cookies
|
|
52
|
+
* Dynamic requests may access headers and cookies and are therefore unsuitable for precompile stages.
|
|
37
53
|
*
|
|
38
54
|
* @template Route - The route key from the RoutesMap.
|
|
39
55
|
* @template Method - The method key from the specified route.
|
|
40
|
-
* @param route - The route
|
|
41
|
-
* @param method - The method to be used for the request.
|
|
56
|
+
* @param route - The route identifier.
|
|
57
|
+
* @param method - The HTTP method to be used for the request.
|
|
42
58
|
* @param data - The input data for the request, defaults to null.
|
|
43
59
|
* @returns A promise that resolves to the output of the route handler.
|
|
44
60
|
*/
|
|
@@ -59,8 +75,8 @@ export const pikku = () => {
|
|
|
59
75
|
*
|
|
60
76
|
* @template Route - The route key from the RoutesMap.
|
|
61
77
|
* @template Method - The method key from the specified route.
|
|
62
|
-
* @param route - The route
|
|
63
|
-
* @param method - The method to be used for the request.
|
|
78
|
+
* @param route - The route identifier.
|
|
79
|
+
* @param method - The HTTP method to be used for the request.
|
|
64
80
|
* @param data - The input data for the request, defaults to null.
|
|
65
81
|
* @returns A promise that resolves to the output of the route handler.
|
|
66
82
|
*/
|
|
@@ -77,6 +93,11 @@ export const pikku = () => {
|
|
|
77
93
|
|
|
78
94
|
/**
|
|
79
95
|
* Makes a dynamic POST request for a specified route.
|
|
96
|
+
*
|
|
97
|
+
* @template Route - The route key with the POST method.
|
|
98
|
+
* @param route - The route identifier.
|
|
99
|
+
* @param data - The input data for the POST request, defaults to null.
|
|
100
|
+
* @returns A promise that resolves to the output of the POST handler.
|
|
80
101
|
*/
|
|
81
102
|
const dynamicPost = <Route extends RoutesWithMethod<'POST'>>(
|
|
82
103
|
route: Route,
|
|
@@ -87,6 +108,11 @@ export const pikku = () => {
|
|
|
87
108
|
|
|
88
109
|
/**
|
|
89
110
|
* Makes a dynamic GET request for a specified route.
|
|
111
|
+
*
|
|
112
|
+
* @template Route - The route key with the GET method.
|
|
113
|
+
* @param route - The route identifier.
|
|
114
|
+
* @param data - The input data for the GET request, defaults to null.
|
|
115
|
+
* @returns A promise that resolves to the output of the GET handler.
|
|
90
116
|
*/
|
|
91
117
|
const dynamicGet = <Route extends RoutesWithMethod<'GET'>>(
|
|
92
118
|
route: Route,
|
|
@@ -97,6 +123,11 @@ export const pikku = () => {
|
|
|
97
123
|
|
|
98
124
|
/**
|
|
99
125
|
* Makes a dynamic PATCH request for a specified route.
|
|
126
|
+
*
|
|
127
|
+
* @template Route - The route key with the PATCH method.
|
|
128
|
+
* @param route - The route identifier.
|
|
129
|
+
* @param data - The input data for the PATCH request, defaults to null.
|
|
130
|
+
* @returns A promise that resolves to the output of the PATCH handler.
|
|
100
131
|
*/
|
|
101
132
|
const dynamicPatch = <Route extends RoutesWithMethod<'PATCH'>>(
|
|
102
133
|
route: Route,
|
|
@@ -107,6 +138,11 @@ export const pikku = () => {
|
|
|
107
138
|
|
|
108
139
|
/**
|
|
109
140
|
* Makes a dynamic DELETE request for a specified route.
|
|
141
|
+
*
|
|
142
|
+
* @template Route - The route key with the DELETE method.
|
|
143
|
+
* @param route - The route identifier.
|
|
144
|
+
* @param data - The input data for the DELETE request, defaults to null.
|
|
145
|
+
* @returns A promise that resolves to the output of the DELETE handler.
|
|
110
146
|
*/
|
|
111
147
|
const dynamicDel = <Route extends RoutesWithMethod<'DELETE'>>(
|
|
112
148
|
route: Route,
|
|
@@ -115,10 +151,15 @@ export const pikku = () => {
|
|
|
115
151
|
return dynamicActionRequest(route, 'DELETE', data)
|
|
116
152
|
}
|
|
117
153
|
|
|
118
|
-
// Static
|
|
154
|
+
// Static Requests
|
|
119
155
|
|
|
120
156
|
/**
|
|
121
157
|
* Makes a static POST request for a specified route.
|
|
158
|
+
*
|
|
159
|
+
* @template Route - The route key with the POST method.
|
|
160
|
+
* @param route - The route identifier.
|
|
161
|
+
* @param data - The input data for the POST request, defaults to null.
|
|
162
|
+
* @returns A promise that resolves to the output of the POST handler.
|
|
122
163
|
*/
|
|
123
164
|
const staticPost = <Route extends RoutesWithMethod<'POST'>>(
|
|
124
165
|
route: Route,
|
|
@@ -129,6 +170,11 @@ export const pikku = () => {
|
|
|
129
170
|
|
|
130
171
|
/**
|
|
131
172
|
* Makes a static GET request for a specified route.
|
|
173
|
+
*
|
|
174
|
+
* @template Route - The route key with the GET method.
|
|
175
|
+
* @param route - The route identifier.
|
|
176
|
+
* @param data - The input data for the GET request, defaults to null.
|
|
177
|
+
* @returns A promise that resolves to the output of the GET handler.
|
|
132
178
|
*/
|
|
133
179
|
const staticGet = <Route extends RoutesWithMethod<'GET'>>(
|
|
134
180
|
route: Route,
|
|
@@ -138,6 +184,7 @@ export const pikku = () => {
|
|
|
138
184
|
}
|
|
139
185
|
|
|
140
186
|
return {
|
|
187
|
+
getSession,
|
|
141
188
|
get: dynamicGet,
|
|
142
189
|
post: dynamicPost,
|
|
143
190
|
patch: dynamicPatch,
|
|
@@ -145,5 +192,6 @@ export const pikku = () => {
|
|
|
145
192
|
staticGet,
|
|
146
193
|
staticPost
|
|
147
194
|
}
|
|
148
|
-
}
|
|
195
|
+
}
|
|
196
|
+
`;
|
|
149
197
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OpenAPISpecInfo } from './openapi/openapi-spec-generator.js';
|
|
2
|
+
import { InspectorFilters } from '@pikku/inspector';
|
|
2
3
|
export interface PikkuCLICoreOutputFiles {
|
|
3
4
|
outDir?: string;
|
|
4
5
|
routesFile: string;
|
|
@@ -26,6 +27,7 @@ export type PikkuCLIConfig = {
|
|
|
26
27
|
outputFile: string;
|
|
27
28
|
additionalInfo: OpenAPISpecInfo;
|
|
28
29
|
};
|
|
30
|
+
filters: InspectorFilters;
|
|
29
31
|
} & PikkuCLICoreOutputFiles;
|
|
30
|
-
export declare const getPikkuCLIConfig: (configFile: string | undefined, requiredFields: Array<keyof PikkuCLIConfig>, exitProcess?: boolean) => Promise<PikkuCLIConfig>;
|
|
32
|
+
export declare const getPikkuCLIConfig: (configFile: string | undefined, requiredFields: Array<keyof PikkuCLIConfig>, tags?: string[], exitProcess?: boolean) => Promise<PikkuCLIConfig>;
|
|
31
33
|
export declare const validateCLIConfig: (cliConfig: PikkuCLIConfig, required: Array<keyof PikkuCLIConfig>) => void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { join, dirname, resolve, isAbsolute } from 'path';
|
|
2
2
|
import { readdir, readFile } from 'fs/promises';
|
|
3
3
|
const CONFIG_DIR_FILES = ['nextJSfile', 'fetchFile', 'websocketFile'];
|
|
4
|
-
export const getPikkuCLIConfig = async (configFile = undefined, requiredFields, exitProcess = false) => {
|
|
5
|
-
const config = await _getPikkuCLIConfig(configFile, requiredFields, exitProcess);
|
|
4
|
+
export const getPikkuCLIConfig = async (configFile = undefined, requiredFields, tags = [], exitProcess = false) => {
|
|
5
|
+
const config = await _getPikkuCLIConfig(configFile, requiredFields, tags, exitProcess);
|
|
6
6
|
return config;
|
|
7
7
|
};
|
|
8
|
-
const _getPikkuCLIConfig = async (configFile = undefined, requiredFields, exitProcess = false) => {
|
|
8
|
+
const _getPikkuCLIConfig = async (configFile = undefined, requiredFields, tags = [], exitProcess = false) => {
|
|
9
9
|
if (!configFile) {
|
|
10
10
|
let execDirectory = process.cwd();
|
|
11
11
|
const files = await readdir(execDirectory);
|
|
@@ -26,7 +26,7 @@ const _getPikkuCLIConfig = async (configFile = undefined, requiredFields, exitPr
|
|
|
26
26
|
const configDir = dirname(configFile);
|
|
27
27
|
const config = JSON.parse(file);
|
|
28
28
|
if (config.extends) {
|
|
29
|
-
const extendedConfig = await getPikkuCLIConfig(resolve(configDir, config.extends), [], exitProcess);
|
|
29
|
+
const extendedConfig = await getPikkuCLIConfig(resolve(configDir, config.extends), [], tags, exitProcess);
|
|
30
30
|
result = {
|
|
31
31
|
...extendedConfig,
|
|
32
32
|
...config,
|
|
@@ -88,6 +88,10 @@ const _getPikkuCLIConfig = async (configFile = undefined, requiredFields, exitPr
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
+
result.filters = result.filters || {};
|
|
92
|
+
if (tags.length > 0) {
|
|
93
|
+
result.filters.tags = tags;
|
|
94
|
+
}
|
|
91
95
|
if (!isAbsolute(result.tsconfig)) {
|
|
92
96
|
result.tsconfig = join(result.rootDir, result.tsconfig);
|
|
93
97
|
}
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ interface Meta {
|
|
|
12
12
|
export type FilesAndMethods = {
|
|
13
13
|
userSessionType: Meta;
|
|
14
14
|
sessionServicesType: Meta;
|
|
15
|
+
singletonServicesType: Meta;
|
|
15
16
|
pikkuConfigFactory: Meta;
|
|
16
17
|
singletonServicesFactory: Meta;
|
|
17
18
|
sessionServicesFactory: Meta;
|
|
@@ -22,10 +23,12 @@ export interface PikkuCLIOptions {
|
|
|
22
23
|
userSessionType?: string;
|
|
23
24
|
singletonServicesFactoryType?: string;
|
|
24
25
|
sessionServicesFactoryType?: string;
|
|
26
|
+
tags?: string[];
|
|
25
27
|
}
|
|
26
|
-
export declare const getPikkuFilesAndMethods: ({ sessionServicesTypeImportMap
|
|
28
|
+
export declare const getPikkuFilesAndMethods: ({ singletonServicesTypeImportMap, sessionServicesTypeImportMap, userSessionTypeImportMap, sessionServicesFactories, singletonServicesFactories, configFactories, }: InspectorState, packageMappings: Record<string, string>, outputFile: string, { configFileType, singletonServicesFactoryType, sessionServicesFactoryType, }: PikkuCLIOptions, requires?: Partial<{
|
|
27
29
|
config: boolean;
|
|
28
30
|
sessionServiceType: boolean;
|
|
31
|
+
singletonServicesType: boolean;
|
|
29
32
|
userSessionType: boolean;
|
|
30
33
|
singletonServicesFactory: boolean;
|
|
31
34
|
sessionServicesFactory: boolean;
|
package/dist/src/utils.js
CHANGED
|
@@ -60,8 +60,9 @@ const getMetaTypes = (type, errors, map, desiredType) => {
|
|
|
60
60
|
}
|
|
61
61
|
return undefined;
|
|
62
62
|
};
|
|
63
|
-
export const getPikkuFilesAndMethods = async ({ sessionServicesTypeImportMap
|
|
63
|
+
export const getPikkuFilesAndMethods = async ({ singletonServicesTypeImportMap, sessionServicesTypeImportMap, userSessionTypeImportMap, sessionServicesFactories, singletonServicesFactories, configFactories, }, packageMappings, outputFile, { configFileType, singletonServicesFactoryType, sessionServicesFactoryType, }, requires = {
|
|
64
64
|
config: false,
|
|
65
|
+
singletonServicesType: false,
|
|
65
66
|
sessionServiceType: false,
|
|
66
67
|
userSessionType: false,
|
|
67
68
|
singletonServicesFactory: false,
|
|
@@ -70,7 +71,8 @@ export const getPikkuFilesAndMethods = async ({ sessionServicesTypeImportMap: ht
|
|
|
70
71
|
let errors = new Map();
|
|
71
72
|
const result = {
|
|
72
73
|
userSessionType: getMetaTypes('CoreUserSession', requires.userSessionType ? errors : new Map(), userSessionTypeImportMap, configFileType),
|
|
73
|
-
|
|
74
|
+
singletonServicesType: getMetaTypes('CoreSingletonServices', requires.singletonServicesType ? errors : new Map(), singletonServicesTypeImportMap),
|
|
75
|
+
sessionServicesType: getMetaTypes('CoreServices', requires.sessionServiceType ? errors : new Map(), sessionServicesTypeImportMap),
|
|
74
76
|
pikkuConfigFactory: getMetaTypes('CoreConfig', requires.config ? errors : new Map(), configFactories, configFileType),
|
|
75
77
|
singletonServicesFactory: getMetaTypes('CreateSingletonServices', requires.singletonServicesFactory ? errors : new Map(), singletonServicesFactories, singletonServicesFactoryType),
|
|
76
78
|
sessionServicesFactory: getMetaTypes('CreateSessionServices', requires.sessionServicesFactory ? errors : new Map(), sessionServicesFactories, sessionServicesFactoryType),
|
|
@@ -102,7 +104,7 @@ export const writeFileInDir = async (path, content, ignoreModifyComment = false)
|
|
|
102
104
|
};
|
|
103
105
|
export const logCommandInfoAndTime = async (commandStart, commandEnd, [skipCondition, skipMessage = 'none found'], callback) => {
|
|
104
106
|
if (skipCondition === true) {
|
|
105
|
-
logInfo(`• Skipping ${commandStart} since ${skipMessage}.`);
|
|
107
|
+
logInfo(`• Skipping ${commandStart.charAt(0).toLocaleLowerCase()}${commandStart.slice(1)} since ${skipMessage}.`);
|
|
106
108
|
return false;
|
|
107
109
|
}
|
|
108
110
|
const start = Date.now();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../bin/pikku-all.ts","../bin/pikku-channels-map.ts","../bin/pikku-channels.ts","../bin/pikku-fetch.ts","../bin/pikku-function-types.ts","../bin/pikku-
|
|
1
|
+
{"root":["../bin/pikku-all.ts","../bin/pikku-channels-map.ts","../bin/pikku-channels.ts","../bin/pikku-fetch.ts","../bin/pikku-function-types.ts","../bin/pikku-http.ts","../bin/pikku-nextjs.ts","../bin/pikku-openapi.ts","../bin/pikku-routes-map.ts","../bin/pikku-scheduler.ts","../bin/pikku-schemas.ts","../bin/pikku-websocket.ts","../bin/pikku.ts","../src/inspector-glob.ts","../src/pikku-cli-config.ts","../src/utils.ts","../src/channels/serialize-channels.ts","../src/channels/serialize-typed-channel-map.ts","../src/channels/serialize-websocket-wrapper.ts","../src/core/serialize-import-map.ts","../src/core/serialize-pikku-types.ts","../src/http/serialize-fetch-wrapper.ts","../src/http/serialize-route-imports.ts","../src/http/serialize-route-meta.ts","../src/http/serialize-typed-route-map.ts","../src/nextjs/serialize-nextjs-wrapper.ts","../src/openapi/openapi-spec-generator.ts","../src/scheduler/serialize-schedulers.ts","../src/schema/schema-generator.ts"],"version":"5.7.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikku/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.13",
|
|
4
4
|
"author": "yasser.fadl@gmail.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@openapi-contrib/json-schema-to-openapi-schema": "^3.0.2",
|
|
25
|
-
"@pikku/core": "^0.6.
|
|
26
|
-
"@pikku/inspector": "^0.6.
|
|
25
|
+
"@pikku/core": "^0.6.14",
|
|
26
|
+
"@pikku/inspector": "^0.6.3",
|
|
27
27
|
"@types/cookie": "^0.6.0",
|
|
28
28
|
"@types/uuid": "^10.0.0",
|
|
29
29
|
"chalk": "^5.4.1",
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
export const serializePikkuTypes = (
|
|
5
5
|
userSessionTypeImport: string,
|
|
6
6
|
userSessionTypeName: string,
|
|
7
|
+
singletonServicesTypeImport: string,
|
|
8
|
+
singletonServicesTypeName: string,
|
|
7
9
|
sessionServicesTypeImport: string,
|
|
8
10
|
servicesTypeName: string
|
|
9
11
|
) => {
|
|
@@ -11,23 +13,25 @@ export const serializePikkuTypes = (
|
|
|
11
13
|
* This is used to provide the application types in the typescript project
|
|
12
14
|
*/
|
|
13
15
|
|
|
14
|
-
import { CoreAPIFunction, CoreAPIFunctionSessionless, CoreAPIPermission } from '@pikku/core'
|
|
16
|
+
import { CoreAPIFunction, CoreAPIFunctionSessionless, CoreAPIPermission, PikkuMiddleware } from '@pikku/core'
|
|
15
17
|
import { CoreHTTPFunctionRoute, AssertRouteParams, addRoute as addCoreHTTP } from '@pikku/core/http'
|
|
16
18
|
import { CoreScheduledTask, addScheduledTask as addCoreScheduledTask } from '@pikku/core/scheduler'
|
|
17
19
|
import { CoreAPIChannel, PikkuChannel, addChannel as addCoreChannel } from '@pikku/core/channel'
|
|
18
20
|
|
|
19
21
|
${userSessionTypeImport}
|
|
22
|
+
${singletonServicesTypeImport}
|
|
20
23
|
${sessionServicesTypeImport}
|
|
21
24
|
|
|
22
|
-
export type APIPermission<In = unknown, RequiredServices = ${
|
|
25
|
+
export type APIPermission<In = unknown, RequiredServices extends ${singletonServicesTypeName} = ${singletonServicesTypeName}> = CoreAPIPermission<In, RequiredServices, ${userSessionTypeName}>
|
|
26
|
+
export type APIMiddleware<RequiredServices extends ${singletonServicesTypeName} = ${singletonServicesTypeName}> = PikkuMiddleware<RequiredServices, ${userSessionTypeName}>
|
|
23
27
|
|
|
24
|
-
export type APIFunctionSessionless<In = unknown, Out = never, RequiredServices = ${servicesTypeName}> = CoreAPIFunctionSessionless<In, Out, RequiredServices, ${userSessionTypeName}>
|
|
25
|
-
export type APIFunction<In = unknown, Out = never, RequiredServices = ${servicesTypeName}> = CoreAPIFunction<In, Out, RequiredServices, ${userSessionTypeName}>
|
|
26
|
-
type APIRoute<In, Out, Route extends string> = CoreHTTPFunctionRoute<In, Out, Route, APIFunction<In, Out>, APIFunctionSessionless<In, Out>, APIPermission<In
|
|
28
|
+
export type APIFunctionSessionless<In = unknown, Out = never, RequiredServices extends ${servicesTypeName} = ${servicesTypeName}> = CoreAPIFunctionSessionless<In, Out, RequiredServices, ${userSessionTypeName}>
|
|
29
|
+
export type APIFunction<In = unknown, Out = never, RequiredServices extends ${servicesTypeName} = ${servicesTypeName}> = CoreAPIFunction<In, Out, RequiredServices, ${userSessionTypeName}>
|
|
30
|
+
type APIRoute<In, Out, Route extends string> = CoreHTTPFunctionRoute<In, Out, Route, APIFunction<In, Out>, APIFunctionSessionless<In, Out>, APIPermission<In>, APIMiddleware>
|
|
27
31
|
|
|
28
|
-
export type ChannelConnection<Out = unknown, ChannelData = unknown, RequiredServices extends ${servicesTypeName} = ${servicesTypeName}> = (services: RequiredServices, channel: PikkuChannel
|
|
29
|
-
export type ChannelDisconnection<ChannelData = unknown, RequiredServices extends ${servicesTypeName} = ${servicesTypeName}> = (services: RequiredServices, channel: PikkuChannel
|
|
30
|
-
export type ChannelMessage<In, Out = unknown, ChannelData = unknown, RequiredServices extends ${servicesTypeName} = ${servicesTypeName}> = (services: RequiredServices, channel: PikkuChannel
|
|
32
|
+
export type ChannelConnection<Out = unknown, ChannelData = unknown, RequiredServices extends ${servicesTypeName} = ${servicesTypeName}> = (services: RequiredServices, channel: PikkuChannel<ChannelData, Out>) => Promise<void>
|
|
33
|
+
export type ChannelDisconnection<ChannelData = unknown, RequiredServices extends ${servicesTypeName} = ${servicesTypeName}> = (services: RequiredServices, channel: PikkuChannel<ChannelData, never>) => Promise<void>
|
|
34
|
+
export type ChannelMessage<In, Out = unknown, ChannelData = unknown, RequiredServices extends ${servicesTypeName} = ${servicesTypeName}> = (services: RequiredServices, channel: PikkuChannel<ChannelData, Out>, data: In) => Promise<Out | void>
|
|
31
35
|
type APIChannel<ChannelData, Channel extends string> = CoreAPIChannel<ChannelData, Channel, ChannelConnection, ChannelDisconnection, ChannelMessage<any, any, ChannelData>, ChannelMessage<any, any, ChannelData>, APIPermission>
|
|
32
36
|
|
|
33
37
|
type ScheduledTask = CoreScheduledTask<APIFunctionSessionless<void, void>, ${userSessionTypeName}>
|
|
@@ -6,41 +6,51 @@ import type { RoutesMap, RouteHandlerOf, RoutesWithMethod } from '${routesMapPat
|
|
|
6
6
|
export class PikkuFetch extends CorePikkuFetch {
|
|
7
7
|
public async post<Route extends RoutesWithMethod<'POST'>>(
|
|
8
8
|
route: Route,
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
...args: null extends RouteHandlerOf<Route, 'POST'>['input']
|
|
10
|
+
? [data?: Exclude<RouteHandlerOf<Route, 'POST'>['input'], null>, options?: Omit<RequestInit, 'body'>]
|
|
11
|
+
: [data: RouteHandlerOf<Route, 'POST'>['input'], options?: Omit<RequestInit, 'body'>]
|
|
11
12
|
): Promise<RouteHandlerOf<Route, 'POST'>['output']> {
|
|
13
|
+
const [data, options] = args;
|
|
12
14
|
return super.api(route, 'POST', data, options);
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
public async get<Route extends RoutesWithMethod<'GET'>>(
|
|
16
18
|
route: Route,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
...args: null extends RouteHandlerOf<Route, 'GET'>['input']
|
|
20
|
+
? [data?: Exclude<RouteHandlerOf<Route, 'GET'>['input'], null>, options?: Omit<RequestInit, 'body'>]
|
|
21
|
+
: [data: RouteHandlerOf<Route, 'GET'>['input'], options?: Omit<RequestInit, 'body'>]
|
|
19
22
|
): Promise<RouteHandlerOf<Route, 'GET'>['output']> {
|
|
23
|
+
const [data, options] = args;
|
|
20
24
|
return super.api(route, 'GET', data, options);
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
public async patch<Route extends RoutesWithMethod<'PATCH'>>(
|
|
24
28
|
route: Route,
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
...args: null extends RouteHandlerOf<Route, 'PATCH'>['input']
|
|
30
|
+
? [data?: Exclude<RouteHandlerOf<Route, 'PATCH'>['input'], null>, options?: Omit<RequestInit, 'body'>]
|
|
31
|
+
: [data: RouteHandlerOf<Route, 'PATCH'>['input'], options?: Omit<RequestInit, 'body'>]
|
|
27
32
|
): Promise<RouteHandlerOf<Route, 'PATCH'>['output']> {
|
|
33
|
+
const [data, options] = args;
|
|
28
34
|
return super.api(route, 'PATCH', data, options);
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
public async head<Route extends RoutesWithMethod<'HEAD'>>(
|
|
32
38
|
route: Route,
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
...args: null extends RouteHandlerOf<Route, 'HEAD'>['input']
|
|
40
|
+
? [data?: Exclude<RouteHandlerOf<Route, 'HEAD'>['input'], null>, options?: Omit<RequestInit, 'body'>]
|
|
41
|
+
: [data: RouteHandlerOf<Route, 'HEAD'>['input'], options?: Omit<RequestInit, 'body'>]
|
|
35
42
|
): Promise<RouteHandlerOf<Route, 'HEAD'>['output']> {
|
|
43
|
+
const [data, options] = args;
|
|
36
44
|
return super.api(route, 'HEAD', data, options);
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
public async delete<Route extends RoutesWithMethod<'DELETE'>>(
|
|
40
48
|
route: Route,
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
...args: null extends RouteHandlerOf<Route, 'DELETE'>['input']
|
|
50
|
+
? [data?: Exclude<RouteHandlerOf<Route, 'DELETE'>['input'], null>, options?: Omit<RequestInit, 'body'>]
|
|
51
|
+
: [data: RouteHandlerOf<Route, 'DELETE'>['input'], options?: Omit<RequestInit, 'body'>]
|
|
43
52
|
): Promise<RouteHandlerOf<Route, 'DELETE'>['output']> {
|
|
53
|
+
const [data, options] = args;
|
|
44
54
|
return super.api(route, 'DELETE', data, options);
|
|
45
55
|
}
|
|
46
56
|
|
|
@@ -48,10 +58,10 @@ export class PikkuFetch extends CorePikkuFetch {
|
|
|
48
58
|
Route extends keyof RoutesMap,
|
|
49
59
|
Method extends keyof RoutesMap[Route]
|
|
50
60
|
>(route: Route, method: Method, data: RouteHandlerOf<Route, Method>['input'], options?: Omit<RequestInit, 'body'>): Promise<Response> {
|
|
51
|
-
return await super.fetch(route, method as HTTPMethod, data, options)
|
|
61
|
+
return await super.fetch(route, method as HTTPMethod, data, options);
|
|
52
62
|
}
|
|
53
63
|
}
|
|
54
64
|
|
|
55
|
-
export const pikkuFetch = new PikkuFetch()
|
|
65
|
+
export const pikkuFetch = new PikkuFetch();
|
|
56
66
|
`
|
|
57
67
|
}
|
package/src/inspector-glob.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as path from 'path'
|
|
2
2
|
import { glob } from 'glob'
|
|
3
|
-
import { InspectorState, inspect } from '@pikku/inspector'
|
|
3
|
+
import { InspectorFilters, InspectorState, inspect } from '@pikku/inspector'
|
|
4
4
|
import { logCommandInfoAndTime } from './utils.js'
|
|
5
5
|
|
|
6
6
|
export const inspectorGlob = async (
|
|
7
7
|
rootDir: string,
|
|
8
|
-
routeDirectories: string[]
|
|
8
|
+
routeDirectories: string[],
|
|
9
|
+
filters: InspectorFilters
|
|
9
10
|
) => {
|
|
10
11
|
let result: InspectorState
|
|
11
12
|
await logCommandInfoAndTime(
|
|
@@ -20,7 +21,7 @@ export const inspectorGlob = async (
|
|
|
20
21
|
)
|
|
21
22
|
)
|
|
22
23
|
).flat()
|
|
23
|
-
result = await inspect(routeFiles)
|
|
24
|
+
result = await inspect(routeFiles, filters)
|
|
24
25
|
}
|
|
25
26
|
)
|
|
26
27
|
return result!
|