Update typescript to v5

This also updates code to use the default import syntax instead of
`import * as` when the imported module exposes a default. This is needed
with the latest typescript version.

Change-type: patch
This commit is contained in:
Felipe Lalanne 2024-03-05 15:15:30 -03:00
parent 3c546aa199
commit 6217546894
110 changed files with 208 additions and 205 deletions

72
package-lock.json generated
View File

@ -28,6 +28,7 @@
"@types/event-stream": "^3.3.34",
"@types/express": "^4.17.14",
"@types/json-mask": "2.0.3",
"@types/JSONStream": "npm:@types/jsonstream@^0.8.33",
"@types/lodash": "^4.14.186",
"@types/memoizee": "^0.4.8",
"@types/mocha": "^8.2.3",
@ -73,6 +74,7 @@
"io-ts": "^2.2.10",
"io-ts-reporters": "^1.2.2",
"json-mask": "^0.3.9",
"JSONStream": "^1.3.5",
"knex": "^2.5.1",
"lint-staged": "^13.0.3",
"livepush": "^3.5.1",
@ -108,7 +110,7 @@
"ts-node": "^8.10.2",
"tsconfig-paths": "^4.1.0",
"typed-error": "^3.2.1",
"typescript": "^4.8.4",
"typescript": "^5.3.3",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
"winston": "^3.3.3",
@ -1105,19 +1107,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@balena/lint/node_modules/typescript": {
"version": "5.3.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/@balena/lint/node_modules/y18n": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
@ -2079,10 +2068,11 @@
"integrity": "sha512-vuL/tG01yKO//gmCmnV3OZhx2hs538t+7FpQq//sUV1sF6xiKi5V8F60dvAxe/HkC4+QaMCHqrm/akqlppTAkQ==",
"dev": true
},
"node_modules/@types/jsonstream": {
"version": "0.8.30",
"resolved": "https://registry.npmjs.org/@types/jsonstream/-/jsonstream-0.8.30.tgz",
"integrity": "sha512-KqHs2eAapKL7ZKUiKI/giUYPVgkoDXkVGFehk3goo+3Q8qwxVVRC3iwg+hK/THORbcri4RRxTtlm3JoSY1KZLQ==",
"node_modules/@types/JSONStream": {
"name": "@types/jsonstream",
"version": "0.8.33",
"resolved": "https://registry.npmjs.org/@types/jsonstream/-/jsonstream-0.8.33.tgz",
"integrity": "sha512-yhg1SNOgJ8y2nOkvAQ1zZ1Z2xibxgFs7984+EeBPuWgo/TbuYo79+rj2wUVch3KF4GhhcwAi/AlJcehmLCXb3g==",
"dev": true,
"dependencies": {
"@types/node": "*"
@ -12785,6 +12775,15 @@
"tar-stream": "^2.1.0"
}
},
"node_modules/resin-docker-build/node_modules/@types/jsonstream": {
"version": "0.8.33",
"resolved": "https://registry.npmjs.org/@types/jsonstream/-/jsonstream-0.8.33.tgz",
"integrity": "sha512-yhg1SNOgJ8y2nOkvAQ1zZ1Z2xibxgFs7984+EeBPuWgo/TbuYo79+rj2wUVch3KF4GhhcwAi/AlJcehmLCXb3g==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/resin-docker-build/node_modules/@types/node": {
"version": "10.17.28",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.28.tgz",
@ -15031,16 +15030,16 @@
}
},
"node_modules/typescript": {
"version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"version": "5.3.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
"node": ">=14.17"
}
},
"node_modules/uglify-js": {
@ -16969,12 +16968,6 @@
"integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
"dev": true
},
"typescript": {
"version": "5.3.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
"dev": true
},
"y18n": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
@ -17748,10 +17741,10 @@
"integrity": "sha512-vuL/tG01yKO//gmCmnV3OZhx2hs538t+7FpQq//sUV1sF6xiKi5V8F60dvAxe/HkC4+QaMCHqrm/akqlppTAkQ==",
"dev": true
},
"@types/jsonstream": {
"version": "0.8.30",
"resolved": "https://registry.npmjs.org/@types/jsonstream/-/jsonstream-0.8.30.tgz",
"integrity": "sha512-KqHs2eAapKL7ZKUiKI/giUYPVgkoDXkVGFehk3goo+3Q8qwxVVRC3iwg+hK/THORbcri4RRxTtlm3JoSY1KZLQ==",
"@types/JSONStream": {
"version": "npm:@types/jsonstream@0.8.33",
"resolved": "https://registry.npmjs.org/@types/jsonstream/-/jsonstream-0.8.33.tgz",
"integrity": "sha512-yhg1SNOgJ8y2nOkvAQ1zZ1Z2xibxgFs7984+EeBPuWgo/TbuYo79+rj2wUVch3KF4GhhcwAi/AlJcehmLCXb3g==",
"dev": true,
"requires": {
"@types/node": "*"
@ -26014,6 +26007,15 @@
"tar-stream": "^2.1.0"
},
"dependencies": {
"@types/jsonstream": {
"version": "0.8.33",
"resolved": "https://registry.npmjs.org/@types/jsonstream/-/jsonstream-0.8.33.tgz",
"integrity": "sha512-yhg1SNOgJ8y2nOkvAQ1zZ1Z2xibxgFs7984+EeBPuWgo/TbuYo79+rj2wUVch3KF4GhhcwAi/AlJcehmLCXb3g==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/node": {
"version": "10.17.28",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.28.tgz",
@ -27734,9 +27736,9 @@
}
},
"typescript": {
"version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"version": "5.3.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
"dev": true
},
"uglify-js": {

View File

@ -54,6 +54,7 @@
"@types/event-stream": "^3.3.34",
"@types/express": "^4.17.14",
"@types/json-mask": "2.0.3",
"@types/JSONStream": "npm:@types/jsonstream@^0.8.33",
"@types/lodash": "^4.14.186",
"@types/memoizee": "^0.4.8",
"@types/mocha": "^8.2.3",
@ -99,6 +100,7 @@
"io-ts": "^2.2.10",
"io-ts-reporters": "^1.2.2",
"json-mask": "^0.3.9",
"JSONStream": "^1.3.5",
"knex": "^2.5.1",
"lint-staged": "^13.0.3",
"livepush": "^3.5.1",
@ -134,7 +136,7 @@
"ts-node": "^8.10.2",
"tsconfig-paths": "^4.1.0",
"typed-error": "^3.2.1",
"typescript": "^4.8.4",
"typescript": "^5.3.3",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
"winston": "^3.3.3",

View File

@ -1,10 +1,10 @@
import * as Bluebird from 'bluebird';
import Bluebird from 'bluebird';
import { stripIndent } from 'common-tags';
import { isLeft } from 'fp-ts/lib/Either';
import * as t from 'io-ts';
import * as _ from 'lodash';
import _ from 'lodash';
import { PinejsClientRequest } from 'pinejs-client-request';
import * as url from 'url';
import url from 'url';
import * as config from '../config';
import * as deviceConfig from '../device-config';

View File

@ -1,4 +1,4 @@
import * as url from 'url';
import url from 'url';
import type { CoreOptions } from 'request';
import { performance } from 'perf_hooks';
import { setTimeout } from 'timers/promises';

View File

@ -3,7 +3,7 @@ import { set } from '@balena/es-version';
set('es2019');
import { NOTFOUND } from 'dns';
import * as mdnsResolver from 'mdns-resolver';
import mdnsResolver from 'mdns-resolver';
class DnsLookupError extends Error {
public constructor(public code: string = NOTFOUND) {
@ -144,7 +144,7 @@ async function mdnsLookup(
import '@balena/happy-eyeballs/eye-patch';
import Supervisor from './supervisor';
import * as process from 'process';
import process from 'process';
import log from './lib/supervisor-console';
// Register signal handlers before starting the supervisor service

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs } from 'fs';
import type { ImageInspectInfo } from 'dockerode';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { EventEmitter } from 'events';
import type StrictEventEmitter from 'strict-event-emitter-types';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import * as config from '../config';

View File

@ -1,6 +1,6 @@
import type * as Docker from 'dockerode';
import type Docker from 'dockerode';
import { EventEmitter } from 'events';
import * as _ from 'lodash';
import _ from 'lodash';
import type StrictEventEmitter from 'strict-event-emitter-types';
import * as config from '../config';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import * as constants from '../lib/constants';
import { docker } from '../lib/docker-utils';

View File

@ -1,5 +1,5 @@
import * as _ from 'lodash';
import type * as dockerode from 'dockerode';
import _ from 'lodash';
import type dockerode from 'dockerode';
import { docker } from '../lib/docker-utils';
import logTypes = require('../lib/log-types');

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { TypedError } from 'typed-error';
// Adapted from https://github.com/docker/docker-py/blob/master/docker/utils/ports.py#L3

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import type { ConfigMap, ServiceComposeConfig } from './types/service';

View File

@ -1,8 +1,8 @@
import type * as Dockerode from 'dockerode';
import type Dockerode from 'dockerode';
import { EventEmitter } from 'events';
import { isLeft } from 'fp-ts/lib/Either';
import * as JSONStream from 'JSONStream';
import * as _ from 'lodash';
import JSONStream from 'JSONStream';
import _ from 'lodash';
import { promises as fs } from 'fs';
import type StrictEventEmitter from 'strict-event-emitter-types';
@ -390,7 +390,7 @@ export function listenToEvents() {
stream.on('error', (e) => {
log.error(`Error on docker events stream:`, e);
});
const parser = JSONStream.parse();
const parser = JSONStream.parse(true);
parser.on('data', async (data: { status: string; id: string }) => {
if (data != null) {
const status = data.status;

View File

@ -1,8 +1,8 @@
import { detailedDiff as diff } from 'deep-object-diff';
import type * as Dockerode from 'dockerode';
import type Dockerode from 'dockerode';
import Duration = require('duration-js');
import * as _ from 'lodash';
import * as path from 'path';
import _ from 'lodash';
import path from 'path';
import type { DockerPortOptions } from './ports';
import { PortMap } from './ports';

View File

@ -1,5 +1,5 @@
import type * as Dockerode from 'dockerode';
import * as t from 'io-ts';
import type Dockerode from 'dockerode';
import { isAbsolute } from 'path';
import type { PortMap } from '../ports';

View File

@ -1,6 +1,6 @@
import type * as Dockerode from 'dockerode';
import type Dockerode from 'dockerode';
import Duration = require('duration-js');
import * as _ from 'lodash';
import _ from 'lodash';
import { parse as parseCommand } from 'shell-quote';
import * as constants from '../lib/constants';

View File

@ -1,5 +1,5 @@
import * as _ from 'lodash';
import * as path from 'path';
import _ from 'lodash';
import path from 'path';
import type { VolumeInspectInfo } from 'dockerode';
import { isNotFoundError, InternalInconsistencyError } from '../lib/errors';

View File

@ -1,4 +1,4 @@
import type * as Docker from 'dockerode';
import type Docker from 'dockerode';
import isEqual = require('lodash/isEqual');
import omitBy = require('lodash/omitBy');

View File

@ -1,6 +1,6 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs } from 'fs';
import * as path from 'path';
import path from 'path';
import type { ConfigOptions } from './backend';
import { ConfigBackend } from './backend';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import type { ConfigOptions } from './backend';
import { ConfigBackend } from './backend';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import type { ConfigOptions } from './backend';
import {

View File

@ -1,5 +1,5 @@
import * as _ from 'lodash';
import * as semver from 'semver';
import _ from 'lodash';
import semver from 'semver';
import type { ConfigOptions } from './backend';
import { ConfigBackend } from './backend';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import type { ConfigOptions } from './backend';
import { ConfigBackend } from './backend';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs } from 'fs';
import type { ConfigOptions } from './backend';

View File

@ -1,6 +1,6 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs } from 'fs';
import * as path from 'path';
import path from 'path';
import * as constants from '../../lib/constants';
import { exists } from '../../lib/fs-utils';

View File

@ -1,5 +1,5 @@
import * as Bluebird from 'bluebird';
import * as _ from 'lodash';
import Bluebird from 'bluebird';
import _ from 'lodash';
import * as constants from '../lib/constants';
import * as hostUtils from '../lib/host-utils';

View File

@ -1,5 +1,5 @@
import * as _ from 'lodash';
import * as memoizee from 'memoizee';
import _ from 'lodash';
import memoizee from 'memoizee';
import supervisorVersion = require('../lib/supervisor-version');

View File

@ -1,6 +1,6 @@
import { EventEmitter } from 'events';
import type { Knex } from 'knex';
import * as _ from 'lodash';
import _ from 'lodash';
import type StrictEventEmitter from 'strict-event-emitter-types';
import { inspect } from 'util';
import { generateUniqueKey } from '../lib/register-device';

View File

@ -1,6 +1,6 @@
import { either, isRight } from 'fp-ts/lib/Either';
import * as t from 'io-ts';
import * as _ from 'lodash';
import _ from 'lodash';
import { InternalInconsistencyError } from '../lib/errors';
import { checkBooleanish, checkTruthy } from '../lib/validation';

View File

@ -1,5 +1,5 @@
import * as _ from 'lodash';
import * as Bluebird from 'bluebird';
import _ from 'lodash';
import Bluebird from 'bluebird';
import * as config from '../config';
import * as constants from '../lib/constants';

View File

@ -1,7 +1,7 @@
import type { Knex } from 'knex';
import { knex } from 'knex';
import * as path from 'path';
import * as _ from 'lodash';
import path from 'path';
import _ from 'lodash';
import * as constants from './lib/constants';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { getGlobalApiKey, refreshKey } from '.';
import * as messages from './messages';

View File

@ -1,6 +1,6 @@
import * as _ from 'lodash';
import type * as express from 'express';
import * as memoizee from 'memoizee';
import _ from 'lodash';
import type express from 'express';
import memoizee from 'memoizee';
import { TypedError } from 'typed-error';
import * as db from '../db';

View File

@ -1,4 +1,4 @@
import * as express from 'express';
import express from 'express';
import * as middleware from './middleware';
import * as apiKeys from './api-keys';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { UpdatesLockedError } from '../../lib/errors';
import log from '../../lib/supervisor-console';

View File

@ -1,4 +1,4 @@
import * as morgan from 'morgan';
import morgan from 'morgan';
import type { Request } from 'express';
import log from '../../lib/supervisor-console';

View File

@ -1,4 +1,4 @@
import * as express from 'express';
import express from 'express';
import type { Response } from 'express';
import * as actions from './actions';

View File

@ -1,6 +1,6 @@
import * as express from 'express';
import express from 'express';
import type { Response, NextFunction } from 'express';
import * as _ from 'lodash';
import _ from 'lodash';
import * as deviceState from '../device-state';
import * as apiBinder from '../api-binder';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { inspect } from 'util';
import { promises as fs } from 'fs';

View File

@ -1,11 +1,11 @@
import * as Bluebird from 'bluebird';
import Bluebird from 'bluebird';
import { stripIndent } from 'common-tags';
import { EventEmitter } from 'events';
import * as _ from 'lodash';
import _ from 'lodash';
import type StrictEventEmitter from 'strict-event-emitter-types';
import { isRight } from 'fp-ts/lib/Either';
import Reporter from 'io-ts-reporters';
import prettyMs = require('pretty-ms');
import prettyMs from 'pretty-ms';
import * as config from './config';
import * as db from './db';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import type * as db from '../db';
import * as targetStateCache from './target-state-cache';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import type { TargetAppsV2 } from '../lib/legacy';
import { fromV2TargetApps } from '../lib/legacy';
import type { AppsJsonFormat, TargetApp, TargetRelease } from '../types';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs } from 'fs';
import type { Image } from '../compose/images';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import * as config from '../config';
import * as db from '../db';

View File

@ -1,7 +1,7 @@
import { EventEmitter } from 'events';
import * as url from 'url';
import url from 'url';
import { setTimeout } from 'timers/promises';
import * as Bluebird from 'bluebird';
import Bluebird from 'bluebird';
import type StrictEventEmitter from 'strict-event-emitter-types';
import type { TargetState } from '../types/state';

View File

@ -1,5 +1,5 @@
import { EventEmitter } from 'events';
import * as _ from 'lodash';
import _ from 'lodash';
import type StrictEventEmitter from 'strict-event-emitter-types';
import type { TargetState } from './types/state';

View File

@ -1,7 +1,7 @@
import { stripIndent } from 'common-tags';
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs } from 'fs';
import * as path from 'path';
import path from 'path';
import * as config from './config';
import * as applicationManager from './compose/application-manager';

View File

@ -1,6 +1,6 @@
import type { PinejsClientRequest } from 'pinejs-client-request';
import * as Bluebird from 'bluebird';
import Bluebird from 'bluebird';
import * as config from '../config';
import * as eventTracker from '../event-tracker';

View File

@ -1,7 +1,7 @@
import * as config from '../config';
import * as dbus from './dbus';
import * as _ from 'lodash';
import _ from 'lodash';
import log from './supervisor-console';

View File

@ -1,4 +1,4 @@
import * as path from 'path';
import path from 'path';
import { checkString } from './validation';
const supervisorNetworkInterface = 'supervisor0';

View File

@ -1,7 +1,7 @@
import { isLeft } from 'fp-ts/lib/Either';
import * as t from 'io-ts';
import Reporter from 'io-ts-reporters';
import * as _ from 'lodash';
import _ from 'lodash';
import { Blueprint, Contract, ContractObject } from '@balena/contrato';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import type { EnvVarObject } from '../types';

View File

@ -1,8 +1,8 @@
import type { ProgressCallback } from 'docker-progress';
import { DockerProgress } from 'docker-progress';
import * as Dockerode from 'dockerode';
import * as _ from 'lodash';
import * as memoizee from 'memoizee';
import Dockerode from 'dockerode';
import _ from 'lodash';
import memoizee from 'memoizee';
import { applyDelta, OutOfSyncError } from 'docker-delta';
import DockerToolbelt = require('docker-toolbelt');

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import * as config from '../config/index';
import * as constants from './constants';

View File

@ -1,5 +1,5 @@
import { promises as fs } from 'fs';
import * as path from 'path';
import path from 'path';
import { exec as execSync } from 'child_process';
import { promisify } from 'util';
import { uptime } from 'os';

View File

@ -1,5 +1,5 @@
import { spawn } from 'child_process';
import * as path from 'path';
import path from 'path';
import * as constants from './constants';
import { exec, exists } from './fs-utils';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { spawn } from 'child_process';
import { Readable } from 'stream';
import { TypedError } from 'typed-error';

View File

@ -1,5 +1,5 @@
import { promises as fs, unlinkSync, rmdirSync } from 'fs';
import * as os from 'os';
import os from 'os';
import { dirname } from 'path';
import { exec } from './fs-utils';

View File

@ -1,6 +1,6 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs } from 'fs';
import * as path from 'path';
import path from 'path';
import { TypedError } from 'typed-error';
import log from './supervisor-console';

View File

@ -1,5 +1,5 @@
import { promises as fs } from 'fs';
import * as path from 'path';
import path from 'path';
import * as volumeManager from '../compose/volume-manager';
import * as deviceState from '../device-state';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs } from 'fs';
import { InternalInconsistencyError } from './errors';

View File

@ -1,7 +1,7 @@
import * as Bluebird from 'bluebird';
import Bluebird from 'bluebird';
import once = require('lodash/once');
import * as requestLib from 'request';
import * as resumableRequestLib from 'resumable-request';
import requestLib from 'request';
import resumableRequestLib from 'resumable-request';
import * as constants from './constants';
import * as osRelease from './os-release';

View File

@ -1,6 +1,6 @@
import * as _ from 'lodash';
import _ from 'lodash';
import type { TransformableInfo } from 'logform';
import * as winston from 'winston';
import winston from 'winston';
const levels = {
error: 0,

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import * as packageJson from '../../package.json';
let version = packageJson.version;

View File

@ -1,6 +1,6 @@
import * as systeminformation from 'systeminformation';
import * as _ from 'lodash';
import * as memoizee from 'memoizee';
import systeminformation from 'systeminformation';
import _ from 'lodash';
import memoizee from 'memoizee';
import { promises as fs } from 'fs';
import { exec } from './fs-utils';

View File

@ -1,7 +1,7 @@
import * as Bluebird from 'bluebird';
import Bluebird from 'bluebird';
import { promises as fs } from 'fs';
import * as path from 'path';
import * as Lock from 'rwlock';
import path from 'path';
import Lock from 'rwlock';
import { isRight } from 'fp-ts/lib/Either';
import {

View File

@ -1,5 +1,5 @@
import { isRight } from 'fp-ts/lib/Either';
import * as _ from 'lodash';
import _ from 'lodash';
import { DeviceName } from '../types';
export interface CheckIntOptions {
positive?: boolean;

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import * as config from './config';
import * as db from './db';

View File

@ -1,5 +1,5 @@
import * as Bluebird from 'bluebird';
import * as _ from 'lodash';
import Bluebird from 'bluebird';
import _ from 'lodash';
import * as config from './config';
import * as db from './db';

View File

@ -1,9 +1,9 @@
import type { ClientRequest } from 'http';
import * as https from 'https';
import * as _ from 'lodash';
import * as stream from 'stream';
import * as url from 'url';
import * as zlib from 'zlib';
import https from 'https';
import _ from 'lodash';
import stream from 'stream';
import url from 'url';
import zlib from 'zlib';
import type { LogMessage } from './log-backend';
import { LogBackend } from './log-backend';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { Readable } from 'stream';
import { checkInt } from '../lib/validation';

View File

@ -1,4 +1,4 @@
import * as JSONstream from 'JSONStream';
import JSONstream from 'JSONStream';
import * as db from '../db';
import { spawnJournalctl, toJournalDate } from '../lib/journald';

View File

@ -1,5 +1,5 @@
import * as Bluebird from 'bluebird';
import * as _ from 'lodash';
import Bluebird from 'bluebird';
import _ from 'lodash';
const tryParse = function (obj) {
try {

View File

@ -1,4 +1,4 @@
import * as fs from 'fs';
import fs from 'fs';
const configJsonPath = process.env.CONFIG_MOUNT_POINT;
exports.up = function (knex) {

View File

@ -1,5 +1,5 @@
import * as Bluebird from 'bluebird';
import * as fs from 'fs';
import Bluebird from 'bluebird';
import fs from 'fs';
const configJsonPath = process.env.CONFIG_MOUNT_POINT;
exports.up = function (knex) {

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
// We take legacy deviceConfig targets and store them without the RESIN_ prefix
// (we also strip the BALENA_ prefix for completeness, even though no supervisors

View File

@ -1,4 +1,4 @@
import * as fs from 'fs';
import fs from 'fs';
const configJsonPath = process.env.CONFIG_MOUNT_POINT;
import { checkTruthy } from '../lib/validation';

View File

@ -1,4 +1,4 @@
import * as fs from 'fs';
import fs from 'fs';
const configJsonPath = process.env.CONFIG_MOUNT_POINT;
import { checkTruthy } from '../lib/validation';

View File

@ -1,8 +1,8 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs, watch } from 'fs';
import * as networkCheck from 'network-checker';
import * as os from 'os';
import * as url from 'url';
import networkCheck from 'network-checker';
import os from 'os';
import url from 'url';
import * as constants from './lib/constants';
import { EEXIST } from './lib/errors';

View File

@ -1,6 +1,6 @@
import { expect } from 'chai';
import * as sinon from 'sinon';
import * as Docker from 'dockerode';
import Docker from 'dockerode';
import * as applicationManager from '~/src/compose/application-manager';
import * as imageManager from '~/src/compose/images';
import * as serviceManager from '~/src/compose/service-manager';

View File

@ -4,7 +4,7 @@ import * as imageManager from '~/src/compose/images';
import { createImage, withMockerode } from '~/test-lib/mockerode';
import { createDockerImage } from '~/test-lib/docker-helper';
import * as Docker from 'dockerode';
import Docker from 'dockerode';
import * as db from '~/src/db';
// TODO: this code is duplicated in multiple tests

View File

@ -3,7 +3,7 @@ import { expect } from 'chai';
import { Network } from '~/src/compose/network';
import { createNetwork, withMockerode } from '~/test-lib/mockerode';
import * as Docker from 'dockerode';
import Docker from 'dockerode';
describe('compose/network: integration tests', () => {
const docker = new Docker();

View File

@ -5,7 +5,7 @@ import * as volumeManager from '~/src/compose/volume-manager';
import Volume from '~/src/compose/volume';
import { createDockerImage } from '~/test-lib/docker-helper';
import * as Docker from 'dockerode';
import Docker from 'dockerode';
describe('compose/volume-manager', () => {
const docker = new Docker();

View File

@ -5,7 +5,7 @@ import Volume from '~/src/compose/volume';
import * as logTypes from '~/lib/log-types';
import * as logger from '~/src/logger';
import * as Docker from 'dockerode';
import Docker from 'dockerode';
import { createVolume, withMockerode } from '~/test-lib/mockerode';

View File

@ -1,8 +1,8 @@
import { expect } from 'chai';
import type { SinonStub } from 'sinon';
import { stub } from 'sinon';
import * as Docker from 'dockerode';
import * as request from 'supertest';
import Docker from 'dockerode';
import request from 'supertest';
import { setTimeout } from 'timers/promises';
import * as deviceState from '~/src/device-state';

View File

@ -1,5 +1,5 @@
import * as express from 'express';
import * as request from 'supertest';
import express from 'express';
import request from 'supertest';
import { expect } from 'chai';
import * as config from '~/src/config';

View File

@ -1,5 +1,5 @@
import type * as express from 'express';
import * as request from 'supertest';
import request from 'supertest';
import * as deviceApi from '~/src/device-api';

View File

@ -1,5 +1,5 @@
import * as express from 'express';
import * as request from 'supertest';
import express from 'express';
import request from 'supertest';
import * as config from '~/src/config';
import * as testDb from '~/src/db';

View File

@ -2,7 +2,7 @@ import { expect } from 'chai';
import type * as express from 'express';
import type { SinonStub } from 'sinon';
import { stub } from 'sinon';
import * as request from 'supertest';
import request from 'supertest';
import * as config from '~/src/config';
import * as db from '~/src/db';

View File

@ -2,7 +2,7 @@ import { expect } from 'chai';
import type * as express from 'express';
import type { SinonStub } from 'sinon';
import { stub } from 'sinon';
import * as request from 'supertest';
import request from 'supertest';
import * as config from '~/src/config';
import * as db from '~/src/db';

View File

@ -12,7 +12,7 @@ import { initializeContractRequirements } from '~/lib/contracts';
import { testfs } from 'mocha-pod';
import { createDockerImage } from '~/test-lib/docker-helper';
import * as Docker from 'dockerode';
import Docker from 'dockerode';
import { setTimeout } from 'timers/promises';
describe('device-state', () => {

View File

@ -3,7 +3,7 @@ import { stub } from 'sinon';
import * as dockerUtils from '~/lib/docker-utils';
import { createDockerImage, cleanupDocker } from '~/test-lib/docker-helper';
import * as Docker from 'dockerode';
import Docker from 'dockerode';
describe('lib/docker-utils', () => {
const docker = new Docker();

View File

@ -1,6 +1,6 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { expect } from 'chai';
import * as sinon from 'sinon';
import sinon from 'sinon';
import * as config from '~/src/config';
import * as logger from '~/src/logger';

View File

@ -1,6 +1,6 @@
import { expect } from 'chai';
import { isRight } from 'fp-ts/lib/Either';
import * as nock from 'nock';
import nock from 'nock';
import { TargetState } from '~/src/types';
import * as legacy from '~/lib/legacy';

View File

@ -1,7 +1,7 @@
import { expect } from 'chai';
import * as Docker from 'dockerode';
import Docker from 'dockerode';
import type { TargetStateV2 } from '~/lib/legacy';
import * as request from 'supertest';
import request from 'supertest';
import { setTimeout as delay } from 'timers/promises';
import { exec } from '~/lib/fs-utils';

View File

@ -1,4 +1,4 @@
import * as request from 'supertest';
import request from 'supertest';
const BALENA_SUPERVISOR_ADDRESS =
process.env.BALENA_SUPERVISOR_ADDRESS || 'http://balena-supervisor:48484';

View File

@ -1,8 +1,8 @@
import type { SinonStub, SinonSpy } from 'sinon';
import { stub, spy } from 'sinon';
import * as Bluebird from 'bluebird';
import * as _ from 'lodash';
import rewire = require('rewire');
import Bluebird from 'bluebird';
import _ from 'lodash';
import rewire from 'rewire';
import { expect } from 'chai';
import * as TargetState from '~/src/device-state/target-state';

View File

@ -1,7 +1,7 @@
import { expect } from 'chai';
import type { SinonStub, SinonSpy } from 'sinon';
import { stub, spy } from 'sinon';
import * as supertest from 'supertest';
import supertest from 'supertest';
import sampleResponses = require('~/test-data/device-api-responses.json');
import mockedAPI = require('~/test-lib/mocked-device-api');

View File

@ -1,8 +1,8 @@
import * as chai from 'chai';
import * as chaiAsPromised from 'chai-as-promised';
import * as sinonChai from 'sinon-chai';
import * as chaiThings from 'chai-things';
import * as chaiLike from 'chai-like';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import sinonChai from 'sinon-chai';
import chaiThings from 'chai-things';
import chaiLike from 'chai-like';
/**
* Mocha runs this EXACTLY ONCE before all tests to set up globals that

Some files were not shown because too many files have changed in this diff Show More