@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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.0.31",
6
+ "version": "1.0.32",
7
7
  "author": "Disco Media",
8
8
  "description": "Utility functions used in Disco Media apps",
9
9
  "always-build-npm": true,
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "dotenv": "^17.2.1",
36
- "openai": "^5.12.2",
37
- "p-limit": "^7.0.0",
36
+ "openai": "^5.16.0",
37
+ "p-limit": "^7.1.1",
38
38
  "tslib": "^2.8.1",
39
39
  "ws": "^8.18.3"
40
40
  },
@@ -46,7 +46,7 @@
46
46
  "@rollup/plugin-typescript": "^12.1.4",
47
47
  "@types/ws": "^8.18.1",
48
48
  "lightweight-charts": "^5.0.8",
49
- "rollup": "^4.46.2",
49
+ "rollup": "^4.50.0",
50
50
  "typescript": "^5.9.2"
51
51
  }
52
52
  }
package/dist/test.js CHANGED
@@ -1104,7 +1104,7 @@ function pLimit(concurrency) {
1104
1104
  },
1105
1105
  map: {
1106
1106
  async value(array, function_) {
1107
- const promises = array.map(value => this(function_, value));
1107
+ const promises = array.map((value, index) => this(function_, value, index));
1108
1108
  return Promise.all(promises);
1109
1109
  },
1110
1110
  },
@@ -1370,7 +1370,7 @@ const safeJSON = (text) => {
1370
1370
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1371
1371
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
1372
1372
 
1373
- const VERSION = '5.12.2'; // x-release-please-version
1373
+ const VERSION = '5.16.0'; // x-release-please-version
1374
1374
 
1375
1375
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1376
1376
  const isRunningInBrowser = () => {
@@ -2710,6 +2710,36 @@ class CursorPage extends AbstractPage {
2710
2710
  };
2711
2711
  }
2712
2712
  }
2713
+ class ConversationCursorPage extends AbstractPage {
2714
+ constructor(client, response, body, options) {
2715
+ super(client, response, body, options);
2716
+ this.data = body.data || [];
2717
+ this.has_more = body.has_more || false;
2718
+ this.last_id = body.last_id || '';
2719
+ }
2720
+ getPaginatedItems() {
2721
+ return this.data ?? [];
2722
+ }
2723
+ hasNextPage() {
2724
+ if (this.has_more === false) {
2725
+ return false;
2726
+ }
2727
+ return super.hasNextPage();
2728
+ }
2729
+ nextPageRequestOptions() {
2730
+ const cursor = this.last_id;
2731
+ if (!cursor) {
2732
+ return null;
2733
+ }
2734
+ return {
2735
+ ...this.options,
2736
+ query: {
2737
+ ...maybeObj(this.options.query),
2738
+ after: cursor,
2739
+ },
2740
+ };
2741
+ }
2742
+ }
2713
2743
 
2714
2744
  const checkFileSupport = () => {
2715
2745
  if (typeof File === 'undefined') {
@@ -5800,6 +5830,74 @@ class Containers extends APIResource {
5800
5830
  }
5801
5831
  Containers.Files = Files$2;
5802
5832
 
5833
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5834
+ class Items extends APIResource {
5835
+ /**
5836
+ * Create items in a conversation with the given ID.
5837
+ */
5838
+ create(conversationID, params, options) {
5839
+ const { include, ...body } = params;
5840
+ return this._client.post(path `/conversations/${conversationID}/items`, {
5841
+ query: { include },
5842
+ body,
5843
+ ...options,
5844
+ });
5845
+ }
5846
+ /**
5847
+ * Get a single item from a conversation with the given IDs.
5848
+ */
5849
+ retrieve(itemID, params, options) {
5850
+ const { conversation_id, ...query } = params;
5851
+ return this._client.get(path `/conversations/${conversation_id}/items/${itemID}`, { query, ...options });
5852
+ }
5853
+ /**
5854
+ * List all items for a conversation with the given ID.
5855
+ */
5856
+ list(conversationID, query = {}, options) {
5857
+ return this._client.getAPIList(path `/conversations/${conversationID}/items`, (ConversationCursorPage), { query, ...options });
5858
+ }
5859
+ /**
5860
+ * Delete an item from a conversation with the given IDs.
5861
+ */
5862
+ delete(itemID, params, options) {
5863
+ const { conversation_id } = params;
5864
+ return this._client.delete(path `/conversations/${conversation_id}/items/${itemID}`, options);
5865
+ }
5866
+ }
5867
+
5868
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5869
+ class Conversations extends APIResource {
5870
+ constructor() {
5871
+ super(...arguments);
5872
+ this.items = new Items(this._client);
5873
+ }
5874
+ /**
5875
+ * Create a conversation.
5876
+ */
5877
+ create(body, options) {
5878
+ return this._client.post('/conversations', { body, ...options });
5879
+ }
5880
+ /**
5881
+ * Get a conversation with the given ID.
5882
+ */
5883
+ retrieve(conversationID, options) {
5884
+ return this._client.get(path `/conversations/${conversationID}`, options);
5885
+ }
5886
+ /**
5887
+ * Update a conversation's metadata with the given ID.
5888
+ */
5889
+ update(conversationID, body, options) {
5890
+ return this._client.post(path `/conversations/${conversationID}`, { body, ...options });
5891
+ }
5892
+ /**
5893
+ * Delete a conversation with the given ID.
5894
+ */
5895
+ delete(conversationID, options) {
5896
+ return this._client.delete(path `/conversations/${conversationID}`, options);
5897
+ }
5898
+ }
5899
+ Conversations.Items = Items;
5900
+
5803
5901
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5804
5902
  class Embeddings extends APIResource {
5805
5903
  /**
@@ -5964,7 +6062,7 @@ let Files$1 = class Files extends APIResource {
5964
6062
  /**
5965
6063
  * Upload a file that can be used across various endpoints. Individual files can be
5966
6064
  * up to 512 MB, and the size of all files uploaded by one organization can be up
5967
- * to 100 GB.
6065
+ * to 1 TB.
5968
6066
  *
5969
6067
  * The Assistants API supports files up to 2 million tokens and of specific file
5970
6068
  * types. See the
@@ -7393,6 +7491,7 @@ class OpenAI {
7393
7491
  this.batches = new Batches(this);
7394
7492
  this.uploads = new Uploads(this);
7395
7493
  this.responses = new Responses(this);
7494
+ this.conversations = new Conversations(this);
7396
7495
  this.evals = new Evals(this);
7397
7496
  this.containers = new Containers(this);
7398
7497
  if (apiKey === undefined) {
@@ -7783,7 +7882,7 @@ class OpenAI {
7783
7882
  // Preserve legacy string encoding behavior for now
7784
7883
  headers.values.has('content-type')) ||
7785
7884
  // `Blob` is superset of `File`
7786
- body instanceof Blob ||
7885
+ (globalThis.Blob && body instanceof globalThis.Blob) ||
7787
7886
  // `FormData` -> `multipart/form-data`
7788
7887
  body instanceof FormData ||
7789
7888
  // `URLSearchParams` -> `application/x-www-form-urlencoded`
@@ -7838,6 +7937,7 @@ OpenAI.Beta = Beta;
7838
7937
  OpenAI.Batches = Batches;
7839
7938
  OpenAI.Uploads = Uploads;
7840
7939
  OpenAI.Responses = Responses;
7940
+ OpenAI.Conversations = Conversations;
7841
7941
  OpenAI.Evals = Evals;
7842
7942
  OpenAI.Containers = Containers;
7843
7943