@upbit-official/upbit-sdk 1.0.0 → 1.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/CHANGELOG.md +5 -0
- package/README.md +21 -0
- package/client.d.mts +10 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +10 -4
- package/client.d.ts.map +1 -1
- package/client.js +23 -5
- package/client.js.map +1 -1
- package/client.mjs +23 -5
- package/client.mjs.map +1 -1
- package/index.d.mts +3 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts +3 -1
- package/index.d.ts.map +1 -1
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -1
- package/index.mjs.map +1 -1
- package/internal/ws-parser.d.mts +40 -0
- package/internal/ws-parser.d.mts.map +1 -0
- package/internal/ws-parser.d.ts +40 -0
- package/internal/ws-parser.d.ts.map +1 -0
- package/internal/ws-parser.js +125 -0
- package/internal/ws-parser.js.map +1 -0
- package/internal/ws-parser.mjs +118 -0
- package/internal/ws-parser.mjs.map +1 -0
- package/internal/ws-simple-types.d.mts +8 -0
- package/internal/ws-simple-types.d.mts.map +1 -0
- package/internal/ws-simple-types.d.ts +8 -0
- package/internal/ws-simple-types.d.ts.map +1 -0
- package/internal/ws-simple-types.js +3 -0
- package/internal/ws-simple-types.js.map +1 -0
- package/internal/ws-simple-types.mjs +2 -0
- package/internal/ws-simple-types.mjs.map +1 -0
- package/internal/ws.d.mts +1 -0
- package/internal/ws.d.mts.map +1 -1
- package/internal/ws.d.ts +1 -0
- package/internal/ws.d.ts.map +1 -1
- package/internal/ws.js.map +1 -1
- package/internal/ws.mjs.map +1 -1
- package/lib/index.d.mts +4 -2
- package/lib/index.d.mts.map +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/jsonParseFloat.d.mts +5 -5
- package/lib/jsonParseFloat.d.mts.map +1 -1
- package/lib/jsonParseFloat.d.ts +5 -5
- package/lib/jsonParseFloat.d.ts.map +1 -1
- package/lib/jsonParseFloat.js +30 -12
- package/lib/jsonParseFloat.js.map +1 -1
- package/lib/jsonParseFloat.mjs +30 -12
- package/lib/jsonParseFloat.mjs.map +1 -1
- package/lib/ws.d.mts +102 -15
- package/lib/ws.d.mts.map +1 -1
- package/lib/ws.d.ts +102 -15
- package/lib/ws.d.ts.map +1 -1
- package/lib/ws.js +208 -34
- package/lib/ws.js.map +1 -1
- package/lib/ws.mjs +204 -33
- package/lib/ws.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/index.d.mts +3 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -2
- package/resources/index.mjs.map +1 -1
- package/resources/ws-info/index.d.mts +6 -0
- package/resources/ws-info/index.d.mts.map +1 -0
- package/resources/ws-info/index.d.ts +6 -0
- package/resources/ws-info/index.d.ts.map +1 -0
- package/resources/ws-info/index.js +6 -0
- package/resources/ws-info/index.js.map +1 -0
- package/resources/ws-info/index.mjs +2 -0
- package/resources/ws-info/index.mjs.map +1 -0
- package/resources/ws-info/internal-base.d.mts +63 -0
- package/resources/ws-info/internal-base.d.mts.map +1 -0
- package/resources/ws-info/internal-base.d.ts +63 -0
- package/resources/ws-info/internal-base.d.ts.map +1 -0
- package/resources/ws-info/internal-base.js +47 -0
- package/resources/ws-info/internal-base.js.map +1 -0
- package/resources/ws-info/internal-base.mjs +41 -0
- package/resources/ws-info/internal-base.mjs.map +1 -0
- package/resources/ws-info/ws-info.d.mts +1180 -0
- package/resources/ws-info/ws-info.d.mts.map +1 -0
- package/resources/ws-info/ws-info.d.ts +1180 -0
- package/resources/ws-info/ws-info.d.ts.map +1 -0
- package/resources/ws-info/ws-info.js +8 -0
- package/resources/ws-info/ws-info.js.map +1 -0
- package/resources/ws-info/ws-info.mjs +4 -0
- package/resources/ws-info/ws-info.mjs.map +1 -0
- package/resources/ws-info/ws.d.mts +91 -0
- package/resources/ws-info/ws.d.mts.map +1 -0
- package/resources/ws-info/ws.d.ts +91 -0
- package/resources/ws-info/ws.d.ts.map +1 -0
- package/resources/ws-info/ws.js +463 -0
- package/resources/ws-info/ws.js.map +1 -0
- package/resources/ws-info/ws.mjs +458 -0
- package/resources/ws-info/ws.mjs.map +1 -0
- package/resources/ws-info.d.mts +2 -0
- package/resources/ws-info.d.mts.map +1 -0
- package/resources/ws-info.d.ts +2 -0
- package/resources/ws-info.d.ts.map +1 -0
- package/resources/ws-info.js +5 -0
- package/resources/ws-info.js.map +1 -0
- package/resources/ws-info.mjs +2 -0
- package/resources/ws-info.mjs.map +1 -0
- package/resources/ws-private/index.d.mts +3 -1
- package/resources/ws-private/index.d.mts.map +1 -1
- package/resources/ws-private/index.d.ts +3 -1
- package/resources/ws-private/index.d.ts.map +1 -1
- package/resources/ws-private/index.js.map +1 -1
- package/resources/ws-private/index.mjs +1 -1
- package/resources/ws-private/index.mjs.map +1 -1
- package/resources/ws-private/internal-base.d.mts.map +1 -1
- package/resources/ws-private/internal-base.d.ts.map +1 -1
- package/resources/ws-private/internal-base.js.map +1 -1
- package/resources/ws-private/internal-base.mjs.map +1 -1
- package/resources/ws-private/ws-private.d.mts +301 -9
- package/resources/ws-private/ws-private.d.mts.map +1 -1
- package/resources/ws-private/ws-private.d.ts +301 -9
- package/resources/ws-private/ws-private.d.ts.map +1 -1
- package/resources/ws-private/ws-private.js.map +1 -1
- package/resources/ws-private/ws-private.mjs.map +1 -1
- package/resources/ws-private/ws.d.mts +2 -2
- package/resources/ws-private/ws.d.mts.map +1 -1
- package/resources/ws-private/ws.d.ts +2 -2
- package/resources/ws-private/ws.d.ts.map +1 -1
- package/resources/ws-private/ws.js +15 -20
- package/resources/ws-private/ws.js.map +1 -1
- package/resources/ws-private/ws.mjs +15 -20
- package/resources/ws-private/ws.mjs.map +1 -1
- package/resources/ws-public/index.d.mts +3 -1
- package/resources/ws-public/index.d.mts.map +1 -1
- package/resources/ws-public/index.d.ts +3 -1
- package/resources/ws-public/index.d.ts.map +1 -1
- package/resources/ws-public/index.js.map +1 -1
- package/resources/ws-public/index.mjs +1 -1
- package/resources/ws-public/index.mjs.map +1 -1
- package/resources/ws-public/internal-base.d.mts.map +1 -1
- package/resources/ws-public/internal-base.d.ts.map +1 -1
- package/resources/ws-public/internal-base.js.map +1 -1
- package/resources/ws-public/internal-base.mjs.map +1 -1
- package/resources/ws-public/ws-public.d.mts +355 -5
- package/resources/ws-public/ws-public.d.mts.map +1 -1
- package/resources/ws-public/ws-public.d.ts +355 -5
- package/resources/ws-public/ws-public.d.ts.map +1 -1
- package/resources/ws-public/ws.d.mts +2 -2
- package/resources/ws-public/ws.d.mts.map +1 -1
- package/resources/ws-public/ws.d.ts +2 -2
- package/resources/ws-public/ws.d.ts.map +1 -1
- package/resources/ws-public/ws.js +15 -20
- package/resources/ws-public/ws.js.map +1 -1
- package/resources/ws-public/ws.mjs +15 -20
- package/resources/ws-public/ws.mjs.map +1 -1
- package/src/client.ts +92 -5
- package/src/index.ts +24 -1
- package/src/internal/ws-parser.ts +164 -0
- package/src/internal/ws-simple-types.ts +34 -0
- package/src/internal/ws.ts +1 -0
- package/src/lib/index.ts +17 -2
- package/src/lib/jsonParseFloat.ts +37 -12
- package/src/lib/ws.ts +367 -55
- package/src/resources/index.ts +42 -2
- package/src/resources/ws-info/index.ts +44 -0
- package/src/resources/ws-info/internal-base.ts +96 -0
- package/src/resources/ws-info/ws-info.ts +1855 -0
- package/src/resources/ws-info/ws.ts +574 -0
- package/src/resources/ws-info.ts +1 -0
- package/src/resources/ws-private/index.ts +12 -1
- package/src/resources/ws-private/internal-base.ts +0 -1
- package/src/resources/ws-private/ws-private.ts +420 -18
- package/src/resources/ws-private/ws.ts +16 -23
- package/src/resources/ws-public/index.ts +16 -1
- package/src/resources/ws-public/internal-base.ts +0 -1
- package/src/resources/ws-public/ws-public.ts +459 -4
- package/src/resources/ws-public/ws.ts +16 -23
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAAO,EAAE,KAAK,IAAI,OAAO,EAAE;OACpB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAAO,EAAE,KAAK,IAAI,OAAO,EAAE;OACpB,EACL,cAAc,EACd,UAAU,EACV,QAAQ,EACR,eAAe,EACf,KAAK,qBAAqB,EAC1B,KAAK,kCAAkC,EACvC,KAAK,2BAA2B,EAChC,KAAK,aAAa,EAClB,KAAK,iCAAiC,EACtC,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,GACnC;OAEM,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,KAAK,EAAE,KAAK,aAAa,EAAE;OAC7B,EAAE,WAAW,EAAE;OACf,EACL,UAAU,EACV,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB;;YAGW,EACV,wBAAwB,EACxB,uBAAuB,EACvB,2BAA2B,GAC5B"}
|
package/index.js
CHANGED
|
@@ -3,11 +3,12 @@ exports = module.exports = function (...args) {
|
|
|
3
3
|
return new exports.default(...args)
|
|
4
4
|
}
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitPenaltyError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.UpbitError = exports.PagePromise = exports.Upbit = exports.APIPromise = exports.toFile = exports.WsStreamManager = exports.WsStream = exports.createJwtToken = exports.default = void 0;
|
|
6
|
+
exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitPenaltyError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.UpbitError = exports.PagePromise = exports.Upbit = exports.APIPromise = exports.toFile = exports.WsStreamManager = exports.WsStream = exports.WsEndpoint = exports.createJwtToken = exports.default = void 0;
|
|
7
7
|
var client_1 = require("./client.js");
|
|
8
8
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return client_1.Upbit; } });
|
|
9
9
|
var lib_1 = require("./lib/index.js");
|
|
10
10
|
Object.defineProperty(exports, "createJwtToken", { enumerable: true, get: function () { return lib_1.createJwtToken; } });
|
|
11
|
+
Object.defineProperty(exports, "WsEndpoint", { enumerable: true, get: function () { return lib_1.WsEndpoint; } });
|
|
11
12
|
Object.defineProperty(exports, "WsStream", { enumerable: true, get: function () { return lib_1.WsStream; } });
|
|
12
13
|
Object.defineProperty(exports, "WsStreamManager", { enumerable: true, get: function () { return lib_1.WsStreamManager; } });
|
|
13
14
|
var uploads_1 = require("./core/uploads.js");
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";;;AAAA,sCAA4C;AAAnC,iGAAA,KAAK,OAAW;AACzB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";;;AAAA,sCAA4C;AAAnC,iGAAA,KAAK,OAAW;AACzB,sCAgBe;AAfb,qGAAA,cAAc,OAAA;AACd,iGAAA,UAAU,OAAA;AACV,+FAAA,QAAQ,OAAA;AACR,sGAAA,eAAe,OAAA;AAcjB,6CAAyD;AAA/B,iGAAA,MAAM,OAAA;AAChC,qDAAgD;AAAvC,yGAAA,UAAU,OAAA;AACnB,sCAAqD;AAA5C,+FAAA,KAAK,OAAA;AACd,mDAAgD;AAAvC,yGAAA,WAAW,OAAA;AACpB,yCAesB;AAdpB,mGAAA,UAAU,OAAA;AACV,iGAAA,QAAQ,OAAA;AACR,2GAAA,kBAAkB,OAAA;AAClB,kHAAA,yBAAyB,OAAA;AACzB,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,aAAa,OAAA;AACb,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AACd,8GAAA,qBAAqB,OAAA;AACrB,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,8GAAA,qBAAqB,OAAA;AACrB,iHAAA,wBAAwB,OAAA"}
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Upbit as default } from "./client.mjs";
|
|
2
|
-
export { createJwtToken, WsStream, WsStreamManager } from "./lib/index.mjs";
|
|
2
|
+
export { createJwtToken, WsEndpoint, WsStream, WsStreamManager, } from "./lib/index.mjs";
|
|
3
3
|
export { toFile } from "./core/uploads.mjs";
|
|
4
4
|
export { APIPromise } from "./core/api-promise.mjs";
|
|
5
5
|
export { Upbit } from "./client.mjs";
|
package/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAAO,EAAE,KAAK,IAAI,OAAO,EAAE;OACpB,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAAO,EAAE,KAAK,IAAI,OAAO,EAAE;OACpB,EACL,cAAc,EACd,UAAU,EACV,QAAQ,EACR,eAAe,GAYhB;OAEM,EAAmB,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,KAAK,EAAsB;OAC7B,EAAE,WAAW,EAAE;OACf,EACL,UAAU,EACV,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { RawWebSocketData } from "./ws.mjs";
|
|
2
|
+
import type { WsListSubscriptionsResponse } from "../lib/ws.mjs";
|
|
3
|
+
/** Backwards-compatible fallback for extensions to the SIMPLE protocol. */
|
|
4
|
+
export interface SimpleWebSocketEvent {
|
|
5
|
+
ty: string;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface WebSocketAPIErrorMessage {
|
|
9
|
+
error: {
|
|
10
|
+
name: string;
|
|
11
|
+
message: string;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** A valid object without a stream discriminator, such as a status notification. */
|
|
16
|
+
export interface WebSocketUntypedMessage {
|
|
17
|
+
type?: undefined;
|
|
18
|
+
ty?: undefined;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
/** Info streams also forward objects with future or unknown discriminators. */
|
|
22
|
+
export interface InfoWebSocketUnknownMessage {
|
|
23
|
+
type?: string;
|
|
24
|
+
ty?: string;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
export type WebSocketMessage<Event> = Event | WebSocketAPIErrorMessage | WebSocketUntypedMessage;
|
|
28
|
+
export interface ParsedWebSocketMessage<Event> {
|
|
29
|
+
events: WebSocketMessage<Event>[];
|
|
30
|
+
controls: WsListSubscriptionsResponse[];
|
|
31
|
+
/** Data and controls in their original frame order. */
|
|
32
|
+
messages: Array<WebSocketMessage<Event> | WsListSubscriptionsResponse>;
|
|
33
|
+
}
|
|
34
|
+
/** Preserve decimal tokens while keeping indicator integer parameters numeric. */
|
|
35
|
+
export declare function parseWebSocketValue(data: RawWebSocketData): unknown;
|
|
36
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
37
|
+
export declare function isListSubscriptionsResponse(value: unknown): value is WsListSubscriptionsResponse;
|
|
38
|
+
export declare function webSocketEventType(event: unknown): string | undefined;
|
|
39
|
+
export declare function parseWebSocketMessage<Event>(data: RawWebSocketData): ParsedWebSocketMessage<Event> | null;
|
|
40
|
+
//# sourceMappingURL=ws-parser.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws-parser.d.mts","sourceRoot":"","sources":["../src/internal/ws-parser.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,gBAAgB,EAAE;OAEzB,KAAK,EAAE,2BAA2B,EAAE;AAE3C,2EAA2E;AAC3E,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;CAClE;AAED,oFAAoF;AACpF,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,+EAA+E;AAC/E,MAAM,WAAW,2BAA2B;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,gBAAgB,CAAC,KAAK,IAAI,KAAK,GAAG,wBAAwB,GAAG,uBAAuB,CAAC;AAEjG,MAAM,WAAW,sBAAsB,CAAC,KAAK;IAC3C,MAAM,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,2BAA2B,EAAE,CAAC;IACxC,uDAAuD;IACvD,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,2BAA2B,CAAC,CAAC;CACxE;AAiBD,kFAAkF;AAClF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAqDnE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,2BAA2B,CAiBhG;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAIrE;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,IAAI,EAAE,gBAAgB,GAAG,sBAAsB,CAAC,KAAK,CAAC,GAAG,IAAI,CAkBzG"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { RawWebSocketData } from "./ws.js";
|
|
2
|
+
import type { WsListSubscriptionsResponse } from "../lib/ws.js";
|
|
3
|
+
/** Backwards-compatible fallback for extensions to the SIMPLE protocol. */
|
|
4
|
+
export interface SimpleWebSocketEvent {
|
|
5
|
+
ty: string;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface WebSocketAPIErrorMessage {
|
|
9
|
+
error: {
|
|
10
|
+
name: string;
|
|
11
|
+
message: string;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** A valid object without a stream discriminator, such as a status notification. */
|
|
16
|
+
export interface WebSocketUntypedMessage {
|
|
17
|
+
type?: undefined;
|
|
18
|
+
ty?: undefined;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
/** Info streams also forward objects with future or unknown discriminators. */
|
|
22
|
+
export interface InfoWebSocketUnknownMessage {
|
|
23
|
+
type?: string;
|
|
24
|
+
ty?: string;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
export type WebSocketMessage<Event> = Event | WebSocketAPIErrorMessage | WebSocketUntypedMessage;
|
|
28
|
+
export interface ParsedWebSocketMessage<Event> {
|
|
29
|
+
events: WebSocketMessage<Event>[];
|
|
30
|
+
controls: WsListSubscriptionsResponse[];
|
|
31
|
+
/** Data and controls in their original frame order. */
|
|
32
|
+
messages: Array<WebSocketMessage<Event> | WsListSubscriptionsResponse>;
|
|
33
|
+
}
|
|
34
|
+
/** Preserve decimal tokens while keeping indicator integer parameters numeric. */
|
|
35
|
+
export declare function parseWebSocketValue(data: RawWebSocketData): unknown;
|
|
36
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
37
|
+
export declare function isListSubscriptionsResponse(value: unknown): value is WsListSubscriptionsResponse;
|
|
38
|
+
export declare function webSocketEventType(event: unknown): string | undefined;
|
|
39
|
+
export declare function parseWebSocketMessage<Event>(data: RawWebSocketData): ParsedWebSocketMessage<Event> | null;
|
|
40
|
+
//# sourceMappingURL=ws-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws-parser.d.ts","sourceRoot":"","sources":["../src/internal/ws-parser.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,gBAAgB,EAAE;OAEzB,KAAK,EAAE,2BAA2B,EAAE;AAE3C,2EAA2E;AAC3E,MAAM,WAAW,oBAA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GAAG,MAAM,GAAG,SAAS,CAIrE;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,IAAI,EAAE,gBAAgB,GAAG,sBAAsB,CAAC,KAAK,CAAC,GAAG,IAAI,CAkBzG"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseWebSocketValue = parseWebSocketValue;
|
|
4
|
+
exports.isRecord = isRecord;
|
|
5
|
+
exports.isListSubscriptionsResponse = isListSubscriptionsResponse;
|
|
6
|
+
exports.webSocketEventType = webSocketEventType;
|
|
7
|
+
exports.parseWebSocketMessage = parseWebSocketMessage;
|
|
8
|
+
const jsonParseFloat_1 = require("../lib/jsonParseFloat.js");
|
|
9
|
+
const INFO_INTEGER_PARAMS = new Set([
|
|
10
|
+
'period',
|
|
11
|
+
'short_period',
|
|
12
|
+
'long_period',
|
|
13
|
+
'fast',
|
|
14
|
+
'slow',
|
|
15
|
+
'signal_period',
|
|
16
|
+
'p',
|
|
17
|
+
'shp',
|
|
18
|
+
'lop',
|
|
19
|
+
'f',
|
|
20
|
+
's',
|
|
21
|
+
'sgp',
|
|
22
|
+
]);
|
|
23
|
+
/** Preserve decimal tokens while keeping indicator integer parameters numeric. */
|
|
24
|
+
function parseWebSocketValue(data) {
|
|
25
|
+
return (0, jsonParseFloat_1.jsonParseFloat)(toText(data), (key, path, root) => {
|
|
26
|
+
const type = root['type'] ?? root['ty'];
|
|
27
|
+
if (path.length === 0 &&
|
|
28
|
+
['ticker', 'trade', 'myOrder', 'myAsset', 'orderbook'].includes(String(type)) &&
|
|
29
|
+
[
|
|
30
|
+
'trade_timestamp',
|
|
31
|
+
'order_timestamp',
|
|
32
|
+
'asset_timestamp',
|
|
33
|
+
'ttms',
|
|
34
|
+
'otms',
|
|
35
|
+
'asttms',
|
|
36
|
+
'sid',
|
|
37
|
+
'tc',
|
|
38
|
+
].includes(key))
|
|
39
|
+
return true;
|
|
40
|
+
if (type === 'ticker' &&
|
|
41
|
+
path.length === 1 &&
|
|
42
|
+
(path[0] === 'delisting_date' || path[0] === 'dd') &&
|
|
43
|
+
['year', 'month', 'day'].includes(key))
|
|
44
|
+
return true;
|
|
45
|
+
if (root['method'] === 'LIST_SUBSCRIPTIONS' || root['mthd'] === 'LIST_SUBSCRIPTIONS') {
|
|
46
|
+
return (path.includes('indicators') &&
|
|
47
|
+
(path[path.length - 1] === 'params' || path[path.length - 1] === 'event_params') &&
|
|
48
|
+
(INFO_INTEGER_PARAMS.has(key) || key === 'threshold' || key === 'multiplier'));
|
|
49
|
+
}
|
|
50
|
+
if (type !== 'indicator' && type !== 'indicator_signal')
|
|
51
|
+
return false;
|
|
52
|
+
if (path.length !== 1)
|
|
53
|
+
return false;
|
|
54
|
+
const indicator = root['indicator'] ?? root['ind'];
|
|
55
|
+
if (indicator === 'bollinger_bands' &&
|
|
56
|
+
(path[0] === 'params' || path[0] === 'p') &&
|
|
57
|
+
(key === 'multiplier' || key === 'm'))
|
|
58
|
+
return true;
|
|
59
|
+
if (type === 'indicator_signal' &&
|
|
60
|
+
indicator === 'volume' &&
|
|
61
|
+
(path[0] === 'event_params' || path[0] === 'ep') &&
|
|
62
|
+
(key === 'multiplier' || key === 'mul'))
|
|
63
|
+
return true;
|
|
64
|
+
return (((path[0] === 'params' || path[0] === 'p') && INFO_INTEGER_PARAMS.has(key)) ||
|
|
65
|
+
((path[0] === 'event_params' || path[0] === 'ep') && (key === 'threshold' || key === 'th')));
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function isRecord(value) {
|
|
69
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
70
|
+
}
|
|
71
|
+
function isListSubscriptionsResponse(value) {
|
|
72
|
+
if (!isRecord(value))
|
|
73
|
+
return false;
|
|
74
|
+
if (value['method'] === 'LIST_SUBSCRIPTIONS') {
|
|
75
|
+
return (typeof value['ticket'] === 'string' &&
|
|
76
|
+
Array.isArray(value['result']) &&
|
|
77
|
+
value['result'].every((item) => isRecord(item) && typeof item['type'] === 'string'));
|
|
78
|
+
}
|
|
79
|
+
if (value['mthd'] === 'LIST_SUBSCRIPTIONS') {
|
|
80
|
+
return (typeof value['tckt'] === 'string' &&
|
|
81
|
+
Array.isArray(value['rslt']) &&
|
|
82
|
+
value['rslt'].every((item) => isRecord(item) && typeof item['ty'] === 'string'));
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
function webSocketEventType(event) {
|
|
87
|
+
if (!isRecord(event))
|
|
88
|
+
return undefined;
|
|
89
|
+
if (typeof event['type'] === 'string')
|
|
90
|
+
return event['type'];
|
|
91
|
+
return typeof event['ty'] === 'string' ? event['ty'] : undefined;
|
|
92
|
+
}
|
|
93
|
+
function parseWebSocketMessage(data) {
|
|
94
|
+
let value;
|
|
95
|
+
try {
|
|
96
|
+
value = parseWebSocketValue(data);
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
const values = Array.isArray(value) ? value : [value];
|
|
102
|
+
const events = [];
|
|
103
|
+
const controls = [];
|
|
104
|
+
const messages = [];
|
|
105
|
+
for (const item of values) {
|
|
106
|
+
if (!isRecord(item))
|
|
107
|
+
continue;
|
|
108
|
+
messages.push(item);
|
|
109
|
+
if (isListSubscriptionsResponse(item))
|
|
110
|
+
controls.push(item);
|
|
111
|
+
else
|
|
112
|
+
events.push(item);
|
|
113
|
+
}
|
|
114
|
+
return { events, controls, messages };
|
|
115
|
+
}
|
|
116
|
+
function toText(data) {
|
|
117
|
+
if (typeof data === 'string')
|
|
118
|
+
return data;
|
|
119
|
+
if (Array.isArray(data))
|
|
120
|
+
return data.map(toText).join('');
|
|
121
|
+
if (ArrayBuffer.isView(data))
|
|
122
|
+
return new TextDecoder().decode(new Uint8Array(data.buffer, data.byteOffset, data.byteLength));
|
|
123
|
+
return new TextDecoder().decode(data);
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=ws-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws-parser.js","sourceRoot":"","sources":["../src/internal/ws-parser.ts"],"names":[],"mappings":";;AAqDA,kDAqDC;AAED,4BAEC;AAED,kEAiBC;AAED,gDAIC;AAED,sDAkBC;AA1JD,6DAAuD;AAoCvD,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAClC,QAAQ;IACR,cAAc;IACd,aAAa;IACb,MAAM;IACN,MAAM;IACN,eAAe;IACf,GAAG;IACH,KAAK;IACL,KAAK;IACL,GAAG;IACH,GAAG;IACH,KAAK;CACN,CAAC,CAAC;AAEH,kFAAkF;AAClF,SAAgB,mBAAmB,CAAC,IAAsB;IACxD,OAAO,IAAA,+BAAc,EAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QACtD,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,IACE,IAAI,CAAC,MAAM,KAAK,CAAC;YACjB,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC7E;gBACE,iBAAiB;gBACjB,iBAAiB;gBACjB,iBAAiB;gBACjB,MAAM;gBACN,MAAM;gBACN,QAAQ;gBACR,KAAK;gBACL,IAAI;aACL,CAAC,QAAQ,CAAC,GAAG,CAAC;YAEf,OAAO,IAAI,CAAC;QACd,IACE,IAAI,KAAK,QAAQ;YACjB,IAAI,CAAC,MAAM,KAAK,CAAC;YACjB,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,gBAAgB,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;YAClD,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;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CAAC;AACxC,CAAC;AAED,SAAS,MAAM,CAAC,IAAsB;IACpC,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;QAC1B,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IACjG,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsonParseFloat } from "../lib/jsonParseFloat.mjs";
|
|
2
|
+
const INFO_INTEGER_PARAMS = new Set([
|
|
3
|
+
'period',
|
|
4
|
+
'short_period',
|
|
5
|
+
'long_period',
|
|
6
|
+
'fast',
|
|
7
|
+
'slow',
|
|
8
|
+
'signal_period',
|
|
9
|
+
'p',
|
|
10
|
+
'shp',
|
|
11
|
+
'lop',
|
|
12
|
+
'f',
|
|
13
|
+
's',
|
|
14
|
+
'sgp',
|
|
15
|
+
]);
|
|
16
|
+
/** Preserve decimal tokens while keeping indicator integer parameters numeric. */
|
|
17
|
+
export function parseWebSocketValue(data) {
|
|
18
|
+
return jsonParseFloat(toText(data), (key, path, root) => {
|
|
19
|
+
const type = root['type'] ?? root['ty'];
|
|
20
|
+
if (path.length === 0 &&
|
|
21
|
+
['ticker', 'trade', 'myOrder', 'myAsset', 'orderbook'].includes(String(type)) &&
|
|
22
|
+
[
|
|
23
|
+
'trade_timestamp',
|
|
24
|
+
'order_timestamp',
|
|
25
|
+
'asset_timestamp',
|
|
26
|
+
'ttms',
|
|
27
|
+
'otms',
|
|
28
|
+
'asttms',
|
|
29
|
+
'sid',
|
|
30
|
+
'tc',
|
|
31
|
+
].includes(key))
|
|
32
|
+
return true;
|
|
33
|
+
if (type === 'ticker' &&
|
|
34
|
+
path.length === 1 &&
|
|
35
|
+
(path[0] === 'delisting_date' || path[0] === 'dd') &&
|
|
36
|
+
['year', 'month', 'day'].includes(key))
|
|
37
|
+
return true;
|
|
38
|
+
if (root['method'] === 'LIST_SUBSCRIPTIONS' || root['mthd'] === 'LIST_SUBSCRIPTIONS') {
|
|
39
|
+
return (path.includes('indicators') &&
|
|
40
|
+
(path[path.length - 1] === 'params' || path[path.length - 1] === 'event_params') &&
|
|
41
|
+
(INFO_INTEGER_PARAMS.has(key) || key === 'threshold' || key === 'multiplier'));
|
|
42
|
+
}
|
|
43
|
+
if (type !== 'indicator' && type !== 'indicator_signal')
|
|
44
|
+
return false;
|
|
45
|
+
if (path.length !== 1)
|
|
46
|
+
return false;
|
|
47
|
+
const indicator = root['indicator'] ?? root['ind'];
|
|
48
|
+
if (indicator === 'bollinger_bands' &&
|
|
49
|
+
(path[0] === 'params' || path[0] === 'p') &&
|
|
50
|
+
(key === 'multiplier' || key === 'm'))
|
|
51
|
+
return true;
|
|
52
|
+
if (type === 'indicator_signal' &&
|
|
53
|
+
indicator === 'volume' &&
|
|
54
|
+
(path[0] === 'event_params' || path[0] === 'ep') &&
|
|
55
|
+
(key === 'multiplier' || key === 'mul'))
|
|
56
|
+
return true;
|
|
57
|
+
return (((path[0] === 'params' || path[0] === 'p') && INFO_INTEGER_PARAMS.has(key)) ||
|
|
58
|
+
((path[0] === 'event_params' || path[0] === 'ep') && (key === 'threshold' || key === 'th')));
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export function isRecord(value) {
|
|
62
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
63
|
+
}
|
|
64
|
+
export function isListSubscriptionsResponse(value) {
|
|
65
|
+
if (!isRecord(value))
|
|
66
|
+
return false;
|
|
67
|
+
if (value['method'] === 'LIST_SUBSCRIPTIONS') {
|
|
68
|
+
return (typeof value['ticket'] === 'string' &&
|
|
69
|
+
Array.isArray(value['result']) &&
|
|
70
|
+
value['result'].every((item) => isRecord(item) && typeof item['type'] === 'string'));
|
|
71
|
+
}
|
|
72
|
+
if (value['mthd'] === 'LIST_SUBSCRIPTIONS') {
|
|
73
|
+
return (typeof value['tckt'] === 'string' &&
|
|
74
|
+
Array.isArray(value['rslt']) &&
|
|
75
|
+
value['rslt'].every((item) => isRecord(item) && typeof item['ty'] === 'string'));
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
export function webSocketEventType(event) {
|
|
80
|
+
if (!isRecord(event))
|
|
81
|
+
return undefined;
|
|
82
|
+
if (typeof event['type'] === 'string')
|
|
83
|
+
return event['type'];
|
|
84
|
+
return typeof event['ty'] === 'string' ? event['ty'] : undefined;
|
|
85
|
+
}
|
|
86
|
+
export function parseWebSocketMessage(data) {
|
|
87
|
+
let value;
|
|
88
|
+
try {
|
|
89
|
+
value = parseWebSocketValue(data);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
const values = Array.isArray(value) ? value : [value];
|
|
95
|
+
const events = [];
|
|
96
|
+
const controls = [];
|
|
97
|
+
const messages = [];
|
|
98
|
+
for (const item of values) {
|
|
99
|
+
if (!isRecord(item))
|
|
100
|
+
continue;
|
|
101
|
+
messages.push(item);
|
|
102
|
+
if (isListSubscriptionsResponse(item))
|
|
103
|
+
controls.push(item);
|
|
104
|
+
else
|
|
105
|
+
events.push(item);
|
|
106
|
+
}
|
|
107
|
+
return { events, controls, messages };
|
|
108
|
+
}
|
|
109
|
+
function toText(data) {
|
|
110
|
+
if (typeof data === 'string')
|
|
111
|
+
return data;
|
|
112
|
+
if (Array.isArray(data))
|
|
113
|
+
return data.map(toText).join('');
|
|
114
|
+
if (ArrayBuffer.isView(data))
|
|
115
|
+
return new TextDecoder().decode(new Uint8Array(data.buffer, data.byteOffset, data.byteLength));
|
|
116
|
+
return new TextDecoder().decode(data);
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=ws-parser.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws-parser.mjs","sourceRoot":"","sources":["../src/internal/ws-parser.ts"],"names":[],"mappings":"OACO,EAAE,cAAc,EAAE;AAoCzB,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAClC,QAAQ;IACR,cAAc;IACd,aAAa;IACb,MAAM;IACN,MAAM;IACN,eAAe;IACf,GAAG;IACH,KAAK;IACL,KAAK;IACL,GAAG;IACH,GAAG;IACH,KAAK;CACN,CAAC,CAAC;AAEH,kFAAkF;AAClF,MAAM,UAAU,mBAAmB,CAAC,IAAsB;IACxD,OAAO,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QACtD,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,IACE,IAAI,CAAC,MAAM,KAAK,CAAC;YACjB,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC7E;gBACE,iBAAiB;gBACjB,iBAAiB;gBACjB,iBAAiB;gBACjB,MAAM;gBACN,MAAM;gBACN,QAAQ;gBACR,KAAK;gBACL,IAAI;aACL,CAAC,QAAQ,CAAC,GAAG,CAAC;YAEf,OAAO,IAAI,CAAC;QACd,IACE,IAAI,KAAK,QAAQ;YACjB,IAAI,CAAC,MAAM,KAAK,CAAC;YACjB,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,gBAAgB,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;YAClD,CAAC,MAAM,EAAE,OAAO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C;IACpD,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AACxC,CAAC;AAED,SAAS,MAAM,CAAC,IAAsB;IACpC,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;QAC1B,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IACjG,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { SimpleCandle, SimpleOrderbook, SimplePublicServerEvent, SimpleTicker, SimpleTrade, } from "../resources/ws-public/ws-public.mjs";
|
|
2
|
+
export type { SimpleAnnouncement, SimpleMyAsset, SimpleMyOrder, SimplePrivateServerEvent, } from "../resources/ws-private/ws-private.mjs";
|
|
3
|
+
export type { SimpleBollingerBandsIndicator, SimpleBollingerBandsIndicatorSignal, SimpleInfoServerEvent, SimpleMaCrossoverIndicator, SimpleMaCrossoverIndicatorSignal, SimpleMacdIndicator, SimpleMacdIndicatorSignal, SimpleMovingAverageIndicator, SimpleMovingAverageIndicatorSignal, SimpleRsiIndicator, SimpleRsiOverboughtIndicatorSignal, SimpleRsiOversoldIndicatorSignal, SimpleVolumeIndicator, SimpleVolumeIndicatorSignal, } from "../resources/ws-info/ws-info.mjs";
|
|
4
|
+
import type { SimplePublicServerEvent } from "../resources/ws-public/ws-public.mjs";
|
|
5
|
+
import type { SimplePrivateServerEvent } from "../resources/ws-private/ws-private.mjs";
|
|
6
|
+
import type { SimpleInfoServerEvent } from "../resources/ws-info/ws-info.mjs";
|
|
7
|
+
export type SimpleWebSocketEvent = SimplePublicServerEvent | SimplePrivateServerEvent | SimpleInfoServerEvent;
|
|
8
|
+
//# sourceMappingURL=ws-simple-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws-simple-types.d.mts","sourceRoot":"","sources":["../src/internal/ws-simple-types.ts"],"names":[],"mappings":"YACY,EACV,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,YAAY,EACZ,WAAW,GACZ;YACW,EACV,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,wBAAwB,GACzB;YACW,EACV,6BAA6B,EAC7B,mCAAmC,EACnC,qBAAqB,EACrB,0BAA0B,EAC1B,gCAAgC,EAChC,mBAAmB,EACnB,yBAAyB,EACzB,4BAA4B,EAC5B,kCAAkC,EAClC,kBAAkB,EAClB,kCAAkC,EAClC,gCAAgC,EAChC,qBAAqB,EACrB,2BAA2B,GAC5B;OACM,KAAK,EAAE,uBAAuB,EAAE;OAChC,KAAK,EAAE,wBAAwB,EAAE;OACjC,KAAK,EAAE,qBAAqB,EAAE;AACrC,MAAM,MAAM,oBAAoB,GAAG,uBAAuB,GAAG,wBAAwB,GAAG,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { SimpleCandle, SimpleOrderbook, SimplePublicServerEvent, SimpleTicker, SimpleTrade, } from "../resources/ws-public/ws-public.js";
|
|
2
|
+
export type { SimpleAnnouncement, SimpleMyAsset, SimpleMyOrder, SimplePrivateServerEvent, } from "../resources/ws-private/ws-private.js";
|
|
3
|
+
export type { SimpleBollingerBandsIndicator, SimpleBollingerBandsIndicatorSignal, SimpleInfoServerEvent, SimpleMaCrossoverIndicator, SimpleMaCrossoverIndicatorSignal, SimpleMacdIndicator, SimpleMacdIndicatorSignal, SimpleMovingAverageIndicator, SimpleMovingAverageIndicatorSignal, SimpleRsiIndicator, SimpleRsiOverboughtIndicatorSignal, SimpleRsiOversoldIndicatorSignal, SimpleVolumeIndicator, SimpleVolumeIndicatorSignal, } from "../resources/ws-info/ws-info.js";
|
|
4
|
+
import type { SimplePublicServerEvent } from "../resources/ws-public/ws-public.js";
|
|
5
|
+
import type { SimplePrivateServerEvent } from "../resources/ws-private/ws-private.js";
|
|
6
|
+
import type { SimpleInfoServerEvent } from "../resources/ws-info/ws-info.js";
|
|
7
|
+
export type SimpleWebSocketEvent = SimplePublicServerEvent | SimplePrivateServerEvent | SimpleInfoServerEvent;
|
|
8
|
+
//# sourceMappingURL=ws-simple-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws-simple-types.d.ts","sourceRoot":"","sources":["../src/internal/ws-simple-types.ts"],"names":[],"mappings":"YACY,EACV,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,YAAY,EACZ,WAAW,GACZ;YACW,EACV,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,wBAAwB,GACzB;YACW,EACV,6BAA6B,EAC7B,mCAAmC,EACnC,qBAAqB,EACrB,0BAA0B,EAC1B,gCAAgC,EAChC,mBAAmB,EACnB,yBAAyB,EACzB,4BAA4B,EAC5B,kCAAkC,EAClC,kBAAkB,EAClB,kCAAkC,EAClC,gCAAgC,EAChC,qBAAqB,EACrB,2BAA2B,GAC5B;OACM,KAAK,EAAE,uBAAuB,EAAE;OAChC,KAAK,EAAE,wBAAwB,EAAE;OACjC,KAAK,EAAE,qBAAqB,EAAE;AACrC,MAAM,MAAM,oBAAoB,GAAG,uBAAuB,GAAG,wBAAwB,GAAG,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws-simple-types.js","sourceRoot":"","sources":["../src/internal/ws-simple-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws-simple-types.mjs","sourceRoot":"","sources":["../src/internal/ws-simple-types.ts"],"names":[],"mappings":""}
|
package/internal/ws.d.mts
CHANGED
|
@@ -27,5 +27,6 @@ export type ReconnectingOverrides<Parameters = Record<string, unknown>> = {
|
|
|
27
27
|
*/
|
|
28
28
|
abort: true;
|
|
29
29
|
};
|
|
30
|
+
export type RawWebSocketData = string | ArrayBufferLike | ArrayBufferView | ArrayBufferView[];
|
|
30
31
|
export declare function isRecoverableClose(code: number): boolean;
|
|
31
32
|
//# sourceMappingURL=ws.d.mts.map
|
package/internal/ws.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.d.mts","sourceRoot":"","sources":["../src/internal/ws.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,WAAW,iBAAiB,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrE,6CAA6C;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wCAAwC;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oCAAoC;IACpC,QAAQ,CAAC,UAAU,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;CACzE;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAClE;IACE;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;CACjE,GACD;IACE;;OAEG;IACH,KAAK,EAAE,IAAI,CAAC;CACb,CAAC;
|
|
1
|
+
{"version":3,"file":"ws.d.mts","sourceRoot":"","sources":["../src/internal/ws.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,WAAW,iBAAiB,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrE,6CAA6C;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wCAAwC;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oCAAoC;IACpC,QAAQ,CAAC,UAAU,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;CACzE;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAClE;IACE;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;CACjE,GACD;IACE;;OAEG;IACH,KAAK,EAAE,IAAI,CAAC;CACb,CAAC;AAEN,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,eAAe,GAAG,eAAe,GAAG,eAAe,EAAE,CAAC;AAE9F,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAiCxD"}
|
package/internal/ws.d.ts
CHANGED
|
@@ -27,5 +27,6 @@ export type ReconnectingOverrides<Parameters = Record<string, unknown>> = {
|
|
|
27
27
|
*/
|
|
28
28
|
abort: true;
|
|
29
29
|
};
|
|
30
|
+
export type RawWebSocketData = string | ArrayBufferLike | ArrayBufferView | ArrayBufferView[];
|
|
30
31
|
export declare function isRecoverableClose(code: number): boolean;
|
|
31
32
|
//# sourceMappingURL=ws.d.ts.map
|
package/internal/ws.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../src/internal/ws.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,WAAW,iBAAiB,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrE,6CAA6C;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wCAAwC;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oCAAoC;IACpC,QAAQ,CAAC,UAAU,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;CACzE;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAClE;IACE;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;CACjE,GACD;IACE;;OAEG;IACH,KAAK,EAAE,IAAI,CAAC;CACb,CAAC;
|
|
1
|
+
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../src/internal/ws.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,WAAW,iBAAiB,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrE,6CAA6C;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wCAAwC;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oCAAoC;IACpC,QAAQ,CAAC,UAAU,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;CACzE;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAClE;IACE;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;CACjE,GACD;IACE;;OAEG;IACH,KAAK,EAAE,IAAI,CAAC;CACb,CAAC;AAEN,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,eAAe,GAAG,eAAe,GAAG,eAAe,EAAE,CAAC;AAE9F,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAiCxD"}
|
package/internal/ws.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.js","sourceRoot":"","sources":["../src/internal/ws.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"ws.js","sourceRoot":"","sources":["../src/internal/ws.ts"],"names":[],"mappings":";;AAmCA,gDAiCC;AAlCD,kBAAkB;AAClB,SAAgB,kBAAkB,CAAC,IAAY;IAC7C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,IAAI;YACP,OAAO,KAAK,CAAC,CAAC,iBAAiB;QACjC,KAAK,IAAI;YACP,OAAO,IAAI,CAAC,CAAC,oCAAoC;QACnD,KAAK,IAAI;YACP,OAAO,KAAK,CAAC,CAAC,iBAAiB;QACjC,KAAK,IAAI;YACP,OAAO,KAAK,CAAC,CAAC,mBAAmB;QACnC,KAAK,IAAI;YACP,OAAO,IAAI,CAAC,CAAC,4BAA4B;QAC3C,KAAK,IAAI;YACP,OAAO,IAAI,CAAC,CAAC,kCAAkC;QACjD,KAAK,IAAI;YACP,OAAO,KAAK,CAAC,CAAC,kBAAkB;QAClC,KAAK,IAAI;YACP,OAAO,KAAK,CAAC,CAAC,mBAAmB;QACnC,KAAK,IAAI;YACP,OAAO,KAAK,CAAC,CAAC,kBAAkB;QAClC,KAAK,IAAI;YACP,OAAO,KAAK,CAAC,CAAC,oBAAoB;QACpC,KAAK,IAAI;YACP,OAAO,IAAI,CAAC,CAAC,wBAAwB;QACvC,KAAK,IAAI;YACP,OAAO,IAAI,CAAC,CAAC,kBAAkB;QACjC,KAAK,IAAI;YACP,OAAO,IAAI,CAAC,CAAC,kBAAkB;QACjC,KAAK,IAAI;YACP,OAAO,IAAI,CAAC,CAAC,wBAAwB;QACvC;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
|
package/internal/ws.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.mjs","sourceRoot":"","sources":["../src/internal/ws.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ws.mjs","sourceRoot":"","sources":["../src/internal/ws.ts"],"names":[],"mappings":"AAkCA,kBAAkB;AAClB,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,IAAI;YACP,OAAO,KAAK,CAAC,CAAC,iBAAiB;QACjC,KAAK,IAAI;YACP,OAAO,IAAI,CAAC,CAAC,oCAAoC;QACnD,KAAK,IAAI;YACP,OAAO,KAAK,CAAC,CAAC,iBAAiB;QACjC,KAAK,IAAI;YACP,OAAO,KAAK,CAAC,CAAC,mBAAmB;QACnC,KAAK,IAAI;YACP,OAAO,IAAI,CAAC,CAAC,4BAA4B;QAC3C,KAAK,IAAI;YACP,OAAO,IAAI,CAAC,CAAC,kCAAkC;QACjD,KAAK,IAAI;YACP,OAAO,KAAK,CAAC,CAAC,kBAAkB;QAClC,KAAK,IAAI;YACP,OAAO,KAAK,CAAC,CAAC,mBAAmB;QACnC,KAAK,IAAI;YACP,OAAO,KAAK,CAAC,CAAC,kBAAkB;QAClC,KAAK,IAAI;YACP,OAAO,KAAK,CAAC,CAAC,oBAAoB;QACpC,KAAK,IAAI;YACP,OAAO,IAAI,CAAC,CAAC,wBAAwB;QACvC,KAAK,IAAI;YACP,OAAO,IAAI,CAAC,CAAC,kBAAkB;QACjC,KAAK,IAAI;YACP,OAAO,IAAI,CAAC,CAAC,kBAAkB;QACjC,KAAK,IAAI;YACP,OAAO,IAAI,CAAC,CAAC,wBAAwB;QACvC;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
|
package/lib/index.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { createJwtToken } from "./jwtAuth.mjs";
|
|
2
|
-
export { WsStream, WsStreamManager } from "./ws.mjs";
|
|
3
|
-
export type { WsStreamOptions } from "./ws.mjs";
|
|
2
|
+
export { WsEndpoint, WsStream, WsStreamManager } from "./ws.mjs";
|
|
3
|
+
export type { WsAnnouncementOptions, WsDefaultListSubscriptionsResponse, WsListSubscriptionsResponse, WsSimpleEvent, WsSimpleListSubscriptionsResponse, WsStreamFormat, WsStreamOptions, WsIndicatorOptions, WsIndicatorSubscription, WsIndicatorSignalOptions, WsIndicatorSignalSubscription, } from "./ws.mjs";
|
|
4
4
|
export { jsonParseFloat } from "./jsonParseFloat.mjs";
|
|
5
|
+
export type * from "../internal/ws-simple-types.mjs";
|
|
6
|
+
export type { WebSocketAPIErrorMessage, WebSocketUntypedMessage } from "../internal/ws-parser.mjs";
|
|
5
7
|
//# sourceMappingURL=index.d.mts.map
|
package/lib/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"OAAO,EAAE,cAAc,EAAE;OAClB,EAAE,QAAQ,EAAE,eAAe,EAAE;
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"OAAO,EAAE,cAAc,EAAE;OAClB,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE;YACpC,EACV,qBAAqB,EACrB,kCAAkC,EAClC,2BAA2B,EAC3B,aAAa,EACb,iCAAiC,EACjC,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,GAC9B;OACM,EAAE,cAAc,EAAE;;YAGb,EAAE,wBAAwB,EAAE,uBAAuB,EAAE"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { createJwtToken } from "./jwtAuth.js";
|
|
2
|
-
export { WsStream, WsStreamManager } from "./ws.js";
|
|
3
|
-
export type { WsStreamOptions } from "./ws.js";
|
|
2
|
+
export { WsEndpoint, WsStream, WsStreamManager } from "./ws.js";
|
|
3
|
+
export type { WsAnnouncementOptions, WsDefaultListSubscriptionsResponse, WsListSubscriptionsResponse, WsSimpleEvent, WsSimpleListSubscriptionsResponse, WsStreamFormat, WsStreamOptions, WsIndicatorOptions, WsIndicatorSubscription, WsIndicatorSignalOptions, WsIndicatorSignalSubscription, } from "./ws.js";
|
|
4
4
|
export { jsonParseFloat } from "./jsonParseFloat.js";
|
|
5
|
+
export type * from "../internal/ws-simple-types.js";
|
|
6
|
+
export type { WebSocketAPIErrorMessage, WebSocketUntypedMessage } from "../internal/ws-parser.js";
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"OAAO,EAAE,cAAc,EAAE;OAClB,EAAE,QAAQ,EAAE,eAAe,EAAE;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"OAAO,EAAE,cAAc,EAAE;OAClB,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE;YACpC,EACV,qBAAqB,EACrB,kCAAkC,EAClC,2BAA2B,EAC3B,aAAa,EACb,iCAAiC,EACjC,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,GAC9B;OACM,EAAE,cAAc,EAAE;;YAGb,EAAE,wBAAwB,EAAE,uBAAuB,EAAE"}
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jsonParseFloat = exports.WsStreamManager = exports.WsStream = exports.createJwtToken = void 0;
|
|
3
|
+
exports.jsonParseFloat = exports.WsStreamManager = exports.WsStream = exports.WsEndpoint = exports.createJwtToken = void 0;
|
|
4
4
|
var jwtAuth_1 = require("./jwtAuth.js");
|
|
5
5
|
Object.defineProperty(exports, "createJwtToken", { enumerable: true, get: function () { return jwtAuth_1.createJwtToken; } });
|
|
6
6
|
var ws_1 = require("./ws.js");
|
|
7
|
+
Object.defineProperty(exports, "WsEndpoint", { enumerable: true, get: function () { return ws_1.WsEndpoint; } });
|
|
7
8
|
Object.defineProperty(exports, "WsStream", { enumerable: true, get: function () { return ws_1.WsStream; } });
|
|
8
9
|
Object.defineProperty(exports, "WsStreamManager", { enumerable: true, get: function () { return ws_1.WsStreamManager; } });
|
|
9
10
|
var jsonParseFloat_1 = require("./jsonParseFloat.js");
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":";;;AAAA,wCAA2C;AAAlC,yGAAA,cAAc,OAAA;AACvB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":";;;AAAA,wCAA2C;AAAlC,yGAAA,cAAc,OAAA;AACvB,8BAA6D;AAApD,gGAAA,UAAU,OAAA;AAAE,8FAAA,QAAQ,OAAA;AAAE,qGAAA,eAAe,OAAA;AAc9C,sDAAkD;AAAzC,gHAAA,cAAc,OAAA"}
|
package/lib/index.mjs
CHANGED
package/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"OAAO,EAAE,cAAc,EAAE;OAClB,EAAE,QAAQ,EAAE,eAAe,EAAE;
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"OAAO,EAAE,cAAc,EAAE;OAClB,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE;OAczC,EAAE,cAAc,EAAE"}
|
package/lib/jsonParseFloat.d.mts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Parses a JSON string with type-aware coercion.
|
|
3
3
|
*
|
|
4
|
-
* 1st pass (JSON.parse reviver):
|
|
5
|
-
*
|
|
6
|
-
* Uses the reviver's third argument `context.source` (TypeScript 5.2+ / modern runtimes).
|
|
4
|
+
* 1st pass (JSON.parse reviver): numeric tokens retain their original source
|
|
5
|
+
* alongside the parsed number. Uses the runtime's reviver `context.source`.
|
|
7
6
|
* Falls back to standard number parsing when `context.source` is unavailable.
|
|
8
7
|
*
|
|
9
8
|
* 2nd pass (constructType): coerces values to match SDK declared types.
|
|
10
9
|
* - `string`-declared fields: `number` → `string` (e.g. balance `0` → `"0"`)
|
|
11
10
|
* - `number`-declared fields: `string` → `number` (e.g. timestamp `"123.45"` → `123.45`)
|
|
12
11
|
*
|
|
13
|
-
*
|
|
12
|
+
* Integer scalars and integer array elements keep their existing number contract;
|
|
13
|
+
* decimal/exponent scalars and array elements keep their existing source strings.
|
|
14
14
|
*/
|
|
15
|
-
export declare function jsonParseFloat(text: string): unknown;
|
|
15
|
+
export declare function jsonParseFloat(text: string, numberField?: (key: string, path: string[], root: Record<string, unknown>) => boolean): unknown;
|
|
16
16
|
//# sourceMappingURL=jsonParseFloat.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonParseFloat.d.mts","sourceRoot":"","sources":["../src/lib/jsonParseFloat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jsonParseFloat.d.mts","sourceRoot":"","sources":["../src/lib/jsonParseFloat.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,GACpF,OAAO,CAQT"}
|
package/lib/jsonParseFloat.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Parses a JSON string with type-aware coercion.
|
|
3
3
|
*
|
|
4
|
-
* 1st pass (JSON.parse reviver):
|
|
5
|
-
*
|
|
6
|
-
* Uses the reviver's third argument `context.source` (TypeScript 5.2+ / modern runtimes).
|
|
4
|
+
* 1st pass (JSON.parse reviver): numeric tokens retain their original source
|
|
5
|
+
* alongside the parsed number. Uses the runtime's reviver `context.source`.
|
|
7
6
|
* Falls back to standard number parsing when `context.source` is unavailable.
|
|
8
7
|
*
|
|
9
8
|
* 2nd pass (constructType): coerces values to match SDK declared types.
|
|
10
9
|
* - `string`-declared fields: `number` → `string` (e.g. balance `0` → `"0"`)
|
|
11
10
|
* - `number`-declared fields: `string` → `number` (e.g. timestamp `"123.45"` → `123.45`)
|
|
12
11
|
*
|
|
13
|
-
*
|
|
12
|
+
* Integer scalars and integer array elements keep their existing number contract;
|
|
13
|
+
* decimal/exponent scalars and array elements keep their existing source strings.
|
|
14
14
|
*/
|
|
15
|
-
export declare function jsonParseFloat(text: string): unknown;
|
|
15
|
+
export declare function jsonParseFloat(text: string, numberField?: (key: string, path: string[], root: Record<string, unknown>) => boolean): unknown;
|
|
16
16
|
//# sourceMappingURL=jsonParseFloat.d.ts.map
|