@xyo-network/xl1-driver-cloudflare-r2 4.3.3 → 4.4.1

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 CHANGED
@@ -5,104 +5,31 @@
5
5
  [![npm-badge][]][npm-link]
6
6
  [![license-badge][]][license-link]
7
7
 
8
- > Cloudflare R2 and S3-compatible map driver for XL1 protocol storage.
8
+ > Deprecated compatibility package for `@xyo-network/xl1-driver-s3`.
9
9
 
10
10
  ## Description
11
11
 
12
- XL1 is the XYO Layer One blockchain protocol. This package provides `R2Map`, an
13
- S3-compatible `AsyncIterableMap` for Cloudflare R2 buckets. It stores each value
14
- as JSON under a deterministic object key and can optionally use an in-memory
15
- read-through cache.
12
+ XL1 is the XYO Layer One blockchain protocol. This package is a compatibility
13
+ stub. It re-exports `@xyo-network/xl1-driver-s3` — with the former `R2Map` /
14
+ `R2MapParams` names aliased to `S3Map` / `S3MapParams` — so older imports keep
15
+ working after the package rename.
16
16
 
17
- Use it for durable object-storage-backed maps in Node services and publishers.
17
+ New code should install and import `@xyo-network/xl1-driver-s3` directly.
18
18
 
19
19
  ## Install
20
20
 
21
- Using npm:
21
+ Use the renamed package for new code:
22
22
 
23
23
  ```sh
24
- npm i --save @xyo-network/xl1-driver-cloudflare-r2
24
+ pnpm add @xyo-network/xl1-driver-s3
25
25
  ```
26
26
 
27
- Using yarn:
28
-
29
- ```sh
30
- yarn add @xyo-network/xl1-driver-cloudflare-r2
31
- ```
32
-
33
- Using pnpm:
27
+ Install this package only to keep legacy imports compiling:
34
28
 
35
29
  ```sh
36
30
  pnpm add @xyo-network/xl1-driver-cloudflare-r2
37
31
  ```
38
32
 
