@relevanceai/sdk 1.10.0 → 1.13.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.
Files changed (33) hide show
  1. package/dist-cjs/generated/DiscoveryApi.js +595 -3
  2. package/dist-cjs/generated/_DiscoveryApiSchemaTypes.js +1 -4
  3. package/dist-cjs/generated/index.js +5 -2
  4. package/dist-cjs/index.js +6 -2
  5. package/dist-cjs/services/discovery/Dataset.js +125 -115
  6. package/dist-cjs/services/discovery/index.js +158 -179
  7. package/dist-cjs/services/index.js +2 -12
  8. package/dist-cjs/shared/generate.js +1 -1
  9. package/dist-cjs/shared/serviceConfigs.js +2 -7
  10. package/dist-es/generated/DiscoveryApi.js +898 -10
  11. package/dist-es/generated/_DiscoveryApiSchemaTypes.js +1 -4
  12. package/dist-es/generated/index.js +0 -1
  13. package/dist-es/index.js +1 -1
  14. package/dist-es/services/discovery/Dataset.js +126 -309
  15. package/dist-es/services/discovery/index.js +159 -233
  16. package/dist-es/services/index.js +3 -1
  17. package/dist-es/shared/BaseClient.js +9 -9
  18. package/dist-es/shared/generate.js +21 -20
  19. package/dist-es/shared/serviceConfigs.js +2 -7
  20. package/dist-types/generated/DiscoveryApi.d.ts +226 -4
  21. package/dist-types/generated/_DiscoveryApiSchemaTypes.d.ts +8663 -1056
  22. package/dist-types/generated/index.d.ts +0 -1
  23. package/dist-types/index.d.ts +0 -1
  24. package/dist-types/services/discovery/Dataset.d.ts +0 -50
  25. package/dist-types/services/discovery/index.d.ts +0 -366
  26. package/dist-types/services/index.d.ts +0 -1
  27. package/package.json +2 -2
  28. package/dist-cjs/generated/VectorApi.js +0 -754
  29. package/dist-cjs/generated/_VectorApiSchemaTypes.js +0 -6
  30. package/dist-es/generated/VectorApi.js +0 -1187
  31. package/dist-es/generated/_VectorApiSchemaTypes.js +0 -5
  32. package/dist-types/generated/VectorApi.d.ts +0 -284
  33. package/dist-types/generated/_VectorApiSchemaTypes.d.ts +0 -5724
