matterbridge 3.4.7-dev-20260113-0917d83 → 3.5.0-dev-20260113-96c82db

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.
Files changed (71) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/npm-shrinkwrap.json +1500 -11420
  3. package/package.json +2 -7
  4. package/frontend/index.html +0 -15
  5. package/frontend/package-lock.json +0 -7553
  6. package/packages/dgram/LICENSE +0 -202
  7. package/packages/dgram/dist/coap.d.ts +0 -34
  8. package/packages/dgram/dist/coap.js +0 -252
  9. package/packages/dgram/dist/dgram.d.ts +0 -45
  10. package/packages/dgram/dist/dgram.js +0 -255
  11. package/packages/dgram/dist/export.d.ts +0 -5
  12. package/packages/dgram/dist/export.js +0 -5
  13. package/packages/dgram/dist/mdns.d.ts +0 -188
  14. package/packages/dgram/dist/mdns.js +0 -702
  15. package/packages/dgram/dist/multicast.d.ts +0 -18
  16. package/packages/dgram/dist/multicast.js +0 -119
  17. package/packages/dgram/dist/unicast.d.ts +0 -11
  18. package/packages/dgram/dist/unicast.js +0 -40
  19. package/packages/dgram/package.json +0 -110
  20. package/packages/jest-utils/LICENSE +0 -202
  21. package/packages/jest-utils/dist/export.d.ts +0 -1
  22. package/packages/jest-utils/dist/export.js +0 -1
  23. package/packages/jest-utils/dist/jestHelpers.d.ts +0 -21
  24. package/packages/jest-utils/dist/jestHelpers.js +0 -77
  25. package/packages/jest-utils/package.json +0 -109
  26. package/packages/utils/LICENSE +0 -202
  27. package/packages/utils/dist/colorUtils.d.ts +0 -24
  28. package/packages/utils/dist/colorUtils.js +0 -187
  29. package/packages/utils/dist/commandLine.d.ts +0 -6
  30. package/packages/utils/dist/commandLine.js +0 -63
  31. package/packages/utils/dist/copyDirectory.d.ts +0 -2
  32. package/packages/utils/dist/copyDirectory.js +0 -39
  33. package/packages/utils/dist/createDirectory.d.ts +0 -2
  34. package/packages/utils/dist/createDirectory.js +0 -21
  35. package/packages/utils/dist/createZip.d.ts +0 -1
  36. package/packages/utils/dist/createZip.js +0 -69
  37. package/packages/utils/dist/deepCopy.d.ts +0 -1
  38. package/packages/utils/dist/deepCopy.js +0 -40
  39. package/packages/utils/dist/deepEqual.d.ts +0 -1
  40. package/packages/utils/dist/deepEqual.js +0 -58
  41. package/packages/utils/dist/error.d.ts +0 -3
  42. package/packages/utils/dist/error.js +0 -12
  43. package/packages/utils/dist/export.d.ts +0 -15
  44. package/packages/utils/dist/export.js +0 -15
  45. package/packages/utils/dist/format.d.ts +0 -4
  46. package/packages/utils/dist/format.js +0 -29
  47. package/packages/utils/dist/githubVersion.d.ts +0 -11
  48. package/packages/utils/dist/githubVersion.js +0 -37
  49. package/packages/utils/dist/hex.d.ts +0 -4
  50. package/packages/utils/dist/hex.js +0 -118
  51. package/packages/utils/dist/inspector.d.ts +0 -24
  52. package/packages/utils/dist/inspector.js +0 -200
  53. package/packages/utils/dist/isValid.d.ts +0 -10
  54. package/packages/utils/dist/isValid.js +0 -69
  55. package/packages/utils/dist/network.d.ts +0 -12
  56. package/packages/utils/dist/network.js +0 -105
  57. package/packages/utils/dist/npmRoot.d.ts +0 -1
  58. package/packages/utils/dist/npmRoot.js +0 -13
  59. package/packages/utils/dist/npmVersion.d.ts +0 -1
  60. package/packages/utils/dist/npmVersion.js +0 -43
  61. package/packages/utils/dist/tracker.d.ts +0 -52
  62. package/packages/utils/dist/tracker.js +0 -201
  63. package/packages/utils/dist/wait.d.ts +0 -3
  64. package/packages/utils/dist/wait.js +0 -73
  65. package/packages/utils/package.json +0 -110
  66. package/packages/vitest-utils/LICENSE +0 -202
  67. package/packages/vitest-utils/dist/export.d.ts +0 -1
  68. package/packages/vitest-utils/dist/export.js +0 -1
  69. package/packages/vitest-utils/dist/vitestHelpers.d.ts +0 -21
  70. package/packages/vitest-utils/dist/vitestHelpers.js +0 -77
  71. package/packages/vitest-utils/package.json +0 -109
