@qodalis/cli-encode 2.0.0-beta.9 → 2.0.0-rc.2
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/package.json +4 -4
- package/public-api.d.mts +9 -10
- package/public-api.d.ts +9 -10
- package/public-api.js +18 -17
- package/public-api.js.map +1 -1
- package/public-api.mjs +19 -18
- package/public-api.mjs.map +1 -1
- package/umd/{cli-entrypoint.global.js → index.global.js} +231 -83
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qodalis/cli-encode",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.2",
|
|
4
4
|
"description": "Encoding, decoding, and hashing utilities",
|
|
5
5
|
"author": "Qodalis Solutions",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"binary",
|
|
24
24
|
"rot13"
|
|
25
25
|
],
|
|
26
|
-
"umd": "./umd/index.js",
|
|
27
|
-
"unpkg": "./umd/index.js",
|
|
26
|
+
"umd": "./umd/index.global.js",
|
|
27
|
+
"unpkg": "./umd/index.global.js",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@qodalis/cli-core": "2.0.0-
|
|
29
|
+
"@qodalis/cli-core": "2.0.0-rc.2"
|
|
30
30
|
},
|
|
31
31
|
"sideEffects": false,
|
|
32
32
|
"main": "./public-api.js",
|
package/public-api.d.mts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import * as _qodalis_cli_core from '@qodalis/cli-core';
|
|
2
1
|
import { ICliCommandProcessor, CliProcessorMetadata, CliProcessCommand, ICliExecutionContext, ICliModule } from '@qodalis/cli-core';
|
|
3
2
|
|
|
4
3
|
declare class CliBase64CommandProcessor implements ICliCommandProcessor {
|
|
5
4
|
command: string;
|
|
6
5
|
aliases: string[];
|
|
7
6
|
description: string;
|
|
8
|
-
author:
|
|
7
|
+
author: any;
|
|
9
8
|
processors?: ICliCommandProcessor[];
|
|
10
9
|
metadata?: CliProcessorMetadata;
|
|
11
10
|
constructor();
|
|
@@ -16,7 +15,7 @@ declare class CliBase64CommandProcessor implements ICliCommandProcessor {
|
|
|
16
15
|
declare class CliHexCommandProcessor implements ICliCommandProcessor {
|
|
17
16
|
command: string;
|
|
18
17
|
description: string;
|
|
19
|
-
author:
|
|
18
|
+
author: any;
|
|
20
19
|
processors?: ICliCommandProcessor[];
|
|
21
20
|
metadata?: CliProcessorMetadata;
|
|
22
21
|
constructor();
|
|
@@ -27,7 +26,7 @@ declare class CliHexCommandProcessor implements ICliCommandProcessor {
|
|
|
27
26
|
declare class CliUrlCommandProcessor implements ICliCommandProcessor {
|
|
28
27
|
command: string;
|
|
29
28
|
description: string;
|
|
30
|
-
author:
|
|
29
|
+
author: any;
|
|
31
30
|
processors?: ICliCommandProcessor[];
|
|
32
31
|
metadata?: CliProcessorMetadata;
|
|
33
32
|
constructor();
|
|
@@ -38,7 +37,7 @@ declare class CliUrlCommandProcessor implements ICliCommandProcessor {
|
|
|
38
37
|
declare class CliHashCommandProcessor implements ICliCommandProcessor {
|
|
39
38
|
command: string;
|
|
40
39
|
description: string;
|
|
41
|
-
author:
|
|
40
|
+
author: any;
|
|
42
41
|
processors?: ICliCommandProcessor[];
|
|
43
42
|
metadata?: CliProcessorMetadata;
|
|
44
43
|
constructor();
|
|
@@ -49,7 +48,7 @@ declare class CliHashCommandProcessor implements ICliCommandProcessor {
|
|
|
49
48
|
declare class CliJwtCommandProcessor implements ICliCommandProcessor {
|
|
50
49
|
command: string;
|
|
51
50
|
description: string;
|
|
52
|
-
author:
|
|
51
|
+
author: any;
|
|
53
52
|
processors?: ICliCommandProcessor[];
|
|
54
53
|
metadata?: CliProcessorMetadata;
|
|
55
54
|
constructor();
|
|
@@ -62,7 +61,7 @@ declare class CliBinaryCommandProcessor implements ICliCommandProcessor {
|
|
|
62
61
|
command: string;
|
|
63
62
|
aliases: string[];
|
|
64
63
|
description: string;
|
|
65
|
-
author:
|
|
64
|
+
author: any;
|
|
66
65
|
processors?: ICliCommandProcessor[];
|
|
67
66
|
metadata?: CliProcessorMetadata;
|
|
68
67
|
constructor();
|
|
@@ -73,7 +72,7 @@ declare class CliBinaryCommandProcessor implements ICliCommandProcessor {
|
|
|
73
72
|
declare class CliRotCommandProcessor implements ICliCommandProcessor {
|
|
74
73
|
command: string;
|
|
75
74
|
description: string;
|
|
76
|
-
author:
|
|
75
|
+
author: any;
|
|
77
76
|
metadata?: CliProcessorMetadata;
|
|
78
77
|
parameters: {
|
|
79
78
|
name: string;
|
|
@@ -90,7 +89,7 @@ declare class CliRotCommandProcessor implements ICliCommandProcessor {
|
|
|
90
89
|
declare class CliMorseCommandProcessor implements ICliCommandProcessor {
|
|
91
90
|
command: string;
|
|
92
91
|
description: string;
|
|
93
|
-
author:
|
|
92
|
+
author: any;
|
|
94
93
|
processors?: ICliCommandProcessor[];
|
|
95
94
|
metadata?: CliProcessorMetadata;
|
|
96
95
|
constructor();
|
|
@@ -98,7 +97,7 @@ declare class CliMorseCommandProcessor implements ICliCommandProcessor {
|
|
|
98
97
|
writeDescription(context: ICliExecutionContext): void;
|
|
99
98
|
}
|
|
100
99
|
|
|
101
|
-
declare const LIBRARY_VERSION = "2.0.0-
|
|
100
|
+
declare const LIBRARY_VERSION = "2.0.0-rc.2";
|
|
102
101
|
declare const API_VERSION = 2;
|
|
103
102
|
|
|
104
103
|
declare const encodeModule: ICliModule;
|
package/public-api.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import * as _qodalis_cli_core from '@qodalis/cli-core';
|
|
2
1
|
import { ICliCommandProcessor, CliProcessorMetadata, CliProcessCommand, ICliExecutionContext, ICliModule } from '@qodalis/cli-core';
|
|
3
2
|
|
|
4
3
|
declare class CliBase64CommandProcessor implements ICliCommandProcessor {
|
|
5
4
|
command: string;
|
|
6
5
|
aliases: string[];
|
|
7
6
|
description: string;
|
|
8
|
-
author:
|
|
7
|
+
author: any;
|
|
9
8
|
processors?: ICliCommandProcessor[];
|
|
10
9
|
metadata?: CliProcessorMetadata;
|
|
11
10
|
constructor();
|
|
@@ -16,7 +15,7 @@ declare class CliBase64CommandProcessor implements ICliCommandProcessor {
|
|
|
16
15
|
declare class CliHexCommandProcessor implements ICliCommandProcessor {
|
|
17
16
|
command: string;
|
|
18
17
|
description: string;
|
|
19
|
-
author:
|
|
18
|
+
author: any;
|
|
20
19
|
processors?: ICliCommandProcessor[];
|
|
21
20
|
metadata?: CliProcessorMetadata;
|
|
22
21
|
constructor();
|
|
@@ -27,7 +26,7 @@ declare class CliHexCommandProcessor implements ICliCommandProcessor {
|
|
|
27
26
|
declare class CliUrlCommandProcessor implements ICliCommandProcessor {
|
|
28
27
|
command: string;
|
|
29
28
|
description: string;
|
|
30
|
-
author:
|
|
29
|
+
author: any;
|
|
31
30
|
processors?: ICliCommandProcessor[];
|
|
32
31
|
metadata?: CliProcessorMetadata;
|
|
33
32
|
constructor();
|
|
@@ -38,7 +37,7 @@ declare class CliUrlCommandProcessor implements ICliCommandProcessor {
|
|
|
38
37
|
declare class CliHashCommandProcessor implements ICliCommandProcessor {
|
|
39
38
|
command: string;
|
|
40
39
|
description: string;
|
|
41
|
-
author:
|
|
40
|
+
author: any;
|
|
42
41
|
processors?: ICliCommandProcessor[];
|
|
43
42
|
metadata?: CliProcessorMetadata;
|
|
44
43
|
constructor();
|
|
@@ -49,7 +48,7 @@ declare class CliHashCommandProcessor implements ICliCommandProcessor {
|
|
|
49
48
|
declare class CliJwtCommandProcessor implements ICliCommandProcessor {
|
|
50
49
|
command: string;
|
|
51
50
|
description: string;
|
|
52
|
-
author:
|
|
51
|
+
author: any;
|
|
53
52
|
processors?: ICliCommandProcessor[];
|
|
54
53
|
metadata?: CliProcessorMetadata;
|
|
55
54
|
constructor();
|
|
@@ -62,7 +61,7 @@ declare class CliBinaryCommandProcessor implements ICliCommandProcessor {
|
|
|
62
61
|
command: string;
|
|
63
62
|
aliases: string[];
|
|
64
63
|
description: string;
|
|
65
|
-
author:
|
|
64
|
+
author: any;
|
|
66
65
|
processors?: ICliCommandProcessor[];
|
|
67
66
|
metadata?: CliProcessorMetadata;
|
|
68
67
|
constructor();
|
|
@@ -73,7 +72,7 @@ declare class CliBinaryCommandProcessor implements ICliCommandProcessor {
|
|
|
73
72
|
declare class CliRotCommandProcessor implements ICliCommandProcessor {
|
|
74
73
|
command: string;
|
|
75
74
|
description: string;
|
|
76
|
-
author:
|
|
75
|
+
author: any;
|
|
77
76
|
metadata?: CliProcessorMetadata;
|
|
78
77
|
parameters: {
|
|
79
78
|
name: string;
|
|
@@ -90,7 +89,7 @@ declare class CliRotCommandProcessor implements ICliCommandProcessor {
|
|
|
90
89
|
declare class CliMorseCommandProcessor implements ICliCommandProcessor {
|
|
91
90
|
command: string;
|
|
92
91
|
description: string;
|
|
93
|
-
author:
|
|
92
|
+
author: any;
|
|
94
93
|
processors?: ICliCommandProcessor[];
|
|
95
94
|
metadata?: CliProcessorMetadata;
|
|
96
95
|
constructor();
|
|
@@ -98,7 +97,7 @@ declare class CliMorseCommandProcessor implements ICliCommandProcessor {
|
|
|
98
97
|
writeDescription(context: ICliExecutionContext): void;
|
|
99
98
|
}
|
|
100
99
|
|
|
101
|
-
declare const LIBRARY_VERSION = "2.0.0-
|
|
100
|
+
declare const LIBRARY_VERSION = "2.0.0-rc.2";
|
|
102
101
|
declare const API_VERSION = 2;
|
|
103
102
|
|
|
104
103
|
declare const encodeModule: ICliModule;
|
package/public-api.js
CHANGED
|
@@ -22,7 +22,7 @@ var CliBase64CommandProcessor = class {
|
|
|
22
22
|
acceptsRawInput: true,
|
|
23
23
|
valueRequired: true,
|
|
24
24
|
processCommand: async (command, context) => {
|
|
25
|
-
const text = command.value || command.data || "";
|
|
25
|
+
const text = cliCore.joinShellWords(command.value ?? "") || command.data || "";
|
|
26
26
|
const encoded = btoa(
|
|
27
27
|
new TextEncoder().encode(text).reduce(
|
|
28
28
|
(data, byte) => data + String.fromCharCode(byte),
|
|
@@ -54,7 +54,7 @@ var CliBase64CommandProcessor = class {
|
|
|
54
54
|
acceptsRawInput: true,
|
|
55
55
|
valueRequired: true,
|
|
56
56
|
processCommand: async (command, context) => {
|
|
57
|
-
const encoded = command.value || command.data || "";
|
|
57
|
+
const encoded = cliCore.joinShellWords(command.value ?? "") || command.data || "";
|
|
58
58
|
try {
|
|
59
59
|
const bytes = Uint8Array.from(
|
|
60
60
|
atob(encoded),
|
|
@@ -120,7 +120,7 @@ var CliHexCommandProcessor = class {
|
|
|
120
120
|
acceptsRawInput: true,
|
|
121
121
|
valueRequired: true,
|
|
122
122
|
processCommand: async (command, context) => {
|
|
123
|
-
const text = command.value || command.data || "";
|
|
123
|
+
const text = cliCore.joinShellWords(command.value ?? "") || command.data || "";
|
|
124
124
|
const hex = Array.from(new TextEncoder().encode(text)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
125
125
|
context.writer.writeln(hex);
|
|
126
126
|
context.process.output(hex);
|
|
@@ -142,7 +142,7 @@ var CliHexCommandProcessor = class {
|
|
|
142
142
|
acceptsRawInput: true,
|
|
143
143
|
valueRequired: true,
|
|
144
144
|
processCommand: async (command, context) => {
|
|
145
|
-
const hexStr = command.value || command.data || "";
|
|
145
|
+
const hexStr = cliCore.joinShellWords(command.value ?? "") || command.data || "";
|
|
146
146
|
try {
|
|
147
147
|
const bytes = new Uint8Array(
|
|
148
148
|
(hexStr.match(/.{1,2}/g) || []).map(
|
|
@@ -189,7 +189,7 @@ var CliHexCommandProcessor = class {
|
|
|
189
189
|
],
|
|
190
190
|
processCommand: async (command, context) => {
|
|
191
191
|
const { writer } = context;
|
|
192
|
-
const input = command.value || "";
|
|
192
|
+
const input = cliCore.joinShellWords(command.value ?? "") || "";
|
|
193
193
|
const fromBase = parseInt(command.args["from"]) || 10;
|
|
194
194
|
const toBase = parseInt(command.args["to"]) || 16;
|
|
195
195
|
if (fromBase < 2 || fromBase > 36 || toBase < 2 || toBase > 36) {
|
|
@@ -288,7 +288,7 @@ var CliUrlCommandProcessor = class {
|
|
|
288
288
|
acceptsRawInput: true,
|
|
289
289
|
valueRequired: true,
|
|
290
290
|
processCommand: async (command, context) => {
|
|
291
|
-
const text = command.value || command.data || "";
|
|
291
|
+
const text = cliCore.joinShellWords(command.value ?? "") || command.data || "";
|
|
292
292
|
const encoded = encodeURIComponent(text);
|
|
293
293
|
context.writer.writeln(encoded);
|
|
294
294
|
context.process.output(encoded);
|
|
@@ -315,7 +315,7 @@ var CliUrlCommandProcessor = class {
|
|
|
315
315
|
acceptsRawInput: true,
|
|
316
316
|
valueRequired: true,
|
|
317
317
|
processCommand: async (command, context) => {
|
|
318
|
-
const text = command.value || command.data || "";
|
|
318
|
+
const text = cliCore.joinShellWords(command.value ?? "") || command.data || "";
|
|
319
319
|
try {
|
|
320
320
|
const decoded = decodeURIComponent(text);
|
|
321
321
|
context.writer.writeln(decoded);
|
|
@@ -346,7 +346,7 @@ var CliUrlCommandProcessor = class {
|
|
|
346
346
|
acceptsRawInput: true,
|
|
347
347
|
valueRequired: true,
|
|
348
348
|
processCommand: async (command, context) => {
|
|
349
|
-
const input = command.value || command.data || "";
|
|
349
|
+
const input = cliCore.joinShellWords(command.value ?? "") || command.data || "";
|
|
350
350
|
try {
|
|
351
351
|
const url = new URL(input);
|
|
352
352
|
const parts = {
|
|
@@ -424,7 +424,7 @@ var CliHashCommandProcessor = class {
|
|
|
424
424
|
acceptsRawInput: true,
|
|
425
425
|
valueRequired: true,
|
|
426
426
|
processCommand: async (cmd, context) => {
|
|
427
|
-
const text = cmd.value || cmd.data || "";
|
|
427
|
+
const text = cliCore.joinShellWords(cmd.value ?? "") || cmd.data || "";
|
|
428
428
|
try {
|
|
429
429
|
const encoded = new TextEncoder().encode(text);
|
|
430
430
|
const hashBuffer = await crypto.subtle.digest(
|
|
@@ -500,7 +500,7 @@ var CliJwtCommandProcessor = class {
|
|
|
500
500
|
acceptsRawInput: true,
|
|
501
501
|
valueRequired: true,
|
|
502
502
|
processCommand: async (command, context) => {
|
|
503
|
-
const token = command.value || command.data || "";
|
|
503
|
+
const token = cliCore.joinShellWords(command.value ?? "") || command.data || "";
|
|
504
504
|
const { writer } = context;
|
|
505
505
|
const parts = token.split(".");
|
|
506
506
|
if (parts.length !== 3) {
|
|
@@ -629,7 +629,7 @@ var CliBinaryCommandProcessor = class {
|
|
|
629
629
|
acceptsRawInput: true,
|
|
630
630
|
valueRequired: true,
|
|
631
631
|
processCommand: async (command, context) => {
|
|
632
|
-
const text = command.value || command.data || "";
|
|
632
|
+
const text = cliCore.joinShellWords(command.value ?? "") || command.data || "";
|
|
633
633
|
const binary = Array.from(new TextEncoder().encode(text)).map((b) => b.toString(2).padStart(8, "0")).join(" ");
|
|
634
634
|
context.writer.writeln(binary);
|
|
635
635
|
context.process.output(binary);
|
|
@@ -656,7 +656,7 @@ var CliBinaryCommandProcessor = class {
|
|
|
656
656
|
acceptsRawInput: true,
|
|
657
657
|
valueRequired: true,
|
|
658
658
|
processCommand: async (command, context) => {
|
|
659
|
-
const input = command.value || command.data || "";
|
|
659
|
+
const input = cliCore.joinShellWords(command.value ?? "") || command.data || "";
|
|
660
660
|
try {
|
|
661
661
|
const cleaned = input.replace(/[^01]/g, "");
|
|
662
662
|
if (cleaned.length === 0 || cleaned.length % 8 !== 0) {
|
|
@@ -732,8 +732,9 @@ var CliRotCommandProcessor = class {
|
|
|
732
732
|
this.valueRequired = true;
|
|
733
733
|
}
|
|
734
734
|
async processCommand(command, context) {
|
|
735
|
-
const text = command.value || command.data || "";
|
|
736
|
-
const
|
|
735
|
+
const text = cliCore.joinShellWords(command.value ?? "") || command.data || "";
|
|
736
|
+
const parsedShift = parseInt(command.args["shift"]);
|
|
737
|
+
const shift = Number.isNaN(parsedShift) ? 13 : parsedShift;
|
|
737
738
|
const normalizedShift = (shift % 26 + 26) % 26;
|
|
738
739
|
const result = text.replace(/[a-zA-Z]/g, (char) => {
|
|
739
740
|
const base = char >= "a" ? 97 : 65;
|
|
@@ -854,7 +855,7 @@ var CliMorseCommandProcessor = class {
|
|
|
854
855
|
acceptsRawInput: true,
|
|
855
856
|
valueRequired: true,
|
|
856
857
|
processCommand: async (command, context) => {
|
|
857
|
-
const text = command.value || command.data || "";
|
|
858
|
+
const text = cliCore.joinShellWords(command.value ?? "") || command.data || "";
|
|
858
859
|
const morse = text.toUpperCase().split("").map((c) => CHAR_TO_MORSE[c] ?? c).join(" ");
|
|
859
860
|
context.writer.writeln(morse);
|
|
860
861
|
context.process.output(morse);
|
|
@@ -884,7 +885,7 @@ var CliMorseCommandProcessor = class {
|
|
|
884
885
|
acceptsRawInput: true,
|
|
885
886
|
valueRequired: true,
|
|
886
887
|
processCommand: async (command, context) => {
|
|
887
|
-
const input = command.value || command.data || "";
|
|
888
|
+
const input = cliCore.joinShellWords(command.value ?? "") || command.data || "";
|
|
888
889
|
try {
|
|
889
890
|
const text = input.split(" ").map((code) => {
|
|
890
891
|
if (code === "/") return " ";
|
|
@@ -939,7 +940,7 @@ var CliMorseCommandProcessor = class {
|
|
|
939
940
|
};
|
|
940
941
|
|
|
941
942
|
// src/lib/version.ts
|
|
942
|
-
var LIBRARY_VERSION = "2.0.0-
|
|
943
|
+
var LIBRARY_VERSION = "2.0.0-rc.2";
|
|
943
944
|
var API_VERSION = 2;
|
|
944
945
|
|
|
945
946
|
// src/public-api.ts
|