@genoacms/adapter-gcp 0.7.1-fix.5 → 0.7.1-fix.7

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.
@@ -74,7 +74,7 @@ async function deployFunction(functionName, storageSource) {
74
74
  serviceConfig: {
75
75
  minInstanceCount: 0,
76
76
  maxInstanceCount: 1,
77
- ingressSettings: 1,
77
+ ingressSettings: 1, // ALLOW_ALL
78
78
  environmentVariables: {
79
79
  NODE_ENV: 'production'
80
80
  }
@@ -1,5 +1,4 @@
1
1
  import { getBucket } from './storage.js';
2
- import { join } from 'path';
3
2
  const getObject = async ({ bucket, name }) => {
4
3
  const bucketInstance = getBucket(bucket);
5
4
  const file = bucketInstance.file(name);
@@ -35,7 +34,7 @@ const listDirectory = async ({ bucket, name }, listingParams = {}) => {
35
34
  const bucketInstance = getBucket(bucket);
36
35
  const options = {
37
36
  autoPaginate: false,
38
- prefix: name ? join(name, '/') : '',
37
+ prefix: name,
39
38
  maxResults: listingParams?.limit,
40
39
  startOffset: listingParams?.startAfter,
41
40
  delimiter: '/'
@@ -43,7 +42,7 @@ const listDirectory = async ({ bucket, name }, listingParams = {}) => {
43
42
  let [files, , apiResponse] = (await bucketInstance.getFiles(options));
44
43
  files = files.filter((file) => !file.name.endsWith('.folderPlaceholder'));
45
44
  return {
46
- files: files.map((file) => {
45
+ files: files.filter(f => f.name !== name).map((file) => {
47
46
  return {
48
47
  name: file.name,
49
48
  // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
@@ -51,7 +50,7 @@ const listDirectory = async ({ bucket, name }, listingParams = {}) => {
51
50
  lastModified: new Date(file.metadata.updated)
52
51
  };
53
52
  }),
54
- directories: (apiResponse?.prefixes ?? []).filter((item) => item !== name)
53
+ directories: (apiResponse?.prefixes ?? []).filter((item) => item !== name).map(i => i.replace(name, ''))
55
54
  };
56
55
  };
57
56
  const createDirectory = async ({ bucket, name }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genoacms/adapter-gcp",
3
- "version": "0.7.1-fix.5",
3
+ "version": "0.7.1-fix.7",
4
4
  "type": "module",
5
5
  "description": "Implementation of abstraction layer of GenoaCMS for GCP",
6
6
  "repository": {
@@ -4,7 +4,6 @@ import type {
4
4
  } from '@genoacms/cloudabstraction/storage'
5
5
  import { type File } from '@google-cloud/storage'
6
6
  import { getBucket } from './storage.js'
7
- import { join } from 'path'
8
7
 
9
8
  const getObject: Adapter['getObject'] = async ({ bucket, name }) => {
10
9
  const bucketInstance = getBucket(bucket)
@@ -47,7 +46,7 @@ const listDirectory: Adapter['listDirectory'] = async ({ bucket, name }, listing
47
46
  const bucketInstance = getBucket(bucket)
48
47
  const options = {
49
48
  autoPaginate: false,
50
- prefix: name ? join(name, '/') : '',
49
+ prefix: name,
51
50
  maxResults: listingParams?.limit,
52
51
  startOffset: listingParams?.startAfter,
53
52
  delimiter: '/'
@@ -58,7 +57,7 @@ const listDirectory: Adapter['listDirectory'] = async ({ bucket, name }, listing
58
57
  files = files.filter((file) => !file.name.endsWith('.folderPlaceholder'))
59
58
 
60
59
  return {
61
- files: files.map((file) => {
60
+ files: files.filter(f => f.name !== name).map((file) => {
62
61
  return {
63
62
  name: file.name,
64
63
  // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
@@ -66,7 +65,7 @@ const listDirectory: Adapter['listDirectory'] = async ({ bucket, name }, listing
66
65
  lastModified: new Date(file.metadata.updated as string)
67
66
  } satisfies StorageObject
68
67
  }),
69
- directories: (apiResponse?.prefixes ?? []).filter((item) => item !== name)
68
+ directories: (apiResponse?.prefixes ?? []).filter((item) => item !== name).map(i => i.replace(name, ''))
70
69
  }
71
70
  }
72
71