nmtjs 0.16.0 → 0.17.0-beta.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.
Files changed (224) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +41 -1
  3. package/dist/index.d.ts +22 -121
  4. package/dist/index.js +24 -53
  5. package/dist/index.js.map +1 -1
  6. package/package.json +11 -63
  7. package/src/index.ts +71 -91
  8. package/bin/cli.js +0 -2
  9. package/dist/cli.d.ts +0 -1
  10. package/dist/cli.js +0 -137
  11. package/dist/cli.js.map +0 -1
  12. package/dist/codegen.d.ts +0 -5
  13. package/dist/codegen.js +0 -18
  14. package/dist/codegen.js.map +0 -1
  15. package/dist/config.d.ts +0 -47
  16. package/dist/config.js +0 -16
  17. package/dist/config.js.map +0 -1
  18. package/dist/entrypoints/cli.d.ts +0 -1
  19. package/dist/entrypoints/cli.js +0 -12
  20. package/dist/entrypoints/cli.js.map +0 -1
  21. package/dist/entrypoints/main.d.ts +0 -5
  22. package/dist/entrypoints/main.js +0 -248
  23. package/dist/entrypoints/main.js.map +0 -1
  24. package/dist/entrypoints/thread.d.ts +0 -16
  25. package/dist/entrypoints/thread.js +0 -182
  26. package/dist/entrypoints/thread.js.map +0 -1
  27. package/dist/entrypoints/worker.d.ts +0 -9
  28. package/dist/entrypoints/worker.js +0 -143
  29. package/dist/entrypoints/worker.js.map +0 -1
  30. package/dist/resolver.d.ts +0 -2
  31. package/dist/resolver.js +0 -7
  32. package/dist/resolver.js.map +0 -1
  33. package/dist/runtime/application/index.d.ts +0 -1
  34. package/dist/runtime/application/index.js +0 -2
  35. package/dist/runtime/application/index.js.map +0 -1
  36. package/dist/runtime/constants.d.ts +0 -8
  37. package/dist/runtime/constants.js +0 -5
  38. package/dist/runtime/constants.js.map +0 -1
  39. package/dist/runtime/enums.d.ts +0 -10
  40. package/dist/runtime/enums.js +0 -13
  41. package/dist/runtime/enums.js.map +0 -1
  42. package/dist/runtime/hooks.d.ts +0 -1
  43. package/dist/runtime/hooks.js +0 -2
  44. package/dist/runtime/hooks.js.map +0 -1
  45. package/dist/runtime/index.d.ts +0 -28
  46. package/dist/runtime/index.js +0 -29
  47. package/dist/runtime/index.js.map +0 -1
  48. package/dist/runtime/injectables.d.ts +0 -28
  49. package/dist/runtime/injectables.js +0 -24
  50. package/dist/runtime/injectables.js.map +0 -1
  51. package/dist/runtime/jobs/job.d.ts +0 -146
  52. package/dist/runtime/jobs/job.js +0 -89
  53. package/dist/runtime/jobs/job.js.map +0 -1
  54. package/dist/runtime/jobs/manager.d.ts +0 -131
  55. package/dist/runtime/jobs/manager.js +0 -309
  56. package/dist/runtime/jobs/manager.js.map +0 -1
  57. package/dist/runtime/jobs/router.d.ts +0 -296
  58. package/dist/runtime/jobs/router.js +0 -458
  59. package/dist/runtime/jobs/router.js.map +0 -1
  60. package/dist/runtime/jobs/runner.d.ts +0 -103
  61. package/dist/runtime/jobs/runner.js +0 -425
  62. package/dist/runtime/jobs/runner.js.map +0 -1
  63. package/dist/runtime/jobs/step.d.ts +0 -26
  64. package/dist/runtime/jobs/step.js +0 -18
  65. package/dist/runtime/jobs/step.js.map +0 -1
  66. package/dist/runtime/jobs/types.d.ts +0 -86
  67. package/dist/runtime/jobs/types.js +0 -5
  68. package/dist/runtime/jobs/types.js.map +0 -1
  69. package/dist/runtime/metrics/metric.d.ts +0 -8
  70. package/dist/runtime/metrics/metric.js +0 -11
  71. package/dist/runtime/metrics/metric.js.map +0 -1
  72. package/dist/runtime/metrics/registry.d.ts +0 -3
  73. package/dist/runtime/metrics/registry.js +0 -5
  74. package/dist/runtime/metrics/registry.js.map +0 -1
  75. package/dist/runtime/metrics/server.d.ts +0 -7
  76. package/dist/runtime/metrics/server.js +0 -53
  77. package/dist/runtime/metrics/server.js.map +0 -1
  78. package/dist/runtime/plugin.d.ts +0 -2
  79. package/dist/runtime/plugin.js +0 -2
  80. package/dist/runtime/plugin.js.map +0 -1
  81. package/dist/runtime/runtime.d.ts +0 -27
  82. package/dist/runtime/runtime.js +0 -77
  83. package/dist/runtime/runtime.js.map +0 -1
  84. package/dist/runtime/scheduler/index.d.ts +0 -22
  85. package/dist/runtime/scheduler/index.js +0 -20
  86. package/dist/runtime/scheduler/index.js.map +0 -1
  87. package/dist/runtime/server/applications.d.ts +0 -91
  88. package/dist/runtime/server/applications.js +0 -171
  89. package/dist/runtime/server/applications.js.map +0 -1
  90. package/dist/runtime/server/config.d.ts +0 -148
  91. package/dist/runtime/server/config.js +0 -33
  92. package/dist/runtime/server/config.js.map +0 -1
  93. package/dist/runtime/server/environment.d.ts +0 -43
  94. package/dist/runtime/server/environment.js +0 -33
  95. package/dist/runtime/server/environment.js.map +0 -1
  96. package/dist/runtime/server/error-policy.d.ts +0 -62
  97. package/dist/runtime/server/error-policy.js +0 -73
  98. package/dist/runtime/server/error-policy.js.map +0 -1
  99. package/dist/runtime/server/hmr-coordinator.d.ts +0 -37
  100. package/dist/runtime/server/hmr-coordinator.js +0 -94
  101. package/dist/runtime/server/hmr-coordinator.js.map +0 -1
  102. package/dist/runtime/server/jobs.d.ts +0 -54
  103. package/dist/runtime/server/jobs.js +0 -176
  104. package/dist/runtime/server/jobs.js.map +0 -1
  105. package/dist/runtime/server/lifecycle.d.ts +0 -85
  106. package/dist/runtime/server/lifecycle.js +0 -177
  107. package/dist/runtime/server/lifecycle.js.map +0 -1
  108. package/dist/runtime/server/managed-worker.d.ts +0 -158
  109. package/dist/runtime/server/managed-worker.js +0 -420
  110. package/dist/runtime/server/managed-worker.js.map +0 -1
  111. package/dist/runtime/server/pool-manager.d.ts +0 -85
  112. package/dist/runtime/server/pool-manager.js +0 -129
  113. package/dist/runtime/server/pool-manager.js.map +0 -1
  114. package/dist/runtime/server/proxy.d.ts +0 -21
  115. package/dist/runtime/server/proxy.js +0 -76
  116. package/dist/runtime/server/proxy.js.map +0 -1
  117. package/dist/runtime/server/server.d.ts +0 -60
  118. package/dist/runtime/server/server.js +0 -163
  119. package/dist/runtime/server/server.js.map +0 -1
  120. package/dist/runtime/server/types.d.ts +0 -31
  121. package/dist/runtime/server/types.js +0 -2
  122. package/dist/runtime/server/types.js.map +0 -1
  123. package/dist/runtime/server/worker-pool.d.ts +0 -121
  124. package/dist/runtime/server/worker-pool.js +0 -171
  125. package/dist/runtime/server/worker-pool.js.map +0 -1
  126. package/dist/runtime/store/index.d.ts +0 -3
  127. package/dist/runtime/store/index.js +0 -23
  128. package/dist/runtime/store/index.js.map +0 -1
  129. package/dist/runtime/subscription/manager.d.ts +0 -49
  130. package/dist/runtime/subscription/manager.js +0 -170
  131. package/dist/runtime/subscription/manager.js.map +0 -1
  132. package/dist/runtime/subscription/redis.d.ts +0 -18
  133. package/dist/runtime/subscription/redis.js +0 -120
  134. package/dist/runtime/subscription/redis.js.map +0 -1
  135. package/dist/runtime/types.d.ts +0 -95
  136. package/dist/runtime/types.js +0 -2
  137. package/dist/runtime/types.js.map +0 -1
  138. package/dist/runtime/workers/application.d.ts +0 -29
  139. package/dist/runtime/workers/application.js +0 -77
  140. package/dist/runtime/workers/application.js.map +0 -1
  141. package/dist/runtime/workers/base.d.ts +0 -16
  142. package/dist/runtime/workers/base.js +0 -46
  143. package/dist/runtime/workers/base.js.map +0 -1
  144. package/dist/runtime/workers/cli.d.ts +0 -1
  145. package/dist/runtime/workers/cli.js +0 -2
  146. package/dist/runtime/workers/cli.js.map +0 -1
  147. package/dist/runtime/workers/job.d.ts +0 -20
  148. package/dist/runtime/workers/job.js +0 -170
  149. package/dist/runtime/workers/job.js.map +0 -1
  150. package/dist/vite/builder.d.ts +0 -5
  151. package/dist/vite/builder.js +0 -79
  152. package/dist/vite/builder.js.map +0 -1
  153. package/dist/vite/config.d.ts +0 -28
  154. package/dist/vite/config.js +0 -22
  155. package/dist/vite/config.js.map +0 -1
  156. package/dist/vite/plugins.d.ts +0 -2
  157. package/dist/vite/plugins.js +0 -43
  158. package/dist/vite/plugins.js.map +0 -1
  159. package/dist/vite/runners/worker.d.ts +0 -3
  160. package/dist/vite/runners/worker.js +0 -34
  161. package/dist/vite/runners/worker.js.map +0 -1
  162. package/dist/vite/server.d.ts +0 -3
  163. package/dist/vite/server.js +0 -36
  164. package/dist/vite/server.js.map +0 -1
  165. package/dist/vite/servers/main.d.ts +0 -8
  166. package/dist/vite/servers/main.js +0 -24
  167. package/dist/vite/servers/main.js.map +0 -1
  168. package/dist/vite/servers/worker.d.ts +0 -13
  169. package/dist/vite/servers/worker.js +0 -124
  170. package/dist/vite/servers/worker.js.map +0 -1
  171. package/src/cli.ts +0 -162
  172. package/src/codegen.ts +0 -30
  173. package/src/config.ts +0 -69
  174. package/src/entrypoints/cli.ts +0 -13
  175. package/src/entrypoints/main.ts +0 -317
  176. package/src/entrypoints/thread.ts +0 -223
  177. package/src/entrypoints/worker.ts +0 -174
  178. package/src/resolver.ts +0 -7
  179. package/src/runtime/application/index.ts +0 -1
  180. package/src/runtime/constants.ts +0 -13
  181. package/src/runtime/enums.ts +0 -12
  182. package/src/runtime/hooks.ts +0 -1
  183. package/src/runtime/index.ts +0 -29
  184. package/src/runtime/injectables.ts +0 -72
  185. package/src/runtime/jobs/job.ts +0 -467
  186. package/src/runtime/jobs/manager.ts +0 -454
  187. package/src/runtime/jobs/router.ts +0 -967
  188. package/src/runtime/jobs/runner.ts +0 -583
  189. package/src/runtime/jobs/step.ts +0 -66
  190. package/src/runtime/jobs/types.ts +0 -116
  191. package/src/runtime/metrics/metric.ts +0 -18
  192. package/src/runtime/metrics/registry.ts +0 -11
  193. package/src/runtime/metrics/server.ts +0 -69
  194. package/src/runtime/plugin.ts +0 -2
  195. package/src/runtime/runtime.ts +0 -103
  196. package/src/runtime/scheduler/index.ts +0 -39
  197. package/src/runtime/server/applications.ts +0 -264
  198. package/src/runtime/server/config.ts +0 -199
  199. package/src/runtime/server/environment.ts +0 -71
  200. package/src/runtime/server/error-policy.ts +0 -132
  201. package/src/runtime/server/hmr-coordinator.ts +0 -116
  202. package/src/runtime/server/jobs.ts +0 -266
  203. package/src/runtime/server/lifecycle.ts +0 -234
  204. package/src/runtime/server/managed-worker.ts +0 -546
  205. package/src/runtime/server/pool-manager.ts +0 -187
  206. package/src/runtime/server/proxy.ts +0 -119
  207. package/src/runtime/server/server.ts +0 -218
  208. package/src/runtime/server/types.ts +0 -32
  209. package/src/runtime/server/worker-pool.ts +0 -275
  210. package/src/runtime/store/index.ts +0 -30
  211. package/src/runtime/subscription/manager.ts +0 -310
  212. package/src/runtime/subscription/redis.ts +0 -157
  213. package/src/runtime/types.ts +0 -84
  214. package/src/runtime/workers/application.ts +0 -133
  215. package/src/runtime/workers/base.ts +0 -71
  216. package/src/runtime/workers/cli.ts +0 -0
  217. package/src/runtime/workers/job.ts +0 -142
  218. package/src/vite/builder.ts +0 -94
  219. package/src/vite/config.ts +0 -45
  220. package/src/vite/plugins.ts +0 -53
  221. package/src/vite/runners/worker.ts +0 -55
  222. package/src/vite/server.ts +0 -55
  223. package/src/vite/servers/main.ts +0 -41
  224. package/src/vite/servers/worker.ts +0 -177
