@maschinenlesbar.org/ckan-cli 0.5.0 → 0.5.1
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/README.md +1 -1
- package/dist/node_modules/@maschinenlesbar.org/ckan-client/package.json +32 -0
- package/dist/src/cli/commands/catalogue.js +1 -1
- package/dist/src/cli/commands/portal.js +4 -4
- package/dist/src/cli/io.d.ts +2 -2
- package/dist/src/cli/log.js +1 -1
- package/dist/src/cli/program.js +4 -4
- package/dist/src/cli/run.js +1 -1
- package/dist/src/cli/shared.d.ts +1 -1
- package/dist/src/cli/shared.js +5 -5
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +2 -1
- package/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +1172 -0
- package/node_modules/commander/index.js +21 -0
- package/node_modules/commander/lib/argument.js +147 -0
- package/node_modules/commander/lib/command.js +2790 -0
- package/node_modules/commander/lib/error.js +36 -0
- package/node_modules/commander/lib/help.js +731 -0
- package/node_modules/commander/lib/option.js +377 -0
- package/node_modules/commander/lib/suggestSimilar.js +99 -0
- package/node_modules/commander/package-support.json +19 -0
- package/node_modules/commander/package.json +64 -0
- package/node_modules/commander/typings/index.d.ts +1113 -0
- package/package.json +11 -16
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/client.d.ts +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/client.js +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/engine.d.ts +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/engine.js +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/errors.d.ts +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/errors.js +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/http.d.ts +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/http.js +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/index.d.ts +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/index.js +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/portals-list.d.ts +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/portals-list.js +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/portals.d.ts +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/portals.js +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/query.d.ts +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/query.js +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/types.d.ts +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/types.js +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/validate.d.ts +0 -0
- /package/dist/{src/client → node_modules/@maschinenlesbar.org/ckan-client/dist/src}/validate.js +0 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://github.com/maschinenlesbar-org/ckan-cli/actions/workflows/release.yml)
|
|
5
5
|
[](https://www.npmjs.com/package/@maschinenlesbar.org/ckan-cli)
|
|
6
6
|
|
|
7
|
-
**Website:** [English](https://maschinenlesbar
|
|
7
|
+
**Website:** [English](https://maschinenlesbar.org/ckan-cli/) · [Deutsch](https://maschinenlesbar.org/ckan-cli/de/) — command reference, guides and API docs
|
|
8
8
|
|
|
9
9
|
Search any [CKAN](https://ckan.org/) open-data portal from your terminal. `ckan`
|
|
10
10
|
is a command-line tool over the CKAN Action API (`<portal>/api/3/action`), which
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maschinenlesbar.org/ckan-client",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "The typed API client of ckan-cli. Not published on its own: bundled into @maschinenlesbar.org/ckan-cli, whose library entry re-exports it.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/src/index.d.ts",
|
|
10
|
+
"import": "./dist/src/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./internal/*": {
|
|
13
|
+
"types": "./dist/src/*.d.ts",
|
|
14
|
+
"import": "./dist/src/*.js"
|
|
15
|
+
},
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/src"
|
|
20
|
+
],
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=22.12"
|
|
23
|
+
},
|
|
24
|
+
"license": "AGPL-3.0-or-later",
|
|
25
|
+
"author": "Sebastian Schürmann <sebs@2xs.org>",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/maschinenlesbar-org/ckan-cli.git",
|
|
29
|
+
"directory": "packages/client"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://maschinenlesbar.org/ckan-cli/"
|
|
32
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Commands over the catalogue: datasets, their resources, publishers, themes
|
|
2
2
|
// and tags.
|
|
3
3
|
import { InvalidArgumentError } from "commander";
|
|
4
|
-
import { facetLimitProblem } from "
|
|
4
|
+
import { facetLimitProblem } from "@maschinenlesbar.org/ckan-client/internal/validate";
|
|
5
5
|
import { action, collectNonEmpty, once, parseBoundedInt, parseIntArg, parseNonEmpty, parseOptionValue, renderJson, } from "../shared.js";
|
|
6
6
|
/**
|
|
7
7
|
* commander value-parser for a list --limit: 1 or more. CKAN reads `limit=0` as
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Commands about the portal itself rather than its datasets.
|
|
2
2
|
import { InvalidArgumentError } from "commander";
|
|
3
3
|
import { action, renderJson, toEngineOptions } from "../shared.js";
|
|
4
|
-
import { checkPortals } from "
|
|
5
|
-
import { PORTALS } from "
|
|
6
|
-
import { isBlank } from "
|
|
7
|
-
import { cutForMessage, redactUrl } from "
|
|
4
|
+
import { checkPortals } from "@maschinenlesbar.org/ckan-client/internal/portals";
|
|
5
|
+
import { PORTALS } from "@maschinenlesbar.org/ckan-client/internal/portals-list";
|
|
6
|
+
import { isBlank } from "@maschinenlesbar.org/ckan-client/internal/validate";
|
|
7
|
+
import { cutForMessage, redactUrl } from "@maschinenlesbar.org/ckan-client/internal/errors";
|
|
8
8
|
/**
|
|
9
9
|
* A typed value as a message quotes it: cut at MAX_MESSAGE_VALUE_LENGTH, after its
|
|
10
10
|
* credentials are redacted (a cut could otherwise leave part of a password without the
|
package/dist/src/cli/io.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CkanClient } from "
|
|
2
|
-
import type { EngineOptions } from "
|
|
1
|
+
import type { CkanClient } from "@maschinenlesbar.org/ckan-client/internal/client";
|
|
2
|
+
import type { EngineOptions } from "@maschinenlesbar.org/ckan-client/internal/engine";
|
|
3
3
|
import { type Logger } from "./log.js";
|
|
4
4
|
export interface CliIO {
|
|
5
5
|
out(text: string): void;
|
package/dist/src/cli/log.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// ISO 8601. The topic is a dotted logger name: the program, then the area the record
|
|
10
10
|
// comes from (`ckan.cli`, `ckan.api`, `ckan.http`). stdout carries data
|
|
11
11
|
// only and is not touched; neither is `--help`/`--version`.
|
|
12
|
-
import { cutText, toWellFormed } from "
|
|
12
|
+
import { cutText, toWellFormed } from "@maschinenlesbar.org/ckan-client/internal/errors";
|
|
13
13
|
/** The log formats `--log-format` takes. */
|
|
14
14
|
export const LOG_FORMATS = ["text", "jsonl"];
|
|
15
15
|
/** The format without `--log-format`. */
|
package/dist/src/cli/program.js
CHANGED
|
@@ -5,10 +5,10 @@ import { readFileSync } from "node:fs";
|
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { Command, InvalidArgumentError, Option } from "commander";
|
|
7
7
|
import { defaultIO } from "./io.js";
|
|
8
|
-
import { CkanClient } from "
|
|
9
|
-
import { DEFAULT_BASE_URL, MAX_RETRIES, MAX_RETRY_AFTER_MS } from "
|
|
10
|
-
import { MAX_TIMEOUT_MS } from "
|
|
11
|
-
import { cutForMessage, redactUrl } from "
|
|
8
|
+
import { CkanClient } from "@maschinenlesbar.org/ckan-client/internal/client";
|
|
9
|
+
import { DEFAULT_BASE_URL, MAX_RETRIES, MAX_RETRY_AFTER_MS } from "@maschinenlesbar.org/ckan-client/internal/engine";
|
|
10
|
+
import { MAX_TIMEOUT_MS } from "@maschinenlesbar.org/ckan-client/internal/http";
|
|
11
|
+
import { cutForMessage, redactUrl } from "@maschinenlesbar.org/ckan-client/internal/errors";
|
|
12
12
|
import { once, parseBaseUrl, parseBoundedInt, parseHeaderValue, parseIntArg, parsePortal } from "./shared.js";
|
|
13
13
|
import { registerCatalogueCommands } from "./commands/catalogue.js";
|
|
14
14
|
import { registerPortalCommands } from "./commands/portal.js";
|
package/dist/src/cli/run.js
CHANGED
|
@@ -5,7 +5,7 @@ import { CommanderError } from "commander";
|
|
|
5
5
|
import { buildProgram, defaultDeps } from "./program.js";
|
|
6
6
|
import { logOf } from "./io.js";
|
|
7
7
|
import { createLogger, logFormatFromArgv } from "./log.js";
|
|
8
|
-
import { CkanActionError, CkanApiError, CkanError, CkanNetworkError, CkanParseError, CkanValidationError, credentialsIn, echoedCredentialForms, redactCredentials, redactSecrets, } from "
|
|
8
|
+
import { CkanActionError, CkanApiError, CkanError, CkanNetworkError, CkanParseError, CkanValidationError, credentialsIn, echoedCredentialForms, redactCredentials, redactSecrets, } from "@maschinenlesbar.org/ckan-client/internal/errors";
|
|
9
9
|
/** The exit code of a usage error: commander's own for a rejected option value. */
|
|
10
10
|
const USAGE_EXIT = 1;
|
|
11
11
|
/**
|
package/dist/src/cli/shared.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CliDeps } from "./io.js";
|
|
2
|
-
import { type EngineOptions, type RetryEvent } from "
|
|
2
|
+
import { type EngineOptions, type RetryEvent } from "@maschinenlesbar.org/ckan-client/internal/engine";
|
|
3
3
|
/** commander value-parser: a non-negative integer. */
|
|
4
4
|
export declare function parseIntArg(value: string): number;
|
|
5
5
|
/**
|
package/dist/src/cli/shared.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// option resolver, and the JSON result renderer.
|
|
3
3
|
import { InvalidArgumentError } from "commander";
|
|
4
4
|
import { logOf } from "./io.js";
|
|
5
|
-
import { cleartextProblem, DEFAULT_BASE_URL, isBidiControl } from "
|
|
6
|
-
import { CkanError, cutForMessage, redactUrl } from "
|
|
7
|
-
import { findPortal } from "
|
|
8
|
-
import { baseUrlProblem, blankProblem, countProblem, headerValueProblem, intRangeProblem } from "
|
|
9
|
-
import { PORTALS } from "
|
|
5
|
+
import { cleartextProblem, DEFAULT_BASE_URL, isBidiControl } from "@maschinenlesbar.org/ckan-client/internal/engine";
|
|
6
|
+
import { CkanError, cutForMessage, redactUrl } from "@maschinenlesbar.org/ckan-client/internal/errors";
|
|
7
|
+
import { findPortal } from "@maschinenlesbar.org/ckan-client/internal/portals";
|
|
8
|
+
import { baseUrlProblem, blankProblem, countProblem, headerValueProblem, intRangeProblem } from "@maschinenlesbar.org/ckan-client/internal/validate";
|
|
9
|
+
import { PORTALS } from "@maschinenlesbar.org/ckan-client/internal/portals-list";
|
|
10
10
|
/** commander value-parser: a non-negative integer. */
|
|
11
11
|
export function parseIntArg(value) {
|
|
12
12
|
// Validate the literal shape rather than trusting Number(): that rejects
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "
|
|
1
|
+
export * from "@maschinenlesbar.org/ckan-client";
|
package/dist/src/index.js
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|