@mtcute/core 0.10.0 → 0.10.2
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/cjs/highlevel/utils/entities.d.ts +19 -0
- package/cjs/highlevel/utils/entities.js +53 -0
- package/cjs/highlevel/utils/entities.js.map +1 -0
- package/cjs/highlevel/utils/index.d.ts +1 -0
- package/cjs/highlevel/utils/index.js +1 -0
- package/cjs/highlevel/utils/index.js.map +1 -1
- package/cjs/network/network-manager.js +1 -1
- package/cjs/types/utils.d.ts +1 -1
- package/cjs/types/utils.js.map +1 -1
- package/esm/highlevel/utils/entities.d.ts +19 -0
- package/esm/highlevel/utils/entities.js +49 -0
- package/esm/highlevel/utils/entities.js.map +1 -0
- package/esm/highlevel/utils/index.d.ts +1 -0
- package/esm/highlevel/utils/index.js +1 -0
- package/esm/highlevel/utils/index.js.map +1 -1
- package/esm/network/network-manager.js +1 -1
- package/esm/types/utils.d.ts +1 -1
- package/esm/types/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TextWithEntities } from '../types/misc/entities.js';
|
|
2
|
+
/**
|
|
3
|
+
* Join multiple text parts with entities into a single text with entities,
|
|
4
|
+
* adjusting the entities' offsets accordingly.
|
|
5
|
+
*
|
|
6
|
+
* @param parts List of text parts with entities
|
|
7
|
+
* @param delim Delimiter to insert between parts
|
|
8
|
+
* @returns A single text with entities
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* const scoreboardText = joinTextWithEntities(
|
|
13
|
+
* apiResult.scoreboard.map((entry) => html`<b>${entry.name}</b>: ${entry.score}`),
|
|
14
|
+
* html`<br>`
|
|
15
|
+
* )
|
|
16
|
+
* await tg.sendText(chatId, html`<b>scoreboard:</b><br><br>${scoreboardText}`)
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function joinTextWithEntities(parts: (string | TextWithEntities)[], delim?: string | TextWithEntities): TextWithEntities;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.joinTextWithEntities = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Join multiple text parts with entities into a single text with entities,
|
|
6
|
+
* adjusting the entities' offsets accordingly.
|
|
7
|
+
*
|
|
8
|
+
* @param parts List of text parts with entities
|
|
9
|
+
* @param delim Delimiter to insert between parts
|
|
10
|
+
* @returns A single text with entities
|
|
11
|
+
* @example
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* const scoreboardText = joinTextWithEntities(
|
|
15
|
+
* apiResult.scoreboard.map((entry) => html`<b>${entry.name}</b>: ${entry.score}`),
|
|
16
|
+
* html`<br>`
|
|
17
|
+
* )
|
|
18
|
+
* await tg.sendText(chatId, html`<b>scoreboard:</b><br><br>${scoreboardText}`)
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
function joinTextWithEntities(parts, delim = '') {
|
|
22
|
+
const textParts = [];
|
|
23
|
+
const newEntities = [];
|
|
24
|
+
let position = 0;
|
|
25
|
+
if (typeof delim === 'string') {
|
|
26
|
+
delim = { text: delim };
|
|
27
|
+
}
|
|
28
|
+
const pushPart = (part) => {
|
|
29
|
+
textParts.push(part.text);
|
|
30
|
+
const entitiesOffset = position;
|
|
31
|
+
position += part.text.length;
|
|
32
|
+
if (part.entities) {
|
|
33
|
+
for (const entity of part.entities) {
|
|
34
|
+
newEntities.push({
|
|
35
|
+
...entity,
|
|
36
|
+
offset: entity.offset + entitiesOffset,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
for (const part of parts) {
|
|
42
|
+
if (position > 0) {
|
|
43
|
+
pushPart(delim);
|
|
44
|
+
}
|
|
45
|
+
pushPart(typeof part === 'string' ? { text: part } : part);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
text: textParts.join(''),
|
|
49
|
+
entities: newEntities,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
exports.joinTextWithEntities = joinTextWithEntities;
|
|
53
|
+
//# sourceMappingURL=entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../../src/highlevel/utils/entities.ts"],"names":[],"mappings":";;;AAIA;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,oBAAoB,CAChC,KAAoC,EACpC,QAAmC,EAAE;IAErC,MAAM,SAAS,GAAa,EAAE,CAAA;IAC9B,MAAM,WAAW,GAA2B,EAAE,CAAA;IAE9C,IAAI,QAAQ,GAAG,CAAC,CAAA;IAEhB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,KAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;KAC1B;IAED,MAAM,QAAQ,GAAG,CAAC,IAAsB,EAAE,EAAE;QACxC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACzB,MAAM,cAAc,GAAG,QAAQ,CAAA;QAC/B,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAA;QAE5B,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE;gBAChC,WAAW,CAAC,IAAI,CAAC;oBACb,GAAG,MAAM;oBACT,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,cAAc;iBACzC,CAAC,CAAA;aACL;SACJ;IACL,CAAC,CAAA;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,IAAI,QAAQ,GAAG,CAAC,EAAE;YACd,QAAQ,CAAC,KAAK,CAAC,CAAA;SAClB;QAED,QAAQ,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;KAC7D;IAED,OAAO;QACH,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,QAAQ,EAAE,WAAW;KACxB,CAAA;AACL,CAAC;AAxCD,oDAwCC","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { TextWithEntities } from '../types/misc/entities.js'\n\n/**\n * Join multiple text parts with entities into a single text with entities,\n * adjusting the entities' offsets accordingly.\n *\n * @param parts List of text parts with entities\n * @param delim Delimiter to insert between parts\n * @returns A single text with entities\n * @example\n *\n * ```ts\n * const scoreboardText = joinTextWithEntities(\n * apiResult.scoreboard.map((entry) => html`<b>${entry.name}</b>: ${entry.score}`),\n * html`<br>`\n * )\n * await tg.sendText(chatId, html`<b>scoreboard:</b><br><br>${scoreboardText}`)\n * ```\n */\nexport function joinTextWithEntities(\n parts: (string | TextWithEntities)[],\n delim: string | TextWithEntities = '',\n): TextWithEntities {\n const textParts: string[] = []\n const newEntities: tl.TypeMessageEntity[] = []\n\n let position = 0\n\n if (typeof delim === 'string') {\n delim = { text: delim }\n }\n\n const pushPart = (part: TextWithEntities) => {\n textParts.push(part.text)\n const entitiesOffset = position\n position += part.text.length\n\n if (part.entities) {\n for (const entity of part.entities) {\n newEntities.push({\n ...entity,\n offset: entity.offset + entitiesOffset,\n })\n }\n }\n }\n\n for (const part of parts) {\n if (position > 0) {\n pushPart(delim)\n }\n\n pushPart(typeof part === 'string' ? { text: part } : part)\n }\n\n return {\n text: textParts.join(''),\n entities: newEntities,\n }\n}\n"]}
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
__exportStar(require("./entities.js"), exports);
|
|
18
19
|
__exportStar(require("./file-utils.js"), exports);
|
|
19
20
|
__exportStar(require("./inline-utils.js"), exports);
|
|
20
21
|
__exportStar(require("./inspectable.js"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/highlevel/utils/index.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;;;;;;;;;;;;;;AAE5C,kDAA+B;AAC/B,oDAAiC;AACjC,mDAAgC;AAChC,kDAA+B;AAC/B,kDAA+B;AAC/B,iDAA8B;AAC9B,oDAAiC;AACjC,sDAAmC;AACnC,mDAAgC","sourcesContent":["// todo: merge this with the main utils dir?\n\nexport * from './file-utils.js'\nexport * from './inline-utils.js'\nexport * from './inspectable.js'\nexport * from './misc-utils.js'\nexport * from './peer-utils.js'\nexport * from './rps-meter.js'\nexport * from './stream-utils.js'\nexport * from './string-session.js'\nexport * from './voice-utils.js'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/highlevel/utils/index.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;;;;;;;;;;;;;;AAE5C,gDAA6B;AAC7B,kDAA+B;AAC/B,oDAAiC;AACjC,mDAAgC;AAChC,kDAA+B;AAC/B,kDAA+B;AAC/B,iDAA8B;AAC9B,oDAAiC;AACjC,sDAAmC;AACnC,mDAAgC","sourcesContent":["// todo: merge this with the main utils dir?\n\nexport * from './entities.js'\nexport * from './file-utils.js'\nexport * from './inline-utils.js'\nexport * from './inspectable.js'\nexport * from './misc-utils.js'\nexport * from './peer-utils.js'\nexport * from './rps-meter.js'\nexport * from './stream-utils.js'\nexport * from './string-session.js'\nexport * from './voice-utils.js'\n"]}
|
package/cjs/types/utils.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export type MaybePromise<T> = T | Promise<T>;
|
|
|
2
2
|
export type PartialExcept<T, K extends keyof T> = Partial<Omit<T, K>> & Pick<T, K>;
|
|
3
3
|
export type PartialOnly<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
|
|
4
4
|
export type MaybeArray<T> = T | T[];
|
|
5
|
-
export type MustEqual<T, V> = T extends V ? (V extends T ? T : V) : V;
|
|
5
|
+
export type MustEqual<T, V> = (() => T) extends () => V ? ((() => V) extends () => T ? T : V) : V;
|
|
6
6
|
export type PublicPart<T> = {
|
|
7
7
|
[K in keyof T]: T[K];
|
|
8
8
|
};
|
package/cjs/types/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/types/utils.ts"],"names":[],"mappings":";;;AAUA,6DAA6D;AAC7D,SAAgB,WAAW,CAAC,CAAQ;IAChC,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;AACpC,CAAC;AAFD,kCAEC","sourcesContent":["export type MaybePromise<T> = T | Promise<T>\nexport type PartialExcept<T, K extends keyof T> = Partial<Omit<T, K>> & Pick<T, K>\nexport type PartialOnly<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>\n\nexport type MaybeArray<T> = T | T[]\n\nexport type MustEqual<T, V> = T extends V ? (V extends T ? T : V) : V\n\nexport type PublicPart<T> = { [K in keyof T]: T[K] }\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function assertNever(x: never): never {\n throw new Error('Illegal state')\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/types/utils.ts"],"names":[],"mappings":";;;AAUA,6DAA6D;AAC7D,SAAgB,WAAW,CAAC,CAAQ;IAChC,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;AACpC,CAAC;AAFD,kCAEC","sourcesContent":["export type MaybePromise<T> = T | Promise<T>\nexport type PartialExcept<T, K extends keyof T> = Partial<Omit<T, K>> & Pick<T, K>\nexport type PartialOnly<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>\n\nexport type MaybeArray<T> = T | T[]\n\nexport type MustEqual<T, V> = (() => T) extends () => V ? ((() => V) extends () => T ? T : V) : V\n\nexport type PublicPart<T> = { [K in keyof T]: T[K] }\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function assertNever(x: never): never {\n throw new Error('Illegal state')\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TextWithEntities } from '../types/misc/entities.js';
|
|
2
|
+
/**
|
|
3
|
+
* Join multiple text parts with entities into a single text with entities,
|
|
4
|
+
* adjusting the entities' offsets accordingly.
|
|
5
|
+
*
|
|
6
|
+
* @param parts List of text parts with entities
|
|
7
|
+
* @param delim Delimiter to insert between parts
|
|
8
|
+
* @returns A single text with entities
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* const scoreboardText = joinTextWithEntities(
|
|
13
|
+
* apiResult.scoreboard.map((entry) => html`<b>${entry.name}</b>: ${entry.score}`),
|
|
14
|
+
* html`<br>`
|
|
15
|
+
* )
|
|
16
|
+
* await tg.sendText(chatId, html`<b>scoreboard:</b><br><br>${scoreboardText}`)
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function joinTextWithEntities(parts: (string | TextWithEntities)[], delim?: string | TextWithEntities): TextWithEntities;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Join multiple text parts with entities into a single text with entities,
|
|
3
|
+
* adjusting the entities' offsets accordingly.
|
|
4
|
+
*
|
|
5
|
+
* @param parts List of text parts with entities
|
|
6
|
+
* @param delim Delimiter to insert between parts
|
|
7
|
+
* @returns A single text with entities
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* const scoreboardText = joinTextWithEntities(
|
|
12
|
+
* apiResult.scoreboard.map((entry) => html`<b>${entry.name}</b>: ${entry.score}`),
|
|
13
|
+
* html`<br>`
|
|
14
|
+
* )
|
|
15
|
+
* await tg.sendText(chatId, html`<b>scoreboard:</b><br><br>${scoreboardText}`)
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export function joinTextWithEntities(parts, delim = '') {
|
|
19
|
+
const textParts = [];
|
|
20
|
+
const newEntities = [];
|
|
21
|
+
let position = 0;
|
|
22
|
+
if (typeof delim === 'string') {
|
|
23
|
+
delim = { text: delim };
|
|
24
|
+
}
|
|
25
|
+
const pushPart = (part) => {
|
|
26
|
+
textParts.push(part.text);
|
|
27
|
+
const entitiesOffset = position;
|
|
28
|
+
position += part.text.length;
|
|
29
|
+
if (part.entities) {
|
|
30
|
+
for (const entity of part.entities) {
|
|
31
|
+
newEntities.push({
|
|
32
|
+
...entity,
|
|
33
|
+
offset: entity.offset + entitiesOffset,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
for (const part of parts) {
|
|
39
|
+
if (position > 0) {
|
|
40
|
+
pushPart(delim);
|
|
41
|
+
}
|
|
42
|
+
pushPart(typeof part === 'string' ? { text: part } : part);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
text: textParts.join(''),
|
|
46
|
+
entities: newEntities,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../../src/highlevel/utils/entities.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,oBAAoB,CAChC,KAAoC,EACpC,QAAmC,EAAE;IAErC,MAAM,SAAS,GAAa,EAAE,CAAA;IAC9B,MAAM,WAAW,GAA2B,EAAE,CAAA;IAE9C,IAAI,QAAQ,GAAG,CAAC,CAAA;IAEhB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,KAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;KAC1B;IAED,MAAM,QAAQ,GAAG,CAAC,IAAsB,EAAE,EAAE;QACxC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACzB,MAAM,cAAc,GAAG,QAAQ,CAAA;QAC/B,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAA;QAE5B,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE;gBAChC,WAAW,CAAC,IAAI,CAAC;oBACb,GAAG,MAAM;oBACT,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,cAAc;iBACzC,CAAC,CAAA;aACL;SACJ;IACL,CAAC,CAAA;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,IAAI,QAAQ,GAAG,CAAC,EAAE;YACd,QAAQ,CAAC,KAAK,CAAC,CAAA;SAClB;QAED,QAAQ,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;KAC7D;IAED,OAAO;QACH,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,QAAQ,EAAE,WAAW;KACxB,CAAA;AACL,CAAC","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { TextWithEntities } from '../types/misc/entities.js'\n\n/**\n * Join multiple text parts with entities into a single text with entities,\n * adjusting the entities' offsets accordingly.\n *\n * @param parts List of text parts with entities\n * @param delim Delimiter to insert between parts\n * @returns A single text with entities\n * @example\n *\n * ```ts\n * const scoreboardText = joinTextWithEntities(\n * apiResult.scoreboard.map((entry) => html`<b>${entry.name}</b>: ${entry.score}`),\n * html`<br>`\n * )\n * await tg.sendText(chatId, html`<b>scoreboard:</b><br><br>${scoreboardText}`)\n * ```\n */\nexport function joinTextWithEntities(\n parts: (string | TextWithEntities)[],\n delim: string | TextWithEntities = '',\n): TextWithEntities {\n const textParts: string[] = []\n const newEntities: tl.TypeMessageEntity[] = []\n\n let position = 0\n\n if (typeof delim === 'string') {\n delim = { text: delim }\n }\n\n const pushPart = (part: TextWithEntities) => {\n textParts.push(part.text)\n const entitiesOffset = position\n position += part.text.length\n\n if (part.entities) {\n for (const entity of part.entities) {\n newEntities.push({\n ...entity,\n offset: entity.offset + entitiesOffset,\n })\n }\n }\n }\n\n for (const part of parts) {\n if (position > 0) {\n pushPart(delim)\n }\n\n pushPart(typeof part === 'string' ? { text: part } : part)\n }\n\n return {\n text: textParts.join(''),\n entities: newEntities,\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/highlevel/utils/index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAE5C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA","sourcesContent":["// todo: merge this with the main utils dir?\n\nexport * from './file-utils.js'\nexport * from './inline-utils.js'\nexport * from './inspectable.js'\nexport * from './misc-utils.js'\nexport * from './peer-utils.js'\nexport * from './rps-meter.js'\nexport * from './stream-utils.js'\nexport * from './string-session.js'\nexport * from './voice-utils.js'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/highlevel/utils/index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAE5C,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA","sourcesContent":["// todo: merge this with the main utils dir?\n\nexport * from './entities.js'\nexport * from './file-utils.js'\nexport * from './inline-utils.js'\nexport * from './inspectable.js'\nexport * from './misc-utils.js'\nexport * from './peer-utils.js'\nexport * from './rps-meter.js'\nexport * from './stream-utils.js'\nexport * from './string-session.js'\nexport * from './voice-utils.js'\n"]}
|
package/esm/types/utils.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export type MaybePromise<T> = T | Promise<T>;
|
|
|
2
2
|
export type PartialExcept<T, K extends keyof T> = Partial<Omit<T, K>> & Pick<T, K>;
|
|
3
3
|
export type PartialOnly<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
|
|
4
4
|
export type MaybeArray<T> = T | T[];
|
|
5
|
-
export type MustEqual<T, V> = T extends V ? (V extends T ? T : V) : V;
|
|
5
|
+
export type MustEqual<T, V> = (() => T) extends () => V ? ((() => V) extends () => T ? T : V) : V;
|
|
6
6
|
export type PublicPart<T> = {
|
|
7
7
|
[K in keyof T]: T[K];
|
|
8
8
|
};
|
package/esm/types/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/types/utils.ts"],"names":[],"mappings":"AAUA,6DAA6D;AAC7D,MAAM,UAAU,WAAW,CAAC,CAAQ;IAChC,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;AACpC,CAAC","sourcesContent":["export type MaybePromise<T> = T | Promise<T>\nexport type PartialExcept<T, K extends keyof T> = Partial<Omit<T, K>> & Pick<T, K>\nexport type PartialOnly<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>\n\nexport type MaybeArray<T> = T | T[]\n\nexport type MustEqual<T, V> = T extends V ? (V extends T ? T : V) : V\n\nexport type PublicPart<T> = { [K in keyof T]: T[K] }\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function assertNever(x: never): never {\n throw new Error('Illegal state')\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/types/utils.ts"],"names":[],"mappings":"AAUA,6DAA6D;AAC7D,MAAM,UAAU,WAAW,CAAC,CAAQ;IAChC,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;AACpC,CAAC","sourcesContent":["export type MaybePromise<T> = T | Promise<T>\nexport type PartialExcept<T, K extends keyof T> = Partial<Omit<T, K>> & Pick<T, K>\nexport type PartialOnly<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>\n\nexport type MaybeArray<T> = T | T[]\n\nexport type MustEqual<T, V> = (() => T) extends () => V ? ((() => V) extends () => T ? T : V) : V\n\nexport type PublicPart<T> = { [K in keyof T]: T[K] }\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function assertNever(x: never): never {\n throw new Error('Illegal state')\n}\n"]}
|