@pluv/platform-cloudflare 0.34.1 → 0.35.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @pluv/platform-cloudflare@0.34.1 build /home/runner/work/pluv/pluv/packages/platform-cloudflare
2
+ > @pluv/platform-cloudflare@0.35.1 build /home/runner/work/pluv/pluv/packages/platform-cloudflare
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,11 +8,11 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- CJS dist/index.js 13.20 KB
12
- CJS ⚡️ Build success in 73ms
13
- ESM dist/index.mjs 12.09 KB
14
- ESM ⚡️ Build success in 74ms
11
+ CJS dist/index.js 13.18 KB
12
+ CJS ⚡️ Build success in 69ms
13
+ ESM dist/index.mjs 12.07 KB
14
+ ESM ⚡️ Build success in 69ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 811ms
17
- DTS dist/index.d.mts 5.39 KB
18
- DTS dist/index.d.ts 5.39 KB
16
+ DTS ⚡️ Build success in 1082ms
17
+ DTS dist/index.d.mts 5.31 KB
18
+ DTS dist/index.d.ts 5.31 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @pluv/platform-cloudflare
2
2
 
3
+ ## 0.35.1
4
+
5
+ ### Patch Changes
6
+
7
+ - @pluv/io@0.35.1
8
+ - @pluv/persistence-cloudflare-transactional-storage@0.35.1
9
+ - @pluv/types@0.35.1
10
+
11
+ ## 0.35.0
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [c9073ad]
16
+ - @pluv/io@0.35.0
17
+ - @pluv/persistence-cloudflare-transactional-storage@0.35.0
18
+ - @pluv/types@0.35.0
19
+
3
20
  ## 0.34.1
4
21
 
5
22
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AbstractWebSocket, WebSocketSerializedState, AbstractEventMap, AbstractListener, AbstractWebSocketConfig, AbstractPlatformConfig, WebSocketRegistrationMode, AbstractPlatform, ConvertWebSocketConfig, PluvServer, InferInitContextType } from '@pluv/io';
2
- import { JsonObject, Json, MaybePromise, Maybe, InferIOAuthorizeUser, InferIOAuthorize, InferIOAuthorizeRequired, Id } from '@pluv/types';
2
+ import { JsonObject, Json, MaybePromise, Maybe, InferIOAuthorizeUser, InferIOAuthorize, Id } from '@pluv/types';
3
3
 
4
4
  type CloudflareWebSocketConfig = AbstractWebSocketConfig;
