@goatlab/typesense 0.0.2

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.
Files changed (149) hide show
  1. package/LICENSE +21 -0
  2. package/dist/TypesenseApi.d.ts +229 -0
  3. package/dist/TypesenseApi.js +423 -0
  4. package/dist/TypesenseApi.js.map +1 -0
  5. package/dist/actions/admin/getCollectionStats.d.ts +3 -0
  6. package/dist/actions/admin/getCollectionStats.js +8 -0
  7. package/dist/actions/admin/getCollectionStats.js.map +1 -0
  8. package/dist/actions/admin/health.d.ts +4 -0
  9. package/dist/actions/admin/health.js +22 -0
  10. package/dist/actions/admin/health.js.map +1 -0
  11. package/dist/actions/admin/metrics.d.ts +4 -0
  12. package/dist/actions/admin/metrics.js +11 -0
  13. package/dist/actions/admin/metrics.js.map +1 -0
  14. package/dist/actions/aliases/createOrUpdateAlias.d.ts +3 -0
  15. package/dist/actions/aliases/createOrUpdateAlias.js +10 -0
  16. package/dist/actions/aliases/createOrUpdateAlias.js.map +1 -0
  17. package/dist/actions/aliases/deleteAlias.d.ts +3 -0
  18. package/dist/actions/aliases/deleteAlias.js +7 -0
  19. package/dist/actions/aliases/deleteAlias.js.map +1 -0
  20. package/dist/actions/aliases/getAlias.d.ts +3 -0
  21. package/dist/actions/aliases/getAlias.js +7 -0
  22. package/dist/actions/aliases/getAlias.js.map +1 -0
  23. package/dist/actions/aliases/listAliases.d.ts +3 -0
  24. package/dist/actions/aliases/listAliases.js +7 -0
  25. package/dist/actions/aliases/listAliases.js.map +1 -0
  26. package/dist/actions/collections/createCollection.d.ts +3 -0
  27. package/dist/actions/collections/createCollection.js +18 -0
  28. package/dist/actions/collections/createCollection.js.map +1 -0
  29. package/dist/actions/collections/deleteCollection.d.ts +3 -0
  30. package/dist/actions/collections/deleteCollection.js +13 -0
  31. package/dist/actions/collections/deleteCollection.js.map +1 -0
  32. package/dist/actions/collections/getCollection.d.ts +3 -0
  33. package/dist/actions/collections/getCollection.js +11 -0
  34. package/dist/actions/collections/getCollection.js.map +1 -0
  35. package/dist/actions/collections/getOrCreateCollection.d.ts +3 -0
  36. package/dist/actions/collections/getOrCreateCollection.js +19 -0
  37. package/dist/actions/collections/getOrCreateCollection.js.map +1 -0
  38. package/dist/actions/collections/listCollections.d.ts +3 -0
  39. package/dist/actions/collections/listCollections.js +7 -0
  40. package/dist/actions/collections/listCollections.js.map +1 -0
  41. package/dist/actions/collections/updateCollection.d.ts +3 -0
  42. package/dist/actions/collections/updateCollection.js +14 -0
  43. package/dist/actions/collections/updateCollection.js.map +1 -0
  44. package/dist/actions/documents/clearCollection.d.ts +5 -0
  45. package/dist/actions/documents/clearCollection.js +11 -0
  46. package/dist/actions/documents/clearCollection.js.map +1 -0
  47. package/dist/actions/documents/deleteByFilter.d.ts +5 -0
  48. package/dist/actions/documents/deleteByFilter.js +15 -0
  49. package/dist/actions/documents/deleteByFilter.js.map +1 -0
  50. package/dist/actions/documents/deleteDocument.d.ts +3 -0
  51. package/dist/actions/documents/deleteDocument.js +14 -0
  52. package/dist/actions/documents/deleteDocument.js.map +1 -0
  53. package/dist/actions/documents/exportDocuments.d.ts +5 -0
  54. package/dist/actions/documents/exportDocuments.js +51 -0
  55. package/dist/actions/documents/exportDocuments.js.map +1 -0
  56. package/dist/actions/documents/getDocumentById.d.ts +3 -0
  57. package/dist/actions/documents/getDocumentById.js +12 -0
  58. package/dist/actions/documents/getDocumentById.js.map +1 -0
  59. package/dist/actions/documents/importDocuments.d.ts +4 -0
  60. package/dist/actions/documents/importDocuments.js +58 -0
  61. package/dist/actions/documents/importDocuments.js.map +1 -0
  62. package/dist/actions/documents/insertDocument.d.ts +3 -0
  63. package/dist/actions/documents/insertDocument.js +38 -0
  64. package/dist/actions/documents/insertDocument.js.map +1 -0
  65. package/dist/actions/documents/updateDocument.d.ts +5 -0
  66. package/dist/actions/documents/updateDocument.js +15 -0
  67. package/dist/actions/documents/updateDocument.js.map +1 -0
  68. package/dist/actions/documents/upsertDocument.d.ts +3 -0
  69. package/dist/actions/documents/upsertDocument.js +16 -0
  70. package/dist/actions/documents/upsertDocument.js.map +1 -0
  71. package/dist/actions/overrides/deleteOverride.d.ts +3 -0
  72. package/dist/actions/overrides/deleteOverride.js +8 -0
  73. package/dist/actions/overrides/deleteOverride.js.map +1 -0
  74. package/dist/actions/overrides/getOverride.d.ts +3 -0
  75. package/dist/actions/overrides/getOverride.js +8 -0
  76. package/dist/actions/overrides/getOverride.js.map +1 -0
  77. package/dist/actions/overrides/listOverrides.d.ts +5 -0
  78. package/dist/actions/overrides/listOverrides.js +8 -0
  79. package/dist/actions/overrides/listOverrides.js.map +1 -0
  80. package/dist/actions/overrides/upsertOverride.d.ts +3 -0
  81. package/dist/actions/overrides/upsertOverride.js +11 -0
  82. package/dist/actions/overrides/upsertOverride.js.map +1 -0
  83. package/dist/actions/presets/deletePreset.d.ts +3 -0
  84. package/dist/actions/presets/deletePreset.js +7 -0
  85. package/dist/actions/presets/deletePreset.js.map +1 -0
  86. package/dist/actions/presets/getPreset.d.ts +3 -0
  87. package/dist/actions/presets/getPreset.js +7 -0
  88. package/dist/actions/presets/getPreset.js.map +1 -0
  89. package/dist/actions/presets/listPresets.d.ts +5 -0
  90. package/dist/actions/presets/listPresets.js +7 -0
  91. package/dist/actions/presets/listPresets.js.map +1 -0
  92. package/dist/actions/presets/upsertPreset.d.ts +3 -0
  93. package/dist/actions/presets/upsertPreset.js +10 -0
  94. package/dist/actions/presets/upsertPreset.js.map +1 -0
  95. package/dist/actions/search/multiSearch.d.ts +3 -0
  96. package/dist/actions/search/multiSearch.js +10 -0
  97. package/dist/actions/search/multiSearch.js.map +1 -0
  98. package/dist/actions/search/search.d.ts +5 -0
  99. package/dist/actions/search/search.js +19 -0
  100. package/dist/actions/search/search.js.map +1 -0
  101. package/dist/actions/synonyms/deleteSynonym.d.ts +3 -0
  102. package/dist/actions/synonyms/deleteSynonym.js +8 -0
  103. package/dist/actions/synonyms/deleteSynonym.js.map +1 -0
  104. package/dist/actions/synonyms/getSynonym.d.ts +3 -0
  105. package/dist/actions/synonyms/getSynonym.js +8 -0
  106. package/dist/actions/synonyms/getSynonym.js.map +1 -0
  107. package/dist/actions/synonyms/listSynonyms.d.ts +5 -0
  108. package/dist/actions/synonyms/listSynonyms.js +8 -0
  109. package/dist/actions/synonyms/listSynonyms.js.map +1 -0
  110. package/dist/actions/synonyms/upsertSynonym.d.ts +3 -0
  111. package/dist/actions/synonyms/upsertSynonym.js +11 -0
  112. package/dist/actions/synonyms/upsertSynonym.js.map +1 -0
  113. package/dist/components/export-formatter.d.ts +16 -0
  114. package/dist/components/export-formatter.js +226 -0
  115. package/dist/components/export-formatter.js.map +1 -0
  116. package/dist/components/http-client.d.ts +50 -0
  117. package/dist/components/http-client.js +149 -0
  118. package/dist/components/http-client.js.map +1 -0
  119. package/dist/components/resilience-policy.d.ts +33 -0
  120. package/dist/components/resilience-policy.js +115 -0
  121. package/dist/components/resilience-policy.js.map +1 -0
  122. package/dist/components/schema-manager.d.ts +30 -0
  123. package/dist/components/schema-manager.js +227 -0
  124. package/dist/components/schema-manager.js.map +1 -0
  125. package/dist/components/typesense.filter-builder.d.ts +127 -0
  126. package/dist/components/typesense.filter-builder.js +216 -0
  127. package/dist/components/typesense.filter-builder.js.map +1 -0
  128. package/dist/examples/multitenancy-example.d.ts +4 -0
  129. package/dist/examples/multitenancy-example.js +182 -0
  130. package/dist/examples/multitenancy-example.js.map +1 -0
  131. package/dist/index.d.ts +10 -0
  132. package/dist/index.js +23 -0
  133. package/dist/index.js.map +1 -0
  134. package/dist/tests/const.d.ts +6 -0
  135. package/dist/tests/const.js +22 -0
  136. package/dist/tests/const.js.map +1 -0
  137. package/dist/tests/typesense.d.ts +2 -0
  138. package/dist/tests/typesense.js +24 -0
  139. package/dist/tests/typesense.js.map +1 -0
  140. package/dist/types.d.ts +16 -0
  141. package/dist/types.js +3 -0
  142. package/dist/types.js.map +1 -0
  143. package/dist/typesense.model.d.ts +455 -0
  144. package/dist/typesense.model.js +98 -0
  145. package/dist/typesense.model.js.map +1 -0
  146. package/dist/utils/tenant.d.ts +48 -0
  147. package/dist/utils/tenant.js +89 -0
  148. package/dist/utils/tenant.js.map +1 -0
  149. package/package.json +60 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypesenseApi.js","sourceRoot":"","sources":["../src/TypesenseApi.ts"],"names":[],"mappings":";;;;AAAA,cAAc;AACd,6EAAyE;AACzE,uEAAmE;AACnE,6EAAyE;AACzE,6EAAyE;AACzE,2EAAuE;AACvE,uFAAmF;AAEnF,YAAY;AACZ,uEAAmE;AACnE,uEAAmE;AACnE,uEAAmE;AACnE,uEAAmE;AACnE,yEAAqE;AACrE,yEAAqE;AACrE,yEAA4F;AAC5F,uEAAmE;AACnE,yEAAqE;AAErE,SAAS;AACT,oDAA0E;AAC1E,8DAA0D;AAE1D,QAAQ;AACR,mDAA8D;AAC9D,qDAA8D;AAC9D,2EAAuE;AAEvE,UAAU;AACV,+EAA2E;AAC3E,yDAAqD;AACrD,+DAA2D;AAC3D,+DAA2D;AAE3D,WAAW;AACX,oEAAgE;AAChE,8DAA0D;AAC1D,kEAA8D;AAC9D,oEAAgE;AAEhE,YAAY;AACZ,uEAAmE;AACnE,iEAA6D;AAC7D,qEAAiE;AACjE,uEAAmE;AAEnE,UAAU;AACV,iEAA6D;AAC7D,2DAAuD;AACvD,+DAA2D;AAC3D,iEAA6D;AAI7D,0DAAsF;AACtF,sEAA+F;AAC/F,gEAAqE;AACrE,2CAA6D;AAkB7D;;GAEG;AACH,SAAS,OAAO,CAAqB,GAAQ;IAC3C,OAAO,CAA8C,EAAK,EAAE,EAAE;QAC5D,OAAO,CAAC,GAAG,IAA+D,EAAE,EAAE,CAC5E,EAAE,CAAC,GAAG,EAAE,GAAG,IAAW,CAAC,CAAA;IAC3B,CAAC,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAa,YAAY;IACN,GAAG,CAAkB;IAC9B,OAAO,C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AO;QACL,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAA;QAC/B,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAA;IACzB,CAAC;CACF;AAlVD,oCAkVC;AAED,yDAAyD;AACzD,iFAAsD;AACtD,8EAAmD;AACnD,iFAAsD;AACtD,iFAAsD;AACtD,gFAAqD;AACrD,sFAA2D;AAE3D,6EAAkD;AAClD,6EAAkD;AAClD,6EAAkD;AAClD,6EAAkD;AAClD,8EAAmD;AACnD,8EAAmD;AACnD,8EAAmD;AACnD,6EAAkD;AAClD,8EAAmD;AAEnD,kEAAuC;AACvC,uEAA4C;AAE5C,iEAAsC;AACtC,kEAAuC;AACvC,6EAAkD;AAElD,gFAAqD;AACrD,qEAA0C;AAC1C,wEAA6C;AAC7C,wEAA6C;AAE7C,2EAAgD;AAChD,wEAA6C;AAC7C,0EAA+C;AAC/C,2EAAgD;AAEhD,6EAAkD;AAClD,0EAA+C;AAC/C,4EAAiD;AACjD,6EAAkD;AAElD,yEAA8C;AAC9C,sEAA2C;AAC3C,wEAA6C;AAC7C,yEAA8C;AAE9C,0BAA0B;AAC1B,yDAA8B"}
