@miqro/core 1.3.9 → 1.3.11

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 (48) hide show
  1. package/dist/handler/common/context.d.ts +2 -10
  2. package/dist/handler/common/context.js +4 -4
  3. package/dist/handler/common/context.js.map +1 -1
  4. package/dist/handler/middleware/cookie.js +2 -2
  5. package/dist/handler/middleware/cookie.js.map +1 -1
  6. package/dist/util/index.js +0 -2
  7. package/dist/util/index.js.map +1 -1
  8. package/dist/util/session/service.js +2 -2
  9. package/dist/util/session/service.js.map +1 -1
  10. package/package.json +8 -2
  11. package/src/handler/common/context.ts +5 -14
  12. package/src/handler/middleware/cookie.ts +12 -12
  13. package/src/util/index.ts +0 -2
  14. package/src/util/session/service.ts +126 -126
  15. package/dist/util/cookie/cookie.d.ts +0 -50
  16. package/dist/util/cookie/cookie.js +0 -168
  17. package/dist/util/cookie/cookie.js.map +0 -1
  18. package/dist/util/cookie/index.d.ts +0 -16
  19. package/dist/util/cookie/index.js +0 -9
  20. package/dist/util/cookie/index.js.map +0 -1
  21. package/dist/util/uuid/index.d.ts +0 -7
  22. package/dist/util/uuid/index.js +0 -8
  23. package/dist/util/uuid/index.js.map +0 -1
  24. package/dist/util/uuid/regex.d.ts +0 -2
  25. package/dist/util/uuid/regex.js +0 -5
  26. package/dist/util/uuid/regex.js.map +0 -1
  27. package/dist/util/uuid/rng.d.ts +0 -1
  28. package/dist/util/uuid/rng.js +0 -18
  29. package/dist/util/uuid/rng.js.map +0 -1
  30. package/dist/util/uuid/stringify.d.ts +0 -2
  31. package/dist/util/uuid/stringify.js +0 -50
  32. package/dist/util/uuid/stringify.js.map +0 -1
  33. package/dist/util/uuid/v4.d.ts +0 -5
  34. package/dist/util/uuid/v4.js +0 -27
  35. package/dist/util/uuid/v4.js.map +0 -1
  36. package/dist/util/uuid/validate.d.ts +0 -2
  37. package/dist/util/uuid/validate.js +0 -12
  38. package/dist/util/uuid/validate.js.map +0 -1
  39. package/src/util/cookie/cookie.ts +0 -207
  40. package/src/util/cookie/index.ts +0 -6
  41. package/src/util/uuid/index.ts +0 -5
  42. package/src/util/uuid/regex.ts +0 -2
  43. package/src/util/uuid/rng.ts +0 -14
  44. package/src/util/uuid/stringify.ts +0 -53
  45. package/src/util/uuid/v4.ts +0 -30
  46. package/src/util/uuid/validate.ts +0 -8
  47. package/test.md +0 -0
  48. package/tsconfig-test.json +0 -13
