mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-03-10 22:44:14 +00:00
Merge pull request #2011 from balena-io/improve-preload-typings
preload: Improve the typings
This commit is contained in:
commit
4e457da5a9
@ -30,13 +30,12 @@ import type {
|
||||
Application,
|
||||
BalenaSDK,
|
||||
DeviceTypeJson,
|
||||
PineOptions,
|
||||
PineExpand,
|
||||
Release,
|
||||
} from 'balena-sdk';
|
||||
import type { Preloader } from 'balena-preload';
|
||||
import { parseAsInteger } from '../utils/validation';
|
||||
import { ExpectedError } from '../errors';
|
||||
import type { ResourceExpand } from 'pinejs-client-core';
|
||||
|
||||
interface FlagsDef extends DockerConnectionCliFlags {
|
||||
app?: string;
|
||||
@ -278,7 +277,7 @@ Can be repeated to add multiple certificates.\
|
||||
}
|
||||
}
|
||||
|
||||
readonly applicationExpandOptions: ResourceExpand = {
|
||||
readonly applicationExpandOptions: PineExpand<Application> = {
|
||||
owns__release: {
|
||||
$select: ['id', 'commit', 'end_timestamp', 'composition'],
|
||||
$orderby: [{ end_timestamp: 'desc' }, { id: 'desc' }],
|
||||
@ -340,38 +339,43 @@ Can be repeated to add multiple certificates.\
|
||||
|
||||
return this.getDeviceTypesWithSameArch(deviceTypeSlug).then(
|
||||
(deviceTypes) => {
|
||||
const options: PineOptions<
|
||||
ApplicationWithDeviceType & { should_be_running__release: [Release?] }
|
||||
> = {
|
||||
$filter: {
|
||||
is_for__device_type: {
|
||||
$any: {
|
||||
$alias: 'dt',
|
||||
$expr: {
|
||||
dt: {
|
||||
slug: { $in: deviceTypes },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
owns__release: {
|
||||
$any: {
|
||||
$alias: 'r',
|
||||
$expr: {
|
||||
r: {
|
||||
status: 'success',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
$expand: this.applicationExpandOptions,
|
||||
$select: ['id', 'app_name', 'should_track_latest_release'],
|
||||
$orderby: 'app_name asc',
|
||||
};
|
||||
return balena.pine.get({
|
||||
// TODO: remove the explicit types once https://github.com/balena-io/balena-sdk/pull/889 gets merged
|
||||
return balena.pine.get<
|
||||
Application,
|
||||
Array<
|
||||
ApplicationWithDeviceType & {
|
||||
should_be_running__release: [Release?];
|
||||
}
|
||||
>
|
||||
>({
|
||||
resource: 'my_application',
|
||||
options,
|
||||
options: {
|
||||
$filter: {
|
||||
is_for__device_type: {
|
||||
$any: {
|
||||
$alias: 'dt',
|
||||
$expr: {
|
||||
dt: {
|
||||
slug: { $in: deviceTypes },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
owns__release: {
|
||||
$any: {
|
||||
$alias: 'r',
|
||||
$expr: {
|
||||
r: {
|
||||
status: 'success',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
$expand: this.applicationExpandOptions,
|
||||
$select: ['id', 'app_name', 'should_track_latest_release'],
|
||||
$orderby: 'app_name asc',
|
||||
},
|
||||
});
|
||||
},
|
||||
);
|
||||
|
6
npm-shrinkwrap.json
generated
6
npm-shrinkwrap.json
generated
@ -2790,9 +2790,9 @@
|
||||
}
|
||||
},
|
||||
"balena-sdk": {
|
||||
"version": "15.3.1",
|
||||
"resolved": "https://registry.npmjs.org/balena-sdk/-/balena-sdk-15.3.1.tgz",
|
||||
"integrity": "sha512-V5Kj0fD31NyNDPFX0aERTcCs5pnNHg8uNFoqATNXgizrVvLj4Wzij2iHIR5PGvjq+lSyQRMEcQw+xGQd96JXVQ==",
|
||||
"version": "15.3.7",
|
||||
"resolved": "https://registry.npmjs.org/balena-sdk/-/balena-sdk-15.3.7.tgz",
|
||||
"integrity": "sha512-2d4rPHd4DHAWLFL10dsle+E+Zpiu2tfFcWtgYQR8OT1yszVt4Y4bt4/ubWumlpQPMqvvgC/uGGXZx6Lt0XTdLg==",
|
||||
"requires": {
|
||||
"@balena/es-version": "^1.0.0",
|
||||
"@types/lodash": "^4.14.159",
|
||||
|
@ -180,7 +180,6 @@
|
||||
"mock-require": "^3.0.3",
|
||||
"nock": "^12.0.3",
|
||||
"parse-link-header": "~1.0.1",
|
||||
"pinejs-client-core": "^6.7.3",
|
||||
"pkg": "^4.4.9",
|
||||
"publish-release": "^1.6.1",
|
||||
"rewire": "^4.0.1",
|
||||
@ -204,7 +203,7 @@
|
||||
"balena-image-manager": "^7.0.3",
|
||||
"balena-preload": "^10.3.1",
|
||||
"balena-release": "^3.0.0",
|
||||
"balena-sdk": "^15.3.1",
|
||||
"balena-sdk": "^15.3.7",
|
||||
"balena-semver": "^2.3.0",
|
||||
"balena-settings-client": "^4.0.5",
|
||||
"balena-settings-storage": "^6.0.1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user