@pluv/platform-node 0.35.4 → 0.37.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.
@@ -1,18 +1,18 @@
1
1
 
2
- > @pluv/platform-node@0.35.4 build /home/runner/work/pluv/pluv/packages/platform-node
2
+ > @pluv/platform-node@0.37.0 build /home/runner/work/pluv/pluv/packages/platform-node
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.3.6
7
+ CLI tsup v8.4.0
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- CJS dist/index.js 10.26 KB
12
- CJS ⚡️ Build success in 82ms
13
- ESM dist/index.mjs 8.50 KB
14
- ESM ⚡️ Build success in 82ms
11
+ CJS dist/index.js 10.50 KB
12
+ CJS ⚡️ Build success in 90ms
13
+ ESM dist/index.mjs 8.72 KB
14
+ ESM ⚡️ Build success in 91ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 5431ms
17
- DTS dist/index.d.mts 4.83 KB
18
- DTS dist/index.d.ts 4.83 KB
16
+ DTS ⚡️ Build success in 5483ms
17
+ DTS dist/index.d.mts 5.89 KB
18
+ DTS dist/index.d.ts 5.89 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,71 @@
1
1
  # @pluv/platform-node
2
2
 
3
+ ## 0.37.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5165be0: **BREAKING**
8
+
9
+ Updated the `platformNode` function to return an entire `createIO` input object. Now `createIO` must be called with `platformNode`'s return value as an input.
10
+
11
+ ```ts
12
+ // Before
13
+
14
+ import { createIO } from "@pluv/io";
15
+ import { platformNode } from "@pluv/platform-node";
16
+
17
+ export const io = createIO({
18
+ authorize: {
19
+ // ...
20
+ },
21
+ context: {
22
+ // ...
23
+ },
24
+ platform: platformNode<Meta>({
25
+ // ...
26
+ }),
27
+ // ...
28
+ });
29
+
30
+ // After
31
+
32
+ import { createIO } from "@pluv/io";
33
+ import { infer, platformNode } from "@pluv/platform-node";
34
+
35
+ // Types must now be inferred like so, due to TypeScript limitations around partial inferences
36
+ // Note that this types variable is defined outside of the `createIO` function
37
+ const types = infer((i) => ({
38
+ meta: i<Meta>,
39
+ }));
40
+ export const io = createIO(
41
+ platformNode({
42
+ authorize: {
43
+ // ...
44
+ },
45
+ context: {
46
+ // ...
47
+ },
48
+ // Optional: Pass inferred types here
49
+ types,
50
+ // ...
51
+ }),
52
+ );
53
+ ```
54
+
55
+ ### Patch Changes
56
+
57
+ - 9b74abb: Improved type inference when calling `PluvIO.server` to not include options that are always undefined (i.e. are not allowed by the specified platform).
58
+ - Updated dependencies [9b74abb]
59
+ - @pluv/io@0.37.0
60
+ - @pluv/types@0.37.0
61
+
62
+ ## 0.36.0
63
+
64
+ ### Patch Changes
65
+
66
+ - @pluv/io@0.36.0
67
+ - @pluv/types@0.36.0
68
+
3
69
  ## 0.35.4
4
70
 
5
71
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { WebSocket, Server as Server$1 } from 'ws';
2
2
  export { WebSocket } from 'ws';
3
- import { AbstractWebSocket, WebSocketSerializedState, AbstractWebSocketConfig, AbstractEventMap, AbstractListener, AbstractPlatform, WebSocketRegistrationMode, AbstractPersistence, AbstractPubSub, ConvertWebSocketConfig, AbstractPlatformConfig, PluvServer, InferInitContextType } from '@pluv/io';
4
- import { JsonObject, Json, InferIOAuthorizeUser, InferIOAuthorize, BaseUser, MaybePromise, Maybe } from '@pluv/types';
3
+ import { AbstractWebSocket, WebSocketSerializedState, AbstractWebSocketConfig, AbstractEventMap, AbstractListener, AbstractPlatform, WebSocketRegistrationMode, AbstractPersistence, AbstractPubSub, ConvertWebSocketConfig, AbstractPlatformConfig, PluvServer, InferInitContextType, CreateIOParams, PluvIOAuthorize, PluvContext } from '@pluv/io';
4
+ import { JsonObject, Json, InferIOAuthorizeUser, InferIOAuthorize, BaseUser, MaybePromise, Maybe, Id } from '@pluv/types';
5
5
  import { IncomingMessage, Server, ServerResponse } from 'node:http';
