@pluv/platform-pluv 0.41.6 → 0.41.7

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-pluv@0.41.6 build /home/runner/work/pluv/pluv/packages/platform-pluv
2
+ > @pluv/platform-pluv@0.41.7 build /home/runner/work/pluv/pluv/packages/platform-pluv
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
- ESM dist/index.mjs 12.69 KB
12
- ESM ⚡️ Build success in 94ms
13
- CJS dist/index.js 14.43 KB
14
- CJS ⚡️ Build success in 95ms
11
+ CJS dist/index.js 13.95 KB
12
+ CJS ⚡️ Build success in 89ms
13
+ ESM dist/index.mjs 12.11 KB
14
+ ESM ⚡️ Build success in 92ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 6630ms
17
- DTS dist/index.d.mts 3.62 KB
18
- DTS dist/index.d.ts 3.62 KB
16
+ DTS ⚡️ Build success in 6461ms
17
+ DTS dist/index.d.mts 3.66 KB
18
+ DTS dist/index.d.ts 3.66 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @pluv/platform-pluv
2
2
 
3
+ ## 0.41.7
4
+
5
+ ### Patch Changes
6
+
7
+ - c698c24: Update hidden endpoints parameter to be provided as a function.
8
+ - @pluv/crdt@0.41.7
9
+ - @pluv/io@0.41.7
10
+ - @pluv/types@0.41.7
11
+
3
12
  ## 0.41.6
4
13
 
