@balena/open-balena-api 30.0.11-build-get-write-context-58bd1e8c84c931f5fa90ddbfc01b7e13c16680b8-1 → 30.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,28 +12,28 @@ const { api } = sbvrUtils;
12
12
  const supervisor = new Supervisor();
13
13
  const getWriteContext = (() => {
14
14
  const $getWriteContext = multiCacheMemoizee(async (uuid, req) => {
15
- try {
16
- const result = await sbvrUtils.db.readTransaction(async (tx) => {
17
- return await api.resin.request({
15
+ return await sbvrUtils.db.readTransaction(async (tx) => {
16
+ try {
17
+ const result = await api.resin.request({
18
18
  method: 'POST',
19
19
  // We use a parameter alias to signify to pinejs that it's a beneficial query to cache
20
20
  url: `device(uuid=@uuid)/canAccess?@uuid='${uuid}'`,
21
21
  passthrough: { req, tx },
22
22
  body: { action: 'write-log' },
23
23
  });
24
- });
25
- const deviceId = result?.d?.[0]?.id;
26
- if (deviceId == null) {
24
+ const deviceId = result?.d?.[0]?.id;
25
+ if (deviceId == null) {
26
+ return false;
27
+ }
28
+ return addRetentionLimit({
29
+ id: deviceId,
30
+ uuid,
31
+ });
32
+ }
33
+ catch {
27
34
  return false;
28
35
  }
29
- return addRetentionLimit({
30
- id: deviceId,
31
- uuid,
32
- });
33
- }
34
- catch {
35
- return false;
36
- }
36
+ });
37
37
  }, {
38
38
  cacheKey: 'getDeviceLogsWriteContext',
39
39
  promise: true,
@@ -1 +1 @@
1
- {"version":3,"file":"store.js","sourceRoot":"","sources":["../../../../src/features/device-logs/lib/store.ts"],"names":[],"mappings":"AAQA,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EACN,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GAC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AAC,OAAO,GAAG,EAAE,CAAC;YACd,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAClC,CAAC;IACF,CAAC;IACD,SAAS,QAAQ;QAChB,IAAI,gBAAgB,KAAK,KAAK,EAAE,CAAC;YAChC,OAAO;QACR,CAAC;QACD,8DAA8D;QAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS;YAC9B,CAAC,CAAC,0BAA0B;YAC5B,CAAC,CAAC,uCAAuC,CAAC;QAC3C,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC9B,gBAAgB,GAAG,IAAI,CAAC;IACzB,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../../../src/features/device-logs/lib/store.ts"],"names":[],"mappings":"AAQA,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EACN,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACd,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,YAAY,EACZ,mBAAmB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACN,oCAAoC,EACpC,uCAAuC,EACvC,0BAA0B,EAC1B,uBAAuB,EACvB,YAAY,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,kBAAkB,EAClB,uBAAuB,GACvB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,EACL,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,GACzB,GAAG,MAAM,CAAC;AACX,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;AAE1B,MAAM,UAAU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+1,4 @@
1
1
  import type { DeviceTypeJson } from './device-type-json.js';
2
- export declare const getLogoUrl: import("../../infra/cache/multi-level-memoizee.js").MemoizedFn<(normalizedSlug: string, buildId: string) => Promise<string | undefined>>;
2
+ export declare const getLogoUrl: (normalizedSlug: string, buildId: string) => Promise<string | undefined>;
3
3
  export declare const getDeviceTypeJson: import("../../infra/cache/multi-level-memoizee.js").MemoizedFn<(normalizedSlug: string, buildId: string) => Promise<DeviceTypeJson | undefined>>;
4
4
  export declare const getCompressedSize: import("../../infra/cache/multi-level-memoizee.js").MemoizedFn<(normalizedSlug: string, buildId: string) => Promise<number>>;
@@ -1,10 +1,7 @@
1
1
  import { multiCacheMemoizee } from '../../infra/cache/index.js';
2
2
  import { BUILD_COMPRESSED_SIZE_CACHE_TIMEOUT, BUILD_PROPERTY_CACHE_TIMEOUT, FILES_HOST, } from '../../lib/config.js';
3
3
  import { fileExists, getFile, getFolderSize, getImageKey, } from './storage/index.js';
4
- export const getLogoUrl = multiCacheMemoizee(async (normalizedSlug, buildId) => {
5
- if (!FILES_HOST) {
6
- return;
7
- }
4
+ const $getLogoUrl = multiCacheMemoizee(async (normalizedSlug, buildId) => {
8
5
  const pathComponents = [normalizedSlug, buildId, 'logo.svg'];
9
6
  try {
10
7
  const logoKey = getImageKey(...pathComponents);
@@ -13,20 +10,29 @@ export const getLogoUrl = multiCacheMemoizee(async (normalizedSlug, buildId) =>
13
10
  return;
14
11
  }
15
12
  // url encode since the buildId can contain a `+`
16
- const encodedLogoPath = getImageKey(...pathComponents.map(encodeURIComponent));
17
- return `https://${FILES_HOST}/${encodedLogoPath}`;
13
+ return getImageKey(...pathComponents.map(encodeURIComponent));
18
14
  }
19
15
  catch {
20
16
  return;
21
17
  }
22
18
  }, {
23
- cacheKey: 'getLogoUrl',
19
+ cacheKey: '$getLogoUrl',
24
20
  undefinedAs: false,
25
21
  promise: true,
26
22
  primitive: true,
27
23
  preFetch: true,
28
24
  maxAge: BUILD_PROPERTY_CACHE_TIMEOUT,
29
25
  }, { useVersion: false });
26
+ export const getLogoUrl = async (normalizedSlug, buildId) => {
27
+ if (!FILES_HOST) {
28
+ return;
29
+ }
30
+ const encodedLogoPath = await $getLogoUrl(normalizedSlug, buildId);
31
+ if (!encodedLogoPath) {
32
+ return;
33
+ }
34
+ return `https://${FILES_HOST}/${encodedLogoPath}`;
35
+ };
30
36
  export const getDeviceTypeJson = multiCacheMemoizee(async (normalizedSlug, buildId) => {
31
37
  const isIgnored = await fileExists(getImageKey(normalizedSlug, buildId, 'IGNORE'));
32
38
  if (isIgnored) {
@@ -1 +1 @@
1
- {"version":3,"file":"build-info-facade.js","sourceRoot":"","sources":["../../../src/features/device-types/build-info-facade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIhE,OAAO,EACN,mCAAmC,EACnC,4BAA4B,EAC5B,UAAU,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,UAAU,EACV,OAAO,EACP,aAAa,EACb,WAAW,GACX,MAAM,oBAAoB,CAAC;AAE5B,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAC3C,KAAK,EACJ,cAAsB,EACtB,OAAe,EACe,EAAE;IAChC,IAAI,CAAC,UAAU,EAAE,CAAC;QACjB,OAAO;IACR,CAAC;IACD,MAAM,cAAc,GAAG,CAAC,cAAc,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAC7D,IAAI,CAAC;QACJ,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,cAAc,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,OAAO;QACR,CAAC;QAED,iDAAiD;QACjD,MAAM,eAAe,GAAG,WAAW,CAClC,GAAG,cAAc,CAAC,GAAG,CAAC,kBAAkB,CAAC,CACzC,CAAC;QACF,OAAO,WAAW,UAAU,IAAI,eAAe,E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mB,EAAE;IAClE,OAAO,MAAM,aAAa,CACzB,WAAW,CAAC,cAAc,EAAE,OAAO,EAAE,YAAY,CAAC,CAClD,CAAC;AACH,CAAC,EACD;IACC,QAAQ,EAAE,mBAAmB;IAC7B,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,mCAAmC;CAC3C,EACD,EAAE,UAAU,EAAE,KAAK,EAAE,CACrB,CAAC"}
1
+ {"version":3,"file":"build-info-facade.js","sourceRoot":"","sources":["../../../src/features/device-types/build-info-facade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIhE,OAAO,EACN,mCAAmC,EACnC,4BAA4B,EAC5B,UAAU,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,UAAU,EACV,OAAO,EACP,aAAa,EACb,WAAW,GACX,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,GAAG,kBAAkB,CACrC,KAAK,EACJ,cAAsB,EACtB,OAAe,EACe,EAAE;IAChC,MAAM,cAAc,GAAG,CAAC,cAAc,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAC7D,IAAI,CAAC;QACJ,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,cAAc,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,OAAO;QACR,CAAC;QAED,iDAAiD;QACjD,OAAO,WAAW,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACR,OAAO;IACR,CAAC;AACF,CAAC,EACD;IACC,QAAQ,EAAE,aAAa;IACvB,WAAW,EAAE,KAAK;IAClB,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,IAAI;IACd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,EAAE,UAAU,EAAE,KAAK,EAAE,CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,kBAAkB,CAClD,KAAK,EAAE,cAAsB,EAAE,OAAe,EAAmB,EAAE;IAClE,OAAO,MAAM,aAAa,CACzB,WAAW,CAAC,cAAc,EAAE,OAAO,EAAE,YAAY,CAAC,CAClD,CAAC;AACH,CAAC,EACD;IACC,QAAQ,EAAE,mBAAmB;IAC7B,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,mCAAmC;CAC3C,EACD,EAAE,UAAU,EAAE,KAAK,EAAE,CACrB,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": "30.0.11-build-get-write-context-58bd1e8c84c931f5fa90ddbfc01b7e13c16680b8-1",
4
+ "version": "30.0.11",
5
5
  "license": "AGPL-3.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -167,6 +167,6 @@
167
167
  "loader": "ts-node/esm/transpile-only"
168
168
  },
169
169
  "versionist": {
170
- "publishedAt": "2024-10-21T16:11:34.250Z"
170
+ "publishedAt": "2024-10-21T16:17:23.780Z"
171
171
  }
172
172
  }