@pluv/platform-cloudflare 0.16.3 → 0.17.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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +63 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +9 -9
- package/src/createPluvHandler.ts +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/platform-cloudflare@0.
|
|
2
|
+
> @pluv/platform-cloudflare@0.17.1 build /home/runner/work/pluv/pluv/packages/platform-cloudflare
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m6.94 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 91ms
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m5.81 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 91ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 3362ms
|
|
17
17
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m2.94 KB[39m
|
|
18
18
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m2.94 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,68 @@
|
|
|
1
1
|
# @pluv/platform-cloudflare
|
|
2
2
|
|
|
3
|
+
## 0.17.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @pluv/io@0.17.1
|
|
8
|
+
- @pluv/types@0.17.1
|
|
9
|
+
|
|
10
|
+
## 0.17.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 507bc00: _BREAKING_: The `authorize` config when calling `createIO` can now also be a function that exposes the platform context.
|
|
15
|
+
This allows accessing the `env` in Cloudflare workers.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { createIO } from "@pluv/io";
|
|
19
|
+
import { platformCloudflare } from "@pluv/platform-cloudflare";
|
|
20
|
+
import { z } from "zod";
|
|
21
|
+
|
|
22
|
+
const io = createIO({
|
|
23
|
+
authorize: ({ env }) => ({
|
|
24
|
+
required: true,
|
|
25
|
+
secret: env.PLUV_AUTHORIZE_SECRET,
|
|
26
|
+
user: z.object({
|
|
27
|
+
id: z.string(),
|
|
28
|
+
name: z.string(),
|
|
29
|
+
}),
|
|
30
|
+
}),
|
|
31
|
+
platform: platformCloudflare<{ PLUV_AUTHORIZE_SECRET: string }>(),
|
|
32
|
+
// ...
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This also requires that the platform contexts are passed to `io.createToken`.
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
// If using `platformNode`
|
|
40
|
+
await io.createToken({
|
|
41
|
+
req, // This `IncomingMessage` is now required
|
|
42
|
+
room,
|
|
43
|
+
user: {
|
|
44
|
+
id: "user_123",
|
|
45
|
+
name: "john doe",
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// If using `platformCloudflare`
|
|
50
|
+
await io.createToken({
|
|
51
|
+
env, // This env is now required from the handler's fetch function
|
|
52
|
+
room,
|
|
53
|
+
user: {
|
|
54
|
+
id: "user_123",
|
|
55
|
+
name: "john doe",
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- Updated dependencies [507bc00]
|
|
63
|
+
- @pluv/types@0.17.0
|
|
64
|
+
- @pluv/io@0.17.0
|
|
65
|
+
|
|
3
66
|
## 0.16.3
|
|
4
67
|
|
|
5
68
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -106,6 +106,7 @@ var createPluvHandler = (config) => {
|
|
|
106
106
|
const namespace = getDurableObjectNamespace(env);
|
|
107
107
|
const durableObjectId = namespace.idFromName(roomId);
|
|
108
108
|
const token = yield io.createToken({
|
|
109
|
+
env,
|
|
109
110
|
room: durableObjectId.toString(),
|
|
110
111
|
user
|
|
111
112
|
});
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/platform-cloudflare",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "@pluv/io adapter for cloudflare workers",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"path-to-regexp": "^6.2.
|
|
21
|
-
"@pluv/io": "^0.
|
|
22
|
-
"@pluv/types": "^0.
|
|
20
|
+
"path-to-regexp": "^6.2.2",
|
|
21
|
+
"@pluv/io": "^0.17.1",
|
|
22
|
+
"@pluv/types": "^0.17.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@cloudflare/workers-types": "^4.
|
|
26
|
-
"eslint": "^8.
|
|
25
|
+
"@cloudflare/workers-types": "^4.20240405.0",
|
|
26
|
+
"eslint": "^8.57.0",
|
|
27
27
|
"tsup": "^8.0.2",
|
|
28
|
-
"typescript": "^5.
|
|
29
|
-
"@pluv/tsconfig": "^0.
|
|
30
|
-
"eslint-config-pluv": "^0.
|
|
28
|
+
"typescript": "^5.4.5",
|
|
29
|
+
"@pluv/tsconfig": "^0.17.1",
|
|
30
|
+
"eslint-config-pluv": "^0.17.1"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|