@pikku/cli 0.7.7 → 0.8.1
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 +43 -0
- package/bin/pikku-all.ts +188 -91
- package/bin/pikku-fetch.ts +10 -38
- package/bin/pikku-nextjs.ts +12 -113
- package/bin/pikku-openapi.ts +9 -54
- package/bin/pikku-queue-service.ts +28 -0
- package/bin/pikku-schemas.ts +6 -32
- package/bin/pikku-websocket.ts +11 -41
- package/bin/pikku.ts +2 -0
- package/cli.schema.json +113 -10
- package/dist/bin/pikku-all.d.ts +1 -1
- package/dist/bin/pikku-all.js +105 -84
- package/dist/bin/pikku-fetch.d.ts +1 -3
- package/dist/bin/pikku-fetch.js +9 -15
- package/dist/bin/pikku-nextjs.d.ts +1 -4
- package/dist/bin/pikku-nextjs.js +10 -40
- package/dist/bin/pikku-openapi.d.ts +0 -3
- package/dist/bin/pikku-openapi.js +8 -24
- package/dist/bin/pikku-queue-service.d.ts +4 -0
- package/dist/bin/pikku-queue-service.js +19 -0
- package/dist/bin/pikku-schemas.d.ts +0 -3
- package/dist/bin/pikku-schemas.js +5 -11
- package/dist/bin/pikku-websocket.d.ts +1 -3
- package/dist/bin/pikku-websocket.js +9 -18
- package/dist/bin/pikku.js +2 -0
- package/dist/src/events/channels/pikku-channels.d.ts +2 -0
- package/dist/src/events/channels/pikku-channels.js +9 -0
- package/dist/src/events/channels/pikku-command-channels-map.d.ts +2 -0
- package/dist/src/events/channels/pikku-command-channels-map.js +8 -0
- package/dist/src/events/channels/pikku-command-channels.d.ts +2 -0
- package/dist/src/events/channels/pikku-command-channels.js +9 -0
- package/dist/src/events/channels/pikku-command-websocket-typed.d.ts +2 -0
- package/dist/src/events/channels/pikku-command-websocket-typed.js +15 -0
- package/dist/src/{serialize-typed-channel-map.js → events/channels/serialize-typed-channel-map.js} +2 -2
- package/dist/src/events/fetch/index.d.ts +2 -0
- package/dist/src/events/fetch/index.js +12 -0
- package/dist/src/events/functions/pikku-command-function-types.d.ts +2 -0
- package/dist/src/events/functions/pikku-command-function-types.js +13 -0
- package/dist/src/events/functions/pikku-command-functions.d.ts +6 -0
- package/dist/src/events/functions/pikku-command-functions.js +35 -0
- package/dist/src/events/functions/pikku-command-services.d.ts +3 -0
- package/dist/src/events/functions/pikku-command-services.js +73 -0
- package/dist/src/events/functions/pikku-function-types.d.ts +2 -0
- package/dist/{bin → src/events/functions}/pikku-function-types.js +6 -6
- package/dist/src/events/functions/pikku-functions.d.ts +6 -0
- package/dist/{bin → src/events/functions}/pikku-functions.js +5 -5
- package/dist/src/events/http/pikku-command-http-map.d.ts +2 -0
- package/dist/src/events/http/pikku-command-http-map.js +8 -0
- package/dist/src/events/http/pikku-command-http-routes.d.ts +2 -0
- package/dist/src/events/http/pikku-command-http-routes.js +9 -0
- package/dist/src/events/http/pikku-command-openapi.d.ts +2 -0
- package/dist/src/events/http/pikku-command-openapi.js +20 -0
- package/dist/src/events/http/pikku-http-routes.d.ts +2 -0
- package/dist/src/events/http/pikku-http-routes.js +9 -0
- package/dist/src/{serialize-typed-http-map.d.ts → events/http/serialize-typed-http-map.d.ts} +0 -1
- package/dist/src/{serialize-typed-http-map.js → events/http/serialize-typed-http-map.js} +2 -15
- package/dist/src/events/mcp/pikku-command-mcp-json.d.ts +2 -0
- package/dist/src/events/mcp/pikku-command-mcp-json.js +13 -0
- package/dist/src/events/mcp/pikku-command-mcp.d.ts +2 -0
- package/dist/src/events/mcp/pikku-command-mcp.js +54 -0
- package/dist/src/events/mcp/serialize-mcp-json.d.ts +5 -0
- package/dist/src/events/mcp/serialize-mcp-json.js +101 -0
- package/dist/src/events/queue/pikku-command-queue-map.d.ts +2 -0
- package/dist/src/events/queue/pikku-command-queue-map.js +8 -0
- package/dist/src/events/queue/pikku-command-queue-service.d.ts +2 -0
- package/dist/src/events/queue/pikku-command-queue-service.js +12 -0
- package/dist/src/events/queue/pikku-command-queue.d.ts +2 -0
- package/dist/src/events/queue/pikku-command-queue.js +10 -0
- package/dist/src/events/queue/pikku-queue-map.d.ts +2 -0
- package/dist/src/events/queue/pikku-queue-map.js +8 -0
- package/dist/src/events/queue/pikku-queue.d.ts +2 -0
- package/dist/src/events/queue/pikku-queue.js +10 -0
- package/dist/src/events/queue/serialize-queue-map.d.ts +4 -0
- package/dist/src/events/queue/serialize-queue-map.js +77 -0
- package/dist/src/events/queue/serialize-queue-meta.d.ts +2 -0
- package/dist/src/events/queue/serialize-queue-meta.js +6 -0
- package/dist/src/events/queue/serialize-queue-wrapper.d.ts +1 -0
- package/dist/src/events/queue/serialize-queue-wrapper.js +35 -0
- package/dist/src/events/rpc/pikku-command-rpc-client.d.ts +2 -0
- package/dist/src/events/rpc/pikku-command-rpc-client.js +12 -0
- package/dist/src/events/rpc/pikku-command-rpc-map.d.ts +2 -0
- package/dist/src/events/rpc/pikku-command-rpc-map.js +8 -0
- package/dist/src/events/rpc/pikku-command-rpc.d.ts +2 -0
- package/dist/src/events/rpc/pikku-command-rpc.js +6 -0
- package/dist/src/events/rpc/pikku-rpc.d.ts +2 -0
- package/dist/src/events/rpc/pikku-rpc.js +6 -0
- package/dist/src/events/rpc/serialize-rpc-wrapper.d.ts +1 -0
- package/dist/src/events/rpc/serialize-rpc-wrapper.js +29 -0
- package/dist/src/{serialize-typed-rpc-map.d.ts → events/rpc/serialize-typed-rpc-map.d.ts} +1 -1
- package/dist/src/{serialize-typed-rpc-map.js → events/rpc/serialize-typed-rpc-map.js} +3 -3
- package/dist/src/events/scheduler/pikku-command-scheduler.d.ts +2 -0
- package/dist/src/events/scheduler/pikku-command-scheduler.js +10 -0
- package/dist/src/inspector-glob.d.ts +1 -1
- package/dist/src/inspector-glob.js +4 -4
- package/dist/src/pikku-cli-config.d.ts +12 -2
- package/dist/src/pikku-cli-config.js +79 -30
- package/dist/src/pikku-command-schemas.d.ts +2 -0
- package/dist/src/pikku-command-schemas.js +8 -0
- package/dist/src/runtimes/nextjs/pikku-command-nextjs.d.ts +2 -0
- package/dist/src/runtimes/nextjs/pikku-command-nextjs.js +36 -0
- package/dist/src/schema-generator.d.ts +3 -2
- package/dist/src/schema-generator.js +9 -9
- package/dist/src/schemas.d.ts +2 -0
- package/dist/src/schemas.js +8 -0
- package/dist/src/{utils/serialize-import-map.js → serialize-import-map.js} +3 -0
- package/dist/src/serialize-pikku-types.js +378 -1
- package/dist/src/types.d.ts +5 -0
- package/dist/src/types.js +1 -0
- package/dist/src/{utils/utils.d.ts → utils.d.ts} +20 -7
- package/dist/src/{utils/utils.js → utils.js} +56 -32
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/{bin → src/events/channels}/pikku-channels.ts +8 -3
- package/src/events/channels/pikku-command-channels-map.ts +26 -0
- package/src/events/channels/pikku-command-channels.ts +38 -0
- package/src/events/channels/pikku-command-websocket-typed.ts +36 -0
- package/src/{serialize-typed-channel-map.ts → events/channels/serialize-typed-channel-map.ts} +2 -2
- package/src/events/fetch/index.ts +33 -0
- package/src/events/functions/pikku-command-function-types.ts +48 -0
- package/src/events/functions/pikku-command-functions.ts +84 -0
- package/src/events/functions/pikku-command-services.ts +125 -0
- package/{bin → src/events/functions}/pikku-function-types.ts +12 -15
- package/{bin → src/events/functions}/pikku-functions.ts +9 -6
- package/src/events/http/pikku-command-http-map.ts +27 -0
- package/src/events/http/pikku-command-http-routes.ts +40 -0
- package/src/events/http/pikku-command-openapi.ts +54 -0
- package/{bin → src/events/http}/pikku-http-routes.ts +8 -3
- package/src/{serialize-typed-http-map.ts → events/http/serialize-typed-http-map.ts} +2 -19
- package/src/events/mcp/pikku-command-mcp-json.ts +33 -0
- package/src/events/mcp/pikku-command-mcp.ts +110 -0
- package/src/events/mcp/serialize-mcp-json.ts +159 -0
- package/src/events/queue/pikku-command-queue-map.ts +26 -0
- package/src/events/queue/pikku-command-queue-service.ts +33 -0
- package/src/events/queue/pikku-command-queue.ts +42 -0
- package/src/events/queue/pikku-queue-map.ts +26 -0
- package/src/events/queue/pikku-queue.ts +40 -0
- package/src/events/queue/serialize-queue-map.ts +119 -0
- package/src/events/queue/serialize-queue-meta.ts +10 -0
- package/src/events/queue/serialize-queue-wrapper.ts +35 -0
- package/src/events/rpc/pikku-command-rpc-client.ts +33 -0
- package/src/events/rpc/pikku-command-rpc-map.ts +26 -0
- package/src/events/rpc/pikku-command-rpc.ts +22 -0
- package/{bin → src/events/rpc}/pikku-rpc.ts +8 -6
- package/src/events/rpc/serialize-rpc-wrapper.ts +29 -0
- package/src/{serialize-typed-rpc-map.ts → events/rpc/serialize-typed-rpc-map.ts} +5 -4
- package/{bin/pikku-scheduler.ts → src/events/scheduler/pikku-command-scheduler.ts} +11 -8
- package/src/inspector-glob.ts +4 -2
- package/src/pikku-cli-config.ts +119 -42
- package/src/pikku-command-schemas.ts +33 -0
- package/src/runtimes/nextjs/pikku-command-nextjs.ts +110 -0
- package/src/schema-generator.ts +10 -5
- package/src/schemas.ts +33 -0
- package/src/{utils/serialize-import-map.ts → serialize-import-map.ts} +5 -0
- package/src/serialize-pikku-types.ts +378 -1
- package/src/types.ts +16 -0
- package/src/{utils/utils.ts → utils.ts} +68 -34
- package/tsconfig.json +1 -1
- package/bin/pikku-channels-map.ts +0 -25
- package/bin/pikku-http-map.ts +0 -26
- package/bin/pikku-nextjs.test.ts +0 -279
- package/bin/pikku-rpc-map.ts +0 -25
- package/dist/bin/pikku-channels-map.d.ts +0 -3
- package/dist/bin/pikku-channels-map.js +0 -8
- package/dist/bin/pikku-channels.d.ts +0 -3
- package/dist/bin/pikku-channels.js +0 -9
- package/dist/bin/pikku-function-types.d.ts +0 -4
- package/dist/bin/pikku-functions.d.ts +0 -7
- package/dist/bin/pikku-http-map.d.ts +0 -3
- package/dist/bin/pikku-http-map.js +0 -8
- package/dist/bin/pikku-http-routes.d.ts +0 -3
- package/dist/bin/pikku-http-routes.js +0 -9
- package/dist/bin/pikku-rpc-map.d.ts +0 -3
- package/dist/bin/pikku-rpc-map.js +0 -8
- package/dist/bin/pikku-rpc.d.ts +0 -3
- package/dist/bin/pikku-rpc.js +0 -6
- package/dist/bin/pikku-scheduler.d.ts +0 -3
- package/dist/bin/pikku-scheduler.js +0 -10
- /package/dist/src/{serialize-typed-channel-map.d.ts → events/channels/serialize-typed-channel-map.d.ts} +0 -0
- /package/dist/src/{serialize-websocket-wrapper.d.ts → events/channels/serialize-websocket-wrapper.d.ts} +0 -0
- /package/dist/src/{serialize-websocket-wrapper.js → events/channels/serialize-websocket-wrapper.js} +0 -0
- /package/dist/src/{openapi-spec-generator.d.ts → events/http/openapi-spec-generator.d.ts} +0 -0
- /package/dist/src/{openapi-spec-generator.js → events/http/openapi-spec-generator.js} +0 -0
- /package/dist/src/{serialize-fetch-wrapper.d.ts → events/http/serialize-fetch-wrapper.d.ts} +0 -0
- /package/dist/src/{serialize-fetch-wrapper.js → events/http/serialize-fetch-wrapper.js} +0 -0
- /package/dist/src/{serialize-scheduler-meta.d.ts → events/scheduler/serialize-scheduler-meta.d.ts} +0 -0
- /package/dist/src/{serialize-scheduler-meta.js → events/scheduler/serialize-scheduler-meta.js} +0 -0
- /package/dist/src/{serialize-nextjs-backend-wrapper.d.ts → runtimes/nextjs/serialize-nextjs-backend-wrapper.d.ts} +0 -0
- /package/dist/src/{serialize-nextjs-backend-wrapper.js → runtimes/nextjs/serialize-nextjs-backend-wrapper.js} +0 -0
- /package/dist/src/{serialize-nextjs-http-wrapper.d.ts → runtimes/nextjs/serialize-nextjs-http-wrapper.d.ts} +0 -0
- /package/dist/src/{serialize-nextjs-http-wrapper.js → runtimes/nextjs/serialize-nextjs-http-wrapper.js} +0 -0
- /package/dist/src/{utils/serialize-import-map.d.ts → serialize-import-map.d.ts} +0 -0
- /package/src/{serialize-websocket-wrapper.ts → events/channels/serialize-websocket-wrapper.ts} +0 -0
- /package/src/{openapi-spec-generator.ts → events/http/openapi-spec-generator.ts} +0 -0
- /package/src/{serialize-fetch-wrapper.ts → events/http/serialize-fetch-wrapper.ts} +0 -0
- /package/src/{serialize-scheduler-meta.ts → events/scheduler/serialize-scheduler-meta.ts} +0 -0
- /package/src/{serialize-nextjs-backend-wrapper.ts → runtimes/nextjs/serialize-nextjs-backend-wrapper.ts} +0 -0
- /package/src/{serialize-nextjs-http-wrapper.ts → runtimes/nextjs/serialize-nextjs-http-wrapper.ts} +0 -0
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { PikkuCLIConfig } from '../src/pikku-cli-config.js'
|
|
2
|
-
import { InspectorState } from '@pikku/inspector'
|
|
3
|
-
import { logCommandInfoAndTime, writeFileInDir } from '../src/utils/utils.js'
|
|
4
|
-
import { serializeTypedChannelsMap } from '../src/serialize-typed-channel-map.js'
|
|
5
|
-
|
|
6
|
-
export const pikkuChannelsMap = async (
|
|
7
|
-
{ channelsMapDeclarationFile, packageMappings }: PikkuCLIConfig,
|
|
8
|
-
state: InspectorState
|
|
9
|
-
) => {
|
|
10
|
-
return await logCommandInfoAndTime(
|
|
11
|
-
'Creating channels map',
|
|
12
|
-
'Created channels map',
|
|
13
|
-
[state.channels.files.size === 0],
|
|
14
|
-
async () => {
|
|
15
|
-
const content = serializeTypedChannelsMap(
|
|
16
|
-
channelsMapDeclarationFile,
|
|
17
|
-
packageMappings,
|
|
18
|
-
state.functions.typesMap,
|
|
19
|
-
state.functions.meta,
|
|
20
|
-
state.channels.meta
|
|
21
|
-
)
|
|
22
|
-
await writeFileInDir(channelsMapDeclarationFile, content)
|
|
23
|
-
}
|
|
24
|
-
)
|
|
25
|
-
}
|
package/bin/pikku-http-map.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { PikkuCLIConfig } from '../src/pikku-cli-config.js'
|
|
2
|
-
import { InspectorState } from '@pikku/inspector'
|
|
3
|
-
import { logCommandInfoAndTime, writeFileInDir } from '../src/utils/utils.js'
|
|
4
|
-
import { serializeTypedRoutesMap } from '../src/serialize-typed-http-map.js'
|
|
5
|
-
|
|
6
|
-
export const pikkuHTTPMap = async (
|
|
7
|
-
{ httpRoutesMapDeclarationFile, packageMappings }: PikkuCLIConfig,
|
|
8
|
-
{ http, functions }: InspectorState
|
|
9
|
-
) => {
|
|
10
|
-
return await logCommandInfoAndTime(
|
|
11
|
-
'Creating HTTP map',
|
|
12
|
-
'Created HTTP map',
|
|
13
|
-
[http.files.size === 0],
|
|
14
|
-
async () => {
|
|
15
|
-
const content = serializeTypedRoutesMap(
|
|
16
|
-
httpRoutesMapDeclarationFile,
|
|
17
|
-
packageMappings,
|
|
18
|
-
functions.typesMap,
|
|
19
|
-
functions.meta,
|
|
20
|
-
http.meta,
|
|
21
|
-
http.metaInputTypes
|
|
22
|
-
)
|
|
23
|
-
await writeFileInDir(httpRoutesMapDeclarationFile, content)
|
|
24
|
-
}
|
|
25
|
-
)
|
|
26
|
-
}
|
package/bin/pikku-nextjs.test.ts
DELETED
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
// import * as path from 'path'
|
|
2
|
-
// import { assert } from 'chai'
|
|
3
|
-
// import * as sinon from 'sinon'
|
|
4
|
-
|
|
5
|
-
// import { action } from './pikku-nextjs.js'
|
|
6
|
-
|
|
7
|
-
// // Mocking external dependencies
|
|
8
|
-
// import * as fsPromises from 'fs/promises'
|
|
9
|
-
// import * as extractPikkuInformation from '../src/extract-pikku-information.js'
|
|
10
|
-
// import * as getFileImportRelativePath from '../src/utils.js'
|
|
11
|
-
// import * as nextjsWrapperGenerator from '../src/nextjs-wrapper-generator.js'
|
|
12
|
-
|
|
13
|
-
// import * as getPikkuConfig from '@pikku/core/pikku-config'
|
|
14
|
-
|
|
15
|
-
// describe('action function - generateNextJsWrapper arguments', () => {
|
|
16
|
-
// let sandbox: sinon.SinonSandbox
|
|
17
|
-
// let getPikkuConfigStub: sinon.SinonStub
|
|
18
|
-
// let extractPikkuInformationStub: sinon.SinonStub
|
|
19
|
-
// let getFileImportRelativePathStub: sinon.SinonStub
|
|
20
|
-
// let generateNextJsWrapperStub: sinon.SinonStub
|
|
21
|
-
// let processExitStub: sinon.SinonStub
|
|
22
|
-
// let consoleErrorStub: sinon.SinonStub
|
|
23
|
-
|
|
24
|
-
// beforeEach(() => {
|
|
25
|
-
// sandbox = sinon.createSandbox()
|
|
26
|
-
|
|
27
|
-
// // Stub external dependencies
|
|
28
|
-
// getPikkuConfigStub = sandbox.stub(
|
|
29
|
-
// getPikkuConfig,
|
|
30
|
-
// 'getPikkuConfig'
|
|
31
|
-
// )
|
|
32
|
-
// extractPikkuInformationStub = sandbox.stub(
|
|
33
|
-
// extractPikkuInformation,
|
|
34
|
-
// 'extractPikkuInformation'
|
|
35
|
-
// )
|
|
36
|
-
// getFileImportRelativePathStub = sandbox.stub(
|
|
37
|
-
// getFileImportRelativePath,
|
|
38
|
-
// 'getFileImportRelativePath'
|
|
39
|
-
// )
|
|
40
|
-
// generateNextJsWrapperStub = sandbox.stub(
|
|
41
|
-
// nextjsWrapperGenerator,
|
|
42
|
-
// 'generateNextJsWrapper'
|
|
43
|
-
// )
|
|
44
|
-
|
|
45
|
-
// // Stub fs.promises methods to prevent actual file system operations
|
|
46
|
-
// sandbox.stub(fsPromises, 'mkdir').resolves()
|
|
47
|
-
// sandbox.stub(fsPromises, 'writeFile').resolves()
|
|
48
|
-
|
|
49
|
-
// // Stub process.exit and console.error to prevent test from exiting and to capture errors
|
|
50
|
-
// processExitStub = sandbox.stub(process, 'exit')
|
|
51
|
-
// sandbox.stub(console, 'log')
|
|
52
|
-
// consoleErrorStub = sandbox.stub(console, 'error')
|
|
53
|
-
|
|
54
|
-
// // Default stubs for external functions
|
|
55
|
-
// getPikkuConfigStub.resolves({
|
|
56
|
-
// pikkuNextFile: 'nextFile.ts',
|
|
57
|
-
// rootDir: 'rootDir',
|
|
58
|
-
// routesFile: 'routes.ts',
|
|
59
|
-
// configDir: 'configDir',
|
|
60
|
-
// packageMappings: {},
|
|
61
|
-
// schemaDirectory: 'schemas',
|
|
62
|
-
// })
|
|
63
|
-
|
|
64
|
-
// extractPikkuInformationStub.resolves({
|
|
65
|
-
// pikkuConfigs: { 'configFile.ts': ['pikkuConfigVariable'] },
|
|
66
|
-
// sessionServicesFactories: {
|
|
67
|
-
// 'sessionFactoryFile.ts': ['sessionFactoryVariable'],
|
|
68
|
-
// },
|
|
69
|
-
// singletonServicesFactories: {
|
|
70
|
-
// 'singletonFactoryFile.ts': ['singletonFactoryVariable'],
|
|
71
|
-
// },
|
|
72
|
-
// })
|
|
73
|
-
|
|
74
|
-
// // Mock getFileImportRelativePath to return predictable paths
|
|
75
|
-
// getFileImportRelativePathStub.callsFake(
|
|
76
|
-
// (from: string, to: string, packageMappings: any) => {
|
|
77
|
-
// return `./${to}`
|
|
78
|
-
// }
|
|
79
|
-
// )
|
|
80
|
-
// })
|
|
81
|
-
|
|
82
|
-
// afterEach(() => {
|
|
83
|
-
// sandbox.restore()
|
|
84
|
-
// })
|
|
85
|
-
|
|
86
|
-
// it('should pass correct imports to generateNextJsWrapper', async () => {
|
|
87
|
-
// await action({})
|
|
88
|
-
|
|
89
|
-
// // Capture the arguments passed to generateNextJsWrapper
|
|
90
|
-
// assert(
|
|
91
|
-
// generateNextJsWrapperStub.calledOnce,
|
|
92
|
-
// 'generateNextJsWrapper should be called once'
|
|
93
|
-
// )
|
|
94
|
-
|
|
95
|
-
// const [
|
|
96
|
-
// ,
|
|
97
|
-
// ,
|
|
98
|
-
// pikkuConfigImport,
|
|
99
|
-
// singletonServicesImport,
|
|
100
|
-
// sessionServicesImport,
|
|
101
|
-
// ] = generateNextJsWrapperStub.firstCall.args
|
|
102
|
-
|
|
103
|
-
// const expectedPikkuConfigImport = `import { pikkuConfigVariable } from './configFile.ts'`
|
|
104
|
-
// const expectedSingletonServicesImport = `import { singletonFactoryVariable } from './singletonFactoryFile.ts'`
|
|
105
|
-
// const expectedSessionServicesImport = `import { sessionFactoryVariable } from './sessionFactoryFile.ts'`
|
|
106
|
-
|
|
107
|
-
// assert.strictEqual(
|
|
108
|
-
// pikkuConfigImport,
|
|
109
|
-
// expectedPikkuConfigImport,
|
|
110
|
-
// 'pikkuConfigImport should match expected import'
|
|
111
|
-
// )
|
|
112
|
-
// assert.strictEqual(
|
|
113
|
-
// singletonServicesImport,
|
|
114
|
-
// expectedSingletonServicesImport,
|
|
115
|
-
// 'singletonServicesImport should match expected import'
|
|
116
|
-
// )
|
|
117
|
-
// assert.strictEqual(
|
|
118
|
-
// sessionServicesImport,
|
|
119
|
-
// expectedSessionServicesImport,
|
|
120
|
-
// 'sessionServicesImport should match expected import'
|
|
121
|
-
// )
|
|
122
|
-
// })
|
|
123
|
-
|
|
124
|
-
// it('should use provided pikkuConfigFile and pikkuConfigVariable', async () => {
|
|
125
|
-
// const options = {
|
|
126
|
-
// pikkuConfigFile: 'customConfigFile.ts',
|
|
127
|
-
// pikkuConfigVariable: 'customPikkuConfigVariable',
|
|
128
|
-
// }
|
|
129
|
-
|
|
130
|
-
// await action(options)
|
|
131
|
-
|
|
132
|
-
// assert(
|
|
133
|
-
// generateNextJsWrapperStub.calledOnce,
|
|
134
|
-
// 'generateNextJsWrapper should be called once'
|
|
135
|
-
// )
|
|
136
|
-
|
|
137
|
-
// const [, , pikkuConfigImport] = generateNextJsWrapperStub.firstCall.args
|
|
138
|
-
|
|
139
|
-
// const expectedImport = `import { customPikkuConfigVariable } from './customConfigFile.ts'`
|
|
140
|
-
// assert.strictEqual(
|
|
141
|
-
// pikkuConfigImport,
|
|
142
|
-
// expectedImport,
|
|
143
|
-
// 'pikkuConfigImport should use provided file and variable'
|
|
144
|
-
// )
|
|
145
|
-
// })
|
|
146
|
-
|
|
147
|
-
// it('should handle missing pikkuConfigs and exit', async () => {
|
|
148
|
-
// // Modify the stub to simulate missing pikkuConfigs
|
|
149
|
-
// extractPikkuInformationStub.resolves({
|
|
150
|
-
// pikkuConfigs: {},
|
|
151
|
-
// sessionServicesFactories: {
|
|
152
|
-
// 'sessionFactoryFile.ts': ['sessionFactoryVariable'],
|
|
153
|
-
// },
|
|
154
|
-
// singletonServicesFactories: {
|
|
155
|
-
// 'singletonFactoryFile.ts': ['singletonFactoryVariable'],
|
|
156
|
-
// },
|
|
157
|
-
// })
|
|
158
|
-
|
|
159
|
-
// await action({})
|
|
160
|
-
|
|
161
|
-
// assert(consoleErrorStub.calledWithMatch('Found errors:'))
|
|
162
|
-
// assert(consoleErrorStub.calledWithMatch('No PikkuConfig object found'))
|
|
163
|
-
// assert(
|
|
164
|
-
// processExitStub.calledWith(1),
|
|
165
|
-
// 'process.exit should be called with 1'
|
|
166
|
-
// )
|
|
167
|
-
// assert.isFalse(
|
|
168
|
-
// generateNextJsWrapperStub.called,
|
|
169
|
-
// 'generateNextJsWrapper should not be called when there is an error'
|
|
170
|
-
// )
|
|
171
|
-
// })
|
|
172
|
-
|
|
173
|
-
// it('should generate correct import paths with packageMappings', async () => {
|
|
174
|
-
// // Provide packageMappings in the pikkuConfig
|
|
175
|
-
// getPikkuConfigStub.resolves({
|
|
176
|
-
// pikkuNextFile: 'nextFile.ts',
|
|
177
|
-
// rootDir: 'rootDir',
|
|
178
|
-
// routesFile: 'routes.ts',
|
|
179
|
-
// configDir: 'configDir',
|
|
180
|
-
// packageMappings: {
|
|
181
|
-
// 'configFile.ts': '@configs/configFile',
|
|
182
|
-
// 'singletonFactoryFile.ts': '@factories/singletonFactory',
|
|
183
|
-
// 'sessionFactoryFile.ts': '@factories/sessionFactory',
|
|
184
|
-
// },
|
|
185
|
-
// schemaDirectory: 'schemas',
|
|
186
|
-
// })
|
|
187
|
-
|
|
188
|
-
// // Modify getFileImportRelativePath to consider packageMappings
|
|
189
|
-
// getFileImportRelativePathStub.callsFake(
|
|
190
|
-
// (from: string, to: string, packageMappings: any) => {
|
|
191
|
-
// const mappedPackage = packageMappings[to]
|
|
192
|
-
// return mappedPackage || `./${path.relative(path.dirname(from), to)}`
|
|
193
|
-
// }
|
|
194
|
-
// )
|
|
195
|
-
|
|
196
|
-
// await action({})
|
|
197
|
-
|
|
198
|
-
// assert(
|
|
199
|
-
// generateNextJsWrapperStub.calledOnce,
|
|
200
|
-
// 'generateNextJsWrapper should be called once'
|
|
201
|
-
// )
|
|
202
|
-
|
|
203
|
-
// const [
|
|
204
|
-
// ,
|
|
205
|
-
// ,
|
|
206
|
-
// pikkuConfigImport,
|
|
207
|
-
// singletonServicesImport,
|
|
208
|
-
// sessionServicesImport,
|
|
209
|
-
// ] = generateNextJsWrapperStub.firstCall.args
|
|
210
|
-
|
|
211
|
-
// const expectedPikkuConfigImport = `import { pikkuConfigVariable } from '@configs/configFile'`
|
|
212
|
-
// const expectedSingletonServicesImport = `import { singletonFactoryVariable } from '@factories/singletonFactory'`
|
|
213
|
-
// const expectedSessionServicesImport = `import { sessionFactoryVariable } from '@factories/sessionFactory'`
|
|
214
|
-
|
|
215
|
-
// assert.strictEqual(
|
|
216
|
-
// pikkuConfigImport,
|
|
217
|
-
// expectedPikkuConfigImport,
|
|
218
|
-
// 'pikkuConfigImport should use package mapping'
|
|
219
|
-
// )
|
|
220
|
-
// assert.strictEqual(
|
|
221
|
-
// singletonServicesImport,
|
|
222
|
-
// expectedSingletonServicesImport,
|
|
223
|
-
// 'singletonServicesImport should use package mapping'
|
|
224
|
-
// )
|
|
225
|
-
// assert.strictEqual(
|
|
226
|
-
// sessionServicesImport,
|
|
227
|
-
// expectedSessionServicesImport,
|
|
228
|
-
// 'sessionServicesImport should use package mapping'
|
|
229
|
-
// )
|
|
230
|
-
// })
|
|
231
|
-
|
|
232
|
-
// it('should use provided singletonServicesFactoryFile and singletonServicesFactoryVariable', async () => {
|
|
233
|
-
// const options = {
|
|
234
|
-
// singletonServicesFactoryFile: 'customSingletonFactoryFile.ts',
|
|
235
|
-
// singletonServicesFactoryVariable: 'customSingletonFactoryVariable',
|
|
236
|
-
// }
|
|
237
|
-
|
|
238
|
-
// await action(options)
|
|
239
|
-
|
|
240
|
-
// assert(
|
|
241
|
-
// generateNextJsWrapperStub.calledOnce,
|
|
242
|
-
// 'generateNextJsWrapper should be called once'
|
|
243
|
-
// )
|
|
244
|
-
|
|
245
|
-
// const [, , , singletonServicesImport] =
|
|
246
|
-
// generateNextJsWrapperStub.firstCall.args
|
|
247
|
-
|
|
248
|
-
// const expectedImport = `import { customSingletonFactoryVariable } from './customSingletonFactoryFile.ts'`
|
|
249
|
-
// assert.strictEqual(
|
|
250
|
-
// singletonServicesImport,
|
|
251
|
-
// expectedImport,
|
|
252
|
-
// 'singletonServicesImport should use provided file and variable'
|
|
253
|
-
// )
|
|
254
|
-
// })
|
|
255
|
-
|
|
256
|
-
// it('should use provided sessionServicesFactoryFile and sessionServicesFactoryVariable', async () => {
|
|
257
|
-
// const options = {
|
|
258
|
-
// sessionServicesFactoryFile: 'customSessionFactoryFile.ts',
|
|
259
|
-
// sessionServicesFactoryVariable: 'customSessionFactoryVariable',
|
|
260
|
-
// }
|
|
261
|
-
|
|
262
|
-
// await action(options)
|
|
263
|
-
|
|
264
|
-
// assert(
|
|
265
|
-
// generateNextJsWrapperStub.calledOnce,
|
|
266
|
-
// 'generateNextJsWrapper should be called once'
|
|
267
|
-
// )
|
|
268
|
-
|
|
269
|
-
// const [, , , , sessionServicesImport] =
|
|
270
|
-
// generateNextJsWrapperStub.firstCall.args
|
|
271
|
-
|
|
272
|
-
// const expectedImport = `import { customSessionFactoryVariable } from './customSessionFactoryFile.ts'`
|
|
273
|
-
// assert.strictEqual(
|
|
274
|
-
// sessionServicesImport,
|
|
275
|
-
// expectedImport,
|
|
276
|
-
// 'sessionServicesImport should use provided file and variable'
|
|
277
|
-
// )
|
|
278
|
-
// })
|
|
279
|
-
// })
|
package/bin/pikku-rpc-map.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { PikkuCLIConfig } from '../src/pikku-cli-config.js'
|
|
2
|
-
import { InspectorState } from '@pikku/inspector'
|
|
3
|
-
import { logCommandInfoAndTime, writeFileInDir } from '../src/utils/utils.js'
|
|
4
|
-
import { serializeTypedRPCMap } from '../src/serialize-typed-rpc-map.js'
|
|
5
|
-
|
|
6
|
-
export const pikkuRPCMap = async (
|
|
7
|
-
{ rpcMapDeclarationFile, packageMappings }: PikkuCLIConfig,
|
|
8
|
-
{ functions, rpc }: InspectorState
|
|
9
|
-
) => {
|
|
10
|
-
return await logCommandInfoAndTime(
|
|
11
|
-
'Creating RPC map',
|
|
12
|
-
'Created RPC map',
|
|
13
|
-
[false],
|
|
14
|
-
async () => {
|
|
15
|
-
const content = serializeTypedRPCMap(
|
|
16
|
-
rpcMapDeclarationFile,
|
|
17
|
-
packageMappings,
|
|
18
|
-
functions.typesMap,
|
|
19
|
-
functions.meta,
|
|
20
|
-
rpc.meta
|
|
21
|
-
)
|
|
22
|
-
await writeFileInDir(rpcMapDeclarationFile, content)
|
|
23
|
-
}
|
|
24
|
-
)
|
|
25
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { logCommandInfoAndTime, writeFileInDir } from '../src/utils/utils.js';
|
|
2
|
-
import { serializeTypedChannelsMap } from '../src/serialize-typed-channel-map.js';
|
|
3
|
-
export const pikkuChannelsMap = async ({ channelsMapDeclarationFile, packageMappings }, state) => {
|
|
4
|
-
return await logCommandInfoAndTime('Creating channels map', 'Created channels map', [state.channels.files.size === 0], async () => {
|
|
5
|
-
const content = serializeTypedChannelsMap(channelsMapDeclarationFile, packageMappings, state.functions.typesMap, state.functions.meta, state.channels.meta);
|
|
6
|
-
await writeFileInDir(channelsMapDeclarationFile, content);
|
|
7
|
-
});
|
|
8
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { logCommandInfoAndTime, serializeFileImports, writeFileInDir, } from '../src/utils/utils.js';
|
|
2
|
-
export const pikkuChannels = async (cliConfig, visitState) => {
|
|
3
|
-
return await logCommandInfoAndTime('Finding Channels', 'Found channels', [visitState.channels.files.size === 0], async () => {
|
|
4
|
-
const { channelsFile, channelsMetaFile, packageMappings } = cliConfig;
|
|
5
|
-
const { channels } = visitState;
|
|
6
|
-
await writeFileInDir(channelsFile, serializeFileImports('addChannel', channelsFile, channels.files, packageMappings));
|
|
7
|
-
await writeFileInDir(channelsMetaFile, `import { pikkuState } from '@pikku/core'\npikkuState('channel', 'meta', ${JSON.stringify(channels.meta, null, 2)})`);
|
|
8
|
-
});
|
|
9
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { PikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
2
|
-
import { InspectorState } from '@pikku/inspector';
|
|
3
|
-
import { PikkuCLIOptions } from '../src/utils/utils.js';
|
|
4
|
-
export declare const pikkuFunctionTypes: ({ typesDeclarationFile: typesFile, packageMappings, rpcMapDeclarationFile, }: PikkuCLIConfig, options: PikkuCLIOptions, visitState: InspectorState) => Promise<void>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { PikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
2
|
-
import { InspectorState } from '@pikku/inspector';
|
|
3
|
-
export declare const serializeFunctionImports: (outputPath: string, functionsMap: Map<string, {
|
|
4
|
-
path: string;
|
|
5
|
-
exportedName: string;
|
|
6
|
-
}>, packageMappings?: Record<string, string>) => string;
|
|
7
|
-
export declare const pikkuFunctions: ({ functionsMetaFile, functionsFile, packageMappings }: PikkuCLIConfig, { functions }: InspectorState) => Promise<boolean>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { PikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
2
|
-
import { InspectorState } from '@pikku/inspector';
|
|
3
|
-
export declare const pikkuHTTPMap: ({ httpRoutesMapDeclarationFile, packageMappings }: PikkuCLIConfig, { http, functions }: InspectorState) => Promise<boolean>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { logCommandInfoAndTime, writeFileInDir } from '../src/utils/utils.js';
|
|
2
|
-
import { serializeTypedRoutesMap } from '../src/serialize-typed-http-map.js';
|
|
3
|
-
export const pikkuHTTPMap = async ({ httpRoutesMapDeclarationFile, packageMappings }, { http, functions }) => {
|
|
4
|
-
return await logCommandInfoAndTime('Creating HTTP map', 'Created HTTP map', [http.files.size === 0], async () => {
|
|
5
|
-
const content = serializeTypedRoutesMap(httpRoutesMapDeclarationFile, packageMappings, functions.typesMap, functions.meta, http.meta, http.metaInputTypes);
|
|
6
|
-
await writeFileInDir(httpRoutesMapDeclarationFile, content);
|
|
7
|
-
});
|
|
8
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { logCommandInfoAndTime, serializeFileImports, writeFileInDir, } from '../src/utils/utils.js';
|
|
2
|
-
export const pikkuHTTP = async (cliConfig, visitState) => {
|
|
3
|
-
return await logCommandInfoAndTime('Finding HTTP routes', 'Found HTTP routes', [visitState.http.files.size === 0], async () => {
|
|
4
|
-
const { httpRoutesFile, httpRoutesMetaFile, packageMappings } = cliConfig;
|
|
5
|
-
const { http } = visitState;
|
|
6
|
-
await writeFileInDir(httpRoutesFile, serializeFileImports('addHTTPRoute', httpRoutesFile, http.files, packageMappings));
|
|
7
|
-
await writeFileInDir(httpRoutesMetaFile, `import { pikkuState } from '@pikku/core'\npikkuState('http', 'meta', ${JSON.stringify(http.meta, null, 2)})`);
|
|
8
|
-
});
|
|
9
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { logCommandInfoAndTime, writeFileInDir } from '../src/utils/utils.js';
|
|
2
|
-
import { serializeTypedRPCMap } from '../src/serialize-typed-rpc-map.js';
|
|
3
|
-
export const pikkuRPCMap = async ({ rpcMapDeclarationFile, packageMappings }, { functions, rpc }) => {
|
|
4
|
-
return await logCommandInfoAndTime('Creating RPC map', 'Created RPC map', [false], async () => {
|
|
5
|
-
const content = serializeTypedRPCMap(rpcMapDeclarationFile, packageMappings, functions.typesMap, functions.meta, rpc.meta);
|
|
6
|
-
await writeFileInDir(rpcMapDeclarationFile, content);
|
|
7
|
-
});
|
|
8
|
-
};
|
package/dist/bin/pikku-rpc.d.ts
DELETED
package/dist/bin/pikku-rpc.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { logCommandInfoAndTime, writeFileInDir } from '../src/utils/utils.js';
|
|
2
|
-
export const pikkuRPC = async ({ rpcMetaFile }, { rpc }) => {
|
|
3
|
-
return await logCommandInfoAndTime('Finding RPCs tasks', 'Found RPCs', [false], async () => {
|
|
4
|
-
await writeFileInDir(rpcMetaFile, `import { pikkuState } from '@pikku/core'\npikkuState('rpc', 'meta', ${JSON.stringify(rpc.meta, null, 2)})`);
|
|
5
|
-
});
|
|
6
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { logCommandInfoAndTime, serializeFileImports, writeFileInDir, } from '../src/utils/utils.js';
|
|
2
|
-
import { serializeSchedulerMeta } from '../src/serialize-scheduler-meta.js';
|
|
3
|
-
export const pikkuScheduler = async (cliConfig, visitState) => {
|
|
4
|
-
return await logCommandInfoAndTime('Finding scheduled tasks', 'Found scheduled tasks', [visitState.scheduledTasks.files.size === 0], async () => {
|
|
5
|
-
const { schedulersFile, schedulersMetaFile, packageMappings } = cliConfig;
|
|
6
|
-
const { scheduledTasks } = visitState;
|
|
7
|
-
await writeFileInDir(schedulersMetaFile, serializeSchedulerMeta(scheduledTasks.meta));
|
|
8
|
-
await writeFileInDir(schedulersFile, serializeFileImports('addSerializedTasks', schedulersFile, scheduledTasks.files, packageMappings));
|
|
9
|
-
});
|
|
10
|
-
};
|
|
File without changes
|
|
File without changes
|
/package/dist/src/{serialize-websocket-wrapper.js → events/channels/serialize-websocket-wrapper.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/src/{serialize-scheduler-meta.d.ts → events/scheduler/serialize-scheduler-meta.d.ts}
RENAMED
|
File without changes
|
/package/dist/src/{serialize-scheduler-meta.js → events/scheduler/serialize-scheduler-meta.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{serialize-websocket-wrapper.ts → events/channels/serialize-websocket-wrapper.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{serialize-nextjs-http-wrapper.ts → runtimes/nextjs/serialize-nextjs-http-wrapper.ts}
RENAMED
|
File without changes
|