nmtjs 0.15.0-beta.2 → 0.15.0-beta.21
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/dist/cli.d.ts +2 -0
- package/dist/cli.js +3 -2
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +51 -0
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -0
- package/dist/entrypoints/cli.d.ts +1 -0
- package/dist/entrypoints/cli.js +1 -0
- package/dist/entrypoints/cli.js.map +1 -0
- package/dist/entrypoints/main.d.ts +5 -0
- package/dist/entrypoints/main.js +83 -15
- package/dist/entrypoints/main.js.map +1 -0
- package/dist/entrypoints/thread.d.ts +14 -0
- package/dist/entrypoints/thread.js +130 -24
- package/dist/entrypoints/thread.js.map +1 -0
- package/dist/entrypoints/worker.d.ts +3 -0
- package/dist/entrypoints/worker.js +4 -3
- package/dist/entrypoints/worker.js.map +1 -0
- package/dist/index.d.ts +69 -0
- package/dist/{_exports/index.js → index.js} +9 -5
- package/dist/index.js.map +1 -0
- package/dist/resolver.d.ts +2 -0
- package/dist/resolver.js +1 -0
- package/dist/resolver.js.map +1 -0
- package/dist/runtime/application/api/api.d.ts +49 -0
- package/dist/runtime/application/api/api.js +193 -0
- package/dist/runtime/application/api/api.js.map +1 -0
- package/dist/runtime/application/api/constants.d.ts +14 -0
- package/dist/runtime/application/api/constants.js +8 -0
- package/dist/runtime/application/api/constants.js.map +1 -0
- package/dist/runtime/application/api/filters.d.ts +14 -0
- package/dist/runtime/application/api/filters.js +11 -0
- package/dist/runtime/application/api/filters.js.map +1 -0
- package/dist/runtime/application/api/guards.d.ts +13 -0
- package/dist/runtime/application/api/guards.js +8 -0
- package/dist/runtime/application/api/guards.js.map +1 -0
- package/dist/runtime/application/api/index.d.ts +8 -0
- package/dist/runtime/application/api/index.js +9 -0
- package/dist/runtime/application/api/index.js.map +1 -0
- package/dist/runtime/application/api/middlewares.d.ts +14 -0
- package/dist/runtime/application/api/middlewares.js +12 -0
- package/dist/runtime/application/api/middlewares.js.map +1 -0
- package/dist/runtime/application/api/procedure.d.ts +67 -0
- package/dist/runtime/application/api/procedure.js +50 -0
- package/dist/runtime/application/api/procedure.js.map +1 -0
- package/dist/runtime/application/api/router.d.ts +71 -0
- package/dist/runtime/application/api/router.js +51 -0
- package/dist/runtime/application/api/router.js.map +1 -0
- package/dist/runtime/application/api/types.d.ts +32 -0
- package/dist/runtime/application/api/types.js +2 -0
- package/dist/runtime/application/api/types.js.map +1 -0
- package/dist/runtime/application/config.d.ts +26 -0
- package/dist/runtime/application/config.js +21 -0
- package/dist/runtime/application/config.js.map +1 -0
- package/dist/runtime/application/constants.d.ts +2 -0
- package/dist/runtime/application/constants.js +2 -0
- package/dist/runtime/application/constants.js.map +1 -0
- package/dist/runtime/application/hook.d.ts +19 -0
- package/dist/runtime/application/hook.js +11 -0
- package/dist/runtime/application/hook.js.map +1 -0
- package/dist/runtime/application/hooks.d.ts +3 -0
- package/dist/runtime/application/hooks.js +4 -0
- package/dist/runtime/application/hooks.js.map +1 -0
- package/dist/runtime/application/index.d.ts +5 -0
- package/dist/runtime/application/index.js +6 -0
- package/dist/runtime/application/index.js.map +1 -0
- package/dist/runtime/constants.d.ts +8 -0
- package/dist/runtime/constants.js +5 -0
- package/dist/runtime/constants.js.map +1 -0
- package/dist/runtime/core/hooks.d.ts +4 -0
- package/dist/runtime/core/hooks.js +4 -0
- package/dist/runtime/core/hooks.js.map +1 -0
- package/dist/runtime/core/plugin.d.ts +8 -0
- package/dist/runtime/core/plugin.js +4 -0
- package/dist/runtime/core/plugin.js.map +1 -0
- package/dist/runtime/core/runtime.d.ts +27 -0
- package/dist/runtime/core/runtime.js +81 -0
- package/dist/runtime/core/runtime.js.map +1 -0
- package/dist/runtime/enums.d.ts +21 -0
- package/dist/runtime/enums.js +26 -0
- package/dist/runtime/enums.js.map +1 -0
- package/dist/runtime/index.d.ts +21 -0
- package/dist/runtime/index.js +22 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/injectables.d.ts +23 -0
- package/dist/runtime/injectables.js +20 -0
- package/dist/runtime/injectables.js.map +1 -0
- package/dist/runtime/jobs/job.d.ts +132 -0
- package/dist/runtime/jobs/job.js +68 -0
- package/dist/runtime/jobs/job.js.map +1 -0
- package/dist/runtime/jobs/manager.d.ts +113 -0
- package/dist/runtime/jobs/manager.js +210 -0
- package/dist/runtime/jobs/manager.js.map +1 -0
- package/dist/runtime/jobs/router.d.ts +266 -0
- package/dist/runtime/jobs/router.js +432 -0
- package/dist/runtime/jobs/router.js.map +1 -0
- package/dist/runtime/jobs/runner.d.ts +64 -0
- package/dist/runtime/jobs/runner.js +256 -0
- package/dist/runtime/jobs/runner.js.map +1 -0
- package/dist/runtime/jobs/step.d.ts +23 -0
- package/dist/runtime/jobs/step.js +18 -0
- package/dist/runtime/jobs/step.js.map +1 -0
- package/dist/runtime/jobs/ui.d.ts +3 -0
- package/dist/runtime/jobs/ui.js +17 -0
- package/dist/runtime/jobs/ui.js.map +1 -0
- package/dist/runtime/pubsub/manager.d.ts +48 -0
- package/dist/runtime/pubsub/manager.js +119 -0
- package/dist/runtime/pubsub/manager.js.map +1 -0
- package/dist/runtime/pubsub/redis.d.ts +16 -0
- package/dist/runtime/pubsub/redis.js +98 -0
- package/dist/runtime/pubsub/redis.js.map +1 -0
- package/dist/runtime/scheduler/index.d.ts +22 -0
- package/dist/runtime/scheduler/index.js +20 -0
- package/dist/runtime/scheduler/index.js.map +1 -0
- package/dist/runtime/server/applications.d.ts +52 -0
- package/dist/runtime/server/applications.js +133 -0
- package/dist/runtime/server/applications.js.map +1 -0
- package/dist/runtime/server/config.d.ts +121 -0
- package/dist/runtime/server/config.js +33 -0
- package/dist/runtime/server/config.js.map +1 -0
- package/dist/runtime/server/jobs.d.ts +41 -0
- package/dist/runtime/server/jobs.js +181 -0
- package/dist/runtime/server/jobs.js.map +1 -0
- package/dist/runtime/server/pool.d.ts +54 -0
- package/dist/runtime/server/pool.js +194 -0
- package/dist/runtime/server/pool.js.map +1 -0
- package/dist/runtime/server/proxy.d.ts +21 -0
- package/dist/runtime/server/proxy.js +79 -0
- package/dist/runtime/server/proxy.js.map +1 -0
- package/dist/runtime/server/server.d.ts +53 -0
- package/dist/runtime/server/server.js +90 -0
- package/dist/runtime/server/server.js.map +1 -0
- package/dist/runtime/store/index.d.ts +3 -0
- package/dist/runtime/store/index.js +23 -0
- package/dist/runtime/store/index.js.map +1 -0
- package/dist/runtime/types.d.ts +103 -0
- package/dist/runtime/types.js +2 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/runtime/workers/application.d.ts +47 -0
- package/dist/runtime/workers/application.js +162 -0
- package/dist/runtime/workers/application.js.map +1 -0
- package/dist/runtime/workers/base.d.ts +16 -0
- package/dist/runtime/workers/base.js +46 -0
- package/dist/runtime/workers/base.js.map +1 -0
- package/dist/runtime/workers/cli.d.ts +1 -0
- package/dist/runtime/workers/cli.js +2 -0
- package/dist/runtime/workers/cli.js.map +1 -0
- package/dist/runtime/workers/job.d.ts +20 -0
- package/dist/runtime/workers/job.js +172 -0
- package/dist/runtime/workers/job.js.map +1 -0
- package/dist/typings.d.ts +5 -0
- package/dist/typings.js +4 -3
- package/dist/typings.js.map +1 -0
- package/dist/vite/builder.d.ts +5 -0
- package/dist/vite/builder.js +5 -1
- package/dist/vite/builder.js.map +1 -0
- package/dist/vite/config.d.ts +28 -0
- package/dist/vite/config.js +1 -0
- package/dist/vite/config.js.map +1 -0
- package/dist/vite/plugins.d.ts +2 -0
- package/dist/vite/plugins.js +1 -0
- package/dist/vite/plugins.js.map +1 -0
- package/dist/vite/runners/worker.d.ts +4 -0
- package/dist/vite/runners/worker.js +1 -0
- package/dist/vite/runners/worker.js.map +1 -0
- package/dist/vite/server.d.ts +3 -0
- package/dist/vite/server.js +6 -1
- package/dist/vite/server.js.map +1 -0
- package/dist/vite/servers/main.d.ts +8 -0
- package/dist/vite/servers/main.js +1 -0
- package/dist/vite/servers/main.js.map +1 -0
- package/dist/vite/servers/worker.d.ts +11 -0
- package/dist/vite/servers/worker.js +28 -0
- package/dist/vite/servers/worker.js.map +1 -0
- package/package.json +31 -18
- package/src/cli.ts +144 -0
- package/src/config.ts +64 -0
- package/src/entrypoints/cli.ts +13 -0
- package/src/entrypoints/main.ts +200 -0
- package/src/entrypoints/thread.ts +184 -0
- package/src/entrypoints/worker.ts +48 -0
- package/src/index.ts +82 -0
- package/src/resolver.ts +16 -0
- package/src/runtime/application/api/api.ts +265 -0
- package/src/runtime/application/api/constants.ts +22 -0
- package/src/runtime/application/api/filters.ts +39 -0
- package/src/runtime/application/api/guards.ts +29 -0
- package/src/runtime/application/api/index.ts +8 -0
- package/src/runtime/application/api/middlewares.ts +37 -0
- package/src/runtime/application/api/procedure.ts +229 -0
- package/src/runtime/application/api/router.ts +193 -0
- package/src/runtime/application/api/types.ts +124 -0
- package/src/runtime/application/config.ts +69 -0
- package/src/runtime/application/constants.ts +4 -0
- package/src/runtime/application/hook.ts +51 -0
- package/src/runtime/application/hooks.ts +3 -0
- package/src/runtime/application/index.ts +5 -0
- package/src/runtime/constants.ts +13 -0
- package/src/runtime/core/hooks.ts +5 -0
- package/src/runtime/core/plugin.ts +13 -0
- package/src/runtime/core/runtime.ts +109 -0
- package/src/runtime/enums.ts +24 -0
- package/src/runtime/index.ts +21 -0
- package/src/runtime/injectables.ts +61 -0
- package/src/runtime/jobs/job.ts +370 -0
- package/src/runtime/jobs/manager.ts +348 -0
- package/src/runtime/jobs/router.ts +896 -0
- package/src/runtime/jobs/runner.ts +320 -0
- package/src/runtime/jobs/step.ts +66 -0
- package/src/runtime/jobs/ui.ts +21 -0
- package/src/runtime/pubsub/manager.ts +211 -0
- package/src/runtime/pubsub/redis.ts +108 -0
- package/src/runtime/scheduler/index.ts +39 -0
- package/src/runtime/server/applications.ts +210 -0
- package/src/runtime/server/config.ts +158 -0
- package/src/runtime/server/jobs.ts +250 -0
- package/src/runtime/server/pool.ts +260 -0
- package/src/runtime/server/proxy.ts +118 -0
- package/src/runtime/server/server.ts +155 -0
- package/src/runtime/store/index.ts +30 -0
- package/src/runtime/types.ts +93 -0
- package/src/runtime/workers/application.ts +209 -0
- package/src/runtime/workers/base.ts +68 -0
- package/src/runtime/workers/cli.ts +0 -0
- package/src/runtime/workers/job.ts +153 -0
- package/src/typings.ts +30 -0
- package/src/vite/builder.ts +122 -0
- package/src/vite/config.ts +45 -0
- package/src/vite/plugins.ts +26 -0
- package/src/vite/runners/worker.ts +57 -0
- package/src/vite/server.ts +39 -0
- package/src/vite/servers/main.ts +34 -0
- package/src/vite/servers/worker.ts +143 -0
- package/dist/_exports/application.js +0 -1
- package/dist/_exports/common.js +0 -1
- package/dist/_exports/contract.js +0 -2
- package/dist/_exports/core.js +0 -1
- package/dist/_exports/gateway.js +0 -1
- package/dist/_exports/http-transport/bun.js +0 -1
- package/dist/_exports/http-transport/deno.js +0 -1
- package/dist/_exports/http-transport/node.js +0 -1
- package/dist/_exports/http-transport.js +0 -1
- package/dist/_exports/json-format.js +0 -1
- package/dist/_exports/protocol/client.js +0 -1
- package/dist/_exports/protocol/server.js +0 -1
- package/dist/_exports/protocol.js +0 -1
- package/dist/_exports/runtime/types.js +0 -1
- package/dist/_exports/runtime.js +0 -1
- package/dist/_exports/type.js +0 -2
- package/dist/_exports/ws-transport/bun.js +0 -1
- package/dist/_exports/ws-transport/deno.js +0 -1
- package/dist/_exports/ws-transport/node.js +0 -1
- package/dist/_exports/ws-transport.js +0 -1
- package/dist/command.js +0 -30
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import type { MaybePromise } from '@nmtjs/common'
|
|
2
|
+
import type { TAnyProcedureContract, TProcedureContract } from '@nmtjs/contract'
|
|
3
|
+
import type {
|
|
4
|
+
Dependant,
|
|
5
|
+
Dependencies,
|
|
6
|
+
DependencyContext,
|
|
7
|
+
Metadata,
|
|
8
|
+
} from '@nmtjs/core'
|
|
9
|
+
import type { InputType } from '@nmtjs/protocol/server'
|
|
10
|
+
import type { BaseType } from '@nmtjs/type'
|
|
11
|
+
import type * as zod from 'zod/mini'
|
|
12
|
+
import { c } from '@nmtjs/contract'
|
|
13
|
+
import { MetadataStore } from '@nmtjs/core'
|
|
14
|
+
import { t } from '@nmtjs/type'
|
|
15
|
+
|
|
16
|
+
import type { AnyGuard } from './guards.ts'
|
|
17
|
+
import type { AnyMiddleware } from './middlewares.ts'
|
|
18
|
+
import type { JsonPrimitive } from './types.ts'
|
|
19
|
+
import { kProcedure } from './constants.ts'
|
|
20
|
+
|
|
21
|
+
export interface BaseProcedure<
|
|
22
|
+
ProcedureContract extends TAnyProcedureContract,
|
|
23
|
+
ProcedureDeps extends Dependencies,
|
|
24
|
+
> extends Dependant<ProcedureDeps> {
|
|
25
|
+
contract: ProcedureContract
|
|
26
|
+
handler: (...args: any[]) => any
|
|
27
|
+
metadata: MetadataStore
|
|
28
|
+
dependencies: ProcedureDeps
|
|
29
|
+
guards: Set<AnyGuard>
|
|
30
|
+
middlewares: Set<AnyMiddleware>
|
|
31
|
+
streamTimeout?: number
|
|
32
|
+
[kProcedure]: any
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type ProcedureHandlerType<Input, Output, Deps extends Dependencies> = (
|
|
36
|
+
ctx: DependencyContext<Deps>,
|
|
37
|
+
data: Input,
|
|
38
|
+
) => MaybePromise<Output>
|
|
39
|
+
|
|
40
|
+
export interface Procedure<
|
|
41
|
+
ProcedureContract extends TAnyProcedureContract,
|
|
42
|
+
ProcedureDeps extends Dependencies,
|
|
43
|
+
> extends BaseProcedure<ProcedureContract, ProcedureDeps> {
|
|
44
|
+
handler: ProcedureHandlerType<
|
|
45
|
+
InputType<t.infer.decodeRaw.output<ProcedureContract['input']>>,
|
|
46
|
+
ProcedureContract['stream'] extends true
|
|
47
|
+
? AsyncIterable<t.infer.encode.input<ProcedureContract['output']>>
|
|
48
|
+
: t.infer.encode.input<ProcedureContract['output']>,
|
|
49
|
+
ProcedureDeps
|
|
50
|
+
>
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type AnyProcedure<
|
|
54
|
+
Contract extends TAnyProcedureContract = TAnyProcedureContract,
|
|
55
|
+
> = BaseProcedure<Contract, Dependencies>
|
|
56
|
+
|
|
57
|
+
export type CreateProcedureParams<
|
|
58
|
+
ProcedureContract extends TAnyProcedureContract,
|
|
59
|
+
ProcedureDeps extends Dependencies,
|
|
60
|
+
> =
|
|
61
|
+
| {
|
|
62
|
+
dependencies?: ProcedureDeps
|
|
63
|
+
guards?: AnyGuard[]
|
|
64
|
+
middlewares?: AnyMiddleware[]
|
|
65
|
+
metadata?: Metadata[]
|
|
66
|
+
streamTimeout?: number
|
|
67
|
+
handler: ProcedureHandlerType<
|
|
68
|
+
InputType<t.infer.decodeRaw.output<ProcedureContract['input']>>,
|
|
69
|
+
ProcedureContract['stream'] extends undefined
|
|
70
|
+
? t.infer.encode.input<ProcedureContract['output']>
|
|
71
|
+
: AsyncIterable<
|
|
72
|
+
Exclude<ProcedureContract['stream'], undefined | boolean>
|
|
73
|
+
>,
|
|
74
|
+
ProcedureDeps
|
|
75
|
+
>
|
|
76
|
+
}
|
|
77
|
+
| ProcedureHandlerType<
|
|
78
|
+
InputType<t.infer.decodeRaw.output<ProcedureContract['input']>>,
|
|
79
|
+
ProcedureContract['stream'] extends undefined
|
|
80
|
+
? t.infer.decode.input<ProcedureContract['output']>
|
|
81
|
+
: AsyncIterable<
|
|
82
|
+
Exclude<ProcedureContract['stream'], undefined | boolean>
|
|
83
|
+
>,
|
|
84
|
+
ProcedureDeps
|
|
85
|
+
>
|
|
86
|
+
|
|
87
|
+
export function _createBaseProcedure<
|
|
88
|
+
ProcedureContract extends TAnyProcedureContract,
|
|
89
|
+
ProcedureDeps extends Dependencies,
|
|
90
|
+
>(
|
|
91
|
+
contract: ProcedureContract,
|
|
92
|
+
params: {
|
|
93
|
+
dependencies?: ProcedureDeps
|
|
94
|
+
middlewares?: AnyMiddleware[]
|
|
95
|
+
guards?: AnyGuard[]
|
|
96
|
+
metadata?: Metadata[]
|
|
97
|
+
streamTimeout?: number
|
|
98
|
+
},
|
|
99
|
+
) {
|
|
100
|
+
const dependencies = params.dependencies ?? ({} as ProcedureDeps)
|
|
101
|
+
const metadata = new MetadataStore()
|
|
102
|
+
const middlewares = new Set(params.middlewares ?? [])
|
|
103
|
+
const guards = new Set(params.guards ?? [])
|
|
104
|
+
const streamTimeout = params.streamTimeout
|
|
105
|
+
|
|
106
|
+
if (typeof streamTimeout !== 'undefined' && streamTimeout <= 0) {
|
|
107
|
+
throw new Error('Stream timeout must be a positive integer')
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
for (const meta of params.metadata ?? []) {
|
|
111
|
+
metadata.set(meta.key, meta.value)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
contract,
|
|
116
|
+
dependencies,
|
|
117
|
+
middlewares,
|
|
118
|
+
guards,
|
|
119
|
+
metadata,
|
|
120
|
+
streamTimeout,
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function createContractProcedure<
|
|
125
|
+
ProcedureContract extends TAnyProcedureContract,
|
|
126
|
+
ProcedureDeps extends Dependencies,
|
|
127
|
+
>(
|
|
128
|
+
contract: ProcedureContract,
|
|
129
|
+
paramsOrHandler: CreateProcedureParams<ProcedureContract, ProcedureDeps>,
|
|
130
|
+
): Procedure<ProcedureContract, ProcedureDeps> {
|
|
131
|
+
const { handler, ...params } =
|
|
132
|
+
typeof paramsOrHandler === 'function'
|
|
133
|
+
? { handler: paramsOrHandler }
|
|
134
|
+
: paramsOrHandler
|
|
135
|
+
|
|
136
|
+
return Object.assign(_createBaseProcedure(contract, params), {
|
|
137
|
+
handler,
|
|
138
|
+
[kProcedure]: true,
|
|
139
|
+
}) as any
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function createProcedure<
|
|
143
|
+
Return,
|
|
144
|
+
TInput extends BaseType | undefined = undefined,
|
|
145
|
+
TOutput extends BaseType | undefined = undefined,
|
|
146
|
+
TStream extends true | number | undefined = undefined,
|
|
147
|
+
Deps extends Dependencies = {},
|
|
148
|
+
>(
|
|
149
|
+
paramsOrHandler:
|
|
150
|
+
| {
|
|
151
|
+
input?: TInput
|
|
152
|
+
output?: TOutput
|
|
153
|
+
/**
|
|
154
|
+
* Whether the procedure is a stream procedure.
|
|
155
|
+
* If set to `true`, the procedure handler should return an `AsyncIterable` of output items.
|
|
156
|
+
* If set to a number, it specifies an explicit stream timeout in milliseconds.
|
|
157
|
+
*/
|
|
158
|
+
stream?: TStream
|
|
159
|
+
dependencies?: Deps
|
|
160
|
+
guards?: AnyGuard[]
|
|
161
|
+
middlewares?: AnyMiddleware[]
|
|
162
|
+
metadata?: Metadata[]
|
|
163
|
+
timeout?: number
|
|
164
|
+
handler: ProcedureHandlerType<
|
|
165
|
+
TInput extends BaseType
|
|
166
|
+
? InputType<t.infer.decodeRaw.output<TInput>>
|
|
167
|
+
: never,
|
|
168
|
+
TStream extends true | number
|
|
169
|
+
? AsyncIterable<
|
|
170
|
+
TOutput extends BaseType
|
|
171
|
+
? t.infer.encode.input<TOutput>
|
|
172
|
+
: Return
|
|
173
|
+
>
|
|
174
|
+
: TOutput extends BaseType
|
|
175
|
+
? t.infer.encode.input<TOutput>
|
|
176
|
+
: Return,
|
|
177
|
+
Deps
|
|
178
|
+
>
|
|
179
|
+
}
|
|
180
|
+
| ProcedureHandlerType<
|
|
181
|
+
TInput extends BaseType
|
|
182
|
+
? InputType<t.infer.decodeRaw.output<TInput>>
|
|
183
|
+
: never,
|
|
184
|
+
Return,
|
|
185
|
+
Deps
|
|
186
|
+
>,
|
|
187
|
+
): Procedure<
|
|
188
|
+
TProcedureContract<
|
|
189
|
+
TInput extends undefined ? t.NeverType : TInput,
|
|
190
|
+
TOutput extends undefined
|
|
191
|
+
? t.CustomType<
|
|
192
|
+
JsonPrimitive<Return>,
|
|
193
|
+
zod.ZodMiniCustom<JsonPrimitive<Return>, JsonPrimitive<Return>>
|
|
194
|
+
>
|
|
195
|
+
: TOutput,
|
|
196
|
+
TStream extends true | number ? true : undefined
|
|
197
|
+
>,
|
|
198
|
+
Deps
|
|
199
|
+
> {
|
|
200
|
+
const {
|
|
201
|
+
input = t.never() as any,
|
|
202
|
+
output = t.any() as any,
|
|
203
|
+
stream = undefined as any,
|
|
204
|
+
dependencies = {} as Deps,
|
|
205
|
+
guards = [],
|
|
206
|
+
middlewares = [],
|
|
207
|
+
metadata = [],
|
|
208
|
+
handler,
|
|
209
|
+
timeout,
|
|
210
|
+
} = typeof paramsOrHandler === 'function'
|
|
211
|
+
? { handler: paramsOrHandler }
|
|
212
|
+
: paramsOrHandler
|
|
213
|
+
|
|
214
|
+
// @ts-expect-error
|
|
215
|
+
return createContractProcedure(
|
|
216
|
+
c.procedure({ input, output, stream, timeout }),
|
|
217
|
+
{
|
|
218
|
+
dependencies,
|
|
219
|
+
handler: handler as any,
|
|
220
|
+
guards,
|
|
221
|
+
middlewares,
|
|
222
|
+
metadata,
|
|
223
|
+
streamTimeout: typeof stream === 'number' ? stream : undefined,
|
|
224
|
+
},
|
|
225
|
+
)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export const isProcedure = (value: any): value is AnyProcedure =>
|
|
229
|
+
Boolean(value?.[kProcedure])
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import type { Callback } from '@nmtjs/common'
|
|
2
|
+
import type {
|
|
3
|
+
TAnyProcedureContract,
|
|
4
|
+
TAnyRouterContract,
|
|
5
|
+
TProcedureContract,
|
|
6
|
+
TRouteContract,
|
|
7
|
+
TRouterContract,
|
|
8
|
+
} from '@nmtjs/contract'
|
|
9
|
+
import type { AnyType } from '@nmtjs/type/any'
|
|
10
|
+
import { c, IsRouterContract } from '@nmtjs/contract'
|
|
11
|
+
|
|
12
|
+
import type { AnyGuard } from './guards.ts'
|
|
13
|
+
import type { AnyMiddleware } from './middlewares.ts'
|
|
14
|
+
import type { AnyProcedure } from './procedure.ts'
|
|
15
|
+
import { kRootRouter, kRouter } from './constants.ts'
|
|
16
|
+
|
|
17
|
+
export interface AnyRouter {
|
|
18
|
+
contract: TAnyRouterContract
|
|
19
|
+
routes: Record<string, AnyProcedure<any> | AnyRouter>
|
|
20
|
+
guards: Set<AnyGuard>
|
|
21
|
+
middlewares: Set<AnyMiddleware>
|
|
22
|
+
timeout?: number
|
|
23
|
+
[kRouter]: any
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface AnyRootRouter extends AnyRouter {
|
|
27
|
+
[kRootRouter]: any
|
|
28
|
+
contract: TAnyRouterContract<Record<string, TRouteContract>, undefined>
|
|
29
|
+
default?: AnyProcedure<any>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface Router<Contract extends TAnyRouterContract> extends AnyRouter {
|
|
33
|
+
contract: Contract
|
|
34
|
+
routes: {
|
|
35
|
+
[K in keyof Contract['routes']]: Contract['routes'][K] extends TAnyRouterContract
|
|
36
|
+
? Router<Contract['routes'][K]>
|
|
37
|
+
: Contract['routes'][K] extends TAnyProcedureContract
|
|
38
|
+
? AnyProcedure<
|
|
39
|
+
TProcedureContract<
|
|
40
|
+
Contract['routes'][K]['input'],
|
|
41
|
+
Contract['routes'][K]['output'],
|
|
42
|
+
Contract['routes'][K]['stream'],
|
|
43
|
+
Contract['routes'][K]['name']
|
|
44
|
+
>
|
|
45
|
+
>
|
|
46
|
+
: never
|
|
47
|
+
}
|
|
48
|
+
guards: Set<AnyGuard>
|
|
49
|
+
middlewares: Set<AnyMiddleware>
|
|
50
|
+
timeout?: number
|
|
51
|
+
[kRouter]: any
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface RootRouter<
|
|
55
|
+
Contract extends TAnyRouterContract<
|
|
56
|
+
Record<string, TRouteContract>,
|
|
57
|
+
undefined
|
|
58
|
+
>,
|
|
59
|
+
> extends Router<Contract> {
|
|
60
|
+
[kRootRouter]: any
|
|
61
|
+
default?: AnyProcedure<any>
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type MergeRoutersRoutesContracts<
|
|
65
|
+
Routers extends readonly TAnyRouterContract[],
|
|
66
|
+
> = Routers extends [
|
|
67
|
+
infer First extends TAnyRouterContract,
|
|
68
|
+
...infer Rest extends TAnyRouterContract[],
|
|
69
|
+
]
|
|
70
|
+
? {
|
|
71
|
+
[K in keyof First['routes']]: First['routes'][K]
|
|
72
|
+
} & MergeRoutersRoutesContracts<Rest>
|
|
73
|
+
: {}
|
|
74
|
+
|
|
75
|
+
export type ExtractRouterContracts<
|
|
76
|
+
Routers extends readonly { contract: TAnyRouterContract }[],
|
|
77
|
+
> = Routers extends [
|
|
78
|
+
infer First extends { contract: TAnyRouterContract },
|
|
79
|
+
...infer Rest extends { contract: TAnyRouterContract }[],
|
|
80
|
+
]
|
|
81
|
+
? [First['contract'], ...ExtractRouterContracts<Rest>]
|
|
82
|
+
: []
|
|
83
|
+
|
|
84
|
+
export function createRootRouter<Routers extends readonly AnyRouter[]>(
|
|
85
|
+
routers: Routers,
|
|
86
|
+
defaultProcedure?: AnyProcedure<
|
|
87
|
+
TProcedureContract<AnyType, AnyType, true | undefined, string | undefined>
|
|
88
|
+
>,
|
|
89
|
+
): RootRouter<
|
|
90
|
+
TRouterContract<
|
|
91
|
+
MergeRoutersRoutesContracts<ExtractRouterContracts<[...Routers]>>,
|
|
92
|
+
undefined
|
|
93
|
+
>
|
|
94
|
+
> {
|
|
95
|
+
const routes: Record<string, any> = {}
|
|
96
|
+
for (const router of routers) Object.assign(routes, router.routes)
|
|
97
|
+
const router = createRouter({ name: undefined, routes: routes })
|
|
98
|
+
return Object.freeze({
|
|
99
|
+
...router,
|
|
100
|
+
default: defaultProcedure,
|
|
101
|
+
[kRootRouter]: true,
|
|
102
|
+
}) as any
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function createRouter<
|
|
106
|
+
const Options extends {
|
|
107
|
+
name?: string
|
|
108
|
+
routes?: Record<string, AnyProcedure<any> | AnyRouter>
|
|
109
|
+
guards?: AnyGuard[]
|
|
110
|
+
middlewares?: AnyMiddleware[]
|
|
111
|
+
hooks?: Record<string, Callback[]>
|
|
112
|
+
timeout?: number
|
|
113
|
+
},
|
|
114
|
+
>(
|
|
115
|
+
params: Options,
|
|
116
|
+
): Router<
|
|
117
|
+
TRouterContract<
|
|
118
|
+
Options['routes'] extends Record<string, AnyProcedure<any> | AnyRouter>
|
|
119
|
+
? {
|
|
120
|
+
[K in keyof Options['routes']]: Options['routes'][K] extends AnyRouter
|
|
121
|
+
? Options['routes'][K]['contract']
|
|
122
|
+
: Options['routes'][K] extends AnyProcedure<any>
|
|
123
|
+
? Options['routes'][K]['contract']
|
|
124
|
+
: never
|
|
125
|
+
}
|
|
126
|
+
: {},
|
|
127
|
+
null extends Options['name'] ? undefined : Options['name']
|
|
128
|
+
>
|
|
129
|
+
> {
|
|
130
|
+
const { name, guards, middlewares, timeout } = params
|
|
131
|
+
const routes: Record<string, any> = params.routes || {}
|
|
132
|
+
|
|
133
|
+
const routesContracts: any = {}
|
|
134
|
+
for (const [name, route] of Object.entries(routes)) {
|
|
135
|
+
routesContracts[name] = route.contract
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const contract = c.router({ routes: routesContracts, timeout, name })
|
|
139
|
+
|
|
140
|
+
assignRouteContracts(routes, contract)
|
|
141
|
+
|
|
142
|
+
return createContractRouter(contract, {
|
|
143
|
+
routes: routes as any,
|
|
144
|
+
guards,
|
|
145
|
+
middlewares,
|
|
146
|
+
timeout,
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function createContractRouter<Contract extends TAnyRouterContract>(
|
|
151
|
+
contract: Contract,
|
|
152
|
+
params: {
|
|
153
|
+
routes: {
|
|
154
|
+
[K in keyof Contract['routes']]: Contract['routes'][K] extends TAnyRouterContract
|
|
155
|
+
? Router<Contract['routes'][K]>
|
|
156
|
+
: Contract['routes'][K] extends TAnyProcedureContract
|
|
157
|
+
? AnyProcedure<Contract['routes'][K]>
|
|
158
|
+
: never
|
|
159
|
+
}
|
|
160
|
+
guards?: AnyGuard[]
|
|
161
|
+
middlewares?: AnyMiddleware[]
|
|
162
|
+
timeout?: number
|
|
163
|
+
},
|
|
164
|
+
): Router<Contract> {
|
|
165
|
+
const guards = new Set(params.guards ?? [])
|
|
166
|
+
const middlewares = new Set(params.middlewares ?? [])
|
|
167
|
+
|
|
168
|
+
return {
|
|
169
|
+
contract,
|
|
170
|
+
routes: params.routes,
|
|
171
|
+
guards,
|
|
172
|
+
middlewares,
|
|
173
|
+
timeout: params.timeout,
|
|
174
|
+
[kRouter]: true,
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export const isRouter = (value: any): value is AnyRouter =>
|
|
179
|
+
Boolean(value?.[kRouter])
|
|
180
|
+
|
|
181
|
+
export const isRootRouter = (value: any): value is AnyRootRouter =>
|
|
182
|
+
Boolean(value?.[kRootRouter])
|
|
183
|
+
|
|
184
|
+
function assignRouteContracts(
|
|
185
|
+
routes: Record<string, any>,
|
|
186
|
+
contract: TAnyRouterContract,
|
|
187
|
+
) {
|
|
188
|
+
for (const [key, routeContract] of Object.entries(contract.routes)) {
|
|
189
|
+
routes[key] = { ...routes[key], contract: routeContract }
|
|
190
|
+
if (IsRouterContract(routeContract))
|
|
191
|
+
assignRouteContracts(routes[key].routes, routeContract)
|
|
192
|
+
}
|
|
193
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { Container } from '@nmtjs/core'
|
|
2
|
+
import type { GatewayConnection } from '@nmtjs/gateway'
|
|
3
|
+
|
|
4
|
+
import type { AnyProcedure } from './procedure.ts'
|
|
5
|
+
import type { AnyRouter } from './router.ts'
|
|
6
|
+
|
|
7
|
+
export type ApiCallContext = Readonly<{
|
|
8
|
+
connection: GatewayConnection
|
|
9
|
+
container: Container
|
|
10
|
+
path: AnyRouter[]
|
|
11
|
+
procedure: AnyProcedure
|
|
12
|
+
}>
|
|
13
|
+
|
|
14
|
+
export type JsonPrimitive<T> =
|
|
15
|
+
Equal<T, JsonPrimitiveMain<T>> extends true ? T : JsonPrimitiveMain<T>
|
|
16
|
+
|
|
17
|
+
type Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false
|
|
18
|
+
|
|
19
|
+
type JsonPrimitiveMain<
|
|
20
|
+
Instance,
|
|
21
|
+
InArray extends boolean = false,
|
|
22
|
+
> = Instance extends [never]
|
|
23
|
+
? never
|
|
24
|
+
: ValueOf<Instance> extends bigint
|
|
25
|
+
? never
|
|
26
|
+
: ValueOf<Instance> extends boolean | number | string
|
|
27
|
+
? ValueOf<Instance>
|
|
28
|
+
: Instance extends Function
|
|
29
|
+
? InArray extends true
|
|
30
|
+
? null
|
|
31
|
+
: never
|
|
32
|
+
: ValueOf<Instance> extends object
|
|
33
|
+
? Instance extends object
|
|
34
|
+
? Instance extends NativeClass
|
|
35
|
+
? {}
|
|
36
|
+
: Instance extends IJsonable<infer Raw>
|
|
37
|
+
? ValueOf<Raw> extends object
|
|
38
|
+
? Raw extends object
|
|
39
|
+
? PrimitiveObject<Raw>
|
|
40
|
+
: never
|
|
41
|
+
: ValueOf<Raw>
|
|
42
|
+
: PrimitiveObject<Instance>
|
|
43
|
+
: never
|
|
44
|
+
: ValueOf<Instance>
|
|
45
|
+
|
|
46
|
+
type PrimitiveObject<Instance extends object> =
|
|
47
|
+
Instance extends Array<infer T>
|
|
48
|
+
? IsTuple<Instance> extends true
|
|
49
|
+
? PrimitiveTuple<Instance>
|
|
50
|
+
: JsonPrimitiveMain<T, true>[]
|
|
51
|
+
: {
|
|
52
|
+
-readonly [P in keyof Instance as JsonPrimitiveMain<
|
|
53
|
+
Instance[P]
|
|
54
|
+
> extends never
|
|
55
|
+
? never
|
|
56
|
+
: P]: JsonPrimitiveMain<Instance[P]>
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
type PrimitiveTuple<T extends readonly any[]> = T extends []
|
|
60
|
+
? []
|
|
61
|
+
: T extends [infer F]
|
|
62
|
+
? [JsonPrimitiveMain<F, true>]
|
|
63
|
+
: T extends [infer F, ...infer Rest extends readonly any[]]
|
|
64
|
+
? [JsonPrimitiveMain<F, true>, ...PrimitiveTuple<Rest>]
|
|
65
|
+
: T extends [(infer F)?]
|
|
66
|
+
? [JsonPrimitiveMain<F, true>?]
|
|
67
|
+
: T extends [(infer F)?, ...infer Rest extends readonly any[]]
|
|
68
|
+
? [JsonPrimitiveMain<F, true>?, ...PrimitiveTuple<Rest>]
|
|
69
|
+
: []
|
|
70
|
+
|
|
71
|
+
type ValueOf<Instance> =
|
|
72
|
+
IsValueOf<Instance, boolean> extends true
|
|
73
|
+
? boolean
|
|
74
|
+
: IsValueOf<Instance, number> extends true
|
|
75
|
+
? number
|
|
76
|
+
: IsValueOf<Instance, string> extends true
|
|
77
|
+
? string
|
|
78
|
+
: Instance
|
|
79
|
+
|
|
80
|
+
type NativeClass =
|
|
81
|
+
| Set<any>
|
|
82
|
+
| Map<any, any>
|
|
83
|
+
| WeakSet<any>
|
|
84
|
+
| WeakMap<any, any>
|
|
85
|
+
| Uint8Array
|
|
86
|
+
| Uint8ClampedArray
|
|
87
|
+
| Uint16Array
|
|
88
|
+
| Uint32Array
|
|
89
|
+
| BigUint64Array
|
|
90
|
+
| Int8Array
|
|
91
|
+
| Int16Array
|
|
92
|
+
| Int32Array
|
|
93
|
+
| BigInt64Array
|
|
94
|
+
| Float32Array
|
|
95
|
+
| Float64Array
|
|
96
|
+
| ArrayBuffer
|
|
97
|
+
| SharedArrayBuffer
|
|
98
|
+
| DataView
|
|
99
|
+
|
|
100
|
+
type IsTuple<T extends readonly any[] | { length: number }> = [T] extends [
|
|
101
|
+
never,
|
|
102
|
+
]
|
|
103
|
+
? false
|
|
104
|
+
: T extends readonly any[]
|
|
105
|
+
? number extends T['length']
|
|
106
|
+
? false
|
|
107
|
+
: true
|
|
108
|
+
: false
|
|
109
|
+
|
|
110
|
+
type IsValueOf<Instance, Object extends IValueOf<any>> = Instance extends Object
|
|
111
|
+
? Object extends IValueOf<infer U>
|
|
112
|
+
? Instance extends U
|
|
113
|
+
? false
|
|
114
|
+
: true
|
|
115
|
+
: false
|
|
116
|
+
: false
|
|
117
|
+
|
|
118
|
+
interface IValueOf<T> {
|
|
119
|
+
valueOf(): T
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
interface IJsonable<T> {
|
|
123
|
+
toJSON(): T
|
|
124
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ConnectionIdentity, Transport } from '@nmtjs/gateway'
|
|
2
|
+
|
|
3
|
+
import type { LifecycleHooks } from '../core/hooks.ts'
|
|
4
|
+
import type { RuntimePlugin } from '../core/plugin.ts'
|
|
5
|
+
import type { ApiOptions } from './api/api.ts'
|
|
6
|
+
import type { AnyFilter } from './api/filters.ts'
|
|
7
|
+
import type { AnyGuard } from './api/guards.ts'
|
|
8
|
+
import type { AnyMiddleware } from './api/middlewares.ts'
|
|
9
|
+
import type { AnyRootRouter } from './api/router.ts'
|
|
10
|
+
import type { AnyHook } from './hook.ts'
|
|
11
|
+
import { kApplicationConfig } from './constants.ts'
|
|
12
|
+
|
|
13
|
+
export type AnyApplicationConfig = ApplicationConfig<AnyRootRouter>
|
|
14
|
+
|
|
15
|
+
export interface ApplicationConfig<
|
|
16
|
+
Router extends AnyRootRouter = AnyRootRouter,
|
|
17
|
+
Transports extends Record<string, Transport> = Record<string, Transport>,
|
|
18
|
+
> {
|
|
19
|
+
[kApplicationConfig]: any
|
|
20
|
+
router: Router
|
|
21
|
+
api: Pick<ApiOptions, 'timeout'>
|
|
22
|
+
transports: Transports
|
|
23
|
+
identity?: ConnectionIdentity
|
|
24
|
+
plugins: RuntimePlugin[]
|
|
25
|
+
filters: AnyFilter[]
|
|
26
|
+
middlewares: AnyMiddleware[]
|
|
27
|
+
guards: AnyGuard[]
|
|
28
|
+
hooks: AnyHook[]
|
|
29
|
+
lifecycleHooks: LifecycleHooks['_']['config']
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function defineApplication<
|
|
33
|
+
R extends AnyRootRouter,
|
|
34
|
+
T extends Record<string, Transport> = Record<string, Transport>,
|
|
35
|
+
>(
|
|
36
|
+
options: Pick<ApplicationConfig<R, T>, 'router'> &
|
|
37
|
+
Partial<Omit<ApplicationConfig<R, T>, 'router'>>,
|
|
38
|
+
) {
|
|
39
|
+
const {
|
|
40
|
+
router,
|
|
41
|
+
transports = {},
|
|
42
|
+
guards = [],
|
|
43
|
+
middlewares = [],
|
|
44
|
+
plugins = [],
|
|
45
|
+
api = {} as ApplicationConfig['api'],
|
|
46
|
+
filters = [] as ApplicationConfig['filters'],
|
|
47
|
+
hooks = [] as ApplicationConfig['hooks'],
|
|
48
|
+
lifecycleHooks = {},
|
|
49
|
+
identity: identityResolver,
|
|
50
|
+
} = options
|
|
51
|
+
|
|
52
|
+
return Object.freeze({
|
|
53
|
+
[kApplicationConfig]: true,
|
|
54
|
+
router,
|
|
55
|
+
transports,
|
|
56
|
+
api,
|
|
57
|
+
filters,
|
|
58
|
+
plugins,
|
|
59
|
+
guards,
|
|
60
|
+
middlewares,
|
|
61
|
+
hooks,
|
|
62
|
+
lifecycleHooks,
|
|
63
|
+
identity: identityResolver,
|
|
64
|
+
} satisfies AnyApplicationConfig) as ApplicationConfig<R, T>
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function isApplicationConfig(value: any): value is ApplicationConfig {
|
|
68
|
+
return Boolean(value?.[kApplicationConfig])
|
|
69
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { MaybePromise } from '@nmtjs/common'
|
|
2
|
+
import type {
|
|
3
|
+
Dependant,
|
|
4
|
+
Dependencies,
|
|
5
|
+
DependencyContext,
|
|
6
|
+
HookTypes,
|
|
7
|
+
} from '@nmtjs/core'
|
|
8
|
+
import { kHook } from '@nmtjs/core'
|
|
9
|
+
|
|
10
|
+
export type AnyHook = Hook<HookTypes, string, any>
|
|
11
|
+
|
|
12
|
+
export interface Hook<
|
|
13
|
+
T extends HookTypes = HookTypes,
|
|
14
|
+
H extends string = string,
|
|
15
|
+
Deps extends Dependencies = {},
|
|
16
|
+
> extends Dependant<Deps> {
|
|
17
|
+
[kHook]: any
|
|
18
|
+
name: H
|
|
19
|
+
handler: (
|
|
20
|
+
ctx: DependencyContext<Deps>,
|
|
21
|
+
...args: H extends keyof T ? Parameters<T[H]> : unknown[]
|
|
22
|
+
) => MaybePromise<any>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function createHook<
|
|
26
|
+
Types extends HookTypes = HookTypes,
|
|
27
|
+
Name extends Extract<keyof Types, string> | (object & string) = object &
|
|
28
|
+
string,
|
|
29
|
+
Deps extends Dependencies = {},
|
|
30
|
+
>(params: {
|
|
31
|
+
name: Name
|
|
32
|
+
dependencies?: Deps
|
|
33
|
+
handler: Hook<Types, Name, Deps>['handler']
|
|
34
|
+
}): Hook<Types, Name, Deps> {
|
|
35
|
+
const { name, handler, dependencies = {} as Deps } = params
|
|
36
|
+
return Object.freeze({ [kHook]: true, name, handler, dependencies }) as any
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function createApplicationHookFactory<Types extends HookTypes>() {
|
|
40
|
+
return <
|
|
41
|
+
Name extends Extract<keyof Types, string> | (object & string) = object &
|
|
42
|
+
string,
|
|
43
|
+
Deps extends Dependencies = {},
|
|
44
|
+
>(params: {
|
|
45
|
+
name: Name
|
|
46
|
+
dependencies?: Deps
|
|
47
|
+
handler: Hook<Types, Name, Deps>['handler']
|
|
48
|
+
}): Hook<Types, Name, Deps> => {
|
|
49
|
+
return createHook<Types, Name, Deps>(params)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const kServerConfig: unique symbol = Symbol.for(
|
|
2
|
+
'neemata:ServerConfigKey',
|
|
3
|
+
)
|
|
4
|
+
export type kServerConfig = typeof kServerConfig
|
|
5
|
+
|
|
6
|
+
export const kCommand: unique symbol = Symbol.for('neemata:CommandKey')
|
|
7
|
+
export type kCommand = typeof kCommand
|
|
8
|
+
|
|
9
|
+
export const kJobKey: unique symbol = Symbol.for('neemata:JobKey')
|
|
10
|
+
export type kJobKey = typeof kJobKey
|
|
11
|
+
|
|
12
|
+
export const kJobStepKey: unique symbol = Symbol.for('neemata:JobStepKey')
|
|
13
|
+
export type kJobStepKey = typeof kJobStepKey
|