39
- Using bun:
40
-
41
- ```sh
42
- bun add @xyo-network/xl1-driver-cloudflare-r2
43
- ```
44
-
45
- This package expects an `@aws-sdk/client-s3` `S3Client` configured for your R2
46
- or S3-compatible endpoint.
47
-
48
- ## Usage
49
-
50
- ```ts
51
- import { S3Client } from '@aws-sdk/client-s3'
52
- import { R2Map } from '@xyo-network/xl1-driver-cloudflare-r2'
53
-
54
- const client = new S3Client({
55
- region: 'auto',
56
- endpoint: `https://${accountId}.r2.cloudflarestorage.com`,
57
- credentials: { accessKeyId, secretAccessKey },
58
- })
59
-
60
- const map = await R2Map.create({
61
- bucket: 'xl1-cache',
62
- client,
63
- prefix: 'blocks/',
64
- getCache: { enabled: true },
65
- })
66
-
67
- await map.start()
68
- await map.set('head', { block: 42 })
69
- ```
70
-
71
- ## Documentation
72
-
73
- `R2Map` implements async `get`, `set`, `has`, `getMany`, `setMany`, `delete`,
74
- `clear`, and `for await...of` iteration over the matching object prefix.
75
-
76
- Use `@xyo-network/xl1-s3-publishers` when you need to publish the complete XL1
77
- static REST layout rather than a generic map abstraction.
78
-
79
- ## AI Agent Skills
80
-
81
- Install the recommended XL1/XYO skills with [Skills.sh](https://skills.sh):
82
-
83
- ```sh
84
- npx skills add XYOracleNetwork/xyo-skills --all
85
- ```
86
-
87
- In XY toolchain repos, the equivalent convenience command is:
88
-
89
- ```sh
90
- pnpm xy skills defaults
91
- pnpm xy skills lint --fix
92
- ```
93
-
94
- For XL1 work, ask your agent to use `xyo-knowledge`, `xl1-knowledge`, and
95
- `xl1-patterns`. These skills cover XYO primitives, XL1 chain and gateway APIs,
96
- and application patterns for XL1 dApps.
97
-
98
- ## Building Locally
99
-
100
- ```sh
101
- pnpm xy build @xyo-network/xl1-driver-cloudflare-r2
102
- pnpm xy test @xyo-network/xl1-driver-cloudflare-r2
103
- pnpm xy lint @xyo-network/xl1-driver-cloudflare-r2
104
- ```
105
-
106
33
  ## License
107
34
 
108
35
  See the [LICENSE](./LICENSE) file for license rights and limitations
@@ -1,2 +1,16 @@
1
- export * from './R2Map.ts';
1
+ import type { S3MapParams } from '@xyo-network/xl1-driver-s3';
2
+ import { S3Map } from '@xyo-network/xl1-driver-s3';
3
+ /**
4
+ * @deprecated `@xyo-network/xl1-driver-cloudflare-r2` has been renamed to
5
+ * `@xyo-network/xl1-driver-s3` — import from there instead. This package
6
+ * is a compatibility stub that re-exports the renamed package and will be
7
+ * removed in a future major version.
8
+ */
9
+ export * from '@xyo-network/xl1-driver-s3';
10
+ /** @deprecated Renamed to `S3Map` in `@xyo-network/xl1-driver-s3`. */
11
+ export declare const R2Map: typeof S3Map;
12
+ /** @deprecated Renamed to `S3Map` in `@xyo-network/xl1-driver-s3`. */
13
+ export type R2Map<K extends string = string, V extends {} = {}> = S3Map<K, V>;
14
+ /** @deprecated Renamed to `S3MapParams` in `@xyo-network/xl1-driver-s3`. */
15
+ export type R2MapParams = S3MapParams;
2
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAElD;;;;;GAKG;AACH,cAAc,4BAA4B,CAAA;AAE1C,sEAAsE;AACtE,eAAO,MAAM,KAAK,cAAQ,CAAA;AAC1B,sEAAsE;AACtE,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAC7E,4EAA4E;AAC5E,MAAM,MAAM,WAAW,GAAG,WAAW,CAAA"}
@@ -1,168 +1,7 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __decorateClass = (decorators, target, key, kind) => {
4
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
- if (decorator = decorators[i])
7
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result) __defProp(target, key, result);
9
- return result;
10
- };
11
-
12
- // src/R2Map.ts
13
- import {
14
- AbstractCreatable,
15
- assertEx,
16
- creatable,
17
- isDefined
18
- } from "@ariestools/sdk";
19
- import {
20
- DeleteObjectCommand,
21
- DeleteObjectsCommand,
22
- GetObjectCommand,
23
- HeadObjectCommand,
24
- ListObjectsV2Command,
25
- PutObjectCommand
26
- } from "@aws-sdk/client-s3";
27
- import { LruCacheMap } from "@xyo-network/xl1-sdk/driver-memory";
28
- var isNotFoundError = (error) => {
29
- if (typeof error !== "object" || error === null) return false;
30
- const { name, $metadata } = error;
31
- return name === "NoSuchKey" || name === "NotFound" || $metadata?.httpStatusCode === 404;
32
- };
33
- var R2Map = class extends AbstractCreatable {
34
- _getCache;
35
- get bucket() {
36
- return assertEx(this.params.bucket, () => "No bucket specified");
37
- }
38
- get client() {
39
- return assertEx(this.params.client, () => "No client specified");
40
- }
41
- get prefix() {
42
- return this.params.prefix ?? "";
43
- }
44
- /**
45
- * Enable `for await...of` iteration over all entries in the map.
46
- * Pages through ListObjectsV2 so no fixed result limit is applied.
47
- */
48
- [Symbol.asyncIterator]() {
49
- let pageKeys = [];
50
- let continuationToken;
51
- let exhausted = false;
52
- const loadNextPage = async () => {
53
- const response = await this.client.send(new ListObjectsV2Command({
54
- Bucket: this.bucket,
55
- Prefix: this.prefix === "" ? void 0 : this.prefix,
56
- ContinuationToken: continuationToken
57
- }));
58
- pageKeys = (response.Contents ?? []).map((object) => object.Key).filter(isDefined).map((key) => key.slice(this.prefix.length));
59
- continuationToken = response.NextContinuationToken;
60
- exhausted = continuationToken === void 0;
61
- };
62
- return {
63
- next: async () => {
64
- for (; ; ) {
65
- while (pageKeys.length === 0) {
66
- if (exhausted) return { value: void 0, done: true };
67
- await loadNextPage();
68
- }
69
- const key = pageKeys.shift();
70
- const value = await this.get(key);
71
- if (value === void 0) continue;
72
- return { value: [key, value], done: false };
73
- }
74
- }
75
- };
76
- }
77
- async clear() {
78
- await this._getCache?.clear();
79
- let continuationToken;
80
- do {
81
- const response = await this.client.send(new ListObjectsV2Command({
82
- Bucket: this.bucket,
83
- Prefix: this.prefix === "" ? void 0 : this.prefix,
84
- ContinuationToken: continuationToken
85
- }));
86
- const keys = (response.Contents ?? []).map((object) => object.Key).filter(isDefined);
87
- if (keys.length > 0) {
88
- await this.client.send(new DeleteObjectsCommand({
89
- Bucket: this.bucket,
90
- Delete: { Objects: keys.map((key) => ({ Key: key })) }
91
- }));
92
- }
93
- continuationToken = response.NextContinuationToken;
94
- } while (continuationToken !== void 0);
95
- }
96
- async delete(id) {
97
- await this._getCache?.delete(id);
98
- const existed = await this.has(id);
99
- await this.client.send(new DeleteObjectCommand({ Bucket: this.bucket, Key: this.objectKey(id) }));
100
- return existed;
101
- }
102
- async get(id) {
103
- if (this._getCache) {
104
- const getCacheResult = await this._getCache.get(id);
105
- if (getCacheResult) {
106
- return getCacheResult;
107
- }
108
- }
109
- try {
110
- const response = await this.client.send(new GetObjectCommand({ Bucket: this.bucket, Key: this.objectKey(id) }));
111
- const body = await response.Body?.transformToString();
112
- if (body === void 0) return void 0;
113
- const value = JSON.parse(body);
114
- await this._getCache?.set(id, value);
115
- return value;
116
- } catch (error) {
117
- if (isNotFoundError(error)) return void 0;
118
- throw error;
119
- }
120
- }
121
- async getMany(ids) {
122
- const results = await Promise.all(ids.map((id) => this.get(id)));
123
- return results.filter(isDefined);
124
- }
125
- async has(id) {
126
- if (this._getCache) {
127
- const getCacheResult = await this._getCache.has(id);
128
- if (getCacheResult) return getCacheResult;
129
- }
130
- try {
131
- await this.client.send(new HeadObjectCommand({ Bucket: this.bucket, Key: this.objectKey(id) }));
132
- return true;
133
- } catch (error) {
134
- if (isNotFoundError(error)) return false;
135
- throw error;
136
- }
137
- }
138
- async set(id, data) {
139
- await this.client.send(new PutObjectCommand({
140
- Bucket: this.bucket,
141
- Key: this.objectKey(id),
142
- Body: JSON.stringify(data),
143
- ContentType: "application/json"
144
- }));
145
- await this._getCache?.set(id, data);
146
- }
147
- async setMany(entries) {
148
- for (const [key, value] of entries) {
149
- await this.set(key, value);
150
- }
151
- }
152
- async startHandler() {
153
- await super.startHandler();
154
- if (this.params.getCache?.enabled === true) {
155
- const maxEntries = this.params.getCache?.maxEntries ?? 5e3;
156
- this._getCache = new LruCacheMap({ max: maxEntries });
157
- }
158
- }
159
- objectKey(id) {
160
- return `${this.prefix}${id}`;
161
- }
162
- };
163
- R2Map = __decorateClass([
164
- creatable()
165
- ], R2Map);
1
+ // src/index.ts
2
+ import { S3Map } from "@xyo-network/xl1-driver-s3";
3
+ export * from "@xyo-network/xl1-driver-s3";
4
+ var R2Map = S3Map;
166
5
  export {
167
6
  R2Map
168
7
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/R2Map.ts"],
4
- "sourcesContent": ["import type { CreatableParams } from '@ariestools/sdk'\nimport {\n AbstractCreatable, assertEx, creatable, isDefined,\n} from '@ariestools/sdk'\nimport type { S3Client } from '@aws-sdk/client-s3'\nimport {\n DeleteObjectCommand, DeleteObjectsCommand, GetObjectCommand, HeadObjectCommand, ListObjectsV2Command, PutObjectCommand,\n} from '@aws-sdk/client-s3'\nimport type { AsyncIterableMap, MapType } from '@xyo-network/xl1-protocol/protocol-lib'\nimport { LruCacheMap } from '@xyo-network/xl1-sdk/driver-memory'\n\nexport interface R2MapParams extends CreatableParams {\n bucket: string\n /**\n * S3-compatible client pointed at the Cloudflare R2 endpoint\n * (`https://<account-id>.r2.cloudflarestorage.com`).\n */\n client: S3Client\n getCache?: {\n enabled: boolean\n maxEntries?: number\n }\n /** Optional key prefix, allowing multiple maps to share one bucket. */\n prefix?: string\n}\n\nconst isNotFoundError = (error: unknown): boolean => {\n if (typeof error !== 'object' || error === null) return false\n const { name, $metadata } = error as { $metadata?: { httpStatusCode?: number }; name?: string }\n return name === 'NoSuchKey' || name === 'NotFound' || $metadata?.httpStatusCode === 404\n}\n\n@creatable()\nexport class R2Map<K extends string = string, V extends {} = {}>\n extends AbstractCreatable<R2MapParams>\n implements AsyncIterableMap<K, V> {\n private _getCache: MapType<K, V> | undefined\n\n get bucket(): string {\n return assertEx(this.params.bucket, () => 'No bucket specified')\n }\n\n get client(): S3Client {\n return assertEx(this.params.client, () => 'No client specified')\n }\n\n get prefix(): string {\n return this.params.prefix ?? ''\n }\n\n /**\n * Enable `for await...of` iteration over all entries in the map.\n * Pages through ListObjectsV2 so no fixed result limit is applied.\n */\n [Symbol.asyncIterator](): AsyncIterator<[K, V]> {\n // Keys from the current page, drained front-to-back as the iterator advances.\n let pageKeys: K[] = []\n // Continuation token for the next page; undefined once the final page is consumed.\n let continuationToken: string | undefined\n let exhausted = false\n\n const loadNextPage = async (): Promise<void> => {\n const response = await this.client.send(new ListObjectsV2Command({\n Bucket: this.bucket,\n Prefix: this.prefix === '' ? undefined : this.prefix,\n ContinuationToken: continuationToken,\n }))\n pageKeys = (response.Contents ?? [])\n .map(object => object.Key)\n .filter(isDefined)\n .map(key => key.slice(this.prefix.length) as K)\n continuationToken = response.NextContinuationToken\n exhausted = continuationToken === undefined\n }\n\n return {\n next: async (): Promise<IteratorResult<[K, V]>> => {\n for (;;) {\n // Refill from the next page whenever the current one is drained.\n while (pageKeys.length === 0) {\n if (exhausted) return { value: undefined, done: true }\n await loadNextPage()\n }\n\n const key = pageKeys.shift()!\n const value = await this.get(key)\n // The object may have been deleted between listing and reading; skip it.\n if (value === undefined) continue\n\n // Yield the entry to the async iterator consumer (get() already populated the cache).\n return { value: [key, value], done: false }\n }\n },\n }\n }\n\n async clear(): Promise<void> {\n await this._getCache?.clear()\n // DeleteObjects accepts at most 1000 keys per request; page through the bucket until empty.\n let continuationToken: string | undefined\n do {\n const response = await this.client.send(new ListObjectsV2Command({\n Bucket: this.bucket,\n Prefix: this.prefix === '' ? undefined : this.prefix,\n ContinuationToken: continuationToken,\n }))\n const keys = (response.Contents ?? []).map(object => object.Key).filter(isDefined)\n if (keys.length > 0) {\n await this.client.send(new DeleteObjectsCommand({\n Bucket: this.bucket,\n Delete: { Objects: keys.map(key => ({ Key: key })) },\n }))\n }\n continuationToken = response.NextContinuationToken\n } while (continuationToken !== undefined)\n }\n\n async delete(id: K): Promise<boolean> {\n await this._getCache?.delete(id)\n\n // S3-style deletes are idempotent and do not report prior existence, so check first.\n const existed = await this.has(id)\n await this.client.send(new DeleteObjectCommand({ Bucket: this.bucket, Key: this.objectKey(id) }))\n return existed\n }\n\n async get(id: K): Promise<V | undefined> {\n if (this._getCache) {\n const getCacheResult = await this._getCache.get(id)\n if (getCacheResult) {\n return getCacheResult\n }\n }\n try {\n const response = await this.client.send(new GetObjectCommand({ Bucket: this.bucket, Key: this.objectKey(id) }))\n const body = await response.Body?.transformToString()\n if (body === undefined) return undefined\n const value = JSON.parse(body) as V\n await this._getCache?.set(id, value)\n return value\n } catch (error) {\n if (isNotFoundError(error)) return undefined\n throw error\n }\n }\n\n async getMany(ids: K[]): Promise<V[]> {\n const results = await Promise.all(ids.map(id => this.get(id)))\n return results.filter(isDefined)\n }\n\n async has(id: K): Promise<boolean> {\n if (this._getCache) {\n const getCacheResult = await this._getCache.has(id)\n if (getCacheResult) return getCacheResult\n }\n try {\n await this.client.send(new HeadObjectCommand({ Bucket: this.bucket, Key: this.objectKey(id) }))\n return true\n } catch (error) {\n if (isNotFoundError(error)) return false\n throw error\n }\n }\n\n async set(id: K, data: V): Promise<void> {\n await this.client.send(new PutObjectCommand({\n Bucket: this.bucket,\n Key: this.objectKey(id),\n Body: JSON.stringify(data),\n ContentType: 'application/json',\n }))\n await this._getCache?.set(id, data)\n }\n\n async setMany(entries: [K, V][]): Promise<void> {\n // TODO: Optimize with bounded concurrency\n for (const [key, value] of entries) {\n await this.set(key, value)\n }\n }\n\n override async startHandler(): Promise<void> {\n await super.startHandler()\n if (this.params.getCache?.enabled === true) {\n const maxEntries = this.params.getCache?.maxEntries ?? 5000\n this._getCache = new LruCacheMap<K, V>({ max: maxEnt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,MACb,KAAK,KAAK,UAAU,EAAE;AAAA,MACtB,MAAM,KAAK,UAAU,IAAI;AAAA,MACzB,aAAa;AAAA,IACf,CAAC,CAAC;AACF,UAAM,KAAK,WAAW,IAAI,IAAI,IAAI;AAAA,EACpC;AAAA,EAEA,MAAM,QAAQ,SAAkC;AAE9C,eAAW,CAAC,KAAK,KAAK,KAAK,SAAS;AAClC,YAAM,KAAK,IAAI,KAAK,KAAK;AAAA,IAC3B;AAAA,EACF;AAAA,EAEA,MAAe,eAA8B;AAC3C,UAAM,MAAM,aAAa;AACzB,QAAI,KAAK,OAAO,UAAU,YAAY,MAAM;AAC1C,YAAM,aAAa,KAAK,OAAO,UAAU,cAAc;AACvD,WAAK,YAAY,IAAI,YAAkB,EAAE,KAAK,WAAW,CAAC;AAAA,IAC5D;AAAA,EACF;AAAA,EAEQ,UAAU,IAAe;AAC/B,WAAO,GAAG,KAAK,MAAM,GAAG,EAAE;AAAA,EAC5B;AACF;AAhKa,QAAN;AAAA,EADN,UAAU;AAAA,GACE;",
3
+ "sources": ["../../src/index.ts"],
4
+ "sourcesContent": ["import type { S3MapParams } from '@xyo-network/xl1-driver-s3'\nimport { S3Map } from '@xyo-network/xl1-driver-s3'\n\n/**\n * @deprecated `@xyo-network/xl1-driver-cloudflare-r2` has been renamed to\n * `@xyo-network/xl1-driver-s3` \u2014 import from there instead. This package\n * is a compatibility stub that re-exports the renamed package and will be\n * removed in a future major version.\n */\nexport * from '@xyo-network/xl1-driver-s3'\n\n/** @deprecated Renamed to `S3Map` in `@xyo-network/xl1-driver-s3`. */\nexport const R2Map = S3Map\n/** @deprecated Renamed to `S3Map` in `@xyo-network/xl1-driver-s3`. */\nexport type R2Map<K extends string = string, V extends {} = {}> = S3Map<K, V>\n/** @deprecated Renamed to `S3MapParams` in `@xyo-network/xl1-driver-s3`. */\nexport type R2MapParams = S3MapParams\n"],
5
+ "mappings": ";AACA,SAAS,aAAa;AAQtB,cAAc;AAGP,IAAM,QAAQ;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "http://json.schemastore.org/package.json",
3
3
  "name": "@xyo-network/xl1-driver-cloudflare-r2",
