@qodalis/cli-browser-storage 0.0.3 → 2.0.0-beta.10

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 CHANGED
@@ -1,45 +1,37 @@
1
1
  {
2
2
  "name": "@qodalis/cli-browser-storage",
3
- "version": "0.0.3",
4
- "description": "An Angular CLI extension that provides browser storage utilities",
3
+ "version": "2.0.0-beta.10",
4
+ "description": "@qodalis/cli extension for managing browser storage (localStorage, sessionStorage, cookies).",
5
5
  "author": "Nicolae Lupei, Qodalis Solutions",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/qodalis-solutions/angular-web-cli"
9
+ "url": "https://github.com/qodalis-solutions/web-cli"
10
10
  },
11
11
  "homepage": "https://qodalis.com",
12
12
  "keywords": [
13
- "angular",
14
13
  "cli",
15
14
  "qodalis",
16
15
  "terminal",
16
+ "browser-storage",
17
17
  "cookies",
18
- "localstorage"
18
+ "localstorage",
19
+ "sessionstorage"
19
20
  ],
20
- "umd": "./umd/index.js",
21
- "unpkg": "./umd/index.js",
22
- "peerDependencies": {
23
- "@angular/common": "^16.2.0",
24
- "@angular/core": "^16.2.0"
25
- },
21
+ "umd": "./umd/index.global.js",
22
+ "unpkg": "./umd/index.global.js",
26
23
  "dependencies": {
27
- "tslib": "^2.3.0",
28
- "@qodalis/cli-core": "^0.0.16",
29
- "@qodalis/angular-cli": "^1.0.37"
24
+ "@qodalis/cli-core": "2.0.0-beta.10"
30
25
  },
31
26
  "sideEffects": false,
32
- "module": "fesm2022/qodalis-cli-browser-storage.mjs",
33
- "typings": "index.d.ts",
27
+ "main": "./public-api.js",
28
+ "module": "./public-api.mjs",
29
+ "types": "./public-api.d.ts",
34
30
  "exports": {
35
- "./package.json": {
36
- "default": "./package.json"
37
- },
38
31
  ".": {
39
- "types": "./index.d.ts",
40
- "esm2022": "./esm2022/qodalis-cli-browser-storage.mjs",
41
- "esm": "./esm2022/qodalis-cli-browser-storage.mjs",
42
- "default": "./fesm2022/qodalis-cli-browser-storage.mjs"
32
+ "types": "./public-api.d.ts",
33
+ "import": "./public-api.mjs",
34
+ "require": "./public-api.js"
43
35
  }
44
36
  }
