@balena/open-balena-api 43.1.3-build-test-exact-hostApp-state-get-v3-fda46d1fcea18ddaddc6bf4c4bd75dad1d8f19bd-2 → 43.1.3-build-hostApp-updater-state-get-v3-0b070adb6736440897c6d54b43bf99d6a3dac68d-2
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 +7 -0
 - package/dist/features/device-state/routes/state-get-v3.d.ts +185 -1
 - package/dist/features/device-state/routes/state-get-v3.js +36 -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 +26 -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,13 @@ 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.
         
     | 
| 
      
 526 
     | 
    
         
            +
            	Necessity: each application that is updated by an application, is host.
         
     | 
| 
      
 527 
     | 
    
         
            +
            	Necessity: each application that updates an application, is of a class that is equal to "block"
         
     | 
| 
      
 528 
     | 
    
         
            +
            	Necessity: each application that is updated by an application, is host and is updated by an application that is of a class that is equal to "block".
         
     | 
| 
      
 529 
     | 
    
         
            +
            	Necessity: each application that updates an application, is of a class that is equal to "block" and updates an application that is host
         
     | 
| 
       523 
530 
     | 
    
         | 
| 
       524 
531 
     | 
    
         
             
            -- service instance
         
     | 
| 
       525 
532 
     | 
    
         | 
| 
         @@ -8,7 +8,10 @@ type ExpandedDevice = Awaited<ReturnType<typeof getDevice>>; 
     | 
|
| 
       8 
8 
     | 
    
         
             
            type ExpandedApplication = NonNullable<OptionsToResponse<Application['Read'], {
         
     | 
| 
       9 
9 
     | 
    
         
             
                $select: typeof appSelect;
         
     | 
| 
       10 
10 
     | 
    
         
             
                $expand: typeof appExpand;
         
     | 
| 
       11 
     | 
    
         
            -
            }, number 
     | 
| 
      
 11 
     | 
    
         
            +
            }, number>> & Partial<NonNullable<OptionsToResponse<Application['Read'], {
         
     | 
| 
      
 12 
     | 
    
         
            +
                $select: typeof appSelect;
         
     | 
| 
      
 13 
     | 
    
         
            +
                $expand: typeof appExpand & typeof updaterBlockExpand;
         
     | 
| 
      
 14 
     | 
    
         
            +
            }, number>>>;
         
     | 
| 
       12 
15 
     | 
    
         
             
            type TargetReleaseField = 'should_be_running__release' | 'should_be_managed_by__release' | 'should_be_operated_by__release';
         
     | 
| 
       13 
16 
     | 
    
         
             
            export type ExpandedRelease = ExpandedDevice[TargetReleaseField][number];
         
     | 
| 
       14 
17 
     | 
    
         
             
            export type StateV3 = {
         
     | 
| 
         @@ -105,6 +108,26 @@ declare const appExpand: { 
     | 
|
| 
       105 
108 
     | 
    
         
             
                    readonly $select: readonly ["name", "value"];
         
     | 
| 
       106 
109 
     | 
    
         
             
                };
         
     | 
| 
       107 
110 
     | 
    
         
             
            };
         
     | 
| 
      
 111 
     | 
    
         
            +
            declare const updaterBlockExpand: {
         
     | 
| 
      
 112 
     | 
    
         
            +
                readonly is_updated_by__application: {
         
     | 
| 
      
 113 
     | 
    
         
            +
                    readonly $select: "id";
         
     | 
| 
      
 114 
     | 
    
         
            +
                    readonly $expand: {
         
     | 
| 
      
 115 
     | 
    
         
            +
                        readonly should_be_running__release: {
         
     | 
| 
      
 116 
     | 
    
         
            +
                            readonly $select: "id";
         
     | 
| 
      
 117 
     | 
    
         
            +
                            readonly $expand: {
         
     | 
| 
      
 118 
     | 
    
         
            +
                                readonly release_image: {
         
     | 
| 
      
 119 
     | 
    
         
            +
                                    readonly $select: "id";
         
     | 
| 
      
 120 
     | 
    
         
            +
                                    readonly $expand: {
         
     | 
| 
      
 121 
     | 
    
         
            +
                                        readonly image: {
         
     | 
| 
      
 122 
     | 
    
         
            +
                                            readonly $select: readonly ["is_stored_at__image_location", "content_hash"];
         
     | 
| 
      
 123 
     | 
    
         
            +
                                        };
         
     | 
| 
      
 124 
     | 
    
         
            +
                                    };
         
     | 
| 
      
 125 
     | 
    
         
            +
                                };
         
     | 
| 
      
 126 
     | 
    
         
            +
                            };
         
     | 
| 
      
 127 
     | 
    
         
            +
                        };
         
     | 
| 
      
 128 
     | 
    
         
            +
                    };
         
     | 
| 
      
 129 
     | 
    
         
            +
                };
         
     | 
| 
      
 130 
     | 
    
         
            +
            };
         
     | 
| 
       108 
131 
     | 
    
         
             
            export declare const stateV3: RequestHandler;
         
     | 
| 
       109 
132 
     | 
    
         
             
            declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.js").PermissionReq, uuid: string) => Promise<import("@balena/abstract-sql-to-typescript").PickDeferred<{
         
     | 
| 
       110 
133 
     | 
    
         
             
                created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
         
     | 
| 
         @@ -266,6 +289,9 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j 
     | 
|
| 
       266 
