@balena/open-balena-api 43.3.8-build-renovate-valkey-valkey-9-x-09ec873469246518f6faefcb7e24df914aab12e7-1 → 43.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/balena-init.sql +2 -0
- package/dist/balena-model.d.ts +5 -0
- package/dist/balena.sbvr +5 -0
- package/dist/features/device-state/routes/state-get-v3.d.ts +187 -37
- package/dist/features/device-state/routes/state-get-v3.js +38 -1
- package/dist/features/device-state/routes/state-get-v3.js.map +1 -1
- package/dist/migrations/00109-add-application-is-updated-by-application.sql +25 -0
- package/package.json +2 -2
package/dist/balena-init.sql
CHANGED
|
@@ -44,6 +44,8 @@ CREATE INDEX IF NOT EXISTS "application_organization_idx"
|
|
|
44
44
|
ON "application" ("organization");
|
|
45
45
|
CREATE INDEX IF NOT EXISTS "application_release_idx"
|
|
46
46
|
ON "application" ("should be running-release");
|
|
47
|
+
CREATE INDEX IF NOT EXISTS "application_is_updated_by_application_idx"
|
|
48
|
+
ON "application" ("is updated by-application");
|
|
47
49
|
CREATE INDEX IF NOT EXISTS "application_application_type_idx"
|
|
48
50
|
ON "application" ("application type");
|
|
49
51
|
|
package/dist/balena-model.d.ts
CHANGED
|
@@ -513,6 +513,9 @@ export interface Application {
|
|
|
513
513
|
is_archived: Types['Boolean']['Read'];
|
|
514
514
|
uuid: Types['Text']['Read'];
|
|
515
515
|
is_public: Types['Boolean']['Read'];
|
|
516
|
+
is_updated_by__application: {
|
|
517
|
+
__id: Application['Read']['id'];
|
|
518
|
+
} | [Application['Read']] | [] | null;
|
|
516
519
|
application__has__env_var_name?: Array<ApplicationEnvironmentVariable['Read']>;
|
|
517
520
|
application_environment_variable?: Array<ApplicationEnvironmentVariable['Read']>;
|
|
518
521
|
application__has__config_var_name?: Array<ApplicationConfigVariable['Read']>;
|
|
@@ -521,6 +524,7 @@ export interface Application {
|
|
|
521
524
|
service?: Array<Service['Read']>;
|
|
522
525
|
application__has__tag_key?: Array<ApplicationTag['Read']>;
|
|
523
526
|
application_tag?: Array<ApplicationTag['Read']>;
|
|
527
|
+
updates__application?: Array<Application['Read']>;
|
|
524
528
|
owns__device?: Array<Device['Read']>;
|
|
525
529
|
owns__release?: Array<Release['Read']>;
|
|
526
530
|
is_directly_accessible_by__user?: Array<UserHasDirectAccessToApplication['Read']>;
|
|
@@ -542,6 +546,7 @@ export interface Application {
|
|
|
542
546
|
is_archived: Types['Boolean']['Write'];
|
|
543
547
|
uuid: Types['Text']['Write'];
|
|
544
548
|
is_public: Types['Boolean']['Write'];
|
|
549
|
+
is_updated_by__application: Application['Write']['id'] | null;
|
|
545
550
|
};
|
|
546
551
|
}
|
|
547
552
|
export interface ApplicationEnvironmentVariable {
|
package/dist/balena.sbvr
CHANGED
|
@@ -520,6 +520,9 @@ Fact type: application has uuid
|
|
|
520
520
|
Necessity: each uuid is of exactly one application.
|
|
521
521
|
Necessity: each application has a uuid that has a Length (Type) that is equal to 32.
|
|
522
522
|
Fact type: application is public
|
|
523
|
+
Fact type: application is updated by application1
|
|
524
|
+
Synonymous Form: application1 updates application
|
|
525
|
+
Necessity: each application is updated by at most one application.
|
|
523
526
|
|
|
524
527
|
-- service instance
|
|
525
528
|
|
|
@@ -998,3 +1001,5 @@ Rule: It is necessary that each release that should operate a device that is of
|
|
|
998
1001
|
Rule: It is necessary that each release that should manage a device, has a status that is equal to "success" and has a semver major that is greater than 0 or has a semver minor that is greater than 0 or has a semver patch that is greater than 0.
|
|
999
1002
|
-- The first part of this rule is meant to prevent accidentally setting a host extension as a supervisor (i.e., another public + non-host app)
|
|
1000
1003
|
Rule: It is necessary that each release that should manage a device that is of a device type1, belongs to an application that is public and is not host and has a slug that is equal to "balena_os/aarch64-supervisor" or "balena_os/amd64-supervisor" or "balena_os/armv7hf-supervisor" or "balena_os/i386-supervisor" or "balena_os/i386-nlp-supervisor" or "balena_os/rpi-supervisor" and is for a device type2 that is of a cpu architecture that is supported by the device type1.
|
|
1004
|
+
Rule: It is necessary that each application that is not host, is updated by no application.
|
|
1005
|
+
Rule: It is necessary that each application that is of a class that is not equal to "block", updates no application.
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import type { RequestHandler } from 'express';
|
|
2
|
-
import type { OptionsToResponse } from 'pinejs-client-core';
|
|
3
|
-
import type { Application } from '../../../balena-model.js';
|
|
4
2
|
import type { ExpandedApplicationWithService } from './fleet-state-get-v3.js';
|
|
5
3
|
type LocalStateApp = StateV3[string]['apps'][string];
|
|
6
4
|
type ServiceComposition = AnyObject;
|
|
7
5
|
type ExpandedDevice = Awaited<ReturnType<typeof getDevice>>;
|
|
8
|
-
type ExpandedApplication =
|
|
9
|
-
$select: typeof appSelect;
|
|
10
|
-
$expand: typeof appExpand;
|
|
11
|
-
}, number>>;
|
|
6
|
+
type ExpandedApplication = ExpandedDevice['belongs_to__application'][number] | ExpandedDevice['should_be_managed_by__release' | 'should_be_operated_by__release'][number]['belongs_to__application'][number];
|
|
12
7
|
type TargetReleaseField = 'should_be_running__release' | 'should_be_managed_by__release' | 'should_be_operated_by__release';
|
|
13
8
|
export type ExpandedRelease = ExpandedDevice[TargetReleaseField][number];
|
|
14
9
|
export type StateV3 = {
|
|
@@ -99,12 +94,6 @@ export declare const releaseExpand: {
|
|
|
99
94
|
};
|
|
100
95
|
};
|
|
101
96
|
};
|
|
102
|
-
declare const appSelect: readonly ["id", "uuid", "app_name", "is_host", "is_of__class"];
|
|
103
|
-
declare const appExpand: {
|
|
104
|
-
readonly application_environment_variable: {
|
|
105
|
-
readonly $select: readonly ["name", "value"];
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
97
|
export declare const stateV3: RequestHandler;
|
|
109
98
|
declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.js").PermissionReq, uuid: string) => Promise<import("@balena/abstract-sql-to-typescript").PickDeferred<{
|
|
110
99
|
created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
@@ -123,8 +112,8 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
123
112
|
__id: import("../../../balena-model.js").DeviceType["Read"]["id"];
|
|
124
113
|
} | [import("../../../balena-model.js").DeviceType["Read"]];
|
|
125
114
|
belongs_to__application: {
|
|
126
|
-
__id: Application["Read"]["id"];
|
|
127
|
-
} | [Application["Read"]] | [] | null;
|
|
115
|
+
__id: import("../../../balena-model.js").Application["Read"]["id"];
|
|
116
|
+
} | [import("../../../balena-model.js").Application["Read"]] | [] | null;
|
|
128
117
|
is_online: import("@balena/sbvr-types").Types["Boolean"]["Read"];
|
|
129
118
|
last_connectivity_event: import("@balena/sbvr-types").Types["Date Time"]["Read"] | null;
|
|
130
119
|
is_connected_to_vpn: import("@balena/sbvr-types").Types["Boolean"]["Read"];
|
|
@@ -266,6 +255,9 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
266
255
|
is_archived: import("@balena/sbvr-types").Types["Boolean"]["Read"];
|
|
267
256
|
uuid: import("@balena/sbvr-types").Types["Text"]["Read"];
|
|
268
257
|
is_public: import("@balena/sbvr-types").Types["Boolean"]["Read"];
|
|
258
|
+
is_updated_by__application: {
|
|
259
|
+
__id: import("../../../balena-model.js").Application["Read"]["id"];
|
|
260
|
+
} | [import("../../../balena-model.js").Application["Read"]] | [] | null;
|
|
269
261
|
application__has__env_var_name?: Array<import("../../../balena-model.js").ApplicationEnvironmentVariable["Read"]>;
|
|
270
262
|
application_environment_variable?: Array<import("../../../balena-model.js").ApplicationEnvironmentVariable["Read"]>;
|
|
271
263
|
application__has__config_var_name?: Array<import("../../../balena-model.js").ApplicationConfigVariable["Read"]>;
|
|
@@ -274,6 +266,7 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
274
266
|
service?: Array<import("../../../balena-model.js").Service["Read"]>;
|
|
275
267
|
application__has__tag_key?: Array<import("../../../balena-model.js").ApplicationTag["Read"]>;
|
|
276
268
|
application_tag?: Array<import("../../../balena-model.js").ApplicationTag["Read"]>;
|
|
269
|
+
updates__application?: Array<import("../../../balena-model.js").Application["Read"]>;
|
|
277
270
|
owns__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
278
271
|
owns__release?: Array<import("../../../balena-model.js").Release["Read"]>;
|
|
279
272
|
is_directly_accessible_by__user?: Array<import("../../../balena-model.js").UserHasDirectAccessToApplication["Read"]>;
|
|
@@ -282,8 +275,8 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
282
275
|
created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
283
276
|
modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
284
277
|
application: {
|
|
285
|
-
__id: Application["Read"]["id"];
|
|
286
|
-
} | [Application["Read"]];
|
|
278
|
+
__id: import("../../../balena-model.js").Application["Read"]["id"];
|
|
279
|
+
} | [import("../../../balena-model.js").Application["Read"]];
|
|
287
280
|
name: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
288
281
|
id: import("@balena/sbvr-types").Types["Serial"]["Read"];
|
|
289
282
|
value: import("@balena/sbvr-types").Types["Text"]["Read"];
|
|
@@ -292,8 +285,8 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
292
285
|
created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
293
286
|
modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
294
287
|
application: {
|
|
295
|
-
__id: Application["Read"]["id"];
|
|
296
|
-
} | [Application["Read"]];
|
|
288
|
+
__id: import("../../../balena-model.js").Application["Read"]["id"];
|
|
289
|
+
} | [import("../../../balena-model.js").Application["Read"]];
|
|
297
290
|
name: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
298
291
|
id: import("@balena/sbvr-types").Types["Serial"]["Read"];
|
|
299
292
|
value: import("@balena/sbvr-types").Types["Text"]["Read"];
|
|
@@ -304,8 +297,8 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
304
297
|
modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
305
298
|
id: import("@balena/sbvr-types").Types["Serial"]["Read"];
|
|
306
299
|
belongs_to__application: {
|
|
307
|
-
__id: Application["Read"]["id"];
|
|
308
|
-
} | [Application["Read"]];
|
|
300
|
+
__id: import("../../../balena-model.js").Application["Read"]["id"];
|
|
301
|
+
} | [import("../../../balena-model.js").Application["Read"]];
|
|
309
302
|
commit: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
310
303
|
composition: import("@balena/sbvr-types").Types["JSON"]["Read"];
|
|
311
304
|
status: "running" | "success" | "failed" | "error" | "cancelled" | "interrupted";
|
|
@@ -341,7 +334,7 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
341
334
|
image__is_part_of__release?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
|
|
342
335
|
release_image?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
|
|
343
336
|
contains__image?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
|
|
344
|
-
should_be_running_on__application?: Array<Application["Read"]>;
|
|
337
|
+
should_be_running_on__application?: Array<import("../../../balena-model.js").Application["Read"]>;
|
|
345
338
|
should_be_running_on__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
346
339
|
is_running_on__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
347
340
|
is_pinned_to__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
@@ -406,8 +399,8 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
406
399
|
created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
407
400
|
modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
408
401
|
application: {
|
|
409
|
-
__id: Application["Read"]["id"];
|
|
410
|
-
} | [Application["Read"]];
|
|
402
|
+
__id: import("../../../balena-model.js").Application["Read"]["id"];
|
|
403
|
+
} | [import("../../../balena-model.js").Application["Read"]];
|
|
411
404
|
service_name: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
412
405
|
id: import("@balena/sbvr-types").Types["Serial"]["Read"];
|
|
413
406
|
application__has__service_name__has__label_name?: Array<import("../../../balena-model.js").ServiceLabel["Read"]>;
|
|
@@ -487,8 +480,8 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
487
480
|
modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
488
481
|
id: import("@balena/sbvr-types").Types["Serial"]["Read"];
|
|
489
482
|
belongs_to__application: {
|
|
490
|
-
__id: Application["Read"]["id"];
|
|
491
|
-
} | [Application["Read"]];
|
|
483
|
+
__id: import("../../../balena-model.js").Application["Read"]["id"];
|
|
484
|
+
} | [import("../../../balena-model.js").Application["Read"]];
|
|
492
485
|
commit: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
493
486
|
composition: import("@balena/sbvr-types").Types["JSON"]["Read"];
|
|
494
487
|
status: "running" | "success" | "failed" | "error" | "cancelled" | "interrupted";
|
|
@@ -524,7 +517,7 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
524
517
|
image__is_part_of__release?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
|
|
525
518
|
release_image?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
|
|
526
519
|
contains__image?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
|
|
527
|
-
should_be_running_on__application?: Array<Application["Read"]>;
|
|
520
|
+
should_be_running_on__application?: Array<import("../../../balena-model.js").Application["Read"]>;
|
|
528
521
|
should_be_running_on__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
529
522
|
is_running_on__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
530
523
|
is_pinned_to__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
@@ -589,8 +582,8 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
589
582
|
created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
590
583
|
modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
591
584
|
application: {
|
|
592
|
-
__id: Application["Read"]["id"];
|
|
593
|
-
} | [Application["Read"]];
|
|
585
|
+
__id: import("../../../balena-model.js").Application["Read"]["id"];
|
|
586
|
+
} | [import("../../../balena-model.js").Application["Read"]];
|
|
594
587
|
service_name: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
595
588
|
id: import("@balena/sbvr-types").Types["Serial"]["Read"];
|
|
596
589
|
application__has__service_name__has__label_name?: Array<import("../../../balena-model.js").ServiceLabel["Read"]>;
|
|
@@ -691,6 +684,9 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
691
684
|
is_archived: import("@balena/sbvr-types").Types["Boolean"]["Read"];
|
|
692
685
|
uuid: import("@balena/sbvr-types").Types["Text"]["Read"];
|
|
693
686
|
is_public: import("@balena/sbvr-types").Types["Boolean"]["Read"];
|
|
687
|
+
is_updated_by__application: {
|
|
688
|
+
__id: import("../../../balena-model.js").Application["Read"]["id"];
|
|
689
|
+
} | [import("../../../balena-model.js").Application["Read"]] | [] | null;
|
|
694
690
|
application__has__env_var_name?: Array<import("../../../balena-model.js").ApplicationEnvironmentVariable["Read"]>;
|
|
695
691
|
application_environment_variable?: Array<import("../../../balena-model.js").ApplicationEnvironmentVariable["Read"]>;
|
|
696
692
|
application__has__config_var_name?: Array<import("../../../balena-model.js").ApplicationConfigVariable["Read"]>;
|
|
@@ -699,6 +695,7 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
699
695
|
service?: Array<import("../../../balena-model.js").Service["Read"]>;
|
|
700
696
|
application__has__tag_key?: Array<import("../../../balena-model.js").ApplicationTag["Read"]>;
|
|
701
697
|
application_tag?: Array<import("../../../balena-model.js").ApplicationTag["Read"]>;
|
|
698
|
+
updates__application?: Array<import("../../../balena-model.js").Application["Read"]>;
|
|
702
699
|
owns__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
703
700
|
owns__release?: Array<import("../../../balena-model.js").Release["Read"]>;
|
|
704
701
|
is_directly_accessible_by__user?: Array<import("../../../balena-model.js").UserHasDirectAccessToApplication["Read"]>;
|
|
@@ -707,12 +704,161 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
707
704
|
created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
708
705
|
modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
709
706
|
application: {
|
|
710
|
-
__id: Application["Read"]["id"];
|
|
711
|
-
} | [Application["Read"]];
|
|
707
|
+
__id: import("../../../balena-model.js").Application["Read"]["id"];
|
|
708
|
+
} | [import("../../../balena-model.js").Application["Read"]];
|
|
712
709
|
name: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
713
710
|
id: import("@balena/sbvr-types").Types["Serial"]["Read"];
|
|
714
711
|
value: import("@balena/sbvr-types").Types["Text"]["Read"];
|
|
715
712
|
}, "name" | "value">[];
|
|
713
|
+
is_updated_by__application: (import("@balena/abstract-sql-to-typescript").PickDeferred<{
|
|
714
|
+
created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
715
|
+
modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
716
|
+
id: import("@balena/sbvr-types").Types["Serial"]["Read"];
|
|
717
|
+
actor: {
|
|
718
|
+
__id: import("../../../balena-model.js").Actor["Read"]["id"];
|
|
719
|
+
} | [import("../../../balena-model.js").Actor["Read"]];
|
|
720
|
+
should_track_latest_release: import("@balena/sbvr-types").Types["Boolean"]["Read"];
|
|
721
|
+
is_of__class: "fleet" | "block" | "app";
|
|
722
|
+
organization: {
|
|
723
|
+
__id: import("../../../balena-model.js").Organization["Read"]["id"];
|
|
724
|
+
} | [import("../../../balena-model.js").Organization["Read"]];
|
|
725
|
+
app_name: import("@balena/sbvr-types").Types["Text"]["Read"];
|
|
726
|
+
slug: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
727
|
+
is_for__device_type: {
|
|
728
|
+
__id: import("../../../balena-model.js").DeviceType["Read"]["id"];
|
|
729
|
+
} | [import("../../../balena-model.js").DeviceType["Read"]];
|
|
730
|
+
should_be_running__release: {
|
|
731
|
+
__id: import("../../../balena-model.js").Release["Read"]["id"];
|
|
732
|
+
} | [import("../../../balena-model.js").Release["Read"]] | [] | null;
|
|
733
|
+
application_type: {
|
|
734
|
+
__id: import("../../../balena-model.js").ApplicationType["Read"]["id"];
|
|
735
|
+
} | [import("../../../balena-model.js").ApplicationType["Read"]];
|
|
736
|
+
is_host: import("@balena/sbvr-types").Types["Boolean"]["Read"];
|
|
737
|
+
is_archived: import("@balena/sbvr-types").Types["Boolean"]["Read"];
|
|
738
|
+
uuid: import("@balena/sbvr-types").Types["Text"]["Read"];
|
|
739
|
+
is_public: import("@balena/sbvr-types").Types["Boolean"]["Read"];
|
|
740
|
+
is_updated_by__application: {
|
|
741
|
+
__id: import("../../../balena-model.js").Application["Read"]["id"];
|
|
742
|
+
} | [import("../../../balena-model.js").Application["Read"]] | [] | null;
|
|
743
|
+
application__has__env_var_name?: Array<import("../../../balena-model.js").ApplicationEnvironmentVariable["Read"]>;
|
|
744
|
+
application_environment_variable?: Array<import("../../../balena-model.js").ApplicationEnvironmentVariable["Read"]>;
|
|
745
|
+
application__has__config_var_name?: Array<import("../../../balena-model.js").ApplicationConfigVariable["Read"]>;
|
|
746
|
+
application_config_variable?: Array<import("../../../balena-model.js").ApplicationConfigVariable["Read"]>;
|
|
747
|
+
application__has__service_name?: Array<import("../../../balena-model.js").Service["Read"]>;
|
|
748
|
+
service?: Array<import("../../../balena-model.js").Service["Read"]>;
|
|
749
|
+
application__has__tag_key?: Array<import("../../../balena-model.js").ApplicationTag["Read"]>;
|
|
750
|
+
application_tag?: Array<import("../../../balena-model.js").ApplicationTag["Read"]>;
|
|
751
|
+
updates__application?: Array<import("../../../balena-model.js").Application["Read"]>;
|
|
752
|
+
owns__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
753
|
+
owns__release?: Array<import("../../../balena-model.js").Release["Read"]>;
|
|
754
|
+
is_directly_accessible_by__user?: Array<import("../../../balena-model.js").UserHasDirectAccessToApplication["Read"]>;
|
|
755
|
+
}, "id"> & {
|
|
756
|
+
should_be_running__release: (import("@balena/abstract-sql-to-typescript").PickDeferred<{
|
|
757
|
+
created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
758
|
+
modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
759
|
+
id: import("@balena/sbvr-types").Types["Serial"]["Read"];
|
|
760
|
+
belongs_to__application: {
|
|
761
|
+
__id: import("../../../balena-model.js").Application["Read"]["id"];
|
|
762
|
+
} | [import("../../../balena-model.js").Application["Read"]];
|
|
763
|
+
commit: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
764
|
+
composition: import("@balena/sbvr-types").Types["JSON"]["Read"];
|
|
765
|
+
status: "running" | "success" | "failed" | "error" | "cancelled" | "interrupted";
|
|
766
|
+
source: "cloud" | "local";
|
|
767
|
+
build_log: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
|
|
768
|
+
is_invalidated: import("@balena/sbvr-types").Types["Boolean"]["Read"];
|
|
769
|
+
start_timestamp: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
770
|
+
end_timestamp: import("@balena/sbvr-types").Types["Date Time"]["Read"] | null;
|
|
771
|
+
update_timestamp: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
772
|
+
release_version: import("@balena/sbvr-types").Types["Short Text"]["Read"] | null;
|
|
773
|
+
contract: import("@balena/sbvr-types").Types["JSON"]["Read"] | null;
|
|
774
|
+
is_passing_tests: import("@balena/sbvr-types").Types["Boolean"]["Read"];
|
|
775
|
+
is_finalized_at__date: import("@balena/sbvr-types").Types["Date Time"]["Read"] | null;
|
|
776
|
+
phase: "next" | "current" | "sunset" | "end-of-life" | null;
|
|
777
|
+
semver_major: import("@balena/sbvr-types").Types["Integer"]["Read"];
|
|
778
|
+
semver_minor: import("@balena/sbvr-types").Types["Integer"]["Read"];
|
|
779
|
+
semver_patch: import("@balena/sbvr-types").Types["Integer"]["Read"];
|
|
780
|
+
semver_prerelease: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
781
|
+
semver_build: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
782
|
+
variant: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
783
|
+
revision: import("@balena/sbvr-types").Types["Integer"]["Read"] | null;
|
|
784
|
+
known_issue_list: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
|
|
785
|
+
note: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
|
|
786
|
+
invalidation_reason: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
|
|
787
|
+
is_final: import("@balena/sbvr-types").Types["Boolean"]["Read"];
|
|
788
|
+
semver: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
789
|
+
raw_version: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
790
|
+
version: import("@balena/sbvr-types").Types["JSON"]["Read"];
|
|
791
|
+
release__has__tag_key?: Array<import("../../../balena-model.js").ReleaseTag["Read"]>;
|
|
792
|
+
release_tag?: Array<import("../../../balena-model.js").ReleaseTag["Read"]>;
|
|
793
|
+
release__has__asset_key?: Array<import("../../../balena-model.js").ReleaseAsset["Read"]>;
|
|
794
|
+
release_asset?: Array<import("../../../balena-model.js").ReleaseAsset["Read"]>;
|
|
795
|
+
image__is_part_of__release?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
|
|
796
|
+
release_image?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
|
|
797
|
+
contains__image?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
|
|
798
|
+
should_be_running_on__application?: Array<import("../../../balena-model.js").Application["Read"]>;
|
|
799
|
+
should_be_running_on__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
800
|
+
is_running_on__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
801
|
+
is_pinned_to__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
802
|
+
should_operate__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
803
|
+
should_manage__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
804
|
+
provides__device__installs__image?: Array<import("../../../balena-model.js").ImageInstall["Read"]>;
|
|
805
|
+
provides__image_install?: Array<import("../../../balena-model.js").ImageInstall["Read"]>;
|
|
806
|
+
}, "id"> & {
|
|
807
|
+
release_image: (import("@balena/abstract-sql-to-typescript").PickDeferred<{
|
|
808
|
+
created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
809
|
+
modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
810
|
+
image: {
|
|
811
|
+
__id: import("../../../balena-model.js").Image["Read"]["id"];
|
|
812
|
+
} | [import("../../../balena-model.js").Image["Read"]];
|
|
813
|
+
is_part_of__release: {
|
|
814
|
+
__id: import("../../../balena-model.js").Release["Read"]["id"];
|
|
815
|
+
} | [import("../../../balena-model.js").Release["Read"]];
|
|
816
|
+
id: import("@balena/sbvr-types").Types["Serial"]["Read"];
|
|
817
|
+
image__is_part_of__release__has__label_name?: Array<import("../../../balena-model.js").ImageLabel["Read"]>;
|
|
818
|
+
release_image__has__label_name?: Array<import("../../../balena-model.js").ImageLabel["Read"]>;
|
|
819
|
+
image_label?: Array<import("../../../balena-model.js").ImageLabel["Read"]>;
|
|
820
|
+
image__is_part_of__release__has__name?: Array<import("../../../balena-model.js").ImageEnvironmentVariable["Read"]>;
|
|
821
|
+
release_image__has__name?: Array<import("../../../balena-model.js").ImageEnvironmentVariable["Read"]>;
|
|
822
|
+
image_environment_variable?: Array<import("../../../balena-model.js").ImageEnvironmentVariable["Read"]>;
|
|
823
|
+
release: {
|
|
824
|
+
__id: import("../../../balena-model.js").Release["Read"]["id"];
|
|
825
|
+
} | [import("../../../balena-model.js").Release["Read"]];
|
|
826
|
+
contains__image: {
|
|
827
|
+
__id: import("../../../balena-model.js").Image["Read"]["id"];
|
|
828
|
+
} | [import("../../../balena-model.js").Image["Read"]];
|
|
829
|
+
}, "id"> & {
|
|
830
|
+
image: import("@balena/abstract-sql-to-typescript").PickDeferred<{
|
|
831
|
+
created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
832
|
+
modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
833
|
+
id: import("@balena/sbvr-types").Types["Serial"]["Read"];
|
|
834
|
+
start_timestamp: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
835
|
+
end_timestamp: import("@balena/sbvr-types").Types["Date Time"]["Read"] | null;
|
|
836
|
+
dockerfile: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
|
|
837
|
+
is_a_build_of__service: {
|
|
838
|
+
__id: import("../../../balena-model.js").Service["Read"]["id"];
|
|
839
|
+
} | [import("../../../balena-model.js").Service["Read"]];
|
|
840
|
+
image_size: import("@balena/sbvr-types").Types["Big Integer"]["Read"] | null;
|
|
841
|
+
is_stored_at__image_location: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
842
|
+
project_type: "Standard Dockerfile" | "project type unavailable" | "NodeJS" | "node.js" | "local deploy" | "external service" | "Dockerfile.template" | "dockerfile template" | "dockerfile" | "Could not be detected" | "Architecture-specific Dockerfile" | "Archicture-specific Dockerfile" | null;
|
|
843
|
+
error_message: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
|
|
844
|
+
build_log: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
|
|
845
|
+
push_timestamp: import("@balena/sbvr-types").Types["Date Time"]["Read"] | null;
|
|
846
|
+
status: "running" | "success" | "failed" | "error" | "cancelled" | "interrupted";
|
|
847
|
+
content_hash: import("@balena/sbvr-types").Types["Short Text"]["Read"] | null;
|
|
848
|
+
contract: import("@balena/sbvr-types").Types["JSON"]["Read"] | null;
|
|
849
|
+
device__installs__image?: Array<import("../../../balena-model.js").ImageInstall["Read"]>;
|
|
850
|
+
image_install?: Array<import("../../../balena-model.js").ImageInstall["Read"]>;
|
|
851
|
+
is_installed_on__device?: Array<import("../../../balena-model.js").ImageInstall["Read"]>;
|
|
852
|
+
is_part_of__release?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
|
|
853
|
+
image__is_part_of__release?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
|
|
854
|
+
release_image?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
|
|
855
|
+
is_a_build_of__application__has__service_name: {
|
|
856
|
+
__id: import("../../../balena-model.js").Service["Read"]["id"];
|
|
857
|
+
} | [import("../../../balena-model.js").Service["Read"]];
|
|
858
|
+
}, "is_stored_at__image_location" | "content_hash">[];
|
|
859
|
+
})[];
|
|
860
|
+
})[];
|
|
861
|
+
})[];
|
|
716
862
|
})[];
|
|
717
863
|
})[];
|
|
718
864
|
should_be_managed_by__release: (import("@balena/abstract-sql-to-typescript").PickDeferred<{
|
|
@@ -720,8 +866,8 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
720
866
|
modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
721
867
|
id: import("@balena/sbvr-types").Types["Serial"]["Read"];
|
|
722
868
|
belongs_to__application: {
|
|
723
|
-
__id: Application["Read"]["id"];
|
|
724
|
-
} | [Application["Read"]];
|
|
869
|
+
__id: import("../../../balena-model.js").Application["Read"]["id"];
|
|
870
|
+
} | [import("../../../balena-model.js").Application["Read"]];
|
|
725
871
|
commit: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
726
872
|
composition: import("@balena/sbvr-types").Types["JSON"]["Read"];
|
|
727
873
|
status: "running" | "success" | "failed" | "error" | "cancelled" | "interrupted";
|
|
@@ -757,7 +903,7 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
757
903
|
image__is_part_of__release?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
|
|
758
904
|
release_image?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
|
|
759
905
|
contains__image?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
|
|
760
|
-
should_be_running_on__application?: Array<Application["Read"]>;
|
|
906
|
+
should_be_running_on__application?: Array<import("../../../balena-model.js").Application["Read"]>;
|
|
761
907
|
should_be_running_on__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
762
908
|
is_running_on__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
763
909
|
is_pinned_to__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
@@ -822,8 +968,8 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
822
968
|
created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
823
969
|
modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
824
970
|
application: {
|
|
825
|
-
__id: Application["Read"]["id"];
|
|
826
|
-
} | [Application["Read"]];
|
|
971
|
+
__id: import("../../../balena-model.js").Application["Read"]["id"];
|
|
972
|
+
} | [import("../../../balena-model.js").Application["Read"]];
|
|
827
973
|
service_name: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
828
974
|
id: import("@balena/sbvr-types").Types["Serial"]["Read"];
|
|
829
975
|
application__has__service_name__has__label_name?: Array<import("../../../balena-model.js").ServiceLabel["Read"]>;
|
|
@@ -924,6 +1070,9 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
924
1070
|
is_archived: import("@balena/sbvr-types").Types["Boolean"]["Read"];
|
|
925
1071
|
uuid: import("@balena/sbvr-types").Types["Text"]["Read"];
|
|
926
1072
|
is_public: import("@balena/sbvr-types").Types["Boolean"]["Read"];
|
|
1073
|
+
is_updated_by__application: {
|
|
1074
|
+
__id: import("../../../balena-model.js").Application["Read"]["id"];
|
|
1075
|
+
} | [import("../../../balena-model.js").Application["Read"]] | [] | null;
|
|
927
1076
|
application__has__env_var_name?: Array<import("../../../balena-model.js").ApplicationEnvironmentVariable["Read"]>;
|
|
928
1077
|
application_environment_variable?: Array<import("../../../balena-model.js").ApplicationEnvironmentVariable["Read"]>;
|
|
929
1078
|
application__has__config_var_name?: Array<import("../../../balena-model.js").ApplicationConfigVariable["Read"]>;
|
|
@@ -932,6 +1081,7 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
932
1081
|
service?: Array<import("../../../balena-model.js").Service["Read"]>;
|
|
933
1082
|
application__has__tag_key?: Array<import("../../../balena-model.js").ApplicationTag["Read"]>;
|
|
934
1083
|
application_tag?: Array<import("../../../balena-model.js").ApplicationTag["Read"]>;
|
|
1084
|
+
updates__application?: Array<import("../../../balena-model.js").Application["Read"]>;
|
|
935
1085
|
owns__device?: Array<import("../../../balena-model.js").Device["Read"]>;
|
|
936
1086
|
owns__release?: Array<import("../../../balena-model.js").Release["Read"]>;
|
|
937
1087
|
is_directly_accessible_by__user?: Array<import("../../../balena-model.js").UserHasDirectAccessToApplication["Read"]>;
|
|
@@ -940,8 +1090,8 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j
|
|
|
940
1090
|
created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
941
1091
|
modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
|
|
942
1092
|
application: {
|
|
943
|
-
__id: Application["Read"]["id"];
|
|
944
|
-
} | [Application["Read"]];
|
|
1093
|
+
__id: import("../../../balena-model.js").Application["Read"]["id"];
|
|
1094
|
+
} | [import("../../../balena-model.js").Application["Read"]];
|
|
945
1095
|
name: import("@balena/sbvr-types").Types["Short Text"]["Read"];
|
|
946
1096
|
id: import("@balena/sbvr-types").Types["Serial"]["Read"];
|
|
947
1097
|
value: import("@balena/sbvr-types").Types["Text"]["Read"];
|
|
@@ -23,6 +23,17 @@ export function buildAppFromRelease(device, application, release, config, defaul
|
|
|
23
23
|
const dsevsById = device != null
|
|
24
24
|
? _.groupBy(device.device_service_environment_variable, ({ service }) => service.__id)
|
|
25
25
|
: {};
|
|
26
|
+
const updaterImage = 'is_updated_by__application' in application &&
|
|
27
|
+
application.is_updated_by__application != null &&
|
|
28
|
+
Array.isArray(application.is_updated_by__application)
|
|
29
|
+
? application.is_updated_by__application[0]?.should_be_running__release[0]
|
|
30
|
+
?.release_image[0]?.image[0]
|
|
31
|
+
: undefined;
|
|
32
|
+
const updaterImageRegistryUrl = updaterImage == null
|
|
33
|
+
? null
|
|
34
|
+
: `${updaterImage.is_stored_at__image_location}${updaterImage.content_hash != null
|
|
35
|
+
? `@${updaterImage.content_hash}`
|
|
36
|
+
: ''}`;
|
|
26
37
|
for (const ipr of release.release_image) {
|
|
27
38
|
const image = ipr.image[0];
|
|
28
39
|
const svc = image.is_a_build_of__service[0];
|
|
@@ -56,6 +67,9 @@ export function buildAppFromRelease(device, application, release, config, defaul
|
|
|
56
67
|
labels[labelName] = config[confName];
|
|
57
68
|
}
|
|
58
69
|
});
|
|
70
|
+
if (updaterImageRegistryUrl != null) {
|
|
71
|
+
labels['io.balena.private.updater'] = updaterImageRegistryUrl;
|
|
72
|
+
}
|
|
59
73
|
const imgRegistry = image.is_stored_at__image_location +
|
|
60
74
|
(image.content_hash != null ? `@${image.content_hash}` : '');
|
|
61
75
|
services[svc.service_name] = {
|
|
@@ -137,6 +151,26 @@ const appExpand = {
|
|
|
137
151
|
$select: ['name', 'value'],
|
|
138
152
|
},
|
|
139
153
|
};
|
|
154
|
+
const updaterBlockExpand = {
|
|
155
|
+
is_updated_by__application: {
|
|
156
|
+
$select: 'id',
|
|
157
|
+
$expand: {
|
|
158
|
+
should_be_running__release: {
|
|
159
|
+
$select: 'id',
|
|
160
|
+
$expand: {
|
|
161
|
+
release_image: {
|
|
162
|
+
$select: 'id',
|
|
163
|
+
$expand: {
|
|
164
|
+
image: {
|
|
165
|
+
$select: ['is_stored_at__image_location', 'content_hash'],
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
};
|
|
140
174
|
const deviceExpand = {
|
|
141
175
|
device_config_variable: {
|
|
142
176
|
$select: ['name', 'value'],
|
|
@@ -174,7 +208,10 @@ const deviceExpand = {
|
|
|
174
208
|
...releaseExpand.$expand,
|
|
175
209
|
belongs_to__application: {
|
|
176
210
|
$select: appSelect,
|
|
177
|
-
$expand:
|
|
211
|
+
$expand: {
|
|
212
|
+
...appExpand,
|
|
213
|
+
...updaterBlockExpand,
|
|
214
|
+
},
|
|
178
215
|
},
|
|
179
216
|
},
|
|
180
217
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-get-v3.js","sourceRoot":"","sources":["../../../../src/features/device-state/routes/state-get-v3.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EACN,gBAAgB,EAChB,gBAAgB,GAChB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,yBAAyB,EACzB,mBAAmB,EACnB,SAAS,EACT,qBAAqB,EACrB,6BAA6B,EAC7B,eAAe,EACf,aAAa,GACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"state-get-v3.js","sourceRoot":"","sources":["../../../../src/features/device-state/routes/state-get-v3.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EACN,gBAAgB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C,EAAE;YAClB,IAAI,EAAE,WAAW,CAAC,QAAQ;YAC1B,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,KAAK,EAAE,WAAW,CAAC,YAAY;YAC/B,GAAG,CAAC,OAAO,IAAI,IAAI,IAAI;gBACtB,QAAQ,EAAE,mBAAmB,CAC5B,MAAM,EACN,WAAW,EACX,OAAO,EACP,MAAM,EACN,aAAa,CACb;aACD,CAAC;SACF;KACD,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- Add the column if it does not exist
|
|
2
|
+
ALTER TABLE "application"
|
|
3
|
+
ADD COLUMN IF NOT EXISTS "is updated by-application" INTEGER NULL;
|
|
4
|
+
|
|
5
|
+
-- Add an index for optimization if it does not exist
|
|
6
|
+
CREATE INDEX IF NOT EXISTS "application_is_updated_by_application_idx"
|
|
7
|
+
ON "application" ("is updated by-application");
|
|
8
|
+
|
|
9
|
+
-- Check and add the foreign key constraint conditionally
|
|
10
|
+
DO $$
|
|
11
|
+
BEGIN
|
|
12
|
+
IF NOT EXISTS (
|
|
13
|
+
SELECT 1
|
|
14
|
+
FROM information_schema.table_constraints AS tc
|
|
15
|
+
JOIN information_schema.key_column_usage AS kcu ON tc.constraint_name = kcu.constraint_name
|
|
16
|
+
WHERE tc.constraint_type = 'FOREIGN KEY'
|
|
17
|
+
AND tc.table_schema = CURRENT_SCHEMA()
|
|
18
|
+
AND tc.table_name = 'application'
|
|
19
|
+
AND kcu.column_name = 'is updated by-application'
|
|
20
|
+
) THEN
|
|
21
|
+
ALTER TABLE "application"
|
|
22
|
+
ADD CONSTRAINT "application_is updated by-application_fkey" FOREIGN KEY ("is updated by-application") REFERENCES application ("id");
|
|
23
|
+
END IF;
|
|
24
|
+
END;
|
|
25
|
+
$$;
|
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": "43.
|
|
4
|
+
"version": "43.4.0",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -176,6 +176,6 @@
|
|
|
176
176
|
"import": "@swc-node/register/esm-register"
|
|
177
177
|
},
|
|
178
178
|
"versionist": {
|
|
179
|
-
"publishedAt": "2025-12-
|
|
179
|
+
"publishedAt": "2025-12-11T16:28:07.690Z"
|
|
180
180
|
}
|
|
181
181
|
}
|