@pristine-ts/gcp-scheduling 2.0.16

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.
@@ -0,0 +1,24 @@
1
+ import { Event, EventHandlerInterface, EventResponse } from "@pristine-ts/core";
2
+ import { SchedulerInterface } from "@pristine-ts/scheduling";
3
+ /**
4
+ * Handler that picks up Cloud Scheduler ticks. Cloud Scheduler can deliver in two ways:
5
+ *
6
+ * 1. **Pub/Sub target** — the scheduler publishes to a topic; the function/service
7
+ * receives a normal Pub/Sub push delivery. The message attribute `userAgent`
8
+ * starts with `Google-Cloud-Scheduler`, and the message attribute or body
9
+ * carries the job name.
10
+ *
11
+ * 2. **HTTP target** — the scheduler hits an HTTP endpoint with the
12
+ * `X-CloudScheduler: true` and `X-CloudScheduler-JobName` headers set.
13
+ *
14
+ * Both paths end up calling `SchedulerInterface.runTasks(jobName)`. Mirror of
15
+ * `EventBridgeCronEventHandler` in `@pristine-ts/aws-scheduling`.
16
+ */
17
+ export declare class CloudSchedulerEventHandler implements EventHandlerInterface<any, any> {
18
+ private readonly scheduler;
19
+ constructor(scheduler: SchedulerInterface);
20
+ handle(event: Event<any>): Promise<EventResponse<any, any>>;
21
+ supports<T>(event: Event<T>): boolean;
22
+ private extractJobName;
23
+ private getHeaders;
24
+ }
@@ -0,0 +1 @@
1
+ export * from "./cloud-scheduler.event-handler";
@@ -0,0 +1,4 @@
1
+ import { ModuleInterface } from "@pristine-ts/common";
2
+ export * from "./event-handlers/event-handlers";
3
+ export * from "./gcp-scheduling.module.keyname";
4
+ export declare const GcpSchedulingModule: ModuleInterface;
@@ -0,0 +1 @@
1
+ export declare const GcpSchedulingModuleKeyname: string;
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@pristine-ts/gcp-scheduling",
3
+ "version": "2.0.16",
4
+ "description": "",
5
+ "module": "dist/lib/esm/gcp-scheduling.module.js",
6
+ "main": "dist/lib/cjs/gcp-scheduling.module.js",
7
+ "types": "dist/types/gcp-scheduling.module.d.ts",
8
+ "scripts": {
9
+ "build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json",
10
+ "prepublish": "npm run build",
11
+ "test": "jest",
12
+ "test:cov": "jest --coverage"
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "author": "",
18
+ "license": "ISC",
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "dependencies": {
23
+ "@pristine-ts/common": "^2.0.16",
24
+ "@pristine-ts/gcp": "^2.0.16",
25
+ "@pristine-ts/gcp-functions": "^2.0.16",
26
+ "@pristine-ts/logging": "^2.0.16",
27
+ "@pristine-ts/scheduling": "^2.0.16"
28
+ },
29
+ "jest": {
30
+ "transform": {
31
+ ".(ts|tsx)": "ts-jest"
32
+ },
33
+ "globals": {
34
+ "ts-jest": {
35
+ "tsconfig": {
36
+ "strictNullChecks": false
37
+ }
38
+ }
39
+ },
40
+ "testEnvironment": "node",
41
+ "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
42
+ "moduleFileExtensions": [
43
+ "ts",
44
+ "tsx",
45
+ "js"
46
+ ],
47
+ "coveragePathIgnorePatterns": [
48
+ "/node_modules/",
49
+ "/test/"
50
+ ],
51
+ "coverageThreshold": {
52
+ "global": {
53
+ "branches": 90,
54
+ "functions": 95,
55
+ "lines": 95,
56
+ "statements": 95
57
+ }
58
+ },
59
+ "collectCoverageFrom": [
60
+ "src/*.{js,ts}"
61
+ ]
62
+ },
63
+ "repository": {
64
+ "type": "git",
65
+ "url": "https://github.com/magieno/pristine-ts.git",
66
+ "directory": "packages/gcp-scheduling"
67
+ },
68
+ "gitHead": "a55d7d59862672a8cbbca4088fed090779b37705"
69
+ }
package/readme.md ADDED
@@ -0,0 +1,6 @@
1
+ # @pristine-ts/gcp-scheduling
2
+
3
+ Cloud Scheduler integration for Pristine-TS. Mirror of `@pristine-ts/aws-scheduling`:
4
+ listens for the two ways Cloud Scheduler delivers a tick (Pub/Sub topic or HTTP
5
+ endpoint with `X-CloudScheduler-*` headers) and triggers `SchedulerInterface.runTasks`
6
+ with the job name.