wirejs-deploy-amplify-basic 0.0.131-async-api → 0.0.132-async-api
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.
|
@@ -105,8 +105,8 @@ export const handler: LambdaFunctionURLHandler = async (event, context) => {
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
const
|
|
109
|
-
if (!
|
|
108
|
+
const handler = (BackgroundJob as any).registeredJobs[calls.absoluteId];
|
|
109
|
+
if (!handler || typeof handler !== 'function') {
|
|
110
110
|
console.error('Background job not found',
|
|
111
111
|
calls.absoluteId,
|
|
112
112
|
(BackgroundJob as any).registeredJobs
|
|
@@ -118,7 +118,7 @@ export const handler: LambdaFunctionURLHandler = async (event, context) => {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
console.log('Starting background job');
|
|
121
|
-
await
|
|
121
|
+
await handler(...calls.args)
|
|
122
122
|
console.log('Background job completed');
|
|
123
123
|
|
|
124
124
|
return {
|
|
@@ -18,12 +18,10 @@ import { addResource } from '../resource-collector.js';
|
|
|
18
18
|
* 3. In local development, **timeouts are not enforced.** (Yet.)
|
|
19
19
|
*/
|
|
20
20
|
export class BackgroundJob extends Resource {
|
|
21
|
-
#handler;
|
|
22
21
|
#timeoutSeconds;
|
|
23
22
|
static registeredJobs = {};
|
|
24
23
|
constructor(scope, id, options) {
|
|
25
24
|
super(scope, id);
|
|
26
|
-
this.#handler = options.handler;
|
|
27
25
|
if (options.timeoutSeconds && (options.timeoutSeconds < 1 || options.timeoutSeconds > 900)) {
|
|
28
26
|
throw new Error('timeoutSeconds must be between 1 and 900 seconds.');
|
|
29
27
|
}
|
|
@@ -32,7 +30,7 @@ export class BackgroundJob extends Resource {
|
|
|
32
30
|
absoluteId: this.absoluteId,
|
|
33
31
|
timeoutSeconds: this.#timeoutSeconds,
|
|
34
32
|
});
|
|
35
|
-
BackgroundJob.registeredJobs[this.absoluteId] =
|
|
33
|
+
BackgroundJob.registeredJobs[this.absoluteId] = options.handler;
|
|
36
34
|
}
|
|
37
35
|
/**
|
|
38
36
|
* Serializes parameter data and schedules background execution.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wirejs-deploy-amplify-basic",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.132-async-api",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"recursive-copy": "^2.0.14",
|
|
43
43
|
"rimraf": "^6.0.1",
|
|
44
44
|
"wirejs-dom": "^1.0.41",
|
|
45
|
-
"wirejs-resources": "^0.1.
|
|
45
|
+
"wirejs-resources": "^0.1.100-async-api"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@aws-amplify/backend": "^1.14.0",
|