@takeshape/util 7.194.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 (58) hide show
  1. package/README.md +6 -0
  2. package/es/arrays.js +12 -0
  3. package/es/clone.js +3 -0
  4. package/es/delay.js +23 -0
  5. package/es/encryption.js +60 -0
  6. package/es/gzip.js +4 -0
  7. package/es/index.js +10 -0
  8. package/es/map.js +3 -0
  9. package/es/merge.js +40 -0
  10. package/es/mime.js +30 -0
  11. package/es/predicate.js +9 -0
  12. package/es/strings.js +14 -0
  13. package/es/types.js +11 -0
  14. package/es/unix-to-iso.js +3 -0
  15. package/es/value.js +4 -0
  16. package/lib/arrays.d.ts +5 -0
  17. package/lib/arrays.d.ts.map +1 -0
  18. package/lib/arrays.js +25 -0
  19. package/lib/clone.d.ts +2 -0
  20. package/lib/clone.d.ts.map +1 -0
  21. package/lib/clone.js +10 -0
  22. package/lib/delay.d.ts +7 -0
  23. package/lib/delay.d.ts.map +1 -0
  24. package/lib/delay.js +33 -0
  25. package/lib/encryption.d.ts +16 -0
  26. package/lib/encryption.d.ts.map +1 -0
  27. package/lib/encryption.js +82 -0
  28. package/lib/gzip.d.ts +5 -0
  29. package/lib/gzip.d.ts.map +1 -0
  30. package/lib/gzip.js +17 -0
  31. package/lib/index.d.ts +11 -0
  32. package/lib/index.d.ts.map +1 -0
  33. package/lib/index.js +135 -0
  34. package/lib/map.d.ts +2 -0
  35. package/lib/map.d.ts.map +1 -0
  36. package/lib/map.js +10 -0
  37. package/lib/merge.d.ts +11 -0
  38. package/lib/merge.d.ts.map +1 -0
  39. package/lib/merge.js +54 -0
  40. package/lib/mime.d.ts +13 -0
  41. package/lib/mime.d.ts.map +1 -0
  42. package/lib/mime.js +45 -0
  43. package/lib/predicate.d.ts +5 -0
  44. package/lib/predicate.d.ts.map +1 -0
  45. package/lib/predicate.js +20 -0
  46. package/lib/strings.d.ts +5 -0
  47. package/lib/strings.d.ts.map +1 -0
  48. package/lib/strings.js +34 -0
  49. package/lib/types.d.ts +19 -0
  50. package/lib/types.d.ts.map +1 -0
  51. package/lib/types.js +19 -0
  52. package/lib/unix-to-iso.d.ts +2 -0
  53. package/lib/unix-to-iso.d.ts.map +1 -0
  54. package/lib/unix-to-iso.js +10 -0
  55. package/lib/value.d.ts +3 -0
  56. package/lib/value.d.ts.map +1 -0
  57. package/lib/value.js +14 -0
  58. package/package.json +48 -0
