@discomedia/utils 1.0.31 → 1.0.32

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.cjs CHANGED
@@ -1449,7 +1449,7 @@ function pLimit(concurrency) {
1449
1449
  },
1450
1450
  map: {
1451
1451
  async value(array, function_) {
1452
- const promises = array.map(value => this(function_, value));
1452
+ const promises = array.map((value, index) => this(function_, value, index));
1453
1453
  return Promise.all(promises);
1454
1454
  },
1455
1455
  },
@@ -2395,7 +2395,7 @@ const safeJSON = (text) => {
2395
2395
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2396
2396
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
2397
2397
 
2398
- const VERSION = '5.12.2'; // x-release-please-version
2398
+ const VERSION = '5.16.0'; // x-release-please-version
2399
2399
 
2400
2400
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2401
2401
  const isRunningInBrowser = () => {
@@ -3735,6 +3735,36 @@ class CursorPage extends AbstractPage {
3735
3735
  };
3736
3736
  }
3737
3737
  }
3738
+ class ConversationCursorPage extends AbstractPage {
3739
+ constructor(client, response, body, options) {
3740
+ super(client, response, body, options);
3741
+ this.data = body.data || [];
3742
+ this.has_more = body.has_more || false;
3743
+ this.last_id = body.last_id || '';
3744
+ }
3745
+ getPaginatedItems() {
3746
+ return this.data ?? [];
3747
+ }
3748
+ hasNextPage() {
3749
+ if (this.has_more === false) {
3750
+ return false;
3751
+ }
3752
+ return super.hasNextPage();
3753
+ }
3754
+ nextPageRequestOptions() {
3755
+ const cursor = this.last_id;
3756
+ if (!cursor) {
3757
+ return null;
3758
+ }
3759
+ return {
3760
+ ...this.options,
3761
+ query: {
3762
+ ...maybeObj(this.options.query),
3763
+ after: cursor,
3764
+ },
3765
+ };
3766
+ }
3767
+ }
3738
3768
 
3739
3769
  const checkFileSupport = () => {
3740
3770
  if (typeof File === 'undefined') {
@@ -6825,6 +6855,74 @@ class Containers extends APIResource {
6825
6855
  }
6826
6856
  Containers.Files = Files$2;
6827
6857
 
6858
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6859
+ class Items extends APIResource {
6860
+ /**
6861
+ * Create items in a conversation with the given ID.
6862
+ */
6863
+ create(conversationID, params, options) {
6864
+ const { include, ...body } = params;
6865
+ return this._client.post(path `/conversations/${conversationID}/items`, {
6866
+ query: { include },
6867
+ body,
6868
+ ...options,
6869
+ });
6870
+ }
6871
+ /**
6872
+ * Get a single item from a conversation with the given IDs.
6873
+ */
6874
+ retrieve(itemID, params, options) {
6875
+ const { conversation_id, ...query } = params;
6876
+ return this._client.get(path `/conversations/${conversation_id}/items/${itemID}`, { query, ...options });
6877
+ }
6878
+ /**
6879
+ * List all items for a conversation with the given ID.
6880
+ */
6881
+ list(conversationID, query = {}, options) {
6882
+ return this._client.getAPIList(path `/conversations/${conversationID}/items`, (ConversationCursorPage), { query, ...options });
6883
+ }
6884
+ /**
6885
+ * Delete an item from a conversation with the given IDs.
6886
+ */
6887
+ delete(itemID, params, options) {
6888
+ const { conversation_id } = params;
6889
+ return this._client.delete(path `/conversations/${conversation_id}/items/${itemID}`, options);
6890
+ }
6891
+ }
6892
+
6893
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6894
+ class Conversations extends APIResource {
6895
+ constructor() {
6896
+ super(...arguments);
6897
+ this.items = new Items(this._client);
6898
+ }
6899
+ /**
6900
+ * Create a conversation.
6901
+ */
6902
+ create(body, options) {
6903
+ return this._client.post('/conversations', { body, ...options });
6904
+ }
6905
+ /**
6906
+ * Get a conversation with the given ID.
6907
+ */
6908
+ retrieve(conversationID, options) {
6909
+ return this._client.get(path `/conversations/${conversationID}`, options);
6910
+ }
6911
+ /**
6912
+ * Update a conversation's metadata with the given ID.
6913
+ */
6914
+ update(conversationID, body, options) {
6915
+ return this._client.post(path `/conversations/${conversationID}`, { body, ...options });
6916
+ }
6917
+ /**
6918
+ * Delete a conversation with the given ID.
6919
+ */
6920
+ delete(conversationID, options) {
6921
+ return this._client.delete(path `/conversations/${conversationID}`, options);
6922
+ }
6923
+ }
6924
+ Conversations.Items = Items;
6925
+
6828
6926
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6829
6927
  class Embeddings extends APIResource {
6830
6928
  /**
@@ -6989,7 +7087,7 @@ let Files$1 = class Files extends APIResource {
6989
7087
  /**
6990
7088
  * Upload a file that can be used across various endpoints. Individual files can be
6991
7089
  * up to 512 MB, and the size of all files uploaded by one organization can be up
6992
- * to 100 GB.
7090
+ * to 1 TB.
6993
7091
  *
6994
7092
  * The Assistants API supports files up to 2 million tokens and of specific file
6995
7093
  * types. See the
@@ -8418,6 +8516,7 @@ class OpenAI {
8418
8516
  this.batches = new Batches(this);
8419
8517
  this.uploads = new Uploads(this);
8420
8518
  this.responses = new Responses(this);
8519
+ this.conversations = new Conversations(this);
8421
8520
  this.evals = new Evals(this);
8422
8521
  this.containers = new Containers(this);
8423
8522
  if (apiKey === undefined) {
@@ -8808,7 +8907,7 @@ class OpenAI {
8808
8907
  // Preserve legacy string encoding behavior for now
8809
8908
  headers.values.has('content-type')) ||
8810
8909
  // `Blob` is superset of `File`
8811
- body instanceof Blob ||
8910
+ (globalThis.Blob && body instanceof globalThis.Blob) ||
8812
8911
  // `FormData` -> `multipart/form-data`
8813
8912
  body instanceof FormData ||
8814
8913
  // `URLSearchParams` -> `application/x-www-form-urlencoded`
@@ -8863,6 +8962,7 @@ OpenAI.Beta = Beta;
8863
8962
  OpenAI.Batches = Batches;
8864
8963
  OpenAI.Uploads = Uploads;
8865
8964
  OpenAI.Responses = Responses;
8965
+ OpenAI.Conversations = Conversations;
8866
8966
  OpenAI.Evals = Evals;
8867
8967
  OpenAI.Containers = Containers;
8868
8968