@lssm/lib.jobs 0.0.0-canary-20251217083314 → 1.41.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 (158) hide show
  1. package/dist/_virtual/rolldown_runtime.js +1 -42
  2. package/dist/contracts/index.js +1 -484
  3. package/dist/entities/index.js +1 -198
  4. package/dist/events.js +1 -303
  5. package/dist/handlers/gmail-sync-handler.js +1 -9
  6. package/dist/handlers/index.js +1 -12
  7. package/dist/handlers/ping-job.js +1 -13
  8. package/dist/handlers/storage-document-handler.js +1 -14
  9. package/dist/index.js +1 -18
  10. package/dist/jobs.feature.js +1 -101
  11. package/dist/queue/gcp-cloud-tasks.js +1 -61
  12. package/dist/queue/gcp-pubsub.js +1 -47
  13. package/dist/queue/index.js +1 -9
  14. package/dist/queue/memory-queue.js +1 -140
  15. package/dist/queue/register-defined-job.js +1 -15
  16. package/dist/queue/scaleway-sqs-queue.js +1 -175
  17. package/dist/queue/types.js +1 -3
  18. package/dist/scheduler/index.js +1 -145
  19. package/package.json +23 -24
  20. package/dist/contracts/dist/capabilities/openbanking.js +0 -88
  21. package/dist/contracts/dist/client/index.js +0 -5
  22. package/dist/contracts/dist/client/react/feature-render.js +0 -2
  23. package/dist/contracts/dist/client/react/form-render.js +0 -4
  24. package/dist/contracts/dist/client/react/index.js +0 -4
  25. package/dist/contracts/dist/contract-registry/index.js +0 -1
  26. package/dist/contracts/dist/contract-registry/schemas.js +0 -60
  27. package/dist/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
  28. package/dist/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
  29. package/dist/contracts/dist/docs/index.js +0 -29
  30. package/dist/contracts/dist/docs/presentations.js +0 -71
  31. package/dist/contracts/dist/docs/registry.js +0 -44
  32. package/dist/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
  33. package/dist/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
  34. package/dist/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
  35. package/dist/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
  36. package/dist/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
  37. package/dist/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
  38. package/dist/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
  39. package/dist/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
  40. package/dist/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
  41. package/dist/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
  42. package/dist/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
  43. package/dist/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
  44. package/dist/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
  45. package/dist/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
  46. package/dist/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
  47. package/dist/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
  48. package/dist/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
  49. package/dist/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
  50. package/dist/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
  51. package/dist/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
  52. package/dist/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
  53. package/dist/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
  54. package/dist/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
  55. package/dist/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
  56. package/dist/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
  57. package/dist/contracts/dist/events.js +0 -10
  58. package/dist/contracts/dist/experiments/evaluator.js +0 -1
  59. package/dist/contracts/dist/index.js +0 -71
  60. package/dist/contracts/dist/install.js +0 -2
  61. package/dist/contracts/dist/integrations/contracts.js +0 -377
  62. package/dist/contracts/dist/integrations/index.js +0 -18
  63. package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
  64. package/dist/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
  65. package/dist/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
  66. package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
  67. package/dist/contracts/dist/integrations/openbanking/models.js +0 -242
  68. package/dist/contracts/dist/integrations/openbanking/telemetry.js +0 -13
  69. package/dist/contracts/dist/integrations/providers/elevenlabs.js +0 -52
  70. package/dist/contracts/dist/integrations/providers/gcs-storage.js +0 -75
  71. package/dist/contracts/dist/integrations/providers/gmail.js +0 -87
  72. package/dist/contracts/dist/integrations/providers/google-calendar.js +0 -66
  73. package/dist/contracts/dist/integrations/providers/index.js +0 -11
  74. package/dist/contracts/dist/integrations/providers/mistral.js +0 -68
  75. package/dist/contracts/dist/integrations/providers/postmark.js +0 -68
  76. package/dist/contracts/dist/integrations/providers/powens.js +0 -116
  77. package/dist/contracts/dist/integrations/providers/qdrant.js +0 -73
  78. package/dist/contracts/dist/integrations/providers/registry.js +0 -10
  79. package/dist/contracts/dist/integrations/providers/stripe.js +0 -83
  80. package/dist/contracts/dist/integrations/providers/twilio-sms.js +0 -61
  81. package/dist/contracts/dist/jobs/queue.js +0 -33
  82. package/dist/contracts/dist/jsonschema.js +0 -1
  83. package/dist/contracts/dist/knowledge/contracts.js +0 -306
  84. package/dist/contracts/dist/knowledge/index.js +0 -7
  85. package/dist/contracts/dist/knowledge/spaces/email-threads.js +0 -34
  86. package/dist/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
  87. package/dist/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
  88. package/dist/contracts/dist/knowledge/spaces/index.js +0 -6
  89. package/dist/contracts/dist/knowledge/spaces/product-canon.js +0 -34
  90. package/dist/contracts/dist/knowledge/spaces/support-faq.js +0 -37
  91. package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
  92. package/dist/contracts/dist/llm/exporters.js +0 -19
  93. package/dist/contracts/dist/llm/index.js +0 -2
  94. package/dist/contracts/dist/llm/prompts.js +0 -1
  95. package/dist/contracts/dist/onboarding-base.js +0 -196
  96. package/dist/contracts/dist/openapi.js +0 -1
  97. package/dist/contracts/dist/ownership.js +0 -21
  98. package/dist/contracts/dist/presentations.js +0 -1
  99. package/dist/contracts/dist/presentations.v2.js +0 -11
  100. package/dist/contracts/dist/prompt.js +0 -1
  101. package/dist/contracts/dist/promptRegistry.js +0 -1
  102. package/dist/contracts/dist/regenerator/index.js +0 -1
  103. package/dist/contracts/dist/regenerator/service.js +0 -6
  104. package/dist/contracts/dist/registry.js +0 -2
  105. package/dist/contracts/dist/resources.js +0 -1
  106. package/dist/contracts/dist/schema/dist/EnumType.js +0 -2
  107. package/dist/contracts/dist/schema/dist/FieldType.js +0 -49
  108. package/dist/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
  109. package/dist/contracts/dist/schema/dist/SchemaModel.js +0 -34
  110. package/dist/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
  111. package/dist/contracts/dist/schema/dist/entity/index.js +0 -2
  112. package/dist/contracts/dist/schema/dist/entity/types.js +0 -1
  113. package/dist/contracts/dist/schema/dist/index.js +0 -6
  114. package/dist/contracts/dist/server/graphql-pothos.js +0 -6
  115. package/dist/contracts/dist/server/index.js +0 -8
  116. package/dist/contracts/dist/server/mcp/createMcpServer.js +0 -4
  117. package/dist/contracts/dist/server/mcp/registerPresentations.js +0 -2
  118. package/dist/contracts/dist/server/mcp/registerPrompts.js +0 -1
  119. package/dist/contracts/dist/server/mcp/registerResources.js +0 -2
  120. package/dist/contracts/dist/server/mcp/registerTools.js +0 -1
  121. package/dist/contracts/dist/server/provider-mcp.js +0 -1
  122. package/dist/contracts/dist/server/rest-elysia.js +0 -1
  123. package/dist/contracts/dist/server/rest-express.js +0 -1
  124. package/dist/contracts/dist/server/rest-generic.js +0 -1
  125. package/dist/contracts/dist/server/rest-next-app.js +0 -1
  126. package/dist/contracts/dist/server/rest-next-pages.js +0 -1
  127. package/dist/contracts/dist/spec.js +0 -34
  128. package/dist/contracts/dist/telemetry/index.js +0 -1
  129. package/dist/contracts/dist/telemetry/tracker.js +0 -1
  130. package/dist/contracts/dist/tests/index.js +0 -1
  131. package/dist/contracts/dist/tests/runner.js +0 -2
  132. package/dist/contracts/dist/workflow/index.js +0 -1
  133. package/dist/contracts/dist/workflow/runner.js +0 -1
  134. package/dist/contracts/index.d.ts +0 -546
  135. package/dist/entities/index.d.ts +0 -144
  136. package/dist/events.d.ts +0 -387
  137. package/dist/handlers/gmail-sync-handler.d.ts +0 -9
  138. package/dist/handlers/index.d.ts +0 -9
  139. package/dist/handlers/ping-job.d.ts +0 -10
  140. package/dist/handlers/storage-document-handler.d.ts +0 -12
  141. package/dist/index.d.ts +0 -24
  142. package/dist/jobs.feature.d.ts +0 -11
  143. package/dist/queue/gcp-cloud-tasks.d.ts +0 -41
  144. package/dist/queue/gcp-pubsub.d.ts +0 -25
  145. package/dist/queue/index.d.ts +0 -15
  146. package/dist/queue/memory-queue.d.ts +0 -34
  147. package/dist/queue/register-defined-job.d.ts +0 -7
  148. package/dist/queue/scaleway-sqs-queue.d.ts +0 -38
  149. package/dist/queue/types.d.ts +0 -7
  150. package/dist/scheduler/index.d.ts +0 -92
  151. package/dist/schema/dist/EnumType.js +0 -2
  152. package/dist/schema/dist/FieldType.js +0 -49
  153. package/dist/schema/dist/ScalarTypeEnum.js +0 -236
  154. package/dist/schema/dist/SchemaModel.js +0 -39
  155. package/dist/schema/dist/entity/defineEntity.js +0 -236
  156. package/dist/schema/dist/entity/index.js +0 -2
  157. package/dist/schema/dist/entity/types.js +0 -1
  158. package/dist/schema/dist/index.js +0 -6
