@balena/open-balena-api 27.1.1-build-simplify-getAccessibleDeviceTypes-d702c16f4a39aa86ddb4986a4db8c25b0cf6386c-1 → 28.0.0-build-drop-device-types-v1-images-935ed5606fba5d10b2fca59593a64cf5aaee1038-1

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,8 +24,3 @@ export declare const getAccessibleDeviceTypes: (resinApi: typeof sbvrUtils.api.r
24
24
  /** @deprecated Use the getDeviceTypeBySlug unless you need the device-type.json contents. */
25
25
  export declare const findBySlug: (resinApi: typeof sbvrUtils.api.resin, slug: string) => Promise<DeviceTypeJson>;
26
26
  export declare const getImageSize: (resinApi: typeof sbvrUtils.api.resin, slug: string, buildId: string) => Promise<number>;
27
- export interface ImageVersions {
28
- versions: string[];
29
- latest: string;
30
- }
31
- export declare const getImageVersions: (resinApi: typeof sbvrUtils.api.resin, slug: string) => Promise<ImageVersions>;
@@ -1,6 +1,5 @@
1
1
  import _ from 'lodash';
2
2
  import { errors } from '@balena/pinejs';
3
- const { InternalRequestError } = errors;
4
3
  import { captureException } from '../../infra/error-handling/index.js';
5
4
  import { getCompressedSize, getDeviceTypeJson } from './build-info-facade.js';
6
5
  import { getDeviceTypes } from './device-types-list.js';
@@ -61,9 +60,14 @@ export const validateSlug = (slug) => {
61
60
  return slug;
62
61
  };
63
62
  /** @deprecated */
63
+ const getAllDeviceTypes = async () => {
64
+ const dtInfo = await getDeviceTypes();
65
+ return _.uniqBy(Object.values(dtInfo).map((dtEntry) => dtEntry.latest), (dt) => dt.slug);
66
+ };
67
+ /** @deprecated */
64
68
  export const getAccessibleDeviceTypes = async (resinApi) => {
65
- const [deviceTypeInfosBySlug, accessibleDeviceTypes] = await Promise.all([
66
- getDeviceTypes(),
69
+ const [deviceTypes, accessibleDeviceTypes] = await Promise.all([
70
+ getAllDeviceTypes(),
67
71
  resinApi.get({
68
72
  resource: 'device_type',
69
73
  options: {
@@ -71,18 +75,19 @@ export const getAccessibleDeviceTypes = async (resinApi) => {
71
75
  },
72
76
  }),
73
77
  ]);
74
- return accessibleDeviceTypes
75
- .map((dt) => deviceTypeInfosBySlug[dt.slug]?.latest)
76
- .filter((dtJson) => dtJson != null);
78
+ const accessSet = new Set(accessibleDeviceTypes.map((dt) => dt.slug));
79
+ return deviceTypes.filter((deviceType) => {
80
+ return accessSet.has(deviceType.slug);
81
+ });
77
82
  };
78
83
  /** @deprecated Use the getDeviceTypeBySlug unless you need the device-type.json contents. */
79
84
  export const findBySlug = async (resinApi, slug) => (await findDeviceTypeInfoBySlug(resinApi, slug)).latest;
80
85
  export const getImageSize = async (resinApi, slug, buildId) => {
81
86
  const deviceTypeInfo = await findDeviceTypeInfoBySlug(resinApi, slug);
82
- const deviceType = deviceTypeInfo.latest;
83
- const normalizedSlug = deviceType.slug;
87
+ const deviceTypeJson = deviceTypeInfo.latest;
88
+ const normalizedSlug = deviceTypeJson.slug;
84
89
  if (buildId === 'latest') {
85
- buildId = deviceType.buildId;
90
+ buildId = deviceTypeJson.buildId;
86
91
  }
87
92
  if (!deviceTypeInfo.versions.includes(buildId)) {
88
93
  throw new UnknownVersionError(slug, buildId);
@@ -99,26 +104,4 @@ export const getImageSize = async (resinApi, slug, buildId) => {
99
104
  throw err;
100
105
  }
101
106
  };
102
- export const getImageVersions = async (resinApi, slug) => {
103
- const deviceTypeInfo = await findDeviceTypeInfoBySlug(resinApi, slug);
104
- const deviceType = deviceTypeInfo.latest;
105
- const normalizedSlug = deviceType.slug;
106
- const buildIds = (await Promise.all(deviceTypeInfo.versions.map(async (buildId) => {
107
- try {
108
- if ((await getDeviceTypeJson(normalizedSlug, buildId)) != null) {
109
- return buildId;
110
- }
111
- }
112
- catch {
113
- return;
114
- }
115
- }))).filter((buildId) => buildId != null);
116
- if (_.isEmpty(buildIds) && !_.isEmpty(deviceTypeInfo.versions)) {
117
- throw new InternalRequestError(`Could not retrieve any image version for device type ${slug}`);
118
- }
119
- return {
120
- versions: buildIds,
121
- latest: buildIds[0],
122
- };
123
- };
124
107
  //# sourceMappingURL=device-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"device-types.js","sourceRoot":"","sources":["../../../src/features/device-types/device-types.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAIvB,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAEvE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE9E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC;AAGlD,MAAM,OAAO,sBAAuB,SAAQ,aAAa;IACxD,YAAY,IAAY;QACvB,KAAK,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;IACtC,CAAC;CACD;AAED,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IACrD,YAAY,IAAY,EAAE,OAAe;QACxC,KAAK,CAAC,UAAU,IAAI,kBAAkB,OAAO,UAAU,CAAC,CAAC;IAC1D,CAAC;CACD;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACvC,QAAoC,EACpC,IAAY,EAC4B,EAAE;IAC1C,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC;QAC/B,QAAQ,EAAE,aAAa;QACvB,OAAO,EAAE;YACR,IAAI,EAAE,CAAC;YACP,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC;YACvB,OAAO,EAAE;gBACR,iBAAiB,EAAE;oBAClB,IAAI,EAAE;wBACL,MAAM,EAAE,KAAK;wBACb,KAAK,EAAE;4BACN,GAAG,EAAE;gCACJ,uBAAuB,EAAE,IAAI;6BAC7B;yBACD;qBACD;iBACD;aACD;SACD;KACD,CAAC,CAAC;IAEH,IAAI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zD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,gBAAgB,CACf,GAAG,EACH,6BAA6B,IAAI,gCAAgC,OAAO,EAAE,CAC1E,CAAC;QACF,MAAM,GAAG,CAAC;IACX,CAAC;AACF,CAAC,CAAC"}
@@ -1,9 +1,8 @@
1
1
  import { middleware } from '../../infra/auth/index.js';
2
- import { downloadImageSize, getDeviceType, getDeviceTypes, listAvailableImageVersions, } from './routes.js';
2
+ import { downloadImageSize, getDeviceType, getDeviceTypes } from './routes.js';
3
3
  export const setup = (app) => {
4
4
  app.get('/device-types/v1', middleware.resolveCredentialsAndUser, getDeviceTypes);
5
5
  app.get('/device-types/v1/:deviceType', middleware.resolveCredentialsAndUser, getDeviceType);
6
- app.get('/device-types/v1/:deviceType/images', middleware.resolveCredentialsAndUser, listAvailableImageVersions);
7
6
  app.get('/device-types/v1/:deviceType/images/:version/download-size', middleware.resolveCredentialsAndUser, downloadImageSize);
8
7
  };
9
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/device-types/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EACN,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,0BAA0B,GAC1B,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAgB,EAAE,EAAE;IACzC,GAAG,CAAC,GAAG,CACN,kBAAkB,EAClB,UAAU,CAAC,yBAAyB,EACpC,cAAc,CACd,CAAC;IACF,GAAG,CAAC,GAAG,CACN,8BAA8B,EAC9B,UAAU,CAAC,yBAAyB,EACpC,aAAa,CACb,CAAC;IACF,GAAG,CAAC,GAAG,CACN,qCAAqC,EACrC,UAAU,CAAC,yBAAyB,EACpC,0BAA0B,CAC1B,CAAC;IACF,GAAG,CAAC,GAAG,CACN,4DAA4D,EAC5D,UAAU,CAAC,yBAAyB,EACpC,iBAAiB,CACjB,CAAC;AACH,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/device-types/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/E,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAgB,EAAE,EAAE;IACzC,GAAG,CAAC,GAAG,CACN,kBAAkB,EAClB,UAAU,CAAC,yBAAyB,EACpC,cAAc,CACd,CAAC;IACF,GAAG,CAAC,GAAG,CACN,8BAA8B,EAC9B,UAAU,CAAC,yBAAyB,EACpC,aAAa,CACb,CAAC;IACF,GAAG,CAAC,GAAG,CACN,4DAA4D,EAC5D,UAAU,CAAC,yBAAyB,EACpC,iBAAiB,CACjB,CAAC;AACH,CAAC,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import type { RequestHandler } from 'express';
2
2
  export declare const getDeviceTypes: RequestHandler;
3
3
  export declare const getDeviceType: RequestHandler;
4
- export declare const listAvailableImageVersions: RequestHandler;
5
4
  export declare const downloadImageSize: RequestHandler;
@@ -34,21 +34,6 @@ export const getDeviceType = async (req, res) => {
34
34
  res.status(500).send(translateError(err));
35
35
  }
36
36
  };
37
- export const listAvailableImageVersions = async (req, res) => {
38
- try {
39
- const resinApi = api.resin.clone({ passthrough: { req } });
40
- const slug = deviceTypesLib.validateSlug(req.params.deviceType);
41
- const data = await deviceTypesLib.getImageVersions(resinApi, slug);
42
- res.json(data);
43
- }
44
- catch (err) {
45
- captureException(err, 'Error getting image versions', { req });
46
- if (handleHttpErrors(req, res, err)) {
47
- return;
48
- }
49
- res.status(500).send(translateError(err));
50
- }
51
- };
52
37
  const DOWNLOAD_TIMEOUT = 30000; // we must respond within this time
53
38
  export const downloadImageSize = async (req, res) => {
54
39
  req.setTimeout(DOWNLOAD_TIMEOUT, _.noop);
@@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CAAC,EAAE,CAAC;YACrC,OAAO;QACR,CAAC;QACD,gBAAgB,CAAC,GAAG,EAAE,6BAA6B,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9D,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3C,CAAC;AACF,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@balena/open-balena-api",
3
3
  "description": "Internet of things, Made Simple",
4
- "version": "27.1.1-build-simplify-getAccessibleDeviceTypes-d702c16f4a39aa86ddb4986a4db8c25b0cf6386c-1",
4
+ "version": "28.0.0-build-drop-device-types-v1-images-935ed5606fba5d10b2fca59593a64cf5aaee1038-1",
5
5
  "license": "AGPL-3.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -168,6 +168,6 @@
168
168
  "loader": "ts-node/esm/transpile-only"
169
169
  },
170
170
  "versionist": {
171
- "publishedAt": "2024-09-06T08:34:28.077Z"
171
+ "publishedAt": "2024-09-06T10:13:04.151Z"
172
172
  }
173
173
  }