@genoacms/adapter-gcp 0.7.1-fix.2 → 0.7.1-fix.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
1
  import config from '../../config.js';
2
2
  import { ProjectsClient } from '@google-cloud/resource-manager';
3
- const authorizationConfig = config.authorization.providers.find((provider) => provider.name === 'gcp');
3
+ const PROVIDER_NAME = '@genoacms/adapter-gcp/authorization';
4
+ const authorizationConfig = config.authorization.providers.find((provider) => provider.name === PROVIDER_NAME);
4
5
  if (!authorizationConfig)
5
6
  throw new Error('authorization-provider-not-found');
6
7
  const projectId = authorizationConfig.projectId;
@@ -1,6 +1,7 @@
1
1
  import config from '../../config.js';
2
2
  import { Firestore } from '@google-cloud/firestore';
3
- const firestoreConfig = config.database.providers.find((provider) => provider.name === 'firestore');
3
+ const PROVIDER_NAME = '@genoacms/adapter-gcp/database';
4
+ const firestoreConfig = config.database.providers.find((provider) => provider.name === PROVIDER_NAME);
4
5
  if (!firestoreConfig)
5
6
  throw new Error('firestore-provider-not-found');
6
7
  const firestore = new Firestore({
@@ -5,7 +5,7 @@ const storageConfig = config.storage.providers.find((provider) => provider.name
5
5
  if (!storageConfig)
6
6
  throw new Error('storage-provider-not-found');
7
7
  const storage = new Storage({
8
- credentials: config.storage.credentials
8
+ credentials: storageConfig.credentials
9
9
  });
10
10
  const hasBucket = (name) => {
11
11
  const has = config.storage.buckets.find((bucket) => bucket.name === name && bucket.providerName === PROVIDER_NAME);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genoacms/adapter-gcp",
3
- "version": "0.7.1-fix.2",
3
+ "version": "0.7.1-fix.3",
4
4
  "type": "module",
5
5
  "description": "Implementation of abstraction layer of GenoaCMS for GCP",
6
6
  "repository": {
@@ -2,7 +2,8 @@ import type { Adapter, AuthorizationProvider } from '@genoacms/cloudabstraction/
2
2
  import config from '../../config.js'
3
3
  import { ProjectsClient } from '@google-cloud/resource-manager'
4
4
 
5
- const authorizationConfig = config.authorization.providers.find((provider: AuthorizationProvider) => provider.name === 'gcp')
5
+ const PROVIDER_NAME = '@genoacms/adapter-gcp/authorization'
6
+ const authorizationConfig = config.authorization.providers.find((provider: AuthorizationProvider) => provider.name === PROVIDER_NAME)
6
7
  if (!authorizationConfig) throw new Error('authorization-provider-not-found')
7
8
  const projectId = authorizationConfig.projectId
8
9
  const resourceManager = new ProjectsClient({
@@ -10,7 +10,8 @@ import type {
10
10
  import config from '../../config.js'
11
11
  import { Firestore } from '@google-cloud/firestore'
12
12
 
13
- const firestoreConfig = config.database.providers.find((provider: DatabaseProvider) => provider.name === 'firestore')
13
+ const PROVIDER_NAME = '@genoacms/adapter-gcp/database'
14
+ const firestoreConfig = config.database.providers.find((provider: DatabaseProvider) => provider.name === PROVIDER_NAME)
14
15
  if (!firestoreConfig) throw new Error('firestore-provider-not-found')
15
16
  const firestore = new Firestore({
16
17
  credentials: firestoreConfig.credentials,
@@ -6,7 +6,7 @@ const PROVIDER_NAME = '@genoacms/adapter-gcp/storage'
6
6
  const storageConfig = config.storage.providers.find((provider: StorageProvider) => provider.name === PROVIDER_NAME)
7
7
  if (!storageConfig) throw new Error('storage-provider-not-found')
8
8
  const storage = new Storage({
9
- credentials: config.storage.credentials
9
+ credentials: storageConfig.credentials
10
10
  })
11
11
 
12
12
  const hasBucket = (name: string): boolean => {