UNPKG

@prismicio/mock

Version:

Generate mock Prismic documents, fields, Slices, and models for development and testing environments

129 lines (128 loc) 4.01 kB
var __defProp = Object.defineProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __publicField = (obj, key, value) => { __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); return value; }; import { createFaker } from "../lib/createFaker.js"; import { boolean } from "./boolean.js"; import { buildMockGroupFieldMap } from "./buildMockGroupFieldMap.js"; import { color } from "./color.js"; import { contentRelationship } from "./contentRelationship.js"; import { customType } from "./customType.js"; import { date } from "./date.js"; import { embed } from "./embed.js"; import { geoPoint } from "./geoPoint.js"; import { group } from "./group.js"; import { image } from "./image.js"; import { integration } from "./integration.js"; import { keyText } from "./keyText.js"; import { link } from "./link.js"; import { linkToMedia } from "./linkToMedia.js"; import { number } from "./number.js"; import { richText } from "./richText.js"; import { select } from "./select.js"; import { sharedSlice } from "./sharedSlice.js"; import { sharedSliceChoice } from "./sharedSliceChoice.js"; import { sharedSliceVariation } from "./sharedSliceVariation.js"; import { slice } from "./slice.js"; import { sliceZone } from "./sliceZone.js"; import { timestamp } from "./timestamp.js"; import { title } from "./title.js"; import { uid } from "./uid.js"; import { table } from "./table.js"; const createModelMockFactory = (...args) => { return new ModelMockFactory(...args); }; class ModelMockFactory { constructor(config) { __publicField(this, "faker"); this.faker = "faker" in config ? config.faker : createFaker(config.seed); } get seed() { return this.faker.seed; } buildMockGroupFieldMap(config) { return buildMockGroupFieldMap({ ...config, faker: this.faker }); } boolean(config) { return boolean({ ...config, faker: this.faker }); } color(config) { return color({ ...config, faker: this.faker }); } contentRelationship(config) { return contentRelationship({ ...config, faker: this.faker }); } customType(config) { return customType({ ...config, faker: this.faker }); } date(config) { return date({ ...config, faker: this.faker }); } embed(config) { return embed({ ...config, faker: this.faker }); } geoPoint(config) { return geoPoint({ ...config, faker: this.faker }); } group(config) { return group({ ...config, faker: this.faker }); } image(config) { return image({ ...config, faker: this.faker }); } integration(config) { return integration({ ...config, faker: this.faker }); } keyText(config) { return keyText({ ...config, faker: this.faker }); } link(config) { return link({ ...config, faker: this.faker }); } linkToMedia(config) { return linkToMedia({ ...config, faker: this.faker }); } number(config) { return number({ ...config, faker: this.faker }); } richText(config) { return richText({ ...config, faker: this.faker }); } select(config) { return select({ ...config, faker: this.faker }); } sharedSlice(config) { return sharedSlice({ ...config, faker: this.faker }); } sharedSliceChoice() { return sharedSliceChoice(); } sharedSliceVariation(config) { return sharedSliceVariation({ ...config, faker: this.faker }); } slice(config) { return slice({ ...config, faker: this.faker }); } sliceZone(config) { return sliceZone({ ...config, faker: this.faker }); } table(config) { return table({ ...config, faker: this.faker }); } timestamp(config) { return timestamp({ ...config, faker: this.faker }); } title(config) { return title({ ...config, faker: this.faker }); } uid(config) { return uid({ ...config, faker: this.faker }); } } export { ModelMockFactory, createModelMockFactory }; //# sourceMappingURL=createModelMockFactory.js.map