@pluv/platform-cloudflare 0.41.7 → 0.43.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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +39 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +12 -10
- package/package.json +8 -8
- package/src/CloudflarePlatform.ts +11 -9
- package/src/createPluvHandler.ts +4 -0
- package/src/platformCloudflare.ts +2 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/platform-cloudflare@0.
|
|
2
|
+
> @pluv/platform-cloudflare@0.43.0 build /home/runner/work/pluv/pluv/packages/platform-cloudflare
|
|
3
3
|
> tsup src/index.ts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
[34mCLI[39m Using tsup config: /home/runner/work/pluv/pluv/packages/platform-cloudflare/tsup.config.ts
|
|
9
9
|
[34mCLI[39m Target: es6
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m13.
|
|
12
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m13.91 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 50ms
|
|
13
13
|
[34mDTS[39m Build start
|
|
14
|
-
[32mDTS[39m ⚡️ Build success in
|
|
15
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m7.
|
|
14
|
+
[32mDTS[39m ⚡️ Build success in 1206ms
|
|
15
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m7.31 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# @pluv/platform-cloudflare
|
|
2
2
|
|
|
3
|
+
## 0.43.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 29fe3fc: Update `platformNode` and `platformCloudflare` to be able to configure limits for `PluvIO` (when self-hosted).
|
|
8
|
+
- Updated dependencies [e60a677]
|
|
9
|
+
- Updated dependencies [0063e80]
|
|
10
|
+
- Updated dependencies [244a973]
|
|
11
|
+
- Updated dependencies [4b0fbb3]
|
|
12
|
+
- @pluv/io@0.43.0
|
|
13
|
+
- @pluv/persistence-cloudflare-transactional-storage@0.43.0
|
|
14
|
+
- @pluv/types@0.43.0
|
|
15
|
+
|
|
16
|
+
## 0.42.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 5c2c71d: **BREAKING** Updated the `PersistenceCloudflareTransactionalStorage` constructor so require a new property `mode` (either `kv` or `sqlite`). `sqlite` makes use of `DurableObject` SQLite storage, and `kv` makes use of their key-value storage. `platformCloudflare` now sets the underlying `PersistenceCloudflareTransactionalStorage` to use the `sqlite` mode by default (was previously using `kv`). For more information on the differences, please refer to [Cloudflare's documentation](https://developers.cloudflare.com/durable-objects/api/storage-api/#sql-api).
|
|
21
|
+
|
|
22
|
+
To continue using the `kv` mode, you will need to install `@pluv/persistence-cloudflare-transactional-storage` and provide it manually to `platformCloudflare` with your desired mode.
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
platformCloudflare({
|
|
26
|
+
// ...
|
|
27
|
+
persistence: new PersistenceCloudflareTransactionalStorage({ mode: "kv" }),
|
|
28
|
+
// ...
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- a47e171: Deprecated `createPluvHandler`. Instead, documentation will be provided on how to host pluv.io yourself on Node.js and Cloudflare Workers.
|
|
35
|
+
- Updated dependencies [5c2c71d]
|
|
36
|
+
- Updated dependencies [4ce32ee]
|
|
37
|
+
- Updated dependencies [cf1529a]
|
|
38
|
+
- @pluv/persistence-cloudflare-transactional-storage@0.42.0
|
|
39
|
+
- @pluv/io@0.42.0
|
|
40
|
+
- @pluv/types@0.42.0
|
|
41
|
+
|
|
3
42
|
## 0.41.7
|
|
4
43
|
|
|
5
44
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -102,6 +102,10 @@ interface CreatePluvHandlerResult<TEnv extends Record<string, any> = {}> {
|
|
|
102
102
|
handler: ExportedHandler<TEnv>;
|
|
103
103
|
}
|
|
104
104
|
type InferCloudflarePluvHandlerEnv<TPluvServer extends PluvServer<CloudflarePlatform<any, any>, any, any, any>> = TPluvServer extends PluvServer<CloudflarePlatform<any, infer IEnv>, any, any, any> ? IEnv : {};
|
|
105
|
+
/**
|
|
106
|
+
* @deprecated Instructions will be provided on https://pluv.io on how to host this yourself instead.
|
|
107
|
+
* @date April 27, 2025
|
|
108
|
+
*/
|
|
105
109
|
declare const createPluvHandler: <TPluvServer extends PluvServer<CloudflarePlatform<any, any>, any, any, any>>(config: CreatePluvHandlerConfig<TPluvServer, Id<InferCloudflarePluvHandlerEnv<TPluvServer>>>) => CreatePluvHandlerResult<Id<InferCloudflarePluvHandlerEnv<TPluvServer>>>;
|
|
106
110
|
|
|
107
111
|
declare const identity: <T extends unknown>(x: T) => T;
|
package/dist/index.mjs
CHANGED
|
@@ -274,7 +274,7 @@ var CloudflareWebSocket = class extends AbstractWebSocket {
|
|
|
274
274
|
var CloudflarePlatform = class _CloudflarePlatform extends AbstractPlatform {
|
|
275
275
|
constructor(config) {
|
|
276
276
|
var _a;
|
|
277
|
-
super(__spreadValues(__spreadValues({}, config), config.roomContext && config.mode === "detached" ? { persistence: new PersistenceCloudflareTransactionalStorage(
|
|
277
|
+
super(__spreadValues(__spreadValues({}, config), config.roomContext && config.mode === "detached" ? { persistence: new PersistenceCloudflareTransactionalStorage({ mode: "sqlite" }) } : {}));
|
|
278
278
|
this._name = "platformCloudflare";
|
|
279
279
|
this._config = {
|
|
280
280
|
authorize: {
|
|
@@ -340,16 +340,17 @@ var CloudflarePlatform = class _CloudflarePlatform extends AbstractPlatform {
|
|
|
340
340
|
}
|
|
341
341
|
initialize(config) {
|
|
342
342
|
var _a;
|
|
343
|
-
const
|
|
344
|
-
if (!
|
|
343
|
+
const ctx = (_a = config.roomContext) != null ? _a : __spreadValues({}, this._roomContext);
|
|
344
|
+
if (!ctx.env || !ctx.state) throw new Error("Could not derive platform roomContext");
|
|
345
|
+
const roomContext = {
|
|
346
|
+
env: ctx.env,
|
|
347
|
+
meta: ctx.meta,
|
|
348
|
+
state: ctx.state
|
|
349
|
+
};
|
|
345
350
|
return new _CloudflarePlatform({
|
|
346
|
-
roomContext
|
|
347
|
-
env: roomContext.env,
|
|
348
|
-
meta: roomContext.meta,
|
|
349
|
-
state: roomContext.state
|
|
350
|
-
},
|
|
351
|
+
roomContext,
|
|
351
352
|
mode: this._config.registrationMode,
|
|
352
|
-
persistence: this.persistence,
|
|
353
|
+
persistence: this.persistence.initialize(roomContext),
|
|
353
354
|
pubSub: this.pubSub
|
|
354
355
|
})._initialize();
|
|
355
356
|
}
|
|
@@ -377,12 +378,13 @@ var CloudflarePlatform = class _CloudflarePlatform extends AbstractPlatform {
|
|
|
377
378
|
|
|
378
379
|
// src/platformCloudflare.ts
|
|
379
380
|
var platformCloudflare = (config = {}) => {
|
|
380
|
-
const { authorize, context, crdt, debug } = config;
|
|
381
|
+
const { authorize, context, crdt, debug, limits } = config;
|
|
381
382
|
return {
|
|
382
383
|
authorize,
|
|
383
384
|
context,
|
|
384
385
|
crdt,
|
|
385
386
|
debug,
|
|
387
|
+
limits,
|
|
386
388
|
platform: new CloudflarePlatform(config)
|
|
387
389
|
};
|
|
388
390
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/platform-cloudflare",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
4
4
|
"description": "@pluv/io adapter for cloudflare workers",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"path-to-regexp": "^8.2.0",
|
|
20
|
-
"@pluv/io": "^0.
|
|
21
|
-
"@pluv/persistence-cloudflare-transactional-storage": "^0.
|
|
22
|
-
"@pluv/types": "^0.
|
|
20
|
+
"@pluv/io": "^0.43.0",
|
|
21
|
+
"@pluv/persistence-cloudflare-transactional-storage": "^0.43.0",
|
|
22
|
+
"@pluv/types": "^0.43.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@cloudflare/workers-types": "^4.
|
|
26
|
-
"eslint": "^9.25.
|
|
25
|
+
"@cloudflare/workers-types": "^4.20250428.0",
|
|
26
|
+
"eslint": "^9.25.1",
|
|
27
27
|
"tsup": "^8.4.0",
|
|
28
28
|
"typescript": "^5.8.3",
|
|
29
|
-
"@pluv/tsconfig": "^0.
|
|
30
|
-
"eslint-config-pluv": "^0.
|
|
29
|
+
"@pluv/tsconfig": "^0.43.0",
|
|
30
|
+
"eslint-config-pluv": "^0.43.0"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "tsup src/index.ts",
|
|
@@ -52,7 +52,7 @@ export class CloudflarePlatform<
|
|
|
52
52
|
super({
|
|
53
53
|
...config,
|
|
54
54
|
...(config.roomContext && config.mode === "detached"
|
|
55
|
-
? { persistence: new PersistenceCloudflareTransactionalStorage(
|
|
55
|
+
? { persistence: new PersistenceCloudflareTransactionalStorage({ mode: "sqlite" }) }
|
|
56
56
|
: {}),
|
|
57
57
|
});
|
|
58
58
|
|
|
@@ -136,18 +136,20 @@ export class CloudflarePlatform<
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
public initialize(config: AbstractPlatformConfig<CloudflarePlatformRoomContext<TEnv, TMeta>>): this {
|
|
139
|
-
const
|
|
139
|
+
const ctx = config.roomContext ?? { ...this._roomContext };
|
|
140
140
|
|
|
141
|
-
if (!
|
|
141
|
+
if (!ctx.env || !ctx.state) throw new Error("Could not derive platform roomContext");
|
|
142
|
+
|
|
143
|
+
const roomContext = {
|
|
144
|
+
env: ctx.env,
|
|
145
|
+
meta: ctx.meta,
|
|
146
|
+
state: ctx.state,
|
|
147
|
+
} as CloudflarePlatformRoomContext<TEnv, TMeta>;
|
|
142
148
|
|
|
143
149
|
return new CloudflarePlatform<TAuthorize, TEnv, TMeta>({
|
|
144
|
-
roomContext
|
|
145
|
-
env: roomContext.env,
|
|
146
|
-
meta: roomContext.meta,
|
|
147
|
-
state: roomContext.state,
|
|
148
|
-
} as CloudflarePlatformRoomContext<TEnv, TMeta>,
|
|
150
|
+
roomContext,
|
|
149
151
|
mode: this._config.registrationMode,
|
|
150
|
-
persistence: this.persistence,
|
|
152
|
+
persistence: this.persistence.initialize(roomContext),
|
|
151
153
|
pubSub: this.pubSub,
|
|
152
154
|
})._initialize() as this;
|
|
153
155
|
}
|
package/src/createPluvHandler.ts
CHANGED
|
@@ -40,6 +40,10 @@ export interface CreatePluvHandlerResult<TEnv extends Record<string, any> = {}>
|
|
|
40
40
|
type InferCloudflarePluvHandlerEnv<TPluvServer extends PluvServer<CloudflarePlatform<any, any>, any, any, any>> =
|
|
41
41
|
TPluvServer extends PluvServer<CloudflarePlatform<any, infer IEnv>, any, any, any> ? IEnv : {};
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Instructions will be provided on https://pluv.io on how to host this yourself instead.
|
|
45
|
+
* @date April 27, 2025
|
|
46
|
+
*/
|
|
43
47
|
export const createPluvHandler = <TPluvServer extends PluvServer<CloudflarePlatform<any, any>, any, any, any>>(
|
|
44
48
|
config: CreatePluvHandlerConfig<TPluvServer, Id<InferCloudflarePluvHandlerEnv<TPluvServer>>>,
|
|
45
49
|
): CreatePluvHandlerResult<Id<InferCloudflarePluvHandlerEnv<TPluvServer>>> => {
|
|
@@ -33,13 +33,14 @@ export const platformCloudflare = <
|
|
|
33
33
|
>(
|
|
34
34
|
config: PlatformCloudflareCreateIOParams<TEnv, TMeta, TContext, TUser> = {},
|
|
35
35
|
): CreateIOParams<CloudflarePlatform<IOAuthorize<TUser, TContext>, TEnv, TMeta>, TContext, TUser> => {
|
|
36
|
-
const { authorize, context, crdt, debug } = config;
|
|
36
|
+
const { authorize, context, crdt, debug, limits } = config;
|
|
37
37
|
|
|
38
38
|
return {
|
|
39
39
|
authorize,
|
|
40
40
|
context,
|
|
41
41
|
crdt,
|
|
42
42
|
debug,
|
|
43
|
+
limits,
|
|
43
44
|
platform: new CloudflarePlatform<IOAuthorize<TUser, TContext>, TEnv, TMeta>(config),
|
|
44
45
|
};
|
|
45
46
|
};
|