@lpdjs/firestore-repo-service 3.0.2 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- # @lpdjs/firestore-repo-service (v3.0.2) — full documentation
1
+ # @lpdjs/firestore-repo-service (v3.0.4) — full documentation
2
2
 
3
3
  > ⚡ Type-safe Firestore ORM with auto-generated repositories, advanced queries, relations with typed select, pagination with include, batch/bulk operations, aggregations and transactions.
4
4
 
package/dist/llms.txt CHANGED
@@ -1,4 +1,4 @@
1
- # @lpdjs/firestore-repo-service (v3.0.2)
1
+ # @lpdjs/firestore-repo-service (v3.0.4)
2
2
 
3
3
  > ⚡ Type-safe Firestore ORM with auto-generated repositories, advanced queries, relations with typed select, pagination with include, batch/bulk operations, aggregations and transactions.
4
4
 
@@ -107,5 +107,5 @@ ${t}
107
107
 
108
108
  `)}async function We(n,e,t){let r={created:[],altered:[],upToDate:[],skipped:[]};for(let[s,o]of Object.entries(n)){let i=o.schema??void 0;if(!i){r.skipped.push(s);continue}let m=t?.repos?.[s],c=m?.tableName??s,g=o._systemKeys?.[0]??o.documentKey??"docId",C=I(i,e.dialect,{primaryKey:g,exclude:m?.exclude,columnMap:m?.columnMap}),y={tableName:c,columns:C};if(!await e.tableExists(c))await e.createTable(y),r.created.push(c);else {let k=new Set(await e.getTableColumns(c)),p=C.filter(u=>!k.has(u.name));p.length>0?(await e.addColumns(c,p),r.altered.push(c)):r.upToDate.push(c);}}return r}function Ue(n){if(n.client)return n.client;if(!n.host)throw new Error("MeilisearchAdapter requires either a `client` instance or a `host` option.");try{let{MeiliSearch:e}=ie("meilisearch");return new e({host:n.host,apiKey:n.apiKey})}catch(e){throw new Error(`Failed to load the "meilisearch" package. Please install it with:
109
109
  bun add meilisearch # or npm install meilisearch
