@relevanceai/sdk 1.9.0 → 1.12.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,233 +1,159 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- var __assign = (this && this.__assign) || function () {
17
- __assign = Object.assign || function(t) {
18
- for (var s, i = 1, n = arguments.length; i < n; i++) {
19
- s = arguments[i];
20
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
- t[p] = s[p];
22
- }
23
- return t;
24
- };
25
- return __assign.apply(this, arguments);
26
- };
27
- var __values = (this && this.__values) || function(o) {
28
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
29
- if (m) return m.call(o);
30
- if (o && typeof o.length === "number") return {
31
- next: function () {
32
- if (o && i >= o.length) o = void 0;
33
- return { value: o && o[i++], done: !o };
34
- }
35
- };
36
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
37
- };
38
- import { DiscoveryApiClient } from '../../';
39
- import { Dataset } from './Dataset';
40
- export function QueryBuilder() {
41
- return new _QueryBuilder();
42
- }
43
- export function FilterBuilder() {
44
- return new _FilterBuilder();
45
- }
46
- var _FilterBuilder = /** @class */ (function () {
47
- function _FilterBuilder() {
48
- this.body = { filters: [], fieldsToAggregate: [], fieldsToAggregateStats: [] };
49
- }
50
- _FilterBuilder.prototype.buildFilters = function () {
51
- return this.body.filters;
52
- };
53
- _FilterBuilder.prototype.rawFilter = function (filter) {
54
- var _a;
55
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push(filter);
56
- return this;
57
- };
58
- _FilterBuilder.prototype.filter = function (type, key, value) {
59
- var _a;
60
- var _b;
61
- var options = [];
62
- for (var _i = 3; _i < arguments.length; _i++) {
63
- options[_i - 3] = arguments[_i];
64
- }
65
- (_b = this.body.filters) === null || _b === void 0 ? void 0 : _b.push((_a = {},
66
- _a[type] = __assign({ key: key, value: value }, options),
67
- _a));
68
- return this;
69
- };
70
- _FilterBuilder.prototype.match = function (field, value) {
71
- var _a;
72
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ match: { key: field, value: value } });
73
- return this;
74
- };
75
- _FilterBuilder.prototype.wildcard = function (field, value) {
76
- var _a;
77
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ wildcard: { key: field, value: value } });
78
- return this;
79
- };
80
- _FilterBuilder.prototype.selfreference = function (fielda, fieldb, operation) {
81
- var _a;
82
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ selfreference: { a: fielda, b: fieldb, operation: operation } });
83
- return this;
84
- };
85
- _FilterBuilder.prototype.range = function (field, options) {
86
- var _a;
87
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ range: __assign({ key: field }, options) });
88
- return this;
89
- };
90
- _FilterBuilder.prototype.or = function (filters) {
91
- var _a;
92
- (_a = this.body.filters) === null || _a === void 0 ? void 0 : _a.push({ or: filters.map(function (f) { var _a; return (_a = f.body.filters) !== null && _a !== void 0 ? _a : []; }) });
93
- return this;
94
- };
95
- _FilterBuilder.prototype.not = function (filter) {
96
- var _a, _b, _c;
97
- (_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 : [] });
98
- return this;
99
- };
100
- return _FilterBuilder;
101
- }());
102
- export { _FilterBuilder };
103
- var _QueryBuilder = /** @class */ (function (_super) {
104
- __extends(_QueryBuilder, _super);
105
- function _QueryBuilder() {
106
- var _this = _super.call(this) || this;
107
- _this.shouldPerformTextQuery = false;
108
- return _this;
109
- }
110
- _QueryBuilder.prototype.build = function () {
111
- if (!this.shouldPerformTextQuery)
112
- return this.body;
113
- if (!this.defaultQueryValue)
114
- throw new Error("Please set the search query by calling .query('my search query') before performing a text search.");
115
- this.body.query = this.defaultQueryValue;
116
- return this.body;
117
- };
118
- _QueryBuilder.prototype.query = function (query, fieldsToSearch) {
119
- this.defaultQueryValue = query;
120
- if (fieldsToSearch)
121
- this.body.fieldsToSearch = fieldsToSearch;
122
- return this;
123
- };
124
- _QueryBuilder.prototype.queryConfig = function (weight, options) {
125
- this.body.queryConfig = __assign({ weight: weight }, (options !== null && options !== void 0 ? options : {}));
126
- return this;
127
- };
128
- _QueryBuilder.prototype.text = function (field, weight) {
129
- this.shouldPerformTextQuery = true;
130
- if (!field)
131
- return this; // support searching all fields
132
- if (!this.body.fieldsToSearch)
133
- this.body.fieldsToSearch = [];
134
- if (!weight)
135
- this.body.fieldsToSearch.push(field);
136
- else
137
- this.body.fieldsToSearch.push({ key: field, weight: weight });
138
- return this;
139
- };
140
- _QueryBuilder.prototype.vector = function (field) {
141
- var e_1, _a;
142
- var args = [];
143
- for (var _i = 1; _i < arguments.length; _i++) {
144
- args[_i - 1] = arguments[_i];
145
- }
146
- if (!Array.isArray(this.body.vectorSearchQuery))
147
- this.body.vectorSearchQuery = [];
148
- var payload = { field: field };
149
- var inferredModelMatch = field.match(/_(.*)_.*vector_/); // title_text@1-0_vector_ -> text@1-0
150
- if (inferredModelMatch && inferredModelMatch[1])
151
- payload.model = inferredModelMatch[1]; // this can be overridden
152
- try {
153
- for (var args_1 = __values(args), args_1_1 = args_1.next(); !args_1_1.done; args_1_1 = args_1.next()) {
154
- var arg = args_1_1.value;
155
- if (typeof arg === 'number')
156
- payload.weight = arg; // weight
157
- else
158
- payload = __assign(__assign({}, payload), arg); // options
159
- }
160
- }
161
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
162
- finally {
163
- try {
164
- if (args_1_1 && !args_1_1.done && (_a = args_1.return)) _a.call(args_1);
165
- }
166
- finally { if (e_1) throw e_1.error; }
167
- }
168
- this.body.vectorSearchQuery.push(payload);
169
- return this;
170
- };
171
- _QueryBuilder.prototype.sort = function (field, direction) {
172
- var _a, _b;
173
- 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))
174
- this.body.sort = {};
175
- this.body.sort[field] = direction;
176
- return this;
177
- };
178
- _QueryBuilder.prototype.textSort = function (field, direction) {
179
- var _a, _b;
180
- 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))
181
- this.body.textSort = {};
182
- this.body.textSort[field] = direction;
183
- return this;
184
- };
185
- _QueryBuilder.prototype.rawOption = function (key, value) {
186
- this.body[key] = value;
187
- return this;
188
- };
189
- _QueryBuilder.prototype.minimumRelevance = function (value) {
190
- this.body.minimumRelevance = value;
191
- return this;
192
- };
193
- _QueryBuilder.prototype.page = function (value) {
194
- this.body.page = value;
195
- return this;
196
- };
197
- _QueryBuilder.prototype.pageSize = function (value) {
198
- this.body.pageSize = value;
199
- return this;
200
- };
201
- _QueryBuilder.prototype.includeFields = function (fields) {
202
- this.body.includeFields = fields;
203
- };
204
- _QueryBuilder.prototype.excludeFields = function (fields) {
205
- this.body.excludeFields = fields;
206
- };
207
- _QueryBuilder.prototype.includeVectors = function (whetherToInclude) {
208
- this.body.includeVectors = whetherToInclude;
209
- };
210
- _QueryBuilder.prototype.aggregate = function (field, options) {
211
- var _a, _b, _c;
212
- (_a = this.body.fieldsToAggregate) === null || _a === void 0 ? void 0 : _a.push(__assign(__assign({ 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 : [] }));
213
- return this;
214
- };
215
- _QueryBuilder.prototype.aggregateStats = function (field, interval) {
216
- var _a;
217
- (_a = this.body.fieldsToAggregateStats) === null || _a === void 0 ? void 0 : _a.push({ key: field, interval: interval });
218
- return this;
219
- };
220
- return _QueryBuilder;
221
- }(_FilterBuilder));
222
- export { _QueryBuilder };
223
- var DiscoveryClient = /** @class */ (function () {
224
- function DiscoveryClient(config) {
225
- this.apiClient = new DiscoveryApiClient(config !== null && config !== void 0 ? config : {});
226
- }
227
- DiscoveryClient.prototype.dataset = function (name, options) {
228
- var dataset = new Dataset(this, name, options);
229
- return dataset;
230
- };
231
- return DiscoveryClient;
232
- }());
233
- export { DiscoveryClient };
1
+ "use strict";
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 +1,3 @@
1
- export * from './discovery';
1
+ "use strict";
2
+ // Not interested in this right now
3
+ // export * from './discovery';
@@ -50,28 +50,28 @@ var _GenericClient = /** @class */ (function () {
50
50
  var _b, _c, _d, _e, _f;
51
51
  var input = _a.input, path = _a.path, method = _a.method, options = _a.options;
52
52
  return __awaiter(this, void 0, void 0, function () {
53
- var settings, final_dataset_id, res, _g, _h, body;
54
- return __generator(this, function (_j) {
55
- switch (_j.label) {
53
+ var settings, final_dataset_id, res, _g, _h, _j, body;
54
+ return __generator(this, function (_k) {
55
+ switch (_k.label) {
56
56
  case 0:
57
57
  settings = {
58
58
  method: method,
59
- headers: { authorization: ((_b = this.config.project) !== null && _b !== void 0 ? _b : envVars.project) + ":" + ((_c = this.config.api_key) !== null && _c !== void 0 ? _c : envVars.api_key) },
59
+ headers: { authorization: "".concat((_b = this.config.project) !== null && _b !== void 0 ? _b : envVars.project, ":").concat((_c = this.config.api_key) !== null && _c !== void 0 ? _c : envVars.api_key) },
60
60
  };
61
61
  if (method.toLowerCase() !== 'get')
62
62
  settings.body = JSON.stringify(input);
63
63
  final_dataset_id = (_e = (_d = options === null || options === void 0 ? void 0 : options.dataset_id) !== null && _d !== void 0 ? _d : this.config.dataset_id) !== null && _e !== void 0 ? _e : "";
64
- return [4 /*yield*/, fetch(((_f = this.config.endpoint) !== null && _f !== void 0 ? _f : this.serviceConfig.endpoint) + "/latest" + path.replace('{dataset_id}', final_dataset_id), settings)];
64
+ return [4 /*yield*/, fetch("".concat((_f = this.config.endpoint) !== null && _f !== void 0 ? _f : this.serviceConfig.endpoint, "/latest").concat(path.replace('{dataset_id}', final_dataset_id)), settings)];
65
65
  case 1:
66
- res = _j.sent();
66
+ res = _k.sent();
67
67
  if (!!res.ok) return [3 /*break*/, 3];
68
68
  _g = Error.bind;
69
- _h = path + " " + method + " failed with status " + res.status + ": ";
69
+ _j = (_h = "".concat(path, " ").concat(method, " failed with status ").concat(res.status, ": ")).concat;
70
70
  return [4 /*yield*/, res.text()];
71
- case 2: throw new (_g.apply(Error, [void 0, _h + (_j.sent())]))();
71
+ case 2: throw new (_g.apply(Error, [void 0, _j.apply(_h, [(_k.sent())])]))();
72
72
  case 3: return [4 /*yield*/, res.json()];
73
73
  case 4:
74
- body = _j.sent();
74
+ body = _k.sent();
75
75
  return [2 /*return*/, { body: body }];
76
76
  }
77
77
  });
@@ -80,7 +80,7 @@ function GetFlattenedSchema(schema) {
80
80
  for (var _j = (e_2 = void 0, __values(Object.entries(methods))), _k = _j.next(); !_k.done; _k = _j.next()) {
81
81
  var _l = __read(_k.value, 2), method = _l[0], pathData = _l[1];
82
82
  var operation = pathData; // object.entries didnt work here
83
- var operationSummaryName = (_e = ((_d = (_c = operation === null || operation === void 0 ? void 0 : operation.operationId) !== null && _c !== void 0 ? _c : operation === null || operation === void 0 ? void 0 : operation.summary) !== null && _d !== void 0 ? _d : path + "-" + method)) === null || _e === void 0 ? void 0 : _e.replace(/[^A-Za-z0-9]/g, "");
83
+ var operationSummaryName = (_e = ((_d = (_c = operation === null || operation === void 0 ? void 0 : operation.operationId) !== null && _c !== void 0 ? _c : operation === null || operation === void 0 ? void 0 : operation.summary) !== null && _d !== void 0 ? _d : "".concat(path, "-").concat(method))) === null || _e === void 0 ? void 0 : _e.replace(/[^A-Za-z0-9]/g, "");
84
84
  final.push({ path: path, method: method, operation: operation, operationSummaryName: operationSummaryName });
85
85
  }
86
86
  }
@@ -105,21 +105,22 @@ function GetFlattenedSchema(schema) {
105
105
  function GenerateSDKFromOpenAPISchema(_a) {
106
106
  var config = _a.config;
107
107
  return __awaiter(this, void 0, void 0, function () {
108
- var openapiSchema, typescriptOutput, sdkText, pipeline, pipeline_1, pipeline_1_1, fn;
109
- var e_3, _b;
110
- return __generator(this, function (_c) {
111
- switch (_c.label) {
108
+ var openapiSchema, typescriptOutput, _b, sdkText, pipeline, pipeline_1, pipeline_1_1, fn;
109
+ var e_3, _c;
110
+ return __generator(this, function (_d) {
111
+ switch (_d.label) {
112
112
  case 0: return [4 /*yield*/, fetch(config.schema_url)];
113
- case 1: return [4 /*yield*/, (_c.sent()).json()];
113
+ case 1: return [4 /*yield*/, (_d.sent()).json()];
114
114
  case 2:
115
- openapiSchema = _c.sent();
115
+ openapiSchema = _d.sent();
116
+ _b = 'interface definitions {[id:string]:any};\n';
116
117
  return [4 /*yield*/, openapiTS(openapiSchema)];
117
118
  case 3:
118
- typescriptOutput = _c.sent();
119
+ typescriptOutput = _b + (_d.sent());
119
120
  sdkText = '';
120
121
  pipeline = [
121
122
  function () {
122
- sdkText += "import {CommandInput,_GenericClient,CommandOutput,_ClientInput,_GenericMethodOptions} from '../shared/BaseClient';\n import {operations} from './_" + config.name + "SchemaTypes';\n";
123
+ sdkText += "import {CommandInput,_GenericClient,CommandOutput,_ClientInput,_GenericMethodOptions} from '../shared/BaseClient';\n import {operations} from './_".concat(config.name, "SchemaTypes';\n");
123
124
  },
124
125
  function () {
125
126
  var e_4, _a;
@@ -127,12 +128,12 @@ function GenerateSDKFromOpenAPISchema(_a) {
127
128
  for (var _b = __values(GetFlattenedSchema(openapiSchema)), _c = _b.next(); !_c.done; _c = _b.next()) {
128
129
  var _d = _c.value, path = _d.path, method = _d.method, operation = _d.operation, operationSummaryName = _d.operationSummaryName;
129
130
  if (method.toLowerCase() !== 'get' && operation.requestBody) {
130
- sdkText += "\n export type " + operationSummaryName + "Input = operations['" + operation.operationId + "']['requestBody']['content']['application/json']";
131
+ sdkText += "\n export type ".concat(operationSummaryName, "Input = operations['").concat(operation.operationId, "']['requestBody']['content']['application/json']");
131
132
  }
132
133
  else {
133
- sdkText += "\n export type " + operationSummaryName + "Input = {}";
134
+ sdkText += "\n export type ".concat(operationSummaryName, "Input = {}");
134
135
  }
135
- sdkText += "\nexport type " + operationSummaryName + "Output = operations['" + operation.operationId + "']['responses']['200']['content']['application/json']";
136
+ sdkText += "\nexport type ".concat(operationSummaryName, "Output = operations['").concat(operation.operationId, "']['responses']['200']['content']['application/json']");
136
137
  }
137
138
  }
138
139
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
@@ -144,14 +145,14 @@ function GenerateSDKFromOpenAPISchema(_a) {
144
145
  }
145
146
  },
146
147
  function () {
147
- sdkText += "\nexport class " + config.name + "Client extends _GenericClient {\n constructor(config:_ClientInput){\n super({...config,service_name:'" + config.name + "'});\n }";
148
+ sdkText += "\nexport class ".concat(config.name, "Client extends _GenericClient {\n constructor(config:_ClientInput){\n super({...config,service_name:'").concat(config.name, "'});\n }");
148
149
  },
149
150
  function () {
150
151
  var e_5, _a;
151
152
  try {
152
153
  for (var _b = __values(GetFlattenedSchema(openapiSchema)), _c = _b.next(); !_c.done; _c = _b.next()) {
153
154
  var _d = _c.value, path = _d.path, method = _d.method, operationSummaryName = _d.operationSummaryName;
154
- sdkText += "\n public async " + operationSummaryName + "(\n input: CommandInput<" + operationSummaryName + "Input>,\n options?: _GenericMethodOptions\n ):Promise<CommandOutput<" + operationSummaryName + "Output>> {\n return this.SendRequest({\n input,\n method:'" + method + "',\n path:'" + path + "',\n options\n });\n }";
155
+ sdkText += "\n public async ".concat(operationSummaryName, "(\n input: CommandInput<").concat(operationSummaryName, "Input>,\n options?: _GenericMethodOptions\n ):Promise<CommandOutput<").concat(operationSummaryName, "Output>> {\n return this.SendRequest({\n input,\n method:'").concat(method, "',\n path:'").concat(path, "',\n options\n });\n }");
155
156
  }
156
157
  }
157
158
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
@@ -175,16 +176,16 @@ function GenerateSDKFromOpenAPISchema(_a) {
175
176
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
176
177
  finally {
177
178
  try {
178
- if (pipeline_1_1 && !pipeline_1_1.done && (_b = pipeline_1.return)) _b.call(pipeline_1);
179
+ if (pipeline_1_1 && !pipeline_1_1.done && (_c = pipeline_1.return)) _c.call(pipeline_1);
179
180
  }
180
181
  finally { if (e_3) throw e_3.error; }
181
182
  }
182
- return [4 /*yield*/, fs.writeFile("./src/generated/" + config.name + ".ts", sdkText)];
183
+ return [4 /*yield*/, fs.writeFile("./src/generated/".concat(config.name, ".ts"), sdkText)];
183
184
  case 4:
184
- _c.sent();
185
- return [4 /*yield*/, fs.writeFile("./src/generated/_" + config.name + "SchemaTypes.ts", typescriptOutput)];
185
+ _d.sent();
186
+ return [4 /*yield*/, fs.writeFile("./src/generated/_".concat(config.name, "SchemaTypes.ts"), typescriptOutput)];
186
187
  case 5:
187
- _c.sent();
188
+ _d.sent();
188
189
  return [2 /*return*/];
189
190
  }
190
191
  });
@@ -202,7 +203,7 @@ function GenerateSDKS() {
202
203
  for (_a = __values(Object.values(serviceConfigs)), _b = _a.next(); !_b.done; _b = _a.next()) {
203
204
  config = _b.value;
204
205
  GenerateSDKFromOpenAPISchema({ config: config });
205
- indexFileContent += "export * from \"./" + config.name + "\";\n";
206
+ indexFileContent += "export * from \"./".concat(config.name, "\";\n");
206
207
  }
207
208
  }
208
209
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
@@ -1,12 +1,7 @@
1
1
  export var serviceConfigs = {
2
2
  DiscoveryApi: {
3
- schema_url: 'https://gateway-api-aueast.relevance.ai/latest/openapi_schema.json',
4
- endpoint: 'https://gateway-api-aueast.relevance.ai',
3
+ schema_url: 'https://api.ap-southeast-2.relevance.ai/latest/openapi_schema.json',
4
+ endpoint: 'https://api.ap-southeast-2.relevance.ai',
5
5
  name: 'DiscoveryApi',
6
6
  },
7
- VectorApi: {
8
- schema_url: 'https://gateway-api-aueast.relevance.ai/latest/openapi.json',
9
- endpoint: 'https://gateway-api-aueast.relevance.ai',
10
- name: 'VectorApi',
11
- }
12
7
  };