openlayer 0.1.32 → 0.1.33

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 (2) hide show
  1. package/dist/index.js +9 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.OpenAIMonitor = exports.OpenlayerClient = void 0;
20
+ const node_fetch_1 = require("node-fetch");
20
21
  const openai_1 = require("openai");
21
22
  const uuid_1 = require("uuid");
22
23
  const request_1 = require("./utils/request");
@@ -126,7 +127,7 @@ class OpenlayerClient {
126
127
  catch (_a) { }
127
128
  const createInferencePipelineEndpoint = `/projects/${projectId}/inference-pipelines`;
128
129
  const createInferencePipelineQuery = this.resolvedQuery(createInferencePipelineEndpoint, { version: this.version });
129
- const createInferencePipelineResponse = yield fetch(createInferencePipelineQuery, {
130
+ const createInferencePipelineResponse = yield (0, node_fetch_1.default)(createInferencePipelineQuery, {
130
131
  body: JSON.stringify({
131
132
  description: '',
132
133
  name,
@@ -137,7 +138,7 @@ class OpenlayerClient {
137
138
  },
138
139
  method: 'POST',
139
140
  });
140
- const inferencePipeline = yield createInferencePipelineResponse.json();
141
+ const inferencePipeline = (yield createInferencePipelineResponse.json());
141
142
  if (!(inferencePipeline === null || inferencePipeline === void 0 ? void 0 : inferencePipeline.id)) {
142
143
  throw new Error('Error creating inference pipeline');
143
144
  }
@@ -158,7 +159,7 @@ class OpenlayerClient {
158
159
  catch (_b) { }
159
160
  const projectsEndpoint = '/projects';
160
161
  const projectsQuery = this.resolvedQuery(projectsEndpoint);
161
- const response = yield fetch(projectsQuery, {
162
+ const response = yield (0, node_fetch_1.default)(projectsQuery, {
162
163
  body: JSON.stringify({
163
164
  description,
164
165
  name,
@@ -170,7 +171,7 @@ class OpenlayerClient {
170
171
  },
171
172
  method: 'POST',
172
173
  });
173
- const data = yield response.json();
174
+ const data = (yield response.json());
174
175
  const { items: projects, error } = data;
175
176
  if (!Array.isArray(projects)) {
176
177
  throw new Error(typeof error === 'string' ? error : 'Invalid response from Openlayer');
@@ -195,14 +196,14 @@ class OpenlayerClient {
195
196
  version: this.version,
196
197
  };
197
198
  const inferencePipelineQuery = this.resolvedQuery(inferencePipelineEndpoint, inferencePipelineQueryParameters);
198
- const inferencePipelineResponse = yield fetch(inferencePipelineQuery, {
199
+ const inferencePipelineResponse = yield (0, node_fetch_1.default)(inferencePipelineQuery, {
199
200
  headers: {
200
201
  Authorization: `Bearer ${this.openlayerApiKey}`,
201
202
  'Content-Type': 'application/json',
202
203
  },
203
204
  method: 'GET',
204
205
  });
205
- const { items: inferencePipelines, error } = yield inferencePipelineResponse.json();
206
+ const { items: inferencePipelines, error } = (yield inferencePipelineResponse.json());
206
207
  const inferencePipeline = Array.isArray(inferencePipelines)
207
208
  ? inferencePipelines.find((p) => p.name === name)
208
209
  : undefined;
@@ -224,7 +225,7 @@ class OpenlayerClient {
224
225
  version: this.version,
225
226
  };
226
227
  const projectsQuery = this.resolvedQuery(projectsEndpoint, projectsQueryParameters);
227
- const response = yield fetch(projectsQuery, {
228
+ const response = yield (0, node_fetch_1.default)(projectsQuery, {
228
229
  headers: {
229
230
  Authorization: `Bearer ${this.openlayerApiKey}`,
230
231
  'Content-Type': 'application/json',
@@ -257,7 +258,7 @@ class OpenlayerClient {
257
258
  try {
258
259
  const dataStreamEndpoint = `/inference-pipelines/${inferencePipelineId}/data-stream`;
259
260
  const dataStreamQuery = this.resolvedQuery(dataStreamEndpoint);
260
- const response = yield fetch(dataStreamQuery, {
261
+ const response = yield (0, node_fetch_1.default)(dataStreamQuery, {
261
262
  body: JSON.stringify({
262
263
  config,
263
264
  rows: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openlayer",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "description": "The Openlayer TypeScript client",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",