@storyshelf/storage-gcs 0.7.0 → 0.8.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/dist/client.mjs +1 -2
- package/dist/errors.mjs +1 -2
- package/dist/index.d.mts +0 -2
- package/dist/index.mjs +2 -3
- package/dist/keys.d.mts +0 -2
- package/dist/keys.mjs +1 -2
- package/dist/lifecycle.mjs +1 -2
- package/dist/operations.mjs +1 -2
- package/dist/streams.mjs +1 -2
- package/dist/types.d.mts +0 -2
- package/package.json +3 -3
package/dist/client.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import "node:path";
|
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { Storage } from "@google-cloud/storage";
|
|
5
|
-
|
|
5
|
+
// src/client.ts
|
|
6
6
|
/** GCS Storage client construction and shared operation context. */
|
|
7
7
|
/** Build the bucket handle plus key prefix every GCS operation threads through. */
|
|
8
8
|
function createGcsContext(options) {
|
|
@@ -21,7 +21,6 @@ function resolveClientOptions(options) {
|
|
|
21
21
|
if (options.apiEndpoint !== void 0) config.apiEndpoint = options.apiEndpoint;
|
|
22
22
|
return config;
|
|
23
23
|
}
|
|
24
|
-
//#endregion
|
|
25
24
|
export { createGcsContext, resolveClientOptions };
|
|
26
25
|
|
|
27
26
|
//# sourceMappingURL=client.mjs.map
|
package/dist/errors.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
-
|
|
4
|
+
// src/errors.ts
|
|
5
5
|
/** Not-found guard for GCS API errors. */
|
|
6
6
|
/** Return whether a GCS error signals a missing object. */
|
|
7
7
|
function isNotFound(error) {
|
|
@@ -10,7 +10,6 @@ function isNotFound(error) {
|
|
|
10
10
|
if (err.statusCode === 404) return true;
|
|
11
11
|
return err.errors?.[0]?.reason === "notFound";
|
|
12
12
|
}
|
|
13
|
-
//#endregion
|
|
14
13
|
export { isNotFound };
|
|
15
14
|
|
|
16
15
|
//# sourceMappingURL=errors.mjs.map
|
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,6 @@ import __tsdown_shims_url from 'node:url';
|
|
|
3
3
|
import { GcsStorageOptions } from "./types.mjs";
|
|
4
4
|
import { gcsKey } from "./keys.mjs";
|
|
5
5
|
import { StorageAdapter } from "@storyshelf/core/adapter/storage";
|
|
6
|
-
//#region src/index.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* Create a Google Cloud Storage (GCS) StorageAdapter.
|
|
9
8
|
*
|
|
@@ -11,6 +10,5 @@ import { StorageAdapter } from "@storyshelf/core/adapter/storage";
|
|
|
11
10
|
* @returns A StorageAdapter backed by the configured GCS bucket.
|
|
12
11
|
*/
|
|
13
12
|
declare function createGcsStorage(options: GcsStorageOptions): StorageAdapter;
|
|
14
|
-
//#endregion
|
|
15
13
|
export { type GcsStorageOptions, createGcsStorage, gcsKey };
|
|
16
14
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { createGcsLifecycle } from "./lifecycle.mjs";
|
|
|
6
6
|
import { gcsKey } from "./keys.mjs";
|
|
7
7
|
import { gcsDelete, gcsExists, gcsList, gcsRead, gcsWrite } from "./operations.mjs";
|
|
8
8
|
import { gcsReadStream, gcsWriteStream } from "./streams.mjs";
|
|
9
|
-
|
|
9
|
+
// src/index.ts
|
|
10
10
|
/**
|
|
11
11
|
* Create a Google Cloud Storage (GCS) StorageAdapter.
|
|
12
12
|
*
|
|
@@ -18,7 +18,7 @@ function createGcsStorage(options) {
|
|
|
18
18
|
return {
|
|
19
19
|
metadata: {
|
|
20
20
|
name: "GCS Storage",
|
|
21
|
-
version: "0.
|
|
21
|
+
version: "0.8.0",
|
|
22
22
|
description: "Google Cloud Storage adapter",
|
|
23
23
|
kind: "gcs",
|
|
24
24
|
category: "storage"
|
|
@@ -47,7 +47,6 @@ function createGcsStorage(options) {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
//#endregion
|
|
51
50
|
export { createGcsStorage, gcsKey };
|
|
52
51
|
|
|
53
52
|
//# sourceMappingURL=index.mjs.map
|
package/dist/keys.d.mts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import __tsdown_shims_path from 'node:path';
|
|
2
2
|
import __tsdown_shims_url from 'node:url';
|
|
3
|
-
//#region src/keys.d.ts
|
|
4
3
|
/** Key join/split for GCS object keys. */
|
|
5
4
|
/** Join an optional key prefix with a storage path. */
|
|
6
5
|
declare function gcsKey(prefix: string, path: string): string;
|
|
7
|
-
//#endregion
|
|
8
6
|
export { gcsKey };
|
|
9
7
|
//# sourceMappingURL=keys.d.mts.map
|
package/dist/keys.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
-
|
|
4
|
+
// src/keys.ts
|
|
5
5
|
/** Key join/split for GCS object keys. */
|
|
6
6
|
/** Join an optional key prefix with a storage path. */
|
|
7
7
|
function gcsKey(prefix, path) {
|
|
@@ -11,7 +11,6 @@ function gcsKey(prefix, path) {
|
|
|
11
11
|
function gcsRel(prefix, key) {
|
|
12
12
|
return prefix === "" ? key : key.slice(prefix.length + 1);
|
|
13
13
|
}
|
|
14
|
-
//#endregion
|
|
15
14
|
export { gcsKey, gcsRel };
|
|
16
15
|
|
|
17
16
|
//# sourceMappingURL=keys.mjs.map
|
package/dist/lifecycle.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
-
|
|
4
|
+
// src/lifecycle.ts
|
|
5
5
|
/** Build the setup/health/teardown hooks probing a GCS bucket. */
|
|
6
6
|
function createGcsLifecycle(ctx) {
|
|
7
7
|
return {
|
|
@@ -24,7 +24,6 @@ function gcsHealthQuery(prefix) {
|
|
|
24
24
|
maxResults: 1
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { createGcsLifecycle, gcsHealthQuery };
|
|
29
28
|
|
|
30
29
|
//# sourceMappingURL=lifecycle.mjs.map
|
package/dist/operations.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import "node:url";
|
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { isNotFound } from "./errors.mjs";
|
|
5
5
|
import { gcsKey, gcsRel } from "./keys.mjs";
|
|
6
|
-
|
|
6
|
+
// src/operations.ts
|
|
7
7
|
/** Download the full bytes stored at `path`. */
|
|
8
8
|
async function gcsRead(ctx, path) {
|
|
9
9
|
const [data] = await ctx.bucket.file(gcsKey(ctx.prefix, path)).download();
|
|
@@ -45,7 +45,6 @@ function nextQueryQuery(nextQuery) {
|
|
|
45
45
|
if (!nextQuery || typeof nextQuery !== "object") return;
|
|
46
46
|
return nextQuery.pageToken ? nextQuery : void 0;
|
|
47
47
|
}
|
|
48
|
-
//#endregion
|
|
49
48
|
export { gcsDelete, gcsExists, gcsList, gcsRead, gcsWrite };
|
|
50
49
|
|
|
51
50
|
//# sourceMappingURL=operations.mjs.map
|
package/dist/streams.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import "node:url";
|
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { gcsKey } from "./keys.mjs";
|
|
5
5
|
import { pipeline } from "node:stream/promises";
|
|
6
|
-
|
|
6
|
+
// src/streams.ts
|
|
7
7
|
/** Stream `stream` to `path`, deleting the partial object when the pipeline fails. */
|
|
8
8
|
async function gcsWriteStream(ctx, path, stream) {
|
|
9
9
|
const file = ctx.bucket.file(gcsKey(ctx.prefix, path));
|
|
@@ -24,7 +24,6 @@ async function gcsReadStream(ctx, path) {
|
|
|
24
24
|
if (!exists) throw new Error(`No object at "${path}"`);
|
|
25
25
|
return file.createReadStream();
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { gcsReadStream, gcsWriteStream };
|
|
29
28
|
|
|
30
29
|
//# sourceMappingURL=streams.mjs.map
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import __tsdown_shims_path from 'node:path';
|
|
2
2
|
import __tsdown_shims_url from 'node:url';
|
|
3
3
|
import { Storage } from "@google-cloud/storage";
|
|
4
|
-
//#region src/types.d.ts
|
|
5
4
|
/** Options for configuring a GCS storage adapter. */
|
|
6
5
|
interface GcsStorageOptions {
|
|
7
6
|
/** GCS bucket name. */
|
|
@@ -19,6 +18,5 @@ interface GcsStorageOptions {
|
|
|
19
18
|
/** Custom API endpoint (e.g. emulator: http://localhost:9090). */
|
|
20
19
|
apiEndpoint?: string;
|
|
21
20
|
}
|
|
22
|
-
//#endregion
|
|
23
21
|
export { GcsStorageOptions };
|
|
24
22
|
//# sourceMappingURL=types.d.mts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyshelf/storage-gcs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Google Cloud Storage adapter for StoryShelf.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gcs",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@google-cloud/storage": "^7.13.0",
|
|
56
|
-
"@storyshelf/core": "0.
|
|
56
|
+
"@storyshelf/core": "0.8.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/node": "^26.0.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"oxlint-tsgolint": "^7.0.2001",
|
|
64
64
|
"tsdown": "^0.22.14",
|
|
65
65
|
"typescript": "^7.0.2",
|
|
66
|
-
"vitest": "^5.0.
|
|
66
|
+
"vitest": "^5.0.5"
|
|
67
67
|
},
|
|
68
68
|
"engines": {
|
|
69
69
|
"node": ">=24"
|