@storyshelf/storage-gcs 0.6.1 → 0.7.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/README.md +14 -0
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -64,6 +64,20 @@ interface GcsStorageOptions {
|
|
|
64
64
|
}
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
Options at a glance:
|
|
68
|
+
|
|
69
|
+
| Option | Required | Notes |
|
|
70
|
+
| ------------- | -------- | -------------------------------------------------------- |
|
|
71
|
+
| `bucket` | yes | GCS bucket name |
|
|
72
|
+
| `prefix` | no | Key prefix for every object |
|
|
73
|
+
| `client` | no | Pre-built `Storage` client (tests, custom endpoint) |
|
|
74
|
+
| `projectId` | no | GCP project ID (defaults to ADC) |
|
|
75
|
+
| `keyFilename` | no | Path to service-account JSON |
|
|
76
|
+
| `credentials` | no | Inline service-account object |
|
|
77
|
+
| `apiEndpoint` | no | Custom endpoint (emulator, e.g. `http://localhost:9090`) |
|
|
78
|
+
|
|
79
|
+
Auth otherwise uses Application Default Credentials.
|
|
80
|
+
|
|
67
81
|
### `createGcsStorage(options: GcsStorageOptions): StorageAdapter`
|
|
68
82
|
|
|
69
83
|
Creates a `StorageAdapter` backed by the configured GCS bucket. The returned adapter implements every method of the `StorageAdapter` interface (`read`, `write`, `delete`, `exists`, `list(prefix)`, `readStream`, `writeStream`).
|
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Google Cloud Storage adapter for StoryShelf.\n *\n * Server-side blob storage for screenshots, diffs, and Storybook archives.\n * The factory wires per-concern modules (client, lifecycle, operations,\n * streams); key and option helpers are re-exported below.\n */\nimport type { StorageAdapter } from \"@storyshelf/core/adapter/storage\";\nimport { createGcsContext } from \"./client.ts\";\nimport { createGcsLifecycle } from \"./lifecycle.ts\";\nimport { gcsDelete, gcsExists, gcsList, gcsRead, gcsWrite } from \"./operations.ts\";\nimport { gcsReadStream, gcsWriteStream } from \"./streams.ts\";\nimport type { GcsStorageOptions } from \"./types.ts\";\n\ndeclare const __PKG_VERSION__: string | undefined;\n\n/**\n * Create a Google Cloud Storage (GCS) StorageAdapter.\n *\n * @param options - GCS configuration options.\n * @returns A StorageAdapter backed by the configured GCS bucket.\n */\nexport function createGcsStorage(options: GcsStorageOptions): StorageAdapter {\n const ctx = createGcsContext(options);\n\n return {\n metadata: {\n name: \"GCS Storage\",\n version:
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Google Cloud Storage adapter for StoryShelf.\n *\n * Server-side blob storage for screenshots, diffs, and Storybook archives.\n * The factory wires per-concern modules (client, lifecycle, operations,\n * streams); key and option helpers are re-exported below.\n */\nimport type { StorageAdapter } from \"@storyshelf/core/adapter/storage\";\nimport { createGcsContext } from \"./client.ts\";\nimport { createGcsLifecycle } from \"./lifecycle.ts\";\nimport { gcsDelete, gcsExists, gcsList, gcsRead, gcsWrite } from \"./operations.ts\";\nimport { gcsReadStream, gcsWriteStream } from \"./streams.ts\";\nimport type { GcsStorageOptions } from \"./types.ts\";\n\ndeclare const __PKG_VERSION__: string | undefined;\n\n/**\n * Create a Google Cloud Storage (GCS) StorageAdapter.\n *\n * @param options - GCS configuration options.\n * @returns A StorageAdapter backed by the configured GCS bucket.\n */\nexport function createGcsStorage(options: GcsStorageOptions): StorageAdapter {\n const ctx = createGcsContext(options);\n\n return {\n metadata: {\n name: \"GCS Storage\",\n version: typeof __PKG_VERSION__ === \"string\" ? __PKG_VERSION__ : \"0.0.0\",\n description: \"Google Cloud Storage adapter\",\n kind: \"gcs\",\n category: \"storage\",\n },\n lifecycle: createGcsLifecycle(ctx),\n async read(path) {\n return await gcsRead(ctx, path);\n },\n async write(path, data) {\n await gcsWrite(ctx, path, data);\n },\n async delete(path) {\n await gcsDelete(ctx, path);\n },\n async exists(path) {\n return await gcsExists(ctx, path);\n },\n async list(listPrefix) {\n return await gcsList(ctx, listPrefix);\n },\n async writeStream(path, stream) {\n await gcsWriteStream(ctx, path, stream);\n },\n async readStream(path) {\n return await gcsReadStream(ctx, path);\n },\n };\n}\n\nexport type { GcsStorageOptions } from \"./types.ts\";\nexport { gcsKey } from \"./keys.ts\";\n"],"mappings":";;;;;;;;;;;;;;;AAsBA,SAAgB,iBAAiB,SAA4C;CAC3E,MAAM,MAAM,iBAAiB,OAAO;CAEpC,OAAO;EACL,UAAU;GACR,MAAM;GACN,SAAA;GACA,aAAa;GACb,MAAM;GACN,UAAU;EACZ;EACA,WAAW,mBAAmB,GAAG;EACjC,MAAM,KAAK,MAAM;GACf,OAAO,MAAM,QAAQ,KAAK,IAAI;EAChC;EACA,MAAM,MAAM,MAAM,MAAM;GACtB,MAAM,SAAS,KAAK,MAAM,IAAI;EAChC;EACA,MAAM,OAAO,MAAM;GACjB,MAAM,UAAU,KAAK,IAAI;EAC3B;EACA,MAAM,OAAO,MAAM;GACjB,OAAO,MAAM,UAAU,KAAK,IAAI;EAClC;EACA,MAAM,KAAK,YAAY;GACrB,OAAO,MAAM,QAAQ,KAAK,UAAU;EACtC;EACA,MAAM,YAAY,MAAM,QAAQ;GAC9B,MAAM,eAAe,KAAK,MAAM,MAAM;EACxC;EACA,MAAM,WAAW,MAAM;GACrB,OAAO,MAAM,cAAc,KAAK,IAAI;EACtC;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyshelf/storage-gcs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.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.7.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/node": "^26.0.0",
|
|
@@ -65,6 +65,9 @@
|
|
|
65
65
|
"typescript": "^7.0.2",
|
|
66
66
|
"vitest": "^5.0.0"
|
|
67
67
|
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": ">=24"
|
|
70
|
+
},
|
|
68
71
|
"jsr": {
|
|
69
72
|
"runtimeCompat": {
|
|
70
73
|
"node": true,
|