@maschinenlesbar.org/ckan-cli 0.7.0 → 0.9.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.
Files changed (40) hide show
  1. package/README.md +56 -0
  2. package/dist/node_modules/@maschinenlesbar.org/ckan-client/dist/src/client.d.ts +25 -1
  3. package/dist/node_modules/@maschinenlesbar.org/ckan-client/dist/src/client.js +64 -23
  4. package/dist/node_modules/@maschinenlesbar.org/ckan-client/dist/src/engine.d.ts +26 -4
  5. package/dist/node_modules/@maschinenlesbar.org/ckan-client/dist/src/engine.js +152 -45
  6. package/dist/node_modules/@maschinenlesbar.org/ckan-client/dist/src/errors.d.ts +52 -6
  7. package/dist/node_modules/@maschinenlesbar.org/ckan-client/dist/src/errors.js +155 -17
  8. package/dist/node_modules/@maschinenlesbar.org/ckan-client/dist/src/http.d.ts +2 -1
  9. package/dist/node_modules/@maschinenlesbar.org/ckan-client/dist/src/http.js +33 -6
  10. package/dist/node_modules/@maschinenlesbar.org/ckan-client/dist/src/index.d.ts +2 -1
  11. package/dist/node_modules/@maschinenlesbar.org/ckan-client/dist/src/index.js +2 -1
  12. package/dist/node_modules/@maschinenlesbar.org/ckan-client/dist/src/operations.d.ts +441 -0
  13. package/dist/node_modules/@maschinenlesbar.org/ckan-client/dist/src/operations.js +1211 -0
  14. package/dist/node_modules/@maschinenlesbar.org/ckan-client/dist/src/portals.d.ts +2 -0
  15. package/dist/node_modules/@maschinenlesbar.org/ckan-client/dist/src/portals.js +2 -2
  16. package/dist/node_modules/@maschinenlesbar.org/ckan-client/dist/src/validate.d.ts +8 -4
  17. package/dist/node_modules/@maschinenlesbar.org/ckan-client/dist/src/validate.js +21 -4
  18. package/dist/node_modules/@maschinenlesbar.org/ckan-log/dist/src/index.d.ts +1 -0
  19. package/dist/node_modules/@maschinenlesbar.org/ckan-log/dist/src/index.js +1 -0
  20. package/dist/node_modules/@maschinenlesbar.org/ckan-log/dist/src/log.d.ts +80 -0
  21. package/dist/node_modules/@maschinenlesbar.org/ckan-log/dist/src/log.js +124 -0
  22. package/dist/node_modules/@maschinenlesbar.org/ckan-log/package.json +25 -0
  23. package/dist/src/cli/index.js +3 -1
  24. package/dist/src/cli/io.d.ts +17 -0
  25. package/dist/src/cli/io.js +14 -0
  26. package/dist/src/cli/limits.d.ts +19 -0
  27. package/dist/src/cli/limits.js +53 -0
  28. package/dist/src/cli/program.js +3 -0
  29. package/dist/src/cli/run.d.ts +0 -7
  30. package/dist/src/cli/run.js +17 -16
  31. package/dist/src/cli/shared.d.ts +4 -0
  32. package/dist/src/cli/shared.js +16 -1
  33. package/node_modules/commander/Readme.md +6 -32
  34. package/node_modules/commander/index.js +1 -1
  35. package/node_modules/commander/lib/command.js +22 -9
  36. package/node_modules/commander/lib/help.js +6 -2
  37. package/node_modules/commander/lib/option.js +1 -1
  38. package/node_modules/commander/package.json +2 -1
  39. package/node_modules/commander/typings/index.d.ts +6 -3
  40. package/package.json +2 -2