@@ -1,42 +1 @@
1
- //#region rolldown:runtime
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (all, symbols) => {
7
- let target = {};
8
- for (var name in all) {
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true
12
- });
13
- }
14
- if (symbols) {
15
- __defProp(target, Symbol.toStringTag, { value: "Module" });
16
- }
17
- return target;
18
- };
19
- var __copyProps = (to, from, except, desc) => {
20
- if (from && typeof from === "object" || typeof from === "function") {
21
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
22
- key = keys[i];
23
- if (!__hasOwnProp.call(to, key) && key !== except) {
24
- __defProp(to, key, {
25
- get: ((k) => from[k]).bind(null, key),
26
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
27
- });
28
- }
29
- }
30
- }
31
- return to;
32
- };
33
- var __reExport = (target, mod, secondTarget, symbols) => {
34
- if (symbols) {
35
- __defProp(target, Symbol.toStringTag, { value: "Module" });
36
- secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
37
- }
38
- __copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
39
- };
40
-
41
- //#endregion
42
- export { __export, __reExport };
1
+ var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n&&e(r,Symbol.toStringTag,{value:`Module`}),r},a=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!r.call(i,d)&&d!==o&&e(i,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return i},o=(t,n,r,i)=>{i&&(e(t,Symbol.toStringTag,{value:`Module`}),r&&e(r,Symbol.toStringTag,{value:`Module`})),a(t,n,`default`),r&&a(r,n,`default`)};export{i as __export,o as __reExport};
@@ -1,484 +1 @@
1
- import { ScalarTypeEnum } from "../schema/dist/ScalarTypeEnum.js";
2
- import { defineSchemaModel } from "../schema/dist/SchemaModel.js";
3
- import "../schema/dist/index.js";
4
- import { defineCommand, defineQuery } from "./dist/spec.js";
5
- import "./dist/index.js";
6
-
7
- //#region src/contracts/index.ts
8
- const OWNERS = ["platform.jobs"];
9
- const JobModel = defineSchemaModel({
10
- name: "Job",
11
- description: "Represents a background job",
12
- fields: {
13
- id: {
14
- type: ScalarTypeEnum.String_unsecure(),
15
- isOptional: false
16
- },
17
- type: {
18
- type: ScalarTypeEnum.String_unsecure(),
19
- isOptional: false
20
- },
21
- version: {
22
- type: ScalarTypeEnum.Int_unsecure(),
23
- isOptional: false
24
- },
25
- payload: {
26
- type: ScalarTypeEnum.JSON(),
27
- isOptional: false
28
- },
29
- status: {
30
- type: ScalarTypeEnum.String_unsecure(),
31
- isOptional: false
32
- },
33
- priority: {
34
- type: ScalarTypeEnum.Int_unsecure(),
35
- isOptional: false
36
- },
37
- attempts: {
38
- type: ScalarTypeEnum.Int_unsecure(),
39
- isOptional: false
40
- },
41
- maxRetries: {
42
- type: ScalarTypeEnum.Int_unsecure(),
43
- isOptional: false
44
- },
45
- createdAt: {
46
- type: ScalarTypeEnum.DateTime(),
47
- isOptional: false
48
- },
49
- updatedAt: {
50
- type: ScalarTypeEnum.DateTime(),
51
- isOptional: false
52
- },
53
- scheduledAt: {
54
- type: ScalarTypeEnum.DateTime(),
55
- isOptional: true
56
- },
57
- startedAt: {
58
- type: ScalarTypeEnum.DateTime(),
59
- isOptional: true
60
- },
61
- completedAt: {
62
- type: ScalarTypeEnum.DateTime(),
63
- isOptional: true
64
- },
65
- lastError: {
66
- type: ScalarTypeEnum.String_unsecure(),
67
- isOptional: true
68
- }
69
- }
70
- });
71
- const ScheduledJobModel = defineSchemaModel({
72
- name: "ScheduledJob",
73
- description: "Represents a scheduled/recurring job",
74
- fields: {
75
- id: {
76
- type: ScalarTypeEnum.String_unsecure(),
77
- isOptional: false
78
- },
79
- name: {
80
- type: ScalarTypeEnum.String_unsecure(),
81
- isOptional: false
82
- },
83
- description: {
84
- type: ScalarTypeEnum.String_unsecure(),
85
- isOptional: true
86
- },
87
- cronExpression: {
88
- type: ScalarTypeEnum.String_unsecure(),
89
- isOptional: false
90
- },
91
- timezone: {
92
- type: ScalarTypeEnum.String_unsecure(),
93
- isOptional: false
94
- },
95
- jobType: {
96
- type: ScalarTypeEnum.String_unsecure(),
97
- isOptional: false
98
- },
99
- enabled: {
100
- type: ScalarTypeEnum.Boolean(),
101
- isOptional: false
102
- },
103
- lastRunAt: {
104
- type: ScalarTypeEnum.DateTime(),
105
- isOptional: true
106
- },
107
- nextRunAt: {
108
- type: ScalarTypeEnum.DateTime(),
109
- isOptional: true
110
- },
111
- createdAt: {
112
- type: ScalarTypeEnum.DateTime(),
113
- isOptional: false
114
- }
115
- }
116
- });
117
- const QueueStatsModel = defineSchemaModel({
118
- name: "QueueStats",
119
- description: "Job queue statistics",
120
- fields: {
121
- pending: {
122
- type: ScalarTypeEnum.Int_unsecure(),
123
- isOptional: false
124
- },
125
- running: {
126
- type: ScalarTypeEnum.Int_unsecure(),
127
- isOptional: false
128
- },
129
- completed: {
130
- type: ScalarTypeEnum.Int_unsecure(),
131
- isOptional: false
132
- },
133
- failed: {
134
- type: ScalarTypeEnum.Int_unsecure(),
135
- isOptional: false
136
- },
137
- deadLetter: {
138
- type: ScalarTypeEnum.Int_unsecure(),
139
- isOptional: false
140
- }
141
- }
142
- });
143
- const EnqueueJobInput = defineSchemaModel({
144
- name: "EnqueueJobInput",
145
- description: "Input for enqueuing a new job",
146
- fields: {
147
- type: {
148
- type: ScalarTypeEnum.String_unsecure(),
149
- isOptional: false
150
- },
151
- payload: {
152
- type: ScalarTypeEnum.JSON(),
153
- isOptional: false
154
- },
155
- delaySeconds: {
156
- type: ScalarTypeEnum.Int_unsecure(),
157
- isOptional: true
158
- },
159
- dedupeKey: {
160
- type: ScalarTypeEnum.String_unsecure(),
161
- isOptional: true
162
- },
163
- maxRetries: {
164
- type: ScalarTypeEnum.Int_unsecure(),
165
- isOptional: true
166
- },
167
- priority: {
168
- type: ScalarTypeEnum.Int_unsecure(),
169
- isOptional: true
170
- },
171
- timeoutMs: {
172
- type: ScalarTypeEnum.Int_unsecure(),
173
- isOptional: true
174
- }
175
- }
176
- });
177
- const GetJobInput = defineSchemaModel({
178
- name: "GetJobInput",
179
- description: "Input for getting a job by ID",
180
- fields: { jobId: {
181
- type: ScalarTypeEnum.String_unsecure(),
182
- isOptional: false
183
- } }
184
- });
185
- const CancelJobInput = defineSchemaModel({
186
- name: "CancelJobInput",
187
- description: "Input for cancelling a job",
188
- fields: { jobId: {
189
- type: ScalarTypeEnum.String_unsecure(),
190
- isOptional: false
191
- } }
192
- });
193
- const CancelJobOutput = defineSchemaModel({
194
- name: "CancelJobOutput",
195
- description: "Output for cancel job operation",
196
- fields: { success: {
197
- type: ScalarTypeEnum.Boolean(),
198
- isOptional: false
199
- } }
200
- });
201
- const CreateScheduledJobInput = defineSchemaModel({
202
- name: "CreateScheduledJobInput",
203
- description: "Input for creating a scheduled job",
204
- fields: {
205
- name: {
206
- type: ScalarTypeEnum.String_unsecure(),
207
- isOptional: false
208
- },
209
- description: {
210
- type: ScalarTypeEnum.String_unsecure(),
211
- isOptional: true
212
- },
213
- cronExpression: {
214
- type: ScalarTypeEnum.String_unsecure(),
215
- isOptional: false
216
- },
217
- timezone: {
218
- type: ScalarTypeEnum.String_unsecure(),
219
- isOptional: true
220
- },
221
- jobType: {
222
- type: ScalarTypeEnum.String_unsecure(),
223
- isOptional: false
224
- },
225
- payload: {
226
- type: ScalarTypeEnum.JSON(),
227
- isOptional: true
228
- },
229
- maxRetries: {
230
- type: ScalarTypeEnum.Int_unsecure(),
231
- isOptional: true
232
- },
233
- enabled: {
234
- type: ScalarTypeEnum.Boolean(),
235
- isOptional: true
236
- }
237
- }
238
- });
239
- const ListScheduledJobsOutput = defineSchemaModel({
240
- name: "ListScheduledJobsOutput",
241
- description: "Output for listing scheduled jobs",
242
- fields: { schedules: {
243
- type: ScheduledJobModel,
244
- isArray: true,
245
- isOptional: false
246
- } }
247
- });
248
- const ToggleScheduledJobInput = defineSchemaModel({
249
- name: "ToggleScheduledJobInput",
250
- description: "Input for toggling a scheduled job",
251
- fields: {
252
- name: {
253
- type: ScalarTypeEnum.String_unsecure(),
254
- isOptional: false
255
- },
256
- enabled: {
257
- type: ScalarTypeEnum.Boolean(),
258
- isOptional: false
259
- }
260
- }
261
- });
262
- const JobEnqueuedPayload = defineSchemaModel({
263
- name: "JobEnqueuedPayload",
264
- description: "Payload for job.enqueued event",
265
- fields: {
266
- jobId: {
267
- type: ScalarTypeEnum.String_unsecure(),
268
- isOptional: false
269
- },
270
- type: {
271
- type: ScalarTypeEnum.String_unsecure(),
272
- isOptional: false
273
- },
274
- priority: {
275
- type: ScalarTypeEnum.Int_unsecure(),
276
- isOptional: false
277
- },
278
- scheduledAt: {
279
- type: ScalarTypeEnum.DateTime(),
280
- isOptional: true
281
- },
282
- tenantId: {
283
- type: ScalarTypeEnum.String_unsecure(),
284
- isOptional: true
285
- },
286
- enqueuedAt: {
287
- type: ScalarTypeEnum.DateTime(),
288
- isOptional: false
289
- }
290
- }
291
- });
292
- const JobCancelledPayload = defineSchemaModel({
293
- name: "JobCancelledPayload",
294
- description: "Payload for job.cancelled event",
295
- fields: { jobId: {
296
- type: ScalarTypeEnum.String_unsecure(),
297
- isOptional: false
298
- } }
299
- });
300
- /**
301
- * Enqueue a job.
302
- */
303
- const EnqueueJobContract = defineCommand({
304
- meta: {
305
- name: "jobs.enqueue",
306
- version: 1,
307
- stability: "stable",
308
- owners: [...OWNERS],
309
- tags: ["jobs", "enqueue"],
310
- description: "Enqueue a background job for async processing.",
311
- goal: "Allow services to offload work to background processing.",
312
- context: "Called by any service that needs async processing."
313
- },
314
- io: {
315
- input: EnqueueJobInput,
316
- output: JobModel
317
- },
318
- policy: { auth: "user" },
319
- sideEffects: { emits: [{
320
- name: "job.enqueued",
321
- version: 1,
322
- when: "Job is enqueued",
323
- payload: JobEnqueuedPayload
324
- }] }
325
- });
326
- /**
327
- * Get job by ID.
328
- */
329
- const GetJobContract = defineQuery({
330
- meta: {
331
- name: "jobs.get",
332
- version: 1,
333
- stability: "stable",
334
- owners: [...OWNERS],
335
- tags: ["jobs", "get"],
336
- description: "Get a job by ID.",
337
- goal: "Check job status and result.",
338
- context: "Called to poll job status or retrieve results."
339
- },
340
- io: {
341
- input: GetJobInput,
342
- output: JobModel
343
- },
344
- policy: { auth: "user" }
345
- });
346
- /**
347
- * Cancel a job.
348
- */
349
- const CancelJobContract = defineCommand({
350
- meta: {
351
- name: "jobs.cancel",
352
- version: 1,
353
- stability: "stable",
354
- owners: [...OWNERS],
355
- tags: ["jobs", "cancel"],
356
- description: "Cancel a pending job.",
357
- goal: "Allow cancellation of jobs that are no longer needed.",
358
- context: "Only pending jobs can be cancelled."
359
- },
360
- io: {
361
- input: CancelJobInput,
362
- output: CancelJobOutput,
363
- errors: {
364
- JOB_NOT_FOUND: {
365
- description: "Job does not exist",
366
- http: 404,
367
- gqlCode: "JOB_NOT_FOUND",
368
- when: "Job ID is invalid"
369
- },
370
- JOB_NOT_PENDING: {
371
- description: "Job is not in pending state",
372
- http: 409,
373
- gqlCode: "JOB_NOT_PENDING",
374
- when: "Job has already started or completed"
375
- }
376
- }
377
- },
378
- policy: { auth: "user" },
379
- sideEffects: { emits: [{
380
- name: "job.cancelled",
381
- version: 1,
382
- when: "Job is cancelled",
383
- payload: JobCancelledPayload
384
- }] }
385
- });
386
- /**
387
- * Get queue statistics.
388
- */
389
- const GetQueueStatsContract = defineQuery({
390
- meta: {
391
- name: "jobs.stats",
392
- version: 1,
393
- stability: "stable",
394
- owners: [...OWNERS],
395
- tags: [
396
- "jobs",
397
- "stats",
398
- "admin"
399
- ],
400
- description: "Get job queue statistics.",
401
- goal: "Monitor queue health and backlog.",
402
- context: "Admin dashboard monitoring."
403
- },
404
- io: {
405
- input: null,
406
- output: QueueStatsModel
407
- },
408
- policy: { auth: "admin" }
409
- });
410
- /**
411
- * Create a scheduled job.
412
- */
413
- const CreateScheduledJobContract = defineCommand({
414
- meta: {
415
- name: "jobs.schedule.create",
416
- version: 1,
417
- stability: "stable",
418
- owners: [...OWNERS],
419
- tags: [
420
- "jobs",
421
- "schedule",
422
- "create"
423
- ],
424
- description: "Create a scheduled/recurring job.",
425
- goal: "Set up recurring background tasks.",
426
- context: "Admin configuration for periodic tasks."
427
- },
428
- io: {
429
- input: CreateScheduledJobInput,
430
- output: ScheduledJobModel
431
- },
432
- policy: { auth: "admin" }
433
- });
434
- /**
435
- * List scheduled jobs.
436
- */
437
- const ListScheduledJobsContract = defineQuery({
438
- meta: {
439
- name: "jobs.schedule.list",
440
- version: 1,
441
- stability: "stable",
442
- owners: [...OWNERS],
443
- tags: [
444
- "jobs",
445
- "schedule",
446
- "list"
447
- ],
448
- description: "List all scheduled jobs.",
449
- goal: "View configured recurring tasks.",
450
- context: "Admin dashboard."
451
- },
452
- io: {
453
- input: null,
454
- output: ListScheduledJobsOutput
455
- },
456
- policy: { auth: "admin" }
457
- });
458
- /**
459
- * Toggle scheduled job enabled state.
460
- */
461
- const ToggleScheduledJobContract = defineCommand({
462
- meta: {
463
- name: "jobs.schedule.toggle",
464
- version: 1,
465
- stability: "stable",
466
- owners: [...OWNERS],
467
- tags: [
468
- "jobs",
469
- "schedule",
470
- "toggle"
471
- ],
472
- description: "Enable or disable a scheduled job.",
473
- goal: "Control when recurring tasks run.",
474
- context: "Admin control over scheduled tasks."
475
- },
476
- io: {
477
- input: ToggleScheduledJobInput,
478
- output: ScheduledJobModel
479
- },
480
- policy: { auth: "admin" }
481
- });
482
-
483
- //#endregion
484
- export { CancelJobContract, CreateScheduledJobContract, EnqueueJobContract, GetJobContract, GetQueueStatsContract, JobModel, ListScheduledJobsContract, QueueStatsModel, ScheduledJobModel, ToggleScheduledJobContract };
1
+ import{ScalarTypeEnum as e,defineSchemaModel as t}from"@lssm/lib.schema";import{defineCommand as n,defineQuery as r}from"@lssm/lib.contracts";const i=[`platform.jobs`],a=t({name:`Job`,description:`Represents a background job`,fields:{id:{type:e.String_unsecure(),isOptional:!1},type:{type:e.String_unsecure(),isOptional:!1},version:{type:e.Int_unsecure(),isOptional:!1},payload:{type:e.JSON(),isOptional:!1},status:{type:e.String_unsecure(),isOptional:!1},priority:{type:e.Int_unsecure(),isOptional:!1},attempts:{type:e.Int_unsecure(),isOptional:!1},maxRetries:{type:e.Int_unsecure(),isOptional:!1},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1},scheduledAt:{type:e.DateTime(),isOptional:!0},startedAt:{type:e.DateTime(),isOptional:!0},completedAt:{type:e.DateTime(),isOptional:!0},lastError:{type:e.String_unsecure(),isOptional:!0}}}),o=t({name:`ScheduledJob`,description:`Represents a scheduled/recurring job`,fields:{id:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},description:{type:e.String_unsecure(),isOptional:!0},cronExpression:{type:e.String_unsecure(),isOptional:!1},timezone:{type:e.String_unsecure(),isOptional:!1},jobType:{type:e.String_unsecure(),isOptional:!1},enabled:{type:e.Boolean(),isOptional:!1},lastRunAt:{type:e.DateTime(),isOptional:!0},nextRunAt:{type:e.DateTime(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),s=t({name:`QueueStats`,description:`Job queue statistics`,fields:{pending:{type:e.Int_unsecure(),isOptional:!1},running:{type:e.Int_unsecure(),isOptional:!1},completed:{type:e.Int_unsecure(),isOptional:!1},failed:{type:e.Int_unsecure(),isOptional:!1},deadLetter:{type:e.Int_unsecure(),isOptional:!1}}}),c=t({name:`EnqueueJobInput`,description:`Input for enqueuing a new job`,fields:{type:{type:e.String_unsecure(),isOptional:!1},payload:{type:e.JSON(),isOptional:!1},delaySeconds:{type:e.Int_unsecure(),isOptional:!0},dedupeKey:{type:e.String_unsecure(),isOptional:!0},maxRetries:{type:e.Int_unsecure(),isOptional:!0},priority:{type:e.Int_unsecure(),isOptional:!0},timeoutMs:{type:e.Int_unsecure(),isOptional:!0}}}),l=t({name:`GetJobInput`,description:`Input for getting a job by ID`,fields:{jobId:{type:e.String_unsecure(),isOptional:!1}}}),u=t({name:`CancelJobInput`,description:`Input for cancelling a job`,fields:{jobId:{type:e.String_unsecure(),isOptional:!1}}}),d=t({name:`CancelJobOutput`,description:`Output for cancel job operation`,fields:{success:{type:e.Boolean(),isOptional:!1}}}),f=t({name:`CreateScheduledJobInput`,description:`Input for creating a scheduled job`,fields:{name:{type:e.String_unsecure(),isOptional:!1},description:{type:e.String_unsecure(),isOptional:!0},cronExpression:{type:e.String_unsecure(),isOptional:!1},timezone:{type:e.String_unsecure(),isOptional:!0},jobType:{type:e.String_unsecure(),isOptional:!1},payload:{type:e.JSON(),isOptional:!0},maxRetries:{type:e.Int_unsecure(),isOptional:!0},enabled:{type:e.Boolean(),isOptional:!0}}}),p=t({name:`ListScheduledJobsOutput`,description:`Output for listing scheduled jobs`,fields:{schedules:{type:o,isArray:!0,isOptional:!1}}}),m=t({name:`ToggleScheduledJobInput`,description:`Input for toggling a scheduled job`,fields:{name:{type:e.String_unsecure(),isOptional:!1},enabled:{type:e.Boolean(),isOptional:!1}}}),h=t({name:`JobEnqueuedPayload`,description:`Payload for job.enqueued event`,fields:{jobId:{type:e.String_unsecure(),isOptional:!1},type:{type:e.String_unsecure(),isOptional:!1},priority:{type:e.Int_unsecure(),isOptional:!1},scheduledAt:{type:e.DateTime(),isOptional:!0},tenantId:{type:e.String_unsecure(),isOptional:!0},enqueuedAt:{type:e.DateTime(),isOptional:!1}}}),g=t({name:`JobCancelledPayload`,description:`Payload for job.cancelled event`,fields:{jobId:{type:e.String_unsecure(),isOptional:!1}}}),_=n({meta:{name:`jobs.enqueue`,version:1,stability:`stable`,owners:[...i],tags:[`jobs`,`enqueue`],description:`Enqueue a background job for async processing.`,goal:`Allow services to offload work to background processing.`,context:`Called by any service that needs async processing.`},io:{input:c,output:a},policy:{auth:`user`},sideEffects:{emits:[{name:`job.enqueued`,version:1,when:`Job is enqueued`,payload:h}]}}),v=r({meta:{name:`jobs.get`,version:1,stability:`stable`,owners:[...i],tags:[`jobs`,`get`],description:`Get a job by ID.`,goal:`Check job status and result.`,context:`Called to poll job status or retrieve results.`},io:{input:l,output:a},policy:{auth:`user`}}),y=n({meta:{name:`jobs.cancel`,version:1,stability:`stable`,owners:[...i],tags:[`jobs`,`cancel`],description:`Cancel a pending job.`,goal:`Allow cancellation of jobs that are no longer needed.`,context:`Only pending jobs can be cancelled.`},io:{input:u,output:d,errors:{JOB_NOT_FOUND:{description:`Job does not exist`,http:404,gqlCode:`JOB_NOT_FOUND`,when:`Job ID is invalid`},JOB_NOT_PENDING:{description:`Job is not in pending state`,http:409,gqlCode:`JOB_NOT_PENDING`,when:`Job has already started or completed`}}},policy:{auth:`user`},sideEffects:{emits:[{name:`job.cancelled`,version:1,when:`Job is cancelled`,payload:g}]}}),b=r({meta:{name:`jobs.stats`,version:1,stability:`stable`,owners:[...i],tags:[`jobs`,`stats`,`admin`],description:`Get job queue statistics.`,goal:`Monitor queue health and backlog.`,context:`Admin dashboard monitoring.`},io:{input:null,output:s},policy:{auth:`admin`}}),x=n({meta:{name:`jobs.schedule.create`,version:1,stability:`stable`,owners:[...i],tags:[`jobs`,`schedule`,`create`],description:`Create a scheduled/recurring job.`,goal:`Set up recurring background tasks.`,context:`Admin configuration for periodic tasks.`},io:{input:f,output:o},policy:{auth:`admin`}}),S=r({meta:{name:`jobs.schedule.list`,version:1,stability:`stable`,owners:[...i],tags:[`jobs`,`schedule`,`list`],description:`List all scheduled jobs.`,goal:`View configured recurring tasks.`,context:`Admin dashboard.`},io:{input:null,output:p},policy:{auth:`admin`}}),C=n({meta:{name:`jobs.schedule.toggle`,version:1,stability:`stable`,owners:[...i],tags:[`jobs`,`schedule`,`toggle`],description:`Enable or disable a scheduled job.`,goal:`Control when recurring tasks run.`,context:`Admin control over scheduled tasks.`},io:{input:m,output:o},policy:{auth:`admin`}});export{y as CancelJobContract,x as CreateScheduledJobContract,_ as EnqueueJobContract,v as GetJobContract,b as GetQueueStatsContract,a as JobModel,S as ListScheduledJobsContract,s as QueueStatsModel,o as ScheduledJobModel,C as ToggleScheduledJobContract};