110
- Original error: ${e?.message??String(e)}`)}}var oe=class{constructor(e){this.name="meilisearch";this._client=null;this.options=e,e.client&&(this._client=e.client);}get client(){return this._client||(this._client=Ue(this.options)),this._client}async targetExists(e){try{return await this.client.getIndex(e),!0}catch(t){if(t?.code==="index_not_found"||t?.statusCode===404||t?.status===404)return false;throw t}}async upsert(e,t,r){if(t.length===0)return;await this.client.index(e).addDocuments(t,{primaryKey:r});}async delete(e,t,r){if(r.length===0)return;await this.client.index(e).deleteDocuments(r);}async ensureTarget(e){let{targetName:t,primaryKey:r}=e;await this.targetExists(t)||await this.client.createIndex(t,{primaryKey:r});let o=this.options.indexesSettings?.[t];o&&await this.client.index(t).updateSettings(o);}async healthCheck(e){let{targetName:t}=e;try{if(!await this.targetExists(t))return {healthy:!1,targetName:t,targetExists:!1,error:`Meilisearch index "${t}" does not exist`};let s=this.client.index(t),o=await s.getStats(),i=typeof s.getRawInfo=="function"?await s.getRawInfo():{};return {healthy:!0,targetName:t,targetExists:!0,error:null,details:{numberOfDocuments:o?.numberOfDocuments??0,isIndexing:o?.isIndexing??!1,fieldDistribution:o?.fieldDistribution??{},primaryKey:i?.primaryKey??e.primaryKey}}}catch(r){return {healthy:false,targetName:t,targetExists:false,error:r?.message??String(r)}}}async checkConnection(){try{let e=!0;if(typeof this.client.isHealthy=="function"){let r=await this.client.isHealthy();e=r?.status==="available"||r===!0;}else if(typeof this.client.health=="function"){let r=await this.client.health();e=r?.status==="available"||r===!0;}let t;return typeof this.client.getVersion=="function"&&(t=(await this.client.getVersion())?.pkgVersion),{healthy:e,version:t}}catch(e){return {healthy:false,error:e?.message??String(e)}}}};exports.BigQueryAdapter=re;exports.MeilisearchAdapter=oe;exports.SchemaTypeMismatchError=q;exports.SyncQueue=Q;exports.addColumnsDDL=Qe;exports.autoMigrate=We;exports.bigqueryDialect=he;exports.createFirestoreSync=qe;exports.createSyncTriggers=ee;exports.createSyncWorker=se;exports.createTableDDL=Se;exports.createadminsyncServer=X;exports.generateDDL=Ke;exports.serializeDocument=F;exports.serializeValue=Y;exports.zodSchemaToColumns=I;exports.zodTypeToLogical=He;//# sourceMappingURL=index.cjs.map
110
+ Original error: ${e?.message??String(e)}`)}}var oe=class{constructor(e){this.name="meilisearch";this._client=null;this.options=e,e.client&&(this._client=e.client);}get client(){return this._client||(this._client=Ue(this.options)),this._client}async targetExists(e){try{return await this.client.getIndex(e),!0}catch(t){if(t?.code==="index_not_found"||t?.cause?.code==="index_not_found"||t?.statusCode===404||t?.status===404||t?.response?.status===404||t?.cause?.status===404||t?.cause?.statusCode===404||t?.cause?.response?.status===404)return false;throw t}}async upsert(e,t,r){if(t.length===0)return;await this.client.index(e).addDocuments(t,{primaryKey:r});}async delete(e,t,r){if(r.length===0)return;await this.client.index(e).deleteDocuments(r);}async ensureTarget(e){let{targetName:t,primaryKey:r}=e;await this.targetExists(t)||await this.client.createIndex(t,{primaryKey:r});let o=this.options.indexesSettings?.[t];o&&await this.client.index(t).updateSettings(o);}async healthCheck(e){let{targetName:t}=e;try{if(!await this.targetExists(t))return {healthy:!1,targetName:t,targetExists:!1,error:`Meilisearch index "${t}" does not exist`};let s=this.client.index(t),o=await s.getStats(),i=typeof s.getRawInfo=="function"?await s.getRawInfo():{};return {healthy:!0,targetName:t,targetExists:!0,error:null,details:{numberOfDocuments:o?.numberOfDocuments??0,isIndexing:o?.isIndexing??!1,fieldDistribution:o?.fieldDistribution??{},primaryKey:i?.primaryKey??e.primaryKey}}}catch(r){return {healthy:false,targetName:t,targetExists:false,error:r?.message??String(r)}}}async checkConnection(){try{let e=!0;if(typeof this.client.isHealthy=="function"){let r=await this.client.isHealthy();e=r?.status==="available"||r===!0;}else if(typeof this.client.health=="function"){let r=await this.client.health();e=r?.status==="available"||r===!0;}let t;return typeof this.client.getVersion=="function"&&(t=(await this.client.getVersion())?.pkgVersion),{healthy:e,version:t}}catch(e){return {healthy:false,error:e?.message??String(e)}}}};exports.BigQueryAdapter=re;exports.MeilisearchAdapter=oe;exports.SchemaTypeMismatchError=q;exports.SyncQueue=Q;exports.addColumnsDDL=Qe;exports.autoMigrate=We;exports.bigqueryDialect=he;exports.createFirestoreSync=qe;exports.createSyncTriggers=ee;exports.createSyncWorker=se;exports.createTableDDL=Se;exports.createadminsyncServer=X;exports.generateDDL=Ke;exports.serializeDocument=F;exports.serializeValue=Y;exports.zodSchemaToColumns=I;exports.zodTypeToLogical=He;//# sourceMappingURL=index.cjs.map
111
111
  //# sourceMappingURL=index.cjs.map