@autobe/agent
Version:
AI backend server code generator
707 lines (706 loc) • 105 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.orchestratePrismaSchemas = orchestratePrismaSchemas;
const __typia_transform__isUniqueItems = __importStar(require("typia/lib/internal/_isUniqueItems.js"));
const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
const core_1 = require("@agentica/core");
const typia_1 = __importDefault(require("typia"));
const assertSchemaModel_1 = require("../../context/assertSchemaModel");
const enforceToolCall_1 = require("../../utils/enforceToolCall");
const forceRetry_1 = require("../../utils/forceRetry");
const transformPrismaSchemaHistories_1 = require("./transformPrismaSchemaHistories");
function orchestratePrismaSchemas(ctx, components) {
return __awaiter(this, void 0, void 0, function* () {
const start = new Date();
const total = components
.map((c) => c.tables.length)
.reduce((x, y) => x + y, 0);
let completed = 0;
return yield Promise.all(components.map((comp) => __awaiter(this, void 0, void 0, function* () {
var _a, _b;
const targetComponent = comp;
const otherComponents = components.filter((y) => comp !== y);
const result = yield (0, forceRetry_1.forceRetry)(() => process(ctx, targetComponent, otherComponents));
const event = {
type: "prismaSchemas",
created_at: start.toISOString(),
file: {
filename: comp.filename,
namespace: comp.namespace,
models: result.models,
},
completed: (completed += comp.tables.length),
total,
step: (_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : 0,
};
ctx.dispatch(event);
return event;
})));
});
}
function process(ctx, targetComponent, otherComponents) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const pointer = {
value: null,
};
const agentica = new core_1.MicroAgentica({
model: ctx.model,
vendor: ctx.vendor,
config: Object.assign(Object.assign({}, ((_a = ctx.config) !== null && _a !== void 0 ? _a : {})), { executor: {
describe: null,
} }),
histories: (0, transformPrismaSchemaHistories_1.transformPrismaSchemaHistories)(ctx.state().analyze.files, targetComponent, otherComponents),
controllers: [
createApplication(ctx, {
targetComponent,
otherComponents,
build: (next) => {
pointer.value = next;
},
}),
],
});
(0, enforceToolCall_1.enforceToolCall)(agentica);
yield agentica.conversate("Make prisma schema file please").finally(() => {
const tokenUsage = agentica.getTokenUsage();
ctx.usage().record(tokenUsage, ["prisma"]);
});
if (pointer.value === null)
throw new Error("Unreachable code: Prisma Schema not generated");
return pointer.value;
});
}
function createApplication(ctx, props) {
(0, assertSchemaModel_1.assertSchemaModel)(ctx.model);
const application = collection[ctx.model];
// application.functions[0].validate = (
// input: unknown,
// ): IValidation<IMakePrismaSchemaFileProps> => {
// const result: IValidation<IMakePrismaSchemaFileProps> =
// typia.validate<IMakePrismaSchemaFileProps>(input);
// if (result.success === false) return result;
// const everyModels: AutoBePrisma.IModel[] = result.data.models;
// result.data.models = result.data.models.filter((m) =>
// props.otherComponents.every((oc) => oc.tables.includes(m.name) === false),
// );
// const expected: string[] = props.targetComponent.tables;
// const actual: string[] = result.data.models.map((m) => m.name);
// const missed: string[] = expected.filter(
// (x) => actual.includes(x) === false,
// );
// if (missed.length === 0) return result;
// ctx.dispatch({
// type: "prismaInsufficient",
// created_at: new Date().toISOString(),
// component: props.targetComponent,
// actual: everyModels,
// missed,
// tablesToCreate: result.data.tablesToCreate,
// validationReview: result.data.validationReview,
// confirmedTables: result.data.confirmedTables,
// });
// return {
// success: false,
// data: result.data,
// errors: [
// {
// path: "$input.file.models",
// value: result.data.models,
// expected: `Array<AutoBePrisma.IModel>`,
// description: [
// "You missed some tables from the current domain's component.",
// "",
// "Look at the following details to fix the schemas. Never forget to",
// "compose the `missed` tables at the next function calling.",
// "",
// "- filename: current domain's filename",
// "- namespace: current domain's namespace",
// "- expected: expected tables in the current domain",
// "- actual: actual tables you made",
// "- missed: tables you have missed, and you have to compose again",
// "",
// JSON.stringify({
// filename: props.targetComponent.filename,
// namespace: props.targetComponent.namespace,
// expected,
// actual,
// missed,
// }),
// ].join("\n"),
// },
// ],
// };
// };
return {
protocol: "class",
name: "Prisma Generator",
application,
execute: {
makePrismaSchemaFile: (next) => {
props.build(next);
},
},
};
}
const claude = {
model: "claude",
options: {
reference: true,
separate: null
},
functions: [
{
name: "makePrismaSchemaFile",
parameters: {
description: " Properties containing the file\n\n------------------------------\n\nCurrent Type: {@link IMakePrismaSchemaFileProps}",
type: "object",
properties: {
tablesToCreate: {
description: "STEP 1: First enumeration of tables that must be created\n\nList all table names that need to be created based on the\n`targetComponent.tables`. This should be an exact copy of the\n`targetComponent.tables` array.\n\nExample: [\"shopping_goods\", \"shopping_goods_options\"]",
type: "array",
items: {
type: "string"
}
},
validationReview: {
description: "STEP 2: Validation review of the first enumeration\n\nCompare `tablesToCreate` against `targetComponent.tables` and\n`otherComponents[].tables`. Write a review statement that validates:\n\n- All tables from `targetComponent.tables` are included\n- No tables from `otherComponents[].tables` are included\n- Additional tables (if any) are for M:N junction relationships or\n domain-specific needs\n- No forbidden tables from other domains are included\n\nExample: \"VALIDATION PASSED: All required tables from\n`targetComponent.tables` included: shopping_goods, shopping_goods_options.\nFORBIDDEN CHECK: No tables from `otherComponents` included\n(shopping_customers, shopping_sellers are correctly excluded). Additional\ntables: none needed for this domain.\"",
type: "string"
},
confirmedTables: {
description: "STEP 3: Second enumeration of tables to create\n\nAfter validation, re-list the tables that will be created. This should be\nidentical to `tablesToCreate` if validation passed. This serves as the\nfinal confirmed list before model creation.\n\nExample: [\"shopping_goods\", \"shopping_goods_options\"]",
type: "array",
items: {
type: "string"
}
},
models: {
description: "STEP 4: Array of Prisma models (database tables) within the domain\n\nCreate exactly one model for each table in `confirmedTables`. Each model\nrepresents a business entity or concept within the namespace. Models can\nreference each other through foreign key relationships.\n\nThe `models` array length must equal `confirmedTables.length`. Each\n`model.name` must match an entry in `confirmedTables`.",
type: "array",
items: {
$ref: "#/$defs/AutoBePrisma.IModel"
}
}
},
required: [
"tablesToCreate",
"validationReview",
"confirmedTables",
"models"
],
additionalProperties: false,
$defs: {
"AutoBePrisma.IModel": {
description: "Interface representing a single Prisma model (database table).\n\nBased on the uploaded schemas, models follow specific patterns:\n\n- Main business entities (e.g., shopping_sales, shopping_customers)\n- Snapshot/versioning entities for audit trails (e.g.,\n shopping_sale_snapshots)\n- Junction tables for M:N relationships (e.g.,\n shopping_cart_commodity_stocks)\n- Materialized views for performance (prefixed with mv_)",
type: "object",
properties: {
name: {
description: "Name of the Prisma model (database table name).\n\nShould follow snake_case convention with domain prefix. Examples:\n\"shopping_customers\", \"shopping_sale_snapshots\", \"bbs_articles\"\nMaterialized views use \"mv_\" prefix: \"mv_shopping_sale_last_snapshots\"",
type: "string",
pattern: "^[a-z][a-z0-9_]*$"
},
description: {
description: "Detailed description explaining the business purpose and usage of the\nmodel.\n\nShould include:\n\n- Business context and purpose\n- Key relationships with other models\n- Important behavioral notes or constraints\n- References to related entities using \"{@\\link ModelName}\" syntax Example:\n \"Customer information, but not a person but a **connection** basis...\"",
type: "string"
},
material: {
description: "Indicates whether this model represents a materialized view for\nperformance optimization.\n\nMaterialized views are read-only computed tables that cache complex query\nresults. They're marked as \"@\\hidden\" in documentation and prefixed with\n\"mv_\" in naming. Examples: mv_shopping_sale_last_snapshots,\nmv_shopping_cart_commodity_prices",
type: "boolean"
},
primaryField: {
description: "The primary key field of the model.\n\nIn all uploaded schemas, primary keys are always UUID type with \"@\\id\"\ndirective. Usually named \"id\" and marked with \"@\\db.Uuid\" for PostgreSQL\nmapping.",
$ref: "#/$defs/AutoBePrisma.IPrimaryField"
},
foreignFields: {
description: "Array of foreign key fields that reference other models.\n\nThese establish relationships between models and include Prisma relation\ndirectives. Can be nullable (optional relationships) or required\n(mandatory relationships). May have unique constraints for 1:1\nrelationships.",
type: "array",
items: {
$ref: "#/$defs/AutoBePrisma.IForeignField"
}
},
plainFields: {
description: "Array of regular data fields that don't reference other models.\n\nInclude business data like names, descriptions, timestamps, flags,\namounts, etc. Common patterns: created_at, updated_at, deleted_at for\nsoft deletion and auditing.",
type: "array",
items: {
$ref: "#/$defs/AutoBePrisma.IPlainField"
}
},
uniqueIndexes: {
description: "Array of unique indexes for enforcing data integrity constraints.\n\nEnsure uniqueness across single or multiple columns. Examples: unique\nemail addresses, unique codes within a channel, unique combinations like\n(channel_id, nickname).",
type: "array",
items: {
$ref: "#/$defs/AutoBePrisma.IUniqueIndex"
}
},
plainIndexes: {
description: "Array of regular indexes for query performance optimization.\n\nSpeed up common query patterns like filtering by foreign keys, date\nranges, or frequently searched fields. Examples: indexes on created_at,\nforeign key fields, search fields.",
type: "array",
items: {
$ref: "#/$defs/AutoBePrisma.IPlainIndex"
}
},
ginIndexes: {
description: "Array of GIN (Generalized Inverted Index) indexes for full-text search.\n\nUsed specifically for PostgreSQL text search capabilities using trigram\noperations. Applied to text fields that need fuzzy matching or partial\ntext search. Examples: searching names, nicknames, titles, content\nbodies.",
type: "array",
items: {
$ref: "#/$defs/AutoBePrisma.IGinIndex"
}
}
},
required: [
"name",
"description",
"material",
"primaryField",
"foreignFields",
"plainFields",
"uniqueIndexes",
"plainIndexes",
"ginIndexes"
]
},
"AutoBePrisma.IPrimaryField": {
description: "Interface representing the primary key field of a Prisma model.\n\nAll models in the uploaded schemas use UUID as primary key for better\ndistributed system compatibility and security (no sequential ID exposure).",
type: "object",
properties: {
name: {
description: "Name of the primary key field.\n\nConsistently named \"id\" across all models in the uploaded schemas.\nRepresents the unique identifier for each record in the table.",
type: "string",
pattern: "^[a-z][a-z0-9_]*$"
},
type: {
description: "Data type of the primary key field.\n\nAlways \"uuid\" in the uploaded schemas for better distributed system\nsupport and to avoid exposing sequential IDs that could reveal business\ninformation.",
"const": "uuid"
},
description: {
description: "Description of the primary key field's purpose.\n\nStandard description is \"Primary Key.\" across all models. Serves as the\nunique identifier for the model instance.",
type: "string"
}
},
required: [
"name",
"type",
"description"
]
},
"AutoBePrisma.IForeignField": {
description: "Interface representing a foreign key field that establishes relationships\nbetween models.\n\nForeign keys create associations between models, enabling relational data\nmodeling. They can represent 1:1, 1:N, or participate in M:N relationships\nthrough junction tables.",
type: "object",
properties: {
name: {
description: "Name of the foreign key field.\n\nFollows convention: \"{target_model_name_without_prefix}_id\" Examples:\n\"shopping_customer_id\", \"bbs_article_id\", \"attachment_file_id\" For\nself-references: \"parent_id\" (e.g., in hierarchical structures)",
type: "string",
pattern: "^[a-z][a-z0-9_]*$"
},
type: {
description: "Data type of the foreign key field.\n\nAlways \"uuid\" to match the primary key type of referenced models. Ensures\nreferential integrity and consistency across the schema.",
"const": "uuid"
},
description: {
description: "Description explaining the purpose and target of this foreign key\nrelationship.\n\nShould reference the target model using format: \"Target model's {@\\link\nModelName.id}\" Examples: \"Belonged customer's {@\\link\nshopping_customers.id}\" May include additional context about the\nrelationship's business meaning.",
type: "string"
},
relation: {
description: "Prisma relation configuration defining the association details.\n\nSpecifies how this foreign key connects to the target model, including\nrelation name, target model, and target field. This configuration is used\nto generate the appropriate Prisma relation directive in the schema.",
$ref: "#/$defs/AutoBePrisma.IRelation"
},
unique: {
description: "Whether this foreign key has a unique constraint.\n\nTrue: Creates a 1:1 relationship (e.g., user profile, order publish\ndetails) false: Allows 1:N relationship (e.g., customer to multiple\norders) Used for enforcing business rules about relationship\ncardinality.",
type: "boolean"
},
nullable: {
description: "Whether this foreign key can be null (optional relationship).\n\nTrue: Relationship is optional, foreign key can be null false:\nRelationship is required, foreign key cannot be null Reflects business\nrules about mandatory vs optional associations.",
type: "boolean"
}
},
required: [
"name",
"type",
"description",
"relation",
"unique",
"nullable"
]
},
"AutoBePrisma.IRelation": {
description: "Interface representing a Prisma relation configuration between models.\n\nThis interface defines how foreign key fields establish relationships with\ntheir target models. It provides the necessary information for Prisma to\ngenerate appropriate relation directives (@relation) in the schema,\nenabling proper relational data modeling and ORM functionality.\n\nThe relation configuration is essential for:\n\n- Generating correct Prisma relation syntax\n- Establishing bidirectional relationships between models\n- Enabling proper type-safe querying through Prisma client\n- Supporting complex relationship patterns (1:1, 1:N, M:N)",
type: "object",
properties: {
name: {
description: "Name of the relation property in the Prisma model.\n\nThis becomes the property name used to access the related model instance\nthrough the Prisma client. Should be descriptive and reflect the business\nrelationship being modeled.\n\nExamples:\n\n- \"customer\" for shopping_customer_id field\n- \"channel\" for shopping_channel_id field\n- \"parent\" for parent_id field in hierarchical structures\n- \"snapshot\" for versioning relationships\n- \"article\" for bbs_article_id field\n\nNaming convention: camelCase, descriptive of the relationship's business\nmeaning",
type: "string",
pattern: "^[a-zA-Z_][a-zA-Z0-9_]*$"
},
targetModel: {
description: "Name of the target model being referenced by this relation.\n\nMust exactly match an existing model name in the schema. This is used by\nPrisma to establish the foreign key constraint and generate the\nappropriate relation mapping.\n\nExamples:\n\n- \"shopping_customers\" for customer relationships\n- \"shopping_channels\" for channel relationships\n- \"bbs_articles\" for article relationships\n- \"attachment_files\" for file attachments\n\nThe target model should exist in the same schema or be accessible through\nthe Prisma schema configuration.",
type: "string"
}
},
required: [
"name",
"targetModel"
]
},
"AutoBePrisma.IPlainField": {
description: "Interface representing a regular data field that stores business\ninformation.\n\nThese fields contain the actual business data like names, amounts,\ntimestamps, flags, descriptions, and other domain-specific information.",
type: "object",
properties: {
name: {
description: "Name of the field in the database table.\n\nShould use snake_case convention. Common patterns from uploaded schemas:\n\n- Timestamps: created_at, updated_at, deleted_at, opened_at, closed_at\n- Identifiers: code, name, nickname, title\n- Business data: value, quantity, price, volume, balance\n- Flags: primary, required, exclusive, secret, multiplicative",
type: "string",
pattern: "^[a-z][a-z0-9_]*$"
},
type: {
description: "Data type of the field for Prisma schema generation.\n\nMaps to appropriate Prisma/PostgreSQL types:\n\n- Boolean: Boolean flags and yes/no values\n- Int: Integer numbers, quantities, sequences\n- Double: Decimal numbers, prices, monetary values, percentages\n- String: Text data, names, descriptions, codes\n- Uri: URL/URI fields for links and references\n- Uuid: UUID fields (for non-foreign-key UUIDs)\n- Datetime: Timestamp fields with date and time",
oneOf: [
{
"const": "string"
},
{
"const": "boolean"
},
{
"const": "uuid"
},
{
"const": "uri"
},
{
"const": "int"
},
{
"const": "double"
},
{
"const": "datetime"
}
]
},
description: {
description: "Description explaining the business purpose and usage of this field.\n\nShould clearly explain:\n\n- What business concept this field represents\n- Valid values or constraints if applicable\n- How it relates to business processes\n- Any special behavioral notes Example: \"Amount of cash payment.\" or\n \"Whether the unit is required or not.\"",
type: "string"
},
nullable: {
description: "Whether this field can contain null values.\n\nTrue: Field is optional and can be null (e.g., middle name, description)\nfalse: Field is required and cannot be null (e.g., creation timestamp,\nname) Reflects business rules about mandatory vs optional data.",
type: "boolean"
}
},
required: [
"name",
"type",
"description",
"nullable"
]
},
"AutoBePrisma.IUniqueIndex": {
description: "Interface representing a unique index constraint on one or more fields.\n\nUnique indexes enforce data integrity by ensuring no duplicate values exist\nfor the specified field combination. Essential for business rules that\nrequire uniqueness like email addresses, codes, or composite keys.",
type: "object",
properties: {
fieldNames: {
description: "Array of field names that together form the unique constraint.\n\nCan be single field (e.g., [\"email\"]) or composite (e.g., [\"channel_id\",\n\"code\"]). All field names must exist in the model. Order matters for\ncomposite indexes. Examples: [\"code\"], [\"shopping_channel_id\",\n\"nickname\"], [\"email\"]",
type: "array",
items: {
type: "string"
},
minItems: 1,
uniqueItems: true
},
unique: {
description: "Explicit marker indicating this is a unique index.\n\nAlways true to distinguish from regular indexes. Used by code generator\nto emit \"@@unique\" directive in Prisma schema instead of \"@@index\".",
"const": true
}
},
required: [
"fieldNames",
"unique"
]
},
"AutoBePrisma.IPlainIndex": {
description: "Interface representing a regular (non-unique) index for query performance.\n\nRegular indexes speed up database queries by creating optimized data\nstructures for common search patterns. Essential for foreign keys, date\nranges, and frequently filtered fields.",
type: "object",
properties: {
fieldNames: {
description: "Array of field names to include in the performance index.\n\nCan be single field (e.g., [\"created_at\"]) or composite (e.g.,\n[\"customer_id\", \"created_at\"]). All field names must exist in the model.\nOrder matters for composite indexes and should match common query\npatterns. Examples: [\"created_at\"], [\"shopping_customer_id\",\n\"created_at\"], [\"ip\"]",
type: "array",
items: {
type: "string"
},
minItems: 1,
uniqueItems: true
}
},
required: [
"fieldNames"
]
},
"AutoBePrisma.IGinIndex": {
description: "Interface representing a GIN (Generalized Inverted Index) for full-text\nsearch.\n\nGIN indexes enable advanced PostgreSQL text search capabilities including\nfuzzy matching and partial text search using trigram operations. Essential\nfor user-facing search features on text content.",
type: "object",
properties: {
fieldName: {
description: "Name of the text field to index for full-text search capabilities.\n\nMust be a string field in the model that contains searchable text.\nExamples from uploaded schemas: \"nickname\", \"title\", \"body\", \"name\" Used\nwith PostgreSQL gin_trgm_ops for trigram-based fuzzy text search.",
type: "string"
}
},
required: [
"fieldName"
]
}
}
},
description: "Generates comprehensive Prisma schema files based on detailed requirements\nanalysis.\n\nCreates multiple organized schema files following enterprise patterns\nincluding proper domain separation, relationship modeling, snapshot\npatterns, inheritance, materialized views, and comprehensive documentation.\nThe generated schemas implement best practices for scalability,\nmaintainability, and data integrity.",
validate: (() => { const _io0 = input => Array.isArray(input.tablesToCreate) && input.tablesToCreate.every(elem => "string" === typeof elem) && "string" === typeof input.validationReview && (Array.isArray(input.confirmedTables) && input.confirmedTables.every(elem => "string" === typeof elem)) && (Array.isArray(input.models) && input.models.every(elem => "object" === typeof elem && null !== elem && _io1(elem))); const _io1 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "string" === typeof input.description && "boolean" === typeof input.material && ("object" === typeof input.primaryField && null !== input.primaryField && _io2(input.primaryField)) && (Array.isArray(input.foreignFields) && input.foreignFields.every(elem => "object" === typeof elem && null !== elem && _io3(elem))) && (Array.isArray(input.plainFields) && input.plainFields.every(elem => "object" === typeof elem && null !== elem && _io5(elem))) && (Array.isArray(input.uniqueIndexes) && input.uniqueIndexes.every(elem => "object" === typeof elem && null !== elem && _io6(elem))) && (Array.isArray(input.plainIndexes) && input.plainIndexes.every(elem => "object" === typeof elem && null !== elem && _io7(elem))) && (Array.isArray(input.ginIndexes) && input.ginIndexes.every(elem => "object" === typeof elem && null !== elem && _io8(elem))); const _io2 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description; const _io3 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description && ("object" === typeof input.relation && null !== input.relation && _io4(input.relation)) && "boolean" === typeof input.unique && "boolean" === typeof input.nullable; const _io4 = input => "string" === typeof input.name && RegExp("^[a-zA-Z_][a-zA-Z0-9_]*$").test(input.name) && "string" === typeof input.targetModel; const _io5 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && ("string" === input.type || "boolean" === input.type || "uuid" === input.type || "uri" === input.type || "int" === input.type || "double" === input.type || "datetime" === input.type) && "string" === typeof input.description && "boolean" === typeof input.nullable; const _io6 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)) && true === input.unique; const _io7 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)); const _io8 = input => "string" === typeof input.fieldName; const _vo0 = (input, _path, _exceptionable = true) => [(Array.isArray(input.tablesToCreate) || _report(_exceptionable, {
path: _path + ".tablesToCreate",
expected: "Array<string>",
value: input.tablesToCreate
})) && input.tablesToCreate.map((elem, _index11) => "string" === typeof elem || _report(_exceptionable, {
path: _path + ".tablesToCreate[" + _index11 + "]",
expected: "string",
value: elem
})).every(flag => flag) || _report(_exceptionable, {
path: _path + ".tablesToCreate",
expected: "Array<string>",
value: input.tablesToCreate
}), "string" === typeof input.validationReview || _report(_exceptionable, {
path: _path + ".validationReview",
expected: "string",
value: input.validationReview
}), (Array.isArray(input.confirmedTables) || _report(_exceptionable, {
path: _path + ".confirmedTables",
expected: "Array<string>",
value: input.confirmedTables
})) && input.confirmedTables.map((elem, _index12) => "string" === typeof elem || _report(_exceptionable, {
path: _path + ".confirmedTables[" + _index12 + "]",
expected: "string",
value: elem
})).every(flag => flag) || _report(_exceptionable, {
path: _path + ".confirmedTables",
expected: "Array<string>",
value: input.confirmedTables
}), (Array.isArray(input.models) || _report(_exceptionable, {
path: _path + ".models",
expected: "Array<AutoBePrisma.IModel>",
value: input.models
})) && input.models.map((elem, _index13) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
path: _path + ".models[" + _index13 + "]",
expected: "AutoBePrisma.IModel",
value: elem
})) && _vo1(elem, _path + ".models[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".models[" + _index13 + "]",
expected: "AutoBePrisma.IModel",
value: elem
})).every(flag => flag) || _report(_exceptionable, {
path: _path + ".models",
expected: "Array<AutoBePrisma.IModel>",
value: input.models
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
path: _path + ".name",
expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">",
value: input.name
})) || _report(_exceptionable, {
path: _path + ".name",
expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)",
value: input.name
}), "string" === typeof input.description || _report(_exceptionable, {
path: _path + ".description",
expected: "string",
value: input.description
}), "boolean" === typeof input.material || _report(_exceptionable, {
path: _path + ".material",
expected: "boolean",
value: input.material
}), ("object" === typeof input.primaryField && null !== input.primaryField || _report(_exceptionable, {
path: _path + ".primaryField",
expected: "AutoBePrisma.IPrimaryField",
value: input.primaryField
})) && _vo2(input.primaryField, _path + ".primaryField", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".primaryField",
expected: "AutoBePrisma.IPrimaryField",
value: input.primaryField
}), (Array.isArray(input.foreignFields) || _report(_exceptionable, {
path: _path + ".foreignFields",
expected: "Array<AutoBePrisma.IForeignField>",
value: input.foreignFields
})) && input.foreignFields.map((elem, _index14) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
path: _path + ".foreignFields[" + _index14 + "]",
expected: "AutoBePrisma.IForeignField",
value: elem
})) && _vo3(elem, _path + ".foreignFields[" + _index14 + "]", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".foreignFields[" + _index14 + "]",
expected: "AutoBePrisma.IForeignField",
value: elem
})).every(flag => flag) || _report(_exceptionable, {
path: _path + ".foreignFields",
expected: "Array<AutoBePrisma.IForeignField>",
value: input.foreignFields
}), (Array.isArray(input.plainFields) || _report(_exceptionable, {
path: _path + ".plainFields",
expected: "Array<AutoBePrisma.IPlainField>",
value: input.plainFields
})) && input.plainFields.map((elem, _index15) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
path: _path + ".plainFields[" + _index15 + "]",
expected: "AutoBePrisma.IPlainField",
value: elem
})) && _vo5(elem, _path + ".plainFields[" + _index15 + "]", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".plainFields[" + _index15 + "]",
expected: "AutoBePrisma.IPlainField",
value: elem
})).every(flag => flag) || _report(_exceptionable, {
path: _path + ".plainFields",
expected: "Array<AutoBePrisma.IPlainField>",
value: input.plainFields
}), (Array.isArray(input.uniqueIndexes) || _report(_exceptionable, {
path: _path + ".uniqueIndexes",
expected: "Array<AutoBePrisma.IUniqueIndex>",
value: input.uniqueIndexes
})) && input.uniqueIndexes.map((elem, _index16) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
path: _path + ".uniqueIndexes[" + _index16 + "]",
expected: "AutoBePrisma.IUniqueIndex",
value: elem
})) && _vo6(elem, _path + ".uniqueIndexes[" + _index16 + "]", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".uniqueIndexes[" + _index16 + "]",
expected: "AutoBePrisma.IUniqueIndex",
value: elem
})).every(flag => flag) || _report(_exceptionable, {
path: _path + ".uniqueIndexes",
expected: "Array<AutoBePrisma.IUniqueIndex>",
value: input.uniqueIndexes
}), (Array.isArray(input.plainIndexes) || _report(_exceptionable, {
path: _path + ".plainIndexes",
expected: "Array<AutoBePrisma.IPlainIndex>",
value: input.plainIndexes
})) && input.plainIndexes.map((elem, _index17) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
path: _path + ".plainIndexes[" + _index17 + "]",
expected: "AutoBePrisma.IPlainIndex",
value: elem
})) && _vo7(elem, _path + ".plainIndexes[" + _index17 + "]", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".plainIndexes[" + _index17 + "]",
expected: "AutoBePrisma.IPlainIndex",
value: elem
})).every(flag => flag) || _report(_exceptionable, {
path: _path + ".plainIndexes",
expected: "Array<AutoBePrisma.IPlainIndex>",
value: input.plainIndexes
}), (Array.isArray(input.ginIndexes) || _report(_exceptionable, {
path: _path + ".ginIndexes",
expected: "Array<AutoBePrisma.IGinIndex>",
value: input.ginIndexes
})) && input.ginIndexes.map((elem, _index18) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
path: _path + ".ginIndexes[" + _index18 + "]",
expected: "AutoBePrisma.IGinIndex",
value: elem
})) && _vo8(elem, _path + ".ginIndexes[" + _index18 + "]", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".ginIndexes[" + _index18 + "]",
expected: "AutoBePrisma.IGinIndex",
value: elem
})).every(flag => flag) || _report(_exceptionable, {
path: _path + ".ginIndexes",
expected: "Array<AutoBePrisma.IGinIndex>",
value: input.ginIndexes
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
path: _path + ".name",
expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">",
value: input.name
})) || _report(_exceptionable, {
path: _path + ".name",
expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)",
value: input.name
}), "uuid" === input.type || _report(_exceptionable, {
path: _path + ".type",
expected: "\"uuid\"",
value: input.type
}), "string" === typeof input.description || _report(_exceptionable, {
path: _path + ".description",
expected: "string",
value: input.description
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
path: _path + ".name",
expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">",
value: input.name
})) || _report(_exceptionable, {
path: _path + ".name",
expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)",
value: input.name
}), "uuid" === input.type || _report(_exceptionable, {
path: _path + ".type",
expected: "\"uuid\"",
value: input.type
}), "string" === typeof input.description || _report(_exceptionable, {
path: _path + ".description",
expected: "string",
value: input.description
}), ("object" === typeof input.relation && null !== input.relation || _report(_exceptionable, {
path: _path + ".relation",
expected: "AutoBePrisma.IRelation",
value: input.relation
})) && _vo4(input.relation, _path + ".relation", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".relation",
expected: "AutoBePrisma.IRelation",
value: input.relation
}), "boolean" === typeof input.unique || _report(_exceptionable, {
path: _path + ".unique",
expected: "boolean",
value: input.unique
}), "boolean" === typeof input.nullable || _report(_exceptionable, {
path: _path + ".nullable",
expected: "boolean",
value: input.nullable
})].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-zA-Z_][a-zA-Z0-9_]*$").test(input.name) || _report(_exceptionable, {
path: _path + ".name",
expected: "string & Pattern<\"^[a-zA-Z_][a-zA-Z0-9_]*$\">",
value: input.name
})) || _report(_exceptionable, {
path: _path + ".name",
expected: "(string & Pattern<\"^[a-zA-Z_][a-zA-Z0-9_]*$\">)",
value: input.name
}), "string" === typeof input.targetModel || _report(_exceptionable, {
path: _path + ".targetModel",
expected: "string",
value: input.targetModel
})].every(flag => flag); const _vo5 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
path: _path + ".name",