@contractspec/lib.jobs 1.44.1 → 1.45.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.
- package/README.md +1 -1
- package/dist/contracts/index.d.ts +140 -140
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +10 -10
- package/dist/contracts/index.js.map +1 -1
- package/dist/entities/index.d.ts +116 -116
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/events.js +8 -8
- package/dist/events.js.map +1 -1
- package/dist/jobs.feature.js +18 -18
- package/dist/jobs.feature.js.map +1 -1
- package/dist/queue/gcp-cloud-tasks.js +1 -1
- package/dist/queue/gcp-cloud-tasks.js.map +1 -1
- package/dist/queue/gcp-pubsub.js +1 -1
- package/dist/queue/gcp-pubsub.js.map +1 -1
- package/dist/queue/memory-queue.js +1 -1
- package/dist/queue/memory-queue.js.map +1 -1
- package/dist/queue/scaleway-sqs-queue.js +2 -2
- package/dist/queue/scaleway-sqs-queue.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/contracts/index.ts"],"sourcesContent":[],"mappings":";;;;cAOa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/contracts/index.ts"],"sourcesContent":[],"mappings":";;;;cAOa,sCAAQ;;UAmBnB,2BAAA,CAAA;;EAnBW,CAAA;EAmBX,IAAA,EAAA;;;;;;;;;;;;;;;;;;;;EAnBmB,QAAA,EAAA;IAqBR,IAAA,uCAkBX,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;;;;;;;;EAlB4B,WAAA,EAAA;IAoBjB,IAAA,uCAUX,KAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,IAAA;;;;;;EAV0B,WAAA,EAAA;IAmHf,IAAA,uCA4BX,KAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,IAAA;;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AA;;UAkBzB,2BAAA,CAAA;;;;;UAlByB,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAuBd,iDAAiB,0CAAA;;UA0C5B,2BAAA,CAAA;;;;;UA1C4B,2BAAA,CAAA;;;;;;;;;;;;;;;;;cA+CjB,uBAAqB,6BAAA,CAAA,cAkBhC,2BAAA,CAlBgC,cAAA,8BAAA;;UAAA,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;cAuBrB,0DAA0B,0CAAA;;UAkBrC,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAlBqC,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAuB1B,2BAAyB,6BAAA,CAAA,cAkBpC,2BAAA,CAlBoC,cAAA,8BAAA;;;;cAAA,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAuBzB,0DAA0B,0CAAA;;UAkBrC,2BAAA,CAAA;;;;;;;;;UAlBqC,2BAAA,CAAA"}
|
package/dist/contracts/index.js
CHANGED
|
@@ -16,7 +16,7 @@ const JobModel = defineSchemaModel({
|
|
|
16
16
|
isOptional: false
|
|
17
17
|
},
|
|
18
18
|
version: {
|
|
19
|
-
type: ScalarTypeEnum.
|
|
19
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
20
20
|
isOptional: false
|
|
21
21
|
},
|
|
22
22
|
payload: {
|
|
@@ -300,7 +300,7 @@ const JobCancelledPayload = defineSchemaModel({
|
|
|
300
300
|
const EnqueueJobContract = defineCommand({
|
|
301
301
|
meta: {
|
|
302
302
|
key: "jobs.enqueue",
|
|
303
|
-
version: 1,
|
|
303
|
+
version: "1.0.0",
|
|
304
304
|
stability: "stable",
|
|
305
305
|
owners: [...OWNERS],
|
|
306
306
|
tags: ["jobs", "enqueue"],
|
|
@@ -315,7 +315,7 @@ const EnqueueJobContract = defineCommand({
|
|
|
315
315
|
policy: { auth: "user" },
|
|
316
316
|
sideEffects: { emits: [{
|
|
317
317
|
key: "job.enqueued",
|
|
318
|
-
version: 1,
|
|
318
|
+
version: "1.0.0",
|
|
319
319
|
when: "Job is enqueued",
|
|
320
320
|
payload: JobEnqueuedPayload
|
|
321
321
|
}] }
|
|
@@ -326,7 +326,7 @@ const EnqueueJobContract = defineCommand({
|
|
|
326
326
|
const GetJobContract = defineQuery({
|
|
327
327
|
meta: {
|
|
328
328
|
key: "jobs.get",
|
|
329
|
-
version: 1,
|
|
329
|
+
version: "1.0.0",
|
|
330
330
|
stability: "stable",
|
|
331
331
|
owners: [...OWNERS],
|
|
332
332
|
tags: ["jobs", "get"],
|
|
@@ -346,7 +346,7 @@ const GetJobContract = defineQuery({
|
|
|
346
346
|
const CancelJobContract = defineCommand({
|
|
347
347
|
meta: {
|
|
348
348
|
key: "jobs.cancel",
|
|
349
|
-
version: 1,
|
|
349
|
+
version: "1.0.0",
|
|
350
350
|
stability: "stable",
|
|
351
351
|
owners: [...OWNERS],
|
|
352
352
|
tags: ["jobs", "cancel"],
|
|
@@ -375,7 +375,7 @@ const CancelJobContract = defineCommand({
|
|
|
375
375
|
policy: { auth: "user" },
|
|
376
376
|
sideEffects: { emits: [{
|
|
377
377
|
key: "job.cancelled",
|
|
378
|
-
version: 1,
|
|
378
|
+
version: "1.0.0",
|
|
379
379
|
when: "Job is cancelled",
|
|
380
380
|
payload: JobCancelledPayload
|
|
381
381
|
}] }
|
|
@@ -386,7 +386,7 @@ const CancelJobContract = defineCommand({
|
|
|
386
386
|
const GetQueueStatsContract = defineQuery({
|
|
387
387
|
meta: {
|
|
388
388
|
key: "jobs.stats",
|
|
389
|
-
version: 1,
|
|
389
|
+
version: "1.0.0",
|
|
390
390
|
stability: "stable",
|
|
391
391
|
owners: [...OWNERS],
|
|
392
392
|
tags: [
|
|
@@ -410,7 +410,7 @@ const GetQueueStatsContract = defineQuery({
|
|
|
410
410
|
const CreateScheduledJobContract = defineCommand({
|
|
411
411
|
meta: {
|
|
412
412
|
key: "jobs.schedule.create",
|
|
413
|
-
version: 1,
|
|
413
|
+
version: "1.0.0",
|
|
414
414
|
stability: "stable",
|
|
415
415
|
owners: [...OWNERS],
|
|
416
416
|
tags: [
|
|
@@ -434,7 +434,7 @@ const CreateScheduledJobContract = defineCommand({
|
|
|
434
434
|
const ListScheduledJobsContract = defineQuery({
|
|
435
435
|
meta: {
|
|
436
436
|
key: "jobs.schedule.list",
|
|
437
|
-
version: 1,
|
|
437
|
+
version: "1.0.0",
|
|
438
438
|
stability: "stable",
|
|
439
439
|
owners: [...OWNERS],
|
|
440
440
|
tags: [
|
|
@@ -458,7 +458,7 @@ const ListScheduledJobsContract = defineQuery({
|
|
|
458
458
|
const ToggleScheduledJobContract = defineCommand({
|
|
459
459
|
meta: {
|
|
460
460
|
key: "jobs.schedule.toggle",
|
|
461
|
-
version: 1,
|
|
461
|
+
version: "1.0.0",
|
|
462
462
|
stability: "stable",
|
|
463
463
|
owners: [...OWNERS],
|
|
464
464
|
tags: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/contracts/index.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineCommand, defineQuery } from '@contractspec/lib.contracts';\n\nconst OWNERS = ['platform.jobs'] as const;\n\n// ============ Schema Models ============\n\nexport const JobModel = defineSchemaModel({\n name: 'Job',\n description: 'Represents a background job',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n version: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n payload: { type: ScalarTypeEnum.JSON(), isOptional: false },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }, // JobStatus enum value\n priority: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n attempts: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n maxRetries: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n scheduledAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n lastError: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nexport const ScheduledJobModel = defineSchemaModel({\n name: 'ScheduledJob',\n description: 'Represents a scheduled/recurring job',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n cronExpression: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n timezone: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n jobType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n enabled: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n lastRunAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n nextRunAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const QueueStatsModel = defineSchemaModel({\n name: 'QueueStats',\n description: 'Job queue statistics',\n fields: {\n pending: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n running: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n completed: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n failed: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n deadLetter: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\n// ============ Input/Output Models ============\n\nconst EnqueueJobInput = defineSchemaModel({\n name: 'EnqueueJobInput',\n description: 'Input for enqueuing a new job',\n fields: {\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n payload: { type: ScalarTypeEnum.JSON(), isOptional: false },\n delaySeconds: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n dedupeKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n maxRetries: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n priority: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n },\n});\n\nconst GetJobInput = defineSchemaModel({\n name: 'GetJobInput',\n description: 'Input for getting a job by ID',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst CancelJobInput = defineSchemaModel({\n name: 'CancelJobInput',\n description: 'Input for cancelling a job',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst CancelJobOutput = defineSchemaModel({\n name: 'CancelJobOutput',\n description: 'Output for cancel job operation',\n fields: {\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n});\n\nconst CreateScheduledJobInput = defineSchemaModel({\n name: 'CreateScheduledJobInput',\n description: 'Input for creating a scheduled job',\n fields: {\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n cronExpression: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n timezone: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n jobType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n payload: { type: ScalarTypeEnum.JSON(), isOptional: true },\n maxRetries: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n enabled: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n },\n});\n\nconst ListScheduledJobsOutput = defineSchemaModel({\n name: 'ListScheduledJobsOutput',\n description: 'Output for listing scheduled jobs',\n fields: {\n schedules: { type: ScheduledJobModel, isArray: true, isOptional: false },\n },\n});\n\nconst ToggleScheduledJobInput = defineSchemaModel({\n name: 'ToggleScheduledJobInput',\n description: 'Input for toggling a scheduled job',\n fields: {\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n enabled: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n});\n\n// ============ Event Payloads ============\n\nconst JobEnqueuedPayload = defineSchemaModel({\n name: 'JobEnqueuedPayload',\n description: 'Payload for job.enqueued event',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n priority: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n scheduledAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n tenantId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n enqueuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst JobCancelledPayload = defineSchemaModel({\n name: 'JobCancelledPayload',\n description: 'Payload for job.cancelled event',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\n// ============ Contracts ============\n\n/**\n * Enqueue a job.\n */\nexport const EnqueueJobContract = defineCommand({\n meta: {\n key: 'jobs.enqueue',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['jobs', 'enqueue'],\n description: 'Enqueue a background job for async processing.',\n goal: 'Allow services to offload work to background processing.',\n context: 'Called by any service that needs async processing.',\n },\n io: {\n input: EnqueueJobInput,\n output: JobModel,\n },\n policy: {\n auth: 'user',\n },\n sideEffects: {\n emits: [\n {\n key: 'job.enqueued',\n version: 1,\n when: 'Job is enqueued',\n payload: JobEnqueuedPayload,\n },\n ],\n },\n});\n\n/**\n * Get job by ID.\n */\nexport const GetJobContract = defineQuery({\n meta: {\n key: 'jobs.get',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['jobs', 'get'],\n description: 'Get a job by ID.',\n goal: 'Check job status and result.',\n context: 'Called to poll job status or retrieve results.',\n },\n io: {\n input: GetJobInput,\n output: JobModel,\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * Cancel a job.\n */\nexport const CancelJobContract = defineCommand({\n meta: {\n key: 'jobs.cancel',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['jobs', 'cancel'],\n description: 'Cancel a pending job.',\n goal: 'Allow cancellation of jobs that are no longer needed.',\n context: 'Only pending jobs can be cancelled.',\n },\n io: {\n input: CancelJobInput,\n output: CancelJobOutput,\n errors: {\n JOB_NOT_FOUND: {\n description: 'Job does not exist',\n http: 404,\n gqlCode: 'JOB_NOT_FOUND',\n when: 'Job ID is invalid',\n },\n JOB_NOT_PENDING: {\n description: 'Job is not in pending state',\n http: 409,\n gqlCode: 'JOB_NOT_PENDING',\n when: 'Job has already started or completed',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n sideEffects: {\n emits: [\n {\n key: 'job.cancelled',\n version: 1,\n when: 'Job is cancelled',\n payload: JobCancelledPayload,\n },\n ],\n },\n});\n\n/**\n * Get queue statistics.\n */\nexport const GetQueueStatsContract = defineQuery({\n meta: {\n key: 'jobs.stats',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['jobs', 'stats', 'admin'],\n description: 'Get job queue statistics.',\n goal: 'Monitor queue health and backlog.',\n context: 'Admin dashboard monitoring.',\n },\n io: {\n input: null,\n output: QueueStatsModel,\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Create a scheduled job.\n */\nexport const CreateScheduledJobContract = defineCommand({\n meta: {\n key: 'jobs.schedule.create',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['jobs', 'schedule', 'create'],\n description: 'Create a scheduled/recurring job.',\n goal: 'Set up recurring background tasks.',\n context: 'Admin configuration for periodic tasks.',\n },\n io: {\n input: CreateScheduledJobInput,\n output: ScheduledJobModel,\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * List scheduled jobs.\n */\nexport const ListScheduledJobsContract = defineQuery({\n meta: {\n key: 'jobs.schedule.list',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['jobs', 'schedule', 'list'],\n description: 'List all scheduled jobs.',\n goal: 'View configured recurring tasks.',\n context: 'Admin dashboard.',\n },\n io: {\n input: null,\n output: ListScheduledJobsOutput,\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Toggle scheduled job enabled state.\n */\nexport const ToggleScheduledJobContract = defineCommand({\n meta: {\n key: 'jobs.schedule.toggle',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['jobs', 'schedule', 'toggle'],\n description: 'Enable or disable a scheduled job.',\n goal: 'Control when recurring tasks run.',\n context: 'Admin control over scheduled tasks.',\n },\n io: {\n input: ToggleScheduledJobInput,\n output: ScheduledJobModel,\n },\n policy: {\n auth: 'admin',\n },\n});\n"],"mappings":";;;;AAGA,MAAM,SAAS,CAAC,gBAAgB;AAIhC,MAAa,WAAW,kBAAkB;CACxC,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,SAAS;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACnE,SAAS;GAAE,MAAM,eAAe,MAAM;GAAE,YAAY;GAAO;EAC3D,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,UAAU;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACpE,UAAU;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACpE,YAAY;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACtE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACjE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACjE,aAAa;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAM;EAClE,WAAW;G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S;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,SACP;CACF,CAAC;;;;AAKF,MAAa,4BAA4B,YAAY;CACnD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAQ;GAAY;GAAO;EAClC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,SACP;CACF,CAAC;;;;AAKF,MAAa,6BAA6B,cAAc;CACtD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAQ;GAAY;GAAS;EACpC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,SACP;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/contracts/index.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineCommand, defineQuery } from '@contractspec/lib.contracts';\n\nconst OWNERS = ['platform.jobs'] as const;\n\n// ============ Schema Models ============\n\nexport const JobModel = defineSchemaModel({\n name: 'Job',\n description: 'Represents a background job',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n version: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n payload: { type: ScalarTypeEnum.JSON(), isOptional: false },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }, // JobStatus enum value\n priority: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n attempts: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n maxRetries: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n scheduledAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n lastError: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nexport const ScheduledJobModel = defineSchemaModel({\n name: 'ScheduledJob',\n description: 'Represents a scheduled/recurring job',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n cronExpression: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n timezone: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n jobType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n enabled: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n lastRunAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n nextRunAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const QueueStatsModel = defineSchemaModel({\n name: 'QueueStats',\n description: 'Job queue statistics',\n fields: {\n pending: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n running: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n completed: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n failed: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n deadLetter: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\n// ============ Input/Output Models ============\n\nconst EnqueueJobInput = defineSchemaModel({\n name: 'EnqueueJobInput',\n description: 'Input for enqueuing a new job',\n fields: {\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n payload: { type: ScalarTypeEnum.JSON(), isOptional: false },\n delaySeconds: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n dedupeKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n maxRetries: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n priority: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n },\n});\n\nconst GetJobInput = defineSchemaModel({\n name: 'GetJobInput',\n description: 'Input for getting a job by ID',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst CancelJobInput = defineSchemaModel({\n name: 'CancelJobInput',\n description: 'Input for cancelling a job',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst CancelJobOutput = defineSchemaModel({\n name: 'CancelJobOutput',\n description: 'Output for cancel job operation',\n fields: {\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n});\n\nconst CreateScheduledJobInput = defineSchemaModel({\n name: 'CreateScheduledJobInput',\n description: 'Input for creating a scheduled job',\n fields: {\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n cronExpression: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n timezone: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n jobType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n payload: { type: ScalarTypeEnum.JSON(), isOptional: true },\n maxRetries: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n enabled: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n },\n});\n\nconst ListScheduledJobsOutput = defineSchemaModel({\n name: 'ListScheduledJobsOutput',\n description: 'Output for listing scheduled jobs',\n fields: {\n schedules: { type: ScheduledJobModel, isArray: true, isOptional: false },\n },\n});\n\nconst ToggleScheduledJobInput = defineSchemaModel({\n name: 'ToggleScheduledJobInput',\n description: 'Input for toggling a scheduled job',\n fields: {\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n enabled: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n});\n\n// ============ Event Payloads ============\n\nconst JobEnqueuedPayload = defineSchemaModel({\n name: 'JobEnqueuedPayload',\n description: 'Payload for job.enqueued event',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n priority: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n scheduledAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n tenantId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n enqueuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst JobCancelledPayload = defineSchemaModel({\n name: 'JobCancelledPayload',\n description: 'Payload for job.cancelled event',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\n// ============ Contracts ============\n\n/**\n * Enqueue a job.\n */\nexport const EnqueueJobContract = defineCommand({\n meta: {\n key: 'jobs.enqueue',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['jobs', 'enqueue'],\n description: 'Enqueue a background job for async processing.',\n goal: 'Allow services to offload work to background processing.',\n context: 'Called by any service that needs async processing.',\n },\n io: {\n input: EnqueueJobInput,\n output: JobModel,\n },\n policy: {\n auth: 'user',\n },\n sideEffects: {\n emits: [\n {\n key: 'job.enqueued',\n version: '1.0.0',\n when: 'Job is enqueued',\n payload: JobEnqueuedPayload,\n },\n ],\n },\n});\n\n/**\n * Get job by ID.\n */\nexport const GetJobContract = defineQuery({\n meta: {\n key: 'jobs.get',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['jobs', 'get'],\n description: 'Get a job by ID.',\n goal: 'Check job status and result.',\n context: 'Called to poll job status or retrieve results.',\n },\n io: {\n input: GetJobInput,\n output: JobModel,\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * Cancel a job.\n */\nexport const CancelJobContract = defineCommand({\n meta: {\n key: 'jobs.cancel',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['jobs', 'cancel'],\n description: 'Cancel a pending job.',\n goal: 'Allow cancellation of jobs that are no longer needed.',\n context: 'Only pending jobs can be cancelled.',\n },\n io: {\n input: CancelJobInput,\n output: CancelJobOutput,\n errors: {\n JOB_NOT_FOUND: {\n description: 'Job does not exist',\n http: 404,\n gqlCode: 'JOB_NOT_FOUND',\n when: 'Job ID is invalid',\n },\n JOB_NOT_PENDING: {\n description: 'Job is not in pending state',\n http: 409,\n gqlCode: 'JOB_NOT_PENDING',\n when: 'Job has already started or completed',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n sideEffects: {\n emits: [\n {\n key: 'job.cancelled',\n version: '1.0.0',\n when: 'Job is cancelled',\n payload: JobCancelledPayload,\n },\n ],\n },\n});\n\n/**\n * Get queue statistics.\n */\nexport const GetQueueStatsContract = defineQuery({\n meta: {\n key: 'jobs.stats',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['jobs', 'stats', 'admin'],\n description: 'Get job queue statistics.',\n goal: 'Monitor queue health and backlog.',\n context: 'Admin dashboard monitoring.',\n },\n io: {\n input: null,\n output: QueueStatsModel,\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Create a scheduled job.\n */\nexport const CreateScheduledJobContract = defineCommand({\n meta: {\n key: 'jobs.schedule.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['jobs', 'schedule', 'create'],\n description: 'Create a scheduled/recurring job.',\n goal: 'Set up recurring background tasks.',\n context: 'Admin configuration for periodic tasks.',\n },\n io: {\n input: CreateScheduledJobInput,\n output: ScheduledJobModel,\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * List scheduled jobs.\n */\nexport const ListScheduledJobsContract = defineQuery({\n meta: {\n key: 'jobs.schedule.list',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['jobs', 'schedule', 'list'],\n description: 'List all scheduled jobs.',\n goal: 'View configured recurring tasks.',\n context: 'Admin dashboard.',\n },\n io: {\n input: null,\n output: ListScheduledJobsOutput,\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Toggle scheduled job enabled state.\n */\nexport const ToggleScheduledJobContract = defineCommand({\n meta: {\n key: 'jobs.schedule.toggle',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['jobs', 'schedule', 'toggle'],\n description: 'Enable or disable a scheduled job.',\n goal: 'Control when recurring tasks run.',\n context: 'Admin control over scheduled tasks.',\n },\n io: {\n input: ToggleScheduledJobInput,\n output: ScheduledJobModel,\n },\n policy: {\n auth: 'admin',\n },\n});\n"],"mappings":";;;;AAGA,MAAM,SAAS,CAAC,gBAAgB;AAIhC,MAAa,WAAW,kBAAkB;CACxC,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,SAAS;GAAE,MAAM,eAAe,MAAM;GAAE,YAAY;GAAO;EAC3D,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,UAAU;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACpE,UAAU;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACpE,YAAY;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACtE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACjE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACjE,aAAa;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAM;EAClE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAM;EAChE,a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D,QAAQ,EACN,MAAM,SACP;CACF,CAAC;;;;AAKF,MAAa,4BAA4B,YAAY;CACnD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAQ;GAAY;GAAO;EAClC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,SACP;CACF,CAAC;;;;AAKF,MAAa,6BAA6B,cAAc;CACtD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAQ;GAAY;GAAS;EACpC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,SACP;CACF,CAAC"}
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _contractspec_lib_schema95 from "@contractspec/lib.schema";
|
|
2
2
|
import { ModuleSchemaContribution } from "@contractspec/lib.schema";
|
|
3
3
|
|
|
4
4
|
//#region src/entities/index.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Job status enum.
|
|
7
7
|
*/
|
|
8
|
-
declare const JobStatusEnum:
|
|
8
|
+
declare const JobStatusEnum: _contractspec_lib_schema95.EntityEnumDef;
|
|
9
9
|
/**
|
|
10
10
|
* Job entity - represents a single job execution.
|
|
11
11
|
*/
|
|
12
|
-
declare const JobEntity:
|
|
13
|
-
id:
|
|
14
|
-
type:
|
|
15
|
-
version:
|
|
16
|
-
payload:
|
|
17
|
-
status:
|
|
18
|
-
priority:
|
|
19
|
-
attempts:
|
|
20
|
-
maxRetries:
|
|
21
|
-
lastError:
|
|
22
|
-
lastErrorStack:
|
|
23
|
-
scheduledAt:
|
|
24
|
-
startedAt:
|
|
25
|
-
completedAt:
|
|
26
|
-
timeoutAt:
|
|
27
|
-
dedupeKey:
|
|
28
|
-
tenantId:
|
|
29
|
-
userId:
|
|
30
|
-
traceId:
|
|
31
|
-
metadata:
|
|
32
|
-
result:
|
|
33
|
-
createdAt:
|
|
34
|
-
updatedAt:
|
|
35
|
-
scheduledJob:
|
|
36
|
-
scheduledJobId:
|
|
37
|
-
executions:
|
|
12
|
+
declare const JobEntity: _contractspec_lib_schema95.EntitySpec<{
|
|
13
|
+
id: _contractspec_lib_schema95.EntityScalarField;
|
|
14
|
+
type: _contractspec_lib_schema95.EntityScalarField;
|
|
15
|
+
version: _contractspec_lib_schema95.EntityScalarField;
|
|
16
|
+
payload: _contractspec_lib_schema95.EntityScalarField;
|
|
17
|
+
status: _contractspec_lib_schema95.EntityEnumField;
|
|
18
|
+
priority: _contractspec_lib_schema95.EntityScalarField;
|
|
19
|
+
attempts: _contractspec_lib_schema95.EntityScalarField;
|
|
20
|
+
maxRetries: _contractspec_lib_schema95.EntityScalarField;
|
|
21
|
+
lastError: _contractspec_lib_schema95.EntityScalarField;
|
|
22
|
+
lastErrorStack: _contractspec_lib_schema95.EntityScalarField;
|
|
23
|
+
scheduledAt: _contractspec_lib_schema95.EntityScalarField;
|
|
24
|
+
startedAt: _contractspec_lib_schema95.EntityScalarField;
|
|
25
|
+
completedAt: _contractspec_lib_schema95.EntityScalarField;
|
|
26
|
+
timeoutAt: _contractspec_lib_schema95.EntityScalarField;
|
|
27
|
+
dedupeKey: _contractspec_lib_schema95.EntityScalarField;
|
|
28
|
+
tenantId: _contractspec_lib_schema95.EntityScalarField;
|
|
29
|
+
userId: _contractspec_lib_schema95.EntityScalarField;
|
|
30
|
+
traceId: _contractspec_lib_schema95.EntityScalarField;
|
|
31
|
+
metadata: _contractspec_lib_schema95.EntityScalarField;
|
|
32
|
+
result: _contractspec_lib_schema95.EntityScalarField;
|
|
33
|
+
createdAt: _contractspec_lib_schema95.EntityScalarField;
|
|
34
|
+
updatedAt: _contractspec_lib_schema95.EntityScalarField;
|
|
35
|
+
scheduledJob: _contractspec_lib_schema95.EntityRelationField;
|
|
36
|
+
scheduledJobId: _contractspec_lib_schema95.EntityScalarField;
|
|
37
|
+
executions: _contractspec_lib_schema95.EntityRelationField;
|
|
38
38
|
}>;
|
|
39
39
|
/**
|
|
40
40
|
* ScheduledJob entity - recurring job definitions.
|
|
41
41
|
*/
|
|
42
|
-
declare const ScheduledJobEntity:
|
|
43
|
-
id:
|
|
44
|
-
name:
|
|
45
|
-
description:
|
|
46
|
-
cronExpression:
|
|
47
|
-
timezone:
|
|
48
|
-
jobType:
|
|
49
|
-
jobVersion:
|
|
50
|
-
payload:
|
|
51
|
-
maxRetries:
|
|
52
|
-
timeoutMs:
|
|
53
|
-
enabled:
|
|
54
|
-
lastRunAt:
|
|
55
|
-
nextRunAt:
|
|
56
|
-
tenantId:
|
|
57
|
-
createdAt:
|
|
58
|
-
updatedAt:
|
|
59
|
-
jobs:
|
|
42
|
+
declare const ScheduledJobEntity: _contractspec_lib_schema95.EntitySpec<{
|
|
43
|
+
id: _contractspec_lib_schema95.EntityScalarField;
|
|
44
|
+
name: _contractspec_lib_schema95.EntityScalarField;
|
|
45
|
+
description: _contractspec_lib_schema95.EntityScalarField;
|
|
46
|
+
cronExpression: _contractspec_lib_schema95.EntityScalarField;
|
|
47
|
+
timezone: _contractspec_lib_schema95.EntityScalarField;
|
|
48
|
+
jobType: _contractspec_lib_schema95.EntityScalarField;
|
|
49
|
+
jobVersion: _contractspec_lib_schema95.EntityScalarField;
|
|
50
|
+
payload: _contractspec_lib_schema95.EntityScalarField;
|
|
51
|
+
maxRetries: _contractspec_lib_schema95.EntityScalarField;
|
|
52
|
+
timeoutMs: _contractspec_lib_schema95.EntityScalarField;
|
|
53
|
+
enabled: _contractspec_lib_schema95.EntityScalarField;
|
|
54
|
+
lastRunAt: _contractspec_lib_schema95.EntityScalarField;
|
|
55
|
+
nextRunAt: _contractspec_lib_schema95.EntityScalarField;
|
|
56
|
+
tenantId: _contractspec_lib_schema95.EntityScalarField;
|
|
57
|
+
createdAt: _contractspec_lib_schema95.EntityScalarField;
|
|
58
|
+
updatedAt: _contractspec_lib_schema95.EntityScalarField;
|
|
59
|
+
jobs: _contractspec_lib_schema95.EntityRelationField;
|
|
60
60
|
}>;
|
|
61
61
|
/**
|
|
62
62
|
* JobExecution entity - individual execution attempts.
|
|
63
63
|
*/
|
|
64
|
-
declare const JobExecutionEntity:
|
|
65
|
-
id:
|
|
66
|
-
jobId:
|
|
67
|
-
attemptNumber:
|
|
68
|
-
startedAt:
|
|
69
|
-
completedAt:
|
|
70
|
-
durationMs:
|
|
71
|
-
success:
|
|
72
|
-
error:
|
|
73
|
-
errorStack:
|
|
74
|
-
result:
|
|
75
|
-
workerId:
|
|
76
|
-
job:
|
|
64
|
+
declare const JobExecutionEntity: _contractspec_lib_schema95.EntitySpec<{
|
|
65
|
+
id: _contractspec_lib_schema95.EntityScalarField;
|
|
66
|
+
jobId: _contractspec_lib_schema95.EntityScalarField;
|
|
67
|
+
attemptNumber: _contractspec_lib_schema95.EntityScalarField;
|
|
68
|
+
startedAt: _contractspec_lib_schema95.EntityScalarField;
|
|
69
|
+
completedAt: _contractspec_lib_schema95.EntityScalarField;
|
|
70
|
+
durationMs: _contractspec_lib_schema95.EntityScalarField;
|
|
71
|
+
success: _contractspec_lib_schema95.EntityScalarField;
|
|
72
|
+
error: _contractspec_lib_schema95.EntityScalarField;
|
|
73
|
+
errorStack: _contractspec_lib_schema95.EntityScalarField;
|
|
74
|
+
result: _contractspec_lib_schema95.EntityScalarField;
|
|
75
|
+
workerId: _contractspec_lib_schema95.EntityScalarField;
|
|
76
|
+
job: _contractspec_lib_schema95.EntityRelationField;
|
|
77
77
|
}>;
|
|
78
78
|
/**
|
|
79
79
|
* All job entities for schema composition.
|
|
80
80
|
*/
|
|
81
|
-
declare const jobEntities: (
|
|
82
|
-
id:
|
|
83
|
-
type:
|
|
84
|
-
version:
|
|
85
|
-
payload:
|
|
86
|
-
status:
|
|
87
|
-
priority:
|
|
88
|
-
attempts:
|
|
89
|
-
maxRetries:
|
|
90
|
-
lastError:
|
|
91
|
-
lastErrorStack:
|
|
92
|
-
scheduledAt:
|
|
93
|
-
startedAt:
|
|
94
|
-
completedAt:
|
|
95
|
-
timeoutAt:
|
|
96
|
-
dedupeKey:
|
|
97
|
-
tenantId:
|
|
98
|
-
userId:
|
|
99
|
-
traceId:
|
|
100
|
-
metadata:
|
|
101
|
-
result:
|
|
102
|
-
createdAt:
|
|
103
|
-
updatedAt:
|
|
104
|
-
scheduledJob:
|
|
105
|
-
scheduledJobId:
|
|
106
|
-
executions:
|
|
107
|
-
}> |
|
|
108
|
-
id:
|
|
109
|
-
name:
|
|
110
|
-
description:
|
|
111
|
-
cronExpression:
|
|
112
|
-
timezone:
|
|
113
|
-
jobType:
|
|
114
|
-
jobVersion:
|
|
115
|
-
payload:
|
|
116
|
-
maxRetries:
|
|
117
|
-
timeoutMs:
|
|
118
|
-
enabled:
|
|
119
|
-
lastRunAt:
|
|
120
|
-
nextRunAt:
|
|
121
|
-
tenantId:
|
|
122
|
-
createdAt:
|
|
123
|
-
updatedAt:
|
|
124
|
-
jobs:
|
|
125
|
-
}> |
|
|
126
|
-
id:
|
|
127
|
-
jobId:
|
|
128
|
-
attemptNumber:
|
|
129
|
-
startedAt:
|
|
130
|
-
completedAt:
|
|
131
|
-
durationMs:
|
|
132
|
-
success:
|
|
133
|
-
error:
|
|
134
|
-
errorStack:
|
|
135
|
-
result:
|
|
136
|
-
workerId:
|
|
137
|
-
job:
|
|
81
|
+
declare const jobEntities: (_contractspec_lib_schema95.EntitySpec<{
|
|
82
|
+
id: _contractspec_lib_schema95.EntityScalarField;
|
|
83
|
+
type: _contractspec_lib_schema95.EntityScalarField;
|
|
84
|
+
version: _contractspec_lib_schema95.EntityScalarField;
|
|
85
|
+
payload: _contractspec_lib_schema95.EntityScalarField;
|
|
86
|
+
status: _contractspec_lib_schema95.EntityEnumField;
|
|
87
|
+
priority: _contractspec_lib_schema95.EntityScalarField;
|
|
88
|
+
attempts: _contractspec_lib_schema95.EntityScalarField;
|
|
89
|
+
maxRetries: _contractspec_lib_schema95.EntityScalarField;
|
|
90
|
+
lastError: _contractspec_lib_schema95.EntityScalarField;
|
|
91
|
+
lastErrorStack: _contractspec_lib_schema95.EntityScalarField;
|
|
92
|
+
scheduledAt: _contractspec_lib_schema95.EntityScalarField;
|
|
93
|
+
startedAt: _contractspec_lib_schema95.EntityScalarField;
|
|
94
|
+
completedAt: _contractspec_lib_schema95.EntityScalarField;
|
|
95
|
+
timeoutAt: _contractspec_lib_schema95.EntityScalarField;
|
|
96
|
+
dedupeKey: _contractspec_lib_schema95.EntityScalarField;
|
|
97
|
+
tenantId: _contractspec_lib_schema95.EntityScalarField;
|
|
98
|
+
userId: _contractspec_lib_schema95.EntityScalarField;
|
|
99
|
+
traceId: _contractspec_lib_schema95.EntityScalarField;
|
|
100
|
+
metadata: _contractspec_lib_schema95.EntityScalarField;
|
|
101
|
+
result: _contractspec_lib_schema95.EntityScalarField;
|
|
102
|
+
createdAt: _contractspec_lib_schema95.EntityScalarField;
|
|
103
|
+
updatedAt: _contractspec_lib_schema95.EntityScalarField;
|
|
104
|
+
scheduledJob: _contractspec_lib_schema95.EntityRelationField;
|
|
105
|
+
scheduledJobId: _contractspec_lib_schema95.EntityScalarField;
|
|
106
|
+
executions: _contractspec_lib_schema95.EntityRelationField;
|
|
107
|
+
}> | _contractspec_lib_schema95.EntitySpec<{
|
|
108
|
+
id: _contractspec_lib_schema95.EntityScalarField;
|
|
109
|
+
name: _contractspec_lib_schema95.EntityScalarField;
|
|
110
|
+
description: _contractspec_lib_schema95.EntityScalarField;
|
|
111
|
+
cronExpression: _contractspec_lib_schema95.EntityScalarField;
|
|
112
|
+
timezone: _contractspec_lib_schema95.EntityScalarField;
|
|
113
|
+
jobType: _contractspec_lib_schema95.EntityScalarField;
|
|
114
|
+
jobVersion: _contractspec_lib_schema95.EntityScalarField;
|
|
115
|
+
payload: _contractspec_lib_schema95.EntityScalarField;
|
|
116
|
+
maxRetries: _contractspec_lib_schema95.EntityScalarField;
|
|
117
|
+
timeoutMs: _contractspec_lib_schema95.EntityScalarField;
|
|
118
|
+
enabled: _contractspec_lib_schema95.EntityScalarField;
|
|
119
|
+
lastRunAt: _contractspec_lib_schema95.EntityScalarField;
|
|
120
|
+
nextRunAt: _contractspec_lib_schema95.EntityScalarField;
|
|
121
|
+
tenantId: _contractspec_lib_schema95.EntityScalarField;
|
|
122
|
+
createdAt: _contractspec_lib_schema95.EntityScalarField;
|
|
123
|
+
updatedAt: _contractspec_lib_schema95.EntityScalarField;
|
|
124
|
+
jobs: _contractspec_lib_schema95.EntityRelationField;
|
|
125
|
+
}> | _contractspec_lib_schema95.EntitySpec<{
|
|
126
|
+
id: _contractspec_lib_schema95.EntityScalarField;
|
|
127
|
+
jobId: _contractspec_lib_schema95.EntityScalarField;
|
|
128
|
+
attemptNumber: _contractspec_lib_schema95.EntityScalarField;
|
|
129
|
+
startedAt: _contractspec_lib_schema95.EntityScalarField;
|
|
130
|
+
completedAt: _contractspec_lib_schema95.EntityScalarField;
|
|
131
|
+
durationMs: _contractspec_lib_schema95.EntityScalarField;
|
|
132
|
+
success: _contractspec_lib_schema95.EntityScalarField;
|
|
133
|
+
error: _contractspec_lib_schema95.EntityScalarField;
|
|
134
|
+
errorStack: _contractspec_lib_schema95.EntityScalarField;
|
|
135
|
+
result: _contractspec_lib_schema95.EntityScalarField;
|
|
136
|
+
workerId: _contractspec_lib_schema95.EntityScalarField;
|
|
137
|
+
job: _contractspec_lib_schema95.EntityRelationField;
|
|
138
138
|
}>)[];
|
|
139
139
|
/**
|
|
140
140
|
* Module schema contribution for jobs.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/entities/index.ts"],"sourcesContent":[],"mappings":";;;;;;;AAWa,cAAA,aAYX,EAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/entities/index.ts"],"sourcesContent":[],"mappings":";;;;;;;AAWa,cAAA,aAYX,EAAA,0BAAA,CAZwB,aAYxB;AAKF;;;cAAa,sCAAS;MA4FpB,0BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;8DA5FoB;EAAA,cAAA,8CAAA;EAiGT,UAAA,gDAkDX;CAAA,CAAA;;;;cAlDW,+CAAkB;MAkD7B,0BAAA,CAAA;;;;;;;;;;;;yDAlD6B;EAAA,QAAA,8CAAA;EAuDlB,SAAA,8CA+BX;EAAA,SAAA,8CAAA;;;;;;cA/BW,+CAAkB;MA+B7B,0BAAA,CAAA;;;;;0DA/B6B;EAAA,OAAA,8CAAA;EAoClB,KAAA,8CAAiE;EAAA,UAAA,8CAAA;;;;;;;;cAAjE,yCAAW;MAAsD,0BAAA,CAAA;;;;;;;;;;;;;;;;sDAAtD;EAAA,OAAA,8CAAA;;;;;;;;;MAAA,0BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;EAKX,UAAA,8CAIZ;;;;;;;;;;;cAJY,wBAAwB"}
|
package/dist/events.js
CHANGED
|
@@ -216,7 +216,7 @@ const ScheduledJobTriggeredPayload = defineSchemaModel({
|
|
|
216
216
|
const JobEnqueuedEvent = defineEvent({
|
|
217
217
|
meta: {
|
|
218
218
|
key: "job.enqueued",
|
|
219
|
-
version: 1,
|
|
219
|
+
version: "1.0.0",
|
|
220
220
|
description: "A job has been added to the queue.",
|
|
221
221
|
stability: StabilityEnum.Stable,
|
|
222
222
|
owners: ["@contractspec.libs.jobs"],
|
|
@@ -230,7 +230,7 @@ const JobEnqueuedEvent = defineEvent({
|
|
|
230
230
|
const JobStartedEvent = defineEvent({
|
|
231
231
|
meta: {
|
|
232
232
|
key: "job.started",
|
|
233
|
-
version: 1,
|
|
233
|
+
version: "1.0.0",
|
|
234
234
|
description: "A job has started processing.",
|
|
235
235
|
stability: StabilityEnum.Stable,
|
|
236
236
|
owners: ["@contractspec.libs.jobs"],
|
|
@@ -244,7 +244,7 @@ const JobStartedEvent = defineEvent({
|
|
|
244
244
|
const JobCompletedEvent = defineEvent({
|
|
245
245
|
meta: {
|
|
246
246
|
key: "job.completed",
|
|
247
|
-
version: 1,
|
|
247
|
+
version: "1.0.0",
|
|
248
248
|
description: "A job has completed successfully.",
|
|
249
249
|
stability: StabilityEnum.Stable,
|
|
250
250
|
owners: ["@contractspec.libs.jobs"],
|
|
@@ -258,7 +258,7 @@ const JobCompletedEvent = defineEvent({
|
|
|
258
258
|
const JobFailedEvent = defineEvent({
|
|
259
259
|
meta: {
|
|
260
260
|
key: "job.failed",
|
|
261
|
-
version: 1,
|
|
261
|
+
version: "1.0.0",
|
|
262
262
|
description: "A job attempt has failed.",
|
|
263
263
|
stability: StabilityEnum.Stable,
|
|
264
264
|
owners: ["@contractspec.libs.jobs"],
|
|
@@ -276,7 +276,7 @@ const JobFailedEvent = defineEvent({
|
|
|
276
276
|
const JobRetryingEvent = defineEvent({
|
|
277
277
|
meta: {
|
|
278
278
|
key: "job.retrying",
|
|
279
|
-
version: 1,
|
|
279
|
+
version: "1.0.0",
|
|
280
280
|
description: "A job is being scheduled for retry.",
|
|
281
281
|
stability: StabilityEnum.Stable,
|
|
282
282
|
owners: ["@contractspec.libs.jobs"],
|
|
@@ -294,7 +294,7 @@ const JobRetryingEvent = defineEvent({
|
|
|
294
294
|
const JobDeadLetteredEvent = defineEvent({
|
|
295
295
|
meta: {
|
|
296
296
|
key: "job.dead_lettered",
|
|
297
|
-
version: 1,
|
|
297
|
+
version: "1.0.0",
|
|
298
298
|
description: "A job has exhausted all retries and moved to dead letter queue.",
|
|
299
299
|
stability: StabilityEnum.Stable,
|
|
300
300
|
owners: ["@contractspec.libs.jobs"],
|
|
@@ -312,7 +312,7 @@ const JobDeadLetteredEvent = defineEvent({
|
|
|
312
312
|
const JobCancelledEvent = defineEvent({
|
|
313
313
|
meta: {
|
|
314
314
|
key: "job.cancelled",
|
|
315
|
-
version: 1,
|
|
315
|
+
version: "1.0.0",
|
|
316
316
|
description: "A job has been cancelled.",
|
|
317
317
|
stability: StabilityEnum.Stable,
|
|
318
318
|
owners: ["@contractspec.libs.jobs"],
|
|
@@ -326,7 +326,7 @@ const JobCancelledEvent = defineEvent({
|
|
|
326
326
|
const ScheduledJobTriggeredEvent = defineEvent({
|
|
327
327
|
meta: {
|
|
328
328
|
key: "scheduler.job_triggered",
|
|
329
|
-
version: 1,
|
|
329
|
+
version: "1.0.0",
|
|
330
330
|
description: "A scheduled job has been triggered.",
|
|
331
331
|
stability: StabilityEnum.Stable,
|
|
332
332
|
owners: ["@contractspec.libs.jobs"],
|
package/dist/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","names":[],"sources":["../src/events.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineEvent, StabilityEnum } from '@contractspec/lib.contracts';\n\n// ============ Event Payloads ============\n\nconst JobEnqueuedPayload = defineSchemaModel({\n name: 'JobEnqueuedEventPayload',\n description: 'Payload when a job is added to the queue',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n priority: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n scheduledAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n tenantId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n enqueuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst JobStartedPayload = defineSchemaModel({\n name: 'JobStartedEventPayload',\n description: 'Payload when a job starts processing',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n attempt: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst JobCompletedPayload = defineSchemaModel({\n name: 'JobCompletedEventPayload',\n description: 'Payload when a job completes successfully',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n attempt: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst JobFailedPayload = defineSchemaModel({\n name: 'JobFailedEventPayload',\n description: 'Payload when a job attempt fails',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n attempt: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n error: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n willRetry: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n failedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst JobRetryingPayload = defineSchemaModel({\n name: 'JobRetryingEventPayload',\n description: 'Payload when a job is scheduled for retry',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n attempt: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n nextAttemptAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n backoffMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\nconst JobDeadLetteredPayload = defineSchemaModel({\n name: 'JobDeadLetteredEventPayload',\n description: 'Payload when a job is moved to dead letter queue',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n attempts: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n lastError: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n deadLetteredAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst JobCancelledPayload = defineSchemaModel({\n name: 'JobCancelledEventPayload',\n description: 'Payload when a job is cancelled',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n cancelledBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n cancelledAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst ScheduledJobTriggeredPayload = defineSchemaModel({\n name: 'ScheduledJobTriggeredEventPayload',\n description: 'Payload when a scheduled job is triggered',\n fields: {\n scheduleName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n jobType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n triggeredAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n nextRunAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\n// ============ Events ============\n\n/**\n * Emitted when a job is enqueued.\n */\nexport const JobEnqueuedEvent = defineEvent({\n meta: {\n key: 'job.enqueued',\n version: 1,\n description: 'A job has been added to the queue.',\n stability: StabilityEnum.Stable,\n owners: ['@contractspec.libs.jobs'],\n tags: ['job-queue', 'lifecycle'],\n },\n payload: JobEnqueuedPayload,\n});\n\n/**\n * Emitted when a job starts processing.\n */\nexport const JobStartedEvent = defineEvent({\n meta: {\n key: 'job.started',\n version: 1,\n description: 'A job has started processing.',\n stability: StabilityEnum.Stable,\n owners: ['@contractspec.libs.jobs'],\n tags: ['job-queue', 'lifecycle'],\n },\n payload: JobStartedPayload,\n});\n\n/**\n * Emitted when a job completes successfully.\n */\nexport const JobCompletedEvent = defineEvent({\n meta: {\n key: 'job.completed',\n version: 1,\n description: 'A job has completed successfully.',\n stability: StabilityEnum.Stable,\n owners: ['@contractspec.libs.jobs'],\n tags: ['job-queue', 'lifecycle'],\n },\n payload: JobCompletedPayload,\n});\n\n/**\n * Emitted when a job fails (single attempt).\n */\nexport const JobFailedEvent = defineEvent({\n meta: {\n key: 'job.failed',\n version: 1,\n description: 'A job attempt has failed.',\n stability: StabilityEnum.Stable,\n owners: ['@contractspec.libs.jobs'],\n tags: ['job-queue', 'lifecycle', 'error'],\n },\n payload: JobFailedPayload,\n});\n\n/**\n * Emitted when a job is being retried.\n */\nexport const JobRetryingEvent = defineEvent({\n meta: {\n key: 'job.retrying',\n version: 1,\n description: 'A job is being scheduled for retry.',\n stability: StabilityEnum.Stable,\n owners: ['@contractspec.libs.jobs'],\n tags: ['job-queue', 'lifecycle', 'retry'],\n },\n payload: JobRetryingPayload,\n});\n\n/**\n * Emitted when a job is moved to dead letter queue.\n */\nexport const JobDeadLetteredEvent = defineEvent({\n meta: {\n key: 'job.dead_lettered',\n version: 1,\n description:\n 'A job has exhausted all retries and moved to dead letter queue.',\n stability: StabilityEnum.Stable,\n owners: ['@contractspec.libs.jobs'],\n tags: ['job-queue', 'lifecycle', 'error'],\n },\n payload: JobDeadLetteredPayload,\n});\n\n/**\n * Emitted when a job is cancelled.\n */\nexport const JobCancelledEvent = defineEvent({\n meta: {\n key: 'job.cancelled',\n version: 1,\n description: 'A job has been cancelled.',\n stability: StabilityEnum.Stable,\n owners: ['@contractspec.libs.jobs'],\n tags: ['job-queue', 'lifecycle'],\n },\n payload: JobCancelledPayload,\n});\n\n/**\n * Emitted when a scheduled job is triggered.\n */\nexport const ScheduledJobTriggeredEvent = defineEvent({\n meta: {\n key: 'scheduler.job_triggered',\n version: 1,\n description: 'A scheduled job has been triggered.',\n stability: StabilityEnum.Stable,\n owners: ['@contractspec.libs.jobs'],\n tags: ['job-queue', 'scheduler'],\n },\n payload: ScheduledJobTriggeredPayload,\n});\n\n/**\n * All job events.\n */\nexport const JobEvents = {\n JobEnqueuedEvent,\n JobStartedEvent,\n JobCompletedEvent,\n JobFailedEvent,\n JobRetryingEvent,\n JobDeadLetteredEvent,\n JobCancelledEvent,\n ScheduledJobTriggeredEvent,\n};\n"],"mappings":";;;;AAKA,MAAM,qBAAqB,kBAAkB;CAC3C,MAAM;CACN,aAAa;C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;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,uBAAuB,YAAY;CAC9C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aACE;EACF,WAAW,cAAc;EACzB,QAAQ,CAAC,0BAA0B;EACnC,MAAM;GAAC;GAAa;GAAa;GAAQ;EAC1C;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,oBAAoB,YAAY;CAC3C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW,cAAc;EACzB,QAAQ,CAAC,0BAA0B;EACnC,MAAM,CAAC,aAAa,YAAY;EACjC;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,6BAA6B,YAAY;CACpD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW,cAAc;EACzB,QAAQ,CAAC,0BAA0B;EACnC,MAAM,CAAC,aAAa,YAAY;EACjC;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,YAAY;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
1
|
+
{"version":3,"file":"events.js","names":[],"sources":["../src/events.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineEvent, StabilityEnum } from '@contractspec/lib.contracts';\n\n// ============ Event Payloads ============\n\nconst JobEnqueuedPayload = defineSchemaModel({\n name: 'JobEnqueuedEventPayload',\n description: 'Payload when a job is added to the queue',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n priority: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n scheduledAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n tenantId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n enqueuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst JobStartedPayload = defineSchemaModel({\n name: 'JobStartedEventPayload',\n description: 'Payload when a job starts processing',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n attempt: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst JobCompletedPayload = defineSchemaModel({\n name: 'JobCompletedEventPayload',\n description: 'Payload when a job completes successfully',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n attempt: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst JobFailedPayload = defineSchemaModel({\n name: 'JobFailedEventPayload',\n description: 'Payload when a job attempt fails',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n attempt: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n error: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n willRetry: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n failedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst JobRetryingPayload = defineSchemaModel({\n name: 'JobRetryingEventPayload',\n description: 'Payload when a job is scheduled for retry',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n attempt: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n nextAttemptAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n backoffMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\nconst JobDeadLetteredPayload = defineSchemaModel({\n name: 'JobDeadLetteredEventPayload',\n description: 'Payload when a job is moved to dead letter queue',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n attempts: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n lastError: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n deadLetteredAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst JobCancelledPayload = defineSchemaModel({\n name: 'JobCancelledEventPayload',\n description: 'Payload when a job is cancelled',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n cancelledBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n cancelledAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst ScheduledJobTriggeredPayload = defineSchemaModel({\n name: 'ScheduledJobTriggeredEventPayload',\n description: 'Payload when a scheduled job is triggered',\n fields: {\n scheduleName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n jobType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n triggeredAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n nextRunAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\n// ============ Events ============\n\n/**\n * Emitted when a job is enqueued.\n */\nexport const JobEnqueuedEvent = defineEvent({\n meta: {\n key: 'job.enqueued',\n version: '1.0.0',\n description: 'A job has been added to the queue.',\n stability: StabilityEnum.Stable,\n owners: ['@contractspec.libs.jobs'],\n tags: ['job-queue', 'lifecycle'],\n },\n payload: JobEnqueuedPayload,\n});\n\n/**\n * Emitted when a job starts processing.\n */\nexport const JobStartedEvent = defineEvent({\n meta: {\n key: 'job.started',\n version: '1.0.0',\n description: 'A job has started processing.',\n stability: StabilityEnum.Stable,\n owners: ['@contractspec.libs.jobs'],\n tags: ['job-queue', 'lifecycle'],\n },\n payload: JobStartedPayload,\n});\n\n/**\n * Emitted when a job completes successfully.\n */\nexport const JobCompletedEvent = defineEvent({\n meta: {\n key: 'job.completed',\n version: '1.0.0',\n description: 'A job has completed successfully.',\n stability: StabilityEnum.Stable,\n owners: ['@contractspec.libs.jobs'],\n tags: ['job-queue', 'lifecycle'],\n },\n payload: JobCompletedPayload,\n});\n\n/**\n * Emitted when a job fails (single attempt).\n */\nexport const JobFailedEvent = defineEvent({\n meta: {\n key: 'job.failed',\n version: '1.0.0',\n description: 'A job attempt has failed.',\n stability: StabilityEnum.Stable,\n owners: ['@contractspec.libs.jobs'],\n tags: ['job-queue', 'lifecycle', 'error'],\n },\n payload: JobFailedPayload,\n});\n\n/**\n * Emitted when a job is being retried.\n */\nexport const JobRetryingEvent = defineEvent({\n meta: {\n key: 'job.retrying',\n version: '1.0.0',\n description: 'A job is being scheduled for retry.',\n stability: StabilityEnum.Stable,\n owners: ['@contractspec.libs.jobs'],\n tags: ['job-queue', 'lifecycle', 'retry'],\n },\n payload: JobRetryingPayload,\n});\n\n/**\n * Emitted when a job is moved to dead letter queue.\n */\nexport const JobDeadLetteredEvent = defineEvent({\n meta: {\n key: 'job.dead_lettered',\n version: '1.0.0',\n description:\n 'A job has exhausted all retries and moved to dead letter queue.',\n stability: StabilityEnum.Stable,\n owners: ['@contractspec.libs.jobs'],\n tags: ['job-queue', 'lifecycle', 'error'],\n },\n payload: JobDeadLetteredPayload,\n});\n\n/**\n * Emitted when a job is cancelled.\n */\nexport const JobCancelledEvent = defineEvent({\n meta: {\n key: 'job.cancelled',\n version: '1.0.0',\n description: 'A job has been cancelled.',\n stability: StabilityEnum.Stable,\n owners: ['@contractspec.libs.jobs'],\n tags: ['job-queue', 'lifecycle'],\n },\n payload: JobCancelledPayload,\n});\n\n/**\n * Emitted when a scheduled job is triggered.\n */\nexport const ScheduledJobTriggeredEvent = defineEvent({\n meta: {\n key: 'scheduler.job_triggered',\n version: '1.0.0',\n description: 'A scheduled job has been triggered.',\n stability: StabilityEnum.Stable,\n owners: ['@contractspec.libs.jobs'],\n tags: ['job-queue', 'scheduler'],\n },\n payload: ScheduledJobTriggeredPayload,\n});\n\n/**\n * All job events.\n */\nexport const JobEvents = {\n JobEnqueuedEvent,\n JobStartedEvent,\n JobCompletedEvent,\n JobFailedEvent,\n JobRetryingEvent,\n JobDeadLetteredEvent,\n JobCancelledEvent,\n ScheduledJobTriggeredEvent,\n};\n"],"mappings":";;;;AAKA,MAAM,qBAAqB,kBAAkB;CAC3C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACpE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,UAAU;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACpE,aAAa;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAM;EAClE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACtE,YAAY;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACnE;CACF,CAAC;AAEF,MAAM,oBAAoB,kBAAkB;CAC1C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACpE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,SAAS;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACnE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAM,sBAAsB,kBAAkB;CAC5C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACpE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,SAAS;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACnE,YAAY;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACtE,aAAa;G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