@@ -1,168 +0,0 @@
1
- // https://github.com/jshttp/cookie/blob/master/index.js
2
- /*!
3
- * cookie
4
- * Copyright(c) 2012-2014 Roman Shtylman
5
- * Copyright(c) 2015 Douglas Christopher Wilson
6
- * MIT Licensed
7
- */
8
- 'use strict';
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.serialize = exports.parse = void 0;
11
- /**
12
- * Module exports.
13
- * @public
14
- */
15
- /**
16
- * Parse a cookie header.
17
- *
18
- * Parse the given cookie header string into an object
19
- * The object has the various cookies as keys(names) => values
20
- *
21
- * @param {string} str
22
- * @param {object} [options]
23
- * @return {object}
24
- * @public
25
- */
26
- const parse = (str, options) => {
27
- if (typeof str !== 'string') {
28
- throw new TypeError('argument str must be a string');
29
- }
30
- const obj = {};
31
- const opt = options || {};
32
- const pairs = str.split(pairSplitRegExp);
33
- const dec = opt.decode || decode;
34
- for (let i = 0; i < pairs.length; i++) {
35
- const pair = pairs[i];
36
- let eq_idx = pair.indexOf('=');
37
- // skip things that don't look like key=value
38
- if (eq_idx < 0) {
39
- continue;
40
- }
41
- const key = pair.substr(0, eq_idx).trim();
42
- let val = pair.substr(++eq_idx, pair.length).trim();
43
- // quoted values
44
- if ('"' == val[0]) {
45
- val = val.slice(1, -1);
46
- }
47
- // only assign once
48
- if (undefined == obj[key]) {
49
- obj[key] = tryDecode(val, dec);
50
- }
51
- }
52
- return obj;
53
- };
54
- exports.parse = parse;
55
- /**
56
- * Serialize data into a cookie header.
57
- *
58
- * Serialize the a name value pair into a cookie string suitable for
59
- * http headers. An optional options object specified cookie parameters.
60
- *
61
- * serialize('foo', 'bar', { httpOnly: true })
62
- * => "foo=bar; httpOnly"
63
- *
64
- * @param {string} name
65
- * @param {string} val
66
- * @param {object} [options]
67
- * @return {string}
68
- * @public
69
- */
70
- const serialize = (name, val, options) => {
71
- const opt = options || {};
72
- const enc = opt.encode || encode;
73
- if (typeof enc !== 'function') {
74
- throw new TypeError('option encode is invalid');
75
- }
76
- if (!fieldContentRegExp.test(name)) {
77
- throw new TypeError('argument name is invalid');
78
- }
79
- const value = enc(val);
80
- if (value && !fieldContentRegExp.test(value)) {
81
- throw new TypeError('argument val is invalid');
82
- }
83
- let str = name + '=' + value;
84
- if (null != opt.maxAge) {
85
- const maxAge = opt.maxAge - 0;
86
- if (isNaN(maxAge) || !isFinite(maxAge)) {
87
- throw new TypeError('option maxAge is invalid');
88
- }
89
- str += '; Max-Age=' + Math.floor(maxAge);
90
- }
91
- if (opt.domain) {
92
- if (!fieldContentRegExp.test(opt.domain)) {
93
- throw new TypeError('option domain is invalid');
94
- }
95
- str += '; Domain=' + opt.domain;
96
- }
97
- if (opt.path) {
98
- if (!fieldContentRegExp.test(opt.path)) {
99
- throw new TypeError('option path is invalid');
100
- }
101
- str += '; Path=' + opt.path;
102
- }
103
- if (opt.expires) {
104
- if (typeof opt.expires.toUTCString !== 'function') {
105
- throw new TypeError('option expires is invalid');
106
- }
107
- str += '; Expires=' + opt.expires.toUTCString();
108
- }
109
- if (opt.httpOnly) {
110
- str += '; HttpOnly';
111
- }
112
- if (opt.secure) {
113
- str += '; Secure';
114
- }
115
- if (opt.sameSite) {
116
- const sameSite = typeof opt.sameSite === 'string'
117
- ? opt.sameSite.toLowerCase() : opt.sameSite;
118
- switch (sameSite) {
119
- case true:
120
- str += '; SameSite=Strict';
121
- break;
122
- case 'lax':
123
- str += '; SameSite=Lax';
124
- break;
125
- case 'strict':
126
- str += '; SameSite=Strict';
127
- break;
128
- case 'none':
129
- str += '; SameSite=None';
130
- break;
131
- default:
132
- throw new TypeError('option sameSite is invalid');
133
- }
134
- }
135
- return str;
136
- };
137
- exports.serialize = serialize;
138
- /**
139
- * Module variables.
140
- * @private
141
- */
142
- const decode = decodeURIComponent;
143
- const encode = encodeURIComponent;
144
- const pairSplitRegExp = /; */;
145
- /**
146
- * RegExp to match field-content in RFC 7230 sec 3.2
147
- *
148
- * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
149
- * field-vchar = VCHAR / obs-text
150
- * obs-text = %x80-FF
151
- */
152
- const fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
153
- /**
154
- * Try decoding a string using a decoding function.
155
- *
156
- * @param {string} str
157
- * @param {function} decode
158
- * @private
159
- */
160
- const tryDecode = (str, decode) => {
161
- try {
162
- return decode(str);
163
- }
164
- catch (e) {
165
- return str;
166
- }
167
- };
168
- //# sourceMappingURL=cookie.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cookie.js","sourceRoot":"","sources":["../../../src/util/cookie/cookie.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD;;;;;GAKG;AAEH,YAAY,CAAC;;;AAEb;;;GAGG;AAEH;;;;;;;;;;GAUG;AACI,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,OAElC,EAAuB,EAAE;IACxB,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,MAAM,IAAI,SAAS,CAAC,+BAA+B,CAAC,CAAC;KACtD;IAED,MAAM,GAAG,GAAwB,EAAE,CAAA;IACnC,MAAM,GAAG,GAAG,OAAO,IAAI,EAAE,CAAC;IAC1B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IACzC,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,IAAI,MAAM,CAAC;IAEjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,IAAI,GAAG,KAAK,CA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,GAAG,IAAI,YAAY,CAAC;KACrB;IAED,IAAI,GAAG,CAAC,MAAM,EAAE;QACd,GAAG,IAAI,UAAU,CAAC;KACnB;IAED,IAAI,GAAG,CAAC,QAAQ,EAAE;QAChB,MAAM,QAAQ,GAAG,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ;YAC/C,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC;QAE9C,QAAQ,QAAQ,EAAE;YAChB,KAAK,IAAI;gBACP,GAAG,IAAI,mBAAmB,CAAC;gBAC3B,MAAM;YACR,KAAK,KAAK;gBACR,GAAG,IAAI,gBAAgB,CAAC;gBACxB,MAAM;YACR,KAAK,QAAQ;gBACX,GAAG,IAAI,mBAAmB,CAAC;gBAC3B,MAAM;YACR,KAAK,MAAM;gBACT,GAAG,IAAI,iBAAiB,CAAC;gBACzB,MAAM;YACR;gBACE,MAAM,IAAI,SAAS,CAAC,4BAA4B,CAAC,CAAC;SACrD;KACF;IAED,OAAO,GAAG,CAAC;AACb,CAAC,CAAA;AA9FY,QAAA,SAAS,aA8FrB;AAED;;;GAGG;AAEH,MAAM,MAAM,GAAG,kBAAkB,CAAC;AAClC,MAAM,MAAM,GAAG,kBAAkB,CAAC;AAClC,MAAM,eAAe,GAAG,KAAK,CAAC;AAE9B;;;;;;GAMG;AAEH,MAAM,kBAAkB,GAAG,uCAAuC,CAAC;AAEnE;;;;;;GAMG;AACH,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,MAA+B,EAAU,EAAE;IACzE,IAAI;QACF,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;KACpB;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,GAAG,CAAC;KACZ;AACH,CAAC,CAAA"}
@@ -1,16 +0,0 @@
1
- /// <reference types="node" />
2
- export declare const COOKIE: {
3
- parse: (str: string, options?: {
4
- decode?: ((value: string) => string) | undefined;
5
- } | undefined) => NodeJS.Dict<string>;
6
- serialize: (name: string, val: string, options?: {
7
- encode?: ((uriComponent: string | number | boolean) => string) | undefined;
8
- maxAge?: number | null | undefined;
9
- domain?: string | undefined;
10
- httpOnly?: boolean | undefined;
11
- secure?: boolean | undefined;
12
- path?: string | undefined;
13
- expires?: Date | undefined;
14
- sameSite?: true | "lax" | "strict" | "none" | undefined;
15
- } | undefined) => string;
16
- };
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.COOKIE = void 0;
4
- const cookie_1 = require("./cookie");
5
- exports.COOKIE = {
6
- parse: cookie_1.parse,
7
- serialize: cookie_1.serialize
8
- };
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/util/cookie/index.ts"],"names":[],"mappings":";;;AAAA,qCAA4C;AAE/B,QAAA,MAAM,GAAG;IAClB,KAAK,EAAL,cAAK;IACL,SAAS,EAAT,kBAAS;CACZ,CAAA"}
@@ -1,7 +0,0 @@
1
- /// <reference types="node" />
2
- export declare const UUID: {
3
- v4: (options?: {
4
- random?: Uint8Array | undefined;
5
- rng?: (() => Uint8Array) | undefined;
6
- } | undefined, buf?: Buffer | undefined, offset?: number | undefined) => string | Buffer;
7
- };
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UUID = void 0;
4
- const v4_1 = require("./v4");
5
- exports.UUID = {
6
- v4: v4_1.v4
7
- };
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/util/uuid/index.ts"],"names":[],"mappings":";;;AAAA,6BAA0B;AAEb,QAAA,IAAI,GAAG;IAChB,EAAE,EAAF,OAAE;CACL,CAAC"}
@@ -1,2 +0,0 @@
1
- declare const _default: RegExp;
2
- export default _default;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // https://github.com/uuidjs/uuid/blob/main/src/regex.js
4
- exports.default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
5
- //# sourceMappingURL=regex.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"regex.js","sourceRoot":"","sources":["../../../src/util/uuid/regex.ts"],"names":[],"mappings":";;AAAA,wDAAwD;AACxD,kBAAe,qHAAqH,CAAC"}
@@ -1 +0,0 @@
1
- export default function rng(): Uint8Array;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- // https://github.com/uuidjs/uuid/blob/main/src/rng.js
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const crypto_1 = __importDefault(require("crypto"));
8
- const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate
9
- let poolPtr = rnds8Pool.length;
10
- function rng() {
11
- if (poolPtr > rnds8Pool.length - 16) {
12
- crypto_1.default.randomFillSync(rnds8Pool);
13
- poolPtr = 0;
14
- }
15
- return rnds8Pool.slice(poolPtr, (poolPtr += 16));
16
- }
17
- exports.default = rng;
18
- //# sourceMappingURL=rng.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rng.js","sourceRoot":"","sources":["../../../src/util/uuid/rng.ts"],"names":[],"mappings":";AAAA,sDAAsD;;;;;AAEtD,oDAA4B;AAE5B,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,qCAAqC;AAC5E,IAAI,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC;AAE/B,SAAwB,GAAG;IACzB,IAAI,OAAO,GAAG,SAAS,CAAC,MAAM,GAAG,EAAE,EAAE;QACnC,gBAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACjC,OAAO,GAAG,CAAC,CAAC;KACb;IACD,OAAO,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;AACnD,CAAC;AAND,sBAMC"}
@@ -1,2 +0,0 @@
1
- declare const stringify: (arr: Uint8Array, offset?: number) => string;
2
- export default stringify;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- // https://github.com/uuidjs/uuid/blob/main/src/stringify.js
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const validate_1 = __importDefault(require("./validate"));
8
- /**
9
- * Convert array of 16 byte values to UUID string format of the form:
10
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
11
- */
12
- const byteToHex = [];
13
- for (let i = 0; i < 256; ++i) {
14
- byteToHex.push((i + 0x100).toString(16).substr(1));
15
- }
16
- const stringify = (arr, offset = 0) => {
17
- // Note: Be careful editing this code! It's been tuned for performance
18
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
19
- const uuid = (byteToHex[arr[offset + 0]] +
20
- byteToHex[arr[offset + 1]] +
21
- byteToHex[arr[offset + 2]] +
22
- byteToHex[arr[offset + 3]] +
23
- '-' +
24
- byteToHex[arr[offset + 4]] +
25
- byteToHex[arr[offset + 5]] +
26
- '-' +
27
- byteToHex[arr[offset + 6]] +
28
- byteToHex[arr[offset + 7]] +
29
- '-' +
30
- byteToHex[arr[offset + 8]] +
31
- byteToHex[arr[offset + 9]] +
32
- '-' +
33
- byteToHex[arr[offset + 10]] +
34
- byteToHex[arr[offset + 11]] +
35
- byteToHex[arr[offset + 12]] +
36
- byteToHex[arr[offset + 13]] +
37
- byteToHex[arr[offset + 14]] +
38
- byteToHex[arr[offset + 15]]).toLowerCase();
39
- // Consistency check for valid UUID. If this throws, it's likely due to one
40
- // of the following:
41
- // - One or more input array values don't map to a hex octet (leading to
42
- // "undefined" in the uuid)
43
- // - Invalid input values for the RFC `version` or `variant` fields
44
- if (!(0, validate_1.default)(uuid)) {
45
- throw TypeError('Stringified UUID is invalid');
46
- }
47
- return uuid;
48
- };
49
- exports.default = stringify;
50
- //# sourceMappingURL=stringify.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stringify.js","sourceRoot":"","sources":["../../../src/util/uuid/stringify.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;;;AAE5D,0DAAkC;AAElC;;;GAGG;AACH,MAAM,SAAS,GAAa,EAAE,CAAC;AAE/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,EAAE,CAAC,EAAE;IAC5B,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CACpD;AAED,MAAM,SAAS,GAAG,CAAC,GAAe,EAAE,MAAM,GAAG,CAAC,EAAU,EAAE;IACxD,uEAAuE;IACvE,oFAAoF;IACpF,MAAM,IAAI,GAAG,CACX,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1B,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1B,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1B,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1B,GAAG;QACH,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1B,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1B,GAAG;QACH,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1B,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1B,GAAG;QACH,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1B,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1B,GAAG;QACH,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;QAC3B,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;QAC3B,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;QAC3B,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;QAC3B,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;QAC3B,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAC5B,CAAC,WAAW,EAAE,CAAC;IAEhB,4EAA4E;IAC5E,oBAAoB;IACpB,wEAAwE;IACxE,2BAA2B;IAC3B,mEAAmE;IACnE,IAAI,CAAC,IAAA,kBAAQ,EAAC,IAAI,CAAC,EAAE;QACnB,MAAM,SAAS,CAAC,6BAA6B,CAAC,CAAC;KAChD;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAA;AAED,kBAAe,SAAS,CAAC"}
@@ -1,5 +0,0 @@
1
- /// <reference types="node" />
2
- export declare const v4: (options?: {
3
- random?: Uint8Array | undefined;
4
- rng?: (() => Uint8Array) | undefined;
5
- } | undefined, buf?: Buffer | undefined, offset?: number | undefined) => string | Buffer;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- // https://github.com/uuidjs/uuid/blob/main/src/v4.js
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.v4 = void 0;
8
- const rng_1 = __importDefault(require("./rng"));
9
- const stringify_1 = __importDefault(require("./stringify"));
10
- const v4 = (options, buf, offset) => {
11
- options = options || {};
12
- const rnds = options.random || (options.rng || rng_1.default)();
13
- // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
14
- rnds[6] = (rnds[6] & 0x0f) | 0x40;
15
- rnds[8] = (rnds[8] & 0x3f) | 0x80;
16
- // Copy bytes to buffer, if provided
17
- if (buf) {
18
- offset = offset || 0;
19
- for (let i = 0; i < 16; ++i) {
20
- buf[offset + i] = rnds[i];
21
- }
22
- return buf;
23
- }
24
- return (0, stringify_1.default)(rnds);
25
- };
26
- exports.v4 = v4;
27
- //# sourceMappingURL=v4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"v4.js","sourceRoot":"","sources":["../../../src/util/uuid/v4.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;;;;AAErD,gDAAwB;AACxB,4DAAoC;AAE7B,MAAM,EAAE,GAAG,CAAC,OAGlB,EAAE,GAAY,EAAE,MAAe,EAAE,EAAE;IAChC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;IAExB,MAAM,IAAI,GAAe,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,aAAG,CAAC,EAAE,CAAC;IAElE,gEAAgE;IAChE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAClC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAElC,oCAAoC;IACpC,IAAI,GAAG,EAAE;QACL,MAAM,GAAG,MAAM,IAAI,CAAC,CAAC;QAErB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YACzB,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;SAC7B;QAED,OAAO,GAAG,CAAC;KACd;IAED,OAAO,IAAA,mBAAS,EAAC,IAAI,CAAC,CAAC;AAC3B,CAAC,CAAA;AAxBY,QAAA,EAAE,MAwBd"}
@@ -1,2 +0,0 @@
1
- declare const validate: (uuid: string) => boolean;
2
- export default validate;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- // https://github.com/uuidjs/uuid/blob/main/src/validate.js
7
- const regex_1 = __importDefault(require("./regex"));
8
- const validate = (uuid) => {
9
- return typeof uuid === 'string' && regex_1.default.test(uuid);
10
- };
11
- exports.default = validate;
12
- //# sourceMappingURL=validate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/util/uuid/validate.ts"],"names":[],"mappings":";;;;;AAAA,2DAA2D;AAC3D,oDAA4B;AAE5B,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE;IAChC,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtD,CAAC,CAAA;AAED,kBAAe,QAAQ,CAAC"}
@@ -1,207 +0,0 @@
1
- // https://github.com/jshttp/cookie/blob/master/index.js
2
- /*!
3
- * cookie
4
- * Copyright(c) 2012-2014 Roman Shtylman
5
- * Copyright(c) 2015 Douglas Christopher Wilson
6
- * MIT Licensed
7
- */
8
-
9
- 'use strict';
10
-
11
- /**
12
- * Module exports.
13
- * @public
14
- */
15
-
16
- /**
17
- * Parse a cookie header.
18
- *
19
- * Parse the given cookie header string into an object
20
- * The object has the various cookies as keys(names) => values
21
- *
22
- * @param {string} str
23
- * @param {object} [options]
24
- * @return {object}
25
- * @public
26
- */
27
- export const parse = (str: string, options?: {
28
- decode?: (value: string) => string;
29
- }): NodeJS.Dict<string> => {
30
- if (typeof str !== 'string') {
31
- throw new TypeError('argument str must be a string');
32
- }
33
-
34
- const obj: NodeJS.Dict<string> = {}
35
- const opt = options || {};
36
- const pairs = str.split(pairSplitRegExp);
37
- const dec = opt.decode || decode;
38
-
39
- for (let i = 0; i < pairs.length; i++) {
40
- const pair = pairs[i];
41
- let eq_idx = pair.indexOf('=');
42
-
43
- // skip things that don't look like key=value
44
- if (eq_idx < 0) {
45
- continue;
46
- }
47
-
48
- const key = pair.substr(0, eq_idx).trim()
49
- let val = pair.substr(++eq_idx, pair.length).trim();
50
-
51
- // quoted values
52
- if ('"' == val[0]) {
53
- val = val.slice(1, -1);
54
- }
55
- // only assign once
56
- if (undefined == obj[key]) {
57
- obj[key] = tryDecode(val, dec);
58
- }
59
- }
60
-
61
- return obj;
62
- }
63
-
64
- /**
65
- * Serialize data into a cookie header.
66
- *
67
- * Serialize the a name value pair into a cookie string suitable for
68
- * http headers. An optional options object specified cookie parameters.
69
- *
70
- * serialize('foo', 'bar', { httpOnly: true })
71
- * => "foo=bar; httpOnly"
72
- *
73
- * @param {string} name
74
- * @param {string} val
75
- * @param {object} [options]
76
- * @return {string}
77
- * @public
78
- */
79
- export const serialize = (name: string, val: string, options?: {
80
- encode?: (uriComponent: string | number | boolean) => string;
81
- maxAge?: number | null;
82
- domain?: string;
83
- httpOnly?: boolean;
84
- secure?: boolean;
85
- path?: string;
86
- expires?: Date;
87
- sameSite?: "lax" | "strict" | "none" | true;
88
- }): string => {
89
- const opt = options || {};
90
- const enc = opt.encode || encode;
91
-
92
- if (typeof enc !== 'function') {
93
- throw new TypeError('option encode is invalid');
94
- }
95
-
96
- if (!fieldContentRegExp.test(name)) {
97
- throw new TypeError('argument name is invalid');
98
- }
99
-
100
- const value = enc(val);
101
-
102
- if (value && !fieldContentRegExp.test(value)) {
103
- throw new TypeError('argument val is invalid');
104
- }
105
-
106
- let str = name + '=' + value;
107
-
108
- if (null != opt.maxAge) {
109
- const maxAge = opt.maxAge - 0;
110
-
111
- if (isNaN(maxAge) || !isFinite(maxAge)) {
112
- throw new TypeError('option maxAge is invalid')
113
- }
114
-
115
- str += '; Max-Age=' + Math.floor(maxAge);
116
- }
117
-
118
- if (opt.domain) {
119
- if (!fieldContentRegExp.test(opt.domain)) {
120
- throw new TypeError('option domain is invalid');
121
- }
122
-
123
- str += '; Domain=' + opt.domain;
124
- }
125
-
126
- if (opt.path) {
127
- if (!fieldContentRegExp.test(opt.path)) {
128
- throw new TypeError('option path is invalid');
129
- }
130
-
131
- str += '; Path=' + opt.path;
132
- }
133
-
134
- if (opt.expires) {
135
- if (typeof opt.expires.toUTCString !== 'function') {
136
- throw new TypeError('option expires is invalid');
137
- }
138
-
139
- str += '; Expires=' + opt.expires.toUTCString();
140
- }
141
-
142
- if (opt.httpOnly) {
143
- str += '; HttpOnly';
144
- }
145
-
146
- if (opt.secure) {
147
- str += '; Secure';
148
- }
149
-
150
- if (opt.sameSite) {
151
- const sameSite = typeof opt.sameSite === 'string'
152
- ? opt.sameSite.toLowerCase() : opt.sameSite;
153
-
154
- switch (sameSite) {
155
- case true:
156
- str += '; SameSite=Strict';
157
- break;
158
- case 'lax':
159
- str += '; SameSite=Lax';
160
- break;
161
- case 'strict':
162
- str += '; SameSite=Strict';
163
- break;
164
- case 'none':
165
- str += '; SameSite=None';
166
- break;
167
- default:
168
- throw new TypeError('option sameSite is invalid');
169
- }
170
- }
171
-
172
- return str;
173
- }
174
-
175
- /**
176
- * Module variables.
177
- * @private
178
- */
179
-
180
- const decode = decodeURIComponent;
181
- const encode = encodeURIComponent;
182
- const pairSplitRegExp = /; */;
183
-
184
- /**
185
- * RegExp to match field-content in RFC 7230 sec 3.2
186
- *
187
- * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
188
- * field-vchar = VCHAR / obs-text
189
- * obs-text = %x80-FF
190
- */
191
-
192
- const fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
193
-
194
- /**
195
- * Try decoding a string using a decoding function.
196
- *
197
- * @param {string} str
198
- * @param {function} decode
199
- * @private
200
- */
201
- const tryDecode = (str: string, decode: (str: string) => string): string => {
202
- try {
203
- return decode(str);
204
- } catch (e) {
205
- return str;
206
- }
207
- }
@@ -1,6 +0,0 @@
1
- import { parse, serialize } from "./cookie";
2
-
3
- export const COOKIE = {
4
- parse,
5
- serialize
6
- }
@@ -1,5 +0,0 @@
1
- import { v4 } from './v4';
2
-
3
- export const UUID = {
4
- v4
5
- };
@@ -1,2 +0,0 @@
1
- // https://github.com/uuidjs/uuid/blob/main/src/regex.js
2
- export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
@@ -1,14 +0,0 @@
1
- // https://github.com/uuidjs/uuid/blob/main/src/rng.js
2
-
3
- import crypto from 'crypto';
4
-
5
- const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate
6
- let poolPtr = rnds8Pool.length;
7
-
8
- export default function rng() {
9
- if (poolPtr > rnds8Pool.length - 16) {
10
- crypto.randomFillSync(rnds8Pool);
11
- poolPtr = 0;
12
- }
13
- return rnds8Pool.slice(poolPtr, (poolPtr += 16));
14
- }