5
5
  declare class CloudflareWebSocket extends AbstractWebSocket<WebSocket> {
@@ -31,7 +31,7 @@ declare class CloudflarePlatform<TEnv extends Record<string, any> = {}, TMeta ex
31
31
  request: Request;
32
32
  }, CloudflarePlatformRoomContext<TEnv, TMeta>, {
33
33
  authorize: {
34
- required: true;
34
+ secret: true;
35
35
  };
36
36
  handleMode: "io";
37
37
  requireAuth: false;
@@ -46,7 +46,6 @@ declare class CloudflarePlatform<TEnv extends Record<string, any> = {}, TMeta ex
46
46
  }> {
47
47
  readonly _config: {
48
48
  authorize: {
49
- required: true;
50
49
  secret: true;
51
50
  };
52
51
  handleMode: "io";
@@ -84,10 +83,10 @@ type CreatePluvHandlerConfig<TPluvServer extends PluvServer<CloudflarePlatform,
84
83
  endpoint?: string;
85
84
  modify?: (request: Request, response: Response, env: TEnv) => MaybePromise<Response>;
86
85
  io: TPluvServer;
87
- } & (InferIOAuthorizeRequired<InferIOAuthorize<TPluvServer>> extends true ? {
88
- authorize: AuthorizeFunction<TPluvServer>;
89
- } : {
86
+ } & (InferIOAuthorize<TPluvServer> extends null ? {
90
87
  authorize?: undefined;
88
+ } : {
89
+ authorize: AuthorizeFunction<TPluvServer>;
91
90
  });
92
91
  type PluvHandlerFetch<TEnv extends Record<string, any> = {}> = (request: Request, env: TEnv) => Promise<Response | null>;
93
92
  interface CreatePluvHandlerResult<TEnv extends Record<string, any> = {}> {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AbstractWebSocket, WebSocketSerializedState, AbstractEventMap, AbstractListener, AbstractWebSocketConfig, AbstractPlatformConfig, WebSocketRegistrationMode, AbstractPlatform, ConvertWebSocketConfig, PluvServer, InferInitContextType } from '@pluv/io';
2
- import { JsonObject, Json, MaybePromise, Maybe, InferIOAuthorizeUser, InferIOAuthorize, InferIOAuthorizeRequired, Id } from '@pluv/types';
2
+ import { JsonObject, Json, MaybePromise, Maybe, InferIOAuthorizeUser, InferIOAuthorize, Id } from '@pluv/types';
3
3
 
4
4
  type CloudflareWebSocketConfig = AbstractWebSocketConfig;
5
5
  declare class CloudflareWebSocket extends AbstractWebSocket<WebSocket> {
@@ -31,7 +31,7 @@ declare class CloudflarePlatform<TEnv extends Record<string, any> = {}, TMeta ex
31
31
  request: Request;
32
32
  }, CloudflarePlatformRoomContext<TEnv, TMeta>, {
33
33
  authorize: {
34
- required: true;
34
+ secret: true;
35
35
  };
36
36
  handleMode: "io";
37
37
  requireAuth: false;
@@ -46,7 +46,6 @@ declare class CloudflarePlatform<TEnv extends Record<string, any> = {}, TMeta ex
46
46
  }> {
47
47
  readonly _config: {
48
48
  authorize: {
49
- required: true;
50
49
  secret: true;
51
50
  };
52
51
  handleMode: "io";
@@ -84,10 +83,10 @@ type CreatePluvHandlerConfig<TPluvServer extends PluvServer<CloudflarePlatform,
84
83
  endpoint?: string;
85
84
  modify?: (request: Request, response: Response, env: TEnv) => MaybePromise<Response>;
86
85
  io: TPluvServer;
87
- } & (InferIOAuthorizeRequired<InferIOAuthorize<TPluvServer>> extends true ? {
88
- authorize: AuthorizeFunction<TPluvServer>;
89
- } : {
86
+ } & (InferIOAuthorize<TPluvServer> extends null ? {
90
87
  authorize?: undefined;
88
+ } : {
89
+ authorize: AuthorizeFunction<TPluvServer>;
91
90
  });
92
91
  type PluvHandlerFetch<TEnv extends Record<string, any> = {}> = (request: Request, env: TEnv) => Promise<Response | null>;
93
92
  interface CreatePluvHandlerResult<TEnv extends Record<string, any> = {}> {
package/dist/index.js CHANGED
@@ -264,7 +264,6 @@ var CloudflarePlatform = class _CloudflarePlatform extends import_io2.AbstractPl
264
264
  this._name = "platformCloudflare";
265
265
  this._config = {
266
266
  authorize: {
267
- required: true,
268
267
  secret: true
269
268
  },
270
269
  handleMode: "io",
package/dist/index.mjs CHANGED
@@ -240,7 +240,6 @@ var CloudflarePlatform = class _CloudflarePlatform extends AbstractPlatform {
240
240
  this._name = "platformCloudflare";
241
241
  this._config = {
242
242
  authorize: {
243
- required: true,
244
243
  secret: true
245
244
  },
246
245
  handleMode: "io",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/platform-cloudflare",
3
- "version": "0.34.1",
3
+ "version": "0.35.1",
4
4
  "description": "@pluv/io adapter for cloudflare workers",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -18,17 +18,17 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "path-to-regexp": "^8.2.0",
21
- "@pluv/io": "^0.34.1",
22
- "@pluv/persistence-cloudflare-transactional-storage": "^0.34.1",
23
- "@pluv/types": "^0.34.1"
21
+ "@pluv/io": "^0.35.1",
22
+ "@pluv/persistence-cloudflare-transactional-storage": "^0.35.1",
23
+ "@pluv/types": "^0.35.1"
24
24
  },
25
25
  "devDependencies": {
26
- "@cloudflare/workers-types": "^4.20241224.0",
26
+ "@cloudflare/workers-types": "^4.20250121.0",
27
27
  "eslint": "^8.57.1",
28
28
  "tsup": "^8.3.5",
29
- "typescript": "^5.7.2",
30
- "@pluv/tsconfig": "^0.34.1",
31
- "eslint-config-pluv": "^0.34.1"
29
+ "typescript": "^5.7.3",
30
+ "@pluv/tsconfig": "^0.35.1",
31
+ "eslint-config-pluv": "^0.35.1"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "tsup src/index.ts --format esm,cjs --dts",
@@ -29,7 +29,7 @@ export class CloudflarePlatform<
29
29
  CloudflarePlatformRoomContext<TEnv, TMeta>,
30
30
  {
31
31
  authorize: {
32
- required: true;
32
+ secret: true;
33
33
  };
34
34
  handleMode: "io";
35
35
  requireAuth: false;
@@ -56,7 +56,6 @@ export class CloudflarePlatform<
56
56
 
57
57
  this._config = {
58
58
  authorize: {
59
- required: true as const,
60
59
  secret: true as const,
61
60
  },
62
61
  handleMode: "io" as const,
@@ -1,12 +1,5 @@
1
1
  import type { InferInitContextType, IORoom, PluvServer } from "@pluv/io";
2
- import type {
3
- Id,
4
- InferIOAuthorize,
5
- InferIOAuthorizeRequired,
6
- InferIOAuthorizeUser,
7
- Maybe,
8
- MaybePromise,
9
- } from "@pluv/types";
2
+ import type { Id, InferIOAuthorize, InferIOAuthorizeUser, Maybe, MaybePromise } from "@pluv/types";
10
3
  import { match } from "path-to-regexp";
11
4
  import { CloudflarePlatform } from "./CloudflarePlatform";
12
5
 
@@ -25,9 +18,9 @@ export type CreatePluvHandlerConfig<
25
18
  endpoint?: string;
26
19
  modify?: (request: Request, response: Response, env: TEnv) => MaybePromise<Response>;
27
20
  io: TPluvServer;
28
- } & (InferIOAuthorizeRequired<InferIOAuthorize<TPluvServer>> extends true
29
- ? { authorize: AuthorizeFunction<TPluvServer> }
30
- : { authorize?: undefined });
21
+ } & (InferIOAuthorize<TPluvServer> extends null
22
+ ? { authorize?: undefined }
23
+ : { authorize: AuthorizeFunction<TPluvServer> });
31
24
 
32
25
  export type PluvHandlerFetch<TEnv extends Record<string, any> = {}> = (
33
26
  request: Request,
@@ -139,7 +132,7 @@ export const createPluvHandler = <TPluvServer extends PluvServer<CloudflarePlatf
139
132
  const token = await io.createToken({
140
133
  env,
141
134
  room: durableObjectId.toString(),
142
- user,
135
+ user: user as any,
143
136
  request,
144
137
  });
145
138