@emuanalytics/flow-cli 1.3.125 → 1.3.127
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.
|
@@ -21,22 +21,33 @@ const builder = (args) => {
|
|
|
21
21
|
.option('limit', { alias: 'n', type: 'number', describe: 'Limit to n results' })
|
|
22
22
|
.option('offset', { alias: ['o'], type: 'number', describe: 'Start list at offset n' })
|
|
23
23
|
.option('sort', { alias: ['s'], type: 'string', describe: 'Sort by attribute' })
|
|
24
|
+
.option('tags', { alias: 't', type: 'array', describe: 'Filter by specified tags' })
|
|
24
25
|
.conflicts('id', ['limit', 'offset', 'sort'])
|
|
25
26
|
.positional('id', { describe: 'Dataset id (or unique prefix)', type: 'string' });
|
|
26
27
|
};
|
|
27
28
|
exports.builder = builder;
|
|
28
|
-
function handler({ client, id, format, offset, limit, sort }) {
|
|
29
|
+
function handler({ client, id, format, offset, limit, sort, tags }) {
|
|
29
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
31
|
try {
|
|
31
32
|
let results;
|
|
32
33
|
if (id) {
|
|
33
34
|
const resource = yield (0, utils_1.resolveResource)(id, client.datasets);
|
|
34
|
-
(
|
|
35
|
+
if (format === 'table') {
|
|
36
|
+
// Add tags to the output
|
|
37
|
+
(0, utils_1.logObject)(promoteTags(resource), 'table');
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
(0, utils_1.logObject)(resource, format || 'json');
|
|
41
|
+
}
|
|
35
42
|
}
|
|
36
43
|
else {
|
|
37
44
|
results = yield client.datasets.list({ offset, limit, sort });
|
|
45
|
+
if (tags) {
|
|
46
|
+
results = results.filter((dataset) => dataset.metadata.tags && tags.every((tag) => dataset.metadata.tags.includes(tag)));
|
|
47
|
+
}
|
|
38
48
|
if (format === 'table') {
|
|
39
|
-
|
|
49
|
+
// Add tags to the output
|
|
50
|
+
(0, utils_1.logObject)(results.map(promoteTags), 'table', ['id', 'name', 'description', 'type', 'tags']);
|
|
40
51
|
}
|
|
41
52
|
else {
|
|
42
53
|
(0, utils_1.logObject)(results, format || 'json');
|
|
@@ -49,4 +60,15 @@ function handler({ client, id, format, offset, limit, sort }) {
|
|
|
49
60
|
});
|
|
50
61
|
}
|
|
51
62
|
exports.handler = handler;
|
|
63
|
+
/**
|
|
64
|
+
* Augment a dataset with a `tags` property.
|
|
65
|
+
*
|
|
66
|
+
* A top-level `tags` property containing a comma-separated string of tags is added to facilitate output.
|
|
67
|
+
*
|
|
68
|
+
* @param dataset
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
function promoteTags(dataset) {
|
|
72
|
+
return Object.assign(Object.assign({}, dataset), { tags: dataset.metadata.tags ? dataset.metadata.tags.join(',') : '' });
|
|
73
|
+
}
|
|
52
74
|
//# sourceMappingURL=list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/datasets/list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/datasets/list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAIH,uCAAmE;AAEtD,QAAA,OAAO,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEpC,QAAA,IAAI,GAAG,eAAe,CAAC;AAE7B,MAAM,OAAO,GAAG,CAAC,IAAgB,EAAE,EAAE;IAC1C,OAAO,IAAI;SACR,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,oBAAoB,EAAE,CAAC;SAC/E,MAAM,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,wBAAwB,EAAE,CAAC;SACtF,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,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AAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAC5F,CAAC;iBACH;gBACD,IAAI,MAAM,KAAK,OAAO,EAAE;oBACtB,yBAAyB;oBACzB,IAAA,iBAAS,EAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;iBAC7F;qBAAM;oBACL,IAAA,iBAAS,EAAC,OAAO,EAAE,MAAM,IAAI,MAAM,CAAC,CAAC;iBACtC;aACF;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;SACb;IACH,CAAC;CAAA;AA9BD,0BA8BC;AAED;;;;;;;GAOG;AACH,SAAS,WAAW,CAAC,OAAiB;IACpC,uCAAY,OAAO,KAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAG;AAC5F,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright © 2024 Emu Analytics
|
|
4
|
+
*/
|
|
5
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
16
|
+
const utils_1 = require("../../utils");
|
|
17
|
+
exports.command = ['tags <id>'];
|
|
18
|
+
exports.desc = 'Add or remove tags on a dataset.';
|
|
19
|
+
const builder = (args) => {
|
|
20
|
+
return args
|
|
21
|
+
.positional('id', { describe: 'Dataset id (or unique prefix)', type: 'string' })
|
|
22
|
+
.option('add', {
|
|
23
|
+
alias: 'a',
|
|
24
|
+
type: 'array',
|
|
25
|
+
describe: 'One or more tags to add.'
|
|
26
|
+
})
|
|
27
|
+
.option('remove', {
|
|
28
|
+
alias: 'r',
|
|
29
|
+
type: 'array',
|
|
30
|
+
describe: 'One or more tags to remove.'
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
exports.builder = builder;
|
|
34
|
+
function handler({ client, id, add, remove, format }) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
try {
|
|
37
|
+
const resource = yield (0, utils_1.resolveResource)(id, client.datasets);
|
|
38
|
+
const existingTags = resource.metadata.tags;
|
|
39
|
+
const updatedTagSet = new Set(existingTags);
|
|
40
|
+
if (add) {
|
|
41
|
+
add.forEach(tag => updatedTagSet.add(tag));
|
|
42
|
+
}
|
|
43
|
+
if (remove) {
|
|
44
|
+
remove.forEach(tag => updatedTagSet.delete(tag));
|
|
45
|
+
}
|
|
46
|
+
const updatedTags = Array.from(updatedTagSet);
|
|
47
|
+
const updatedMetadata = yield client.datasets.setMetadata(resource.id, 'tags', updatedTags);
|
|
48
|
+
(0, utils_1.logObject)(format === 'csv' ? updatedMetadata.tags.map((t) => ({ tag: t })) : updatedMetadata.tags, format || 'table');
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
(0, utils_1.logError)(e);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
exports.handler = handler;
|
|
56
|
+
//# sourceMappingURL=tags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../../src/commands/datasets/tags.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAIH,uCAAmE;AAEtD,QAAA,OAAO,GAAG,CAAC,WAAW,CAAC,CAAC;AAExB,QAAA,IAAI,GAAG,kCAAkC,CAAC;AAEhD,MAAM,OAAO,GAAG,CAAC,IAAgB,EAAE,EAAE;IAC1C,OAAO,IAAI;SACR,UAAU,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,+BAA+B,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;SAC/E,MAAM,CAAC,KAAK,EAAE;QACb,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,0BAA0B;KACrC,CAAC;SACD,MAAM,CAAC,QAAQ,EAAE;QAChB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,6BAA6B;KACxC,CAAC,CAAC;AACP,CAAC,CAAC;AAbW,QAAA,OAAO,WAalB;AAUF,SAAsB,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAU;;QACvE,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,IAAA,uBAAe,EAAC,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5D,MAAM,YAAY,GAAa,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;YACtD,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;YAE5C,IAAI,GAAG,EAAE;gBACP,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;aAC5C;YACD,IAAI,MAAM,EAAE;gBACV,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;aAClD;YACD,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAE9C,MAAM,eAAe,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;YAC5F,IAAA,iBAAS,EACP,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,EAC/F,MAAM,IAAI,OAAO,CAClB,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;SACb;IACH,CAAC;CAAA;AAtBD,0BAsBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emuanalytics/flow-cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.127",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"author": "Robin Summerhill <robin.summerhill@emu-analytics.net",
|
|
6
6
|
"license": "Copyright 2018 Emu Analytics Limited",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"typescript": "^4.7.4"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@emuanalytics/flow-engine-client": "^1.3.
|
|
45
|
+
"@emuanalytics/flow-engine-client": "^1.3.127",
|
|
46
46
|
"@types/uuid": "^8.3.4",
|
|
47
47
|
"JSONStream": "^1.3.5",
|
|
48
48
|
"chalk": "^2.0.1",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"git add"
|
|
81
81
|
]
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "337b9cebf9afaeb55829b626b6fdbf0f16adb2e3"
|
|
84
84
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# Release notes
|
|
2
|
-
All notable changes to this project will be documented in this file.
|
|
3
|
-
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4
|
-
|
|
5
|
-
## 0.4.2
|
|
6
|
-
|
|
7
|
-
### Features
|
|
8
|
-
|
|
9
|
-
- Support CSV format for dataset queries
|
|
10
|
-
- Dataset creation - autodetection of geometry SRID/extent and manual override are supported. (These options were previously only available on dataset update)
|
|
11
|
-
|
|
12
|
-
## 0.4.1
|
|
13
|
-
### Features
|
|
14
|
-
- Added support for auto-detecting or manually specifying SRID and extent when updating a dataset SQL src.
|
|
15
|
-
- source-srs and target-srs switches changed to source-srid and target-strid. These switches now accept a numeric SRID.
|
|
16
|
-
|
|
17
|
-
## 0.4.0
|
|
18
|
-
### Features
|
|
19
|
-
- source-srs and target-srs switches added to upload command for SRS conversion during upload. Specify as an OGR2OGR-compatible SRS string e.g. `--target-srs EPSG:4326` (for WGS84), `--target-srs EPSG:3857` (for WebMercator)
|
|
20
|
-
|
|
21
|
-
## 0.2.11
|
|
22
|
-
|
|
23
|
-
### Features
|
|
24
|
-
- New command: `users verify`
|
|
25
|
-
- Verification status of users included with `users list`
|
|
26
|
-
|
|
27
|
-
### Bug Fixes
|
|
28
|
-
- Remove all non-printable characters from table cells
|
|
29
|
-
|
|
30
|
-
## 0.2.10
|
|
31
|
-
|
|
32
|
-
### Features
|
|
33
|
-
- New command: `tiles create`
|
|
34
|
-
- New command: `tiles update`
|
|
35
|
-
- Ability to override the map extent of a tilesource
|
|
36
|
-
|
|
37
|
-
### Bug Fixes
|
|
38
|
-
- Remove trailing whitespace from Dataset SQL source added by editor
|
|
39
|
-
|
|
40
|
-
## 0.2.9
|
|
41
|
-
|
|
42
|
-
### Features
|
|
43
|
-
- New command: `styles create`
|
|
44
|
-
- New command: `datasets create`
|
|
45
|
-
- Interactive options added to `datasets update`
|
|
46
|
-
|
|
47
|
-
### Bug Fixes
|
|
48
|
-
- Dataset SQL queries with newline characters do not break table output
|
|
49
|
-
- All CLI operations now deal correctly with partial IDs
|
|
50
|
-
|
|
51
|
-
## v0.2.6
|
|
52
|
-
|
|
53
|
-
### Bugfixes
|
|
54
|
-
- Fix 'multiple prefixes' warning where provided id is an exact match
|
|
55
|
-
|
|
56
|
-
## v0.2.5
|
|
57
|
-
|
|
58
|
-
### Bugfixes
|
|
59
|
-
- Allow changing dataset type attribute (`flow dataset update --type sql --source "..."`)
|