package/README.md ADDED
@@ -0,0 +1,6 @@
1
+ # Util
2
+
3
+ ## Summary
4
+
5
+ A grab-bag of general purpose utility functions. The home for functions that need to be shared but small enough to not
6
+ warrant their own package
package/es/arrays.js ADDED
@@ -0,0 +1,12 @@
1
+ export function arrayContainsAll(a, b) {
2
+ return a.every(value => b.includes(value));
3
+ }
4
+ export function setIsEqual(a, b) {
5
+ return arrayContainsAll(a, b) && arrayContainsAll(b, a);
6
+ }
7
+ export function isDefined(x) {
8
+ return x !== null && x !== undefined;
9
+ }
10
+ export function toArray(obj) {
11
+ return obj ? [obj] : [];
12
+ }
package/es/clone.js ADDED
@@ -0,0 +1,3 @@
1
+ export function deepClone(input) {
2
+ return JSON.parse(JSON.stringify(input));
3
+ }
package/es/delay.js ADDED
@@ -0,0 +1,23 @@
1
+ export const delay = async (timeout, value) => new Promise(resolve => {
2
+ setTimeout(resolve, timeout, value);
3
+ });
4
+
5
+ function randomInt(minimum, maximum) {
6
+ // eslint-disable-next-line security-node/detect-insecure-randomness
7
+ const co = Math.random() * (maximum - minimum + 1);
8
+ return Math.floor(co + minimum);
9
+ } // Decorrelated jitter backoff:
10
+ // https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
11
+
12
+
13
+ export async function backoff(baseDelay, maxDelay, attempt = {
14
+ num: 1,
15
+ lastDelay: 0
16
+ }) {
17
+ const msec = Math.min(maxDelay, randomInt(baseDelay, (attempt.lastDelay || baseDelay) * 3));
18
+ await delay(msec);
19
+ return {
20
+ num: attempt.num + 1,
21
+ lastDelay: msec
22
+ };
23
+ }
@@ -0,0 +1,60 @@
1
+ import crypto from 'crypto';
2
+ import KMS from 'aws-sdk/clients/kms';
3
+ import curry from 'lodash/curry';
4
+ const CIPHER_ALGORITHM = 'aes-256-ctr';
5
+ const IV_LENGTH = 16;
6
+ const KEY_ENCODING = 'base64';
7
+ const CIPHER_TEXT_ENCODING = 'base64';
8
+ const CONTENT_ENCODING = 'utf8';
9
+ export const encrypt = curry((key, plaintext) => {
10
+ // Initialization Vector
11
+ const iv = crypto.randomBytes(IV_LENGTH);
12
+ const cipher = crypto.createCipheriv(CIPHER_ALGORITHM, Buffer.from(key, KEY_ENCODING), iv);
13
+ const cipherText = cipher.update(Buffer.from(plaintext, CONTENT_ENCODING));
14
+ return Buffer.concat([iv, cipherText, cipher.final()]).toString(CIPHER_TEXT_ENCODING);
15
+ });
16
+ export const decrypt = curry((key, encrypted) => {
17
+ const input = Buffer.from(encrypted, CIPHER_TEXT_ENCODING);
18
+
19
+ if (input.length < IV_LENGTH + 1) {
20
+ throw new TypeError('Provided "encrypted" must decrypt to a non-empty string');
21
+ } // Initialization Vector
22
+
23
+
24
+ const iv = input.slice(0, IV_LENGTH);
25
+ const decipher = crypto.createDecipheriv(CIPHER_ALGORITHM, Buffer.from(key, KEY_ENCODING), iv);
26
+ const cipherText = input.slice(IV_LENGTH);
27
+ return Buffer.concat([decipher.update(cipherText), decipher.final()]).toString(CONTENT_ENCODING);
28
+ });
29
+ export async function generateDataKey(config) {
30
+ const {
31
+ region,
32
+ env
33
+ } = config;
34
+ const kms = new KMS({
35
+ region
36
+ });
37
+ const res = await kms.generateDataKey({
38
+ KeyId: `alias/takeshape-${env}`,
39
+ KeySpec: 'AES_256'
40
+ }).promise();
41
+ return {
42
+ encryptedKey: res.CiphertextBlob.toString(KEY_ENCODING),
43
+ plaintextKey: res.Plaintext.toString(KEY_ENCODING)
44
+ };
45
+ }
46
+ export async function decryptDataKey(keyStr, config) {
47
+ const {
48
+ region
49
+ } = config;
50
+ const kms = new KMS({
51
+ region
52
+ });
53
+ const res = await kms.decrypt({
54
+ CiphertextBlob: Buffer.from(keyStr, KEY_ENCODING)
55
+ }).promise();
56
+ return {
57
+ encryptedKey: keyStr,
58
+ plaintextKey: res.Plaintext.toString(KEY_ENCODING)
59
+ };
60
+ }
package/es/gzip.js ADDED
@@ -0,0 +1,4 @@
1
+ import pify from 'pify';
2
+ import zlib from 'zlib';
3
+ export const gzip = pify(zlib.gzip);
4
+ export const gunzip = pify(zlib.gunzip);
package/es/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export * from './types';
2
+ export * from './mime';
3
+ export * from './gzip';
4
+ export * from './delay';
5
+ export * from './strings';
6
+ export * from './unix-to-iso';
7
+ export * from './arrays';
8
+ export * from './value';
9
+ export * from './clone';
10
+ export * from './predicate';
package/es/map.js ADDED
@@ -0,0 +1,3 @@
1
+ export function mapKeysToArray(map) {
2
+ return Array.from(map.keys());
3
+ }
package/es/merge.js ADDED
@@ -0,0 +1,40 @@
1
+ import isArray from 'lodash/isArray';
2
+ import mergeWith from 'lodash/mergeWith';
3
+ import merge from 'lodash/merge';
4
+ import isNull from 'lodash/isNull';
5
+
6
+ /**
7
+ * Lodash `mergeWith` customizer to concat arrays
8
+ */
9
+ const arrayConcatCustomizer = (value, srcValue) => {
10
+ if (isArray(value)) {
11
+ return value.concat(srcValue);
12
+ }
13
+ };
14
+ /**
15
+ * Lodash `mergeWith` loaded with a customizer that concatenates arrays for a
16
+ * deeper merge.
17
+ */
18
+
19
+
20
+ export function mergeWithArrayConcat(object, source) {
21
+ return mergeWith(object, source, arrayConcatCustomizer);
22
+ }
23
+ /**
24
+ * Lodash `mergeWith` customizer to merge arrays
25
+ */
26
+
27
+ const arrayMergeCustomizer = (value, srcValue) => {
28
+ if (isArray(value) && isArray(srcValue)) {
29
+ return merge(value, srcValue).filter(val => !isNull(val));
30
+ }
31
+ };
32
+ /**
33
+ * Lodash `mergeWith` loaded with a customizer that merges arrays at the same
34
+ * object path. Array items set to `null` will be removed.
35
+ */
36
+
37
+
38
+ export function mergeWithArrayMerge(object, source) {
39
+ return mergeWith(object, source, arrayMergeCustomizer);
40
+ }
package/es/mime.js ADDED
@@ -0,0 +1,30 @@
1
+ import mime from 'mime-types';
2
+ const compressedMimeTypes = new Set(['application/atom+xml', 'application/javascript', 'application/json', 'application/ld+json', 'application/manifest+json', 'application/rdf+xml', 'application/rss+xml', 'application/schema+json', 'application/vnd.geo+json', 'application/vnd.ms-fontobject', 'application/x-font-ttf', 'application/x-javascript', 'application/x-web-app-manifest+json', 'application/xhtml+xml', 'application/xml', 'font/eot', 'font/otf', 'font/opentype', 'image/bmp', 'image/svg+xml', 'image/vnd.microsoft.icon', 'image/x-icon', 'text/cache-manifest', 'text/css', 'text/html', 'text/javascript', 'text/plain', 'text/vcard', 'text/vnd.rim.location.xloc', 'text/vtt', 'text/x-component', 'text/x-cross-domain-policy', 'text/xml']); // application/octetstream
3
+
4
+ const DEFAULT_TYPE = mime.lookup('bin');
5
+ /**
6
+ * Gets the content type of the file, based on it's extension.
7
+ * @param {String} src Path to file fow which content type should be evaluated.
8
+ * @return {String} Returns string with content type and charset.
9
+ */
10
+
11
+ export function contentType(src) {
12
+ let type = (mime.lookup(src) || DEFAULT_TYPE).replace('-', '');
13
+ const charset = mime.charset(type);
14
+
15
+ if (charset) {
16
+ type += '; charset=' + charset;
17
+ }
18
+
19
+ return type;
20
+ }
21
+ /**
22
+ * Determines whether we should compress based on file extension
23
+ * @param {String} src Path to file fow which content type should be evaluated.
24
+ * @return {Boolean} Returns true if we should compress
25
+ */
26
+
27
+ export function shouldCompress(src) {
28
+ const mimeType = mime.lookup(src);
29
+ return Boolean(mimeType && compressedMimeTypes.has(mimeType));
30
+ }
@@ -0,0 +1,9 @@
1
+ export function not(predicate) {
2
+ return value => !predicate(value);
3
+ }
4
+ export function equals(a) {
5
+ return b => a === b;
6
+ }
7
+ export function falsy(obj) {
8
+ return !obj;
9
+ }
package/es/strings.js ADDED
@@ -0,0 +1,14 @@
1
+ import upperFirst from 'lodash/upperFirst';
2
+ import _camelCase from 'lodash/camelCase';
3
+ import isEmpty from 'lodash/isEmpty';
4
+ import isString from 'lodash/isString';
5
+ export const camelCase = _camelCase;
6
+ export function upperCamel(str) {
7
+ return upperFirst(camelCase(str));
8
+ }
9
+ export function isUuid(str) {
10
+ return Boolean(/\w{8,}(-\w{4,}){3,}-\w{12,}/.exec(str));
11
+ }
12
+ export function isEmptyString(str) {
13
+ return isString(str) && isEmpty(str);
14
+ }
package/es/types.js ADDED
@@ -0,0 +1,11 @@
1
+ export function isObject(obj) {
2
+ return obj !== null && typeof obj === 'object';
3
+ }
4
+
5
+ /**
6
+ * Create enum matchers, which will return the enum entry from the provided
7
+ * enum when the value matches.
8
+ */
9
+ export function createEnumMatcher(enumVariable) {
10
+ return testValue => Object.entries(enumVariable).find(([, enumValue]) => enumValue === testValue);
11
+ }
@@ -0,0 +1,3 @@
1
+ export function unixToISO(unix) {
2
+ return new Date(unix * 1000).toISOString();
3
+ }
package/es/value.js ADDED
@@ -0,0 +1,4 @@
1
+ export function value(x) {
2
+ return () => x;
3
+ }
4
+ export default value;
@@ -0,0 +1,5 @@
1
+ export declare function arrayContainsAll<T>(a: T[], b: T[]): boolean;
2
+ export declare function setIsEqual<T>(a: T[], b: T[]): boolean;
3
+ export declare function isDefined<T>(x: T | null | undefined): x is T;
4
+ export declare function toArray<T>(obj: T | null): T[];
5
+ //# sourceMappingURL=arrays.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrays.d.ts","sourceRoot":"","sources":["../../src/arrays.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAE3D;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAErD;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,CAAC,IAAI,CAAC,CAE5D;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,CAE7C"}
package/lib/arrays.js ADDED
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.arrayContainsAll = arrayContainsAll;
7
+ exports.setIsEqual = setIsEqual;
8
+ exports.isDefined = isDefined;
9
+ exports.toArray = toArray;
10
+
11
+ function arrayContainsAll(a, b) {
12
+ return a.every(value => b.includes(value));
13
+ }
14
+
15
+ function setIsEqual(a, b) {
16
+ return arrayContainsAll(a, b) && arrayContainsAll(b, a);
17
+ }
18
+
19
+ function isDefined(x) {
20
+ return x !== null && x !== undefined;
21
+ }
22
+
23
+ function toArray(obj) {
24
+ return obj ? [obj] : [];
25
+ }
package/lib/clone.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare function deepClone<T>(input: T): T;
2
+ //# sourceMappingURL=clone.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../../src/clone.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAExC"}
package/lib/clone.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.deepClone = deepClone;
7
+
8
+ function deepClone(input) {
9
+ return JSON.parse(JSON.stringify(input));
10
+ }
package/lib/delay.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export declare const delay: <T>(timeout: number, value?: T | undefined) => Promise<T>;
2
+ export interface Attempt {
3
+ num: number;
4
+ lastDelay: number;
5
+ }
6
+ export declare function backoff(baseDelay: number, maxDelay: number, attempt?: Attempt): Promise<Attempt>;
7
+ //# sourceMappingURL=delay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../src/delay.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,eAAsB,MAAM,sCAG1C,CAAC;AAEL,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB;AAUD,wBAAsB,OAAO,CAC3B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,OAAgC,GACxC,OAAO,CAAC,OAAO,CAAC,CAOlB"}
package/lib/delay.js ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.backoff = backoff;
7
+ exports.delay = void 0;
8
+
9
+ const delay = async (timeout, value) => new Promise(resolve => {
10
+ setTimeout(resolve, timeout, value);
11
+ });
12
+
13
+ exports.delay = delay;
14
+
15
+ function randomInt(minimum, maximum) {
16
+ // eslint-disable-next-line security-node/detect-insecure-randomness
17
+ const co = Math.random() * (maximum - minimum + 1);
18
+ return Math.floor(co + minimum);
19
+ } // Decorrelated jitter backoff:
20
+ // https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
21
+
22
+
23
+ async function backoff(baseDelay, maxDelay, attempt = {
24
+ num: 1,
25
+ lastDelay: 0
26
+ }) {
27
+ const msec = Math.min(maxDelay, randomInt(baseDelay, (attempt.lastDelay || baseDelay) * 3));
28
+ await delay(msec);
29
+ return {
30
+ num: attempt.num + 1,
31
+ lastDelay: msec
32
+ };
33
+ }
@@ -0,0 +1,16 @@
1
+ /// <reference types="lodash" />
2
+ export interface DataKeyConfig {
3
+ region?: string;
4
+ env: string;
5
+ }
6
+ export declare const encrypt: import("lodash").CurriedFunction2<string, string, string>;
7
+ export declare const decrypt: import("lodash").CurriedFunction2<string, string, string>;
8
+ export declare function generateDataKey(config: DataKeyConfig): Promise<{
9
+ encryptedKey: string;
10
+ plaintextKey: string;
11
+ }>;
12
+ export declare function decryptDataKey(keyStr: string, config: DataKeyConfig): Promise<{
13
+ encryptedKey: string;
14
+ plaintextKey: string;
15
+ }>;
16
+ //# sourceMappingURL=encryption.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/encryption.ts"],"names":[],"mappings":";AAUA,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,OAAO,2DAOlB,CAAC;AAEH,eAAO,MAAM,OAAO,2DAalB,CAAC;AAEH,wBAAsB,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAC,CAAC,CAelH;AAED,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAC,CAAC,CASvD"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.generateDataKey = generateDataKey;
7
+ exports.decryptDataKey = decryptDataKey;
8
+ exports.decrypt = exports.encrypt = void 0;
9
+
10
+ var _crypto = _interopRequireDefault(require("crypto"));
11
+
12
+ var _kms = _interopRequireDefault(require("aws-sdk/clients/kms"));
13
+
14
+ var _curry = _interopRequireDefault(require("lodash/curry"));
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ const CIPHER_ALGORITHM = 'aes-256-ctr';
19
+ const IV_LENGTH = 16;
20
+ const KEY_ENCODING = 'base64';
21
+ const CIPHER_TEXT_ENCODING = 'base64';
22
+ const CONTENT_ENCODING = 'utf8';
23
+ const encrypt = (0, _curry.default)((key, plaintext) => {
24
+ // Initialization Vector
25
+ const iv = _crypto.default.randomBytes(IV_LENGTH);
26
+
27
+ const cipher = _crypto.default.createCipheriv(CIPHER_ALGORITHM, Buffer.from(key, KEY_ENCODING), iv);
28
+
29
+ const cipherText = cipher.update(Buffer.from(plaintext, CONTENT_ENCODING));
30
+ return Buffer.concat([iv, cipherText, cipher.final()]).toString(CIPHER_TEXT_ENCODING);
31
+ });
32
+ exports.encrypt = encrypt;
33
+ const decrypt = (0, _curry.default)((key, encrypted) => {
34
+ const input = Buffer.from(encrypted, CIPHER_TEXT_ENCODING);
35
+
36
+ if (input.length < IV_LENGTH + 1) {
37
+ throw new TypeError('Provided "encrypted" must decrypt to a non-empty string');
38
+ } // Initialization Vector
39
+
40
+
41
+ const iv = input.slice(0, IV_LENGTH);
42
+
43
+ const decipher = _crypto.default.createDecipheriv(CIPHER_ALGORITHM, Buffer.from(key, KEY_ENCODING), iv);
44
+
45
+ const cipherText = input.slice(IV_LENGTH);
46
+ return Buffer.concat([decipher.update(cipherText), decipher.final()]).toString(CONTENT_ENCODING);
47
+ });
48
+ exports.decrypt = decrypt;
49
+
50
+ async function generateDataKey(config) {
51
+ const {
52
+ region,
53
+ env
54
+ } = config;
55
+ const kms = new _kms.default({
56
+ region
57
+ });
58
+ const res = await kms.generateDataKey({
59
+ KeyId: `alias/takeshape-${env}`,
60
+ KeySpec: 'AES_256'
61
+ }).promise();
62
+ return {
63
+ encryptedKey: res.CiphertextBlob.toString(KEY_ENCODING),
64
+ plaintextKey: res.Plaintext.toString(KEY_ENCODING)
65
+ };
66
+ }
67
+
68
+ async function decryptDataKey(keyStr, config) {
69
+ const {
70
+ region
71
+ } = config;
72
+ const kms = new _kms.default({
73
+ region
74
+ });
75
+ const res = await kms.decrypt({
76
+ CiphertextBlob: Buffer.from(keyStr, KEY_ENCODING)
77
+ }).promise();
78
+ return {
79
+ encryptedKey: keyStr,
80
+ plaintextKey: res.Plaintext.toString(KEY_ENCODING)
81
+ };
82
+ }
package/lib/gzip.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /// <reference types="node" />
2
+ export declare type GzipInputType = string | ArrayBuffer | NodeJS.ArrayBufferView;
3
+ export declare const gzip: (input: GzipInputType) => Promise<Buffer>;
4
+ export declare const gunzip: (input: GzipInputType) => Promise<Buffer>;
5
+ //# sourceMappingURL=gzip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gzip.d.ts","sourceRoot":"","sources":["../../src/gzip.ts"],"names":[],"mappings":";AAGA,oBAAY,aAAa,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC,eAAe,CAAC;AAE1E,eAAO,MAAM,IAAI,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC,MAAM,CAAmB,CAAC;AAC/E,eAAO,MAAM,MAAM,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC,MAAM,CAAqB,CAAC"}
package/lib/gzip.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.gunzip = exports.gzip = void 0;
7
+
8
+ var _pify = _interopRequireDefault(require("pify"));
9
+
10
+ var _zlib = _interopRequireDefault(require("zlib"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ const gzip = (0, _pify.default)(_zlib.default.gzip);
15
+ exports.gzip = gzip;
16
+ const gunzip = (0, _pify.default)(_zlib.default.gunzip);
17
+ exports.gunzip = gunzip;
package/lib/index.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export * from './types';
2
+ export * from './mime';
3
+ export * from './gzip';
4
+ export * from './delay';
5
+ export * from './strings';
6
+ export * from './unix-to-iso';
7
+ export * from './arrays';
8
+ export * from './value';
9
+ export * from './clone';
10
+ export * from './predicate';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _types = require("./types");
8
+
9
+ Object.keys(_types).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _types[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _types[key];
16
+ }
17
+ });
18
+ });
19
+
20
+ var _mime = require("./mime");
21
+
22
+ Object.keys(_mime).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _mime[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function () {
28
+ return _mime[key];
29
+ }
30
+ });
31
+ });
32
+
33
+ var _gzip = require("./gzip");
34
+
35
+ Object.keys(_gzip).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (key in exports && exports[key] === _gzip[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function () {
41
+ return _gzip[key];
42
+ }
43
+ });
44
+ });
45
+
46
+ var _delay = require("./delay");
47
+
48
+ Object.keys(_delay).forEach(function (key) {
49
+ if (key === "default" || key === "__esModule") return;
50
+ if (key in exports && exports[key] === _delay[key]) return;
51
+ Object.defineProperty(exports, key, {
52
+ enumerable: true,
53
+ get: function () {
54
+ return _delay[key];
55
+ }
56
+ });
57
+ });
58
+
59
+ var _strings = require("./strings");
60
+
61
+ Object.keys(_strings).forEach(function (key) {
62
+ if (key === "default" || key === "__esModule") return;
63
+ if (key in exports && exports[key] === _strings[key]) return;
64
+ Object.defineProperty(exports, key, {
65
+ enumerable: true,
66
+ get: function () {
67
+ return _strings[key];
68
+ }
69
+ });
70
+ });
71
+
72
+ var _unixToIso = require("./unix-to-iso");
73
+
74
+ Object.keys(_unixToIso).forEach(function (key) {
75
+ if (key === "default" || key === "__esModule") return;
76
+ if (key in exports && exports[key] === _unixToIso[key]) return;
77
+ Object.defineProperty(exports, key, {
78
+ enumerable: true,
79
+ get: function () {
80
+ return _unixToIso[key];
81
+ }
82
+ });
83
+ });
84
+
85
+ var _arrays = require("./arrays");
86
+
87
+ Object.keys(_arrays).forEach(function (key) {
88
+ if (key === "default" || key === "__esModule") return;
89
+ if (key in exports && exports[key] === _arrays[key]) return;
90
+ Object.defineProperty(exports, key, {
91
+ enumerable: true,
92
+ get: function () {
93
+ return _arrays[key];
94
+ }
95
+ });
96
+ });
97
+
98
+ var _value = require("./value");
99
+
100
+ Object.keys(_value).forEach(function (key) {
101
+ if (key === "default" || key === "__esModule") return;
102
+ if (key in exports && exports[key] === _value[key]) return;
103
+ Object.defineProperty(exports, key, {
104
+ enumerable: true,
105
+ get: function () {
106
+ return _value[key];
107
+ }
108
+ });
109
+ });
110
+
111
+ var _clone = require("./clone");
112
+
113
+ Object.keys(_clone).forEach(function (key) {
114
+ if (key === "default" || key === "__esModule") return;
115
+ if (key in exports && exports[key] === _clone[key]) return;
116
+ Object.defineProperty(exports, key, {
117
+ enumerable: true,
118
+ get: function () {
119
+ return _clone[key];
120
+ }
121
+ });
122
+ });
123
+
124
+ var _predicate = require("./predicate");
125
+
126
+ Object.keys(_predicate).forEach(function (key) {
127
+ if (key === "default" || key === "__esModule") return;
128
+ if (key in exports && exports[key] === _predicate[key]) return;
129
+ Object.defineProperty(exports, key, {
130
+ enumerable: true,
131
+ get: function () {
132
+ return _predicate[key];
133
+ }
134
+ });
135
+ });
package/lib/map.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare function mapKeysToArray<T>(map: Map<T, unknown>): T[];
2
+ //# sourceMappingURL=map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/map.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAE3D"}
package/lib/map.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.mapKeysToArray = mapKeysToArray;
7
+
8
+ function mapKeysToArray(map) {
9
+ return Array.from(map.keys());
10
+ }
package/lib/merge.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Lodash `mergeWith` loaded with a customizer that concatenates arrays for a
3
+ * deeper merge.
4
+ */
5
+ export declare function mergeWithArrayConcat<TObject, TSource>(object: TObject, source: TSource): TObject & TSource;
6
+ /**
7
+ * Lodash `mergeWith` loaded with a customizer that merges arrays at the same
8
+ * object path. Array items set to `null` will be removed.
9
+ */
10
+ export declare function mergeWithArrayMerge<TObject, TSource>(object: TObject, source: TSource): TObject & TSource;
11
+ //# sourceMappingURL=merge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/merge.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,qBAEtF;AAWD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,qBAErF"}
package/lib/merge.js ADDED
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.mergeWithArrayConcat = mergeWithArrayConcat;
7
+ exports.mergeWithArrayMerge = mergeWithArrayMerge;
8
+
9
+ var _isArray = _interopRequireDefault(require("lodash/isArray"));
10
+
11
+ var _mergeWith = _interopRequireDefault(require("lodash/mergeWith"));
12
+
13
+ var _merge = _interopRequireDefault(require("lodash/merge"));
14
+
15
+ var _isNull = _interopRequireDefault(require("lodash/isNull"));
16
+
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+
19
+ /**
20
+ * Lodash `mergeWith` customizer to concat arrays
21
+ */
22
+ const arrayConcatCustomizer = (value, srcValue) => {
23
+ if ((0, _isArray.default)(value)) {
24
+ return value.concat(srcValue);
25
+ }
26
+ };
27
+ /**
28
+ * Lodash `mergeWith` loaded with a customizer that concatenates arrays for a
29
+ * deeper merge.
30
+ */
31
+
32
+
33
+ function mergeWithArrayConcat(object, source) {
34
+ return (0, _mergeWith.default)(object, source, arrayConcatCustomizer);
35
+ }
36
+ /**
37
+ * Lodash `mergeWith` customizer to merge arrays
38
+ */
39
+
40
+
41
+ const arrayMergeCustomizer = (value, srcValue) => {
42
+ if ((0, _isArray.default)(value) && (0, _isArray.default)(srcValue)) {
43
+ return (0, _merge.default)(value, srcValue).filter(val => !(0, _isNull.default)(val));
44
+ }
45
+ };
46
+ /**
47
+ * Lodash `mergeWith` loaded with a customizer that merges arrays at the same
48
+ * object path. Array items set to `null` will be removed.
49
+ */
50
+
51
+
52
+ function mergeWithArrayMerge(object, source) {
53
+ return (0, _mergeWith.default)(object, source, arrayMergeCustomizer);
54
+ }
package/lib/mime.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Gets the content type of the file, based on it's extension.
3
+ * @param {String} src Path to file fow which content type should be evaluated.
4
+ * @return {String} Returns string with content type and charset.
5
+ */
6
+ export declare function contentType(src: string): string;
7
+ /**
8
+ * Determines whether we should compress based on file extension
9
+ * @param {String} src Path to file fow which content type should be evaluated.
10
+ * @return {Boolean} Returns true if we should compress
11
+ */
12
+ export declare function shouldCompress(src: string): boolean;
13
+ //# sourceMappingURL=mime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mime.d.ts","sourceRoot":"","sources":["../../src/mime.ts"],"names":[],"mappings":"AAyCA;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAS/C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGnD"}
package/lib/mime.js ADDED
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.contentType = contentType;
7
+ exports.shouldCompress = shouldCompress;
8
+
9
+ var _mimeTypes = _interopRequireDefault(require("mime-types"));
10
+
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+
13
+ const compressedMimeTypes = new Set(['application/atom+xml', 'application/javascript', 'application/json', 'application/ld+json', 'application/manifest+json', 'application/rdf+xml', 'application/rss+xml', 'application/schema+json', 'application/vnd.geo+json', 'application/vnd.ms-fontobject', 'application/x-font-ttf', 'application/x-javascript', 'application/x-web-app-manifest+json', 'application/xhtml+xml', 'application/xml', 'font/eot', 'font/otf', 'font/opentype', 'image/bmp', 'image/svg+xml', 'image/vnd.microsoft.icon', 'image/x-icon', 'text/cache-manifest', 'text/css', 'text/html', 'text/javascript', 'text/plain', 'text/vcard', 'text/vnd.rim.location.xloc', 'text/vtt', 'text/x-component', 'text/x-cross-domain-policy', 'text/xml']); // application/octetstream
14
+
15
+ const DEFAULT_TYPE = _mimeTypes.default.lookup('bin');
16
+ /**
17
+ * Gets the content type of the file, based on it's extension.
18
+ * @param {String} src Path to file fow which content type should be evaluated.
19
+ * @return {String} Returns string with content type and charset.
20
+ */
21
+
22
+
23
+ function contentType(src) {
24
+ let type = (_mimeTypes.default.lookup(src) || DEFAULT_TYPE).replace('-', '');
25
+
26
+ const charset = _mimeTypes.default.charset(type);
27
+
28
+ if (charset) {
29
+ type += '; charset=' + charset;
30
+ }
31
+
32
+ return type;
33
+ }
34
+ /**
35
+ * Determines whether we should compress based on file extension
36
+ * @param {String} src Path to file fow which content type should be evaluated.
37
+ * @return {Boolean} Returns true if we should compress
38
+ */
39
+
40
+
41
+ function shouldCompress(src) {
42
+ const mimeType = _mimeTypes.default.lookup(src);
43
+
44
+ return Boolean(mimeType && compressedMimeTypes.has(mimeType));
45
+ }
@@ -0,0 +1,5 @@
1
+ export declare type Predicate<T> = (value: T) => boolean;
2
+ export declare function not<T>(predicate: Predicate<T>): Predicate<T>;
3
+ export declare function equals<T>(a: T): Predicate<T>;
4
+ export declare function falsy<T>(obj: T): boolean;
5
+ //# sourceMappingURL=predicate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../../src/predicate.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;AAEjD,wBAAgB,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAE5D;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAE5C;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAExC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.not = not;
7
+ exports.equals = equals;
8
+ exports.falsy = falsy;
9
+
10
+ function not(predicate) {
11
+ return value => !predicate(value);
12
+ }
13
+
14
+ function equals(a) {
15
+ return b => a === b;
16
+ }
17
+
18
+ function falsy(obj) {
19
+ return !obj;
20
+ }
@@ -0,0 +1,5 @@
1
+ export declare const camelCase: (str: string | string[]) => string;
2
+ export declare function upperCamel(str: string | string[]): string;
3
+ export declare function isUuid(str: string): boolean;
4
+ export declare function isEmptyString(str: unknown): boolean;
5
+ //# sourceMappingURL=strings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/strings.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS,QAAuB,MAAM,GAAG,MAAM,EAAE,KAAK,MAAM,CAAC;AAE1E,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAEzD;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE3C;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEnD"}
package/lib/strings.js ADDED
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.upperCamel = upperCamel;
7
+ exports.isUuid = isUuid;
8
+ exports.isEmptyString = isEmptyString;
9
+ exports.camelCase = void 0;
10
+
11
+ var _upperFirst = _interopRequireDefault(require("lodash/upperFirst"));
12
+
13
+ var _camelCase2 = _interopRequireDefault(require("lodash/camelCase"));
14
+
15
+ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
16
+
17
+ var _isString = _interopRequireDefault(require("lodash/isString"));
18
+
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+
21
+ const camelCase = _camelCase2.default;
22
+ exports.camelCase = camelCase;
23
+
24
+ function upperCamel(str) {
25
+ return (0, _upperFirst.default)(camelCase(str));
26
+ }
27
+
28
+ function isUuid(str) {
29
+ return Boolean(/\w{8,}(-\w{4,}){3,}-\w{12,}/.exec(str));
30
+ }
31
+
32
+ function isEmptyString(str) {
33
+ return (0, _isString.default)(str) && (0, _isEmpty.default)(str);
34
+ }
package/lib/types.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ export declare type StringProps<Obj> = {
2
+ [K in keyof Required<Obj>]: Obj[K] extends string ? K : never;
3
+ }[keyof Obj];
4
+ export declare function isObject(obj: unknown): obj is Record<string, unknown>;
5
+ export declare type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
6
+ export declare type Maybe<T> = T | undefined;
7
+ /**
8
+ * Type util migrated from schema package. Not currently used, but certain to
9
+ * be useful.
10
+ */
11
+ export declare type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
12
+ /**
13
+ * Create enum matchers, which will return the enum entry from the provided
14
+ * enum when the value matches.
15
+ */
16
+ export declare function createEnumMatcher<T extends string, TEnum extends string>(enumVariable: {
17
+ [key in T]: TEnum;
18
+ }): (testValue: string) => [string, unknown] | undefined;
19
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW,CAAC,GAAG,IAAI;KAAE,CAAC,IAAI,MAAM,QAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK;CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAE1G,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAErE;AAED,oBAAY,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAG/E,oBAAY,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;AAErC;;;GAGG;AACH,oBAAY,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAErE;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,SAAS,MAAM,EAAE,YAAY,EAAE;KAAE,GAAG,IAAI,CAAC,GAAG,KAAK;CAAC,eACtF,MAAM,mCAC1B"}
package/lib/types.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isObject = isObject;
7
+ exports.createEnumMatcher = createEnumMatcher;
8
+
9
+ function isObject(obj) {
10
+ return obj !== null && typeof obj === 'object';
11
+ }
12
+
13
+ /**
14
+ * Create enum matchers, which will return the enum entry from the provided
15
+ * enum when the value matches.
16
+ */
17
+ function createEnumMatcher(enumVariable) {
18
+ return testValue => Object.entries(enumVariable).find(([, enumValue]) => enumValue === testValue);
19
+ }
@@ -0,0 +1,2 @@
1
+ export declare function unixToISO(unix: number): string;
2
+ //# sourceMappingURL=unix-to-iso.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unix-to-iso.d.ts","sourceRoot":"","sources":["../../src/unix-to-iso.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.unixToISO = unixToISO;
7
+
8
+ function unixToISO(unix) {
9
+ return new Date(unix * 1000).toISOString();
10
+ }
package/lib/value.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare function value<T>(x: T): () => T;
2
+ export default value;
3
+ //# sourceMappingURL=value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value.d.ts","sourceRoot":"","sources":["../../src/value.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAEtC;AAED,eAAe,KAAK,CAAC"}
package/lib/value.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.value = value;
7
+ exports.default = void 0;
8
+
9
+ function value(x) {
10
+ return () => x;
11
+ }
12
+
13
+ var _default = value;
14
+ exports.default = _default;
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@takeshape/util",
3
+ "version": "7.194.0",
4
+ "description": "Shared utilities",
5
+ "homepage": "https://www.takeshape.io",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "github.com:takeshape/takeshape.git"
9
+ },
10
+ "author": "asprouse",
11
+ "license": "UNLICENSED",
12
+ "engines": {
13
+ "node": ">=12"
14
+ },
15
+ "main": "lib/index.js",
16
+ "module": "es/index.js",
17
+ "types": "lib/index.d.ts",
18
+ "files": [
19
+ "lib",
20
+ "es"
21
+ ],
22
+ "dependencies": {
23
+ "aws-sdk": "^2.802.0",
24
+ "lodash": "^4.17.20",
25
+ "mime-types": "^2.1.27",
26
+ "pify": "^5.0.0"
27
+ },
28
+ "devDependencies": {
29
+ "@types/lodash": "^4.14.165",
30
+ "@types/mime-types": "^2.1.0",
31
+ "@types/pify": "^3.0.2"
32
+ },
33
+ "scripts": {
34
+ "lint": "eslint . --ext .js,.ts",
35
+ "lint:code:ci": "eslint . --ext .js,.ts --format junit -o \"${HOME}/test-results/${npm_package_name#*\\/}/eslint-results.xml\"",
36
+ "test": "jest",
37
+ "test-changed": "pnpm run test -- --changedSince=master",
38
+ "test:ci": "JEST_JUNIT_OUTPUT_DIR=\"${HOME}/test-results/${npm_package_name#*\\/}\" JEST_JUNIT_OUTPUT_NAME=jest-results.xml jest --ci --reporters=default --reporters=jest-junit",
39
+ "typecheck": "tsc --noEmit",
40
+ "clean": "rimraf lib es build *.tsbuildinfo",
41
+ "build": "pnpm clean && pnpm build:types && pnpm build:js && pnpm build:es && pnpm build:copy",
42
+ "build:types": "tsc --emitDeclarationOnly --project tsconfig.build.json",
43
+ "build:js": "cross-env BABEL_MODULES=commonjs babel src --out-dir lib --extensions \".js,.ts\" --ignore '**/__tests__'",
44
+ "build:es": "cross-env BABEL_MODULES=es babel src --out-dir es --extensions \".js,.ts\" --ignore '**/__tests__'",
45
+ "build:copy": "cp -rf build/src/* lib/",
46
+ "will-it-blend": "pnpm typecheck && pnpm lint -- --quiet && pnpm test -- --silent --coverage false"
47
+ }
48
+ }