@alva-ai/toolkit 0.22.0 → 0.23.0
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/README.md +2 -0
- package/dist/browser.global.js +130 -3
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.d.ts +129 -0
- package/dist/cli.js +430 -3
- package/dist/cli.js.map +1 -1
- package/dist/dispatch.d.ts +130 -1
- package/dist/dispatch.js +113 -3
- package/dist/dispatch.js.map +1 -1
- package/dist/index.cjs +320 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +130 -1
- package/dist/index.d.ts +130 -1
- package/dist/index.js +319 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1860,6 +1860,133 @@ declare class CreditsResource {
|
|
|
1860
1860
|
private graphql;
|
|
1861
1861
|
}
|
|
1862
1862
|
|
|
1863
|
+
type CompanyFiscalQuarter = 'Q1' | 'Q2' | 'Q3' | 'Q4';
|
|
1864
|
+
type CompanyEarningsEvent = 'latest-completed' | 'next-confirmed';
|
|
1865
|
+
type CompanyEarningsStatus = 'UPCOMING' | 'COMPLETED';
|
|
1866
|
+
type CompanyEarningsContentStatus = 'AVAILABLE' | 'NOT_AVAILABLE_YET' | 'UNAVAILABLE';
|
|
1867
|
+
type CompanyEarningsSession = 'BEFORE_MARKET_OPEN' | 'AFTER_MARKET_CLOSE';
|
|
1868
|
+
interface CompanyNarrative {
|
|
1869
|
+
asOf: string;
|
|
1870
|
+
generatedAtMs: number;
|
|
1871
|
+
narrative: string;
|
|
1872
|
+
peers: string;
|
|
1873
|
+
}
|
|
1874
|
+
interface CompanyNarrativeSnapshot {
|
|
1875
|
+
asOf: string;
|
|
1876
|
+
generatedAtMs: number;
|
|
1877
|
+
narrative: string;
|
|
1878
|
+
}
|
|
1879
|
+
interface CompanyNarrativeChangeLogEntry {
|
|
1880
|
+
asOf: string;
|
|
1881
|
+
generatedAtMs: number;
|
|
1882
|
+
narrativeChangeLog: string | null;
|
|
1883
|
+
}
|
|
1884
|
+
interface CompanyNarrativeHistory {
|
|
1885
|
+
snapshots: CompanyNarrativeSnapshot[];
|
|
1886
|
+
changeLog: CompanyNarrativeChangeLogEntry[];
|
|
1887
|
+
}
|
|
1888
|
+
interface CompanyNarrativeContext {
|
|
1889
|
+
ticker: string;
|
|
1890
|
+
current: CompanyNarrative | null;
|
|
1891
|
+
history: CompanyNarrativeHistory | null;
|
|
1892
|
+
}
|
|
1893
|
+
interface CompanyEarningsPeriod {
|
|
1894
|
+
fiscalYear: number;
|
|
1895
|
+
fiscalQuarter: CompanyFiscalQuarter;
|
|
1896
|
+
label: string;
|
|
1897
|
+
fiscalDateEnding: string;
|
|
1898
|
+
earningsDate: string;
|
|
1899
|
+
session: CompanyEarningsSession | null;
|
|
1900
|
+
status: CompanyEarningsStatus;
|
|
1901
|
+
isDefault: boolean;
|
|
1902
|
+
}
|
|
1903
|
+
interface CompanyEarningsCatalog {
|
|
1904
|
+
periods: CompanyEarningsPeriod[];
|
|
1905
|
+
defaultPeriod: CompanyEarningsPeriod | null;
|
|
1906
|
+
unresolvedEventCount: number;
|
|
1907
|
+
}
|
|
1908
|
+
interface CompanyPreEarningsAnalysis {
|
|
1909
|
+
status: CompanyEarningsContentStatus;
|
|
1910
|
+
asOf: string | null;
|
|
1911
|
+
summary: string | null;
|
|
1912
|
+
whatWouldChangeView: string | null;
|
|
1913
|
+
mainQuestion: string | null;
|
|
1914
|
+
investorFocus: string[];
|
|
1915
|
+
consensusAndGuidance: string | null;
|
|
1916
|
+
stockSetup: string | null;
|
|
1917
|
+
eventRisk: string | null;
|
|
1918
|
+
whatWouldDriveUpside: string | null;
|
|
1919
|
+
bullCase: string | null;
|
|
1920
|
+
baseCase: string | null;
|
|
1921
|
+
bearCase: string | null;
|
|
1922
|
+
keyAsymmetry: string | null;
|
|
1923
|
+
consensusN: number | null;
|
|
1924
|
+
consensusObservedAt: string | null;
|
|
1925
|
+
}
|
|
1926
|
+
interface CompanyEarningsRelease {
|
|
1927
|
+
status: CompanyEarningsContentStatus;
|
|
1928
|
+
releaseDate: string | null;
|
|
1929
|
+
url: string | null;
|
|
1930
|
+
}
|
|
1931
|
+
interface CompanyEarningsTranscriptEntry {
|
|
1932
|
+
speaker: string;
|
|
1933
|
+
title: string;
|
|
1934
|
+
content: string;
|
|
1935
|
+
}
|
|
1936
|
+
interface CompanyEarningsTranscriptSection {
|
|
1937
|
+
name: string;
|
|
1938
|
+
entries: CompanyEarningsTranscriptEntry[];
|
|
1939
|
+
}
|
|
1940
|
+
interface CompanyEarningsTranscript {
|
|
1941
|
+
status: CompanyEarningsContentStatus;
|
|
1942
|
+
date: string | null;
|
|
1943
|
+
publishedAtMs: number | null;
|
|
1944
|
+
sections: CompanyEarningsTranscriptSection[];
|
|
1945
|
+
}
|
|
1946
|
+
interface CompanyPostEarningsSummary {
|
|
1947
|
+
status: CompanyEarningsContentStatus;
|
|
1948
|
+
asOf: string | null;
|
|
1949
|
+
reportedCurrency: string | null;
|
|
1950
|
+
evidenceState: 'INITIAL_PRINT' | 'POST_CALL' | null;
|
|
1951
|
+
openingQuote: string | null;
|
|
1952
|
+
openingQuoteSpeaker: string | null;
|
|
1953
|
+
openingQuoteTitle: string | null;
|
|
1954
|
+
openingQuoteNote: string | null;
|
|
1955
|
+
buriedSignals: string[];
|
|
1956
|
+
whatYouShouldKnow: string[];
|
|
1957
|
+
consensusN: number | null;
|
|
1958
|
+
consensusObservedAt: string | null;
|
|
1959
|
+
}
|
|
1960
|
+
interface CompanyEarningsContext {
|
|
1961
|
+
ticker: string;
|
|
1962
|
+
period: CompanyEarningsPeriod;
|
|
1963
|
+
preEarningsAnalysis: CompanyPreEarningsAnalysis;
|
|
1964
|
+
earningsRelease: CompanyEarningsRelease;
|
|
1965
|
+
earningsTranscript: CompanyEarningsTranscript;
|
|
1966
|
+
postEarningsSummary: CompanyPostEarningsSummary;
|
|
1967
|
+
}
|
|
1968
|
+
type CompanyEarningsParams = {
|
|
1969
|
+
ticker: string;
|
|
1970
|
+
event?: CompanyEarningsEvent;
|
|
1971
|
+
fiscalYear?: never;
|
|
1972
|
+
fiscalQuarter?: never;
|
|
1973
|
+
} | {
|
|
1974
|
+
ticker: string;
|
|
1975
|
+
event?: never;
|
|
1976
|
+
fiscalYear: number;
|
|
1977
|
+
fiscalQuarter: CompanyFiscalQuarter;
|
|
1978
|
+
};
|
|
1979
|
+
declare class MarketsResource {
|
|
1980
|
+
private client;
|
|
1981
|
+
constructor(client: AlvaClient);
|
|
1982
|
+
narrative(ticker: string): Promise<CompanyNarrativeContext>;
|
|
1983
|
+
earningsPeriods(ticker: string): Promise<CompanyEarningsCatalog>;
|
|
1984
|
+
earnings(params: CompanyEarningsParams): Promise<CompanyEarningsContext>;
|
|
1985
|
+
private selectPeriod;
|
|
1986
|
+
private notFound;
|
|
1987
|
+
private graphql;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1863
1990
|
interface RequestOptions {
|
|
1864
1991
|
query?: Record<string, unknown>;
|
|
1865
1992
|
body?: unknown;
|
|
@@ -1924,6 +2051,7 @@ declare class AlvaClient {
|
|
|
1924
2051
|
private _feedback?;
|
|
1925
2052
|
private _functions?;
|
|
1926
2053
|
private _credits?;
|
|
2054
|
+
private _markets?;
|
|
1927
2055
|
constructor(config: AlvaClientConfig);
|
|
1928
2056
|
get fs(): FsResource;
|
|
1929
2057
|
get run(): RunResource;
|
|
@@ -1952,6 +2080,7 @@ declare class AlvaClient {
|
|
|
1952
2080
|
get feedback(): FeedbackResource;
|
|
1953
2081
|
get functions(): FunctionsResource;
|
|
1954
2082
|
get credits(): CreditsResource;
|
|
2083
|
+
get markets(): MarketsResource;
|
|
1955
2084
|
_requireAuth(): void;
|
|
1956
2085
|
_request(method: string, path: string, options?: RequestOptions): Promise<unknown>;
|
|
1957
2086
|
}
|
|
@@ -2100,4 +2229,4 @@ declare const installPlaybookRuntime: (targetWindow?: Window) => void;
|
|
|
2100
2229
|
/** SDK version, injected at build time from package.json. */
|
|
2101
2230
|
declare const VERSION: string;
|
|
2102
2231
|
|
|
2103
|
-
export { AlertsResource, AlvaClient, type AlvaClientConfig, AlvaError, AutomationResource, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupHistoryParams, type ChannelGroupHistoryResponse, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, CliUsageError, type CreateAllowanceParams, type CreateAllowanceResponse, type CreditAllowance, type CreditWallet, type CreditWalletItem, type CreditWalletItemConnection, type CreditWalletItemEdge, type CreditWalletItemsParams, type CreditWalletItemsResponse, type CreditWalletPageInfo, type DeleteFunctionParams, type FeedDeleteRequest, type FeedDeleteResponse, type FeedListItem, type FeedListParams, type FeedListResponse, type FeedListStatus, type FeedStatusUpdateRequest, type FeedStatusUpdateResponse, type FollowPlaybookResponse, type FsChmodParams, type FsCopyParams, type FsEntry, type FsGrantParams, type FsMkdirParams, type FsRawWriteParams, type FsReadParams, type FsReaddirParams, type FsReaddirResponse, type FsReadlinkParams, type FsRemoveParams, type FsRenameParams, type FsRevokeParams, type FsStat, type FsSymlinkParams, type FsWriteParams, type FsWriteResponse, type GetAllowanceParams, type GroupChatMessage, type InvokeFunctionParams, type InvokeFunctionResponse, type ListAllowancesResponse, type ListFunctionsParams, type ListFunctionsResponse, type NotificationPreference, type NotificationPreferenceKey, type NotificationPreferenceUpdateParams, type NotificationPreferenceUpdateResponse, type NotificationPreferencesResponse, PBSV_UPDATE_MESSAGE, type PlaybookFollowParams, type PlaybookFunction, type PlaybookSkillFile, type PlaybookSkillFileMeta, type PlaybookSkillMeta, type PlaybookSkillSummary, type PlaybookSkillTagEntry, type RegisterFunctionParams, type RegisterFunctionResponse, type RevokeAllowanceParams, type RevokeAllowanceResponse, SUBSCRIBE_PROPOSE_MESSAGE, SUBSCRIBE_RESULT_MESSAGE, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type SubmitFeedbackRequest, type SubmitFeedbackResponse, type SubscribeApi, type SubscribeBatchParams, type SubscribeBatchResponse, type SubscribeProposalInput, type SubscribeProposalResult, type TrendingPlaybookItem, type TrendingPlaybooksDir, type TrendingPlaybooksParams, type TrendingPlaybooksResponse, type TrendingPlaybooksSort, UDF_AUTH_REQUIRED_MESSAGE, UDF_CONSENT_REQUEST_MESSAGE, UDF_CONSENT_RESPONSE_MESSAGE, type UdfApi, UdfAuthRequiredError, type UdfButtonEventDetail, type UdfButtonOptions, UdfConsentDeniedError, UdfConsentRequiredError, UdfConsentTimeoutError, type UdfDescriptor, UdfError, UdfExecutionError, UdfFunctionDisabledError, UdfFunctionNotFoundError, UdfInsufficientCredits, type UdfInvokeResponse, UdfPidMismatchError, UdfRateLimitedError, UdfTokenExpiredError, UdfTokenInvalidError, UdfTransportError, type UnfollowPlaybookResponse, type UnsubscribeBatchParams, type UnsubscribeBatchResponse, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, subscribe, udf };
|
|
2232
|
+
export { AlertsResource, AlvaClient, type AlvaClientConfig, AlvaError, AutomationResource, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupHistoryParams, type ChannelGroupHistoryResponse, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, CliUsageError, type CompanyEarningsCatalog, type CompanyEarningsContentStatus, type CompanyEarningsContext, type CompanyEarningsEvent, type CompanyEarningsParams, type CompanyEarningsPeriod, type CompanyEarningsRelease, type CompanyEarningsSession, type CompanyEarningsStatus, type CompanyEarningsTranscript, type CompanyEarningsTranscriptEntry, type CompanyEarningsTranscriptSection, type CompanyFiscalQuarter, type CompanyNarrative, type CompanyNarrativeChangeLogEntry, type CompanyNarrativeContext, type CompanyNarrativeHistory, type CompanyNarrativeSnapshot, type CompanyPostEarningsSummary, type CompanyPreEarningsAnalysis, type CreateAllowanceParams, type CreateAllowanceResponse, type CreditAllowance, type CreditWallet, type CreditWalletItem, type CreditWalletItemConnection, type CreditWalletItemEdge, type CreditWalletItemsParams, type CreditWalletItemsResponse, type CreditWalletPageInfo, type DeleteFunctionParams, type FeedDeleteRequest, type FeedDeleteResponse, type FeedListItem, type FeedListParams, type FeedListResponse, type FeedListStatus, type FeedStatusUpdateRequest, type FeedStatusUpdateResponse, type FollowPlaybookResponse, type FsChmodParams, type FsCopyParams, type FsEntry, type FsGrantParams, type FsMkdirParams, type FsRawWriteParams, type FsReadParams, type FsReaddirParams, type FsReaddirResponse, type FsReadlinkParams, type FsRemoveParams, type FsRenameParams, type FsRevokeParams, type FsStat, type FsSymlinkParams, type FsWriteParams, type FsWriteResponse, type GetAllowanceParams, type GroupChatMessage, type InvokeFunctionParams, type InvokeFunctionResponse, type ListAllowancesResponse, type ListFunctionsParams, type ListFunctionsResponse, MarketsResource, type NotificationPreference, type NotificationPreferenceKey, type NotificationPreferenceUpdateParams, type NotificationPreferenceUpdateResponse, type NotificationPreferencesResponse, PBSV_UPDATE_MESSAGE, type PlaybookFollowParams, type PlaybookFunction, type PlaybookSkillFile, type PlaybookSkillFileMeta, type PlaybookSkillMeta, type PlaybookSkillSummary, type PlaybookSkillTagEntry, type RegisterFunctionParams, type RegisterFunctionResponse, type RevokeAllowanceParams, type RevokeAllowanceResponse, SUBSCRIBE_PROPOSE_MESSAGE, SUBSCRIBE_RESULT_MESSAGE, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type SubmitFeedbackRequest, type SubmitFeedbackResponse, type SubscribeApi, type SubscribeBatchParams, type SubscribeBatchResponse, type SubscribeProposalInput, type SubscribeProposalResult, type TrendingPlaybookItem, type TrendingPlaybooksDir, type TrendingPlaybooksParams, type TrendingPlaybooksResponse, type TrendingPlaybooksSort, UDF_AUTH_REQUIRED_MESSAGE, UDF_CONSENT_REQUEST_MESSAGE, UDF_CONSENT_RESPONSE_MESSAGE, type UdfApi, UdfAuthRequiredError, type UdfButtonEventDetail, type UdfButtonOptions, UdfConsentDeniedError, UdfConsentRequiredError, UdfConsentTimeoutError, type UdfDescriptor, UdfError, UdfExecutionError, UdfFunctionDisabledError, UdfFunctionNotFoundError, UdfInsufficientCredits, type UdfInvokeResponse, UdfPidMismatchError, UdfRateLimitedError, UdfTokenExpiredError, UdfTokenInvalidError, UdfTransportError, type UnfollowPlaybookResponse, type UnsubscribeBatchParams, type UnsubscribeBatchResponse, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, subscribe, udf };
|
package/dist/index.d.ts
CHANGED
|
@@ -1860,6 +1860,133 @@ declare class CreditsResource {
|
|
|
1860
1860
|
private graphql;
|
|
1861
1861
|
}
|
|
1862
1862
|
|
|
1863
|
+
type CompanyFiscalQuarter = 'Q1' | 'Q2' | 'Q3' | 'Q4';
|
|
1864
|
+
type CompanyEarningsEvent = 'latest-completed' | 'next-confirmed';
|
|
1865
|
+
type CompanyEarningsStatus = 'UPCOMING' | 'COMPLETED';
|
|
1866
|
+
type CompanyEarningsContentStatus = 'AVAILABLE' | 'NOT_AVAILABLE_YET' | 'UNAVAILABLE';
|
|
1867
|
+
type CompanyEarningsSession = 'BEFORE_MARKET_OPEN' | 'AFTER_MARKET_CLOSE';
|
|
1868
|
+
interface CompanyNarrative {
|
|
1869
|
+
asOf: string;
|
|
1870
|
+
generatedAtMs: number;
|
|
1871
|
+
narrative: string;
|
|
1872
|
+
peers: string;
|
|
1873
|
+
}
|
|
1874
|
+
interface CompanyNarrativeSnapshot {
|
|
1875
|
+
asOf: string;
|
|
1876
|
+
generatedAtMs: number;
|
|
1877
|
+
narrative: string;
|
|
1878
|
+
}
|
|
1879
|
+
interface CompanyNarrativeChangeLogEntry {
|
|
1880
|
+
asOf: string;
|
|
1881
|
+
generatedAtMs: number;
|
|
1882
|
+
narrativeChangeLog: string | null;
|
|
1883
|
+
}
|
|
1884
|
+
interface CompanyNarrativeHistory {
|
|
1885
|
+
snapshots: CompanyNarrativeSnapshot[];
|
|
1886
|
+
changeLog: CompanyNarrativeChangeLogEntry[];
|
|
1887
|
+
}
|
|
1888
|
+
interface CompanyNarrativeContext {
|
|
1889
|
+
ticker: string;
|
|
1890
|
+
current: CompanyNarrative | null;
|
|
1891
|
+
history: CompanyNarrativeHistory | null;
|
|
1892
|
+
}
|
|
1893
|
+
interface CompanyEarningsPeriod {
|
|
1894
|
+
fiscalYear: number;
|
|
1895
|
+
fiscalQuarter: CompanyFiscalQuarter;
|
|
1896
|
+
label: string;
|
|
1897
|
+
fiscalDateEnding: string;
|
|
1898
|
+
earningsDate: string;
|
|
1899
|
+
session: CompanyEarningsSession | null;
|
|
1900
|
+
status: CompanyEarningsStatus;
|
|
1901
|
+
isDefault: boolean;
|
|
1902
|
+
}
|
|
1903
|
+
interface CompanyEarningsCatalog {
|
|
1904
|
+
periods: CompanyEarningsPeriod[];
|
|
1905
|
+
defaultPeriod: CompanyEarningsPeriod | null;
|
|
1906
|
+
unresolvedEventCount: number;
|
|
1907
|
+
}
|
|
1908
|
+
interface CompanyPreEarningsAnalysis {
|
|
1909
|
+
status: CompanyEarningsContentStatus;
|
|
1910
|
+
asOf: string | null;
|
|
1911
|
+
summary: string | null;
|
|
1912
|
+
whatWouldChangeView: string | null;
|
|
1913
|
+
mainQuestion: string | null;
|
|
1914
|
+
investorFocus: string[];
|
|
1915
|
+
consensusAndGuidance: string | null;
|
|
1916
|
+
stockSetup: string | null;
|
|
1917
|
+
eventRisk: string | null;
|
|
1918
|
+
whatWouldDriveUpside: string | null;
|
|
1919
|
+
bullCase: string | null;
|
|
1920
|
+
baseCase: string | null;
|
|
1921
|
+
bearCase: string | null;
|
|
1922
|
+
keyAsymmetry: string | null;
|
|
1923
|
+
consensusN: number | null;
|
|
1924
|
+
consensusObservedAt: string | null;
|
|
1925
|
+
}
|
|
1926
|
+
interface CompanyEarningsRelease {
|
|
1927
|
+
status: CompanyEarningsContentStatus;
|
|
1928
|
+
releaseDate: string | null;
|
|
1929
|
+
url: string | null;
|
|
1930
|
+
}
|
|
1931
|
+
interface CompanyEarningsTranscriptEntry {
|
|
1932
|
+
speaker: string;
|
|
1933
|
+
title: string;
|
|
1934
|
+
content: string;
|
|
1935
|
+
}
|
|
1936
|
+
interface CompanyEarningsTranscriptSection {
|
|
1937
|
+
name: string;
|
|
1938
|
+
entries: CompanyEarningsTranscriptEntry[];
|
|
1939
|
+
}
|
|
1940
|
+
interface CompanyEarningsTranscript {
|
|
1941
|
+
status: CompanyEarningsContentStatus;
|
|
1942
|
+
date: string | null;
|
|
1943
|
+
publishedAtMs: number | null;
|
|
1944
|
+
sections: CompanyEarningsTranscriptSection[];
|
|
1945
|
+
}
|
|
1946
|
+
interface CompanyPostEarningsSummary {
|
|
1947
|
+
status: CompanyEarningsContentStatus;
|
|
1948
|
+
asOf: string | null;
|
|
1949
|
+
reportedCurrency: string | null;
|
|
1950
|
+
evidenceState: 'INITIAL_PRINT' | 'POST_CALL' | null;
|
|
1951
|
+
openingQuote: string | null;
|
|
1952
|
+
openingQuoteSpeaker: string | null;
|
|
1953
|
+
openingQuoteTitle: string | null;
|
|
1954
|
+
openingQuoteNote: string | null;
|
|
1955
|
+
buriedSignals: string[];
|
|
1956
|
+
whatYouShouldKnow: string[];
|
|
1957
|
+
consensusN: number | null;
|
|
1958
|
+
consensusObservedAt: string | null;
|
|
1959
|
+
}
|
|
1960
|
+
interface CompanyEarningsContext {
|
|
1961
|
+
ticker: string;
|
|
1962
|
+
period: CompanyEarningsPeriod;
|
|
1963
|
+
preEarningsAnalysis: CompanyPreEarningsAnalysis;
|
|
1964
|
+
earningsRelease: CompanyEarningsRelease;
|
|
1965
|
+
earningsTranscript: CompanyEarningsTranscript;
|
|
1966
|
+
postEarningsSummary: CompanyPostEarningsSummary;
|
|
1967
|
+
}
|
|
1968
|
+
type CompanyEarningsParams = {
|
|
1969
|
+
ticker: string;
|
|
1970
|
+
event?: CompanyEarningsEvent;
|
|
1971
|
+
fiscalYear?: never;
|
|
1972
|
+
fiscalQuarter?: never;
|
|
1973
|
+
} | {
|
|
1974
|
+
ticker: string;
|
|
1975
|
+
event?: never;
|
|
1976
|
+
fiscalYear: number;
|
|
1977
|
+
fiscalQuarter: CompanyFiscalQuarter;
|
|
1978
|
+
};
|
|
1979
|
+
declare class MarketsResource {
|
|
1980
|
+
private client;
|
|
1981
|
+
constructor(client: AlvaClient);
|
|
1982
|
+
narrative(ticker: string): Promise<CompanyNarrativeContext>;
|
|
1983
|
+
earningsPeriods(ticker: string): Promise<CompanyEarningsCatalog>;
|
|
1984
|
+
earnings(params: CompanyEarningsParams): Promise<CompanyEarningsContext>;
|
|
1985
|
+
private selectPeriod;
|
|
1986
|
+
private notFound;
|
|
1987
|
+
private graphql;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1863
1990
|
interface RequestOptions {
|
|
1864
1991
|
query?: Record<string, unknown>;
|
|
1865
1992
|
body?: unknown;
|
|
@@ -1924,6 +2051,7 @@ declare class AlvaClient {
|
|
|
1924
2051
|
private _feedback?;
|
|
1925
2052
|
private _functions?;
|
|
1926
2053
|
private _credits?;
|
|
2054
|
+
private _markets?;
|
|
1927
2055
|
constructor(config: AlvaClientConfig);
|
|
1928
2056
|
get fs(): FsResource;
|
|
1929
2057
|
get run(): RunResource;
|
|
@@ -1952,6 +2080,7 @@ declare class AlvaClient {
|
|
|
1952
2080
|
get feedback(): FeedbackResource;
|
|
1953
2081
|
get functions(): FunctionsResource;
|
|
1954
2082
|
get credits(): CreditsResource;
|
|
2083
|
+
get markets(): MarketsResource;
|
|
1955
2084
|
_requireAuth(): void;
|
|
1956
2085
|
_request(method: string, path: string, options?: RequestOptions): Promise<unknown>;
|
|
1957
2086
|
}
|
|
@@ -2100,4 +2229,4 @@ declare const installPlaybookRuntime: (targetWindow?: Window) => void;
|
|
|
2100
2229
|
/** SDK version, injected at build time from package.json. */
|
|
2101
2230
|
declare const VERSION: string;
|
|
2102
2231
|
|
|
2103
|
-
export { AlertsResource, AlvaClient, type AlvaClientConfig, AlvaError, AutomationResource, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupHistoryParams, type ChannelGroupHistoryResponse, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, CliUsageError, type CreateAllowanceParams, type CreateAllowanceResponse, type CreditAllowance, type CreditWallet, type CreditWalletItem, type CreditWalletItemConnection, type CreditWalletItemEdge, type CreditWalletItemsParams, type CreditWalletItemsResponse, type CreditWalletPageInfo, type DeleteFunctionParams, type FeedDeleteRequest, type FeedDeleteResponse, type FeedListItem, type FeedListParams, type FeedListResponse, type FeedListStatus, type FeedStatusUpdateRequest, type FeedStatusUpdateResponse, type FollowPlaybookResponse, type FsChmodParams, type FsCopyParams, type FsEntry, type FsGrantParams, type FsMkdirParams, type FsRawWriteParams, type FsReadParams, type FsReaddirParams, type FsReaddirResponse, type FsReadlinkParams, type FsRemoveParams, type FsRenameParams, type FsRevokeParams, type FsStat, type FsSymlinkParams, type FsWriteParams, type FsWriteResponse, type GetAllowanceParams, type GroupChatMessage, type InvokeFunctionParams, type InvokeFunctionResponse, type ListAllowancesResponse, type ListFunctionsParams, type ListFunctionsResponse, type NotificationPreference, type NotificationPreferenceKey, type NotificationPreferenceUpdateParams, type NotificationPreferenceUpdateResponse, type NotificationPreferencesResponse, PBSV_UPDATE_MESSAGE, type PlaybookFollowParams, type PlaybookFunction, type PlaybookSkillFile, type PlaybookSkillFileMeta, type PlaybookSkillMeta, type PlaybookSkillSummary, type PlaybookSkillTagEntry, type RegisterFunctionParams, type RegisterFunctionResponse, type RevokeAllowanceParams, type RevokeAllowanceResponse, SUBSCRIBE_PROPOSE_MESSAGE, SUBSCRIBE_RESULT_MESSAGE, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type SubmitFeedbackRequest, type SubmitFeedbackResponse, type SubscribeApi, type SubscribeBatchParams, type SubscribeBatchResponse, type SubscribeProposalInput, type SubscribeProposalResult, type TrendingPlaybookItem, type TrendingPlaybooksDir, type TrendingPlaybooksParams, type TrendingPlaybooksResponse, type TrendingPlaybooksSort, UDF_AUTH_REQUIRED_MESSAGE, UDF_CONSENT_REQUEST_MESSAGE, UDF_CONSENT_RESPONSE_MESSAGE, type UdfApi, UdfAuthRequiredError, type UdfButtonEventDetail, type UdfButtonOptions, UdfConsentDeniedError, UdfConsentRequiredError, UdfConsentTimeoutError, type UdfDescriptor, UdfError, UdfExecutionError, UdfFunctionDisabledError, UdfFunctionNotFoundError, UdfInsufficientCredits, type UdfInvokeResponse, UdfPidMismatchError, UdfRateLimitedError, UdfTokenExpiredError, UdfTokenInvalidError, UdfTransportError, type UnfollowPlaybookResponse, type UnsubscribeBatchParams, type UnsubscribeBatchResponse, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, subscribe, udf };
|
|
2232
|
+
export { AlertsResource, AlvaClient, type AlvaClientConfig, AlvaError, AutomationResource, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupHistoryParams, type ChannelGroupHistoryResponse, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, CliUsageError, type CompanyEarningsCatalog, type CompanyEarningsContentStatus, type CompanyEarningsContext, type CompanyEarningsEvent, type CompanyEarningsParams, type CompanyEarningsPeriod, type CompanyEarningsRelease, type CompanyEarningsSession, type CompanyEarningsStatus, type CompanyEarningsTranscript, type CompanyEarningsTranscriptEntry, type CompanyEarningsTranscriptSection, type CompanyFiscalQuarter, type CompanyNarrative, type CompanyNarrativeChangeLogEntry, type CompanyNarrativeContext, type CompanyNarrativeHistory, type CompanyNarrativeSnapshot, type CompanyPostEarningsSummary, type CompanyPreEarningsAnalysis, type CreateAllowanceParams, type CreateAllowanceResponse, type CreditAllowance, type CreditWallet, type CreditWalletItem, type CreditWalletItemConnection, type CreditWalletItemEdge, type CreditWalletItemsParams, type CreditWalletItemsResponse, type CreditWalletPageInfo, type DeleteFunctionParams, type FeedDeleteRequest, type FeedDeleteResponse, type FeedListItem, type FeedListParams, type FeedListResponse, type FeedListStatus, type FeedStatusUpdateRequest, type FeedStatusUpdateResponse, type FollowPlaybookResponse, type FsChmodParams, type FsCopyParams, type FsEntry, type FsGrantParams, type FsMkdirParams, type FsRawWriteParams, type FsReadParams, type FsReaddirParams, type FsReaddirResponse, type FsReadlinkParams, type FsRemoveParams, type FsRenameParams, type FsRevokeParams, type FsStat, type FsSymlinkParams, type FsWriteParams, type FsWriteResponse, type GetAllowanceParams, type GroupChatMessage, type InvokeFunctionParams, type InvokeFunctionResponse, type ListAllowancesResponse, type ListFunctionsParams, type ListFunctionsResponse, MarketsResource, type NotificationPreference, type NotificationPreferenceKey, type NotificationPreferenceUpdateParams, type NotificationPreferenceUpdateResponse, type NotificationPreferencesResponse, PBSV_UPDATE_MESSAGE, type PlaybookFollowParams, type PlaybookFunction, type PlaybookSkillFile, type PlaybookSkillFileMeta, type PlaybookSkillMeta, type PlaybookSkillSummary, type PlaybookSkillTagEntry, type RegisterFunctionParams, type RegisterFunctionResponse, type RevokeAllowanceParams, type RevokeAllowanceResponse, SUBSCRIBE_PROPOSE_MESSAGE, SUBSCRIBE_RESULT_MESSAGE, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type SubmitFeedbackRequest, type SubmitFeedbackResponse, type SubscribeApi, type SubscribeBatchParams, type SubscribeBatchResponse, type SubscribeProposalInput, type SubscribeProposalResult, type TrendingPlaybookItem, type TrendingPlaybooksDir, type TrendingPlaybooksParams, type TrendingPlaybooksResponse, type TrendingPlaybooksSort, UDF_AUTH_REQUIRED_MESSAGE, UDF_CONSENT_REQUEST_MESSAGE, UDF_CONSENT_RESPONSE_MESSAGE, type UdfApi, UdfAuthRequiredError, type UdfButtonEventDetail, type UdfButtonOptions, UdfConsentDeniedError, UdfConsentRequiredError, UdfConsentTimeoutError, type UdfDescriptor, UdfError, UdfExecutionError, UdfFunctionDisabledError, UdfFunctionNotFoundError, UdfInsufficientCredits, type UdfInvokeResponse, UdfPidMismatchError, UdfRateLimitedError, UdfTokenExpiredError, UdfTokenInvalidError, UdfTransportError, type UnfollowPlaybookResponse, type UnsubscribeBatchParams, type UnsubscribeBatchResponse, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, subscribe, udf };
|
package/dist/index.js
CHANGED
|
@@ -2505,6 +2505,319 @@ var CreditsResource = class {
|
|
|
2505
2505
|
}
|
|
2506
2506
|
};
|
|
2507
2507
|
|
|
2508
|
+
// src/resources/markets.ts
|
|
2509
|
+
var FISCAL_QUARTERS = [
|
|
2510
|
+
"Q1",
|
|
2511
|
+
"Q2",
|
|
2512
|
+
"Q3",
|
|
2513
|
+
"Q4"
|
|
2514
|
+
];
|
|
2515
|
+
var EARNINGS_EVENTS = [
|
|
2516
|
+
"latest-completed",
|
|
2517
|
+
"next-confirmed"
|
|
2518
|
+
];
|
|
2519
|
+
var NARRATIVE_QUERY = `
|
|
2520
|
+
query ToolkitCompanyNarrative($ticker: String!) {
|
|
2521
|
+
market {
|
|
2522
|
+
entity(input: { ticker: $ticker, kind: STOCK }) {
|
|
2523
|
+
ticker
|
|
2524
|
+
companyInsight {
|
|
2525
|
+
asOf
|
|
2526
|
+
generatedAtMs
|
|
2527
|
+
narrative
|
|
2528
|
+
peers
|
|
2529
|
+
}
|
|
2530
|
+
companyInsightHistory {
|
|
2531
|
+
snapshots {
|
|
2532
|
+
asOf
|
|
2533
|
+
generatedAtMs
|
|
2534
|
+
narrative
|
|
2535
|
+
}
|
|
2536
|
+
changeLog {
|
|
2537
|
+
asOf
|
|
2538
|
+
generatedAtMs
|
|
2539
|
+
narrativeChangeLog
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
`.trim();
|
|
2546
|
+
var EARNINGS_CATALOG_QUERY = `
|
|
2547
|
+
query ToolkitCompanyEarningsCatalog($ticker: String!) {
|
|
2548
|
+
market {
|
|
2549
|
+
entity(input: { ticker: $ticker, kind: STOCK }) {
|
|
2550
|
+
ticker
|
|
2551
|
+
earningsPeriods {
|
|
2552
|
+
unresolvedEventCount
|
|
2553
|
+
defaultPeriod {
|
|
2554
|
+
fiscalYear
|
|
2555
|
+
fiscalQuarter
|
|
2556
|
+
label
|
|
2557
|
+
fiscalDateEnding
|
|
2558
|
+
earningsDate
|
|
2559
|
+
session
|
|
2560
|
+
status
|
|
2561
|
+
isDefault
|
|
2562
|
+
}
|
|
2563
|
+
periods {
|
|
2564
|
+
fiscalYear
|
|
2565
|
+
fiscalQuarter
|
|
2566
|
+
label
|
|
2567
|
+
fiscalDateEnding
|
|
2568
|
+
earningsDate
|
|
2569
|
+
session
|
|
2570
|
+
status
|
|
2571
|
+
isDefault
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
`.trim();
|
|
2578
|
+
var EARNINGS_QUERY = `
|
|
2579
|
+
query ToolkitCompanyEarnings($ticker: String!, $input: CompanyEarningsInput) {
|
|
2580
|
+
market {
|
|
2581
|
+
entity(input: { ticker: $ticker, kind: STOCK }) {
|
|
2582
|
+
ticker
|
|
2583
|
+
earnings(input: $input) {
|
|
2584
|
+
period {
|
|
2585
|
+
fiscalYear
|
|
2586
|
+
fiscalQuarter
|
|
2587
|
+
label
|
|
2588
|
+
fiscalDateEnding
|
|
2589
|
+
earningsDate
|
|
2590
|
+
session
|
|
2591
|
+
status
|
|
2592
|
+
isDefault
|
|
2593
|
+
}
|
|
2594
|
+
preEarningsAnalysis {
|
|
2595
|
+
status
|
|
2596
|
+
asOf
|
|
2597
|
+
summary
|
|
2598
|
+
whatWouldChangeView
|
|
2599
|
+
mainQuestion
|
|
2600
|
+
investorFocus
|
|
2601
|
+
consensusAndGuidance
|
|
2602
|
+
stockSetup
|
|
2603
|
+
eventRisk
|
|
2604
|
+
whatWouldDriveUpside
|
|
2605
|
+
bullCase
|
|
2606
|
+
baseCase
|
|
2607
|
+
bearCase
|
|
2608
|
+
keyAsymmetry
|
|
2609
|
+
consensusN
|
|
2610
|
+
consensusObservedAt
|
|
2611
|
+
}
|
|
2612
|
+
earningsRelease {
|
|
2613
|
+
status
|
|
2614
|
+
releaseDate
|
|
2615
|
+
url
|
|
2616
|
+
}
|
|
2617
|
+
earningsTranscript {
|
|
2618
|
+
status
|
|
2619
|
+
date
|
|
2620
|
+
publishedAtMs
|
|
2621
|
+
sections {
|
|
2622
|
+
name
|
|
2623
|
+
entries {
|
|
2624
|
+
speaker
|
|
2625
|
+
title
|
|
2626
|
+
content
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
postEarningsSummary {
|
|
2631
|
+
status
|
|
2632
|
+
asOf
|
|
2633
|
+
reportedCurrency
|
|
2634
|
+
evidenceState
|
|
2635
|
+
openingQuote
|
|
2636
|
+
openingQuoteSpeaker
|
|
2637
|
+
openingQuoteTitle
|
|
2638
|
+
openingQuoteNote
|
|
2639
|
+
buriedSignals
|
|
2640
|
+
whatYouShouldKnow
|
|
2641
|
+
consensusN
|
|
2642
|
+
consensusObservedAt
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
`.trim();
|
|
2649
|
+
function graphQLErrorMessage2(errors) {
|
|
2650
|
+
const messages = errors.map(
|
|
2651
|
+
(error) => typeof error.message === "string" && error.message ? error.message : void 0
|
|
2652
|
+
).filter((message) => Boolean(message));
|
|
2653
|
+
return messages.length > 0 ? messages.join("; ") : "GraphQL request failed";
|
|
2654
|
+
}
|
|
2655
|
+
function normalizedTicker(ticker) {
|
|
2656
|
+
const normalized = ticker.trim().toUpperCase();
|
|
2657
|
+
if (!normalized) {
|
|
2658
|
+
throw new AlvaError("INVALID_ARGUMENT", "ticker is required", 400);
|
|
2659
|
+
}
|
|
2660
|
+
return normalized;
|
|
2661
|
+
}
|
|
2662
|
+
var MarketsResource = class {
|
|
2663
|
+
constructor(client) {
|
|
2664
|
+
this.client = client;
|
|
2665
|
+
}
|
|
2666
|
+
client;
|
|
2667
|
+
async narrative(ticker) {
|
|
2668
|
+
this.client._requireAuth();
|
|
2669
|
+
const requestedTicker = normalizedTicker(ticker);
|
|
2670
|
+
const data = await this.graphql(NARRATIVE_QUERY, {
|
|
2671
|
+
ticker: requestedTicker
|
|
2672
|
+
});
|
|
2673
|
+
const entity = data.market?.entity;
|
|
2674
|
+
if (!entity) {
|
|
2675
|
+
throw this.notFound(requestedTicker);
|
|
2676
|
+
}
|
|
2677
|
+
return {
|
|
2678
|
+
ticker: entity.ticker,
|
|
2679
|
+
current: entity.companyInsight,
|
|
2680
|
+
history: entity.companyInsightHistory
|
|
2681
|
+
};
|
|
2682
|
+
}
|
|
2683
|
+
async earningsPeriods(ticker) {
|
|
2684
|
+
this.client._requireAuth();
|
|
2685
|
+
const requestedTicker = normalizedTicker(ticker);
|
|
2686
|
+
const data = await this.graphql(
|
|
2687
|
+
EARNINGS_CATALOG_QUERY,
|
|
2688
|
+
{ ticker: requestedTicker }
|
|
2689
|
+
);
|
|
2690
|
+
const entity = data.market?.entity;
|
|
2691
|
+
if (!entity) {
|
|
2692
|
+
throw this.notFound(requestedTicker);
|
|
2693
|
+
}
|
|
2694
|
+
if (!entity.earningsPeriods) {
|
|
2695
|
+
throw new AlvaError(
|
|
2696
|
+
"MARKETS_EARNINGS_NOT_COVERED",
|
|
2697
|
+
`No earnings periods are available for ${entity.ticker}`,
|
|
2698
|
+
404,
|
|
2699
|
+
{ ticker: entity.ticker }
|
|
2700
|
+
);
|
|
2701
|
+
}
|
|
2702
|
+
return entity.earningsPeriods;
|
|
2703
|
+
}
|
|
2704
|
+
async earnings(params) {
|
|
2705
|
+
this.client._requireAuth();
|
|
2706
|
+
const ticker = normalizedTicker(params.ticker);
|
|
2707
|
+
const requestedEvent = params.event;
|
|
2708
|
+
const requestedFiscalYear = params.fiscalYear;
|
|
2709
|
+
const requestedFiscalQuarter = params.fiscalQuarter;
|
|
2710
|
+
const hasExplicitPeriod = requestedFiscalYear !== void 0 || requestedFiscalQuarter !== void 0;
|
|
2711
|
+
if (requestedEvent !== void 0 && hasExplicitPeriod) {
|
|
2712
|
+
throw new AlvaError(
|
|
2713
|
+
"INVALID_ARGUMENT",
|
|
2714
|
+
"event cannot be combined with fiscalYear or fiscalQuarter",
|
|
2715
|
+
400
|
|
2716
|
+
);
|
|
2717
|
+
}
|
|
2718
|
+
if (requestedFiscalYear === void 0 !== (requestedFiscalQuarter === void 0)) {
|
|
2719
|
+
throw new AlvaError(
|
|
2720
|
+
"INVALID_ARGUMENT",
|
|
2721
|
+
"fiscalYear and fiscalQuarter must be provided together",
|
|
2722
|
+
400
|
|
2723
|
+
);
|
|
2724
|
+
}
|
|
2725
|
+
if (requestedEvent !== void 0 && !EARNINGS_EVENTS.includes(requestedEvent)) {
|
|
2726
|
+
throw new AlvaError(
|
|
2727
|
+
"INVALID_ARGUMENT",
|
|
2728
|
+
`Unknown earnings event selector: ${requestedEvent}`,
|
|
2729
|
+
400
|
|
2730
|
+
);
|
|
2731
|
+
}
|
|
2732
|
+
if (requestedFiscalYear !== void 0 && (!Number.isInteger(requestedFiscalYear) || requestedFiscalYear < 1900 || requestedFiscalYear > 9999)) {
|
|
2733
|
+
throw new AlvaError(
|
|
2734
|
+
"INVALID_ARGUMENT",
|
|
2735
|
+
"fiscalYear must be an integer between 1900 and 9999",
|
|
2736
|
+
400
|
|
2737
|
+
);
|
|
2738
|
+
}
|
|
2739
|
+
if (requestedFiscalQuarter !== void 0 && !FISCAL_QUARTERS.includes(requestedFiscalQuarter)) {
|
|
2740
|
+
throw new AlvaError(
|
|
2741
|
+
"INVALID_ARGUMENT",
|
|
2742
|
+
"fiscalQuarter must be Q1, Q2, Q3, or Q4",
|
|
2743
|
+
400
|
|
2744
|
+
);
|
|
2745
|
+
}
|
|
2746
|
+
let fiscalYear;
|
|
2747
|
+
let fiscalQuarter;
|
|
2748
|
+
if (requestedFiscalYear !== void 0 && requestedFiscalQuarter !== void 0) {
|
|
2749
|
+
fiscalYear = requestedFiscalYear;
|
|
2750
|
+
fiscalQuarter = requestedFiscalQuarter;
|
|
2751
|
+
} else {
|
|
2752
|
+
const event = requestedEvent ?? "latest-completed";
|
|
2753
|
+
const catalog = await this.earningsPeriods(ticker);
|
|
2754
|
+
const period = this.selectPeriod(catalog, event, ticker);
|
|
2755
|
+
fiscalYear = period.fiscalYear;
|
|
2756
|
+
fiscalQuarter = period.fiscalQuarter;
|
|
2757
|
+
}
|
|
2758
|
+
const data = await this.graphql(EARNINGS_QUERY, {
|
|
2759
|
+
ticker,
|
|
2760
|
+
input: { fiscalYear, fiscalQuarter }
|
|
2761
|
+
});
|
|
2762
|
+
const entity = data.market?.entity;
|
|
2763
|
+
if (!entity) {
|
|
2764
|
+
throw this.notFound(ticker);
|
|
2765
|
+
}
|
|
2766
|
+
if (!entity.earnings) {
|
|
2767
|
+
throw new AlvaError(
|
|
2768
|
+
"MARKETS_EARNINGS_NOT_COVERED",
|
|
2769
|
+
`No earnings content is available for ${entity.ticker} FY${fiscalYear} ${fiscalQuarter}`,
|
|
2770
|
+
404,
|
|
2771
|
+
{ ticker: entity.ticker, fiscalYear, fiscalQuarter }
|
|
2772
|
+
);
|
|
2773
|
+
}
|
|
2774
|
+
return { ticker: entity.ticker, ...entity.earnings };
|
|
2775
|
+
}
|
|
2776
|
+
selectPeriod(catalog, event, ticker) {
|
|
2777
|
+
if (event === "latest-completed") {
|
|
2778
|
+
if (catalog.defaultPeriod) return catalog.defaultPeriod;
|
|
2779
|
+
} else {
|
|
2780
|
+
const upcoming = catalog.periods.filter((period) => period.status === "UPCOMING").sort((a, b) => a.earningsDate.localeCompare(b.earningsDate));
|
|
2781
|
+
if (upcoming.length > 0) return upcoming[0];
|
|
2782
|
+
}
|
|
2783
|
+
throw new AlvaError(
|
|
2784
|
+
"MARKETS_EARNINGS_EVENT_NOT_FOUND",
|
|
2785
|
+
`No ${event} earnings event is available for ${ticker}`,
|
|
2786
|
+
404,
|
|
2787
|
+
{ ticker, event }
|
|
2788
|
+
);
|
|
2789
|
+
}
|
|
2790
|
+
notFound(ticker) {
|
|
2791
|
+
return new AlvaError(
|
|
2792
|
+
"MARKETS_ENTITY_NOT_FOUND",
|
|
2793
|
+
`No stock entity was found for ${ticker}`,
|
|
2794
|
+
404,
|
|
2795
|
+
{ ticker }
|
|
2796
|
+
);
|
|
2797
|
+
}
|
|
2798
|
+
async graphql(query, variables) {
|
|
2799
|
+
const response = await this.client._request("POST", "/query", {
|
|
2800
|
+
body: { query, variables }
|
|
2801
|
+
});
|
|
2802
|
+
if (response.errors && response.errors.length > 0) {
|
|
2803
|
+
throw new AlvaError(
|
|
2804
|
+
"GRAPHQL_ERROR",
|
|
2805
|
+
graphQLErrorMessage2(response.errors),
|
|
2806
|
+
400,
|
|
2807
|
+
{ errors: response.errors }
|
|
2808
|
+
);
|
|
2809
|
+
}
|
|
2810
|
+
if (!response.data) {
|
|
2811
|
+
throw new AlvaError(
|
|
2812
|
+
"GRAPHQL_EMPTY_RESPONSE",
|
|
2813
|
+
"GraphQL response did not include data",
|
|
2814
|
+
502
|
|
2815
|
+
);
|
|
2816
|
+
}
|
|
2817
|
+
return response.data;
|
|
2818
|
+
}
|
|
2819
|
+
};
|
|
2820
|
+
|
|
2508
2821
|
// src/client.ts
|
|
2509
2822
|
var DEFAULT_BASE_URL = "https://api-llm.prd.alva.ai";
|
|
2510
2823
|
var DEFAULT_ARRAYS_BASE_URL = "https://data-tools.prd.space.id";
|
|
@@ -2612,6 +2925,7 @@ var AlvaClient = class {
|
|
|
2612
2925
|
_feedback;
|
|
2613
2926
|
_functions;
|
|
2614
2927
|
_credits;
|
|
2928
|
+
_markets;
|
|
2615
2929
|
constructor(config) {
|
|
2616
2930
|
this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
|
|
2617
2931
|
this.arraysBaseUrl = config.arraysBaseUrl ?? DEFAULT_ARRAYS_BASE_URL;
|
|
@@ -2706,6 +3020,9 @@ var AlvaClient = class {
|
|
|
2706
3020
|
get credits() {
|
|
2707
3021
|
return this._credits ??= new CreditsResource(this);
|
|
2708
3022
|
}
|
|
3023
|
+
get markets() {
|
|
3024
|
+
return this._markets ??= new MarketsResource(this);
|
|
3025
|
+
}
|
|
2709
3026
|
_requireAuth() {
|
|
2710
3027
|
if (!this.pbsvToken && !this.viewer_token && !this.apiKey) {
|
|
2711
3028
|
throw new AlvaError(
|
|
@@ -3307,13 +3624,14 @@ var installPlaybookRuntime = (targetWindow) => {
|
|
|
3307
3624
|
};
|
|
3308
3625
|
|
|
3309
3626
|
// src/index.ts
|
|
3310
|
-
var VERSION = true ? "0.
|
|
3627
|
+
var VERSION = true ? "0.23.0" : "dev";
|
|
3311
3628
|
export {
|
|
3312
3629
|
AlertsResource,
|
|
3313
3630
|
AlvaClient,
|
|
3314
3631
|
AlvaError,
|
|
3315
3632
|
AutomationResource,
|
|
3316
3633
|
CliUsageError,
|
|
3634
|
+
MarketsResource,
|
|
3317
3635
|
PBSV_UPDATE_MESSAGE,
|
|
3318
3636
|
SUBSCRIBE_PROPOSE_MESSAGE,
|
|
3319
3637
|
SUBSCRIBE_RESULT_MESSAGE,
|