@discomedia/utils 1.0.30 → 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-frontend.cjs +103 -3
- package/dist/index-frontend.cjs.map +1 -1
- package/dist/index-frontend.mjs +103 -3
- package/dist/index-frontend.mjs.map +1 -1
- package/dist/index.cjs +106 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +106 -5
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +4 -4
- package/dist/test.js +793 -85
- package/dist/test.js.map +1 -1
- package/dist/types/index-frontend.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/market-time.d.ts.map +1 -1
- package/dist/types-frontend/index-frontend.d.ts +1 -1
- package/dist/types-frontend/index.d.ts +1 -1
- package/dist/types-frontend/market-time.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/alpaca-trading-api-CPaXTnjf.js +0 -1412
- package/dist/alpaca-trading-api-CPaXTnjf.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -667,7 +667,8 @@ function getMarketStatusImpl(date = new Date()) {
|
|
|
667
667
|
const nextMarketDay = calendar.getNextMarketDay(date);
|
|
668
668
|
nextStatusTime = getDayBoundaries(nextMarketDay, 'extended_hours').start;
|
|
669
669
|
}
|
|
670
|
-
|
|
670
|
+
// I think using nyDate here may be wrong - should use current time? i.e. date.getTime()
|
|
671
|
+
const nextStatusTimeDifference = nextStatusTime.getTime() - date.getTime();
|
|
671
672
|
return {
|
|
672
673
|
time: date,
|
|
673
674
|
timeString: formatNYLocale(nyDate),
|
|
@@ -1448,7 +1449,7 @@ function pLimit(concurrency) {
|
|
|
1448
1449
|
},
|
|
1449
1450
|
map: {
|
|
1450
1451
|
async value(array, function_) {
|
|
1451
|
-
const promises = array.map(value => this(function_, value));
|
|
1452
|
+
const promises = array.map((value, index) => this(function_, value, index));
|
|
1452
1453
|
return Promise.all(promises);
|
|
1453
1454
|
},
|
|
1454
1455
|
},
|
|
@@ -2394,7 +2395,7 @@ const safeJSON = (text) => {
|
|
|
2394
2395
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2395
2396
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
2396
2397
|
|
|
2397
|
-
const VERSION = '5.
|
|
2398
|
+
const VERSION = '5.16.0'; // x-release-please-version
|
|
2398
2399
|
|
|
2399
2400
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2400
2401
|
const isRunningInBrowser = () => {
|
|
@@ -3734,6 +3735,36 @@ class CursorPage extends AbstractPage {
|
|
|
3734
3735
|
};
|
|
3735
3736
|
}
|
|
3736
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
|
+
}
|
|
3737
3768
|
|
|
3738
3769
|
const checkFileSupport = () => {
|
|
3739
3770
|
if (typeof File === 'undefined') {
|
|
@@ -6824,6 +6855,74 @@ class Containers extends APIResource {
|
|
|
6824
6855
|
}
|
|
6825
6856
|
Containers.Files = Files$2;
|
|
6826
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
|
+
|
|
6827
6926
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6828
6927
|
class Embeddings extends APIResource {
|
|
6829
6928
|
/**
|
|
@@ -6988,7 +7087,7 @@ let Files$1 = class Files extends APIResource {
|
|
|
6988
7087
|
/**
|
|
6989
7088
|
* Upload a file that can be used across various endpoints. Individual files can be
|
|
6990
7089
|
* up to 512 MB, and the size of all files uploaded by one organization can be up
|
|
6991
|
-
* to
|
|
7090
|
+
* to 1 TB.
|
|
6992
7091
|
*
|
|
6993
7092
|
* The Assistants API supports files up to 2 million tokens and of specific file
|
|
6994
7093
|
* types. See the
|
|
@@ -8417,6 +8516,7 @@ class OpenAI {
|
|
|
8417
8516
|
this.batches = new Batches(this);
|
|
8418
8517
|
this.uploads = new Uploads(this);
|
|
8419
8518
|
this.responses = new Responses(this);
|
|
8519
|
+
this.conversations = new Conversations(this);
|
|
8420
8520
|
this.evals = new Evals(this);
|
|
8421
8521
|
this.containers = new Containers(this);
|
|
8422
8522
|
if (apiKey === undefined) {
|
|
@@ -8807,7 +8907,7 @@ class OpenAI {
|
|
|
8807
8907
|
// Preserve legacy string encoding behavior for now
|
|
8808
8908
|
headers.values.has('content-type')) ||
|
|
8809
8909
|
// `Blob` is superset of `File`
|
|
8810
|
-
body instanceof Blob ||
|
|
8910
|
+
(globalThis.Blob && body instanceof globalThis.Blob) ||
|
|
8811
8911
|
// `FormData` -> `multipart/form-data`
|
|
8812
8912
|
body instanceof FormData ||
|
|
8813
8913
|
// `URLSearchParams` -> `application/x-www-form-urlencoded`
|
|
@@ -8862,6 +8962,7 @@ OpenAI.Beta = Beta;
|
|
|
8862
8962
|
OpenAI.Batches = Batches;
|
|
8863
8963
|
OpenAI.Uploads = Uploads;
|
|
8864
8964
|
OpenAI.Responses = Responses;
|
|
8965
|
+
OpenAI.Conversations = Conversations;
|
|
8865
8966
|
OpenAI.Evals = Evals;
|
|
8866
8967
|
OpenAI.Containers = Containers;
|
|
8867
8968
|
|