UNPKG

@autobe/agent

Version:

AI backend server code generator

643 lines 105 kB
"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.orchestratePrismaCorrect = orchestratePrismaCorrect; 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 transformPrismaCorrectHistories_1 = require("./transformPrismaCorrectHistories"); function orchestratePrismaCorrect(ctx, application, life = 4) { const unique = new Set(); for (const file of application.files) file.models = file.models.filter((model) => { if (unique.has(model.name)) return false; unique.add(model.name); return true; }); application.files = application.files.filter((f) => f.models.length !== 0); return step(ctx, application, life); } function step(ctx, application, life) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c, _d, _e; const compiler = yield ctx.compiler(); const result = yield compiler.prisma.validate(application); if (result.success) return result; // SUCCESS else if (life <= 0) return result; // FAILURE // VALIDATION FAILED const schemas = yield compiler.prisma.write(application, "postgres"); ctx.dispatch({ type: "prismaValidate", result, schemas, compiled: yield compiler.prisma.compile({ files: schemas, }), step: (_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : 0, created_at: new Date().toISOString(), }); const pointer = { value: null, }; const agentica = new core_1.MicroAgentica({ model: ctx.model, vendor: ctx.vendor, config: Object.assign(Object.assign({}, ((_c = ctx.config) !== null && _c !== void 0 ? _c : {})), { executor: { describe: null, } }), histories: (0, transformPrismaCorrectHistories_1.transformPrismaCorrectHistories)(result), controllers: [ createApplication({ model: ctx.model, build: (next) => { pointer.value = next; }, }), ], }); (0, enforceToolCall_1.enforceToolCall)(agentica); // REQUEST CORRECTION yield agentica .conversate("Resolve the compilation errors in the provided Prisma schema files.") .finally(() => { const tokenUsage = agentica.getTokenUsage(); ctx.usage().record(tokenUsage, ["prisma"]); }); if (pointer.value === null) { console.error("Unreachable error: PrismaCompilerAgent.pointer.value is null"); return result; // unreachable } const correction = { files: application.files.map((file) => ({ filename: file.filename, namespace: file.namespace, models: file.models.map((model) => { const newbie = pointer.value.models.find((m) => m.name === model.name); return newbie !== null && newbie !== void 0 ? newbie : model; }), })), }; ctx.dispatch({ type: "prismaCorrect", failure: result, correction, planning: pointer.value.planning, step: (_e = (_d = ctx.state().analyze) === null || _d === void 0 ? void 0 : _d.step) !== null && _e !== void 0 ? _e : 0, created_at: new Date().toISOString(), }); return step(ctx, { files: correction.files, }, life - 1); }); } function createApplication(props) { (0, assertSchemaModel_1.assertSchemaModel)(props.model); const application = collection[props.model]; return { protocol: "class", name: "Prisma Compiler", application, execute: { correctPrismaSchemaFiles: (next) => { props.build(next); }, }, }; } const claude = { model: "claude", options: { reference: true, separate: null }, functions: [ { name: "correctPrismaSchemaFiles", parameters: { description: "Current Type: {@link IModifyPrismaSchemaFilesProps}", type: "object", properties: { planning: { description: "Detailed execution plan for fixing `AutoBePrisma` validation errors in\nspecific models.\n\n\uD83C\uDFAF Purpose: Enable systematic reasoning and step-by-step error resolution\napproach for targeted model validation issues\n\n\uD83D\uDCCB Required Planning Content:\n\n1. **Error Scope Analysis**\n\n - List all validation errors from IAutoBePrismaValidation.IError[] array\n - Extract unique table names from errors to identify affected models\n - Categorize errors by type (field duplications, references, types, indexes)\n - Identify which models need correction vs. which remain unchanged\n2. **Targeted Fix Strategy**\n\n - Focus ONLY on models mentioned in validation errors\n - Outline minimal changes needed for each affected model\n - Plan cross-model reference updates (if any) without modifying non-error\n models\n - Ensure unchanged models maintain valid references to corrected models\n3. **Model-Specific Fix Plan**\n\n - Model-by-model modification plan for ONLY affected models\n - Exact field additions, renames, or type corrections required\n - Reference updates within corrected models only\n - Index corrections limited to affected models\n4. **Minimal Scope Validation**\n\n - Confirm which models will be included in output (error models only)\n - List models that will remain unchanged in original schema\n - Identify cross-model dependencies without including unchanged models\n - Preserve all business logic within corrected models\n5. **Targeted Impact Assessment**\n\n - Potential effects of fixes on unchanged models (reference validation)\n - Verification points for corrected models only\n - Ensure no new validation errors in targeted models\n - Confirm minimal output scope compliance\n\n\uD83D\uDCA1 Example Planning Structure:\n\n ## Error Scope\n - Target Models: shopping_customers, shopping_orders (2 models only)\n - Unchanged Models: All others remain in original schema\n\n ## Targeted Fixes\n - shopping_customers: Remove duplicate 'email' field\n - shopping_orders: Update targetModel reference to 'shopping_customers'\n\n ## Output Scope\n - Return: Only shopping_customers and shopping_orders models\n - Preserve: All other models unchanged in original schema\n\n ## Cross-Model Impact\n - Verify: shopping_orders still references shopping_customers correctly\n - No changes needed in other models referencing these", type: "string" }, models: { description: "ONLY the specific models that contain validation errors and need\ncorrection.\n\n\uD83D\uDCE5 Input Structure:\n\n- Contains ONLY models mentioned in IAutoBePrismaValidation.IError[] array\n- Each model has specific validation errors that need targeted correction\n- Models not mentioned in errors are excluded from this input\n- Represents minimal scope for error correction\n\n\uD83D\uDD0D Expected Validation Issues (Model-Specific):\n\n- Duplicate field/relation names within these specific models\n- Invalid foreign key references from these models to other models\n- Single foreign key fields in index arrays within these models\n- Invalid naming conventions within these specific models\n- Type validation errors in fields of these models\n\n\uD83D\uDCDD Model Content Analysis (Targeted Scope):\n\n- Complete field definitions for each error model only\n- Relationships from these models (may reference unchanged models)\n- Indexes within these models that need correction\n- Business descriptions specific to these models\n- Cross-model references that need validation (read-only for targets)\n\n\u26A0\uFE0F Processing Notes (Focused Approach):\n\n- Input contains ONLY models with validation errors\n- May reference other models not included in this input\n- Cross-model references must be validated but target models won't be\n modified\n- Output should return corrected versions of ONLY these input models\n- All business logic and descriptions within these models must be preserved\n- Corrections must not break references from unchanged models\n\n\uD83C\uDFAF Correction Scope:\n\n- Fix validation errors within these specific models\n- Update internal model structure (fields, relations, indexes)\n- Correct references to external models (without modifying targets)\n- Maintain compatibility with unchanged models in the full schema\n- Return corrected versions of ONLY these models", type: "array", items: { $ref: "#/$defs/AutoBePrisma.IModel" } } }, required: [ "planning", "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: "Fixes validation errors in specific AutoBePrisma models while preserving\nALL existing business logic and model descriptions.\n\n## Core Rules\n\n1. Fix ONLY validation errors in provided models - never remove business\n descriptions\n2. Apply minimal changes to error models only - preserve original design\n intent\n3. Return ONLY corrected models - unchanged models remain in original schema\n4. Maintain referential integrity with unchanged models\n\n## Targeted Scope\n\n- Process ONLY models with validation errors from IError[] array\n- Exclude models without errors from processing and output\n- Minimize context usage by returning corrected models only\n- Preserve unchanged models in their original state\n\n## Fix Strategy\n\n- Resolve validation errors within specific models only\n- Fix field duplications, invalid references, and type mismatches\n- Update cross-model references without modifying target models\n- Ensure naming conventions and index rules compliance in corrected models", validate: (() => { const _io0 = input => "string" === typeof input.planning && (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) => ["string" === typeof input.planning || _report(_exceptionable, { path: _path + ".planning", expected: "string", value: input.planning }), (Array.isArray(input.models) || _report(_exceptionable, { path: _path + ".models", expected: "Array<AutoBePrisma.IModel>", value: input.models })) && input.models.map((elem, _index9) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".models[" + _index9 + "]", expected: "AutoBePrisma.IModel", value: elem })) && _vo1(elem, _path + ".models[" + _index9 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".models[" + _index9 + "]", 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, _index10) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".foreignFields[" + _index10 + "]", expected: "AutoBePrisma.IForeignField", value: elem })) && _vo3(elem, _path + ".foreignFields[" + _index10 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".foreignFields[" + _index10 + "]", 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, _index11) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".plainFields[" + _index11 + "]", expected: "AutoBePrisma.IPlainField", value: elem })) && _vo5(elem, _path + ".plainFields[" + _index11 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".plainFields[" + _index11 + "]", 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, _index12) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".uniqueIndexes[" + _index12 + "]", expected: "AutoBePrisma.IUniqueIndex", value: elem })) && _vo6(elem, _path + ".uniqueIndexes[" + _index12 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".uniqueIndexes[" + _index12 + "]", 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, _index13) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".plainIndexes[" + _index13 + "]", expected: "AutoBePrisma.IPlainIndex", value: elem })) && _vo7(elem, _path + ".plainIndexes[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".plainIndexes[" + _index13 + "]", 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, _index14) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".ginIndexes[" + _index14 + "]", expected: "AutoBePrisma.IGinIndex", value: elem })) && _vo8(elem, _path + ".ginIndexes[" + _index14 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".ginIndexes[" + _index14 + "]", 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", 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" === input.type || "boolean" === input.type || "uuid" === input.type || "uri" === input.type || "int" === input.type || "double" === input.type || "datetime" === input.type || _report(_exceptionable, { path: _path + ".type", expected: "(\"boolean\" | \"datetime\" | \"double\" | \"int\" | \"string\" | \"uri\" | \"uuid\")", value: input.type }), "string" === typeof input.description || _repo