@mastra/cloudflare 0.0.0-update-stores-peerDeps-20250723031338 → 0.0.0-usechat-duplicate-20251016110554

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.
@@ -0,0 +1,67 @@
1
+ import type { KVNamespace } from '@cloudflare/workers-types';
2
+ import type { StorageThreadType, MastraMessageV2 } from '@mastra/core/memory';
3
+ import type { ScoreRowData } from '@mastra/core/scores';
4
+ import type { TABLE_MESSAGES, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, TABLE_EVALS, TABLE_TRACES, TABLE_RESOURCES, TABLE_NAMES, EvalRow, StorageResourceType, TABLE_SCORERS, TABLE_AI_SPANS, AISpanRecord } from '@mastra/core/storage';
5
+ import type { WorkflowRunState } from '@mastra/core/workflows';
6
+ /**
7
+ * Configuration for Cloudflare KV using REST API
8
+ */
9
+ export interface CloudflareRestConfig {
10
+ /** Cloudflare account ID */
11
+ accountId: string;
12
+ /** Cloudflare API token with KV access */
13
+ apiToken: string;
14
+ /**
15
+ * Prefix for KV namespace names.
16
+ * Recommended for production use to ensure data isolation between different instances.
17
+ * If not provided, no prefix will be used
18
+ */
19
+ namespacePrefix?: string;
20
+ }
21
+ /**
22
+ * Configuration for Cloudflare KV using Workers Binding API
23
+ */
24
+ export interface CloudflareWorkersConfig {
25
+ /** KV namespace bindings from Workers environment */
26
+ bindings: {
27
+ [key in TABLE_NAMES]: KVNamespace;
28
+ };
29
+ /** Optional prefix for keys within namespaces */
30
+ keyPrefix?: string;
31
+ }
32
+ /**
33
+ * Combined configuration type supporting both REST API and Workers Binding API
34
+ */
35
+ export type CloudflareStoreConfig = CloudflareRestConfig | CloudflareWorkersConfig;
36
+ /**
37
+ * Interface for KV operations with type support
38
+ */
39
+ export interface KVOperation {
40
+ /** Table/namespace to operate on */
41
+ tableName: TABLE_NAMES;
42
+ /** Key to read/write */
43
+ key: string;
44
+ /** Value to write (for put operations) */
45
+ value?: any;
46
+ /** Optional metadata to associate with the value */
47
+ metadata?: any;
48
+ }
49
+ /**
50
+ * Helper to determine if a config is using Workers bindings
51
+ */
52
+ export declare function isWorkersConfig(config: CloudflareStoreConfig): config is CloudflareWorkersConfig;
53
+ export type RecordTypes = {
54
+ [TABLE_THREADS]: StorageThreadType;
55
+ [TABLE_MESSAGES]: MastraMessageV2;
56
+ [TABLE_WORKFLOW_SNAPSHOT]: WorkflowRunState;
57
+ [TABLE_EVALS]: EvalRow;
58
+ [TABLE_SCORERS]: ScoreRowData;
59
+ [TABLE_TRACES]: any;
60
+ [TABLE_RESOURCES]: StorageResourceType;
61
+ [TABLE_AI_SPANS]: AISpanRecord;
62
+ };
63
+ export type ListOptions = {
64
+ limit?: number;
65
+ prefix?: string;
66
+ };
67
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/storage/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,uBAAuB,EACvB,WAAW,EACX,YAAY,EACZ,eAAe,EACf,WAAW,EACX,OAAO,EACP,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,qDAAqD;IACrD,QAAQ,EAAE;SACP,GAAG,IAAI,WAAW,GAAG,WAAW;KAClC,CAAC;IACF,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,GAAG,uBAAuB,CAAC;AAEnF;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,oCAAoC;IACpC,SAAS,EAAE,WAAW,CAAC;IACvB,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,0CAA0C;IAC1C,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,oDAAoD;IACpD,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,IAAI,uBAAuB,CAEhG;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,aAAa,CAAC,EAAE,iBAAiB,CAAC;IACnC,CAAC,cAAc,CAAC,EAAE,eAAe,CAAC;IAClC,CAAC,uBAAuB,CAAC,EAAE,gBAAgB,CAAC;IAC5C,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IACvB,CAAC,aAAa,CAAC,EAAE,YAAY,CAAC;IAC9B,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC;IACpB,CAAC,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACvC,CAAC,cAAc,CAAC,EAAE,YAAY,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@mastra/cloudflare",
3
- "version": "0.0.0-update-stores-peerDeps-20250723031338",
3
+ "version": "0.0.0-usechat-duplicate-20251016110554",
4
4
  "description": "Cloudflare provider for Mastra - includes db storage capabilities",
5
5
  "type": "module",
6
6
  "files": [
7
- "dist"
7
+ "dist",
8
+ "CHANGELOG.md"
8
9
  ],
9
10
  "main": "dist/index.js",
10
11
  "types": "dist/index.d.ts",
@@ -15,36 +16,46 @@
15
16
  "default": "./dist/index.js"
16
17
  },
17
18
  "require": {
18
- "types": "./dist/index.d.cts",
19
+ "types": "./dist/index.d.ts",
19
20
  "default": "./dist/index.cjs"
20
21
  }
21
22
  },
22
23
  "./package.json": "./package.json"
23
24
  },
24
- "license": "MIT",
25
+ "license": "Apache-2.0",
25
26
  "dependencies": {
26
- "cloudflare": "^4.4.1"
27
+ "cloudflare": "^4.5.0"
27
28
  },
28
29
  "devDependencies": {
29
- "@cloudflare/workers-types": "^4.20250705.0",
30
+ "@cloudflare/workers-types": "^4.20251008.0",
30
31
  "@microsoft/api-extractor": "^7.52.8",
31
32
  "@types/node": "^20.19.0",
32
33
  "dotenv": "^17.0.0",
33
- "eslint": "^9.30.1",
34
- "miniflare": "^4.20250617.5",
34
+ "eslint": "^9.36.0",
35
+ "miniflare": "^4.20251008.0",
35
36
  "tsup": "^8.5.0",
36
37
  "typescript": "^5.8.3",
37
38
  "vitest": "^3.2.4",
38
- "@internal/lint": "0.0.0-update-stores-peerDeps-20250723031338",
39
- "@internal/storage-test-utils": "0.0.0-update-stores-peerDeps-20250723031338",
40
- "@mastra/core": "0.11.0"
39
+ "@internal/lint": "0.0.0-usechat-duplicate-20251016110554",
40
+ "@internal/storage-test-utils": "0.0.45",
41
+ "@mastra/core": "0.0.0-usechat-duplicate-20251016110554",
42
+ "@internal/types-builder": "0.0.0-usechat-duplicate-20251016110554"
41
43
  },
42
44
  "peerDependencies": {
43
- "@mastra/core": "0.11.0"
45
+ "@mastra/core": "0.0.0-usechat-duplicate-20251016110554"
46
+ },
47
+ "homepage": "https://mastra.ai",
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/mastra-ai/mastra.git",
51
+ "directory": "stores/cloudflare"
52
+ },
53
+ "bugs": {
54
+ "url": "https://github.com/mastra-ai/mastra/issues"
44
55
  },
45
56
  "scripts": {
46
- "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
47
- "build:watch": "pnpm build --watch",
57
+ "build": "tsup --silent --config tsup.config.ts",
58
+ "build:watch": "tsup --watch --silent --config tsup.config.ts",
48
59
  "test": "vitest run",
49
60
  "lint": "eslint ."
50
61
  }