@webda/gcp 4.0.0-beta.1 → 4.0.0-beta.3
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 +54 -4
- package/lib/index.d.ts +5 -4
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/services/firestore.service.d.ts +236 -0
- package/lib/services/firestore.service.d.ts.map +1 -0
- package/lib/services/firestore.service.js +692 -0
- package/lib/services/firestore.service.js.map +1 -0
- package/lib/services/index.d.ts +2 -1
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +1 -1
- package/lib/services/index.js.map +1 -1
- package/lib/services/{kms.d.ts → kms.service.d.ts} +14 -14
- package/lib/services/kms.service.d.ts.map +1 -0
- package/lib/services/{kms.js → kms.service.js} +18 -16
- package/lib/services/kms.service.js.map +1 -0
- package/lib/services/{pubsub.d.ts → pubsub.service.d.ts} +23 -3
- package/lib/services/pubsub.service.d.ts.map +1 -0
- package/lib/services/{pubsub.js → pubsub.service.js} +36 -10
- package/lib/services/pubsub.service.js.map +1 -0
- package/lib/services/{queue.d.ts → queue.service.d.ts} +32 -14
- package/lib/services/queue.service.d.ts.map +1 -0
- package/lib/services/{queue.js → queue.service.js} +65 -38
- package/lib/services/queue.service.js.map +1 -0
- package/lib/services/storage.service.d.ts +268 -0
- package/lib/services/storage.service.d.ts.map +1 -0
- package/lib/services/{storage.js → storage.service.js} +125 -78
- package/lib/services/storage.service.js.map +1 -0
- package/package.json +34 -40
- package/webda.module.json +1120 -1462
- package/lib/index.spec.d.ts +0 -4
- package/lib/index.spec.js +0 -7
- package/lib/index.spec.js.map +0 -1
- package/lib/services/firestore.d.ts +0 -134
- package/lib/services/firestore.js +0 -424
- package/lib/services/firestore.js.map +0 -1
- package/lib/services/firestore.spec.d.ts +0 -1
- package/lib/services/firestore.spec.js +0 -194
- package/lib/services/firestore.spec.js.map +0 -1
- package/lib/services/kms.js.map +0 -1
- package/lib/services/kms.spec.d.ts +0 -1
- package/lib/services/kms.spec.js +0 -53
- package/lib/services/kms.spec.js.map +0 -1
- package/lib/services/pubsub.js.map +0 -1
- package/lib/services/pubsub.spec.d.ts +0 -1
- package/lib/services/pubsub.spec.js +0 -95
- package/lib/services/pubsub.spec.js.map +0 -1
- package/lib/services/queue.js.map +0 -1
- package/lib/services/queue.spec.d.ts +0 -1
- package/lib/services/queue.spec.js +0 -104
- package/lib/services/queue.spec.js.map +0 -1
- package/lib/services/storage.d.ts +0 -214
- package/lib/services/storage.js.map +0 -1
- package/lib/services/storage.spec.d.ts +0 -1
- package/lib/services/storage.spec.js +0 -220
- package/lib/services/storage.spec.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.service.js","sourceRoot":"","sources":["../../src/services/queue.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAkB,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE5D;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,eAAe;IAyBrD;;;;OAIG;IACH,IAAI,CAAC,MAAM,GAAQ,EAAE;QACnB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,IAAI,CAAC,IAAI,KAAT,IAAI,CAAC,IAAI,GAAK,UAAU,EAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,QAAqE,SAAQ,KAAW;IAA7G;;QAgBE;;WAEG;QACH,aAAQ,GAA+B,EAAE,CAAC;IAoK5C,CAAC;IAlKC;;;OAGG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,EAA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C,UAAU,CAAC,YAAY,EAAE;YAC3E,WAAW,EAAE;gBACX,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE;aACpC;SACF,CAAC,EAAC;QACH,MAAM,UAAU,GAAG,KAAK,EAAE,OAAgB,EAAE,EAAE;YAC5C,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG,EAAE,CAAC;YACrC,IAAI,CAAC;gBACH,MAAM,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC;gBAC1E,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC;YAClC,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;gBAC1B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,OAAO,CAAC,KAAK,EAAE,EAAE,GAAG,CAAC,CAAC;YACrD,CAAC;QACH,CAAC,CAAC;QACF,OAAO,IAAI,iBAAiB,CAC1B,KAAK,IAAI,EAAE;YACT,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC9C,CAAC,EACD,KAAK,IAAI,EAAE;YACT,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC3D,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { Bucket, StorageOptions } from "@google-cloud/storage";
|
|
2
|
+
import { BinaryFile, BinaryFileInfo, BinaryMap, CloudBinary, CloudBinaryParameters, CoreModel, OperationContext } from "@webda/core";
|
|
3
|
+
import { StorageFinder } from "@webda/utils";
|
|
4
|
+
import { Readable, Writable } from "node:stream";
|
|
5
|
+
export type StorageObject = {
|
|
6
|
+
key: string;
|
|
7
|
+
/**
|
|
8
|
+
* bucket is an option,
|
|
9
|
+
* if not provided: it will get the DEFAULT_BUCKET set from environment variable
|
|
10
|
+
*/
|
|
11
|
+
bucket?: string;
|
|
12
|
+
};
|
|
13
|
+
export type DownloadParams = StorageObject & {
|
|
14
|
+
localPath: string;
|
|
15
|
+
};
|
|
16
|
+
export type PutObjectParams = StorageObject & {
|
|
17
|
+
localPath?: string;
|
|
18
|
+
content?: string | Buffer;
|
|
19
|
+
};
|
|
20
|
+
export type SignedUrlParams = StorageObject & {
|
|
21
|
+
expires?: number;
|
|
22
|
+
action: "read" | "write" | "delete";
|
|
23
|
+
contentMd5?: string;
|
|
24
|
+
contentType?: string;
|
|
25
|
+
extensionHeaders?: {
|
|
26
|
+
[key: string]: string;
|
|
27
|
+
};
|
|
28
|
+
responseDisposition?: string;
|
|
29
|
+
queryParams?: {
|
|
30
|
+
[key: string]: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type StorageObjectMeta = {
|
|
34
|
+
size: number;
|
|
35
|
+
contentType: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Configuration for {@link Storage}
|
|
39
|
+
*/
|
|
40
|
+
export declare class StorageParameters extends CloudBinaryParameters {
|
|
41
|
+
/**
|
|
42
|
+
* Bucket to store binaries in
|
|
43
|
+
*/
|
|
44
|
+
bucket: string;
|
|
45
|
+
/**
|
|
46
|
+
* Specify endpoint for GCS
|
|
47
|
+
*/
|
|
48
|
+
endpoint?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Google Storage Finder implementation
|
|
52
|
+
*/
|
|
53
|
+
export declare class GCSFinder implements StorageFinder {
|
|
54
|
+
private _storage;
|
|
55
|
+
/**
|
|
56
|
+
* @param options - GCS client options
|
|
57
|
+
*/
|
|
58
|
+
constructor(options?: StorageOptions);
|
|
59
|
+
/**
|
|
60
|
+
* Get info from url
|
|
61
|
+
* @param path - the gs:// url
|
|
62
|
+
* @returns the bucket and key
|
|
63
|
+
*/
|
|
64
|
+
getInfo(path: string): {
|
|
65
|
+
bucket: string;
|
|
66
|
+
key: string;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Depth or options is ignored
|
|
70
|
+
* @override
|
|
71
|
+
* @param path - the gs:// url to walk
|
|
72
|
+
* @param processor - called for each file found
|
|
73
|
+
* @param _options - ignored
|
|
74
|
+
* @param _depth - ignored
|
|
75
|
+
*/
|
|
76
|
+
walk(path: string, processor: (filepath: string) => void, _options?: {
|
|
77
|
+
followSymlinks?: boolean;
|
|
78
|
+
resolveSymlink?: boolean;
|
|
79
|
+
includeDir?: boolean;
|
|
80
|
+
maxDepth?: number;
|
|
81
|
+
}, _depth?: number): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Find files under a gs:// url
|
|
84
|
+
* @param currentPath - the gs:// url to search
|
|
85
|
+
* @param options - only `filterPattern` and `processor` are used
|
|
86
|
+
* @returns the files found
|
|
87
|
+
*/
|
|
88
|
+
find(currentPath: string, options?: {
|
|
89
|
+
includeDir?: boolean;
|
|
90
|
+
maxDepth?: number;
|
|
91
|
+
} & {
|
|
92
|
+
filterPattern?: RegExp;
|
|
93
|
+
processor?: (filepath: string) => void;
|
|
94
|
+
}): Promise<string[]>;
|
|
95
|
+
/**
|
|
96
|
+
* Get a write stream
|
|
97
|
+
* @param path - the gs:// url
|
|
98
|
+
* @returns the write stream
|
|
99
|
+
*/
|
|
100
|
+
getWriteStream(path: string): Promise<Writable>;
|
|
101
|
+
/**
|
|
102
|
+
* Get a read stream
|
|
103
|
+
* @param path - the gs:// url
|
|
104
|
+
* @returns the read stream
|
|
105
|
+
*/
|
|
106
|
+
getReadStream(path: string): Promise<Readable>;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Storage handles the storage of binary on a Google Cloud Storage bucket
|
|
110
|
+
*
|
|
111
|
+
* See Binary the general interface
|
|
112
|
+
* @WebdaModda GoogleCloudStorage
|
|
113
|
+
*/
|
|
114
|
+
export default class Storage<T extends StorageParameters = StorageParameters> extends CloudBinary<T> {
|
|
115
|
+
private _storage?;
|
|
116
|
+
/**
|
|
117
|
+
* GCS client, created on first use
|
|
118
|
+
* @returns the GCS client
|
|
119
|
+
*/
|
|
120
|
+
private get storage();
|
|
121
|
+
/**
|
|
122
|
+
* @override
|
|
123
|
+
* @param info - the binary map
|
|
124
|
+
* @returns the content stream
|
|
125
|
+
*/
|
|
126
|
+
_get(info: BinaryMap): Promise<Readable>;
|
|
127
|
+
/**
|
|
128
|
+
* @override
|
|
129
|
+
* @param map - the binary map
|
|
130
|
+
* @param expires - expiration in seconds
|
|
131
|
+
* @param _context - the operation context
|
|
132
|
+
* @returns the signed url
|
|
133
|
+
*/
|
|
134
|
+
getSignedUrlFromMap(map: BinaryMap, expires: number, _context: OperationContext): Promise<string>;
|
|
135
|
+
/**
|
|
136
|
+
* Get object content as a stream
|
|
137
|
+
* @param params - the object to read
|
|
138
|
+
* @param params.bucket - the bucket, default to the one predefined
|
|
139
|
+
* @param params.key - the object key
|
|
140
|
+
* @returns the content stream
|
|
141
|
+
*/
|
|
142
|
+
getContent({ bucket, key }: StorageObject): Promise<Readable>;
|
|
143
|
+
/**
|
|
144
|
+
* Upload a local file to GCS bucket destination
|
|
145
|
+
*
|
|
146
|
+
* @param key - key to add to
|
|
147
|
+
* @param body - content of the object, a string is a local file path
|
|
148
|
+
* @param metadata - to put along the object
|
|
149
|
+
* @param bucket - to use
|
|
150
|
+
*/
|
|
151
|
+
putObject(key: string, body: Readable | Buffer | string, metadata?: {}, bucket?: string): Promise<void>;
|
|
152
|
+
/**
|
|
153
|
+
* Return the Google Bucket directly
|
|
154
|
+
*
|
|
155
|
+
* @param bucket - name of the bucket default to the one predefined
|
|
156
|
+
* @returns the bucket
|
|
157
|
+
*/
|
|
158
|
+
getStorageBucket(bucket?: string): Bucket;
|
|
159
|
+
/**
|
|
160
|
+
* @inheritdoc
|
|
161
|
+
* @param hash - the binary hash
|
|
162
|
+
* @param uuid - the object uuid
|
|
163
|
+
* @param property - the object property
|
|
164
|
+
*/
|
|
165
|
+
_cleanUsage(hash: string, uuid: string, property?: string): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* @inheritdoc
|
|
168
|
+
* @param hash - the binary hash
|
|
169
|
+
* @returns the number of objects using the binary
|
|
170
|
+
*/
|
|
171
|
+
getUsageCount(hash: string): Promise<number>;
|
|
172
|
+
/**
|
|
173
|
+
* @inheritdoc
|
|
174
|
+
* @param object - the object to attach the binary to
|
|
175
|
+
* @param property - the object property
|
|
176
|
+
* @param file - the binary to store
|
|
177
|
+
*/
|
|
178
|
+
store(object: CoreModel, property: string, file: BinaryFile): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Delete a file inside an existing bucket
|
|
181
|
+
* @param params - the object to delete
|
|
182
|
+
* @param params.bucket - the bucket, default to the one predefined
|
|
183
|
+
* @param params.key - the object key
|
|
184
|
+
*/
|
|
185
|
+
deleteObject({ bucket, key }: StorageObject): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Move a file from one bucket to an other
|
|
188
|
+
* @param source - the object to move
|
|
189
|
+
* @param destination - the new location
|
|
190
|
+
*/
|
|
191
|
+
moveObject(source: StorageObject, destination: StorageObject): Promise<void>;
|
|
192
|
+
/**
|
|
193
|
+
* Get a signed url for the client to upload the binary directly to GCS
|
|
194
|
+
* @param object - the object to attach the binary to
|
|
195
|
+
* @param property - the object property
|
|
196
|
+
* @param info - the binary information (hash, challenge), read from the context if not provided
|
|
197
|
+
* @param context - the operation context
|
|
198
|
+
* @returns the upload url, undefined if the binary is already uploaded
|
|
199
|
+
*/
|
|
200
|
+
putRedirectUrl(object: CoreModel, property: string, info?: BinaryFileInfo & {
|
|
201
|
+
hash: string;
|
|
202
|
+
challenge: string;
|
|
203
|
+
}, context?: OperationContext<any>): Promise<{
|
|
204
|
+
url: string;
|
|
205
|
+
method: string;
|
|
206
|
+
headers: {
|
|
207
|
+
[key: string]: string;
|
|
208
|
+
};
|
|
209
|
+
}>;
|
|
210
|
+
/**
|
|
211
|
+
* Retrieve one signed URL to download the file in parameter
|
|
212
|
+
* @param params.bucket - the bucket, default to the one predefined
|
|
213
|
+
* @param params.key - the object key
|
|
214
|
+
* @param params.expires - expiration in seconds
|
|
215
|
+
* @param params.action - the action allowed by the url
|
|
216
|
+
* @param params - the object and signature options
|
|
217
|
+
* @returns URL in order to download the file
|
|
218
|
+
*/
|
|
219
|
+
getSignedUrl({ bucket, key, expires, action, ...params }: SignedUrlParams): Promise<string>;
|
|
220
|
+
/**
|
|
221
|
+
* Retrieve mandatory headers if needed by the cloud provider (ie. Azure)
|
|
222
|
+
* Returns empty object if no headers are mandatory
|
|
223
|
+
* @returns mandatory headers
|
|
224
|
+
*/
|
|
225
|
+
getSignedUrlHeaders(): {
|
|
226
|
+
[key: string]: string;
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Retrieve public URL of this object
|
|
230
|
+
* @param params - the object
|
|
231
|
+
* @param params.bucket - the bucket, default to the one predefined
|
|
232
|
+
* @param params.key - the object key
|
|
233
|
+
* @returns Public URL in order to download the file
|
|
234
|
+
*/
|
|
235
|
+
getPublicUrl({ bucket, key }: StorageObject): Promise<string>;
|
|
236
|
+
/**
|
|
237
|
+
* Fetch an object's metadata
|
|
238
|
+
* @param params - the object
|
|
239
|
+
* @param params.bucket - the bucket, default to the one predefined
|
|
240
|
+
* @param params.key - the object key
|
|
241
|
+
* @returns size and content type
|
|
242
|
+
*/
|
|
243
|
+
getMeta({ bucket, key }: StorageObject): Promise<StorageObjectMeta>;
|
|
244
|
+
/**
|
|
245
|
+
* Get a bucket size with a prefix
|
|
246
|
+
* @param bucket - the bucket, default to the one predefined
|
|
247
|
+
* @param prefix - on the bucket
|
|
248
|
+
* @param regex - to filter files
|
|
249
|
+
* @returns the total size and count of files
|
|
250
|
+
*/
|
|
251
|
+
getBucketSize(bucket?: string, prefix?: string, regex?: RegExp): Promise<{
|
|
252
|
+
size: number;
|
|
253
|
+
count: number;
|
|
254
|
+
}>;
|
|
255
|
+
/**
|
|
256
|
+
* Add a usage marker for a binary
|
|
257
|
+
* @param hash - the binary hash
|
|
258
|
+
* @param uuid - the marker name: `${property}_${uuid}`
|
|
259
|
+
* @param model - the model identifier of the object
|
|
260
|
+
*/
|
|
261
|
+
putMarker(hash: string, uuid: string, model: string): Promise<void>;
|
|
262
|
+
/**
|
|
263
|
+
* Delete every object under the prefix, used by tests
|
|
264
|
+
*/
|
|
265
|
+
__clean(): Promise<void>;
|
|
266
|
+
}
|
|
267
|
+
export { Storage };
|
|
268
|
+
//# sourceMappingURL=storage.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.service.d.ts","sourceRoot":"","sources":["../../src/services/storage.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA4C,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzG,OAAO,EACL,UAAU,EACV,cAAc,EACd,SAAS,EACT,WAAW,EACX,qBAAqB,EACrB,SAAS,EACT,gBAAgB,EAEjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAa,MAAM,cAAc,CAAC;AAGxD,OAAO,EAAE,QAAQ,EAAU,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGzD,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG;IAC3C,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM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