UNPKG

@enspirit/emb

Version:

A replacement for our Makefile-for-monorepos

39 lines (38 loc) 1.1 kB
import * as z from 'zod'; import { AbstractOperation } from '../../../operations/index.js'; /** * https://docs.docker.com/reference/api/engine/version/v1.37/#tag/Image/operation/ImageList */ const schema = z .object({ all: z .boolean() .optional() .describe('Show all images. Only images from a final layer (no children) are shown by default.'), filters: z .object({ label: z.array(z.string()).describe('Labels on the images'), }) .optional() .describe('Filters to process on the images list,'), }) .optional(); export class ListImagesOperation extends AbstractOperation { constructor() { super(schema); } async _run(input) { let filters = {}; if (input?.filters?.label) { filters.label = input.filters.label; } // Let's not even pass empty filters if (Object.keys(filters).length === 0) { filters = undefined; } return this.context.docker.listImages({ all: input?.all, filters, }); } }