UNPKG

@prismicio/mock

Version:

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

129 lines (128 loc) 4.46 kB
"use strict"; 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; }; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const createFaker = require("../lib/createFaker.cjs"); const boolean = require("./boolean.cjs"); const buildMockGroupFieldMap = require("./buildMockGroupFieldMap.cjs"); const color = require("./color.cjs"); const contentRelationship = require("./contentRelationship.cjs"); const customType = require("./customType.cjs"); const date = require("./date.cjs"); const embed = require("./embed.cjs"); const geoPoint = require("./geoPoint.cjs"); const group = require("./group.cjs"); const image = require("./image.cjs"); const integration = require("./integration.cjs"); const keyText = require("./keyText.cjs"); const link = require("./link.cjs"); const linkToMedia = require("./linkToMedia.cjs"); const number = require("./number.cjs"); const richText = require("./richText.cjs"); const select = require("./select.cjs"); const sharedSlice = require("./sharedSlice.cjs"); const sharedSliceChoice = require("./sharedSliceChoice.cjs"); const sharedSliceVariation = require("./sharedSliceVariation.cjs"); const slice = require("./slice.cjs"); const sliceZone = require("./sliceZone.cjs"); const timestamp = require("./timestamp.cjs"); const title = require("./title.cjs"); const uid = require("./uid.cjs"); const table = require("./table.cjs"); const createModelMockFactory = (...args) => { return new ModelMockFactory(...args); }; class ModelMockFactory { constructor(config) { __publicField(this, "faker"); this.faker = "faker" in config ? config.faker : createFaker.createFaker(config.seed); } get seed() { return this.faker.seed; } buildMockGroupFieldMap(config) { return buildMockGroupFieldMap.buildMockGroupFieldMap({ ...config, faker: this.faker }); } boolean(config) { return boolean.boolean({ ...config, faker: this.faker }); } color(config) { return color.color({ ...config, faker: this.faker }); } contentRelationship(config) { return contentRelationship.contentRelationship({ ...config, faker: this.faker }); } customType(config) { return customType.customType({ ...config, faker: this.faker }); } date(config) { return date.date({ ...config, faker: this.faker }); } embed(config) { return embed.embed({ ...config, faker: this.faker }); } geoPoint(config) { return geoPoint.geoPoint({ ...config, faker: this.faker }); } group(config) { return group.group({ ...config, faker: this.faker }); } image(config) { return image.image({ ...config, faker: this.faker }); } integration(config) { return integration.integration({ ...config, faker: this.faker }); } keyText(config) { return keyText.keyText({ ...config, faker: this.faker }); } link(config) { return link.link({ ...config, faker: this.faker }); } linkToMedia(config) { return linkToMedia.linkToMedia({ ...config, faker: this.faker }); } number(config) { return number.number({ ...config, faker: this.faker }); } richText(config) { return richText.richText({ ...config, faker: this.faker }); } select(config) { return select.select({ ...config, faker: this.faker }); } sharedSlice(config) { return sharedSlice.sharedSlice({ ...config, faker: this.faker }); } sharedSliceChoice() { return sharedSliceChoice.sharedSliceChoice(); } sharedSliceVariation(config) { return sharedSliceVariation.sharedSliceVariation({ ...config, faker: this.faker }); } slice(config) { return slice.slice({ ...config, faker: this.faker }); } sliceZone(config) { return sliceZone.sliceZone({ ...config, faker: this.faker }); } table(config) { return table.table({ ...config, faker: this.faker }); } timestamp(config) { return timestamp.timestamp({ ...config, faker: this.faker }); } title(config) { return title.title({ ...config, faker: this.faker }); } uid(config) { return uid.uid({ ...config, faker: this.faker }); } } exports.ModelMockFactory = ModelMockFactory; exports.createModelMockFactory = createModelMockFactory; //# sourceMappingURL=createModelMockFactory.cjs.map