@discomedia/utils 1.0.16 → 1.0.18
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 +19 -32
- package/dist/index-frontend.cjs.map +1 -1
- package/dist/index-frontend.mjs +19 -32
- package/dist/index-frontend.mjs.map +1 -1
- package/dist/index.cjs +36 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +36 -36
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +3 -3
- package/dist/test.js +413 -7390
- package/dist/test.js.map +1 -1
- package/dist/types/market-time.d.ts +1 -1
- package/dist/types/market-time.d.ts.map +1 -1
- package/dist/types-frontend/market-time.d.ts +1 -1
- package/dist/types-frontend/market-time.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index-frontend.cjs
CHANGED
|
@@ -251,7 +251,7 @@ const safeJSON = (text) => {
|
|
|
251
251
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
252
252
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
253
253
|
|
|
254
|
-
const VERSION = '5.
|
|
254
|
+
const VERSION = '5.10.1'; // x-release-please-version
|
|
255
255
|
|
|
256
256
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
257
257
|
const isRunningInBrowser = () => {
|
|
@@ -1108,6 +1108,8 @@ class Stream {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
if (sse.event === null ||
|
|
1110
1110
|
sse.event.startsWith('response.') ||
|
|
1111
|
+
sse.event.startsWith('image_edit.') ||
|
|
1112
|
+
sse.event.startsWith('image_generation.') ||
|
|
1111
1113
|
sse.event.startsWith('transcript.')) {
|
|
1112
1114
|
let data;
|
|
1113
1115
|
try {
|
|
@@ -5211,34 +5213,11 @@ class Images extends APIResource {
|
|
|
5211
5213
|
createVariation(body, options) {
|
|
5212
5214
|
return this._client.post('/images/variations', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
5213
5215
|
}
|
|
5214
|
-
/**
|
|
5215
|
-
* Creates an edited or extended image given one or more source images and a
|
|
5216
|
-
* prompt. This endpoint only supports `gpt-image-1` and `dall-e-2`.
|
|
5217
|
-
*
|
|
5218
|
-
* @example
|
|
5219
|
-
* ```ts
|
|
5220
|
-
* const imagesResponse = await client.images.edit({
|
|
5221
|
-
* image: fs.createReadStream('path/to/file'),
|
|
5222
|
-
* prompt: 'A cute baby sea otter wearing a beret',
|
|
5223
|
-
* });
|
|
5224
|
-
* ```
|
|
5225
|
-
*/
|
|
5226
5216
|
edit(body, options) {
|
|
5227
|
-
return this._client.post('/images/edits', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
5217
|
+
return this._client.post('/images/edits', multipartFormRequestOptions({ body, ...options, stream: body.stream ?? false }, this._client));
|
|
5228
5218
|
}
|
|
5229
|
-
/**
|
|
5230
|
-
* Creates an image given a prompt.
|
|
5231
|
-
* [Learn more](https://platform.openai.com/docs/guides/images).
|
|
5232
|
-
*
|
|
5233
|
-
* @example
|
|
5234
|
-
* ```ts
|
|
5235
|
-
* const imagesResponse = await client.images.generate({
|
|
5236
|
-
* prompt: 'A cute baby sea otter',
|
|
5237
|
-
* });
|
|
5238
|
-
* ```
|
|
5239
|
-
*/
|
|
5240
5219
|
generate(body, options) {
|
|
5241
|
-
return this._client.post('/images/generations', { body, ...options });
|
|
5220
|
+
return this._client.post('/images/generations', { body, ...options, stream: body.stream ?? false });
|
|
5242
5221
|
}
|
|
5243
5222
|
}
|
|
5244
5223
|
|
|
@@ -13741,16 +13720,24 @@ class MarketTimeCalculator {
|
|
|
13741
13720
|
/**
|
|
13742
13721
|
* Get the last full trading date
|
|
13743
13722
|
*/
|
|
13744
|
-
getLastFullTradingDate(currentDate = new Date()) {
|
|
13723
|
+
getLastFullTradingDate(currentDate = new Date(), extendedHours = true) {
|
|
13745
13724
|
const nowET = dateFnsTz.toZonedTime(currentDate, this.timezone);
|
|
13746
|
-
// If today is a market day and we're after extended hours close, return today
|
|
13747
13725
|
if (this.calendar.isMarketDay(nowET)) {
|
|
13748
13726
|
const timeInMinutes = nowET.getHours() * 60 + nowET.getMinutes();
|
|
13749
|
-
let
|
|
13750
|
-
if (
|
|
13751
|
-
|
|
13727
|
+
let endMinutes;
|
|
13728
|
+
if (extendedHours) {
|
|
13729
|
+
endMinutes = MARKET_CONFIG.TIMES.EXTENDED_END.hour * 60 + MARKET_CONFIG.TIMES.EXTENDED_END.minute;
|
|
13730
|
+
if (this.calendar.isEarlyCloseDay(nowET)) {
|
|
13731
|
+
endMinutes = MARKET_CONFIG.TIMES.EARLY_EXTENDED_END.hour * 60 + MARKET_CONFIG.TIMES.EARLY_EXTENDED_END.minute;
|
|
13732
|
+
}
|
|
13733
|
+
}
|
|
13734
|
+
else {
|
|
13735
|
+
endMinutes = MARKET_CONFIG.TIMES.MARKET_CLOSE.hour * 60 + MARKET_CONFIG.TIMES.MARKET_CLOSE.minute;
|
|
13736
|
+
if (this.calendar.isEarlyCloseDay(nowET)) {
|
|
13737
|
+
endMinutes = MARKET_CONFIG.TIMES.EARLY_CLOSE.hour * 60 + MARKET_CONFIG.TIMES.EARLY_CLOSE.minute;
|
|
13738
|
+
}
|
|
13752
13739
|
}
|
|
13753
|
-
if (timeInMinutes >=
|
|
13740
|
+
if (timeInMinutes >= endMinutes) {
|
|
13754
13741
|
return dateFnsTz.fromZonedTime(dateFns.set(nowET, { hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }), this.timezone);
|
|
13755
13742
|
}
|
|
13756
13743
|
}
|