289 
     | 
    
         
             
                    is_archived: import("@balena/sbvr-types").Types["Boolean"]["Read"];
         
     | 
| 
       267 
290 
     | 
    
         
             
                    uuid: import("@balena/sbvr-types").Types["Text"]["Read"];
         
     | 
| 
       268 
291 
     | 
    
         
             
                    is_public: import("@balena/sbvr-types").Types["Boolean"]["Read"];
         
     | 
| 
      
 292 
     | 
    
         
            +
                    is_updated_by__application: {
         
     | 
| 
      
 293 
     | 
    
         
            +
                        __id: Application["Read"]["id"];
         
     | 
| 
      
 294 
     | 
    
         
            +
                    } | [Application["Read"]] | [] | null;
         
     | 
| 
       269 
295 
     | 
    
         
             
                    application__has__env_var_name?: Array<import("../../../balena-model.js").ApplicationEnvironmentVariable["Read"]>;
         
     | 
| 
       270 
296 
     | 
    
         
             
                    application_environment_variable?: Array<import("../../../balena-model.js").ApplicationEnvironmentVariable["Read"]>;
         
     | 
| 
       271 
297 
     | 
    
         
             
                    application__has__config_var_name?: Array<import("../../../balena-model.js").ApplicationConfigVariable["Read"]>;
         
     | 
| 
         @@ -274,6 +300,7 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j 
     | 
|
| 
       274 
300 
     | 
    
         
             
                    service?: Array<import("../../../balena-model.js").Service["Read"]>;
         
     | 
| 
       275 
301 
     | 
    
         
             
                    application__has__tag_key?: Array<import("../../../balena-model.js").ApplicationTag["Read"]>;
         
     | 
| 
       276 
302 
     | 
    
         
             
                    application_tag?: Array<import("../../../balena-model.js").ApplicationTag["Read"]>;
         
     | 
| 
      
 303 
     | 
    
         
            +
                    updates__application?: Array<Application["Read"]>;
         
     | 
| 
       277 
304 
     | 
    
         
             
                    owns__device?: Array<import("../../../balena-model.js").Device["Read"]>;
         
     | 
| 
       278 
305 
     | 
    
         
             
                    owns__release?: Array<import("../../../balena-model.js").Release["Read"]>;
         
     | 
| 
       279 
306 
     | 
    
         
             
                    is_directly_accessible_by__user?: Array<import("../../../balena-model.js").UserHasDirectAccessToApplication["Read"]>;
         
     | 
| 
         @@ -691,6 +718,9 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j 
     | 
|
| 
       691 
718 
     | 
    
         
             
                        is_archived: import("@balena/sbvr-types").Types["Boolean"]["Read"];
         
     | 
| 
       692 
719 
     | 
    
         
             
                        uuid: import("@balena/sbvr-types").Types["Text"]["Read"];
         
     | 
| 
       693 
720 
     | 
    
         
             
                        is_public: import("@balena/sbvr-types").Types["Boolean"]["Read"];
         
     | 
| 
      
 721 
     | 
    
         
            +
                        is_updated_by__application: {
         
     | 
| 
      
 722 
     | 
    
         
            +
                            __id: Application["Read"]["id"];
         
     | 
| 
      
 723 
     | 
    
         
            +
                        } | [Application["Read"]] | [] | null;
         
     | 
| 
       694 
724 
     | 
    
         
             
                        application__has__env_var_name?: Array<import("../../../balena-model.js").ApplicationEnvironmentVariable["Read"]>;
         
     | 
| 
       695 
725 
     | 
    
         
             
                        application_environment_variable?: Array<import("../../../balena-model.js").ApplicationEnvironmentVariable["Read"]>;
         
     | 
| 
       696 
726 
     | 
    
         
             
                        application__has__config_var_name?: Array<import("../../../balena-model.js").ApplicationConfigVariable["Read"]>;
         
     | 
| 
         @@ -699,6 +729,7 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j 
     | 
|
| 
       699 
729 
     | 
    
         
             
                        service?: Array<import("../../../balena-model.js").Service["Read"]>;
         
     | 
| 
       700 
730 
     | 
    
         
             
                        application__has__tag_key?: Array<import("../../../balena-model.js").ApplicationTag["Read"]>;
         
     | 
| 
       701 
731 
     | 
    
         
             
                        application_tag?: Array<import("../../../balena-model.js").ApplicationTag["Read"]>;
         
     | 
| 
      
 732 
     | 
    
         
            +
                        updates__application?: Array<Application["Read"]>;
         
     | 
| 
       702 
733 
     | 
    
         
             
                        owns__device?: Array<import("../../../balena-model.js").Device["Read"]>;
         
     | 
| 
       703 
734 
     | 
    
         
             
                        owns__release?: Array<import("../../../balena-model.js").Release["Read"]>;
         
     | 
| 
       704 
735 
     | 
    
         
             
                        is_directly_accessible_by__user?: Array<import("../../../balena-model.js").UserHasDirectAccessToApplication["Read"]>;
         
     | 
| 
         @@ -713,6 +744,155 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j 
     | 
|
| 
       713 
744 
     | 
    
         
             
                            id: import("@balena/sbvr-types").Types["Serial"]["Read"];
         
     | 
| 
       714 
745 
     | 
    
         
             
                            value: import("@balena/sbvr-types").Types["Text"]["Read"];
         
     | 
| 
       715 
746 
     | 
    
         
             
                        }, "name" | "value">[];
         
     | 
