All files / blong-int-adapter/mysql/meta/type schemaPage.ts

100% Statements 27/27
50% Branches 1/2
100% Functions 0/0
100% Lines 27/27

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 281x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import {schema} from '@feasibleone/blong';
 
/**
 * Defines the `itemPage` object schema by composing `item`
 * from the accumulated objectSchema.  This demonstrates reuse: by the time this
 * `schema()` factory runs, `schema.ts` has already been
 * processed (alphabetical load order) and `blong.schema.item` is
 * available as a TypeBox object reference.
 */
export default schema(
    async ({
        lib: {type},
        schema: {
            mysql: {item},
        },
    }) => ({
        itemPage: type.Object(
            {
                item: type.Array(item ?? type.Unknown()),
                total: type.Integer(),
                page: type.Optional(type.Integer()),
                pageSize: type.Optional(type.Integer()),
            },
            {required: ['item', 'total']},
        ),
    }),
);