@stacksjs/cloud 0.58.58 → 0.58.59
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/index.js
CHANGED
|
@@ -1810,26 +1810,25 @@ class QueueStack {
|
|
|
1810
1810
|
}
|
|
1811
1811
|
async init() {
|
|
1812
1812
|
const jobsDir = path6.jobsPath();
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
}
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
console.error("Error reading the jobs directory:", err2);
|
|
1813
|
+
const actionsDir = path6.appPath("Actions");
|
|
1814
|
+
const jobFiles = await fs.readdir(jobsDir);
|
|
1815
|
+
const actionFiles = await fs.readdir(actionsDir);
|
|
1816
|
+
const jobs = [];
|
|
1817
|
+
for (const file of jobFiles) {
|
|
1818
|
+
if (!file.endsWith(".ts"))
|
|
1819
|
+
continue;
|
|
1820
|
+
const jobPath = path6.jobsPath(file);
|
|
1821
|
+
const job = await this.loadModule(jobPath);
|
|
1822
|
+
this.createQueueRule(job, file);
|
|
1823
|
+
jobs.push(job);
|
|
1824
|
+
}
|
|
1825
|
+
for (const file of actionFiles) {
|
|
1826
|
+
if (!file.endsWith(".ts"))
|
|
1827
|
+
continue;
|
|
1828
|
+
const actionPath = path6.appPath(`Actions/${file}`);
|
|
1829
|
+
const action = await this.loadModule(actionPath);
|
|
1830
|
+
this.createQueueRule(action, file);
|
|
1831
|
+
jobs.push(action);
|
|
1833
1832
|
}
|
|
1834
1833
|
}
|
|
1835
1834
|
cronScheduleFromRate(rate) {
|
|
@@ -1843,12 +1842,12 @@ class QueueStack {
|
|
|
1843
1842
|
};
|
|
1844
1843
|
}
|
|
1845
1844
|
async loadModule(filePath) {
|
|
1846
|
-
const
|
|
1847
|
-
return
|
|
1845
|
+
const jobModule = await import(filePath);
|
|
1846
|
+
return jobModule;
|
|
1848
1847
|
}
|
|
1849
|
-
createQueueRule(
|
|
1850
|
-
const rate =
|
|
1851
|
-
if (!rate ||
|
|
1848
|
+
createQueueRule(module, file) {
|
|
1849
|
+
const rate = module.default?.rate;
|
|
1850
|
+
if (!rate || module.default?.enabled === false)
|
|
1852
1851
|
return;
|
|
1853
1852
|
const schedule = Schedule.cron(this.cronScheduleFromRate(rate));
|
|
1854
1853
|
const id = `QueueRule${pascalCase(file.replace(".ts", ""))}`;
|
|
@@ -1873,19 +1872,19 @@ class QueueStack {
|
|
|
1873
1872
|
},
|
|
1874
1873
|
{
|
|
1875
1874
|
name: "JOB_BACKOFF_FACTOR",
|
|
1876
|
-
value:
|
|
1875
|
+
value: module.default?.backoffFactor
|
|
1877
1876
|
},
|
|
1878
1877
|
{
|
|
1879
1878
|
name: "JOB_RETRIES",
|
|
1880
|
-
value:
|
|
1879
|
+
value: module.default?.tries
|
|
1881
1880
|
},
|
|
1882
1881
|
{
|
|
1883
1882
|
name: "JOB_INITIAL_DELAY",
|
|
1884
|
-
value:
|
|
1883
|
+
value: module.default?.initialDelay
|
|
1885
1884
|
},
|
|
1886
1885
|
{
|
|
1887
1886
|
name: "JOB_JITTER",
|
|
1888
|
-
value:
|
|
1887
|
+
value: module.default?.jitter
|
|
1889
1888
|
}
|
|
1890
1889
|
]
|
|
1891
1890
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/cloud",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.58.
|
|
4
|
+
"version": "0.58.59",
|
|
5
5
|
"description": "The Stacks cloud/serverless integration & implementation.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"license": "MIT",
|
|
@@ -55,19 +55,19 @@
|
|
|
55
55
|
"prepublishOnly": "bun run build"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@aws-sdk/client-bedrock": "^3.
|
|
59
|
-
"@aws-sdk/client-cloudformation": "^3.
|
|
60
|
-
"@aws-sdk/client-cloudfront": "^3.
|
|
61
|
-
"@aws-sdk/client-cloudwatch-logs": "^3.
|
|
62
|
-
"@aws-sdk/client-ec2": "^3.
|
|
63
|
-
"@aws-sdk/client-efs": "^3.
|
|
64
|
-
"@aws-sdk/client-iam": "^3.
|
|
65
|
-
"@aws-sdk/client-lambda": "^3.
|
|
66
|
-
"@aws-sdk/client-route-53-domains": "^3.
|
|
67
|
-
"@aws-sdk/client-s3": "^3.
|
|
68
|
-
"@aws-sdk/client-ses": "^3.
|
|
69
|
-
"@aws-sdk/client-sesv2": "^3.
|
|
70
|
-
"@aws-sdk/client-ssm": "^3.
|
|
58
|
+
"@aws-sdk/client-bedrock": "^3.511.0",
|
|
59
|
+
"@aws-sdk/client-cloudformation": "^3.511.0",
|
|
60
|
+
"@aws-sdk/client-cloudfront": "^3.511.0",
|
|
61
|
+
"@aws-sdk/client-cloudwatch-logs": "^3.511.0",
|
|
62
|
+
"@aws-sdk/client-ec2": "^3.511.0",
|
|
63
|
+
"@aws-sdk/client-efs": "^3.511.0",
|
|
64
|
+
"@aws-sdk/client-iam": "^3.511.0",
|
|
65
|
+
"@aws-sdk/client-lambda": "^3.511.0",
|
|
66
|
+
"@aws-sdk/client-route-53-domains": "^3.511.0",
|
|
67
|
+
"@aws-sdk/client-s3": "^3.511.0",
|
|
68
|
+
"@aws-sdk/client-ses": "^3.511.0",
|
|
69
|
+
"@aws-sdk/client-sesv2": "^3.511.0",
|
|
70
|
+
"@aws-sdk/client-ssm": "^3.511.0",
|
|
71
71
|
"@stacksjs/config": "latest",
|
|
72
72
|
"@stacksjs/env": "latest",
|
|
73
73
|
"@stacksjs/logging": "latest",
|
|
@@ -79,20 +79,20 @@
|
|
|
79
79
|
"@stacksjs/validation": "latest"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@aws-sdk/client-bedrock": "^3.
|
|
83
|
-
"@aws-sdk/client-cloudformation": "^3.
|
|
84
|
-
"@aws-sdk/client-cloudfront": "^3.
|
|
85
|
-
"@aws-sdk/client-cloudwatch-logs": "^3.
|
|
86
|
-
"@aws-sdk/client-dynamodb": "3.
|
|
87
|
-
"@aws-sdk/client-ec2": "^3.
|
|
88
|
-
"@aws-sdk/client-efs": "^3.
|
|
89
|
-
"@aws-sdk/client-iam": "^3.
|
|
90
|
-
"@aws-sdk/client-lambda": "^3.
|
|
91
|
-
"@aws-sdk/client-route-53-domains": "^3.
|
|
92
|
-
"@aws-sdk/client-s3": "^3.
|
|
93
|
-
"@aws-sdk/client-ses": "^3.
|
|
94
|
-
"@aws-sdk/client-sesv2": "^3.
|
|
95
|
-
"@aws-sdk/client-ssm": "^3.
|
|
82
|
+
"@aws-sdk/client-bedrock": "^3.511.0",
|
|
83
|
+
"@aws-sdk/client-cloudformation": "^3.511.0",
|
|
84
|
+
"@aws-sdk/client-cloudfront": "^3.511.0",
|
|
85
|
+
"@aws-sdk/client-cloudwatch-logs": "^3.511.0",
|
|
86
|
+
"@aws-sdk/client-dynamodb": "3.511.0",
|
|
87
|
+
"@aws-sdk/client-ec2": "^3.511.0",
|
|
88
|
+
"@aws-sdk/client-efs": "^3.511.0",
|
|
89
|
+
"@aws-sdk/client-iam": "^3.511.0",
|
|
90
|
+
"@aws-sdk/client-lambda": "^3.511.0",
|
|
91
|
+
"@aws-sdk/client-route-53-domains": "^3.511.0",
|
|
92
|
+
"@aws-sdk/client-s3": "^3.511.0",
|
|
93
|
+
"@aws-sdk/client-ses": "^3.511.0",
|
|
94
|
+
"@aws-sdk/client-sesv2": "^3.511.0",
|
|
95
|
+
"@aws-sdk/client-ssm": "^3.511.0",
|
|
96
96
|
"@stacksjs/config": "latest",
|
|
97
97
|
"@stacksjs/dns": "latest",
|
|
98
98
|
"@stacksjs/env": "latest",
|
|
@@ -102,18 +102,18 @@
|
|
|
102
102
|
"@stacksjs/storage": "latest",
|
|
103
103
|
"@stacksjs/utils": "latest",
|
|
104
104
|
"@stacksjs/validation": "latest",
|
|
105
|
-
"aws-cdk": "^2.
|
|
106
|
-
"aws-cdk-lib": "^2.
|
|
105
|
+
"aws-cdk": "^2.127.0",
|
|
106
|
+
"aws-cdk-lib": "^2.127.0",
|
|
107
107
|
"aws4fetch": "^1.0.17",
|
|
108
108
|
"constructs": "^10.3.0"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
|
-
"@oclif/plugin-plugins": "^4.2.
|
|
111
|
+
"@oclif/plugin-plugins": "^4.2.2",
|
|
112
112
|
"@stacksjs/cli": "latest",
|
|
113
113
|
"@stacksjs/development": "latest",
|
|
114
114
|
"@stacksjs/env": "latest",
|
|
115
115
|
"jszip": "^3.10.1",
|
|
116
|
-
"oclif": "^4.4.
|
|
116
|
+
"oclif": "^4.4.10",
|
|
117
117
|
"source-map-support": "^0.5.21"
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aws-sdk-layer",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.58",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "aws-sdk-layer",
|
|
9
|
-
"version": "0.58.
|
|
9
|
+
"version": "0.58.58",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"aws-sdk": "^2.
|
|
12
|
+
"aws-sdk": "^2.1555.0"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"node_modules/available-typed-arrays": {
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"node_modules/aws-sdk": {
|
|
27
|
-
"version": "2.
|
|
28
|
-
"resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.
|
|
29
|
-
"integrity": "sha512-
|
|
27
|
+
"version": "2.1555.0",
|
|
28
|
+
"resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1555.0.tgz",
|
|
29
|
+
"integrity": "sha512-hjYs1MQkJxdHnoZm8hypqGy4PQKWVUs19McdXRXWNXr97V0il4xcUpIfvjHQ9x9EjP0p/jyIx9/BtyrR68jnUQ==",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"buffer": "4.9.2",
|
|
32
32
|
"events": "1.1.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aws-sdk-layer",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.59",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"aws-sdk": "^2.
|
|
13
|
+
"aws-sdk": "^2.1555.0"
|
|
14
14
|
}
|
|
15
15
|
}
|
package/src/cloud/queue.ts
CHANGED
|
@@ -24,39 +24,39 @@ export class QueueStack {
|
|
|
24
24
|
|
|
25
25
|
async init() {
|
|
26
26
|
const jobsDir = path.jobsPath()
|
|
27
|
+
const actionsDir = path.appPath('Actions')
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const jobs = []
|
|
29
|
+
const jobFiles = await fs.readdir(jobsDir)
|
|
30
|
+
const actionFiles = await fs.readdir(actionsDir)
|
|
31
|
+
const jobs = []
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
// then, need to loop through all app/Jobs/*.ts and create a rule for each, potentially overwriting the Schedule.ts jobs
|
|
34
|
+
for (const file of jobFiles) {
|
|
35
|
+
if (!file.endsWith('.ts'))
|
|
36
|
+
continue
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
const jobPath = path.jobsPath(file)
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (!file.endsWith('.ts'))
|
|
46
|
-
continue
|
|
40
|
+
// Await the loading of the job module
|
|
41
|
+
const job = await this.loadModule(jobPath)
|
|
42
|
+
this.createQueueRule(job, file)
|
|
43
|
+
jobs.push(job)
|
|
44
|
+
}
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
for (const file of actionFiles) {
|
|
47
|
+
if (!file.endsWith('.ts'))
|
|
48
|
+
continue
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
jobs.push(await this.loadModule(filePath))
|
|
52
|
-
}
|
|
50
|
+
const actionPath = path.appPath(`Actions/${file}`)
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
console.error('Error reading the jobs directory:', err)
|
|
52
|
+
// Await the loading of the job module
|
|
53
|
+
const action = await this.loadModule(actionPath)
|
|
54
|
+
this.createQueueRule(action, file)
|
|
55
|
+
jobs.push(action)
|
|
59
56
|
}
|
|
57
|
+
|
|
58
|
+
// for (const job of jobs)
|
|
59
|
+
// await this.createQueueRule(job, file)
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// Helper function to convert a rate string to a cron object for AWS Schedule
|
|
@@ -78,12 +78,13 @@ export class QueueStack {
|
|
|
78
78
|
return jobModule
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
// TODO: narrow any type -> jobs & actions are allowed
|
|
82
|
+
createQueueRule(module: { default: any }, file: string) {
|
|
83
|
+
// Now you can safely access module.default.rate
|
|
84
|
+
const rate = module.default?.rate
|
|
84
85
|
|
|
85
86
|
// if no rate or job is disabled, no need to schedule, skip
|
|
86
|
-
if (!rate ||
|
|
87
|
+
if (!rate || module.default?.enabled === false)
|
|
87
88
|
return
|
|
88
89
|
|
|
89
90
|
// Convert the rate to a Schedule object
|
|
@@ -115,26 +116,26 @@ export class QueueStack {
|
|
|
115
116
|
},
|
|
116
117
|
{
|
|
117
118
|
name: 'JOB_BACKOFF_FACTOR',
|
|
118
|
-
value:
|
|
119
|
+
value: module.default?.backoffFactor,
|
|
119
120
|
},
|
|
120
121
|
{
|
|
121
122
|
name: 'JOB_RETRIES',
|
|
122
|
-
value:
|
|
123
|
+
value: module.default?.tries,
|
|
123
124
|
},
|
|
124
125
|
{
|
|
125
126
|
name: 'JOB_INITIAL_DELAY',
|
|
126
|
-
value:
|
|
127
|
+
value: module.default?.initialDelay,
|
|
127
128
|
},
|
|
128
129
|
{
|
|
129
130
|
name: 'JOB_JITTER',
|
|
130
|
-
value:
|
|
131
|
+
value: module.default?.jitter,
|
|
131
132
|
},
|
|
132
133
|
],
|
|
133
134
|
},
|
|
134
135
|
],
|
|
135
136
|
|
|
136
137
|
retryAttempts: 1, // we utilize a custom retry mechanism in the job itself
|
|
137
|
-
// retryAttempts:
|
|
138
|
+
// retryAttempts: module.default.tries || 3,
|
|
138
139
|
|
|
139
140
|
subnetSelection: {
|
|
140
141
|
subnetType: ec2.SubnetType.PUBLIC, // SubnetType.PRIVATE_WITH_EGRESS
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stacks-router-layer",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.59",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@stacksjs/router": "^0.58.
|
|
13
|
+
"@stacksjs/router": "^0.58.58"
|
|
14
14
|
}
|
|
15
15
|
}
|