@@ -1 +0,0 @@
1
- {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/runtime/jobs/manager.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AASxC,OAAO,EACL,KAAK,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,QAAQ,CAAA;AAKf,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAErD;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,OAAO,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;AAClC,CAAC;AAkBD,MAAM,OAAO,cAAc;IACzB,QAAQ,CAA0B;IAElC,YAAY,OAAiC;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;IACzB,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,QAAQ,CAAC,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D;gBACE,OAAO,EAAE,CAAA;QACb,CAAC;IACH,CAAC;CACF"}
@@ -1,296 +0,0 @@
1
- import type { AnyGuard, AnyMiddleware, AnyRouterMetaBinding, ProcedureMetaBinding, Router } from '@nmtjs/application';
2
- import type { MaybePromise } from '@nmtjs/common';
3
- import type { TProcedureContract, TRouterContract } from '@nmtjs/contract';
4
- import type { Dependencies, DependencyContext } from '@nmtjs/core';
5
- import type { NullableType, OptionalType } from '@nmtjs/type';
6
- import type { NeverType } from '@nmtjs/type/never';
7
- import { t } from '@nmtjs/type';
8
- import type { AnyJob } from './job.ts';
9
- type ListOperationInput = {
10
- page?: number;
11
- limit?: number;
12
- status?: string[];
13
- };
14
- type IdOperationInput = {
15
- id: string;
16
- };
17
- type RetryOperationInput = {
18
- id: string;
19
- clearState?: boolean;
20
- };
21
- type AddOperationInput<T extends AnyJob> = {
22
- data: T['_']['input'];
23
- jobId?: string;
24
- priority?: number;
25
- delay?: number;
26
- };
27
- /** Base operation config shared by all operations */
28
- export type BaseOperationConfig<Input = unknown, Deps extends Dependencies = {}> = {
29
- dependencies?: Deps;
30
- guards?: AnyGuard[];
31
- middlewares?: AnyMiddleware[];
32
- meta?: ProcedureMetaBinding<Input>[];
33
- timeout?: number;
34
- };
35
- /** List operation config (read-only, no hooks) */
36
- export type ListOperationConfig<Deps extends Dependencies = {}> = BaseOperationConfig<ListOperationInput, Deps>;
37
- /** Get operation config (read-only, no hooks) */
38
- export type GetOperationConfig<Deps extends Dependencies = {}> = BaseOperationConfig<IdOperationInput, Deps>;
39
- /** Info operation config (read-only, no hooks) */
40
- export type InfoOperationConfig<Deps extends Dependencies = {}> = BaseOperationConfig<unknown, Deps>;
41
- /** Add queue options */
42
- export type AddQueueOptions = {
43
- priority?: number;
44
- attempts?: number;
45
- delay?: number;
46
- };
47
- /** Add operation config with before/after hooks */
48
- export type AddOperationConfig<T extends AnyJob = AnyJob, Deps extends Dependencies = {}> = BaseOperationConfig<AddOperationInput<T>, Deps> & {
49
- beforeAdd?: (ctx: DependencyContext<Deps>, input: T['_']['input']) => MaybePromise<T['_']['input']>;
50
- afterAdd?: (ctx: DependencyContext<Deps>, result: {
51
- id: string;
52
- name: string;
53
- }, input: T['_']['input']) => MaybePromise<void>;
54
- options?: AddQueueOptions;
55
- };
56
- /** Remove operation config with before/after hooks */
57
- export type RemoveOperationConfig<Deps extends Dependencies = {}> = BaseOperationConfig<IdOperationInput, Deps> & {
58
- beforeRemove?: (ctx: DependencyContext<Deps>, params: {
59
- id: string;
60
- }) => MaybePromise<void>;
61
- afterRemove?: (ctx: DependencyContext<Deps>, params: {
62
- id: string;
63
- }) => MaybePromise<void>;
64
- };
65
- /** Retry operation config with before/after hooks */
66
- export type RetryOperationConfig<Deps extends Dependencies = {}> = BaseOperationConfig<RetryOperationInput, Deps> & {
67
- clearState?: boolean;
68
- beforeRetry?: (ctx: DependencyContext<Deps>, params: {
69
- id: string;
70
- clearState?: boolean;
71
- }) => MaybePromise<void>;
72
- afterRetry?: (ctx: DependencyContext<Deps>, params: {
73
- id: string;
74
- clearState?: boolean;
75
- }) => MaybePromise<void>;
76
- };
77
- /** Cancel operation config with before/after hooks */
78
- export type CancelOperationConfig<Deps extends Dependencies = {}> = BaseOperationConfig<IdOperationInput, Deps> & {
79
- beforeCancel?: (ctx: DependencyContext<Deps>, params: {
80
- id: string;
81
- }) => MaybePromise<void>;
82
- afterCancel?: (ctx: DependencyContext<Deps>, params: {
83
- id: string;
84
- }) => MaybePromise<void>;
85
- };
86
- /** All operations for a job (false = disabled) */
87
- export type JobOperations<T extends AnyJob = AnyJob> = {
88
- info?: InfoOperationConfig<any> | false;
89
- list?: ListOperationConfig<any> | false;
90
- get?: GetOperationConfig<any> | false;
91
- add?: AddOperationConfig<T, any> | false;
92
- retry?: RetryOperationConfig<any> | false;
93
- cancel?: CancelOperationConfig<any> | false;
94
- remove?: RemoveOperationConfig<any> | false;
95
- };
96
- /** Default operations config */
97
- export type DefaultOperations = {
98
- info?: InfoOperationConfig<any> | false;
99
- list?: ListOperationConfig<any> | false;
100
- get?: GetOperationConfig<any> | false;
101
- add?: AddOperationConfig<AnyJob, any> | false;
102
- retry?: RetryOperationConfig<any> | false;
103
- cancel?: CancelOperationConfig<any> | false;
104
- remove?: RemoveOperationConfig<any> | false;
105
- };
106
- /** Options for createJobsRouter */
107
- export type CreateJobsRouterOptions<Jobs extends Record<string, AnyJob>> = {
108
- jobs: Jobs;
109
- guards?: AnyGuard[];
110
- middlewares?: AnyMiddleware[];
111
- meta?: JobsRouterMetaBinding[];
112
- defaults?: DefaultOperations;
113
- overrides?: {
114
- [K in keyof Jobs]?: JobOperations<Jobs[K]>;
115
- };
116
- };
117
- /** Type-level schema for JobProgressCheckpoint - typed per job */
118
- type JobProgressCheckpointSchemaType<T extends AnyJob> = t.ObjectType<{
119
- stepIndex: t.NumberType;
120
- stepLabel: OptionalType<t.StringType>;
121
- result: t.RecordType<t.StringType, t.AnyType>;
122
- stepResults: t.ArrayType<NullableType<t.ObjectType<{
123
- data: NullableType<t.RecordType<t.StringType, t.AnyType>>;
124
- duration: t.NumberType;
125
- }>>>;
126
- progress: T['progress'];
127
- }>;
128
- /** Type-level representation of createJobItemSchema output */
129
- type JobItemSchemaType<T extends AnyJob> = t.ObjectType<{
130
- id: t.StringType;
131
- name: t.StringType;
132
- queue: t.StringType;
133
- data: T['input'];
134
- output: OptionalType<NullableType<T['output']>>;
135
- status: t.StringType;
136
- priority: OptionalType<t.NumberType>;
137
- progress: OptionalType<JobProgressCheckpointSchemaType<T>>;
138
- attempts: t.NumberType;
139
- startedAt: OptionalType<t.NumberType>;
140
- completedAt: OptionalType<t.NumberType>;
141
- error: OptionalType<t.StringType>;
142
- stacktrace: NullableType<t.ArrayType<t.StringType>>;
143
- }>;
144
- /** Type-level representation of createListOutputSchema output */
145
- type ListOutputSchemaType<T extends AnyJob> = t.ObjectType<{
146
- items: t.ArrayType<JobItemSchemaType<T>>;
147
- page: t.NumberType;
148
- limit: t.NumberType;
149
- pages: t.NumberType;
150
- total: t.NumberType;
151
- }>;
152
- /** Type-level representation of createGetOutputSchema output */
153
- type GetOutputSchemaType<T extends AnyJob> = NullableType<JobItemSchemaType<T>>;
154
- /** Type-level representation of infoOutputSchema */
155
- type InfoOutputSchemaType = typeof infoOutputSchema;
156
- /** Type-level representation of createAddInputSchema output */
157
- type AddInputSchemaType<T extends AnyJob> = t.ObjectType<{
158
- data: T['input'];
159
- jobId: OptionalType<t.StringType>;
160
- priority: OptionalType<t.NumberType>;
161
- delay: OptionalType<t.NumberType>;
162
- }>;
163
- /** Operations contract for a single job - now properly typed per job */
164
- type JobOperationsProcedures<T extends AnyJob> = {
165
- info: TProcedureContract<NeverType, InfoOutputSchemaType>;
166
- list: TProcedureContract<typeof listInputSchema, ListOutputSchemaType<T>>;
167
- get: TProcedureContract<typeof getInputSchema, GetOutputSchemaType<T>>;
168
- add: TProcedureContract<AddInputSchemaType<T>, typeof addOutputSchema>;
169
- retry: TProcedureContract<typeof retryInputSchema, NeverType>;
170
- cancel: TProcedureContract<typeof idInputSchema, NeverType>;
171
- remove: TProcedureContract<typeof idInputSchema, NeverType>;
172
- };
173
- /** Router contract for a single job's operations */
174
- type JobRouterContract<T extends AnyJob> = TRouterContract<JobOperationsProcedures<T>>;
175
- /** Full jobs router contract mapping job names to their operation routers */
176
- type JobsRouterContract<Jobs extends Record<string, AnyJob>> = TRouterContract<{
177
- [K in keyof Jobs]: JobRouterContract<Jobs[K]>;
178
- }>;
179
- export type JobsRouterMetaBinding = AnyRouterMetaBinding;
180
- /** Return type for createJobsRouter */
181
- export type JobsRouter<Jobs extends Record<string, AnyJob>> = Router<JobsRouterContract<Jobs>>;
182
- /** Input schema for list operation */
183
- declare const listInputSchema: t.ObjectType<{
184
- page: OptionalType<t.NumberType>;
185
- limit: OptionalType<t.NumberType>;
186
- status: OptionalType<t.ArrayType<t.StringType>>;
187
- }>;
188
- /** Input schema for get operation */
189
- declare const getInputSchema: t.ObjectType<{
190
- id: t.StringType;
191
- }>;
192
- /** Output schema for add operation */
193
- declare const addOutputSchema: t.ObjectType<{
194
- id: t.StringType;
195
- name: t.StringType;
196
- }>;
197
- /** Input schema for retry operation */
198
- declare const retryInputSchema: t.ObjectType<{
199
- id: t.StringType;
200
- clearState: OptionalType<t.BooleanType>;
201
- }>;
202
- /** Input schema for cancel/remove operations */
203
- declare const idInputSchema: t.ObjectType<{
204
- id: t.StringType;
205
- }>;
206
- /** Output schema for info operation */
207
- declare const infoOutputSchema: t.ObjectType<{
208
- name: t.StringType;
209
- steps: t.ArrayType<t.ObjectType<{
210
- label: OptionalType<t.StringType>;
211
- conditional: t.BooleanType;
212
- parallel: t.BooleanType;
213
- }>>;
214
- }>;
215
- /**
216
- * Helper function to create a type-safe operation config with dependencies.
217
- * Use this when you need custom dependencies for hooks.
218
- *
219
- * @example
220
- * ```ts
221
- * add: jobOperation({
222
- * dependencies: { userService, auditLog },
223
- * beforeAdd: async (ctx, input) => {
224
- * return { ...input, createdBy: ctx.userService.getCurrentId() }
225
- * },
226
- * })
227
- * ```
228
- */
229
- export declare function createJobRouterOperation<Deps extends Dependencies, T extends AnyJob = AnyJob>(config: BaseOperationConfig<Deps> & {
230
- beforeAdd?: (ctx: DependencyContext<Deps>, input: T['_']['input']) => MaybePromise<T['_']['input']>;
231
- afterAdd?: (ctx: DependencyContext<Deps>, result: {
232
- id: string;
233
- name: string;
234
- }, input: T['_']['input']) => MaybePromise<void>;
235
- options?: AddQueueOptions;
236
- beforeRemove?: (ctx: DependencyContext<Deps>, params: {
237
- id: string;
238
- }) => MaybePromise<void>;
239
- afterRemove?: (ctx: DependencyContext<Deps>, params: {
240
- id: string;
241
- }) => MaybePromise<void>;
242
- clearState?: boolean;
243
- beforeRetry?: (ctx: DependencyContext<Deps>, params: {
244
- id: string;
245
- clearState?: boolean;
246
- }) => MaybePromise<void>;
247
- afterRetry?: (ctx: DependencyContext<Deps>, params: {
248
- id: string;
249
- clearState?: boolean;
250
- }) => MaybePromise<void>;
251
- beforeCancel?: (ctx: DependencyContext<Deps>, params: {
252
- id: string;
253
- }) => MaybePromise<void>;
254
- afterCancel?: (ctx: DependencyContext<Deps>, params: {
255
- id: string;
256
- }) => MaybePromise<void>;
257
- }): typeof config;
258
- /**
259
- * Creates a router with CRUD-like operations for multiple jobs.
260
- *
261
- * @example
262
- * ```ts
263
- * const jobsRouter = createJobsRouter({
264
- * jobs: [userJob, emailJob] as const,
265
- * guards: [authGuard],
266
- * defaults: {
267
- * list: {},
268
- * get: {},
269
- * add: {},
270
- * retry: { guards: [adminGuard] },
271
- * cancel: { guards: [adminGuard] },
272
- * remove: false,
273
- * },
274
- * overrides: {
275
- * userProcessing: {
276
- * add: jobOperation({
277
- * dependencies: { userService },
278
- * beforeAdd: async (ctx, input) => ({
279
- * ...input,
280
- * userId: ctx.userService.getCurrentId(),
281
- * }),
282
- * }),
283
- * },
284
- * },
285
- * })
286
- *
287
- * // Use in your router
288
- * createRouter({
289
- * routes: {
290
- * jobs: jobsRouter,
291
- * }
292
- * })
293
- * ```
294
- */
295
- export declare function createJobsRouter<const Jobs extends Record<string, AnyJob>>(options: CreateJobsRouterOptions<Jobs>): JobsRouter<Jobs>;
296
- export {};