@contrail/cli 3.5.0-alpha → 3.5.0-alpha-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 +2 -2
- package/dist/commands/entities/get.js +7 -8
- package/oclif.manifest.json +2 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ $ npm install -g @contrail/cli
|
|
|
17
17
|
$ contrail COMMAND
|
|
18
18
|
running command...
|
|
19
19
|
$ contrail (--version)
|
|
20
|
-
@contrail/cli/3.5.0-alpha darwin-arm64 node-v22.19.0
|
|
20
|
+
@contrail/cli/3.5.0-alpha-1 darwin-arm64 node-v22.19.0
|
|
21
21
|
$ contrail --help [COMMAND]
|
|
22
22
|
USAGE
|
|
23
23
|
$ contrail COMMAND
|
|
@@ -641,7 +641,7 @@ FLAGS
|
|
|
641
641
|
-p, --propertySlugs=<value> Comma-separated list of property slugs to include in the output
|
|
642
642
|
-r, --relations=<value> Comma-separated list of relations to include in the output
|
|
643
643
|
-s, --skipHydrateRelationships Skip hydrating relationships when fetching the entity
|
|
644
|
-
-t, --take=<value>
|
|
644
|
+
-t, --take=<value> Number of entities to fetch in a single request (default is 100)
|
|
645
645
|
|
|
646
646
|
DESCRIPTION
|
|
647
647
|
(BETA) Get an entity
|
|
@@ -9,7 +9,7 @@ const login_1 = require("../../auth/login");
|
|
|
9
9
|
const types_1 = require("../../api/types");
|
|
10
10
|
const propertySpecifications_1 = require("../../helpers/propertySpecifications/propertySpecifications");
|
|
11
11
|
let SHOULD_USE_PAGINATED_FIND = false;
|
|
12
|
-
let MAX_NUMBER_OF_ENTITIES_TO_FETCH =
|
|
12
|
+
let MAX_NUMBER_OF_ENTITIES_TO_FETCH = undefined;
|
|
13
13
|
class GetEntity extends basecommand_1.BaseCommand {
|
|
14
14
|
static description = '(BETA) Get an entity';
|
|
15
15
|
static examples = [
|
|
@@ -69,7 +69,8 @@ class GetEntity extends basecommand_1.BaseCommand {
|
|
|
69
69
|
const { outputFile, propertySlugs, relations: relationString, skipHydrateRelationships, paginated: shouldUsePaginatedFind, take: numToTake, } = flags;
|
|
70
70
|
SHOULD_USE_PAGINATED_FIND = shouldUsePaginatedFind;
|
|
71
71
|
MAX_NUMBER_OF_ENTITIES_TO_FETCH = numToTake;
|
|
72
|
-
|
|
72
|
+
if (MAX_NUMBER_OF_ENTITIES_TO_FETCH)
|
|
73
|
+
console.log(`Will limit output to ${MAX_NUMBER_OF_ENTITIES_TO_FETCH} entities.`);
|
|
73
74
|
const propertySpecificationArgs = argv
|
|
74
75
|
.slice(1, argv.length)
|
|
75
76
|
.filter(propertySpecifications_1.isValidPropertySpecification);
|
|
@@ -184,16 +185,14 @@ async function* streamPaginatedFind(typePath, options = {}) {
|
|
|
184
185
|
nextPageKey = response.nextPageKey;
|
|
185
186
|
const results = response.results || [];
|
|
186
187
|
for (const result of results) {
|
|
187
|
-
if (count >= MAX_NUMBER_OF_ENTITIES_TO_FETCH)
|
|
188
|
-
return;
|
|
189
188
|
yield result;
|
|
190
189
|
count++;
|
|
190
|
+
if (MAX_NUMBER_OF_ENTITIES_TO_FETCH && count >= MAX_NUMBER_OF_ENTITIES_TO_FETCH)
|
|
191
|
+
return;
|
|
191
192
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
if (!nextPageKey || results.length === 0 || count >= MAX_NUMBER_OF_ENTITIES_TO_FETCH) {
|
|
193
|
+
console.log(`Fetched ${count} entities`);
|
|
194
|
+
if (!nextPageKey || results.length === 0)
|
|
195
195
|
return;
|
|
196
|
-
}
|
|
197
196
|
}
|
|
198
197
|
}
|
|
199
198
|
// Useful for troubleshooting
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.5.0-alpha",
|
|
2
|
+
"version": "3.5.0-alpha-1",
|
|
3
3
|
"commands": {
|
|
4
4
|
"app:create": {
|
|
5
5
|
"id": "app:create",
|
|
@@ -943,8 +943,7 @@
|
|
|
943
943
|
"char": "t",
|
|
944
944
|
"description": "Number of entities to fetch in a single request (default is 100)",
|
|
945
945
|
"required": false,
|
|
946
|
-
"multiple": false
|
|
947
|
-
"default": 1000
|
|
946
|
+
"multiple": false
|
|
948
947
|
}
|
|
949
948
|
},
|
|
950
949
|
"args": {
|