Drop the no longer needed __metadata property handling

This commit is contained in:
myarmolinsky 2024-09-17 08:26:17 -04:00
parent 5adc43bcbd
commit ec92f21b70
17 changed files with 328 additions and 893 deletions

View File

@ -95,7 +95,7 @@ export interface Release {
| 'end_timestamp' | 'end_timestamp'
>; >;
serviceImages: Dictionary< serviceImages: Dictionary<
Omit<ImageModel, 'created_at' | 'is_a_build_of__service' | '__metadata'> Omit<ImageModel, 'created_at' | 'is_a_build_of__service'>
>; >;
} }

View File

@ -186,13 +186,9 @@ export const createRelease = async function (
serviceImages: _.mapValues( serviceImages: _.mapValues(
serviceImages, serviceImages,
(serviceImage) => (serviceImage) =>
_.omit(serviceImage, [ _.omit(serviceImage, ['created_at', 'is_a_build_of__service']) as Omit<
'created_at',
'is_a_build_of__service',
'__metadata',
]) as Omit<
typeof serviceImage, typeof serviceImage,
'created_at' | 'is_a_build_of__service' | '__metadata' 'created_at' | 'is_a_build_of__service'
>, >,
), ),
}; };

View File

@ -85,6 +85,5 @@ describe('balena release', function () {
expect(json[0].contains__image[0].image[0].start_timestamp).to.equal( expect(json[0].contains__image[0].image[0].start_timestamp).to.equal(
'2020-01-04T01:13:08.583Z', '2020-01-04T01:13:08.583Z',
); );
expect(json[0].__metadata.uri).to.equal('/resin/release(@id)?@id=142334');
}); });
}); });

View File

@ -90,9 +90,8 @@ export class BalenaAPIMock extends NockMock {
this.optGet(/^\/v7\/my_application($|[(?])/, opts).reply( this.optGet(/^\/v7\/my_application($|[(?])/, opts).reply(
200, 200,
JSON.parse(`{"d": [{ JSON.parse(`{"d": [{
"organization": [{ "handle": "bob", "__metadata": {} }], "organization": [{ "handle": "bob" }],
"id": 1301645, "id": 1301645}]}
"__metadata": { "uri": "/resin/my_application(@id)?@id=1301645" }}]}
`), `),
); );
} }
@ -423,9 +422,6 @@ export class BalenaAPIMock extends NockMock {
actor: { __id: 1234567 }, actor: { __id: 1234567 },
username: 'gh_user', username: 'gh_user',
created_at: '2018-08-19T13:55:04.485Z', created_at: '2018-08-19T13:55:04.485Z',
__metadata: {
uri: '/resin/user(@id)?@id=43699',
},
}, },
], ],
}); });

View File

@ -6,8 +6,7 @@
"name": "Starter", "name": "Starter",
"slug": "microservices-starter", "slug": "microservices-starter",
"supports_multicontainer": true, "supports_multicontainer": true,
"is_legacy": true, "is_legacy": true
"__metadata": {}
} }
], ],
"id": 1301645, "id": 1301645,
@ -44,10 +43,7 @@
"should_track_latest_release": true, "should_track_latest_release": true,
"is_accessible_by_support_until__date": null, "is_accessible_by_support_until__date": null,
"is_public": false, "is_public": false,
"is_host": false, "is_host": false
"__metadata": {
"uri": "/resin/application(@id)?@id=1301645"
}
} }
] ]
} }

View File

@ -6,8 +6,7 @@
"name": "Starter", "name": "Starter",
"slug": "microservices-starter", "slug": "microservices-starter",
"supports_multicontainer": true, "supports_multicontainer": true,
"is_legacy": true, "is_legacy": true
"__metadata": {}
} }
], ],
"id": 1301645, "id": 1301645,
@ -39,10 +38,7 @@
"should_track_latest_release": true, "should_track_latest_release": true,
"is_accessible_by_support_until__date": null, "is_accessible_by_support_until__date": null,
"is_public": false, "is_public": false,
"is_host": false, "is_host": false
"__metadata": {
"uri": "/resin/application(@id)?@id=1301645"
}
} }
] ]
} }

View File

@ -24,10 +24,7 @@
"storage_block_device": "/dev/mmcblk0", "storage_block_device": "/dev/mmcblk0",
"storage_usage": 1000, "storage_usage": 1000,
"storage_total": 64000, "storage_total": 64000,
"is_undervolted": true, "is_undervolted": true
"__metadata": {
"uri": "/resin/device(@id)?@id=1747415"
}
} }
] ]
} }

View File

@ -4,8 +4,7 @@
"belongs_to__application": [ "belongs_to__application": [
{ {
"app_name": "test app", "app_name": "test app",
"slug": "org/test app", "slug": "org/test app"
"__metadata": {}
} }
], ],
"id": 1747415, "id": 1747415,
@ -21,10 +20,7 @@
"os_version": "balenaOS 2.44.0+rev3", "os_version": "balenaOS 2.44.0+rev3",
"supervisor_version": "10.3.7", "supervisor_version": "10.3.7",
"is_web_accessible": false, "is_web_accessible": false,
"overall_status": "disconnected", "overall_status": "disconnected"
"__metadata": {
"uri": "/resin/device(@id)?@id=1747415"
}
} }
] ]
} }

View File

@ -1,8 +1,7 @@
{ {
"d": [ "d": [
{ {
"overall_status": "disconnected", "overall_status": "disconnected"
"__metadata": {}
} }
] ]
} }

