Skip to content

Commit

Permalink
fix(registry): allow non-ptks to delete and get manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
Looskie committed Sep 26, 2023
1 parent f9f2fd0 commit de68105
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/sdks/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,28 @@ export const registry = sdk(client => {
return images;
},

async getManifest(image: string) {
async getManifest(image: string, project?: Id<'project'>) {
if (!project && client.authType !== 'ptk') {
throw new Error('Project is required when using a PAT or bearer');
}

const {manifests} = await client.get(
'/v1/registry/images/:image/manifests',
{image},
{image, project},
);

return manifests;
},

async delete(image: string) {
await client.delete('/v1/registry/images/:image', undefined, {image});
async delete(image: string, project?: Id<'project'>) {
if (!project && client.authType !== 'ptk') {
throw new Error('Project is required when using a PAT or bearer');
}

await client.delete('/v1/registry/images/:image', undefined, {
image,
project,
});
},
},
};
Expand Down

0 comments on commit de68105

Please sign in to comment.