@@ -44,7 +44,6 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md)
44
44
  - [Bits and pieces](#bits-and-pieces)
45
45
  - [.parse() and .parseAsync()](#parse-and-parseasync)
46
46
  - [Parsing Configuration](#parsing-configuration)
47
- - [Legacy options as properties](#legacy-options-as-properties)
48
47
  - [TypeScript](#typescript)
49
48
  - [createCommand()](#createcommand)
50
49
  - [Node options such as `--harmony`](#node-options-such-as---harmony)
@@ -54,7 +53,6 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md)
54
53
  - [Override exit and output handling](#override-exit-and-output-handling)
55
54
  - [Additional documentation](#additional-documentation)
56
55
  - [Support](#support)
57
- - [Commander for enterprise](#commander-for-enterprise)
58
56
 
59
57
  For information about terms used in this document see: [terminology](./docs/terminology.md)
60
58
 
@@ -367,7 +365,8 @@ Example file: [options-variadic.js](./examples/options-variadic.js)
367
365
  ```js
368
366
  program
369
367
  .option('-n, --number <numbers...>', 'specify numbers')
370
- .option('-l, --letter [letters...]', 'specify letters');
368
+ .option('-l, --letter [letters...]', 'specify letters')
369
+ .argument('[operand]');
371
370
 
372
371
  program.parse();
373
372
 
@@ -380,10 +379,10 @@ $ collect -n 1 2 3 --letter a b c
380
379
  Options: { number: [ '1', '2', '3' ], letter: [ 'a', 'b', 'c' ] }
381
380
  Remaining arguments: []
382
381
  $ collect --letter=A -n80 operand
383
- Options: { number: [ '80' ], letter: [ 'A' ] }
382
+ Options: { letter: [ 'A' ], number: [ '80' ] }
384
383
  Remaining arguments: [ 'operand' ]
385
384
  $ collect --letter -n 1 -n 2 3 -- operand
386
- Options: { number: [ '1', '2', '3' ], letter: true }
385
+ Options: { letter: true, number: [ '1', '2', '3' ] }
387
386
  Remaining arguments: [ 'operand' ]
388
387
  ```
389
388
 
@@ -670,7 +669,7 @@ Example file: [action-this.js](./examples/action-this.js)
670
669
  program
671
670
  .command('serve')
672
671
  .argument('<script>')
673
- .option('-p, --port <number>', 'port number', 80)
672
+ .option('-p, --port <number>', 'port number', '80')
674
673
  .action(function() {
675
674
  console.error('Run script %s on port %s', this.args[0], this.opts().port);
676
675
  });
@@ -1016,25 +1015,6 @@ By default, the option processing shows an error for an unknown option. To have
1016
1015
  By default, the argument processing displays an error for more command-arguments than expected.
1017
1016
  To suppress the error for excess arguments, use `.allowExcessArguments()`.
1018
1017
 
1019
- ### Legacy options as properties
1020
-
1021
- Before Commander 7, the option values were stored as properties on the command.
1022
- This was convenient to code, but the downside was possible clashes with
1023
- existing properties of `Command`.
1024
-
1025
- You can revert to the old behaviour to run unmodified legacy code by using `.storeOptionsAsProperties()`.
1026
-
1027
- ```js
1028
- program
1029
- .storeOptionsAsProperties()
1030
- .option('-d, --debug')
1031
- .action((commandAndOptions) => {
1032
- if (commandAndOptions.debug) {
1033
- console.error(`Called ${commandAndOptions.name()}`);
1034
- }
1035
- });
1036
- ```
1037
-
1038
1018
  ### TypeScript
1039
1019
 
1040
1020
  **extra-typings:** There is an optional project to infer extra type information from the option and argument definitions.
@@ -1075,7 +1055,7 @@ You can enable `--harmony` option in two ways:
1075
1055
 
1076
1056
  An executable subcommand is launched as a separate child process.
1077
1057
 
1078
- If you are using the node inspector for [debugging](https://nodejs.org/en/docs/guides/debugging-getting-started/) executable subcommands using `node --inspect` et al.,
1058
+ If you are using the node inspector for [debugging](https://nodejs.org/en/learn/getting-started/debugging) executable subcommands using `node --inspect` et al.,
1079
1059
  the inspector port is incremented by 1 for the spawned subcommand.
1080
1060
 
1081
1061
  If you are using VSCode to debug executable subcommands you need to set the `"autoAttachChildProcesses": true` flag in your `launch.json` configuration.
@@ -1164,9 +1144,3 @@ The current version of Commander is fully supported on Long Term Support version
1164
1144
  Older major versions of Commander receive security updates for 12 months. For more see: [Release Policy](./docs/release-policy.md).
1165
1145
 
1166
1146
  The main forum for free and community support is the project [Issues](https://github.com/tj/commander.js/issues) on GitHub.
1167
-
1168
- ### Commander for enterprise
1169
-
1170
- Available as part of the Tidelift Subscription
1171
-
1172
- The maintainers of Commander and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-commander?utm_source=npm-commander&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
@@ -18,4 +18,4 @@ export const createArgument = (name, description) =>
18
18
 
19
19
  export { Command, Option, Argument, Help };
20
20
  export { CommanderError, InvalidArgumentError };
21
- export { InvalidArgumentError as InvalidOptionArgumentError }; // Deprecated
21
+ export { InvalidArgumentError as InvalidOptionArgumentError };
@@ -975,7 +975,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
975
975
  // global overwrites local, like optsWithGlobals
976
976
  let source;
977
977
  this._getCommandAndAncestors().forEach((cmd) => {
978
- if (cmd.getOptionValueSource(key) !== undefined) {
978
+ if (Object.hasOwn(cmd._optionValueSources, key)) {
979
979
  source = cmd.getOptionValueSource(key);
980
980
  }
981
981
  });
@@ -1768,7 +1768,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1768
1768
 
1769
1769
  const negativeNumberArg = (arg) => {
1770
1770
  // return false if not a negative number
1771
- if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg)) return false;
1771
+ if (!/^-(\d+|\d*\.\d+)([eE][+-]?\d+)?$/.test(arg)) return false;
1772
1772
  // negative number is ok unless digit used as an option in command hierarchy
1773
1773
  return !this._getCommandAndAncestors().some((cmd) =>
1774
1774
  cmd.options
@@ -2366,7 +2366,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2366
2366
  * (This does not override a group set directly on the subcommand using .helpGroup().)
2367
2367
  *
2368
2368
  * @example
2369
- * program.commandsGroup('Development Commands:);
2369
+ * program.commandsGroup('Development Commands:');
2370
2370
  * program.command('watch')...
2371
2371
  * program.command('lint')...
2372
2372
  * ...
@@ -2562,7 +2562,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2562
2562
  * Pass in false to disable the built-in help option.
2563
2563
  *
2564
2564
  * @example
2565
- * program.helpOption('-?, --help' 'show help'); // customise
2565
+ * program.helpOption('-?, --help', 'show help'); // customise
2566
2566
  * program.helpOption(false); // disable
2567
2567
  *
2568
2568
  * @param {(string | boolean)} flags
@@ -2720,7 +2720,12 @@ function incrementNodeInspectorPort(args) {
2720
2720
  // Testing for these options:
2721
2721
  // --inspect[=[host:]port]
2722
2722
  // --inspect-brk[=[host:]port]
2723
+ // --inspect-wait[=[host:]port]
2723
2724
  // --inspect-port=[host:]port
2725
+ //
2726
+ // Host can be an IP literal encapsulated within square brackets (e.g. [::1]),
2727
+ // an IPv4 address in dotted-decimal form (e.g. 192.168.0.1), or a registered name.
2728
+ // https://www.rfc-editor.org/rfc/rfc3986.html#section-3.2.2
2724
2729
  return args.map((arg) => {
2725
2730
  if (!arg.startsWith('--inspect')) {
2726
2731
  return arg;
@@ -2729,24 +2734,32 @@ function incrementNodeInspectorPort(args) {
2729
2734
  let debugHost = '127.0.0.1';
2730
2735
  let debugPort = '9229';
2731
2736
  let match;
2732
- if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
2737
+ if ((match = arg.match(/^(--inspect(-brk|-wait)?)$/)) !== null) {
2733
2738
  // e.g. --inspect
2734
2739
  debugOption = match[1];
2735
2740
  } else if (
2736
- (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null
2741
+ (match = arg.match(
2742
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+)$/,
2743
+ )) !== null
2737
2744
  ) {
2745
+ // Matches a host or a port, but not both. No colon to separate them.
2738
2746
  debugOption = match[1];
2739
2747
  if (/^\d+$/.test(match[3])) {
2748
+ // Plain digits so a port number.
2740
2749
  // e.g. --inspect=1234
2741
2750
  debugPort = match[3];
2742
2751
  } else {
2743
- // e.g. --inspect=localhost
2752
+ // Assume a host.
2753
+ // e.g. --inspect=localhost, --inspect=[::1], --inspect=192.168.0.1
2744
2754
  debugHost = match[3];
2745
2755
  }
2746
2756
  } else if (
2747
- (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null
2757
+ (match = arg.match(
2758
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+):(\d+)$/,
2759
+ )) !== null
2748
2760
  ) {
2749
- // e.g. --inspect=localhost:1234
2761
+ // Matched host:port pattern.
2762
+ // e.g. --inspect=localhost:1234, --inspect=[::1]:1234, --inspect=192.168.0.1:1234
2750
2763
  debugOption = match[1];
2751
2764
  debugHost = match[3];
2752
2765
  debugPort = match[4];
@@ -89,11 +89,15 @@ export class Help {
89
89
  visibleOptions.push(helpOption); // no changes needed
90
90
  } else if (helpOption.long && !removeLong) {
91
91
  visibleOptions.push(
92
- cmd.createOption(helpOption.long, helpOption.description),
92
+ cmd
93
+ .createOption(helpOption.long, helpOption.description)
94
+ .helpGroup(helpOption.helpGroupHeading),
93
95
  );
94
96
  } else if (helpOption.short && !removeShort) {
95
97
  visibleOptions.push(
96
- cmd.createOption(helpOption.short, helpOption.description),
98
+ cmd
99
+ .createOption(helpOption.short, helpOption.description)
100
+ .helpGroup(helpOption.helpGroupHeading),
97
101
  );
98
102
  }
99
103
  }
@@ -15,7 +15,7 @@ export class Option {
15
15
  this.required = flags.includes('<'); // A value must be supplied when the option is specified.
16
16
  this.optional = flags.includes('['); // A value is optional when the option is specified.
17
17
  // variadic test ignores <value,...> et al which might be used to describe custom splitting of single argument
18
- this.variadic = /\w\.\.\.[>\]]$/.test(flags); // The option can take multiple values.
18
+ this.variadic = /\p{ID_Continue}\.\.\.[>\]]$/u.test(flags); // The option can take multiple values.
19
19
  this.mandatory = false; // The option must have a value after parsing, which usually means it must be specified on command line.
20
20
  const optionFlags = splitOptionFlags(flags);
21
21
  this.short = optionFlags.shortFlag; // May be a short flag, undefined, or even a long flag (if option has two long flags).
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commander",
3
- "version": "15.0.0",
3
+ "version": "15.1.0",
4
4
  "description": "the complete solution for node.js command-line programs",
5
5
  "keywords": [
6
6
  "commander",
@@ -50,6 +50,7 @@
50
50
  "@types/node": "^22.7.4",
51
51
  "eslint": "^10.0.2",
52
52
  "eslint-config-prettier": "^10.0.1",
53
+ "eslint-node-test": "^1.0.0",
53
54
  "globals": "^17.3.0",
54
55
  "prettier": "^3.2.5",
55
56
  "tsd": "^0.33.0",
@@ -10,8 +10,7 @@
10
10
  // - https://github.com/sindresorhus/type-fest/blob/main/source/literal-union.d.ts
11
11
  // - https://github.com/sindresorhus/type-fest/blob/main/source/primitive.d.ts
12
12
  type LiteralUnion<LiteralType, BaseType extends string | number> =
13
- | LiteralType
14
- | (BaseType & Record<never, never>);
13
+ LiteralType | (BaseType & Record<never, never>);
15
14
 
16
15
  export class CommanderError extends Error {
17
16
  code: string;
@@ -35,7 +34,7 @@ export class InvalidArgumentError extends CommanderError {
35
34
  */
36
35
  constructor(message: string);
37
36
  }
38
- export { InvalidArgumentError as InvalidOptionArgumentError }; // deprecated old name
37
+ export { InvalidArgumentError as InvalidOptionArgumentError };
39
38
 
40
39
  export interface ErrorOptions {
41
40
  // optional parameter for error()
@@ -711,10 +710,13 @@ export class Command {
711
710
  *
712
711
  * @returns `this` command for chaining
713
712
  */
713
+ /** @deprecated since v15 */
714
714
  storeOptionsAsProperties<T extends OptionValues>(): this & T;
715
+ /** @deprecated since v15 */
715
716
  storeOptionsAsProperties<T extends OptionValues>(
716
717
  storeAsProperties: true,
717
718
  ): this & T;
719
+ /** @deprecated since v15 */
718
720
  storeOptionsAsProperties(storeAsProperties?: boolean): this;
719
721
 
720
722
  /**
@@ -758,6 +760,7 @@ export class Command {
758
760
  *
759
761
  * @returns `this` command for chaining
760
762
  */
763
+ /** @deprecated since v15 */
761
764
  combineFlagAndOptionalValue(combine?: boolean): this;
762
765
 
763
766
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maschinenlesbar.org/ckan-cli",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "TypeScript API client and CLI for any CKAN open-data portal (Action API v3), e.g. the Hamburg Transparenzportal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -60,7 +60,7 @@
60
60
  "access": "public"
61
61
  },
62
62
  "dependencies": {
63
- "commander": "15.0.0"
63
+ "commander": "15.1.0"
64
64
  },
65
65
  "bundleDependencies": [
66
66
  "commander"