@alanszp/jwt 10.0.0 → 11.0.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.
Files changed (126) hide show
  1. package/dist/JWTUser.d.ts +31 -0
  2. package/dist/JWTUser.js +62 -0
  3. package/dist/JWTUser.js.map +1 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +1 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/jwt.d.ts +2 -3
  8. package/dist/jwt.js +4 -26
  9. package/dist/jwt.js.map +1 -1
  10. package/dist/types.d.ts +3 -3
  11. package/node_modules/@types/node/LICENSE +21 -0
  12. package/node_modules/@types/node/README.md +15 -0
  13. package/node_modules/@types/node/assert/strict.d.ts +8 -0
  14. package/node_modules/@types/node/assert.d.ts +996 -0
  15. package/node_modules/@types/node/async_hooks.d.ts +539 -0
  16. package/node_modules/@types/node/buffer.d.ts +2362 -0
  17. package/node_modules/@types/node/child_process.d.ts +1540 -0
  18. package/node_modules/@types/node/cluster.d.ts +432 -0
  19. package/node_modules/@types/node/console.d.ts +415 -0
  20. package/node_modules/@types/node/constants.d.ts +19 -0
  21. package/node_modules/@types/node/crypto.d.ts +4487 -0
  22. package/node_modules/@types/node/dgram.d.ts +596 -0
  23. package/node_modules/@types/node/diagnostics_channel.d.ts +545 -0
  24. package/node_modules/@types/node/dns/promises.d.ts +425 -0
  25. package/node_modules/@types/node/dns.d.ts +809 -0
  26. package/node_modules/@types/node/dom-events.d.ts +122 -0
  27. package/node_modules/@types/node/domain.d.ts +170 -0
  28. package/node_modules/@types/node/events.d.ts +879 -0
  29. package/node_modules/@types/node/fs/promises.d.ts +1239 -0
  30. package/node_modules/@types/node/fs.d.ts +4311 -0
  31. package/node_modules/@types/node/globals.d.ts +411 -0
  32. package/node_modules/@types/node/globals.global.d.ts +1 -0
  33. package/node_modules/@types/node/http.d.ts +1887 -0
  34. package/node_modules/@types/node/http2.d.ts +2382 -0
  35. package/node_modules/@types/node/https.d.ts +550 -0
  36. package/node_modules/@types/node/index.d.ts +88 -0
  37. package/node_modules/@types/node/inspector.d.ts +2747 -0
  38. package/node_modules/@types/node/module.d.ts +315 -0
  39. package/node_modules/@types/node/net.d.ts +949 -0
  40. package/node_modules/@types/node/os.d.ts +478 -0
  41. package/node_modules/@types/node/package.json +229 -0
  42. package/node_modules/@types/node/path.d.ts +191 -0
  43. package/node_modules/@types/node/perf_hooks.d.ts +645 -0
  44. package/node_modules/@types/node/process.d.ts +1561 -0
  45. package/node_modules/@types/node/punycode.d.ts +117 -0
  46. package/node_modules/@types/node/querystring.d.ts +141 -0
  47. package/node_modules/@types/node/readline/promises.d.ts +150 -0
  48. package/node_modules/@types/node/readline.d.ts +539 -0
  49. package/node_modules/@types/node/repl.d.ts +430 -0
  50. package/node_modules/@types/node/stream/consumers.d.ts +12 -0
  51. package/node_modules/@types/node/stream/promises.d.ts +83 -0
  52. package/node_modules/@types/node/stream/web.d.ts +366 -0
  53. package/node_modules/@types/node/stream.d.ts +1701 -0
  54. package/node_modules/@types/node/string_decoder.d.ts +67 -0
  55. package/node_modules/@types/node/test.d.ts +1465 -0
  56. package/node_modules/@types/node/timers/promises.d.ts +93 -0
  57. package/node_modules/@types/node/timers.d.ts +240 -0
  58. package/node_modules/@types/node/tls.d.ts +1210 -0
  59. package/node_modules/@types/node/trace_events.d.ts +182 -0
  60. package/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
  61. package/node_modules/@types/node/ts4.8/assert.d.ts +996 -0
  62. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +539 -0
  63. package/node_modules/@types/node/ts4.8/buffer.d.ts +2362 -0
  64. package/node_modules/@types/node/ts4.8/child_process.d.ts +1540 -0
  65. package/node_modules/@types/node/ts4.8/cluster.d.ts +432 -0
  66. package/node_modules/@types/node/ts4.8/console.d.ts +415 -0
  67. package/node_modules/@types/node/ts4.8/constants.d.ts +19 -0
  68. package/node_modules/@types/node/ts4.8/crypto.d.ts +4487 -0
  69. package/node_modules/@types/node/ts4.8/dgram.d.ts +596 -0
  70. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +545 -0
  71. package/node_modules/@types/node/ts4.8/dns/promises.d.ts +425 -0
  72. package/node_modules/@types/node/ts4.8/dns.d.ts +809 -0
  73. package/node_modules/@types/node/ts4.8/dom-events.d.ts +122 -0
  74. package/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
  75. package/node_modules/@types/node/ts4.8/events.d.ts +879 -0
  76. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +1239 -0
  77. package/node_modules/@types/node/ts4.8/fs.d.ts +4311 -0
  78. package/node_modules/@types/node/ts4.8/globals.d.ts +411 -0
  79. package/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
  80. package/node_modules/@types/node/ts4.8/http.d.ts +1887 -0
  81. package/node_modules/@types/node/ts4.8/http2.d.ts +2382 -0
  82. package/node_modules/@types/node/ts4.8/https.d.ts +550 -0
  83. package/node_modules/@types/node/ts4.8/index.d.ts +88 -0
  84. package/node_modules/@types/node/ts4.8/inspector.d.ts +2747 -0
  85. package/node_modules/@types/node/ts4.8/module.d.ts +315 -0
  86. package/node_modules/@types/node/ts4.8/net.d.ts +949 -0
  87. package/node_modules/@types/node/ts4.8/os.d.ts +478 -0
  88. package/node_modules/@types/node/ts4.8/path.d.ts +191 -0
  89. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +645 -0
  90. package/node_modules/@types/node/ts4.8/process.d.ts +1561 -0
  91. package/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
  92. package/node_modules/@types/node/ts4.8/querystring.d.ts +141 -0
  93. package/node_modules/@types/node/ts4.8/readline/promises.d.ts +150 -0
  94. package/node_modules/@types/node/ts4.8/readline.d.ts +539 -0
  95. package/node_modules/@types/node/ts4.8/repl.d.ts +430 -0
  96. package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
  97. package/node_modules/@types/node/ts4.8/stream/promises.d.ts +83 -0
  98. package/node_modules/@types/node/ts4.8/stream/web.d.ts +366 -0
  99. package/node_modules/@types/node/ts4.8/stream.d.ts +1701 -0
  100. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
  101. package/node_modules/@types/node/ts4.8/test.d.ts +1465 -0
  102. package/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
  103. package/node_modules/@types/node/ts4.8/timers.d.ts +240 -0
  104. package/node_modules/@types/node/ts4.8/tls.d.ts +1210 -0
  105. package/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
  106. package/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
  107. package/node_modules/@types/node/ts4.8/url.d.ts +927 -0
  108. package/node_modules/@types/node/ts4.8/util.d.ts +2183 -0
  109. package/node_modules/@types/node/ts4.8/v8.d.ts +764 -0
  110. package/node_modules/@types/node/ts4.8/vm.d.ts +903 -0
  111. package/node_modules/@types/node/ts4.8/wasi.d.ts +179 -0
  112. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +691 -0
  113. package/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
  114. package/node_modules/@types/node/tty.d.ts +208 -0
  115. package/node_modules/@types/node/url.d.ts +927 -0
  116. package/node_modules/@types/node/util.d.ts +2183 -0
  117. package/node_modules/@types/node/v8.d.ts +764 -0
  118. package/node_modules/@types/node/vm.d.ts +903 -0
  119. package/node_modules/@types/node/wasi.d.ts +179 -0
  120. package/node_modules/@types/node/worker_threads.d.ts +691 -0
  121. package/node_modules/@types/node/zlib.d.ts +517 -0
  122. package/package.json +3 -3
  123. package/src/JWTUser.ts +85 -0
  124. package/src/index.ts +1 -0
  125. package/src/jwt.ts +4 -29
  126. package/src/types.ts +3 -3
