@depup/typesense 3.0.3-depup.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/LICENSE +201 -0
- package/README.md +31 -0
- package/changes.json +10 -0
- package/dist/typesense.js +13031 -0
- package/dist/typesense.js.map +1 -0
- package/dist/typesense.min.js +3 -0
- package/dist/typesense.min.js.LICENSE.txt +1 -0
- package/dist/typesense.min.js.map +1 -0
- package/lib/Typesense/Alias.d.ts +10 -0
- package/lib/Typesense/Alias.js +30 -0
- package/lib/Typesense/Alias.js.map +1 -0
- package/lib/Typesense/Aliases.d.ts +18 -0
- package/lib/Typesense/Aliases.js +36 -0
- package/lib/Typesense/Aliases.js.map +1 -0
- package/lib/Typesense/Analytics.d.ts +15 -0
- package/lib/Typesense/Analytics.js +40 -0
- package/lib/Typesense/Analytics.js.map +1 -0
- package/lib/Typesense/AnalyticsEvent.d.ts +5 -0
- package/lib/Typesense/AnalyticsEvent.js +3 -0
- package/lib/Typesense/AnalyticsEvent.js.map +1 -0
- package/lib/Typesense/AnalyticsEvents.d.ts +26 -0
- package/lib/Typesense/AnalyticsEvents.js +37 -0
- package/lib/Typesense/AnalyticsEvents.js.map +1 -0
- package/lib/Typesense/AnalyticsRule.d.ts +47 -0
- package/lib/Typesense/AnalyticsRule.js +30 -0
- package/lib/Typesense/AnalyticsRule.js.map +1 -0
- package/lib/Typesense/AnalyticsRuleV1.d.ts +35 -0
- package/lib/Typesense/AnalyticsRuleV1.js +30 -0
- package/lib/Typesense/AnalyticsRuleV1.js.map +1 -0
- package/lib/Typesense/AnalyticsRules.d.ts +16 -0
- package/lib/Typesense/AnalyticsRules.js +49 -0
- package/lib/Typesense/AnalyticsRules.js.map +1 -0
- package/lib/Typesense/AnalyticsRulesV1.d.ts +13 -0
- package/lib/Typesense/AnalyticsRulesV1.js +37 -0
- package/lib/Typesense/AnalyticsRulesV1.js.map +1 -0
- package/lib/Typesense/AnalyticsV1.d.ts +19 -0
- package/lib/Typesense/AnalyticsV1.js +49 -0
- package/lib/Typesense/AnalyticsV1.js.map +1 -0
- package/lib/Typesense/ApiCall.d.ts +99 -0
- package/lib/Typesense/ApiCall.js +777 -0
- package/lib/Typesense/ApiCall.js.map +1 -0
- package/lib/Typesense/Client.d.ts +79 -0
- package/lib/Typesense/Client.js +170 -0
- package/lib/Typesense/Client.js.map +1 -0
- package/lib/Typesense/Collection.d.ts +63 -0
- package/lib/Typesense/Collection.js +109 -0
- package/lib/Typesense/Collection.js.map +1 -0
- package/lib/Typesense/Collections.d.ts +42 -0
- package/lib/Typesense/Collections.js +34 -0
- package/lib/Typesense/Collections.js.map +1 -0
- package/lib/Typesense/Configuration.d.ts +143 -0
- package/lib/Typesense/Configuration.js +113 -0
- package/lib/Typesense/Configuration.js.map +1 -0
- package/lib/Typesense/Conversation.d.ts +22 -0
- package/lib/Typesense/Conversation.js +37 -0
- package/lib/Typesense/Conversation.js.map +1 -0
- package/lib/Typesense/ConversationModel.d.ts +30 -0
- package/lib/Typesense/ConversationModel.js +37 -0
- package/lib/Typesense/ConversationModel.js.map +1 -0
- package/lib/Typesense/ConversationModels.d.ts +10 -0
- package/lib/Typesense/ConversationModels.js +37 -0
- package/lib/Typesense/ConversationModels.js.map +1 -0
- package/lib/Typesense/Conversations.d.ts +17 -0
- package/lib/Typesense/Conversations.js +42 -0
- package/lib/Typesense/Conversations.js.map +1 -0
- package/lib/Typesense/CurationSet.d.ts +17 -0
- package/lib/Typesense/CurationSet.js +52 -0
- package/lib/Typesense/CurationSet.js.map +1 -0
- package/lib/Typesense/CurationSetItem.d.ts +15 -0
- package/lib/Typesense/CurationSetItem.js +38 -0
- package/lib/Typesense/CurationSetItem.js.map +1 -0
- package/lib/Typesense/CurationSetItems.d.ts +9 -0
- package/lib/Typesense/CurationSetItems.js +23 -0
- package/lib/Typesense/CurationSetItems.js.map +1 -0
- package/lib/Typesense/CurationSets.d.ts +56 -0
- package/lib/Typesense/CurationSets.js +19 -0
- package/lib/Typesense/CurationSets.js.map +1 -0
- package/lib/Typesense/Debug.d.ts +10 -0
- package/lib/Typesense/Debug.js +19 -0
- package/lib/Typesense/Debug.js.map +1 -0
- package/lib/Typesense/Document.d.ts +12 -0
- package/lib/Typesense/Document.js +41 -0
- package/lib/Typesense/Document.js.map +1 -0
- package/lib/Typesense/Documents.d.ts +196 -0
- package/lib/Typesense/Documents.js +204 -0
- package/lib/Typesense/Documents.js.map +1 -0
- package/lib/Typesense/Errors/HTTPError.d.ts +3 -0
- package/lib/Typesense/Errors/HTTPError.js +13 -0
- package/lib/Typesense/Errors/HTTPError.js.map +1 -0
- package/lib/Typesense/Errors/ImportError.d.ts +15 -0
- package/lib/Typesense/Errors/ImportError.js +16 -0
- package/lib/Typesense/Errors/ImportError.js.map +1 -0
- package/lib/Typesense/Errors/MissingConfigurationError.d.ts +3 -0
- package/lib/Typesense/Errors/MissingConfigurationError.js +13 -0
- package/lib/Typesense/Errors/MissingConfigurationError.js.map +1 -0
- package/lib/Typesense/Errors/ObjectAlreadyExists.d.ts +3 -0
- package/lib/Typesense/Errors/ObjectAlreadyExists.js +13 -0
- package/lib/Typesense/Errors/ObjectAlreadyExists.js.map +1 -0
- package/lib/Typesense/Errors/ObjectNotFound.d.ts +3 -0
- package/lib/Typesense/Errors/ObjectNotFound.js +13 -0
- package/lib/Typesense/Errors/ObjectNotFound.js.map +1 -0
- package/lib/Typesense/Errors/ObjectUnprocessable.d.ts +3 -0
- package/lib/Typesense/Errors/ObjectUnprocessable.js +13 -0
- package/lib/Typesense/Errors/ObjectUnprocessable.js.map +1 -0
- package/lib/Typesense/Errors/RequestMalformed.d.ts +3 -0
- package/lib/Typesense/Errors/RequestMalformed.js +13 -0
- package/lib/Typesense/Errors/RequestMalformed.js.map +1 -0
- package/lib/Typesense/Errors/RequestUnauthorized.d.ts +3 -0
- package/lib/Typesense/Errors/RequestUnauthorized.js +13 -0
- package/lib/Typesense/Errors/RequestUnauthorized.js.map +1 -0
- package/lib/Typesense/Errors/ServerError.d.ts +3 -0
- package/lib/Typesense/Errors/ServerError.js +13 -0
- package/lib/Typesense/Errors/ServerError.js.map +1 -0
- package/lib/Typesense/Errors/TypesenseError.d.ts +5 -0
- package/lib/Typesense/Errors/TypesenseError.js +19 -0
- package/lib/Typesense/Errors/TypesenseError.js.map +1 -0
- package/lib/Typesense/Errors/index.d.ts +11 -0
- package/lib/Typesense/Errors/index.js +25 -0
- package/lib/Typesense/Errors/index.js.map +1 -0
- package/lib/Typesense/Health.d.ts +9 -0
- package/lib/Typesense/Health.js +19 -0
- package/lib/Typesense/Health.js.map +1 -0
- package/lib/Typesense/Key.d.ts +33 -0
- package/lib/Typesense/Key.js +30 -0
- package/lib/Typesense/Key.js.map +1 -0
- package/lib/Typesense/Keys.d.ts +19 -0
- package/lib/Typesense/Keys.js +46 -0
- package/lib/Typesense/Keys.js.map +1 -0
- package/lib/Typesense/Metrics.d.ts +25 -0
- package/lib/Typesense/Metrics.js +19 -0
- package/lib/Typesense/Metrics.js.map +1 -0
- package/lib/Typesense/MultiSearch.d.ts +25 -0
- package/lib/Typesense/MultiSearch.js +63 -0
- package/lib/Typesense/MultiSearch.js.map +1 -0
- package/lib/Typesense/NLSearchModel.d.ts +16 -0
- package/lib/Typesense/NLSearchModel.js +37 -0
- package/lib/Typesense/NLSearchModel.js.map +1 -0
- package/lib/Typesense/NLSearchModels.d.ts +36 -0
- package/lib/Typesense/NLSearchModels.js +36 -0
- package/lib/Typesense/NLSearchModels.js.map +1 -0
- package/lib/Typesense/Operations.d.ts +12 -0
- package/lib/Typesense/Operations.js +27 -0
- package/lib/Typesense/Operations.js.map +1 -0
- package/lib/Typesense/Override.d.ts +17 -0
- package/lib/Typesense/Override.js +32 -0
- package/lib/Typesense/Override.js.map +1 -0
- package/lib/Typesense/Overrides.d.ts +43 -0
- package/lib/Typesense/Overrides.js +38 -0
- package/lib/Typesense/Overrides.js.map +1 -0
- package/lib/Typesense/Preset.d.ts +17 -0
- package/lib/Typesense/Preset.js +30 -0
- package/lib/Typesense/Preset.js.map +1 -0
- package/lib/Typesense/Presets.d.ts +18 -0
- package/lib/Typesense/Presets.js +49 -0
- package/lib/Typesense/Presets.js.map +1 -0
- package/lib/Typesense/RequestWithCache.d.ts +15 -0
- package/lib/Typesense/RequestWithCache.js +117 -0
- package/lib/Typesense/RequestWithCache.js.map +1 -0
- package/lib/Typesense/SearchClient.d.ts +13 -0
- package/lib/Typesense/SearchClient.js +45 -0
- package/lib/Typesense/SearchClient.js.map +1 -0
- package/lib/Typesense/SearchOnlyCollection.d.ts +11 -0
- package/lib/Typesense/SearchOnlyCollection.js +18 -0
- package/lib/Typesense/SearchOnlyCollection.js.map +1 -0
- package/lib/Typesense/SearchOnlyDocuments.d.ts +16 -0
- package/lib/Typesense/SearchOnlyDocuments.js +57 -0
- package/lib/Typesense/SearchOnlyDocuments.js.map +1 -0
- package/lib/Typesense/Stats.d.ts +24 -0
- package/lib/Typesense/Stats.js +19 -0
- package/lib/Typesense/Stats.js.map +1 -0
- package/lib/Typesense/Stemming.d.ts +12 -0
- package/lib/Typesense/Stemming.js +35 -0
- package/lib/Typesense/Stemming.js.map +1 -0
- package/lib/Typesense/StemmingDictionaries.d.ts +13 -0
- package/lib/Typesense/StemmingDictionaries.js +58 -0
- package/lib/Typesense/StemmingDictionaries.js.map +1 -0
- package/lib/Typesense/StemmingDictionary.d.ts +20 -0
- package/lib/Typesense/StemmingDictionary.js +30 -0
- package/lib/Typesense/StemmingDictionary.js.map +1 -0
- package/lib/Typesense/Stopword.d.ts +20 -0
- package/lib/Typesense/Stopword.js +30 -0
- package/lib/Typesense/Stopword.js.map +1 -0
- package/lib/Typesense/Stopwords.d.ts +17 -0
- package/lib/Typesense/Stopwords.js +36 -0
- package/lib/Typesense/Stopwords.js.map +1 -0
- package/lib/Typesense/Synonym.d.ts +21 -0
- package/lib/Typesense/Synonym.js +41 -0
- package/lib/Typesense/Synonym.js.map +1 -0
- package/lib/Typesense/SynonymSet.d.ts +21 -0
- package/lib/Typesense/SynonymSet.js +52 -0
- package/lib/Typesense/SynonymSet.js.map +1 -0
- package/lib/Typesense/SynonymSetItem.d.ts +14 -0
- package/lib/Typesense/SynonymSetItem.js +31 -0
- package/lib/Typesense/SynonymSetItem.js.map +1 -0
- package/lib/Typesense/SynonymSetItems.d.ts +10 -0
- package/lib/Typesense/SynonymSetItems.js +30 -0
- package/lib/Typesense/SynonymSetItems.js.map +1 -0
- package/lib/Typesense/SynonymSets.d.ts +23 -0
- package/lib/Typesense/SynonymSets.js +19 -0
- package/lib/Typesense/SynonymSets.js.map +1 -0
- package/lib/Typesense/Synonyms.d.ts +24 -0
- package/lib/Typesense/Synonyms.js +47 -0
- package/lib/Typesense/Synonyms.js.map +1 -0
- package/lib/Typesense/Types.d.ts +201 -0
- package/lib/Typesense/Types.js +22 -0
- package/lib/Typesense/Types.js.map +1 -0
- package/lib/Typesense/Utils.d.ts +11 -0
- package/lib/Typesense/Utils.js +50 -0
- package/lib/Typesense/Utils.js.map +1 -0
- package/lib/Typesense.d.ts +46 -0
- package/lib/Typesense.js +12 -0
- package/lib/Typesense.js.map +1 -0
- package/package.json +141 -0
- package/src/Typesense/Alias.ts +18 -0
- package/src/Typesense/Aliases.ts +41 -0
- package/src/Typesense/Analytics.ts +39 -0
- package/src/Typesense/AnalyticsEvent.ts +5 -0
- package/src/Typesense/AnalyticsEvents.ts +53 -0
- package/src/Typesense/AnalyticsRule.ts +63 -0
- package/src/Typesense/AnalyticsRuleV1.ts +52 -0
- package/src/Typesense/AnalyticsRules.ts +67 -0
- package/src/Typesense/AnalyticsRulesV1.ts +43 -0
- package/src/Typesense/AnalyticsV1.ts +52 -0
- package/src/Typesense/ApiCall.ts +1103 -0
- package/src/Typesense/Client.ts +225 -0
- package/src/Typesense/Collection.ts +179 -0
- package/src/Typesense/Collections.ts +68 -0
- package/src/Typesense/Configuration.ts +328 -0
- package/src/Typesense/Conversation.ts +45 -0
- package/src/Typesense/ConversationModel.ts +55 -0
- package/src/Typesense/ConversationModels.ts +38 -0
- package/src/Typesense/Conversations.ts +47 -0
- package/src/Typesense/CurationSet.ts +56 -0
- package/src/Typesense/CurationSetItem.ts +35 -0
- package/src/Typesense/CurationSetItems.ts +18 -0
- package/src/Typesense/CurationSets.ts +60 -0
- package/src/Typesense/Debug.ts +16 -0
- package/src/Typesense/Document.ts +34 -0
- package/src/Typesense/Documents.ts +445 -0
- package/src/Typesense/Errors/HTTPError.ts +3 -0
- package/src/Typesense/Errors/ImportError.ts +24 -0
- package/src/Typesense/Errors/MissingConfigurationError.ts +3 -0
- package/src/Typesense/Errors/ObjectAlreadyExists.ts +3 -0
- package/src/Typesense/Errors/ObjectNotFound.ts +3 -0
- package/src/Typesense/Errors/ObjectUnprocessable.ts +3 -0
- package/src/Typesense/Errors/RequestMalformed.ts +3 -0
- package/src/Typesense/Errors/RequestUnauthorized.ts +3 -0
- package/src/Typesense/Errors/ServerError.ts +3 -0
- package/src/Typesense/Errors/TypesenseError.ts +13 -0
- package/src/Typesense/Errors/index.ts +23 -0
- package/src/Typesense/Health.ts +15 -0
- package/src/Typesense/Key.ts +73 -0
- package/src/Typesense/Keys.ts +59 -0
- package/src/Typesense/Metrics.ts +31 -0
- package/src/Typesense/MultiSearch.ts +144 -0
- package/src/Typesense/NLSearchModel.ts +35 -0
- package/src/Typesense/NLSearchModels.ts +61 -0
- package/src/Typesense/Operations.ts +35 -0
- package/src/Typesense/Override.ts +31 -0
- package/src/Typesense/Overrides.ts +73 -0
- package/src/Typesense/Preset.ts +31 -0
- package/src/Typesense/Presets.ts +62 -0
- package/src/Typesense/RequestWithCache.ts +209 -0
- package/src/Typesense/SearchClient.ts +64 -0
- package/src/Typesense/SearchOnlyCollection.ts +24 -0
- package/src/Typesense/SearchOnlyDocuments.ts +87 -0
- package/src/Typesense/Stats.ts +31 -0
- package/src/Typesense/Stemming.ts +38 -0
- package/src/Typesense/StemmingDictionaries.ts +59 -0
- package/src/Typesense/StemmingDictionary.ts +37 -0
- package/src/Typesense/Stopword.ts +31 -0
- package/src/Typesense/Stopwords.ts +41 -0
- package/src/Typesense/Synonym.ts +42 -0
- package/src/Typesense/SynonymSet.ts +57 -0
- package/src/Typesense/SynonymSetItem.ts +28 -0
- package/src/Typesense/SynonymSetItems.ts +31 -0
- package/src/Typesense/SynonymSets.ts +30 -0
- package/src/Typesense/Synonyms.ts +55 -0
- package/src/Typesense/Types.ts +355 -0
- package/src/Typesense/Utils.ts +80 -0
- package/src/Typesense.ts +43 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import ApiCall from "./ApiCall";
|
|
2
|
+
import Collections from "./Collections";
|
|
3
|
+
import Documents, {
|
|
4
|
+
DeleteQuery,
|
|
5
|
+
DocumentSchema,
|
|
6
|
+
DocumentWriteParameters,
|
|
7
|
+
} from "./Documents";
|
|
8
|
+
|
|
9
|
+
export class Document<T extends DocumentSchema = object> {
|
|
10
|
+
constructor(
|
|
11
|
+
private collectionName: string,
|
|
12
|
+
private documentId: string,
|
|
13
|
+
private apiCall: ApiCall
|
|
14
|
+
) {}
|
|
15
|
+
|
|
16
|
+
async retrieve(): Promise<T> {
|
|
17
|
+
return this.apiCall.get<T>(this.endpointPath());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async delete(options?: DeleteQuery): Promise<T> {
|
|
21
|
+
return this.apiCall.delete<T>(this.endpointPath(), options);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async update(
|
|
25
|
+
partialDocument: Partial<T>,
|
|
26
|
+
options: DocumentWriteParameters = {}
|
|
27
|
+
): Promise<T> {
|
|
28
|
+
return this.apiCall.patch<T>(this.endpointPath(), partialDocument, options);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private endpointPath(): string {
|
|
32
|
+
return `${Collections.RESOURCEPATH}/${encodeURIComponent(this.collectionName)}${Documents.RESOURCEPATH}/${encodeURIComponent(this.documentId)}`;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import type { ReadStream } from "fs";
|
|
2
|
+
import ApiCall from "./ApiCall";
|
|
3
|
+
import Configuration from "./Configuration";
|
|
4
|
+
import { ImportError, RequestMalformed } from "./Errors";
|
|
5
|
+
import { SearchOnlyDocuments } from "./SearchOnlyDocuments";
|
|
6
|
+
import {
|
|
7
|
+
SearchParams,
|
|
8
|
+
SearchResponseRequestParams,
|
|
9
|
+
WriteableDocuments,
|
|
10
|
+
} from "./Types";
|
|
11
|
+
|
|
12
|
+
// Todo: use generic to extract filter_by values
|
|
13
|
+
export type DeleteQuery =
|
|
14
|
+
| {
|
|
15
|
+
truncate?: true;
|
|
16
|
+
}
|
|
17
|
+
| {
|
|
18
|
+
truncate?: never;
|
|
19
|
+
filter_by?: string;
|
|
20
|
+
batch_size?: number;
|
|
21
|
+
ignore_not_found?: boolean;
|
|
22
|
+
return_doc?: boolean;
|
|
23
|
+
return_id?: boolean;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export interface DeleteResponse<T extends DocumentSchema = DocumentSchema> {
|
|
27
|
+
num_deleted: number;
|
|
28
|
+
documents?: T[];
|
|
29
|
+
ids?: string[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface ImportResponseSuccess<T extends DocumentSchema = DocumentSchema> {
|
|
33
|
+
success: true;
|
|
34
|
+
error?: never;
|
|
35
|
+
document?: T;
|
|
36
|
+
id?: string;
|
|
37
|
+
code?: never;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ImportResponseFail<T extends DocumentSchema = DocumentSchema> {
|
|
41
|
+
success: false;
|
|
42
|
+
error: string;
|
|
43
|
+
document?: T;
|
|
44
|
+
id?: string;
|
|
45
|
+
code: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type ImportResponse<T extends DocumentSchema = DocumentSchema> = ImportResponseSuccess<T> | ImportResponseFail<T>;
|
|
49
|
+
|
|
50
|
+
export type DocumentSchema = Record<string, any>;
|
|
51
|
+
|
|
52
|
+
export interface SearchParamsWithPreset<
|
|
53
|
+
T extends DocumentSchema,
|
|
54
|
+
Infix extends string,
|
|
55
|
+
> extends Partial<SearchParams<T, Infix>> {
|
|
56
|
+
preset: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
type SearchResponseHighlightObject = {
|
|
60
|
+
matched_tokens?: string[];
|
|
61
|
+
snippet?: string;
|
|
62
|
+
value?: string;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export type SearchResponseHighlight<T> = T extends string | number
|
|
66
|
+
? SearchResponseHighlightObject
|
|
67
|
+
: {
|
|
68
|
+
[TAttribute in keyof T]?: SearchResponseHighlight<T[TAttribute]>;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export interface SearchResponseHit<T extends DocumentSchema> {
|
|
72
|
+
curated?: true;
|
|
73
|
+
highlights?: [
|
|
74
|
+
{
|
|
75
|
+
field: keyof T;
|
|
76
|
+
snippet?: string;
|
|
77
|
+
value?: string;
|
|
78
|
+
snippets?: string[];
|
|
79
|
+
indices?: number[];
|
|
80
|
+
matched_tokens: string[][] | string[];
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
highlight: SearchResponseHighlight<T>;
|
|
84
|
+
document: T;
|
|
85
|
+
text_match: number;
|
|
86
|
+
text_match_info?: {
|
|
87
|
+
best_field_score: `${number}`; // To prevent scores from being truncated by JSON spec
|
|
88
|
+
best_field_weight: number;
|
|
89
|
+
fields_matched: number;
|
|
90
|
+
score: `${number}`; // To prevent scores from being truncated by JSON spec
|
|
91
|
+
tokens_matched: number;
|
|
92
|
+
};
|
|
93
|
+
geo_distance_meters?: {
|
|
94
|
+
location: number
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface SearchResponseFacetCountSchema<T extends DocumentSchema> {
|
|
99
|
+
counts: {
|
|
100
|
+
count: number;
|
|
101
|
+
highlighted: string;
|
|
102
|
+
value: string;
|
|
103
|
+
parent?: Record<string, string | number | boolean>;
|
|
104
|
+
}[];
|
|
105
|
+
field_name: keyof T;
|
|
106
|
+
sampled: boolean;
|
|
107
|
+
stats: {
|
|
108
|
+
avg?: number;
|
|
109
|
+
max?: number;
|
|
110
|
+
min?: number;
|
|
111
|
+
sum?: number;
|
|
112
|
+
total_values?: number;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface LLMResponse {
|
|
117
|
+
content: string;
|
|
118
|
+
extraction_method: string;
|
|
119
|
+
model: string;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Todo: we could infer whether this is a grouped response by adding the search params as a generic
|
|
123
|
+
export interface SearchResponse<T extends DocumentSchema> {
|
|
124
|
+
facet_counts?: SearchResponseFacetCountSchema<T>[];
|
|
125
|
+
found: number;
|
|
126
|
+
found_docs?: number;
|
|
127
|
+
out_of: number;
|
|
128
|
+
page: number;
|
|
129
|
+
request_params: SearchResponseRequestParams;
|
|
130
|
+
search_time_ms: number;
|
|
131
|
+
search_cutoff?: boolean;
|
|
132
|
+
hits?: SearchResponseHit<T>[];
|
|
133
|
+
grouped_hits?: {
|
|
134
|
+
group_key: string[];
|
|
135
|
+
hits: SearchResponseHit<T>[];
|
|
136
|
+
found?: number;
|
|
137
|
+
}[];
|
|
138
|
+
parsed_nl_query?: {
|
|
139
|
+
parse_time_ms: number;
|
|
140
|
+
generated_params: SearchParams<T>;
|
|
141
|
+
augmented_params: SearchParams<T>;
|
|
142
|
+
llm_response?: LLMResponse;
|
|
143
|
+
};
|
|
144
|
+
conversation?: {
|
|
145
|
+
answer: string;
|
|
146
|
+
conversation_history: {
|
|
147
|
+
conversation: object[];
|
|
148
|
+
id: string;
|
|
149
|
+
last_updated: number;
|
|
150
|
+
ttl: number;
|
|
151
|
+
};
|
|
152
|
+
conversation_id: string;
|
|
153
|
+
query: string;
|
|
154
|
+
};
|
|
155
|
+
error?: string;
|
|
156
|
+
code?: number;
|
|
157
|
+
metadata?: JsonRecord;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
type JSONPrimitive = string | number | boolean | null;
|
|
161
|
+
|
|
162
|
+
type JsonRecord = {
|
|
163
|
+
[key: string]: JSONPrimitive | JSONPrimitive[] | JsonRecord;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export interface DocumentWriteParameters {
|
|
167
|
+
dirty_values?: "coerce_or_reject" | "coerce_or_drop" | "drop" | "reject";
|
|
168
|
+
action?: "create" | "update" | "upsert" | "emplace";
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface UpdateByFilterParameters {
|
|
172
|
+
filter_by?: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface UpdateByFilterResponse {
|
|
176
|
+
num_updated: number;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface DocumentImportParameters extends DocumentWriteParameters {
|
|
180
|
+
batch_size?: number;
|
|
181
|
+
remote_embedding_batch_size?: number;
|
|
182
|
+
remote_embedding_timeout_ms?: number;
|
|
183
|
+
remote_embedding_num_tries?: number;
|
|
184
|
+
return_doc?: boolean;
|
|
185
|
+
return_id?: boolean;
|
|
186
|
+
throwOnFail?: boolean;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface DocumentsExportParameters {
|
|
190
|
+
filter_by?: string;
|
|
191
|
+
include_fields?: string;
|
|
192
|
+
exclude_fields?: string;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface SearchOptions {
|
|
196
|
+
cacheSearchResultsForSeconds?: number;
|
|
197
|
+
abortSignal?: AbortSignal | null;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const isNodeJSEnvironment =
|
|
201
|
+
typeof process !== "undefined" &&
|
|
202
|
+
process.versions != null &&
|
|
203
|
+
process.versions.node != null;
|
|
204
|
+
|
|
205
|
+
export default class Documents<T extends DocumentSchema = object>
|
|
206
|
+
extends SearchOnlyDocuments<T>
|
|
207
|
+
implements WriteableDocuments<T>
|
|
208
|
+
{
|
|
209
|
+
constructor(
|
|
210
|
+
collectionName: string,
|
|
211
|
+
apiCall: ApiCall,
|
|
212
|
+
configuration: Configuration,
|
|
213
|
+
) {
|
|
214
|
+
super(collectionName, apiCall, configuration);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
async create(document: T, options: DocumentWriteParameters = {}): Promise<T> {
|
|
218
|
+
if (!document) throw new Error("No document provided");
|
|
219
|
+
return this.apiCall.post<T>(this.endpointPath(), document, options);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
async upsert(document: T, options: DocumentWriteParameters = {}): Promise<T> {
|
|
223
|
+
if (!document) throw new Error("No document provided");
|
|
224
|
+
return this.apiCall.post<T>(
|
|
225
|
+
this.endpointPath(),
|
|
226
|
+
document,
|
|
227
|
+
Object.assign({}, options, { action: "upsert" }),
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async update(
|
|
232
|
+
document: T,
|
|
233
|
+
options: UpdateByFilterParameters,
|
|
234
|
+
): Promise<UpdateByFilterResponse>;
|
|
235
|
+
async update(document: T, options: DocumentWriteParameters): Promise<T>;
|
|
236
|
+
async update(
|
|
237
|
+
document: T,
|
|
238
|
+
options: DocumentWriteParameters | UpdateByFilterParameters = {},
|
|
239
|
+
): Promise<UpdateByFilterResponse | T> {
|
|
240
|
+
if (!document) throw new Error("No document provided");
|
|
241
|
+
|
|
242
|
+
if (options["filter_by"] != null) {
|
|
243
|
+
return this.apiCall.patch<T>(
|
|
244
|
+
this.endpointPath(),
|
|
245
|
+
document,
|
|
246
|
+
Object.assign({}, options),
|
|
247
|
+
);
|
|
248
|
+
} else {
|
|
249
|
+
return this.apiCall.post<T>(
|
|
250
|
+
this.endpointPath(),
|
|
251
|
+
document,
|
|
252
|
+
Object.assign({}, options, { action: "update" }),
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async delete(
|
|
258
|
+
query: DeleteQuery = {} as DeleteQuery,
|
|
259
|
+
): Promise<DeleteResponse<T>> {
|
|
260
|
+
return this.apiCall.delete<DeleteResponse<T>>(this.endpointPath(), query);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
async createMany(documents: T[], options: DocumentImportParameters = {}) {
|
|
264
|
+
this.configuration.logger.warn(
|
|
265
|
+
"createMany is deprecated and will be removed in a future version. Use import instead, which now takes both an array of documents or a JSONL string of documents",
|
|
266
|
+
);
|
|
267
|
+
return this.import(documents, options);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Import a set of documents in a batch.
|
|
272
|
+
* @param {string|Array} documents - Can be a JSONL string of documents or an array of document objects.
|
|
273
|
+
* @param options
|
|
274
|
+
* @return {string|Array} Returns a JSONL string if the input was a JSONL string, otherwise it returns an array of results.
|
|
275
|
+
*/
|
|
276
|
+
async import(
|
|
277
|
+
documents: string,
|
|
278
|
+
options?: DocumentImportParameters,
|
|
279
|
+
): Promise<string>;
|
|
280
|
+
async import(
|
|
281
|
+
documents: T[],
|
|
282
|
+
options?: DocumentImportParameters,
|
|
283
|
+
): Promise<ImportResponse<T>[]>;
|
|
284
|
+
async import(
|
|
285
|
+
documents: T[] | string,
|
|
286
|
+
options: DocumentImportParameters = {},
|
|
287
|
+
): Promise<string | ImportResponse<T>[]> {
|
|
288
|
+
// Set default value for throwOnFail if not provided
|
|
289
|
+
const finalOptions = { throwOnFail: true, ...options };
|
|
290
|
+
let documentsInJSONLFormat;
|
|
291
|
+
if (Array.isArray(documents)) {
|
|
292
|
+
if (documents.length === 0) {
|
|
293
|
+
throw new RequestMalformed("No documents provided");
|
|
294
|
+
}
|
|
295
|
+
try {
|
|
296
|
+
documentsInJSONLFormat = documents
|
|
297
|
+
.map((document) => JSON.stringify(document))
|
|
298
|
+
.join("\n");
|
|
299
|
+
} catch (error: any) {
|
|
300
|
+
// if rangeerror, throw custom error message
|
|
301
|
+
if (
|
|
302
|
+
error instanceof RangeError &&
|
|
303
|
+
error.message.includes("Too many properties to enumerate")
|
|
304
|
+
) {
|
|
305
|
+
throw new Error(`${error}
|
|
306
|
+
It looks like you have reached a Node.js limit that restricts the number of keys in an Object: https://stackoverflow.com/questions/9282869/are-there-limits-to-the-number-of-properties-in-a-javascript-object
|
|
307
|
+
|
|
308
|
+
Please try reducing the number of keys in your document, or using CURL to import your data.
|
|
309
|
+
`);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// else, throw the non-range error anyways
|
|
313
|
+
throw new Error(error);
|
|
314
|
+
}
|
|
315
|
+
} else {
|
|
316
|
+
documentsInJSONLFormat = documents;
|
|
317
|
+
if (isEmptyString(documentsInJSONLFormat)) {
|
|
318
|
+
throw new RequestMalformed("No documents provided");
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const resultsInJSONLFormat = await this.apiCall.performRequest<string>(
|
|
323
|
+
"post",
|
|
324
|
+
this.endpointPath("import"),
|
|
325
|
+
{
|
|
326
|
+
queryParameters: finalOptions,
|
|
327
|
+
bodyParameters: documentsInJSONLFormat,
|
|
328
|
+
additionalHeaders: { "Content-Type": "text/plain" },
|
|
329
|
+
skipConnectionTimeout: true, // We never want to client-side-timeout on an import and retry, since imports are syncronous and we want to let them take as long as it takes to complete fully
|
|
330
|
+
enableKeepAlive: isNodeJSEnvironment ? true : false, // This is to prevent ECONNRESET socket hang up errors. Reference: https://github.com/axios/axios/issues/2936#issuecomment-779439991
|
|
331
|
+
},
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
if (Array.isArray(documents)) {
|
|
335
|
+
const resultsInJSONFormat = resultsInJSONLFormat
|
|
336
|
+
.split("\n")
|
|
337
|
+
.map((r) => JSON.parse(r)) as ImportResponse<T>[];
|
|
338
|
+
const failedItems = resultsInJSONFormat.filter(
|
|
339
|
+
(r) => r.success === false,
|
|
340
|
+
);
|
|
341
|
+
if (failedItems.length > 0 && finalOptions.throwOnFail) {
|
|
342
|
+
throw new ImportError(
|
|
343
|
+
`${
|
|
344
|
+
resultsInJSONFormat.length - failedItems.length
|
|
345
|
+
} documents imported successfully, ${
|
|
346
|
+
failedItems.length
|
|
347
|
+
} documents failed during import. Use \`error.importResults\` from the raised exception to get a detailed error reason for each document.`,
|
|
348
|
+
resultsInJSONFormat,
|
|
349
|
+
{
|
|
350
|
+
documentsInJSONLFormat,
|
|
351
|
+
options: finalOptions,
|
|
352
|
+
failedItems,
|
|
353
|
+
successCount: resultsInJSONFormat.length - failedItems.length,
|
|
354
|
+
},
|
|
355
|
+
);
|
|
356
|
+
} else {
|
|
357
|
+
return resultsInJSONFormat;
|
|
358
|
+
}
|
|
359
|
+
} else {
|
|
360
|
+
return resultsInJSONLFormat as string;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Imports documents from a NodeJS readable stream of JSONL.
|
|
365
|
+
*/
|
|
366
|
+
async importStream(
|
|
367
|
+
readableStream: ReadStream,
|
|
368
|
+
options: DocumentImportParameters = {},
|
|
369
|
+
): Promise<ImportResponse<T>[]> {
|
|
370
|
+
const finalOptions = { throwOnFail: true, ...options };
|
|
371
|
+
|
|
372
|
+
const resultsInJSONLFormat = await this.apiCall.performRequest<string>(
|
|
373
|
+
"post",
|
|
374
|
+
this.endpointPath("import"),
|
|
375
|
+
{
|
|
376
|
+
queryParameters: finalOptions,
|
|
377
|
+
bodyParameters: readableStream,
|
|
378
|
+
additionalHeaders: { "Content-Type": "text/plain" },
|
|
379
|
+
skipConnectionTimeout: true, // We never want to client-side-timeout on an import and retry, since imports are syncronous and we want to let them take as long as it takes to complete fully
|
|
380
|
+
enableKeepAlive: isNodeJSEnvironment ? true : false, // This is to prevent ECONNRESET socket hang up errors. Reference: https://github.com/axios/axios/issues/2936#issuecomment-779439991
|
|
381
|
+
},
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
const resultsInJSONFormat = resultsInJSONLFormat
|
|
385
|
+
.split("\n")
|
|
386
|
+
.map((r) => JSON.parse(r)) as ImportResponse<T>[];
|
|
387
|
+
const failedItems = resultsInJSONFormat.filter((r) => r.success === false);
|
|
388
|
+
if (failedItems.length > 0 && finalOptions.throwOnFail) {
|
|
389
|
+
throw new ImportError(
|
|
390
|
+
`${
|
|
391
|
+
resultsInJSONFormat.length - failedItems.length
|
|
392
|
+
} documents imported successfully, ${
|
|
393
|
+
failedItems.length
|
|
394
|
+
} documents failed during import. Use \`error.importResults\` from the raised exception to get a detailed error reason for each document.`,
|
|
395
|
+
resultsInJSONFormat,
|
|
396
|
+
{
|
|
397
|
+
documentsInJSONLFormat: readableStream,
|
|
398
|
+
options: finalOptions,
|
|
399
|
+
failedItems,
|
|
400
|
+
successCount: resultsInJSONFormat.length - failedItems.length,
|
|
401
|
+
},
|
|
402
|
+
);
|
|
403
|
+
} else {
|
|
404
|
+
return resultsInJSONFormat;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Returns a JSONL string for all the documents in this collection
|
|
410
|
+
*/
|
|
411
|
+
async export(options: DocumentsExportParameters = {}): Promise<string> {
|
|
412
|
+
return this.apiCall.get<string>(this.endpointPath("export"), options);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Returns a NodeJS readable stream of JSONL for all the documents in this collection.
|
|
417
|
+
*/
|
|
418
|
+
async exportStream(
|
|
419
|
+
options: DocumentsExportParameters = {},
|
|
420
|
+
): Promise<ReadStream> {
|
|
421
|
+
return this.apiCall.get<ReadStream>(this.endpointPath("export"), options, {
|
|
422
|
+
responseType: "stream",
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
function isEmptyString(str: string | null | undefined): boolean {
|
|
428
|
+
return str == null || str === "" || str.length === 0;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* @deprecated Import from './Types' instead
|
|
433
|
+
*/
|
|
434
|
+
export type {
|
|
435
|
+
SearchParams,
|
|
436
|
+
WriteableDocuments,
|
|
437
|
+
SearchableDocuments,
|
|
438
|
+
DropTokensMode,
|
|
439
|
+
OperationMode,
|
|
440
|
+
UnionArrayKeys,
|
|
441
|
+
UnionArraySearchParams,
|
|
442
|
+
ArraybleParams,
|
|
443
|
+
ExtractBaseTypes,
|
|
444
|
+
SearchResponseRequestParams,
|
|
445
|
+
} from "./Types";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import TypesenseError from "./TypesenseError";
|
|
2
|
+
import type { DocumentImportParameters, ImportResponse } from "../Documents";
|
|
3
|
+
import { ReadStream } from "node:fs";
|
|
4
|
+
|
|
5
|
+
interface ImportErrorPayload {
|
|
6
|
+
documentsInJSONLFormat: string | ReadStream;
|
|
7
|
+
options: DocumentImportParameters;
|
|
8
|
+
failedItems: ImportResponse[];
|
|
9
|
+
successCount: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default class ImportError extends TypesenseError {
|
|
13
|
+
payload: ImportErrorPayload;
|
|
14
|
+
importResults: ImportResponse[];
|
|
15
|
+
constructor(
|
|
16
|
+
message: string,
|
|
17
|
+
importResults: ImportResponse[],
|
|
18
|
+
payload: ImportErrorPayload,
|
|
19
|
+
) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.importResults = importResults;
|
|
22
|
+
this.payload = payload;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default class TypesenseError extends Error {
|
|
2
|
+
httpStatus?: number;
|
|
3
|
+
httpBody?: string;
|
|
4
|
+
|
|
5
|
+
// Source: https://stackoverflow.com/a/58417721/123545
|
|
6
|
+
constructor(message?: string, httpBody?: string, httpStatus?: number) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = new.target.name;
|
|
9
|
+
this.httpBody = httpBody;
|
|
10
|
+
this.httpStatus = httpStatus;
|
|
11
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import HTTPError from "./HTTPError";
|
|
2
|
+
import MissingConfigurationError from "./MissingConfigurationError";
|
|
3
|
+
import ObjectAlreadyExists from "./ObjectAlreadyExists";
|
|
4
|
+
import ObjectNotFound from "./ObjectNotFound";
|
|
5
|
+
import ObjectUnprocessable from "./ObjectUnprocessable";
|
|
6
|
+
import RequestMalformed from "./RequestMalformed";
|
|
7
|
+
import RequestUnauthorized from "./RequestUnauthorized";
|
|
8
|
+
import ServerError from "./ServerError";
|
|
9
|
+
import ImportError from "./ImportError";
|
|
10
|
+
import TypesenseError from "./TypesenseError";
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
HTTPError,
|
|
14
|
+
MissingConfigurationError,
|
|
15
|
+
ObjectAlreadyExists,
|
|
16
|
+
ObjectNotFound,
|
|
17
|
+
ObjectUnprocessable,
|
|
18
|
+
RequestMalformed,
|
|
19
|
+
RequestUnauthorized,
|
|
20
|
+
ServerError,
|
|
21
|
+
TypesenseError,
|
|
22
|
+
ImportError,
|
|
23
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import ApiCall from "./ApiCall";
|
|
2
|
+
|
|
3
|
+
const RESOURCEPATH = "/health";
|
|
4
|
+
|
|
5
|
+
export interface HealthResponse {
|
|
6
|
+
ok: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default class Health {
|
|
10
|
+
constructor(private apiCall: ApiCall) {}
|
|
11
|
+
|
|
12
|
+
async retrieve(): Promise<HealthResponse> {
|
|
13
|
+
return this.apiCall.get<HealthResponse>(RESOURCEPATH);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import ApiCall from "./ApiCall";
|
|
2
|
+
import Keys from "./Keys";
|
|
3
|
+
|
|
4
|
+
export interface KeyCreateSchema {
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
6
|
+
actions: Actions[] | (string & {})[];
|
|
7
|
+
collections: string[];
|
|
8
|
+
description?: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
value_prefix?: string;
|
|
11
|
+
expires_at?: number;
|
|
12
|
+
autodelete?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type CRUDActions = "create" | "delete" | "get" | "list" | "*";
|
|
16
|
+
type DocumentActionTypes =
|
|
17
|
+
| "search"
|
|
18
|
+
| "get"
|
|
19
|
+
| "create"
|
|
20
|
+
| "upsert"
|
|
21
|
+
| "update"
|
|
22
|
+
| "delete"
|
|
23
|
+
| "import"
|
|
24
|
+
| "export"
|
|
25
|
+
| "*";
|
|
26
|
+
|
|
27
|
+
type CRUDFeatures =
|
|
28
|
+
| "collections"
|
|
29
|
+
| "aliases"
|
|
30
|
+
| "synonyms"
|
|
31
|
+
| "overrides"
|
|
32
|
+
| "stopwords"
|
|
33
|
+
| "keys"
|
|
34
|
+
| "analytics"
|
|
35
|
+
| "analytics/rules";
|
|
36
|
+
|
|
37
|
+
type FeatureActions = `${CRUDFeatures}:${CRUDActions}`;
|
|
38
|
+
type DocumentActions = `documents:${DocumentActionTypes}`;
|
|
39
|
+
type AnalyticsEventActions = "analytics/events:create";
|
|
40
|
+
type MiscActions = `${`metrics.json` | `stats.json` | `debug`}.list` | "*";
|
|
41
|
+
|
|
42
|
+
export type Actions =
|
|
43
|
+
| FeatureActions
|
|
44
|
+
| DocumentActions
|
|
45
|
+
| AnalyticsEventActions
|
|
46
|
+
| MiscActions;
|
|
47
|
+
|
|
48
|
+
export interface KeyDeleteSchema {
|
|
49
|
+
id: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface KeySchema extends KeyCreateSchema {
|
|
53
|
+
id: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default class Key {
|
|
57
|
+
constructor(
|
|
58
|
+
private id: number,
|
|
59
|
+
private apiCall: ApiCall,
|
|
60
|
+
) {}
|
|
61
|
+
|
|
62
|
+
async retrieve(): Promise<KeySchema> {
|
|
63
|
+
return this.apiCall.get<KeySchema>(this.endpointPath());
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async delete(): Promise<KeyDeleteSchema> {
|
|
67
|
+
return this.apiCall.delete<KeyDeleteSchema>(this.endpointPath());
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private endpointPath(): string {
|
|
71
|
+
return `${Keys.RESOURCEPATH}/${encodeURIComponent(this.id)}`;
|
|
72
|
+
}
|
|
73
|
+
}
|