@discomedia/utils 1.0.77 → 1.0.79
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 +2024 -15270
- package/dist/index-frontend.cjs.map +7 -1
- package/dist/index-frontend.mjs +1985 -15260
- package/dist/index-frontend.mjs.map +7 -1
- package/dist/index.cjs +5486 -24388
- package/dist/index.cjs.map +7 -1
- package/dist/index.mjs +5444 -24377
- package/dist/index.mjs.map +7 -1
- package/dist/package.json +10 -11
- package/dist/test.mjs +5814 -0
- package/dist/test.mjs.map +7 -0
- package/dist/types/alpaca-market-data-api.d.ts.map +1 -1
- package/dist/types/alpaca-trading-api.d.ts.map +1 -1
- package/dist/types/disco-mail.d.ts +24 -0
- package/dist/types/disco-mail.d.ts.map +1 -0
- package/dist/types/index-frontend.d.ts +2 -1
- package/dist/types/index-frontend.d.ts.map +1 -1
- package/dist/types/index.d.ts +10 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/llm-config.d.ts +4 -2
- package/dist/types/llm-config.d.ts.map +1 -1
- package/dist/types/llm-deepseek.d.ts.map +1 -1
- package/dist/types/llm-images.d.ts.map +1 -1
- package/dist/types/llm-openai.d.ts +7 -4
- package/dist/types/llm-openai.d.ts.map +1 -1
- package/dist/types/llm-openrouter.d.ts.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/misc-utils.d.ts +1 -1
- package/dist/types/misc-utils.d.ts.map +1 -1
- package/dist/types/performance-timer.d.ts.map +1 -1
- package/dist/types/types/disco-mail-types.d.ts +80 -0
- package/dist/types/types/disco-mail-types.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/llm-types.d.ts +8 -5
- package/dist/types/types/llm-types.d.ts.map +1 -1
- package/package.json +10 -11
- package/dist/test.js +0 -17500
- package/dist/test.js.map +0 -1
- package/dist/types-frontend/alpaca-market-data-api.d.ts +0 -451
- package/dist/types-frontend/alpaca-market-data-api.d.ts.map +0 -1
- package/dist/types-frontend/alpaca-trading-api.d.ts +0 -407
- package/dist/types-frontend/alpaca-trading-api.d.ts.map +0 -1
- package/dist/types-frontend/format-tools.d.ts +0 -46
- package/dist/types-frontend/format-tools.d.ts.map +0 -1
- package/dist/types-frontend/index-frontend.d.ts +0 -18
- package/dist/types-frontend/index-frontend.d.ts.map +0 -1
- package/dist/types-frontend/index.d.ts +0 -59
- package/dist/types-frontend/index.d.ts.map +0 -1
- package/dist/types-frontend/json-tools.d.ts +0 -31
- package/dist/types-frontend/json-tools.d.ts.map +0 -1
- package/dist/types-frontend/llm-config.d.ts +0 -51
- package/dist/types-frontend/llm-config.d.ts.map +0 -1
- package/dist/types-frontend/llm-deepseek.d.ts +0 -12
- package/dist/types-frontend/llm-deepseek.d.ts.map +0 -1
- package/dist/types-frontend/llm-images.d.ts +0 -52
- package/dist/types-frontend/llm-images.d.ts.map +0 -1
- package/dist/types-frontend/llm-openai.d.ts +0 -79
- package/dist/types-frontend/llm-openai.d.ts.map +0 -1
- package/dist/types-frontend/llm-openrouter.d.ts +0 -28
- package/dist/types-frontend/llm-openrouter.d.ts.map +0 -1
- package/dist/types-frontend/llm-utils.d.ts +0 -16
- package/dist/types-frontend/llm-utils.d.ts.map +0 -1
- package/dist/types-frontend/logging.d.ts +0 -12
- package/dist/types-frontend/logging.d.ts.map +0 -1
- package/dist/types-frontend/market-hours.d.ts +0 -24
- package/dist/types-frontend/market-hours.d.ts.map +0 -1
- package/dist/types-frontend/market-time.d.ts +0 -270
- package/dist/types-frontend/market-time.d.ts.map +0 -1
- package/dist/types-frontend/misc-utils.d.ts +0 -43
- package/dist/types-frontend/misc-utils.d.ts.map +0 -1
- package/dist/types-frontend/performance-timer.d.ts +0 -73
- package/dist/types-frontend/performance-timer.d.ts.map +0 -1
- package/dist/types-frontend/test.d.ts +0 -2
- package/dist/types-frontend/test.d.ts.map +0 -1
- package/dist/types-frontend/testing/market-time-refactor-test.d.ts +0 -1
- package/dist/types-frontend/testing/market-time-refactor-test.d.ts.map +0 -1
- package/dist/types-frontend/types/alpaca-crypto-pairs.d.ts +0 -11
- package/dist/types-frontend/types/alpaca-crypto-pairs.d.ts.map +0 -1
- package/dist/types-frontend/types/alpaca-types.d.ts +0 -1181
- package/dist/types-frontend/types/alpaca-types.d.ts.map +0 -1
- package/dist/types-frontend/types/index.d.ts +0 -6
- package/dist/types-frontend/types/index.d.ts.map +0 -1
- package/dist/types-frontend/types/llm-types.d.ts +0 -174
- package/dist/types-frontend/types/llm-types.d.ts.map +0 -1
- package/dist/types-frontend/types/logging-types.d.ts +0 -10
- package/dist/types-frontend/types/logging-types.d.ts.map +0 -1
- package/dist/types-frontend/types/market-time-types.d.ts +0 -64
- package/dist/types-frontend/types/market-time-types.d.ts.map +0 -1
- package/dist/types-frontend/types/ta-types.d.ts +0 -89
- package/dist/types-frontend/types/ta-types.d.ts.map +0 -1
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ChatCompletionContentPart } from 'openai/resources/chat';
|
|
2
|
-
import { LLMResponse, LLMOptions, OpenAIResponseFormat } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Makes a call to the Deepseek AI API.
|
|
5
|
-
*
|
|
6
|
-
* @param content The content to pass to the LLM. Can be a string or an array of content parts.
|
|
7
|
-
* @param responseFormat The format of the response. Defaults to 'json'.
|
|
8
|
-
* @param options Configuration options including model ('deepseek-chat' or 'deepseek-reasoner'), tools, and apiKey.
|
|
9
|
-
* @return A promise that resolves to the response from the Deepseek API.
|
|
10
|
-
*/
|
|
11
|
-
export declare const makeDeepseekCall: <T = string>(content: string | ChatCompletionContentPart[], responseFormat?: OpenAIResponseFormat, options?: LLMOptions) => Promise<LLMResponse<T>>;
|
|
12
|
-
//# sourceMappingURL=llm-deepseek.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm-deepseek.d.ts","sourceRoot":"","sources":["../../src/llm-deepseek.ts"],"names":[],"mappings":"AACA,OAAO,EACL,yBAAyB,EAG1B,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAAE,WAAW,EAAE,UAAU,EAAe,oBAAoB,EAA2B,MAAM,SAAS,CAAC;AAyL9G;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAU,CAAC,GAAG,MAAM,EAC/C,SAAS,MAAM,GAAG,yBAAyB,EAAE,EAC7C,iBAAgB,oBAA6B,EAC7C,UAAS,UAAe,KACvB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAmIxB,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { ImageGenerationOptions, LLMModel, DiscoImageModel } from './types';
|
|
2
|
-
import { ImagesResponse } from 'openai/resources/images';
|
|
3
|
-
/**
|
|
4
|
-
* Enhanced ImagesResponse that includes cost calculation
|
|
5
|
-
*/
|
|
6
|
-
export interface ImageResponseWithUsage extends ImagesResponse {
|
|
7
|
-
usage?: ImagesResponse['usage'] & {
|
|
8
|
-
provider: string;
|
|
9
|
-
model: DiscoImageModel;
|
|
10
|
-
cost: number;
|
|
11
|
-
visionModel?: LLMModel;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export declare const DEFAULT_IMAGE_MODEL: DiscoImageModel;
|
|
15
|
-
export declare const resolveImageModel: (model?: DiscoImageModel) => DiscoImageModel;
|
|
16
|
-
/**
|
|
17
|
-
* Makes a call to the OpenAI Images API to generate images based on a text prompt.
|
|
18
|
-
*
|
|
19
|
-
* This function provides access to OpenAI's image generation capabilities with support for:
|
|
20
|
-
* - Different output formats (JPEG, PNG, WebP)
|
|
21
|
-
* - Various image sizes and quality settings
|
|
22
|
-
* - Multiple image generation in a single call
|
|
23
|
-
* - Base64 encoded image data return
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* // Basic image generation
|
|
27
|
-
* const response = await makeImagesCall('A beautiful sunset over mountains');
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* // Custom options
|
|
31
|
-
* const response = await makeImagesCall('A birthday cake', {
|
|
32
|
-
* size: '1024x1024',
|
|
33
|
-
* outputFormat: 'png',
|
|
34
|
-
* quality: 'high',
|
|
35
|
-
* count: 2
|
|
36
|
-
* });
|
|
37
|
-
*
|
|
38
|
-
* @param prompt - The text prompt describing the image to generate
|
|
39
|
-
* @param options - Configuration options for image generation. Includes:
|
|
40
|
-
* - size: Image dimensions (uses OpenAI's size options)
|
|
41
|
-
* - outputFormat: Image format ('jpeg', 'png', 'webp') - defaults to 'webp'
|
|
42
|
-
* - compression: Compression level (number) - defaults to 50
|
|
43
|
-
* - quality: Quality setting (uses OpenAI's quality options) - defaults to 'high'
|
|
44
|
-
* - count: Number of images to generate - defaults to 1
|
|
45
|
-
* - background: Background setting for transparency support
|
|
46
|
-
* - moderation: Content moderation level
|
|
47
|
-
* - apiKey: OpenAI API key (optional, falls back to environment variable)
|
|
48
|
-
* @returns Promise<ImageResponseWithUsage> - The image generation response with cost information
|
|
49
|
-
* @throws Error if the API call fails or invalid parameters are provided
|
|
50
|
-
*/
|
|
51
|
-
export declare function makeImagesCall(prompt: string, options?: ImageGenerationOptions): Promise<ImageResponseWithUsage>;
|
|
52
|
-
//# sourceMappingURL=llm-images.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm-images.d.ts","sourceRoot":"","sources":["../../src/llm-images.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,eAAe,EAAiB,MAAM,SAAS,CAAC;AAE3F,OAAO,EAAuB,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC5D,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG;QAChC,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,eAAe,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,QAAQ,CAAC;KACxB,CAAC;CACH;AAED,eAAO,MAAM,mBAAmB,EAAE,eAA+B,CAAC;AAElE,eAAO,MAAM,iBAAiB,GAAI,QAAQ,eAAe,KAAG,eAA+C,CAAC;AAI5G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,sBAAsB,CAAC,CAoGjC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { Tool } from 'openai/resources/responses/responses';
|
|
2
|
-
import { LLMResponse, LLMOptions, LLMModel, OpenAIResponseFormat, ContextMessage, OpenAISchemaInput, OpenAIImageInput, OpenAIImageDetail } from './types';
|
|
3
|
-
import { ResponseCreateParamsNonStreaming } from 'openai/resources/responses/responses';
|
|
4
|
-
export declare const DEFAULT_OPTIONS: LLMOptions;
|
|
5
|
-
/**
|
|
6
|
-
* Checks if the given direct OpenAI model supports the temperature parameter.
|
|
7
|
-
* @param model The model to check.
|
|
8
|
-
* @returns True if the model supports the temperature parameter, false otherwise.
|
|
9
|
-
*/
|
|
10
|
-
export declare function supportsTemperature(_model: string): boolean;
|
|
11
|
-
export declare function uploadVisionFile(filePath: string, options?: {
|
|
12
|
-
apiKey?: string;
|
|
13
|
-
filename?: string;
|
|
14
|
-
mimeType?: string;
|
|
15
|
-
}): Promise<string>;
|
|
16
|
-
/**
|
|
17
|
-
* Makes a call to OpenAI's Responses API for more advanced use cases with built-in tools.
|
|
18
|
-
*
|
|
19
|
-
* This function provides access to the Responses API which supports:
|
|
20
|
-
* - Built-in tools (web search, file search, computer use, code interpreter, image generation)
|
|
21
|
-
* - Background processing
|
|
22
|
-
* - Conversation state management
|
|
23
|
-
* - GPT-5 reasoning controls
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* // Basic text response
|
|
27
|
-
* const response = await makeResponsesAPICall('What is the weather like?');
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* // With web search tool
|
|
31
|
-
* const response = await makeResponsesAPICall('Latest news about AI', {
|
|
32
|
-
* tools: [{ type: 'web_search_preview' }]
|
|
33
|
-
* });
|
|
34
|
-
*
|
|
35
|
-
* @param input - The input content. Can be:
|
|
36
|
-
* - A string for simple text prompts
|
|
37
|
-
* - An array of input items for complex/multi-modal content
|
|
38
|
-
* @param options - Configuration options for the Responses API
|
|
39
|
-
* @returns Promise<LLMResponse<T>> - The response in the same format as makeLLMCall
|
|
40
|
-
* @throws Error if the API call fails
|
|
41
|
-
*/
|
|
42
|
-
export declare const makeResponsesAPICall: <T = string>(input: string | ResponseCreateParamsNonStreaming["input"], options?: Omit<ResponseCreateParamsNonStreaming, "input" | "model"> & {
|
|
43
|
-
apiKey?: string;
|
|
44
|
-
model?: string;
|
|
45
|
-
}) => Promise<LLMResponse<T>>;
|
|
46
|
-
/**
|
|
47
|
-
* Makes a call to the OpenAI Responses API for advanced use cases with built-in tools.
|
|
48
|
-
*
|
|
49
|
-
* @param input The text prompt to send to the model (e.g., "What's in this image?")
|
|
50
|
-
* @param options The options for the Responses API call, including optional image data and context.
|
|
51
|
-
* @return A promise that resolves to the response from the Responses API.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* // With conversation context
|
|
55
|
-
* const response = await makeLLMCall("What did I ask about earlier?", {
|
|
56
|
-
* context: [
|
|
57
|
-
* { role: 'user', content: 'What is the capital of France?' },
|
|
58
|
-
* { role: 'assistant', content: 'The capital of France is Paris.' }
|
|
59
|
-
* ]
|
|
60
|
-
* });
|
|
61
|
-
*/
|
|
62
|
-
export declare function makeLLMCall<T = string>(input: string, options?: {
|
|
63
|
-
apiKey?: string;
|
|
64
|
-
model?: LLMModel;
|
|
65
|
-
responseFormat?: OpenAIResponseFormat;
|
|
66
|
-
schema?: OpenAISchemaInput;
|
|
67
|
-
schemaName?: string;
|
|
68
|
-
schemaDescription?: string;
|
|
69
|
-
schemaStrict?: boolean;
|
|
70
|
-
tools?: Tool[];
|
|
71
|
-
useCodeInterpreter?: boolean;
|
|
72
|
-
useWebSearch?: boolean;
|
|
73
|
-
image?: OpenAIImageInput;
|
|
74
|
-
images?: OpenAIImageInput[];
|
|
75
|
-
imageBase64?: string;
|
|
76
|
-
imageDetail?: OpenAIImageDetail;
|
|
77
|
-
context?: ContextMessage[];
|
|
78
|
-
}): Promise<LLMResponse<T>>;
|
|
79
|
-
//# sourceMappingURL=llm-openai.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm-openai.d.ts","sourceRoot":"","sources":["../../src/llm-openai.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,IAAI,EAKL,MAAM,sCAAsC,CAAC;AAI9C,OAAO,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EAElB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,gCAAgC,EAOjC,MAAM,sCAAsC,CAAC;AAE9C,eAAO,MAAM,eAAe,EAAE,UAG7B,CAAC;AAIF;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE3D;AA+ND,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACd,GACL,OAAO,CAAC,MAAM,CAAC,CAKjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,oBAAoB,GAAU,CAAC,GAAG,MAAM,EACnD,OAAO,MAAM,GAAG,gCAAgC,CAAC,OAAO,CAAC,EACzD,UAAS,IAAI,CAAC,gCAAgC,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CACX,KACL,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CA+HxB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,WAAW,CAAC,CAAC,GAAG,MAAM,EAC1C,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;CACvB,GACL,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAiHzB"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { ChatCompletionTool, ChatCompletionToolChoiceOption } from 'openai/resources/chat/completions';
|
|
2
|
-
import type { LLMResponse, ContextMessage, OpenAIResponseFormat, OpenRouterModel } from './types/llm-types';
|
|
3
|
-
type ToolChoice = ChatCompletionToolChoiceOption;
|
|
4
|
-
export interface OpenRouterCallOptions {
|
|
5
|
-
apiKey?: string;
|
|
6
|
-
model?: OpenRouterModel | string;
|
|
7
|
-
responseFormat?: 'text' | 'json' | OpenAIResponseFormat;
|
|
8
|
-
tools?: ChatCompletionTool[];
|
|
9
|
-
toolChoice?: ToolChoice;
|
|
10
|
-
context?: ContextMessage[];
|
|
11
|
-
developerPrompt?: string;
|
|
12
|
-
temperature?: number;
|
|
13
|
-
max_tokens?: number;
|
|
14
|
-
top_p?: number;
|
|
15
|
-
frequency_penalty?: number;
|
|
16
|
-
presence_penalty?: number;
|
|
17
|
-
stop?: string | string[];
|
|
18
|
-
seed?: number;
|
|
19
|
-
referer?: string;
|
|
20
|
-
title?: string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Make a call through OpenRouter using the OpenAI Chat Completions-compatible API.
|
|
24
|
-
* Supports: JSON mode, model selection, message history, and tools.
|
|
25
|
-
*/
|
|
26
|
-
export declare function makeOpenRouterCall<T = string>(input: string, options?: OpenRouterCallOptions): Promise<LLMResponse<T>>;
|
|
27
|
-
export default makeOpenRouterCall;
|
|
28
|
-
//# sourceMappingURL=llm-openrouter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm-openrouter.d.ts","sourceRoot":"","sources":["../../src/llm-openrouter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,kBAAkB,EAClB,8BAA8B,EAC/B,MAAM,mCAAmC,CAAC;AAI3C,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,oBAAoB,EAIpB,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAI3B,KAAK,UAAU,GAAG,8BAA8B,CAAC;AAyBjD,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,eAAe,GAAG,MAAM,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,oBAAoB,CAAC;IACxD,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,CAAC,GAAG,MAAM,EACjD,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAqHzB;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { LLMModel, OpenAIResponseFormat } from './types';
|
|
2
|
-
export declare function normalizeModelName(model: string): LLMModel;
|
|
3
|
-
export declare const CODE_BLOCK_TYPES: string[];
|
|
4
|
-
/**
|
|
5
|
-
* Tries to parse JSON from the given content string according to the specified
|
|
6
|
-
* response format. If the response format is 'json' or a JSON schema object, it
|
|
7
|
-
* will attempt to parse the content using multiple strategies. If any of the
|
|
8
|
-
* strategies succeed, it will return the parsed JSON object. If all of them fail,
|
|
9
|
-
* it will throw an error.
|
|
10
|
-
*
|
|
11
|
-
* @param content The content string to parse
|
|
12
|
-
* @param responseFormat The desired format of the response
|
|
13
|
-
* @returns The parsed JSON object or null if it fails
|
|
14
|
-
*/
|
|
15
|
-
export declare function parseResponse<T>(content: string, responseFormat: OpenAIResponseFormat): Promise<T | null>;
|
|
16
|
-
//# sourceMappingURL=llm-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm-utils.d.ts","sourceRoot":"","sources":["../../src/llm-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAe,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAGtE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAE1D;AAED,eAAO,MAAM,gBAAgB,UAAsF,CAAC;AAElH;;;;;;;;;;GAUG;AACL,wBAAsB,aAAa,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,oBAAoB,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CA+E/G"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { LogOptions } from './types/logging-types';
|
|
2
|
-
/**
|
|
3
|
-
* Logs a message to the console.
|
|
4
|
-
* @param message The message to log.
|
|
5
|
-
* @param options Optional options.
|
|
6
|
-
* @param options.source The source of the message.
|
|
7
|
-
* @param options.type The type of message to log.
|
|
8
|
-
* @param options.symbol The trading symbol associated with this log.
|
|
9
|
-
* @param options.account The account associated with this log.
|
|
10
|
-
*/
|
|
11
|
-
export declare function log(message: string, options?: LogOptions): void;
|
|
12
|
-
//# sourceMappingURL=logging.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/logging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,UAA4C,GAAG,IAAI,CAoBhG"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export interface HolidayDetails {
|
|
2
|
-
date: string;
|
|
3
|
-
}
|
|
4
|
-
export interface MarketHolidaysForYear {
|
|
5
|
-
[holidayName: string]: HolidayDetails;
|
|
6
|
-
}
|
|
7
|
-
export interface MarketHolidays {
|
|
8
|
-
[year: number]: MarketHolidaysForYear;
|
|
9
|
-
}
|
|
10
|
-
export interface EarlyCloseDetails {
|
|
11
|
-
date: string;
|
|
12
|
-
time: string;
|
|
13
|
-
optionsTime: string;
|
|
14
|
-
notes: string;
|
|
15
|
-
}
|
|
16
|
-
export interface EarlyClosesForYear {
|
|
17
|
-
[date: string]: EarlyCloseDetails;
|
|
18
|
-
}
|
|
19
|
-
export interface MarketEarlyCloses {
|
|
20
|
-
[year: number]: EarlyClosesForYear;
|
|
21
|
-
}
|
|
22
|
-
export declare const marketHolidays: MarketHolidays;
|
|
23
|
-
export declare const marketEarlyCloses: MarketEarlyCloses;
|
|
24
|
-
//# sourceMappingURL=market-hours.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"market-hours.d.ts","sourceRoot":"","sources":["../../src/market-hours.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,CAAC;CACvC;AAED,MAAM,WAAW,cAAc;IAC7B,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CAAC;CACvC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAAC;CACpC;AAED,eAAO,MAAM,cAAc,EAAE,cAsC5B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,iBAsE/B,CAAC"}
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import { IntradayReporting, PeriodDates, MarketTimeParams, MarketOpenCloseResult, MarketStatus, MarketTimesConfig, TradingDaysBackOptions } from './types/market-time-types';
|
|
2
|
-
export declare const MARKET_CONFIG: {
|
|
3
|
-
readonly TIMEZONE: "America/New_York";
|
|
4
|
-
readonly UTC_OFFSET_STANDARD: -5;
|
|
5
|
-
readonly UTC_OFFSET_DST: -4;
|
|
6
|
-
readonly TIMES: {
|
|
7
|
-
readonly EXTENDED_START: {
|
|
8
|
-
readonly hour: 4;
|
|
9
|
-
readonly minute: 0;
|
|
10
|
-
};
|
|
11
|
-
readonly MARKET_OPEN: {
|
|
12
|
-
readonly hour: 9;
|
|
13
|
-
readonly minute: 30;
|
|
14
|
-
};
|
|
15
|
-
readonly EARLY_MARKET_END: {
|
|
16
|
-
readonly hour: 10;
|
|
17
|
-
readonly minute: 0;
|
|
18
|
-
};
|
|
19
|
-
readonly MARKET_CLOSE: {
|
|
20
|
-
readonly hour: 16;
|
|
21
|
-
readonly minute: 0;
|
|
22
|
-
};
|
|
23
|
-
readonly EARLY_CLOSE: {
|
|
24
|
-
readonly hour: 13;
|
|
25
|
-
readonly minute: 0;
|
|
26
|
-
};
|
|
27
|
-
readonly EXTENDED_END: {
|
|
28
|
-
readonly hour: 20;
|
|
29
|
-
readonly minute: 0;
|
|
30
|
-
};
|
|
31
|
-
readonly EARLY_EXTENDED_END: {
|
|
32
|
-
readonly hour: 17;
|
|
33
|
-
readonly minute: 0;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Checks if a date/time is within market hours, extended hours, or continuous.
|
|
39
|
-
* @param date - Date object
|
|
40
|
-
* @param intradayReporting - 'market_hours', 'extended_hours', or 'continuous'
|
|
41
|
-
* @returns true if within hours, false otherwise
|
|
42
|
-
*/
|
|
43
|
-
export declare function isWithinMarketHours(date: Date, intradayReporting?: IntradayReporting): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Returns the start and end dates for a market time period.
|
|
46
|
-
* @param params - MarketTimeParams
|
|
47
|
-
* @returns PeriodDates object
|
|
48
|
-
*/
|
|
49
|
-
export declare function getMarketTimePeriod(params: MarketTimeParams): PeriodDates;
|
|
50
|
-
/**
|
|
51
|
-
* Returns market open/close times for a given date.
|
|
52
|
-
* @param options - { date?: Date }
|
|
53
|
-
* @returns MarketOpenCloseResult
|
|
54
|
-
*/
|
|
55
|
-
export declare function getMarketOpenClose(options?: {
|
|
56
|
-
date?: Date;
|
|
57
|
-
}): MarketOpenCloseResult;
|
|
58
|
-
/**
|
|
59
|
-
* Returns the start and end dates for a market time period as Date objects.
|
|
60
|
-
* @param params - MarketTimeParams
|
|
61
|
-
* @returns Object with start and end Date
|
|
62
|
-
*/
|
|
63
|
-
export declare function getStartAndEndDates(params?: MarketTimeParams): {
|
|
64
|
-
start: Date;
|
|
65
|
-
end: Date;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Returns the last full trading date as a Date object.
|
|
69
|
-
*/
|
|
70
|
-
/**
|
|
71
|
-
* Returns the last full trading date as a Date object.
|
|
72
|
-
* @param currentDate - Date object (default: now)
|
|
73
|
-
* @returns Date object for last full trading date
|
|
74
|
-
*/
|
|
75
|
-
export declare function getLastFullTradingDate(currentDate?: Date): Date;
|
|
76
|
-
/**
|
|
77
|
-
* Returns the last full trading date and formatted YYYYMMDD string.
|
|
78
|
-
*/
|
|
79
|
-
/**
|
|
80
|
-
* Returns the last full trading date and formatted YYYY-MM-DD string.
|
|
81
|
-
* @param currentDate - Date object (default: now)
|
|
82
|
-
* @returns Object with date and YYYYMMDD string
|
|
83
|
-
*/
|
|
84
|
-
export declare function getLastFullTradingDateInfo(currentDate?: Date): {
|
|
85
|
-
date: Date;
|
|
86
|
-
YYYYMMDD: string;
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* Returns the next market day after the reference date.
|
|
90
|
-
* @param referenceDate - Date object (default: now)
|
|
91
|
-
* @returns Object with date, yyyymmdd string, and ISO string
|
|
92
|
-
*/
|
|
93
|
-
export declare function getNextMarketDay({ referenceDate }?: {
|
|
94
|
-
referenceDate?: Date;
|
|
95
|
-
}): {
|
|
96
|
-
date: Date;
|
|
97
|
-
yyyymmdd: string;
|
|
98
|
-
dateISOString: string;
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Returns the previous market day before the reference date.
|
|
102
|
-
* @param referenceDate - Date object (default: now)
|
|
103
|
-
* @returns Object with date, yyyymmdd string, and ISO string
|
|
104
|
-
*/
|
|
105
|
-
export declare function getPreviousMarketDay({ referenceDate }?: {
|
|
106
|
-
referenceDate?: Date;
|
|
107
|
-
}): {
|
|
108
|
-
date: Date;
|
|
109
|
-
yyyymmdd: string;
|
|
110
|
-
dateISOString: string;
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* Returns the trading date for a given time. Note: Just trims the date string; does not validate if the date is a market day.
|
|
114
|
-
* @param time - a string, number (unix timestamp), or Date object representing the time
|
|
115
|
-
* @returns the trading date as a string in YYYY-MM-DD format
|
|
116
|
-
*/
|
|
117
|
-
/**
|
|
118
|
-
* Returns the trading date for a given time in YYYY-MM-DD format (NY time).
|
|
119
|
-
* @param time - string, number, or Date
|
|
120
|
-
* @returns trading date string
|
|
121
|
-
*/
|
|
122
|
-
export declare function getTradingDate(time: string | number | Date): string;
|
|
123
|
-
/**
|
|
124
|
-
* Returns the NY timezone offset string for a given date.
|
|
125
|
-
* @param date - Date object (default: now)
|
|
126
|
-
* @returns '-04:00' for EDT, '-05:00' for EST
|
|
127
|
-
*/
|
|
128
|
-
export declare function getNYTimeZone(date?: Date): '-04:00' | '-05:00';
|
|
129
|
-
/**
|
|
130
|
-
* Returns the regular market open and close Date objects for a given trading day string in the
|
|
131
|
-
* America/New_York timezone (NYSE/NASDAQ calendar).
|
|
132
|
-
*
|
|
133
|
-
* This helper is convenient when you have a calendar date like '2025-10-03' and want the precise
|
|
134
|
-
* open and close Date values for that day. It internally:
|
|
135
|
-
* - Determines the NY offset for the day using `getNYTimeZone()`.
|
|
136
|
-
* - Anchors a noon-time Date on that day in NY time to avoid DST edge cases.
|
|
137
|
-
* - Verifies the day is a market day via `isMarketDay()`.
|
|
138
|
-
* - Fetches the open/close times via `getMarketOpenClose()`.
|
|
139
|
-
*
|
|
140
|
-
* Throws if the provided day is not a market day or if open/close times are unavailable.
|
|
141
|
-
*
|
|
142
|
-
* See also:
|
|
143
|
-
* - `getNYTimeZone(date?: Date)`
|
|
144
|
-
* - `isMarketDay(date: Date)`
|
|
145
|
-
* - `getMarketOpenClose(options?: { date?: Date })`
|
|
146
|
-
*
|
|
147
|
-
* @param dateStr - Trading day string in 'YYYY-MM-DD' format (Eastern Time date)
|
|
148
|
-
* @returns An object containing `{ open: Date; close: Date }`
|
|
149
|
-
* @example
|
|
150
|
-
* ```ts
|
|
151
|
-
* const { open, close } = disco.time.getOpenCloseForTradingDay('2025-10-03');
|
|
152
|
-
* ```
|
|
153
|
-
*/
|
|
154
|
-
export declare function getOpenCloseForTradingDay(dateStr: string): {
|
|
155
|
-
open: Date;
|
|
156
|
-
close: Date;
|
|
157
|
-
};
|
|
158
|
-
/**
|
|
159
|
-
* Converts any date to the market time zone (America/New_York, Eastern Time).
|
|
160
|
-
* Returns a new Date object representing the same moment in time but adjusted to NY/Eastern timezone.
|
|
161
|
-
* Automatically handles daylight saving time transitions (EST/EDT).
|
|
162
|
-
*
|
|
163
|
-
* @param date - Date object to convert to market time zone
|
|
164
|
-
* @returns Date object in NY/Eastern time zone
|
|
165
|
-
* @example
|
|
166
|
-
* ```typescript
|
|
167
|
-
* const utcDate = new Date('2024-01-15T15:30:00Z'); // 3:30 PM UTC
|
|
168
|
-
* const nyDate = convertDateToMarketTimeZone(utcDate); // 10:30 AM EST (winter) or 11:30 AM EDT (summer)
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
export declare function convertDateToMarketTimeZone(date: Date): Date;
|
|
172
|
-
/**
|
|
173
|
-
* Returns the current market status for a given date.
|
|
174
|
-
* @param options - { date?: Date }
|
|
175
|
-
* @returns MarketStatus object
|
|
176
|
-
*/
|
|
177
|
-
export declare function getMarketStatus(options?: {
|
|
178
|
-
date?: Date;
|
|
179
|
-
}): MarketStatus;
|
|
180
|
-
/**
|
|
181
|
-
* Checks if a date is a market day.
|
|
182
|
-
* @param date - Date object
|
|
183
|
-
* @returns true if market day, false otherwise
|
|
184
|
-
*/
|
|
185
|
-
export declare function isMarketDay(date: Date): boolean;
|
|
186
|
-
/**
|
|
187
|
-
* Returns full trading days from market open to market close.
|
|
188
|
-
* endDate is always the most recent market close (previous day's close if before open, today's close if after open).
|
|
189
|
-
* days: 1 or not specified = that day's open; 2 = previous market day's open, etc.
|
|
190
|
-
*/
|
|
191
|
-
/**
|
|
192
|
-
* Returns full trading days from market open to market close.
|
|
193
|
-
* @param options - { endDate?: Date, days?: number }
|
|
194
|
-
* @returns Object with startDate and endDate
|
|
195
|
-
*/
|
|
196
|
-
export declare function getTradingStartAndEndDates(options?: {
|
|
197
|
-
endDate?: Date;
|
|
198
|
-
days?: number;
|
|
199
|
-
}): {
|
|
200
|
-
startDate: Date;
|
|
201
|
-
endDate: Date;
|
|
202
|
-
};
|
|
203
|
-
/**
|
|
204
|
-
* Counts trading time between two dates (passed as standard Date objects), excluding weekends and holidays, and closed market hours, using other functions in this library.
|
|
205
|
-
*
|
|
206
|
-
* This function calculates the actual trading time between two dates by:
|
|
207
|
-
* 1. Iterating through each calendar day between startDate and endDate (inclusive)
|
|
208
|
-
* 2. For each day that is a market day (not weekend/holiday), getting market open/close times
|
|
209
|
-
* 3. Calculating the overlap between the time range and market hours for that day
|
|
210
|
-
* 4. Summing up all the trading minutes across all days
|
|
211
|
-
*
|
|
212
|
-
* The function automatically handles:
|
|
213
|
-
* - Weekends (Saturday/Sunday) - skipped entirely
|
|
214
|
-
* - Market holidays - skipped entirely
|
|
215
|
-
* - Early close days (e.g. day before holidays) - uses early close time
|
|
216
|
-
* - Times outside market hours - only counts time within 9:30am-4pm ET (or early close)
|
|
217
|
-
*
|
|
218
|
-
* Examples:
|
|
219
|
-
* - 12pm to 3:30pm same day = 3.5 hours = 210 minutes = 0.54 days
|
|
220
|
-
* - 9:30am to 4pm same day = 6.5 hours = 390 minutes = 1 day
|
|
221
|
-
* - Friday 2pm to Monday 2pm = 6.5 hours (Friday 2pm-4pm + Monday 9:30am-2pm)
|
|
222
|
-
*
|
|
223
|
-
* @param startDate - Start date/time
|
|
224
|
-
* @param endDate - End date/time (default: now)
|
|
225
|
-
* @returns Object containing:
|
|
226
|
-
* - days: Trading time as fraction of full trading days (6.5 hours = 1 day)
|
|
227
|
-
* - hours: Trading time in hours
|
|
228
|
-
* - minutes: Trading time in minutes
|
|
229
|
-
*/
|
|
230
|
-
export declare function countTradingDays(startDate: Date, endDate?: Date): {
|
|
231
|
-
days: number;
|
|
232
|
-
hours: number;
|
|
233
|
-
minutes: number;
|
|
234
|
-
};
|
|
235
|
-
/**
|
|
236
|
-
* Returns the trading day N days back from a reference date, along with its market open time.
|
|
237
|
-
* Trading days are counted as full or half trading days (days that end count as 1 full trading day).
|
|
238
|
-
* By default, the most recent completed trading day counts as day 1.
|
|
239
|
-
* Set includeMostRecentFullDay to false to count strictly before that day.
|
|
240
|
-
*
|
|
241
|
-
* @param options - Object with:
|
|
242
|
-
* - referenceDate: Date to count back from (default: now)
|
|
243
|
-
* - days: Number of trading days to go back (must be an integer >= 1)
|
|
244
|
-
* - includeMostRecentFullDay: Whether to include the most recent completed trading day (default: true)
|
|
245
|
-
* @returns Object containing:
|
|
246
|
-
* - date: Trading date in YYYY-MM-DD format
|
|
247
|
-
* - marketOpenISO: Market open time as ISO string (e.g., "2025-11-15T13:30:00.000Z")
|
|
248
|
-
* - unixTimestamp: Market open time as Unix timestamp in seconds
|
|
249
|
-
* @example
|
|
250
|
-
* ```typescript
|
|
251
|
-
* // Get the trading day 1 day back (most recent full trading day)
|
|
252
|
-
* const result = getTradingDaysBack({ days: 1 });
|
|
253
|
-
* console.log(result.date); // "2025-11-01"
|
|
254
|
-
* console.log(result.marketOpenISO); // "2025-11-01T13:30:00.000Z"
|
|
255
|
-
* console.log(result.unixTimestamp); // 1730466600
|
|
256
|
-
*
|
|
257
|
-
* // Get the trading day 5 days back from a specific date
|
|
258
|
-
* const result2 = getTradingDaysBack({
|
|
259
|
-
* referenceDate: new Date('2025-11-15T12:00:00-05:00'),
|
|
260
|
-
* days: 5
|
|
261
|
-
* });
|
|
262
|
-
* ```
|
|
263
|
-
*/
|
|
264
|
-
export declare function getTradingDaysBack(options: TradingDaysBackOptions): {
|
|
265
|
-
date: string;
|
|
266
|
-
marketOpenISO: string;
|
|
267
|
-
unixTimestamp: number;
|
|
268
|
-
};
|
|
269
|
-
export declare const MARKET_TIMES: MarketTimesConfig;
|
|
270
|
-
//# sourceMappingURL=market-time.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"market-time.d.ts","sourceRoot":"","sources":["../../src/market-time.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
declare const LOG_TYPES: readonly ["info", "warn", "error", "debug", "trace"];
|
|
2
|
-
type LogType = (typeof LOG_TYPES)[number];
|
|
3
|
-
/**
|
|
4
|
-
* Debug logging utility that respects environment debug flags.
|
|
5
|
-
* Logs messages to the console based on the specified log level.
|
|
6
|
-
*
|
|
7
|
-
* @param message - The message to log.
|
|
8
|
-
* @param data - Optional data to log alongside the message. This can be any type of data.
|
|
9
|
-
* @param type - Log level. One of: 'info' | 'warn' | 'error' | 'debug' | 'trace'. Defaults to 'info'.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* logIfDebug("User login failed", { userId: 123 }, "error");
|
|
13
|
-
* logIfDebug("Cache miss", undefined, "warn");
|
|
14
|
-
* logIfDebug("Processing request", { requestId: "abc" }, "debug");
|
|
15
|
-
*/
|
|
16
|
-
export declare const logIfDebug: (message: string, data?: unknown, type?: LogType) => void;
|
|
17
|
-
/**
|
|
18
|
-
* Hides (masks) the value of any query parameter that is "apiKey" (case-insensitive),
|
|
19
|
-
* replacing the middle part with **** and keeping only the first 2 and last 2 characters.
|
|
20
|
-
*
|
|
21
|
-
* @param url - The URL containing the query parameters.
|
|
22
|
-
* @returns The URL with the masked API key.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* hideApiKeyFromurl("https://xxx.com/s/23/fdsa/?apiKey=12341239856677");
|
|
26
|
-
* // Returns "https://xxx.com/s/23/fdsa/?apiKey=12****77"
|
|
27
|
-
*/
|
|
28
|
-
export declare function hideApiKeyFromurl(url: string): string;
|
|
29
|
-
/**
|
|
30
|
-
* Fetches a resource with intelligent retry logic for handling transient errors.
|
|
31
|
-
* Features enhanced error logging, rate limit detection, and adaptive backoff.
|
|
32
|
-
*
|
|
33
|
-
* @param url - The URL to fetch.
|
|
34
|
-
* @param options - Optional fetch options.
|
|
35
|
-
* @param retries - The number of retry attempts. Defaults to 3.
|
|
36
|
-
* @param initialBackoff - The initial backoff time in milliseconds. Defaults to 1000.
|
|
37
|
-
* @returns A promise that resolves to the response.
|
|
38
|
-
*
|
|
39
|
-
* @throws Will throw an error if the fetch fails after the specified number of retries.
|
|
40
|
-
*/
|
|
41
|
-
export declare function fetchWithRetry(url: string, options?: RequestInit, retries?: number, initialBackoff?: number): Promise<Response>;
|
|
42
|
-
export {};
|
|
43
|
-
//# sourceMappingURL=misc-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"misc-utils.d.ts","sourceRoot":"","sources":["../../src/misc-utils.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,SAAS,sDAAuD,CAAC;AAEvE,KAAK,OAAO,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,EAAE,OAAO,OAAO,EAAE,OAAM,OAAgB,SAqBjF,CAAC;AAqBF;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAiBrD;AA2CD;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,WAAgB,EACzB,OAAO,GAAE,MAAU,EACnB,cAAc,GAAE,MAAa,GAC5B,OAAO,CAAC,QAAQ,CAAC,CA2FnB"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A class to measure performance of code execution.
|
|
3
|
-
*
|
|
4
|
-
* This utility records elapsed time during execution and provides a detailed
|
|
5
|
-
* breakdown of elapsed time between checkpoints.
|
|
6
|
-
*
|
|
7
|
-
* Usage example:
|
|
8
|
-
* const timer = new PerformanceTimer();
|
|
9
|
-
* timer.checkpoint('Start Processing');
|
|
10
|
-
* // ... code for processing
|
|
11
|
-
* timer.checkpoint('After Task 1');
|
|
12
|
-
* // ... additional processing code
|
|
13
|
-
* timer.stop();
|
|
14
|
-
* console.log(timer.generateReport());
|
|
15
|
-
*
|
|
16
|
-
* Methods:
|
|
17
|
-
* - checkpoint(label: string): Record a timestamped checkpoint.
|
|
18
|
-
* - stop(): Stop the timer and compute the total elapsed time.
|
|
19
|
-
* - generateReport(): Return a performance report with total time and phases.
|
|
20
|
-
* - formatPerformanceReport(): Return a formatted string of the performance report.
|
|
21
|
-
* - getElapsedSeconds(): Get the current elapsed time in seconds.
|
|
22
|
-
*/
|
|
23
|
-
export declare class PerformanceTimer {
|
|
24
|
-
private startTime;
|
|
25
|
-
private checkpoints;
|
|
26
|
-
private totalTime;
|
|
27
|
-
constructor();
|
|
28
|
-
/**
|
|
29
|
-
* Gets the current elapsed time in seconds.
|
|
30
|
-
*
|
|
31
|
-
* @returns The elapsed time in seconds with 3 decimal places of precision.
|
|
32
|
-
*/
|
|
33
|
-
getElapsedSeconds(): number;
|
|
34
|
-
/**
|
|
35
|
-
* Records a checkpoint with the given label.
|
|
36
|
-
*
|
|
37
|
-
* @param label - A descriptive label for the checkpoint.
|
|
38
|
-
*/
|
|
39
|
-
checkpoint(label: string): void;
|
|
40
|
-
/**
|
|
41
|
-
* Stops the timer and sets the total elapsed time.
|
|
42
|
-
*/
|
|
43
|
-
stop(): void;
|
|
44
|
-
/**
|
|
45
|
-
* Generates a performance report containing the total elapsed time and
|
|
46
|
-
* breakdown of phases between checkpoints.
|
|
47
|
-
*
|
|
48
|
-
* @returns A performance report object.
|
|
49
|
-
* @throws Error if the timer is not stopped before generating the report.
|
|
50
|
-
*/
|
|
51
|
-
analyseReportData(): PerformanceReport;
|
|
52
|
-
/**
|
|
53
|
-
* Returns a formatted string of the performance report.
|
|
54
|
-
*
|
|
55
|
-
* @returns A string detailing the total execution time and phase breakdown.
|
|
56
|
-
*/
|
|
57
|
-
generateReport(): string;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Interface representing a single phase of performance measurement.
|
|
61
|
-
*/
|
|
62
|
-
export interface PerformancePhase {
|
|
63
|
-
label: string;
|
|
64
|
-
duration: number;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Interface representing the full performance report.
|
|
68
|
-
*/
|
|
69
|
-
export interface PerformanceReport {
|
|
70
|
-
totalTime: number;
|
|
71
|
-
phases: PerformancePhase[];
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=performance-timer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"performance-timer.d.ts","sourceRoot":"","sources":["../../src/performance-timer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,SAAS,CAAgB;;IAQjC;;;;OAIG;IACH,iBAAiB,IAAI,MAAM;IAK3B;;;;OAIG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI/B;;OAEG;IACH,IAAI,IAAI,IAAI;IAIZ;;;;;;OAMG;IACH,iBAAiB,IAAI,iBAAiB;IAuCtC;;;;OAIG;IACI,cAAc,IAAI,MAAM;CA4BhC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B"}
|