@workglow/indexeddb 0.3.38 → 0.3.39
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/dist/job-queue/IndexedDbQueueStorage.d.ts.map +1 -1
- package/dist/job-queue/browser.js +5 -228
- package/dist/job-queue/browser.js.map +5 -7
- package/dist/job-queue/common.d.ts +0 -2
- package/dist/job-queue/common.d.ts.map +1 -1
- package/dist/job-queue/createIndexedDbQueue.d.ts +2 -6
- package/dist/job-queue/createIndexedDbQueue.d.ts.map +1 -1
- package/dist/job-queue/node.js +5 -228
- package/dist/job-queue/node.js.map +5 -7
- package/dist/storage/IndexedDbKvStorage.d.ts +3 -2
- package/dist/storage/IndexedDbKvStorage.d.ts.map +1 -1
- package/dist/storage/IndexedDbTabularStorage.d.ts +23 -10
- package/dist/storage/IndexedDbTabularStorage.d.ts.map +1 -1
- package/dist/storage/IndexedDbVectorStorage.d.ts.map +1 -1
- package/dist/storage/browser.js +60 -24
- package/dist/storage/browser.js.map +5 -5
- package/dist/storage/node.js +60 -24
- package/dist/storage/node.js.map +5 -5
- package/package.json +9 -17
- package/dist/job-queue/IndexedDbJobStore.d.ts +0 -38
- package/dist/job-queue/IndexedDbJobStore.d.ts.map +0 -1
- package/dist/job-queue/IndexedDbMessageQueue.d.ts +0 -25
- package/dist/job-queue/IndexedDbMessageQueue.d.ts.map +0 -1
- package/dist/job-queue/bun.d.ts +0 -7
- package/dist/job-queue/bun.d.ts.map +0 -1
- package/dist/storage/bun.d.ts +0 -7
- package/dist/storage/bun.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndexedDbQueueStorage.d.ts","sourceRoot":"","sources":["../../src/job-queue/IndexedDbQueueStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,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oC3F;YAEa,UAAU;YAgCV,oBAAoB;IA2ClC,OAAO,CAAC,oBAAoB;IAoB5B,OAAO,CAAC,gBAAgB;IAkCxB,OAAO,CAAC,+BAA+B;IA6CvC;;;;OAIG;IACI,kBAAkB,CACvB,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAC7D,OAAO,CAAC,EAAE,qBAAqB,GAC9B,MAAM,IAAI,CASZ;IAED,OAAO,IAAI,IAAI,CAKd;CACF"}
|
|
@@ -393,13 +393,13 @@ class IndexedDbQueueStorage {
|
|
|
393
393
|
jobWithPrefixes.id = jobWithPrefixes.id ?? uuid4();
|
|
394
394
|
jobWithPrefixes.job_run_id = jobWithPrefixes.job_run_id ?? uuid4();
|
|
395
395
|
jobWithPrefixes.queue = this.queueName;
|
|
396
|
-
jobWithPrefixes.fingerprint = await makeFingerprint(jobWithPrefixes.input);
|
|
396
|
+
jobWithPrefixes.fingerprint = jobWithPrefixes.fingerprint ?? await makeFingerprint(jobWithPrefixes.input);
|
|
397
397
|
jobWithPrefixes.status = JobStatus.PENDING;
|
|
398
398
|
jobWithPrefixes.progress = 0;
|
|
399
399
|
jobWithPrefixes.progress_message = "";
|
|
400
400
|
jobWithPrefixes.progress_details = null;
|
|
401
401
|
jobWithPrefixes.created_at = now;
|
|
402
|
-
jobWithPrefixes.visible_at = now;
|
|
402
|
+
jobWithPrefixes.visible_at = jobWithPrefixes.visible_at ?? now;
|
|
403
403
|
for (const [key, value] of Object.entries(this.prefixValues)) {
|
|
404
404
|
jobWithPrefixes[key] = value;
|
|
405
405
|
}
|
|
@@ -996,231 +996,10 @@ class IndexedDbQueueStorage {
|
|
|
996
996
|
}
|
|
997
997
|
}
|
|
998
998
|
}
|
|
999
|
-
// src/job-queue/IndexedDbMessageQueue.ts
|
|
1000
|
-
class IndexedDbClaim {
|
|
1001
|
-
core;
|
|
1002
|
-
id;
|
|
1003
|
-
body;
|
|
1004
|
-
attempts;
|
|
1005
|
-
workerId;
|
|
1006
|
-
constructor(core, id, body, attempts, workerId) {
|
|
1007
|
-
this.core = core;
|
|
1008
|
-
this.id = id;
|
|
1009
|
-
this.body = body;
|
|
1010
|
-
this.attempts = attempts;
|
|
1011
|
-
this.workerId = workerId;
|
|
1012
|
-
}
|
|
1013
|
-
async ack(result) {
|
|
1014
|
-
const current = await this.core.get(this.id) ?? this.body;
|
|
1015
|
-
const output = result !== undefined ? result : current.output ?? null;
|
|
1016
|
-
await this.core.finalize(this.id, {
|
|
1017
|
-
output,
|
|
1018
|
-
error: null,
|
|
1019
|
-
error_code: null,
|
|
1020
|
-
status: "COMPLETED",
|
|
1021
|
-
completed_at: current.completed_at ?? new Date().toISOString()
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
async retry(opts) {
|
|
1025
|
-
const delay = opts?.delaySeconds ?? 0;
|
|
1026
|
-
const current = await this.core.get(this.id) ?? this.body;
|
|
1027
|
-
await this.core.complete({
|
|
1028
|
-
...current,
|
|
1029
|
-
status: "PENDING",
|
|
1030
|
-
lease_owner: null,
|
|
1031
|
-
lease_expires_at: null,
|
|
1032
|
-
visible_at: new Date(Date.now() + delay * 1000).toISOString(),
|
|
1033
|
-
progress: 0,
|
|
1034
|
-
progress_message: "",
|
|
1035
|
-
progress_details: null
|
|
1036
|
-
});
|
|
1037
|
-
}
|
|
1038
|
-
async fail(opts) {
|
|
1039
|
-
opts?.permanent;
|
|
1040
|
-
const current = await this.core.get(this.id) ?? this.body;
|
|
1041
|
-
const error = opts?.error !== undefined ? opts.error : current.error ?? null;
|
|
1042
|
-
const errorCode = opts?.errorCode !== undefined ? opts.errorCode : current.error_code ?? null;
|
|
1043
|
-
const abortRequested = opts?.abortRequested === true;
|
|
1044
|
-
await this.core.finalize(this.id, {
|
|
1045
|
-
error,
|
|
1046
|
-
error_code: errorCode,
|
|
1047
|
-
abort_requested_at: abortRequested ? current.abort_requested_at ?? new Date().toISOString() : current.abort_requested_at ?? null,
|
|
1048
|
-
status: "FAILED",
|
|
1049
|
-
completed_at: current.completed_at ?? new Date().toISOString()
|
|
1050
|
-
});
|
|
1051
|
-
}
|
|
1052
|
-
async extendLease(ms) {
|
|
1053
|
-
await this.core.extendLease(this.id, this.workerId, ms);
|
|
1054
|
-
}
|
|
1055
|
-
async disable() {
|
|
1056
|
-
const current = await this.core.get(this.id);
|
|
1057
|
-
const completedAt = current?.completed_at ?? new Date().toISOString();
|
|
1058
|
-
await this.core.finalize(this.id, {
|
|
1059
|
-
status: "DISABLED",
|
|
1060
|
-
completed_at: completedAt,
|
|
1061
|
-
lease_owner: null,
|
|
1062
|
-
progress: 0,
|
|
1063
|
-
progress_message: "",
|
|
1064
|
-
progress_details: null
|
|
1065
|
-
});
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
class IndexedDbMessageQueue {
|
|
1070
|
-
scope = "process";
|
|
1071
|
-
core;
|
|
1072
|
-
constructor(core) {
|
|
1073
|
-
this.core = core;
|
|
1074
|
-
}
|
|
1075
|
-
async send(body, opts) {
|
|
1076
|
-
return this.core.add(applySendOptions(body, opts));
|
|
1077
|
-
}
|
|
1078
|
-
async sendBatch(bodies, opts) {
|
|
1079
|
-
const ids = [];
|
|
1080
|
-
for (const body of bodies) {
|
|
1081
|
-
ids.push(await this.send(body, opts));
|
|
1082
|
-
}
|
|
1083
|
-
return ids;
|
|
1084
|
-
}
|
|
1085
|
-
async receive(opts) {
|
|
1086
|
-
const max = Math.max(1, opts.max ?? 1);
|
|
1087
|
-
const claims = [];
|
|
1088
|
-
while (claims.length < max) {
|
|
1089
|
-
const job = await this.core.next(opts.workerId, { leaseMs: opts.leaseMs });
|
|
1090
|
-
if (!job)
|
|
1091
|
-
break;
|
|
1092
|
-
claims.push(new IndexedDbClaim(this.core, job.id, job, job.attempts ?? 0, opts.workerId));
|
|
1093
|
-
}
|
|
1094
|
-
return claims;
|
|
1095
|
-
}
|
|
1096
|
-
async releaseClaim(id) {
|
|
1097
|
-
await this.core.releaseClaim(id);
|
|
1098
|
-
}
|
|
1099
|
-
async migrate() {
|
|
1100
|
-
await this.core.migrate();
|
|
1101
|
-
}
|
|
1102
|
-
getMigrations() {
|
|
1103
|
-
return this.core.getMigrations();
|
|
1104
|
-
}
|
|
1105
|
-
subscribeToChanges(callback, options) {
|
|
1106
|
-
return this.core.subscribeToChanges(callback, options);
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
function applySendOptions(body, opts) {
|
|
1110
|
-
if (!opts)
|
|
1111
|
-
return body;
|
|
1112
|
-
const out = { ...body };
|
|
1113
|
-
if (opts.delaySeconds != null) {
|
|
1114
|
-
out.visible_at = new Date(Date.now() + opts.delaySeconds * 1000).toISOString();
|
|
1115
|
-
}
|
|
1116
|
-
if (opts.timeoutSeconds != null) {
|
|
1117
|
-
out.deadline_at = new Date(Date.now() + opts.timeoutSeconds * 1000).toISOString();
|
|
1118
|
-
}
|
|
1119
|
-
if (opts.fingerprint != null)
|
|
1120
|
-
out.fingerprint = opts.fingerprint;
|
|
1121
|
-
if (opts.jobRunId != null)
|
|
1122
|
-
out.job_run_id = opts.jobRunId;
|
|
1123
|
-
if (opts.maxAttempts != null)
|
|
1124
|
-
out.max_attempts = opts.maxAttempts;
|
|
1125
|
-
return out;
|
|
1126
|
-
}
|
|
1127
|
-
// src/job-queue/IndexedDbJobStore.ts
|
|
1128
|
-
class IndexedDbJobStore {
|
|
1129
|
-
core;
|
|
1130
|
-
constructor(core) {
|
|
1131
|
-
this.core = core;
|
|
1132
|
-
}
|
|
1133
|
-
get(id) {
|
|
1134
|
-
return this.core.get(id);
|
|
1135
|
-
}
|
|
1136
|
-
async peek(status, num) {
|
|
1137
|
-
return this.core.peek(status, num);
|
|
1138
|
-
}
|
|
1139
|
-
size(status) {
|
|
1140
|
-
return this.core.size(status);
|
|
1141
|
-
}
|
|
1142
|
-
async getByRunId(runId) {
|
|
1143
|
-
return this.core.getByRunId(runId);
|
|
1144
|
-
}
|
|
1145
|
-
outputForInput(input) {
|
|
1146
|
-
return this.core.outputForInput(input);
|
|
1147
|
-
}
|
|
1148
|
-
async saveProgress(id, progress, message, details) {
|
|
1149
|
-
await this.core.saveProgress(id, progress, message, details);
|
|
1150
|
-
}
|
|
1151
|
-
async deleteByStatusAndAge(status, olderThanMs) {
|
|
1152
|
-
await this.core.deleteJobsByStatusAndAge(status, olderThanMs);
|
|
1153
|
-
}
|
|
1154
|
-
async delete(id) {
|
|
1155
|
-
await this.core.delete(id);
|
|
1156
|
-
}
|
|
1157
|
-
async deleteAll() {
|
|
1158
|
-
await this.core.deleteAll();
|
|
1159
|
-
}
|
|
1160
|
-
async abort(id) {
|
|
1161
|
-
await this.core.abort(id);
|
|
1162
|
-
}
|
|
1163
|
-
async saveStatus(id, status) {
|
|
1164
|
-
await this.core.saveStatus(id, status);
|
|
1165
|
-
}
|
|
1166
|
-
async create(body, opts) {
|
|
1167
|
-
const enriched = {
|
|
1168
|
-
...body,
|
|
1169
|
-
fingerprint: opts.fingerprint ?? body.fingerprint,
|
|
1170
|
-
job_run_id: opts.jobRunId ?? body.job_run_id,
|
|
1171
|
-
max_attempts: opts.maxAttempts ?? body.max_attempts,
|
|
1172
|
-
deadline_at: opts.timeoutSeconds != null ? new Date(Date.now() + opts.timeoutSeconds * 1000).toISOString() : body.deadline_at
|
|
1173
|
-
};
|
|
1174
|
-
return this.core.add(enriched);
|
|
1175
|
-
}
|
|
1176
|
-
async findActiveByFingerprint(fingerprint, _queueName) {
|
|
1177
|
-
const [pending, processing] = await Promise.all([
|
|
1178
|
-
this.core.peek("PENDING"),
|
|
1179
|
-
this.core.peek("PROCESSING")
|
|
1180
|
-
]);
|
|
1181
|
-
return [...pending, ...processing].find((j) => j.fingerprint === fingerprint);
|
|
1182
|
-
}
|
|
1183
|
-
async getMany(ids) {
|
|
1184
|
-
return Promise.all(ids.map((id) => this.core.get(id)));
|
|
1185
|
-
}
|
|
1186
|
-
async completeWithResult(id, result) {
|
|
1187
|
-
await this.core.finalize(id, {
|
|
1188
|
-
output: result,
|
|
1189
|
-
error: null,
|
|
1190
|
-
error_code: null,
|
|
1191
|
-
status: "COMPLETED",
|
|
1192
|
-
completed_at: new Date().toISOString()
|
|
1193
|
-
});
|
|
1194
|
-
}
|
|
1195
|
-
async failWithError(id, opts) {
|
|
1196
|
-
const current = await this.core.get(id);
|
|
1197
|
-
const now = new Date().toISOString();
|
|
1198
|
-
const abortRequestedAt = opts.abortRequested === true ? current?.abort_requested_at ?? now : current?.abort_requested_at ?? null;
|
|
1199
|
-
await this.core.finalize(id, {
|
|
1200
|
-
..."error" in opts ? { error: opts.error ?? null } : {},
|
|
1201
|
-
..."errorCode" in opts ? { error_code: opts.errorCode ?? null } : {},
|
|
1202
|
-
abort_requested_at: abortRequestedAt,
|
|
1203
|
-
status: "FAILED",
|
|
1204
|
-
completed_at: current?.completed_at ?? now
|
|
1205
|
-
});
|
|
1206
|
-
}
|
|
1207
|
-
async markDisabled(id) {
|
|
1208
|
-
await this.core.markDisabled(id);
|
|
1209
|
-
}
|
|
1210
|
-
async markEnqueueDeferred(id, opts) {
|
|
1211
|
-
await this.core.finalize(id, {
|
|
1212
|
-
visible_at: opts.visible_at.toISOString(),
|
|
1213
|
-
error_code: opts.errorCode
|
|
1214
|
-
});
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
999
|
// src/job-queue/createIndexedDbQueue.ts
|
|
1000
|
+
import { wrapQueueStorage } from "@workglow/job-queue";
|
|
1218
1001
|
function createIndexedDbQueue(queueName, opts) {
|
|
1219
|
-
|
|
1220
|
-
return {
|
|
1221
|
-
messageQueue: new IndexedDbMessageQueue(core),
|
|
1222
|
-
jobStore: new IndexedDbJobStore(core)
|
|
1223
|
-
};
|
|
1002
|
+
return wrapQueueStorage(new IndexedDbQueueStorage(queueName, opts));
|
|
1224
1003
|
}
|
|
1225
1004
|
// src/job-queue/IndexedDbRateLimiterStorage.ts
|
|
1226
1005
|
import { createServiceToken as createServiceToken2 } from "@workglow/util";
|
|
@@ -1552,10 +1331,8 @@ export {
|
|
|
1552
1331
|
IndexedDbRateLimiterStorage,
|
|
1553
1332
|
IndexedDbQueueStorage,
|
|
1554
1333
|
IndexedDbMigrationRunner,
|
|
1555
|
-
IndexedDbMessageQueue,
|
|
1556
|
-
IndexedDbJobStore,
|
|
1557
1334
|
INDEXED_DB_RATE_LIMITER_STORAGE,
|
|
1558
1335
|
INDEXED_DB_QUEUE_STORAGE
|
|
1559
1336
|
};
|
|
1560
1337
|
|
|
1561
|
-
//# debugId=
|
|
1338
|
+
//# debugId=672FC172A214B3E764756E2164756E21
|