@zeitvu97/cms-sdk 0.1.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/LICENSE +21 -0
- package/README.md +478 -0
- package/dist/chunks/_shared-48T7q0V3.js +26 -0
- package/dist/chunks/_shared-48T7q0V3.js.map +1 -0
- package/dist/chunks/auth.constant-DO7ZmsKg.js +68 -0
- package/dist/chunks/auth.constant-DO7ZmsKg.js.map +1 -0
- package/dist/chunks/mt5Retcode-DlZLQOLA.js +178 -0
- package/dist/chunks/mt5Retcode-DlZLQOLA.js.map +1 -0
- package/dist/chunks/storage.constant--64BDSPW.js +44 -0
- package/dist/chunks/storage.constant--64BDSPW.js.map +1 -0
- package/dist/common/constants/auth.constant.d.ts +54 -0
- package/dist/common/constants/auth.constant.d.ts.map +1 -0
- package/dist/common/constants/bars.constant.d.ts +15 -0
- package/dist/common/constants/bars.constant.d.ts.map +1 -0
- package/dist/common/constants/content-types.constant.d.ts +29 -0
- package/dist/common/constants/content-types.constant.d.ts.map +1 -0
- package/dist/common/constants/content.constant.d.ts +114 -0
- package/dist/common/constants/content.constant.d.ts.map +1 -0
- package/dist/common/constants/executions.constant.d.ts +56 -0
- package/dist/common/constants/executions.constant.d.ts.map +1 -0
- package/dist/common/constants/gov.constant.d.ts +118 -0
- package/dist/common/constants/gov.constant.d.ts.map +1 -0
- package/dist/common/constants/history.constant.d.ts +108 -0
- package/dist/common/constants/history.constant.d.ts.map +1 -0
- package/dist/common/constants/http.constant.d.ts +46 -0
- package/dist/common/constants/http.constant.d.ts.map +1 -0
- package/dist/common/constants/index.d.ts +16 -0
- package/dist/common/constants/index.d.ts.map +1 -0
- package/dist/common/constants/kalshi.constant.d.ts +35 -0
- package/dist/common/constants/kalshi.constant.d.ts.map +1 -0
- package/dist/common/constants/llm.constant.d.ts +37 -0
- package/dist/common/constants/llm.constant.d.ts.map +1 -0
- package/dist/common/constants/mt5-action.constant.d.ts +131 -0
- package/dist/common/constants/mt5-action.constant.d.ts.map +1 -0
- package/dist/common/constants/mt5.constant.d.ts +254 -0
- package/dist/common/constants/mt5.constant.d.ts.map +1 -0
- package/dist/common/constants/notifications.constant.d.ts +45 -0
- package/dist/common/constants/notifications.constant.d.ts.map +1 -0
- package/dist/common/constants/people.constant.d.ts +269 -0
- package/dist/common/constants/people.constant.d.ts.map +1 -0
- package/dist/common/constants/rules.constant.d.ts +14 -0
- package/dist/common/constants/rules.constant.d.ts.map +1 -0
- package/dist/common/constants/settings.constant.d.ts +17 -0
- package/dist/common/constants/settings.constant.d.ts.map +1 -0
- package/dist/common/constants/sort.constant.d.ts +14 -0
- package/dist/common/constants/sort.constant.d.ts.map +1 -0
- package/dist/common/constants/storage.constant.d.ts +74 -0
- package/dist/common/constants/storage.constant.d.ts.map +1 -0
- package/dist/common/helpers/format.d.ts +7 -0
- package/dist/common/helpers/format.d.ts.map +1 -0
- package/dist/common/helpers/format.js +20 -0
- package/dist/common/helpers/format.js.map +1 -0
- package/dist/common/helpers/mt5Retcode.d.ts +18 -0
- package/dist/common/helpers/mt5Retcode.d.ts.map +1 -0
- package/dist/common/helpers/mt5Retcode.js +2 -0
- package/dist/common/helpers/mt5Retcode.js.map +1 -0
- package/dist/common/utils/case.d.ts +12 -0
- package/dist/common/utils/case.d.ts.map +1 -0
- package/dist/common/utils/clone.d.ts +9 -0
- package/dist/common/utils/clone.d.ts.map +1 -0
- package/dist/composables/cbsStateKey.d.ts +27 -0
- package/dist/composables/cbsStateKey.d.ts.map +1 -0
- package/dist/core/createApi.d.ts +69 -0
- package/dist/core/createApi.d.ts.map +1 -0
- package/dist/core/createCmsSDK.d.ts +19 -0
- package/dist/core/createCmsSDK.d.ts.map +1 -0
- package/dist/core/credentials/TokenManager.d.ts +38 -0
- package/dist/core/credentials/TokenManager.d.ts.map +1 -0
- package/dist/core/credentials/credential.type.d.ts +16 -0
- package/dist/core/credentials/credential.type.d.ts.map +1 -0
- package/dist/core/credentials/resolveStorage.d.ts +6 -0
- package/dist/core/credentials/resolveStorage.d.ts.map +1 -0
- package/dist/core/credentials/storages/cookieStorage.d.ts +18 -0
- package/dist/core/credentials/storages/cookieStorage.d.ts.map +1 -0
- package/dist/core/credentials/storages/localStorageAdapter.d.ts +8 -0
- package/dist/core/credentials/storages/localStorageAdapter.d.ts.map +1 -0
- package/dist/core/credentials/storages/memoryStorage.d.ts +7 -0
- package/dist/core/credentials/storages/memoryStorage.d.ts.map +1 -0
- package/dist/core/errors.d.ts +26 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/sdk.type.d.ts +115 -0
- package/dist/core/sdk.type.d.ts.map +1 -0
- package/dist/core/ws/createEaeraWebSocket.d.ts +21 -0
- package/dist/core/ws/createEaeraWebSocket.d.ts.map +1 -0
- package/dist/core/ws/index.d.ts +4 -0
- package/dist/core/ws/index.d.ts.map +1 -0
- package/dist/core/ws/ws.constants.d.ts +246 -0
- package/dist/core/ws/ws.constants.d.ts.map +1 -0
- package/dist/core/ws/ws.events.d.ts +264 -0
- package/dist/core/ws/ws.events.d.ts.map +1 -0
- package/dist/core/ws/ws.type.d.ts +225 -0
- package/dist/core/ws/ws.type.d.ts.map +1 -0
- package/dist/index.d.ts +130 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8416 -0
- package/dist/index.js.map +1 -0
- package/dist/nuxt.d.ts +49 -0
- package/dist/nuxt.d.ts.map +1 -0
- package/dist/nuxt.js +47 -0
- package/dist/nuxt.js.map +1 -0
- package/dist/runtime/plugin.d.ts +6 -0
- package/dist/runtime/plugin.js +188 -0
- package/dist/runtime/plugin.js.map +1 -0
- package/dist/server/auth/cbs-callback.post.js +42 -0
- package/dist/server/auth/cbs-callback.post.js.map +1 -0
- package/dist/server/auth/cbs-start.post.js +34 -0
- package/dist/server/auth/cbs-start.post.js.map +1 -0
- package/dist/server/auth/idp-callback.get.js +52 -0
- package/dist/server/auth/idp-callback.get.js.map +1 -0
- package/dist/server/auth/idp-link.post.js +38 -0
- package/dist/server/auth/idp-link.post.js.map +1 -0
- package/dist/server/auth/idp-login.get.js +42 -0
- package/dist/server/auth/idp-login.get.js.map +1 -0
- package/dist/server/auth/idp-unlink.delete.js +38 -0
- package/dist/server/auth/idp-unlink.delete.js.map +1 -0
- package/dist/server/auth/login.post.js +42 -0
- package/dist/server/auth/login.post.js.map +1 -0
- package/dist/server/auth/logout.post.js +31 -0
- package/dist/server/auth/logout.post.js.map +1 -0
- package/dist/server/auth/refresh.post.js +46 -0
- package/dist/server/auth/refresh.post.js.map +1 -0
- package/dist/server/clear-token.delete.js +12 -0
- package/dist/server/clear-token.delete.js.map +1 -0
- package/dist/server/persist.post.js +31 -0
- package/dist/server/persist.post.js.map +1 -0
- package/dist/server/set-token.post.js +27 -0
- package/dist/server/set-token.post.js.map +1 -0
- package/dist/services/auth/auth.type.d.ts +66 -0
- package/dist/services/auth/auth.type.d.ts.map +1 -0
- package/dist/services/auth/index.d.ts +127 -0
- package/dist/services/auth/index.d.ts.map +1 -0
- package/dist/services/auth/mock.d.ts +13 -0
- package/dist/services/auth/mock.d.ts.map +1 -0
- package/dist/services/bars/bars.type.d.ts +78 -0
- package/dist/services/bars/bars.type.d.ts.map +1 -0
- package/dist/services/bars/index.d.ts +24 -0
- package/dist/services/bars/index.d.ts.map +1 -0
- package/dist/services/bars/mock.d.ts +23 -0
- package/dist/services/bars/mock.d.ts.map +1 -0
- package/dist/services/content/content.type.d.ts +832 -0
- package/dist/services/content/content.type.d.ts.map +1 -0
- package/dist/services/content/filter.d.ts +46 -0
- package/dist/services/content/filter.d.ts.map +1 -0
- package/dist/services/content/index.d.ts +35 -0
- package/dist/services/content/index.d.ts.map +1 -0
- package/dist/services/content/mock.d.ts +16 -0
- package/dist/services/content/mock.d.ts.map +1 -0
- package/dist/services/content-types/content-types.type.d.ts +70 -0
- package/dist/services/content-types/content-types.type.d.ts.map +1 -0
- package/dist/services/content-types/index.d.ts +18 -0
- package/dist/services/content-types/index.d.ts.map +1 -0
- package/dist/services/content-types/mock.d.ts +15 -0
- package/dist/services/content-types/mock.d.ts.map +1 -0
- package/dist/services/executions/executions.type.d.ts +67 -0
- package/dist/services/executions/executions.type.d.ts.map +1 -0
- package/dist/services/executions/index.d.ts +30 -0
- package/dist/services/executions/index.d.ts.map +1 -0
- package/dist/services/executions/mock.d.ts +29 -0
- package/dist/services/executions/mock.d.ts.map +1 -0
- package/dist/services/gov/gov.type.d.ts +740 -0
- package/dist/services/gov/gov.type.d.ts.map +1 -0
- package/dist/services/gov/index.d.ts +84 -0
- package/dist/services/gov/index.d.ts.map +1 -0
- package/dist/services/history/history.type.d.ts +167 -0
- package/dist/services/history/history.type.d.ts.map +1 -0
- package/dist/services/history/index.d.ts +38 -0
- package/dist/services/history/index.d.ts.map +1 -0
- package/dist/services/history/mock.d.ts +21 -0
- package/dist/services/history/mock.d.ts.map +1 -0
- package/dist/services/kalshi/index.d.ts +19 -0
- package/dist/services/kalshi/index.d.ts.map +1 -0
- package/dist/services/kalshi/kalshi.type.d.ts +99 -0
- package/dist/services/kalshi/kalshi.type.d.ts.map +1 -0
- package/dist/services/kalshi/mock.d.ts +5 -0
- package/dist/services/kalshi/mock.d.ts.map +1 -0
- package/dist/services/llm/index.d.ts +38 -0
- package/dist/services/llm/index.d.ts.map +1 -0
- package/dist/services/llm/llm.type.d.ts +106 -0
- package/dist/services/llm/llm.type.d.ts.map +1 -0
- package/dist/services/notifications/index.d.ts +38 -0
- package/dist/services/notifications/index.d.ts.map +1 -0
- package/dist/services/notifications/mock.d.ts +39 -0
- package/dist/services/notifications/mock.d.ts.map +1 -0
- package/dist/services/notifications/notifications.type.d.ts +75 -0
- package/dist/services/notifications/notifications.type.d.ts.map +1 -0
- package/dist/services/people/_invoke.d.ts +26 -0
- package/dist/services/people/_invoke.d.ts.map +1 -0
- package/dist/services/people/copilot/index.d.ts +132 -0
- package/dist/services/people/copilot/index.d.ts.map +1 -0
- package/dist/services/people/identity/actions.d.ts +116 -0
- package/dist/services/people/identity/actions.d.ts.map +1 -0
- package/dist/services/people/identity/ct.types.d.ts +133 -0
- package/dist/services/people/identity/ct.types.d.ts.map +1 -0
- package/dist/services/people/identity/index.d.ts +14 -0
- package/dist/services/people/identity/index.d.ts.map +1 -0
- package/dist/services/people/identity/projections.d.ts +63 -0
- package/dist/services/people/identity/projections.d.ts.map +1 -0
- package/dist/services/people/index.d.ts +31 -0
- package/dist/services/people/index.d.ts.map +1 -0
- package/dist/services/people/legal/actions.d.ts +161 -0
- package/dist/services/people/legal/actions.d.ts.map +1 -0
- package/dist/services/people/legal/ct.types.d.ts +186 -0
- package/dist/services/people/legal/ct.types.d.ts.map +1 -0
- package/dist/services/people/legal/index.d.ts +15 -0
- package/dist/services/people/legal/index.d.ts.map +1 -0
- package/dist/services/people/packops/index.d.ts +70 -0
- package/dist/services/people/packops/index.d.ts.map +1 -0
- package/dist/services/people/packops/packops.type.d.ts +183 -0
- package/dist/services/people/packops/packops.type.d.ts.map +1 -0
- package/dist/services/people/perms/actions.d.ts +214 -0
- package/dist/services/people/perms/actions.d.ts.map +1 -0
- package/dist/services/people/perms/ct.types.d.ts +140 -0
- package/dist/services/people/perms/ct.types.d.ts.map +1 -0
- package/dist/services/people/perms/index.d.ts +14 -0
- package/dist/services/people/perms/index.d.ts.map +1 -0
- package/dist/services/people/perms/projections.d.ts +47 -0
- package/dist/services/people/perms/projections.d.ts.map +1 -0
- package/dist/services/people/process/actions.d.ts +154 -0
- package/dist/services/people/process/actions.d.ts.map +1 -0
- package/dist/services/people/process/ct.types.d.ts +304 -0
- package/dist/services/people/process/ct.types.d.ts.map +1 -0
- package/dist/services/people/process/index.d.ts +12 -0
- package/dist/services/people/process/index.d.ts.map +1 -0
- package/dist/services/people/shared.types.d.ts +36 -0
- package/dist/services/people/shared.types.d.ts.map +1 -0
- package/dist/services/rules/conditions.d.ts +264 -0
- package/dist/services/rules/conditions.d.ts.map +1 -0
- package/dist/services/rules/index.d.ts +49 -0
- package/dist/services/rules/index.d.ts.map +1 -0
- package/dist/services/rules/llm-rule.constant.d.ts +84 -0
- package/dist/services/rules/llm-rule.constant.d.ts.map +1 -0
- package/dist/services/rules/mock.d.ts +20 -0
- package/dist/services/rules/mock.d.ts.map +1 -0
- package/dist/services/rules/rules.type.d.ts +262 -0
- package/dist/services/rules/rules.type.d.ts.map +1 -0
- package/dist/services/rules/triggers.d.ts +140 -0
- package/dist/services/rules/triggers.d.ts.map +1 -0
- package/dist/services/settings/index.d.ts +36 -0
- package/dist/services/settings/index.d.ts.map +1 -0
- package/dist/services/settings/mock.d.ts +14 -0
- package/dist/services/settings/mock.d.ts.map +1 -0
- package/dist/services/settings/settings.type.d.ts +39 -0
- package/dist/services/settings/settings.type.d.ts.map +1 -0
- package/dist/stores/auth.d.ts +192 -0
- package/dist/stores/auth.d.ts.map +1 -0
- package/dist/stores/bars.d.ts +288 -0
- package/dist/stores/bars.d.ts.map +1 -0
- package/dist/stores/content.d.ts +4101 -0
- package/dist/stores/content.d.ts.map +1 -0
- package/dist/stores/executions.d.ts +249 -0
- package/dist/stores/executions.d.ts.map +1 -0
- package/dist/stores/gov.d.ts +238 -0
- package/dist/stores/gov.d.ts.map +1 -0
- package/dist/stores/history.d.ts +833 -0
- package/dist/stores/history.d.ts.map +1 -0
- package/dist/stores/index.d.ts +15 -0
- package/dist/stores/index.d.ts.map +1 -0
- package/dist/stores/kalshi.d.ts +728 -0
- package/dist/stores/kalshi.d.ts.map +1 -0
- package/dist/stores/llm-providers.d.ts +97 -0
- package/dist/stores/llm-providers.d.ts.map +1 -0
- package/dist/stores/llm.d.ts +102 -0
- package/dist/stores/llm.d.ts.map +1 -0
- package/dist/stores/people.d.ts +596 -0
- package/dist/stores/people.d.ts.map +1 -0
- package/dist/stores/persist.d.ts +58 -0
- package/dist/stores/persist.d.ts.map +1 -0
- package/dist/stores/rules.d.ts +485 -0
- package/dist/stores/rules.d.ts.map +1 -0
- package/dist/stores/settings.d.ts +36 -0
- package/dist/stores/settings.d.ts.map +1 -0
- package/dist/stores/ws.d.ts +66 -0
- package/dist/stores/ws.d.ts.map +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token storage constants — the single source for the storage key so the
|
|
3
|
+
* memory/localStorage/cookie adapters never drift apart.
|
|
4
|
+
*/
|
|
5
|
+
export declare const TOKEN_STORAGE_KEY: "cms_access_token";
|
|
6
|
+
/**
|
|
7
|
+
* Refresh-token cookie key. Stored as an httpOnly cookie (parallel to the access
|
|
8
|
+
* token) so the SDK can silently rotate the access token when it expires.
|
|
9
|
+
*/
|
|
10
|
+
export declare const REFRESH_TOKEN_STORAGE_KEY: "cms_refresh_token";
|
|
11
|
+
/** Cookie adapter defaults (overridable via `credentials.cookie`). */
|
|
12
|
+
export declare const COOKIE_DEFAULTS: {
|
|
13
|
+
readonly MAX_AGE_SECONDS: number;
|
|
14
|
+
readonly PATH: "/";
|
|
15
|
+
readonly SECURE: true;
|
|
16
|
+
readonly SAME_SITE: "Lax";
|
|
17
|
+
readonly HTTP_ONLY: true;
|
|
18
|
+
};
|
|
19
|
+
/** Pinia persistence keys (versioned for schema migration). */
|
|
20
|
+
export declare const STORE_PERSIST_KEY: {
|
|
21
|
+
readonly AUTH: "cms-auth-v1";
|
|
22
|
+
readonly CONTENT: "cms-content-v1";
|
|
23
|
+
readonly RULES: "cms-rules-v1";
|
|
24
|
+
readonly EXECUTIONS: "cms-executions-v1";
|
|
25
|
+
readonly SETTINGS: "cms-settings-v1";
|
|
26
|
+
readonly LLM: "cms-llm-v1";
|
|
27
|
+
readonly LLM_PROVIDERS: "cms-llm-providers-v1";
|
|
28
|
+
readonly BARS: "cms-bars-v1";
|
|
29
|
+
readonly HISTORY: "cms-history-v1";
|
|
30
|
+
readonly KALSHI: "cms-kalshi-v1";
|
|
31
|
+
readonly GOV: "cms-gov-v1";
|
|
32
|
+
readonly PEOPLE: "cms-people-v1";
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Internal cookie persistence (replaces pinia-plugin-persistedstate).
|
|
36
|
+
*
|
|
37
|
+
* Each persisted state → its own cookie `${PERSIST_KEY.<store>}.${field}`.
|
|
38
|
+
* The common `/api/cms-sdk/persist` endpoint may only set keys in
|
|
39
|
+
* `PERSIST_ALLOWED_KEYS` (single source of truth, shared by the plugin + the
|
|
40
|
+
* endpoint). The token key is always excluded as a belt-and-suspenders guard.
|
|
41
|
+
*/
|
|
42
|
+
export declare const PERSIST_PREFIX: "cms-persist-";
|
|
43
|
+
export declare const PERSIST_KEY: {
|
|
44
|
+
readonly AUTH: "cms-persist-auth";
|
|
45
|
+
};
|
|
46
|
+
/** Max bytes per persisted cookie value (~4KB cookie cap, with headroom). */
|
|
47
|
+
export declare const PERSIST_MAX_BYTES = 3500;
|
|
48
|
+
/** Allowlist of cookie keys the persist endpoint may set. */
|
|
49
|
+
export declare const PERSIST_ALLOWED_KEYS: readonly ["cms-persist-auth.authUser"];
|
|
50
|
+
/**
|
|
51
|
+
* Storage backend names accepted by `TokenManager`. Kept in sync with
|
|
52
|
+
* `IStorageName` in `core/credentials/credential.type.ts`. The
|
|
53
|
+
* `httpOnlyBridge` value is the recommended production backend (delegates
|
|
54
|
+
* to a Nuxt server route).
|
|
55
|
+
*/
|
|
56
|
+
export declare const STORAGE_NAME: {
|
|
57
|
+
readonly MEMORY: "memory";
|
|
58
|
+
readonly LOCAL_STORAGE: "localStorage";
|
|
59
|
+
readonly COOKIE: "cookie";
|
|
60
|
+
readonly HTTP_ONLY_BRIDGE: "httpOnlyBridge";
|
|
61
|
+
};
|
|
62
|
+
export type StorageName = (typeof STORAGE_NAME)[keyof typeof STORAGE_NAME];
|
|
63
|
+
/**
|
|
64
|
+
* `Cookie SameSite` values (RFC 6265). Used by `cookieStorage` and the
|
|
65
|
+
* SDK Nuxt module when setting the httpOnly access-token cookie. Mirrors
|
|
66
|
+
* the `CookieSameSite` type in `core/credentials/storages/cookieStorage.ts`.
|
|
67
|
+
*/
|
|
68
|
+
export declare const COOKIE_SAME_SITE: {
|
|
69
|
+
readonly STRICT: "Strict";
|
|
70
|
+
readonly LAX: "Lax";
|
|
71
|
+
readonly NONE: "None";
|
|
72
|
+
};
|
|
73
|
+
export type CookieSameSite = (typeof COOKIE_SAME_SITE)[keyof typeof COOKIE_SAME_SITE];
|
|
74
|
+
//# sourceMappingURL=storage.constant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.constant.d.ts","sourceRoot":"","sources":["../../../src/common/constants/storage.constant.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAG,kBAA2B,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAG,mBAA4B,CAAC;AAEtE,sEAAsE;AACtE,eAAO,MAAM,eAAe;;;;;;CAMlB,CAAC;AAEX,+DAA+D;AAC/D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;CAapB,CAAC;AAEX;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,EAAG,cAAuB,CAAC;AAEtD,eAAO,MAAM,WAAW;;CAEd,CAAC;AAEX,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC,6DAA6D;AAC7D,eAAO,MAAM,oBAAoB,wCAA4C,CAAC;AAE9E;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE3E;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Format a price to a symbol's digit precision. */
|
|
2
|
+
export declare function formatPrice(value: number, digits?: number): string;
|
|
3
|
+
/** Compute spread from bid/ask at a given precision. */
|
|
4
|
+
export declare function computeSpread(bid: number, ask: number, digits?: number): number;
|
|
5
|
+
/** Human label for a symbol category. */
|
|
6
|
+
export declare function categoryLabel(category: string): string;
|
|
7
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/common/helpers/format.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,MAAM,CAE7D;AAED,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,MAAM,CAE1E;AAED,yCAAyC;AACzC,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAUtD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function formatPrice(value, digits = 5) {
|
|
2
|
+
return value.toFixed(digits);
|
|
3
|
+
}
|
|
4
|
+
function computeSpread(bid, ask, digits = 5) {
|
|
5
|
+
return Number((ask - bid).toFixed(digits));
|
|
6
|
+
}
|
|
7
|
+
function categoryLabel(category) {
|
|
8
|
+
const map = {
|
|
9
|
+
fx: "Forex",
|
|
10
|
+
metal: "Metals",
|
|
11
|
+
crypto: "Crypto",
|
|
12
|
+
index: "Indices",
|
|
13
|
+
stock: "Stocks",
|
|
14
|
+
energy: "Energy"
|
|
15
|
+
};
|
|
16
|
+
return map[category] ?? category;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { categoryLabel, computeSpread, formatPrice };
|
|
20
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sources":["../../../src/common/helpers/format.ts"],"sourcesContent":["/** Format a price to a symbol's digit precision. */\nexport function formatPrice(value: number, digits = 5): string {\n return value.toFixed(digits);\n}\n\n/** Compute spread from bid/ask at a given precision. */\nexport function computeSpread(bid: number, ask: number, digits = 5): number {\n return Number((ask - bid).toFixed(digits));\n}\n\n/** Human label for a symbol category. */\nexport function categoryLabel(category: string): string {\n const map: Record<string, string> = {\n fx: 'Forex',\n metal: 'Metals',\n crypto: 'Crypto',\n index: 'Indices',\n stock: 'Stocks',\n energy: 'Energy',\n };\n return map[category] ?? category;\n}\n"],"names":[],"mappings":"AACO,SAAS,WAAA,CAAY,KAAA,EAAe,MAAA,GAAS,CAAA,EAAW;AAC7D,EAAA,OAAO,KAAA,CAAM,QAAQ,MAAM,CAAA;AAC7B;AAGO,SAAS,aAAA,CAAc,GAAA,EAAa,GAAA,EAAa,MAAA,GAAS,CAAA,EAAW;AAC1E,EAAA,OAAO,MAAA,CAAA,CAAQ,GAAA,GAAM,GAAA,EAAK,OAAA,CAAQ,MAAM,CAAC,CAAA;AAC3C;AAGO,SAAS,cAAc,QAAA,EAA0B;AACtD,EAAA,MAAM,GAAA,GAA8B;AAAA,IAClC,EAAA,EAAI,OAAA;AAAA,IACJ,KAAA,EAAO,QAAA;AAAA,IACP,MAAA,EAAQ,QAAA;AAAA,IACR,KAAA,EAAO,SAAA;AAAA,IACP,KAAA,EAAO,QAAA;AAAA,IACP,MAAA,EAAQ;AAAA,GACV;AACA,EAAA,OAAO,GAAA,CAAI,QAAQ,CAAA,IAAK,QAAA;AAC1B;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface IMt5RetcodeView {
|
|
2
|
+
/** Stable machine code (one of the MT5_RETCODE values). */
|
|
3
|
+
code: number;
|
|
4
|
+
/** Short human label, e.g. `PRICE_OFF_QUOTES`. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** One-line FE-facing message. */
|
|
7
|
+
message: string;
|
|
8
|
+
/** What the FE should do — surface a toast, re-quote, retry, etc. */
|
|
9
|
+
suggestion: 'show-as-rejected' | 'show-as-cancelled' | 're-quote-and-retry' | 'show-new-params' | 'show-no-quotes' | 'retry-shortly';
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Look up an MT5 broker retcode. Returns `null` if the code is unknown —
|
|
13
|
+
* FE should fall back to `error.message` from `action_result.error`.
|
|
14
|
+
*
|
|
15
|
+
* @param retcode — the integer from `action_result.output.data.retcode`
|
|
16
|
+
*/
|
|
17
|
+
export declare function viewMt5Retcode(retcode: number | null | undefined): IMt5RetcodeView | null;
|
|
18
|
+
//# sourceMappingURL=mt5Retcode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mt5Retcode.d.ts","sourceRoot":"","sources":["../../../src/common/helpers/mt5Retcode.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,eAAe;IAC9B,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,UAAU,EACN,kBAAkB,GAClB,mBAAmB,GACnB,oBAAoB,GACpB,iBAAiB,GACjB,gBAAgB,GAChB,eAAe,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,eAAe,GAAG,IAAI,CAiDzF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mt5Retcode.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep-transform an object's own keys to snake_case. Values are left untouched
|
|
3
|
+
* unless they are plain objects/arrays (recursed). Used by `createApi` when the
|
|
4
|
+
* consumer opts into `requestCasing: 'snake'` so request bodies match a backend
|
|
5
|
+
* expecting snake_case keys.
|
|
6
|
+
*
|
|
7
|
+
* Non-plain objects (URLSearchParams, FormData, Blob, Date, …) pass through.
|
|
8
|
+
*/
|
|
9
|
+
export declare function toSnakeCaseKeys<T>(value: T): T;
|
|
10
|
+
/** Convert a single camelCase / PascalCase key to snake_case. */
|
|
11
|
+
export declare function toSnake(key: string): string;
|
|
12
|
+
//# sourceMappingURL=case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"case.d.ts","sourceRoot":"","sources":["../../../src/common/utils/case.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAY9C;AAQD,iEAAiE;AACjE,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM3C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured deep clone for JSON-safe values.
|
|
3
|
+
*
|
|
4
|
+
* Used internally by mock resolvers so returned data can be mutated by the
|
|
5
|
+
* caller without affecting the shared fake dataset. Not exported publicly —
|
|
6
|
+
* it serves the SDK only.
|
|
7
|
+
*/
|
|
8
|
+
export declare function deepClone<T>(value: T): T;
|
|
9
|
+
//# sourceMappingURL=clone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../../../src/common/utils/clone.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAExC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CBS silent-login shared constants + state-key helpers (direct-fetch variant).
|
|
3
|
+
*
|
|
4
|
+
* Used by the webtrade iframe receiver (`eaera-webtrade` →
|
|
5
|
+
* `composables/useSilentLoginReceiver.ts`) when running embedded inside the
|
|
6
|
+
* super-app parent. The iframe persists the `stateKey` returned by
|
|
7
|
+
* `authStore.cbsStart()` here and reads it back when the parent posts the
|
|
8
|
+
* `eaera:silent-login:callback` message.
|
|
9
|
+
*/
|
|
10
|
+
/** localStorage key holding the CBS `stateKey`. */
|
|
11
|
+
export declare const CBS_STATE_KEY_STORAGE = "cms_sdk_cbs_state_key";
|
|
12
|
+
/** postMessage `type` discriminators for the silent-login handshake. */
|
|
13
|
+
export declare const SILENT_LOGIN_MESSAGE: {
|
|
14
|
+
/** parent → iframe: kick off the handshake. */
|
|
15
|
+
readonly START: "eaera:silent-login:start";
|
|
16
|
+
/** iframe → parent: CBS `authorizeUrl` ready for the parent to fetch. */
|
|
17
|
+
readonly AUTHORIZE_READY: "eaera:silent-login:authorize-ready";
|
|
18
|
+
/** parent → iframe: handshake failed (`code`). */
|
|
19
|
+
readonly ERROR: "eaera:silent-login:error";
|
|
20
|
+
/** parent → iframe: user logged out of the parent; tear down the session. */
|
|
21
|
+
readonly LOGOUT: "eaera:logout";
|
|
22
|
+
};
|
|
23
|
+
/** Read the persisted CBS `stateKey` (empty string when absent / non-browser). */
|
|
24
|
+
export declare function readCbsStateKey(): string;
|
|
25
|
+
/** Clear the persisted CBS `stateKey` (call after `/cbs/callback` settles). */
|
|
26
|
+
export declare function clearCbsStateKey(): void;
|
|
27
|
+
//# sourceMappingURL=cbsStateKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cbsStateKey.d.ts","sourceRoot":"","sources":["../../src/composables/cbsStateKey.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,mDAAmD;AACnD,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,wEAAwE;AACxE,eAAO,MAAM,oBAAoB;IAC/B,+CAA+C;;IAE/C,yEAAyE;;IAEzE,kDAAkD;;IAElD,6EAA6E;;CAErE,CAAC;AAEX,kFAAkF;AAClF,wBAAgB,eAAe,IAAI,MAAM,CAIxC;AAED,+EAA+E;AAC/E,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { $Fetch, FetchOptions } from 'ofetch';
|
|
2
|
+
import { RequestCasing, ResponseCasing } from '../common/constants/http.constant';
|
|
3
|
+
import { TokenManager } from './credentials/TokenManager';
|
|
4
|
+
import { CmsError } from './errors';
|
|
5
|
+
export interface IDeviceContext {
|
|
6
|
+
deviceId?: string | (() => string | null);
|
|
7
|
+
deviceIp?: string | (() => string | null);
|
|
8
|
+
}
|
|
9
|
+
export interface ICreateApiOptions {
|
|
10
|
+
baseURL: string;
|
|
11
|
+
tokenManager: TokenManager;
|
|
12
|
+
clientId?: string;
|
|
13
|
+
device?: IDeviceContext;
|
|
14
|
+
/** Default request timeout in ms. */
|
|
15
|
+
timeout?: number;
|
|
16
|
+
/** Retry count for transient failures. */
|
|
17
|
+
retry?: number;
|
|
18
|
+
/** Global handler invoked for every error AFTER normalisation. */
|
|
19
|
+
onError?: (error: CmsError) => void;
|
|
20
|
+
/** Invoked when a 401 is observed (e.g. force logout / redirect). */
|
|
21
|
+
onUnauthorized?: (error: CmsError) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Async hook called whenever the access token changes (login, refresh, 401).
|
|
24
|
+
* When provided, the hook fully owns token storage updates (including the
|
|
25
|
+
* underlying TokenManager). When omitted, createApi falls back to updating
|
|
26
|
+
* TokenManager directly.
|
|
27
|
+
*/
|
|
28
|
+
onToken?: (token: string | null) => void | Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Silent token refresh. When provided, a 401 triggers ONE refresh attempt:
|
|
31
|
+
* the returned token replaces the access token and the request is replayed
|
|
32
|
+
* (via ofetch's native retry). Return `null` to signal "refresh failed"
|
|
33
|
+
* (the SDK then clears the session + fires `onUnauthorized`).
|
|
34
|
+
*/
|
|
35
|
+
refresh?: () => Promise<string | null>;
|
|
36
|
+
/**
|
|
37
|
+
* Response casing to request from the backend. `'camel'` (default) sends no
|
|
38
|
+
* header (matches the backend default + the SDK's DTOs); `'snake'` sends
|
|
39
|
+
* `x-response-casing: snake`.
|
|
40
|
+
*/
|
|
41
|
+
responseCasing?: ResponseCasing;
|
|
42
|
+
/**
|
|
43
|
+
* Request casing, declared to the backend via the `x-request-casing` header.
|
|
44
|
+
* Default `'camel'` (no header; bodies keep the SDK's camelCase keys). `'snake'`
|
|
45
|
+
* deep-converts request body keys to snake_case and sends the header.
|
|
46
|
+
*/
|
|
47
|
+
requestCasing?: RequestCasing;
|
|
48
|
+
/** Extra per-request middlewares (the "dynamic interceptor" escape hatch). */
|
|
49
|
+
requestMiddlewares?: RequestMiddleware[];
|
|
50
|
+
}
|
|
51
|
+
export interface IRequestContext {
|
|
52
|
+
tokenManager: TokenManager;
|
|
53
|
+
}
|
|
54
|
+
/** Single request middleware. Return value is ignored; mutate `options`. */
|
|
55
|
+
export type RequestMiddleware = (options: FetchOptions, ctx: IRequestContext) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Build a typed `$Fetch` instance for one endpoint (CMS, report, …).
|
|
58
|
+
*
|
|
59
|
+
* Hooks:
|
|
60
|
+
* - `onRequest` → inject Authorization / DeviceID / DeviceIP / client_id
|
|
61
|
+
* - `onResponse` → sliding-session token refresh from response header
|
|
62
|
+
* - `onResponseError` → normalise to `CmsError`; on 401, silently refresh +
|
|
63
|
+
* replay once (when `refresh` is provided), else trigger `onUnauthorized`
|
|
64
|
+
*
|
|
65
|
+
* Multiple endpoints share the same `tokenManager` so a refresh from one
|
|
66
|
+
* backend is visible to all.
|
|
67
|
+
*/
|
|
68
|
+
export declare function createApi(opts: ICreateApiOptions): $Fetch;
|
|
69
|
+
//# sourceMappingURL=createApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createApi.d.ts","sourceRoot":"","sources":["../../src/core/createApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAgB,YAAY,EAAiB,MAAM,QAAQ,CAAC;AAEhF,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,YAAY,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IACpC,qEAAqE;IACrE,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC3C;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACvC;;;;OAIG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,8EAA8E;IAC9E,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,4EAA4E;AAC5E,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,eAAe,KAAK,IAAI,CAAC;AAEtF;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAiIzD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ICmsSDK, ICmsSDKOptions } from './sdk.type';
|
|
2
|
+
/**
|
|
3
|
+
* Build the CMS SDK facade.
|
|
4
|
+
*
|
|
5
|
+
* One call wires up: token storage → per-endpoint `$Fetch` instances
|
|
6
|
+
* (sharing one token + hooks) → domain services → mock toggle.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const sdk = createCmsSDK({
|
|
11
|
+
* endpoints: { cms: 'https://cms.example.com', report: 'https://r.example.com' },
|
|
12
|
+
* clientId: 'web',
|
|
13
|
+
* credentials: { storage: 'cookie' },
|
|
14
|
+
* mock: true,
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function createCmsSDK(options: ICmsSDKOptions): ICmsSDK;
|
|
19
|
+
//# sourceMappingURL=createCmsSDK.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCmsSDK.d.ts","sourceRoot":"","sources":["../../src/core/createCmsSDK.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAU,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGlE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAuO7D"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ITokenStorage } from './credential.type';
|
|
2
|
+
export interface ITokenManagerOptions {
|
|
3
|
+
/** Called after every (re)set with the new token — e.g. to sync realtime socket. */
|
|
4
|
+
onRefreshed?: (token: string) => void;
|
|
5
|
+
/** Header name carrying the token. Default `Authorization`. */
|
|
6
|
+
headerName?: string;
|
|
7
|
+
/** Prefix prepended to the header value. Default `Bearer `. Pass `''` for raw. */
|
|
8
|
+
prefix?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Single source of truth for the access token.
|
|
12
|
+
*
|
|
13
|
+
* The HTTP layer (createApi) reads via `getHeader()` in its `onRequest` hook
|
|
14
|
+
* and refreshes via `set()` in `onResponse` (sliding-session pattern). Pinia
|
|
15
|
+
* stores MUST NOT store the token — they read `currentToken` (a reactive Vue
|
|
16
|
+
* ref) for reactive access (e.g. `isLoggedIn`), or call `has()` for a
|
|
17
|
+
* one-shot check.
|
|
18
|
+
*/
|
|
19
|
+
export declare class TokenManager {
|
|
20
|
+
readonly headerName: string;
|
|
21
|
+
readonly prefix: string;
|
|
22
|
+
private readonly onRefreshed?;
|
|
23
|
+
private storage;
|
|
24
|
+
/** Reactive mirror of the stored token — the only reactive way to observe it. */
|
|
25
|
+
private readonly tokenRef;
|
|
26
|
+
constructor(storage: ITokenStorage, opts?: ITokenManagerOptions);
|
|
27
|
+
/** Reactive current token. Read this inside `computed` to track changes. */
|
|
28
|
+
get currentToken(): string | null;
|
|
29
|
+
get(): string | null;
|
|
30
|
+
/** Full header value ready to drop into a request (prefix + token). */
|
|
31
|
+
getHeader(): string | null;
|
|
32
|
+
has(): boolean;
|
|
33
|
+
set(token: string): void;
|
|
34
|
+
clear(): void;
|
|
35
|
+
/** Replace the underlying storage (e.g. upgrade memory → cookie after first login). */
|
|
36
|
+
swapStorage(storage: ITokenStorage): void;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=TokenManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenManager.d.ts","sourceRoot":"","sources":["../../../src/core/credentials/TokenManager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,WAAW,oBAAoB;IACnC,oFAAoF;IACpF,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,qBAAa,YAAY;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAA0B;IACvD,OAAO,CAAC,OAAO,CAAgB;IAC/B,iFAAiF;IACjF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;gBAElC,OAAO,EAAE,aAAa,EAAE,IAAI,GAAE,oBAAyB;IAQnE,4EAA4E;IAC5E,IAAI,YAAY,IAAI,MAAM,GAAG,IAAI,CAEhC;IAED,GAAG,IAAI,MAAM,GAAG,IAAI;IAIpB,uEAAuE;IACvE,SAAS,IAAI,MAAM,GAAG,IAAI;IAK1B,GAAG,IAAI,OAAO;IAId,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAOxB,KAAK,IAAI,IAAI;IAKb,uFAAuF;IACvF,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;CAO1C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StorageName } from '../../common/constants/storage.constant';
|
|
2
|
+
export type { StorageName };
|
|
3
|
+
export interface ITokenStorage {
|
|
4
|
+
get(): string | null;
|
|
5
|
+
set(token: string): void;
|
|
6
|
+
clear(): void;
|
|
7
|
+
}
|
|
8
|
+
/** Secondary device identifiers (DeviceID / DeviceIP) follow the same contract. */
|
|
9
|
+
export interface IDeviceStorage {
|
|
10
|
+
getDeviceId(): string | null;
|
|
11
|
+
setDeviceId(id: string): void;
|
|
12
|
+
getDeviceIp(): string | null;
|
|
13
|
+
setDeviceIp(ip: string): void;
|
|
14
|
+
clearDevice(): void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=credential.type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential.type.d.ts","sourceRoot":"","sources":["../../../src/core/credentials/credential.type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAE3E,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,MAAM,WAAW,aAAa;IAC5B,GAAG,IAAI,MAAM,GAAG,IAAI,CAAC;IACrB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,IAAI,IAAI,CAAC;CACf;AAED,mFAAmF;AACnF,MAAM,WAAW,cAAc;IAC7B,WAAW,IAAI,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,WAAW,IAAI,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,WAAW,IAAI,IAAI,CAAC;CACrB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ICookieStorageOptions } from './storages/cookieStorage';
|
|
2
|
+
import { StorageName, ITokenStorage } from './credential.type';
|
|
3
|
+
/** Pick a built-in storage by name. Pass options for the `cookie` backend. */
|
|
4
|
+
export declare function resolveStorage(name: StorageName, cookieOpts?: ICookieStorageOptions): ITokenStorage;
|
|
5
|
+
export type { ICookieStorageOptions } from './storages/cookieStorage';
|
|
6
|
+
//# sourceMappingURL=resolveStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveStorage.d.ts","sourceRoot":"","sources":["../../../src/core/credentials/resolveStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAAiB,MAAM,0BAA0B,CAAC;AAGrF,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEpE,8EAA8E;AAC9E,wBAAgB,cAAc,CAC5B,IAAI,EAAE,WAAW,EACjB,UAAU,CAAC,EAAE,qBAAqB,GACjC,aAAa,CAgBf;AAED,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CookieSameSite } from '../../../common/constants/storage.constant';
|
|
2
|
+
import { ITokenStorage } from '../credential.type';
|
|
3
|
+
export interface ICookieStorageOptions {
|
|
4
|
+
key?: string;
|
|
5
|
+
/** Seconds. Default = 30 days (see COOKIE_DEFAULTS). */
|
|
6
|
+
maxAge?: number;
|
|
7
|
+
domain?: string;
|
|
8
|
+
path?: string;
|
|
9
|
+
secure?: boolean;
|
|
10
|
+
sameSite?: CookieSameSite;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Cookie-backed token storage. Client-side only: it reads/writes
|
|
14
|
+
* `document.cookie`, so it no-ops during SSR. For Nuxt SSR token sharing,
|
|
15
|
+
* the `httpOnlyBridge` storage (delegating to a Nuxt server route) is planned.
|
|
16
|
+
*/
|
|
17
|
+
export declare function cookieStorage(opts?: ICookieStorageOptions): ITokenStorage;
|
|
18
|
+
//# sourceMappingURL=cookieStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookieStorage.d.ts","sourceRoot":"","sources":["../../../../src/core/credentials/storages/cookieStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,WAAW,qBAAqB;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAgBD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,GAAE,qBAA0B,GAAG,aAAa,CAqB7E"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ITokenStorage } from '../credential.type';
|
|
2
|
+
/**
|
|
3
|
+
* localStorage-backed token storage. XSS-readable, so prefer `cookieStorage`
|
|
4
|
+
* or an httpOnly bridge for production. Falls back to memory when `window`
|
|
5
|
+
* is undefined (SSR).
|
|
6
|
+
*/
|
|
7
|
+
export declare function localStorageAdapter(): ITokenStorage;
|
|
8
|
+
//# sourceMappingURL=localStorageAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localStorageAdapter.d.ts","sourceRoot":"","sources":["../../../../src/core/credentials/storages/localStorageAdapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxD;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAWnD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ITokenStorage } from '../credential.type';
|
|
2
|
+
/**
|
|
3
|
+
* In-memory storage. Token vanishes on page reload — the safest default
|
|
4
|
+
* and a guaranteed-safe fallback for SSR where no window exists.
|
|
5
|
+
*/
|
|
6
|
+
export declare function memoryStorage(): ITokenStorage;
|
|
7
|
+
//# sourceMappingURL=memoryStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoryStorage.d.ts","sourceRoot":"","sources":["../../../../src/core/credentials/storages/memoryStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;GAGG;AACH,wBAAgB,aAAa,IAAI,aAAa,CAW7C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalised SDK error. The `onResponseError` hook inspects the raw ofetch
|
|
3
|
+
* error and converts it into this shape so consumers deal with ONE type.
|
|
4
|
+
*/
|
|
5
|
+
export declare class CmsError extends Error {
|
|
6
|
+
readonly statusCode: number;
|
|
7
|
+
readonly code: string;
|
|
8
|
+
readonly fieldErrors?: Record<string, string>;
|
|
9
|
+
readonly requestId?: string;
|
|
10
|
+
readonly traceId?: string;
|
|
11
|
+
constructor(input: {
|
|
12
|
+
message: string;
|
|
13
|
+
statusCode?: number;
|
|
14
|
+
code?: string;
|
|
15
|
+
fieldErrors?: Record<string, string>;
|
|
16
|
+
requestId?: string;
|
|
17
|
+
traceId?: string;
|
|
18
|
+
cause?: unknown;
|
|
19
|
+
});
|
|
20
|
+
get isUnauthorized(): boolean;
|
|
21
|
+
get isForbidden(): boolean;
|
|
22
|
+
get isNotFound(): boolean;
|
|
23
|
+
get isValidation(): boolean;
|
|
24
|
+
get isNetwork(): boolean;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;gBAEd,KAAK,EAAE;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACrC,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB;IAUD,IAAI,cAAc,IAAI,OAAO,CAE5B;IACD,IAAI,WAAW,IAAI,OAAO,CAEzB;IACD,IAAI,UAAU,IAAI,OAAO,CAExB;IACD,IAAI,YAAY,IAAI,OAAO,CAE1B;IACD,IAAI,SAAS,IAAI,OAAO,CAEvB;CACF"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { $Fetch } from 'ofetch';
|
|
2
|
+
import { IDeviceContext, RequestMiddleware } from './createApi';
|
|
3
|
+
import { ICookieStorageOptions } from './credentials/resolveStorage';
|
|
4
|
+
import { StorageName } from './credentials/credential.type';
|
|
5
|
+
import { CmsError } from './errors';
|
|
6
|
+
import { IWsClient } from './ws/ws.type';
|
|
7
|
+
import { RequestCasing, ResponseCasing } from '../common/constants/http.constant';
|
|
8
|
+
export interface IEndpointMap {
|
|
9
|
+
/** Primary CMS API. Required. */
|
|
10
|
+
cms: string;
|
|
11
|
+
/** Optional secondary backends, each gets its own $Fetch sharing the token. */
|
|
12
|
+
report?: string;
|
|
13
|
+
poolTrading?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Optional CMS WebSocket endpoint (`wss://host/ws`). When omitted the SDK
|
|
16
|
+
* exposes `sdk.ws === null` and the consumer stays REST-only.
|
|
17
|
+
*/
|
|
18
|
+
ws?: string;
|
|
19
|
+
[key: string]: string | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface ICredentialsConfig {
|
|
22
|
+
storage?: StorageName;
|
|
23
|
+
cookie?: ICookieStorageOptions;
|
|
24
|
+
headerName?: string;
|
|
25
|
+
prefix?: string;
|
|
26
|
+
onRefreshed?: (token: string) => void;
|
|
27
|
+
}
|
|
28
|
+
export interface ICmsSDKOptions {
|
|
29
|
+
endpoints: IEndpointMap;
|
|
30
|
+
clientId?: string;
|
|
31
|
+
credentials?: ICredentialsConfig;
|
|
32
|
+
device?: IDeviceContext;
|
|
33
|
+
timeout?: number;
|
|
34
|
+
retry?: number;
|
|
35
|
+
/**
|
|
36
|
+
* When true, domain services return fake data instead of hitting the
|
|
37
|
+
* backend. Intended for development until real endpoints exist.
|
|
38
|
+
*/
|
|
39
|
+
mock?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Response casing to request from the backend via the `x-response-casing`
|
|
42
|
+
* header. Default `'camel'` (the backend default — no header is sent, which
|
|
43
|
+
* matches the SDK's camelCase DTOs). Set `'snake'` to receive snake_case.
|
|
44
|
+
*/
|
|
45
|
+
responseCasing?: ResponseCasing;
|
|
46
|
+
/**
|
|
47
|
+
* Request casing, declared to the backend via the `x-request-casing` header.
|
|
48
|
+
* Default `'camel'` (no header; request bodies use the SDK's camelCase keys).
|
|
49
|
+
* Set `'snake'` to send snake_case request bodies (keys are deep-converted).
|
|
50
|
+
*/
|
|
51
|
+
requestCasing?: RequestCasing;
|
|
52
|
+
onError?: (error: CmsError) => void;
|
|
53
|
+
onUnauthorized?: (error: CmsError) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Async hook called whenever the access token changes (refresh, 401).
|
|
56
|
+
* Used by the Nuxt module to sync an httpOnly cookie. When omitted,
|
|
57
|
+
* TokenManager is updated directly.
|
|
58
|
+
*/
|
|
59
|
+
onToken?: (token: string | null) => void | Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Silent access-token refresh on 401. The Nuxt module wires this to the
|
|
62
|
+
* `/api/cms/refresh` proxy (which reads the httpOnly refresh-token cookie,
|
|
63
|
+
* rotates both tokens, and returns the new access token). Return `null` to
|
|
64
|
+
* signal a failed refresh (the session is then cleared). When omitted, a 401
|
|
65
|
+
* just clears the session + fires `onUnauthorized`.
|
|
66
|
+
*/
|
|
67
|
+
refresh?: () => Promise<string | null>;
|
|
68
|
+
/**
|
|
69
|
+
* Optional `$Fetch` used by the auth service for token-lifecycle flows
|
|
70
|
+
* (login/register/verifyOtp/logout). The Nuxt module points this at the
|
|
71
|
+
* `/api/cms/*` server routes so those flows set the httpOnly cookie
|
|
72
|
+
* atomically. When omitted, token-lifecycle flows call the backend directly.
|
|
73
|
+
*/
|
|
74
|
+
authRoute?: $Fetch;
|
|
75
|
+
}
|
|
76
|
+
/** Map of backend name → typed fetcher, built from `endpoints`. */
|
|
77
|
+
export type ApiMap = Record<string, $Fetch>;
|
|
78
|
+
/** Concrete SDK instance returned by `createCmsSDK()`. */
|
|
79
|
+
export interface ICmsSDK {
|
|
80
|
+
readonly apis: ApiMap;
|
|
81
|
+
readonly tokenManager: import('./credentials/TokenManager').TokenManager;
|
|
82
|
+
readonly auth: import('../services/auth').IAuthService;
|
|
83
|
+
readonly content: import('../services/content').IContentService;
|
|
84
|
+
readonly rules: import('../services/rules').IRulesService;
|
|
85
|
+
readonly executions: import('../services/executions').IExecutionsService;
|
|
86
|
+
readonly settings: import('../services/settings').ISettingsService;
|
|
87
|
+
readonly llm: import('../services/llm').ILlmService;
|
|
88
|
+
readonly bars: import('../services/bars').IBarsService;
|
|
89
|
+
readonly history: import('../services/history').IHistoryService;
|
|
90
|
+
readonly kalshi: import('../services/kalshi').IKalshiService;
|
|
91
|
+
readonly gov: import('../services/gov').IGovService;
|
|
92
|
+
readonly people: import('../services/people').IPeopleService;
|
|
93
|
+
/** Read-only CT metadata (`/api/v1/content-types`) — renders forms/badges. */
|
|
94
|
+
readonly contentTypes: import('../services/content-types').IContentTypesService;
|
|
95
|
+
/** FEAT-012 — notification/report template lifecycle (engine-owned APIs). */
|
|
96
|
+
readonly notifications: import('../services/notifications').INotificationsService;
|
|
97
|
+
/**
|
|
98
|
+
* Lazily-constructed WebSocket client. `null` when `endpoints.ws` is omitted.
|
|
99
|
+
* Consumers should treat this as the source of real-time events; the
|
|
100
|
+
* `createEaeraWebSocket` instance shares the SDK's `TokenManager` and
|
|
101
|
+
* `refresh()` so token rotation is transparent.
|
|
102
|
+
*/
|
|
103
|
+
readonly ws: IWsClient | null;
|
|
104
|
+
/** Runtime middleware escape hatch (the "dynamic interceptor" path). */
|
|
105
|
+
addRequestMiddleware: (target: string | 'all', mw: RequestMiddleware) => () => void;
|
|
106
|
+
/** Flip mock mode at runtime (e.g. switch off after a feature-flag rollout). */
|
|
107
|
+
setMock: (enabled: boolean) => void;
|
|
108
|
+
/**
|
|
109
|
+
* Sync the access token (login/restore/logout). When an `onToken` hook is
|
|
110
|
+
* configured (e.g. Nuxt httpOnly cookie) it is awaited; otherwise the token
|
|
111
|
+
* is written directly to TokenManager.
|
|
112
|
+
*/
|
|
113
|
+
syncToken: (token: string | null) => Promise<void>;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=sdk.type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.type.d.ts","sourceRoot":"","sources":["../../src/core/sdk.type.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IWsClient, IWsClientOptions } from './ws.type';
|
|
2
|
+
/**
|
|
3
|
+
* Framework-agnostic EAERA CMS WebSocket client.
|
|
4
|
+
*
|
|
5
|
+
* Implements the protocol documented in
|
|
6
|
+
* `eaera-docs/cbs/eaera-cms/docs/eaera-cms-websocket-integration-guide.md`:
|
|
7
|
+
* open → auth → subscribe → events/heartbeats/action invocation/reconnect.
|
|
8
|
+
*
|
|
9
|
+
* Token source is intentionally pluggable. The SDK's Nuxt module wires this
|
|
10
|
+
* to {@link TokenManager} + the silent `refresh()` flow, so sliding session
|
|
11
|
+
* refreshes and 401-driven cookie syncs are transparent.
|
|
12
|
+
*
|
|
13
|
+
* Reconnect schedule: exponential backoff with jitter (0…WS_RECONNECT_JITTER_MS),
|
|
14
|
+
* capped at `WS_RECONNECT_MAX_MS`. On `token_expired` / `auth_fail` mid-session
|
|
15
|
+
* the injected `refresh()` is awaited once before reconnecting.
|
|
16
|
+
*
|
|
17
|
+
* SSR safety: pass `WebSocketCtor: undefined` (or skip `open()`); the
|
|
18
|
+
* module's plugin only calls `open()` inside `if (import.meta.client)`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createEaeraWebSocket(options: IWsClientOptions): IWsClient;
|
|
21
|
+
//# sourceMappingURL=createEaeraWebSocket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createEaeraWebSocket.d.ts","sourceRoot":"","sources":["../../../src/core/ws/createEaeraWebSocket.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAIV,SAAS,EACT,gBAAgB,EAajB,MAAM,WAAW,CAAC;AAEnB;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAshBzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/ws/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|