@nmtjs/contract
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -1,4 +0,3 @@ | ||
import { createSchema } from "../utils.js"; | ||
export const ProcedureContract = (input, output, timeout, schemaOptions = {})=>{ | ||
return createSchema({ | ||
return { | ||
...schemaOptions, | ||
@@ -12,3 +11,3 @@ type: 'neemata:procedure', | ||
transports: undefined | ||
}); | ||
}; | ||
}; |
import { createSchema } from "../utils.js"; | ||
export const SubscriptionContract = (input, output, events, timeout, schemaOptions = {})=>{ | ||
return ()=>createSchema({ | ||
...schemaOptions, | ||
type: 'neemata:subscription', | ||
input, | ||
output, | ||
events, | ||
timeout, | ||
options: undefined, | ||
name: undefined, | ||
serviceName: undefined, | ||
transports: undefined | ||
}); | ||
return { | ||
$withOptions: ()=>createSchema({ | ||
...schemaOptions, | ||
type: 'neemata:subscription', | ||
input, | ||
output, | ||
events, | ||
timeout, | ||
options: undefined, | ||
name: undefined, | ||
serviceName: undefined, | ||
transports: undefined | ||
}) | ||
}; | ||
}; |
@@ -12,8 +12,8 @@ { | ||
"peerDependencies": { | ||
"@nmtjs/common": "0.2.1", | ||
"@nmtjs/type": "0.2.1" | ||
"@nmtjs/type": "0.3.0", | ||
"@nmtjs/common": "0.3.0" | ||
}, | ||
"devDependencies": { | ||
"@nmtjs/type": "0.2.1", | ||
"@nmtjs/common": "0.2.1" | ||
"@nmtjs/type": "0.3.0", | ||
"@nmtjs/common": "0.3.0" | ||
}, | ||
@@ -27,3 +27,3 @@ "files": [ | ||
], | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"scripts": { | ||
@@ -30,0 +30,0 @@ "build": "neemata-build -p neutral --root=./src './**/*.ts'", |
@@ -1,2 +0,1 @@ | ||
import { t as baseT } from '@nmtjs/type' | ||
import { EventContract, type TEventContract } from './schemas/event.ts' | ||
@@ -11,2 +10,3 @@ | ||
import { | ||
type SubcriptionOptions, | ||
SubscriptionContract, | ||
@@ -23,2 +23,3 @@ type TSubscriptionContract, | ||
TSubscriptionContract, | ||
SubcriptionOptions, | ||
} | ||
@@ -25,0 +26,0 @@ |
@@ -48,4 +48,4 @@ import type { BaseType } from '@nmtjs/type' | ||
schemaOptions: ContractSchemaOptions = {} as ContractSchemaOptions, | ||
) => { | ||
return createSchema<TProcedureContract<Input, Output>>({ | ||
): TProcedureContract<Input, Output> => { | ||
return { | ||
...schemaOptions, | ||
@@ -59,3 +59,3 @@ type: 'neemata:procedure', | ||
transports: undefined, | ||
}) | ||
} | ||
} |
@@ -6,3 +6,3 @@ import type { BaseType } from '@nmtjs/type' | ||
export type TSubcriptionOptions = Record<string, string | number> | ||
export type SubcriptionOptions = Record<string, string | number> | ||
@@ -12,3 +12,3 @@ export interface TSubscriptionContract< | ||
Output extends BaseType = BaseType, | ||
Options extends TSubcriptionOptions = TSubcriptionOptions, | ||
Options extends SubcriptionOptions = SubcriptionOptions, | ||
Events extends Record<string, TEventContract> = Record< | ||
@@ -49,15 +49,17 @@ string, | ||
) => { | ||
return <Options extends TSubcriptionOptions>() => | ||
createSchema<TSubscriptionContract<Input, Output, Options, Events>>({ | ||
...schemaOptions, | ||
type: 'neemata:subscription', | ||
input, | ||
output, | ||
events, | ||
timeout, | ||
options: undefined as unknown as Options, | ||
name: undefined, | ||
serviceName: undefined, | ||
transports: undefined, | ||
}) | ||
return { | ||
$withOptions: <Options extends SubcriptionOptions>() => | ||
createSchema<TSubscriptionContract<Input, Output, Options, Events>>({ | ||
...schemaOptions, | ||
type: 'neemata:subscription', | ||
input, | ||
output, | ||
events, | ||
timeout, | ||
options: undefined as unknown as Options, | ||
name: undefined, | ||
serviceName: undefined, | ||
transports: undefined, | ||
}), | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29210
448