@causa/runtime-google 0.30.0 → 0.31.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/dist/tasks/scheduler.d.ts +11 -1
- package/dist/tasks/scheduler.js +18 -2
- package/package.json +9 -9
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CloudTasksClient, protos } from '@google-cloud/tasks';
|
|
2
|
+
import { ConfigService } from '@nestjs/config';
|
|
2
3
|
import { RetryOptions } from 'google-gax';
|
|
3
4
|
export import Task = protos.google.cloud.tasks.v2.ITask;
|
|
4
5
|
export import HttpMethod = protos.google.cloud.tasks.v2.HttpMethod;
|
|
@@ -22,7 +23,16 @@ export type HttpRequestCreation = Omit<HttpRequest, 'body' | 'oidcToken'> & {
|
|
|
22
23
|
*/
|
|
23
24
|
export declare class CloudTasksScheduler {
|
|
24
25
|
private readonly client;
|
|
25
|
-
|
|
26
|
+
private readonly configService;
|
|
27
|
+
constructor(client: CloudTasksClient, configService: ConfigService);
|
|
28
|
+
/**
|
|
29
|
+
* Returns the full path of the queue with the given name.
|
|
30
|
+
* It gets the path from the configuration, using the `TASKS_QUEUE_` prefix and the uppercase and underscored name.
|
|
31
|
+
*
|
|
32
|
+
* @param name The name of the queue.
|
|
33
|
+
* @returns The full path of the queue, or `null` if the configuration could not be found.
|
|
34
|
+
*/
|
|
35
|
+
getQueuePath(name: string): string | null;
|
|
26
36
|
/**
|
|
27
37
|
* The promise resolving to the email of the service account used by the Cloud Tasks client.
|
|
28
38
|
* This assumes that it is the account used by the current service / application.
|
package/dist/tasks/scheduler.js
CHANGED
|
@@ -9,6 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
import { CloudTasksClient, protos } from '@google-cloud/tasks';
|
|
11
11
|
import { Injectable } from '@nestjs/common';
|
|
12
|
+
import { ConfigService } from '@nestjs/config';
|
|
12
13
|
import { grpc } from 'google-gax';
|
|
13
14
|
import { TemporaryCloudTasksError } from './errors.js';
|
|
14
15
|
export var HttpMethod = protos.google.cloud.tasks.v2.HttpMethod;
|
|
@@ -44,8 +45,22 @@ const GRPC_RETRYABLE_CODES = [
|
|
|
44
45
|
*/
|
|
45
46
|
let CloudTasksScheduler = class CloudTasksScheduler {
|
|
46
47
|
client;
|
|
47
|
-
|
|
48
|
+
configService;
|
|
49
|
+
constructor(client, configService) {
|
|
48
50
|
this.client = client;
|
|
51
|
+
this.configService = configService;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns the full path of the queue with the given name.
|
|
55
|
+
* It gets the path from the configuration, using the `TASKS_QUEUE_` prefix and the uppercase and underscored name.
|
|
56
|
+
*
|
|
57
|
+
* @param name The name of the queue.
|
|
58
|
+
* @returns The full path of the queue, or `null` if the configuration could not be found.
|
|
59
|
+
*/
|
|
60
|
+
getQueuePath(name) {
|
|
61
|
+
const configName = `TASKS_QUEUE_${name.toUpperCase().replace(/[\.-]{1}/g, '_')}`;
|
|
62
|
+
const queuePath = this.configService.get(configName);
|
|
63
|
+
return queuePath ?? null;
|
|
49
64
|
}
|
|
50
65
|
/**
|
|
51
66
|
* The promise resolving to the email of the service account used by the Cloud Tasks client.
|
|
@@ -124,6 +139,7 @@ let CloudTasksScheduler = class CloudTasksScheduler {
|
|
|
124
139
|
};
|
|
125
140
|
CloudTasksScheduler = __decorate([
|
|
126
141
|
Injectable(),
|
|
127
|
-
__metadata("design:paramtypes", [CloudTasksClient
|
|
142
|
+
__metadata("design:paramtypes", [CloudTasksClient,
|
|
143
|
+
ConfigService])
|
|
128
144
|
], CloudTasksScheduler);
|
|
129
145
|
export { CloudTasksScheduler };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@causa/runtime-google",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "An extension to the Causa runtime SDK (`@causa/runtime`), providing Google-specific features.",
|
|
5
5
|
"repository": "github:causa-io/runtime-typescript-google",
|
|
6
6
|
"license": "ISC",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@causa/runtime": ">= 0.22.0 < 1.0.0",
|
|
33
33
|
"@google-cloud/precise-date": "^4.0.0",
|
|
34
|
-
"@google-cloud/pubsub": "^4.7.
|
|
34
|
+
"@google-cloud/pubsub": "^4.7.1",
|
|
35
35
|
"@google-cloud/spanner": "^7.14.0",
|
|
36
36
|
"@google-cloud/tasks": "^5.5.0",
|
|
37
|
-
"@grpc/grpc-js": "^1.11.
|
|
37
|
+
"@grpc/grpc-js": "^1.11.2",
|
|
38
38
|
"@nestjs/common": "^10.4.1",
|
|
39
39
|
"@nestjs/config": "^3.2.3",
|
|
40
40
|
"@nestjs/core": "^10.4.1",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"@nestjs/terminus": "^10.2.3",
|
|
44
44
|
"class-transformer": "^0.5.1",
|
|
45
45
|
"class-validator": "^0.14.1",
|
|
46
|
-
"express": "^4.
|
|
47
|
-
"firebase-admin": "^12.
|
|
46
|
+
"express": "^4.21.0",
|
|
47
|
+
"firebase-admin": "^12.5.0",
|
|
48
48
|
"jsonwebtoken": "^9.0.2",
|
|
49
49
|
"nestjs-pino": "^4.1.0",
|
|
50
50
|
"passport-http-bearer": "^1.0.1",
|
|
@@ -54,14 +54,14 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@nestjs/testing": "^10.4.1",
|
|
56
56
|
"@tsconfig/node18": "^18.2.4",
|
|
57
|
-
"@types/jest": "^29.5.
|
|
57
|
+
"@types/jest": "^29.5.13",
|
|
58
58
|
"@types/jsonwebtoken": "^9.0.6",
|
|
59
|
-
"@types/node": "^18.19.
|
|
59
|
+
"@types/node": "^18.19.50",
|
|
60
60
|
"@types/passport-http-bearer": "^1.0.41",
|
|
61
61
|
"@types/supertest": "^6.0.2",
|
|
62
62
|
"@types/uuid": "^10.0.0",
|
|
63
63
|
"dotenv": "^16.4.5",
|
|
64
|
-
"eslint": "^9.
|
|
64
|
+
"eslint": "^9.10.0",
|
|
65
65
|
"eslint-config-prettier": "^9.1.0",
|
|
66
66
|
"eslint-plugin-prettier": "^5.2.1",
|
|
67
67
|
"jest": "^29.7.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"ts-jest": "^29.2.5",
|
|
72
72
|
"ts-node": "^10.9.2",
|
|
73
73
|
"typescript": "^5.5.4",
|
|
74
|
-
"typescript-eslint": "^8.
|
|
74
|
+
"typescript-eslint": "^8.5.0",
|
|
75
75
|
"uuid": "^10.0.0"
|
|
76
76
|
}
|
|
77
77
|
}
|