@takeshape/util 11.45.5 → 11.47.1
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.
- package/dist/cjs/common/arrays.js +42 -0
- package/dist/cjs/common/assert.js +9 -0
- package/dist/cjs/common/async-noop.js +5 -0
- package/dist/cjs/common/billing.js +35 -0
- package/dist/cjs/common/clone.js +76 -0
- package/dist/cjs/common/delay.js +28 -0
- package/dist/cjs/common/draftjs-templates.js +131 -0
- package/dist/cjs/common/draftjs.js +807 -0
- package/dist/cjs/common/get-image-url.js +8 -0
- package/dist/cjs/common/highlight-code.js +33 -0
- package/dist/cjs/common/http.js +19 -0
- package/dist/cjs/common/index.js +50 -0
- package/dist/cjs/common/map.js +7 -0
- package/dist/cjs/common/memoize.js +13 -0
- package/dist/cjs/common/merge.js +64 -0
- package/dist/cjs/common/mime.js +68 -0
- package/dist/cjs/common/names.js +13 -0
- package/dist/cjs/common/naming.js +65 -0
- package/dist/cjs/common/path-to-string.js +10 -0
- package/dist/cjs/common/persisted-queries.js +4 -0
- package/dist/cjs/common/predicate.js +15 -0
- package/dist/cjs/common/set-in.js +13 -0
- package/dist/cjs/common/sets.js +19 -0
- package/dist/cjs/common/sleep.js +9 -0
- package/dist/cjs/common/sort-object.js +16 -0
- package/dist/cjs/common/strings.js +74 -0
- package/dist/cjs/common/templates.js +109 -0
- package/dist/cjs/common/timezone.js +606 -0
- package/dist/cjs/common/tracing.js +2 -0
- package/dist/cjs/common/types.js +63 -0
- package/dist/cjs/common/unix-to-iso.js +15 -0
- package/dist/cjs/common/urls.js +9 -0
- package/dist/cjs/common/validation.js +5 -0
- package/dist/cjs/common/value.js +8 -0
- package/dist/cjs/common/visit.js +60 -0
- package/dist/cjs/node/encryption.js +31 -0
- package/dist/cjs/node/gzip.js +10 -0
- package/dist/cjs/node/index.js +19 -0
- package/dist/cjs/node/search-params.js +23 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/common/arrays.js +33 -0
- package/dist/esm/common/assert.js +5 -0
- package/dist/esm/common/async-noop.js +2 -0
- package/dist/esm/common/billing.js +29 -0
- package/dist/esm/common/clone.js +71 -0
- package/dist/esm/common/delay.js +22 -0
- package/dist/esm/common/draftjs-templates.js +122 -0
- package/dist/esm/common/draftjs.js +792 -0
- package/{es → dist/esm/common}/get-image-url.js +2 -7
- package/dist/esm/common/highlight-code.js +26 -0
- package/dist/esm/common/http.js +15 -0
- package/dist/esm/common/index.js +34 -0
- package/{es → dist/esm/common}/map.js +2 -2
- package/dist/esm/common/memoize.js +6 -0
- package/dist/esm/common/merge.js +54 -0
- package/dist/esm/common/mime.js +60 -0
- package/dist/esm/common/names.js +9 -0
- package/dist/esm/common/naming.js +54 -0
- package/dist/esm/common/path-to-string.js +6 -0
- package/{es → dist/esm/common}/persisted-queries.js +1 -1
- package/{es → dist/esm/common}/predicate.js +4 -4
- package/dist/esm/common/set-in.js +7 -0
- package/dist/esm/common/sets.js +14 -0
- package/dist/esm/common/sleep.js +5 -0
- package/dist/esm/common/sort-object.js +12 -0
- package/dist/esm/common/strings.js +60 -0
- package/dist/esm/common/templates.js +95 -0
- package/dist/esm/common/timezone.js +602 -0
- package/dist/esm/common/tracing.js +1 -0
- package/dist/esm/common/types.js +50 -0
- package/dist/esm/common/unix-to-iso.js +9 -0
- package/dist/esm/common/urls.js +5 -0
- package/dist/esm/common/validation.js +2 -0
- package/dist/esm/common/value.js +4 -0
- package/dist/esm/common/visit.js +52 -0
- package/dist/esm/node/encryption.js +25 -0
- package/dist/esm/node/gzip.js +4 -0
- package/dist/esm/node/index.js +3 -0
- package/dist/esm/node/search-params.js +17 -0
- package/dist/esm/package.json +1 -0
- package/dist/tsconfig.types.tsbuildinfo +1 -0
- package/dist/{arrays.d.ts → types/common/arrays.d.ts} +0 -1
- package/dist/{assert.d.ts → types/common/assert.d.ts} +0 -1
- package/dist/{async-noop.d.ts → types/common/async-noop.d.ts} +0 -1
- package/dist/types/common/billing.d.ts +365 -0
- package/dist/{clone.d.ts → types/common/clone.d.ts} +0 -1
- package/dist/{delay.d.ts → types/common/delay.d.ts} +0 -1
- package/dist/{draftjs-templates.d.ts → types/common/draftjs-templates.d.ts} +1 -2
- package/dist/{draftjs.d.ts → types/common/draftjs.d.ts} +1 -2
- package/dist/{get-image-url.d.ts → types/common/get-image-url.d.ts} +0 -1
- package/dist/types/common/highlight-code.d.ts +14 -0
- package/dist/{http.d.ts → types/common/http.d.ts} +0 -1
- package/dist/types/common/index.d.ts +34 -0
- package/dist/{map.d.ts → types/common/map.d.ts} +0 -1
- package/dist/{memoize.d.ts → types/common/memoize.d.ts} +0 -1
- package/dist/{merge.d.ts → types/common/merge.d.ts} +0 -1
- package/dist/{mime.d.ts → types/common/mime.d.ts} +0 -1
- package/dist/{names.d.ts → types/common/names.d.ts} +0 -1
- package/dist/{naming.d.ts → types/common/naming.d.ts} +0 -1
- package/dist/{path-to-string.d.ts → types/common/path-to-string.d.ts} +0 -1
- package/dist/{persisted-queries.d.ts → types/common/persisted-queries.d.ts} +0 -1
- package/dist/{predicate.d.ts → types/common/predicate.d.ts} +0 -1
- package/dist/{set-in.d.ts → types/common/set-in.d.ts} +0 -1
- package/dist/{sets.d.ts → types/common/sets.d.ts} +0 -1
- package/dist/{sleep.d.ts → types/common/sleep.d.ts} +0 -1
- package/dist/{sort-object.d.ts → types/common/sort-object.d.ts} +0 -1
- package/dist/{strings.d.ts → types/common/strings.d.ts} +1 -2
- package/dist/{templates.d.ts → types/common/templates.d.ts} +1 -2
- package/dist/{timezone.d.ts → types/common/timezone.d.ts} +0 -1
- package/dist/{tracing.d.ts → types/common/tracing.d.ts} +1 -2
- package/dist/{types.d.ts → types/common/types.d.ts} +0 -1
- package/dist/{unix-to-iso.d.ts → types/common/unix-to-iso.d.ts} +0 -1
- package/dist/{urls.d.ts → types/common/urls.d.ts} +0 -1
- package/dist/{validation.d.ts → types/common/validation.d.ts} +0 -1
- package/dist/{value.d.ts → types/common/value.d.ts} +0 -1
- package/dist/{visit.d.ts → types/common/visit.d.ts} +0 -1
- package/dist/{encryption.d.ts → types/node/encryption.d.ts} +0 -1
- package/dist/{gzip.d.ts → types/node/gzip.d.ts} +1 -2
- package/dist/types/node/index.d.ts +3 -0
- package/dist/{search-params.d.ts → types/node/search-params.d.ts} +1 -2
- package/package.json +33 -21
- package/dist/arrays.d.ts.map +0 -1
- package/dist/arrays.js +0 -44
- package/dist/assert.d.ts.map +0 -1
- package/dist/assert.js +0 -11
- package/dist/async-noop.d.ts.map +0 -1
- package/dist/async-noop.js +0 -8
- package/dist/billing.d.ts +0 -366
- package/dist/billing.d.ts.map +0 -1
- package/dist/billing.js +0 -48
- package/dist/browser.d.ts +0 -2
- package/dist/browser.d.ts.map +0 -1
- package/dist/browser.js +0 -16
- package/dist/clone.d.ts.map +0 -1
- package/dist/clone.js +0 -101
- package/dist/common.d.ts +0 -32
- package/dist/common.d.ts.map +0 -1
- package/dist/common.js +0 -346
- package/dist/delay.d.ts.map +0 -1
- package/dist/delay.js +0 -34
- package/dist/draftjs-templates.d.ts.map +0 -1
- package/dist/draftjs-templates.js +0 -157
- package/dist/draftjs.d.ts.map +0 -1
- package/dist/draftjs.js +0 -836
- package/dist/encryption.d.ts.map +0 -1
- package/dist/encryption.js +0 -33
- package/dist/get-image-url.d.ts.map +0 -1
- package/dist/get-image-url.js +0 -15
- package/dist/gzip.d.ts.map +0 -1
- package/dist/gzip.js +0 -11
- package/dist/highlight-code.d.ts +0 -15
- package/dist/highlight-code.d.ts.map +0 -1
- package/dist/highlight-code.js +0 -35
- package/dist/http.d.ts.map +0 -1
- package/dist/http.js +0 -18
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -60
- package/dist/map.d.ts.map +0 -1
- package/dist/map.js +0 -9
- package/dist/memoize.d.ts.map +0 -1
- package/dist/memoize.js +0 -13
- package/dist/merge.d.ts.map +0 -1
- package/dist/merge.js +0 -67
- package/dist/mime.d.ts.map +0 -1
- package/dist/mime.js +0 -37
- package/dist/names.d.ts.map +0 -1
- package/dist/names.js +0 -15
- package/dist/naming.d.ts.map +0 -1
- package/dist/naming.js +0 -91
- package/dist/path-to-string.d.ts.map +0 -1
- package/dist/path-to-string.js +0 -13
- package/dist/persisted-queries.d.ts.map +0 -1
- package/dist/persisted-queries.js +0 -7
- package/dist/predicate.d.ts.map +0 -1
- package/dist/predicate.js +0 -17
- package/dist/search-params.d.ts.map +0 -1
- package/dist/search-params.js +0 -25
- package/dist/set-in.d.ts.map +0 -1
- package/dist/set-in.js +0 -11
- package/dist/sets.d.ts.map +0 -1
- package/dist/sets.js +0 -21
- package/dist/sleep.d.ts.map +0 -1
- package/dist/sleep.js +0 -11
- package/dist/sort-object.d.ts.map +0 -1
- package/dist/sort-object.js +0 -21
- package/dist/strings.d.ts.map +0 -1
- package/dist/strings.js +0 -87
- package/dist/templates.d.ts.map +0 -1
- package/dist/templates.js +0 -120
- package/dist/timezone.d.ts.map +0 -1
- package/dist/timezone.js +0 -17
- package/dist/tracing.d.ts.map +0 -1
- package/dist/tracing.js +0 -5
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -92
- package/dist/unix-to-iso.d.ts.map +0 -1
- package/dist/unix-to-iso.js +0 -17
- package/dist/urls.d.ts.map +0 -1
- package/dist/urls.js +0 -11
- package/dist/validation.d.ts.map +0 -1
- package/dist/validation.js +0 -8
- package/dist/value.d.ts.map +0 -1
- package/dist/value.js +0 -11
- package/dist/visit.d.ts.map +0 -1
- package/dist/visit.js +0 -61
- package/es/arrays.js +0 -33
- package/es/assert.js +0 -5
- package/es/async-noop.js +0 -2
- package/es/billing.js +0 -40
- package/es/browser.js +0 -1
- package/es/clone.js +0 -94
- package/es/common.js +0 -31
- package/es/delay.js +0 -26
- package/es/draftjs-templates.js +0 -147
- package/es/draftjs.js +0 -819
- package/es/encryption.js +0 -26
- package/es/gzip.js +0 -4
- package/es/highlight-code.js +0 -26
- package/es/http.js +0 -11
- package/es/index.js +0 -6
- package/es/memoize.js +0 -6
- package/es/merge.js +0 -58
- package/es/mime.js +0 -29
- package/es/names.js +0 -9
- package/es/naming.js +0 -78
- package/es/path-to-string.js +0 -6
- package/es/search-params.js +0 -17
- package/es/set-in.js +0 -6
- package/es/sets.js +0 -14
- package/es/sleep.js +0 -5
- package/es/sort-object.js +0 -14
- package/es/strings.js +0 -72
- package/es/templates.js +0 -105
- package/es/timezone.js +0 -10
- package/es/tracing.js +0 -1
- package/es/types.js +0 -80
- package/es/unix-to-iso.js +0 -9
- package/es/urls.js +0 -5
- package/es/validation.js +0 -2
- package/es/value.js +0 -4
- package/es/visit.js +0 -53
package/es/encryption.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import crypto from 'crypto';
|
|
2
|
-
import curry from 'lodash/curry';
|
|
3
|
-
const CIPHER_ALGORITHM = 'aes-256-ctr';
|
|
4
|
-
const IV_LENGTH = 16;
|
|
5
|
-
const KEY_ENCODING = 'base64';
|
|
6
|
-
const CIPHER_TEXT_ENCODING = 'base64';
|
|
7
|
-
const CONTENT_ENCODING = 'utf8';
|
|
8
|
-
export const encrypt = curry((key, plaintext) => {
|
|
9
|
-
// Initialization Vector
|
|
10
|
-
const iv = crypto.randomBytes(IV_LENGTH);
|
|
11
|
-
const cipher = crypto.createCipheriv(CIPHER_ALGORITHM, Buffer.from(key, KEY_ENCODING), iv);
|
|
12
|
-
const cipherText = cipher.update(Buffer.from(plaintext, CONTENT_ENCODING));
|
|
13
|
-
return Buffer.concat([iv, cipherText, cipher.final()]).toString(CIPHER_TEXT_ENCODING);
|
|
14
|
-
});
|
|
15
|
-
export const decrypt = curry((key, encrypted) => {
|
|
16
|
-
const input = Buffer.from(encrypted, CIPHER_TEXT_ENCODING);
|
|
17
|
-
if (input.length < IV_LENGTH + 1) {
|
|
18
|
-
throw new TypeError('Provided "encrypted" must decrypt to a non-empty string');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Initialization Vector
|
|
22
|
-
const iv = input.slice(0, IV_LENGTH);
|
|
23
|
-
const decipher = crypto.createDecipheriv(CIPHER_ALGORITHM, Buffer.from(key, KEY_ENCODING), iv);
|
|
24
|
-
const cipherText = input.slice(IV_LENGTH);
|
|
25
|
-
return Buffer.concat([decipher.update(cipherText), decipher.final()]).toString(CONTENT_ENCODING);
|
|
26
|
-
});
|
package/es/gzip.js
DELETED
package/es/highlight-code.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The intention is to move all this to the client package in the end, but right now it's here
|
|
3
|
-
* to be shared between the draftjs / mdx implementations, which span the client / server differently.
|
|
4
|
-
*/
|
|
5
|
-
import Prism from 'prismjs';
|
|
6
|
-
import 'prismjs/components/prism-javascript';
|
|
7
|
-
import 'prismjs/components/prism-markup';
|
|
8
|
-
import 'prismjs/components/prism-markup-templating';
|
|
9
|
-
import 'prismjs/components/prism-css';
|
|
10
|
-
import 'prismjs/components/prism-bash';
|
|
11
|
-
import 'prismjs/components/prism-django';
|
|
12
|
-
import 'prismjs/components/prism-twig';
|
|
13
|
-
import 'prismjs/components/prism-yaml';
|
|
14
|
-
import 'prismjs/components/prism-graphql';
|
|
15
|
-
import 'prismjs/components/prism-sass';
|
|
16
|
-
import 'prismjs/components/prism-scss';
|
|
17
|
-
import 'prismjs/components/prism-markdown';
|
|
18
|
-
import 'prismjs/components/prism-json';
|
|
19
|
-
import escape from 'lodash/escape';
|
|
20
|
-
export const highlightCode = (code, lang) => {
|
|
21
|
-
if (lang) {
|
|
22
|
-
const syntax = Prism.languages[lang];
|
|
23
|
-
return Prism.highlight(code, syntax, lang);
|
|
24
|
-
}
|
|
25
|
-
return escape(code);
|
|
26
|
-
};
|
package/es/http.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const getBasicAuthString = basicAuth => {
|
|
2
|
-
let authString = '';
|
|
3
|
-
if (basicAuth.username) {
|
|
4
|
-
authString += basicAuth.username;
|
|
5
|
-
}
|
|
6
|
-
authString += ':';
|
|
7
|
-
if (basicAuth.password) {
|
|
8
|
-
authString += basicAuth.password;
|
|
9
|
-
}
|
|
10
|
-
return Buffer.from(authString).toString('base64');
|
|
11
|
-
};
|
package/es/index.js
DELETED
package/es/memoize.js
DELETED
package/es/merge.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
import difference from 'lodash/difference';
|
|
6
|
-
import omit from 'lodash/omit';
|
|
7
|
-
import isEqual from 'lodash/isEqual';
|
|
8
|
-
import union from 'lodash/union';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Lodash `mergeWith` customizer to concat arrays
|
|
12
|
-
*/
|
|
13
|
-
const arrayConcatCustomizer = (value, srcValue) => {
|
|
14
|
-
if (isArray(value)) {
|
|
15
|
-
return value.concat(srcValue);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Lodash `mergeWith` loaded with a customizer that concatenates arrays for a
|
|
21
|
-
* deeper merge.
|
|
22
|
-
*/
|
|
23
|
-
export function mergeWithArrayConcat(object, source) {
|
|
24
|
-
return mergeWith(object, source, arrayConcatCustomizer);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Lodash `mergeWith` customizer to merge arrays
|
|
29
|
-
*/
|
|
30
|
-
const arrayMergeCustomizer = (value, srcValue) => {
|
|
31
|
-
if (isArray(value) && isArray(srcValue)) {
|
|
32
|
-
return merge(value, srcValue).filter(val => !isNull(val));
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Lodash `mergeWith` loaded with a customizer that merges arrays at the same
|
|
38
|
-
* object path. Array items set to `null` will be removed.
|
|
39
|
-
*/
|
|
40
|
-
export function mergeWithArrayMerge(object, source) {
|
|
41
|
-
return mergeWith(object, source, arrayMergeCustomizer);
|
|
42
|
-
}
|
|
43
|
-
export function rebaseObject(to, base, from) {
|
|
44
|
-
const fromKeys = Object.keys(from);
|
|
45
|
-
const removedKeys = difference(Object.keys(base), fromKeys);
|
|
46
|
-
const newObj = omit(to, removedKeys);
|
|
47
|
-
for (const key of fromKeys) {
|
|
48
|
-
if (!isEqual(base[key], from[key])) {
|
|
49
|
-
newObj[key] = from[key];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return newObj;
|
|
53
|
-
}
|
|
54
|
-
export function rebaseArray(to, base, from) {
|
|
55
|
-
const removed = difference(base, from);
|
|
56
|
-
const added = difference(from, base);
|
|
57
|
-
return union(difference(to, removed), added);
|
|
58
|
-
}
|
package/es/mime.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
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']);
|
|
3
|
-
|
|
4
|
-
// Application/octetstream
|
|
5
|
-
const DEFAULT_TYPE = mime.lookup('bin');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Gets the content type of the file, based on it's extension.
|
|
9
|
-
* @param {String} src Path to file fow which content type should be evaluated.
|
|
10
|
-
* @return {String} Returns string with content type and charset.
|
|
11
|
-
*/
|
|
12
|
-
export function contentType(src) {
|
|
13
|
-
let type = (mime.lookup(src) || DEFAULT_TYPE).replace('-', '');
|
|
14
|
-
const charset = mime.charset(type);
|
|
15
|
-
if (charset) {
|
|
16
|
-
type += '; charset=' + charset;
|
|
17
|
-
}
|
|
18
|
-
return type;
|
|
19
|
-
}
|
|
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
|
-
export function shouldCompress(src) {
|
|
27
|
-
const mimeType = mime.lookup(src);
|
|
28
|
-
return Boolean(mimeType && compressedMimeTypes.has(mimeType));
|
|
29
|
-
}
|
package/es/names.js
DELETED
package/es/naming.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import camelCase from 'lodash/camelCase';
|
|
2
|
-
import kebabCase from 'lodash/kebabCase';
|
|
3
|
-
export function prefixName(config, params, name) {
|
|
4
|
-
const {
|
|
5
|
-
withVariant,
|
|
6
|
-
withRegion,
|
|
7
|
-
separator
|
|
8
|
-
} = config;
|
|
9
|
-
const {
|
|
10
|
-
appName,
|
|
11
|
-
stage: {
|
|
12
|
-
env,
|
|
13
|
-
variant
|
|
14
|
-
},
|
|
15
|
-
region
|
|
16
|
-
} = params;
|
|
17
|
-
const parts = [appName, env];
|
|
18
|
-
if (withVariant && env !== 'prod' && variant) {
|
|
19
|
-
parts.push(variant);
|
|
20
|
-
}
|
|
21
|
-
if (withRegion) {
|
|
22
|
-
if (!region) {
|
|
23
|
-
throw new Error('Cannot provide a region prefix without a region in context');
|
|
24
|
-
}
|
|
25
|
-
parts.push(region);
|
|
26
|
-
}
|
|
27
|
-
if (name === '*') {
|
|
28
|
-
parts.push(name);
|
|
29
|
-
} else if (config.case === 'kebabCase') {
|
|
30
|
-
parts.push(kebabCase(name));
|
|
31
|
-
} else if (config.case === 'camelCase') {
|
|
32
|
-
parts.push(camelCase(name));
|
|
33
|
-
} else {
|
|
34
|
-
parts.push(name);
|
|
35
|
-
}
|
|
36
|
-
return parts.join(separator);
|
|
37
|
-
}
|
|
38
|
-
export function dynamoTableName(params, name) {
|
|
39
|
-
return prefixName({
|
|
40
|
-
withVariant: true,
|
|
41
|
-
withRegion: false,
|
|
42
|
-
separator: '--'
|
|
43
|
-
}, params, name);
|
|
44
|
-
}
|
|
45
|
-
export const variantResourceName = prefixName.bind(null, {
|
|
46
|
-
withVariant: true,
|
|
47
|
-
withRegion: false,
|
|
48
|
-
separator: '--',
|
|
49
|
-
case: 'kebabCase'
|
|
50
|
-
});
|
|
51
|
-
export const sharedResourceName = prefixName.bind(null, {
|
|
52
|
-
withVariant: false,
|
|
53
|
-
withRegion: false,
|
|
54
|
-
separator: '--',
|
|
55
|
-
case: 'kebabCase'
|
|
56
|
-
});
|
|
57
|
-
export function variantBucketName(params, name) {
|
|
58
|
-
return prefixName({
|
|
59
|
-
withVariant: true,
|
|
60
|
-
withRegion: true,
|
|
61
|
-
separator: '--'
|
|
62
|
-
}, params, name);
|
|
63
|
-
}
|
|
64
|
-
export function sharedBucketName(params, name) {
|
|
65
|
-
return prefixName({
|
|
66
|
-
withVariant: false,
|
|
67
|
-
withRegion: true,
|
|
68
|
-
separator: '--'
|
|
69
|
-
}, params, name);
|
|
70
|
-
}
|
|
71
|
-
export const sharedTopicName = sharedResourceName;
|
|
72
|
-
export function keyName(params, name) {
|
|
73
|
-
return prefixName({
|
|
74
|
-
withVariant: true,
|
|
75
|
-
withRegion: false,
|
|
76
|
-
separator: '--'
|
|
77
|
-
}, params, name);
|
|
78
|
-
}
|
package/es/path-to-string.js
DELETED
package/es/search-params.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { URLSearchParams } from 'url';
|
|
2
|
-
export function toSearchParamsEntries(obj) {
|
|
3
|
-
if (obj instanceof URLSearchParams) {
|
|
4
|
-
return [...obj.entries()];
|
|
5
|
-
}
|
|
6
|
-
if (typeof obj === 'object' && !Array.isArray(obj)) {
|
|
7
|
-
return Object.entries(obj).map(([k, v]) => [k, v?.toString() ?? '']);
|
|
8
|
-
}
|
|
9
|
-
return [...new URLSearchParams(obj).entries()];
|
|
10
|
-
}
|
|
11
|
-
export function toSearchParamsRecord(obj) {
|
|
12
|
-
return Object.fromEntries(toSearchParamsEntries(obj));
|
|
13
|
-
}
|
|
14
|
-
export function concatURLSearchParams(...searchParamsInput) {
|
|
15
|
-
const entries = searchParamsInput.flatMap(item => item ? toSearchParamsEntries(item) : []);
|
|
16
|
-
return new URLSearchParams(entries);
|
|
17
|
-
}
|
package/es/set-in.js
DELETED
package/es/sets.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export function addAll(set, iterable) {
|
|
2
|
-
for (const value of iterable) {
|
|
3
|
-
set.add(value);
|
|
4
|
-
}
|
|
5
|
-
return set;
|
|
6
|
-
}
|
|
7
|
-
export function mapSet(set, fn) {
|
|
8
|
-
const result = new Array(set.size);
|
|
9
|
-
let i = 0;
|
|
10
|
-
for (const value of set) {
|
|
11
|
-
result[i++] = fn(value);
|
|
12
|
-
}
|
|
13
|
-
return result;
|
|
14
|
-
}
|
package/es/sleep.js
DELETED
package/es/sort-object.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Object key order is not guarenteed. This can be useful
|
|
3
|
-
* but should not be depended upon.
|
|
4
|
-
*/
|
|
5
|
-
export const sortObject = obj => {
|
|
6
|
-
// Convert object to array of key-value pairs
|
|
7
|
-
const arr = Object.entries(obj);
|
|
8
|
-
|
|
9
|
-
// Sort array by key
|
|
10
|
-
arr.sort(([key1], [key2]) => key1.localeCompare(key2));
|
|
11
|
-
|
|
12
|
-
// Convert array back to object
|
|
13
|
-
return Object.fromEntries(arr);
|
|
14
|
-
};
|
package/es/strings.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { isBrowser } from 'browser-or-node';
|
|
2
|
-
import upperFirst from 'lodash/upperFirst';
|
|
3
|
-
import _camelCase from 'lodash/camelCase';
|
|
4
|
-
import isEmpty from 'lodash/isEmpty';
|
|
5
|
-
import isString from 'lodash/isString';
|
|
6
|
-
import { ensureArray } from './arrays';
|
|
7
|
-
export const camelCase = _camelCase;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Special function for preserving namespace case when pascal-casing.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
export function formatShapeName(str, options) {
|
|
14
|
-
const strings = ensureArray(str);
|
|
15
|
-
const shapeNameIndex = options?.shapeNameIndex ?? 0;
|
|
16
|
-
const shapeName = strings.at(shapeNameIndex);
|
|
17
|
-
|
|
18
|
-
// If the shapeNameIndex is incorrect, behave as normal
|
|
19
|
-
if (!shapeName) {
|
|
20
|
-
throw new Error(`Could not find a ShapeName at index '${shapeNameIndex}'`);
|
|
21
|
-
}
|
|
22
|
-
const prefix = strings.slice(0, Math.max(shapeNameIndex, 0));
|
|
23
|
-
const suffix = strings.slice(shapeNameIndex + 1);
|
|
24
|
-
let arr = [];
|
|
25
|
-
if (prefix) {
|
|
26
|
-
arr = [...arr, pascalCase(prefix)];
|
|
27
|
-
}
|
|
28
|
-
if (shapeName.length > 2 && shapeName.startsWith('TS') && shapeName.charAt(2) === shapeName.charAt(2).toUpperCase()) {
|
|
29
|
-
// Built-in shape, prefixed with `TS`
|
|
30
|
-
arr = [...arr, shapeName];
|
|
31
|
-
} else {
|
|
32
|
-
arr = [...arr, pascalCase(shapeName)];
|
|
33
|
-
}
|
|
34
|
-
if (suffix) {
|
|
35
|
-
arr = [...arr, pascalCase(suffix)];
|
|
36
|
-
}
|
|
37
|
-
return arr.join('');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Optional config triggers a namespace-preserving behavior for built-in shapes starting with `TS`.
|
|
42
|
-
*/
|
|
43
|
-
export function pascalCase(str) {
|
|
44
|
-
return upperFirst(camelCase(str));
|
|
45
|
-
}
|
|
46
|
-
export function isUuid(str) {
|
|
47
|
-
return Boolean(/\w{8,}(-\w{4,}){3,}-\w{12,}/.exec(str));
|
|
48
|
-
}
|
|
49
|
-
export function isEmptyString(str) {
|
|
50
|
-
return isString(str) && isEmpty(str);
|
|
51
|
-
}
|
|
52
|
-
export function isIntegerLike(value) {
|
|
53
|
-
if (typeof value === 'number') {
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
return /^\d+$/.test(value);
|
|
57
|
-
}
|
|
58
|
-
export function base64Encode(str) {
|
|
59
|
-
if (isBrowser) {
|
|
60
|
-
return window.btoa(str);
|
|
61
|
-
}
|
|
62
|
-
return Buffer.from(str).toString('base64');
|
|
63
|
-
}
|
|
64
|
-
export function base64Decode(str) {
|
|
65
|
-
if (isBrowser) {
|
|
66
|
-
return window.atob(str);
|
|
67
|
-
}
|
|
68
|
-
return Buffer.from(str, 'base64').toString();
|
|
69
|
-
}
|
|
70
|
-
export function encodePropertyName(value) {
|
|
71
|
-
return value.replace(/[^A-Za-z0-9]/g, c => `%${c.charCodeAt(0).toString(16)}`);
|
|
72
|
-
}
|
package/es/templates.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The intention is to move all this to the client package in the end, but right now it's here
|
|
3
|
-
* to be shared between the draftjs / mdx implementations, which span the client / server differently.
|
|
4
|
-
*/
|
|
5
|
-
import classnames from 'classnames';
|
|
6
|
-
import escape from 'lodash/escape';
|
|
7
|
-
import { getImageUrl } from '@takeshape/routing';
|
|
8
|
-
import { highlightCode } from './highlight-code';
|
|
9
|
-
import { isRecord } from './types';
|
|
10
|
-
export function getApplyPrefix(prefix) {
|
|
11
|
-
return className => className ? prefix + className : '';
|
|
12
|
-
}
|
|
13
|
-
export function attrs(obj) {
|
|
14
|
-
const attrStrings = [];
|
|
15
|
-
const attrNames = Object.keys(obj);
|
|
16
|
-
attrNames.sort();
|
|
17
|
-
for (const attrName of attrNames) {
|
|
18
|
-
const value = obj[attrName];
|
|
19
|
-
if (value) {
|
|
20
|
-
attrStrings.push(`${attrName}="${escape(value)}"`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return attrStrings.length ? ' ' + attrStrings.join(' ') : '';
|
|
24
|
-
}
|
|
25
|
-
export function imageTemplate(applyPrefix, data) {
|
|
26
|
-
const {
|
|
27
|
-
caption,
|
|
28
|
-
credit,
|
|
29
|
-
alignment,
|
|
30
|
-
size,
|
|
31
|
-
asset,
|
|
32
|
-
imageParams
|
|
33
|
-
} = data;
|
|
34
|
-
if (!asset) {
|
|
35
|
-
return '';
|
|
36
|
-
}
|
|
37
|
-
const imageUrl = getImageUrl(asset.path, imageParams);
|
|
38
|
-
let figCaption = '';
|
|
39
|
-
if (caption || credit) {
|
|
40
|
-
const htmlCaption = caption ? `<span class="${applyPrefix('caption')}">${caption}</span>` : '';
|
|
41
|
-
const htmlCredit = credit ? `<span class="${applyPrefix('credit')}">${credit}</span>` : '';
|
|
42
|
-
figCaption = `<figcaption>${htmlCaption} ${htmlCredit}</figcaption>`;
|
|
43
|
-
}
|
|
44
|
-
const classes = classnames(applyPrefix(alignment), applyPrefix(size));
|
|
45
|
-
const classAttr = classes ? ` class="${classes}"` : '';
|
|
46
|
-
const imgAttrs = attrs({
|
|
47
|
-
alt: asset.description,
|
|
48
|
-
title: asset.title
|
|
49
|
-
});
|
|
50
|
-
let image = `<img${imgAttrs} src="${imageUrl}"/>`;
|
|
51
|
-
if (data.link?.url) {
|
|
52
|
-
const target = data.link.external ? ' target="blank" rel="noopener noreferrer"' : '';
|
|
53
|
-
image = `<a href="${data.link.url}"${target}>${image}</a>`;
|
|
54
|
-
}
|
|
55
|
-
return `<figure${classAttr}>${image}${figCaption}</figure>`;
|
|
56
|
-
}
|
|
57
|
-
function renderMdx(tag, attributes, data, children) {
|
|
58
|
-
const tagWithAttributes = `${tag} ${attributes.map(attr => `${attr}="${escape(data[attr])}"`).join(' ')}`;
|
|
59
|
-
if (children) {
|
|
60
|
-
return `<${tagWithAttributes}>
|
|
61
|
-
${children.replace(/[\n\r]+$/, '')}
|
|
62
|
-
</${tag}>`;
|
|
63
|
-
}
|
|
64
|
-
return `<${tagWithAttributes}/>`;
|
|
65
|
-
}
|
|
66
|
-
export function imageTemplateMdx(applyPrefix, data) {
|
|
67
|
-
return renderMdx(applyPrefix('Image'), ['id', 'caption', 'credit', 'link', 'linkisexternal', 'alignment', 'size', 'src'], data);
|
|
68
|
-
}
|
|
69
|
-
export function oembedTemplate(applyPrefix, data) {
|
|
70
|
-
return `<div class="${applyPrefix('oembed')}">${data.html}</div>`;
|
|
71
|
-
}
|
|
72
|
-
export function oembedTemplateMdx(applyPrefix, data) {
|
|
73
|
-
return renderMdx(applyPrefix('Oembed'), ['url', 'author_name', 'author_url', 'width', 'height', 'type', 'cache_age', 'provider_name', 'version'], data, data.html);
|
|
74
|
-
}
|
|
75
|
-
export function codeTemplate(applyPrefix, data) {
|
|
76
|
-
const {
|
|
77
|
-
text,
|
|
78
|
-
lang
|
|
79
|
-
} = data;
|
|
80
|
-
const code = highlightCode(text, lang);
|
|
81
|
-
const langClass = lang ? ` class="${applyPrefix(`language-${lang}`)}"` : '';
|
|
82
|
-
return `<pre><code${langClass}>${code}</code></pre>`;
|
|
83
|
-
}
|
|
84
|
-
export function jsonTemplate(template, context) {
|
|
85
|
-
const renderTemplate = template => {
|
|
86
|
-
return template.replace(/{{(\w+)}}/g, (_, name) => context[name] ?? '');
|
|
87
|
-
};
|
|
88
|
-
const transform = obj => {
|
|
89
|
-
if (Array.isArray(obj)) {
|
|
90
|
-
return obj.map(transform);
|
|
91
|
-
}
|
|
92
|
-
if (isRecord(obj)) {
|
|
93
|
-
const result = {};
|
|
94
|
-
for (const key of Object.keys(obj)) {
|
|
95
|
-
result[renderTemplate(key)] = transform(obj[key]);
|
|
96
|
-
}
|
|
97
|
-
return result;
|
|
98
|
-
}
|
|
99
|
-
if (typeof obj === 'string') {
|
|
100
|
-
return renderTemplate(obj);
|
|
101
|
-
}
|
|
102
|
-
return obj;
|
|
103
|
-
};
|
|
104
|
-
return transform(template);
|
|
105
|
-
}
|
package/es/timezone.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export function guessTimeZone() {
|
|
2
|
-
if (Intl) {
|
|
3
|
-
// eslint-disable-next-line new-cap
|
|
4
|
-
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
5
|
-
}
|
|
6
|
-
return 'UTC';
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// Equivalent to `moment.tz.names()`
|
|
10
|
-
export const timeZoneList = ['Africa/Abidjan', 'Africa/Accra', 'Africa/Addis_Ababa', 'Africa/Algiers', 'Africa/Asmara', 'Africa/Asmera', 'Africa/Bamako', 'Africa/Bangui', 'Africa/Banjul', 'Africa/Bissau', 'Africa/Blantyre', 'Africa/Brazzaville', 'Africa/Bujumbura', 'Africa/Cairo', 'Africa/Casablanca', 'Africa/Ceuta', 'Africa/Conakry', 'Africa/Dakar', 'Africa/Dar_es_Salaam', 'Africa/Djibouti', 'Africa/Douala', 'Africa/El_Aaiun', 'Africa/Freetown', 'Africa/Gaborone', 'Africa/Harare', 'Africa/Johannesburg', 'Africa/Juba', 'Africa/Kampala', 'Africa/Khartoum', 'Africa/Kigali', 'Africa/Kinshasa', 'Africa/Lagos', 'Africa/Libreville', 'Africa/Lome', 'Africa/Luanda', 'Africa/Lubumbashi', 'Africa/Lusaka', 'Africa/Malabo', 'Africa/Maputo', 'Africa/Maseru', 'Africa/Mbabane', 'Africa/Mogadishu', 'Africa/Monrovia', 'Africa/Nairobi', 'Africa/Ndjamena', 'Africa/Niamey', 'Africa/Nouakchott', 'Africa/Ouagadougou', 'Africa/Porto-Novo', 'Africa/Sao_Tome', 'Africa/Timbuktu', 'Africa/Tripoli', 'Africa/Tunis', 'Africa/Windhoek', 'America/Adak', 'America/Anchorage', 'America/Anguilla', 'America/Antigua', 'America/Araguaina', 'America/Argentina/Buenos_Aires', 'America/Argentina/Catamarca', 'America/Argentina/ComodRivadavia', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/La_Rioja', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Salta', 'America/Argentina/San_Juan', 'America/Argentina/San_Luis', 'America/Argentina/Tucuman', 'America/Argentina/Ushuaia', 'America/Aruba', 'America/Asuncion', 'America/Atikokan', 'America/Atka', 'America/Bahia', 'America/Bahia_Banderas', 'America/Barbados', 'America/Belem', 'America/Belize', 'America/Blanc-Sablon', 'America/Boa_Vista', 'America/Bogota', 'America/Boise', 'America/Buenos_Aires', 'America/Cambridge_Bay', 'America/Campo_Grande', 'America/Cancun', 'America/Caracas', 'America/Catamarca', 'America/Cayenne', 'America/Cayman', 'America/Chicago', 'America/Chihuahua', 'America/Coral_Harbour', 'America/Cordoba', 'America/Costa_Rica', 'America/Creston', 'America/Cuiaba', 'America/Curacao', 'America/Danmarkshavn', 'America/Dawson', 'America/Dawson_Creek', 'America/Denver', 'America/Detroit', 'America/Dominica', 'America/Edmonton', 'America/Eirunepe', 'America/El_Salvador', 'America/Ensenada', 'America/Fort_Nelson', 'America/Fort_Wayne', 'America/Fortaleza', 'America/Glace_Bay', 'America/Godthab', 'America/Goose_Bay', 'America/Grand_Turk', 'America/Grenada', 'America/Guadeloupe', 'America/Guatemala', 'America/Guayaquil', 'America/Guyana', 'America/Halifax', 'America/Havana', 'America/Hermosillo', 'America/Indiana/Indianapolis', 'America/Indiana/Knox', 'America/Indiana/Marengo', 'America/Indiana/Petersburg', 'America/Indiana/Tell_City', 'America/Indiana/Vevay', 'America/Indiana/Vincennes', 'America/Indiana/Winamac', 'America/Indianapolis', 'America/Inuvik', 'America/Iqaluit', 'America/Jamaica', 'America/Jujuy', 'America/Juneau', 'America/Kentucky/Louisville', 'America/Kentucky/Monticello', 'America/Knox_IN', 'America/Kralendijk', 'America/La_Paz', 'America/Lima', 'America/Los_Angeles', 'America/Louisville', 'America/Lower_Princes', 'America/Maceio', 'America/Managua', 'America/Manaus', 'America/Marigot', 'America/Martinique', 'America/Matamoros', 'America/Mazatlan', 'America/Mendoza', 'America/Menominee', 'America/Merida', 'America/Metlakatla', 'America/Mexico_City', 'America/Miquelon', 'America/Moncton', 'America/Monterrey', 'America/Montevideo', 'America/Montreal', 'America/Montserrat', 'America/Nassau', 'America/New_York', 'America/Nipigon', 'America/Nome', 'America/Noronha', 'America/North_Dakota/Beulah', 'America/North_Dakota/Center', 'America/North_Dakota/New_Salem', 'America/Nuuk', 'America/Ojinaga', 'America/Panama', 'America/Pangnirtung', 'America/Paramaribo', 'America/Phoenix', 'America/Port-au-Prince', 'America/Port_of_Spain', 'America/Porto_Acre', 'America/Porto_Velho', 'America/Puerto_Rico', 'America/Punta_Arenas', 'America/Rainy_River', 'America/Rankin_Inlet', 'America/Recife', 'America/Regina', 'America/Resolute', 'America/Rio_Branco', 'America/Rosario', 'America/Santa_Isabel', 'America/Santarem', 'America/Santiago', 'America/Santo_Domingo', 'America/Sao_Paulo', 'America/Scoresbysund', 'America/Shiprock', 'America/Sitka', 'America/St_Barthelemy', 'America/St_Johns', 'America/St_Kitts', 'America/St_Lucia', 'America/St_Thomas', 'America/St_Vincent', 'America/Swift_Current', 'America/Tegucigalpa', 'America/Thule', 'America/Thunder_Bay', 'America/Tijuana', 'America/Toronto', 'America/Tortola', 'America/Vancouver', 'America/Virgin', 'America/Whitehorse', 'America/Winnipeg', 'America/Yakutat', 'America/Yellowknife', 'Antarctica/Casey', 'Antarctica/Davis', 'Antarctica/DumontDUrville', 'Antarctica/Macquarie', 'Antarctica/Mawson', 'Antarctica/McMurdo', 'Antarctica/Palmer', 'Antarctica/Rothera', 'Antarctica/South_Pole', 'Antarctica/Syowa', 'Antarctica/Troll', 'Antarctica/Vostok', 'Arctic/Longyearbyen', 'Asia/Aden', 'Asia/Almaty', 'Asia/Amman', 'Asia/Anadyr', 'Asia/Aqtau', 'Asia/Aqtobe', 'Asia/Ashgabat', 'Asia/Ashkhabad', 'Asia/Atyrau', 'Asia/Baghdad', 'Asia/Bahrain', 'Asia/Baku', 'Asia/Bangkok', 'Asia/Barnaul', 'Asia/Beirut', 'Asia/Bishkek', 'Asia/Brunei', 'Asia/Calcutta', 'Asia/Chita', 'Asia/Choibalsan', 'Asia/Chongqing', 'Asia/Chungking', 'Asia/Colombo', 'Asia/Dacca', 'Asia/Damascus', 'Asia/Dhaka', 'Asia/Dili', 'Asia/Dubai', 'Asia/Dushanbe', 'Asia/Famagusta', 'Asia/Gaza', 'Asia/Harbin', 'Asia/Hebron', 'Asia/Ho_Chi_Minh', 'Asia/Hong_Kong', 'Asia/Hovd', 'Asia/Irkutsk', 'Asia/Istanbul', 'Asia/Jakarta', 'Asia/Jayapura', 'Asia/Jerusalem', 'Asia/Kabul', 'Asia/Kamchatka', 'Asia/Karachi', 'Asia/Kashgar', 'Asia/Kathmandu', 'Asia/Katmandu', 'Asia/Khandyga', 'Asia/Kolkata', 'Asia/Krasnoyarsk', 'Asia/Kuala_Lumpur', 'Asia/Kuching', 'Asia/Kuwait', 'Asia/Macao', 'Asia/Macau', 'Asia/Magadan', 'Asia/Makassar', 'Asia/Manila', 'Asia/Muscat', 'Asia/Nicosia', 'Asia/Novokuznetsk', 'Asia/Novosibirsk', 'Asia/Omsk', 'Asia/Oral', 'Asia/Phnom_Penh', 'Asia/Pontianak', 'Asia/Pyongyang', 'Asia/Qatar', 'Asia/Qostanay', 'Asia/Qyzylorda', 'Asia/Rangoon', 'Asia/Riyadh', 'Asia/Saigon', 'Asia/Sakhalin', 'Asia/Samarkand', 'Asia/Seoul', 'Asia/Shanghai', 'Asia/Singapore', 'Asia/Srednekolymsk', 'Asia/Taipei', 'Asia/Tashkent', 'Asia/Tbilisi', 'Asia/Tehran', 'Asia/Tel_Aviv', 'Asia/Thimbu', 'Asia/Thimphu', 'Asia/Tokyo', 'Asia/Tomsk', 'Asia/Ujung_Pandang', 'Asia/Ulaanbaatar', 'Asia/Ulan_Bator', 'Asia/Urumqi', 'Asia/Ust-Nera', 'Asia/Vientiane', 'Asia/Vladivostok', 'Asia/Yakutsk', 'Asia/Yangon', 'Asia/Yekaterinburg', 'Asia/Yerevan', 'Atlantic/Azores', 'Atlantic/Bermuda', 'Atlantic/Canary', 'Atlantic/Cape_Verde', 'Atlantic/Faeroe', 'Atlantic/Faroe', 'Atlantic/Jan_Mayen', 'Atlantic/Madeira', 'Atlantic/Reykjavik', 'Atlantic/South_Georgia', 'Atlantic/St_Helena', 'Atlantic/Stanley', 'Australia/ACT', 'Australia/Adelaide', 'Australia/Brisbane', 'Australia/Broken_Hill', 'Australia/Canberra', 'Australia/Currie', 'Australia/Darwin', 'Australia/Eucla', 'Australia/Hobart', 'Australia/LHI', 'Australia/Lindeman', 'Australia/Lord_Howe', 'Australia/Melbourne', 'Australia/NSW', 'Australia/North', 'Australia/Perth', 'Australia/Queensland', 'Australia/South', 'Australia/Sydney', 'Australia/Tasmania', 'Australia/Victoria', 'Australia/West', 'Australia/Yancowinna', 'Brazil/Acre', 'Brazil/DeNoronha', 'Brazil/East', 'Brazil/West', 'CET', 'CST6CDT', 'Canada/Atlantic', 'Canada/Central', 'Canada/Eastern', 'Canada/Mountain', 'Canada/Newfoundland', 'Canada/Pacific', 'Canada/Saskatchewan', 'Canada/Yukon', 'Chile/Continental', 'Chile/EasterIsland', 'Cuba', 'EET', 'EST', 'EST5EDT', 'Egypt', 'Eire', 'Etc/GMT', 'Etc/GMT+0', 'Etc/GMT+1', 'Etc/GMT+10', 'Etc/GMT+11', 'Etc/GMT+12', 'Etc/GMT+2', 'Etc/GMT+3', 'Etc/GMT+4', 'Etc/GMT+5', 'Etc/GMT+6', 'Etc/GMT+7', 'Etc/GMT+8', 'Etc/GMT+9', 'Etc/GMT-0', 'Etc/GMT-1', 'Etc/GMT-10', 'Etc/GMT-11', 'Etc/GMT-12', 'Etc/GMT-13', 'Etc/GMT-14', 'Etc/GMT-2', 'Etc/GMT-3', 'Etc/GMT-4', 'Etc/GMT-5', 'Etc/GMT-6', 'Etc/GMT-7', 'Etc/GMT-8', 'Etc/GMT-9', 'Etc/GMT0', 'Etc/Greenwich', 'Etc/UCT', 'Etc/UTC', 'Etc/Universal', 'Etc/Zulu', 'Europe/Amsterdam', 'Europe/Andorra', 'Europe/Astrakhan', 'Europe/Athens', 'Europe/Belfast', 'Europe/Belgrade', 'Europe/Berlin', 'Europe/Bratislava', 'Europe/Brussels', 'Europe/Bucharest', 'Europe/Budapest', 'Europe/Busingen', 'Europe/Chisinau', 'Europe/Copenhagen', 'Europe/Dublin', 'Europe/Gibraltar', 'Europe/Guernsey', 'Europe/Helsinki', 'Europe/Isle_of_Man', 'Europe/Istanbul', 'Europe/Jersey', 'Europe/Kaliningrad', 'Europe/Kiev', 'Europe/Kirov', 'Europe/Lisbon', 'Europe/Ljubljana', 'Europe/London', 'Europe/Luxembourg', 'Europe/Madrid', 'Europe/Malta', 'Europe/Mariehamn', 'Europe/Minsk', 'Europe/Monaco', 'Europe/Moscow', 'Europe/Nicosia', 'Europe/Oslo', 'Europe/Paris', 'Europe/Podgorica', 'Europe/Prague', 'Europe/Riga', 'Europe/Rome', 'Europe/Samara', 'Europe/San_Marino', 'Europe/Sarajevo', 'Europe/Saratov', 'Europe/Simferopol', 'Europe/Skopje', 'Europe/Sofia', 'Europe/Stockholm', 'Europe/Tallinn', 'Europe/Tirane', 'Europe/Tiraspol', 'Europe/Ulyanovsk', 'Europe/Uzhgorod', 'Europe/Vaduz', 'Europe/Vatican', 'Europe/Vienna', 'Europe/Vilnius', 'Europe/Volgograd', 'Europe/Warsaw', 'Europe/Zagreb', 'Europe/Zaporozhye', 'Europe/Zurich', 'GB', 'GB-Eire', 'GMT', 'GMT+0', 'GMT-0', 'GMT0', 'Greenwich', 'HST', 'Hongkong', 'Iceland', 'Indian/Antananarivo', 'Indian/Chagos', 'Indian/Christmas', 'Indian/Cocos', 'Indian/Comoro', 'Indian/Kerguelen', 'Indian/Mahe', 'Indian/Maldives', 'Indian/Mauritius', 'Indian/Mayotte', 'Indian/Reunion', 'Iran', 'Israel', 'Jamaica', 'Japan', 'Kwajalein', 'Libya', 'MET', 'MST', 'MST7MDT', 'Mexico/BajaNorte', 'Mexico/BajaSur', 'Mexico/General', 'NZ', 'NZ-CHAT', 'Navajo', 'PRC', 'PST8PDT', 'Pacific/Apia', 'Pacific/Auckland', 'Pacific/Bougainville', 'Pacific/Chatham', 'Pacific/Chuuk', 'Pacific/Easter', 'Pacific/Efate', 'Pacific/Enderbury', 'Pacific/Fakaofo', 'Pacific/Fiji', 'Pacific/Funafuti', 'Pacific/Galapagos', 'Pacific/Gambier', 'Pacific/Guadalcanal', 'Pacific/Guam', 'Pacific/Honolulu', 'Pacific/Johnston', 'Pacific/Kiritimati', 'Pacific/Kosrae', 'Pacific/Kwajalein', 'Pacific/Majuro', 'Pacific/Marquesas', 'Pacific/Midway', 'Pacific/Nauru', 'Pacific/Niue', 'Pacific/Norfolk', 'Pacific/Noumea', 'Pacific/Pago_Pago', 'Pacific/Palau', 'Pacific/Pitcairn', 'Pacific/Pohnpei', 'Pacific/Ponape', 'Pacific/Port_Moresby', 'Pacific/Rarotonga', 'Pacific/Saipan', 'Pacific/Samoa', 'Pacific/Tahiti', 'Pacific/Tarawa', 'Pacific/Tongatapu', 'Pacific/Truk', 'Pacific/Wake', 'Pacific/Wallis', 'Pacific/Yap', 'Poland', 'Portugal', 'ROC', 'ROK', 'Singapore', 'Turkey', 'UCT', 'US/Alaska', 'US/Aleutian', 'US/Arizona', 'US/Central', 'US/East-Indiana', 'US/Eastern', 'US/Hawaii', 'US/Indiana-Starke', 'US/Michigan', 'US/Mountain', 'US/Pacific', 'US/Samoa', 'UTC', 'Universal', 'W-SU', 'WET', 'Zulu'];
|
package/es/tracing.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/es/types.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import isNull from 'lodash/isNull';
|
|
2
|
-
import isPlainObject from 'lodash/isPlainObject';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @example
|
|
6
|
-
* interface Foo {
|
|
7
|
-
* a: string;
|
|
8
|
-
* b: number;
|
|
9
|
-
* c?: string;
|
|
10
|
-
* }
|
|
11
|
-
* type Bar = keyof PickByValue<Foo, string>;
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Remove index from a type
|
|
16
|
-
* Adapted from https://stackoverflow.com/a/51955852
|
|
17
|
-
* @example
|
|
18
|
-
* // Given:
|
|
19
|
-
* type Foo = {
|
|
20
|
-
* a: string;
|
|
21
|
-
* b: number:
|
|
22
|
-
* [k: string]: unknown
|
|
23
|
-
* };
|
|
24
|
-
* type Bar = RemoveIndex<Foo>;
|
|
25
|
-
* // Is equivalent to:
|
|
26
|
-
* type Bar = {
|
|
27
|
-
* a: string;
|
|
28
|
-
* b: number:
|
|
29
|
-
* };
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* A guard for objects that ensures they are plain objects, and thus, can
|
|
34
|
-
* reasonably be typed as a Record.
|
|
35
|
-
*/
|
|
36
|
-
export function isRecord(maybeRecord) {
|
|
37
|
-
return isPlainObject(maybeRecord);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
A guard for objects that ensures they are iterable records objects
|
|
42
|
-
not as strict as isRecord but better performance when that matters
|
|
43
|
-
*/
|
|
44
|
-
export function isIterableObject(x) {
|
|
45
|
-
return Boolean(x) && typeof x === 'object';
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// https://stackoverflow.com/questions/50573891/maybe-a-type-in-typescript
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Type util migrated from schema package. Not currently used, but certain to
|
|
52
|
-
* be useful.
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Create enum matchers, which will return the enum entry from the provided
|
|
57
|
-
* enum when the value matches.
|
|
58
|
-
*/
|
|
59
|
-
export function createEnumMatcher(enumVariable) {
|
|
60
|
-
return testValue => Object.entries(enumVariable).find(([, enumValue]) => enumValue === testValue);
|
|
61
|
-
}
|
|
62
|
-
export function isPrimitive(maybePrimitive) {
|
|
63
|
-
return typeof maybePrimitive === 'string' || typeof maybePrimitive === 'number' || typeof maybePrimitive === 'boolean' || typeof maybePrimitive === 'symbol' || typeof maybePrimitive === 'undefined' || typeof maybePrimitive === 'bigint' || isNull(maybePrimitive);
|
|
64
|
-
}
|
|
65
|
-
export function isScalar(maybeScalar) {
|
|
66
|
-
return typeof maybeScalar === 'string' || typeof maybeScalar === 'number' || typeof maybeScalar === 'boolean' || typeof maybeScalar === 'bigint';
|
|
67
|
-
}
|
|
68
|
-
export function getSingle(t) {
|
|
69
|
-
if (Array.isArray(t)) {
|
|
70
|
-
return t[0];
|
|
71
|
-
}
|
|
72
|
-
return t;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Test whether a provided string is numeric, e.g., '9' is numeric while 'nine' is not.
|
|
77
|
-
*/
|
|
78
|
-
export function isNumericString(key) {
|
|
79
|
-
return !isNaN(Number(key));
|
|
80
|
-
}
|
package/es/unix-to-iso.js
DELETED