@@ -1,18 +0,0 @@
1
- import { AddressInfo } from 'node:net';
2
- import { Dgram } from './dgram.js';
3
- export declare const MDNS_MULTICAST_IPV4_ADDRESS = "224.0.0.251";
4
- export declare const MDNS_MULTICAST_IPV6_ADDRESS = "ff02::fb";
5
- export declare const MDNS_MULTICAST_PORT = 5353;
6
- export declare const COAP_MULTICAST_IPV4_ADDRESS = "224.0.1.187";
7
- export declare const COAP_MULTICAST_IPV6_ADDRESS = "ff02::fd";
8
- export declare const COAP_MULTICAST_PORT = 5683;
9
- export declare class Multicast extends Dgram {
10
- multicastAddress: string;
11
- multicastPort: number;
12
- outgoingInterfaceAddress: string | undefined;
13
- joinedInterfaces: string[];
14
- constructor(name: string, multicastAddress: string, multicastPort: number, socketType: 'udp4' | 'udp6', reuseAddr?: boolean | undefined, interfaceName?: string, interfaceAddress?: string, outgoingInterfaceAddress?: string);
15
- start(): void;
16
- onListening(address: AddressInfo): void;
17
- stop(): void;
18
- }
@@ -1,119 +0,0 @@
1
- import os from 'node:os';
2
- import { BLUE, CYAN, db, RED, YELLOW } from 'node-ansi-logger';
3
- import { Dgram } from './dgram.js';
4
- export const MDNS_MULTICAST_IPV4_ADDRESS = '224.0.0.251';
5
- export const MDNS_MULTICAST_IPV6_ADDRESS = 'ff02::fb';
6
- export const MDNS_MULTICAST_PORT = 5353;
7
- export const COAP_MULTICAST_IPV4_ADDRESS = '224.0.1.187';
8
- export const COAP_MULTICAST_IPV6_ADDRESS = 'ff02::fd';
9
- export const COAP_MULTICAST_PORT = 5683;
10
- export class Multicast extends Dgram {
11
- multicastAddress;
12
- multicastPort;
13
- outgoingInterfaceAddress;
14
- joinedInterfaces = [];
15
- constructor(name, multicastAddress, multicastPort, socketType, reuseAddr = true, interfaceName, interfaceAddress, outgoingInterfaceAddress) {
16
- super(name, socketType, reuseAddr, interfaceName, interfaceAddress);
17
- this.multicastAddress = multicastAddress;
18
- this.multicastPort = multicastPort;
19
- this.outgoingInterfaceAddress = outgoingInterfaceAddress;
20
- }
21
- start() {
22
- if (this.socketType === 'udp4') {
23
- this.log.debug(`Starting ipv4 dgram multicast socket...`);
24
- this.interfaceAddress = this.interfaceAddress ?? this.getIpv4InterfaceAddress(this.interfaceName);
25
- }
26
- else {
27
- this.log.debug(`Starting ipv6 dgram multicast socket...`);
28
- this.interfaceAddress = this.interfaceAddress ?? this.getIpv6InterfaceAddress(this.interfaceName);
29
- }
30
- this.log.debug(`Binding dgram multicast socket to ${BLUE}${this.interfaceAddress}${db}:${BLUE}${this.multicastPort}${db} on interface ${CYAN}${this.interfaceName}${db}`);
31
- this.socket.bind(this.multicastPort, this.interfaceAddress, () => {
32
- const address = this.socket.address();
33
- this.log.debug(`Dgram multicast socket bound to ${BLUE}${address.family}${db} ${BLUE}${address.address}${db}:${BLUE}${address.port}${db}`);
34
- this.emit('bound', address);
35
- });
36
- }
37
- onListening(address) {
38
- this.log.debug(`Dgram multicast socket listening on ${BLUE}${address.family}${db} ${BLUE}${address.address}${db}:${BLUE}${address.port}${db}`);
39
- this.socket.setBroadcast(true);
40
- this.log.debug(`Dgram multicast socket broadcast enabled`);
41
- this.socket.setTTL(255);
42
- this.log.debug(`Dgram multicast socket TTL set to 255`);
43
- this.socket.setMulticastTTL(255);
44
- this.log.debug(`Dgram multicast socket multicast TTL set to 255`);
45
- this.socket.setMulticastLoopback(true);
46
- this.log.debug(`Dgram multicast socket multicast loopback enabled`);
47
- Object.entries(os.networkInterfaces()).forEach(([name, interfaces]) => {
48
- this.log.debug(`Dgram multicast socket processing interface ${CYAN}${name}${db}`);
49
- if (!interfaces)
50
- return;
51
- if (this.interfaceName && name !== this.interfaceName)
52
- return;
53
- let iface;
54
- let membershipInterface;
55
- const ifaceIpv4 = interfaces.find((iface) => iface.family === 'IPv4' && this.socketType === 'udp4');
56
- if (ifaceIpv4) {
57
- iface = ifaceIpv4;
58
- membershipInterface = ifaceIpv4.address;
59
- }
60
- const ifaceIpv6 = interfaces.find((iface) => iface.family === 'IPv6' && this.socketType === 'udp6');
61
- if (ifaceIpv6) {
62
- iface = ifaceIpv6;
63
- membershipInterface = ifaceIpv6.address + (ifaceIpv6.scopeid !== undefined ? (process.platform === 'win32' ? '%' + String(ifaceIpv6.scopeid) : '%' + name) : '');
64
- }
65
- const ifaceUla = interfaces.find((iface) => iface.family === 'IPv6' && this.socketType === 'udp6' && iface.address.startsWith('fd'));
66
- if (ifaceUla) {
67
- iface = ifaceUla;
68
- membershipInterface = ifaceUla.address + (ifaceUla.scopeid !== undefined ? (process.platform === 'win32' ? '%' + String(ifaceUla.scopeid) : '%' + name) : '');
69
- }
70
- const ifaceUla64 = interfaces.find((iface) => iface.family === 'IPv6' && this.socketType === 'udp6' && iface.address.startsWith('fd') && iface.netmask === 'ffff:ffff:ffff:ffff::');
71
- if (ifaceUla64) {
72
- iface = ifaceUla64;
73
- membershipInterface = ifaceUla64.address + (ifaceUla64.scopeid !== undefined ? (process.platform === 'win32' ? '%' + String(ifaceUla64.scopeid) : '%' + name) : '');
74
- }
75
- const ifaceLinkLocal = interfaces.find((iface) => iface.family === 'IPv6' && this.socketType === 'udp6' && iface.address.startsWith('fe80'));
76
- if (ifaceLinkLocal) {
77
- iface = ifaceLinkLocal;
78
- membershipInterface =
79
- ifaceLinkLocal.address + (ifaceLinkLocal.scopeid !== undefined ? (process.platform === 'win32' ? '%' + String(ifaceLinkLocal.scopeid) : '%' + name) : '');
80
- }
81
- if (iface && membershipInterface) {
82
- try {
83
- this.socket.addMembership(this.multicastAddress, membershipInterface);
84
- this.joinedInterfaces.push(membershipInterface);
85
- this.log.debug(`Dgram multicast socket joined multicast group ${BLUE}${this.multicastAddress}${db} on interface ${CYAN}${name}${db} ${BLUE}${iface.family}${db} ${BLUE}${iface.address}${db} ${BLUE}${iface.scopeid}${db} >>> ${YELLOW}${membershipInterface}${db}`);
86
- }
87
- catch (error) {
88
- this.log.debug(`Dgram multicast socket failed to join multicast group ${BLUE}${this.multicastAddress}${db} on interface ${CYAN}${name}${db} ${BLUE}${iface.family}${db} ${BLUE}${iface.address}${db} ${BLUE}${iface.scopeid}${db} >>> ${RED}${membershipInterface}${db}: ${error instanceof Error ? error.message : error}`);
89
- }
90
- }
91
- });
92
- let interfaceAddress = this.outgoingInterfaceAddress || this.interfaceAddress;
93
- if (!this.outgoingInterfaceAddress && this.socketType === 'udp4' && this.interfaceAddress === '0.0.0.0') {
94
- interfaceAddress = this.getIpv4InterfaceAddress(this.interfaceName);
95
- }
96
- if (!this.outgoingInterfaceAddress && this.socketType === 'udp6' && this.interfaceAddress === '::') {
97
- interfaceAddress = '::' + this.getIpv6ScopeId(this.interfaceName);
98
- }
99
- this.log.debug(`Dgram multicast socket setting multicastInterface to ${BLUE}${interfaceAddress}${db} for ${BLUE}${address.family}${db} ${BLUE}${address.address}${db}:${BLUE}${address.port}${db}`);
100
- this.socket.setMulticastInterface(interfaceAddress);
101
- this.log.debug(`Dgram multicast socket multicastInterface set to ${BLUE}${interfaceAddress}${db}`);
102
- this.emit('ready', address);
103
- }
104
- stop() {
105
- this.log.debug('Stopping dgram multicast socket...');
106
- this.joinedInterfaces.forEach((membershipInterface) => {
107
- try {
108
- this.socket.dropMembership(this.multicastAddress, membershipInterface);
109
- this.log.debug(`Dgram multicast socket dropped multicast group ${BLUE}${this.multicastAddress}${db} on interface ${YELLOW}${membershipInterface}${db}`);
110
- }
111
- catch (error) {
112
- this.log.debug(`Dgram multicast socket failed to drop multicast group ${BLUE}${this.multicastAddress}${db} on interface ${RED}${membershipInterface}${db}: ${error}`);
113
- }
114
- });
115
- this.joinedInterfaces = [];
116
- this.socket.close();
117
- this.log.debug('Stopped dgram multicast socket.');
118
- }
119
- }
@@ -1,11 +0,0 @@
1
- import { AddressInfo } from 'node:net';
2
- import { RemoteInfo } from 'node:dgram';
3
- import { Dgram } from './dgram.js';
4
- export declare class Unicast extends Dgram {
5
- port: number | undefined;
6
- constructor(name: string, socketType: 'udp4' | 'udp6', reuseAddr?: boolean | undefined, interfaceName?: string, interfaceAddress?: string, port?: number);
7
- start(): void;
8
- onListening(address: AddressInfo): void;
9
- onMessage(msg: Buffer, rinfo: RemoteInfo): void;
10
- stop(): void;
11
- }
@@ -1,40 +0,0 @@
1
- import { BLUE, db } from 'node-ansi-logger';
2
- import { Dgram } from './dgram.js';
3
- export class Unicast extends Dgram {
4
- port;
5
- constructor(name, socketType, reuseAddr = true, interfaceName, interfaceAddress, port) {
6
- super(name, socketType, reuseAddr, interfaceName, interfaceAddress);
7
- this.port = port;
8
- }
9
- start() {
10
- if (this.socketType === 'udp4') {
11
- this.log.debug(`Starting ipv4 dgram unicast socket...`);
12
- this.interfaceAddress = this.interfaceAddress ?? (this.interfaceName ? this.getIpv4InterfaceAddress(this.interfaceName) : undefined);
13
- }
14
- else {
15
- this.log.debug(`Starting ipv6 dgram unicast socket...`);
16
- this.interfaceAddress = this.interfaceAddress ?? (this.interfaceName ? this.getIpv6InterfaceAddress(this.interfaceName) : undefined);
17
- }
18
- this.interfaceNetmask = this.interfaceAddress ? this.getNetmask(this.interfaceAddress) : undefined;
19
- this.log.debug(`Binding dgram unicast socket to ${BLUE}${this.interfaceAddress || 'all available addresses'}${db} on port ${BLUE}${this.port || 'any available port'}${db}...`);
20
- this.socket.bind(this.port, this.interfaceAddress, () => {
21
- const address = this.socket.address();
22
- this.log.debug(`Dgram unicast socket bound to ${BLUE}${address.family}${db} ${BLUE}${address.address}${db}:${BLUE}${address.port}${db}`);
23
- this.emit('bound', address);
24
- });
25
- }
26
- onListening(address) {
27
- this.log.debug(`Dgram unicast socket listening on ${BLUE}${address.family}${db} ${BLUE}${address.address}${db}:${BLUE}${address.port}${db}`);
28
- this.socket.setBroadcast(true);
29
- this.log.debug(`Dgram unicast socket broadcast enabled`);
30
- this.emit('ready', address);
31
- }
32
- onMessage(msg, rinfo) {
33
- this.log.debug(`Socket received a message from ${BLUE}${rinfo.family}${db} ${BLUE}${rinfo.address}${db}:${BLUE}${rinfo.port}${db}`);
34
- }
35
- stop() {
36
- this.log.debug('Stopping dgram unicast socket...');
37
- this.socket.close();
38
- this.log.debug('Stopped dgram unicast socket.');
39
- }
40
- }
@@ -1,110 +0,0 @@
1
- {
2
- "name": "@matterbridge/dgram",
3
- "version": "0.0.2",
4
- "description": "Matterbridge dgram library",
5
- "author": "https://github.com/Luligu",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/Luligu/matterbridge.git",
9
- "directory": "packages/dgram"
10
- },
11
- "publishConfig": {
12
- "access": "public"
13
- },
14
- "keywords": [],
15
- "license": "Apache-2.0",
16
- "funding": {
17
- "type": "buymeacoffee",
18
- "url": "https://www.buymeacoffee.com/luligugithub"
19
- },
20
- "type": "module",
21
- "main": "./dist/export.js",
22
- "types": "./dist/export.d.ts",
23
- "exports": {
24
- ".": {
25
- "types": "./dist/export.d.ts",
26
- "import": "./dist/export.js"
27
- }
28
- },
29
- "engines": {
30
- "node": ">=20.0.0 <21.0.0 || >=22.0.0 <23.0.0 || >=24.0.0 <25.0.0"
31
- },
32
- "scripts": {
33
- "start": "node ./dist/export.js",
34
- "build": "tsc --project tsconfig.json",
35
- "buildProduction": "tsc --project tsconfig.production.json",
36
- "clean": "npx shx rm -rf tsconfig.tsbuildinfo dist",
37
- "cleanBuild": "npm run clean && npm run build",
38
- "cleanBuildProduction": "npm run clean && npm run buildProduction",
39
- "watch": "tsc --watch",
40
- "test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest --maxWorkers=100%",
41
- "test:watch": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest --maxWorkers=100% --watch",
42
- "test:verbose": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest --maxWorkers=100% --verbose",
43
- "test:coverage": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest --maxWorkers=100% --coverage",
44
- "test:vitest": "vitest run",
45
- "test:vitest:watch": "vitest --reporter verbose",
46
- "test:vitest:verbose": "vitest run --reporter verbose",
47
- "test:vitest:coverage": "vitest run --reporter verbose --coverage",
48
- "deepClean": "npx shx rm -rf tsconfig.tsbuildinfo dist coverage jest temp package-lock.json npm-shrinkwrap.json .eslintcache .prettiercache node_modules/* node_modules/.[!.]* node_modules/..?*",
49
- "reset": "npm run deepClean && npm install && npm run build && npx jest --clearCache",
50
- "lint": "eslint --cache --cache-location .eslintcache --max-warnings=0 .",
51
- "lint:fix": "eslint --cache --cache-location .eslintcache --fix --max-warnings=0 .",
52
- "format": "prettier --cache --cache-location .prettiercache --write .",
53
- "format:check": "prettier --cache --cache-location .prettiercache --check .",
54
- "preversion": "npm run runMeBeforePublish",
55
- "postversion": "git push && git push --tags",
56
- "version:patch": "npm version patch",
57
- "version:minor": "npm version minor",
58
- "version:major": "npm version major",
59
- "git:status": "git status && git branch -vv && git stash list",
60
- "git:remote": "git remote -v && git remote show origin",
61
- "git:hardreset:main": "git fetch origin && git checkout main && git reset --hard origin/main",
62
- "git:hardreset:dev": "git fetch origin && git checkout dev && git reset --hard origin/dev",
63
- "git:hardreset:edge": "git fetch origin && git checkout edge && git reset --hard origin/edge",
64
- "checkDependencies": "npx npm-check-updates",
65
- "updateDependencies": "npx npm-check-updates -u && npm run reset",
66
- "automator": "node scripts/runAutomator.mjs --monorepo-package",
67
- "runMeBeforePublish": "npm run lint && npm run format && npm run test && npm run build",
68
- "prepublishOnly": "npm run cleanBuildProduction && npm pkg delete devDependencies scripts && npx shx rm -rf node_modules/* node_modules/.[!.]* node_modules/..?* && npm install --omit=dev",
69
- "npmPack": "npx shx cp package.json package.json.backup && npm run prepublishOnly && npm pack && npx shx cp package.json.backup package.json && npx shx rm -f package.json.backup && npm run reset",
70
- "npmPublishTagDev": "npx shx cp package.json package.json.backup && npm run prepublishOnly && npm publish --tag dev && npx shx cp package.json.backup package.json && npx shx rm -f package.json.backup && npm run reset",
71
- "npmPublishTagEdge": "npx shx cp package.json package.json.backup && npm run prepublishOnly && npm publish --tag edge && npx shx cp package.json.backup package.json && npx shx rm -f package.json.backup && npm run reset",
72
- "npmPublishTagLatest": "npx shx cp package.json package.json.backup && npm run prepublishOnly && npm publish --tag latest && npx shx cp package.json.backup package.json && npx shx rm -f package.json.backup && npm run reset",
73
- "install:dependencies": "npm install --save-exact node-ansi-logger @matterbridge/jest-utils",
74
- "install:scripts": "npm install --save-dev --save-exact npm-check-updates shx cross-env",
75
- "install:typescript": "npm install --save-dev --save-exact typescript @types/node",
76
- "install:eslint": "npm install --save-dev --save-exact eslint @eslint/js typescript-eslint eslint-plugin-import eslint-plugin-n eslint-plugin-promise eslint-plugin-jsdoc",
77
- "install:prettier": "npm install --save-dev --save-exact prettier eslint-config-prettier eslint-plugin-prettier",
78
- "install:jest": "npm install --save-dev --save-exact jest ts-jest @types/jest @jest/globals eslint-plugin-jest",
79
- "install:vitest": "npm install --save-dev --save-exact vitest @vitest/coverage-v8 @vitest/eslint-plugin"
80
- },
81
- "dependencies": {
82
- "@matterbridge/jest-utils": "0.0.1",
83
- "node-ansi-logger": "3.1.1"
84
- },
85
- "devDependencies": {
86
- "@eslint/js": "9.39.2",
87
- "@jest/globals": "30.2.0",
88
- "@types/jest": "30.0.0",
89
- "@types/node": "25.0.3",
90
- "@vitest/coverage-v8": "4.0.16",
91
- "@vitest/eslint-plugin": "1.6.5",
92
- "cross-env": "10.1.0",
93
- "eslint": "9.39.2",
94
- "eslint-config-prettier": "10.1.8",
95
- "eslint-plugin-import": "2.32.0",
96
- "eslint-plugin-jest": "29.12.1",
97
- "eslint-plugin-jsdoc": "61.5.0",
98
- "eslint-plugin-n": "17.23.1",
99
- "eslint-plugin-prettier": "5.5.4",
100
- "eslint-plugin-promise": "7.2.1",
101
- "jest": "30.2.0",
102
- "npm-check-updates": "19.2.1",
103
- "prettier": "3.7.4",
104
- "shx": "0.4.0",
105
- "ts-jest": "29.4.6",
106
- "typescript": "5.9.3",
107
- "typescript-eslint": "8.51.0",
108
- "vitest": "4.0.16"
109
- }
110
- }
@@ -1,202 +0,0 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright [yyyy] [name of copyright owner]
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
- See the License for the specific language governing permissions and
202
- limitations under the License.
@@ -1 +0,0 @@
1
- export * from './jestHelpers.js';
@@ -1 +0,0 @@
1
- export * from './jestHelpers.js';
@@ -1,21 +0,0 @@
1
- import type { jest } from '@jest/globals';
2
- import { AnsiLogger } from 'node-ansi-logger';
3
- export declare const originalProcessArgv: readonly string[];
4
- export declare const originalProcessEnv: Readonly<Record<string, string | undefined>>;
5
- export declare let loggerLogSpy: jest.SpiedFunction<typeof AnsiLogger.prototype.log>;
6
- export declare let loggerDebugSpy: jest.SpiedFunction<typeof AnsiLogger.prototype.debug>;
7
- export declare let loggerInfoSpy: jest.SpiedFunction<typeof AnsiLogger.prototype.info>;
8
- export declare let loggerNoticeSpy: jest.SpiedFunction<typeof AnsiLogger.prototype.notice>;
9
- export declare let loggerWarnSpy: jest.SpiedFunction<typeof AnsiLogger.prototype.warn>;
10
- export declare let loggerErrorSpy: jest.SpiedFunction<typeof AnsiLogger.prototype.error>;
11
- export declare let loggerFatalSpy: jest.SpiedFunction<typeof AnsiLogger.prototype.fatal>;
12
- export declare let consoleLogSpy: jest.SpiedFunction<typeof console.log>;
13
- export declare let consoleDebugSpy: jest.SpiedFunction<typeof console.log>;
14
- export declare let consoleInfoSpy: jest.SpiedFunction<typeof console.log>;
15
- export declare let consoleWarnSpy: jest.SpiedFunction<typeof console.log>;
16
- export declare let consoleErrorSpy: jest.SpiedFunction<typeof console.log>;
17
- export declare let NAME: string;
18
- export declare let HOMEDIR: string;
19
- export declare let log: AnsiLogger;
20
- export declare function setupTest(name: string, debug?: boolean): Promise<void>;
21
- export declare function setDebug(debug: boolean): Promise<void>;
@@ -1,77 +0,0 @@
1
- import { rmSync } from 'node:fs';
2
- import path from 'node:path';
3
- import { AnsiLogger } from 'node-ansi-logger';
4
- export const originalProcessArgv = Object.freeze([...process.argv]);
5
- export const originalProcessEnv = Object.freeze({ ...process.env });
6
- export let loggerLogSpy;
7
- export let loggerDebugSpy;
8
- export let loggerInfoSpy;
9
- export let loggerNoticeSpy;
10
- export let loggerWarnSpy;
11
- export let loggerErrorSpy;
12
- export let loggerFatalSpy;
13
- export let consoleLogSpy;
14
- export let consoleDebugSpy;
15
- export let consoleInfoSpy;
16
- export let consoleWarnSpy;
17
- export let consoleErrorSpy;
18
- export let NAME;
19
- export let HOMEDIR;
20
- export let log;
21
- export async function setupTest(name, debug = false) {
22
- expect(name).toBeDefined();
23
- expect(typeof name).toBe('string');
24
- expect(name.length).toBeGreaterThanOrEqual(4);
25
- NAME = name;
26
- HOMEDIR = path.join('temp', name);
27
- log = new AnsiLogger({ logName: 'Jest', logTimestampFormat: 4, logLevel: "info" });
28
- rmSync(HOMEDIR, { recursive: true, force: true });
29
- const { jest } = await import('@jest/globals');
30
- loggerDebugSpy = jest.spyOn(AnsiLogger.prototype, 'debug');
31
- loggerInfoSpy = jest.spyOn(AnsiLogger.prototype, 'info');
32
- loggerNoticeSpy = jest.spyOn(AnsiLogger.prototype, 'notice');
33
- loggerWarnSpy = jest.spyOn(AnsiLogger.prototype, 'warn');
34
- loggerErrorSpy = jest.spyOn(AnsiLogger.prototype, 'error');
35
- loggerFatalSpy = jest.spyOn(AnsiLogger.prototype, 'fatal');
36
- if (debug) {
37
- loggerLogSpy = jest.spyOn(AnsiLogger.prototype, 'log');
38
- consoleLogSpy = jest.spyOn(console, 'log');
39
- consoleDebugSpy = jest.spyOn(console, 'debug');
40
- consoleInfoSpy = jest.spyOn(console, 'info');
41
- consoleWarnSpy = jest.spyOn(console, 'warn');
42
- consoleErrorSpy = jest.spyOn(console, 'error');
43
- }
44
- else {
45
- loggerLogSpy = jest.spyOn(AnsiLogger.prototype, 'log').mockImplementation(() => { });
46
- consoleLogSpy = jest.spyOn(console, 'log').mockImplementation(() => { });
47
- consoleDebugSpy = jest.spyOn(console, 'debug').mockImplementation(() => { });
48
- consoleInfoSpy = jest.spyOn(console, 'info').mockImplementation(() => { });
49
- consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(() => { });
50
- consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => { });
51
- }
52
- }
53
- export async function setDebug(debug) {
54
- const { jest } = await import('@jest/globals');
55
- if (debug) {
56
- loggerLogSpy.mockRestore();
57
- consoleLogSpy.mockRestore();
58
- consoleDebugSpy.mockRestore();
59
- consoleInfoSpy.mockRestore();
60
- consoleWarnSpy.mockRestore();
61
- consoleErrorSpy.mockRestore();
62
- loggerLogSpy = jest.spyOn(AnsiLogger.prototype, 'log');
63
- consoleLogSpy = jest.spyOn(console, 'log');
64
- consoleDebugSpy = jest.spyOn(console, 'debug');
65
- consoleInfoSpy = jest.spyOn(console, 'info');
66
- consoleWarnSpy = jest.spyOn(console, 'warn');
67
- consoleErrorSpy = jest.spyOn(console, 'error');
68
- }
69
- else {
70
- loggerLogSpy = jest.spyOn(AnsiLogger.prototype, 'log').mockImplementation(() => { });
71
- consoleLogSpy = jest.spyOn(console, 'log').mockImplementation(() => { });
72
- consoleDebugSpy = jest.spyOn(console, 'debug').mockImplementation(() => { });
73
- consoleInfoSpy = jest.spyOn(console, 'info').mockImplementation(() => { });
74
- consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(() => { });
75
- consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => { });
76
- }
77
- }