@adaptic/utils 0.0.376 → 0.0.378
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.cjs +94 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +95 -22
- package/dist/index.mjs.map +1 -1
- package/dist/types/adaptic.d.ts +35 -1
- package/dist/types/adaptic.d.ts.map +1 -1
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/types/adaptic.d.ts
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
import { AssetOverviewResponse } from './types';
|
|
2
|
+
import { type TokenProvider } from '@adaptic/backend-legacy';
|
|
3
|
+
export type { TokenProvider };
|
|
2
4
|
type ApolloClientType = any;
|
|
5
|
+
/**
|
|
6
|
+
* Configure the Apollo client authentication with a dynamic token provider.
|
|
7
|
+
* This should be called once during app initialization before making any
|
|
8
|
+
* @adaptic/backend-legacy API calls.
|
|
9
|
+
*
|
|
10
|
+
* The token provider function will be called for each GraphQL request,
|
|
11
|
+
* allowing for dynamic token retrieval (e.g., from session storage, SecretsManager, etc.)
|
|
12
|
+
*
|
|
13
|
+
* @param provider - Function that returns the auth token (sync or async)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Configure with an environment variable
|
|
17
|
+
* configureAuth(() => process.env.GRAPHQL_API_KEY || '');
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Configure with NextAuth session token (async)
|
|
21
|
+
* configureAuth(async () => {
|
|
22
|
+
* const session = await auth();
|
|
23
|
+
* return session?.accessToken || '';
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Configure with SecretsManager
|
|
28
|
+
* configureAuth(() => {
|
|
29
|
+
* const secrets = getSecretsManager();
|
|
30
|
+
* return secrets.getGraphQLConfig().apiKey || '';
|
|
31
|
+
* });
|
|
32
|
+
*/
|
|
33
|
+
export declare const configureAuth: (provider: TokenProvider) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Check if Apollo auth has been configured.
|
|
36
|
+
*/
|
|
37
|
+
export declare const isAuthConfigured: () => boolean;
|
|
3
38
|
/**
|
|
4
39
|
* Returns a shared Apollo client instance with connection pooling.
|
|
5
40
|
* This should be used for all @adaptic/backend-legacy operations.
|
|
@@ -14,5 +49,4 @@ export declare const getSharedApolloClient: () => Promise<ApolloClientType>;
|
|
|
14
49
|
* @returns {Promise<AssetOverviewResponse>} - A promise that resolves to the asset overview response.
|
|
15
50
|
*/
|
|
16
51
|
export declare const fetchAssetOverview: (symbol: string) => Promise<AssetOverviewResponse>;
|
|
17
|
-
export {};
|
|
18
52
|
//# sourceMappingURL=adaptic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptic.d.ts","sourceRoot":"","sources":["../../src/adaptic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAiB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"adaptic.d.ts","sourceRoot":"","sources":["../../src/adaptic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAiB,MAAM,SAAS,CAAC;AAC/D,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EAAE,aAAa,EAAE,CAAC;AAG9B,KAAK,gBAAgB,GAAG,GAAG,CAAC;AAQ5B;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,aAAa,KAAG,IAcvD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAO,OAEnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAa,OAAO,CAAC,gBAAgB,CAWtE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,qBAAqB,CA0DtF,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import * as Types from './types';
|
|
|
9
9
|
import * as misc from './misc-utils';
|
|
10
10
|
import * as polygon from './polygon';
|
|
11
11
|
import * as av from './alphavantage';
|
|
12
|
+
import * as backend from './adaptic';
|
|
12
13
|
import * as crypto from './crypto';
|
|
13
14
|
import * as ta from './technical-analysis';
|
|
14
15
|
export { StampedeProtectedCache, createStampedeProtectedCache, DEFAULT_CACHE_OPTIONS, type StampedeProtectedCacheOptions, type CacheEntry, type CacheStats, type CacheLoader, } from './cache/stampede-protected-cache';
|
|
@@ -19,11 +20,14 @@ export { AlpacaTradingAPI } from './alpaca-trading-api';
|
|
|
19
20
|
export { AlpacaMarketDataAPI } from './alpaca-market-data-api';
|
|
20
21
|
export declare const createAlpacaTradingAPI: (credentials: Types.AlpacaCredentials) => Types.AlpacaTradingAPI;
|
|
21
22
|
export declare const createAlpacaMarketDataAPI: () => Types.AlpacaMarketDataAPI;
|
|
23
|
+
export type { TokenProvider } from './adaptic';
|
|
22
24
|
export declare const adaptic: {
|
|
23
25
|
types: typeof Types;
|
|
24
26
|
backend: {
|
|
25
27
|
fetchAssetOverview: (symbol: string) => Promise<Types.AssetOverviewResponse>;
|
|
26
28
|
getApolloClient: () => Promise<any>;
|
|
29
|
+
configureAuth: (provider: backend.TokenProvider) => void;
|
|
30
|
+
isAuthConfigured: () => boolean;
|
|
27
31
|
};
|
|
28
32
|
alpaca: {
|
|
29
33
|
TradingAPI: typeof Types.AlpacaTradingAPI;
|
|
@@ -224,6 +228,8 @@ export declare const adptc: {
|
|
|
224
228
|
backend: {
|
|
225
229
|
fetchAssetOverview: (symbol: string) => Promise<Types.AssetOverviewResponse>;
|
|
226
230
|
getApolloClient: () => Promise<any>;
|
|
231
|
+
configureAuth: (provider: backend.TokenProvider) => void;
|
|
232
|
+
isAuthConfigured: () => boolean;
|
|
227
233
|
};
|
|
228
234
|
alpaca: {
|
|
229
235
|
TradingAPI: typeof Types.AlpacaTradingAPI;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,iBAAiB,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,iBAAiB,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC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AC;iBAAmB,CAAC;gBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAJv/B,CAAC;AAEF,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA3JoB,CAAC;;;iBAiFnB,CAAC;eAAW,CAAC;iBAC7B,CAAC;kBAAgB,CAAC;gBAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBArFjC,CAAC;;;kBAgK+gL,CAAC;oBAAsB,CAAC;sBAAyB,CAAC;;;kBAzDlkL,CAAJ;;;kBAyD2zX,CAAC;qBAAuB,CAAC;uBAAkC,CAAC;wBAAmC,CAAC;uBAAkC,CAAC;wBAAmC,CAAC;iBAA4B,CAAC;iBAA2B,CAAC;gBAAkB,CAAC;;;;;eAAz6W,CAAC;;;iBAAiE,CAAC;;kBAAmC,CAAC;;;;;kBAA60Q,CAAC;oBAAsB,CAAC;;;;;;kBAjJ9kS,CAAC;;;kBAgDuB,CAAC;;;kBAyCxB,CAAF;;;kBAgCc,CAAA;;;kBAwBy5B,CAAC;gBAAkB,CAAC;iBAAmB,CAAC;iBAAmB,CAAC;gBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAF59B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptic/utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.378",
|
|
4
4
|
"author": "Adaptic.ai",
|
|
5
5
|
"description": "Utility functions used in Adaptic app and Lambda functions",
|
|
6
6
|
"always-build-npm": true,
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"test": "npm run build && node dist/test.js"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@adaptic/backend-legacy": "^0.0.
|
|
28
|
+
"@adaptic/backend-legacy": "^0.0.38",
|
|
29
29
|
"@adaptic/lumic-utils": "^1.0.6",
|
|
30
30
|
"@apollo/client": "^3.13.8",
|
|
31
31
|
"chalk": "^5.4.1",
|
|
@@ -54,4 +54,4 @@
|
|
|
54
54
|
"rollup-cli": "^1.0.9",
|
|
55
55
|
"typescript": "^5.8.3"
|
|
56
56
|
}
|
|
57
|
-
}
|
|
57
|
+
}
|