@pluv/persistence-cloudflare-transactional-storage 0.0.0-canary-20261027022227
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/LICENSE +21 -0
- package/README.md +20 -0
- package/dist/index.d.mts +25 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +163 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Shoubhit Dash
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
## `@pluv/persistence-cloudflare-transactional-storage`
|
|
2
|
+
|
|
3
|
+
> Crdt storage persistence for [@pluv/io](https://www.npmjs.com/package/@pluv/io) rooms on Cloudflare Workers.
|
|
4
|
+
|
|
5
|
+
**👉 See full documentation on [docs.pluv.io](https://docs.pluv.io/docs). 👈**
|
|
6
|
+
|
|
7
|
+
This is a dependency of `@pluv/platform-cloudflare`. You probably don't mean to install this yourself.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# npm
|
|
13
|
+
npm install @pluv/persistence-cloudflare-transactional-storage
|
|
14
|
+
|
|
15
|
+
# yarn
|
|
16
|
+
yarn add @pluv/persistence-cloudflare-transactional-storage
|
|
17
|
+
|
|
18
|
+
# pnpm
|
|
19
|
+
pnpm add @pluv/persistence-cloudflare-transactional-storage
|
|
20
|
+
```
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AbstractPersistence } from "@pluv/io";
|
|
2
|
+
import { JsonObject } from "@pluv/types";
|
|
3
|
+
type PersistenceCloudflareTransactionalStorageInit = {
|
|
4
|
+
_initialized?: Promise<true> | null;
|
|
5
|
+
_state?: DurableObjectState | null;
|
|
6
|
+
};
|
|
7
|
+
export declare class PersistenceCloudflareTransactionalStorage extends AbstractPersistence {
|
|
8
|
+
private _state;
|
|
9
|
+
private _initialized;
|
|
10
|
+
constructor(config?: PersistenceCloudflareTransactionalStorageInit);
|
|
11
|
+
addUser(room: string, connectionId: string, user: JsonObject | null): Promise<void>;
|
|
12
|
+
deleteStorageState(room: string): Promise<void>;
|
|
13
|
+
deleteUser(room: string, connectionId: string): Promise<void>;
|
|
14
|
+
deleteUsers(room: string): Promise<void>;
|
|
15
|
+
getStorageState(room: string): Promise<string | null>;
|
|
16
|
+
getUser(room: string, connectionId: string): Promise<JsonObject | null>;
|
|
17
|
+
getUsers(room: string): Promise<Map<[connectionId: string][0], JsonObject | null>>;
|
|
18
|
+
getUsersSize(room: string): Promise<number>;
|
|
19
|
+
initialize(roomContext: {
|
|
20
|
+
state: DurableObjectState;
|
|
21
|
+
}): typeof this;
|
|
22
|
+
setStorageState(room: string, state: string): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/PersistenceCloudflareTransactionalStorage.ts"],"mappings":";;KAOK;EACD,eAAe;EACf,SAAS;;qBAGA,kDAAkD;UACnD;UACA;EAER,YAAY,SAAQ;EAOP,QACT,cACA,sBACA,MAAM,oBACP;EA6BU,mBAAmB,eAAe;EAelC,WAAW,cAAc,uBAAuB;EAiBhD,YAAY,eAAe;EAe3B,gBAAgB,eAAe;EAwB/B,QAAQ,cAAc,uBAAuB,QAAQ;EA2BrD,SACT,eACD,QAAQ,KAAK,0BAA0B;EA0B7B,aAAa,eAAe;EAwBlC,WAAW;IAAe,OAAO;;EA0B3B,gBAAgB,cAAc,gBAAgB"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { AbstractPersistence } from "@pluv/io";
|
|
2
|
+
// src/utils/castNumber.ts
|
|
3
|
+
const castNumber = (value) => {
|
|
4
|
+
return typeof value === "number" ? value : typeof value === "string" ? Number.parseInt(value, 10) : Number(value);
|
|
5
|
+
};
|
|
6
|
+
// src/utils/sql.ts
|
|
7
|
+
const sql = (strings, ...values) => {
|
|
8
|
+
return strings.reduce((result, str, i) => {
|
|
9
|
+
return result + str.replace(/(\n[ \t]*)+/g, " ") + (i < values.length ? values[i] : "");
|
|
10
|
+
}, "").trim();
|
|
11
|
+
};
|
|
12
|
+
// src/PersistenceCloudflareTransactionalStorage.ts
|
|
13
|
+
const SQLITE_STORAGE_TABLE = "__pluv_storage";
|
|
14
|
+
const SQLITE_USER_TABLE = "__pluv_user";
|
|
15
|
+
var PersistenceCloudflareTransactionalStorage = class PersistenceCloudflareTransactionalStorage extends AbstractPersistence {
|
|
16
|
+
_state = null;
|
|
17
|
+
_initialized = null;
|
|
18
|
+
constructor(config = {}) {
|
|
19
|
+
super();
|
|
20
|
+
this._initialized = config._initialized ?? null;
|
|
21
|
+
this._state = config._state ?? null;
|
|
22
|
+
}
|
|
23
|
+
async addUser(room, connectionId, user) {
|
|
24
|
+
if (!this._initialized) return;
|
|
25
|
+
if (!this._state) return;
|
|
26
|
+
await this._initialized;
|
|
27
|
+
if (!!this._state.storage.sql.exec(sql`
|
|
28
|
+
SELECT id
|
|
29
|
+
FROM ${SQLITE_USER_TABLE}
|
|
30
|
+
WHERE id = ?;
|
|
31
|
+
`, connectionId).toArray()[0]) return;
|
|
32
|
+
this._state.storage.sql.exec(sql`
|
|
33
|
+
INSERT INTO ${SQLITE_USER_TABLE} VALUES (?, ?, ?);
|
|
34
|
+
`, connectionId, JSON.stringify(user), room);
|
|
35
|
+
}
|
|
36
|
+
async deleteStorageState(room) {
|
|
37
|
+
if (!this._initialized) return;
|
|
38
|
+
if (!this._state) return;
|
|
39
|
+
await this._initialized;
|
|
40
|
+
this._state.storage.sql.exec(sql`
|
|
41
|
+
DELETE FROM ${SQLITE_STORAGE_TABLE}
|
|
42
|
+
WHERE room = ?;
|
|
43
|
+
`, room);
|
|
44
|
+
}
|
|
45
|
+
async deleteUser(room, connectionId) {
|
|
46
|
+
if (!this._initialized) return;
|
|
47
|
+
if (!this._state) return;
|
|
48
|
+
await this._initialized;
|
|
49
|
+
this._state.storage.sql.exec(sql`
|
|
50
|
+
DELETE FROM ${SQLITE_USER_TABLE}
|
|
51
|
+
WHERE room = ?
|
|
52
|
+
AND id = ?;
|
|
53
|
+
`, room, connectionId);
|
|
54
|
+
}
|
|
55
|
+
async deleteUsers(room) {
|
|
56
|
+
if (!this._initialized) return;
|
|
57
|
+
if (!this._state) return;
|
|
58
|
+
await this._initialized;
|
|
59
|
+
this._state.storage.sql.exec(sql`
|
|
60
|
+
DELETE FROM ${SQLITE_USER_TABLE}
|
|
61
|
+
WHERE room = ?;
|
|
62
|
+
`, room);
|
|
63
|
+
}
|
|
64
|
+
async getStorageState(room) {
|
|
65
|
+
if (!this._initialized) return null;
|
|
66
|
+
if (!this._state) return null;
|
|
67
|
+
await this._initialized;
|
|
68
|
+
const cursor = this._state.storage.sql.exec(sql`
|
|
69
|
+
SELECT room, data
|
|
70
|
+
FROM ${SQLITE_STORAGE_TABLE}
|
|
71
|
+
WHERE room = ?;
|
|
72
|
+
`, room);
|
|
73
|
+
try {
|
|
74
|
+
return cursor.one().data;
|
|
75
|
+
} catch {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async getUser(room, connectionId) {
|
|
80
|
+
if (!this._initialized) return null;
|
|
81
|
+
if (!this._state) return null;
|
|
82
|
+
await this._initialized;
|
|
83
|
+
const cursor = this._state.storage.sql.exec(sql`
|
|
84
|
+
SELECT id, data, room
|
|
85
|
+
FROM ${SQLITE_USER_TABLE}
|
|
86
|
+
WHERE room = ?
|
|
87
|
+
AND id = ?;
|
|
88
|
+
`, room, connectionId);
|
|
89
|
+
try {
|
|
90
|
+
const result = cursor.one();
|
|
91
|
+
return JSON.parse(result.data);
|
|
92
|
+
} catch {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async getUsers(room) {
|
|
97
|
+
if (!this._initialized) return /* @__PURE__ */ new Map();
|
|
98
|
+
if (!this._state) return /* @__PURE__ */ new Map();
|
|
99
|
+
await this._initialized;
|
|
100
|
+
return this._state.storage.sql.exec(sql`
|
|
101
|
+
SELECT id, room, data
|
|
102
|
+
FROM ${SQLITE_USER_TABLE}
|
|
103
|
+
WHERE room = ?;
|
|
104
|
+
`, room).toArray().reduce((map, { id, data }) => {
|
|
105
|
+
try {
|
|
106
|
+
const user = JSON.parse(data);
|
|
107
|
+
return map.set(id, user);
|
|
108
|
+
} catch {
|
|
109
|
+
return map;
|
|
110
|
+
}
|
|
111
|
+
}, /* @__PURE__ */ new Map());
|
|
112
|
+
}
|
|
113
|
+
async getUsersSize(room) {
|
|
114
|
+
if (!this._initialized) return 0;
|
|
115
|
+
if (!this._state) return 0;
|
|
116
|
+
await this._initialized;
|
|
117
|
+
const cursor = this._state.storage.sql.exec(sql`
|
|
118
|
+
SELECT COUNT(*) count
|
|
119
|
+
FROM ${SQLITE_USER_TABLE}
|
|
120
|
+
WHERE room = ?;
|
|
121
|
+
`, room);
|
|
122
|
+
try {
|
|
123
|
+
const result = cursor.one();
|
|
124
|
+
return castNumber(result.count);
|
|
125
|
+
} catch {
|
|
126
|
+
return 0;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
initialize(roomContext) {
|
|
130
|
+
const { state } = roomContext;
|
|
131
|
+
const initialized = (async () => {
|
|
132
|
+
state.storage.sql.exec(sql`
|
|
133
|
+
CREATE TABLE IF NOT EXISTS ${SQLITE_STORAGE_TABLE}(
|
|
134
|
+
room TEXT PRIMARY KEY,
|
|
135
|
+
data TEXT NOT NULL
|
|
136
|
+
);
|
|
137
|
+
CREATE TABLE IF NOT EXISTS ${SQLITE_USER_TABLE}(
|
|
138
|
+
id TEXT PRIMARY KEY,
|
|
139
|
+
data TEXT NOT NULL,
|
|
140
|
+
room TEXT NOT NULL
|
|
141
|
+
);
|
|
142
|
+
CREATE INDEX IF NOT EXISTS ${SQLITE_USER_TABLE}_room ON ${SQLITE_USER_TABLE}(room);
|
|
143
|
+
`);
|
|
144
|
+
return true;
|
|
145
|
+
})();
|
|
146
|
+
return new PersistenceCloudflareTransactionalStorage({
|
|
147
|
+
_initialized: initialized,
|
|
148
|
+
_state: state
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
async setStorageState(room, state) {
|
|
152
|
+
if (!this._initialized) return;
|
|
153
|
+
if (!this._state) return;
|
|
154
|
+
await this._initialized;
|
|
155
|
+
this._state.storage.sql.exec(sql`
|
|
156
|
+
INSERT INTO ${SQLITE_STORAGE_TABLE}(room, data) VALUES (?, ?)
|
|
157
|
+
ON CONFLICT(room) DO UPDATE SET data = excluded.data;
|
|
158
|
+
`, room, state);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
export { PersistenceCloudflareTransactionalStorage };
|
|
162
|
+
|
|
163
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/utils/castNumber.ts","../src/utils/sql.ts","../src/PersistenceCloudflareTransactionalStorage.ts"],"sourcesContent":["export const castNumber = (value: any): number => {\n return typeof value === \"number\"\n ? value\n : typeof value === \"string\"\n ? Number.parseInt(value, 10)\n : Number(value);\n};\n","export const sql = (strings: TemplateStringsArray, ...values: any[]): string => {\n return strings\n .reduce((result, str, i) => {\n // Compresses the string to a single line (not including the interpolated values)\n const cleaned = str.replace(/(\\n[ \\t]*)+/g, \" \");\n\n return result + cleaned + (i < values.length ? values[i] : \"\");\n }, \"\")\n .trim();\n};\n","import { AbstractPersistence } from \"@pluv/io\";\nimport type { JsonObject } from \"@pluv/types\";\nimport { castNumber, sql } from \"./utils\";\n\nconst SQLITE_STORAGE_TABLE = \"__pluv_storage\";\nconst SQLITE_USER_TABLE = \"__pluv_user\";\n\ntype PersistenceCloudflareTransactionalStorageInit = {\n _initialized?: Promise<true> | null;\n _state?: DurableObjectState | null;\n};\n\nexport class PersistenceCloudflareTransactionalStorage extends AbstractPersistence {\n private _state: DurableObjectState | null = null;\n private _initialized: Promise<true> | null = null;\n\n constructor(config: PersistenceCloudflareTransactionalStorageInit = {}) {\n super();\n\n this._initialized = config._initialized ?? null;\n this._state = config._state ?? null;\n }\n\n public async addUser(\n room: string,\n connectionId: string,\n user: JsonObject | null,\n ): Promise<void> {\n if (!this._initialized) return;\n if (!this._state) return;\n\n await this._initialized;\n\n const result = this._state.storage.sql.exec<{ id: string }>(\n sql`\n SELECT id\n FROM ${SQLITE_USER_TABLE}\n WHERE id = ?;\n `,\n connectionId,\n );\n\n const existing = !!result.toArray()[0];\n\n if (existing) return;\n\n this._state.storage.sql.exec(\n sql`\n INSERT INTO ${SQLITE_USER_TABLE} VALUES (?, ?, ?);\n `,\n connectionId,\n JSON.stringify(user),\n room,\n );\n }\n\n public async deleteStorageState(room: string): Promise<void> {\n if (!this._initialized) return;\n if (!this._state) return;\n\n await this._initialized;\n\n this._state.storage.sql.exec(\n sql`\n DELETE FROM ${SQLITE_STORAGE_TABLE}\n WHERE room = ?;\n `,\n room,\n );\n }\n\n public async deleteUser(room: string, connectionId: string): Promise<void> {\n if (!this._initialized) return;\n if (!this._state) return;\n\n await this._initialized;\n\n this._state.storage.sql.exec(\n sql`\n DELETE FROM ${SQLITE_USER_TABLE}\n WHERE room = ?\n AND id = ?;\n `,\n room,\n connectionId,\n );\n }\n\n public async deleteUsers(room: string): Promise<void> {\n if (!this._initialized) return;\n if (!this._state) return;\n\n await this._initialized;\n\n this._state.storage.sql.exec(\n sql`\n DELETE FROM ${SQLITE_USER_TABLE}\n WHERE room = ?;\n `,\n room,\n );\n }\n\n public async getStorageState(room: string): Promise<string | null> {\n if (!this._initialized) return null;\n if (!this._state) return null;\n\n await this._initialized;\n\n const cursor = this._state.storage.sql.exec<{ room: string; data: string }>(\n sql`\n SELECT room, data\n FROM ${SQLITE_STORAGE_TABLE}\n WHERE room = ?;\n `,\n room,\n );\n\n try {\n const result = cursor.one();\n\n return result.data;\n } catch {\n return null;\n }\n }\n\n public async getUser(room: string, connectionId: string): Promise<JsonObject | null> {\n if (!this._initialized) return null;\n if (!this._state) return null;\n\n await this._initialized;\n\n const cursor = this._state.storage.sql.exec<{ id: string; data: string; room: string }>(\n sql`\n SELECT id, data, room\n FROM ${SQLITE_USER_TABLE}\n WHERE room = ?\n AND id = ?;\n `,\n room,\n connectionId,\n );\n\n try {\n const result = cursor.one();\n const user = JSON.parse(result.data);\n\n return user;\n } catch {\n return null;\n }\n }\n\n public async getUsers(\n room: string,\n ): Promise<Map<[connectionId: string][0], JsonObject | null>> {\n if (!this._initialized) return new Map();\n if (!this._state) return new Map();\n\n await this._initialized;\n\n const cursor = this._state.storage.sql.exec<{ id: string; data: string; room: string }>(\n sql`\n SELECT id, room, data\n FROM ${SQLITE_USER_TABLE}\n WHERE room = ?;\n `,\n room,\n );\n\n return cursor.toArray().reduce((map, { id, data }) => {\n try {\n const user = JSON.parse(data) as JsonObject;\n\n return map.set(id, user);\n } catch {\n return map;\n }\n }, new Map<string, JsonObject | null>());\n }\n\n public async getUsersSize(room: string): Promise<number> {\n if (!this._initialized) return 0;\n if (!this._state) return 0;\n\n await this._initialized;\n\n const cursor = this._state.storage.sql.exec<{ count: number }>(\n sql`\n SELECT COUNT(*) count\n FROM ${SQLITE_USER_TABLE}\n WHERE room = ?;\n `,\n room,\n );\n\n try {\n const result = cursor.one();\n\n return castNumber(result.count);\n } catch {\n return 0;\n }\n }\n\n public initialize(roomContext: { state: DurableObjectState }): typeof this {\n const { state } = roomContext;\n\n const initialized = (async () => {\n state.storage.sql.exec(sql`\n CREATE TABLE IF NOT EXISTS ${SQLITE_STORAGE_TABLE}(\n room TEXT PRIMARY KEY,\n data TEXT NOT NULL\n );\n CREATE TABLE IF NOT EXISTS ${SQLITE_USER_TABLE}(\n id TEXT PRIMARY KEY,\n data TEXT NOT NULL,\n room TEXT NOT NULL\n );\n CREATE INDEX IF NOT EXISTS ${SQLITE_USER_TABLE}_room ON ${SQLITE_USER_TABLE}(room);\n `);\n\n return true as const;\n })();\n\n return new PersistenceCloudflareTransactionalStorage({\n _initialized: initialized,\n _state: state,\n }) as typeof this;\n }\n\n public async setStorageState(room: string, state: string): Promise<void> {\n if (!this._initialized) return;\n if (!this._state) return;\n\n await this._initialized;\n\n this._state.storage.sql.exec(\n sql`\n INSERT INTO ${SQLITE_STORAGE_TABLE}(room, data) VALUES (?, ?)\n ON CONFLICT(room) DO UPDATE SET data = excluded.data;\n `,\n room,\n state,\n );\n }\n}\n"],"mappings":";;AAAA,MAAa,cAAc,UAAuB;CAC9C,OAAO,OAA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X;EACJ,mBAAG,IAAI,IAA+B,CAAC;CAC3C;CAEA,MAAa,aAAa,MAA+B;EACrD,IAAI,CAAC,KAAK,cAAc,OAAO;EAC/B,IAAI,CAAC,KAAK,QAAQ,OAAO;EAEzB,MAAM,KAAK;EAEX,MAAM,SAAS,KAAK,OAAO,QAAQ,IAAI,KACnC,GAAG;;uBAEQ,kBAAkB;;eAG7B,IACJ;EAEA,IAAI;GACA,MAAM,SAAS,OAAO,IAAI;GAE1B,OAAO,WAAW,OAAO,KAAK;EAClC,QAAQ;GACJ,OAAO;EACX;CACJ;CAEA,WAAkB,aAAyD;EACvE,MAAM,EAAE,UAAU;EAElB,MAAM,eAAe,YAAY;GAC7B,MAAM,QAAQ,IAAI,KAAK,GAAG;6CACO,qBAAqB;;;;6CAIrB,kBAAkB;;;;;6CAKlB,kBAAkB,WAAW,kBAAkB;aAC/E;GAED,OAAO;EACX,EAAA,CAAG;EAEH,OAAO,IAAI,0CAA0C;GACjD,cAAc;GACd,QAAQ;EACZ,CAAC;CACL;CAEA,MAAa,gBAAgB,MAAc,OAA8B;EACrE,IAAI,CAAC,KAAK,cAAc;EACxB,IAAI,CAAC,KAAK,QAAQ;EAElB,MAAM,KAAK;EAEX,KAAK,OAAO,QAAQ,IAAI,KACpB,GAAG;8BACe,qBAAqB;;eAGvC,MACA,KACJ;CACJ;AACJ"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pluv/persistence-cloudflare-transactional-storage",
|
|
3
|
+
"version": "0.0.0-canary-20261027022227",
|
|
4
|
+
"description": "@pluv/io crdt storage persistence for cloudflare via transactional storage",
|
|
5
|
+
"author": {
|
|
6
|
+
"email": "david@pluv.io",
|
|
7
|
+
"name": "i3dly",
|
|
8
|
+
"url": "https://github.com/i3dly"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"homepage": "https://github.com/pluv-io/pluv",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/pluv-io/pluv.git",
|
|
15
|
+
"directory": "packages/persistence-cloudflare-transactional-storage"
|
|
16
|
+
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"types": "./dist/index.d.mts",
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@pluv/io": "^0.0.0-canary-20261027022227",
|
|
27
|
+
"@pluv/types": "^0.0.0-canary-20261027022227"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@cloudflare/workers-types": "^5.20261025.1",
|
|
31
|
+
"@pluv/tsconfig": "^0.0.0-canary-20261027022227",
|
|
32
|
+
"tsdown": "^0.23.2",
|
|
33
|
+
"typescript": "7.1.0-beta"
|
|
34
|
+
},
|
|
35
|
+
"exports": {
|
|
36
|
+
".": "./dist/index.mjs",
|
|
37
|
+
"./*": "./*"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsdown",
|
|
41
|
+
"dev": "tsdown --watch",
|
|
42
|
+
"typecheck": "tsc --noEmit",
|
|
43
|
+
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
44
|
+
}
|
|
45
|
+
}
|