@zintrust/storage-gcs 0.1.12

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 ADDED
@@ -0,0 +1,19 @@
1
+ # @zintrust/storage-gcs
2
+
3
+ Google Cloud Storage (GCS) storage driver registration for Zintrust.
4
+
5
+ - Docs: https://zintrust.com/storage
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm i @zintrust/storage-gcs
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import '@zintrust/storage-gcs/register';
17
+ ```
18
+
19
+ You will also need `@google-cloud/storage` installed in your app.
@@ -0,0 +1,3 @@
1
+ declare const GcsDriver: any;
2
+ export { GcsDriver };
3
+ export type { GcsConfig } from '@zintrust/core';
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import { GcsDriver as CoreGcsDriver } from '@zintrust/core';
2
+ const GcsDriver = CoreGcsDriver;
3
+ export { GcsDriver };
@@ -0,0 +1,8 @@
1
+ type Registry = {
2
+ register: (driverName: string, entry: {
3
+ driver: unknown;
4
+ normalize?: unknown;
5
+ }) => void;
6
+ };
7
+ export declare function registerGcsStorageDriver(registry: Registry): Promise<void>;
8
+ export {};
@@ -0,0 +1,23 @@
1
+ export async function registerGcsStorageDriver(registry) {
2
+ const core = (await importCore());
3
+ if (core.GcsDriver === undefined)
4
+ return;
5
+ registry.register('gcs', { driver: core.GcsDriver });
6
+ }
7
+ const importCore = async () => {
8
+ try {
9
+ return await import('@zintrust/core');
10
+ }
11
+ catch {
12
+ try {
13
+ return await import('@zintrust/core');
14
+ }
15
+ catch {
16
+ return {};
17
+ }
18
+ }
19
+ };
20
+ const core = (await importCore());
21
+ if (core.StorageDriverRegistry !== undefined) {
22
+ await registerGcsStorageDriver(core.StorageDriverRegistry);
23
+ }
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@zintrust/storage-gcs",
3
+ "version": "0.1.12",
4
+ "private": false,
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./register": {
17
+ "types": "./dist/register.d.ts",
18
+ "default": "./dist/register.js"
19
+ }
20
+ },
21
+ "engines": {
22
+ "node": ">=20.0.0"
23
+ },
24
+ "peerDependencies": {
25
+ "@zintrust/core": "^0.1.12"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "scripts": {
31
+ "build": "tsc -p tsconfig.json",
32
+ "prepublishOnly": "npm run build"
33
+ }
34
+ }