| 
      
 747 
     | 
    
         
            +
                        is_updated_by__application: (import("@balena/abstract-sql-to-typescript").PickDeferred<{
         
     | 
| 
      
 748 
     | 
    
         
            +
                            created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
         
     | 
| 
      
 749 
     | 
    
         
            +
                            modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
         
     | 
| 
      
 750 
     | 
    
         
            +
                            id: import("@balena/sbvr-types").Types["Serial"]["Read"];
         
     | 
| 
      
 751 
     | 
    
         
            +
                            actor: {
         
     | 
| 
      
 752 
     | 
    
         
            +
                                __id: import("../../../balena-model.js").Actor["Read"]["id"];
         
     | 
| 
      
 753 
     | 
    
         
            +
                            } | [import("../../../balena-model.js").Actor["Read"]];
         
     | 
| 
      
 754 
     | 
    
         
            +
                            should_track_latest_release: import("@balena/sbvr-types").Types["Boolean"]["Read"];
         
     | 
| 
      
 755 
     | 
    
         
            +
                            is_of__class: "fleet" | "block" | "app";
         
     | 
| 
      
 756 
     | 
    
         
            +
                            organization: {
         
     | 
| 
      
 757 
     | 
    
         
            +
                                __id: import("../../../balena-model.js").Organization["Read"]["id"];
         
     | 
| 
      
 758 
     | 
    
         
            +
                            } | [import("../../../balena-model.js").Organization["Read"]];
         
     | 
| 
      
 759 
     | 
    
         
            +
                            app_name: import("@balena/sbvr-types").Types["Text"]["Read"];
         
     | 
| 
      
 760 
     | 
    
         
            +
                            slug: import("@balena/sbvr-types").Types["Short Text"]["Read"];
         
     | 
| 
      
 761 
     | 
    
         
            +
                            is_for__device_type: {
         
     | 
| 
      
 762 
     | 
    
         
            +
                                __id: import("../../../balena-model.js").DeviceType["Read"]["id"];
         
     | 
| 
      
 763 
     | 
    
         
            +
                            } | [import("../../../balena-model.js").DeviceType["Read"]];
         
     | 
| 
      
 764 
     | 
    
         
            +
                            should_be_running__release: {
         
     | 
| 
      
 765 
     | 
    
         
            +
                                __id: import("../../../balena-model.js").Release["Read"]["id"];
         
     | 
| 
      
 766 
     | 
    
         
            +
                            } | [import("../../../balena-model.js").Release["Read"]] | [] | null;
         
     | 
| 
      
 767 
     | 
    
         
            +
                            application_type: {
         
     | 
| 
      
 768 
     | 
    
         
            +
                                __id: import("../../../balena-model.js").ApplicationType["Read"]["id"];
         
     | 
| 
      
 769 
     | 
    
         
            +
                            } | [import("../../../balena-model.js").ApplicationType["Read"]];
         
     | 
| 
      
 770 
     | 
    
         
            +
                            is_host: import("@balena/sbvr-types").Types["Boolean"]["Read"];
         
     | 
| 
      
 771 
     | 
    
         
            +
                            is_archived: import("@balena/sbvr-types").Types["Boolean"]["Read"];
         
     | 
| 
      
 772 
     | 
    
         
            +
                            uuid: import("@balena/sbvr-types").Types["Text"]["Read"];
         
     | 
| 
      
 773 
     | 
    
         
            +
                            is_public: import("@balena/sbvr-types").Types["Boolean"]["Read"];
         
     | 
| 
      
 774 
     | 
    
         
            +
                            is_updated_by__application: {
         
     | 
| 
      
 775 
     | 
    
         
            +
                                __id: Application["Read"]["id"];
         
     | 
| 
      
 776 
     | 
    
         
            +
                            } | [Application["Read"]] | [] | null;
         
     | 
| 
      
 777 
     | 
    
         
            +
                            application__has__env_var_name?: Array<import("../../../balena-model.js").ApplicationEnvironmentVariable["Read"]>;
         
     | 
| 
      
 778 
     | 
    
         
            +
                            application_environment_variable?: Array<import("../../../balena-model.js").ApplicationEnvironmentVariable["Read"]>;
         
     | 
| 
      
 779 
     | 
    
         
            +
                            application__has__config_var_name?: Array<import("../../../balena-model.js").ApplicationConfigVariable["Read"]>;
         
     | 
| 
      
 780 
     | 
    
         
            +
                            application_config_variable?: Array<import("../../../balena-model.js").ApplicationConfigVariable["Read"]>;
         
     | 
| 
      
 781 
     | 
    
         
            +
                            application__has__service_name?: Array<import("../../../balena-model.js").Service["Read"]>;
         
     | 
| 
      
 782 
     | 
    
         
            +
                            service?: Array<import("../../../balena-model.js").Service["Read"]>;
         
     | 
| 
      
 783 
     | 
    
         
            +
                            application__has__tag_key?: Array<import("../../../balena-model.js").ApplicationTag["Read"]>;
         
     | 
| 
      
 784 
     | 
    
         
            +
                            application_tag?: Array<import("../../../balena-model.js").ApplicationTag["Read"]>;
         
     | 
| 
      
 785 
     | 
    
         
            +
                            updates__application?: Array<Application["Read"]>;
         
     | 
| 
      
 786 
     | 
    
         
            +
                            owns__device?: Array<import("../../../balena-model.js").Device["Read"]>;
         
     | 
| 
      
 787 
     | 
    
         
            +
                            owns__release?: Array<import("../../../balena-model.js").Release["Read"]>;
         
     | 
| 
      
 788 
     | 
    
         
            +
                            is_directly_accessible_by__user?: Array<import("../../../balena-model.js").UserHasDirectAccessToApplication["Read"]>;
         
     | 
| 
      
 789 
     | 
    
         
            +
                        }, "id"> & {
         
     | 
| 
      
 790 
     | 
    
         
            +
                            should_be_running__release: (import("@balena/abstract-sql-to-typescript").PickDeferred<{
         
     | 
| 
      
 791 
     | 
    
         
            +
                                created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
         
     | 
| 
      
 792 
     | 
    
         
            +
                                modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
         
     | 
| 
      
 793 
     | 
    
         
            +
                                id: import("@balena/sbvr-types").Types["Serial"]["Read"];
         
     | 
| 
      
 794 
     | 
    
         
            +
                                belongs_to__application: {
         
     | 
| 
      
 795 
     | 
    
         
            +
                                    __id: Application["Read"]["id"];
         
     | 
| 
      
 796 
     | 
    
         
            +
                                } | [Application["Read"]];
         
     | 
| 
      
 797 
     | 
    
         
            +
                                commit: import("@balena/sbvr-types").Types["Short Text"]["Read"];
         
     | 
| 
      
 798 
     | 
    
         
            +
                                composition: import("@balena/sbvr-types").Types["JSON"]["Read"];
         
     | 
| 
      
 799 
     | 
    
         
            +
                                status: "running" | "success" | "failed" | "error" | "cancelled" | "interrupted";
         
     | 
| 
      
 800 
     | 
    
         
            +
                                source: "cloud" | "local";
         
     | 
| 
      
 801 
     | 
    
         
            +
                                build_log: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
         
     | 
| 
      
 802 
     | 
    
         
            +
                                is_invalidated: import("@balena/sbvr-types").Types["Boolean"]["Read"];
         
     | 
| 
      
 803 
     | 
    
         
            +
                                start_timestamp: import("@balena/sbvr-types").Types["Date Time"]["Read"];
         
     | 
| 
      
 804 
     | 
    
         
            +
                                end_timestamp: import("@balena/sbvr-types").Types["Date Time"]["Read"] | null;
         
     | 
| 
      
 805 
     | 
    
         
            +
                                update_timestamp: import("@balena/sbvr-types").Types["Date Time"]["Read"];
         
     | 
| 
      
 806 
     | 
    
         
            +
                                release_version: import("@balena/sbvr-types").Types["Short Text"]["Read"] | null;
         
     | 
| 
      
 807 
     | 
    
         
            +
                                contract: import("@balena/sbvr-types").Types["JSON"]["Read"] | null;
         
     | 
| 
      
 808 
     | 
    
         
            +
                                is_passing_tests: import("@balena/sbvr-types").Types["Boolean"]["Read"];
         
     | 
| 
      
 809 
     | 
    
         
            +
                                is_finalized_at__date: import("@balena/sbvr-types").Types["Date Time"]["Read"] | null;
         
     | 
| 
      
 810 
     | 
    
         
            +
                                phase: "next" | "current" | "sunset" | "end-of-life" | null;
         
     | 
| 
      
 811 
     | 
    
         
            +
                                semver_major: import("@balena/sbvr-types").Types["Integer"]["Read"];
         
     | 
| 
      
 812 
     | 
    
         
            +
                                semver_minor: import("@balena/sbvr-types").Types["Integer"]["Read"];
         
     | 
| 
      
 813 
     | 
    
         
            +
                                semver_patch: import("@balena/sbvr-types").Types["Integer"]["Read"];
         
     | 
| 
      
 814 
     | 
    
         
            +
                                semver_prerelease: import("@balena/sbvr-types").Types["Short Text"]["Read"];
         
     | 
| 
      
 815 
     | 
    
         
            +
                                semver_build: import("@balena/sbvr-types").Types["Short Text"]["Read"];
         
     | 
| 
      
 816 
     | 
    
         
            +
                                variant: import("@balena/sbvr-types").Types["Short Text"]["Read"];
         
     | 
| 
      
 817 
     | 
    
         
            +
                                revision: import("@balena/sbvr-types").Types["Integer"]["Read"] | null;
         
     | 
| 
      
 818 
     | 
    
         
            +
                                known_issue_list: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
         
     | 
| 
      
 819 
     | 
    
         
            +
                                note: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
         
     | 
| 
      
 820 
     | 
    
         
            +
                                invalidation_reason: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
         
     | 
| 
      
 821 
     | 
    
         
            +
                                is_final: import("@balena/sbvr-types").Types["Boolean"]["Read"];
         
     | 
| 
      
 822 
     | 
    
         
            +
                                semver: import("@balena/sbvr-types").Types["Short Text"]["Read"];
         
     | 
| 
      
 823 
     | 
    
         
            +
                                raw_version: import("@balena/sbvr-types").Types["Short Text"]["Read"];
         
     | 
| 
      
 824 
     | 
    
         
            +
                                version: import("@balena/sbvr-types").Types["JSON"]["Read"];
         
     | 
| 
      
 825 
     | 
    
         
            +
                                release__has__tag_key?: Array<import("../../../balena-model.js").ReleaseTag["Read"]>;
         
     | 
| 
      
 826 
     | 
    
         
            +
                                release_tag?: Array<import("../../../balena-model.js").ReleaseTag["Read"]>;
         
     | 
| 
      
 827 
     | 
    
         
            +
                                release__has__asset_key?: Array<import("../../../balena-model.js").ReleaseAsset["Read"]>;
         
     | 
| 
      
 828 
     | 
    
         
            +
                                release_asset?: Array<import("../../../balena-model.js").ReleaseAsset["Read"]>;
         
     | 
| 
      
 829 
     | 
    
         
            +
                                image__is_part_of__release?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
         
     | 
| 
      
 830 
     | 
    
         
            +
                                release_image?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
         
     | 
| 
      
 831 
     | 
    
         
            +
                                contains__image?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
         
     | 
| 
      
 832 
     | 
    
         
            +
                                should_be_running_on__application?: Array<Application["Read"]>;
         
     | 
| 
      
 833 
     | 
    
         
            +
                                should_be_running_on__device?: Array<import("../../../balena-model.js").Device["Read"]>;
         
     | 
| 
      
 834 
     | 
    
         
            +
                                is_running_on__device?: Array<import("../../../balena-model.js").Device["Read"]>;
         
     | 
| 
      
 835 
     | 
    
         
            +
                                is_pinned_to__device?: Array<import("../../../balena-model.js").Device["Read"]>;
         
     | 
| 
      
 836 
     | 
    
         
            +
                                should_operate__device?: Array<import("../../../balena-model.js").Device["Read"]>;
         
     | 
| 
      
 837 
     | 
    
         
            +
                                should_manage__device?: Array<import("../../../balena-model.js").Device["Read"]>;
         
     | 
| 
      
 838 
     | 
    
         
            +
                                provides__device__installs__image?: Array<import("../../../balena-model.js").ImageInstall["Read"]>;
         
     | 
| 
      
 839 
     | 
    
         
            +
                                provides__image_install?: Array<import("../../../balena-model.js").ImageInstall["Read"]>;
         
     | 
| 
      
 840 
     | 
    
         
            +
                            }, "id"> & {
         
     | 
| 
      
 841 
     | 
    
         
            +
                                release_image: (import("@balena/abstract-sql-to-typescript").PickDeferred<{
         
     | 
| 
      
 842 
     | 
    
         
            +
                                    created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
         
     | 
| 
      
 843 
     | 
    
         
            +
                                    modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
         
     | 
| 
      
 844 
     | 
    
         
            +
                                    image: {
         
     | 
| 
      
 845 
     | 
    
         
            +
                                        __id: import("../../../balena-model.js").Image["Read"]["id"];
         
     | 
| 
      
 846 
     | 
    
         
            +
                                    } | [import("../../../balena-model.js").Image["Read"]];
         
     | 
| 
      
 847 
     | 
    
         
            +
                                    is_part_of__release: {
         
     | 
| 
      
 848 
     | 
    
         
            +
                                        __id: import("../../../balena-model.js").Release["Read"]["id"];
         
     | 
| 
      
 849 
     | 
    
         
            +
                                    } | [import("../../../balena-model.js").Release["Read"]];
         
     | 
| 
      
 850 
     | 
    
         
            +
                                    id: import("@balena/sbvr-types").Types["Serial"]["Read"];
         
     | 
| 
      
 851 
     | 
    
         
            +
                                    image__is_part_of__release__has__label_name?: Array<import("../../../balena-model.js").ImageLabel["Read"]>;
         
     | 
| 
      
 852 
     | 
    
         
            +
                                    release_image__has__label_name?: Array<import("../../../balena-model.js").ImageLabel["Read"]>;
         
     | 
| 
      
 853 
     | 
    
         
            +
                                    image_label?: Array<import("../../../balena-model.js").ImageLabel["Read"]>;
         
     | 
| 
      
 854 
     | 
    
         
            +
                                    image__is_part_of__release__has__name?: Array<import("../../../balena-model.js").ImageEnvironmentVariable["Read"]>;
         
     | 
| 
      
 855 
     | 
    
         
            +
                                    release_image__has__name?: Array<import("../../../balena-model.js").ImageEnvironmentVariable["Read"]>;
         
     | 
| 
      
 856 
     | 
    
         
            +
                                    image_environment_variable?: Array<import("../../../balena-model.js").ImageEnvironmentVariable["Read"]>;
         
     | 
| 
      
 857 
     | 
    
         
            +
                                    release: {
         
     | 
| 
      
 858 
     | 
    
         
            +
                                        __id: import("../../../balena-model.js").Release["Read"]["id"];
         
     | 
| 
      
 859 
     | 
    
         
            +
                                    } | [import("../../../balena-model.js").Release["Read"]];
         
     | 
| 
      
 860 
     | 
    
         
            +
                                    contains__image: {
         
     | 
| 
      
 861 
     | 
    
         
            +
                                        __id: import("../../../balena-model.js").Image["Read"]["id"];
         
     | 
| 
      
 862 
     | 
    
         
            +
                                    } | [import("../../../balena-model.js").Image["Read"]];
         
     | 
| 
      
 863 
     | 
    
         
            +
                                }, "id"> & {
         
     | 
| 
      
 864 
     | 
    
         
            +
                                    image: import("@balena/abstract-sql-to-typescript").PickDeferred<{
         
     | 
| 
      
 865 
     | 
    
         
            +
                                        created_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
         
     | 
| 
      
 866 
     | 
    
         
            +
                                        modified_at: import("@balena/sbvr-types").Types["Date Time"]["Read"];
         
     | 
| 
      
 867 
     | 
    
         
            +
                                        id: import("@balena/sbvr-types").Types["Serial"]["Read"];
         
     | 
| 
      
 868 
     | 
    
         
            +
                                        start_timestamp: import("@balena/sbvr-types").Types["Date Time"]["Read"];
         
     | 
| 
      
 869 
     | 
    
         
            +
                                        end_timestamp: import("@balena/sbvr-types").Types["Date Time"]["Read"] | null;
         
     | 
| 
      
 870 
     | 
    
         
            +
                                        dockerfile: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
         
     | 
| 
      
 871 
     | 
    
         
            +
                                        is_a_build_of__service: {
         
     | 
| 
      
 872 
     | 
    
         
            +
                                            __id: import("../../../balena-model.js").Service["Read"]["id"];
         
     | 
| 
      
 873 
     | 
    
         
            +
                                        } | [import("../../../balena-model.js").Service["Read"]];
         
     | 
| 
      
 874 
     | 
    
         
            +
                                        image_size: import("@balena/sbvr-types").Types["Big Integer"]["Read"] | null;
         
     | 
| 
      
 875 
     | 
    
         
            +
                                        is_stored_at__image_location: import("@balena/sbvr-types").Types["Short Text"]["Read"];
         
     | 
| 
      
 876 
     | 
    
         
            +
                                        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;
         
     | 
| 
      
 877 
     | 
    
         
            +
                                        error_message: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
         
     | 
| 
      
 878 
     | 
    
         
            +
                                        build_log: import("@balena/sbvr-types").Types["Text"]["Read"] | null;
         
     | 
| 
      
 879 
     | 
    
         
            +
                                        push_timestamp: import("@balena/sbvr-types").Types["Date Time"]["Read"] | null;
         
     | 
| 
      
 880 
     | 
    
         
            +
                                        status: "running" | "success" | "failed" | "error" | "cancelled" | "interrupted";
         
     | 
| 
      
 881 
     | 
    
         
            +
                                        content_hash: import("@balena/sbvr-types").Types["Short Text"]["Read"] | null;
         
     | 
| 
      
 882 
     | 
    
         
            +
                                        contract: import("@balena/sbvr-types").Types["JSON"]["Read"] | null;
         
     | 
| 
      
 883 
     | 
    
         
            +
                                        device__installs__image?: Array<import("../../../balena-model.js").ImageInstall["Read"]>;
         
     | 
| 
      
 884 
     | 
    
         
            +
                                        image_install?: Array<import("../../../balena-model.js").ImageInstall["Read"]>;
         
     | 
| 
      
 885 
     | 
    
         
            +
                                        is_installed_on__device?: Array<import("../../../balena-model.js").ImageInstall["Read"]>;
         
     | 
| 
      
 886 
     | 
    
         
            +
                                        is_part_of__release?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
         
     | 
| 
      
 887 
     | 
    
         
            +
                                        image__is_part_of__release?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
         
     | 
| 
      
 888 
     | 
    
         
            +
                                        release_image?: Array<import("../../../balena-model.js").ImageIsPartOfRelease["Read"]>;
         
     | 
| 
      
 889 
     | 
    
         
            +
                                        is_a_build_of__application__has__service_name: {
         
     | 
| 
      
 890 
     | 
    
         
            +
                                            __id: import("../../../balena-model.js").Service["Read"]["id"];
         
     | 
| 
      
 891 
     | 
    
         
            +
                                        } | [import("../../../balena-model.js").Service["Read"]];
         
     | 
| 
      
 892 
     | 
    
         
            +
                                    }, "is_stored_at__image_location" | "content_hash">[];
         
     | 
| 
      
 893 
     | 
    
         
            +
                                })[];
         
     | 
| 
      
 894 
     | 
    
         
            +
                            })[];
         
     | 
| 
      
 895 
     | 
    
         
            +
                        })[];
         
     | 