45
- }
37
+ }
@@ -0,0 +1,29 @@
1
+ import { ICliCommandProcessor, ICliCommandAuthor, CliProcessorMetadata, CliProcessCommand, ICliExecutionContext, ICliModule } from '@qodalis/cli-core';
2
+
3
+ declare class CliCookiesCommandProcessor implements ICliCommandProcessor {
4
+ command: string;
5
+ description: string;
6
+ author?: ICliCommandAuthor | undefined;
7
+ processors?: ICliCommandProcessor[] | undefined;
8
+ version: string;
9
+ metadata?: CliProcessorMetadata | undefined;
10
+ constructor();
11
+ processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
12
+ writeDescription?(context: ICliExecutionContext): void;
13
+ }
14
+
15
+ declare class CliLocalStorageCommandProcessor implements ICliCommandProcessor {
16
+ command: string;
17
+ description: string;
18
+ author?: ICliCommandAuthor | undefined;
19
+ processors?: ICliCommandProcessor[] | undefined;
20
+ version: string;
21
+ metadata?: CliProcessorMetadata | undefined;
22
+ constructor();
23
+ processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
24
+ writeDescription?(context: ICliExecutionContext): void;
25
+ }
26
+
27
+ declare const browserStorageModule: ICliModule;
28
+
29
+ export { CliCookiesCommandProcessor, CliLocalStorageCommandProcessor, browserStorageModule };
package/public-api.d.ts CHANGED
@@ -1,2 +1,29 @@
1
- export * from './lib/cli-browser-storage.module';
2
- export * from './lib/index';
1
+ import { ICliCommandProcessor, ICliCommandAuthor, CliProcessorMetadata, CliProcessCommand, ICliExecutionContext, ICliModule } from '@qodalis/cli-core';
2
+
3
+ declare class CliCookiesCommandProcessor implements ICliCommandProcessor {
4
+ command: string;
5
+ description: string;
6
+ author?: ICliCommandAuthor | undefined;
7
+ processors?: ICliCommandProcessor[] | undefined;
8
+ version: string;
9
+ metadata?: CliProcessorMetadata | undefined;
10
+ constructor();
11
+ processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
12
+ writeDescription?(context: ICliExecutionContext): void;
13
+ }
14
+
15
+ declare class CliLocalStorageCommandProcessor implements ICliCommandProcessor {
16
+ command: string;
17
+ description: string;
18
+ author?: ICliCommandAuthor | undefined;
19
+ processors?: ICliCommandProcessor[] | undefined;
20
+ version: string;
21
+ metadata?: CliProcessorMetadata | undefined;
22
+ constructor();
23
+ processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
24
+ writeDescription?(context: ICliExecutionContext): void;
25
+ }
26
+
27
+ declare const browserStorageModule: ICliModule;
28
+
29
+ export { CliCookiesCommandProcessor, CliLocalStorageCommandProcessor, browserStorageModule };
package/public-api.js ADDED
@@ -0,0 +1,254 @@
1
+ 'use strict';
2
+
3
+ var cliCore = require('@qodalis/cli-core');
4
+
5
+ // src/lib/processors/cli-cookies-command-processor.ts
6
+
7
+ // src/lib/version.ts
8
+ var LIBRARY_VERSION = "2.0.0-beta.10";
9
+ var API_VERSION = 2;
10
+
11
+ // src/lib/processors/cli-cookies-command-processor.ts
12
+ var CliCookiesCommandProcessor = class {
13
+ constructor() {
14
+ this.command = "cookies";
15
+ this.description = "Interact with the cookies";
16
+ this.author = cliCore.DefaultLibraryAuthor;
17
+ this.processors = [];
18
+ this.version = LIBRARY_VERSION;
19
+ this.metadata = {
20
+ requiredCoreVersion: ">=2.0.0 <3.0.0",
21
+ requiredCliVersion: ">=2.0.0 <3.0.0"
22
+ };
23
+ this.processors = [
24
+ {
25
+ command: "list",
26
+ acceptsRawInput: true,
27
+ description: "List all cookies",
28
+ processCommand: async (command, context) => {
29
+ const cookies = document.cookie.split("; ").reduce(
30
+ (acc, cookie) => {
31
+ const [cookieKey, cookieValue] = cookie.split("=");
32
+ acc[cookieKey] = decodeURIComponent(
33
+ cookieValue || ""
34
+ );
35
+ return acc;
36
+ },
37
+ {}
38
+ );
39
+ for (const [key, value] of Object.entries(cookies)) {
40
+ context.writer.writeln(`${key}: ${value}`);
41
+ }
42
+ }
43
+ },
44
+ {
45
+ command: "get",
46
+ acceptsRawInput: true,
47
+ description: "Get the value of a key",
48
+ processCommand: async (command, context) => {
49
+ const [key] = command.chainCommands.slice(2);
50
+ const cookies = document.cookie.split("; ").reduce(
51
+ (acc, cookie) => {
52
+ const [cookieKey, cookieValue] = cookie.split("=");
53
+ acc[cookieKey] = decodeURIComponent(
54
+ cookieValue || ""
55
+ );
56
+ return acc;
57
+ },
58
+ {}
59
+ );
60
+ const value = cookies[key];
61
+ context.writer.writeln(value || "null");
62
+ }
63
+ },
64
+ {
65
+ command: "set",
66
+ acceptsRawInput: true,
67
+ description: "Set the value of a key",
68
+ processCommand: async (command, context) => {
69
+ const [key, ...value] = command.chainCommands.slice(1);
70
+ const expires = /* @__PURE__ */ new Date();
71
+ expires.setFullYear(expires.getFullYear() + 1);
72
+ document.cookie = `${key}=${encodeURIComponent(value.join(" "))};expires=${expires.toUTCString()};path=/`;
73
+ context.writer.writeSuccess("Cookie set successfully");
74
+ }
75
+ },
76
+ {
77
+ command: "remove",
78
+ acceptsRawInput: true,
79
+ description: "Remove a key",
80
+ processCommand: async (command, context) => {
81
+ const [key] = command.chainCommands.slice(1);
82
+ document.cookie = `${key}=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/`;
83
+ context.writer.writeSuccess("Cookie removed successfully");
84
+ }
85
+ }
86
+ ];
87
+ }
88
+ async processCommand(command, context) {
89
+ await context.executor.showHelp(command, context);
90
+ }
91
+ writeDescription(context) {
92
+ const { writer } = context;
93
+ writer.writeln("Read, write, and delete browser cookies");
94
+ writer.writeln();
95
+ writer.writeln("\u{1F4CB} Commands:");
96
+ writer.writeln(
97
+ ` ${writer.wrapInColor("cookies list", cliCore.CliForegroundColor.Cyan)} \u{1F36A} List all cookies`
98
+ );
99
+ writer.writeln(
100
+ ` ${writer.wrapInColor("cookies get <key>", cliCore.CliForegroundColor.Cyan)} Read a cookie value`
101
+ );
102
+ writer.writeln(
103
+ ` ${writer.wrapInColor("cookies set <key> <value>", cliCore.CliForegroundColor.Cyan)} Write a cookie`
104
+ );
105
+ writer.writeln(
106
+ ` ${writer.wrapInColor("cookies remove <key>", cliCore.CliForegroundColor.Cyan)} Delete a cookie`
107
+ );
108
+ writer.writeln();
109
+ writer.writeln("\u{1F4DD} Examples:");
110
+ writer.writeln(
111
+ ` cookies set lang en ${writer.wrapInColor("# Set a cookie", cliCore.CliForegroundColor.Green)}`
112
+ );
113
+ writer.writeln(
114
+ ` cookies get lang ${writer.wrapInColor("# Read a cookie", cliCore.CliForegroundColor.Green)}`
115
+ );
116
+ writer.writeln(
117
+ ` cookies list ${writer.wrapInColor("# Show all cookies", cliCore.CliForegroundColor.Green)}`
118
+ );
119
+ }
120
+ };
121
+ var CliLocalStorageCommandProcessor = class {
122
+ constructor() {
123
+ this.command = "local-storage";
124
+ this.description = "Interact with the local storage";
125
+ this.author = cliCore.DefaultLibraryAuthor;
126
+ this.processors = [];
127
+ this.version = LIBRARY_VERSION;
128
+ this.metadata = {
129
+ requiredCoreVersion: ">=2.0.0 <3.0.0",
130
+ requiredCliVersion: ">=2.0.0 <3.0.0"
131
+ };
132
+ this.processors = [
133
+ {
134
+ command: "get",
135
+ acceptsRawInput: true,
136
+ description: "Get the value of a key",
137
+ processCommand: async (command, context) => {
138
+ const [key] = command.chainCommands.slice(1);
139
+ const value = localStorage.getItem(key);
140
+ context.writer.writeln(value || "null");
141
+ }
142
+ },
143
+ {
144
+ command: "set",
145
+ acceptsRawInput: true,
146
+ description: "Set the value of a key",
147
+ processCommand: async (command, context) => {
148
+ const [key, ...value] = command.chainCommands.slice(1);
149
+ localStorage.setItem(key, value.join(" "));
150
+ context.writer.writeSuccess("Value set successfully");
151
+ }
152
+ },
153
+ {
154
+ command: "remove",
155
+ acceptsRawInput: true,
156
+ description: "Remove a key",
157
+ processCommand: async (command, context) => {
158
+ const [key] = command.chainCommands.slice(2);
159
+ localStorage.removeItem(key);
160
+ context.writer.writeSuccess("Key removed successfully");
161
+ }
162
+ }
163
+ ];
164
+ }
165
+ async processCommand(command, context) {
166
+ await context.executor.showHelp(command, context);
167
+ }
168
+ writeDescription(context) {
169
+ const { writer } = context;
170
+ writer.writeln(
171
+ "Read, write, and delete keys from the browser local storage"
172
+ );
173
+ writer.writeln();
174
+ writer.writeln("\u{1F4CB} Commands:");
175
+ writer.writeln(
176
+ ` ${writer.wrapInColor("local-storage get <key>", cliCore.CliForegroundColor.Cyan)} Read a value`
177
+ );
178
+ writer.writeln(
179
+ ` ${writer.wrapInColor("local-storage set <key> <value>", cliCore.CliForegroundColor.Cyan)} Write a value`
180
+ );
181
+ writer.writeln(
182
+ ` ${writer.wrapInColor("local-storage remove <key>", cliCore.CliForegroundColor.Cyan)} Delete a key`
183
+ );
184
+ writer.writeln();
185
+ writer.writeln("\u{1F4DD} Examples:");
186
+ writer.writeln(
187
+ ` local-storage set theme dark ${writer.wrapInColor("# Store a value", cliCore.CliForegroundColor.Green)}`
188
+ );
189
+ writer.writeln(
190
+ ` local-storage get theme ${writer.wrapInColor("# Read a value", cliCore.CliForegroundColor.Green)}`
191
+ );
192
+ writer.writeln(
193
+ ` local-storage remove theme ${writer.wrapInColor("# Delete a key", cliCore.CliForegroundColor.Green)}`
194
+ );
195
+ }
196
+ };
197
+
198
+ // src/public-api.ts
199
+ var browserStorageModule = {
200
+ apiVersion: API_VERSION,
201
+ name: "@qodalis/cli-browser-storage",
202
+ processors: [
203
+ new CliCookiesCommandProcessor(),
204
+ new CliLocalStorageCommandProcessor()
205
+ ],
206
+ translations: {
207
+ es: {
208
+ "cli.cookies.description": "Gestionar cookies del navegador",
209
+ "cli.local-storage.description": "Gestionar el almacenamiento local del navegador"
210
+ },
211
+ fr: {
212
+ "cli.cookies.description": "G\xE9rer les cookies du navigateur",
213
+ "cli.local-storage.description": "G\xE9rer le stockage local du navigateur"
214
+ },
215
+ de: {
216
+ "cli.cookies.description": "Browser-Cookies verwalten",
217
+ "cli.local-storage.description": "Lokalen Browserspeicher verwalten"
218
+ },
219
+ pt: {
220
+ "cli.cookies.description": "Gerenciar cookies do navegador",
221
+ "cli.local-storage.description": "Gerenciar o armazenamento local do navegador"
222
+ },
223
+ it: {
224
+ "cli.cookies.description": "Gestire i cookie del browser",
225
+ "cli.local-storage.description": "Gestire la memoria locale del browser"
226
+ },
227
+ ja: {
228
+ "cli.cookies.description": "\u30D6\u30E9\u30A6\u30B6\u306ECookie\u3092\u7BA1\u7406",
229
+ "cli.local-storage.description": "\u30D6\u30E9\u30A6\u30B6\u306E\u30ED\u30FC\u30AB\u30EB\u30B9\u30C8\u30EC\u30FC\u30B8\u3092\u7BA1\u7406"
230
+ },
231
+ ko: {
232
+ "cli.cookies.description": "\uBE0C\uB77C\uC6B0\uC800 \uCFE0\uD0A4 \uAD00\uB9AC",
233
+ "cli.local-storage.description": "\uBE0C\uB77C\uC6B0\uC800 \uB85C\uCEEC \uC2A4\uD1A0\uB9AC\uC9C0 \uAD00\uB9AC"
234
+ },
235
+ zh: {
236
+ "cli.cookies.description": "\u7BA1\u7406\u6D4F\u89C8\u5668 Cookie",
237
+ "cli.local-storage.description": "\u7BA1\u7406\u6D4F\u89C8\u5668\u672C\u5730\u5B58\u50A8"
238
+ },
239
+ ru: {
240
+ "cli.cookies.description": "\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 cookies \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430",
241
+ "cli.local-storage.description": "\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u043C \u0445\u0440\u0430\u043D\u0438\u043B\u0438\u0449\u0435\u043C \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430"
242
+ },
243
+ ro: {
244
+ "cli.cookies.description": "Gestionare cookie-uri ale browserului",
245
+ "cli.local-storage.description": "Gestionare stocare local\u0103 a browserului"
246
+ }
247
+ }
248
+ };
249
+
250
+ exports.CliCookiesCommandProcessor = CliCookiesCommandProcessor;
251
+ exports.CliLocalStorageCommandProcessor = CliLocalStorageCommandProcessor;
252
+ exports.browserStorageModule = browserStorageModule;
253
+ //# sourceMappingURL=public-api.js.map
254
+ //# sourceMappingURL=public-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../packages/plugins/browser-storage/src/lib/version.ts","../../packages/plugins/browser-storage/src/lib/processors/cli-cookies-command-processor.ts","../../packages/plugins/browser-storage/src/lib/processors/cli-local-storage-command-processor.ts","../../packages/plugins/browser-storage/src/public-api.ts"],"names":["DefaultLibraryAuthor","CliForegroundColor"],"mappings":";;;;;;;AAEO,IAAM,eAAA,GAAkB,eAAA;AACxB,IAAM,WAAA,GAAc,CAAA;;;ACSpB,IAAM,6BAAN,MAAiE;AAAA,EAgBpE,WAAA,GAAc;AAfd,IAAA,IAAA,CAAA,OAAA,GAAU,SAAA;AAEV,IAAA,IAAA,CAAA,WAAA,GAAc,2BAAA;AAEd,IAAA,IAAA,CAAA,MAAA,GAAyCA,4BAAA;AAEzC,IAAA,IAAA,CAAA,UAAA,GAAkD,EAAC;AAEnD,IAAA,IAAA,CAAA,OAAA,GAAU,eAAA;AAEV,IAAA,IAAA,CAAA,QAAA,GAA8C;AAAA,MAC1C,mBAAA,EAAqB,gBAAA;AAAA,MACrB,kBAAA,EAAoB;AAAA,KACxB;AAGI,IAAA,IAAA,CAAK,UAAA,GAAa;AAAA,MACd;AAAA,QACI,OAAA,EAAS,MAAA;AAAA,QACT,eAAA,EAAiB,IAAA;AAAA,QACjB,WAAA,EAAa,kBAAA;AAAA,QACb,cAAA,EAAgB,OACZ,OAAA,EACA,OAAA,KACC;AACD,UAAA,MAAM,OAAA,GAAU,QAAA,CAAS,MAAA,CAAO,KAAA,CAAM,IAAI,CAAA,CAAE,MAAA;AAAA,YACxC,CAAC,KAAK,MAAA,KAAW;AACb,cAAA,MAAM,CAAC,SAAA,EAAW,WAAW,CAAA,GAAI,MAAA,CAAO,MAAM,GAA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uCAAA;AAAA,MAC3B,+BAAA,EAAiC;AAAA,KACrC;AAAA,IACA,EAAA,EAAI;AAAA,MACA,yBAAA,EAA2B,uHAAA;AAAA,MAC3B,+BAAA,EAAiC;AAAA,KACrC;AAAA,IACA,EAAA,EAAI;AAAA,MACA,yBAAA,EAA2B,uCAAA;AAAA,MAC3B,+BAAA,EAAiC;AAAA;AACrC;AAER","file":"public-api.js","sourcesContent":["\n// Automatically generated during build\nexport const LIBRARY_VERSION = '2.0.0-beta.10';\nexport const API_VERSION = 2;\n ","import {\n CliForegroundColor,\n CliProcessCommand,\n CliProcessorMetadata,\n ICliCommandAuthor,\n ICliCommandProcessor,\n ICliExecutionContext,\n} from '@qodalis/cli-core';\n\nimport { DefaultLibraryAuthor } from '@qodalis/cli-core';\nimport { LIBRARY_VERSION } from '../version';\n\nexport class CliCookiesCommandProcessor implements ICliCommandProcessor {\n command = 'cookies';\n\n description = 'Interact with the cookies';\n\n author?: ICliCommandAuthor | undefined = DefaultLibraryAuthor;\n\n processors?: ICliCommandProcessor[] | undefined = [];\n\n version = LIBRARY_VERSION;\n\n metadata?: CliProcessorMetadata | undefined = {\n requiredCoreVersion: '>=2.0.0 <3.0.0',\n requiredCliVersion: '>=2.0.0 <3.0.0',\n };\n\n constructor() {\n this.processors = [\n {\n command: 'list',\n acceptsRawInput: true,\n description: 'List all cookies',\n processCommand: async (\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ) => {\n const cookies = document.cookie.split('; ').reduce(\n (acc, cookie) => {\n const [cookieKey, cookieValue] = cookie.split('=');\n acc[cookieKey] = decodeURIComponent(\n cookieValue || '',\n );\n return acc;\n },\n {} as Record<string, string>,\n );\n\n for (const [key, value] of Object.entries(cookies)) {\n context.writer.writeln(`${key}: ${value}`);\n }\n },\n },\n {\n command: 'get',\n acceptsRawInput: true,\n description: 'Get the value of a key',\n processCommand: async (\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ) => {\n const [key] = command.chainCommands.slice(2);\n\n const cookies = document.cookie.split('; ').reduce(\n (acc, cookie) => {\n const [cookieKey, cookieValue] = cookie.split('=');\n acc[cookieKey] = decodeURIComponent(\n cookieValue || '',\n );\n return acc;\n },\n {} as Record<string, string>,\n );\n\n const value = cookies[key];\n\n context.writer.writeln(value || 'null');\n },\n },\n {\n command: 'set',\n acceptsRawInput: true,\n description: 'Set the value of a key',\n processCommand: async (\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ) => {\n const [key, ...value] = command.chainCommands.slice(1);\n\n const expires = new Date();\n expires.setFullYear(expires.getFullYear() + 1);\n\n document.cookie = `${key}=${encodeURIComponent(value.join(' '))};expires=${expires.toUTCString()};path=/`;\n context.writer.writeSuccess('Cookie set successfully');\n },\n },\n {\n command: 'remove',\n acceptsRawInput: true,\n description: 'Remove a key',\n processCommand: async (\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ) => {\n const [key] = command.chainCommands.slice(1);\n\n document.cookie = `${key}=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/`;\n context.writer.writeSuccess('Cookie removed successfully');\n },\n },\n ];\n }\n\n async processCommand(\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ): Promise<void> {\n await context.executor.showHelp(command, context);\n }\n\n writeDescription?(context: ICliExecutionContext): void {\n const { writer } = context;\n writer.writeln('Read, write, and delete browser cookies');\n writer.writeln();\n writer.writeln('📋 Commands:');\n writer.writeln(\n ` ${writer.wrapInColor('cookies list', CliForegroundColor.Cyan)} 🍪 List all cookies`,\n );\n writer.writeln(\n ` ${writer.wrapInColor('cookies get <key>', CliForegroundColor.Cyan)} Read a cookie value`,\n );\n writer.writeln(\n ` ${writer.wrapInColor('cookies set <key> <value>', CliForegroundColor.Cyan)} Write a cookie`,\n );\n writer.writeln(\n ` ${writer.wrapInColor('cookies remove <key>', CliForegroundColor.Cyan)} Delete a cookie`,\n );\n writer.writeln();\n writer.writeln('📝 Examples:');\n writer.writeln(\n ` cookies set lang en ${writer.wrapInColor('# Set a cookie', CliForegroundColor.Green)}`,\n );\n writer.writeln(\n ` cookies get lang ${writer.wrapInColor('# Read a cookie', CliForegroundColor.Green)}`,\n );\n writer.writeln(\n ` cookies list ${writer.wrapInColor('# Show all cookies', CliForegroundColor.Green)}`,\n );\n }\n}\n","import {\n CliForegroundColor,\n CliProcessCommand,\n CliProcessorMetadata,\n ICliCommandAuthor,\n ICliCommandProcessor,\n ICliExecutionContext,\n} from '@qodalis/cli-core';\n\nimport { DefaultLibraryAuthor } from '@qodalis/cli-core';\nimport { LIBRARY_VERSION } from '../version';\n\nexport class CliLocalStorageCommandProcessor implements ICliCommandProcessor {\n command = 'local-storage';\n\n description = 'Interact with the local storage';\n\n author?: ICliCommandAuthor | undefined = DefaultLibraryAuthor;\n\n processors?: ICliCommandProcessor[] | undefined = [];\n\n version = LIBRARY_VERSION;\n\n metadata?: CliProcessorMetadata | undefined = {\n requiredCoreVersion: '>=2.0.0 <3.0.0',\n requiredCliVersion: '>=2.0.0 <3.0.0',\n };\n\n constructor() {\n this.processors = [\n {\n command: 'get',\n acceptsRawInput: true,\n description: 'Get the value of a key',\n processCommand: async (\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ) => {\n const [key] = command.chainCommands.slice(1);\n\n const value = localStorage.getItem(key);\n context.writer.writeln(value || 'null');\n },\n },\n {\n command: 'set',\n acceptsRawInput: true,\n description: 'Set the value of a key',\n processCommand: async (\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ) => {\n const [key, ...value] = command.chainCommands.slice(1);\n\n localStorage.setItem(key, value.join(' '));\n context.writer.writeSuccess('Value set successfully');\n },\n },\n {\n command: 'remove',\n acceptsRawInput: true,\n description: 'Remove a key',\n processCommand: async (\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ) => {\n const [key] = command.chainCommands.slice(2);\n\n localStorage.removeItem(key);\n context.writer.writeSuccess('Key removed successfully');\n },\n },\n ];\n }\n\n async processCommand(\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ): Promise<void> {\n await context.executor.showHelp(command, context);\n }\n\n writeDescription?(context: ICliExecutionContext): void {\n const { writer } = context;\n writer.writeln(\n 'Read, write, and delete keys from the browser local storage',\n );\n writer.writeln();\n writer.writeln('📋 Commands:');\n writer.writeln(\n ` ${writer.wrapInColor('local-storage get <key>', CliForegroundColor.Cyan)} Read a value`,\n );\n writer.writeln(\n ` ${writer.wrapInColor('local-storage set <key> <value>', CliForegroundColor.Cyan)} Write a value`,\n );\n writer.writeln(\n ` ${writer.wrapInColor('local-storage remove <key>', CliForegroundColor.Cyan)} Delete a key`,\n );\n writer.writeln();\n writer.writeln('📝 Examples:');\n writer.writeln(\n ` local-storage set theme dark ${writer.wrapInColor('# Store a value', CliForegroundColor.Green)}`,\n );\n writer.writeln(\n ` local-storage get theme ${writer.wrapInColor('# Read a value', CliForegroundColor.Green)}`,\n );\n writer.writeln(\n ` local-storage remove theme ${writer.wrapInColor('# Delete a key', CliForegroundColor.Green)}`,\n );\n }\n}\n","/*\n * Public API Surface of browser-storage\n */\n\nexport * from './lib/index';\n\nimport { ICliModule } from '@qodalis/cli-core';\nimport { CliCookiesCommandProcessor } from './lib/processors/cli-cookies-command-processor';\nimport { CliLocalStorageCommandProcessor } from './lib/processors/cli-local-storage-command-processor';\nimport { API_VERSION } from './lib/version';\n\nexport const browserStorageModule: ICliModule = {\n apiVersion: API_VERSION,\n name: '@qodalis/cli-browser-storage',\n processors: [\n new CliCookiesCommandProcessor(),\n new CliLocalStorageCommandProcessor(),\n ],\n translations: {\n es: {\n 'cli.cookies.description': 'Gestionar cookies del navegador',\n 'cli.local-storage.description': 'Gestionar el almacenamiento local del navegador',\n },\n fr: {\n 'cli.cookies.description': 'Gérer les cookies du navigateur',\n 'cli.local-storage.description': 'Gérer le stockage local du navigateur',\n },\n de: {\n 'cli.cookies.description': 'Browser-Cookies verwalten',\n 'cli.local-storage.description': 'Lokalen Browserspeicher verwalten',\n },\n pt: {\n 'cli.cookies.description': 'Gerenciar cookies do navegador',\n 'cli.local-storage.description': 'Gerenciar o armazenamento local do navegador',\n },\n it: {\n 'cli.cookies.description': 'Gestire i cookie del browser',\n 'cli.local-storage.description': 'Gestire la memoria locale del browser',\n },\n ja: {\n 'cli.cookies.description': 'ブラウザのCookieを管理',\n 'cli.local-storage.description': 'ブラウザのローカルストレージを管理',\n },\n ko: {\n 'cli.cookies.description': '브라우저 쿠키 관리',\n 'cli.local-storage.description': '브라우저 로컬 스토리지 관리',\n },\n zh: {\n 'cli.cookies.description': '管理浏览器 Cookie',\n 'cli.local-storage.description': '管理浏览器本地存储',\n },\n ru: {\n 'cli.cookies.description': 'Управление cookies браузера',\n 'cli.local-storage.description': 'Управление локальным хранилищем браузера',\n },\n ro: {\n 'cli.cookies.description': 'Gestionare cookie-uri ale browserului',\n 'cli.local-storage.description': 'Gestionare stocare locală a browserului',\n },\n },\n};\n"]}
package/public-api.mjs ADDED
@@ -0,0 +1,250 @@
1
+ import { DefaultLibraryAuthor, CliForegroundColor } from '@qodalis/cli-core';
2
+
3
+ // src/lib/processors/cli-cookies-command-processor.ts
4
+
5
+ // src/lib/version.ts
6
+ var LIBRARY_VERSION = "2.0.0-beta.10";
7
+ var API_VERSION = 2;
8
+
9
+ // src/lib/processors/cli-cookies-command-processor.ts
10
+ var CliCookiesCommandProcessor = class {
11
+ constructor() {
12
+ this.command = "cookies";
13
+ this.description = "Interact with the cookies";
14
+ this.author = DefaultLibraryAuthor;
15
+ this.processors = [];
16
+ this.version = LIBRARY_VERSION;
17
+ this.metadata = {
18
+ requiredCoreVersion: ">=2.0.0 <3.0.0",
19
+ requiredCliVersion: ">=2.0.0 <3.0.0"
20
+ };
21
+ this.processors = [
22
+ {
23
+ command: "list",
24
+ acceptsRawInput: true,
25
+ description: "List all cookies",
26
+ processCommand: async (command, context) => {
27
+ const cookies = document.cookie.split("; ").reduce(
28
+ (acc, cookie) => {
29
+ const [cookieKey, cookieValue] = cookie.split("=");
30
+ acc[cookieKey] = decodeURIComponent(
31
+ cookieValue || ""
32
+ );
33
+ return acc;
34
+ },
35
+ {}
36
+ );
37
+ for (const [key, value] of Object.entries(cookies)) {
38
+ context.writer.writeln(`${key}: ${value}`);
39
+ }
40
+ }
41
+ },
42
+ {
43
+ command: "get",
44
+ acceptsRawInput: true,
45
+ description: "Get the value of a key",
46
+ processCommand: async (command, context) => {
47
+ const [key] = command.chainCommands.slice(2);
48
+ const cookies = document.cookie.split("; ").reduce(
49
+ (acc, cookie) => {
50
+ const [cookieKey, cookieValue] = cookie.split("=");
51
+ acc[cookieKey] = decodeURIComponent(
52
+ cookieValue || ""
53
+ );
54
+ return acc;
55
+ },
56
+ {}
57
+ );
58
+ const value = cookies[key];
59
+ context.writer.writeln(value || "null");
60
+ }
61
+ },
62
+ {
63
+ command: "set",
64
+ acceptsRawInput: true,
65
+ description: "Set the value of a key",
66
+ processCommand: async (command, context) => {
67
+ const [key, ...value] = command.chainCommands.slice(1);
68
+ const expires = /* @__PURE__ */ new Date();
69
+ expires.setFullYear(expires.getFullYear() + 1);
70
+ document.cookie = `${key}=${encodeURIComponent(value.join(" "))};expires=${expires.toUTCString()};path=/`;
71
+ context.writer.writeSuccess("Cookie set successfully");
72
+ }
73
+ },
74
+ {
75
+ command: "remove",
76
+ acceptsRawInput: true,
77
+ description: "Remove a key",
78
+ processCommand: async (command, context) => {
79
+ const [key] = command.chainCommands.slice(1);
80
+ document.cookie = `${key}=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/`;
81
+ context.writer.writeSuccess("Cookie removed successfully");
82
+ }
83
+ }
84
+ ];
85
+ }
86
+ async processCommand(command, context) {
87
+ await context.executor.showHelp(command, context);
88
+ }
89
+ writeDescription(context) {
90
+ const { writer } = context;
91
+ writer.writeln("Read, write, and delete browser cookies");
92
+ writer.writeln();
93
+ writer.writeln("\u{1F4CB} Commands:");
94
+ writer.writeln(
95
+ ` ${writer.wrapInColor("cookies list", CliForegroundColor.Cyan)} \u{1F36A} List all cookies`
96
+ );
97
+ writer.writeln(
98
+ ` ${writer.wrapInColor("cookies get <key>", CliForegroundColor.Cyan)} Read a cookie value`
99
+ );
100
+ writer.writeln(
101
+ ` ${writer.wrapInColor("cookies set <key> <value>", CliForegroundColor.Cyan)} Write a cookie`
102
+ );
103
+ writer.writeln(
104
+ ` ${writer.wrapInColor("cookies remove <key>", CliForegroundColor.Cyan)} Delete a cookie`
105
+ );
106
+ writer.writeln();
107
+ writer.writeln("\u{1F4DD} Examples:");
108
+ writer.writeln(
109
+ ` cookies set lang en ${writer.wrapInColor("# Set a cookie", CliForegroundColor.Green)}`
110
+ );
111
+ writer.writeln(
112
+ ` cookies get lang ${writer.wrapInColor("# Read a cookie", CliForegroundColor.Green)}`
113
+ );
114
+ writer.writeln(
115
+ ` cookies list ${writer.wrapInColor("# Show all cookies", CliForegroundColor.Green)}`
116
+ );
117
+ }
118
+ };
119
+ var CliLocalStorageCommandProcessor = class {
120
+ constructor() {
121
+ this.command = "local-storage";
122
+ this.description = "Interact with the local storage";
123
+ this.author = DefaultLibraryAuthor;
124
+ this.processors = [];
125
+ this.version = LIBRARY_VERSION;
126
+ this.metadata = {
127
+ requiredCoreVersion: ">=2.0.0 <3.0.0",
128
+ requiredCliVersion: ">=2.0.0 <3.0.0"
129
+ };
130
+ this.processors = [
131
+ {
132
+ command: "get",
133
+ acceptsRawInput: true,
134
+ description: "Get the value of a key",
135
+ processCommand: async (command, context) => {
136
+ const [key] = command.chainCommands.slice(1);
137
+ const value = localStorage.getItem(key);
138
+ context.writer.writeln(value || "null");
139
+ }
140
+ },
141
+ {
142
+ command: "set",
143
+ acceptsRawInput: true,
144
+ description: "Set the value of a key",
145
+ processCommand: async (command, context) => {
146
+ const [key, ...value] = command.chainCommands.slice(1);
147
+ localStorage.setItem(key, value.join(" "));
148
+ context.writer.writeSuccess("Value set successfully");
149
+ }
150
+ },
151
+ {
152
+ command: "remove",
153
+ acceptsRawInput: true,
154
+ description: "Remove a key",
155
+ processCommand: async (command, context) => {
156
+ const [key] = command.chainCommands.slice(2);
157
+ localStorage.removeItem(key);
158
+ context.writer.writeSuccess("Key removed successfully");
159
+ }
160
+ }
161
+ ];
162
+ }
163
+ async processCommand(command, context) {
164
+ await context.executor.showHelp(command, context);
165
+ }
166
+ writeDescription(context) {
167
+ const { writer } = context;
168
+ writer.writeln(
169
+ "Read, write, and delete keys from the browser local storage"
170
+ );
171
+ writer.writeln();
172
+ writer.writeln("\u{1F4CB} Commands:");
173
+ writer.writeln(
174
+ ` ${writer.wrapInColor("local-storage get <key>", CliForegroundColor.Cyan)} Read a value`
175
+ );
176
+ writer.writeln(
177
+ ` ${writer.wrapInColor("local-storage set <key> <value>", CliForegroundColor.Cyan)} Write a value`
178
+ );
179
+ writer.writeln(
180
+ ` ${writer.wrapInColor("local-storage remove <key>", CliForegroundColor.Cyan)} Delete a key`
181
+ );
182
+ writer.writeln();
183
+ writer.writeln("\u{1F4DD} Examples:");
184
+ writer.writeln(
185
+ ` local-storage set theme dark ${writer.wrapInColor("# Store a value", CliForegroundColor.Green)}`
186
+ );
187
+ writer.writeln(
188
+ ` local-storage get theme ${writer.wrapInColor("# Read a value", CliForegroundColor.Green)}`
189
+ );
190
+ writer.writeln(
191
+ ` local-storage remove theme ${writer.wrapInColor("# Delete a key", CliForegroundColor.Green)}`
192
+ );
193
+ }
194
+ };
195
+
196
+ // src/public-api.ts
197
+ var browserStorageModule = {
198
+ apiVersion: API_VERSION,
199
+ name: "@qodalis/cli-browser-storage",
200
+ processors: [
201
+ new CliCookiesCommandProcessor(),
202
+ new CliLocalStorageCommandProcessor()
203
+ ],
204
+ translations: {
205
+ es: {
206
+ "cli.cookies.description": "Gestionar cookies del navegador",
207
+ "cli.local-storage.description": "Gestionar el almacenamiento local del navegador"
208
+ },
209
+ fr: {
210
+ "cli.cookies.description": "G\xE9rer les cookies du navigateur",
211
+ "cli.local-storage.description": "G\xE9rer le stockage local du navigateur"
212
+ },
213
+ de: {
214
+ "cli.cookies.description": "Browser-Cookies verwalten",
215
+ "cli.local-storage.description": "Lokalen Browserspeicher verwalten"
216
+ },
217
+ pt: {
218
+ "cli.cookies.description": "Gerenciar cookies do navegador",
219
+ "cli.local-storage.description": "Gerenciar o armazenamento local do navegador"
220
+ },
221
+ it: {
222
+ "cli.cookies.description": "Gestire i cookie del browser",
223
+ "cli.local-storage.description": "Gestire la memoria locale del browser"
224
+ },
225
+ ja: {
226
+ "cli.cookies.description": "\u30D6\u30E9\u30A6\u30B6\u306ECookie\u3092\u7BA1\u7406",
227
+ "cli.local-storage.description": "\u30D6\u30E9\u30A6\u30B6\u306E\u30ED\u30FC\u30AB\u30EB\u30B9\u30C8\u30EC\u30FC\u30B8\u3092\u7BA1\u7406"
228
+ },
229
+ ko: {
230
+ "cli.cookies.description": "\uBE0C\uB77C\uC6B0\uC800 \uCFE0\uD0A4 \uAD00\uB9AC",
231
+ "cli.local-storage.description": "\uBE0C\uB77C\uC6B0\uC800 \uB85C\uCEEC \uC2A4\uD1A0\uB9AC\uC9C0 \uAD00\uB9AC"
232
+ },
233
+ zh: {
234
+ "cli.cookies.description": "\u7BA1\u7406\u6D4F\u89C8\u5668 Cookie",
235
+ "cli.local-storage.description": "\u7BA1\u7406\u6D4F\u89C8\u5668\u672C\u5730\u5B58\u50A8"
236
+ },
237
+ ru: {
238
+ "cli.cookies.description": "\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 cookies \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430",
239
+ "cli.local-storage.description": "\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u043C \u0445\u0440\u0430\u043D\u0438\u043B\u0438\u0449\u0435\u043C \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430"
240
+ },
241
+ ro: {
242
+ "cli.cookies.description": "Gestionare cookie-uri ale browserului",
243
+ "cli.local-storage.description": "Gestionare stocare local\u0103 a browserului"
244
+ }
245
+ }
246
+ };
247
+
248
+ export { CliCookiesCommandProcessor, CliLocalStorageCommandProcessor, browserStorageModule };
249
+ //# sourceMappingURL=public-api.mjs.map
250
+ //# sourceMappingURL=public-api.mjs.map