@@ -1,116 +1,126 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Dataset = void 0;
4
- const _1 = require(".");
5
- class Dataset {
6
- constructor(client, name, options) {
7
- // TODO validate name
8
- this.client = client;
9
- this.name = name;
10
- this.config = options;
11
- }
12
- get datasetName() {
13
- return this.name;
14
- }
15
- ;
16
- async insertDocument(document, options) {
17
- const response = await this.client.apiClient.Insert({
18
- document,
19
- ...options
20
- }, { dataset_id: this.name });
21
- return response.body;
22
- }
23
- async search(...args) {
24
- let payload = {};
25
- let options = {};
26
- for (const arg of args) {
27
- if (arg instanceof _1._QueryBuilder) {
28
- payload = { ...payload, ...arg.build() };
29
- }
30
- else {
31
- options = arg;
32
- if (options.rawPayload)
33
- payload = { ...payload, ...options.rawPayload };
34
- }
35
- }
36
- const reqCallback = async () => await this.client.apiClient.SimpleSearchPost(payload, { dataset_id: this.name });
37
- if (options.debounce && this.debounceTimer) {
38
- clearTimeout(this.debounceTimer);
39
- return new Promise((resolve) => {
40
- this.debounceTimer = setTimeout(async () => { const res = await reqCallback(); resolve(res); }, options.debounce);
41
- });
42
- }
43
- else {
44
- const response = await reqCallback();
45
- return response.body;
46
- }
47
- }
48
- async insertDocuments(documents, options) {
49
- const results = await this._GenericBulkOperation({
50
- data: documents !== null && documents !== void 0 ? documents : [],
51
- ...options,
52
- fn: async (documentsSlice) => (await this.client.apiClient.BulkInsert({ documents: documentsSlice }, { dataset_id: this.name })).body
53
- });
54
- const finalResults = results.reduce((prev, cur) => {
55
- prev.failed_documents = prev.failed_documents.concat(cur.failed_documents);
56
- prev.inserted += cur.inserted;
57
- return prev;
58
- }, { inserted: 0, failed_documents: [] });
59
- return finalResults;
60
- }
61
- // TODO - ChunkSearch, insert, insertAndVectorize?, vectorize,
62
- async _GenericBulkOperation({ data, batchSize, fn, retryCount }) {
63
- batchSize = batchSize !== null && batchSize !== void 0 ? batchSize : 10000;
64
- retryCount = retryCount !== null && retryCount !== void 0 ? retryCount : 1;
65
- const results = [];
66
- for (let i = 0; i < (data === null || data === void 0 ? void 0 : data.length); i += batchSize) {
67
- for (let retrysSoFar = 0; retrysSoFar < retryCount; retrysSoFar++) {
68
- try {
69
- const res = await fn(data.slice(i, i + batchSize));
70
- results.push(res);
71
- break;
72
- }
73
- catch (e) {
74
- console.error(`Bulk operation failed with error, retrying - ${e}`);
75
- }
76
- }
77
- }
78
- return results;
79
- }
80
- async updateDocument(documentId, partialUpdates) {
81
- const response = await this.client.apiClient.Update({ id: documentId, updates: partialUpdates });
82
- return response.body;
83
- }
84
- async updateDocuments(updates, options) {
85
- const results = await this._GenericBulkOperation({
86
- data: updates !== null && updates !== void 0 ? updates : [],
87
- ...options,
88
- fn: async (updatesSlice) => (await this.client.apiClient.BulkUpdate({ updates: updatesSlice }, { dataset_id: this.name })).body
89
- });
90
- const finalResults = results.reduce((prev, cur) => {
91
- prev.failed_documents = prev.failed_documents.concat(cur.failed_documents);
92
- prev.inserted += cur.inserted;
93
- return prev;
94
- }, { inserted: 0, failed_documents: [] });
95
- return finalResults;
96
- }
97
- async updateDocumentsWhere(filters, partialUpdates) {
98
- return (await this.client.apiClient.UpdateWhere({ filters: filters.build().filters, updates: partialUpdates })).body;
99
- }
100
- async getDocument(documentId) {
101
- return (await this.client.apiClient.GetDocument({ document_id: documentId })).body;
102
- }
103
- async deleteDocument(documentId) {
104
- return (await this.client.apiClient.DeleteDocument({ document_id: documentId })).body;
105
- }
106
- async deleteDocuments(documentIds) {
107
- var _a;
108
- const filters = (0, _1.QueryBuilder)().match('_id', documentIds);
109
- return (await this.client.apiClient.DeleteWhere({ filters: (_a = filters.build().filters) !== null && _a !== void 0 ? _a : [] })).body;
110
- }
111
- async deleteDocumentsWhere(filters) {
112
- var _a;
113
- return (await this.client.apiClient.DeleteWhere({ filters: (_a = filters.build().filters) !== null && _a !== void 0 ? _a : [] })).body;
114
- }
115
- }
116
- exports.Dataset = Dataset;
2
+ // import { QueryBuilder, DiscoveryClient, _QueryBuilder } from ".";
3
+ // import { DeleteDocumentOutput, DeleteWhereOutput, GetDocumentOutput, SimpleSearchPostOutput, BulkInsertOutput,UpdateWhereOutput,BulkUpdateOutput } from "../..";
4
+ // import { _GenericMethodOptions } from "../../shared/BaseClient";
5
+ // interface searchOptions {
6
+ // debounce?:number;
7
+ // rawPayload?:any;
8
+ // }
9
+ // export class Dataset {
10
+ // client: DiscoveryClient;
11
+ // name: string;
12
+ // config: any;
13
+ // debounceTimer?:NodeJS.Timeout;
14
+ // constructor(client: DiscoveryClient, name: string, options: any) {
15
+ // // TODO validate name
16
+ // this.client = client;
17
+ // this.name = name;
18
+ // this.config = options;
19
+ // }
20
+ // get datasetName(): string {
21
+ // return this.name;
22
+ // };
23
+ // async insertDocument(document: any, options?: _GenericMethodOptions) {
24
+ // const response = await this.client.apiClient.Insert({
25
+ // document,
26
+ // ...options
27
+ // }, { dataset_id: this.name });
28
+ // return response.body;
29
+ // }
30
+ // // without options
31
+ // async search(): Promise<SimpleSearchPostOutput>;
32
+ // async search(query?: _QueryBuilder): Promise<SimpleSearchPostOutput>;
33
+ // async search(options?:searchOptions): Promise<SimpleSearchPostOutput>;
34
+ // async search(query?: _QueryBuilder,options?:searchOptions): Promise<SimpleSearchPostOutput>;
35
+ // async search(...args:any[]) {
36
+ // let payload: any = {};
37
+ // let options:searchOptions = {};
38
+ // for (const arg of args) {
39
+ // if (arg instanceof _QueryBuilder) {
40
+ // payload = {...payload,...arg.build()};
41
+ // }
42
+ // else {
43
+ // options = arg;
44
+ // if (options.rawPayload) payload = {...payload,...options.rawPayload};
45
+ // }
46
+ // }
47
+ // const reqCallback = async () => await this.client.apiClient.SimpleSearchPost(payload, { dataset_id: this.name });
48
+ // if (options.debounce && this.debounceTimer) {
49
+ // clearTimeout(this.debounceTimer);
50
+ // return new Promise((resolve) => {
51
+ // this.debounceTimer = setTimeout(async () => {const res = await reqCallback();resolve(res)},options.debounce);
52
+ // });
53
+ // } else {
54
+ // const response = await reqCallback();
55
+ // return response.body;
56
+ // }
57
+ // }
58
+ // async insertDocuments(documents: any, options?: _GenericMethodOptions & { batchSize?: number,retryCount?:number, progressCallback?: (progress:BulkInsertOutput[]) => any }):Promise<BulkInsertOutput> {
59
+ // const results = await this._GenericBulkOperation<any,BulkInsertOutput>({
60
+ // data:documents??[],
61
+ // ...options,
62
+ // fn:async (documentsSlice) => (await this.client.apiClient.BulkInsert({ documents:documentsSlice }, { dataset_id: this.name })).body
63
+ // });
64
+ // const finalResults = results.reduce((prev,cur) => {
65
+ // prev.failed_documents = prev.failed_documents.concat(cur.failed_documents);
66
+ // prev.inserted += cur.inserted
67
+ // return prev;
68
+ // },{inserted:0,failed_documents:[]});
69
+ // return finalResults;
70
+ // }
71
+ // // TODO - ChunkSearch, insert, insertAndVectorize?, vectorize,
72
+ // async _GenericBulkOperation<InputItem,OutputItem>({data,batchSize,fn,retryCount}:{
73
+ // data:InputItem[],
74
+ // fn:(data:InputItem[]) => Promise<OutputItem>,
75
+ // batchSize?:number,
76
+ // retryCount?:number,
77
+ // progressCallback?:(progress:OutputItem[]) => any
78
+ // }):Promise<OutputItem[]> {
79
+ // batchSize = batchSize ?? 10000;
80
+ // retryCount = retryCount ?? 1;
81
+ // const results:OutputItem[] = [];
82
+ // for (let i = 0; i < data?.length; i += batchSize) {
83
+ // for (let retrysSoFar = 0; retrysSoFar < retryCount; retrysSoFar++) {
84
+ // try {
85
+ // const res = await fn(data.slice(i, i + batchSize));
86
+ // results.push(res);
87
+ // break;
88
+ // } catch (e) { console.error(`Bulk operation failed with error, retrying - ${e}`) }
89
+ // }
90
+ // }
91
+ // return results;
92
+ // }
93
+ // async updateDocument(documentId: string, partialUpdates: any) {
94
+ // const response = await this.client.apiClient.Update({ id: documentId, updates: partialUpdates });
95
+ // return response.body;
96
+ // }
97
+ // async updateDocuments(updates: any, options?: _GenericMethodOptions & { batchSize?: number,retryCount?:number, progressCallback?: (progress:BulkUpdateOutput[]) => any }):Promise<BulkUpdateOutput> {
98
+ // const results = await this._GenericBulkOperation<any,BulkUpdateOutput>({
99
+ // data:updates??[],
100
+ // ...options,
101
+ // fn:async (updatesSlice) => (await this.client.apiClient.BulkUpdate({ updates:updatesSlice }, { dataset_id: this.name })).body
102
+ // });
103
+ // const finalResults = results.reduce((prev,cur) => {
104
+ // prev.failed_documents = prev.failed_documents.concat(cur.failed_documents);
105
+ // prev.inserted += cur.inserted
106
+ // return prev;
107
+ // },{inserted:0,failed_documents:[]});
108
+ // return finalResults;
109
+ // }
110
+ // async updateDocumentsWhere(filters: _QueryBuilder, partialUpdates: {[id:string]:any}):Promise<UpdateWhereOutput> {
111
+ // return (await this.client.apiClient.UpdateWhere({ filters: filters.build().filters, updates: partialUpdates })).body;
112
+ // }
113
+ // async getDocument(documentId: string):Promise<GetDocumentOutput> {
114
+ // return (await this.client.apiClient.GetDocument({document_id:documentId})).body;
115
+ // }
116
+ // async deleteDocument(documentId: string):Promise<DeleteDocumentOutput> {
117
+ // return (await this.client.apiClient.DeleteDocument({id:documentId})).body;
118
+ // }
119
+ // async deleteDocuments(documentIds: [string]):Promise<DeleteWhereOutput> {
120
+ // const filters = QueryBuilder().match('_id',documentIds);
121
+ // return (await this.client.apiClient.DeleteWhere({ filters: filters.build().filters??[] })).body;
122
+ // }
123
+ // async deleteDocumentsWhere(filters: _QueryBuilder):Promise<DeleteWhereOutput> {
124
+ // return (await this.client.apiClient.DeleteWhere({ filters: filters.build().filters??[]})).body;
125
+ // }
126
+ // }
@@ -1,180 +1,159 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DiscoveryClient = exports._QueryBuilder = exports._FilterBuilder = exports.FilterBuilder = exports.QueryBuilder = void 0;
4
- const __1 = require("../../");
5
- const Dataset_1 = require("./Dataset");
6
- function QueryBuilder() {
7
- return new _QueryBuilder();
8
- }
9
- exports.QueryBuilder = QueryBuilder;
10
- function FilterBuilder() {
11
- return new _FilterBuilder();
12
- }
13
- exports.FilterBuilder = FilterBuilder;
14
- class _FilterBuilder {
15
- constructor() {
16
- this.body = { filters: [], fieldsToAggregate: [], fieldsToAggregateStats: [] };
17
- }
18
- buildFilters() {
19
- return this.body.filters;
20
- }
21
- rawFilter(filter) {
22
- var _a;
23
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push(filter);
24
- return this;
25
- }
26
- filter(type, key, value, ...options) {
27
- var _a;
28
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({
29
- [type]: {
30
- key,
31
- value,
32
- ...options
33
- }
34
- });
35
- return this;
36
- }
37
- match(field, value) {
38
- var _a;
39
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ match: { key: field, value } });
40
- return this;
41
- }
42
- wildcard(field, value) {
43
- var _a;
44
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ wildcard: { key: field, value } });
45
- return this;
46
- }
47
- selfreference(fielda, fieldb, operation) {
48
- var _a;
49
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ selfreference: { a: fielda, b: fieldb, operation } });
50
- return this;
51
- }
52
- range(field, options) {
53
- var _a;
54
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ range: { key: field, ...options } });
55
- return this;
56
- }
57
- or(filters) {
58
- var _a;
59
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ or: filters.map(f => { var _a; return (_a = f.body.filters) !== null && _a !== void 0 ? _a : []; }) });
60
- return this;
61
- }
62
- not(filter) {
63
- var _a, _b, _c;
64
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ not: (_c = (_b = filter.body) === null || _b === void 0 ? void 0 : _b.filters) !== null && _c !== void 0 ? _c : [] });
65
- return this;
66
- }
67
- }
68
- exports._FilterBuilder = _FilterBuilder;
69
- class _QueryBuilder extends _FilterBuilder {
70
- constructor() {
71
- super();
72
- this.shouldPerformTextQuery = false;
73
- }
74
- build() {
75
- if (!this.shouldPerformTextQuery)
76
- return this.body;
77
- if (!this.defaultQueryValue)
78
- throw new Error("Please set the search query by calling .query('my search query') before performing a text search.");
79
- this.body.query = this.defaultQueryValue;
80
- return this.body;
81
- }
82
- query(query, fieldsToSearch) {
83
- this.defaultQueryValue = query;
84
- if (fieldsToSearch)
85
- this.body.fieldsToSearch = fieldsToSearch;
86
- return this;
87
- }
88
- queryConfig(weight, options) {
89
- this.body.queryConfig = { weight, ...(options !== null && options !== void 0 ? options : {}) };
90
- return this;
91
- }
92
- text(field, weight) {
93
- this.shouldPerformTextQuery = true;
94
- if (!field)
95
- return this; // support searching all fields
96
- if (!this.body.fieldsToSearch)
97
- this.body.fieldsToSearch = [];
98
- if (!weight)
99
- this.body.fieldsToSearch.push(field);
100
- else
101
- this.body.fieldsToSearch.push({ key: field, weight });
102
- return this;
103
- }
104
- vector(field, ...args) {
105
- if (!Array.isArray(this.body.vectorSearchQuery))
106
- this.body.vectorSearchQuery = [];
107
- let payload = { field };
108
- const inferredModelMatch = field.match(/_(.*)_.*vector_/); // title_text@1-0_vector_ -> text@1-0
109
- if (inferredModelMatch && inferredModelMatch[1])
110
- payload.model = inferredModelMatch[1]; // this can be overridden
111
- for (const arg of args) {
112
- if (typeof arg === 'number')
113
- payload.weight = arg; // weight
114
- else
115
- payload = { ...payload, ...arg }; // options
116
- }
117
- this.body.vectorSearchQuery.push(payload);
118
- return this;
119
- }
120
- sort(field, direction) {
121
- var _a, _b;
122
- if (!((_b = (_a = this === null || this === void 0 ? void 0 : this.body) === null || _a === void 0 ? void 0 : _a.sort) === null || _b === void 0 ? void 0 : _b.length))
123
- this.body.sort = {};
124
- this.body.sort[field] = direction;
125
- return this;
126
- }
127
- textSort(field, direction) {
128
- var _a, _b;
129
- if (!((_b = (_a = this === null || this === void 0 ? void 0 : this.body) === null || _a === void 0 ? void 0 : _a.textSort) === null || _b === void 0 ? void 0 : _b.length))
130
- this.body.textSort = {};
131
- this.body.textSort[field] = direction;
132
- return this;
133
- }
134
- rawOption(key, value) {
135
- this.body[key] = value;
136
- return this;
137
- }
138
- minimumRelevance(value) {
139
- this.body.minimumRelevance = value;
140
- return this;
141
- }
142
- page(value) {
143
- this.body.page = value;
144
- return this;
145
- }
146
- pageSize(value) {
147
- this.body.pageSize = value;
148
- return this;
149
- }
150
- includeFields(fields) {
151
- this.body.includeFields = fields;
152
- }
153
- excludeFields(fields) {
154
- this.body.excludeFields = fields;
155
- }
156
- includeVectors(whetherToInclude) {
157
- this.body.includeVectors = whetherToInclude;
158
- }
159
- aggregate(field, options) {
160
- var _a, _b, _c;
161
- (_a = this.body.fieldsToAggregate) === null || _a === void 0 ? void 0 : _a.push({ key: field, ...options, fieldsToAggregate: (_c = (_b = options === null || options === void 0 ? void 0 : options.aggregates) === null || _b === void 0 ? void 0 : _b.body.fieldsToAggregate) !== null && _c !== void 0 ? _c : [] });
162
- return this;
163
- }
164
- aggregateStats(field, interval) {
165
- var _a;
166
- (_a = this.body.fieldsToAggregateStats) === null || _a === void 0 ? void 0 : _a.push({ key: field, interval });
167
- return this;
168
- }
169
- }
170
- exports._QueryBuilder = _QueryBuilder;
171
- class DiscoveryClient {
172
- constructor(config) {
173
- this.apiClient = new __1.DiscoveryApiClient(config !== null && config !== void 0 ? config : {});
174
- }
175
- dataset(name, options) {
176
- let dataset = new Dataset_1.Dataset(this, name, options);
177
- return dataset;
178
- }
179
- }
180
- exports.DiscoveryClient = DiscoveryClient;
2
+ // import { DiscoveryApiClient, BulkInsertInput, BulkInsertOutput } from '../../';
3
+ // import { _ClientInput, CommandInput, CommandOutput, _GenericMethodOptions } from '../../shared/BaseClient';
4
+ // import { operations, components } from '../../generated/_DiscoveryApiSchemaTypes';
5
+ // import { Dataset } from './Dataset';
6
+ // type bodyType = operations['SimpleSearchPost']['requestBody']['content']['application/json'];
7
+ // export function QueryBuilder():_QueryBuilder{
8
+ // return new _QueryBuilder();
9
+ // }
10
+ // export function FilterBuilder():_FilterBuilder{
11
+ // return new _FilterBuilder();
12
+ // }
13
+ // export class _FilterBuilder {
14
+ // body: bodyType;
15
+ // constructor() {
16
+ // this.body = {filters:[],fieldsToAggregate:[],fieldsToAggregateStats:[]};
17
+ // }
18
+ // buildFilters() {
19
+ // return this.body.filters;
20
+ // }
21
+ // rawFilter(filter: components['schemas']['filterListItem']) {
22
+ // this.body.filters?.push(filter);
23
+ // return this;
24
+ // }
25
+ // filter(type: string, key: string, value: string, ...options: any) {
26
+ // this.body.filters?.push({
27
+ // [type]: {
28
+ // key,
29
+ // value,
30
+ // ...options
31
+ // }
32
+ // });
33
+ // return this;
34
+ // }
35
+ // match(field: string, value: any) {
36
+ // this.body.filters?.push({ match: { key: field, value } });
37
+ // return this;
38
+ // }
39
+ // wildcard(field: string, value: any) {
40
+ // this.body.filters?.push({ wildcard: { key: field, value } });
41
+ // return this;
42
+ // }
43
+ // selfreference(fielda: string, fieldb: string, operation: "<=" | ">=" | "<" | ">" | "==" | "!=") {
44
+ // this.body.filters?.push({ selfreference: { a: fielda, b: fieldb, operation } });
45
+ // return this;
46
+ // }
47
+ // range(field: string, options: Omit<components['schemas']['filterListItem']['range'],'key'>) {
48
+ // this.body.filters?.push({ range: { key: field, ...options } });
49
+ // return this;
50
+ // }
51
+ // or(filters: _FilterBuilder[]) {
52
+ // this.body.filters?.push({ or: filters.map(f => f.body.filters ?? []) });
53
+ // return this;
54
+ // }
55
+ // not(filter: _FilterBuilder) {
56
+ // this.body.filters?.push({ not: filter.body?.filters ?? [] });
57
+ // return this;
58
+ // }
59
+ // }
60
+ // export class _QueryBuilder extends _FilterBuilder {
61
+ // defaultQueryValue?: string;
62
+ // shouldPerformTextQuery:boolean;
63
+ // constructor() {
64
+ // super();
65
+ // this.shouldPerformTextQuery = false;
66
+ // }
67
+ // build() {
68
+ // if (!this.shouldPerformTextQuery) return this.body;
69
+ // if (!this.defaultQueryValue) throw new Error("Please set the search query by calling .query('my search query') before performing a text search.");
70
+ // this.body.query = this.defaultQueryValue;
71
+ // return this.body;
72
+ // }
73
+ // query(query:string,fieldsToSearch?: bodyType['fieldsToSearch']) {
74
+ // this.defaultQueryValue = query;
75
+ // if (fieldsToSearch) this.body.fieldsToSearch = fieldsToSearch;
76
+ // return this;
77
+ // }
78
+ // queryConfig(weight:number,options?:bodyType['queryConfig']) {
79
+ // this.body.queryConfig = {weight,...(options??{})};
80
+ // return this;
81
+ // }
82
+ // text(field?:string): _QueryBuilder;
83
+ // text(field?:string,weight?:number):_QueryBuilder{
84
+ // this.shouldPerformTextQuery = true;
85
+ // if (!field) return this; // support searching all fields
86
+ // if (!this.body.fieldsToSearch) this.body.fieldsToSearch = [];
87
+ // if (!weight) this.body.fieldsToSearch.push(field);
88
+ // else this.body.fieldsToSearch.push({field,weight});
89
+ // return this;
90
+ // }
91
+ // vector(field: string, weight?: number): _QueryBuilder;
92
+ // vector(field: string, options?: components['schemas']['vectorSearchQuery']): _QueryBuilder;
93
+ // vector(field: string, weight?: number, options?: components['schemas']['vectorSearchQuery']): _QueryBuilder;
94
+ // vector(field: string, ...args:any[]) {
95
+ // if (!Array.isArray(this.body.vectorSearchQuery)) this.body.vectorSearchQuery = [];
96
+ // let payload:components['schemas']['vectorSearchQuery'] = {field};
97
+ // const inferredModelMatch = field.match(/_(.*)_.*vector_/) // title_text@1-0_vector_ -> text@1-0
98
+ // if (inferredModelMatch && inferredModelMatch[1]) payload.model = inferredModelMatch[1]; // this can be overridden
99
+ // for (const arg of args) {
100
+ // if (typeof arg ==='number') payload.weight = arg; // weight
101
+ // else payload = {...payload,...arg}; // options
102
+ // }
103
+ // this.body.vectorSearchQuery.push(payload);
104
+ // return this;
105
+ // }
106
+ // sort(field: string, direction: 'asc' | 'desc') {
107
+ // if (!this?.body?.sort?.length) this.body.sort = {};
108
+ // this.body.sort[field] = direction;
109
+ // return this;
110
+ // }
111
+ // textSort(field: string, direction: 'asc' | 'desc') {
112
+ // if (!this?.body?.textSort?.length) this.body.textSort = {};
113
+ // this.body.textSort[field] = direction;
114
+ // return this;
115
+ // }
116
+ // rawOption(key: string, value: any) {
117
+ // (this.body as any)[key] = value;
118
+ // return this;
119
+ // }
120
+ // minimumRelevance(value: bodyType['minimumRelevance']) {
121
+ // this.body.minimumRelevance = value;
122
+ // return this;
123
+ // }
124
+ // page(value: bodyType['page']) {
125
+ // this.body.page = value;
126
+ // return this;
127
+ // }
128
+ // pageSize(value: bodyType['pageSize']) {
129
+ // this.body.pageSize = value;
130
+ // return this;
131
+ // }
132
+ // includeFields(fields:bodyType['includeFields']) {
133
+ // this.body.includeFields = fields;
134
+ // }
135
+ // excludeFields(fields:bodyType['excludeFields']) {
136
+ // this.body.excludeFields = fields;
137
+ // }
138
+ // includeVectors(whetherToInclude:bodyType['includeVectors']){
139
+ // this.body.includeVectors = whetherToInclude;
140
+ // }
141
+ // aggregate(field: string, options?: { options?: any, aggregates?: _QueryBuilder }) {
142
+ // this.body.fieldsToAggregate?.push({ field, ...options, fieldsToAggregate: options?.aggregates?.body.fieldsToAggregate ?? [] });
143
+ // return this;
144
+ // }
145
+ // aggregateStats(field: string, interval?: number) {
146
+ // this.body.fieldsToAggregateStats?.push({ field, interval });
147
+ // return this;
148
+ // }
149
+ // }
150
+ // export class DiscoveryClient {
151
+ // apiClient:DiscoveryApiClient;
152
+ // constructor(config?: _ClientInput) {
153
+ // this.apiClient = new DiscoveryApiClient(config ?? {});
154
+ // }
155
+ // dataset(name: string, options?: any) {
156
+ // let dataset = new Dataset(this, name, options);
157
+ // return dataset;
158
+ // }
159
+ // }
@@ -1,13 +1,3 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./discovery"), exports);
2
+ // Not interested in this right now
3
+ // export * from './discovery';
@@ -25,7 +25,7 @@ function GetFlattenedSchema(schema) {
25
25
  }
26
26
  async function GenerateSDKFromOpenAPISchema({ config }) {
27
27
  const openapiSchema = await (await (0, cross_fetch_1.default)(config.schema_url)).json();
28
- const typescriptOutput = await (0, openapi_typescript_1.default)(openapiSchema);
28
+ const typescriptOutput = 'interface definitions {[id:string]:any};\n' + (await (0, openapi_typescript_1.default)(openapiSchema));
29
29
  let sdkText = '';
30
30
  const pipeline = [
31
31
  () => {