| 
       716 
896 
     | 
    
         
             
                    })[];
         
     | 
| 
       717 
897 
     | 
    
         
             
                })[];
         
     | 
| 
       718 
898 
     | 
    
         
             
                should_be_managed_by__release: (import("@balena/abstract-sql-to-typescript").PickDeferred<{
         
     | 
| 
         @@ -924,6 +1104,9 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j 
     | 
|
| 
       924 
1104 
     | 
    
         
             
                        is_archived: import("@balena/sbvr-types").Types["Boolean"]["Read"];
         
     | 
| 
       925 
1105 
     | 
    
         
             
                        uuid: import("@balena/sbvr-types").Types["Text"]["Read"];
         
     | 
| 
       926 
1106 
     | 
    
         
             
                        is_public: import("@balena/sbvr-types").Types["Boolean"]["Read"];
         
     | 
| 
      
 1107 
     | 
    
         
            +
                        is_updated_by__application: {
         
     | 
| 
      
 1108 
     | 
    
         
            +
                            __id: Application["Read"]["id"];
         
     | 
| 
      
 1109 
     | 
    
         
            +
                        } | [Application["Read"]] | [] | null;
         
     | 
| 
       927 
1110 
     | 
    
         
             
                        application__has__env_var_name?: Array<import("../../../balena-model.js").ApplicationEnvironmentVariable["Read"]>;
         
     | 
| 
       928 
1111 
     | 
    
         
             
                        application_environment_variable?: Array<import("../../../balena-model.js").ApplicationEnvironmentVariable["Read"]>;
         
     | 
| 
       929 
1112 
     | 
    
         
             
                        application__has__config_var_name?: Array<import("../../../balena-model.js").ApplicationConfigVariable["Read"]>;
         
     | 
| 
         @@ -932,6 +1115,7 @@ declare const getDevice: (req: import("@balena/pinejs/out/sbvr-api/permissions.j 
     | 
|
| 
       932 
1115 
     | 
    
         
             
                        service?: Array<import("../../../balena-model.js").Service["Read"]>;
         
     | 
| 
       933 
1116 
     | 
    
         
             
                        application__has__tag_key?: Array<import("../../../balena-model.js").ApplicationTag["Read"]>;
         
     | 
| 
       934 
1117 
     | 
    
         
             
                        application_tag?: Array<import("../../../balena-model.js").ApplicationTag["Read"]>;
         
     | 
| 
      
 1118 
     | 
    
         
            +
                        updates__application?: Array<Application["Read"]>;
         
     | 
| 
       935 
1119 
     | 
    
         
             
                        owns__device?: Array<import("../../../balena-model.js").Device["Read"]>;
         
     | 
| 
       936 
1120 
     | 
    
         
             
                        owns__release?: Array<import("../../../balena-model.js").Release["Read"]>;
         
     | 
| 
       937 
1121 
     | 
    
         
             
                        is_directly_accessible_by__user?: Array<import("../../../balena-model.js").UserHasDirectAccessToApplication["Read"]>;
         
     | 
| 
         @@ -56,6 +56,18 @@ export function buildAppFromRelease(device, application, release, config, defaul 
     | 
|
| 
       56 
56 
     | 
    
         
             
                            labels[labelName] = config[confName];
         
     | 
| 
       57 
57 
     | 
    
         
             
                        }
         
     | 
| 
       58 
58 
     | 
    
         
             
                    });
         
     | 
| 
      
 59 
     | 
    
         
            +
                    const updaterImage = application.is_updated_by__application != null &&
         
     | 
| 
      
 60 
     | 
    
         
            +
                        Array.isArray(application.is_updated_by__application)
         
     | 
| 
      
 61 
     | 
    
         
            +
                        ? application.is_updated_by__application[0]
         
     | 
| 
      
 62 
     | 
    
         
            +
                            ?.should_be_running__release[0]?.release_image[0]?.image[0]
         
     | 
| 
      
 63 
     | 
    
         
            +
                        : undefined;
         
     | 
| 
      
 64 
     | 
    
         
            +
                    if (updaterImage != null) {
         
     | 
| 
      
 65 
     | 
    
         
            +
                        const updaterImageRegistryUrl = updaterImage.is_stored_at__image_location +
         
     | 
| 
      
 66 
     | 
    
         
            +
                            (updaterImage.content_hash != null
         
     | 
| 
      
 67 
     | 
    
         
            +
                                ? `@${updaterImage.content_hash}`
         
     | 
| 
      
 68 
     | 
    
         
            +
                                : '');
         
     | 
| 
      
 69 
     | 
    
         
            +
                        labels['io.balena.private.updater'] = updaterImageRegistryUrl;
         
     | 
| 
      
 70 
     | 
    
         
            +
                    }
         
     | 
| 
       59 
71 
     | 
    
         
             
                    const imgRegistry = image.is_stored_at__image_location +
         
     | 
| 
       60 
72 
     | 
    
         
             
                        (image.content_hash != null ? `@${image.content_hash}` : '');
         
     | 
| 
       61 
73 
     | 
    
         
             
                    services[svc.service_name] = {
         
     | 
| 
         @@ -137,6 +149,26 @@ const appExpand = { 
     | 
|
| 
       137 
149 
     | 
    
         
             
                    $select: ['name', 'value'],
         
     | 
| 
       138 
150 
     | 
    
         
             
                },
         
     | 
| 
       139 
151 
     | 
    
         
             
            };
         
     | 
| 
      
 152 
     | 
    
         
            +
            const updaterBlockExpand = {
         
     | 
| 
      
 153 
     | 
    
         
            +
                is_updated_by__application: {
         
     | 
| 
      
 154 
     | 
    
         
            +
                    $select: 'id',
         
     | 
| 
      
 155 
     | 
    
         
            +
                    $expand: {
         
     | 
| 
      
 156 
     | 
    
         
            +
                        should_be_running__release: {
         
     | 
| 
      
 157 
     | 
    
         
            +
                            $select: 'id',
         
     | 
| 
      
 158 
     | 
    
         
            +
                            $expand: {
         
     | 
| 
      
 159 
     | 
    
         
            +
                                release_image: {
         
     | 
| 
      
 160 
     | 
    
         
            +
                                    $select: 'id',
         
     | 
| 
      
 161 
     | 
    
         
            +
                                    $expand: {
         
     | 
| 
      
 162 
     | 
    
         
            +
                                        image: {
         
     | 
| 
      
 163 
     | 
    
         
            +
                                            $select: ['is_stored_at__image_location', 'content_hash'],
         
     | 
| 
      
 164 
     | 
    
         
            +
                                        },
         
     | 
| 
      
 165 
     | 
    
         
            +
                                    },
         
     | 
| 
      
 166 
     | 
    
         
            +
                                },
         
     | 
| 
      
 167 
     | 
    
         
            +
                            },
         
     | 
| 
      
 168 
     | 
    
         
            +
                        },
         
     | 
| 
      
 169 
     | 
    
         
            +
                    },
         
     | 
| 
      
 170 
     | 
    
         
            +
                },
         
     | 
| 
      
 171 
     | 
    
         
            +
            };
         
     | 
| 
       140 
172 
     | 
    
         
             
            const deviceExpand = {
         
     | 
| 
       141 
173 
     | 
    
         
             
                device_config_variable: {
         
     | 
| 
       142 
174 
     | 
    
         
             
                    $select: ['name', 'value'],
         
     | 
| 
         @@ -174,7 +206,10 @@ const deviceExpand = { 
     | 
|
| 
       174 
206 
     | 
    
         
             
                        ...releaseExpand.$expand,
         
     | 
| 
       175 
207 
     | 
    
         
             
                        belongs_to__application: {
         
     | 
| 
       176 
208 
     | 
    
         
             
                            $select: appSelect,
         
     | 
| 
       177 
     | 
    
         
            -
                            $expand:  
     | 
| 
      
 209 
     | 
    
         
            +
                            $expand: {
         
     | 
| 
      
 210 
     | 
    
         
            +
                                ...appExpand,
         
     | 
| 
      
 211 
     | 
    
         
            +
                                ...updaterBlockExpand,
         
     | 
| 
      
 212 
     | 
    
         
            +
                            },
         
     | 
| 
       178 
213 
     | 
    
         
             
                        },
         
     | 
| 
       179 
214 
     | 
    
         
             
                    },
         
     | 
| 
       180 
215 
     | 
    
         
             
                },
         
     | 
| 
         @@ -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;AAK9C,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC; 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"state-get-v3.js","sourceRoot":"","sources":["../../../../src/features/device-state/routes/state-get-v3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AE;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,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
             
     | 
| 
      
 2 
     | 
    
         
            +
            -- Add the column if it does not exist
         
     | 
| 
      
 3 
     | 
    
         
            +
            ALTER TABLE "application"
         
     | 
| 
      
 4 
     | 
    
         
            +
            ADD COLUMN IF NOT EXISTS "is updated by-application" INTEGER NULL;
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            -- Add an index for optimization if it does not exist
         
     | 
| 
      
 7 
     | 
    
         
            +
            CREATE INDEX IF NOT EXISTS "application_is_updated_by_application_idx"
         
     | 
| 
      
 8 
     | 
    
         
            +
            ON "application" ("is updated by-application");
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            -- Check and add the foreign key constraint conditionally
         
     | 
| 
      
 11 
     | 
    
         
            +
            DO $$
         
     | 
| 
      
 12 
     | 
    
         
            +
            BEGIN
         
     | 
| 
      
 13 
     | 
    
         
            +
            	IF NOT EXISTS (
         
     | 
| 
      
 14 
     | 
    
         
            +
            		SELECT 1
         
     | 
| 
      
 15 
     | 
    
         
            +
            		FROM information_schema.table_constraints AS tc
         
     | 
| 
      
 16 
     | 
    
         
            +
            		JOIN information_schema.key_column_usage AS kcu ON tc.constraint_name = kcu.constraint_name
         
     | 
| 
      
 17 
     | 
    
         
            +
            		WHERE tc.constraint_type = 'FOREIGN KEY'
         
     | 
| 
      
 18 
     | 
    
         
            +
            			AND tc.table_schema = CURRENT_SCHEMA()
         
     | 
| 
      
 19 
     | 
    
         
            +
            			AND tc.table_name = 'application'
         
     | 
| 
      
 20 
     | 
    
         
            +
            			AND kcu.column_name = 'is updated by-application'
         
     | 
| 
      
 21 
     | 
    
         
            +
            	) THEN
         
     | 
| 
      
 22 
     | 
    
         
            +
            		ALTER TABLE "application"
         
     | 
| 
      
 23 
     | 
    
         
            +
            		ADD CONSTRAINT "application_is updated by-application_fkey" FOREIGN KEY ("is updated by-application") REFERENCES application ("id");
         
     | 
| 
      
 24 
     | 
    
         
            +
            	END IF;
         
     | 
| 
      
 25 
     | 
    
         
            +
            END;
         
     | 
| 
      
 26 
     | 
    
         
            +
            $$;
         
     | 
    
        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.1.3-build- 
     | 
| 
      
 4 
     | 
    
         
            +
              "version": "43.1.3-build-hostApp-updater-state-get-v3-0b070adb6736440897c6d54b43bf99d6a3dac68d-2",
         
     | 
| 
       5 
5 
     | 
    
         
             
              "license": "AGPL-3.0",
         
     | 
| 
       6 
6 
     | 
    
         
             
              "repository": {
         
     | 
| 
       7 
7 
     | 
    
         
             
                "type": "git",
         
     | 
| 
         @@ -175,6 +175,6 @@ 
     | 
|
| 
       175 
175 
     | 
    
         
             
                "import": "@swc-node/register/esm-register"
         
     | 
| 
       176 
176 
     | 
    
         
             
              },
         
     | 
| 
       177 
177 
     | 
    
         
             
              "versionist": {
         
     | 
| 
       178 
     | 
    
         
            -
                "publishedAt": "2025-10- 
     | 
| 
      
 178 
     | 
    
         
            +
                "publishedAt": "2025-10-30T18:17:26.597Z"
         
     | 
| 
       179 
179 
     | 
    
         
             
              }
         
     | 
| 
       180 
180 
     | 
    
         
             
            }
         
     |