File diff suppressed because it is too large Load Diff

View File

@ -4,8 +4,7 @@
"belongs_to__application": [ "belongs_to__application": [
{ {
"app_name": "test app", "app_name": "test app",
"slug": "org/test app", "slug": "org/test app"
"__metadata": {}
} }
], ],
"device_tag": [ "device_tag": [
@ -36,10 +35,7 @@
"storage_block_device": "/dev/mmcblk0", "storage_block_device": "/dev/mmcblk0",
"storage_usage": 1000, "storage_usage": 1000,
"storage_total": 64000, "storage_total": 64000,
"is_undervolted": true, "is_undervolted": true
"__metadata": {
"uri": "/resin/device(@id)?@id=1747415"
}
} }
] ]
} }

View File

@ -3,8 +3,7 @@
{ {
"belongs_to__application": [ "belongs_to__application": [
{ {
"slug": "org/test app", "slug": "org/test app"
"__metadata": {}
} }
], ],
"id": 1747415, "id": 1747415,
@ -19,10 +18,7 @@
"status": "Idle", "status": "Idle",
"is_online": false, "is_online": false,
"os_version": "balenaOS 2.44.0+rev3", "os_version": "balenaOS 2.44.0+rev3",
"supervisor_version": "10.3.7", "supervisor_version": "10.3.7"
"__metadata": {
"uri": "/resin/device(@id)?@id=1747415"
}
}, },
{ {
"belongs_to__application": [], "belongs_to__application": [],
@ -38,10 +34,7 @@
"status": "Idle", "status": "Idle",
"is_online": false, "is_online": false,
"os_version": "balenaOS 2.44.0+rev3", "os_version": "balenaOS 2.44.0+rev3",
"supervisor_version": "10.3.7", "supervisor_version": "10.3.7"
"__metadata": {
"uri": "/resin/device(@id)?@id=1747415"
}
} }
] ]
} }

View File

@ -18,8 +18,5 @@
"push_timestamp": null, "push_timestamp": null,
"status": "running", "status": "running",
"content_hash": null, "content_hash": null,
"contract": null, "contract": null
"__metadata": { }
"uri": "/resin/image(@id)?@id=1859016"
}
}

View File

@ -12,8 +12,5 @@
"uri": "/resin/release(1218643)" "uri": "/resin/release(1218643)"
}, },
"__id": 1218643 "__id": 1218643
},
"__metadata": {
"uri": "/resin/image__is_part_of__release(@id)?@id=1774668"
} }
} }

View File

@ -8,8 +8,5 @@
"__id": 1774668 "__id": 1774668
}, },
"label_name": "io.resin.features.firmware", "label_name": "io.resin.features.firmware",
"value": "1", "value": "1"
"__metadata": { }
"uri": "/resin/image_label(@id)?@id=99699617"
}
}

View File

@ -10,9 +10,6 @@
"build_log": null, "build_log": null,
"start_timestamp": "2021-08-25T22:18:33.624Z", "start_timestamp": "2021-08-25T22:18:33.624Z",
"end_timestamp": "2021-08-25T22:18:48.820Z", "end_timestamp": "2021-08-25T22:18:48.820Z",
"__metadata": {
"uri": "/resin/release(@id)?@id=142334"
},
"contains__image": [ "contains__image": [
{ {
"image": [ "image": [
@ -36,10 +33,7 @@
"push_timestamp": "2020-01-04T01:13:14.415Z", "push_timestamp": "2020-01-04T01:13:14.415Z",
"status": "success", "status": "success",
"content_hash": "sha256:6b5471aae43ae81e8f69e10d1a516cb412569a6d5020a57eae311f8fa16d688a", "content_hash": "sha256:6b5471aae43ae81e8f69e10d1a516cb412569a6d5020a57eae311f8fa16d688a",
"contract": null, "contract": null
"__metadata": {
"uri": "/resin/image(@id)?@id=1820810"
}
} }
], ],
"id": 1738663, "id": 1738663,
@ -49,17 +43,13 @@
"uri": "/resin/release(1203844)" "uri": "/resin/release(1203844)"
}, },
"__id": 1203844 "__id": 1203844
},
"__metadata": {
"uri": "/resin/image__is_part_of__release(@id)?@id=1738663"
} }
} }
], ],
"release_tag": [ "release_tag": [
{ {
"tag_key": "testtag1", "tag_key": "testtag1",
"value": "val1", "value": "val1"
"__metadata": {}
} }
], ],
"composition": { "composition": {

View File

@ -29,9 +29,7 @@
"tty": true, "tty": true,
"restart": "always", "restart": "always",
"network_mode": "host", "network_mode": "host",
"volumes": [ "volumes": ["resin-data:/data"],
"resin-data:/data"
],
"labels": { "labels": {
"io.resin.features.kernel-modules": "1", "io.resin.features.kernel-modules": "1",
"io.resin.features.firmware": "1", "io.resin.features.firmware": "1",
@ -47,8 +45,5 @@
"build_log": null, "build_log": null,
"start_timestamp": "2020-01-16T17:08:52.710Z", "start_timestamp": "2020-01-16T17:08:52.710Z",
"end_timestamp": null, "end_timestamp": null,
"update_timestamp": "2020-01-16T17:08:53.017Z", "update_timestamp": "2020-01-16T17:08:53.017Z"
"__metadata": { }
"uri": "/resin/release(@id)?@id=1218643"
}
}