ivy-kit
Version:
Ivy Kit is a CLI migrator tool for [Ivy ORM](https://www.npmjs.com/package/ivy-orm), a fully type-safe "ORM" for Azure AI Search. Use Ivy Kit to manage your AI Search data plane, like creating indexes and indexers.
2 lines (1 loc) • 2.73 kB
JavaScript
var S=Object.create;var p=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var F=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var I=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of D(t))!E.call(e,n)&&n!==r&&p(e,n,{get:()=>t[n],enumerable:!(s=b(t,n))||s.enumerable});return e};var v=(e,t,r)=>(r=e!=null?S(C(e)):{},I(t||!e||!e.__esModule?p(r,"default",{value:e,enumerable:!0}):r,e));var y=F((q,f)=>{"use strict";var l=Object.defineProperty,w=Object.getOwnPropertyDescriptor,N=Object.getOwnPropertyNames,T=Object.prototype.hasOwnProperty,O=(e,t)=>{for(var r in t)l(e,r,{get:t[r],enumerable:!0})},R=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of N(t))!T.call(e,n)&&n!==r&&l(e,n,{get:()=>t[n],enumerable:!(s=w(t,n))||s.enumerable});return e},P=e=>R(l({},"__esModule",{value:!0}),e),h={};O(h,{isComplexFieldDataType:()=>j,isDataSource:()=>z,isSearchIndex:()=>_,isSearchIndexer:()=>k,isSimpleField:()=>M,isSimpleFieldDataType:()=>g});f.exports=P(h);var g=e=>["Edm.String","Edm.Int32","Edm.Int64","Edm.Double","Edm.Boolean","Edm.DateTimeOffset","Edm.GeographyPoint","Collection(Edm.String)","Collection(Edm.Int32)","Collection(Edm.Int64)","Collection(Edm.Double)","Collection(Edm.Boolean)","Collection(Edm.DateTimeOffset)","Collection(Edm.GeographyPoint)","Collection(Edm.Single)"].includes(e),j=e=>e==="Edm.ComplexType"||e==="Collection(Edm.ComplexType)",M=e=>{let{type:t,name:r}=e;return!(!t||!r||!g(t))},_=e=>e.name&&e.fields,k=e=>e.name&&e.dataSourceName,z=e=>e.name&&e.container.name});var c=v(y());function B(e){return["adlsgen2","azureblob","azuresql","azuretable","cosmosdb","mysql"].includes(e)}function x(e){return!!e.name&&B(e.type)}import{z as i}from"zod";var L=i.object({id:i.string(),migrationName:i.string(),checksum:i.string(),startedAt:i.date(),finishedAt:i.date().nullish(),logs:i.string().nullish()}),o=i.object({id:i.string(),name:i.string(),checksum:i.string()}),d=o.extend({type:i.literal("index")}),u=o.extend({type:i.literal("indexer")}),m=o.extend({type:i.literal("dataSource")}),U=i.object({indexes:i.object({create:i.any().refine(c.isSearchIndex).array(),delete:d.omit({id:!0}).array()}),indexers:i.object({create:i.any().refine(c.isSearchIndexer).array(),delete:u.omit({id:!0}).array()}),dataSources:i.object({create:i.any().refine(x).array(),delete:m.omit({id:!0}).array()})});var a=class{constructor(t){this.schema=t}guard(t){try{return this.schema.parse(t),!0}catch{return!1}}},A=new a(o);function K(e){return A.guard(e)&&["index","indexer","dataSource"].includes(e.type)}var Q=new a(d);var W=new a(u);var X=new a(m);export{K as isResource};