@byline/core 0.9.3
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/LICENSE +373 -0
- package/README.md +17 -0
- package/dist/@types/admin-types.d.ts +275 -0
- package/dist/@types/admin-types.d.ts.map +1 -0
- package/dist/@types/admin-types.js +18 -0
- package/dist/@types/admin-types.js.map +1 -0
- package/dist/@types/collection-types.d.ts +816 -0
- package/dist/@types/collection-types.d.ts.map +1 -0
- package/dist/@types/collection-types.js +217 -0
- package/dist/@types/collection-types.js.map +1 -0
- package/dist/@types/db-types.d.ts +463 -0
- package/dist/@types/db-types.d.ts.map +1 -0
- package/dist/@types/db-types.js +2 -0
- package/dist/@types/db-types.js.map +1 -0
- package/dist/@types/field-data-types.d.ts +147 -0
- package/dist/@types/field-data-types.d.ts.map +1 -0
- package/dist/@types/field-data-types.js +38 -0
- package/dist/@types/field-data-types.js.map +1 -0
- package/dist/@types/field-types.d.ts +579 -0
- package/dist/@types/field-types.d.ts.map +1 -0
- package/dist/@types/field-types.js +32 -0
- package/dist/@types/field-types.js.map +1 -0
- package/dist/@types/index.d.ts +18 -0
- package/dist/@types/index.d.ts.map +1 -0
- package/dist/@types/index.js +18 -0
- package/dist/@types/index.js.map +1 -0
- package/dist/@types/populate-types.d.ts +54 -0
- package/dist/@types/populate-types.d.ts.map +1 -0
- package/dist/@types/populate-types.js +9 -0
- package/dist/@types/populate-types.js.map +1 -0
- package/dist/@types/query-predicate.d.ts +74 -0
- package/dist/@types/query-predicate.d.ts.map +1 -0
- package/dist/@types/query-predicate.js +9 -0
- package/dist/@types/query-predicate.js.map +1 -0
- package/dist/@types/site-config.d.ts +212 -0
- package/dist/@types/site-config.d.ts.map +1 -0
- package/dist/@types/site-config.js +9 -0
- package/dist/@types/site-config.js.map +1 -0
- package/dist/@types/storage-types.d.ts +86 -0
- package/dist/@types/storage-types.d.ts.map +1 -0
- package/dist/@types/storage-types.js +9 -0
- package/dist/@types/storage-types.js.map +1 -0
- package/dist/@types/store-types.d.ts +134 -0
- package/dist/@types/store-types.d.ts.map +1 -0
- package/dist/@types/store-types.js +24 -0
- package/dist/@types/store-types.js.map +1 -0
- package/dist/@types/type-utils.d.ts +17 -0
- package/dist/@types/type-utils.d.ts.map +1 -0
- package/dist/@types/type-utils.js +9 -0
- package/dist/@types/type-utils.js.map +1 -0
- package/dist/auth/apply-before-read.d.ts +36 -0
- package/dist/auth/apply-before-read.d.ts.map +1 -0
- package/dist/auth/apply-before-read.js +68 -0
- package/dist/auth/apply-before-read.js.map +1 -0
- package/dist/auth/apply-before-read.test.node.d.ts +9 -0
- package/dist/auth/apply-before-read.test.node.d.ts.map +1 -0
- package/dist/auth/apply-before-read.test.node.js +144 -0
- package/dist/auth/apply-before-read.test.node.js.map +1 -0
- package/dist/auth/assert-actor-can-perform.d.ts +39 -0
- package/dist/auth/assert-actor-can-perform.d.ts.map +1 -0
- package/dist/auth/assert-actor-can-perform.js +64 -0
- package/dist/auth/assert-actor-can-perform.js.map +1 -0
- package/dist/auth/assert-actor-can-perform.test.node.d.ts +9 -0
- package/dist/auth/assert-actor-can-perform.test.node.d.ts.map +1 -0
- package/dist/auth/assert-actor-can-perform.test.node.js +119 -0
- package/dist/auth/assert-actor-can-perform.test.node.js.map +1 -0
- package/dist/auth/index.d.ts +11 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +11 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/register-collection-abilities.d.ts +40 -0
- package/dist/auth/register-collection-abilities.d.ts.map +1 -0
- package/dist/auth/register-collection-abilities.js +87 -0
- package/dist/auth/register-collection-abilities.js.map +1 -0
- package/dist/auth/register-collection-abilities.test.node.d.ts +9 -0
- package/dist/auth/register-collection-abilities.test.node.d.ts.map +1 -0
- package/dist/auth/register-collection-abilities.test.node.js +124 -0
- package/dist/auth/register-collection-abilities.test.node.js.map +1 -0
- package/dist/config/config.d.ts +10 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +108 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/routes.d.ts +16 -0
- package/dist/config/routes.d.ts.map +1 -0
- package/dist/config/routes.js +26 -0
- package/dist/config/routes.js.map +1 -0
- package/dist/config/validate-admin-configs.d.ts +33 -0
- package/dist/config/validate-admin-configs.d.ts.map +1 -0
- package/dist/config/validate-admin-configs.js +250 -0
- package/dist/config/validate-admin-configs.js.map +1 -0
- package/dist/config/validate-admin-configs.test.node.d.ts +9 -0
- package/dist/config/validate-admin-configs.test.node.d.ts.map +1 -0
- package/dist/config/validate-admin-configs.test.node.js +224 -0
- package/dist/config/validate-admin-configs.test.node.js.map +1 -0
- package/dist/config/validate-collections.d.ts +33 -0
- package/dist/config/validate-collections.d.ts.map +1 -0
- package/dist/config/validate-collections.js +70 -0
- package/dist/config/validate-collections.js.map +1 -0
- package/dist/config/validate-collections.test.node.d.ts +9 -0
- package/dist/config/validate-collections.test.node.d.ts.map +1 -0
- package/dist/config/validate-collections.test.node.js +149 -0
- package/dist/config/validate-collections.test.node.js.map +1 -0
- package/dist/core.d.ts +89 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +99 -0
- package/dist/core.js.map +1 -0
- package/dist/defaults/default-values.d.ts +13 -0
- package/dist/defaults/default-values.d.ts.map +1 -0
- package/dist/defaults/default-values.js +60 -0
- package/dist/defaults/default-values.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/errors.d.ts +98 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +134 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/logger.d.ts +62 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +120 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/registry.d.ts +65 -0
- package/dist/lib/registry.d.ts.map +1 -0
- package/dist/lib/registry.js +133 -0
- package/dist/lib/registry.js.map +1 -0
- package/dist/logger/index.d.ts +3 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/index.js +3 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/patches/apply-patches.d.ts +21 -0
- package/dist/patches/apply-patches.d.ts.map +1 -0
- package/dist/patches/apply-patches.js +357 -0
- package/dist/patches/apply-patches.js.map +1 -0
- package/dist/patches/index.d.ts +3 -0
- package/dist/patches/index.d.ts.map +1 -0
- package/dist/patches/index.js +4 -0
- package/dist/patches/index.js.map +1 -0
- package/dist/patches/patch-types.d.ts +82 -0
- package/dist/patches/patch-types.d.ts.map +1 -0
- package/dist/patches/patch-types.js +3 -0
- package/dist/patches/patch-types.js.map +1 -0
- package/dist/patches/patch.test.node.d.ts +2 -0
- package/dist/patches/patch.test.node.d.ts.map +1 -0
- package/dist/patches/patch.test.node.js +193 -0
- package/dist/patches/patch.test.node.js.map +1 -0
- package/dist/query/parse-where.d.ts +100 -0
- package/dist/query/parse-where.d.ts.map +1 -0
- package/dist/query/parse-where.js +352 -0
- package/dist/query/parse-where.js.map +1 -0
- package/dist/query/parse-where.test.node.d.ts +9 -0
- package/dist/query/parse-where.test.node.d.ts.map +1 -0
- package/dist/query/parse-where.test.node.js +581 -0
- package/dist/query/parse-where.test.node.js.map +1 -0
- package/dist/schemas/zod/builder.d.ts +466 -0
- package/dist/schemas/zod/builder.d.ts.map +1 -0
- package/dist/schemas/zod/builder.js +276 -0
- package/dist/schemas/zod/builder.js.map +1 -0
- package/dist/schemas/zod/cache.d.ts +14 -0
- package/dist/schemas/zod/cache.d.ts.map +1 -0
- package/dist/schemas/zod/cache.js +40 -0
- package/dist/schemas/zod/cache.js.map +1 -0
- package/dist/schemas/zod/index.d.ts +4 -0
- package/dist/schemas/zod/index.d.ts.map +1 -0
- package/dist/schemas/zod/index.js +4 -0
- package/dist/schemas/zod/index.js.map +1 -0
- package/dist/schemas/zod/types.d.ts +13 -0
- package/dist/schemas/zod/types.d.ts.map +1 -0
- package/dist/schemas/zod/types.js +2 -0
- package/dist/schemas/zod/types.js.map +1 -0
- package/dist/services/collection-bootstrap.d.ts +46 -0
- package/dist/services/collection-bootstrap.d.ts.map +1 -0
- package/dist/services/collection-bootstrap.js +108 -0
- package/dist/services/collection-bootstrap.js.map +1 -0
- package/dist/services/collection-bootstrap.test.node.d.ts +9 -0
- package/dist/services/collection-bootstrap.test.node.d.ts.map +1 -0
- package/dist/services/collection-bootstrap.test.node.js +208 -0
- package/dist/services/collection-bootstrap.test.node.js.map +1 -0
- package/dist/services/document-lifecycle.d.ts +245 -0
- package/dist/services/document-lifecycle.d.ts.map +1 -0
- package/dist/services/document-lifecycle.js +481 -0
- package/dist/services/document-lifecycle.js.map +1 -0
- package/dist/services/document-lifecycle.test.node.d.ts +9 -0
- package/dist/services/document-lifecycle.test.node.d.ts.map +1 -0
- package/dist/services/document-lifecycle.test.node.js +781 -0
- package/dist/services/document-lifecycle.test.node.js.map +1 -0
- package/dist/services/document-read.d.ts +26 -0
- package/dist/services/document-read.d.ts.map +1 -0
- package/dist/services/document-read.js +60 -0
- package/dist/services/document-read.js.map +1 -0
- package/dist/services/field-upload.d.ts +100 -0
- package/dist/services/field-upload.d.ts.map +1 -0
- package/dist/services/field-upload.js +328 -0
- package/dist/services/field-upload.js.map +1 -0
- package/dist/services/field-upload.test.node.d.ts +9 -0
- package/dist/services/field-upload.test.node.d.ts.map +1 -0
- package/dist/services/field-upload.test.node.js +337 -0
- package/dist/services/field-upload.test.node.js.map +1 -0
- package/dist/services/index.d.ts +10 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +11 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/populate.d.ts +299 -0
- package/dist/services/populate.d.ts.map +1 -0
- package/dist/services/populate.js +484 -0
- package/dist/services/populate.js.map +1 -0
- package/dist/services/populate.test.node.d.ts +9 -0
- package/dist/services/populate.test.node.d.ts.map +1 -0
- package/dist/services/populate.test.node.js +910 -0
- package/dist/services/populate.test.node.js.map +1 -0
- package/dist/services/relation-projection.d.ts +52 -0
- package/dist/services/relation-projection.d.ts.map +1 -0
- package/dist/services/relation-projection.js +81 -0
- package/dist/services/relation-projection.js.map +1 -0
- package/dist/services/richtext-populate.d.ts +87 -0
- package/dist/services/richtext-populate.d.ts.map +1 -0
- package/dist/services/richtext-populate.js +189 -0
- package/dist/services/richtext-populate.js.map +1 -0
- package/dist/services/richtext-populate.test.node.d.ts +9 -0
- package/dist/services/richtext-populate.test.node.d.ts.map +1 -0
- package/dist/services/richtext-populate.test.node.js +197 -0
- package/dist/services/richtext-populate.test.node.js.map +1 -0
- package/dist/storage/collection-fingerprint.d.ts +21 -0
- package/dist/storage/collection-fingerprint.d.ts.map +1 -0
- package/dist/storage/collection-fingerprint.js +172 -0
- package/dist/storage/collection-fingerprint.js.map +1 -0
- package/dist/storage/collection-fingerprint.test.node.d.ts +9 -0
- package/dist/storage/collection-fingerprint.test.node.d.ts.map +1 -0
- package/dist/storage/collection-fingerprint.test.node.js +256 -0
- package/dist/storage/collection-fingerprint.test.node.js.map +1 -0
- package/dist/storage/field-store-map.d.ts +59 -0
- package/dist/storage/field-store-map.d.ts.map +1 -0
- package/dist/storage/field-store-map.js +75 -0
- package/dist/storage/field-store-map.js.map +1 -0
- package/dist/storage/field-store-map.test.node.d.ts +9 -0
- package/dist/storage/field-store-map.test.node.d.ts.map +1 -0
- package/dist/storage/field-store-map.test.node.js +117 -0
- package/dist/storage/field-store-map.test.node.js.map +1 -0
- package/dist/storage/index.d.ts +10 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +10 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/utils/normalise-dates.d.ts +15 -0
- package/dist/utils/normalise-dates.d.ts.map +1 -0
- package/dist/utils/normalise-dates.js +22 -0
- package/dist/utils/normalise-dates.js.map +1 -0
- package/dist/utils/slugify.d.ts +56 -0
- package/dist/utils/slugify.d.ts.map +1 -0
- package/dist/utils/slugify.js +91 -0
- package/dist/utils/slugify.js.map +1 -0
- package/dist/utils/slugify.test.node.d.ts +9 -0
- package/dist/utils/slugify.test.node.d.ts.map +1 -0
- package/dist/utils/slugify.test.node.js +86 -0
- package/dist/utils/slugify.test.node.js.map +1 -0
- package/dist/utils/storage-utils.d.ts +36 -0
- package/dist/utils/storage-utils.d.ts.map +1 -0
- package/dist/utils/storage-utils.js +38 -0
- package/dist/utils/storage-utils.js.map +1 -0
- package/dist/utils/utils.general.d.ts +64 -0
- package/dist/utils/utils.general.d.ts.map +1 -0
- package/dist/utils/utils.general.js +219 -0
- package/dist/utils/utils.general.js.map +1 -0
- package/dist/validation/index.d.ts +9 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +9 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/shared.d.ts +36 -0
- package/dist/validation/shared.d.ts.map +1 -0
- package/dist/validation/shared.js +42 -0
- package/dist/validation/shared.js.map +1 -0
- package/dist/workflow/index.d.ts +2 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +3 -0
- package/dist/workflow/index.js.map +1 -0
- package/dist/workflow/workflow.d.ts +40 -0
- package/dist/workflow/workflow.d.ts.map +1 -0
- package/dist/workflow/workflow.js +96 -0
- package/dist/workflow/workflow.js.map +1 -0
- package/dist/workflow/workflow.test.node.d.ts +2 -0
- package/dist/workflow/workflow.test.node.d.ts.map +1 -0
- package/dist/workflow/workflow.test.node.js +198 -0
- package/dist/workflow/workflow.test.node.js.map +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Context passed to a `SlugifierFn`.
|
|
10
|
+
*
|
|
11
|
+
* `locale` - The content locale being slugified (e.g. the default
|
|
12
|
+
* content locale when deriving `documentVersions.path`).
|
|
13
|
+
* `collectionPath` - The collection that owns the value being slugified.
|
|
14
|
+
* Lets installation-supplied slugifiers branch by
|
|
15
|
+
* collection if URL policies differ.
|
|
16
|
+
*/
|
|
17
|
+
export type SlugifyContext = {
|
|
18
|
+
locale: string;
|
|
19
|
+
collectionPath: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A pure function that converts a raw value into a URL-safe slug.
|
|
23
|
+
*
|
|
24
|
+
* Implementations must be synchronous and side-effect free — they are
|
|
25
|
+
* called both server-side at write time and client-side for live form
|
|
26
|
+
* preview / validation, and the two MUST agree on output.
|
|
27
|
+
*/
|
|
28
|
+
export type SlugifierFn = (value: string, ctx: SlugifyContext) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Detects whether a string value looks like an ISO 8601 datetime.
|
|
31
|
+
*
|
|
32
|
+
* Used to decide between date-style and text-style slug formatting when
|
|
33
|
+
* the source field is a date/datetime.
|
|
34
|
+
*/
|
|
35
|
+
export declare function looksLikeISODate(value: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Default slug formatter. Strips HTML, folds accented Latin to ASCII
|
|
38
|
+
* while preserving letters and digits across all other scripts (CJK,
|
|
39
|
+
* Cyrillic, Arabic, Thai, Devanagari, Greek, Kana, Hangul, …), replaces
|
|
40
|
+
* whitespace and punctuation with hyphens, and lowercases the result.
|
|
41
|
+
*
|
|
42
|
+
* Used by core when no installation slugifier is configured on
|
|
43
|
+
* `ServerConfig.slugifier`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function formatTextValue(value: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* The default slugifier shipped with `@byline/core`.
|
|
48
|
+
*
|
|
49
|
+
* Branches on the value to keep ISO datetimes legible (`2026-04-22`
|
|
50
|
+
* rather than the slugified `2026-04-22t12-00-00z`).
|
|
51
|
+
*
|
|
52
|
+
* Callers must coerce non-string source values (e.g. `Date`) to a string
|
|
53
|
+
* before invocation — typically `value instanceof Date ? value.toISOString() : String(value)`.
|
|
54
|
+
*/
|
|
55
|
+
export declare const slugify: SlugifierFn;
|
|
56
|
+
//# sourceMappingURL=slugify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slugify.d.ts","sourceRoot":"","sources":["../../src/utils/slugify.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,KAAK,MAAM,CAAA;AAExE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEvD;AAgCD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA4BrD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,EAAE,WAGrB,CAAA"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Detects whether a string value looks like an ISO 8601 datetime.
|
|
10
|
+
*
|
|
11
|
+
* Used to decide between date-style and text-style slug formatting when
|
|
12
|
+
* the source field is a date/datetime.
|
|
13
|
+
*/
|
|
14
|
+
export function looksLikeISODate(value) {
|
|
15
|
+
return /^\d{4}-\d{2}-\d{2}/.test(value);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Extracts the `yyyy-mm-dd` portion of an ISO 8601 datetime string for
|
|
19
|
+
* use as a slug segment.
|
|
20
|
+
*/
|
|
21
|
+
function formatDateValue(value) {
|
|
22
|
+
return value.substring(0, 10);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Decomposes `value` (NFKD), drops combining marks whose preceding base
|
|
26
|
+
* character is Latin script, and recomposes to NFC. Folds accented Latin
|
|
27
|
+
* to ASCII (`café` → `cafe`, `Zürich` → `Zurich`) while preserving marks
|
|
28
|
+
* that are structurally significant in other scripts — Thai tone marks,
|
|
29
|
+
* Arabic harakat, Devanagari matras, Hebrew niqqud, etc.
|
|
30
|
+
*/
|
|
31
|
+
function foldLatinDiacritics(value) {
|
|
32
|
+
const decomposed = value.normalize('NFKD');
|
|
33
|
+
let lastBaseIsLatin = false;
|
|
34
|
+
let result = '';
|
|
35
|
+
for (const ch of decomposed) {
|
|
36
|
+
if (/\p{M}/u.test(ch)) {
|
|
37
|
+
if (!lastBaseIsLatin)
|
|
38
|
+
result += ch;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
lastBaseIsLatin = /\p{Script=Latin}/u.test(ch);
|
|
42
|
+
result += ch;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return result.normalize('NFC');
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Default slug formatter. Strips HTML, folds accented Latin to ASCII
|
|
49
|
+
* while preserving letters and digits across all other scripts (CJK,
|
|
50
|
+
* Cyrillic, Arabic, Thai, Devanagari, Greek, Kana, Hangul, …), replaces
|
|
51
|
+
* whitespace and punctuation with hyphens, and lowercases the result.
|
|
52
|
+
*
|
|
53
|
+
* Used by core when no installation slugifier is configured on
|
|
54
|
+
* `ServerConfig.slugifier`.
|
|
55
|
+
*/
|
|
56
|
+
export function formatTextValue(value) {
|
|
57
|
+
if (typeof value !== 'string') {
|
|
58
|
+
return '';
|
|
59
|
+
}
|
|
60
|
+
// Remove HTML tags
|
|
61
|
+
let formatted = value.replace(/<[^>]*>/g, '');
|
|
62
|
+
// Fold Latin diacritics to ASCII; leave non-Latin combining marks intact
|
|
63
|
+
formatted = foldLatinDiacritics(formatted);
|
|
64
|
+
// Lowercase (affects cased scripts — Latin, Greek, Cyrillic, Armenian, …)
|
|
65
|
+
formatted = formatted.toLowerCase();
|
|
66
|
+
// Replace spaces and punctuation-like separators with a hyphen
|
|
67
|
+
formatted = formatted.replace(/[\s\p{Z}\p{P}]+/gu, '-');
|
|
68
|
+
// Keep letters and numbers across scripts, plus any combining marks that
|
|
69
|
+
// survived the Latin fold (Thai vowel/tone marks, Devanagari matras, etc.)
|
|
70
|
+
formatted = formatted.replace(/[^\p{L}\p{N}\p{M}-]+/gu, '');
|
|
71
|
+
// Collapse runs of hyphens
|
|
72
|
+
formatted = formatted.replace(/-+/g, '-');
|
|
73
|
+
// Trim leading/trailing hyphens
|
|
74
|
+
formatted = formatted.replace(/^-+|-+$/g, '');
|
|
75
|
+
return formatted;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The default slugifier shipped with `@byline/core`.
|
|
79
|
+
*
|
|
80
|
+
* Branches on the value to keep ISO datetimes legible (`2026-04-22`
|
|
81
|
+
* rather than the slugified `2026-04-22t12-00-00z`).
|
|
82
|
+
*
|
|
83
|
+
* Callers must coerce non-string source values (e.g. `Date`) to a string
|
|
84
|
+
* before invocation — typically `value instanceof Date ? value.toISOString() : String(value)`.
|
|
85
|
+
*/
|
|
86
|
+
export const slugify = (value, _ctx) => {
|
|
87
|
+
if (value == null || value.length === 0)
|
|
88
|
+
return '';
|
|
89
|
+
return looksLikeISODate(value) ? formatDateValue(value) : formatTextValue(value);
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=slugify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slugify.js","sourceRoot":"","sources":["../../src/utils/slugify.ts"],"names":[],"mappings":"AAAA;;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AAC,mBAAmB,EAAE,GAAG,CAAC,CAAA;IAEvD,yEAAyE;IACzE,2EAA2E;IAC3E,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAA;IAE3D,2BAA2B;IAC3B,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAEzC,gCAAgC;IAChC,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;IAE7C,OAAO,SAAS,CAAA;AAClB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,OAAO,GAAgB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IAClD,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IAClD,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAA;AAClF,CAAC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=slugify.test.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slugify.test.node.d.ts","sourceRoot":"","sources":["../../src/utils/slugify.test.node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
import { describe, expect, it } from 'vitest';
|
|
9
|
+
import { formatTextValue, looksLikeISODate, slugify } from './slugify.js';
|
|
10
|
+
const ctx = { locale: 'en', collectionPath: 'pages' };
|
|
11
|
+
describe('formatTextValue', () => {
|
|
12
|
+
it('lowercases and replaces whitespace with hyphens', () => {
|
|
13
|
+
expect(formatTextValue('My Great Post')).toBe('my-great-post');
|
|
14
|
+
});
|
|
15
|
+
it('strips HTML tags', () => {
|
|
16
|
+
expect(formatTextValue('<p>Hello <em>World</em></p>')).toBe('hello-world');
|
|
17
|
+
});
|
|
18
|
+
it('folds accented Latin to ASCII', () => {
|
|
19
|
+
expect(formatTextValue('café')).toBe('cafe');
|
|
20
|
+
expect(formatTextValue('Zürich')).toBe('zurich');
|
|
21
|
+
expect(formatTextValue('São Paulo')).toBe('sao-paulo');
|
|
22
|
+
expect(formatTextValue('naïve')).toBe('naive');
|
|
23
|
+
// Decomposed input: 'cafe' + combining acute (U+0301)
|
|
24
|
+
expect(formatTextValue('café')).toBe('cafe');
|
|
25
|
+
});
|
|
26
|
+
it('preserves Thai including tone marks', () => {
|
|
27
|
+
expect(formatTextValue('สวัสดี ครับ')).toBe('สวัสดี-ครับ');
|
|
28
|
+
expect(formatTextValue('ก้าวไกล')).toBe('ก้าวไกล');
|
|
29
|
+
});
|
|
30
|
+
it('preserves CJK, Kana, and Hangul', () => {
|
|
31
|
+
expect(formatTextValue('你好 世界')).toBe('你好-世界');
|
|
32
|
+
expect(formatTextValue('こんにちは')).toBe('こんにちは');
|
|
33
|
+
expect(formatTextValue('안녕하세요')).toBe('안녕하세요');
|
|
34
|
+
});
|
|
35
|
+
it('preserves Cyrillic and Arabic', () => {
|
|
36
|
+
expect(formatTextValue('Привет мир')).toBe('привет-мир');
|
|
37
|
+
expect(formatTextValue('مرحبا بالعالم')).toBe('مرحبا-بالعالم');
|
|
38
|
+
});
|
|
39
|
+
it('preserves Greek tonos (non-Latin diacritics are not folded)', () => {
|
|
40
|
+
expect(formatTextValue('Καλημέρα')).toBe('καλημέρα');
|
|
41
|
+
});
|
|
42
|
+
it('preserves Devanagari matras (non-Latin combining marks)', () => {
|
|
43
|
+
expect(formatTextValue('हिन्दी')).toBe('हिन्दी');
|
|
44
|
+
});
|
|
45
|
+
it('handles mixed-script input', () => {
|
|
46
|
+
expect(formatTextValue('Hello 世界 café')).toBe('hello-世界-cafe');
|
|
47
|
+
});
|
|
48
|
+
it('converts underscores to hyphens', () => {
|
|
49
|
+
expect(formatTextValue('foo_bar')).toBe('foo-bar');
|
|
50
|
+
});
|
|
51
|
+
it('collapses runs of separators into a single hyphen', () => {
|
|
52
|
+
expect(formatTextValue('a b---c d')).toBe('a-b-c-d');
|
|
53
|
+
});
|
|
54
|
+
it('trims leading and trailing hyphens', () => {
|
|
55
|
+
expect(formatTextValue(' hello ')).toBe('hello');
|
|
56
|
+
expect(formatTextValue('---hi---')).toBe('hi');
|
|
57
|
+
});
|
|
58
|
+
it('returns empty string for non-string input', () => {
|
|
59
|
+
// @ts-expect-error — testing runtime safety
|
|
60
|
+
expect(formatTextValue(null)).toBe('');
|
|
61
|
+
// @ts-expect-error
|
|
62
|
+
expect(formatTextValue(undefined)).toBe('');
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
describe('looksLikeISODate', () => {
|
|
66
|
+
it('recognises a yyyy-mm-dd prefix', () => {
|
|
67
|
+
expect(looksLikeISODate('2026-04-22')).toBe(true);
|
|
68
|
+
expect(looksLikeISODate('2026-04-22T12:00:00Z')).toBe(true);
|
|
69
|
+
});
|
|
70
|
+
it('rejects non-ISO strings', () => {
|
|
71
|
+
expect(looksLikeISODate('hello')).toBe(false);
|
|
72
|
+
expect(looksLikeISODate('22/04/2026')).toBe(false);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
describe('slugify (default SlugifierFn)', () => {
|
|
76
|
+
it('returns the date prefix for ISO datetime values', () => {
|
|
77
|
+
expect(slugify('2026-04-22T12:00:00Z', ctx)).toBe('2026-04-22');
|
|
78
|
+
});
|
|
79
|
+
it('slugifies plain text', () => {
|
|
80
|
+
expect(slugify('Hello, World!', ctx)).toBe('hello-world');
|
|
81
|
+
});
|
|
82
|
+
it('returns empty string for empty input', () => {
|
|
83
|
+
expect(slugify('', ctx)).toBe('');
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
//# sourceMappingURL=slugify.test.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slugify.test.node.js","sourceRoot":"","sources":["../../src/utils/slugify.test.node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEzE,MAAM,GAAG,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,CAAA;AAErD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MAAM,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;IAChE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAC1B,MAAM,CAAC,eAAe,CAAC,6BAA6B,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;IAC5E,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC5C,MA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
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
import type { CollectionDefinition } from '../@types/collection-types.js';
|
|
9
|
+
import type { Field, FileField, ImageField } from '../@types/field-types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Predicate: does this field carry an `upload` config? True for any
|
|
12
|
+
* `image` / `file` field with an `upload` block declared.
|
|
13
|
+
*/
|
|
14
|
+
export declare function isUploadField(field: Field): field is (ImageField | FileField) & {
|
|
15
|
+
upload: NonNullable<(ImageField | FileField)['upload']>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Walk the top-level field set and return every upload-capable
|
|
19
|
+
* image/file field on the collection. Used by the delete path,
|
|
20
|
+
* the upload-route resolver, and any UI that needs to reason about
|
|
21
|
+
* "is this collection upload-capable, and which fields take uploads?"
|
|
22
|
+
*
|
|
23
|
+
* Does not recurse into `group` / `array` / `blocks` — the supported
|
|
24
|
+
* transport surface is top-level upload fields. Nested upload fields
|
|
25
|
+
* are reachable through the core upload service via `findUploadField`,
|
|
26
|
+
* but require a richer transport selector.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getUploadFields(definition: Pick<CollectionDefinition, 'fields'>): (ImageField | FileField)[];
|
|
29
|
+
/**
|
|
30
|
+
* Convenience: does this collection have at least one upload-capable
|
|
31
|
+
* image/file field at the top level? Replaces the old
|
|
32
|
+
* `definition.upload != null` discriminator that "this collection is
|
|
33
|
+
* an upload collection / media library."
|
|
34
|
+
*/
|
|
35
|
+
export declare function hasUploadField(definition: Pick<CollectionDefinition, 'fields'>): boolean;
|
|
36
|
+
//# sourceMappingURL=storage-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-utils.d.ts","sourceRoot":"","sources":["../../src/utils/storage-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AACzE,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE5E;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,GAAG;IAC/E,MAAM,EAAE,WAAW,CAAC,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;CACxD,CAEA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC,GAC/C,CAAC,UAAU,GAAG,SAAS,CAAC,EAAE,CAE5B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC,GAAG,OAAO,CAExF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Predicate: does this field carry an `upload` config? True for any
|
|
10
|
+
* `image` / `file` field with an `upload` block declared.
|
|
11
|
+
*/
|
|
12
|
+
export function isUploadField(field) {
|
|
13
|
+
return (field.type === 'image' || field.type === 'file') && field.upload != null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Walk the top-level field set and return every upload-capable
|
|
17
|
+
* image/file field on the collection. Used by the delete path,
|
|
18
|
+
* the upload-route resolver, and any UI that needs to reason about
|
|
19
|
+
* "is this collection upload-capable, and which fields take uploads?"
|
|
20
|
+
*
|
|
21
|
+
* Does not recurse into `group` / `array` / `blocks` — the supported
|
|
22
|
+
* transport surface is top-level upload fields. Nested upload fields
|
|
23
|
+
* are reachable through the core upload service via `findUploadField`,
|
|
24
|
+
* but require a richer transport selector.
|
|
25
|
+
*/
|
|
26
|
+
export function getUploadFields(definition) {
|
|
27
|
+
return definition.fields.filter(isUploadField);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Convenience: does this collection have at least one upload-capable
|
|
31
|
+
* image/file field at the top level? Replaces the old
|
|
32
|
+
* `definition.upload != null` discriminator that "this collection is
|
|
33
|
+
* an upload collection / media library."
|
|
34
|
+
*/
|
|
35
|
+
export function hasUploadField(definition) {
|
|
36
|
+
return definition.fields.some(isUploadField);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=storage-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-utils.js","sourceRoot":"","sources":["../../src/utils/storage-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAY;IAGxC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,IAAI,CAAA;AAClF,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAgD;IAEhD,OAAO,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;AAChD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,UAAgD;IAC7E,OAAO,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;AAC9C,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* delay in ms
|
|
10
|
+
* @param ms
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export declare function delay(ms: number): Promise<unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* truncate
|
|
16
|
+
* @param str
|
|
17
|
+
* @param length
|
|
18
|
+
* @param useWordBoundary
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare function truncate(str: string, length: number, useWordBoundary: boolean, useSuffix?: boolean): string;
|
|
22
|
+
/**
|
|
23
|
+
* Returns a hash code from a string
|
|
24
|
+
* @param {String} input The string to hash.
|
|
25
|
+
* @return {String} hash to string
|
|
26
|
+
* @see http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/
|
|
27
|
+
* @see https://gist.github.com/jlevy/c246006675becc446360a798e2b2d781
|
|
28
|
+
*/
|
|
29
|
+
export declare function simpleHash(input: string): string;
|
|
30
|
+
export declare function isString(value: any): boolean;
|
|
31
|
+
export declare function isNumber(value: any): boolean;
|
|
32
|
+
export declare function isArray(value: any): boolean;
|
|
33
|
+
export declare function isFunction(value: any): boolean;
|
|
34
|
+
export declare function isObject(value: any): boolean;
|
|
35
|
+
export declare function isEmptyObject(value: any): boolean;
|
|
36
|
+
export declare function isNull(value: any): boolean;
|
|
37
|
+
export declare function isUndefined(value: any): boolean;
|
|
38
|
+
export declare function isBoolean(value: any): boolean;
|
|
39
|
+
export declare function isRegExp(value: any): boolean;
|
|
40
|
+
export declare function isDate(value: any): boolean;
|
|
41
|
+
export declare function isSymbol(value: any): boolean;
|
|
42
|
+
export declare function arrayEquals(array1: number[], array2: number[]): boolean;
|
|
43
|
+
export declare function insertIf(condition: any, ...elements: any[]): any[];
|
|
44
|
+
export declare const formatDate: (value: string) => string;
|
|
45
|
+
export declare const formatDateTime: (value: string) => string;
|
|
46
|
+
export declare const daysRemaining: (value: string) => number | string;
|
|
47
|
+
/**
|
|
48
|
+
* Accept currency value in cents and convert to formatted US dollars.
|
|
49
|
+
* @param {*} value
|
|
50
|
+
*/
|
|
51
|
+
export declare const formatToDollarsFromCents: (value: any) => string;
|
|
52
|
+
export declare function formatNumber(number: number, decimalPlaces: number): string;
|
|
53
|
+
export declare function formatFileSize(bytes: number | null | undefined, decimalPoint: number): string;
|
|
54
|
+
/**
|
|
55
|
+
* getRemainingTime
|
|
56
|
+
* @param {*} value - remaining time in seconds
|
|
57
|
+
*/
|
|
58
|
+
export declare const getRemainingTime: (seconds: number) => {
|
|
59
|
+
days: number;
|
|
60
|
+
hours: number;
|
|
61
|
+
minutes: number;
|
|
62
|
+
seconds: number;
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=utils.general.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.general.d.ts","sourceRoot":"","sources":["../../src/utils/utils.general.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;GAIG;AACH,wBAAsB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAExD;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,OAAO,EACxB,SAAS,UAAO,GACf,MAAM,CAOR;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOhD;AAKD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAE5C;AAGD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAG5C;AAGD,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAE3C;AAGD,wBAAgB,UAAU,CAAC,K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AO,MAAM,gBAAgB,GAC3B,SAAS,MAAM,KACd;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CA4BhB,CAAA"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
/* eslint-disable no-unused-vars */
|
|
9
|
+
/**
|
|
10
|
+
* delay in ms
|
|
11
|
+
* @param ms
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export async function delay(ms) {
|
|
15
|
+
return await new Promise((resolve) => setTimeout(resolve, ms));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* truncate
|
|
19
|
+
* @param str
|
|
20
|
+
* @param length
|
|
21
|
+
* @param useWordBoundary
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
export function truncate(str, length, useWordBoundary, useSuffix = true) {
|
|
25
|
+
if (str == null || str.length <= length) {
|
|
26
|
+
return str;
|
|
27
|
+
}
|
|
28
|
+
const subString = str.slice(0, length - 2); // the original check - less 2 so zero based + '...' will respect length
|
|
29
|
+
const truncated = useWordBoundary ? subString.slice(0, subString.lastIndexOf(' ')) : subString;
|
|
30
|
+
return useSuffix ? `${truncated}...` : truncated;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns a hash code from a string
|
|
34
|
+
* @param {String} input The string to hash.
|
|
35
|
+
* @return {String} hash to string
|
|
36
|
+
* @see http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/
|
|
37
|
+
* @see https://gist.github.com/jlevy/c246006675becc446360a798e2b2d781
|
|
38
|
+
*/
|
|
39
|
+
export function simpleHash(input) {
|
|
40
|
+
let hash = 0;
|
|
41
|
+
for (let i = 0; i < input.length; i++) {
|
|
42
|
+
hash = (hash << 5) - hash + input.charCodeAt(i);
|
|
43
|
+
hash &= hash; // Convert to 32bit integer
|
|
44
|
+
}
|
|
45
|
+
return (hash >>> 0).toString(36);
|
|
46
|
+
}
|
|
47
|
+
// https://webbjocke.com/javascript-check-data-types/
|
|
48
|
+
// Returns if a value is a string
|
|
49
|
+
export function isString(value) {
|
|
50
|
+
return typeof value === 'string' || value instanceof String;
|
|
51
|
+
}
|
|
52
|
+
// Returns if a value is really a number
|
|
53
|
+
export function isNumber(value) {
|
|
54
|
+
// eslint-disable-next-line no-restricted-globals
|
|
55
|
+
return typeof value === 'number' && Number.isFinite(value);
|
|
56
|
+
}
|
|
57
|
+
// Returns if a value is an array
|
|
58
|
+
export function isArray(value) {
|
|
59
|
+
return value != null && typeof value === 'object' && value.constructor === Array;
|
|
60
|
+
}
|
|
61
|
+
// Returns if a value is a function
|
|
62
|
+
export function isFunction(value) {
|
|
63
|
+
return typeof value === 'function';
|
|
64
|
+
}
|
|
65
|
+
// Returns if a value is an object
|
|
66
|
+
export function isObject(value) {
|
|
67
|
+
return value != null && typeof value === 'object' && value.constructor === Object;
|
|
68
|
+
}
|
|
69
|
+
// Returns if a value is an object
|
|
70
|
+
export function isEmptyObject(value) {
|
|
71
|
+
return (value != null &&
|
|
72
|
+
typeof value === 'object' &&
|
|
73
|
+
value.constructor === Object &&
|
|
74
|
+
Object.keys(value).length === 0);
|
|
75
|
+
}
|
|
76
|
+
// Returns if a value is null
|
|
77
|
+
export function isNull(value) {
|
|
78
|
+
return value === null;
|
|
79
|
+
}
|
|
80
|
+
// Returns if a value is undefined
|
|
81
|
+
export function isUndefined(value) {
|
|
82
|
+
return typeof value === 'undefined';
|
|
83
|
+
}
|
|
84
|
+
// Returns if a value is a boolean
|
|
85
|
+
export function isBoolean(value) {
|
|
86
|
+
return typeof value === 'boolean';
|
|
87
|
+
}
|
|
88
|
+
// Returns if a value is a regexp
|
|
89
|
+
export function isRegExp(value) {
|
|
90
|
+
return value != null && typeof value === 'object' && value.constructor === RegExp;
|
|
91
|
+
}
|
|
92
|
+
// Returns if value is a date object
|
|
93
|
+
export function isDate(value) {
|
|
94
|
+
return value instanceof Date;
|
|
95
|
+
}
|
|
96
|
+
// Returns if a Symbol
|
|
97
|
+
export function isSymbol(value) {
|
|
98
|
+
return typeof value === 'symbol';
|
|
99
|
+
}
|
|
100
|
+
// Simple numerical array comparison
|
|
101
|
+
export function arrayEquals(array1, array2) {
|
|
102
|
+
return array1.sort((a, b) => a - b).join(',') === array2.sort((a, b) => a - b).join(',');
|
|
103
|
+
}
|
|
104
|
+
// Conditionally inserts element to an array
|
|
105
|
+
export function insertIf(condition, ...elements) {
|
|
106
|
+
return condition != null ? elements : [];
|
|
107
|
+
}
|
|
108
|
+
// Default date formatter
|
|
109
|
+
const dateTimeFormatter = new Intl.DateTimeFormat('en-CA', {
|
|
110
|
+
year: 'numeric',
|
|
111
|
+
month: 'short',
|
|
112
|
+
day: '2-digit',
|
|
113
|
+
hour: 'numeric',
|
|
114
|
+
minute: 'numeric',
|
|
115
|
+
timeZone: 'UTC', // IMPORTANT: Will prevent hydration errors in React
|
|
116
|
+
// second: 'numeric',
|
|
117
|
+
});
|
|
118
|
+
const dateFormatter = new Intl.DateTimeFormat('en-CA', {
|
|
119
|
+
year: 'numeric',
|
|
120
|
+
month: 'short',
|
|
121
|
+
day: '2-digit',
|
|
122
|
+
timeZone: 'UTC', // IMPORTANT: Will prevent hydration errors in React
|
|
123
|
+
// second: 'numeric',
|
|
124
|
+
});
|
|
125
|
+
export const formatDate = (value) => {
|
|
126
|
+
const date = Date.parse(value);
|
|
127
|
+
if (Number.isNaN(date)) {
|
|
128
|
+
return 'Error';
|
|
129
|
+
}
|
|
130
|
+
return dateFormatter.format(date);
|
|
131
|
+
};
|
|
132
|
+
export const formatDateTime = (value) => {
|
|
133
|
+
const date = Date.parse(value);
|
|
134
|
+
if (Number.isNaN(date)) {
|
|
135
|
+
return 'Error';
|
|
136
|
+
}
|
|
137
|
+
return dateTimeFormatter.format(date);
|
|
138
|
+
};
|
|
139
|
+
export const daysRemaining = (value) => {
|
|
140
|
+
const date = Date.parse(value);
|
|
141
|
+
if (!Number.isNaN(date)) {
|
|
142
|
+
const difference = date - Date.now();
|
|
143
|
+
const days = Math.ceil(difference / (1000 * 3600 * 24));
|
|
144
|
+
return Math.max(0, days);
|
|
145
|
+
}
|
|
146
|
+
return 'Error';
|
|
147
|
+
};
|
|
148
|
+
// Default USD currency formatter
|
|
149
|
+
const currencyFormatter = new Intl.NumberFormat('en-US', {
|
|
150
|
+
style: 'currency',
|
|
151
|
+
minimumFractionDigits: 2,
|
|
152
|
+
currency: 'USD',
|
|
153
|
+
});
|
|
154
|
+
/**
|
|
155
|
+
* Accept currency value in cents and convert to formatted US dollars.
|
|
156
|
+
* @param {*} value
|
|
157
|
+
*/
|
|
158
|
+
export const formatToDollarsFromCents = (value) => {
|
|
159
|
+
// Remove all characters except numbers.'
|
|
160
|
+
if (isNumber(value)) {
|
|
161
|
+
return currencyFormatter.format(value / 100);
|
|
162
|
+
}
|
|
163
|
+
if (isString(value)) {
|
|
164
|
+
const parsed = value.replace(/[^0-9]+/g, '');
|
|
165
|
+
if (!Number.isNaN(parsed)) {
|
|
166
|
+
return currencyFormatter.format(Number(parsed) / 100);
|
|
167
|
+
}
|
|
168
|
+
return 'Error';
|
|
169
|
+
}
|
|
170
|
+
return 'Error';
|
|
171
|
+
};
|
|
172
|
+
export function formatNumber(number, decimalPlaces) {
|
|
173
|
+
if (typeof number !== 'number' || Number.isNaN(number)) {
|
|
174
|
+
throw new TypeError('Input must be a valid number');
|
|
175
|
+
}
|
|
176
|
+
const options = {
|
|
177
|
+
minimumFractionDigits: decimalPlaces !== undefined ? decimalPlaces : 0,
|
|
178
|
+
maximumFractionDigits: decimalPlaces !== undefined ? decimalPlaces : 20,
|
|
179
|
+
};
|
|
180
|
+
return number.toLocaleString('en-US', options);
|
|
181
|
+
}
|
|
182
|
+
export function formatFileSize(bytes, decimalPoint) {
|
|
183
|
+
if (bytes == null || bytes === 0)
|
|
184
|
+
return '0 Bytes';
|
|
185
|
+
const k = 1000;
|
|
186
|
+
const dm = decimalPoint ?? 2;
|
|
187
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
188
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
189
|
+
return `${Number.parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* getRemainingTime
|
|
193
|
+
* @param {*} value - remaining time in seconds
|
|
194
|
+
*/
|
|
195
|
+
export const getRemainingTime = (seconds) => {
|
|
196
|
+
let result;
|
|
197
|
+
if (seconds != null && seconds > 0) {
|
|
198
|
+
const d = Math.floor(seconds / (3600 * 24));
|
|
199
|
+
const h = Math.floor((seconds % (3600 * 24)) / 3600);
|
|
200
|
+
const m = Math.floor((seconds % 3600) / 60);
|
|
201
|
+
const s = Math.floor(seconds % 60);
|
|
202
|
+
result = {
|
|
203
|
+
days: d,
|
|
204
|
+
hours: h,
|
|
205
|
+
minutes: m,
|
|
206
|
+
seconds: s,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
result = {
|
|
211
|
+
days: 0,
|
|
212
|
+
hours: 0,
|
|
213
|
+
minutes: 0,
|
|
214
|
+
seconds: 0,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
return result;
|
|
218
|
+
};
|
|
219
|
+
//# sourceMappingURL=utils.general.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.general.js","sourceRoot":"","sources":["../../src/utils/utils.general.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,mCAAmC;AAEnC;;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