@discomedia/utils 1.0.57 → 1.0.59

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/dist/index.mjs CHANGED
@@ -2539,7 +2539,7 @@ const safeJSON = (text) => {
2539
2539
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2540
2540
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
2541
2541
 
2542
- const VERSION = '6.17.0'; // x-release-please-version
2542
+ const VERSION = '6.22.0'; // x-release-please-version
2543
2543
 
2544
2544
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2545
2545
  const isRunningInBrowser = () => {
@@ -3672,6 +3672,11 @@ async function defaultParseResponse(client, props) {
3672
3672
  const mediaType = contentType?.split(';')[0]?.trim();
3673
3673
  const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
3674
3674
  if (isJSON) {
3675
+ const contentLength = response.headers.get('content-length');
3676
+ if (contentLength === '0') {
3677
+ // if there is no content we can't do anything
3678
+ return undefined;
3679
+ }
3675
3680
  const json = await response.json();
3676
3681
  return addRequestID(json, response);
3677
3682
  }
@@ -7028,7 +7033,7 @@ class Completions extends APIResource {
7028
7033
  }
7029
7034
 
7030
7035
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
7031
- class Content extends APIResource {
7036
+ let Content$2 = class Content extends APIResource {
7032
7037
  /**
7033
7038
  * Retrieve Container File Content
7034
7039
  */
@@ -7040,13 +7045,13 @@ class Content extends APIResource {
7040
7045
  __binaryResponse: true,
7041
7046
  });
7042
7047
  }
7043
- }
7048
+ };
7044
7049
 
7045
7050
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
7046
7051
  let Files$2 = class Files extends APIResource {
7047
7052
  constructor() {
7048
7053
  super(...arguments);
7049
- this.content = new Content(this._client);
7054
+ this.content = new Content$2(this._client);
7050
7055
  }
7051
7056
  /**
7052
7057
  * Create a Container File
@@ -7055,7 +7060,7 @@ let Files$2 = class Files extends APIResource {
7055
7060
  * a JSON request with a file ID.
7056
7061
  */
7057
7062
  create(containerID, body, options) {
7058
- return this._client.post(path `/containers/${containerID}/files`, multipartFormRequestOptions({ body, ...options }, this._client));
7063
+ return this._client.post(path `/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
7059
7064
  }
7060
7065
  /**
7061
7066
  * Retrieve Container File
@@ -7084,7 +7089,7 @@ let Files$2 = class Files extends APIResource {
7084
7089
  });
7085
7090
  }
7086
7091
  };
7087
- Files$2.Content = Content;
7092
+ Files$2.Content = Content$2;
7088
7093
 
7089
7094
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
7090
7095
  class Containers extends APIResource {
@@ -8372,6 +8377,114 @@ class Responses extends APIResource {
8372
8377
  Responses.InputItems = InputItems;
8373
8378
  Responses.InputTokens = InputTokens;
8374
8379
 
8380
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8381
+ let Content$1 = class Content extends APIResource {
8382
+ /**
8383
+ * Get Skill Content
8384
+ */
8385
+ retrieve(skillID, options) {
8386
+ return this._client.get(path `/skills/${skillID}/content`, {
8387
+ ...options,
8388
+ headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
8389
+ __binaryResponse: true,
8390
+ });
8391
+ }
8392
+ };
8393
+
8394
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8395
+ class Content extends APIResource {
8396
+ /**
8397
+ * Get Skill Version Content
8398
+ */
8399
+ retrieve(version, params, options) {
8400
+ const { skill_id } = params;
8401
+ return this._client.get(path `/skills/${skill_id}/versions/${version}/content`, {
8402
+ ...options,
8403
+ headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
8404
+ __binaryResponse: true,
8405
+ });
8406
+ }
8407
+ }
8408
+
8409
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8410
+ class Versions extends APIResource {
8411
+ constructor() {
8412
+ super(...arguments);
8413
+ this.content = new Content(this._client);
8414
+ }
8415
+ /**
8416
+ * Create Skill Version
8417
+ */
8418
+ create(skillID, body = {}, options) {
8419
+ return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
8420
+ }
8421
+ /**
8422
+ * Get Skill Version
8423
+ */
8424
+ retrieve(version, params, options) {
8425
+ const { skill_id } = params;
8426
+ return this._client.get(path `/skills/${skill_id}/versions/${version}`, options);
8427
+ }
8428
+ /**
8429
+ * List Skill Versions
8430
+ */
8431
+ list(skillID, query = {}, options) {
8432
+ return this._client.getAPIList(path `/skills/${skillID}/versions`, (CursorPage), {
8433
+ query,
8434
+ ...options,
8435
+ });
8436
+ }
8437
+ /**
8438
+ * Delete Skill Version
8439
+ */
8440
+ delete(version, params, options) {
8441
+ const { skill_id } = params;
8442
+ return this._client.delete(path `/skills/${skill_id}/versions/${version}`, options);
8443
+ }
8444
+ }
8445
+ Versions.Content = Content;
8446
+
8447
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8448
+ class Skills extends APIResource {
8449
+ constructor() {
8450
+ super(...arguments);
8451
+ this.content = new Content$1(this._client);
8452
+ this.versions = new Versions(this._client);
8453
+ }
8454
+ /**
8455
+ * Create Skill
8456
+ */
8457
+ create(body = {}, options) {
8458
+ return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
8459
+ }
8460
+ /**
8461
+ * Get Skill
8462
+ */
8463
+ retrieve(skillID, options) {
8464
+ return this._client.get(path `/skills/${skillID}`, options);
8465
+ }
8466
+ /**
8467
+ * Update Skill Default Version
8468
+ */
8469
+ update(skillID, body, options) {
8470
+ return this._client.post(path `/skills/${skillID}`, { body, ...options });
8471
+ }
8472
+ /**
8473
+ * List Skills
8474
+ */
8475
+ list(query = {}, options) {
8476
+ return this._client.getAPIList('/skills', (CursorPage), { query, ...options });
8477
+ }
8478
+ /**
8479
+ * Delete Skill
8480
+ */
8481
+ delete(skillID, options) {
8482
+ return this._client.delete(path `/skills/${skillID}`, options);
8483
+ }
8484
+ }
8485
+ Skills.Content = Content$1;
8486
+ Skills.Versions = Versions;
8487
+
8375
8488
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8376
8489
  class Parts extends APIResource {
8377
8490
  /**
@@ -8981,6 +9094,7 @@ class OpenAI {
8981
9094
  this.conversations = new Conversations(this);
8982
9095
  this.evals = new Evals(this);
8983
9096
  this.containers = new Containers(this);
9097
+ this.skills = new Skills(this);
8984
9098
  this.videos = new Videos(this);
8985
9099
  if (apiKey === undefined) {
8986
9100
  throw new OpenAIError('Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.');
@@ -9238,7 +9352,9 @@ class OpenAI {
9238
9352
  return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
9239
9353
  }
9240
9354
  getAPIList(path, Page, opts) {
9241
- return this.requestAPIList(Page, { method: 'get', path, ...opts });
9355
+ return this.requestAPIList(Page, opts && 'then' in opts ?
9356
+ opts.then((opts) => ({ method: 'get', path, ...opts }))
9357
+ : { method: 'get', path, ...opts });
9242
9358
  }
9243
9359
  requestAPIList(Page, options) {
9244
9360
  const request = this.makeRequest(options, null, undefined);
@@ -9246,9 +9362,10 @@ class OpenAI {
9246
9362
  }
9247
9363
  async fetchWithTimeout(url, init, ms, controller) {
9248
9364
  const { signal, method, ...options } = init || {};
9365
+ const abort = this._makeAbort(controller);
9249
9366
  if (signal)
9250
- signal.addEventListener('abort', () => controller.abort());
9251
- const timeout = setTimeout(() => controller.abort(), ms);
9367
+ signal.addEventListener('abort', abort, { once: true });
9368
+ const timeout = setTimeout(abort, ms);
9252
9369
  const isReadableBody = (globalThis.ReadableStream && options.body instanceof globalThis.ReadableStream) ||
9253
9370
  (typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body);
9254
9371
  const fetchOptions = {
@@ -9379,6 +9496,11 @@ class OpenAI {
9379
9496
  this.validateHeaders(headers);
9380
9497
  return headers.values;
9381
9498
  }
9499
+ _makeAbort(controller) {
9500
+ // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
9501
+ // would capture all request options, and cause a memory leak.
9502
+ return () => controller.abort();
9503
+ }
9382
9504
  buildBody({ options: { body, headers: rawHeaders } }) {
9383
9505
  if (!body) {
9384
9506
  return { bodyHeaders: undefined, body: undefined };
@@ -9452,6 +9574,7 @@ OpenAI.Realtime = Realtime;
9452
9574
  OpenAI.Conversations = Conversations;
9453
9575
  OpenAI.Evals = Evals;
9454
9576
  OpenAI.Containers = Containers;
9577
+ OpenAI.Skills = Skills;
9455
9578
  OpenAI.Videos = Videos;
9456
9579
 
9457
9580
  // llm-openai-config.ts
@@ -16342,7 +16465,7 @@ var config = {};
16342
16465
 
16343
16466
  var main = {exports: {}};
16344
16467
 
16345
- var version = "17.2.3";
16468
+ var version = "17.3.1";
16346
16469
  var require$$4 = {
16347
16470
  version: version};
16348
16471
 
@@ -16364,12 +16487,9 @@ function requireMain () {
16364
16487
  '🔐 encrypt with Dotenvx: https://dotenvx.com',
16365
16488
  '🔐 prevent committing .env to code: https://dotenvx.com/precommit',
16366
16489
  '🔐 prevent building .env in docker: https://dotenvx.com/prebuild',
16367
- '📡 add observability to secrets: https://dotenvx.com/ops',
16368
- '👥 sync secrets across teammates & machines: https://dotenvx.com/ops',
16369
- '🗂️ backup and recover secrets: https://dotenvx.com/ops',
16370
- '✅ audit secrets and track compliance: https://dotenvx.com/ops',
16371
- '🔄 add secrets lifecycle management: https://dotenvx.com/ops',
16372
- '🔑 add access controls to secrets: https://dotenvx.com/ops',
16490
+ '🤖 agentic secret storage: https://dotenvx.com/as2',
16491
+ '⚡️ secrets for agents: https://dotenvx.com/as2',
16492
+ '🛡️ auth for agents: https://vestauth.com',
16373
16493
  '🛠️ run anywhere with `dotenvx run -- yourcommand`',
16374
16494
  '⚙️ specify custom .env file path with { path: \'/custom/path/.env\' }',
16375
16495
  '⚙️ enable debug logging with { debug: true }',