@lssm/lib.jobs 0.0.0-canary-20251217083314 → 0.0.0-canary-20251219202229
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/LICENSE +21 -0
- package/dist/_virtual/rolldown_runtime.js +1 -7
- package/dist/contracts/dist/capabilities/openbanking.js +2 -1
- package/dist/contracts/dist/capabilities/openbanking.js.map +1 -0
- package/dist/contracts/dist/contract-registry/schemas.js +2 -1
- package/dist/contracts/dist/contract-registry/schemas.js.map +1 -0
- package/dist/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +2 -1
- package/dist/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/index.js +2 -6
- package/dist/contracts/dist/docs/meta.docs.js +30 -0
- package/dist/contracts/dist/docs/meta.docs.js.map +1 -0
- package/dist/contracts/dist/docs/presentations.js +2 -1
- package/dist/contracts/dist/docs/presentations.js.map +1 -0
- package/dist/contracts/dist/docs/registry.js +2 -1
- package/dist/contracts/dist/docs/registry.js.map +1 -0
- package/dist/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/contracts/openapi-export.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/llm/llm-integration.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/llm/llm-integration.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/mcp-endpoints.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/mcp-endpoints.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/presentation-runtime.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/presentation-runtime.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/schema/README.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/schema/README.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/studio/learning-events.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/studio/learning-events.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/studio/learning-journeys.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/studio/project-access-teams.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/studio/project-routing.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/studio/project-routing.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/studio/team-invitations.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/studio/team-invitations.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/studio/workspace-ops.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/studio/workspaces.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/studio/workspaces.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/telemetry-ingest.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/telemetry-ingest.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/templates/runtime.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/templates/runtime.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/vscode-extension.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/vscode-extension.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech/workflows/overview.docblock.js +2 -1
- package/dist/contracts/dist/docs/tech/workflows/overview.docblock.js.map +1 -0
- package/dist/contracts/dist/docs/tech-contracts.docs.js +97 -0
- package/dist/contracts/dist/docs/tech-contracts.docs.js.map +1 -0
- package/dist/contracts/dist/events.js +2 -1
- package/dist/contracts/dist/events.js.map +1 -0
- package/dist/contracts/dist/index.js +2 -1
- package/dist/contracts/dist/integrations/contracts.js +65 -66
- package/dist/contracts/dist/integrations/contracts.js.map +1 -0
- package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js +31 -32
- package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js.map +1 -0
- package/dist/contracts/dist/integrations/openbanking/contracts/balances.js +18 -19
- package/dist/contracts/dist/integrations/openbanking/contracts/balances.js.map +1 -0
- package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js +32 -33
- package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js.map +1 -0
- package/dist/contracts/dist/integrations/openbanking/models.js +60 -61
- package/dist/contracts/dist/integrations/openbanking/models.js.map +1 -0
- package/dist/contracts/dist/integrations/openbanking/telemetry.js +2 -1
- package/dist/contracts/dist/integrations/openbanking/telemetry.js.map +1 -0
- package/dist/contracts/dist/integrations/providers/elevenlabs.js +2 -1
- package/dist/contracts/dist/integrations/providers/elevenlabs.js.map +1 -0
- package/dist/contracts/dist/integrations/providers/gcs-storage.js +2 -1
- package/dist/contracts/dist/integrations/providers/gcs-storage.js.map +1 -0
- package/dist/contracts/dist/integrations/providers/gmail.js +2 -1
- package/dist/contracts/dist/integrations/providers/gmail.js.map +1 -0
- package/dist/contracts/dist/integrations/providers/google-calendar.js +2 -1
- package/dist/contracts/dist/integrations/providers/google-calendar.js.map +1 -0
- package/dist/contracts/dist/integrations/providers/mistral.js +2 -1
- package/dist/contracts/dist/integrations/providers/mistral.js.map +1 -0
- package/dist/contracts/dist/integrations/providers/postmark.js +2 -1
- package/dist/contracts/dist/integrations/providers/postmark.js.map +1 -0
- package/dist/contracts/dist/integrations/providers/powens.js +2 -1
- package/dist/contracts/dist/integrations/providers/powens.js.map +1 -0
- package/dist/contracts/dist/integrations/providers/qdrant.js +2 -1
- package/dist/contracts/dist/integrations/providers/qdrant.js.map +1 -0
- package/dist/contracts/dist/integrations/providers/stripe.js +2 -1
- package/dist/contracts/dist/integrations/providers/stripe.js.map +1 -0
- package/dist/contracts/dist/integrations/providers/twilio-sms.js +2 -1
- package/dist/contracts/dist/integrations/providers/twilio-sms.js.map +1 -0
- package/dist/contracts/dist/jobs/queue.js +2 -1
- package/dist/contracts/dist/jobs/queue.js.map +1 -0
- package/dist/contracts/dist/knowledge/contracts.js +44 -45
- package/dist/contracts/dist/knowledge/contracts.js.map +1 -0
- package/dist/contracts/dist/knowledge/spaces/email-threads.js +2 -1
- package/dist/contracts/dist/knowledge/spaces/email-threads.js.map +1 -0
- package/dist/contracts/dist/knowledge/spaces/financial-docs.js +2 -1
- package/dist/contracts/dist/knowledge/spaces/financial-docs.js.map +1 -0
- package/dist/contracts/dist/knowledge/spaces/financial-overview.js +2 -1
- package/dist/contracts/dist/knowledge/spaces/financial-overview.js.map +1 -0
- package/dist/contracts/dist/knowledge/spaces/product-canon.js +2 -1
- package/dist/contracts/dist/knowledge/spaces/product-canon.js.map +1 -0
- package/dist/contracts/dist/knowledge/spaces/support-faq.js +2 -1
- package/dist/contracts/dist/knowledge/spaces/support-faq.js.map +1 -0
- package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js +2 -1
- package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js.map +1 -0
- package/dist/contracts/dist/llm/exporters.js +2 -1
- package/dist/contracts/dist/llm/exporters.js.map +1 -0
- package/dist/contracts/dist/onboarding-base.js +22 -23
- package/dist/contracts/dist/onboarding-base.js.map +1 -0
- package/dist/contracts/dist/ownership.js +4 -2
- package/dist/contracts/dist/ownership.js.map +1 -0
- package/dist/contracts/dist/presentations.v2.js +2 -1
- package/dist/contracts/dist/presentations.v2.js.map +1 -0
- package/dist/contracts/dist/regenerator/service.js +2 -1
- package/dist/contracts/dist/regenerator/service.js.map +1 -0
- package/dist/contracts/dist/schema/dist/index.js +3873 -6
- package/dist/contracts/dist/schema/dist/index.js.map +1 -0
- package/dist/contracts/dist/spec.js +2 -1
- package/dist/contracts/dist/spec.js.map +1 -0
- package/dist/contracts/index.d.ts +140 -139
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +71 -72
- package/dist/contracts/index.js.map +1 -0
- package/dist/entities/index.d.ts +118 -117
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +67 -67
- package/dist/entities/index.js.map +1 -0
- package/dist/events.d.ts +2 -1
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +51 -52
- package/dist/events.js.map +1 -0
- package/dist/handlers/gmail-sync-handler.d.ts +2 -1
- package/dist/handlers/gmail-sync-handler.d.ts.map +1 -0
- package/dist/handlers/gmail-sync-handler.js +2 -1
- package/dist/handlers/gmail-sync-handler.js.map +1 -0
- package/dist/handlers/index.d.ts +2 -1
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +2 -1
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/ping-job.d.ts +2 -1
- package/dist/handlers/ping-job.d.ts.map +1 -0
- package/dist/handlers/ping-job.js +2 -1
- package/dist/handlers/ping-job.js.map +1 -0
- package/dist/handlers/storage-document-handler.d.ts +2 -1
- package/dist/handlers/storage-document-handler.d.ts.map +1 -0
- package/dist/handlers/storage-document-handler.js +2 -1
- package/dist/handlers/storage-document-handler.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/jobs.feature.d.ts +2 -1
- package/dist/jobs.feature.d.ts.map +1 -0
- package/dist/jobs.feature.js +2 -1
- package/dist/jobs.feature.js.map +1 -0
- package/dist/queue/gcp-cloud-tasks.d.ts +2 -1
- package/dist/queue/gcp-cloud-tasks.d.ts.map +1 -0
- package/dist/queue/gcp-cloud-tasks.js +2 -1
- package/dist/queue/gcp-cloud-tasks.js.map +1 -0
- package/dist/queue/gcp-pubsub.d.ts +2 -1
- package/dist/queue/gcp-pubsub.d.ts.map +1 -0
- package/dist/queue/gcp-pubsub.js +2 -1
- package/dist/queue/gcp-pubsub.js.map +1 -0
- package/dist/queue/index.d.ts +2 -1
- package/dist/queue/index.d.ts.map +1 -0
- package/dist/queue/memory-queue.d.ts +2 -1
- package/dist/queue/memory-queue.d.ts.map +1 -0
- package/dist/queue/memory-queue.js +2 -1
- package/dist/queue/memory-queue.js.map +1 -0
- package/dist/queue/register-defined-job.d.ts +2 -1
- package/dist/queue/register-defined-job.d.ts.map +1 -0
- package/dist/queue/register-defined-job.js +2 -1
- package/dist/queue/register-defined-job.js.map +1 -0
- package/dist/queue/scaleway-sqs-queue.d.ts +2 -1
- package/dist/queue/scaleway-sqs-queue.d.ts.map +1 -0
- package/dist/queue/scaleway-sqs-queue.js +2 -1
- package/dist/queue/scaleway-sqs-queue.js.map +1 -0
- package/dist/queue/types.d.ts +3 -2
- package/dist/queue/types.d.ts.map +1 -0
- package/dist/scheduler/index.d.ts +2 -1
- package/dist/scheduler/index.d.ts.map +1 -0
- package/dist/scheduler/index.js +2 -1
- package/dist/scheduler/index.js.map +1 -0
- package/dist/schema/dist/index.js +4889 -6
- package/dist/schema/dist/index.js.map +1 -0
- package/package.json +9 -8
- package/dist/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
- package/dist/contracts/dist/schema/dist/EnumType.js +0 -2
- package/dist/contracts/dist/schema/dist/FieldType.js +0 -49
- package/dist/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/contracts/dist/schema/dist/SchemaModel.js +0 -34
- package/dist/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
- package/dist/contracts/dist/schema/dist/entity/index.js +0 -2
- package/dist/contracts/dist/schema/dist/entity/types.js +0 -1
- package/dist/schema/dist/EnumType.js +0 -2
- package/dist/schema/dist/FieldType.js +0 -49
- package/dist/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/schema/dist/SchemaModel.js +0 -39
- package/dist/schema/dist/entity/defineEntity.js +0 -236
- package/dist/schema/dist/entity/index.js +0 -2
- package/dist/schema/dist/entity/types.js +0 -1
package/dist/events.js
CHANGED
|
@@ -1,214 +1,212 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { defineSchemaModel } from "./schema/dist/SchemaModel.js";
|
|
3
|
-
import "./schema/dist/index.js";
|
|
1
|
+
import { E5, K5 } from "./schema/dist/index.js";
|
|
4
2
|
import { defineEvent } from "./contracts/dist/events.js";
|
|
5
3
|
import "./contracts/dist/index.js";
|
|
6
4
|
|
|
7
5
|
//#region src/events.ts
|
|
8
|
-
const JobEnqueuedPayload =
|
|
6
|
+
const JobEnqueuedPayload = K5({
|
|
9
7
|
name: "JobEnqueuedEventPayload",
|
|
10
8
|
description: "Payload when a job is added to the queue",
|
|
11
9
|
fields: {
|
|
12
10
|
jobId: {
|
|
13
|
-
type:
|
|
11
|
+
type: E5.String_unsecure(),
|
|
14
12
|
isOptional: false
|
|
15
13
|
},
|
|
16
14
|
type: {
|
|
17
|
-
type:
|
|
15
|
+
type: E5.String_unsecure(),
|
|
18
16
|
isOptional: false
|
|
19
17
|
},
|
|
20
18
|
priority: {
|
|
21
|
-
type:
|
|
19
|
+
type: E5.Int_unsecure(),
|
|
22
20
|
isOptional: false
|
|
23
21
|
},
|
|
24
22
|
scheduledAt: {
|
|
25
|
-
type:
|
|
23
|
+
type: E5.DateTime(),
|
|
26
24
|
isOptional: true
|
|
27
25
|
},
|
|
28
26
|
tenantId: {
|
|
29
|
-
type:
|
|
27
|
+
type: E5.String_unsecure(),
|
|
30
28
|
isOptional: true
|
|
31
29
|
},
|
|
32
30
|
enqueuedAt: {
|
|
33
|
-
type:
|
|
31
|
+
type: E5.DateTime(),
|
|
34
32
|
isOptional: false
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
35
|
});
|
|
38
|
-
const JobStartedPayload =
|
|
36
|
+
const JobStartedPayload = K5({
|
|
39
37
|
name: "JobStartedEventPayload",
|
|
40
38
|
description: "Payload when a job starts processing",
|
|
41
39
|
fields: {
|
|
42
40
|
jobId: {
|
|
43
|
-
type:
|
|
41
|
+
type: E5.String_unsecure(),
|
|
44
42
|
isOptional: false
|
|
45
43
|
},
|
|
46
44
|
type: {
|
|
47
|
-
type:
|
|
45
|
+
type: E5.String_unsecure(),
|
|
48
46
|
isOptional: false
|
|
49
47
|
},
|
|
50
48
|
attempt: {
|
|
51
|
-
type:
|
|
49
|
+
type: E5.Int_unsecure(),
|
|
52
50
|
isOptional: false
|
|
53
51
|
},
|
|
54
52
|
startedAt: {
|
|
55
|
-
type:
|
|
53
|
+
type: E5.DateTime(),
|
|
56
54
|
isOptional: false
|
|
57
55
|
}
|
|
58
56
|
}
|
|
59
57
|
});
|
|
60
|
-
const JobCompletedPayload =
|
|
58
|
+
const JobCompletedPayload = K5({
|
|
61
59
|
name: "JobCompletedEventPayload",
|
|
62
60
|
description: "Payload when a job completes successfully",
|
|
63
61
|
fields: {
|
|
64
62
|
jobId: {
|
|
65
|
-
type:
|
|
63
|
+
type: E5.String_unsecure(),
|
|
66
64
|
isOptional: false
|
|
67
65
|
},
|
|
68
66
|
type: {
|
|
69
|
-
type:
|
|
67
|
+
type: E5.String_unsecure(),
|
|
70
68
|
isOptional: false
|
|
71
69
|
},
|
|
72
70
|
attempt: {
|
|
73
|
-
type:
|
|
71
|
+
type: E5.Int_unsecure(),
|
|
74
72
|
isOptional: false
|
|
75
73
|
},
|
|
76
74
|
durationMs: {
|
|
77
|
-
type:
|
|
75
|
+
type: E5.Int_unsecure(),
|
|
78
76
|
isOptional: false
|
|
79
77
|
},
|
|
80
78
|
completedAt: {
|
|
81
|
-
type:
|
|
79
|
+
type: E5.DateTime(),
|
|
82
80
|
isOptional: false
|
|
83
81
|
}
|
|
84
82
|
}
|
|
85
83
|
});
|
|
86
|
-
const JobFailedPayload =
|
|
84
|
+
const JobFailedPayload = K5({
|
|
87
85
|
name: "JobFailedEventPayload",
|
|
88
86
|
description: "Payload when a job attempt fails",
|
|
89
87
|
fields: {
|
|
90
88
|
jobId: {
|
|
91
|
-
type:
|
|
89
|
+
type: E5.String_unsecure(),
|
|
92
90
|
isOptional: false
|
|
93
91
|
},
|
|
94
92
|
type: {
|
|
95
|
-
type:
|
|
93
|
+
type: E5.String_unsecure(),
|
|
96
94
|
isOptional: false
|
|
97
95
|
},
|
|
98
96
|
attempt: {
|
|
99
|
-
type:
|
|
97
|
+
type: E5.Int_unsecure(),
|
|
100
98
|
isOptional: false
|
|
101
99
|
},
|
|
102
100
|
error: {
|
|
103
|
-
type:
|
|
101
|
+
type: E5.String_unsecure(),
|
|
104
102
|
isOptional: false
|
|
105
103
|
},
|
|
106
104
|
willRetry: {
|
|
107
|
-
type:
|
|
105
|
+
type: E5.Boolean(),
|
|
108
106
|
isOptional: false
|
|
109
107
|
},
|
|
110
108
|
failedAt: {
|
|
111
|
-
type:
|
|
109
|
+
type: E5.DateTime(),
|
|
112
110
|
isOptional: false
|
|
113
111
|
}
|
|
114
112
|
}
|
|
115
113
|
});
|
|
116
|
-
const JobRetryingPayload =
|
|
114
|
+
const JobRetryingPayload = K5({
|
|
117
115
|
name: "JobRetryingEventPayload",
|
|
118
116
|
description: "Payload when a job is scheduled for retry",
|
|
119
117
|
fields: {
|
|
120
118
|
jobId: {
|
|
121
|
-
type:
|
|
119
|
+
type: E5.String_unsecure(),
|
|
122
120
|
isOptional: false
|
|
123
121
|
},
|
|
124
122
|
type: {
|
|
125
|
-
type:
|
|
123
|
+
type: E5.String_unsecure(),
|
|
126
124
|
isOptional: false
|
|
127
125
|
},
|
|
128
126
|
attempt: {
|
|
129
|
-
type:
|
|
127
|
+
type: E5.Int_unsecure(),
|
|
130
128
|
isOptional: false
|
|
131
129
|
},
|
|
132
130
|
nextAttemptAt: {
|
|
133
|
-
type:
|
|
131
|
+
type: E5.DateTime(),
|
|
134
132
|
isOptional: false
|
|
135
133
|
},
|
|
136
134
|
backoffMs: {
|
|
137
|
-
type:
|
|
135
|
+
type: E5.Int_unsecure(),
|
|
138
136
|
isOptional: false
|
|
139
137
|
}
|
|
140
138
|
}
|
|
141
139
|
});
|
|
142
|
-
const JobDeadLetteredPayload =
|
|
140
|
+
const JobDeadLetteredPayload = K5({
|
|
143
141
|
name: "JobDeadLetteredEventPayload",
|
|
144
142
|
description: "Payload when a job is moved to dead letter queue",
|
|
145
143
|
fields: {
|
|
146
144
|
jobId: {
|
|
147
|
-
type:
|
|
145
|
+
type: E5.String_unsecure(),
|
|
148
146
|
isOptional: false
|
|
149
147
|
},
|
|
150
148
|
type: {
|
|
151
|
-
type:
|
|
149
|
+
type: E5.String_unsecure(),
|
|
152
150
|
isOptional: false
|
|
153
151
|
},
|
|
154
152
|
attempts: {
|
|
155
|
-
type:
|
|
153
|
+
type: E5.Int_unsecure(),
|
|
156
154
|
isOptional: false
|
|
157
155
|
},
|
|
158
156
|
lastError: {
|
|
159
|
-
type:
|
|
157
|
+
type: E5.String_unsecure(),
|
|
160
158
|
isOptional: false
|
|
161
159
|
},
|
|
162
160
|
deadLetteredAt: {
|
|
163
|
-
type:
|
|
161
|
+
type: E5.DateTime(),
|
|
164
162
|
isOptional: false
|
|
165
163
|
}
|
|
166
164
|
}
|
|
167
165
|
});
|
|
168
|
-
const JobCancelledPayload =
|
|
166
|
+
const JobCancelledPayload = K5({
|
|
169
167
|
name: "JobCancelledEventPayload",
|
|
170
168
|
description: "Payload when a job is cancelled",
|
|
171
169
|
fields: {
|
|
172
170
|
jobId: {
|
|
173
|
-
type:
|
|
171
|
+
type: E5.String_unsecure(),
|
|
174
172
|
isOptional: false
|
|
175
173
|
},
|
|
176
174
|
type: {
|
|
177
|
-
type:
|
|
175
|
+
type: E5.String_unsecure(),
|
|
178
176
|
isOptional: false
|
|
179
177
|
},
|
|
180
178
|
cancelledBy: {
|
|
181
|
-
type:
|
|
179
|
+
type: E5.String_unsecure(),
|
|
182
180
|
isOptional: true
|
|
183
181
|
},
|
|
184
182
|
cancelledAt: {
|
|
185
|
-
type:
|
|
183
|
+
type: E5.DateTime(),
|
|
186
184
|
isOptional: false
|
|
187
185
|
}
|
|
188
186
|
}
|
|
189
187
|
});
|
|
190
|
-
const ScheduledJobTriggeredPayload =
|
|
188
|
+
const ScheduledJobTriggeredPayload = K5({
|
|
191
189
|
name: "ScheduledJobTriggeredEventPayload",
|
|
192
190
|
description: "Payload when a scheduled job is triggered",
|
|
193
191
|
fields: {
|
|
194
192
|
scheduleName: {
|
|
195
|
-
type:
|
|
193
|
+
type: E5.String_unsecure(),
|
|
196
194
|
isOptional: false
|
|
197
195
|
},
|
|
198
196
|
jobId: {
|
|
199
|
-
type:
|
|
197
|
+
type: E5.String_unsecure(),
|
|
200
198
|
isOptional: false
|
|
201
199
|
},
|
|
202
200
|
jobType: {
|
|
203
|
-
type:
|
|
201
|
+
type: E5.String_unsecure(),
|
|
204
202
|
isOptional: false
|
|
205
203
|
},
|
|
206
204
|
triggeredAt: {
|
|
207
|
-
type:
|
|
205
|
+
type: E5.DateTime(),
|
|
208
206
|
isOptional: false
|
|
209
207
|
},
|
|
210
208
|
nextRunAt: {
|
|
211
|
-
type:
|
|
209
|
+
type: E5.DateTime(),
|
|
212
210
|
isOptional: true
|
|
213
211
|
}
|
|
214
212
|
}
|
|
@@ -300,4 +298,5 @@ const JobEvents = {
|
|
|
300
298
|
};
|
|
301
299
|
|
|
302
300
|
//#endregion
|
|
303
|
-
export { JobCancelledEvent, JobCompletedEvent, JobDeadLetteredEvent, JobEnqueuedEvent, JobEvents, JobFailedEvent, JobRetryingEvent, JobStartedEvent, ScheduledJobTriggeredEvent };
|
|
301
|
+
export { JobCancelledEvent, JobCompletedEvent, JobDeadLetteredEvent, JobEnqueuedEvent, JobEvents, JobFailedEvent, JobRetryingEvent, JobStartedEvent, ScheduledJobTriggeredEvent };
|
|
302
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","names":["defineSchemaModel","ScalarTypeEnum"],"sources":["../src/events.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@lssm/lib.schema';\nimport { defineEvent } from '@lssm/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 name: 'job.enqueued',\n version: 1,\n description: 'A job has been added to the queue.',\n payload: JobEnqueuedPayload,\n});\n\n/**\n * Emitted when a job starts processing.\n */\nexport const JobStartedEvent = defineEvent({\n name: 'job.started',\n version: 1,\n description: 'A job has started processing.',\n payload: JobStartedPayload,\n});\n\n/**\n * Emitted when a job completes successfully.\n */\nexport const JobCompletedEvent = defineEvent({\n name: 'job.completed',\n version: 1,\n description: 'A job has completed successfully.',\n payload: JobCompletedPayload,\n});\n\n/**\n * Emitted when a job fails (single attempt).\n */\nexport const JobFailedEvent = defineEvent({\n name: 'job.failed',\n version: 1,\n description: 'A job attempt has failed.',\n payload: JobFailedPayload,\n});\n\n/**\n * Emitted when a job is being retried.\n */\nexport const JobRetryingEvent = defineEvent({\n name: 'job.retrying',\n version: 1,\n description: 'A job is being scheduled for retry.',\n payload: JobRetryingPayload,\n});\n\n/**\n * Emitted when a job is moved to dead letter queue.\n */\nexport const JobDeadLetteredEvent = defineEvent({\n name: 'job.dead_lettered',\n version: 1,\n description:\n 'A job has exhausted all retries and moved to dead letter queue.',\n payload: JobDeadLetteredPayload,\n});\n\n/**\n * Emitted when a job is cancelled.\n */\nexport const JobCancelledEvent = defineEvent({\n name: 'job.cancelled',\n version: 1,\n description: 'A job has been cancelled.',\n payload: JobCancelledPayload,\n});\n\n/**\n * Emitted when a scheduled job is triggered.\n */\nexport const ScheduledJobTriggeredEvent = defineEvent({\n name: 'scheduler.job_triggered',\n version: 1,\n description: 'A scheduled job has been triggered.',\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":"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"}
|
|
@@ -6,4 +6,5 @@ import { EmailThreadListQuery } from "@lssm/lib.contracts/integrations/providers
|
|
|
6
6
|
interface GmailSyncJobPayload extends EmailThreadListQuery {}
|
|
7
7
|
declare function createGmailSyncHandler(adapter: GmailIngestionAdapter): JobHandler<GmailSyncJobPayload>;
|
|
8
8
|
//#endregion
|
|
9
|
-
export { GmailSyncJobPayload, createGmailSyncHandler };
|
|
9
|
+
export { GmailSyncJobPayload, createGmailSyncHandler };
|
|
10
|
+
//# sourceMappingURL=gmail-sync-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gmail-sync-handler.d.ts","names":[],"sources":["../../src/handlers/gmail-sync-handler.ts"],"sourcesContent":[],"mappings":";;;;;UAIiB,mBAAA,SAA4B;AAA5B,iBAED,sBAAA,CAF6B,OAAA,EAGlC,qBAHsD,CAAA,EAI9D,UAJ8D,CAInD,mBAJmD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gmail-sync-handler.js","names":[],"sources":["../../src/handlers/gmail-sync-handler.ts"],"sourcesContent":["import type { JobHandler } from '@lssm/lib.contracts/jobs/queue';\nimport type { GmailIngestionAdapter } from '@lssm/lib.knowledge/ingestion/gmail-adapter';\nimport type { EmailThreadListQuery } from '@lssm/lib.contracts/integrations/providers/email';\n\nexport interface GmailSyncJobPayload extends EmailThreadListQuery {}\n\nexport function createGmailSyncHandler(\n adapter: GmailIngestionAdapter\n): JobHandler<GmailSyncJobPayload> {\n return async (job) => {\n await adapter.syncThreads(job.payload);\n };\n}\n"],"mappings":";AAMA,SAAgB,uBACd,SACiC;AACjC,QAAO,OAAO,QAAQ;AACpB,QAAM,QAAQ,YAAY,IAAI,QAAQ"}
|
package/dist/handlers/index.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ import { JobQueue } from "@lssm/lib.contracts/jobs/queue";
|
|
|
6
6
|
//#region src/handlers/index.d.ts
|
|
7
7
|
declare function registerAllJobs(queue: JobQueue): void;
|
|
8
8
|
//#endregion
|
|
9
|
-
export { GmailSyncJobPayload, PING_JOB_TYPE, PingPayload, PingPayloadSchema, StorageDocumentJobPayload, createGmailSyncHandler, createStorageDocumentHandler, pingJob, registerAllJobs };
|
|
9
|
+
export { GmailSyncJobPayload, PING_JOB_TYPE, PingPayload, PingPayloadSchema, StorageDocumentJobPayload, createGmailSyncHandler, createStorageDocumentHandler, pingJob, registerAllJobs };
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/handlers/index.ts"],"sourcesContent":[],"mappings":";;;;;;iBAUgB,eAAA,QAAuB"}
|
package/dist/handlers/index.js
CHANGED
|
@@ -9,4 +9,5 @@ function registerAllJobs(queue) {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
//#endregion
|
|
12
|
-
export { PING_JOB_TYPE, PingPayloadSchema, createGmailSyncHandler, createStorageDocumentHandler, pingJob, registerAllJobs };
|
|
12
|
+
export { PING_JOB_TYPE, PingPayloadSchema, createGmailSyncHandler, createStorageDocumentHandler, pingJob, registerAllJobs };
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/handlers/index.ts"],"sourcesContent":["export * from './ping-job';\nexport * from './gmail-sync-handler';\nexport * from './storage-document-handler';\nimport type { JobQueue } from '@lssm/lib.contracts/jobs/queue';\nimport { registerDefinedJob } from '../queue/register-defined-job';\n\nimport { pingJob } from './ping-job';\n// import { equityaRecomputePlanJob } from './types/equitya.recompute-plan';\n// import { artisanosGenerateQuoteJob } from './types/artisanos.generate-quote';\n\nexport function registerAllJobs(queue: JobQueue): void {\n registerDefinedJob(queue, pingJob);\n // registerDefinedJob(queue, equityaRecomputePlanJob);\n // registerDefinedJob(queue, artisanosGenerateQuoteJob);\n}\n"],"mappings":";;;;;;AAUA,SAAgB,gBAAgB,OAAuB;AACrD,oBAAmB,OAAO,QAAQ"}
|
|
@@ -7,4 +7,5 @@ declare const PingPayloadSchema: z$1.ZodObject<{}, z$1.core.$strip>;
|
|
|
7
7
|
type PingPayload = z$1.infer<typeof PingPayloadSchema>;
|
|
8
8
|
declare const pingJob: DefinedJob<PingPayload>;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { PING_JOB_TYPE, PingPayload, PingPayloadSchema, pingJob };
|
|
10
|
+
export { PING_JOB_TYPE, PingPayload, PingPayloadSchema, pingJob };
|
|
11
|
+
//# sourceMappingURL=ping-job.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ping-job.d.ts","names":[],"sources":["../../src/handlers/ping-job.ts"],"sourcesContent":[],"mappings":";;;;cAIa;cAEA,mBAAiB,GAAA,CAAA,cAAA,GAAA,CAAA,IAAA,CAAA;AAFjB,KAID,WAAA,GAAc,GAAA,CAAE,KAJqB,CAAA,OAIR,iBAJQ,CAAA;AAEpC,cAIA,OAJgC,EAIvB,UAJQ,CAIG,WAJH,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ping-job.js","names":["z","pingJob: DefinedJob<PingPayload>"],"sources":["../../src/handlers/ping-job.ts"],"sourcesContent":["import * as z from 'zod';\nimport type { DefinedJob } from '@lssm/lib.contracts/jobs/define-job';\nimport type { Job } from '@lssm/lib.contracts/jobs/queue';\n\nexport const PING_JOB_TYPE = 'core.ping' as const;\n\nexport const PingPayloadSchema = z.object({});\n\nexport type PingPayload = z.infer<typeof PingPayloadSchema>;\n\nexport const pingJob: DefinedJob<PingPayload> = {\n type: PING_JOB_TYPE,\n schema: PingPayloadSchema,\n handler: async (_payload: PingPayload, _job: Job<PingPayload>) => {},\n};\n"],"mappings":";;;AAIA,MAAa,gBAAgB;AAE7B,MAAa,oBAAoBA,IAAE,OAAO,EAAE,CAAC;AAI7C,MAAaC,UAAmC;CAC9C,MAAM;CACN,QAAQ;CACR,SAAS,OAAO,UAAuB,SAA2B;CACnE"}
|
|
@@ -9,4 +9,5 @@ interface StorageDocumentJobPayload {
|
|
|
9
9
|
}
|
|
10
10
|
declare function createStorageDocumentHandler(storage: ObjectStorageProvider, adapter: StorageIngestionAdapter): JobHandler<StorageDocumentJobPayload>;
|
|
11
11
|
//#endregion
|
|
12
|
-
export { StorageDocumentJobPayload, createStorageDocumentHandler };
|
|
12
|
+
export { StorageDocumentJobPayload, createStorageDocumentHandler };
|
|
13
|
+
//# sourceMappingURL=storage-document-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-document-handler.d.ts","names":[],"sources":["../../src/handlers/storage-document-handler.ts"],"sourcesContent":[],"mappings":";;;;;UAIiB,yBAAA;;EAAA,GAAA,EAAA,MAAA;AAKjB;AACW,iBADK,4BAAA,CACL,OAAA,EAAA,qBAAA,EAAA,OAAA,EACA,uBADA,CAAA,EAER,UAFQ,CAEG,yBAFH,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-document-handler.js","names":[],"sources":["../../src/handlers/storage-document-handler.ts"],"sourcesContent":["import type { ObjectStorageProvider } from '@lssm/lib.contracts/integrations/providers/storage';\nimport type { StorageIngestionAdapter } from '@lssm/lib.knowledge/ingestion/storage-adapter';\nimport type { JobHandler } from '@lssm/lib.contracts/jobs/queue';\n\nexport interface StorageDocumentJobPayload {\n bucket: string;\n key: string;\n}\n\nexport function createStorageDocumentHandler(\n storage: ObjectStorageProvider,\n adapter: StorageIngestionAdapter\n): JobHandler<StorageDocumentJobPayload> {\n return async (job) => {\n const object = await storage.getObject({\n bucket: job.payload.bucket,\n key: job.payload.key,\n });\n if (!object) {\n throw new Error(\n `Object ${job.payload.bucket}/${job.payload.key} not found`\n );\n }\n await adapter.ingestObject(object);\n };\n}\n"],"mappings":";AASA,SAAgB,6BACd,SACA,SACuC;AACvC,QAAO,OAAO,QAAQ;EACpB,MAAM,SAAS,MAAM,QAAQ,UAAU;GACrC,QAAQ,IAAI,QAAQ;GACpB,KAAK,IAAI,QAAQ;GAClB,CAAC;AACF,MAAI,CAAC,OACH,OAAM,IAAI,MACR,UAAU,IAAI,QAAQ,OAAO,GAAG,IAAI,QAAQ,IAAI,YACjD;AAEH,QAAM,QAAQ,aAAa,OAAO"}
|
package/dist/index.d.ts
CHANGED
|
@@ -21,4 +21,5 @@ declare namespace index_d_exports {
|
|
|
21
21
|
export { ActiveSchedule, CancelJobContract, CreateScheduledJobContract, EnqueueJobContract, GcpCloudTasksQueue, GcpCloudTasksQueueOptions, GcpPubSubQueue, GcpPubSubQueueOptions, GetJobContract, GetQueueStatsContract, GmailSyncJobPayload, JobCancelledEvent, JobCompletedEvent, JobDeadLetteredEvent, JobEnqueuedEvent, JobEntity, JobEvents, JobExecutionEntity, JobFailedEvent, JobModel, JobRetryingEvent, JobScheduler, JobStartedEvent, JobStatusEnum, JobsFeature, ListScheduledJobsContract, MemoryJobQueue, MemoryQueueOptions, PING_JOB_TYPE, PingPayload, PingPayloadSchema, QueueStatsModel, ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials, ScheduledJobConfig, ScheduledJobEntity, ScheduledJobModel, ScheduledJobTriggeredEvent, StorageDocumentJobPayload, ToggleScheduledJobContract, createGmailSyncHandler, createScheduler, createStorageDocumentHandler, defineSchedule, jobEntities, jobsSchemaContribution, pingJob, registerAllJobs, registerDefinedJob };
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
|
-
export { ActiveSchedule, CancelJobContract, CreateScheduledJobContract, EnqueueJobContract, GcpCloudTasksQueue, GcpCloudTasksQueueOptions, GcpPubSubQueue, GcpPubSubQueueOptions, GetJobContract, GetQueueStatsContract, GmailSyncJobPayload, JobCancelledEvent, JobCompletedEvent, JobDeadLetteredEvent, JobEnqueuedEvent, JobEntity, JobEvents, JobExecutionEntity, JobFailedEvent, JobModel, JobRetryingEvent, JobScheduler, JobStartedEvent, JobStatusEnum, JobsFeature, ListScheduledJobsContract, MemoryJobQueue, MemoryQueueOptions, PING_JOB_TYPE, PingPayload, PingPayloadSchema, QueueStatsModel, ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials, ScheduledJobConfig, ScheduledJobEntity, ScheduledJobModel, ScheduledJobTriggeredEvent, StorageDocumentJobPayload, ToggleScheduledJobContract, createGmailSyncHandler, createScheduler, createStorageDocumentHandler, defineSchedule, jobEntities, jobsSchemaContribution, pingJob, registerAllJobs, registerDefinedJob };
|
|
24
|
+
export { ActiveSchedule, CancelJobContract, CreateScheduledJobContract, EnqueueJobContract, GcpCloudTasksQueue, GcpCloudTasksQueueOptions, GcpPubSubQueue, GcpPubSubQueueOptions, GetJobContract, GetQueueStatsContract, GmailSyncJobPayload, JobCancelledEvent, JobCompletedEvent, JobDeadLetteredEvent, JobEnqueuedEvent, JobEntity, JobEvents, JobExecutionEntity, JobFailedEvent, JobModel, JobRetryingEvent, JobScheduler, JobStartedEvent, JobStatusEnum, JobsFeature, ListScheduledJobsContract, MemoryJobQueue, MemoryQueueOptions, PING_JOB_TYPE, PingPayload, PingPayloadSchema, QueueStatsModel, ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials, ScheduledJobConfig, ScheduledJobEntity, ScheduledJobModel, ScheduledJobTriggeredEvent, StorageDocumentJobPayload, ToggleScheduledJobContract, createGmailSyncHandler, createScheduler, createStorageDocumentHandler, defineSchedule, jobEntities, jobsSchemaContribution, pingJob, registerAllJobs, registerDefinedJob };
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":""}
|
package/dist/jobs.feature.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.feature.d.ts","names":[],"sources":["../src/jobs.feature.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAWa,aAAa"}
|
package/dist/jobs.feature.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.feature.js","names":["JobsFeature: FeatureModuleSpec"],"sources":["../src/jobs.feature.ts"],"sourcesContent":["/**\n * Jobs Feature Module Specification\n *\n * Defines the feature module for background job processing and scheduling.\n */\nimport type { FeatureModuleSpec } from '@lssm/lib.contracts';\n\n/**\n * Jobs feature module that bundles job queue management,\n * background processing, and scheduled task capabilities.\n */\nexport const JobsFeature: FeatureModuleSpec = {\n meta: {\n key: 'jobs',\n title: 'Background Jobs',\n description: 'Background job processing, scheduling, and queue management',\n domain: 'platform',\n owners: ['@platform.jobs'],\n tags: ['jobs', 'queue', 'background', 'scheduler'],\n stability: 'stable',\n },\n\n // All contract operations included in this feature\n operations: [\n // Job operations\n { name: 'jobs.enqueue', version: 1 },\n { name: 'jobs.cancel', version: 1 },\n { name: 'jobs.get', version: 1 },\n { name: 'jobs.stats', version: 1 },\n\n // Schedule operations\n { name: 'jobs.schedule.create', version: 1 },\n { name: 'jobs.schedule.toggle', version: 1 },\n { name: 'jobs.schedule.list', version: 1 },\n ],\n\n // Events emitted by this feature\n events: [\n // Job lifecycle events\n { name: 'job.enqueued', version: 1 },\n { name: 'job.started', version: 1 },\n { name: 'job.completed', version: 1 },\n { name: 'job.failed', version: 1 },\n { name: 'job.retrying', version: 1 },\n { name: 'job.dead_lettered', version: 1 },\n { name: 'job.cancelled', version: 1 },\n\n // Scheduler events\n { name: 'scheduler.job_triggered', version: 1 },\n ],\n\n // No presentations for this library feature\n presentations: [],\n opToPresentation: [],\n presentationsTargets: [],\n\n // Capability definitions\n capabilities: {\n provides: [\n { key: 'jobs', version: 1 },\n { key: 'scheduler', version: 1 },\n ],\n requires: [],\n },\n};\n"],"mappings":";;;;;AAWA,MAAaA,cAAiC;CAC5C,MAAM;EACJ,KAAK;EACL,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAQ;GAAS;GAAc;GAAY;EAClD,WAAW;EACZ;CAGD,YAAY;EAEV;GAAE,MAAM;GAAgB,SAAS;GAAG;EACpC;GAAE,MAAM;GAAe,SAAS;GAAG;EACnC;GAAE,MAAM;GAAY,SAAS;GAAG;EAChC;GAAE,MAAM;GAAc,SAAS;GAAG;EAGlC;GAAE,MAAM;GAAwB,SAAS;GAAG;EAC5C;GAAE,MAAM;GAAwB,SAAS;GAAG;EAC5C;GAAE,MAAM;GAAsB,SAAS;GAAG;EAC3C;CAGD,QAAQ;EAEN;GAAE,MAAM;GAAgB,SAAS;GAAG;EACpC;GAAE,MAAM;GAAe,SAAS;GAAG;EACnC;GAAE,MAAM;GAAiB,SAAS;GAAG;EACrC;GAAE,MAAM;GAAc,SAAS;GAAG;EAClC;GAAE,MAAM;GAAgB,SAAS;GAAG;EACpC;GAAE,MAAM;GAAqB,SAAS;GAAG;EACzC;GAAE,MAAM;GAAiB,SAAS;GAAG;EAGrC;GAAE,MAAM;GAA2B,SAAS;GAAG;EAChD;CAGD,eAAe,EAAE;CACjB,kBAAkB,EAAE;CACpB,sBAAsB,EAAE;CAGxB,cAAc;EACZ,UAAU,CACR;GAAE,KAAK;GAAQ,SAAS;GAAG,EAC3B;GAAE,KAAK;GAAa,SAAS;GAAG,CACjC;EACD,UAAU,EAAE;EACb;CACF"}
|
|
@@ -38,4 +38,5 @@ declare class GcpCloudTasksQueue implements types_d_exports.JobQueue {
|
|
|
38
38
|
stop(): Promise<void>;
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
|
-
export { GcpCloudTasksQueue, GcpCloudTasksQueueOptions };
|
|
41
|
+
export { GcpCloudTasksQueue, GcpCloudTasksQueueOptions };
|
|
42
|
+
//# sourceMappingURL=gcp-cloud-tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gcp-cloud-tasks.d.ts","names":[],"sources":["../../src/queue/gcp-cloud-tasks.ts"],"sourcesContent":[],"mappings":";;;UAUU,oBAAA;;IAAA,MAAA,EAAA,MAAA;IAOI,IAAA,EAAA;MACI,WAAA,EAAA;QAKZ,UAAA,EAAA,MAAA,GAAA,MAAA;QAAO,GAAA,EAAA,MAAA;QAGI,IAAA,EATH,MASG;QASJ,OAAA,CAAA,EAjBK,MAiBc,CAAA,MAAA,EAAA,MAAA,CAAA;QAGQ,SAAA,CAAA,EAAA;UAI3B,mBAAA,EAAA,MAAA;QACA,CAAA;MACI,CAAA;MAAJ,YAAA,CAAA,EAAA;QAAR,OAAA,EAAA,MAAA;MAsDmB,CAAA;IAAU,CAAA;EAArB,CAAA,CAAA,EA3EP,OA2EO,CAAA,OAAA,CAAA;;AA/D8B,UAT1B,yBAAA,CAS0B;EAAQ,MAAA,EARzC,oBAQyC;;;;;;;cAAtC,kBAAA,YAA8B,eAAA,CAAA;;;uBAGH;8CAI3B,oBACA,eAAA,CAAA,iBACR,QAAQ,eAAA,CAAA,IAAI;+DAsDJ,eAAA,CAAA,WAAW,UAAU;;UASlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gcp-cloud-tasks.js","names":["options: GcpCloudTasksQueueOptions"],"sources":["../../src/queue/gcp-cloud-tasks.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\n\nimport {\n DEFAULT_RETRY_POLICY,\n type EnqueueOptions,\n type Job,\n type JobHandler,\n type JobQueue,\n} from './types';\n\ninterface CloudTasksClientLike {\n createTask(request: {\n parent: string;\n task: {\n httpRequest: {\n httpMethod: number | string;\n url: string;\n body: Buffer;\n headers?: Record<string, string>;\n oidcToken?: { serviceAccountEmail: string };\n };\n scheduleTime?: { seconds: number };\n };\n }): Promise<unknown>;\n}\n\nexport interface GcpCloudTasksQueueOptions {\n client: CloudTasksClientLike;\n projectId: string;\n location: string;\n queue: string;\n resolveUrl(jobType: string): string;\n serviceAccountEmail?: string;\n}\n\nexport class GcpCloudTasksQueue implements JobQueue {\n private readonly handlers = new Map<string, JobHandler>();\n\n constructor(private readonly options: GcpCloudTasksQueueOptions) {}\n\n async enqueue<TPayload>(\n jobType: string,\n payload: TPayload,\n options: EnqueueOptions = {}\n ): Promise<Job<TPayload>> {\n const now = new Date();\n const enqueueTime =\n options.delaySeconds != null\n ? { seconds: Math.floor(Date.now() / 1000) + options.delaySeconds }\n : undefined;\n const body = Buffer.from(\n JSON.stringify({\n id: randomUUID(),\n type: jobType,\n payload,\n }),\n 'utf-8'\n );\n await this.options.client.createTask({\n parent: `projects/${this.options.projectId}/locations/${this.options.location}/queues/${this.options.queue}`,\n task: {\n httpRequest: {\n httpMethod: 'POST',\n url: this.options.resolveUrl(jobType),\n body,\n headers: { 'Content-Type': 'application/json' },\n oidcToken: this.options.serviceAccountEmail\n ? { serviceAccountEmail: this.options.serviceAccountEmail }\n : undefined,\n },\n scheduleTime: enqueueTime,\n },\n });\n\n return {\n id: randomUUID(),\n type: jobType,\n version: 1,\n payload,\n status: 'pending',\n priority: options.priority ?? 0,\n attempts: 0,\n maxRetries: options.maxRetries ?? DEFAULT_RETRY_POLICY.maxRetries,\n createdAt: now,\n updatedAt: now,\n scheduledAt: options.delaySeconds\n ? new Date(now.getTime() + options.delaySeconds * 1000)\n : now,\n dedupeKey: options.dedupeKey,\n tenantId: options.tenantId,\n userId: options.userId,\n traceId: options.traceId,\n metadata: options.metadata,\n };\n }\n\n register<TPayload, TResult = void>(\n jobType: string,\n handler: JobHandler<TPayload, TResult>\n ): void {\n this.handlers.set(jobType, handler as JobHandler);\n }\n\n start(): void {\n // Execution is handled by Cloud Tasks via HTTP callbacks.\n }\n\n async stop(): Promise<void> {\n this.handlers.clear();\n }\n}\n"],"mappings":";;;;;AAmCA,IAAa,qBAAb,MAAoD;CAClD,AAAiB,2BAAW,IAAI,KAAyB;CAEzD,YAAY,AAAiBA,SAAoC;EAApC;;CAE7B,MAAM,QACJ,SACA,SACA,UAA0B,EAAE,EACJ;EACxB,MAAM,sBAAM,IAAI,MAAM;EACtB,MAAM,cACJ,QAAQ,gBAAgB,OACpB,EAAE,SAAS,KAAK,MAAM,KAAK,KAAK,GAAG,IAAK,GAAG,QAAQ,cAAc,GACjE;EACN,MAAM,OAAO,OAAO,KAClB,KAAK,UAAU;GACb,IAAI,YAAY;GAChB,MAAM;GACN;GACD,CAAC,EACF,QACD;AACD,QAAM,KAAK,QAAQ,OAAO,WAAW;GACnC,QAAQ,YAAY,KAAK,QAAQ,UAAU,aAAa,KAAK,QAAQ,SAAS,UAAU,KAAK,QAAQ;GACrG,MAAM;IACJ,aAAa;KACX,YAAY;KACZ,KAAK,KAAK,QAAQ,WAAW,QAAQ;KACrC;KACA,SAAS,EAAE,gBAAgB,oBAAoB;KAC/C,WAAW,KAAK,QAAQ,sBACpB,EAAE,qBAAqB,KAAK,QAAQ,qBAAqB,GACzD;KACL;IACD,cAAc;IACf;GACF,CAAC;AAEF,SAAO;GACL,IAAI,YAAY;GAChB,MAAM;GACN,SAAS;GACT;GACA,QAAQ;GACR,UAAU,QAAQ,YAAY;GAC9B,UAAU;GACV,YAAY,QAAQ,cAAc,qBAAqB;GACvD,WAAW;GACX,WAAW;GACX,aAAa,QAAQ,eACjB,IAAI,KAAK,IAAI,SAAS,GAAG,QAAQ,eAAe,IAAK,GACrD;GACJ,WAAW,QAAQ;GACnB,UAAU,QAAQ;GAClB,QAAQ,QAAQ;GAChB,SAAS,QAAQ;GACjB,UAAU,QAAQ;GACnB;;CAGH,SACE,SACA,SACM;AACN,OAAK,SAAS,IAAI,SAAS,QAAsB;;CAGnD,QAAc;CAId,MAAM,OAAsB;AAC1B,OAAK,SAAS,OAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gcp-pubsub.d.ts","names":[],"sources":["../../src/queue/gcp-pubsub.ts"],"sourcesContent":[],"mappings":";;;UAUU,gBAAA;;IAAA,cAAA,CAAgB,OAAA,EAAA;MAMT,IAAA,EAJmB,MAInB;IAKJ,CAAA,CAAA,EATkC,OASlC,CAAA,MAAe,CAAA;EAGY,CAAA;;AAK3B,UAbI,qBAAA,CAaJ;EACI,MAAA,EAbP,gBAaO;EAAJ,SAAA,EAAA,MAAA;;AAqCW,cA9CX,cAAA,YAA0B,eAAA,CAAA,QA8Cf,CAAA;EAAU,iBAAA,OAAA;EAArB,iBAAA,QAAA;EASG,WAAA,CAAA,OAAA,EApDwB,qBAoDxB;EAvDuB,OAAA,CAAA,QAAA,CAAA,CAAA,OAAA,EAAA,MAAA,EAAA,OAAA,EAO1B,QAP0B,EAAA,OAAA,CAAA,EAQ1B,eAAA,CAAA,cAR0B,CAAA,EASlC,OATkC,CAS1B,eAAA,CAAA,GAT0B,CAStB,QATsB,CAAA,CAAA;EAAQ,QAAA,CAAA,QAAA,EAAA,UAAA,IAAA,CAAA,CAAA,OAAA,EAAA,MAAA,EAAA,OAAA,EA8ClC,eAAA,CAAA,UA9CkC,CA8CvB,QA9CuB,EA8Cb,OA9Ca,CAAA,CAAA,EAAA,IAAA;;UAuD/B"}
|
package/dist/queue/gcp-pubsub.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gcp-pubsub.js","names":["options: GcpPubSubQueueOptions"],"sources":["../../src/queue/gcp-pubsub.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\n\nimport {\n DEFAULT_RETRY_POLICY,\n type EnqueueOptions,\n type Job,\n type JobHandler,\n type JobQueue,\n} from './types';\n\ninterface PubSubClientLike {\n topic(name: string): {\n publishMessage(message: { data: Buffer }): Promise<string>;\n };\n}\n\nexport interface GcpPubSubQueueOptions {\n client: PubSubClientLike;\n topicName: string;\n}\n\nexport class GcpPubSubQueue implements JobQueue {\n private readonly handlers = new Map<string, JobHandler>();\n\n constructor(private readonly options: GcpPubSubQueueOptions) {}\n\n async enqueue<TPayload>(\n jobType: string,\n payload: TPayload,\n options: EnqueueOptions = {}\n ): Promise<Job<TPayload>> {\n const now = new Date();\n await this.options.client.topic(this.options.topicName).publishMessage({\n data: Buffer.from(\n JSON.stringify({\n id: randomUUID(),\n type: jobType,\n payload,\n }),\n 'utf-8'\n ),\n });\n\n return {\n id: randomUUID(),\n type: jobType,\n version: 1,\n payload,\n status: 'pending',\n priority: options.priority ?? 0,\n attempts: 0,\n maxRetries: options.maxRetries ?? DEFAULT_RETRY_POLICY.maxRetries,\n createdAt: now,\n updatedAt: now,\n scheduledAt: options.delaySeconds\n ? new Date(now.getTime() + options.delaySeconds * 1000)\n : now,\n dedupeKey: options.dedupeKey,\n tenantId: options.tenantId,\n userId: options.userId,\n traceId: options.traceId,\n metadata: options.metadata,\n };\n }\n\n register<TPayload, TResult = void>(\n jobType: string,\n handler: JobHandler<TPayload, TResult>\n ): void {\n this.handlers.set(jobType, handler as JobHandler);\n }\n\n start(): void {\n // Message consumption handled externally via Pub/Sub subscription.\n }\n\n async stop(): Promise<void> {\n this.handlers.clear();\n }\n}\n"],"mappings":";;;;;AAqBA,IAAa,iBAAb,MAAgD;CAC9C,AAAiB,2BAAW,IAAI,KAAyB;CAEzD,YAAY,AAAiBA,SAAgC;EAAhC;;CAE7B,MAAM,QACJ,SACA,SACA,UAA0B,EAAE,EACJ;EACxB,MAAM,sBAAM,IAAI,MAAM;AACtB,QAAM,KAAK,QAAQ,OAAO,MAAM,KAAK,QAAQ,UAAU,CAAC,eAAe,EACrE,MAAM,OAAO,KACX,KAAK,UAAU;GACb,IAAI,YAAY;GAChB,MAAM;GACN;GACD,CAAC,EACF,QACD,EACF,CAAC;AAEF,SAAO;GACL,IAAI,YAAY;GAChB,MAAM;GACN,SAAS;GACT;GACA,QAAQ;GACR,UAAU,QAAQ,YAAY;GAC9B,UAAU;GACV,YAAY,QAAQ,cAAc,qBAAqB;GACvD,WAAW;GACX,WAAW;GACX,aAAa,QAAQ,eACjB,IAAI,KAAK,IAAI,SAAS,GAAG,QAAQ,eAAe,IAAK,GACrD;GACJ,WAAW,QAAQ;GACnB,UAAU,QAAQ;GAClB,QAAQ,QAAQ;GAChB,SAAS,QAAQ;GACjB,UAAU,QAAQ;GACnB;;CAGH,SACE,SACA,SACM;AACN,OAAK,SAAS,IAAI,SAAS,QAAsB;;CAGnD,QAAc;CAId,MAAM,OAAsB;AAC1B,OAAK,SAAS,OAAO"}
|
package/dist/queue/index.d.ts
CHANGED
|
@@ -12,4 +12,5 @@ declare namespace index_d_exports {
|
|
|
12
12
|
export { GcpCloudTasksQueue, GcpCloudTasksQueueOptions, GcpPubSubQueue, GcpPubSubQueueOptions, MemoryJobQueue, MemoryQueueOptions, ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials, registerDefinedJob };
|
|
13
13
|
}
|
|
14
14
|
//#endregion
|
|
15
|
-
export { GcpCloudTasksQueue, GcpCloudTasksQueueOptions, GcpPubSubQueue, GcpPubSubQueueOptions, MemoryJobQueue, MemoryQueueOptions, ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials, index_d_exports, registerDefinedJob };
|
|
15
|
+
export { GcpCloudTasksQueue, GcpCloudTasksQueueOptions, GcpPubSubQueue, GcpPubSubQueueOptions, MemoryJobQueue, MemoryQueueOptions, ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials, index_d_exports, registerDefinedJob };
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/queue/index.ts"],"sourcesContent":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-queue.d.ts","names":[],"sources":["../../src/queue/memory-queue.ts"],"sourcesContent":[],"mappings":";;;UAWiB,kBAAA;;EAAA,cAAA,CAAA,EAAA,MAAkB;EAYtB;EASU,WAAA,CAAA,EAAA,MAAA;EAQV;EACA,WAAA,CAAA,EAxBG,eAAA,CAAA,WAwBH;;;;;AA8CqB,cAhErB,cAAA,YAA0B,eAAA,CAAA,QAgEL,CAAA;EAArB,iBAAA,IAAA;EAYG,iBAAA,QAAA;EAWuB,QAAA,KAAA;EAAR,QAAA,WAAA;EAIG,iBAAA,cAAA;EAUN,iBAAA,WAAA;EAAR,iBAAA,WAAA;EArGmB,WAAA,CAAA,OAAA,CAAA,EAShB,kBATgB;EAAQ,OAAA,CAAA,QAAA,CAAA,CAAA,OAAA,EAAA,MAAA,EAAA,OAAA,EAiBlC,QAjBkC,EAAA,OAAA,CAAA,EAkBlC,eAAA,CAAA,cAlBkC,CAAA,EAmB1C,OAnB0C,CAmBlC,eAAA,CAAA,GAnBkC,CAmB9B,QAnB8B,CAAA,CAAA;+DAgElC,eAAA,CAAA,WAAW,UAAU;;UAYlB;yBAWe,QAAQ,eAAA,CAAA;4BAIL;cAUd,QAAQ,eAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-queue.js","names":["job: Job<TPayload>","stats: QueueStats"],"sources":["../../src/queue/memory-queue.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport type {\n Job,\n JobHandler,\n JobQueue,\n EnqueueOptions,\n QueueStats,\n RetryPolicy,\n} from './types';\nimport { calculateBackoff, DEFAULT_RETRY_POLICY } from './types';\n\nexport interface MemoryQueueOptions {\n /** Poll interval in milliseconds */\n pollIntervalMs?: number;\n /** Maximum concurrent jobs */\n concurrency?: number;\n /** Default retry policy */\n retryPolicy?: RetryPolicy;\n}\n\n/**\n * In-memory job queue for development and testing.\n */\nexport class MemoryJobQueue implements JobQueue {\n private readonly jobs = new Map<string, Job>();\n private readonly handlers = new Map<string, JobHandler>();\n private timer?: ReturnType<typeof setInterval>;\n private activeCount = 0;\n private readonly pollIntervalMs: number;\n private readonly concurrency: number;\n private readonly retryPolicy: RetryPolicy;\n\n constructor(options: MemoryQueueOptions = {}) {\n this.pollIntervalMs = options.pollIntervalMs ?? 200;\n this.concurrency = options.concurrency ?? 5;\n this.retryPolicy = options.retryPolicy ?? DEFAULT_RETRY_POLICY;\n }\n\n async enqueue<TPayload>(\n jobType: string,\n payload: TPayload,\n options: EnqueueOptions = {}\n ): Promise<Job<TPayload>> {\n // Check for duplicate\n if (options.dedupeKey) {\n const existing = Array.from(this.jobs.values()).find(\n (j) => j.dedupeKey === options.dedupeKey && j.status === 'pending'\n );\n if (existing) {\n return existing as Job<TPayload>;\n }\n }\n\n const now = new Date();\n const scheduledAt = options.delaySeconds\n ? new Date(now.getTime() + options.delaySeconds * 1000)\n : now;\n\n const job: Job<TPayload> = {\n id: randomUUID(),\n type: jobType,\n version: 1,\n payload,\n status: 'pending',\n priority: options.priority ?? 0,\n attempts: 0,\n maxRetries: options.maxRetries ?? this.retryPolicy.maxRetries,\n createdAt: now,\n updatedAt: now,\n scheduledAt,\n dedupeKey: options.dedupeKey,\n tenantId: options.tenantId,\n userId: options.userId,\n traceId: options.traceId,\n metadata: options.metadata,\n };\n\n if (options.timeoutMs) {\n job.timeoutAt = new Date(now.getTime() + options.timeoutMs);\n }\n\n this.jobs.set(job.id, job);\n return job;\n }\n\n register<TPayload, TResult = void>(\n jobType: string,\n handler: JobHandler<TPayload, TResult>\n ): void {\n this.handlers.set(jobType, handler as JobHandler);\n }\n\n start(): void {\n if (this.timer) return;\n this.timer = setInterval(() => {\n void this.processNext();\n }, this.pollIntervalMs);\n }\n\n async stop(): Promise<void> {\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = undefined;\n }\n // Wait for active jobs to complete\n while (this.activeCount > 0) {\n await new Promise((resolve) => setTimeout(resolve, 50));\n }\n }\n\n async getJob(jobId: string): Promise<Job | null> {\n return this.jobs.get(jobId) ?? null;\n }\n\n async cancelJob(jobId: string): Promise<boolean> {\n const job = this.jobs.get(jobId);\n if (!job || job.status !== 'pending') {\n return false;\n }\n job.status = 'cancelled';\n job.updatedAt = new Date();\n return true;\n }\n\n async getStats(): Promise<QueueStats> {\n const stats: QueueStats = {\n pending: 0,\n running: 0,\n completed: 0,\n failed: 0,\n deadLetter: 0,\n };\n\n for (const job of this.jobs.values()) {\n switch (job.status) {\n case 'pending':\n stats.pending++;\n break;\n case 'running':\n stats.running++;\n break;\n case 'completed':\n stats.completed++;\n break;\n case 'failed':\n stats.failed++;\n break;\n case 'dead_letter':\n stats.deadLetter++;\n break;\n }\n }\n\n return stats;\n }\n\n private async processNext(): Promise<void> {\n if (this.activeCount >= this.concurrency) return;\n\n const now = new Date();\n const pendingJobs = Array.from(this.jobs.values())\n .filter(\n (j) =>\n j.status === 'pending' && (!j.scheduledAt || j.scheduledAt <= now)\n )\n .sort((a, b) => {\n // Higher priority first\n if (a.priority !== b.priority) {\n return b.priority - a.priority;\n }\n // Earlier scheduled first\n return (\n (a.scheduledAt?.getTime() ?? 0) - (b.scheduledAt?.getTime() ?? 0)\n );\n });\n\n const job = pendingJobs[0];\n if (!job) return;\n\n const handler = this.handlers.get(job.type);\n if (!handler) return;\n\n this.activeCount++;\n job.status = 'running';\n job.startedAt = new Date();\n job.updatedAt = new Date();\n job.attempts += 1;\n\n try {\n const result = await handler(job);\n job.status = 'completed';\n job.completedAt = new Date();\n job.result = result;\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'Unknown error';\n job.lastError = errorMessage;\n\n if (job.attempts >= job.maxRetries) {\n job.status = 'dead_letter';\n } else {\n // Schedule retry with backoff\n const backoff = calculateBackoff(job.attempts, this.retryPolicy);\n job.status = 'pending';\n job.scheduledAt = new Date(Date.now() + backoff);\n }\n } finally {\n job.updatedAt = new Date();\n this.activeCount--;\n }\n }\n}\n"],"mappings":"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"}
|
|
@@ -4,4 +4,5 @@ import { DefinedJob } from "@lssm/lib.contracts/jobs/define-job";
|
|
|
4
4
|
//#region src/queue/register-defined-job.d.ts
|
|
5
5
|
declare function registerDefinedJob<TPayload>(queue: JobQueue, def: DefinedJob<TPayload>): void;
|
|
6
6
|
//#endregion
|
|
7
|
-
export { registerDefinedJob };
|
|
7
|
+
export { registerDefinedJob };
|
|
8
|
+
//# sourceMappingURL=register-defined-job.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-defined-job.d.ts","names":[],"sources":["../../src/queue/register-defined-job.ts"],"sourcesContent":[],"mappings":";;;;iBAGgB,oCACP,eACF,WAAW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-defined-job.js","names":["wrapped: JobHandler<unknown>","typedJob: Job<TPayload>"],"sources":["../../src/queue/register-defined-job.ts"],"sourcesContent":["import type { DefinedJob } from '@lssm/lib.contracts/jobs/define-job';\nimport type { Job, JobHandler, JobQueue } from '@lssm/lib.contracts/jobs/queue';\n\nexport function registerDefinedJob<TPayload>(\n queue: JobQueue,\n def: DefinedJob<TPayload>\n): void {\n const wrapped: JobHandler<unknown> = async (job) => {\n const payload = def.schema.parse(job.payload);\n const typedJob: Job<TPayload> = {\n ...(job as Job<unknown>),\n payload,\n } as Job<TPayload>;\n\n await def.handler(payload, typedJob);\n };\n\n queue.register<TPayload>(def.type, wrapped as JobHandler<TPayload>);\n}\n"],"mappings":";AAGA,SAAgB,mBACd,OACA,KACM;CACN,MAAMA,UAA+B,OAAO,QAAQ;EAClD,MAAM,UAAU,IAAI,OAAO,MAAM,IAAI,QAAQ;EAC7C,MAAMC,WAA0B;GAC9B,GAAI;GACJ;GACD;AAED,QAAM,IAAI,QAAQ,SAAS,SAAS;;AAGtC,OAAM,SAAmB,IAAI,MAAM,QAAgC"}
|
|
@@ -35,4 +35,5 @@ declare class ScalewaySqsJobQueue implements types_d_exports.JobQueue {
|
|
|
35
35
|
private sleep;
|
|
36
36
|
}
|
|
37
37
|
//#endregion
|
|
38
|
-
export { ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials };
|
|
38
|
+
export { ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials };
|
|
39
|
+
//# sourceMappingURL=scaleway-sqs-queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaleway-sqs-queue.d.ts","names":[],"sources":["../../src/queue/scaleway-sqs-queue.ts"],"sourcesContent":[],"mappings":";;;;UAWiB,2BAAA;;EAAA,eAAA,EAAA,MAAA;AAKjB;AAiBa,UAjBI,sBAAA,CAiBgB;EAUX,QAAA,EAAA,MAAA;EAmCT,MAAA,CAAA,EAAA,MAAA;EACA,QAAA,CAAA,EAAA,MAAA;EACI,eAAA,CAAA,EAAA,MAAA;EAAJ,mBAAA,CAAA,EAAA,MAAA;EAAR,wBAAA,CAAA,EAAA,MAAA;EA4CmB,WAAA,CAAA,EArGR,2BAqGQ;EAAU,MAAA,CAAA,EApGvB,MAoGuB;;AAmBlB,cA9GH,mBAAA,YAA+B,eAAA,CAAA,QA8G5B,CAAA;EA9G4B,iBAAA,GAAA;EAAQ,iBAAA,QAAA;;;;;;;sBAU9B;8CAmCT,oBACA,eAAA,CAAA,iBACR,QAAQ,eAAA,CAAA,IAAI;+DA4CJ,eAAA,CAAA,WAAW,UAAU;;UAmBlB"}
|