nmtjs 0.16.0-beta.4 → 0.16.0-beta.5
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/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare namespace neemata {
|
|
|
27
27
|
rpcStreamAbortSignal: import("@nmtjs/core").DependencyOptional<import("@nmtjs/core").LazyInjectable<AbortSignal, import("@nmtjs/core").Scope.Call>>;
|
|
28
28
|
}, import("@nmtjs/core").Scope.Global, AbortSignal>;
|
|
29
29
|
createBlob: import("@nmtjs/core").LazyInjectable<(source: string | ArrayBuffer | Blob | File | import("stream").Readable | ReadableStream<any> | Uint8Array<ArrayBufferLike>, metadata?: import("@nmtjs/protocol").ProtocolBlobMetadata | undefined) => import("@nmtjs/protocol").ProtocolBlobInterface, import("@nmtjs/core").Scope.Call>;
|
|
30
|
+
consumeBlob: import("@nmtjs/core").LazyInjectable<(blob: import("@nmtjs/protocol").ProtocolBlobInterface) => import("@nmtjs/protocol/server").ProtocolClientStream, import("@nmtjs/core").Scope.Call>;
|
|
30
31
|
subscriptionAdapter: import("@nmtjs/core").LazyInjectable<import("./runtime/index.ts").SubscriptionAdapterType, import("@nmtjs/core").Scope.Global>;
|
|
31
32
|
publish: import("@nmtjs/core").LazyInjectable<import("./runtime/index.ts").PublishFn, import("@nmtjs/core").Scope.Global>;
|
|
32
33
|
subscribe: import("@nmtjs/core").LazyInjectable<import("./runtime/index.ts").SubscribeFn, import("@nmtjs/core").Scope.Global>;
|
|
@@ -61,6 +62,7 @@ export declare namespace neemata {
|
|
|
61
62
|
rpcStreamAbortSignal: import("@nmtjs/core").DependencyOptional<import("@nmtjs/core").LazyInjectable<AbortSignal, import("@nmtjs/core").Scope.Call>>;
|
|
62
63
|
}, import("@nmtjs/core").Scope.Global, AbortSignal>;
|
|
63
64
|
createBlob: import("@nmtjs/core").LazyInjectable<(source: string | ArrayBuffer | Blob | File | import("stream").Readable | ReadableStream<any> | Uint8Array<ArrayBufferLike>, metadata?: import("@nmtjs/protocol").ProtocolBlobMetadata | undefined) => import("@nmtjs/protocol").ProtocolBlobInterface, import("@nmtjs/core").Scope.Call>;
|
|
65
|
+
consumeBlob: import("@nmtjs/core").LazyInjectable<(blob: import("@nmtjs/protocol").ProtocolBlobInterface) => import("@nmtjs/protocol/server").ProtocolClientStream, import("@nmtjs/core").Scope.Call>;
|
|
64
66
|
subscriptionAdapter: import("@nmtjs/core").LazyInjectable<import("./runtime/index.ts").SubscriptionAdapterType, import("@nmtjs/core").Scope.Global>;
|
|
65
67
|
publish: import("@nmtjs/core").LazyInjectable<import("./runtime/index.ts").PublishFn, import("@nmtjs/core").Scope.Global>;
|
|
66
68
|
subscribe: import("@nmtjs/core").LazyInjectable<import("./runtime/index.ts").SubscribeFn, import("@nmtjs/core").Scope.Global>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { MaybePromise } from '@nmtjs/common';
|
|
2
2
|
import type { TAnyProcedureContract, TProcedureContract } from '@nmtjs/contract';
|
|
3
3
|
import type { Dependant, Dependencies, DependencyContext, Metadata } from '@nmtjs/core';
|
|
4
|
-
import type { InputType } from '@nmtjs/protocol/server';
|
|
5
4
|
import type { BaseType } from '@nmtjs/type';
|
|
6
5
|
import type * as zod from 'zod/mini';
|
|
7
6
|
import { MetadataStore } from '@nmtjs/core';
|
|
@@ -22,7 +21,7 @@ export interface BaseProcedure<ProcedureContract extends TAnyProcedureContract,
|
|
|
22
21
|
}
|
|
23
22
|
export type ProcedureHandlerType<Input, Output, Deps extends Dependencies> = (ctx: DependencyContext<Deps>, data: Input) => MaybePromise<Output>;
|
|
24
23
|
export interface Procedure<ProcedureContract extends TAnyProcedureContract, ProcedureDeps extends Dependencies> extends BaseProcedure<ProcedureContract, ProcedureDeps> {
|
|
25
|
-
handler: ProcedureHandlerType<
|
|
24
|
+
handler: ProcedureHandlerType<t.infer.decode.output<ProcedureContract['input']>, ProcedureContract['stream'] extends true ? AsyncIterable<t.infer.encode.input<ProcedureContract['output']>> : t.infer.encode.input<ProcedureContract['output']>, ProcedureDeps>;
|
|
26
25
|
}
|
|
27
26
|
export type AnyProcedure<Contract extends TAnyProcedureContract = TAnyProcedureContract> = BaseProcedure<Contract, Dependencies>;
|
|
28
27
|
export type CreateProcedureParams<ProcedureContract extends TAnyProcedureContract, ProcedureDeps extends Dependencies> = {
|
|
@@ -31,8 +30,8 @@ export type CreateProcedureParams<ProcedureContract extends TAnyProcedureContrac
|
|
|
31
30
|
middlewares?: AnyMiddleware[];
|
|
32
31
|
metadata?: Metadata[];
|
|
33
32
|
streamTimeout?: number;
|
|
34
|
-
handler: ProcedureHandlerType<
|
|
35
|
-
} | ProcedureHandlerType<
|
|
33
|
+
handler: ProcedureHandlerType<t.infer.decode.output<ProcedureContract['input']>, ProcedureContract['stream'] extends undefined ? t.infer.encode.input<ProcedureContract['output']> : AsyncIterable<Exclude<ProcedureContract['stream'], undefined | boolean>>, ProcedureDeps>;
|
|
34
|
+
} | ProcedureHandlerType<t.infer.decode.output<ProcedureContract['input']>, ProcedureContract['stream'] extends undefined ? t.infer.decode.input<ProcedureContract['output']> : AsyncIterable<Exclude<ProcedureContract['stream'], undefined | boolean>>, ProcedureDeps>;
|
|
36
35
|
export declare function _createBaseProcedure<ProcedureContract extends TAnyProcedureContract, ProcedureDeps extends Dependencies>(contract: ProcedureContract, params: {
|
|
37
36
|
dependencies?: ProcedureDeps;
|
|
38
37
|
middlewares?: AnyMiddleware[];
|
|
@@ -62,6 +61,6 @@ export declare function createProcedure<Return, TInput extends BaseType | undefi
|
|
|
62
61
|
middlewares?: AnyMiddleware[];
|
|
63
62
|
metadata?: Metadata[];
|
|
64
63
|
timeout?: number;
|
|
65
|
-
handler: ProcedureHandlerType<TInput extends BaseType ?
|
|
66
|
-
} | ProcedureHandlerType<TInput extends BaseType ?
|
|
64
|
+
handler: ProcedureHandlerType<TInput extends BaseType ? t.infer.decode.output<TInput> : never, TStream extends true | number ? AsyncIterable<TOutput extends BaseType ? t.infer.encode.input<TOutput> : Return> : TOutput extends BaseType ? t.infer.encode.input<TOutput> : Return, Deps>;
|
|
65
|
+
} | ProcedureHandlerType<TInput extends BaseType ? t.infer.decode.output<TInput> : never, Return, Deps>): Procedure<TProcedureContract<TInput extends undefined ? t.NeverType : TInput, TOutput extends undefined ? t.CustomType<JsonPrimitive<Return>, zod.ZodMiniCustom<JsonPrimitive<Return>, JsonPrimitive<Return>>> : TOutput, TStream extends true | number ? true : undefined>, Deps>;
|
|
67
66
|
export declare const isProcedure: (value: any) => value is AnyProcedure<TAnyProcedureContract>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"procedure.js","sourceRoot":"","sources":["../../../../src/runtime/application/api/procedure.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"procedure.js","sourceRoot":"","sources":["../../../../src/runtime/application/api/procedure.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAA;AAK/B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAoE3C,MAAM,UAAU,oBAAoB,CAIlC,QAA2B,EAC3B,MAMC,EACD;IACA,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,IAAK,EAAoB,CAAA;IACjE,MAAM,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAA;IACpC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC,CAAA;IACrD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAA;IAC3C,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,CAAA;IAE1C,IAAI,OAAO,aAAa,KAAK,WAAW,IAAI,aAAa,IAAI,CAAC,EAAE,CAAC;QAC/D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C,EAC/C;QACE,YAAY;QACZ,OAAO,EAAE,OAAc;QACvB,MAAM;QACN,WAAW;QACX,QAAQ;QACR,aAAa,EAAE,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;KAC/D,CACF,CAAA;AAAA,CACF;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAU,EAAyB,EAAE,CAC/D,OAAO,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -47,16 +47,16 @@
|
|
|
47
47
|
"oxc-resolver": "11.19.1",
|
|
48
48
|
"prom-client": "git@github.com:siimon/prom-client.git#d4d2dcb366384833951e0116caca707b5f62aa5e",
|
|
49
49
|
"vite": "8.0.3",
|
|
50
|
-
"@nmtjs/
|
|
51
|
-
"@nmtjs/core": "0.16.0-beta.
|
|
52
|
-
"@nmtjs/
|
|
53
|
-
"@nmtjs/http-transport": "0.16.0-beta.
|
|
54
|
-
"@nmtjs/json-format": "0.16.0-beta.
|
|
55
|
-
"@nmtjs/
|
|
56
|
-
"@nmtjs/
|
|
57
|
-
"@nmtjs/
|
|
58
|
-
"@nmtjs/ws-transport": "0.16.0-beta.
|
|
59
|
-
"@nmtjs/type": "0.16.0-beta.
|
|
50
|
+
"@nmtjs/contract": "0.16.0-beta.5",
|
|
51
|
+
"@nmtjs/core": "0.16.0-beta.5",
|
|
52
|
+
"@nmtjs/common": "0.16.0-beta.5",
|
|
53
|
+
"@nmtjs/http-transport": "0.16.0-beta.5",
|
|
54
|
+
"@nmtjs/json-format": "0.16.0-beta.5",
|
|
55
|
+
"@nmtjs/gateway": "0.16.0-beta.5",
|
|
56
|
+
"@nmtjs/protocol": "0.16.0-beta.5",
|
|
57
|
+
"@nmtjs/msgpack-format": "0.16.0-beta.5",
|
|
58
|
+
"@nmtjs/ws-transport": "0.16.0-beta.5",
|
|
59
|
+
"@nmtjs/type": "0.16.0-beta.5"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@nmtjs/proxy": "1.0.0-beta.4",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"LICENSE.md",
|
|
80
80
|
"README.md"
|
|
81
81
|
],
|
|
82
|
-
"version": "0.16.0-beta.
|
|
82
|
+
"version": "0.16.0-beta.5",
|
|
83
83
|
"scripts": {
|
|
84
84
|
"clean-build": "rm -rf ./dist"
|
|
85
85
|
}
|
|
@@ -6,7 +6,6 @@ import type {
|
|
|
6
6
|
DependencyContext,
|
|
7
7
|
Metadata,
|
|
8
8
|
} from '@nmtjs/core'
|
|
9
|
-
import type { InputType } from '@nmtjs/protocol/server'
|
|
10
9
|
import type { BaseType } from '@nmtjs/type'
|
|
11
10
|
import type * as zod from 'zod/mini'
|
|
12
11
|
import { c } from '@nmtjs/contract'
|
|
@@ -42,7 +41,7 @@ export interface Procedure<
|
|
|
42
41
|
ProcedureDeps extends Dependencies,
|
|
43
42
|
> extends BaseProcedure<ProcedureContract, ProcedureDeps> {
|
|
44
43
|
handler: ProcedureHandlerType<
|
|
45
|
-
|
|
44
|
+
t.infer.decode.output<ProcedureContract['input']>,
|
|
46
45
|
ProcedureContract['stream'] extends true
|
|
47
46
|
? AsyncIterable<t.infer.encode.input<ProcedureContract['output']>>
|
|
48
47
|
: t.infer.encode.input<ProcedureContract['output']>,
|
|
@@ -65,7 +64,7 @@ export type CreateProcedureParams<
|
|
|
65
64
|
metadata?: Metadata[]
|
|
66
65
|
streamTimeout?: number
|
|
67
66
|
handler: ProcedureHandlerType<
|
|
68
|
-
|
|
67
|
+
t.infer.decode.output<ProcedureContract['input']>,
|
|
69
68
|
ProcedureContract['stream'] extends undefined
|
|
70
69
|
? t.infer.encode.input<ProcedureContract['output']>
|
|
71
70
|
: AsyncIterable<
|
|
@@ -75,7 +74,7 @@ export type CreateProcedureParams<
|
|
|
75
74
|
>
|
|
76
75
|
}
|
|
77
76
|
| ProcedureHandlerType<
|
|
78
|
-
|
|
77
|
+
t.infer.decode.output<ProcedureContract['input']>,
|
|
79
78
|
ProcedureContract['stream'] extends undefined
|
|
80
79
|
? t.infer.decode.input<ProcedureContract['output']>
|
|
81
80
|
: AsyncIterable<
|
|
@@ -164,9 +163,7 @@ export function createProcedure<
|
|
|
164
163
|
metadata?: Metadata[]
|
|
165
164
|
timeout?: number
|
|
166
165
|
handler: ProcedureHandlerType<
|
|
167
|
-
TInput extends BaseType
|
|
168
|
-
? InputType<t.infer.decodeRaw.output<TInput>>
|
|
169
|
-
: never,
|
|
166
|
+
TInput extends BaseType ? t.infer.decode.output<TInput> : never,
|
|
170
167
|
TStream extends true | number
|
|
171
168
|
? AsyncIterable<
|
|
172
169
|
TOutput extends BaseType
|
|
@@ -180,9 +177,7 @@ export function createProcedure<
|
|
|
180
177
|
>
|
|
181
178
|
}
|
|
182
179
|
| ProcedureHandlerType<
|
|
183
|
-
TInput extends BaseType
|
|
184
|
-
? InputType<t.infer.decodeRaw.output<TInput>>
|
|
185
|
-
: never,
|
|
180
|
+
TInput extends BaseType ? t.infer.decode.output<TInput> : never,
|
|
186
181
|
Return,
|
|
187
182
|
Deps
|
|
188
183
|
>,
|