@infuro/cms-core 1.0.28 → 1.0.29
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 +1768 -1193
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.d.cts +10 -1
- package/dist/admin.d.ts +10 -1
- package/dist/admin.js +1730 -1156
- package/dist/admin.js.map +1 -1
- package/dist/api.cjs +562 -13
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +566 -4
- package/dist/api.js.map +1 -1
- package/dist/cli.cjs +2 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/{index-CI6J9dxr.d.cts → index-BPQSXgXF.d.cts} +20 -1
- package/dist/{index-CMJZ5Fpr.d.ts → index-D9SdaDJ0.d.ts} +20 -1
- package/dist/index.cjs +2241 -1416
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -16
- package/dist/index.d.ts +106 -16
- package/dist/index.js +2210 -1383
- package/dist/index.js.map +1 -1
- package/dist/migrations/1775700000000-JobSchedules.ts +70 -0
- package/package.json +4 -2
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
export class JobSchedules1775700000000 implements MigrationInterface {
|
|
4
|
+
name = 'JobSchedules1775700000000';
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`CREATE EXTENSION IF NOT EXISTS "pgcrypto"`);
|
|
8
|
+
await queryRunner.query(`
|
|
9
|
+
CREATE TABLE IF NOT EXISTS "job_schedules" (
|
|
10
|
+
"id" uuid NOT NULL DEFAULT gen_random_uuid(),
|
|
11
|
+
"name" text NOT NULL,
|
|
12
|
+
"jobType" character varying(64) NOT NULL DEFAULT 'blog_generate',
|
|
13
|
+
"enabled" boolean NOT NULL DEFAULT false,
|
|
14
|
+
"scheduleMode" character varying(32) NOT NULL DEFAULT 'daily',
|
|
15
|
+
"intervalMinutes" integer,
|
|
16
|
+
"runAtTime" character varying(8),
|
|
17
|
+
"runOnDays" jsonb,
|
|
18
|
+
"timezone" character varying(64) NOT NULL DEFAULT 'UTC',
|
|
19
|
+
"cronExpression" text,
|
|
20
|
+
"payload" jsonb NOT NULL DEFAULT '{}',
|
|
21
|
+
"authorId" integer,
|
|
22
|
+
"pgBossScheduleName" character varying(128) NOT NULL,
|
|
23
|
+
"lastRunAt" TIMESTAMP,
|
|
24
|
+
"lastRunStatus" character varying(32),
|
|
25
|
+
"lastRunError" text,
|
|
26
|
+
"nextRunAt" TIMESTAMP,
|
|
27
|
+
"createdAt" TIMESTAMP NOT NULL DEFAULT now(),
|
|
28
|
+
"updatedAt" TIMESTAMP NOT NULL DEFAULT now(),
|
|
29
|
+
CONSTRAINT "PK_job_schedules" PRIMARY KEY ("id")
|
|
30
|
+
)`);
|
|
31
|
+
await queryRunner.query(
|
|
32
|
+
`CREATE UNIQUE INDEX IF NOT EXISTS "UQ_job_schedules_pgBossScheduleName" ON "job_schedules" ("pgBossScheduleName")`
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
await queryRunner.query(`
|
|
36
|
+
CREATE TABLE IF NOT EXISTS "job_schedule_runs" (
|
|
37
|
+
"id" uuid NOT NULL DEFAULT gen_random_uuid(),
|
|
38
|
+
"scheduleId" uuid NOT NULL,
|
|
39
|
+
"startedAt" TIMESTAMP NOT NULL,
|
|
40
|
+
"finishedAt" TIMESTAMP,
|
|
41
|
+
"status" character varying(32) NOT NULL,
|
|
42
|
+
"error" text,
|
|
43
|
+
"result" jsonb,
|
|
44
|
+
"triggeredBy" character varying(16) NOT NULL DEFAULT 'schedule',
|
|
45
|
+
"createdAt" TIMESTAMP NOT NULL DEFAULT now(),
|
|
46
|
+
CONSTRAINT "PK_job_schedule_runs" PRIMARY KEY ("id")
|
|
47
|
+
)`);
|
|
48
|
+
await queryRunner.query(`
|
|
49
|
+
DO $$ BEGIN
|
|
50
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'FK_job_schedule_runs_schedule') THEN
|
|
51
|
+
ALTER TABLE "job_schedule_runs"
|
|
52
|
+
ADD CONSTRAINT "FK_job_schedule_runs_schedule"
|
|
53
|
+
FOREIGN KEY ("scheduleId") REFERENCES "job_schedules"("id") ON DELETE CASCADE ON UPDATE NO ACTION;
|
|
54
|
+
END IF;
|
|
55
|
+
END $$;`);
|
|
56
|
+
await queryRunner.query(
|
|
57
|
+
`CREATE INDEX IF NOT EXISTS "IDX_job_schedule_runs_schedule" ON "job_schedule_runs" ("scheduleId")`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
62
|
+
await queryRunner.query(`DROP INDEX IF EXISTS "IDX_job_schedule_runs_schedule"`);
|
|
63
|
+
await queryRunner.query(
|
|
64
|
+
`ALTER TABLE "job_schedule_runs" DROP CONSTRAINT IF EXISTS "FK_job_schedule_runs_schedule"`
|
|
65
|
+
);
|
|
66
|
+
await queryRunner.query(`DROP TABLE IF EXISTS "job_schedule_runs"`);
|
|
67
|
+
await queryRunner.query(`DROP INDEX IF EXISTS "UQ_job_schedules_pgBossScheduleName"`);
|
|
68
|
+
await queryRunner.query(`DROP TABLE IF EXISTS "job_schedules"`);
|
|
69
|
+
}
|
|
70
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infuro/cms-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.29",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -55,7 +55,8 @@
|
|
|
55
55
|
"prepublishOnly": "npm run build",
|
|
56
56
|
"migration:run": "cross-env TYPEORM_CLI=1 tsx -r dotenv/config node_modules/typeorm/cli.js migration:run -d src/scripts/migration-datasource.cjs",
|
|
57
57
|
"migration:revert": "cross-env TYPEORM_CLI=1 tsx -r dotenv/config node_modules/typeorm/cli.js migration:revert -d src/scripts/migration-datasource.cjs",
|
|
58
|
-
"test:chat-agent": "tsx -r dotenv/config scripts/test-chat-agent.ts"
|
|
58
|
+
"test:chat-agent": "tsx -r dotenv/config scripts/test-chat-agent.ts",
|
|
59
|
+
"worker:jobs": "tsx -r dotenv/config src/scripts/pg-boss-worker.ts"
|
|
59
60
|
},
|
|
60
61
|
"peerDependencies": {
|
|
61
62
|
"@craftjs/core": ">=0.2.0",
|
|
@@ -119,6 +120,7 @@
|
|
|
119
120
|
"papaparse": "^5.4.1",
|
|
120
121
|
"pdf-parse": "^1.1.1",
|
|
121
122
|
"pg": "^8.20.0",
|
|
123
|
+
"pg-boss": "^10.0.0",
|
|
122
124
|
"razorpay": "^2.9.6",
|
|
123
125
|
"react-chartjs-2": "^5.3.0",
|
|
124
126
|
"reflect-metadata": "^0.2.2",
|