5
14
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -15,7 +15,7 @@ interface PluvPlatformConfig<TContext extends Record<string, any> = {}> {
15
15
  * @deprecated Internal use only. Changes to this will never be marked as breaking.
16
16
  */
17
17
  _defs?: {
18
- endpoints?: PluvIOEndpoints;
18
+ endpoints?: PluvIOEndpoints | (() => MaybePromise<PluvIOEndpoints>);
19
19
  };
20
20
  basePath: string;
21
21
  context?: TContext;
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@ interface PluvPlatformConfig<TContext extends Record<string, any> = {}> {
15
15
  * @deprecated Internal use only. Changes to this will never be marked as breaking.
16
16
  */
17
17
  _defs?: {
18
- endpoints?: PluvIOEndpoints;
18
+ endpoints?: PluvIOEndpoints | (() => MaybePromise<PluvIOEndpoints>);
19
19
  };
20
20
  basePath: string;
21
21
  context?: TContext;
package/dist/index.js CHANGED
@@ -3,22 +3,8 @@ var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
6
  var __getProtoOf = Object.getPrototypeOf;
8
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
8
  var __export = (target, all) => {
23
9
  for (var name in all)
24
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -228,6 +214,7 @@ var verifyWebhook = (params) => __async(void 0, null, function* () {
228
214
  // src/PluvPlatform.ts
229
215
  var PluvPlatform = class extends import_io.AbstractPlatform {
230
216
  constructor(params) {
217
+ var _a;
231
218
  super();
232
219
  this._config = {
233
220
  authorize: {
@@ -249,11 +236,12 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
249
236
  this._createToken = (params) => __async(this, null, function* () {
250
237
  var _a;
251
238
  const parsed = this._authorize.user.parse(params.user);
252
- const [publicKey, secretKey] = yield Promise.all([
239
+ const [endpoints, publicKey, secretKey] = yield Promise.all([
240
+ typeof this._endpoints === "object" ? this._endpoints : this._endpoints(),
253
241
  typeof this._publicKey === "string" ? this._publicKey : this._publicKey(),
254
242
  typeof this._secretKey === "string" ? this._secretKey : this._secretKey()
255
243
  ]);
256
- const res = yield fetch(this._endpoints.createToken, {
244
+ const res = yield fetch(endpoints.createToken, {
257
245
  headers: { "content-type": "application/json" },
258
246
  method: "post",
259
247
  body: JSON.stringify({
@@ -331,9 +319,7 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
331
319
  const { _defs, context, basePath, publicKey, secretKey, webhookSecret } = params;
332
320
  this._basePath = basePath;
333
321
  this._context = typeof context === "function" ? context(this._roomContext) : context;
334
- this._endpoints = __spreadValues({
335
- createToken: "https://pluv.io/api/room/token"
336
- }, _defs == null ? void 0 : _defs.endpoints);
322
+ this._endpoints = (_a = _defs == null ? void 0 : _defs.endpoints) != null ? _a : { createToken: "https://pluv.io/api/room/token" };
337
323
  this._publicKey = publicKey;
338
324
  this._secretKey = secretKey;
339
325
  this._webhookSecret = webhookSecret;
package/dist/index.mjs CHANGED
@@ -1,19 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __spreadValues = (a, b) => {
7
- for (var prop in b || (b = {}))
8
- if (__hasOwnProp.call(b, prop))
9
- __defNormalProp(a, prop, b[prop]);
10
- if (__getOwnPropSymbols)
11
- for (var prop of __getOwnPropSymbols(b)) {
12
- if (__propIsEnum.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- }
15
- return a;
16
- };
17
1
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
18
2
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
19
3
  }) : x)(function(x) {
@@ -200,6 +184,7 @@ var verifyWebhook = (params) => __async(void 0, null, function* () {
200
184
  // src/PluvPlatform.ts
201
185
  var PluvPlatform = class extends AbstractPlatform {
202
186
  constructor(params) {
187
+ var _a;
203
188
  super();
204
189
  this._config = {
205
190
  authorize: {
@@ -221,11 +206,12 @@ var PluvPlatform = class extends AbstractPlatform {
221
206
  this._createToken = (params) => __async(this, null, function* () {
222
207
  var _a;
223
208
  const parsed = this._authorize.user.parse(params.user);
224
- const [publicKey, secretKey] = yield Promise.all([
209
+ const [endpoints, publicKey, secretKey] = yield Promise.all([
210
+ typeof this._endpoints === "object" ? this._endpoints : this._endpoints(),
225
211
  typeof this._publicKey === "string" ? this._publicKey : this._publicKey(),
226
212
  typeof this._secretKey === "string" ? this._secretKey : this._secretKey()
227
213
  ]);
228
- const res = yield fetch(this._endpoints.createToken, {
214
+ const res = yield fetch(endpoints.createToken, {
229
215
  headers: { "content-type": "application/json" },
230
216
  method: "post",
231
217
  body: JSON.stringify({
@@ -303,9 +289,7 @@ var PluvPlatform = class extends AbstractPlatform {
303
289
  const { _defs, context, basePath, publicKey, secretKey, webhookSecret } = params;
304
290
  this._basePath = basePath;
305
291
  this._context = typeof context === "function" ? context(this._roomContext) : context;
306
- this._endpoints = __spreadValues({
307
- createToken: "https://pluv.io/api/room/token"
308
- }, _defs == null ? void 0 : _defs.endpoints);
292
+ this._endpoints = (_a = _defs == null ? void 0 : _defs.endpoints) != null ? _a : { createToken: "https://pluv.io/api/room/token" };
309
293
  this._publicKey = publicKey;
310
294
  this._secretKey = secretKey;
311
295
  this._webhookSecret = webhookSecret;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/platform-pluv",
3
- "version": "0.41.6",
3
+ "version": "0.41.7",
4
4
  "description": "@pluv/io adapter for pluv.io",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -21,16 +21,16 @@
21
21
  "fast-json-stable-stringify": "^2.1.0",
22
22
  "hono": "^4.7.7",
23
23
  "zod": "^3.24.3",
24
- "@pluv/crdt": "^0.41.6",
25
- "@pluv/types": "^0.41.6",
26
- "@pluv/io": "^0.41.6"
24
+ "@pluv/io": "^0.41.7",
25
+ "@pluv/types": "^0.41.7",
26
+ "@pluv/crdt": "^0.41.7"
27
27
  },
28
28
  "devDependencies": {
29
29
  "eslint": "^9.25.0",
30
30
  "tsup": "^8.4.0",
31
31
  "typescript": "^5.8.3",
32
- "@pluv/tsconfig": "^0.41.6",
33
- "eslint-config-pluv": "^0.41.6"
32
+ "@pluv/tsconfig": "^0.41.7",
33
+ "eslint-config-pluv": "^0.41.7"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup src/index.ts --format esm,cjs --dts",
@@ -29,7 +29,7 @@ export interface PluvPlatformConfig<TContext extends Record<string, any> = {}> {
29
29
  * @deprecated Internal use only. Changes to this will never be marked as breaking.
30
30
  */
31
31
  _defs?: {
32
- endpoints?: PluvIOEndpoints;
32
+ endpoints?: PluvIOEndpoints | (() => MaybePromise<PluvIOEndpoints>);
33
33
  };
34
34
  basePath: string;
35
35
  context?: TContext;
@@ -84,7 +84,7 @@ export class PluvPlatform<
84
84
  private _authorize: any;
85
85
  private readonly _basePath: string;
86
86
  private readonly _context: any;
87
- private readonly _endpoints: PluvIOEndpoints;
87
+ private readonly _endpoints: PluvIOEndpoints | (() => MaybePromise<PluvIOEndpoints>);
88
88
  private _getInitialStorage?: GetInitialStorageFn<{}>;
89
89
  private _listeners?: PluvIOListeners;
90
90
  private readonly _publicKey: PublicKey;
@@ -94,12 +94,13 @@ export class PluvPlatform<
94
94
  public _createToken = async (params: JWTEncodeParams<any, any>): Promise<string> => {
95
95
  const parsed = this._authorize.user.parse(params.user);
96
96
 
97
- const [publicKey, secretKey] = await Promise.all([
97
+ const [endpoints, publicKey, secretKey] = await Promise.all([
98
+ typeof this._endpoints === "object" ? this._endpoints : this._endpoints(),
98
99
  typeof this._publicKey === "string" ? this._publicKey : this._publicKey(),
99
100
  typeof this._secretKey === "string" ? this._secretKey : this._secretKey(),
100
101
  ]);
101
102
 
102
- const res = await fetch(this._endpoints.createToken, {
103
+ const res = await fetch(endpoints.createToken, {
103
104
  headers: { "content-type": "application/json" },
104
105
  method: "post",
105
106
  body: JSON.stringify({
@@ -129,10 +130,7 @@ export class PluvPlatform<
129
130
 
130
131
  this._basePath = basePath;
131
132
  this._context = typeof context === "function" ? context(this._roomContext) : context;
132
- this._endpoints = {
133
- createToken: "https://pluv.io/api/room/token",
134
- ..._defs?.endpoints,
135
- };
133
+ this._endpoints = _defs?.endpoints ?? { createToken: "https://pluv.io/api/room/token" };
136
134
  this._publicKey = publicKey;
137
135
  this._secretKey = secretKey;
138
136
  this._webhookSecret = webhookSecret;