@celljs/faas-adapter 3.0.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/LICENSE +21 -0
- package/README.md +1 -0
- package/cell-event.yml +2 -0
- package/cell.yml +0 -0
- package/lib/hooks/serve.d.ts +8 -0
- package/lib/hooks/serve.d.ts.map +1 -0
- package/lib/hooks/serve.js +47 -0
- package/lib/hooks/serve.js.map +1 -0
- package/lib/node/credentials-provider.d.ts +6 -0
- package/lib/node/credentials-provider.d.ts.map +1 -0
- package/lib/node/credentials-provider.js +30 -0
- package/lib/node/credentials-provider.js.map +1 -0
- package/lib/node/dev-event-application-entry.d.ts +2 -0
- package/lib/node/dev-event-application-entry.d.ts.map +1 -0
- package/lib/node/dev-event-application-entry.js +21 -0
- package/lib/node/dev-event-application-entry.js.map +1 -0
- package/lib/node/event/event-listener.d.ts +5 -0
- package/lib/node/event/event-listener.d.ts.map +1 -0
- package/lib/node/event/event-listener.js +21 -0
- package/lib/node/event/event-listener.js.map +1 -0
- package/lib/node/event/event-protocol.d.ts +5 -0
- package/lib/node/event/event-protocol.d.ts.map +1 -0
- package/lib/node/event/event-protocol.js +5 -0
- package/lib/node/event/event-protocol.js.map +1 -0
- package/lib/node/event/index.d.ts +3 -0
- package/lib/node/event/index.d.ts.map +1 -0
- package/lib/node/event/index.js +19 -0
- package/lib/node/event/index.js.map +1 -0
- package/lib/node/factory/cron-job-factory.d.ts +9 -0
- package/lib/node/factory/cron-job-factory.d.ts.map +1 -0
- package/lib/node/factory/cron-job-factory.js +38 -0
- package/lib/node/factory/cron-job-factory.js.map +1 -0
- package/lib/node/factory/index.d.ts +2 -0
- package/lib/node/factory/index.d.ts.map +1 -0
- package/lib/node/factory/index.js +18 -0
- package/lib/node/factory/index.js.map +1 -0
- package/lib/node/index.d.ts +7 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +23 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/module.d.ts +4 -0
- package/lib/node/module.d.ts.map +1 -0
- package/lib/node/module.js +6 -0
- package/lib/node/module.js.map +1 -0
- package/lib/node/regin-provider.d.ts +5 -0
- package/lib/node/regin-provider.d.ts.map +1 -0
- package/lib/node/regin-provider.js +26 -0
- package/lib/node/regin-provider.js.map +1 -0
- package/lib/node/timer/clock.d.ts +8 -0
- package/lib/node/timer/clock.d.ts.map +1 -0
- package/lib/node/timer/clock.js +28 -0
- package/lib/node/timer/clock.js.map +1 -0
- package/lib/node/timer/cron-job.d.ts +13 -0
- package/lib/node/timer/cron-job.d.ts.map +1 -0
- package/lib/node/timer/cron-job.js +40 -0
- package/lib/node/timer/cron-job.js.map +1 -0
- package/lib/node/timer/events.d.ts +16 -0
- package/lib/node/timer/events.d.ts.map +1 -0
- package/lib/node/timer/events.js +92 -0
- package/lib/node/timer/events.js.map +1 -0
- package/lib/node/timer/index.d.ts +4 -0
- package/lib/node/timer/index.d.ts.map +1 -0
- package/lib/node/timer/index.js +20 -0
- package/lib/node/timer/index.js.map +1 -0
- package/lib/node/timer/timer-protocol.d.ts +7 -0
- package/lib/node/timer/timer-protocol.d.ts.map +1 -0
- package/lib/node/timer/timer-protocol.js +5 -0
- package/lib/node/timer/timer-protocol.js.map +1 -0
- package/lib/node/utils.d.ts +4 -0
- package/lib/node/utils.d.ts.map +1 -0
- package/lib/node/utils.js +12 -0
- package/lib/node/utils.js.map +1 -0
- package/lib/package.spec.d.ts +1 -0
- package/lib/package.spec.d.ts.map +1 -0
- package/lib/package.spec.js +4 -0
- package/lib/package.spec.js.map +1 -0
- package/package.json +48 -0
- package/src/hooks/serve.ts +46 -0
- package/src/node/credentials-provider.ts +20 -0
- package/src/node/dev-event-application-entry.ts +20 -0
- package/src/node/event/event-listener.ts +10 -0
- package/src/node/event/event-protocol.ts +5 -0
- package/src/node/event/index.ts +2 -0
- package/src/node/factory/cron-job-factory.ts +23 -0
- package/src/node/factory/index.ts +1 -0
- package/src/node/index.ts +6 -0
- package/src/node/module.ts +4 -0
- package/src/node/regin-provider.ts +15 -0
- package/src/node/timer/clock.ts +17 -0
- package/src/node/timer/cron-job.ts +46 -0
- package/src/node/timer/events.ts +115 -0
- package/src/node/timer/index.ts +3 -0
- package/src/node/timer/timer-protocol.ts +10 -0
- package/src/node/utils.ts +7 -0
- package/src/package.spec.ts +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Cellbang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Cell - FaaS Adapter Component
|
package/cell-event.yml
ADDED
package/cell.yml
ADDED
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ServeContext } from '@celljs/cli-service';
|
|
2
|
+
export declare class Deferred {
|
|
3
|
+
resolve: () => void;
|
|
4
|
+
reject: (err?: any) => void;
|
|
5
|
+
promise: Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare function after(context: ServeContext): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=serve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/hooks/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,qBAAa,QAAQ;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAE5B,OAAO,gBAGJ;CACN;AACD,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,iBAkChD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.after = exports.Deferred = void 0;
|
|
4
|
+
const config_util_1 = require("@celljs/cli-common/lib/utils/config-util");
|
|
5
|
+
class Deferred {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.promise = new Promise((resolve, reject) => {
|
|
8
|
+
this.resolve = resolve;
|
|
9
|
+
this.reject = reject;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.Deferred = Deferred;
|
|
14
|
+
async function after(context) {
|
|
15
|
+
const { app, entryContextProvider, cfg } = context;
|
|
16
|
+
if (!entryContextProvider) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const mode = config_util_1.ConfigUtil.getBackendConfig(cfg).mode || [];
|
|
20
|
+
if (!mode.includes('event')) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
let handler;
|
|
24
|
+
const compileDeferred = new Deferred();
|
|
25
|
+
context.compiler.hooks.done.tap('WebServe', () => {
|
|
26
|
+
entryContextProvider().then(async (ctx) => {
|
|
27
|
+
handler = ctx.handler;
|
|
28
|
+
console.log('Access any route to trigger event function execution.');
|
|
29
|
+
compileDeferred.resolve();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
app.all('*', async (req, res) => {
|
|
33
|
+
await compileDeferred.promise;
|
|
34
|
+
const event = req.query['event'] || '{}';
|
|
35
|
+
try {
|
|
36
|
+
await handler(event, {}, () => { });
|
|
37
|
+
res.end('Event function executed successfully.');
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
res.end('Event function failed to execute.');
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
exports.after = after;
|
|
46
|
+
;
|
|
47
|
+
//# sourceMappingURL=serve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../src/hooks/serve.ts"],"names":[],"mappings":";;;AACA,0EAAsE;AACtE,MAAa,QAAQ;IAArB;QAII,YAAO,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC5C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACzB,CAAC,CAAC,CAAC;IACP,CAAC;CAAA;AARD,4BAQC;AACM,KAAK,UAAU,KAAK,CAAC,OAAqB;IAC7C,MAAM,EAAE,GAAG,EAAE,oBAAoB,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IAEnD,IAAI,CAAC,oBAAoB,EAAE;QACvB,OAAO;KACV;IACD,MAAM,IAAI,GAAG,wBAAU,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;IACzD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QACzB,OAAO;KACV;IACD,IAAI,OAAmE,CAAC;IACxE,MAAM,eAAe,GAAG,IAAI,QAAQ,EAAE,CAAC;IAEvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,EAAE;QAC7C,oBAAoB,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,GAAQ,EAAE,EAAE;YAC3C,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;YACtB,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;YACrE,eAAe,CAAC,OAAO,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAQ,EAAE,GAAQ,EAAE,EAAE;QACtC,MAAM,eAAe,CAAC,OAAO,CAAC;QAC9B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;QACzC,IAAI;YACA,MAAM,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YACnC,GAAG,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;SACpD;QAAC,OAAO,KAAK,EAAE;YACZ,GAAG,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;YAC7C,MAAM,KAAK,CAAC;SACf;IAEL,CAAC,CAAC,CAAC;AAEP,CAAC;AAlCD,sBAkCC;AAAA,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DefaultCredentialsProvider } from '@celljs/cloud/lib/node';
|
|
2
|
+
import { Credentials } from '@celljs/cloud';
|
|
3
|
+
export declare class FaaSCredentialsProvider extends DefaultCredentialsProvider {
|
|
4
|
+
provide(): Promise<Credentials | undefined>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=credentials-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials-provider.d.ts","sourceRoot":"","sources":["../../src/node/credentials-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAuB,MAAM,eAAe,CAAC;AAEjE,qBACa,uBAAwB,SAAQ,0BAA0B;IAEpD,OAAO,IAAI,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;CAY7D"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.FaaSCredentialsProvider = void 0;
|
|
10
|
+
const node_1 = require("@celljs/cloud/lib/node");
|
|
11
|
+
const core_1 = require("@celljs/core");
|
|
12
|
+
const cloud_1 = require("@celljs/cloud");
|
|
13
|
+
let FaaSCredentialsProvider = class FaaSCredentialsProvider extends node_1.DefaultCredentialsProvider {
|
|
14
|
+
async provide() {
|
|
15
|
+
const credentials = await super.provide();
|
|
16
|
+
if (credentials) {
|
|
17
|
+
return credentials;
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
accessKeyId: process.env.MALAGU_ACCESS_KEY_ID,
|
|
21
|
+
accessKeySecret: process.env.MALAGU_ACCESS_KEY_SECRET,
|
|
22
|
+
token: process.env.MALAGU_TOKEN
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
FaaSCredentialsProvider = __decorate([
|
|
27
|
+
(0, core_1.Component)({ id: cloud_1.CredentialsProvider, rebind: true })
|
|
28
|
+
], FaaSCredentialsProvider);
|
|
29
|
+
exports.FaaSCredentialsProvider = FaaSCredentialsProvider;
|
|
30
|
+
//# sourceMappingURL=credentials-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials-provider.js","sourceRoot":"","sources":["../../src/node/credentials-provider.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iDAAoE;AACpE,uCAAyC;AACzC,yCAAiE;AAG1D,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,iCAA0B;IAE1D,KAAK,CAAC,OAAO;QAClB,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QAC1C,IAAI,WAAW,EAAE;YACb,OAAO,WAAW,CAAC;SACtB;QACD,OAAO;YACH,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAqB;YAC9C,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAyB;YACtD,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY;SAClC,CAAC;IACN,CAAC;CAEJ,CAAA;AAdY,uBAAuB;IADnC,IAAA,gBAAS,EAAC,EAAE,EAAE,EAAE,2BAAmB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;GACxC,uBAAuB,CAcnC;AAdY,0DAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-event-application-entry.d.ts","sourceRoot":"","sources":["../../src/node/dev-event-application-entry.ts"],"names":[],"mappings":"AAgBA,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,iBAGxD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = void 0;
|
|
4
|
+
const dynamic_container_1 = require("@celljs/core/lib/common/container/dynamic-container");
|
|
5
|
+
const application_protocol_1 = require("@celljs/core/lib/common/application/application-protocol");
|
|
6
|
+
const container_provider_1 = require("@celljs/core/lib/common/container/container-provider");
|
|
7
|
+
const event_protocol_1 = require("./event/event-protocol");
|
|
8
|
+
let listeners;
|
|
9
|
+
async function start() {
|
|
10
|
+
const c = await dynamic_container_1.container;
|
|
11
|
+
container_provider_1.ContainerProvider.set(c);
|
|
12
|
+
await c.get(application_protocol_1.Application).start();
|
|
13
|
+
listeners = c.getAll(event_protocol_1.FaaSEventListener);
|
|
14
|
+
}
|
|
15
|
+
const startPromise = start();
|
|
16
|
+
async function handler(event, context) {
|
|
17
|
+
await startPromise;
|
|
18
|
+
await Promise.all(listeners.map(l => l.onTrigger(event)));
|
|
19
|
+
}
|
|
20
|
+
exports.handler = handler;
|
|
21
|
+
//# sourceMappingURL=dev-event-application-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-event-application-entry.js","sourceRoot":"","sources":["../../src/node/dev-event-application-entry.ts"],"names":[],"mappings":";;;AAAA,2FAAgF;AAChF,mGAAuF;AACvF,6FAAyF;AACzF,2DAA2D;AAE3D,IAAI,SAAyC,CAAC;AAE9C,KAAK,UAAU,KAAK;IAChB,MAAM,CAAC,GAAG,MAAM,6BAAS,CAAC;IAC1B,sCAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACzB,MAAM,CAAC,CAAC,GAAG,CAAc,kCAAW,CAAC,CAAC,KAAK,EAAE,CAAC;IAC9C,SAAS,GAAG,CAAC,CAAC,MAAM,CAA+B,kCAAiB,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,YAAY,GAAG,KAAK,EAAE,CAAC;AAEtB,KAAK,UAAU,OAAO,CAAC,KAAa,EAAE,OAAY;IACrD,MAAM,YAAY,CAAC;IACnB,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC;AAHD,0BAGC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-listener.d.ts","sourceRoot":"","sources":["../../../src/node/event/event-listener.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,qBACa,iBAAkB,YAAW,iBAAiB,CAAC,EAAE,EAAE,IAAI,CAAC;IAC3D,SAAS,CAAC,KAAK,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAI5C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.NoOpEventListener = void 0;
|
|
10
|
+
const core_1 = require("@celljs/core");
|
|
11
|
+
const event_protocol_1 = require("./event-protocol");
|
|
12
|
+
let NoOpEventListener = class NoOpEventListener {
|
|
13
|
+
async onTrigger(event) {
|
|
14
|
+
// NoOp
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
NoOpEventListener = __decorate([
|
|
18
|
+
(0, core_1.Component)(event_protocol_1.FaaSEventListener)
|
|
19
|
+
], NoOpEventListener);
|
|
20
|
+
exports.NoOpEventListener = NoOpEventListener;
|
|
21
|
+
//# sourceMappingURL=event-listener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-listener.js","sourceRoot":"","sources":["../../../src/node/event/event-listener.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyC;AACzC,qDAAqD;AAG9C,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC1B,KAAK,CAAC,SAAS,CAAC,KAAS;QACrB,OAAO;IACX,CAAC;CAEJ,CAAA;AALY,iBAAiB;IAD7B,IAAA,gBAAS,EAAC,kCAAiB,CAAC;GAChB,iBAAiB,CAK7B;AALY,8CAAiB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-protocol.d.ts","sourceRoot":"","sources":["../../../src/node/event/event-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,eAA8B,CAAC;AAE7D,MAAM,WAAW,iBAAiB,CAAC,CAAC,EAAE,CAAC;IACnC,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-protocol.js","sourceRoot":"","sources":["../../../src/node/event/event-protocol.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/event/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./event-listener"), exports);
|
|
18
|
+
__exportStar(require("./event-protocol"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/event/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,mDAAiC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CronJob } from 'cron';
|
|
2
|
+
import { CronJobOptions, DefaultCronJobFactory } from '@celljs/schedule';
|
|
3
|
+
import { Clock } from '../timer';
|
|
4
|
+
export declare class FaaSCronJobFactory extends DefaultCronJobFactory {
|
|
5
|
+
protected readonly clock: Clock;
|
|
6
|
+
protected readonly mode: string[];
|
|
7
|
+
create(options: CronJobOptions): CronJob;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=cron-job-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron-job-factory.d.ts","sourceRoot":"","sources":["../../../src/node/factory/cron-job-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAkB,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,KAAK,EAAe,MAAM,UAAU,CAAC;AAE9C,qBACa,kBAAmB,SAAQ,qBAAqB;IAGzD,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IAGhC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAEzB,MAAM,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO;CAQpD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.FaaSCronJobFactory = void 0;
|
|
13
|
+
const core_1 = require("@celljs/core");
|
|
14
|
+
const schedule_1 = require("@celljs/schedule");
|
|
15
|
+
const timer_1 = require("../timer");
|
|
16
|
+
let FaaSCronJobFactory = class FaaSCronJobFactory extends schedule_1.DefaultCronJobFactory {
|
|
17
|
+
create(options) {
|
|
18
|
+
if (this.mode.includes('remote')) {
|
|
19
|
+
return new timer_1.FaaSCronJob(this.clock, Object.assign(Object.assign({}, this.defaultCronJobOptions), options));
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return super.create(options);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, core_1.Autowired)(timer_1.Clock),
|
|
28
|
+
__metadata("design:type", Object)
|
|
29
|
+
], FaaSCronJobFactory.prototype, "clock", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, core_1.Value)('mode'),
|
|
32
|
+
__metadata("design:type", Array)
|
|
33
|
+
], FaaSCronJobFactory.prototype, "mode", void 0);
|
|
34
|
+
FaaSCronJobFactory = __decorate([
|
|
35
|
+
(0, core_1.Component)({ id: schedule_1.CronJobFactory, rebind: true })
|
|
36
|
+
], FaaSCronJobFactory);
|
|
37
|
+
exports.FaaSCronJobFactory = FaaSCronJobFactory;
|
|
38
|
+
//# sourceMappingURL=cron-job-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron-job-factory.js","sourceRoot":"","sources":["../../../src/node/factory/cron-job-factory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAA2D;AAE3D,+CAAyF;AACzF,oCAA8C;AAGvC,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,gCAAqB;IAQhD,MAAM,CAAC,OAAuB;QACnC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAC9B,OAAO,IAAI,mBAAW,CAAC,IAAI,CAAC,KAAK,kCAAM,IAAI,CAAC,qBAAqB,GAAK,OAAO,EAAG,CAAC;SACpF;aAAM;YACH,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;SAChC;IACL,CAAC;CAEJ,CAAA;AAdG;IAAC,IAAA,gBAAS,EAAC,aAAK,CAAC;;iDACe;AAEhC;IAAC,IAAA,YAAK,EAAC,MAAM,CAAC;;gDACoB;AANzB,kBAAkB;IAD9B,IAAA,gBAAS,EAAC,EAAE,EAAE,EAAE,yBAAc,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;GACnC,kBAAkB,CAgB9B;AAhBY,gDAAkB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/factory/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./cron-job-factory"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/factory/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./credentials-provider"), exports);
|
|
18
|
+
__exportStar(require("./regin-provider"), exports);
|
|
19
|
+
__exportStar(require("./timer"), exports);
|
|
20
|
+
__exportStar(require("./event"), exports);
|
|
21
|
+
__exportStar(require("./factory"), exports);
|
|
22
|
+
__exportStar(require("./utils"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,mDAAiC;AACjC,0CAAwB;AACxB,0CAAwB;AACxB,4CAA0B;AAC1B,0CAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,CAAC;;AAEjB,wBAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":";;AAAA,uCAAwC;AACxC,mBAAiB;AAEjB,kBAAe,IAAA,eAAQ,GAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regin-provider.d.ts","sourceRoot":"","sources":["../../src/node/regin-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAI/D,qBACa,kBAAmB,SAAQ,qBAAqB;IAE1C,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAOxD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.FaaSRegionProvider = void 0;
|
|
10
|
+
const node_1 = require("@celljs/cloud/lib/node");
|
|
11
|
+
const core_1 = require("@celljs/core");
|
|
12
|
+
const cloud_1 = require("@celljs/cloud");
|
|
13
|
+
let FaaSRegionProvider = class FaaSRegionProvider extends node_1.DefaultRegionProvider {
|
|
14
|
+
async provide() {
|
|
15
|
+
const region = await super.provide();
|
|
16
|
+
if (region) {
|
|
17
|
+
return region;
|
|
18
|
+
}
|
|
19
|
+
return process.env.MALAGU_REGION;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
FaaSRegionProvider = __decorate([
|
|
23
|
+
(0, core_1.Component)({ id: cloud_1.RegionProvider, rebind: true })
|
|
24
|
+
], FaaSRegionProvider);
|
|
25
|
+
exports.FaaSRegionProvider = FaaSRegionProvider;
|
|
26
|
+
//# sourceMappingURL=regin-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regin-provider.js","sourceRoot":"","sources":["../../src/node/regin-provider.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iDAA+D;AAC/D,uCAAyC;AACzC,yCAA+C;AAGxC,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,4BAAqB;IAEhD,KAAK,CAAC,OAAO;QAClB,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QACrC,IAAI,MAAM,EAAE;YACR,OAAO,MAAM,CAAC;SACjB;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IACrC,CAAC;CACJ,CAAA;AATY,kBAAkB;IAD9B,IAAA,gBAAS,EAAC,EAAE,EAAE,EAAE,sBAAc,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;GACnC,kBAAkB,CAS9B;AATY,gDAAkB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Emitter, Event } from './events';
|
|
2
|
+
import { Clock } from './timer-protocol';
|
|
3
|
+
export declare class ClockImpl implements Clock {
|
|
4
|
+
protected onTickEmitter: Emitter<void>;
|
|
5
|
+
get onTick(): Event<void>;
|
|
6
|
+
tick(): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=clock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../../src/node/timer/clock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,qBACa,SAAU,YAAW,KAAK;IACnC,SAAS,CAAC,aAAa,gBAAuB;IAE9C,IAAI,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,CAExB;IAEK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAI9B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ClockImpl = void 0;
|
|
10
|
+
const core_1 = require("@celljs/core");
|
|
11
|
+
const events_1 = require("./events");
|
|
12
|
+
const timer_protocol_1 = require("./timer-protocol");
|
|
13
|
+
let ClockImpl = class ClockImpl {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.onTickEmitter = new events_1.Emitter();
|
|
16
|
+
}
|
|
17
|
+
get onTick() {
|
|
18
|
+
return this.onTickEmitter.event;
|
|
19
|
+
}
|
|
20
|
+
async tick() {
|
|
21
|
+
await this.onTickEmitter.fire();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
ClockImpl = __decorate([
|
|
25
|
+
(0, core_1.Component)(timer_protocol_1.Clock)
|
|
26
|
+
], ClockImpl);
|
|
27
|
+
exports.ClockImpl = ClockImpl;
|
|
28
|
+
//# sourceMappingURL=clock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.js","sourceRoot":"","sources":["../../../src/node/timer/clock.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyC;AACzC,qCAA0C;AAC1C,qDAAyC;AAGlC,IAAM,SAAS,GAAf,MAAM,SAAS;IAAf;QACO,kBAAa,GAAG,IAAI,gBAAO,EAAQ,CAAC;IAUlD,CAAC;IARG,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,IAAI;QACN,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;IACpC,CAAC;CAEJ,CAAA;AAXY,SAAS;IADrB,IAAA,gBAAS,EAAC,sBAAK,CAAC;GACJ,SAAS,CAWrB;AAXY,8BAAS"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Disposable } from '@celljs/core';
|
|
2
|
+
import { CronJob } from 'cron';
|
|
3
|
+
import { CronJobOptions } from '@celljs/schedule';
|
|
4
|
+
import { Clock } from './timer-protocol';
|
|
5
|
+
export declare class FaaSCronJob extends CronJob {
|
|
6
|
+
protected readonly clock: Clock;
|
|
7
|
+
protected tickDisposable?: Disposable;
|
|
8
|
+
constructor(clock: Clock, options: CronJobOptions);
|
|
9
|
+
protected fireOnTickAsync(): Promise<void>;
|
|
10
|
+
start(): void;
|
|
11
|
+
stop(): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=cron-job.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron-job.d.ts","sourceRoot":"","sources":["../../../src/node/timer/cron-job.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAY,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,qBAAa,WAAY,SAAQ,OAAO;IAIxB,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK;IAF3C,SAAS,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;gBAEP,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc;cAIpD,eAAe;IAOtB,KAAK;IAgBL,IAAI;CAShB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FaaSCronJob = void 0;
|
|
4
|
+
const cron_1 = require("cron");
|
|
5
|
+
class FaaSCronJob extends cron_1.CronJob {
|
|
6
|
+
constructor(clock, options) {
|
|
7
|
+
super(options);
|
|
8
|
+
this.clock = clock;
|
|
9
|
+
}
|
|
10
|
+
async fireOnTickAsync() {
|
|
11
|
+
const callbacks = this._callbacks;
|
|
12
|
+
const context = this.context;
|
|
13
|
+
const onComplete = this.onComplete;
|
|
14
|
+
await Promise.all(callbacks.map((callback) => callback.call(context, onComplete)));
|
|
15
|
+
}
|
|
16
|
+
;
|
|
17
|
+
start() {
|
|
18
|
+
if (this.running) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
this.tickDisposable = this.clock.onTick(async () => {
|
|
22
|
+
const cronTime = this.cronTime;
|
|
23
|
+
const timeout = cronTime.getTimeout();
|
|
24
|
+
if (timeout <= 60 * 1000) {
|
|
25
|
+
await this.fireOnTickAsync();
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
stop() {
|
|
30
|
+
var _a;
|
|
31
|
+
(_a = this.tickDisposable) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
32
|
+
this.running = false;
|
|
33
|
+
const onComplete = this.onComplete;
|
|
34
|
+
if (typeof onComplete === 'function') {
|
|
35
|
+
onComplete();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.FaaSCronJob = FaaSCronJob;
|
|
40
|
+
//# sourceMappingURL=cron-job.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron-job.js","sourceRoot":"","sources":["../../../src/node/timer/cron-job.ts"],"names":[],"mappings":";;;AACA,+BAAyC;AAIzC,MAAa,WAAY,SAAQ,cAAO;IAIpC,YAA+B,KAAY,EAAE,OAAuB;QAChE,KAAK,CAAC,OAAO,CAAC,CAAC;QADY,UAAK,GAAL,KAAK,CAAO;IAE3C,CAAC;IAES,KAAK,CAAC,eAAe;QAC3B,MAAM,SAAS,GAAI,IAAY,CAAC,UAAU,CAAC;QAC3C,MAAM,OAAO,GAAI,IAAY,CAAC,OAAO,CAAC;QACtC,MAAM,UAAU,GAAI,IAAY,CAAC,UAAU,CAAC;QAC5C,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAa,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAC5F,CAAC;IAAA,CAAC;IAEO,KAAK;QACV,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,OAAO;SACV;QAED,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;YAE/C,MAAM,QAAQ,GAAc,IAAY,CAAC,QAAQ,CAAC;YAClD,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC;YACtC,IAAI,OAAO,IAAI,EAAE,GAAG,IAAI,EAAE;gBACtB,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;aAChC;QAEL,CAAC,CAAC,CAAC;IACP,CAAC;IAEQ,IAAI;;QACT,MAAA,IAAI,CAAC,cAAc,0CAAE,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,MAAM,UAAU,GAAI,IAAY,CAAC,UAAU,CAAC;QAC5C,IAAI,OAAO,UAAU,KAAK,UAAU,EAAE;YAClC,UAAU,EAAE,CAAC;SAChB;IACL,CAAC;CAEJ;AAxCD,kCAwCC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Disposable } from '@celljs/core';
|
|
2
|
+
export interface Event<T> {
|
|
3
|
+
(listener: (e: T) => any, disposables?: Disposable[]): Disposable;
|
|
4
|
+
}
|
|
5
|
+
export declare namespace Event {
|
|
6
|
+
const None: Event<any>;
|
|
7
|
+
}
|
|
8
|
+
export declare class Emitter<T> {
|
|
9
|
+
private static _noop;
|
|
10
|
+
private _event;
|
|
11
|
+
private callbacks;
|
|
12
|
+
get event(): Event<T>;
|
|
13
|
+
fire(event: T): Promise<void>;
|
|
14
|
+
dispose(): void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/node/timer/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,WAAW,KAAK,CAAC,CAAC;IAEpB,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,GAAG,EAAE,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC;CACrE;AAED,yBAAiB,KAAK,CAAC;IAEZ,MAAM,IAAI,EAAE,KAAK,CAAC,GAAG,CAAsC,CAAC;CACtE;AAwDD,qBAAa,OAAO,CAAC,CAAC;IAElB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAmB;IAEvC,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,SAAS,CAA2B;IAE5C,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CA2BpB;IAEK,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAMnC,OAAO;CAMV"}
|