6
6
 
7
7
  type NodeWebSocketConfig = AbstractWebSocketConfig;
@@ -34,7 +34,7 @@ type NodePlatformConfig<TMeta extends Record<string, Json>> = {
34
34
  persistence: AbstractPersistence;
35
35
  pubSub: AbstractPubSub;
36
36
  }) & {
37
- context?: NodePlatformRoomContext<TMeta>;
37
+ roomContext?: NodePlatformRoomContext<TMeta>;
38
38
  };
39
39
  declare class NodePlatform<TMeta extends Record<string, Json> = {}> extends AbstractPlatform<NodeWebSocket, {
40
40
  req: IncomingMessage;
@@ -52,6 +52,7 @@ declare class NodePlatform<TMeta extends Record<string, Json> = {}> extends Abst
52
52
  onUserConnected: true;
53
53
  onUserDisconnected: true;
54
54
  };
55
+ router: true;
55
56
  }> {
56
57
  readonly _config: {
57
58
  authorize: {
@@ -67,6 +68,7 @@ declare class NodePlatform<TMeta extends Record<string, Json> = {}> extends Abst
67
68
  onUserConnected: true;
68
69
  onUserDisconnected: true;
69
70
  };
71
+ router: true;
70
72
  };
71
73
  readonly _name = "platformNode";
72
74
  constructor(config?: NodePlatformConfig<TMeta>);
@@ -107,6 +109,18 @@ interface CreatePluvHandlerResult {
107
109
  }
108
110
  declare const createPluvHandler: <TPluvServer extends PluvServer<NodePlatform, any, any, any>>(config: CreatePluvHandlerConfig<TPluvServer>) => CreatePluvHandlerResult;
109
111
 
110
- declare const platformNode: <TMeta extends Record<string, Json> = {}>(config?: NodePlatformConfig<TMeta>) => NodePlatform<TMeta>;
112
+ declare const identity: <T extends unknown>(x: T) => T;
111
113
 
112
- export { type AuthorizeFunction, type AuthorizeFunctionContext, type CreatePluvHandlerConfig, NodePlatform, type NodePlatformConfig, createPluvHandler, platformNode };
114
+ type InferCallback<TMeta extends Record<string, Json> = {}> = (i: typeof identity) => {
115
+ meta?: (io: TMeta) => TMeta;
116
+ };
117
+ declare const infer: <TMeta extends Record<string, Json> = {}>(callback: InferCallback<TMeta>) => InferCallback<TMeta>;
118
+
119
+ type PlatformNodeCreateIOParams<TMeta extends Record<string, Json> = {}, TContext extends Record<string, any> = {}, TUser extends BaseUser | null = null> = Id<NodePlatformConfig<TMeta> & Omit<CreateIOParams<NodePlatform<TMeta>, TContext, TUser>, "authorize" | "context" | "platform"> & {
120
+ authorize?: PluvIOAuthorize<NodePlatform<TMeta>, TUser, InferInitContextType<NodePlatform<TMeta>>>;
121
+ context?: PluvContext<NodePlatform<TMeta>, TContext>;
122
+ types?: InferCallback<TMeta>;
123
+ }>;
124
+ declare const platformNode: <TMeta extends Record<string, Json> = {}, TContext extends Record<string, any> = {}, TUser extends BaseUser | null = null>(config?: PlatformNodeCreateIOParams<TMeta, TContext, TUser>) => CreateIOParams<NodePlatform<TMeta>, TContext, TUser>;
125
+
126
+ export { type AuthorizeFunction, type AuthorizeFunctionContext, type CreatePluvHandlerConfig, type InferCallback, NodePlatform, type NodePlatformConfig, type PlatformNodeCreateIOParams, createPluvHandler, infer, platformNode };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { WebSocket, Server as Server$1 } from 'ws';
2
2
  export { WebSocket } from 'ws';
3
- import { AbstractWebSocket, WebSocketSerializedState, AbstractWebSocketConfig, AbstractEventMap, AbstractListener, AbstractPlatform, WebSocketRegistrationMode, AbstractPersistence, AbstractPubSub, ConvertWebSocketConfig, AbstractPlatformConfig, PluvServer, InferInitContextType } from '@pluv/io';
4
- import { JsonObject, Json, InferIOAuthorizeUser, InferIOAuthorize, BaseUser, MaybePromise, Maybe } from '@pluv/types';
3
+ import { AbstractWebSocket, WebSocketSerializedState, AbstractWebSocketConfig, AbstractEventMap, AbstractListener, AbstractPlatform, WebSocketRegistrationMode, AbstractPersistence, AbstractPubSub, ConvertWebSocketConfig, AbstractPlatformConfig, PluvServer, InferInitContextType, CreateIOParams, PluvIOAuthorize, PluvContext } from '@pluv/io';
4
+ import { JsonObject, Json, InferIOAuthorizeUser, InferIOAuthorize, BaseUser, MaybePromise, Maybe, Id } from '@pluv/types';
5
5
  import { IncomingMessage, Server, ServerResponse } from 'node:http';
6
6
 
7
7
  type NodeWebSocketConfig = AbstractWebSocketConfig;
@@ -34,7 +34,7 @@ type NodePlatformConfig<TMeta extends Record<string, Json>> = {
34
34
  persistence: AbstractPersistence;
35
35
  pubSub: AbstractPubSub;
36
36
  }) & {
37
- context?: NodePlatformRoomContext<TMeta>;
37
+ roomContext?: NodePlatformRoomContext<TMeta>;
38
38
  };
