mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-29 15:44:26 +00:00
preload: Improve the typings
Change-type: patch Depends-on: https://github.com/balena-io/balena-sdk/pull/980 See: https://github.com/balena-io/balena-cli/pull/2007#discussion_r478330624 Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
This commit is contained in:
parent
c647989054
commit
2e1570149d
@ -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',
|
||||
},
|
||||
});
|
||||
},
|
||||
);
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user