@bussolabs/closeyourit-cli 0.7.1 → 0.7.3
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/dist/commands/secrets/assets/list.d.ts +2 -0
- package/dist/commands/secrets/assets/list.js +8 -2
- package/dist/commands/secrets/assets/shared-list.js +1 -1
- package/dist/commands/secrets/list.js +1 -1
- package/dist/lib/paginate.d.ts +12 -0
- package/dist/lib/paginate.js +10 -0
- package/oclif.manifest.json +2724 -2706
- package/package.json +1 -1
|
@@ -2,6 +2,8 @@ import { BaseCommand } from '../../../base';
|
|
|
2
2
|
export default class SecretsAssetsList extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
|
+
page: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
6
|
+
per: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
5
7
|
project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
6
8
|
};
|
|
7
9
|
run(): Promise<unknown>;
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
3
4
|
const base_1 = require("../../../base");
|
|
4
5
|
const output_1 = require("../../../lib/output");
|
|
5
6
|
const paginate_1 = require("../../../lib/paginate");
|
|
6
7
|
class SecretsAssetsList extends base_1.BaseCommand {
|
|
7
8
|
static description = 'List encrypted secret files visible to a project (metadata only)';
|
|
8
|
-
static flags = {
|
|
9
|
+
static flags = {
|
|
10
|
+
...base_1.projectFlag,
|
|
11
|
+
// Deprecati e ignorati: la lista ora aggrega tutte le pagine. Mantenuti per non rompere gli script.
|
|
12
|
+
page: core_1.Flags.integer({ deprecated: true, hidden: true, description: 'Deprecated: the list returns every page' }),
|
|
13
|
+
per: core_1.Flags.integer({ deprecated: true, hidden: true, description: 'Deprecated: the list returns every page' }),
|
|
14
|
+
};
|
|
9
15
|
async run() {
|
|
10
16
|
const { flags } = await this.parse(SecretsAssetsList);
|
|
11
17
|
const projectId = await this.resolveProjectId(flags.project);
|
|
12
18
|
const data = await (0, paginate_1.fetchAllPages)(this.api, `/cli/v1/projects/${encodeURIComponent(projectId)}/secret_assets`);
|
|
13
19
|
if (!this.jsonEnabled())
|
|
14
20
|
this.log((0, output_1.renderTable)(['ID', 'NAME', 'TYPE', 'ENV', 'VERSION', 'BYTES'], data.map((a) => [a.id, a.name, a.asset_type, a.environment?.code ?? 'all', a.current_version?.number ?? '', a.current_version?.byte_size ?? ''])));
|
|
15
|
-
return { data };
|
|
21
|
+
return { data, meta: (0, paginate_1.aggregatedMeta)(data.length) };
|
|
16
22
|
}
|
|
17
23
|
}
|
|
18
24
|
exports.default = SecretsAssetsList;
|
|
@@ -10,7 +10,7 @@ class SecretsAssetsSharedList extends base_1.BaseCommand {
|
|
|
10
10
|
const data = await (0, paginate_1.fetchAllPages)(this.api, '/cli/v1/shared_secret_assets');
|
|
11
11
|
if (!this.jsonEnabled())
|
|
12
12
|
this.log((0, output_1.renderTable)(['ID', 'NAME', 'TYPE', 'ENV'], data.map((a) => [a.id, a.name, a.asset_type, a.environment?.code ?? 'all'])));
|
|
13
|
-
return { data };
|
|
13
|
+
return { data, meta: (0, paginate_1.aggregatedMeta)(data.length) };
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.default = SecretsAssetsSharedList;
|
|
@@ -27,7 +27,7 @@ class SecretsList extends base_1.BaseCommand {
|
|
|
27
27
|
]);
|
|
28
28
|
this.log((0, output_1.renderTable)(['NAME', 'ENVIRONMENT', 'DESCRIPTION'], rows));
|
|
29
29
|
}
|
|
30
|
-
return { data };
|
|
30
|
+
return { data, meta: (0, paginate_1.aggregatedMeta)(data.length) };
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
exports.default = SecretsList;
|
package/dist/lib/paginate.d.ts
CHANGED
|
@@ -7,3 +7,15 @@ import type { CliApi } from './api';
|
|
|
7
7
|
* A backend that does not paginate returns everything on page 1 (`meta` absent) → single fetch.
|
|
8
8
|
*/
|
|
9
9
|
export declare function fetchAllPages<T = Record<string, unknown>>(api: CliApi, basePath: string, params?: Record<string, string>): Promise<T[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Meta for a fully-aggregated collection. `fetchAllPages` collapses every backend page into a
|
|
12
|
+
* single logical page, so page-1's meta (e.g. `total_pages: 2`) would misdescribe the payload —
|
|
13
|
+
* and dropping `meta` altogether breaks `--json` consumers of the envelope. This restates the
|
|
14
|
+
* backend's `{page, per, total, total_pages}` contract consistently with the aggregated `data`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function aggregatedMeta(count: number): {
|
|
17
|
+
page: number;
|
|
18
|
+
per: number;
|
|
19
|
+
total: number;
|
|
20
|
+
total_pages: number;
|
|
21
|
+
};
|
package/dist/lib/paginate.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fetchAllPages = fetchAllPages;
|
|
4
|
+
exports.aggregatedMeta = aggregatedMeta;
|
|
4
5
|
/**
|
|
5
6
|
* Read every page of a paginated collection endpoint and return the aggregated rows.
|
|
6
7
|
*
|
|
@@ -22,3 +23,12 @@ async function fetchAllPages(api, basePath, params = {}) {
|
|
|
22
23
|
} while (page <= totalPages);
|
|
23
24
|
return all;
|
|
24
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Meta for a fully-aggregated collection. `fetchAllPages` collapses every backend page into a
|
|
28
|
+
* single logical page, so page-1's meta (e.g. `total_pages: 2`) would misdescribe the payload —
|
|
29
|
+
* and dropping `meta` altogether breaks `--json` consumers of the envelope. This restates the
|
|
30
|
+
* backend's `{page, per, total, total_pages}` contract consistently with the aggregated `data`.
|
|
31
|
+
*/
|
|
32
|
+
function aggregatedMeta(count) {
|
|
33
|
+
return { page: 1, per: count, total: count, total_pages: 1 };
|
|
34
|
+
}
|