@@ -0,0 +1,31 @@
1
+ import { IJWTUser, JWTPayload } from "./types";
2
+ export declare class JWTUser implements IJWTUser {
3
+ id: string;
4
+ employeeReference: string | null;
5
+ organizationReference: string;
6
+ originalOrganizationReference: string | null;
7
+ roles: string[];
8
+ permissions: string;
9
+ segmentReference: string | null;
10
+ constructor({ id, employeeReference, organizationReference, roles, permissions, segmentReference, }: IJWTUser);
11
+ static fromPayload(payload: JWTPayload): JWTUser;
12
+ toTokenPayload(): JWTPayload;
13
+ /**
14
+ * Old way of checking for a role
15
+ * Will be replaced by permission checks
16
+ * @param role - role code to check
17
+ */
18
+ hasRole(role: string): boolean;
19
+ /**
20
+ * Old way of checking for roles
21
+ * Will be replaced by permission checks
22
+ */
23
+ hasRoles(validateRoles: string | string[]): boolean;
24
+ /**
25
+ * Check if user has permission to perform an action
26
+ * @note - not implemented, will be implemented in the next release
27
+ * @param permissionCode - permission code to check
28
+ * @returns boolean
29
+ */
30
+ hasPermission(_permissionCode: string): boolean;
31
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JWTUser = void 0;
4
+ class JWTUser {
5
+ constructor({ id, employeeReference, organizationReference, roles, permissions, segmentReference, }) {
6
+ this.id = id;
7
+ this.employeeReference = employeeReference;
8
+ this.organizationReference = organizationReference;
9
+ this.roles = roles;
10
+ this.permissions = permissions;
11
+ this.segmentReference = segmentReference;
12
+ }
13
+ static fromPayload(payload) {
14
+ return new JWTUser({
15
+ id: payload.sub,
16
+ employeeReference: payload.ref,
17
+ organizationReference: payload.org,
18
+ roles: payload.rls,
19
+ permissions: payload.prms,
20
+ segmentReference: payload.seg || null,
21
+ });
22
+ }
23
+ toTokenPayload() {
24
+ return {
25
+ sub: this.id,
26
+ ref: this.employeeReference,
27
+ org: this.organizationReference,
28
+ rls: this.roles,
29
+ prms: this.permissions,
30
+ seg: this.segmentReference,
31
+ };
32
+ }
33
+ /**
34
+ * Old way of checking for a role
35
+ * Will be replaced by permission checks
36
+ * @param role - role code to check
37
+ */
38
+ hasRole(role) {
39
+ return this.roles.includes(role);
40
+ }
41
+ /**
42
+ * Old way of checking for roles
43
+ * Will be replaced by permission checks
44
+ */
45
+ hasRoles(validateRoles) {
46
+ if (typeof validateRoles === "string") {
47
+ return this.hasRole(validateRoles);
48
+ }
49
+ return validateRoles.some((role) => this.hasRole(role));
50
+ }
51
+ /**
52
+ * Check if user has permission to perform an action
53
+ * @note - not implemented, will be implemented in the next release
54
+ * @param permissionCode - permission code to check
55
+ * @returns boolean
56
+ */
57
+ hasPermission(_permissionCode) {
58
+ throw new Error("Not implemented");
59
+ }
60
+ }
61
+ exports.JWTUser = JWTUser;
62
+ //# sourceMappingURL=JWTUser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JWTUser.js","sourceRoot":"","sources":["../src/JWTUser.ts"],"names":[],"mappings":";;;AAEA,MAAa,OAAO;IAelB,YAAY,EACV,EAAE,EACF,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,EACL,WAAW,EACX,gBAAgB,GACP;QACT,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,OAAmB;QACpC,OAAO,IAAI,OAAO,CAAC;YACjB,EAAE,EAAE,OAAO,CAAC,GAAG;YACf,iBAAiB,EAAE,OAAO,CAAC,GAAG;YAC9B,qBAAqB,EAAE,OAAO,CAAC,GAAG;YAClC,KAAK,EAAE,OAAO,CAAC,GAAG;YAClB,WAAW,EAAE,OAAO,CAAC,IAAI;YACzB,gBAAgB,EAAE,OAAO,CAAC,GAAG,IAAI,IAAI;SACtC,CAAC,CAAC;IACL,CAAC;IAEM,cAAc;QACnB,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,EAAE;YACZ,GAAG,EAAE,IAAI,CAAC,iBAAiB;YAC3B,GAAG,EAAE,IAAI,CAAC,qBAAqB;YAC/B,GAAG,EAAE,IAAI,CAAC,KAAK;YACf,IAAI,EAAE,IAAI,CAAC,WAAW;YACtB,GAAG,EAAE,IAAI,CAAC,gBAAgB;SAC3B,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,IAAY;QACzB,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED;;;OAGG;IACI,QAAQ,CAAC,aAAgC;QAC9C,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE;YACrC,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;SACpC;QACD,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;OAKG;IACI,aAAa,CAAC,eAAuB;QAC1C,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;CACF;AAlFD,0BAkFC"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./types";
2
+ export * from "./JWTUser";
2
3
  export * from "./jwt";
package/dist/index.js CHANGED
@@ -11,5 +11,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./types"), exports);
14
+ __exportStar(require("./JWTUser"), exports);
14
15
  __exportStar(require("./jwt"), exports);
15
16
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAwB;AACxB,wCAAsB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAwB;AACxB,4CAA0B;AAC1B,wCAAsB"}
package/dist/jwt.d.ts CHANGED
@@ -1,12 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  import { KeyObject } from "crypto";
3
- import type { JWTPayload, JWTUser, SignOptions, VerifyOptions } from "./types";
3
+ import type { SignOptions, VerifyOptions } from "./types";
4
+ import { JWTUser } from "./JWTUser";
4
5
  export declare const JWT_ALGORITHM = "RS512";
5
6
  export declare function privateKeyFromPem(key: string): KeyObject;
6
7
  export declare function publicKeyFromPem(key: string): KeyObject;
7
8
  export declare function withDefaultSignOptions(options?: Partial<SignOptions>): SignOptions;
8
9
  export declare function withDefaultVerifyOptions(options?: Partial<VerifyOptions>): VerifyOptions;
9
10
  export declare function generateJWT(privateKey: KeyObject | string, user: JWTUser, options?: Partial<SignOptions>): Promise<string>;
10
- export declare function createTokenPayload(user: JWTUser): JWTPayload;
11
11
  export declare function verifyJWT(publicKey: KeyObject | string, token: string, options?: Partial<VerifyOptions>): Promise<JWTUser>;
12
- export declare function jwtUserHasRoles(jwtUser: JWTUser, roles: string | string[]): boolean;
package/dist/jwt.js CHANGED
@@ -9,9 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.jwtUserHasRoles = exports.verifyJWT = exports.createTokenPayload = exports.generateJWT = exports.withDefaultVerifyOptions = exports.withDefaultSignOptions = exports.publicKeyFromPem = exports.privateKeyFromPem = exports.JWT_ALGORITHM = void 0;
12
+ exports.verifyJWT = exports.generateJWT = exports.withDefaultVerifyOptions = exports.withDefaultSignOptions = exports.publicKeyFromPem = exports.privateKeyFromPem = exports.JWT_ALGORITHM = void 0;
13
13
  const crypto_1 = require("crypto");
14
14
  const jose_1 = require("jose");
15
+ const JWTUser_1 = require("./JWTUser");
15
16
  exports.JWT_ALGORITHM = "RS512";
16
17
  function privateKeyFromPem(key) {
17
18
  return (0, crypto_1.createPrivateKey)({
@@ -39,7 +40,7 @@ function generateJWT(privateKey, user, options) {
39
40
  return __awaiter(this, void 0, void 0, function* () {
40
41
  const key = typeof privateKey === "string" ? privateKeyFromPem(privateKey) : privateKey;
41
42
  const opts = withDefaultSignOptions(options);
42
- return new jose_1.SignJWT(createTokenPayload(user))
43
+ return new jose_1.SignJWT(user.toTokenPayload())
43
44
  .setProtectedHeader({ alg: exports.JWT_ALGORITHM })
44
45
  .setIssuedAt()
45
46
  .setIssuer(opts.issuer)
@@ -49,17 +50,6 @@ function generateJWT(privateKey, user, options) {
49
50
  });
50
51
  }
51
52
  exports.generateJWT = generateJWT;
52
- function createTokenPayload(user) {
53
- return {
54
- sub: user.id,
55
- ref: user.employeeReference,
56
- org: user.organizationReference,
57
- rls: user.roles,
58
- prms: user.permissions,
59
- seg: user.segmentReference,
60
- };
61
- }
62
- exports.createTokenPayload = createTokenPayload;
63
53
  function verifyJWT(publicKey, token, options) {
64
54
  return __awaiter(this, void 0, void 0, function* () {
65
55
  const key = typeof publicKey === "string" ? publicKeyFromPem(publicKey) : publicKey;
@@ -70,20 +60,8 @@ function verifyJWT(publicKey, token, options) {
70
60
  audience: opts.audience,
71
61
  });
72
62
  const payload = verify.payload;
73
- return {
74
- id: payload.sub,
75
- employeeReference: payload.ref,
76
- organizationReference: payload.org,
77
- roles: payload.rls,
78
- permissions: payload.prms,
79
- segmentReference: payload.seg || null,
80
- };
63
+ return JWTUser_1.JWTUser.fromPayload(payload);
81
64
  });
82
65
  }
83
66
  exports.verifyJWT = verifyJWT;
84
- function jwtUserHasRoles(jwtUser, roles) {
85
- const validateRoles = typeof roles === "string" ? [roles] : roles;
86
- return validateRoles.some((role) => jwtUser.roles.includes(role));
87
- }
88
- exports.jwtUserHasRoles = jwtUserHasRoles;
89
67
  //# sourceMappingURL=jwt.js.map
package/dist/jwt.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"jwt.js","sourceRoot":"","sources":["../src/jwt.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAsE;AACtE,+BAA0C;AAG7B,QAAA,aAAa,GAAG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,CAAC;aAC1C,WAAW,EAAE;aACb,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;aACtB,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC;aAC1B,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC;aAClC,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;CAAA;AAjBD,kCAiBC;AAED,SAAsB,SAAS,CAC7B,SAA6B,EAC7B,KAAa,EACb,OAAgC;;QAEhC,MAAM,GAAG,GACP,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAE1E,MAAM,IAAI,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAC;QAE/C,MAAM,MAAM,GAAG,MAAM,IAAA,gBAAS,EAAC,KAAK,EAAE,GAAG,EAAE;YACzC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,UAAU,EAAE,CAAC,qBAAa,CAAC;YAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,MAAM,CAAC,OAAqB,CAAC;QAE7C,OAAO,iBAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;CAAA;AAnBD,8BAmBC"}
package/dist/types.d.ts CHANGED
@@ -4,15 +4,15 @@ export interface JWTPayload extends LibPayload {
4
4
  ref: string | null;
5
5
  org: string;
6
6
  rls: string[];
7
- prms: string[];
7
+ prms: string;
8
8
  seg: string | null;
9
9
  }
10
- export interface JWTUser {
10
+ export interface IJWTUser {
11
11
  id: string;
12
12
  employeeReference: string | null;
13
13
  organizationReference: string;
14
14
  roles: string[];
15
- permissions: string[];
15
+ permissions: string;
16
16
  segmentReference: string | null;
17
17
  }
18
18
  export interface SignOptions {
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
@@ -0,0 +1,15 @@
1
+ # Installation
2
+ > `npm install --save @types/node`
3
+
4
+ # Summary
5
+ This package contains type definitions for node (https://nodejs.org/).
6
+
7
+ # Details
8
+ Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
+
10
+ ### Additional Details
11
+ * Last updated: Thu, 08 Feb 2024 20:35:44 GMT
12
+ * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
+
14
+ # Credits
15
+ These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky).
@@ -0,0 +1,8 @@
1
+ declare module "assert/strict" {
2
+ import { strict } from "node:assert";
3
+ export = strict;
4
+ }
5
+ declare module "node:assert/strict" {
6
+ import { strict } from "node:assert";
7
+ export = strict;
8
+ }