39
39
  declare class NodePlatform<TMeta extends Record<string, Json> = {}> extends AbstractPlatform<NodeWebSocket, {
40
40
  req: IncomingMessage;
@@ -52,6 +52,7 @@ declare class NodePlatform<TMeta extends Record<string, Json> = {}> extends Abst
52
52
  onUserConnected: true;
53
53
  onUserDisconnected: true;
54
54
  };
55
+ router: true;
55
56
  }> {
56
57
  readonly _config: {
57
58
  authorize: {
@@ -67,6 +68,7 @@ declare class NodePlatform<TMeta extends Record<string, Json> = {}> extends Abst
67
68
  onUserConnected: true;
68
69
  onUserDisconnected: true;
69
70
  };
71
+ router: true;
70
72
  };
71
73
  readonly _name = "platformNode";
72
74
  constructor(config?: NodePlatformConfig<TMeta>);
@@ -107,6 +109,18 @@ interface CreatePluvHandlerResult {
107
109
  }
108
110
  declare const createPluvHandler: <TPluvServer extends PluvServer<NodePlatform, any, any, any>>(config: CreatePluvHandlerConfig<TPluvServer>) => CreatePluvHandlerResult;
109
111
 
110
- declare const platformNode: <TMeta extends Record<string, Json> = {}>(config?: NodePlatformConfig<TMeta>) => NodePlatform<TMeta>;
112
+ declare const identity: <T extends unknown>(x: T) => T;
111
113
 
112
- export { type AuthorizeFunction, type AuthorizeFunctionContext, type CreatePluvHandlerConfig, NodePlatform, type NodePlatformConfig, createPluvHandler, platformNode };
114
+ type InferCallback<TMeta extends Record<string, Json> = {}> = (i: typeof identity) => {
115
+ meta?: (io: TMeta) => TMeta;
116
+ };
117
+ declare const infer: <TMeta extends Record<string, Json> = {}>(callback: InferCallback<TMeta>) => InferCallback<TMeta>;
118
+
119
+ type PlatformNodeCreateIOParams<TMeta extends Record<string, Json> = {}, TContext extends Record<string, any> = {}, TUser extends BaseUser | null = null> = Id<NodePlatformConfig<TMeta> & Omit<CreateIOParams<NodePlatform<TMeta>, TContext, TUser>, "authorize" | "context" | "platform"> & {
120
+ authorize?: PluvIOAuthorize<NodePlatform<TMeta>, TUser, InferInitContextType<NodePlatform<TMeta>>>;
121
+ context?: PluvContext<NodePlatform<TMeta>, TContext>;
122
+ types?: InferCallback<TMeta>;
123
+ }>;
124
+ declare const platformNode: <TMeta extends Record<string, Json> = {}, TContext extends Record<string, any> = {}, TUser extends BaseUser | null = null>(config?: PlatformNodeCreateIOParams<TMeta, TContext, TUser>) => CreateIOParams<NodePlatform<TMeta>, TContext, TUser>;
125
+
126
+ export { type AuthorizeFunction, type AuthorizeFunctionContext, type CreatePluvHandlerConfig, type InferCallback, NodePlatform, type NodePlatformConfig, type PlatformNodeCreateIOParams, createPluvHandler, infer, platformNode };
package/dist/index.js CHANGED
@@ -65,6 +65,7 @@ var __async = (__this, __arguments, generator) => {
65
65
  var index_exports = {};
66
66
  __export(index_exports, {
67
67
  createPluvHandler: () => createPluvHandler,
68
+ infer: () => infer,
68
69
  platformNode: () => platformNode
69
70
  });
70
71
  module.exports = __toCommonJS(index_exports);
@@ -174,6 +175,9 @@ var createPluvHandler = (config) => {
174
175
  };
175
176
  };
176
177
 
178
+ // src/infer.ts
179
+ var infer = (callback) => callback;
180
+
177
181
  // src/NodePlatform.ts
178
182
  var import_io2 = require("@pluv/io");
179
183
  var import_node_crypto2 = __toESM(require("crypto"));
@@ -250,9 +254,9 @@ var NodeWebSocket = class extends import_io.AbstractWebSocket {
250
254
  // src/NodePlatform.ts
251
255
  var NodePlatform = class _NodePlatform extends import_io2.AbstractPlatform {
252
256
  constructor(config = {}) {
253
- const { context, mode = "attached", persistence, pubSub } = config;
257
+ const { roomContext, mode = "attached", persistence, pubSub } = config;
254
258
  super(__spreadValues({
255
- context
259
+ roomContext
256
260
  }, persistence && pubSub ? { persistence, pubSub } : {}));
257
261
  this._name = "platformNode";
258
262
  this._config = {
@@ -268,7 +272,8 @@ var NodePlatform = class _NodePlatform extends import_io2.AbstractPlatform {
268
272
  onStorageUpdated: true,
269
273
  onUserConnected: true,
270
274
  onUserDisconnected: true
271
- }
275
+ },
276
+ router: true
272
277
  };
273
278
  }
274
279
  acceptWebSocket(webSocket) {
@@ -292,7 +297,7 @@ var NodePlatform = class _NodePlatform extends import_io2.AbstractPlatform {
292
297
  }
293
298
  initialize(config) {
294
299
  return new _NodePlatform({
295
- context: config.context,
300
+ roomContext: config.roomContext,
296
301
  mode: this._config.registrationMode,
297
302
  persistence: this.persistence,
298
303
  pubSub: this.pubSub
@@ -313,10 +318,18 @@ var NodePlatform = class _NodePlatform extends import_io2.AbstractPlatform {
313
318
 
314
319
  // src/platformNode.ts
315
320
  var platformNode = (config = {}) => {
316
- return new NodePlatform(config);
321
+ const { authorize, context, crdt, debug } = config;
322
+ return {
323
+ authorize,
324
+ context,
325
+ crdt,
326
+ debug,
327
+ platform: new NodePlatform(config)
328
+ };
317
329
  };
318
330
  // Annotate the CommonJS export names for ESM import in node:
319
331
  0 && (module.exports = {
320
332
  createPluvHandler,
333
+ infer,
321
334
  platformNode
322
335
  });
package/dist/index.mjs CHANGED
@@ -140,6 +140,9 @@ var createPluvHandler = (config) => {
140
140
  };
141
141
  };
142
142
 
143
+ // src/infer.ts
144
+ var infer = (callback) => callback;
145
+
143
146
  // src/NodePlatform.ts
144
147
  import { AbstractPlatform } from "@pluv/io";
145
148
  import crypto2 from "node:crypto";
@@ -216,9 +219,9 @@ var NodeWebSocket = class extends AbstractWebSocket {
216
219
  // src/NodePlatform.ts
217
220
  var NodePlatform = class _NodePlatform extends AbstractPlatform {
218
221
  constructor(config = {}) {
219
- const { context, mode = "attached", persistence, pubSub } = config;
222
+ const { roomContext, mode = "attached", persistence, pubSub } = config;
220
223
  super(__spreadValues({
221
- context
224
+ roomContext
222
225
  }, persistence && pubSub ? { persistence, pubSub } : {}));
223
226
  this._name = "platformNode";
224
227
  this._config = {
@@ -234,7 +237,8 @@ var NodePlatform = class _NodePlatform extends AbstractPlatform {
234
237
  onStorageUpdated: true,
235
238
  onUserConnected: true,
236
239
  onUserDisconnected: true
237
- }
240
+ },
241
+ router: true
238
242
  };
239
243
  }
240
244
  acceptWebSocket(webSocket) {
@@ -258,7 +262,7 @@ var NodePlatform = class _NodePlatform extends AbstractPlatform {
258
262
  }
259
263
  initialize(config) {
260
264
  return new _NodePlatform({
261
- context: config.context,
265
+ roomContext: config.roomContext,
262
266
  mode: this._config.registrationMode,
263
267
  persistence: this.persistence,
264
268
  pubSub: this.pubSub
@@ -279,9 +283,17 @@ var NodePlatform = class _NodePlatform extends AbstractPlatform {
279
283
 
280
284
  // src/platformNode.ts
281
285
  var platformNode = (config = {}) => {
282
- return new NodePlatform(config);
286
+ const { authorize, context, crdt, debug } = config;
287
+ return {
288
+ authorize,
289
+ context,
290
+ crdt,
291
+ debug,
292
+ platform: new NodePlatform(config)
293
+ };
283
294
  };
284
295
  export {
285
296
  createPluvHandler,
297
+ infer,
286
298
  platformNode
287
299
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/platform-node",
3
- "version": "0.35.4",
3
+ "version": "0.37.0",
4
4
  "description": "@pluv/io adapter for node.js",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -17,19 +17,19 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@types/node": "^22.13.4",
20
+ "@types/node": "^22.13.7",
21
21
  "@types/ws": "^8.5.14",
22
22
  "path-to-regexp": "^8.2.0",
23
- "@pluv/io": "^0.35.4",
24
- "@pluv/types": "^0.35.4"
23
+ "@pluv/io": "^0.37.0",
24
+ "@pluv/types": "^0.37.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "eslint": "^8.57.1",
28
- "tsup": "^8.3.6",
29
- "typescript": "^5.7.3",
30
- "ws": "^8.18.0",
31
- "@pluv/tsconfig": "^0.35.4",
32
- "eslint-config-pluv": "^0.35.4"
28
+ "tsup": "^8.4.0",
29
+ "typescript": "^5.8.2",
30
+ "ws": "^8.18.1",
31
+ "@pluv/tsconfig": "^0.37.0",
32
+ "eslint-config-pluv": "^0.37.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "ws": "^8.0.0"
@@ -21,7 +21,7 @@ export type NodePlatformRoomContext<TMeta extends Record<string, Json>> = keyof
21
21
  export type NodePlatformConfig<TMeta extends Record<string, Json>> = { mode?: WebSocketRegistrationMode } & (
22
22
  | { persistence?: undefined; pubSub?: undefined }
23
23
  | { persistence: AbstractPersistence; pubSub: AbstractPubSub }
24
- ) & { context?: NodePlatformRoomContext<TMeta> };
24
+ ) & { roomContext?: NodePlatformRoomContext<TMeta> };
25
25
 
26
26
  export class NodePlatform<TMeta extends Record<string, Json> = {}> extends AbstractPlatform<
27
27
  NodeWebSocket,
@@ -41,16 +41,17 @@ export class NodePlatform<TMeta extends Record<string, Json> = {}> extends Abstr
41
41
  onUserConnected: true;
42
42
  onUserDisconnected: true;
43
43
  };
44
+ router: true;
44
45
  }
45
46
  > {
46
47
  public readonly _config;
47
48
  public readonly _name = "platformNode";
48
49
 
49
50
  constructor(config: NodePlatformConfig<TMeta> = {}) {
50
- const { context, mode = "attached", persistence, pubSub } = config;
51
+ const { roomContext, mode = "attached", persistence, pubSub } = config;
51
52
 
52
53
  super({
53
- context,
54
+ roomContext,
54
55
  ...(persistence && pubSub ? { persistence, pubSub } : {}),
55
56
  });
56
57
 
@@ -68,6 +69,7 @@ export class NodePlatform<TMeta extends Record<string, Json> = {}> extends Abstr
68
69
  onUserConnected: true as const,
69
70
  onUserDisconnected: true as const,
70
71
  },
72
+ router: true as const,
71
73
  };
72
74
  }
73
75
 
@@ -99,7 +101,7 @@ export class NodePlatform<TMeta extends Record<string, Json> = {}> extends Abstr
99
101
 
100
102
  public initialize(config: AbstractPlatformConfig<NodePlatformRoomContext<TMeta>>): this {
101
103
  return new NodePlatform({
102
- context: config.context,
104
+ roomContext: config.roomContext,
103
105
  mode: this._config.registrationMode,
104
106
  persistence: this.persistence,
105
107
  pubSub: this.pubSub,
package/src/index.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  export type { WebSocket } from "ws";
2
2
  export { createPluvHandler } from "./createPluvHandler";
3
3
  export type { AuthorizeFunction, AuthorizeFunctionContext, CreatePluvHandlerConfig } from "./createPluvHandler";
4
+ export { infer } from "./infer";
5
+ export type { InferCallback } from "./infer";
4
6
  export type { NodePlatform, NodePlatformConfig } from "./NodePlatform";
5
7
  export { platformNode } from "./platformNode";
8
+ export type { PlatformNodeCreateIOParams } from "./platformNode";
package/src/infer.ts ADDED
@@ -0,0 +1,8 @@
1
+ import type { Json } from "@pluv/types";
2
+ import type { identity } from "./utils";
3
+
4
+ export type InferCallback<TMeta extends Record<string, Json> = {}> = (i: typeof identity) => {
5
+ meta?: (io: TMeta) => TMeta;
6
+ };
7
+
8
+ export const infer = <TMeta extends Record<string, Json> = {}>(callback: InferCallback<TMeta>) => callback;
@@ -1,9 +1,36 @@
1
- import type { Json } from "@pluv/types";
1
+ import type { CreateIOParams, InferInitContextType, PluvContext, PluvIOAuthorize } from "@pluv/io";
2
+ import type { BaseUser, Id, Json } from "@pluv/types";
2
3
  import type { NodePlatformConfig } from "./NodePlatform";
3
4
  import { NodePlatform } from "./NodePlatform";
5
+ import type { InferCallback } from "./infer";
4
6
 
5
- export const platformNode = <TMeta extends Record<string, Json> = {}>(
6
- config: NodePlatformConfig<TMeta> = {},
7
- ): NodePlatform<TMeta> => {
8
- return new NodePlatform<TMeta>(config);
7
+ export type PlatformNodeCreateIOParams<
8
+ TMeta extends Record<string, Json> = {},
9
+ TContext extends Record<string, any> = {},
10
+ TUser extends BaseUser | null = null,
11
+ > = Id<
12
+ NodePlatformConfig<TMeta> &
13
+ Omit<CreateIOParams<NodePlatform<TMeta>, TContext, TUser>, "authorize" | "context" | "platform"> & {
14
+ authorize?: PluvIOAuthorize<NodePlatform<TMeta>, TUser, InferInitContextType<NodePlatform<TMeta>>>;
15
+ context?: PluvContext<NodePlatform<TMeta>, TContext>;
16
+ types?: InferCallback<TMeta>;
17
+ }
18
+ >;
19
+
20
+ export const platformNode = <
21
+ TMeta extends Record<string, Json> = {},
22
+ TContext extends Record<string, any> = {},
23
+ TUser extends BaseUser | null = null,
24
+ >(
25
+ config: PlatformNodeCreateIOParams<TMeta, TContext, TUser> = {},
26
+ ): CreateIOParams<NodePlatform<TMeta>, TContext, TUser> => {
27
+ const { authorize, context, crdt, debug } = config;
28
+
29
+ return {
30
+ authorize,
31
+ context,
32
+ crdt,
33
+ debug,
34
+ platform: new NodePlatform<TMeta>(config),
35
+ };
9
36
  };
@@ -0,0 +1 @@
1
+ export const identity = <T extends unknown>(x: T): T => x;
@@ -0,0 +1 @@
1
+ export { identity } from "./identity";