@infuro/cms-core 1.0.64 → 1.0.66
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/admin.cjs +4 -4
- package/dist/admin.js +4 -4
- package/dist/api.cjs +36 -36
- package/dist/api.js +4 -4
- package/dist/{chunk-M25DGZ5J.cjs → chunk-5MZFQRDW.cjs} +242 -45
- package/dist/chunk-FLUF2GZH.js +71 -0
- package/dist/{chunk-OJAYCNE5.js → chunk-NV5IRHI3.js} +240 -43
- package/dist/chunk-PA6YDMFZ.cjs +78 -0
- package/dist/{chunk-FF45VZMM.cjs → chunk-QYRXLURF.cjs} +109 -67
- package/dist/{chunk-DXERXWBR.js → chunk-RCE5SJBA.js} +36 -20
- package/dist/{chunk-K6C3ZSBZ.js → chunk-T33KU5G5.js} +81 -39
- package/dist/chunk-THL5JDWJ.cjs +101 -0
- package/dist/{chunk-PX3BSCIG.cjs → chunk-WMMZZRDJ.cjs} +38 -22
- package/dist/chunk-XJNNOSJR.js +98 -0
- package/dist/{emit-order-notification-trigger-MFCBAE7L.js → emit-order-notification-trigger-EJJZ6XTS.js} +2 -2
- package/dist/{emit-order-notification-trigger-ZRRGCQGB.cjs → emit-order-notification-trigger-ZD5YN3JM.cjs} +4 -4
- package/dist/index.cjs +224 -224
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +8 -8
- package/dist/{order-completion-otp-handlers-3W5I3LON.js → order-completion-otp-handlers-LFRHXWK4.js} +2 -2
- package/dist/{order-completion-otp-handlers-RF3DLNV7.cjs → order-completion-otp-handlers-NK65LOLV.cjs} +3 -3
- package/dist/{order-notification-dispatcher-ID2PDEXD.js → order-notification-dispatcher-ECPFI7CD.js} +2 -2
- package/dist/{order-notification-dispatcher-RNEQB3V7.cjs → order-notification-dispatcher-LL7ETKLU.cjs} +7 -7
- package/dist/{pg-boss-service-L6MTF4EQ.cjs → pg-boss-service-BDGOKM2T.cjs} +3 -3
- package/dist/pg-boss-service-WCBJD4JB.js +2 -0
- package/package.json +1 -1
- package/dist/chunk-AYWDQFJZ.js +0 -27
- package/dist/chunk-GO7PPYNU.js +0 -76
- package/dist/chunk-UEE4PTTB.cjs +0 -30
- package/dist/chunk-XQ3QUHWR.cjs +0 -83
- package/dist/pg-boss-service-4XF2TQ2E.js +0 -2
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
+
|
|
3
|
+
// src/plugins/pg-boss/pg-boss-service.ts
|
|
4
|
+
var JOB_RUNNER_QUEUE = "job-runner";
|
|
5
|
+
var PgBossService = class {
|
|
6
|
+
static {
|
|
7
|
+
__name(this, "PgBossService");
|
|
8
|
+
}
|
|
9
|
+
connectionString;
|
|
10
|
+
schema;
|
|
11
|
+
boss = null;
|
|
12
|
+
bossPromise = null;
|
|
13
|
+
started = false;
|
|
14
|
+
workRegistered = /* @__PURE__ */ new Set();
|
|
15
|
+
constructor(connectionString, schema) {
|
|
16
|
+
this.connectionString = connectionString;
|
|
17
|
+
this.schema = schema?.trim() ? schema.trim() : void 0;
|
|
18
|
+
}
|
|
19
|
+
async getBoss() {
|
|
20
|
+
if (this.boss) return this.boss;
|
|
21
|
+
if (this.bossPromise) return this.bossPromise;
|
|
22
|
+
this.bossPromise = (async () => {
|
|
23
|
+
const mod = await import('pg-boss');
|
|
24
|
+
const PgBossClass = mod?.PgBoss ?? mod?.default ?? mod;
|
|
25
|
+
const instance = new PgBossClass({
|
|
26
|
+
connectionString: this.connectionString,
|
|
27
|
+
...this.schema ? {
|
|
28
|
+
schema: this.schema
|
|
29
|
+
} : {},
|
|
30
|
+
schedule: true
|
|
31
|
+
});
|
|
32
|
+
instance.on("error", (err) => {
|
|
33
|
+
console.error("[pg-boss]", err);
|
|
34
|
+
});
|
|
35
|
+
this.boss = instance;
|
|
36
|
+
return instance;
|
|
37
|
+
})();
|
|
38
|
+
return this.bossPromise;
|
|
39
|
+
}
|
|
40
|
+
async start() {
|
|
41
|
+
if (this.started) return;
|
|
42
|
+
const boss = await this.getBoss();
|
|
43
|
+
await boss.start();
|
|
44
|
+
await this.ensureQueue(JOB_RUNNER_QUEUE);
|
|
45
|
+
this.started = true;
|
|
46
|
+
}
|
|
47
|
+
async stop() {
|
|
48
|
+
if (!this.started || !this.boss) return;
|
|
49
|
+
await this.boss.stop({
|
|
50
|
+
graceful: true,
|
|
51
|
+
timeout: 1e4
|
|
52
|
+
});
|
|
53
|
+
this.started = false;
|
|
54
|
+
this.workRegistered.clear();
|
|
55
|
+
}
|
|
56
|
+
get raw() {
|
|
57
|
+
return this.boss;
|
|
58
|
+
}
|
|
59
|
+
async ensureQueue(name) {
|
|
60
|
+
const boss = await this.getBoss();
|
|
61
|
+
const existing = await boss.getQueue(name);
|
|
62
|
+
if (!existing) {
|
|
63
|
+
await boss.createQueue(name);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async send(queue, data) {
|
|
67
|
+
await this.ensureQueue(queue);
|
|
68
|
+
const boss = await this.getBoss();
|
|
69
|
+
return boss.send(queue, data, {
|
|
70
|
+
retryLimit: 2
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
async schedule(name, cron, data, options) {
|
|
74
|
+
await this.ensureQueue(name);
|
|
75
|
+
const boss = await this.getBoss();
|
|
76
|
+
await boss.schedule(name, cron, data, options);
|
|
77
|
+
}
|
|
78
|
+
async unschedule(name) {
|
|
79
|
+
try {
|
|
80
|
+
const boss = await this.getBoss();
|
|
81
|
+
await boss.unschedule(name);
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async registerWork(queue, handler) {
|
|
86
|
+
if (this.workRegistered.has(queue)) return;
|
|
87
|
+
await this.ensureQueue(queue);
|
|
88
|
+
const boss = await this.getBoss();
|
|
89
|
+
await boss.work(queue, async (jobs) => {
|
|
90
|
+
for (const job of jobs) {
|
|
91
|
+
await handler(job.data);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
this.workRegistered.add(queue);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export { JOB_RUNNER_QUEUE, PgBossService };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { emitOrderNotificationTrigger, fireOrderNotificationTrigger } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { emitOrderNotificationTrigger, fireOrderNotificationTrigger } from './chunk-RCE5SJBA.js';
|
|
2
|
+
import './chunk-FLUF2GZH.js';
|
|
3
3
|
import './chunk-SHUYVCID.js';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkWMMZZRDJ_cjs = require('./chunk-WMMZZRDJ.cjs');
|
|
4
|
+
require('./chunk-PA6YDMFZ.cjs');
|
|
5
5
|
require('./chunk-USNT2KNT.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "emitOrderNotificationTrigger", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkWMMZZRDJ_cjs.emitOrderNotificationTrigger; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "fireOrderNotificationTrigger", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkWMMZZRDJ_cjs.fireOrderNotificationTrigger; }
|
|
16
16
|
});
|