@genesislcap/foundation-utils 14.225.2 → 14.225.3-alpha-15b094e.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.
- package/dist/custom-elements.json +237 -60
- package/dist/dts/encoding/base64/decode.d.ts +16 -0
- package/dist/dts/encoding/base64/decode.d.ts.map +1 -0
- package/dist/dts/encoding/base64/encode.d.ts +16 -0
- package/dist/dts/encoding/base64/encode.d.ts.map +1 -0
- package/dist/dts/encoding/base64/index.d.ts +3 -0
- package/dist/dts/encoding/base64/index.d.ts.map +1 -0
- package/dist/dts/encoding/index.d.ts +2 -0
- package/dist/dts/encoding/index.d.ts.map +1 -0
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/esm/encoding/base64/decode.js +45 -0
- package/dist/esm/encoding/base64/encode.js +34 -0
- package/dist/esm/encoding/base64/index.js +2 -0
- package/dist/esm/encoding/index.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/foundation-utils.api.json +120 -0
- package/dist/foundation-utils.d.ts +34 -0
- package/docs/api/foundation-utils.decodefrombase64.md +13 -0
- package/docs/api/foundation-utils.decodefrombase64withprefix.md +18 -0
- package/docs/api/foundation-utils.encodetobase64.md +13 -0
- package/docs/api/foundation-utils.encodetobase64withprefix.md +18 -0
- package/docs/api/foundation-utils.md +4 -0
- package/docs/api-report.md +12 -0
- package/package.json +10 -10
|
@@ -39,6 +39,14 @@
|
|
|
39
39
|
"package": "./directives"
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
+
{
|
|
43
|
+
"kind": "js",
|
|
44
|
+
"name": "*",
|
|
45
|
+
"declaration": {
|
|
46
|
+
"name": "*",
|
|
47
|
+
"package": "./encoding"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
42
50
|
{
|
|
43
51
|
"kind": "js",
|
|
44
52
|
"name": "*",
|
|
@@ -412,29 +420,6 @@
|
|
|
412
420
|
}
|
|
413
421
|
]
|
|
414
422
|
},
|
|
415
|
-
{
|
|
416
|
-
"kind": "javascript-module",
|
|
417
|
-
"path": "src/directives/index.ts",
|
|
418
|
-
"declarations": [],
|
|
419
|
-
"exports": [
|
|
420
|
-
{
|
|
421
|
-
"kind": "js",
|
|
422
|
-
"name": "*",
|
|
423
|
-
"declaration": {
|
|
424
|
-
"name": "*",
|
|
425
|
-
"package": "./sync"
|
|
426
|
-
}
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
"kind": "js",
|
|
430
|
-
"name": "*",
|
|
431
|
-
"declaration": {
|
|
432
|
-
"name": "*",
|
|
433
|
-
"package": "./when-else"
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
]
|
|
437
|
-
},
|
|
438
423
|
{
|
|
439
424
|
"kind": "javascript-module",
|
|
440
425
|
"path": "src/design-system/design-system.ts",
|
|
@@ -485,6 +470,29 @@
|
|
|
485
470
|
}
|
|
486
471
|
]
|
|
487
472
|
},
|
|
473
|
+
{
|
|
474
|
+
"kind": "javascript-module",
|
|
475
|
+
"path": "src/directives/index.ts",
|
|
476
|
+
"declarations": [],
|
|
477
|
+
"exports": [
|
|
478
|
+
{
|
|
479
|
+
"kind": "js",
|
|
480
|
+
"name": "*",
|
|
481
|
+
"declaration": {
|
|
482
|
+
"name": "*",
|
|
483
|
+
"package": "./sync"
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
"kind": "js",
|
|
488
|
+
"name": "*",
|
|
489
|
+
"declaration": {
|
|
490
|
+
"name": "*",
|
|
491
|
+
"package": "./when-else"
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
]
|
|
495
|
+
},
|
|
488
496
|
{
|
|
489
497
|
"kind": "javascript-module",
|
|
490
498
|
"path": "src/env/index.ts",
|
|
@@ -723,6 +731,21 @@
|
|
|
723
731
|
}
|
|
724
732
|
]
|
|
725
733
|
},
|
|
734
|
+
{
|
|
735
|
+
"kind": "javascript-module",
|
|
736
|
+
"path": "src/encoding/index.ts",
|
|
737
|
+
"declarations": [],
|
|
738
|
+
"exports": [
|
|
739
|
+
{
|
|
740
|
+
"kind": "js",
|
|
741
|
+
"name": "*",
|
|
742
|
+
"declaration": {
|
|
743
|
+
"name": "*",
|
|
744
|
+
"package": "./base64"
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
]
|
|
748
|
+
},
|
|
726
749
|
{
|
|
727
750
|
"kind": "javascript-module",
|
|
728
751
|
"path": "src/error/errorMap.ts",
|
|
@@ -1641,6 +1664,43 @@
|
|
|
1641
1664
|
}
|
|
1642
1665
|
]
|
|
1643
1666
|
},
|
|
1667
|
+
{
|
|
1668
|
+
"kind": "javascript-module",
|
|
1669
|
+
"path": "src/utils/index.ts",
|
|
1670
|
+
"declarations": [],
|
|
1671
|
+
"exports": [
|
|
1672
|
+
{
|
|
1673
|
+
"kind": "js",
|
|
1674
|
+
"name": "*",
|
|
1675
|
+
"declaration": {
|
|
1676
|
+
"name": "*",
|
|
1677
|
+
"package": "./logger"
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
]
|
|
1681
|
+
},
|
|
1682
|
+
{
|
|
1683
|
+
"kind": "javascript-module",
|
|
1684
|
+
"path": "src/utils/logger.ts",
|
|
1685
|
+
"declarations": [
|
|
1686
|
+
{
|
|
1687
|
+
"kind": "variable",
|
|
1688
|
+
"name": "logger",
|
|
1689
|
+
"description": "Logger for the foundation-utils package",
|
|
1690
|
+
"privacy": "public"
|
|
1691
|
+
}
|
|
1692
|
+
],
|
|
1693
|
+
"exports": [
|
|
1694
|
+
{
|
|
1695
|
+
"kind": "js",
|
|
1696
|
+
"name": "logger",
|
|
1697
|
+
"declaration": {
|
|
1698
|
+
"name": "logger",
|
|
1699
|
+
"module": "src/utils/logger.ts"
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
]
|
|
1703
|
+
},
|
|
1644
1704
|
{
|
|
1645
1705
|
"kind": "javascript-module",
|
|
1646
1706
|
"path": "src/styles/color.ts",
|
|
@@ -1988,43 +2048,6 @@
|
|
|
1988
2048
|
}
|
|
1989
2049
|
]
|
|
1990
2050
|
},
|
|
1991
|
-
{
|
|
1992
|
-
"kind": "javascript-module",
|
|
1993
|
-
"path": "src/utils/index.ts",
|
|
1994
|
-
"declarations": [],
|
|
1995
|
-
"exports": [
|
|
1996
|
-
{
|
|
1997
|
-
"kind": "js",
|
|
1998
|
-
"name": "*",
|
|
1999
|
-
"declaration": {
|
|
2000
|
-
"name": "*",
|
|
2001
|
-
"package": "./logger"
|
|
2002
|
-
}
|
|
2003
|
-
}
|
|
2004
|
-
]
|
|
2005
|
-
},
|
|
2006
|
-
{
|
|
2007
|
-
"kind": "javascript-module",
|
|
2008
|
-
"path": "src/utils/logger.ts",
|
|
2009
|
-
"declarations": [
|
|
2010
|
-
{
|
|
2011
|
-
"kind": "variable",
|
|
2012
|
-
"name": "logger",
|
|
2013
|
-
"description": "Logger for the foundation-utils package",
|
|
2014
|
-
"privacy": "public"
|
|
2015
|
-
}
|
|
2016
|
-
],
|
|
2017
|
-
"exports": [
|
|
2018
|
-
{
|
|
2019
|
-
"kind": "js",
|
|
2020
|
-
"name": "logger",
|
|
2021
|
-
"declaration": {
|
|
2022
|
-
"name": "logger",
|
|
2023
|
-
"module": "src/utils/logger.ts"
|
|
2024
|
-
}
|
|
2025
|
-
}
|
|
2026
|
-
]
|
|
2027
|
-
},
|
|
2028
2051
|
{
|
|
2029
2052
|
"kind": "javascript-module",
|
|
2030
2053
|
"path": "src/uuid/index.ts",
|
|
@@ -2364,6 +2387,160 @@
|
|
|
2364
2387
|
}
|
|
2365
2388
|
]
|
|
2366
2389
|
},
|
|
2390
|
+
{
|
|
2391
|
+
"kind": "javascript-module",
|
|
2392
|
+
"path": "src/encoding/base64/decode.ts",
|
|
2393
|
+
"declarations": [
|
|
2394
|
+
{
|
|
2395
|
+
"kind": "function",
|
|
2396
|
+
"name": "decodeFromBase64",
|
|
2397
|
+
"return": {
|
|
2398
|
+
"type": {
|
|
2399
|
+
"text": ""
|
|
2400
|
+
}
|
|
2401
|
+
},
|
|
2402
|
+
"parameters": [
|
|
2403
|
+
{
|
|
2404
|
+
"name": "base64Value",
|
|
2405
|
+
"type": {
|
|
2406
|
+
"text": "string"
|
|
2407
|
+
}
|
|
2408
|
+
},
|
|
2409
|
+
{
|
|
2410
|
+
"description": "The value to decode from base64.",
|
|
2411
|
+
"name": "value"
|
|
2412
|
+
}
|
|
2413
|
+
],
|
|
2414
|
+
"description": "Decodes a value from base64.",
|
|
2415
|
+
"privacy": "public"
|
|
2416
|
+
},
|
|
2417
|
+
{
|
|
2418
|
+
"kind": "function",
|
|
2419
|
+
"name": "decodeFromBase64WithPrefix",
|
|
2420
|
+
"return": {
|
|
2421
|
+
"type": {
|
|
2422
|
+
"text": ""
|
|
2423
|
+
}
|
|
2424
|
+
},
|
|
2425
|
+
"parameters": [
|
|
2426
|
+
{
|
|
2427
|
+
"name": "value",
|
|
2428
|
+
"type": {
|
|
2429
|
+
"text": "string"
|
|
2430
|
+
},
|
|
2431
|
+
"description": "The value to decode from base64."
|
|
2432
|
+
}
|
|
2433
|
+
],
|
|
2434
|
+
"description": "Decodes a value from base64 with a prefix.",
|
|
2435
|
+
"privacy": "public"
|
|
2436
|
+
}
|
|
2437
|
+
],
|
|
2438
|
+
"exports": [
|
|
2439
|
+
{
|
|
2440
|
+
"kind": "js",
|
|
2441
|
+
"name": "decodeFromBase64",
|
|
2442
|
+
"declaration": {
|
|
2443
|
+
"name": "decodeFromBase64",
|
|
2444
|
+
"module": "src/encoding/base64/decode.ts"
|
|
2445
|
+
}
|
|
2446
|
+
},
|
|
2447
|
+
{
|
|
2448
|
+
"kind": "js",
|
|
2449
|
+
"name": "decodeFromBase64WithPrefix",
|
|
2450
|
+
"declaration": {
|
|
2451
|
+
"name": "decodeFromBase64WithPrefix",
|
|
2452
|
+
"module": "src/encoding/base64/decode.ts"
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
]
|
|
2456
|
+
},
|
|
2457
|
+
{
|
|
2458
|
+
"kind": "javascript-module",
|
|
2459
|
+
"path": "src/encoding/base64/encode.ts",
|
|
2460
|
+
"declarations": [
|
|
2461
|
+
{
|
|
2462
|
+
"kind": "function",
|
|
2463
|
+
"name": "encodeToBase64",
|
|
2464
|
+
"return": {
|
|
2465
|
+
"type": {
|
|
2466
|
+
"text": ""
|
|
2467
|
+
}
|
|
2468
|
+
},
|
|
2469
|
+
"parameters": [
|
|
2470
|
+
{
|
|
2471
|
+
"name": "value",
|
|
2472
|
+
"type": {
|
|
2473
|
+
"text": "string | ArrayBuffer"
|
|
2474
|
+
},
|
|
2475
|
+
"description": "The value to encode to base64."
|
|
2476
|
+
}
|
|
2477
|
+
],
|
|
2478
|
+
"description": "Encodes the given value to base64.",
|
|
2479
|
+
"privacy": "public"
|
|
2480
|
+
},
|
|
2481
|
+
{
|
|
2482
|
+
"kind": "function",
|
|
2483
|
+
"name": "encodeToBase64WithPrefix",
|
|
2484
|
+
"return": {
|
|
2485
|
+
"type": {
|
|
2486
|
+
"text": ""
|
|
2487
|
+
}
|
|
2488
|
+
},
|
|
2489
|
+
"parameters": [
|
|
2490
|
+
{
|
|
2491
|
+
"name": "value",
|
|
2492
|
+
"type": {
|
|
2493
|
+
"text": "string | ArrayBuffer"
|
|
2494
|
+
},
|
|
2495
|
+
"description": "The value to encode to base64."
|
|
2496
|
+
}
|
|
2497
|
+
],
|
|
2498
|
+
"description": "Encodes the given value with a prefix to base64.",
|
|
2499
|
+
"privacy": "public"
|
|
2500
|
+
}
|
|
2501
|
+
],
|
|
2502
|
+
"exports": [
|
|
2503
|
+
{
|
|
2504
|
+
"kind": "js",
|
|
2505
|
+
"name": "encodeToBase64",
|
|
2506
|
+
"declaration": {
|
|
2507
|
+
"name": "encodeToBase64",
|
|
2508
|
+
"module": "src/encoding/base64/encode.ts"
|
|
2509
|
+
}
|
|
2510
|
+
},
|
|
2511
|
+
{
|
|
2512
|
+
"kind": "js",
|
|
2513
|
+
"name": "encodeToBase64WithPrefix",
|
|
2514
|
+
"declaration": {
|
|
2515
|
+
"name": "encodeToBase64WithPrefix",
|
|
2516
|
+
"module": "src/encoding/base64/encode.ts"
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
]
|
|
2520
|
+
},
|
|
2521
|
+
{
|
|
2522
|
+
"kind": "javascript-module",
|
|
2523
|
+
"path": "src/encoding/base64/index.ts",
|
|
2524
|
+
"declarations": [],
|
|
2525
|
+
"exports": [
|
|
2526
|
+
{
|
|
2527
|
+
"kind": "js",
|
|
2528
|
+
"name": "*",
|
|
2529
|
+
"declaration": {
|
|
2530
|
+
"name": "*",
|
|
2531
|
+
"package": "./decode"
|
|
2532
|
+
}
|
|
2533
|
+
},
|
|
2534
|
+
{
|
|
2535
|
+
"kind": "js",
|
|
2536
|
+
"name": "*",
|
|
2537
|
+
"declaration": {
|
|
2538
|
+
"name": "*",
|
|
2539
|
+
"package": "./encode"
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
]
|
|
2543
|
+
},
|
|
2367
2544
|
{
|
|
2368
2545
|
"kind": "javascript-module",
|
|
2369
2546
|
"path": "src/mappers/dto/index.ts",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decodes a value from base64.
|
|
3
|
+
* @public
|
|
4
|
+
* @param value - The value to decode from base64.
|
|
5
|
+
* @returns The decoded value.
|
|
6
|
+
*/
|
|
7
|
+
export declare const decodeFromBase64: (base64Value: string) => string | ArrayBuffer;
|
|
8
|
+
/**
|
|
9
|
+
* Decodes a value from base64 with a prefix.
|
|
10
|
+
* @remarks Prefixes are: 'str:' for string and 'bin:' for ArrayBuffer.
|
|
11
|
+
* @public
|
|
12
|
+
* @param value - The value to decode from base64.
|
|
13
|
+
* @returns The decoded value.
|
|
14
|
+
*/
|
|
15
|
+
export declare const decodeFromBase64WithPrefix: (value: string) => string | ArrayBuffer;
|
|
16
|
+
//# sourceMappingURL=decode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../../src/encoding/base64/decode.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,KAAG,MAAM,GAAG,WAY/D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,UAAW,MAAM,KAAG,MAAM,GAAG,WAqBnE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encodes the given value to base64.
|
|
3
|
+
* @public
|
|
4
|
+
* @param value - The value to encode to base64.
|
|
5
|
+
* @returns The base64 encoded value.
|
|
6
|
+
*/
|
|
7
|
+
export declare const encodeToBase64: (value: string | ArrayBuffer) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Encodes the given value with a prefix to base64.
|
|
10
|
+
* @remarks Prefixes are: 'str:' for string and 'bin:' for ArrayBuffer.
|
|
11
|
+
* @public
|
|
12
|
+
* @param value - The value to encode to base64.
|
|
13
|
+
* @returns The base64 encoded value with a prefix.
|
|
14
|
+
*/
|
|
15
|
+
export declare const encodeToBase64WithPrefix: (value: string | ArrayBuffer) => string;
|
|
16
|
+
//# sourceMappingURL=encode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../../src/encoding/base64/encode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,cAAc,UAAW,MAAM,GAAG,WAAW,KAAG,MAU5D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,UAAW,MAAM,GAAG,WAAW,KAAG,MAUtE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/encoding/base64/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/encoding/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
package/dist/dts/index.d.ts
CHANGED
package/dist/dts/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const base64Pattern = /^(?:[A-Za-z0-9+/]{4})*?(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
2
|
+
/**
|
|
3
|
+
* Decodes a value from base64.
|
|
4
|
+
* @public
|
|
5
|
+
* @param value - The value to decode from base64.
|
|
6
|
+
* @returns The decoded value.
|
|
7
|
+
*/
|
|
8
|
+
export const decodeFromBase64 = (base64Value) => {
|
|
9
|
+
if (base64Pattern.test(base64Value)) {
|
|
10
|
+
const decodedString = atob(base64Value);
|
|
11
|
+
const buffer = new Uint8Array(decodedString.length);
|
|
12
|
+
[...decodedString].forEach((_, i) => {
|
|
13
|
+
buffer[i] = decodedString.charCodeAt(i);
|
|
14
|
+
});
|
|
15
|
+
return buffer.buffer;
|
|
16
|
+
}
|
|
17
|
+
return base64Value;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Decodes a value from base64 with a prefix.
|
|
21
|
+
* @remarks Prefixes are: 'str:' for string and 'bin:' for ArrayBuffer.
|
|
22
|
+
* @public
|
|
23
|
+
* @param value - The value to decode from base64.
|
|
24
|
+
* @returns The decoded value.
|
|
25
|
+
*/
|
|
26
|
+
export const decodeFromBase64WithPrefix = (value) => {
|
|
27
|
+
const parts = value.split(':');
|
|
28
|
+
let prefix;
|
|
29
|
+
let base64Value;
|
|
30
|
+
if (parts.length === 2) {
|
|
31
|
+
[prefix, base64Value] = parts;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
base64Value = value;
|
|
35
|
+
}
|
|
36
|
+
const decodedValue = decodeFromBase64(base64Value);
|
|
37
|
+
if (prefix === 'str') {
|
|
38
|
+
const textDecoder = new TextDecoder('utf-8');
|
|
39
|
+
return textDecoder.decode(decodedValue);
|
|
40
|
+
}
|
|
41
|
+
else if (prefix === 'bin') {
|
|
42
|
+
return decodedValue;
|
|
43
|
+
}
|
|
44
|
+
return decodedValue;
|
|
45
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encodes the given value to base64.
|
|
3
|
+
* @public
|
|
4
|
+
* @param value - The value to encode to base64.
|
|
5
|
+
* @returns The base64 encoded value.
|
|
6
|
+
*/
|
|
7
|
+
export const encodeToBase64 = (value) => {
|
|
8
|
+
if (typeof value === 'string') {
|
|
9
|
+
return btoa(value);
|
|
10
|
+
}
|
|
11
|
+
else if (value instanceof ArrayBuffer) {
|
|
12
|
+
const buffer = new Uint8Array(value);
|
|
13
|
+
const binaryString = buffer.reduce((data, byte) => data + String.fromCharCode(byte), '');
|
|
14
|
+
return btoa(binaryString);
|
|
15
|
+
}
|
|
16
|
+
return '';
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Encodes the given value with a prefix to base64.
|
|
20
|
+
* @remarks Prefixes are: 'str:' for string and 'bin:' for ArrayBuffer.
|
|
21
|
+
* @public
|
|
22
|
+
* @param value - The value to encode to base64.
|
|
23
|
+
* @returns The base64 encoded value with a prefix.
|
|
24
|
+
*/
|
|
25
|
+
export const encodeToBase64WithPrefix = (value) => {
|
|
26
|
+
const base64Value = encodeToBase64(value);
|
|
27
|
+
if (typeof value === 'string') {
|
|
28
|
+
return `str:${base64Value}`;
|
|
29
|
+
}
|
|
30
|
+
else if (value instanceof ArrayBuffer) {
|
|
31
|
+
return `bin:${base64Value}`;
|
|
32
|
+
}
|
|
33
|
+
return '';
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './base64';
|
package/dist/esm/index.js
CHANGED
|
@@ -1621,6 +1621,62 @@
|
|
|
1621
1621
|
],
|
|
1622
1622
|
"extendsTokenRanges": []
|
|
1623
1623
|
},
|
|
1624
|
+
{
|
|
1625
|
+
"kind": "Variable",
|
|
1626
|
+
"canonicalReference": "@genesislcap/foundation-utils!decodeFromBase64:var",
|
|
1627
|
+
"docComment": "/**\n * Decodes a value from base64.\n *\n * @param value - The value to decode from base64.\n *\n * @returns The decoded value.\n *\n * @public\n */\n",
|
|
1628
|
+
"excerptTokens": [
|
|
1629
|
+
{
|
|
1630
|
+
"kind": "Content",
|
|
1631
|
+
"text": "decodeFromBase64: "
|
|
1632
|
+
},
|
|
1633
|
+
{
|
|
1634
|
+
"kind": "Content",
|
|
1635
|
+
"text": "(base64Value: string) => string | "
|
|
1636
|
+
},
|
|
1637
|
+
{
|
|
1638
|
+
"kind": "Reference",
|
|
1639
|
+
"text": "ArrayBuffer",
|
|
1640
|
+
"canonicalReference": "!ArrayBuffer:interface"
|
|
1641
|
+
}
|
|
1642
|
+
],
|
|
1643
|
+
"fileUrlPath": "src/encoding/base64/decode.ts",
|
|
1644
|
+
"isReadonly": true,
|
|
1645
|
+
"releaseTag": "Public",
|
|
1646
|
+
"name": "decodeFromBase64",
|
|
1647
|
+
"variableTypeTokenRange": {
|
|
1648
|
+
"startIndex": 1,
|
|
1649
|
+
"endIndex": 3
|
|
1650
|
+
}
|
|
1651
|
+
},
|
|
1652
|
+
{
|
|
1653
|
+
"kind": "Variable",
|
|
1654
|
+
"canonicalReference": "@genesislcap/foundation-utils!decodeFromBase64WithPrefix:var",
|
|
1655
|
+
"docComment": "/**\n * Decodes a value from base64 with a prefix.\n *\n * @remarks\n *\n * Prefixes are: 'str:' for string and 'bin:' for ArrayBuffer.\n *\n * @param value - The value to decode from base64.\n *\n * @returns The decoded value.\n *\n * @public\n */\n",
|
|
1656
|
+
"excerptTokens": [
|
|
1657
|
+
{
|
|
1658
|
+
"kind": "Content",
|
|
1659
|
+
"text": "decodeFromBase64WithPrefix: "
|
|
1660
|
+
},
|
|
1661
|
+
{
|
|
1662
|
+
"kind": "Content",
|
|
1663
|
+
"text": "(value: string) => string | "
|
|
1664
|
+
},
|
|
1665
|
+
{
|
|
1666
|
+
"kind": "Reference",
|
|
1667
|
+
"text": "ArrayBuffer",
|
|
1668
|
+
"canonicalReference": "!ArrayBuffer:interface"
|
|
1669
|
+
}
|
|
1670
|
+
],
|
|
1671
|
+
"fileUrlPath": "src/encoding/base64/decode.ts",
|
|
1672
|
+
"isReadonly": true,
|
|
1673
|
+
"releaseTag": "Public",
|
|
1674
|
+
"name": "decodeFromBase64WithPrefix",
|
|
1675
|
+
"variableTypeTokenRange": {
|
|
1676
|
+
"startIndex": 1,
|
|
1677
|
+
"endIndex": 3
|
|
1678
|
+
}
|
|
1679
|
+
},
|
|
1624
1680
|
{
|
|
1625
1681
|
"kind": "Variable",
|
|
1626
1682
|
"canonicalReference": "@genesislcap/foundation-utils!DEFAULT_ORGANISATION:var",
|
|
@@ -2701,6 +2757,70 @@
|
|
|
2701
2757
|
],
|
|
2702
2758
|
"extendsTokenRanges": []
|
|
2703
2759
|
},
|
|
2760
|
+
{
|
|
2761
|
+
"kind": "Variable",
|
|
2762
|
+
"canonicalReference": "@genesislcap/foundation-utils!encodeToBase64:var",
|
|
2763
|
+
"docComment": "/**\n * Encodes the given value to base64.\n *\n * @param value - The value to encode to base64.\n *\n * @returns The base64 encoded value.\n *\n * @public\n */\n",
|
|
2764
|
+
"excerptTokens": [
|
|
2765
|
+
{
|
|
2766
|
+
"kind": "Content",
|
|
2767
|
+
"text": "encodeToBase64: "
|
|
2768
|
+
},
|
|
2769
|
+
{
|
|
2770
|
+
"kind": "Content",
|
|
2771
|
+
"text": "(value: string | "
|
|
2772
|
+
},
|
|
2773
|
+
{
|
|
2774
|
+
"kind": "Reference",
|
|
2775
|
+
"text": "ArrayBuffer",
|
|
2776
|
+
"canonicalReference": "!ArrayBuffer:interface"
|
|
2777
|
+
},
|
|
2778
|
+
{
|
|
2779
|
+
"kind": "Content",
|
|
2780
|
+
"text": ") => string"
|
|
2781
|
+
}
|
|
2782
|
+
],
|
|
2783
|
+
"fileUrlPath": "src/encoding/base64/encode.ts",
|
|
2784
|
+
"isReadonly": true,
|
|
2785
|
+
"releaseTag": "Public",
|
|
2786
|
+
"name": "encodeToBase64",
|
|
2787
|
+
"variableTypeTokenRange": {
|
|
2788
|
+
"startIndex": 1,
|
|
2789
|
+
"endIndex": 4
|
|
2790
|
+
}
|
|
2791
|
+
},
|
|
2792
|
+
{
|
|
2793
|
+
"kind": "Variable",
|
|
2794
|
+
"canonicalReference": "@genesislcap/foundation-utils!encodeToBase64WithPrefix:var",
|
|
2795
|
+
"docComment": "/**\n * Encodes the given value with a prefix to base64.\n *\n * @remarks\n *\n * Prefixes are: 'str:' for string and 'bin:' for ArrayBuffer.\n *\n * @param value - The value to encode to base64.\n *\n * @returns The base64 encoded value with a prefix.\n *\n * @public\n */\n",
|
|
2796
|
+
"excerptTokens": [
|
|
2797
|
+
{
|
|
2798
|
+
"kind": "Content",
|
|
2799
|
+
"text": "encodeToBase64WithPrefix: "
|
|
2800
|
+
},
|
|
2801
|
+
{
|
|
2802
|
+
"kind": "Content",
|
|
2803
|
+
"text": "(value: string | "
|
|
2804
|
+
},
|
|
2805
|
+
{
|
|
2806
|
+
"kind": "Reference",
|
|
2807
|
+
"text": "ArrayBuffer",
|
|
2808
|
+
"canonicalReference": "!ArrayBuffer:interface"
|
|
2809
|
+
},
|
|
2810
|
+
{
|
|
2811
|
+
"kind": "Content",
|
|
2812
|
+
"text": ") => string"
|
|
2813
|
+
}
|
|
2814
|
+
],
|
|
2815
|
+
"fileUrlPath": "src/encoding/base64/encode.ts",
|
|
2816
|
+
"isReadonly": true,
|
|
2817
|
+
"releaseTag": "Public",
|
|
2818
|
+
"name": "encodeToBase64WithPrefix",
|
|
2819
|
+
"variableTypeTokenRange": {
|
|
2820
|
+
"startIndex": 1,
|
|
2821
|
+
"endIndex": 4
|
|
2822
|
+
}
|
|
2823
|
+
},
|
|
2704
2824
|
{
|
|
2705
2825
|
"kind": "TypeAlias",
|
|
2706
2826
|
"canonicalReference": "@genesislcap/foundation-utils!ErrorDetailMap:type",
|
|
@@ -184,6 +184,23 @@ export declare interface DatabaseRecord {
|
|
|
184
184
|
id: string;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Decodes a value from base64.
|
|
189
|
+
* @public
|
|
190
|
+
* @param value - The value to decode from base64.
|
|
191
|
+
* @returns The decoded value.
|
|
192
|
+
*/
|
|
193
|
+
export declare const decodeFromBase64: (base64Value: string) => string | ArrayBuffer;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Decodes a value from base64 with a prefix.
|
|
197
|
+
* @remarks Prefixes are: 'str:' for string and 'bin:' for ArrayBuffer.
|
|
198
|
+
* @public
|
|
199
|
+
* @param value - The value to decode from base64.
|
|
200
|
+
* @returns The decoded value.
|
|
201
|
+
*/
|
|
202
|
+
export declare const decodeFromBase64WithPrefix: (value: string) => string | ArrayBuffer;
|
|
203
|
+
|
|
187
204
|
/**
|
|
188
205
|
* The default Organisation value, used in auth/login flow [`genesislcap-foundation-login`](https://link-to-docs).
|
|
189
206
|
* @remarks Optional.
|
|
@@ -334,6 +351,23 @@ export declare interface DTOMapper<TDTO, TEntity> {
|
|
|
334
351
|
toDTO: (entity: Partial<TEntity>) => TDTO;
|
|
335
352
|
}
|
|
336
353
|
|
|
354
|
+
/**
|
|
355
|
+
* Encodes the given value to base64.
|
|
356
|
+
* @public
|
|
357
|
+
* @param value - The value to encode to base64.
|
|
358
|
+
* @returns The base64 encoded value.
|
|
359
|
+
*/
|
|
360
|
+
export declare const encodeToBase64: (value: string | ArrayBuffer) => string;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Encodes the given value with a prefix to base64.
|
|
364
|
+
* @remarks Prefixes are: 'str:' for string and 'bin:' for ArrayBuffer.
|
|
365
|
+
* @public
|
|
366
|
+
* @param value - The value to encode to base64.
|
|
367
|
+
* @returns The base64 encoded value with a prefix.
|
|
368
|
+
*/
|
|
369
|
+
export declare const encodeToBase64WithPrefix: (value: string | ArrayBuffer) => string;
|
|
370
|
+
|
|
337
371
|
/**
|
|
338
372
|
* @public
|
|
339
373
|
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-utils](./foundation-utils.md) > [decodeFromBase64](./foundation-utils.decodefrombase64.md)
|
|
4
|
+
|
|
5
|
+
## decodeFromBase64 variable
|
|
6
|
+
|
|
7
|
+
Decodes a value from base64.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
decodeFromBase64: (base64Value: string) => string | ArrayBuffer
|
|
13
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-utils](./foundation-utils.md) > [decodeFromBase64WithPrefix](./foundation-utils.decodefrombase64withprefix.md)
|
|
4
|
+
|
|
5
|
+
## decodeFromBase64WithPrefix variable
|
|
6
|
+
|
|
7
|
+
Decodes a value from base64 with a prefix.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
decodeFromBase64WithPrefix: (value: string) => string | ArrayBuffer
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Remarks
|
|
16
|
+
|
|
17
|
+
Prefixes are: 'str:' for string and 'bin:' for ArrayBuffer.
|
|
18
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-utils](./foundation-utils.md) > [encodeToBase64](./foundation-utils.encodetobase64.md)
|
|
4
|
+
|
|
5
|
+
## encodeToBase64 variable
|
|
6
|
+
|
|
7
|
+
Encodes the given value to base64.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
encodeToBase64: (value: string | ArrayBuffer) => string
|
|
13
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-utils](./foundation-utils.md) > [encodeToBase64WithPrefix](./foundation-utils.encodetobase64withprefix.md)
|
|
4
|
+
|
|
5
|
+
## encodeToBase64WithPrefix variable
|
|
6
|
+
|
|
7
|
+
Encodes the given value with a prefix to base64.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
encodeToBase64WithPrefix: (value: string | ArrayBuffer) => string
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Remarks
|
|
16
|
+
|
|
17
|
+
Prefixes are: 'str:' for string and 'bin:' for ArrayBuffer.
|
|
18
|
+
|
|
@@ -77,12 +77,16 @@
|
|
|
77
77
|
| [API\_HOST](./foundation-utils.api_host.md) | The Genesis Server URL (WebSocket or HTTP). |
|
|
78
78
|
| [createErrorMap](./foundation-utils.createerrormap.md) | A factory to create the error map. |
|
|
79
79
|
| [createObserver](./foundation-utils.createobserver.md) | Creates a new event observer instance. |
|
|
80
|
+
| [decodeFromBase64](./foundation-utils.decodefrombase64.md) | Decodes a value from base64. |
|
|
81
|
+
| [decodeFromBase64WithPrefix](./foundation-utils.decodefrombase64withprefix.md) | Decodes a value from base64 with a prefix. |
|
|
80
82
|
| [DEFAULT\_ORGANISATION](./foundation-utils.default_organisation.md) | The default Organisation value, used in auth/login flow \[<code>genesislcap-foundation-login</code>\](https://link-to-docs). |
|
|
81
83
|
| [DEFAULT\_PASSWORD](./foundation-utils.default_password.md) | The default Password value, used in auth/login flow \[<code>genesislcap-foundation-login</code>\](https://link-to-docs). |
|
|
82
84
|
| [DEFAULT\_USER](./foundation-utils.default_user.md) | The default Username value, used in auth/login flow \[<code>genesislcap-foundation-login</code>\](https://link-to-docs). |
|
|
83
85
|
| [defaultEventMap](./foundation-utils.defaulteventmap.md) | A map that associates specific HTML element tags with their corresponding default event names. |
|
|
84
86
|
| [defaultJSONSerializerConfig](./foundation-utils.defaultjsonserializerconfig.md) | A Default JSONSerializer Config for serializing and deserializing functions. |
|
|
85
87
|
| [defaultLoggerOptions](./foundation-utils.defaultloggeroptions.md) | The default logger options. |
|
|
88
|
+
| [encodeToBase64](./foundation-utils.encodetobase64.md) | Encodes the given value to base64. |
|
|
89
|
+
| [encodeToBase64WithPrefix](./foundation-utils.encodetobase64withprefix.md) | Encodes the given value with a prefix to base64. |
|
|
86
90
|
| [FORCE\_HTTP](./foundation-utils.force_http.md) | The path to a JSON config file for the HTTP mode. |
|
|
87
91
|
| [GENESIS\_SOCKET\_URL](./foundation-utils.genesis_socket_url.md) | Genesis Socket URL |
|
|
88
92
|
| [getFontMixin](./foundation-utils.getfontmixin.md) | Generates a CSS mixin for the specified font family, style, and weight. |
|
package/docs/api-report.md
CHANGED
|
@@ -124,6 +124,12 @@ export interface DatabaseRecord {
|
|
|
124
124
|
id: string;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
// @public
|
|
128
|
+
export const decodeFromBase64: (base64Value: string) => string | ArrayBuffer;
|
|
129
|
+
|
|
130
|
+
// @public
|
|
131
|
+
export const decodeFromBase64WithPrefix: (value: string) => string | ArrayBuffer;
|
|
132
|
+
|
|
127
133
|
// @public
|
|
128
134
|
export let DEFAULT_ORGANISATION: string;
|
|
129
135
|
|
|
@@ -191,6 +197,12 @@ export interface DTOMapper<TDTO, TEntity> {
|
|
|
191
197
|
toDTO: (entity: Partial<TEntity>) => TDTO;
|
|
192
198
|
}
|
|
193
199
|
|
|
200
|
+
// @public
|
|
201
|
+
export const encodeToBase64: (value: string | ArrayBuffer) => string;
|
|
202
|
+
|
|
203
|
+
// @public
|
|
204
|
+
export const encodeToBase64WithPrefix: (value: string | ArrayBuffer) => string;
|
|
205
|
+
|
|
194
206
|
// @public (undocumented)
|
|
195
207
|
export type ErrorDetailMap = Record<string, unknown>;
|
|
196
208
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-utils",
|
|
3
3
|
"description": "Genesis Foundation Utils",
|
|
4
|
-
"version": "14.225.
|
|
4
|
+
"version": "14.225.3-alpha-15b094e.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@genesislcap/foundation-testing": "14.225.
|
|
31
|
-
"@genesislcap/genx": "14.225.
|
|
32
|
-
"@genesislcap/rollup-builder": "14.225.
|
|
33
|
-
"@genesislcap/ts-builder": "14.225.
|
|
34
|
-
"@genesislcap/uvu-playwright-builder": "14.225.
|
|
35
|
-
"@genesislcap/vite-builder": "14.225.
|
|
36
|
-
"@genesislcap/webpack-builder": "14.225.
|
|
30
|
+
"@genesislcap/foundation-testing": "14.225.3-alpha-15b094e.0",
|
|
31
|
+
"@genesislcap/genx": "14.225.3-alpha-15b094e.0",
|
|
32
|
+
"@genesislcap/rollup-builder": "14.225.3-alpha-15b094e.0",
|
|
33
|
+
"@genesislcap/ts-builder": "14.225.3-alpha-15b094e.0",
|
|
34
|
+
"@genesislcap/uvu-playwright-builder": "14.225.3-alpha-15b094e.0",
|
|
35
|
+
"@genesislcap/vite-builder": "14.225.3-alpha-15b094e.0",
|
|
36
|
+
"@genesislcap/webpack-builder": "14.225.3-alpha-15b094e.0",
|
|
37
37
|
"rimraf": "^5.0.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@genesislcap/foundation-logger": "14.225.
|
|
40
|
+
"@genesislcap/foundation-logger": "14.225.3-alpha-15b094e.0",
|
|
41
41
|
"@microsoft/fast-components": "2.30.6",
|
|
42
42
|
"@microsoft/fast-element": "1.14.0",
|
|
43
43
|
"@microsoft/fast-foundation": "2.49.6",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
57
|
"customElements": "dist/custom-elements.json",
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "042f1b051fd4a57c332966e1d13d7944e211d1a5"
|
|
59
59
|
}
|