@@ -0,0 +1,3 @@
1
+ import type { TypesenseCollectionStats } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function getCollectionStats(ctx: TypesenseContext, collectionName?: string): Promise<TypesenseCollectionStats>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCollectionStats = getCollectionStats;
4
+ async function getCollectionStats(ctx, collectionName) {
5
+ const collection = collectionName || ctx.fqcn();
6
+ return await ctx.httpClient.request(`/collections/${collection}/stats`);
7
+ }
8
+ //# sourceMappingURL=getCollectionStats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCollectionStats.js","sourceRoot":"","sources":["../../../src/actions/admin/getCollectionStats.ts"],"names":[],"mappings":";;AAGA,gDAQC;AARM,KAAK,UAAU,kBAAkB,CACtC,GAAqB,EACrB,cAAuB;IAEvB,MAAM,UAAU,GAAG,cAAc,IAAI,GAAG,CAAC,IAAI,EAAE,CAAA;IAC/C,OAAO,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CACjC,gBAAgB,UAAU,QAAQ,CACnC,CAAA;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { TypesenseHealthResponse } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function health(ctx: TypesenseContext): Promise<TypesenseHealthResponse>;
4
+ export declare function waitForHealth(ctx: TypesenseContext, maxRetries?: number, delayMs?: number): Promise<void>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.health = health;
4
+ exports.waitForHealth = waitForHealth;
5
+ async function health(ctx) {
6
+ return await ctx.httpClient.request('/health');
7
+ }
8
+ async function waitForHealth(ctx, maxRetries = 15, delayMs = 1000) {
9
+ for (let i = 0; i < maxRetries; i++) {
10
+ try {
11
+ await health(ctx);
12
+ return;
13
+ }
14
+ catch (error) {
15
+ if (i === maxRetries - 1) {
16
+ throw new Error(`Typesense failed to become healthy after ${maxRetries} retries`);
17
+ }
18
+ await new Promise(resolve => setTimeout(resolve, delayMs));
19
+ }
20
+ }
21
+ }
22
+ //# sourceMappingURL=health.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.js","sourceRoot":"","sources":["../../../src/actions/admin/health.ts"],"names":[],"mappings":";;AAGA,wBAEC;AAED,sCAgBC;AApBM,KAAK,UAAU,MAAM,CAAC,GAAqB;IAChD,OAAO,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CAA0B,SAAS,CAAC,CAAA;AACzE,CAAC;AAEM,KAAK,UAAU,aAAa,CACjC,GAAqB,EACrB,aAAqB,EAAE,EACvB,UAAkB,IAAI;IAEtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,GAAG,CAAC,CAAA;YACjB,OAAM;QACR,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,UAAU,GAAG,CAAC,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CAAC,4CAA4C,UAAU,UAAU,CAAC,CAAA;YACnF,CAAC;YACD,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAA;QAC5D,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { TypesenseMetrics } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function getMetrics(ctx: TypesenseContext): Promise<TypesenseMetrics>;
4
+ export declare function getStats(ctx: TypesenseContext): Promise<any>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMetrics = getMetrics;
4
+ exports.getStats = getStats;
5
+ async function getMetrics(ctx) {
6
+ return await ctx.httpClient.request('/metrics.json');
7
+ }
8
+ async function getStats(ctx) {
9
+ return await ctx.httpClient.request('/stats.json');
10
+ }
11
+ //# sourceMappingURL=metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/actions/admin/metrics.ts"],"names":[],"mappings":";;AAGA,gCAEC;AAED,4BAEC;AANM,KAAK,UAAU,UAAU,CAAC,GAAqB;IACpD,OAAO,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CAAmB,eAAe,CAAC,CAAA;AACxE,CAAC;AAEM,KAAK,UAAU,QAAQ,CAAC,GAAqB;IAClD,OAAO,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CAAM,aAAa,CAAC,CAAA;AACzD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { TypesenseAliasResponse } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function createOrUpdateAlias(ctx: TypesenseContext, aliasName: string, collectionName: string): Promise<TypesenseAliasResponse>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createOrUpdateAlias = createOrUpdateAlias;
4
+ async function createOrUpdateAlias(ctx, aliasName, collectionName) {
5
+ return await ctx.httpClient.request(`/aliases/${aliasName}`, {
6
+ method: 'PUT',
7
+ body: { collection_name: collectionName }
8
+ });
9
+ }
10
+ //# sourceMappingURL=createOrUpdateAlias.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createOrUpdateAlias.js","sourceRoot":"","sources":["../../../src/actions/aliases/createOrUpdateAlias.ts"],"names":[],"mappings":";;AAGA,kDAYC;AAZM,KAAK,UAAU,mBAAmB,CACvC,GAAqB,EACrB,SAAiB,EACjB,cAAsB;IAEtB,OAAO,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CACjC,YAAY,SAAS,EAAE,EACvB;QACE,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,EAAE,eAAe,EAAE,cAAc,EAAE;KAC1C,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { TypesenseAliasResponse } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function deleteAlias(ctx: TypesenseContext, aliasName: string): Promise<TypesenseAliasResponse>;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteAlias = deleteAlias;
4
+ async function deleteAlias(ctx, aliasName) {
5
+ return await ctx.httpClient.request(`/aliases/${aliasName}`, { method: 'DELETE' });
6
+ }
7
+ //# sourceMappingURL=deleteAlias.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteAlias.js","sourceRoot":"","sources":["../../../src/actions/aliases/deleteAlias.ts"],"names":[],"mappings":";;AAGA,kCAQC;AARM,KAAK,UAAU,WAAW,CAC/B,GAAqB,EACrB,SAAiB;IAEjB,OAAO,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CACjC,YAAY,SAAS,EAAE,EACvB,EAAE,MAAM,EAAE,QAAQ,EAAE,CACrB,CAAA;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { TypesenseAliasResponse } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function getAlias(ctx: TypesenseContext, aliasName: string): Promise<TypesenseAliasResponse>;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAlias = getAlias;
4
+ async function getAlias(ctx, aliasName) {
5
+ return await ctx.httpClient.request(`/aliases/${aliasName}`);
6
+ }
7
+ //# sourceMappingURL=getAlias.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAlias.js","sourceRoot":"","sources":["../../../src/actions/aliases/getAlias.ts"],"names":[],"mappings":";;AAGA,4BAOC;AAPM,KAAK,UAAU,QAAQ,CAC5B,GAAqB,EACrB,SAAiB;IAEjB,OAAO,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CACjC,YAAY,SAAS,EAAE,CACxB,CAAA;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { TypesenseAliasListResponse } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function listAliases(ctx: TypesenseContext): Promise<TypesenseAliasListResponse>;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listAliases = listAliases;
4
+ async function listAliases(ctx) {
5
+ return await ctx.httpClient.request('/aliases');
6
+ }
7
+ //# sourceMappingURL=listAliases.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listAliases.js","sourceRoot":"","sources":["../../../src/actions/aliases/listAliases.ts"],"names":[],"mappings":";;AAGA,kCAIC;AAJM,KAAK,UAAU,WAAW,CAC/B,GAAqB;IAErB,OAAO,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CAA6B,UAAU,CAAC,CAAA;AAC7E,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { TypesenseCollection, TypesenseCollectionOutput } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function createCollection(ctx: TypesenseContext, collection: TypesenseCollection): Promise<TypesenseCollectionOutput>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCollection = createCollection;
4
+ async function createCollection(ctx, collection) {
5
+ // Use fqcn for the collection name if tenant is configured
6
+ const collectionWithFqcn = {
7
+ ...collection,
8
+ name: ctx.fqcn(collection.name)
9
+ };
10
+ const result = await ctx.httpClient.request('/collections', {
11
+ method: 'POST',
12
+ body: collectionWithFqcn
13
+ });
14
+ // Cache the schema with the fully qualified name
15
+ ctx.schemaManager.setCachedSchema(collectionWithFqcn.name, collectionWithFqcn);
16
+ return result;
17
+ }
18
+ //# sourceMappingURL=createCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createCollection.js","sourceRoot":"","sources":["../../../src/actions/collections/createCollection.ts"],"names":[],"mappings":";;AAGA,4CAsBC;AAtBM,KAAK,UAAU,gBAAgB,CACpC,GAAqB,EACrB,UAA+B;IAE/B,2DAA2D;IAC3D,MAAM,kBAAkB,GAAG;QACzB,GAAG,UAAU;QACb,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;KAChC,CAAA;IAED,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CACzC,cAAc,EACd;QACE,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,kBAAkB;KACzB,CACF,CAAA;IAED,iDAAiD;IACjD,GAAG,CAAC,aAAa,CAAC,eAAe,CAAC,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAA;IAE9E,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { TypesenseCollectionOutput } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function deleteCollection(ctx: TypesenseContext, collectionName?: string): Promise<TypesenseCollectionOutput>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteCollection = deleteCollection;
4
+ async function deleteCollection(ctx, collectionName) {
5
+ const collection = collectionName || ctx.fqcn();
6
+ const result = await ctx.httpClient.request(`/collections/${collection}`, {
7
+ method: 'DELETE'
8
+ });
9
+ // Remove from cache
10
+ ctx.schemaManager.deleteCachedSchema(collection);
11
+ return result;
12
+ }
13
+ //# sourceMappingURL=deleteCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteCollection.js","sourceRoot":"","sources":["../../../src/actions/collections/deleteCollection.ts"],"names":[],"mappings":";;AAGA,4CAiBC;AAjBM,KAAK,UAAU,gBAAgB,CACpC,GAAqB,EACrB,cAAuB;IAEvB,MAAM,UAAU,GAAG,cAAc,IAAI,GAAG,CAAC,IAAI,EAAE,CAAA;IAE/C,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CACzC,gBAAgB,UAAU,EAAE,EAC5B;QACE,MAAM,EAAE,QAAQ;KACjB,CACF,CAAA;IAED,oBAAoB;IACpB,GAAG,CAAC,aAAa,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAA;IAEhD,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { TypesenseCollectionOutput } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function getCollection(ctx: TypesenseContext, collectionName?: string): Promise<TypesenseCollectionOutput>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCollection = getCollection;
4
+ async function getCollection(ctx, collectionName) {
5
+ const collection = collectionName || ctx.fqcn();
6
+ const result = await ctx.httpClient.request(`/collections/${collection}`);
7
+ // Update cache
8
+ ctx.schemaManager.setCachedSchema(collection, result);
9
+ return result;
10
+ }
11
+ //# sourceMappingURL=getCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCollection.js","sourceRoot":"","sources":["../../../src/actions/collections/getCollection.ts"],"names":[],"mappings":";;AAGA,sCAcC;AAdM,KAAK,UAAU,aAAa,CACjC,GAAqB,EACrB,cAAuB;IAEvB,MAAM,UAAU,GAAG,cAAc,IAAI,GAAG,CAAC,IAAI,EAAE,CAAA;IAE/C,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CACzC,gBAAgB,UAAU,EAAE,CAC7B,CAAA;IAED,eAAe;IACf,GAAG,CAAC,aAAa,CAAC,eAAe,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IAErD,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { TypesenseCollection, TypesenseCollectionOutput } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function getOrCreateCollection(ctx: TypesenseContext, collection: TypesenseCollection): Promise<TypesenseCollectionOutput>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOrCreateCollection = getOrCreateCollection;
4
+ const getCollection_1 = require("./getCollection");
5
+ const createCollection_1 = require("./createCollection");
6
+ async function getOrCreateCollection(ctx, collection) {
7
+ try {
8
+ // Try to get existing collection
9
+ return await (0, getCollection_1.getCollection)(ctx, collection.name);
10
+ }
11
+ catch (error) {
12
+ // If collection doesn't exist (404), create it
13
+ if (error.status === 404) {
14
+ return await (0, createCollection_1.createCollection)(ctx, collection);
15
+ }
16
+ throw error;
17
+ }
18
+ }
19
+ //# sourceMappingURL=getOrCreateCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getOrCreateCollection.js","sourceRoot":"","sources":["../../../src/actions/collections/getOrCreateCollection.ts"],"names":[],"mappings":";;AAKA,sDAcC;AAjBD,mDAA+C;AAC/C,yDAAqD;AAE9C,KAAK,UAAU,qBAAqB,CACzC,GAAqB,EACrB,UAA+B;IAE/B,IAAI,CAAC;QACH,iCAAiC;QACjC,OAAO,MAAM,IAAA,6BAAa,EAAC,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;IAClD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,+CAA+C;QAC/C,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YACzB,OAAO,MAAM,IAAA,mCAAgB,EAAC,GAAG,EAAE,UAAU,CAAC,CAAA;QAChD,CAAC;QACD,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { TypesenseCollectionOutput } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function listCollections(ctx: TypesenseContext): Promise<TypesenseCollectionOutput[]>;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listCollections = listCollections;
4
+ async function listCollections(ctx) {
5
+ return ctx.httpClient.request('/collections');
6
+ }
7
+ //# sourceMappingURL=listCollections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listCollections.js","sourceRoot":"","sources":["../../../src/actions/collections/listCollections.ts"],"names":[],"mappings":";;AAGA,0CAIC;AAJM,KAAK,UAAU,eAAe,CACnC,GAAqB;IAErB,OAAO,GAAG,CAAC,UAAU,CAAC,OAAO,CAA8B,cAAc,CAAC,CAAA;AAC5E,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { TypesenseCollection, TypesenseCollectionOutput, TypesenseCollectionOptions } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function updateCollection(ctx: TypesenseContext, collection: Partial<TypesenseCollection>, options?: TypesenseCollectionOptions): Promise<TypesenseCollectionOutput>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateCollection = updateCollection;
4
+ async function updateCollection(ctx, collection, options) {
5
+ const collectionName = options?.collection || collection.name || ctx.fqcn();
6
+ const result = await ctx.httpClient.request(`/collections/${collectionName}`, {
7
+ method: 'PATCH',
8
+ body: collection
9
+ });
10
+ // Update cache
11
+ ctx.schemaManager.setCachedSchema(collectionName, result);
12
+ return result;
13
+ }
14
+ //# sourceMappingURL=updateCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateCollection.js","sourceRoot":"","sources":["../../../src/actions/collections/updateCollection.ts"],"names":[],"mappings":";;AAGA,4CAmBC;AAnBM,KAAK,UAAU,gBAAgB,CACpC,GAAqB,EACrB,UAAwC,EACxC,OAAoC;IAEpC,MAAM,cAAc,GAAG,OAAO,EAAE,UAAU,IAAI,UAAU,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,EAAE,CAAA;IAE3E,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CACzC,gBAAgB,cAAc,EAAE,EAChC;QACE,MAAM,EAAE,OAAO;QACf,IAAI,EAAE,UAAU;KACjB,CACF,CAAA;IAED,eAAe;IACf,GAAG,CAAC,aAAa,CAAC,eAAe,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;IAEzD,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { TypesenseCollectionOptions } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function clearCollection(ctx: TypesenseContext, options?: TypesenseCollectionOptions): Promise<{
4
+ num_deleted: number;
5
+ }>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clearCollection = clearCollection;
4
+ async function clearCollection(ctx, options) {
5
+ const collectionName = options?.collection || ctx.fqcn();
6
+ return await ctx.httpClient.request(`/collections/${collectionName}/documents`, {
7
+ method: 'DELETE',
8
+ searchParams: { filter_by: '*' }
9
+ });
10
+ }
11
+ //# sourceMappingURL=clearCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clearCollection.js","sourceRoot":"","sources":["../../../src/actions/documents/clearCollection.ts"],"names":[],"mappings":";;AAGA,0CAaC;AAbM,KAAK,UAAU,eAAe,CACnC,GAAqB,EACrB,OAAoC;IAEpC,MAAM,cAAc,GAAG,OAAO,EAAE,UAAU,IAAI,GAAG,CAAC,IAAI,EAAE,CAAA;IAExD,OAAO,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CACjC,gBAAgB,cAAc,YAAY,EAC1C;QACE,MAAM,EAAE,QAAQ;QAChB,YAAY,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE;KACjC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { TypesenseDeleteByFilterOptions, TypesenseCollectionOptions } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function deleteByFilter(ctx: TypesenseContext, filter: string, options?: TypesenseDeleteByFilterOptions & TypesenseCollectionOptions): Promise<{
4
+ num_deleted: number;
5
+ }>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteByFilter = deleteByFilter;
4
+ async function deleteByFilter(ctx, filter, options) {
5
+ const collectionName = options?.collection || ctx.fqcn();
6
+ const params = new URLSearchParams({ filter_by: filter });
7
+ if (options?.batch_size) {
8
+ params.set('batch_size', options.batch_size.toString());
9
+ }
10
+ return await ctx.httpClient.request(`/collections/${collectionName}/documents`, {
11
+ method: 'DELETE',
12
+ searchParams: params
13
+ });
14
+ }
15
+ //# sourceMappingURL=deleteByFilter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteByFilter.js","sourceRoot":"","sources":["../../../src/actions/documents/deleteByFilter.ts"],"names":[],"mappings":";;AAMA,wCAoBC;AApBM,KAAK,UAAU,cAAc,CAClC,GAAqB,EACrB,MAAc,EACd,OAAqE;IAErE,MAAM,cAAc,GAAG,OAAO,EAAE,UAAU,IAAI,GAAG,CAAC,IAAI,EAAE,CAAA;IAExD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAA;IAEzD,IAAI,OAAO,EAAE,UAAU,EAAE,CAAC;QACxB,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAA;IACzD,CAAC;IAED,OAAO,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CACjC,gBAAgB,cAAc,YAAY,EAC1C;QACE,MAAM,EAAE,QAAQ;QAChB,YAAY,EAAE,MAAM;KACrB,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { TypesenseDocument, TypesenseCollectionOptions } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function deleteDocument<T extends Record<string, any>>(ctx: TypesenseContext, id: string | number, options?: TypesenseCollectionOptions): Promise<TypesenseDocument<T>>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteDocument = deleteDocument;
4
+ const typesense_model_1 = require("../../typesense.model");
5
+ async function deleteDocument(ctx, id, options) {
6
+ if (!(0, typesense_model_1.isValidDocumentId)(id)) {
7
+ throw new Error('Invalid document id');
8
+ }
9
+ const collectionName = options?.collection || ctx.fqcn();
10
+ return await ctx.httpClient.request(`/collections/${collectionName}/documents/${id}`, {
11
+ method: 'DELETE'
12
+ });
13
+ }
14
+ //# sourceMappingURL=deleteDocument.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteDocument.js","sourceRoot":"","sources":["../../../src/actions/documents/deleteDocument.ts"],"names":[],"mappings":";;AAIA,wCAiBC;AApBD,2DAAyD;AAGlD,KAAK,UAAU,cAAc,CAClC,GAAqB,EACrB,EAAmB,EACnB,OAAoC;IAEpC,IAAI,CAAC,IAAA,mCAAiB,EAAC,EAAE,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACxC,CAAC;IAED,MAAM,cAAc,GAAG,OAAO,EAAE,UAAU,IAAI,GAAG,CAAC,IAAI,EAAE,CAAA;IAExD,OAAO,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CACjC,gBAAgB,cAAc,cAAc,EAAE,EAAE,EAChD;QACE,MAAM,EAAE,QAAQ;KACjB,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Readable } from 'stream';
2
+ import type { TypesenseDocument, TypesenseExportFormat, TypesenseExportOptions, TypesenseCollectionOptions } from '../../typesense.model';
3
+ import type { TypesenseContext } from '../../types';
4
+ export declare function exportDocuments<T extends Record<string, any>>(ctx: TypesenseContext, format?: TypesenseExportFormat, options?: TypesenseExportOptions & TypesenseCollectionOptions): Promise<string | TypesenseDocument<T>[]>;
5
+ export declare function exportDocumentsStream<T extends Record<string, any>>(ctx: TypesenseContext, options?: TypesenseExportOptions & TypesenseCollectionOptions): Promise<Readable>;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.exportDocuments = exportDocuments;
4
+ exports.exportDocumentsStream = exportDocumentsStream;
5
+ const stream_1 = require("stream");
6
+ const typesense_model_1 = require("../../typesense.model");
7
+ const export_formatter_1 = require("../../components/export-formatter");
8
+ async function exportDocuments(ctx, format = 'jsonl', options) {
9
+ // Validate format
10
+ const supportedFormats = ['jsonl', 'json', 'csv'];
11
+ if (!supportedFormats.includes(format)) {
12
+ throw new typesense_model_1.TypesenseError(`Unsupported export format: ${format}`, 400);
13
+ }
14
+ const collectionName = options?.collection || ctx.fqcn();
15
+ const { collection, ...exportOptions } = options || {};
16
+ const searchParams = {
17
+ ...exportOptions
18
+ // Note: Typesense export always returns JSONL regardless of format param
19
+ };
20
+ // Get response as text (JSONL format)
21
+ const response = await ctx.httpClient.requestText(`/collections/${collectionName}/documents/export`, { searchParams });
22
+ if (format === 'json') {
23
+ // Parse JSONL to JSON array
24
+ return response
25
+ .split('\n')
26
+ .filter(line => line.trim())
27
+ .map(line => JSON.parse(line));
28
+ }
29
+ else if (format === 'csv') {
30
+ // For small datasets, convert JSONL to CSV
31
+ const documents = response
32
+ .split('\n')
33
+ .filter(line => line.trim())
34
+ .map(line => JSON.parse(line));
35
+ return export_formatter_1.ExportFormatter.formatCSV(documents);
36
+ }
37
+ return response;
38
+ }
39
+ async function exportDocumentsStream(ctx, options) {
40
+ const collectionName = options?.collection || ctx.fqcn();
41
+ const { collection, ...exportOptions } = options || {};
42
+ const searchParams = {
43
+ ...exportOptions
44
+ };
45
+ return ctx.httpClient
46
+ .stream(`/collections/${collectionName}/documents/export`, {
47
+ searchParams
48
+ })
49
+ .then(stream => stream_1.Readable.fromWeb(stream));
50
+ }
51
+ //# sourceMappingURL=exportDocuments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exportDocuments.js","sourceRoot":"","sources":["../../../src/actions/documents/exportDocuments.ts"],"names":[],"mappings":";;AAWA,0CAyCC;AAED,sDAeC;AArED,mCAAiC;AAOjC,2DAAsD;AACtD,wEAAmE;AAG5D,KAAK,UAAU,eAAe,CACnC,GAAqB,EACrB,SAAgC,OAAO,EACvC,OAA6D;IAE7D,kBAAkB;IAClB,MAAM,gBAAgB,GAA4B,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;IAC1E,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,gCAAc,CAAC,8BAA8B,MAAM,EAAE,EAAE,GAAG,CAAC,CAAA;IACvE,CAAC;IAED,MAAM,cAAc,GAAG,OAAO,EAAE,UAAU,IAAI,GAAG,CAAC,IAAI,EAAE,CAAA;IACxD,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA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AY;KACb,CAAC;SACD,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,iBAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;AAC7C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { TypesenseDocument, TypesenseCollectionOptions } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function getDocumentById<T extends Record<string, any>>(ctx: TypesenseContext, id: string | number, options?: TypesenseCollectionOptions): Promise<TypesenseDocument<T>>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDocumentById = getDocumentById;
4
+ const typesense_model_1 = require("../../typesense.model");
5
+ async function getDocumentById(ctx, id, options) {
6
+ if (!(0, typesense_model_1.isValidDocumentId)(id)) {
7
+ throw new Error('Invalid document id');
8
+ }
9
+ const collectionName = options?.collection || ctx.fqcn();
10
+ return await ctx.httpClient.request(`/collections/${collectionName}/documents/${id}`);
11
+ }
12
+ //# sourceMappingURL=getDocumentById.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDocumentById.js","sourceRoot":"","sources":["../../../src/actions/documents/getDocumentById.ts"],"names":[],"mappings":";;AAIA,0CAcC;AAjBD,2DAAyD;AAGlD,KAAK,UAAU,eAAe,CACnC,GAAqB,EACrB,EAAmB,EACnB,OAAoC;IAEpC,IAAI,CAAC,IAAA,mCAAiB,EAAC,EAAE,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACxC,CAAC;IAED,MAAM,cAAc,GAAG,OAAO,EAAE,UAAU,IAAI,GAAG,CAAC,IAAI,EAAE,CAAA;IAExD,OAAO,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CACjC,gBAAgB,cAAc,cAAc,EAAE,EAAE,CACjD,CAAA;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Readable } from 'stream';
2
+ import type { TypesenseDocument, TypesenseImportResult, TypesenseImportFormat, TypesenseImportOptions, TypesenseCollectionOptions } from '../../typesense.model';
3
+ import type { TypesenseContext } from '../../types';
4
+ export declare function importDocuments<T extends Record<string, any>>(ctx: TypesenseContext, documents: TypesenseDocument<T>[] | string | Readable, format?: TypesenseImportFormat, importOptions?: TypesenseImportOptions, collectionOptions?: TypesenseCollectionOptions): Promise<TypesenseImportResult[]>;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.importDocuments = importDocuments;
4
+ const stream_1 = require("stream");
5
+ const typesense_model_1 = require("../../typesense.model");
6
+ const export_formatter_1 = require("../../components/export-formatter");
7
+ async function importDocuments(ctx, documents, format = 'jsonl', importOptions, collectionOptions) {
8
+ // Validate format
9
+ const supportedFormats = ['jsonl', 'json', 'csv'];
10
+ if (!supportedFormats.includes(format)) {
11
+ throw new typesense_model_1.TypesenseError('Unsupported format', 400);
12
+ }
13
+ const collectionName = collectionOptions?.collection || ctx.fqcn();
14
+ let bodyStream;
15
+ if (documents instanceof stream_1.Readable) {
16
+ bodyStream = documents;
17
+ }
18
+ else if (typeof documents === 'string') {
19
+ if (format === 'csv') {
20
+ throw new typesense_model_1.TypesenseError('CSV import requires conversion', 400);
21
+ }
22
+ else if (format === 'json') {
23
+ // Convert JSON array string to JSONL
24
+ const parsedDocuments = JSON.parse(documents);
25
+ const jsonlData = parsedDocuments.map((doc) => JSON.stringify(doc)).join('\n');
26
+ bodyStream = stream_1.Readable.from([jsonlData]);
27
+ }
28
+ else {
29
+ // Assume it's already JSONL
30
+ bodyStream = stream_1.Readable.from([documents]);
31
+ }
32
+ }
33
+ else {
34
+ // Array of documents
35
+ if (format === 'csv') {
36
+ throw new typesense_model_1.TypesenseError('CSV import requires conversion', 400);
37
+ }
38
+ const formatted = export_formatter_1.ExportFormatter.formatDocuments(documents, format);
39
+ bodyStream = stream_1.Readable.from([formatted]);
40
+ }
41
+ const searchParams = {
42
+ ...importOptions,
43
+ action: importOptions?.action || 'create'
44
+ };
45
+ // Stream directly to HTTP body for large files
46
+ const response = await ctx.httpClient.requestTextWithRawBody(`/collections/${collectionName}/documents/import`, {
47
+ method: 'POST',
48
+ body: bodyStream,
49
+ searchParams,
50
+ timeout: ctx.httpClient['options'].importTimeout
51
+ });
52
+ // Parse JSONL response to array
53
+ return response
54
+ .split('\n')
55
+ .filter(line => line.trim())
56
+ .map(line => JSON.parse(line));
57
+ }
58
+ //# sourceMappingURL=importDocuments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importDocuments.js","sourceRoot":"","sources":["../../../src/actions/documents/importDocuments.ts"],"names":[],"mappings":";;AAYA,0CA4DC;AAxED,mCAAiC;AAQjC,2DAAsD;AACtD,wEAAmE;AAG5D,KAAK,UAAU,eAAe,CACnC,GAAqB,EACrB,SAAqD,EACrD,SAAgC,OAAO,EACvC,aAAsC,EACtC,iBAA8C;IAE9C,kBAAkB;IAClB,MAAM,gBAAgB,GAA4B,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;IAC1E,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,gCAAc,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAA;IACrD,CAAC;IAED,MAAM,cAAc,GAAG,iBAAiB,EAAE,UAAU,IAAI,GAAG,CAAC,IAAI,EAAE,CAAA;IAClE,IAAI,UAAoB,CAAA;IAExB,IAAI,SAAS,YAAY,iBAAQ,EAAE,CAAC;QAClC,UAAU,GAAG,SAAS,CAAA;IACxB,CAAC;SAAM,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QACzC,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;YACrB,MAAM,IAAI,gCAAc,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAA;QACjE,CAAC;aAAM,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YAC7B,qCAAqC;YACrC,MAAM,eAAe,GAAG,IA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AAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;AAClC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { TypesenseDocument, TypesenseCollectionOptions, WithRequiredId } from '../../typesense.model';
2
+ import type { TypesenseContext } from '../../types';
3
+ export declare function insertDocument<T extends Record<string, any>>(ctx: TypesenseContext, document: WithRequiredId<T>, options?: TypesenseCollectionOptions): Promise<TypesenseDocument<T>>;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.insertDocument = insertDocument;
4
+ const typesense_model_1 = require("../../typesense.model");
5
+ const getOrCreateCollection_1 = require("../collections/getOrCreateCollection");
6
+ async function insertDocument(ctx, document, options) {
7
+ if (!(0, typesense_model_1.isValidDocumentId)(document.id)) {
8
+ throw new typesense_model_1.TypesenseError('Document must have a valid id', 400);
9
+ }
10
+ const collectionName = options?.collection || ctx.fqcn();
11
+ try {
12
+ return await ctx.httpClient.request(`/collections/${collectionName}/documents`, {
13
+ method: 'POST',
14
+ body: document
15
+ });
16
+ }
17
+ catch (error) {
18
+ // Auto-create collection if enabled
19
+ if (ctx.autoCreateCollection &&
20
+ error.status === 404 &&
21
+ error.message?.includes('Not found')) {
22
+ // Infer schema from document
23
+ const inferredSchema = ctx.schemaManager.inferSchemaFromDocument(document, collectionName);
24
+ // Create collection
25
+ await (0, getOrCreateCollection_1.getOrCreateCollection)(ctx, {
26
+ ...inferredSchema,
27
+ name: collectionName
28
+ });
29
+ // Retry insert
30
+ return await ctx.httpClient.request(`/collections/${collectionName}/documents`, {
31
+ method: 'POST',
32
+ body: document
33
+ });
34
+ }
35
+ throw error;
36
+ }
37
+ }
38
+ //# sourceMappingURL=insertDocument.js.map