@qodalis/cli-qr 2.0.0-beta.1 → 2.0.0-beta.11

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@qodalis/cli-qr",
3
- "version": "2.0.0-beta.1",
3
+ "version": "2.0.0-beta.11",
4
4
  "description": "@qodalis/cli extension for generating and displaying QR codes.",
5
5
  "author": "Nicolae Lupei, Qodalis Solutions",
6
6
  "license": "MIT",
@@ -18,10 +18,10 @@
18
18
  "barcode",
19
19
  "generator"
20
20
  ],
21
- "umd": "./umd/index.js",
22
- "unpkg": "./umd/index.js",
21
+ "umd": "./umd/index.global.js",
22
+ "unpkg": "./umd/index.global.js",
23
23
  "dependencies": {
24
- "@qodalis/cli-core": "2.0.0-beta.1",
24
+ "@qodalis/cli-core": "2.0.0-beta.11",
25
25
  "qr-code-styling": "^1.9.1"
26
26
  },
27
27
  "cliDependencies": [
package/public-api.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _qodalis_cli_core from '@qodalis/cli-core';
2
- import { ICliCommandProcessor, CliProcessorMetadata, CliProcessCommand, ICliExecutionContext, ICliModule } from '@qodalis/cli-core';
2
+ import { ICliCommandProcessor, CliProcessorMetadata, ICliConfigurationOption, CliProcessCommand, ICliExecutionContext, ICliModule } from '@qodalis/cli-core';
3
3
 
4
4
  declare class CliQrCommandProcessor implements ICliCommandProcessor {
5
5
  command: string;
@@ -8,12 +8,13 @@ declare class CliQrCommandProcessor implements ICliCommandProcessor {
8
8
  version: string;
9
9
  processors?: ICliCommandProcessor[] | undefined;
10
10
  metadata?: CliProcessorMetadata | undefined;
11
+ configurationOptions?: ICliConfigurationOption[];
11
12
  constructor();
12
13
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
13
14
  writeDescription(context: ICliExecutionContext): void;
14
15
  }
15
16
 
16
- declare const LIBRARY_VERSION = "2.0.0-beta.1";
17
+ declare const LIBRARY_VERSION = "2.0.0-beta.11";
17
18
  declare const API_VERSION = 2;
18
19
 
19
20
  declare const qrModule: ICliModule;
package/public-api.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _qodalis_cli_core from '@qodalis/cli-core';
2
- import { ICliCommandProcessor, CliProcessorMetadata, CliProcessCommand, ICliExecutionContext, ICliModule } from '@qodalis/cli-core';
2
+ import { ICliCommandProcessor, CliProcessorMetadata, ICliConfigurationOption, CliProcessCommand, ICliExecutionContext, ICliModule } from '@qodalis/cli-core';
3
3
 
4
4
  declare class CliQrCommandProcessor implements ICliCommandProcessor {
5
5
  command: string;
@@ -8,12 +8,13 @@ declare class CliQrCommandProcessor implements ICliCommandProcessor {
8
8
  version: string;
9
9
  processors?: ICliCommandProcessor[] | undefined;
10
10
  metadata?: CliProcessorMetadata | undefined;
11
+ configurationOptions?: ICliConfigurationOption[];
11
12
  constructor();
12
13
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
13
14
  writeDescription(context: ICliExecutionContext): void;
14
15
  }
15
16
 
16
- declare const LIBRARY_VERSION = "2.0.0-beta.1";
17
+ declare const LIBRARY_VERSION = "2.0.0-beta.11";
17
18
  declare const API_VERSION = 2;
18
19
 
19
20
  declare const qrModule: ICliModule;
package/public-api.js CHANGED
@@ -10,7 +10,7 @@ var QRCodeStyling__default = /*#__PURE__*/_interopDefault(QRCodeStyling);
10
10
  // src/lib/processors/cli-qr-command-processor.ts
11
11
 
12
12
  // src/lib/version.ts
13
- var LIBRARY_VERSION = "2.0.0-beta.1";
13
+ var LIBRARY_VERSION = "2.0.0-beta.11";
14
14
  var API_VERSION = 2;
15
15
 
16
16
  // src/lib/processors/cli-qr-command-processor.ts
@@ -25,6 +25,30 @@ var CliQrCommandProcessor = class {
25
25
  requiredCoreVersion: ">=2.0.0 <3.0.0",
26
26
  requiredCliVersion: ">=2.0.0 <3.0.0"
27
27
  };
28
+ this.configurationOptions = [
29
+ {
30
+ key: "defaultWidth",
31
+ label: "Default Width",
32
+ description: "Default QR code width in pixels",
33
+ type: "number",
34
+ defaultValue: 300,
35
+ validator: (v) => ({
36
+ valid: typeof v === "number" && v >= 50 && v <= 2e3,
37
+ message: "Must be between 50 and 2000"
38
+ })
39
+ },
40
+ {
41
+ key: "defaultHeight",
42
+ label: "Default Height",
43
+ description: "Default QR code height in pixels",
44
+ type: "number",
45
+ defaultValue: 300,
46
+ validator: (v) => ({
47
+ valid: typeof v === "number" && v >= 50 && v <= 2e3,
48
+ message: "Must be between 50 and 2000"
49
+ })
50
+ }
51
+ ];
28
52
  this.processors = [
29
53
  {
30
54
  command: "generate",
@@ -52,10 +76,12 @@ var CliQrCommandProcessor = class {
52
76
  return;
53
77
  }
54
78
  const fileName = command.args["fileName"] || "qr-code";
79
+ const width = command.args["width"] ?? cliCore.getPluginConfigValue(context, "qr", "defaultWidth", 300);
80
+ const height = command.args["height"] ?? cliCore.getPluginConfigValue(context, "qr", "defaultHeight", 300);
55
81
  try {
56
82
  const qrCode = new QRCodeStyling__default.default({
57
- width: 300,
58
- height: 300,
83
+ width,
84
+ height,
59
85
  data: text,
60
86
  type: "svg"
61
87
  });
package/public-api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../packages/plugins/qr/src/lib/version.ts","../../packages/plugins/qr/src/lib/processors/cli-qr-command-processor.ts","../../packages/plugins/qr/src/public-api.ts"],"names":["DefaultLibraryAuthor","QRCodeStyling","CliForegroundColor"],"mappings":";;;;;;;;;;;;AAEO,IAAM,eAAA,GAAkB;AACxB,IAAM,WAAA,GAAc;;;ACQpB,IAAM,wBAAN,MAA4D;AAAA,EAiB/D,WAAA,GAAc;AAhBd,IAAA,IAAA,CAAA,OAAA,GAAU,IAAA;AAEV,IAAA,IAAA,CAAA,WAAA,GACI,oHAAA;AAEJ,IAAA,IAAA,CAAA,MAAA,GAASA,4BAAA;AAET,IAAA,IAAA,CAAA,OAAA,GAAU,eAAA;AAEV,IAAA,IAAA,CAAA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AAmB,KAAK,CAAC,CAAA;AAAA,KAC9H;AACA,IAAA,MAAA,CAAO,OAAA;AAAA,MACH,6DAA6D,MAAA,CAAO,WAAA,CAAY,mBAAA,EAAqBA,0BAAA,CAAmB,KAAK,CAAC,CAAA;AAAA,KAClI;AAAA,EACJ;AACJ;;;AC5GO,IAAM,QAAA,GAAuB;AAAA,EAChC,UAAA,EAAY,WAAA;AAAA,EACZ,IAAA,EAAM,iBAAA;AAAA,EACN,UAAA,EAAY,CAAC,IAAI,qBAAA,EAAuB,CAAA;AAAA,EACxC,YAAA,EAAc;AAAA,IACV,EAAA,EAAI,EAAE,oBAAA,EAAsB,uBAAA,EAAqB;AAAA,IACjD,EAAA,EAAI,EAAE,oBAAA,EAAsB,4BAAA,EAAuB;AAAA,IACnD,EAAA,EAAI,EAAE,oBAAA,EAAsB,qBAAA,EAAsB;AAAA,IAClD,EAAA,EAAI,EAAE,oBAAA,EAAsB,qBAAA,EAAmB;AAAA,IAC/C,EAAA,EAAI,EAAE,oBAAA,EAAsB,oBAAA,EAAqB;AAAA,IACjD,EAAA,EAAI,EAAE,oBAAA,EAAsB,wCAAA,EAAW;AAAA,IACvC,EAAA,EAAI,EAAE,oBAAA,EAAsB,8BAAA,EAAW;AAAA,IACvC,EAAA,EAAI,EAAE,oBAAA,EAAsB,gCAAA,EAAQ;AAAA,IACpC,EAAA,EAAI,EAAE,oBAAA,EAAsB,0FAAA,EAAqB;AAAA,IACjD,EAAA,EAAI,EAAE,oBAAA,EAAsB,oBAAA;AAAqB;AAEzD","file":"public-api.js","sourcesContent":["\n// Automatically generated during build\nexport const LIBRARY_VERSION = '2.0.0-beta.1';\nexport const API_VERSION = 2;\n ","import {\n CliForegroundColor,\n CliProcessCommand,\n CliProcessorMetadata,\n DefaultLibraryAuthor,\n ICliCommandProcessor,\n ICliExecutionContext,\n} from '@qodalis/cli-core';\nimport QRCodeStyling from 'qr-code-styling';\nimport { LIBRARY_VERSION } from '../version';\n\nexport class CliQrCommandProcessor implements ICliCommandProcessor {\n command = 'qr';\n\n description =\n 'Provide utility functions to generate QR codes. Usage: qr generate --text \"https://example.com\" --fileName \"my-qr\"';\n\n author = DefaultLibraryAuthor;\n\n version = LIBRARY_VERSION;\n\n processors?: ICliCommandProcessor[] | undefined = [];\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: 'generate',\n description:\n 'Generate a QR code and download it as PNG. Usage: qr generate --text \"https://example.com\"',\n parameters: [\n {\n name: 'text',\n description: 'Text or URL to encode as a QR code',\n type: 'string',\n required: true,\n },\n {\n name: 'fileName',\n description: 'the file name',\n type: 'string',\n required: false,\n },\n ],\n processCommand: async (command, context) => {\n const text = command.args['text'];\n\n if (!text) {\n context.writer.writeError(\n 'Missing required parameter: --text',\n );\n return;\n }\n\n const fileName = command.args['fileName'] || 'qr-code';\n\n try {\n const qrCode = new QRCodeStyling({\n width: 300,\n height: 300,\n data: text,\n type: 'svg',\n });\n\n await qrCode.download({\n name: fileName,\n extension: 'png',\n });\n\n context.writer.writeSuccess(\n `QR Code for \"${text}\" downloaded as ${fileName}.png`,\n );\n } catch (err) {\n context.writer.writeError(\n `Failed to generate QR code: ${err}`,\n );\n }\n },\n },\n ];\n }\n\n async processCommand(\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ): Promise<void> {\n context.executor.showHelp(command, context);\n }\n\n writeDescription(context: ICliExecutionContext): void {\n const { writer } = context;\n writer.writeln(\n 'Generate QR codes from text or URLs and download as PNG',\n );\n writer.writeln();\n writer.writeln('📋 Usage:');\n writer.writeln(\n ` ${writer.wrapInColor('qr generate --text=\"<content>\"', CliForegroundColor.Cyan)}`,\n );\n writer.writeln();\n writer.writeln('⚙️ Options:');\n writer.writeln(\n ` ${writer.wrapInColor('--text', CliForegroundColor.Yellow)} Text or URL to encode (required)`,\n );\n writer.writeln(\n ` ${writer.wrapInColor('--fileName', CliForegroundColor.Yellow)} Output filename (default: qr-code)`,\n );\n writer.writeln();\n writer.writeln('📝 Examples:');\n writer.writeln(\n ` qr generate --text=\"https://example.com\" ${writer.wrapInColor('# URL QR code', CliForegroundColor.Green)}`,\n );\n writer.writeln(\n ` qr generate --text=\"Hello!\" --fileName=\"my-qr\" ${writer.wrapInColor('# Custom filename', CliForegroundColor.Green)}`,\n );\n }\n}\n","/*\n * Public API Surface of qr\n */\n\nexport * from './lib/processors/cli-qr-command-processor';\n\nexport * from './lib/version';\n\nimport { ICliModule } from '@qodalis/cli-core';\nimport { CliQrCommandProcessor } from './lib/processors/cli-qr-command-processor';\nimport { API_VERSION } from './lib/version';\n\nexport const qrModule: ICliModule = {\n apiVersion: API_VERSION,\n name: '@qodalis/cli-qr',\n processors: [new CliQrCommandProcessor()],\n translations: {\n es: { 'cli.qr.description': 'Generar códigos QR' },\n fr: { 'cli.qr.description': 'Générer des codes QR' },\n de: { 'cli.qr.description': 'QR-Codes generieren' },\n pt: { 'cli.qr.description': 'Gerar códigos QR' },\n it: { 'cli.qr.description': 'Generare codici QR' },\n ja: { 'cli.qr.description': 'QRコードを生成' },\n ko: { 'cli.qr.description': 'QR 코드 생성' },\n zh: { 'cli.qr.description': '生成二维码' },\n ru: { 'cli.qr.description': 'Генерация QR-кодов' },\n ro: { 'cli.qr.description': 'Generare coduri QR' },\n },\n};\n"]}
1
+ {"version":3,"sources":["../../packages/plugins/qr/src/lib/version.ts","../../packages/plugins/qr/src/lib/processors/cli-qr-command-processor.ts","../../packages/plugins/qr/src/public-api.ts"],"names":["DefaultLibraryAuthor","getPluginConfigValue","QRCodeStyling","CliForegroundColor"],"mappings":";;;;;;;;;;;;AAEO,IAAM,eAAA,GAAkB;AACxB,IAAM,WAAA,GAAc;;;ACUpB,IAAM,wBAAN,MAA4D;AAAA,EA0C/D,WAAA,GAAc;AAzCd,IAAA,IAAA,CAAA,OAAA,GAAU,IAAA;AAEV,IAAA,IAAA,CAAA,WAAA,G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J;AACJ;;;ACzIO,IAAM,QAAA,GAAuB;AAAA,EAChC,UAAA,EAAY,WAAA;AAAA,EACZ,IAAA,EAAM,iBAAA;AAAA,EACN,UAAA,EAAY,CAAC,IAAI,qBAAA,EAAuB,CAAA;AAAA,EACxC,YAAA,EAAc;AAAA,IACV,EAAA,EAAI,EAAE,oBAAA,EAAsB,uBAAA,EAAqB;AAAA,IACjD,EAAA,EAAI,EAAE,oBAAA,EAAsB,4BAAA,EAAuB;AAAA,IACnD,EAAA,EAAI,EAAE,oBAAA,EAAsB,qBAAA,EAAsB;AAAA,IAClD,EAAA,EAAI,EAAE,oBAAA,EAAsB,qBAAA,EAAmB;AAAA,IAC/C,EAAA,EAAI,EAAE,oBAAA,EAAsB,oBAAA,EAAqB;AAAA,IACjD,EAAA,EAAI,EAAE,oBAAA,EAAsB,wCAAA,EAAW;AAAA,IACvC,EAAA,EAAI,EAAE,oBAAA,EAAsB,8BAAA,EAAW;AAAA,IACvC,EAAA,EAAI,EAAE,oBAAA,EAAsB,gCAAA,EAAQ;AAAA,IACpC,EAAA,EAAI,EAAE,oBAAA,EAAsB,0FAAA,EAAqB;AAAA,IACjD,EAAA,EAAI,EAAE,oBAAA,EAAsB,oBAAA;AAAqB;AAEzD","file":"public-api.js","sourcesContent":["\n// Automatically generated during build\nexport const LIBRARY_VERSION = '2.0.0-beta.11';\nexport const API_VERSION = 2;\n ","import {\n CliForegroundColor,\n CliProcessCommand,\n CliProcessorMetadata,\n DefaultLibraryAuthor,\n ICliCommandProcessor,\n ICliConfigurationOption,\n ICliExecutionContext,\n getPluginConfigValue,\n} from '@qodalis/cli-core';\nimport QRCodeStyling from 'qr-code-styling';\nimport { LIBRARY_VERSION } from '../version';\n\nexport class CliQrCommandProcessor implements ICliCommandProcessor {\n command = 'qr';\n\n description =\n 'Provide utility functions to generate QR codes. Usage: qr generate --text \"https://example.com\" --fileName \"my-qr\"';\n\n author = DefaultLibraryAuthor;\n\n version = LIBRARY_VERSION;\n\n processors?: ICliCommandProcessor[] | undefined = [];\n\n metadata?: CliProcessorMetadata | undefined = {\n requiredCoreVersion: '>=2.0.0 <3.0.0',\n requiredCliVersion: '>=2.0.0 <3.0.0',\n };\n\n configurationOptions?: ICliConfigurationOption[] = [\n {\n key: 'defaultWidth',\n label: 'Default Width',\n description: 'Default QR code width in pixels',\n type: 'number',\n defaultValue: 300,\n validator: (v) => ({\n valid: typeof v === 'number' && v >= 50 && v <= 2000,\n message: 'Must be between 50 and 2000',\n }),\n },\n {\n key: 'defaultHeight',\n label: 'Default Height',\n description: 'Default QR code height in pixels',\n type: 'number',\n defaultValue: 300,\n validator: (v) => ({\n valid: typeof v === 'number' && v >= 50 && v <= 2000,\n message: 'Must be between 50 and 2000',\n }),\n },\n ];\n\n constructor() {\n this.processors = [\n {\n command: 'generate',\n description:\n 'Generate a QR code and download it as PNG. Usage: qr generate --text \"https://example.com\"',\n parameters: [\n {\n name: 'text',\n description: 'Text or URL to encode as a QR code',\n type: 'string',\n required: true,\n },\n {\n name: 'fileName',\n description: 'the file name',\n type: 'string',\n required: false,\n },\n ],\n processCommand: async (command, context) => {\n const text = command.args['text'];\n\n if (!text) {\n context.writer.writeError(\n 'Missing required parameter: --text',\n );\n return;\n }\n\n const fileName = command.args['fileName'] || 'qr-code';\n const width = command.args['width'] ?? getPluginConfigValue(context, 'qr', 'defaultWidth', 300);\n const height = command.args['height'] ?? getPluginConfigValue(context, 'qr', 'defaultHeight', 300);\n\n try {\n const qrCode = new QRCodeStyling({\n width,\n height,\n data: text,\n type: 'svg',\n });\n\n await qrCode.download({\n name: fileName,\n extension: 'png',\n });\n\n context.writer.writeSuccess(\n `QR Code for \"${text}\" downloaded as ${fileName}.png`,\n );\n } catch (err) {\n context.writer.writeError(\n `Failed to generate QR code: ${err}`,\n );\n }\n },\n },\n ];\n }\n\n async processCommand(\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ): Promise<void> {\n context.executor.showHelp(command, context);\n }\n\n writeDescription(context: ICliExecutionContext): void {\n const { writer } = context;\n writer.writeln(\n 'Generate QR codes from text or URLs and download as PNG',\n );\n writer.writeln();\n writer.writeln('📋 Usage:');\n writer.writeln(\n ` ${writer.wrapInColor('qr generate --text=\"<content>\"', CliForegroundColor.Cyan)}`,\n );\n writer.writeln();\n writer.writeln('⚙️ Options:');\n writer.writeln(\n ` ${writer.wrapInColor('--text', CliForegroundColor.Yellow)} Text or URL to encode (required)`,\n );\n writer.writeln(\n ` ${writer.wrapInColor('--fileName', CliForegroundColor.Yellow)} Output filename (default: qr-code)`,\n );\n writer.writeln();\n writer.writeln('📝 Examples:');\n writer.writeln(\n ` qr generate --text=\"https://example.com\" ${writer.wrapInColor('# URL QR code', CliForegroundColor.Green)}`,\n );\n writer.writeln(\n ` qr generate --text=\"Hello!\" --fileName=\"my-qr\" ${writer.wrapInColor('# Custom filename', CliForegroundColor.Green)}`,\n );\n }\n}\n","/*\n * Public API Surface of qr\n */\n\nexport * from './lib/processors/cli-qr-command-processor';\n\nexport * from './lib/version';\n\nimport { ICliModule } from '@qodalis/cli-core';\nimport { CliQrCommandProcessor } from './lib/processors/cli-qr-command-processor';\nimport { API_VERSION } from './lib/version';\n\nexport const qrModule: ICliModule = {\n apiVersion: API_VERSION,\n name: '@qodalis/cli-qr',\n processors: [new CliQrCommandProcessor()],\n translations: {\n es: { 'cli.qr.description': 'Generar códigos QR' },\n fr: { 'cli.qr.description': 'Générer des codes QR' },\n de: { 'cli.qr.description': 'QR-Codes generieren' },\n pt: { 'cli.qr.description': 'Gerar códigos QR' },\n it: { 'cli.qr.description': 'Generare codici QR' },\n ja: { 'cli.qr.description': 'QRコードを生成' },\n ko: { 'cli.qr.description': 'QR 코드 생성' },\n zh: { 'cli.qr.description': '生成二维码' },\n ru: { 'cli.qr.description': 'Генерация QR-кодов' },\n ro: { 'cli.qr.description': 'Generare coduri QR' },\n },\n};\n"]}
package/public-api.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { DefaultLibraryAuthor, CliForegroundColor } from '@qodalis/cli-core';
1
+ import { DefaultLibraryAuthor, getPluginConfigValue, CliForegroundColor } from '@qodalis/cli-core';
2
2
  import QRCodeStyling from 'qr-code-styling';
3
3
 
4
4
  // src/lib/processors/cli-qr-command-processor.ts
5
5
 
6
6
  // src/lib/version.ts
7
- var LIBRARY_VERSION = "2.0.0-beta.1";
7
+ var LIBRARY_VERSION = "2.0.0-beta.11";
8
8
  var API_VERSION = 2;
9
9
 
10
10
  // src/lib/processors/cli-qr-command-processor.ts
@@ -19,6 +19,30 @@ var CliQrCommandProcessor = class {
19
19
  requiredCoreVersion: ">=2.0.0 <3.0.0",
20
20
  requiredCliVersion: ">=2.0.0 <3.0.0"
21
21
  };
22
+ this.configurationOptions = [
23
+ {
24
+ key: "defaultWidth",
25
+ label: "Default Width",
26
+ description: "Default QR code width in pixels",
27
+ type: "number",
28
+ defaultValue: 300,
29
+ validator: (v) => ({
30
+ valid: typeof v === "number" && v >= 50 && v <= 2e3,
31
+ message: "Must be between 50 and 2000"
32
+ })
33
+ },
34
+ {
35
+ key: "defaultHeight",
36
+ label: "Default Height",
37
+ description: "Default QR code height in pixels",
38
+ type: "number",
39
+ defaultValue: 300,
40
+ validator: (v) => ({
41
+ valid: typeof v === "number" && v >= 50 && v <= 2e3,
42
+ message: "Must be between 50 and 2000"
43
+ })
44
+ }
45
+ ];
22
46
  this.processors = [
23
47
  {
24
48
  command: "generate",
@@ -46,10 +70,12 @@ var CliQrCommandProcessor = class {
46
70
  return;
47
71
  }
48
72
  const fileName = command.args["fileName"] || "qr-code";
73
+ const width = command.args["width"] ?? getPluginConfigValue(context, "qr", "defaultWidth", 300);
74
+ const height = command.args["height"] ?? getPluginConfigValue(context, "qr", "defaultHeight", 300);
49
75
  try {
50
76
  const qrCode = new QRCodeStyling({
51
- width: 300,
52
- height: 300,
77
+ width,
78
+ height,
53
79
  data: text,
54
80
  type: "svg"
55
81
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../packages/plugins/qr/src/lib/version.ts","../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,oBAAA,EAAsB,0FAAA,EAAqB;AAAA,IACjD,EAAA,EAAI,EAAE,oBAAA,EAAsB,oBAAA;AAAqB;AAEzD","file":"public-api.mjs","sourcesContent":["\n// Automatically generated during build\nexport const LIBRARY_VERSION = '2.0.0-beta.1';\nexport const API_VERSION = 2;\n ","import {\n CliForegroundColor,\n CliProcessCommand,\n CliProcessorMetadata,\n DefaultLibraryAuthor,\n ICliCommandProcessor,\n ICliExecutionContext,\n} from '@qodalis/cli-core';\nimport QRCodeStyling from 'qr-code-styling';\nimport { LIBRARY_VERSION } from '../version';\n\nexport class CliQrCommandProcessor implements ICliCommandProcessor {\n command = 'qr';\n\n description =\n 'Provide utility functions to generate QR codes. Usage: qr generate --text \"https://example.com\" --fileName \"my-qr\"';\n\n author = DefaultLibraryAuthor;\n\n version = LIBRARY_VERSION;\n\n processors?: ICliCommandProcessor[] | undefined = [];\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: 'generate',\n description:\n 'Generate a QR code and download it as PNG. Usage: qr generate --text \"https://example.com\"',\n parameters: [\n {\n name: 'text',\n description: 'Text or URL to encode as a QR code',\n type: 'string',\n required: true,\n },\n {\n name: 'fileName',\n description: 'the file name',\n type: 'string',\n required: false,\n },\n ],\n processCommand: async (command, context) => {\n const text = command.args['text'];\n\n if (!text) {\n context.writer.writeError(\n 'Missing required parameter: --text',\n );\n return;\n }\n\n const fileName = command.args['fileName'] || 'qr-code';\n\n try {\n const qrCode = new QRCodeStyling({\n width: 300,\n height: 300,\n data: text,\n type: 'svg',\n });\n\n await qrCode.download({\n name: fileName,\n extension: 'png',\n });\n\n context.writer.writeSuccess(\n `QR Code for \"${text}\" downloaded as ${fileName}.png`,\n );\n } catch (err) {\n context.writer.writeError(\n `Failed to generate QR code: ${err}`,\n );\n }\n },\n },\n ];\n }\n\n async processCommand(\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ): Promise<void> {\n context.executor.showHelp(command, context);\n }\n\n writeDescription(context: ICliExecutionContext): void {\n const { writer } = context;\n writer.writeln(\n 'Generate QR codes from text or URLs and download as PNG',\n );\n writer.writeln();\n writer.writeln('📋 Usage:');\n writer.writeln(\n ` ${writer.wrapInColor('qr generate --text=\"<content>\"', CliForegroundColor.Cyan)}`,\n );\n writer.writeln();\n writer.writeln('⚙️ Options:');\n writer.writeln(\n ` ${writer.wrapInColor('--text', CliForegroundColor.Yellow)} Text or URL to encode (required)`,\n );\n writer.writeln(\n ` ${writer.wrapInColor('--fileName', CliForegroundColor.Yellow)} Output filename (default: qr-code)`,\n );\n writer.writeln();\n writer.writeln('📝 Examples:');\n writer.writeln(\n ` qr generate --text=\"https://example.com\" ${writer.wrapInColor('# URL QR code', CliForegroundColor.Green)}`,\n );\n writer.writeln(\n ` qr generate --text=\"Hello!\" --fileName=\"my-qr\" ${writer.wrapInColor('# Custom filename', CliForegroundColor.Green)}`,\n );\n }\n}\n","/*\n * Public API Surface of qr\n */\n\nexport * from './lib/processors/cli-qr-command-processor';\n\nexport * from './lib/version';\n\nimport { ICliModule } from '@qodalis/cli-core';\nimport { CliQrCommandProcessor } from './lib/processors/cli-qr-command-processor';\nimport { API_VERSION } from './lib/version';\n\nexport const qrModule: ICliModule = {\n apiVersion: API_VERSION,\n name: '@qodalis/cli-qr',\n processors: [new CliQrCommandProcessor()],\n translations: {\n es: { 'cli.qr.description': 'Generar códigos QR' },\n fr: { 'cli.qr.description': 'Générer des codes QR' },\n de: { 'cli.qr.description': 'QR-Codes generieren' },\n pt: { 'cli.qr.description': 'Gerar códigos QR' },\n it: { 'cli.qr.description': 'Generare codici QR' },\n ja: { 'cli.qr.description': 'QRコードを生成' },\n ko: { 'cli.qr.description': 'QR 코드 생성' },\n zh: { 'cli.qr.description': '生成二维码' },\n ru: { 'cli.qr.description': 'Генерация QR-кодов' },\n ro: { 'cli.qr.description': 'Generare coduri QR' },\n },\n};\n"]}
1
+ {"version":3,"sources":["../../packages/plugins/qr/src/lib/version.ts","../../packages/plugins/qr/src/lib/processors/cli-qr-command-processor.ts","../../packages/plugins/qr/src/public-api.ts"],"names":[],"mappings":";;;;;;AAEO,IAAM,eAAA,GAAkB;AACxB,IAAM,WAAA,GAAc;;;ACUpB,IAAM,wBAAN,MAA4D;AAAA,EA0C/D,WAAA,GAAc;AAzCd,IAAA,IAAA,CAAA,OAAA,GAAU,IAAA;AAEV,IAAA,IAAA,CAAA,WAAA,GACI,oHAAA;AAEJ,IAAA,IAAA,CAAA,MAAA,GAAS,oBAAA;AAET,IAAA,IAAA,CAAA,OAAA,GAAU,eAAA;AAEV,IAAA,IAAA,CAAA,UAAA,GAAkD,EAAC;AAEnD,IAAA,IAAA,CAAA,QAAA,GAA8C;AAAA,MAC1C,mBAAA,EAAqB,gBAAA;AAAA,MACrB,kBAAA,EAAoB;AAAA,KACxB;AAEA,IAAA,IAAA,CAAA,oBAAA,GAAmD;AAAA,MAC/C;AAAA,QACI,GAAA,EAAK,cAAA;AAAA,QACL,KAAA,EAAO,eAAA;AAAA,QACP,WAAA,EAAa,iCAAA;AAAA,QACb,IAAA,EAAM,QAAA;AAAA,QACN,YAAA,EAAc,GAAA;AAAA,QACd,SAAA,EAAW,CAAC,CAAA,MAAO;AAAA,UACf,OAAO,OAAO,CAAA,KAAM,QAAA,IAAY,CAAA,IAAK,MAAM,CAAA,IAAK,GAAA;AAAA,UAChD,OAAA,EAAS;AAAA,SACb;AAAA,OACJ;AAAA,MACA;AAAA,QACI,GAAA,EAAK,eAAA;AAAA,QACL,KAAA,EAAO,gBAAA;AAAA,QACP,WAAA,EAAa,kCAAA;AAAA,QACb,IAAA,EAAM,QAAA;AAAA,QACN,YAAA,EAAc,GAAA;AAAA,QACd,SAAA,EAAW,CAAC,CAAA,MAAO;AAAA,UACf,OAAO,OAAO,CAAA,KAAM,QAAA,IAAY,CAAA,IAAK,MAAM,CAAA,IAAK,GAAA;AAAA,UA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IAAA,MAAA,CAAO,QAAQ,qBAAc,CAAA;AAC7B,IAAA,MAAA,CAAO,OAAA;AAAA,MACH,6DAA6D,MAAA,CAAO,WAAA,CAAY,eAAA,EAAiB,kBAAA,CAAmB,KAAK,CAAC,CAAA;AAAA,KAC9H;AACA,IAAA,MAAA,CAAO,OAAA;AAAA,MACH,6DAA6D,MAAA,CAAO,WAAA,CAAY,mBAAA,EAAqB,kBAAA,CAAmB,KAAK,CAAC,CAAA;AAAA,KAClI;AAAA,EACJ;AACJ;;;ACzIO,IAAM,QAAA,GAAuB;AAAA,EAChC,UAAA,EAAY,WAAA;AAAA,EACZ,IAAA,EAAM,iBAAA;AAAA,EACN,UAAA,EAAY,CAAC,IAAI,qBAAA,EAAuB,CAAA;AAAA,EACxC,YAAA,EAAc;AAAA,IACV,EAAA,EAAI,EAAE,oBAAA,EAAsB,uBAAA,EAAqB;AAAA,IACjD,EAAA,EAAI,EAAE,oBAAA,EAAsB,4BAAA,EAAuB;AAAA,IACnD,EAAA,EAAI,EAAE,oBAAA,EAAsB,qBAAA,EAAsB;AAAA,IAClD,EAAA,EAAI,EAAE,oBAAA,EAAsB,qBAAA,EAAmB;AAAA,IAC/C,EAAA,EAAI,EAAE,oBAAA,EAAsB,oBAAA,EAAqB;AAAA,IACjD,EAAA,EAAI,EAAE,oBAAA,EAAsB,wCAAA,EAAW;AAAA,IACvC,EAAA,EAAI,EAAE,oBAAA,EAAsB,8BAAA,EAAW;AAAA,IACvC,EAAA,EAAI,EAAE,oBAAA,EAAsB,gCAAA,EAAQ;AAAA,IACpC,EAAA,EAAI,EAAE,oBAAA,EAAsB,0FAAA,EAAqB;AAAA,IACjD,EAAA,EAAI,EAAE,oBAAA,EAAsB,oBAAA;AAAqB;AAEzD","file":"public-api.mjs","sourcesContent":["\n// Automatically generated during build\nexport const LIBRARY_VERSION = '2.0.0-beta.11';\nexport const API_VERSION = 2;\n ","import {\n CliForegroundColor,\n CliProcessCommand,\n CliProcessorMetadata,\n DefaultLibraryAuthor,\n ICliCommandProcessor,\n ICliConfigurationOption,\n ICliExecutionContext,\n getPluginConfigValue,\n} from '@qodalis/cli-core';\nimport QRCodeStyling from 'qr-code-styling';\nimport { LIBRARY_VERSION } from '../version';\n\nexport class CliQrCommandProcessor implements ICliCommandProcessor {\n command = 'qr';\n\n description =\n 'Provide utility functions to generate QR codes. Usage: qr generate --text \"https://example.com\" --fileName \"my-qr\"';\n\n author = DefaultLibraryAuthor;\n\n version = LIBRARY_VERSION;\n\n processors?: ICliCommandProcessor[] | undefined = [];\n\n metadata?: CliProcessorMetadata | undefined = {\n requiredCoreVersion: '>=2.0.0 <3.0.0',\n requiredCliVersion: '>=2.0.0 <3.0.0',\n };\n\n configurationOptions?: ICliConfigurationOption[] = [\n {\n key: 'defaultWidth',\n label: 'Default Width',\n description: 'Default QR code width in pixels',\n type: 'number',\n defaultValue: 300,\n validator: (v) => ({\n valid: typeof v === 'number' && v >= 50 && v <= 2000,\n message: 'Must be between 50 and 2000',\n }),\n },\n {\n key: 'defaultHeight',\n label: 'Default Height',\n description: 'Default QR code height in pixels',\n type: 'number',\n defaultValue: 300,\n validator: (v) => ({\n valid: typeof v === 'number' && v >= 50 && v <= 2000,\n message: 'Must be between 50 and 2000',\n }),\n },\n ];\n\n constructor() {\n this.processors = [\n {\n command: 'generate',\n description:\n 'Generate a QR code and download it as PNG. Usage: qr generate --text \"https://example.com\"',\n parameters: [\n {\n name: 'text',\n description: 'Text or URL to encode as a QR code',\n type: 'string',\n required: true,\n },\n {\n name: 'fileName',\n description: 'the file name',\n type: 'string',\n required: false,\n },\n ],\n processCommand: async (command, context) => {\n const text = command.args['text'];\n\n if (!text) {\n context.writer.writeError(\n 'Missing required parameter: --text',\n );\n return;\n }\n\n const fileName = command.args['fileName'] || 'qr-code';\n const width = command.args['width'] ?? getPluginConfigValue(context, 'qr', 'defaultWidth', 300);\n const height = command.args['height'] ?? getPluginConfigValue(context, 'qr', 'defaultHeight', 300);\n\n try {\n const qrCode = new QRCodeStyling({\n width,\n height,\n data: text,\n type: 'svg',\n });\n\n await qrCode.download({\n name: fileName,\n extension: 'png',\n });\n\n context.writer.writeSuccess(\n `QR Code for \"${text}\" downloaded as ${fileName}.png`,\n );\n } catch (err) {\n context.writer.writeError(\n `Failed to generate QR code: ${err}`,\n );\n }\n },\n },\n ];\n }\n\n async processCommand(\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ): Promise<void> {\n context.executor.showHelp(command, context);\n }\n\n writeDescription(context: ICliExecutionContext): void {\n const { writer } = context;\n writer.writeln(\n 'Generate QR codes from text or URLs and download as PNG',\n );\n writer.writeln();\n writer.writeln('📋 Usage:');\n writer.writeln(\n ` ${writer.wrapInColor('qr generate --text=\"<content>\"', CliForegroundColor.Cyan)}`,\n );\n writer.writeln();\n writer.writeln('⚙️ Options:');\n writer.writeln(\n ` ${writer.wrapInColor('--text', CliForegroundColor.Yellow)} Text or URL to encode (required)`,\n );\n writer.writeln(\n ` ${writer.wrapInColor('--fileName', CliForegroundColor.Yellow)} Output filename (default: qr-code)`,\n );\n writer.writeln();\n writer.writeln('📝 Examples:');\n writer.writeln(\n ` qr generate --text=\"https://example.com\" ${writer.wrapInColor('# URL QR code', CliForegroundColor.Green)}`,\n );\n writer.writeln(\n ` qr generate --text=\"Hello!\" --fileName=\"my-qr\" ${writer.wrapInColor('# Custom filename', CliForegroundColor.Green)}`,\n );\n }\n}\n","/*\n * Public API Surface of qr\n */\n\nexport * from './lib/processors/cli-qr-command-processor';\n\nexport * from './lib/version';\n\nimport { ICliModule } from '@qodalis/cli-core';\nimport { CliQrCommandProcessor } from './lib/processors/cli-qr-command-processor';\nimport { API_VERSION } from './lib/version';\n\nexport const qrModule: ICliModule = {\n apiVersion: API_VERSION,\n name: '@qodalis/cli-qr',\n processors: [new CliQrCommandProcessor()],\n translations: {\n es: { 'cli.qr.description': 'Generar códigos QR' },\n fr: { 'cli.qr.description': 'Générer des codes QR' },\n de: { 'cli.qr.description': 'QR-Codes generieren' },\n pt: { 'cli.qr.description': 'Gerar códigos QR' },\n it: { 'cli.qr.description': 'Generare codici QR' },\n ja: { 'cli.qr.description': 'QRコードを生成' },\n ko: { 'cli.qr.description': 'QR 코드 생성' },\n zh: { 'cli.qr.description': '生成二维码' },\n ru: { 'cli.qr.description': 'Генерация QR-кодов' },\n ro: { 'cli.qr.description': 'Generare coduri QR' },\n },\n};\n"]}
@@ -2982,10 +2982,37 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
2982
2982
  name: "Nicolae Lupei",
2983
2983
  email: "nicolae.lupei@qodalis.com"
2984
2984
  };
2985
+ var CLI_CONFIGURE_STORE_NAME = "configure";
2986
+ function getConfigValue(state, category, key, defaultValue) {
2987
+ try {
2988
+ const s = state.getState();
2989
+ const bucket = category === "system" ? s?.["system"] : s?.["plugins"]?.[category];
2990
+ if (bucket && key in bucket) {
2991
+ return bucket[key];
2992
+ }
2993
+ } catch {
2994
+ }
2995
+ return defaultValue;
2996
+ }
2997
+ function getPluginConfigValue(context, category, key, defaultValue) {
2998
+ try {
2999
+ const storeManager = context.services.get(
3000
+ "cli-state-store-manager"
3001
+ );
3002
+ if (!storeManager) return defaultValue;
3003
+ const store = storeManager.getStateStore(CLI_CONFIGURE_STORE_NAME);
3004
+ if (!store) return defaultValue;
3005
+ return getConfigValue(store, category, key, defaultValue);
3006
+ } catch {
3007
+ return defaultValue;
3008
+ }
3009
+ }
2985
3010
  var semver = __toESM2(require_semver2());
3011
+ var API_VERSION = 2;
3012
+ var VERSIONS_ENDPOINT = "/api/qcli/versions";
2986
3013
  var ServerVersionNegotiator = class {
2987
3014
  static {
2988
- this.CLIENT_SUPPORTED_VERSIONS = [2];
3015
+ this.CLIENT_SUPPORTED_VERSIONS = [API_VERSION];
2989
3016
  }
2990
3017
  /**
2991
3018
  * Given a server's version info, pick the highest mutually compatible version.
@@ -3004,14 +3031,14 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
3004
3031
  */
3005
3032
  static async discover(baseUrl) {
3006
3033
  try {
3007
- const response = await fetch(`${baseUrl}/api/cli/versions`);
3034
+ const response = await fetch(`${baseUrl}${VERSIONS_ENDPOINT}`);
3008
3035
  if (!response.ok) return null;
3009
3036
  const info = await response.json();
3010
3037
  const version = this.negotiate(info);
3011
3038
  if (version === null) return null;
3012
3039
  return {
3013
3040
  apiVersion: version,
3014
- basePath: `${baseUrl}/api/v${version}/cli`
3041
+ basePath: `${baseUrl}/api/v${version}/qcli`
3015
3042
  };
3016
3043
  } catch {
3017
3044
  return null;
@@ -3839,8 +3866,8 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
3839
3866
  var import_qr_code_styling = __toESM(require_qr_code_styling());
3840
3867
 
3841
3868
  // src/lib/version.ts
3842
- var LIBRARY_VERSION = "2.0.0-beta.1";
3843
- var API_VERSION = 2;
3869
+ var LIBRARY_VERSION = "2.0.0-beta.11";
3870
+ var API_VERSION2 = 2;
3844
3871
 
3845
3872
  // src/lib/processors/cli-qr-command-processor.ts
3846
3873
  var CliQrCommandProcessor = class {
@@ -3854,6 +3881,30 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
3854
3881
  requiredCoreVersion: ">=2.0.0 <3.0.0",
3855
3882
  requiredCliVersion: ">=2.0.0 <3.0.0"
3856
3883
  };
3884
+ this.configurationOptions = [
3885
+ {
3886
+ key: "defaultWidth",
3887
+ label: "Default Width",
3888
+ description: "Default QR code width in pixels",
3889
+ type: "number",
3890
+ defaultValue: 300,
3891
+ validator: (v) => ({
3892
+ valid: typeof v === "number" && v >= 50 && v <= 2e3,
3893
+ message: "Must be between 50 and 2000"
3894
+ })
3895
+ },
3896
+ {
3897
+ key: "defaultHeight",
3898
+ label: "Default Height",
3899
+ description: "Default QR code height in pixels",
3900
+ type: "number",
3901
+ defaultValue: 300,
3902
+ validator: (v) => ({
3903
+ valid: typeof v === "number" && v >= 50 && v <= 2e3,
3904
+ message: "Must be between 50 and 2000"
3905
+ })
3906
+ }
3907
+ ];
3857
3908
  this.processors = [
3858
3909
  {
3859
3910
  command: "generate",
@@ -3881,10 +3932,12 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
3881
3932
  return;
3882
3933
  }
3883
3934
  const fileName = command.args["fileName"] || "qr-code";
3935
+ const width = command.args["width"] ?? getPluginConfigValue(context, "qr", "defaultWidth", 300);
3936
+ const height = command.args["height"] ?? getPluginConfigValue(context, "qr", "defaultHeight", 300);
3884
3937
  try {
3885
3938
  const qrCode = new import_qr_code_styling.default({
3886
- width: 300,
3887
- height: 300,
3939
+ width,
3940
+ height,
3888
3941
  data: text,
3889
3942
  type: "svg"
3890
3943
  });
@@ -3938,7 +3991,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
3938
3991
 
3939
3992
  // src/cli-entrypoint.ts
3940
3993
  var module = {
3941
- apiVersion: API_VERSION,
3994
+ apiVersion: API_VERSION2,
3942
3995
  name: "@qodalis/cli-qr",
3943
3996
  processors: [new CliQrCommandProcessor()]
3944
3997
  };