4
- "version": "4.3.3",
5
- "description": "XYO Layer One SDK Protocol Cloudflare R2 Driver",
4
+ "version": "4.4.1",
5
+ "description": "DEPRECATED: renamed to @xyo-network/xl1-driver-s3 — this package re-exports it (with R2Map aliased to S3Map) for backward compatibility",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
8
8
  "url": "https://github.com/XYOracleNetwork/xl1-protocol/issues",
@@ -35,31 +35,23 @@
35
35
  "README.md"
36
36
  ],
37
37
  "dependencies": {
38
- "@aws-sdk/client-s3": "~3.1086.0",
39
- "@xyo-network/xl1-protocol": "~4.3.3",
40
- "@xyo-network/xl1-sdk": "~4.3.3"
38
+ "@xyo-network/xl1-driver-s3": "~4.4.1"
41
39
  },
42
40
  "devDependencies": {
43
41
  "@ariestools/sdk": "~8.1.0",
44
- "@ariestools/toolchain": "~8.7.11",
45
- "@ariestools/tsconfig": "~8.7.11",
42
+ "@ariestools/toolchain": "~8.7.12",
43
+ "@ariestools/tsconfig": "~8.7.12",
46
44
  "@metamask/json-rpc-engine": "~10.5.0",
47
45
  "@opentelemetry/api": "~1.9.1",
48
- "@xyo-network/sdk": "~7.1.1",
49
- "@xyo-network/sdk-protocol": "~7.1.0",
46
+ "@xyo-network/sdk": "~7.2.0",
47
+ "@xyo-network/sdk-protocol": "~7.2.0",
50
48
  "ajv": "~8.20.0",
51
49
  "async-mutex": "~0.5.0",
52
50
  "eslint": "~10.7.0",
53
51
  "ethers": "~6.17.0",
54
- "tslib": "~2.8.1",
55
52
  "typescript": "~6.0.3",
56
- "vite": "~8.1.4",
57
- "vitest": "~4.1.10",
58
53
  "zod": "~4.4.3"
59
54
  },
