@friggframework/admin-scripts 2.0.0--canary.517.542a9ec.0 → 2.0.0--canary.517.2d5f115.0
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/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/admin-scripts",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.517.
|
|
4
|
+
"version": "2.0.0--canary.517.2d5f115.0",
|
|
5
5
|
"description": "Admin Script Runner for Frigg - Execute maintenance and operational scripts in hosted environments",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@aws-sdk/client-scheduler": "^3.588.0",
|
|
8
|
-
"@friggframework/core": "2.0.0--canary.517.
|
|
8
|
+
"@friggframework/core": "2.0.0--canary.517.2d5f115.0",
|
|
9
9
|
"@hapi/boom": "^10.0.1",
|
|
10
10
|
"express": "^4.18.2",
|
|
11
11
|
"serverless-http": "^3.2.0"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@friggframework/eslint-config": "2.0.0--canary.517.
|
|
15
|
-
"@friggframework/prettier-config": "2.0.0--canary.517.
|
|
16
|
-
"@friggframework/test": "2.0.0--canary.517.
|
|
14
|
+
"@friggframework/eslint-config": "2.0.0--canary.517.2d5f115.0",
|
|
15
|
+
"@friggframework/prettier-config": "2.0.0--canary.517.2d5f115.0",
|
|
16
|
+
"@friggframework/test": "2.0.0--canary.517.2d5f115.0",
|
|
17
17
|
"eslint": "^8.22.0",
|
|
18
18
|
"jest": "^29.7.0",
|
|
19
19
|
"prettier": "^2.7.1",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"maintenance",
|
|
45
45
|
"operations"
|
|
46
46
|
],
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "2d5f1156389ca3b013b151bd6a8468d9d2f8e0cf"
|
|
48
48
|
}
|
|
@@ -8,9 +8,6 @@ class AdminScriptBase {
|
|
|
8
8
|
inputSchema: null,
|
|
9
9
|
outputSchema: null,
|
|
10
10
|
|
|
11
|
-
// Scheduling is not declared here — a script is a capability. Admins
|
|
12
|
-
// activate a schedule at runtime via PUT /admin/scripts/:name/schedule.
|
|
13
|
-
|
|
14
11
|
config: {
|
|
15
12
|
timeout: 300000,
|
|
16
13
|
requireIntegrationInstance: false,
|
|
@@ -6,8 +6,6 @@ const Boom = require('@hapi/boom');
|
|
|
6
6
|
* Application Layer - Hexagonal Architecture
|
|
7
7
|
*
|
|
8
8
|
* Deletes a schedule override and cleans up external scheduler resources.
|
|
9
|
-
* After deletion the script has no active schedule — schedules are never
|
|
10
|
-
* derived from the Definition; an admin re-activates one via PUT /schedule.
|
|
11
9
|
*/
|
|
12
10
|
class DeleteScheduleUseCase {
|
|
13
11
|
constructor({ commands, schedulerAdapter, scriptFactory }) {
|
|
@@ -33,8 +31,6 @@ class DeleteScheduleUseCase {
|
|
|
33
31
|
deleteResult.deleted?.externalScheduleId
|
|
34
32
|
);
|
|
35
33
|
|
|
36
|
-
// Nothing derives a schedule from the Definition, so once the DB
|
|
37
|
-
// override is removed the script has no active schedule.
|
|
38
34
|
const effectiveSchedule = { source: 'none', enabled: false };
|
|
39
35
|
|
|
40
36
|
return {
|
|
@@ -5,12 +5,7 @@ const Boom = require('@hapi/boom');
|
|
|
5
5
|
*
|
|
6
6
|
* Application Layer - Hexagonal Architecture
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* 1. Database override (activated at runtime via PUT /schedule)
|
|
10
|
-
* 2. None (script is declared but not actively scheduled)
|
|
11
|
-
*
|
|
12
|
-
* Schedules are never derived from the script Definition — a script declares
|
|
13
|
-
* a capability; an admin activates a schedule explicitly via the API.
|
|
8
|
+
* Returns the script's database schedule, or a disabled schedule when none exists.
|
|
14
9
|
*/
|
|
15
10
|
class GetEffectiveScheduleUseCase {
|
|
16
11
|
constructor({ commands, scriptFactory }) {
|
|
@@ -26,7 +21,6 @@ class GetEffectiveScheduleUseCase {
|
|
|
26
21
|
async execute(scriptName) {
|
|
27
22
|
this._validateScriptExists(scriptName);
|
|
28
23
|
|
|
29
|
-
// Priority 1: Database override
|
|
30
24
|
const dbSchedule = await this.commands.getScheduleByScriptName(
|
|
31
25
|
scriptName
|
|
32
26
|
);
|
|
@@ -37,8 +31,6 @@ class GetEffectiveScheduleUseCase {
|
|
|
37
31
|
};
|
|
38
32
|
}
|
|
39
33
|
|
|
40
|
-
// No database override: the script is declared but not actively
|
|
41
|
-
// scheduled. Admins activate scheduling explicitly via PUT /schedule.
|
|
42
34
|
return {
|
|
43
35
|
source: 'none',
|
|
44
36
|
schedule: {
|
|
@@ -28,7 +28,6 @@ class UpsertScheduleUseCase {
|
|
|
28
28
|
this._validateScriptExists(scriptName);
|
|
29
29
|
this._validateInput(enabled, cronExpression);
|
|
30
30
|
|
|
31
|
-
// Save to database
|
|
32
31
|
const schedule = await this.commands.upsertSchedule({
|
|
33
32
|
scriptName,
|
|
34
33
|
enabled,
|
|
@@ -36,7 +35,6 @@ class UpsertScheduleUseCase {
|
|
|
36
35
|
timezone: timezone || 'UTC',
|
|
37
36
|
});
|
|
38
37
|
|
|
39
|
-
// Sync with external scheduler (AWS EventBridge, etc.)
|
|
40
38
|
const schedulerResult = await this._syncExternalScheduler(
|
|
41
39
|
scriptName,
|
|
42
40
|
enabled,
|
|
@@ -87,8 +85,6 @@ class UpsertScheduleUseCase {
|
|
|
87
85
|
}
|
|
88
86
|
|
|
89
87
|
/**
|
|
90
|
-
* Sync with external scheduler service
|
|
91
|
-
* Abstracts AWS EventBridge or other scheduler providers
|
|
92
88
|
* @private
|
|
93
89
|
*/
|
|
94
90
|
async _syncExternalScheduler(
|
|
@@ -106,7 +102,6 @@ class UpsertScheduleUseCase {
|
|
|
106
102
|
|
|
107
103
|
try {
|
|
108
104
|
if (enabled && cronExpression) {
|
|
109
|
-
// Create/update external schedule
|
|
110
105
|
const schedulerInfo =
|
|
111
106
|
await this.schedulerAdapter.createSchedule({
|
|
112
107
|
scriptName,
|
|
@@ -123,7 +118,6 @@ class UpsertScheduleUseCase {
|
|
|
123
118
|
result.externalScheduleName = schedulerInfo.scheduleName;
|
|
124
119
|
}
|
|
125
120
|
} else if (!enabled && existingId) {
|
|
126
|
-
// Delete external schedule
|
|
127
121
|
await this.schedulerAdapter.deleteSchedule(scriptName);
|
|
128
122
|
await this.commands.updateScheduleExternalInfo(scriptName, {
|
|
129
123
|
externalScheduleId: null,
|