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'
>;
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,
(serviceImage) =>
_.omit(serviceImage, [
'created_at',
'is_a_build_of__service',
'__metadata',
]) as Omit<
_.omit(serviceImage, ['created_at', 'is_a_build_of__service']) as Omit<
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(
'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(
200,
JSON.parse(`{"d": [{
"organization": [{ "handle": "bob", "__metadata": {} }],
"id": 1301645,
"__metadata": { "uri": "/resin/my_application(@id)?@id=1301645" }}]}
"organization": [{ "handle": "bob" }],
"id": 1301645}]}
`),
);
}
@ -423,9 +422,6 @@ export class BalenaAPIMock extends NockMock {
actor: { __id: 1234567 },
username: 'gh_user',
created_at: '2018-08-19T13:55:04.485Z',
__metadata: {
uri: '/resin/user(@id)?@id=43699',
},
},
],
});

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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