60
- "peerDependencies": {
61
- "@ariestools/sdk": "^8.1"
62
- },
63
55
  "engines": {
64
56
  "node": ">=22.3"
65
57
  },
@@ -1,39 +0,0 @@
1
- import type { CreatableParams } from '@ariestools/sdk';
2
- import { AbstractCreatable } from '@ariestools/sdk';
3
- import type { S3Client } from '@aws-sdk/client-s3';
4
- import type { AsyncIterableMap } from '@xyo-network/xl1-protocol/protocol-lib';
5
- export interface R2MapParams extends CreatableParams {
6
- bucket: string;
7
- /**
8
- * S3-compatible client pointed at the Cloudflare R2 endpoint
9
- * (`https://<account-id>.r2.cloudflarestorage.com`).
10
- */
11
- client: S3Client;
12
- getCache?: {
13
- enabled: boolean;
14
- maxEntries?: number;
15
- };
16
- /** Optional key prefix, allowing multiple maps to share one bucket. */
17
- prefix?: string;
18
- }
19
- export declare class R2Map<K extends string = string, V extends {} = {}> extends AbstractCreatable<R2MapParams> implements AsyncIterableMap<K, V> {
20
- private _getCache;
21
- get bucket(): string;
22
- get client(): S3Client;
23
- get prefix(): string;
24
- /**
25
- * Enable `for await...of` iteration over all entries in the map.
26
- * Pages through ListObjectsV2 so no fixed result limit is applied.
27
- */
28
- [Symbol.asyncIterator](): AsyncIterator<[K, V]>;
29
- clear(): Promise<void>;
30
- delete(id: K): Promise<boolean>;
31
- get(id: K): Promise<V | undefined>;
32
- getMany(ids: K[]): Promise<V[]>;
33
- has(id: K): Promise<boolean>;
34
- set(id: K, data: V): Promise<void>;
35
- setMany(entries: [K, V][]): Promise<void>;
36
- startHandler(): Promise<void>;
37
- private objectKey;
38
- }
39
- //# sourceMappingURL=R2Map.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"R2Map.d.ts","sourceRoot":"","sources":["../../src/R2Map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EACL,iBAAiB,EAClB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAIlD,OAAO,KAAK,EAAE,gBAAgB,EAAW,MAAM,wCAAwC,CAAA;AAGvF,MAAM,WA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