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