@distilled.cloud/typesense 0.0.0 → 0.14.0
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.
- package/README.md +66 -6
- package/lib/category.d.ts +5 -0
- package/lib/category.d.ts.map +1 -0
- package/lib/category.js +5 -0
- package/lib/category.js.map +1 -0
- package/lib/client.d.ts +11 -0
- package/lib/client.d.ts.map +1 -0
- package/lib/client.js +50 -0
- package/lib/client.js.map +1 -0
- package/lib/credentials.d.ts +20 -0
- package/lib/credentials.d.ts.map +1 -0
- package/lib/credentials.js +29 -0
- package/lib/credentials.js.map +1 -0
- package/lib/errors.d.ts +31 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +23 -0
- package/lib/errors.js.map +1 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +16 -0
- package/lib/index.js.map +1 -0
- package/lib/operations/clearCache.d.ts +16 -0
- package/lib/operations/clearCache.d.ts.map +1 -0
- package/lib/operations/clearCache.js +20 -0
- package/lib/operations/clearCache.js.map +1 -0
- package/lib/operations/compactDb.d.ts +16 -0
- package/lib/operations/compactDb.d.ts.map +1 -0
- package/lib/operations/compactDb.js +20 -0
- package/lib/operations/compactDb.js.map +1 -0
- package/lib/operations/createAnalyticsEvent.d.ts +37 -0
- package/lib/operations/createAnalyticsEvent.d.ts.map +1 -0
- package/lib/operations/createAnalyticsEvent.js +34 -0
- package/lib/operations/createAnalyticsEvent.js.map +1 -0
- package/lib/operations/createAnalyticsRule.d.ts +13 -0
- package/lib/operations/createAnalyticsRule.d.ts.map +1 -0
- package/lib/operations/createAnalyticsRule.js +22 -0
- package/lib/operations/createAnalyticsRule.js.map +1 -0
- package/lib/operations/createCollection.d.ts +205 -0
- package/lib/operations/createCollection.d.ts.map +1 -0
- package/lib/operations/createCollection.js +117 -0
- package/lib/operations/createCollection.js.map +1 -0
- package/lib/operations/createConversationModel.d.ts +17 -0
- package/lib/operations/createConversationModel.d.ts.map +1 -0
- package/lib/operations/createConversationModel.js +24 -0
- package/lib/operations/createConversationModel.js.map +1 -0
- package/lib/operations/createKey.d.ts +41 -0
- package/lib/operations/createKey.d.ts.map +1 -0
- package/lib/operations/createKey.js +34 -0
- package/lib/operations/createKey.js.map +1 -0
- package/lib/operations/createNLSearchModel.d.ts +17 -0
- package/lib/operations/createNLSearchModel.d.ts.map +1 -0
- package/lib/operations/createNLSearchModel.js +24 -0
- package/lib/operations/createNLSearchModel.js.map +1 -0
- package/lib/operations/debug.d.ts +14 -0
- package/lib/operations/debug.d.ts.map +1 -0
- package/lib/operations/debug.js +18 -0
- package/lib/operations/debug.js.map +1 -0
- package/lib/operations/deleteAlias.d.ts +23 -0
- package/lib/operations/deleteAlias.d.ts.map +1 -0
- package/lib/operations/deleteAlias.js +25 -0
- package/lib/operations/deleteAlias.js.map +1 -0
- package/lib/operations/deleteAnalyticsRule.d.ts +49 -0
- package/lib/operations/deleteAnalyticsRule.d.ts.map +1 -0
- package/lib/operations/deleteAnalyticsRule.js +46 -0
- package/lib/operations/deleteAnalyticsRule.js.map +1 -0
- package/lib/operations/deleteCollection.d.ts +117 -0
- package/lib/operations/deleteCollection.d.ts.map +1 -0
- package/lib/operations/deleteCollection.js +74 -0
- package/lib/operations/deleteCollection.js.map +1 -0
- package/lib/operations/deleteConversationModel.d.ts +21 -0
- package/lib/operations/deleteConversationModel.d.ts.map +1 -0
- package/lib/operations/deleteConversationModel.js +26 -0
- package/lib/operations/deleteConversationModel.js.map +1 -0
- package/lib/operations/deleteCurationSet.d.ts +23 -0
- package/lib/operations/deleteCurationSet.d.ts.map +1 -0
- package/lib/operations/deleteCurationSet.js +27 -0
- package/lib/operations/deleteCurationSet.js.map +1 -0
- package/lib/operations/deleteCurationSetItem.d.ts +26 -0
- package/lib/operations/deleteCurationSetItem.d.ts.map +1 -0
- package/lib/operations/deleteCurationSetItem.js +33 -0
- package/lib/operations/deleteCurationSetItem.js.map +1 -0
- package/lib/operations/deleteDocument.d.ts +22 -0
- package/lib/operations/deleteDocument.d.ts.map +1 -0
- package/lib/operations/deleteDocument.js +29 -0
- package/lib/operations/deleteDocument.js.map +1 -0
- package/lib/operations/deleteDocuments.d.ts +25 -0
- package/lib/operations/deleteDocuments.d.ts.map +1 -0
- package/lib/operations/deleteDocuments.js +27 -0
- package/lib/operations/deleteDocuments.js.map +1 -0
- package/lib/operations/deleteKey.d.ts +21 -0
- package/lib/operations/deleteKey.d.ts.map +1 -0
- package/lib/operations/deleteKey.js +24 -0
- package/lib/operations/deleteKey.js.map +1 -0
- package/lib/operations/deleteNLSearchModel.d.ts +23 -0
- package/lib/operations/deleteNLSearchModel.d.ts.map +1 -0
- package/lib/operations/deleteNLSearchModel.js +28 -0
- package/lib/operations/deleteNLSearchModel.js.map +1 -0
- package/lib/operations/deletePreset.d.ts +23 -0
- package/lib/operations/deletePreset.d.ts.map +1 -0
- package/lib/operations/deletePreset.js +26 -0
- package/lib/operations/deletePreset.js.map +1 -0
- package/lib/operations/deleteStopwordsSet.d.ts +23 -0
- package/lib/operations/deleteStopwordsSet.d.ts.map +1 -0
- package/lib/operations/deleteStopwordsSet.js +28 -0
- package/lib/operations/deleteStopwordsSet.js.map +1 -0
- package/lib/operations/deleteSynonymSet.d.ts +23 -0
- package/lib/operations/deleteSynonymSet.d.ts.map +1 -0
- package/lib/operations/deleteSynonymSet.js +26 -0
- package/lib/operations/deleteSynonymSet.js.map +1 -0
- package/lib/operations/deleteSynonymSetItem.d.ts +26 -0
- package/lib/operations/deleteSynonymSetItem.d.ts.map +1 -0
- package/lib/operations/deleteSynonymSetItem.js +33 -0
- package/lib/operations/deleteSynonymSetItem.js.map +1 -0
- package/lib/operations/exportDocuments.d.ts +21 -0
- package/lib/operations/exportDocuments.d.ts.map +1 -0
- package/lib/operations/exportDocuments.js +28 -0
- package/lib/operations/exportDocuments.js.map +1 -0
- package/lib/operations/flushAnalytics.d.ts +16 -0
- package/lib/operations/flushAnalytics.d.ts.map +1 -0
- package/lib/operations/flushAnalytics.js +20 -0
- package/lib/operations/flushAnalytics.js.map +1 -0
- package/lib/operations/getAlias.d.ts +25 -0
- package/lib/operations/getAlias.d.ts.map +1 -0
- package/lib/operations/getAlias.js +27 -0
- package/lib/operations/getAlias.js.map +1 -0
- package/lib/operations/getAliases.d.ts +22 -0
- package/lib/operations/getAliases.d.ts.map +1 -0
- package/lib/operations/getAliases.js +23 -0
- package/lib/operations/getAliases.js.map +1 -0
- package/lib/operations/getAnalyticsEvents.d.ts +46 -0
- package/lib/operations/getAnalyticsEvents.d.ts.map +1 -0
- package/lib/operations/getAnalyticsEvents.js +40 -0
- package/lib/operations/getAnalyticsEvents.js.map +1 -0
- package/lib/operations/getAnalyticsStatus.d.ts +28 -0
- package/lib/operations/getAnalyticsStatus.d.ts.map +1 -0
- package/lib/operations/getAnalyticsStatus.js +28 -0
- package/lib/operations/getAnalyticsStatus.js.map +1 -0
- package/lib/operations/getCollection.d.ts +117 -0
- package/lib/operations/getCollection.d.ts.map +1 -0
- package/lib/operations/getCollection.js +74 -0
- package/lib/operations/getCollection.js.map +1 -0
- package/lib/operations/getCollections.d.ts +114 -0
- package/lib/operations/getCollections.d.ts.map +1 -0
- package/lib/operations/getCollections.js +70 -0
- package/lib/operations/getCollections.js.map +1 -0
- package/lib/operations/getDocument.d.ts +22 -0
- package/lib/operations/getDocument.d.ts.map +1 -0
- package/lib/operations/getDocument.js +29 -0
- package/lib/operations/getDocument.js.map +1 -0
- package/lib/operations/getKey.d.ts +35 -0
- package/lib/operations/getKey.d.ts.map +1 -0
- package/lib/operations/getKey.js +32 -0
- package/lib/operations/getKey.js.map +1 -0
- package/lib/operations/getKeys.d.ts +30 -0
- package/lib/operations/getKeys.d.ts.map +1 -0
- package/lib/operations/getKeys.js +26 -0
- package/lib/operations/getKeys.js.map +1 -0
- package/lib/operations/getSchemaChanges.d.ts +20 -0
- package/lib/operations/getSchemaChanges.d.ts.map +1 -0
- package/lib/operations/getSchemaChanges.js +22 -0
- package/lib/operations/getSchemaChanges.js.map +1 -0
- package/lib/operations/getStemmingDictionary.d.ts +31 -0
- package/lib/operations/getStemmingDictionary.d.ts.map +1 -0
- package/lib/operations/getStemmingDictionary.js +32 -0
- package/lib/operations/getStemmingDictionary.js.map +1 -0
- package/lib/operations/health.d.ts +14 -0
- package/lib/operations/health.d.ts.map +1 -0
- package/lib/operations/health.js +18 -0
- package/lib/operations/health.js.map +1 -0
- package/lib/operations/importDocuments.d.ts +21 -0
- package/lib/operations/importDocuments.d.ts.map +1 -0
- package/lib/operations/importDocuments.js +28 -0
- package/lib/operations/importDocuments.js.map +1 -0
- package/lib/operations/importStemmingDictionary.d.ts +19 -0
- package/lib/operations/importStemmingDictionary.d.ts.map +1 -0
- package/lib/operations/importStemmingDictionary.js +26 -0
- package/lib/operations/importStemmingDictionary.js.map +1 -0
- package/lib/operations/index.d.ts +80 -0
- package/lib/operations/index.d.ts.map +1 -0
- package/lib/operations/index.js +80 -0
- package/lib/operations/index.js.map +1 -0
- package/lib/operations/indexDocument.d.ts +25 -0
- package/lib/operations/indexDocument.d.ts.map +1 -0
- package/lib/operations/indexDocument.js +28 -0
- package/lib/operations/indexDocument.js.map +1 -0
- package/lib/operations/listStemmingDictionaries.d.ts +16 -0
- package/lib/operations/listStemmingDictionaries.d.ts.map +1 -0
- package/lib/operations/listStemmingDictionaries.js +22 -0
- package/lib/operations/listStemmingDictionaries.js.map +1 -0
- package/lib/operations/multiSearch.d.ts +415 -0
- package/lib/operations/multiSearch.d.ts.map +1 -0
- package/lib/operations/multiSearch.js +214 -0
- package/lib/operations/multiSearch.js.map +1 -0
- package/lib/operations/retrieveAPIStats.d.ts +40 -0
- package/lib/operations/retrieveAPIStats.d.ts.map +1 -0
- package/lib/operations/retrieveAPIStats.js +32 -0
- package/lib/operations/retrieveAPIStats.js.map +1 -0
- package/lib/operations/retrieveAllConversationModels.d.ts +16 -0
- package/lib/operations/retrieveAllConversationModels.d.ts.map +1 -0
- package/lib/operations/retrieveAllConversationModels.js +23 -0
- package/lib/operations/retrieveAllConversationModels.js.map +1 -0
- package/lib/operations/retrieveAllNLSearchModels.d.ts +16 -0
- package/lib/operations/retrieveAllNLSearchModels.d.ts.map +1 -0
- package/lib/operations/retrieveAllNLSearchModels.js +22 -0
- package/lib/operations/retrieveAllNLSearchModels.js.map +1 -0
- package/lib/operations/retrieveAllPresets.d.ts +22 -0
- package/lib/operations/retrieveAllPresets.d.ts.map +1 -0
- package/lib/operations/retrieveAllPresets.js +25 -0
- package/lib/operations/retrieveAllPresets.js.map +1 -0
- package/lib/operations/retrieveAnalyticsRule.d.ts +49 -0
- package/lib/operations/retrieveAnalyticsRule.d.ts.map +1 -0
- package/lib/operations/retrieveAnalyticsRule.js +46 -0
- package/lib/operations/retrieveAnalyticsRule.js.map +1 -0
- package/lib/operations/retrieveAnalyticsRules.d.ts +48 -0
- package/lib/operations/retrieveAnalyticsRules.d.ts.map +1 -0
- package/lib/operations/retrieveAnalyticsRules.js +44 -0
- package/lib/operations/retrieveAnalyticsRules.js.map +1 -0
- package/lib/operations/retrieveConversationModel.d.ts +21 -0
- package/lib/operations/retrieveConversationModel.d.ts.map +1 -0
- package/lib/operations/retrieveConversationModel.js +26 -0
- package/lib/operations/retrieveConversationModel.js.map +1 -0
- package/lib/operations/retrieveCurationSet.d.ts +75 -0
- package/lib/operations/retrieveCurationSet.d.ts.map +1 -0
- package/lib/operations/retrieveCurationSet.js +54 -0
- package/lib/operations/retrieveCurationSet.js.map +1 -0
- package/lib/operations/retrieveCurationSetItem.d.ts +70 -0
- package/lib/operations/retrieveCurationSetItem.d.ts.map +1 -0
- package/lib/operations/retrieveCurationSetItem.js +55 -0
- package/lib/operations/retrieveCurationSetItem.js.map +1 -0
- package/lib/operations/retrieveCurationSetItems.d.ts +67 -0
- package/lib/operations/retrieveCurationSetItems.d.ts.map +1 -0
- package/lib/operations/retrieveCurationSetItems.js +50 -0
- package/lib/operations/retrieveCurationSetItems.js.map +1 -0
- package/lib/operations/retrieveCurationSets.d.ts +68 -0
- package/lib/operations/retrieveCurationSets.d.ts.map +1 -0
- package/lib/operations/retrieveCurationSets.js +48 -0
- package/lib/operations/retrieveCurationSets.js.map +1 -0
- package/lib/operations/retrieveMetrics.d.ts +12 -0
- package/lib/operations/retrieveMetrics.d.ts.map +1 -0
- package/lib/operations/retrieveMetrics.js +18 -0
- package/lib/operations/retrieveMetrics.js.map +1 -0
- package/lib/operations/retrieveNLSearchModel.d.ts +23 -0
- package/lib/operations/retrieveNLSearchModel.d.ts.map +1 -0
- package/lib/operations/retrieveNLSearchModel.js +28 -0
- package/lib/operations/retrieveNLSearchModel.js.map +1 -0
- package/lib/operations/retrievePreset.d.ts +25 -0
- package/lib/operations/retrievePreset.d.ts.map +1 -0
- package/lib/operations/retrievePreset.js +27 -0
- package/lib/operations/retrievePreset.js.map +1 -0
- package/lib/operations/retrieveStopwordsSet.d.ts +31 -0
- package/lib/operations/retrieveStopwordsSet.d.ts.map +1 -0
- package/lib/operations/retrieveStopwordsSet.js +32 -0
- package/lib/operations/retrieveStopwordsSet.js.map +1 -0
- package/lib/operations/retrieveStopwordsSets.d.ts +24 -0
- package/lib/operations/retrieveStopwordsSets.d.ts.map +1 -0
- package/lib/operations/retrieveStopwordsSets.js +26 -0
- package/lib/operations/retrieveStopwordsSets.js.map +1 -0
- package/lib/operations/retrieveSynonymSet.d.ts +37 -0
- package/lib/operations/retrieveSynonymSet.d.ts.map +1 -0
- package/lib/operations/retrieveSynonymSet.js +35 -0
- package/lib/operations/retrieveSynonymSet.js.map +1 -0
- package/lib/operations/retrieveSynonymSetItem.d.ts +34 -0
- package/lib/operations/retrieveSynonymSetItem.d.ts.map +1 -0
- package/lib/operations/retrieveSynonymSetItem.js +37 -0
- package/lib/operations/retrieveSynonymSetItem.js.map +1 -0
- package/lib/operations/retrieveSynonymSetItems.d.ts +31 -0
- package/lib/operations/retrieveSynonymSetItems.d.ts.map +1 -0
- package/lib/operations/retrieveSynonymSetItems.js +32 -0
- package/lib/operations/retrieveSynonymSetItems.js.map +1 -0
- package/lib/operations/retrieveSynonymSets.d.ts +30 -0
- package/lib/operations/retrieveSynonymSets.d.ts.map +1 -0
- package/lib/operations/retrieveSynonymSets.js +29 -0
- package/lib/operations/retrieveSynonymSets.js.map +1 -0
- package/lib/operations/searchCollection.d.ts +257 -0
- package/lib/operations/searchCollection.d.ts.map +1 -0
- package/lib/operations/searchCollection.js +139 -0
- package/lib/operations/searchCollection.js.map +1 -0
- package/lib/operations/takeSnapshot.d.ts +22 -0
- package/lib/operations/takeSnapshot.d.ts.map +1 -0
- package/lib/operations/takeSnapshot.js +24 -0
- package/lib/operations/takeSnapshot.js.map +1 -0
- package/lib/operations/toggleSlowRequestLog.d.ts +20 -0
- package/lib/operations/toggleSlowRequestLog.d.ts.map +1 -0
- package/lib/operations/toggleSlowRequestLog.js +24 -0
- package/lib/operations/toggleSlowRequestLog.js.map +1 -0
- package/lib/operations/updateCollection.d.ts +173 -0
- package/lib/operations/updateCollection.d.ts.map +1 -0
- package/lib/operations/updateCollection.js +102 -0
- package/lib/operations/updateCollection.js.map +1 -0
- package/lib/operations/updateConversationModel.d.ts +39 -0
- package/lib/operations/updateConversationModel.d.ts.map +1 -0
- package/lib/operations/updateConversationModel.js +36 -0
- package/lib/operations/updateConversationModel.js.map +1 -0
- package/lib/operations/updateDocument.d.ts +25 -0
- package/lib/operations/updateDocument.d.ts.map +1 -0
- package/lib/operations/updateDocument.js +31 -0
- package/lib/operations/updateDocument.js.map +1 -0
- package/lib/operations/updateDocuments.d.ts +25 -0
- package/lib/operations/updateDocuments.d.ts.map +1 -0
- package/lib/operations/updateDocuments.js +27 -0
- package/lib/operations/updateDocuments.js.map +1 -0
- package/lib/operations/updateNLSearchModel.d.ts +23 -0
- package/lib/operations/updateNLSearchModel.d.ts.map +1 -0
- package/lib/operations/updateNLSearchModel.js +28 -0
- package/lib/operations/updateNLSearchModel.js.map +1 -0
- package/lib/operations/upsertAlias.d.ts +27 -0
- package/lib/operations/upsertAlias.d.ts.map +1 -0
- package/lib/operations/upsertAlias.js +28 -0
- package/lib/operations/upsertAlias.js.map +1 -0
- package/lib/operations/upsertAnalyticsRule.d.ts +71 -0
- package/lib/operations/upsertAnalyticsRule.d.ts.map +1 -0
- package/lib/operations/upsertAnalyticsRule.js +57 -0
- package/lib/operations/upsertAnalyticsRule.js.map +1 -0
- package/lib/operations/upsertCurationSet.d.ts +127 -0
- package/lib/operations/upsertCurationSet.d.ts.map +1 -0
- package/lib/operations/upsertCurationSet.js +79 -0
- package/lib/operations/upsertCurationSet.js.map +1 -0
- package/lib/operations/upsertCurationSetItem.d.ts +116 -0
- package/lib/operations/upsertCurationSetItem.d.ts.map +1 -0
- package/lib/operations/upsertCurationSetItem.js +78 -0
- package/lib/operations/upsertCurationSetItem.js.map +1 -0
- package/lib/operations/upsertPreset.d.ts +27 -0
- package/lib/operations/upsertPreset.d.ts.map +1 -0
- package/lib/operations/upsertPreset.js +28 -0
- package/lib/operations/upsertPreset.js.map +1 -0
- package/lib/operations/upsertStopwordsSet.d.ts +31 -0
- package/lib/operations/upsertStopwordsSet.d.ts.map +1 -0
- package/lib/operations/upsertStopwordsSet.js +32 -0
- package/lib/operations/upsertStopwordsSet.js.map +1 -0
- package/lib/operations/upsertSynonymSet.d.ts +51 -0
- package/lib/operations/upsertSynonymSet.d.ts.map +1 -0
- package/lib/operations/upsertSynonymSet.js +40 -0
- package/lib/operations/upsertSynonymSet.js.map +1 -0
- package/lib/operations/upsertSynonymSetItem.d.ts +42 -0
- package/lib/operations/upsertSynonymSetItem.d.ts.map +1 -0
- package/lib/operations/upsertSynonymSetItem.js +41 -0
- package/lib/operations/upsertSynonymSetItem.js.map +1 -0
- package/lib/operations/vote.d.ts +16 -0
- package/lib/operations/vote.d.ts.map +1 -0
- package/lib/operations/vote.js +20 -0
- package/lib/operations/vote.js.map +1 -0
- package/lib/retry.d.ts +22 -0
- package/lib/retry.d.ts.map +1 -0
- package/lib/retry.js +21 -0
- package/lib/retry.js.map +1 -0
- package/lib/sensitive.d.ts +5 -0
- package/lib/sensitive.d.ts.map +1 -0
- package/lib/sensitive.js +5 -0
- package/lib/sensitive.js.map +1 -0
- package/lib/traits.d.ts +5 -0
- package/lib/traits.d.ts.map +1 -0
- package/lib/traits.js +5 -0
- package/lib/traits.js.map +1 -0
- package/package.json +81 -7
- package/src/category.ts +4 -0
- package/src/client.ts +61 -0
- package/src/credentials.ts +43 -0
- package/src/errors.ts +47 -0
- package/src/index.ts +15 -0
- package/src/operations/clearCache.ts +26 -0
- package/src/operations/compactDb.ts +26 -0
- package/src/operations/createAnalyticsEvent.ts +40 -0
- package/src/operations/createAnalyticsRule.ts +28 -0
- package/src/operations/createCollection.ts +135 -0
- package/src/operations/createConversationModel.ts +34 -0
- package/src/operations/createKey.ts +38 -0
- package/src/operations/createNLSearchModel.ts +30 -0
- package/src/operations/debug.ts +24 -0
- package/src/operations/deleteAlias.ts +29 -0
- package/src/operations/deleteAnalyticsRule.ts +52 -0
- package/src/operations/deleteCollection.ts +86 -0
- package/src/operations/deleteConversationModel.ts +36 -0
- package/src/operations/deleteCurationSet.ts +33 -0
- package/src/operations/deleteCurationSetItem.ts +42 -0
- package/src/operations/deleteDocument.ts +35 -0
- package/src/operations/deleteDocuments.ts +33 -0
- package/src/operations/deleteKey.ts +28 -0
- package/src/operations/deleteNLSearchModel.ts +32 -0
- package/src/operations/deletePreset.ts +30 -0
- package/src/operations/deleteStopwordsSet.ts +32 -0
- package/src/operations/deleteSynonymSet.ts +32 -0
- package/src/operations/deleteSynonymSetItem.ts +41 -0
- package/src/operations/exportDocuments.ts +34 -0
- package/src/operations/flushAnalytics.ts +26 -0
- package/src/operations/getAlias.ts +31 -0
- package/src/operations/getAliases.ts +31 -0
- package/src/operations/getAnalyticsEvents.ts +46 -0
- package/src/operations/getAnalyticsStatus.ts +34 -0
- package/src/operations/getCollection.ts +84 -0
- package/src/operations/getCollections.ts +82 -0
- package/src/operations/getDocument.ts +35 -0
- package/src/operations/getKey.ts +36 -0
- package/src/operations/getKeys.ts +34 -0
- package/src/operations/getSchemaChanges.ts +30 -0
- package/src/operations/getStemmingDictionary.ts +43 -0
- package/src/operations/health.ts +24 -0
- package/src/operations/importDocuments.ts +34 -0
- package/src/operations/importStemmingDictionary.ts +34 -0
- package/src/operations/index.ts +79 -0
- package/src/operations/indexDocument.ts +34 -0
- package/src/operations/listStemmingDictionaries.ts +32 -0
- package/src/operations/multiSearch.ts +288 -0
- package/src/operations/retrieveAPIStats.ts +40 -0
- package/src/operations/retrieveAllConversationModels.ts +33 -0
- package/src/operations/retrieveAllNLSearchModels.ts +34 -0
- package/src/operations/retrieveAllPresets.ts +33 -0
- package/src/operations/retrieveAnalyticsRule.ts +55 -0
- package/src/operations/retrieveAnalyticsRules.ts +56 -0
- package/src/operations/retrieveConversationModel.ts +34 -0
- package/src/operations/retrieveCurationSet.ts +68 -0
- package/src/operations/retrieveCurationSetItem.ts +73 -0
- package/src/operations/retrieveCurationSetItems.ts +70 -0
- package/src/operations/retrieveCurationSets.ts +68 -0
- package/src/operations/retrieveMetrics.ts +24 -0
- package/src/operations/retrieveNLSearchModel.ts +35 -0
- package/src/operations/retrievePreset.ts +31 -0
- package/src/operations/retrieveStopwordsSet.ts +38 -0
- package/src/operations/retrieveStopwordsSets.ts +37 -0
- package/src/operations/retrieveSynonymSet.ts +41 -0
- package/src/operations/retrieveSynonymSetItem.ts +47 -0
- package/src/operations/retrieveSynonymSetItems.ts +44 -0
- package/src/operations/retrieveSynonymSets.ts +39 -0
- package/src/operations/searchCollection.ts +209 -0
- package/src/operations/takeSnapshot.ts +28 -0
- package/src/operations/toggleSlowRequestLog.ts +30 -0
- package/src/operations/updateCollection.ts +116 -0
- package/src/operations/updateConversationModel.ts +44 -0
- package/src/operations/updateDocument.ts +37 -0
- package/src/operations/updateDocuments.ts +33 -0
- package/src/operations/updateNLSearchModel.ts +32 -0
- package/src/operations/upsertAlias.ts +32 -0
- package/src/operations/upsertAnalyticsRule.ts +65 -0
- package/src/operations/upsertCurationSet.ts +105 -0
- package/src/operations/upsertCurationSetItem.ts +103 -0
- package/src/operations/upsertPreset.ts +32 -0
- package/src/operations/upsertStopwordsSet.ts +36 -0
- package/src/operations/upsertSynonymSet.ts +50 -0
- package/src/operations/upsertSynonymSetItem.ts +49 -0
- package/src/operations/vote.ts +26 -0
- package/src/retry.ts +35 -0
- package/src/sensitive.ts +4 -0
- package/src/traits.ts +4 -0
- package/bun.lock +0 -26
- package/index.ts +0 -1
- package/tsconfig.json +0 -29
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { BadRequest } from "../errors.ts";
|
|
3
|
+
export declare const UpsertStopwordsSetInput: Schema.Struct<{
|
|
4
|
+
readonly setId: Schema.String;
|
|
5
|
+
readonly stopwords: Schema.$Array<Schema.String>;
|
|
6
|
+
readonly locale: Schema.optional<Schema.String>;
|
|
7
|
+
}>;
|
|
8
|
+
export type UpsertStopwordsSetInput = typeof UpsertStopwordsSetInput.Type;
|
|
9
|
+
export declare const UpsertStopwordsSetOutput: Schema.Struct<{
|
|
10
|
+
readonly id: Schema.String;
|
|
11
|
+
readonly stopwords: Schema.$Array<Schema.String>;
|
|
12
|
+
readonly locale: Schema.optional<Schema.String>;
|
|
13
|
+
}>;
|
|
14
|
+
export type UpsertStopwordsSetOutput = typeof UpsertStopwordsSetOutput.Type;
|
|
15
|
+
/**
|
|
16
|
+
* Upserts a stopwords set.
|
|
17
|
+
*
|
|
18
|
+
* When an analytics rule is created, we give it a name and describe the type, the source collections and the destination collection.
|
|
19
|
+
*
|
|
20
|
+
* @param setId - The ID of the stopwords set to upsert.
|
|
21
|
+
*/
|
|
22
|
+
export declare const upsertStopwordsSet: import("@distilled.cloud/core/client").OperationMethod<{
|
|
23
|
+
readonly locale?: string | undefined;
|
|
24
|
+
readonly setId: string;
|
|
25
|
+
readonly stopwords: readonly string[];
|
|
26
|
+
}, {
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly locale?: string | undefined;
|
|
29
|
+
readonly stopwords: readonly string[];
|
|
30
|
+
}, BadRequest, import("~/credentials.ts").Credentials>;
|
|
31
|
+
//# sourceMappingURL=upsertStopwordsSet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsertStopwordsSet.d.ts","sourceRoot":"","sources":["../../src/operations/upsertStopwordsSet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,eAAO,MAAM,uBAAuB;;;;EAK4B,CAAC;AACjE,MAAM,MAAM,uBAAuB,GAAG,OAAO,uBAAuB,CAAC,IAAI,CAAC;AAG1E,eAAO,MAAM,wBAAwB;;;;EAKjC,CAAC;AACL,MAAM,MAAM,wBAAwB,GAAG,OAAO,wBAAwB,CAAC,IAAI,CAAC;AAG5E;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;sDAI5B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { API } from "../client.js";
|
|
3
|
+
import * as T from "../traits.js";
|
|
4
|
+
import { BadRequest } from "../errors.js";
|
|
5
|
+
// Input Schema
|
|
6
|
+
export const UpsertStopwordsSetInput =
|
|
7
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
8
|
+
setId: Schema.String.pipe(T.PathParam()),
|
|
9
|
+
stopwords: Schema.Array(Schema.String),
|
|
10
|
+
locale: Schema.optional(Schema.String),
|
|
11
|
+
}).pipe(T.Http({ method: "PUT", path: "/stopwords/{setId}" }));
|
|
12
|
+
// Output Schema
|
|
13
|
+
export const UpsertStopwordsSetOutput =
|
|
14
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
15
|
+
id: Schema.String,
|
|
16
|
+
stopwords: Schema.Array(Schema.String),
|
|
17
|
+
locale: Schema.optional(Schema.String),
|
|
18
|
+
});
|
|
19
|
+
// The operation
|
|
20
|
+
/**
|
|
21
|
+
* Upserts a stopwords set.
|
|
22
|
+
*
|
|
23
|
+
* When an analytics rule is created, we give it a name and describe the type, the source collections and the destination collection.
|
|
24
|
+
*
|
|
25
|
+
* @param setId - The ID of the stopwords set to upsert.
|
|
26
|
+
*/
|
|
27
|
+
export const upsertStopwordsSet = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
|
|
28
|
+
inputSchema: UpsertStopwordsSetInput,
|
|
29
|
+
outputSchema: UpsertStopwordsSetOutput,
|
|
30
|
+
errors: [BadRequest],
|
|
31
|
+
}));
|
|
32
|
+
//# sourceMappingURL=upsertStopwordsSet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsertStopwordsSet.js","sourceRoot":"","sources":["../../src/operations/upsertStopwordsSet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,eAAe;AACf,MAAM,CAAC,MAAM,uBAAuB;AAClC,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;CACvC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC,CAAC,CAAC;AAGjE,gBAAgB;AAChB,MAAM,CAAC,MAAM,wBAAwB;AACnC,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,MAAM,CAAC,MAAM;IACjB,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;CACvC,CAAC,CAAC;AAGL,gBAAgB;AAChB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5E,WAAW,EAAE,uBAAuB;IACpC,YAAY,EAAE,wBAAwB;IACtC,MAAM,EAAE,CAAC,UAAU,CAAU;CAC9B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { BadRequest } from "../errors.ts";
|
|
3
|
+
export declare const UpsertSynonymSetInput: Schema.Struct<{
|
|
4
|
+
readonly synonymSetName: Schema.String;
|
|
5
|
+
readonly items: Schema.$Array<Schema.Struct<{
|
|
6
|
+
readonly id: Schema.String;
|
|
7
|
+
readonly synonyms: Schema.$Array<Schema.String>;
|
|
8
|
+
readonly root: Schema.optional<Schema.String>;
|
|
9
|
+
readonly locale: Schema.optional<Schema.String>;
|
|
10
|
+
readonly symbols_to_index: Schema.optional<Schema.$Array<Schema.String>>;
|
|
11
|
+
}>>;
|
|
12
|
+
}>;
|
|
13
|
+
export type UpsertSynonymSetInput = typeof UpsertSynonymSetInput.Type;
|
|
14
|
+
export declare const UpsertSynonymSetOutput: Schema.Struct<{
|
|
15
|
+
readonly items: Schema.$Array<Schema.Struct<{
|
|
16
|
+
readonly id: Schema.String;
|
|
17
|
+
readonly synonyms: Schema.$Array<Schema.String>;
|
|
18
|
+
readonly root: Schema.optional<Schema.String>;
|
|
19
|
+
readonly locale: Schema.optional<Schema.String>;
|
|
20
|
+
readonly symbols_to_index: Schema.optional<Schema.$Array<Schema.String>>;
|
|
21
|
+
}>>;
|
|
22
|
+
readonly name: Schema.String;
|
|
23
|
+
}>;
|
|
24
|
+
export type UpsertSynonymSetOutput = typeof UpsertSynonymSetOutput.Type;
|
|
25
|
+
/**
|
|
26
|
+
* Create or update a synonym set
|
|
27
|
+
*
|
|
28
|
+
* Create or update a synonym set with the given name
|
|
29
|
+
*
|
|
30
|
+
* @param synonymSetName - The name of the synonym set to create/update
|
|
31
|
+
*/
|
|
32
|
+
export declare const upsertSynonymSet: import("@distilled.cloud/core/client").OperationMethod<{
|
|
33
|
+
readonly items: readonly {
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly locale?: string | undefined;
|
|
36
|
+
readonly root?: string | undefined;
|
|
37
|
+
readonly symbols_to_index?: readonly string[] | undefined;
|
|
38
|
+
readonly synonyms: readonly string[];
|
|
39
|
+
}[];
|
|
40
|
+
readonly synonymSetName: string;
|
|
41
|
+
}, {
|
|
42
|
+
readonly items: readonly {
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly locale?: string | undefined;
|
|
45
|
+
readonly root?: string | undefined;
|
|
46
|
+
readonly symbols_to_index?: readonly string[] | undefined;
|
|
47
|
+
readonly synonyms: readonly string[];
|
|
48
|
+
}[];
|
|
49
|
+
readonly name: string;
|
|
50
|
+
}, BadRequest, import("~/credentials.ts").Credentials>;
|
|
51
|
+
//# sourceMappingURL=upsertSynonymSet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsertSynonymSet.d.ts","sourceRoot":"","sources":["../../src/operations/upsertSynonymSet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,eAAO,MAAM,qBAAqB;;;;;;;;;EAWwC,CAAC;AAC3E,MAAM,MAAM,qBAAqB,GAAG,OAAO,qBAAqB,CAAC,IAAI,CAAC;AAGtE,eAAO,MAAM,sBAAsB;;;;;;;;;EAalC,CAAC;AACF,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAC,IAAI,CAAC;AAGxE;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;sDAI1B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { API } from "../client.js";
|
|
3
|
+
import * as T from "../traits.js";
|
|
4
|
+
import { BadRequest } from "../errors.js";
|
|
5
|
+
// Input Schema
|
|
6
|
+
export const UpsertSynonymSetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
7
|
+
synonymSetName: Schema.String.pipe(T.PathParam()),
|
|
8
|
+
items: Schema.Array(Schema.Struct({
|
|
9
|
+
id: Schema.String,
|
|
10
|
+
synonyms: Schema.Array(Schema.String),
|
|
11
|
+
root: Schema.optional(Schema.String),
|
|
12
|
+
locale: Schema.optional(Schema.String),
|
|
13
|
+
symbols_to_index: Schema.optional(Schema.Array(Schema.String)),
|
|
14
|
+
})),
|
|
15
|
+
}).pipe(T.Http({ method: "PUT", path: "/synonym_sets/{synonymSetName}" }));
|
|
16
|
+
// Output Schema
|
|
17
|
+
export const UpsertSynonymSetOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
18
|
+
items: Schema.Array(Schema.Struct({
|
|
19
|
+
id: Schema.String,
|
|
20
|
+
synonyms: Schema.Array(Schema.String),
|
|
21
|
+
root: Schema.optional(Schema.String),
|
|
22
|
+
locale: Schema.optional(Schema.String),
|
|
23
|
+
symbols_to_index: Schema.optional(Schema.Array(Schema.String)),
|
|
24
|
+
})),
|
|
25
|
+
name: Schema.String,
|
|
26
|
+
});
|
|
27
|
+
// The operation
|
|
28
|
+
/**
|
|
29
|
+
* Create or update a synonym set
|
|
30
|
+
*
|
|
31
|
+
* Create or update a synonym set with the given name
|
|
32
|
+
*
|
|
33
|
+
* @param synonymSetName - The name of the synonym set to create/update
|
|
34
|
+
*/
|
|
35
|
+
export const upsertSynonymSet = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
|
|
36
|
+
inputSchema: UpsertSynonymSetInput,
|
|
37
|
+
outputSchema: UpsertSynonymSetOutput,
|
|
38
|
+
errors: [BadRequest],
|
|
39
|
+
}));
|
|
40
|
+
//# sourceMappingURL=upsertSynonymSet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsertSynonymSet.js","sourceRoot":"","sources":["../../src/operations/upsertSynonymSet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,eAAe;AACf,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IAC7E,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC,KAAK,CACjB,MAAM,CAAC,MAAM,CAAC;QACZ,EAAE,EAAE,MAAM,CAAC,MAAM;QACjB,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;QACrC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;QACpC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;QACtC,gBAAgB,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;KAC/D,CAAC,CACH;CACF,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,gCAAgC,EAAE,CAAC,CAAC,CAAC;AAG3E,gBAAgB;AAChB,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAC7E;IACE,KAAK,EAAE,MAAM,CAAC,KAAK,CACjB,MAAM,CAAC,MAAM,CAAC;QACZ,EAAE,EAAE,MAAM,CAAC,MAAM;QACjB,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;QACrC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;QACpC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;QACtC,gBAAgB,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;KAC/D,CAAC,CACH;IACD,IAAI,EAAE,MAAM,CAAC,MAAM;CACpB,CACF,CAAC;AAGF,gBAAgB;AAChB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC1E,WAAW,EAAE,qBAAqB;IAClC,YAAY,EAAE,sBAAsB;IACpC,MAAM,EAAE,CAAC,UAAU,CAAU;CAC9B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { BadRequest } from "../errors.ts";
|
|
3
|
+
export declare const UpsertSynonymSetItemInput: Schema.Struct<{
|
|
4
|
+
readonly synonymSetName: Schema.String;
|
|
5
|
+
readonly itemId: Schema.String;
|
|
6
|
+
readonly synonyms: Schema.$Array<Schema.String>;
|
|
7
|
+
readonly root: Schema.optional<Schema.String>;
|
|
8
|
+
readonly locale: Schema.optional<Schema.String>;
|
|
9
|
+
readonly symbols_to_index: Schema.optional<Schema.$Array<Schema.String>>;
|
|
10
|
+
}>;
|
|
11
|
+
export type UpsertSynonymSetItemInput = typeof UpsertSynonymSetItemInput.Type;
|
|
12
|
+
export declare const UpsertSynonymSetItemOutput: Schema.Struct<{
|
|
13
|
+
readonly id: Schema.String;
|
|
14
|
+
readonly synonyms: Schema.$Array<Schema.String>;
|
|
15
|
+
readonly root: Schema.optional<Schema.String>;
|
|
16
|
+
readonly locale: Schema.optional<Schema.String>;
|
|
17
|
+
readonly symbols_to_index: Schema.optional<Schema.$Array<Schema.String>>;
|
|
18
|
+
}>;
|
|
19
|
+
export type UpsertSynonymSetItemOutput = typeof UpsertSynonymSetItemOutput.Type;
|
|
20
|
+
/**
|
|
21
|
+
* Create or update a synonym set item
|
|
22
|
+
*
|
|
23
|
+
* Create or update a synonym set item with the given id
|
|
24
|
+
*
|
|
25
|
+
* @param synonymSetName - The name of the synonym set
|
|
26
|
+
* @param itemId - The id of the synonym item to upsert
|
|
27
|
+
*/
|
|
28
|
+
export declare const upsertSynonymSetItem: import("@distilled.cloud/core/client").OperationMethod<{
|
|
29
|
+
readonly itemId: string;
|
|
30
|
+
readonly locale?: string | undefined;
|
|
31
|
+
readonly root?: string | undefined;
|
|
32
|
+
readonly symbols_to_index?: readonly string[] | undefined;
|
|
33
|
+
readonly synonymSetName: string;
|
|
34
|
+
readonly synonyms: readonly string[];
|
|
35
|
+
}, {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly locale?: string | undefined;
|
|
38
|
+
readonly root?: string | undefined;
|
|
39
|
+
readonly symbols_to_index?: readonly string[] | undefined;
|
|
40
|
+
readonly synonyms: readonly string[];
|
|
41
|
+
}, BadRequest, import("~/credentials.ts").Credentials>;
|
|
42
|
+
//# sourceMappingURL=upsertSynonymSetItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsertSynonymSetItem.d.ts","sourceRoot":"","sources":["../../src/operations/upsertSynonymSetItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,eAAO,MAAM,yBAAyB;;;;;;;EAanC,CAAC;AACJ,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAC,IAAI,CAAC;AAG9E,eAAO,MAAM,0BAA0B;;;;;;EAOnC,CAAC;AACL,MAAM,MAAM,0BAA0B,GAAG,OAAO,0BAA0B,CAAC,IAAI,CAAC;AAGhF;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;sDAMhC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { API } from "../client.js";
|
|
3
|
+
import * as T from "../traits.js";
|
|
4
|
+
import { BadRequest } from "../errors.js";
|
|
5
|
+
// Input Schema
|
|
6
|
+
export const UpsertSynonymSetItemInput =
|
|
7
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
8
|
+
synonymSetName: Schema.String.pipe(T.PathParam()),
|
|
9
|
+
itemId: Schema.String.pipe(T.PathParam()),
|
|
10
|
+
synonyms: Schema.Array(Schema.String),
|
|
11
|
+
root: Schema.optional(Schema.String),
|
|
12
|
+
locale: Schema.optional(Schema.String),
|
|
13
|
+
symbols_to_index: Schema.optional(Schema.Array(Schema.String)),
|
|
14
|
+
}).pipe(T.Http({
|
|
15
|
+
method: "PUT",
|
|
16
|
+
path: "/synonym_sets/{synonymSetName}/items/{itemId}",
|
|
17
|
+
}));
|
|
18
|
+
// Output Schema
|
|
19
|
+
export const UpsertSynonymSetItemOutput =
|
|
20
|
+
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
21
|
+
id: Schema.String,
|
|
22
|
+
synonyms: Schema.Array(Schema.String),
|
|
23
|
+
root: Schema.optional(Schema.String),
|
|
24
|
+
locale: Schema.optional(Schema.String),
|
|
25
|
+
symbols_to_index: Schema.optional(Schema.Array(Schema.String)),
|
|
26
|
+
});
|
|
27
|
+
// The operation
|
|
28
|
+
/**
|
|
29
|
+
* Create or update a synonym set item
|
|
30
|
+
*
|
|
31
|
+
* Create or update a synonym set item with the given id
|
|
32
|
+
*
|
|
33
|
+
* @param synonymSetName - The name of the synonym set
|
|
34
|
+
* @param itemId - The id of the synonym item to upsert
|
|
35
|
+
*/
|
|
36
|
+
export const upsertSynonymSetItem = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
|
|
37
|
+
inputSchema: UpsertSynonymSetItemInput,
|
|
38
|
+
outputSchema: UpsertSynonymSetItemOutput,
|
|
39
|
+
errors: [BadRequest],
|
|
40
|
+
}));
|
|
41
|
+
//# sourceMappingURL=upsertSynonymSetItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsertSynonymSetItem.js","sourceRoot":"","sources":["../../src/operations/upsertSynonymSetItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,eAAe;AACf,MAAM,CAAC,MAAM,yBAAyB;AACpC,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACtC,gBAAgB,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;CAC/D,CAAC,CAAC,IAAI,CACL,CAAC,CAAC,IAAI,CAAC;IACL,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,+CAA+C;CACtD,CAAC,CACH,CAAC;AAGJ,gBAAgB;AAChB,MAAM,CAAC,MAAM,0BAA0B;AACrC,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,MAAM,CAAC,MAAM;IACjB,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACtC,gBAAgB,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;CAC/D,CAAC,CAAC;AAGL,gBAAgB;AAChB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CACtE,GAAG,EAAE,CAAC,CAAC;IACL,WAAW,EAAE,yBAAyB;IACtC,YAAY,EAAE,0BAA0B;IACxC,MAAM,EAAE,CAAC,UAAU,CAAU;CAC9B,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
export declare const VoteInput: Schema.Struct<{}>;
|
|
3
|
+
export type VoteInput = typeof VoteInput.Type;
|
|
4
|
+
export declare const VoteOutput: Schema.Struct<{
|
|
5
|
+
readonly success: Schema.Boolean;
|
|
6
|
+
}>;
|
|
7
|
+
export type VoteOutput = typeof VoteOutput.Type;
|
|
8
|
+
/**
|
|
9
|
+
* Triggers a follower node to initiate the raft voting process, which triggers leader re-election.
|
|
10
|
+
*
|
|
11
|
+
* Triggers a follower node to initiate the raft voting process, which triggers leader re-election. The follower node that you run this operation against will become the new leader, once this command succeeds.
|
|
12
|
+
*/
|
|
13
|
+
export declare const vote: import("@distilled.cloud/core/client").OperationMethod<{}, {
|
|
14
|
+
readonly success: boolean;
|
|
15
|
+
}, never, import("~/credentials.ts").Credentials>;
|
|
16
|
+
//# sourceMappingURL=vote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vote.d.ts","sourceRoot":"","sources":["../../src/operations/vote.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,eAAO,MAAM,SAAS,mBAErB,CAAC;AACF,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAC;AAG9C,eAAO,MAAM,UAAU;;EAErB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;AAGhD;;;;GAIG;AACH,eAAO,MAAM,IAAI;;iDAGd,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { API } from "../client.js";
|
|
3
|
+
import * as T from "../traits.js";
|
|
4
|
+
// Input Schema
|
|
5
|
+
export const VoteInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({}).pipe(T.Http({ method: "POST", path: "/operations/vote" }));
|
|
6
|
+
// Output Schema
|
|
7
|
+
export const VoteOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
|
|
8
|
+
success: Schema.Boolean,
|
|
9
|
+
});
|
|
10
|
+
// The operation
|
|
11
|
+
/**
|
|
12
|
+
* Triggers a follower node to initiate the raft voting process, which triggers leader re-election.
|
|
13
|
+
*
|
|
14
|
+
* Triggers a follower node to initiate the raft voting process, which triggers leader re-election. The follower node that you run this operation against will become the new leader, once this command succeeds.
|
|
15
|
+
*/
|
|
16
|
+
export const vote = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
|
|
17
|
+
inputSchema: VoteInput,
|
|
18
|
+
outputSchema: VoteOutput,
|
|
19
|
+
}));
|
|
20
|
+
//# sourceMappingURL=vote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vote.js","sourceRoot":"","sources":["../../src/operations/vote.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,eAAe;AACf,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CACzE,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CACrD,CAAC;AAGF,gBAAgB;AAChB,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IAClE,OAAO,EAAE,MAAM,CAAC,OAAO;CACxB,CAAC,CAAC;AAGH,gBAAgB;AAChB;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC9D,WAAW,EAAE,SAAS;IACtB,YAAY,EAAE,UAAU;CACzB,CAAC,CAAC,CAAC"}
|
package/lib/retry.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typesense retry configuration.
|
|
3
|
+
*/
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Context from "effect/Context";
|
|
6
|
+
export { type Options, type Factory, type Policy, makeDefault, jittered, capped, throttlingOptions, transientOptions, } from "@distilled.cloud/core/retry";
|
|
7
|
+
import type { Policy } from "@distilled.cloud/core/retry";
|
|
8
|
+
declare const Retry_base: Context.ServiceClass<Retry, "TypesenseRetry", Policy>;
|
|
9
|
+
/**
|
|
10
|
+
* Context tag for configuring retry behavior of Typesense API calls.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Retry extends Retry_base {
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Provides a custom retry policy to all Typesense API calls.
|
|
16
|
+
*/
|
|
17
|
+
export declare const policy: (optionsOrFactory: Policy) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
|
|
18
|
+
/**
|
|
19
|
+
* Disables all automatic retries.
|
|
20
|
+
*/
|
|
21
|
+
export declare const none: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
|
|
22
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,WAAW,EACX,QAAQ,EACR,MAAM,EACN,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;;AAE1D;;GAEG;AACH,qBAAa,KAAM,SAAQ,UAAkD;CAAG;AAEhF;;GAEG;AACH,eAAO,MAAM,MAAM,qBAAsB,MAAM,sFACS,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,IAAI,mFAEhB,CAAC"}
|
package/lib/retry.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typesense retry configuration.
|
|
3
|
+
*/
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Layer from "effect/Layer";
|
|
6
|
+
import * as Context from "effect/Context";
|
|
7
|
+
export { makeDefault, jittered, capped, throttlingOptions, transientOptions, } from "@distilled.cloud/core/retry";
|
|
8
|
+
/**
|
|
9
|
+
* Context tag for configuring retry behavior of Typesense API calls.
|
|
10
|
+
*/
|
|
11
|
+
export class Retry extends Context.Service()("TypesenseRetry") {
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Provides a custom retry policy to all Typesense API calls.
|
|
15
|
+
*/
|
|
16
|
+
export const policy = (optionsOrFactory) => Effect.provide(Layer.succeed(Retry, optionsOrFactory));
|
|
17
|
+
/**
|
|
18
|
+
* Disables all automatic retries.
|
|
19
|
+
*/
|
|
20
|
+
export const none = Effect.provide(Layer.succeed(Retry, { while: () => false }));
|
|
21
|
+
//# sourceMappingURL=retry.js.map
|
package/lib/retry.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAIL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAGrC;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,OAAO,CAAC,OAAO,EAAiB,CAAC,gBAAgB,CAAC;CAAG;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,gBAAwB,EAAE,EAAE,CACjD,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEzD;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAChC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,CAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sensitive.d.ts","sourceRoot":"","sources":["../src/sensitive.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,iCAAiC,CAAC"}
|
package/lib/sensitive.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sensitive.js","sourceRoot":"","sources":["../src/sensitive.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,iCAAiC,CAAC"}
|
package/lib/traits.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traits.d.ts","sourceRoot":"","sources":["../src/traits.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,8BAA8B,CAAC"}
|
package/lib/traits.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traits.js","sourceRoot":"","sources":["../src/traits.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,8BAA8B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,89 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@distilled.cloud/typesense",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.14.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/alchemy-run/distilled",
|
|
7
|
+
"directory": "packages/typesense"
|
|
8
|
+
},
|
|
5
9
|
"type": "module",
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"module": "src/index.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"lib",
|
|
14
|
+
"src"
|
|
15
|
+
],
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/index.d.ts",
|
|
19
|
+
"bun": "./src/index.ts",
|
|
20
|
+
"default": "./lib/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./Category": {
|
|
23
|
+
"types": "./lib/category.d.ts",
|
|
24
|
+
"bun": "./src/category.ts",
|
|
25
|
+
"default": "./lib/category.js"
|
|
26
|
+
},
|
|
27
|
+
"./Client": {
|
|
28
|
+
"types": "./lib/client.d.ts",
|
|
29
|
+
"bun": "./src/client.ts",
|
|
30
|
+
"default": "./lib/client.js"
|
|
31
|
+
},
|
|
32
|
+
"./Credentials": {
|
|
33
|
+
"types": "./lib/credentials.d.ts",
|
|
34
|
+
"bun": "./src/credentials.ts",
|
|
35
|
+
"default": "./lib/credentials.js"
|
|
36
|
+
},
|
|
37
|
+
"./Errors": {
|
|
38
|
+
"types": "./lib/errors.d.ts",
|
|
39
|
+
"bun": "./src/errors.ts",
|
|
40
|
+
"default": "./lib/errors.js"
|
|
41
|
+
},
|
|
42
|
+
"./Operations": {
|
|
43
|
+
"types": "./lib/operations/index.d.ts",
|
|
44
|
+
"bun": "./src/operations/index.ts",
|
|
45
|
+
"default": "./lib/operations/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./Retry": {
|
|
48
|
+
"types": "./lib/retry.d.ts",
|
|
49
|
+
"bun": "./src/retry.ts",
|
|
50
|
+
"default": "./lib/retry.js"
|
|
51
|
+
},
|
|
52
|
+
"./Sensitive": {
|
|
53
|
+
"types": "./lib/sensitive.d.ts",
|
|
54
|
+
"bun": "./src/sensitive.ts",
|
|
55
|
+
"default": "./lib/sensitive.js"
|
|
56
|
+
},
|
|
57
|
+
"./Traits": {
|
|
58
|
+
"types": "./lib/traits.d.ts",
|
|
59
|
+
"bun": "./src/traits.ts",
|
|
60
|
+
"default": "./lib/traits.js"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"typecheck": "tsgo",
|
|
65
|
+
"build": "tsgo -b",
|
|
66
|
+
"fmt": "oxfmt --write src",
|
|
67
|
+
"lint": "oxlint --fix src",
|
|
68
|
+
"check": "tsgo && oxlint src && oxfmt --check src",
|
|
69
|
+
"test": "bunx vitest run test",
|
|
70
|
+
"publish:npm": "bun run build && bun publish --access public",
|
|
71
|
+
"generate": "bun run scripts/generate.ts && oxlint --fix src && oxfmt --write src && oxfmt --write src",
|
|
72
|
+
"specs:fetch": "git submodule update --force --init --recursive --depth=1 specs/typesense-api-spec && git -C specs/typesense-api-spec checkout -- .",
|
|
73
|
+
"specs:update": "git -C specs/typesense-api-spec fetch && git -C specs/typesense-api-spec checkout main && git -C specs/typesense-api-spec pull"
|
|
74
|
+
},
|
|
75
|
+
"dependencies": {
|
|
76
|
+
"@distilled.cloud/core": "0.14.0",
|
|
77
|
+
"effect": "4.0.0-beta.58"
|
|
78
|
+
},
|
|
6
79
|
"devDependencies": {
|
|
7
|
-
"@types/bun": "
|
|
80
|
+
"@types/bun": "^1.3.0",
|
|
81
|
+
"@types/node": "^25.3.5",
|
|
82
|
+
"dotenv": "^16.5.0",
|
|
83
|
+
"vitest": "^3.2.3",
|
|
84
|
+
"yaml": "^2.7.1"
|
|
8
85
|
},
|
|
9
86
|
"peerDependencies": {
|
|
10
|
-
"
|
|
11
|
-
},
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git"
|
|
87
|
+
"effect": "4.0.0-beta.58"
|
|
14
88
|
}
|
|
15
89
|
}
|
package/src/category.ts
ADDED
package/src/client.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typesense API Client.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the shared REST client from sdk-core with Typesense-specific
|
|
5
|
+
* error matching and credential handling.
|
|
6
|
+
*/
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
|
+
import * as Redacted from "effect/Redacted";
|
|
9
|
+
import * as Schema from "effect/Schema";
|
|
10
|
+
import { makeAPI } from "@distilled.cloud/core/client";
|
|
11
|
+
import {
|
|
12
|
+
HTTP_STATUS_MAP,
|
|
13
|
+
UnknownTypesenseError,
|
|
14
|
+
TypesenseParseError,
|
|
15
|
+
} from "./errors.ts";
|
|
16
|
+
|
|
17
|
+
// Re-export for backwards compatibility
|
|
18
|
+
export { UnknownTypesenseError } from "./errors.ts";
|
|
19
|
+
import { Credentials } from "./credentials.ts";
|
|
20
|
+
|
|
21
|
+
// API Error Response Schema (Typesense ApiResponse: { message: string })
|
|
22
|
+
const ApiErrorResponse = Schema.Struct({
|
|
23
|
+
message: Schema.String,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Match a Typesense API error response to the appropriate error class based on HTTP status.
|
|
28
|
+
*/
|
|
29
|
+
const matchError = (
|
|
30
|
+
status: number,
|
|
31
|
+
errorBody: unknown,
|
|
32
|
+
): Effect.Effect<never, unknown> => {
|
|
33
|
+
try {
|
|
34
|
+
const parsed = Schema.decodeUnknownSync(ApiErrorResponse)(errorBody);
|
|
35
|
+
const ErrorClass = (HTTP_STATUS_MAP as any)[status];
|
|
36
|
+
if (ErrorClass) {
|
|
37
|
+
return Effect.fail(new ErrorClass({ message: parsed.message ?? "" }));
|
|
38
|
+
}
|
|
39
|
+
return Effect.fail(
|
|
40
|
+
new UnknownTypesenseError({
|
|
41
|
+
message: parsed.message,
|
|
42
|
+
body: errorBody,
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
45
|
+
} catch {
|
|
46
|
+
return Effect.fail(new UnknownTypesenseError({ body: errorBody }));
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Typesense API client.
|
|
52
|
+
*/
|
|
53
|
+
export const API = makeAPI<Credentials>({
|
|
54
|
+
credentials: Credentials as any,
|
|
55
|
+
getBaseUrl: (creds: any) => creds.apiBaseUrl,
|
|
56
|
+
getAuthHeaders: (creds: any) => ({
|
|
57
|
+
"X-TYPESENSE-API-KEY": Redacted.value(creds.apiKey),
|
|
58
|
+
}),
|
|
59
|
+
matchError,
|
|
60
|
+
ParseError: TypesenseParseError as any,
|
|
61
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
import * as Redacted from "effect/Redacted";
|
|
4
|
+
import * as Context from "effect/Context";
|
|
5
|
+
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Typesense has no fixed default base URL — users run their own server
|
|
9
|
+
* (e.g. http://localhost:8108) or use Typesense Cloud (per-cluster URLs
|
|
10
|
+
* like https://xxx.a1.typesense.net). Users must supply TYPESENSE_API_URL.
|
|
11
|
+
*/
|
|
12
|
+
export const DEFAULT_API_BASE_URL = "";
|
|
13
|
+
|
|
14
|
+
export interface Config {
|
|
15
|
+
readonly apiKey: Redacted.Redacted<string>;
|
|
16
|
+
readonly apiBaseUrl: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class Credentials extends Context.Service<Credentials, Config>()(
|
|
20
|
+
"TypesenseCredentials",
|
|
21
|
+
) {}
|
|
22
|
+
|
|
23
|
+
export const CredentialsFromEnv = Layer.effect(
|
|
24
|
+
Credentials,
|
|
25
|
+
Effect.gen(function* () {
|
|
26
|
+
const apiKey = process.env.TYPESENSE_API_KEY;
|
|
27
|
+
const apiBaseUrl = process.env.TYPESENSE_API_URL ?? DEFAULT_API_BASE_URL;
|
|
28
|
+
|
|
29
|
+
if (!apiKey) {
|
|
30
|
+
return yield* new ConfigError({
|
|
31
|
+
message: "TYPESENSE_API_KEY environment variable is required",
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!apiBaseUrl) {
|
|
36
|
+
return yield* new ConfigError({
|
|
37
|
+
message: "TYPESENSE_API_URL environment variable is required",
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return { apiKey: Redacted.make(apiKey), apiBaseUrl };
|
|
42
|
+
}),
|
|
43
|
+
);
|