@causa/workspace-google 0.7.0 → 0.7.2
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/README.md
CHANGED
|
@@ -162,3 +162,5 @@ Although infrastructure as code tools usually expose this feature as well (e.g.
|
|
|
162
162
|
### `GooglePubSubWriteTopics`
|
|
163
163
|
|
|
164
164
|
[GooglePubSubWriteTopics](./src/functions/google-pubsub-write-topics.ts) writes a configuration file for each event topic, such that it can be picked up by the Causa Pub/Sub Terraform module. This allows automatic setup of Pub/Sub topics, and optionally of the corresponding BigQuery tables.
|
|
165
|
+
|
|
166
|
+
Documentation of Firebase account + Firebase API key.
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { DockerEmulatorService, EmulatorStart, } from '@causa/workspace-core';
|
|
2
2
|
import { Spanner } from '@google-cloud/spanner';
|
|
3
|
-
|
|
3
|
+
// The Spanner client depends on `google-gax` rather than `@grpc/grpc-js` directly. By ensuring `google-gax` is kept in
|
|
4
|
+
// sync with the version required by Spanner, and importing `grpc` from `google-gax`, the correct `grpc.credentials`
|
|
5
|
+
// version can be loaded.
|
|
6
|
+
import { grpc } from 'google-gax';
|
|
4
7
|
import { getLocalGcpProject, } from '../../configurations/index.js';
|
|
5
8
|
import { SPANNER_EMULATOR_NAME, SPANNER_GRPC_PORT, SPANNER_HTTP_PORT, SPANNER_IMAGE, getSpannerContainerName, } from '../../emulators/index.js';
|
|
6
9
|
import { GoogleSpannerListDatabases } from '../google-spanner/index.js';
|
|
@@ -70,7 +73,7 @@ export class EmulatorStartForSpanner extends EmulatorStart {
|
|
|
70
73
|
servicePath: '127.0.0.1',
|
|
71
74
|
port: SPANNER_GRPC_PORT,
|
|
72
75
|
projectId: getLocalGcpProject(context),
|
|
73
|
-
sslCreds: credentials.createInsecure(),
|
|
76
|
+
sslCreds: grpc.credentials.createInsecure(),
|
|
74
77
|
});
|
|
75
78
|
const { instance, instanceConf } = await this.createInstance(spanner, context);
|
|
76
79
|
const databaseConf = await this.createDatabases(instance, context);
|
|
@@ -113,6 +116,12 @@ export class EmulatorStartForSpanner extends EmulatorStart {
|
|
|
113
116
|
const [db, operation] = await instance.createDatabase(database.id, {
|
|
114
117
|
schema: ddls,
|
|
115
118
|
});
|
|
119
|
+
// While unlikely, the database object might emit errors, e.g "The client has already been closed.".
|
|
120
|
+
// These errors could simply be ignored, as awaiting on the operation should be enough to ensure the database is
|
|
121
|
+
// created. However they are logged as warnings for completeness.
|
|
122
|
+
db.on('error', (error) => {
|
|
123
|
+
context.logger.warn(`⚠️ Uncaught Spanner database error: '${error.message}'.`);
|
|
124
|
+
});
|
|
116
125
|
await operation.promise();
|
|
117
126
|
await db.close();
|
|
118
127
|
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventTopicBrokerDeleteTopic, } from '@causa/workspace-core';
|
|
2
|
-
import {
|
|
2
|
+
import { grpc } from 'google-gax';
|
|
3
3
|
import { PubSubService } from '../../services/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Implements {@link EventTopicBrokerDeleteTopic} for Pub/Sub.
|
|
@@ -12,7 +12,7 @@ export class EventTopicBrokerDeleteTopicForPubSub extends EventTopicBrokerDelete
|
|
|
12
12
|
await context.service(PubSubService).pubSub.topic(this.id).delete();
|
|
13
13
|
}
|
|
14
14
|
catch (error) {
|
|
15
|
-
if (error.code === status.NOT_FOUND) {
|
|
15
|
+
if (error.code === grpc.status.NOT_FOUND) {
|
|
16
16
|
context.logger.warn(`⚠️ Pub/Sub topic to delete '${this.id}' does not exist. It might have already been deleted.`);
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventTopicBrokerDeleteTriggerResource, } from '@causa/workspace-core';
|
|
2
|
-
import {
|
|
2
|
+
import { grpc } from 'google-gax';
|
|
3
3
|
import { PubSubService } from '../../services/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Implements {@link EventTopicBrokerDeleteTriggerResource} for Pub/Sub subscriptions.
|
|
@@ -15,7 +15,7 @@ export class EventTopicBrokerDeleteTriggerResourceForPubSubSubscription extends
|
|
|
15
15
|
.delete();
|
|
16
16
|
}
|
|
17
17
|
catch (error) {
|
|
18
|
-
if (error.code === status.NOT_FOUND) {
|
|
18
|
+
if (error.code === grpc.status.NOT_FOUND) {
|
|
19
19
|
context.logger.warn(`⚠️ Pub/Sub subscription '${this.id}' does not exist. It might have already been deleted.`);
|
|
20
20
|
}
|
|
21
21
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@causa/workspace-google",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "The Causa workspace module providing many functionalities related to GCP and its services.",
|
|
5
5
|
"repository": "github:causa-io/workspace-module-google",
|
|
6
6
|
"license": "ISC",
|
|
@@ -32,43 +32,43 @@
|
|
|
32
32
|
"@causa/cli": ">= 0.4.1 < 1.0.0",
|
|
33
33
|
"@causa/workspace": ">= 0.12.1 < 1.0.0",
|
|
34
34
|
"@causa/workspace-core": ">= 0.19.1 < 1.0.0",
|
|
35
|
-
"@causa/workspace-typescript": ">=
|
|
36
|
-
"@google-cloud/apikeys": "^1.0
|
|
37
|
-
"@google-cloud/bigquery": "^7.
|
|
38
|
-
"@google-cloud/iam-credentials": "^3.0
|
|
39
|
-
"@google-cloud/pubsub": "^4.
|
|
40
|
-
"@google-cloud/resource-manager": "^5.0
|
|
41
|
-
"@google-cloud/run": "^1.0
|
|
42
|
-
"@google-cloud/secret-manager": "^5.0
|
|
43
|
-
"@google-cloud/service-usage": "^3.
|
|
44
|
-
"@google-cloud/spanner": "
|
|
45
|
-
"@google-cloud/storage": "^7.
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"firebase": "^
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"google-
|
|
52
|
-
"googleapis": "^
|
|
53
|
-
"pino": "^8.
|
|
54
|
-
"quicktype-core": "^23.0.
|
|
35
|
+
"@causa/workspace-typescript": ">=0.8.2",
|
|
36
|
+
"@google-cloud/apikeys": "^1.1.0",
|
|
37
|
+
"@google-cloud/bigquery": "^7.4.0",
|
|
38
|
+
"@google-cloud/iam-credentials": "^3.1.0",
|
|
39
|
+
"@google-cloud/pubsub": "^4.3.2",
|
|
40
|
+
"@google-cloud/resource-manager": "^5.1.0",
|
|
41
|
+
"@google-cloud/run": "^1.1.0",
|
|
42
|
+
"@google-cloud/secret-manager": "^5.1.0",
|
|
43
|
+
"@google-cloud/service-usage": "^3.2.0",
|
|
44
|
+
"@google-cloud/spanner": "7.4.0",
|
|
45
|
+
"@google-cloud/storage": "^7.7.0",
|
|
46
|
+
"class-validator": "^0.14.1",
|
|
47
|
+
"firebase": "^10.8.0",
|
|
48
|
+
"firebase-admin": "^12.0.0",
|
|
49
|
+
"globby": "^14.0.1",
|
|
50
|
+
"google-auth-library": "^9.6.3",
|
|
51
|
+
"google-gax": "4.3.1",
|
|
52
|
+
"googleapis": "^133.0.0",
|
|
53
|
+
"pino": "^8.19.0",
|
|
54
|
+
"quicktype-core": "^23.0.104",
|
|
55
55
|
"uuid": "^9.0.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@tsconfig/node18": "^18.2.2",
|
|
59
|
-
"@types/jest": "^29.5.
|
|
60
|
-
"@types/node": "^18.18
|
|
61
|
-
"@types/uuid": "^9.0.
|
|
62
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
59
|
+
"@types/jest": "^29.5.12",
|
|
60
|
+
"@types/node": "^18.19.18",
|
|
61
|
+
"@types/uuid": "^9.0.8",
|
|
62
|
+
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
|
63
63
|
"copyfiles": "^2.4.1",
|
|
64
|
-
"eslint": "^8.
|
|
65
|
-
"eslint-config-prettier": "^9.
|
|
66
|
-
"eslint-plugin-prettier": "^5.
|
|
64
|
+
"eslint": "^8.57.0",
|
|
65
|
+
"eslint-config-prettier": "^9.1.0",
|
|
66
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
67
67
|
"jest": "^29.7.0",
|
|
68
68
|
"jest-extended": "^4.0.2",
|
|
69
69
|
"rimraf": "^5.0.5",
|
|
70
|
-
"ts-jest": "^29.1.
|
|
71
|
-
"ts-node": "^10.9.
|
|
72
|
-
"typescript": "^5.
|
|
70
|
+
"ts-jest": "^29.1.2",
|
|
71
|
+
"ts-node": "^10.9.2",
|
|
72
|
+
"typescript": "^5.3.3"
|
|
73
73
|
}
|
|
74
74
|
}
|