@causa/workspace-google 0.10.1 → 0.11.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/README.md CHANGED
@@ -41,7 +41,7 @@ This makes the `google.firebase` configuration safe to commit in your repository
41
41
  The following Causa `project.type`s are supported:
42
42
 
43
43
  - `serviceContainer`, with `google.cloudRun` as the `serviceContainer.platform`. This will ensure the built Docker images are pushed to the repository set in `google.cloudRun.dockerRepository`.
44
- - `serverlessFunctions`, with `google.cloudFunctions` as the `serverlessFunctions.platform`. This will push functions archives to the Cloud Storage bucket set in `google.cloudFunctions.archivesStorageLocation`.
44
+ - `serverlessFunctions`, with `google.cloudFunctions` as the `serverlessFunctions.platform`. This will push functions archives to the Cloud Storage bucket set in `google.cloudFunctions.artefactStorage`.
45
45
 
46
46
  ### Emulators
47
47
 
@@ -244,9 +244,18 @@ export type GoogleConfiguration = {
244
244
  */
245
245
  readonly cloudFunctions?: {
246
246
  /**
247
- * The Cloud Storage URI where Cloud Functions archives should be uploaded.
247
+ * The Cloud Storage configuration where Cloud Functions archives should be uploaded.
248
248
  */
249
- readonly archivesStorageLocation?: string;
249
+ readonly artefactStorage?: {
250
+ /**
251
+ * The name of the Cloud Storage bucket.
252
+ */
253
+ readonly bucket?: string;
254
+ /**
255
+ * An optional prefix within the Cloud Storage bucket.
256
+ */
257
+ readonly prefix?: string;
258
+ };
250
259
  };
251
260
  /**
252
261
  * Configuration for Cloud Run containers.
@@ -3,7 +3,7 @@ import { ProjectGetArtefactDestination } from '@causa/workspace-core';
3
3
  /**
4
4
  * Implements the {@link ProjectGetArtefactDestination} function for Cloud Functions projects.
5
5
  * Cloud Functions archives are stored in a Google Cloud Storage bucket, the destination of which must be
6
- * defined in the `google.cloudFunctions.archivesStorageLocation` configuration.
6
+ * defined in the `google.cloudFunctions.artefactStorage` configuration.
7
7
  */
8
8
  export declare class ProjectGetArtefactDestinationForCloudFunctions extends ProjectGetArtefactDestination {
9
9
  _call(context: WorkspaceContext): Promise<string>;
@@ -3,15 +3,18 @@ import { ProjectGetArtefactDestination, } from '@causa/workspace-core';
3
3
  /**
4
4
  * Implements the {@link ProjectGetArtefactDestination} function for Cloud Functions projects.
5
5
  * Cloud Functions archives are stored in a Google Cloud Storage bucket, the destination of which must be
6
- * defined in the `google.cloudFunctions.archivesStorageLocation` configuration.
6
+ * defined in the `google.cloudFunctions.artefactStorage` configuration.
7
7
  */
8
8
  export class ProjectGetArtefactDestinationForCloudFunctions extends ProjectGetArtefactDestination {
9
9
  async _call(context) {
10
10
  const projectName = context.getOrThrow('project.name');
11
- const archivesStorageLocation = context
12
- .asConfiguration()
13
- .getOrThrow('google.cloudFunctions.archivesStorageLocation');
14
- return `${archivesStorageLocation}/${projectName}/${this.tag}.zip`;
11
+ const googleConf = context.asConfiguration();
12
+ let bucketAndPrefix = googleConf.getOrThrow('google.cloudFunctions.artefactStorage.bucket');
13
+ const archivesStoragePrefix = googleConf.get('google.cloudFunctions.artefactStorage.prefix');
14
+ if (archivesStoragePrefix) {
15
+ bucketAndPrefix += `/${archivesStoragePrefix}`;
16
+ }
17
+ return `gs://${bucketAndPrefix}/${projectName}/${this.tag}.zip`;
15
18
  }
16
19
  _supports(context) {
17
20
  const conf = context.asConfiguration();
@@ -4,7 +4,7 @@ import { IAMCredentialsClient } from '@google-cloud/iam-credentials';
4
4
  import { initializeApp as initializeAdminApp, } from 'firebase-admin/app';
5
5
  import { initializeApp } from 'firebase/app';
6
6
  import { firebase_v1beta1 } from 'googleapis';
7
- import * as uuid from 'uuid';
7
+ import { randomUUID } from 'node:crypto';
8
8
  import { FirebaseAdminServiceAccountNotFoundError, FirebaseApiKeyNotFoundError, NoFirebaseAppFoundError, } from './firebase-app.errors.js';
9
9
  import { GoogleApisService } from './google-apis.js';
10
10
  /**
@@ -79,7 +79,7 @@ export class FirebaseAppService {
79
79
  const keysClient = new ApiKeysClient();
80
80
  const parent = `projects/${this.projectId}/locations/global`;
81
81
  let name;
82
- for await (const key of keysClient.listKeysAsync({ parent })) {
82
+ for await (const key of keysClient.listKeysAsync({ parent }, { autoPaginate: false })) {
83
83
  if (key.displayName?.includes(FIREBASE_AUTOMATIC_KEY_INFO) && key.name) {
84
84
  name = key.name;
85
85
  break;
@@ -127,7 +127,7 @@ export class FirebaseAppService {
127
127
  if (this.app) {
128
128
  return this.app;
129
129
  }
130
- const name = uuid.v4();
130
+ const name = randomUUID();
131
131
  this.app = initializeApp({ projectId: this.projectId, apiKey, authDomain: this.authDomain }, name);
132
132
  return this.app;
133
133
  }
@@ -203,7 +203,7 @@ export class FirebaseAppService {
203
203
  if (this.adminAppForAdminServiceAccount) {
204
204
  return this.adminAppForAdminServiceAccount;
205
205
  }
206
- const name = uuid.v4();
206
+ const name = randomUUID();
207
207
  this.adminAppForAdminServiceAccount = initializeAdminApp({
208
208
  projectId: this.projectId,
209
209
  serviceAccountId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@causa/workspace-google",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
4
  "description": "The Causa workspace module providing many functionalities related to GCP and its services.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,31 +32,30 @@
32
32
  "test:cov": "npm run test -- --coverage"
33
33
  },
34
34
  "dependencies": {
35
- "@causa/cli": ">= 0.6.2 < 1.0.0",
36
- "@causa/workspace": ">= 0.18.0 < 1.0.0",
37
- "@causa/workspace-core": ">= 0.24.0 < 1.0.0",
38
- "@causa/workspace-typescript": ">= 0.11.0 < 1.0.0",
39
- "@google-cloud/apikeys": "^2.2.0",
35
+ "@causa/cli": ">= 0.6.3 < 1.0.0",
36
+ "@causa/workspace": ">= 0.18.1 < 1.0.0",
37
+ "@causa/workspace-core": ">= 0.24.1 < 1.0.0",
38
+ "@causa/workspace-typescript": ">= 0.14.0 < 1.0.0",
39
+ "@google-cloud/apikeys": "^2.2.1",
40
40
  "@google-cloud/bigquery": "^8.1.1",
41
- "@google-cloud/iam-credentials": "^4.2.0",
41
+ "@google-cloud/iam-credentials": "^4.2.1",
42
42
  "@google-cloud/pubsub": "^5.2.0",
43
- "@google-cloud/resource-manager": "^6.2.0",
44
- "@google-cloud/run": "^3.0.0",
45
- "@google-cloud/secret-manager": "^6.1.0",
46
- "@google-cloud/service-usage": "^4.2.0",
47
- "@google-cloud/spanner": "8.2.0",
48
- "@google-cloud/storage": "^7.17.0",
43
+ "@google-cloud/resource-manager": "^6.2.1",
44
+ "@google-cloud/run": "^3.0.1",
45
+ "@google-cloud/secret-manager": "^6.1.1",
46
+ "@google-cloud/service-usage": "^4.2.1",
47
+ "@google-cloud/spanner": "8.2.2",
48
+ "@google-cloud/storage": "^7.17.2",
49
49
  "class-validator": "^0.14.2",
50
- "firebase": "^12.1.0",
51
- "firebase-admin": "^13.4.0",
52
- "globby": "^14.1.0",
53
- "google-auth-library": "^10.3.0",
54
- "google-gax": "5.0.1",
55
- "googleapis": "^158.0.0",
50
+ "firebase": "^12.4.0",
51
+ "firebase-admin": "^13.5.0",
52
+ "globby": "^15.0.0",
53
+ "google-auth-library": "^10.4.1",
54
+ "google-gax": "5.0.3",
55
+ "googleapis": "^164.0.0",
56
56
  "micromatch": "^4.0.8",
57
- "pino": "^9.9.0",
58
- "quicktype-core": "^23.2.6",
59
- "uuid": "^11.1.0"
57
+ "pino": "^10.1.0",
58
+ "quicktype-core": "^23.2.6"
60
59
  },
61
60
  "devDependencies": {
62
61
  "@swc/core": "^1.13.5",
@@ -64,17 +63,16 @@
64
63
  "@tsconfig/node20": "^20.1.6",
65
64
  "@types/jest": "^30.0.0",
66
65
  "@types/micromatch": "^4.0.9",
67
- "@types/node": "^22.18.0",
68
- "@types/uuid": "^10.0.0",
66
+ "@types/node": "^22.18.11",
69
67
  "copyfiles": "^2.4.1",
70
- "eslint": "^9.34.0",
68
+ "eslint": "^9.38.0",
71
69
  "eslint-config-prettier": "^10.1.8",
72
70
  "eslint-plugin-prettier": "^5.5.4",
73
- "jest": "^30.1.0",
71
+ "jest": "^30.2.0",
74
72
  "jest-extended": "^6.0.0",
75
73
  "rimraf": "^6.0.1",
76
74
  "ts-node": "^10.9.2",
77
- "typescript": "^5.9.2",
78
- "typescript-eslint": "^8.41.0"
75
+ "typescript": "^5.9.3",
76
+ "typescript-eslint": "^8.46.1"
79
77
  }
80
78
  }