@meshagent/meshagent 0.0.14 → 0.0.16

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.
@@ -16,8 +16,8 @@ export declare class ParticipantToken {
16
16
  extra?: Record<string, any>;
17
17
  constructor({ name, projectId, apiKeyId, extra, grants, }: {
18
18
  name: string;
19
- projectId: string;
20
- apiKeyId: string;
19
+ projectId?: string;
20
+ apiKeyId?: string;
21
21
  extra?: Record<string, any>;
22
22
  grants?: ParticipantGrant[];
23
23
  });
@@ -25,7 +25,7 @@ export declare class ParticipantToken {
25
25
  addRoleGrant(role: string): void;
26
26
  addRoomGrant(roomName: string): void;
27
27
  toJson(): Record<string, any>;
28
- toJwt({ token }: {
28
+ toJwt({ token }?: {
29
29
  token?: string;
30
30
  }): Promise<string>;
31
31
  static fromJson(json: Record<string, any>): ParticipantToken;
@@ -51,11 +51,8 @@ class ParticipantToken {
51
51
  grants: this.grants.map((g) => g.toJson()),
52
52
  };
53
53
  }
54
- async toJwt({ token }) {
54
+ async toJwt({ token } = {}) {
55
55
  const secret = token || process.env.MESHAGENT_SECRET;
56
- if (!secret) {
57
- throw new Error("No secret provided. Provide `token` or set MESHAGENT_SECRET in environment.");
58
- }
59
56
  const secretKey = new TextEncoder().encode(secret);
60
57
  const payload = {
61
58
  ...this.toJson(),
@@ -26,7 +26,7 @@ var __copyProps = (to, from2, except, desc) => {
26
26
  };
27
27
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
28
28
  var require_base64 = __commonJS({
29
- "../node_modules/base-64/base64.js"(exports, module) {
29
+ "node_modules/base-64/base64.js"(exports, module) {
30
30
  (function (root) {
31
31
  var freeExports = typeof exports == "object" && exports;
32
32
  var freeModule = typeof module == "object" && module && module.exports == freeExports && module;
@@ -16,8 +16,8 @@ export declare class ParticipantToken {
16
16
  extra?: Record<string, any>;
17
17
  constructor({ name, projectId, apiKeyId, extra, grants, }: {
18
18
  name: string;
19
- projectId: string;
20
- apiKeyId: string;
19
+ projectId?: string;
20
+ apiKeyId?: string;
21
21
  extra?: Record<string, any>;
22
22
  grants?: ParticipantGrant[];
23
23
  });
@@ -25,7 +25,7 @@ export declare class ParticipantToken {
25
25
  addRoleGrant(role: string): void;
26
26
  addRoomGrant(roomName: string): void;
27
27
  toJson(): Record<string, any>;
28
- toJwt({ token }: {
28
+ toJwt({ token }?: {
29
29
  token?: string;
30
30
  }): Promise<string>;
31
31
  static fromJson(json: Record<string, any>): ParticipantToken;
@@ -51,11 +51,8 @@ class ParticipantToken {
51
51
  grants: this.grants.map((g) => g.toJson()),
52
52
  };
53
53
  }
54
- async toJwt({ token }) {
54
+ async toJwt({ token } = {}) {
55
55
  const secret = token || process.env.MESHAGENT_SECRET;
56
- if (!secret) {
57
- throw new Error("No secret provided. Provide `token` or set MESHAGENT_SECRET in environment.");
58
- }
59
56
  const secretKey = new TextEncoder().encode(secret);
60
57
  const payload = {
61
58
  ...this.toJson(),
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@meshagent/meshagent",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "Meshagent Client",
5
5
  "homepage": "https://www.meshagent.com",
6
6
  "scripts": {
7
- "test": "mocha dist/node/test/*.js",
8
- "build": "./scripts/build.sh",
7
+ "test": "./run-tests.sh",
8
+ "build": "mkdir -p dist && ./scripts/build.sh",
9
9
  "build-browser-test": "node ./build-browser-test.js"
10
10
  },
11
11
  "author": "Powerboards",
@@ -23,7 +23,10 @@
23
23
  },
24
24
  "files": [
25
25
  "dist",
26
- "!dist/**/test"
26
+ "!dist/**/test",
27
+ "LICENSE",
28
+ "README.md",
29
+ "CHANGELOG.md"
27
30
  ],
28
31
  "devDependencies": {
29
32
  "@types/chai": "^5.0.1",