@cr_docs_t/dts 0.29.0 → 0.30.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.
@@ -1 +1 @@
1
- {"version":3,"file":"FugueTree.d.ts","sourceRoot":"","sources":["../../../src/dts/FugueTree/FugueTree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAa,MAAM,kCAAkC,CAAC;AAG3E,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAE9C;;GAEG;AACH,qBAAa,SAAS;IAClB,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,IAAI,CAAQ;IACpB,EAAE,EAAE,SAAS,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,SAAS,SAAmB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,4BAAmC;IAE9C,QAAQ,CAAC,SAAS,OAAO;gBAEb,EAAE,EAAE,SAAS,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAO1E;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAIlB;;;OAGG;IACH,OAAO,CAAC,SAAS;IAQjB;;;;;OAKG;IACH,OAAO,CAAC,UAAU;IA+ClB;;;;OAIG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IA+B5C;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAOnC;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAsBlB;;;;OAIG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IA4B5C;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM;IAKpB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAgCnB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAk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EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IA+B5C;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAOnC;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAuBlB;;;;OAIG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IA4B5C;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM;IAKpB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAgCnB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAkBtB;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,YAAY,GAAG,YAAY,EAAE,GAAG,YAAY,EAAE;IAuB1D;;;;OAIG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAS1B;;;OAGG;IACH,MAAM,IAAI,MAAM;IAIhB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAWjB;;;OAGG;IACH,IAAI,IAAI,UAAU;IAKlB;;;OAGG;IACH,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAK5B;;;;;OAKG;IACH,SAAS,IAAI,MAAM;IAInB;;;;OAIG;IACH,OAAO,CAAC,EAAE,EAAE,EAAE;IAId;;;;OAIG;IACH,eAAe,CAAC,IAAI,EAAE,KAAK;IAI3B,QAAQ;CAGX"}
@@ -1,4 +1,5 @@
1
1
  import { Operation } from "../../types/FugueTree/Message.js";
2
+ import { MessageType } from "../../types/Message.js";
2
3
  import { randomString } from "../../utils/index.js";
3
4
  import { FugueMessageSerialzier } from "../Serailizers/FugueTree/index.js";
4
5
  import { FTree } from "./FTree.js";
@@ -53,6 +54,7 @@ export class FugueTree {
53
54
  // leftOrigin has no right children, so the new node becomes
54
55
  // a right child of leftOrigin.
55
56
  msg = {
57
+ msgType: MessageType.FUGUE,
56
58
  userIdentity: this.userIdentity,
57
59
  operation: Operation.INSERT,
58
60
  id,
@@ -74,6 +76,7 @@ export class FugueTree {
74
76
  // first right child.
75
77
  const rightOrigin = this.tree.leftmostDescendant(leftOrigin.rightChildren[0]);
76
78
  msg = {
79
+ msgType: MessageType.FUGUE,
77
80
  userIdentity: this.userIdentity,
78
81
  operation: Operation.INSERT,
79
82
  id,
@@ -142,6 +145,7 @@ export class FugueTree {
142
145
  this.tree.updateSize(node, -1);
143
146
  }
144
147
  const msg = {
148
+ msgType: MessageType.FUGUE,
145
149
  operation: Operation.DELETE,
146
150
  documentID: this.documentID,
147
151
  replicaId: this.replicaID,
@@ -1,13 +1,9 @@
1
- import { BaseFugueMessage, FugueMessageType } from "../../../types/FugueTree/index.js";
1
+ import { BaseFugueMessage } from "../../../types/FugueTree/index.js";
2
2
  declare function serialize(msgs: BaseFugueMessage[]): Uint8Array<ArrayBuffer>;
3
- declare function serializeSingleMessage(msg: FugueMessageType): Uint8Array<ArrayBuffer>;
4
3
  declare function deserialize(data: Uint8Array): BaseFugueMessage[];
5
- declare function deserializeSingleMessage(data: Uint8Array): BaseFugueMessage;
6
4
  export declare const FugueMessageSerialzier: {
7
5
  serialize: typeof serialize;
8
- serializeSingleMessage: typeof serializeSingleMessage;
9
6
  deserialize: typeof deserialize;
10
- deserializeSingleMessage: typeof deserializeSingleMessage;
11
7
  };
12
8
  export {};
13
9
  //# sourceMappingURL=Message.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../../src/dts/Serailizers/FugueTree/Message.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAEvF,iBAAS,SAAS,CAAC,IAAI,EAAE,gBAAgB,EAAE,2BAE1C;AAED,iBAAS,sBAAsB,CAAC,GAAG,EAAE,gBAAgB,2BAEpD;AAED,iBAAS,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,gBAAgB,EAAE,CAGzD;AAED,iBAAS,wBAAwB,CAAC,IAAI,EAAE,UAAU,GAAG,gBAAgB,CAGpE;AAED,eAAO,MAAM,sBAAsB;;;;;CAKlC,CAAC"}
1
+ {"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../../src/dts/Serailizers/FugueTree/Message.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAoB,MAAM,mCAAmC,CAAC;AAGvF,iBAAS,SAAS,CAAC,IAAI,EAAE,gBAAgB,EAAE,2BAS1C;AAED,iBAAS,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,gBAAgB,EAAE,CAMzD;AAED,eAAO,MAAM,sBAAsB;;;CAGlC,CAAC"}
@@ -1,21 +1,23 @@
1
1
  import { encode, decode } from "@msgpack/msgpack";
2
+ import { MessageType } from "../../../types/Message.js";
2
3
  function serialize(msgs) {
3
- return encode(msgs);
4
- }
5
- function serializeSingleMessage(msg) {
6
- return encode(msg);
4
+ if (msgs.length === 0)
5
+ return new Uint8Array();
6
+ const enced = encode(msgs);
7
+ // Add magic byte at the beginning to indicate message type
8
+ const buff = new Uint8Array(enced.length + 1);
9
+ buff[0] = MessageType.FUGUE;
10
+ buff.set(enced, 1);
11
+ return buff;
7
12
  }
8
13
  function deserialize(data) {
9
- const dec = decode(data);
10
- return dec;
11
- }
12
- function deserializeSingleMessage(data) {
13
- const dec = decode(data);
14
- return dec;
14
+ if (data.length === 0)
15
+ return [];
16
+ const type = data[0];
17
+ const payload = data.slice(1);
18
+ return decode(payload);
15
19
  }
16
20
  export const FugueMessageSerialzier = {
17
21
  serialize,
18
- serializeSingleMessage,
19
22
  deserialize,
20
- deserializeSingleMessage,
21
23
  };
@@ -0,0 +1,12 @@
1
+ import { BasePresenceMessage } from "../../types/Presence.js";
2
+ import { BaseMessage } from "../../types/Message.js";
3
+ import { BaseFugueMessage } from "../../types/index.js";
4
+ export type Message = BaseFugueMessage[] | BasePresenceMessage[];
5
+ declare function serialize(msgs: BaseMessage | BaseMessage[]): Uint8Array;
6
+ declare function deserialize(bytes: Uint8Array): Message;
7
+ export declare const Seralizer: {
8
+ serialize: typeof serialize;
9
+ deserialize: typeof deserialize;
10
+ };
11
+ export {};
12
+ //# sourceMappingURL=General.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"General.d.ts","sourceRoot":"","sources":["../../../src/dts/Serailizers/General.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAe,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAIxD,MAAM,MAAM,OAAO,GAAG,gBAAgB,EAAE,GAAG,mBAAmB,EAAE,CAAC;AAEjE,iBAAS,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,EAAE,GAAG,UAAU,CAchE;AAED,iBAAS,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAgB/C;AAED,eAAO,MAAM,SAAS;;;CAGrB,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { MessageType } from "../../types/Message.js";
2
+ import { FugueMessageSerialzier } from "./FugueTree/Message.js";
3
+ import { PresenceMessageSerializer } from "./Presence.js";
4
+ function serialize(msgs) {
5
+ const msgArr = Array.isArray(msgs) ? msgs : [msgs];
6
+ const type = msgArr[0].msgType;
7
+ switch (type) {
8
+ case MessageType.FUGUE:
9
+ return FugueMessageSerialzier.serialize(msgArr);
10
+ case MessageType.PRESENCE:
11
+ return PresenceMessageSerializer.serialize(msgArr);
12
+ default:
13
+ // Exhastive check to make sure we handled all message types
14
+ const _exhaustiveCheck = type;
15
+ throw new Error(`Unsupported message type: ${type}`);
16
+ }
17
+ }
18
+ function deserialize(bytes) {
19
+ if (bytes.length === 0)
20
+ return [];
21
+ // Read magic byte to determine message type
22
+ const type = bytes[0];
23
+ switch (type) {
24
+ case MessageType.FUGUE:
25
+ return FugueMessageSerialzier.deserialize(bytes);
26
+ case MessageType.PRESENCE:
27
+ return PresenceMessageSerializer.deserialize(bytes);
28
+ default:
29
+ // Exhastive check to make sure we handled all message types
30
+ const _exhaustiveCheck = type;
31
+ throw new Error(`Unsupported message type: ${type}`);
32
+ }
33
+ }
34
+ export const Seralizer = {
35
+ serialize,
36
+ deserialize,
37
+ };
@@ -0,0 +1,9 @@
1
+ import { BasePresenceMessage } from "../../types/Presence.js";
2
+ declare function serialize(msgs: BasePresenceMessage[]): Uint8Array<ArrayBuffer>;
3
+ declare function deserialize(data: Uint8Array): BasePresenceMessage[];
4
+ export declare const PresenceMessageSerializer: {
5
+ serialize: typeof serialize;
6
+ deserialize: typeof deserialize;
7
+ };
8
+ export {};
9
+ //# sourceMappingURL=Presence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Presence.d.ts","sourceRoot":"","sources":["../../../src/dts/Serailizers/Presence.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,iBAAS,SAAS,CAAC,IAAI,EAAE,mBAAmB,EAAE,2BAS7C;AAED,iBAAS,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,mBAAmB,EAAE,CAM5D;AAED,eAAO,MAAM,yBAAyB;;;CAGrC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { encode, decode } from "@msgpack/msgpack";
2
+ import { MessageType } from "../../types/Message.js";
3
+ function serialize(msgs) {
4
+ if (msgs.length === 0)
5
+ return new Uint8Array();
6
+ const enced = encode(msgs);
7
+ // Add magic byte at the beginning to indicate message type
8
+ const buff = new Uint8Array(enced.length + 1);
9
+ buff[0] = MessageType.PRESENCE;
10
+ buff.set(enced, 1);
11
+ return buff;
12
+ }
13
+ function deserialize(data) {
14
+ if (data.length === 0)
15
+ return [];
16
+ const type = data[0];
17
+ const payload = data.slice(1);
18
+ return decode(payload);
19
+ }
20
+ export const PresenceMessageSerializer = {
21
+ serialize,
22
+ deserialize,
23
+ };
@@ -1,2 +1,4 @@
1
1
  export * from "./FugueTree/index.js";
2
+ export * from "./Presence.js";
3
+ export * from "./General.js";
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dts/Serailizers/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dts/Serailizers/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
@@ -1,2 +1,4 @@
1
1
  // export * from "./Fugue/index.js";
2
2
  export * from "./FugueTree/index.js";
3
+ export * from "./Presence.js";
4
+ export * from "./General.js";
@@ -1,4 +1,5 @@
1
- import { ID, NodeSide } from "../../dts/FugueTree/FTree";
1
+ import { ID, NodeSide } from "../../dts/FugueTree/FTree.js";
2
+ import { BaseMessage, MessageType } from "../Message.js";
2
3
  export declare enum Operation {
3
4
  INSERT = 0,
4
5
  DELETE = 1,
@@ -9,11 +10,9 @@ export declare enum Operation {
9
10
  }
10
11
  export declare function operationToString(op: Operation): string;
11
12
  export type Data = string;
12
- export interface BaseFugueMessage<T extends Operation = Operation> {
13
+ export interface BaseFugueMessage<T extends Operation = Operation> extends BaseMessage<MessageType.FUGUE> {
13
14
  operation: T;
14
- documentID: string;
15
15
  replicaId: string;
16
- userIdentity: string;
17
16
  }
18
17
  export interface FugueMessage extends BaseFugueMessage<Operation.INSERT | Operation.DELETE> {
19
18
  id: ID;
@@ -39,4 +38,5 @@ export interface FugueUserJoinMessage extends BaseFugueMessage<Operation.USER_JO
39
38
  }
40
39
  export type FugueMessageType = FugueMessage | FugueJoinMessage | FugueRejectMessage | FugueLeaveMessage | FugueUserJoinMessage;
41
40
  export type FugueMutationMessageTypes = Extract<FugueMessageType, FugueMessage | FugueJoinMessage>;
41
+ export declare const makeFugueMessage: <T extends FugueMessageType>(msg: Omit<T, "msgType">) => BaseFugueMessage;
42
42
  //# sourceMappingURL=Message.d.ts.map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AM,CAAC,EAAE,EAAE,CAAC;IACZ,WAAW,CAAC,EAAE,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB,CAAC,SAAS,CAAC,YAAY,CAAC;IAC9E,KAAK,EAAE,UAAU,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC;CAE7C;AAED,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB,CAAC,SAAS,CAAC,MAAM,CAAC;IAC1E,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC;IACxE,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB,CAAC,SAAS,CAAC,SAAS,CAAC;IAC/E,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;CAC9C;AAED,MAAM,MAAM,gBAAgB,GACtB,YAAY,GACZ,gBAAgB,GAChB,kBAAkB,GAClB,iBAAiB,GACjB,oBAAoB,CAAC;AAE3B,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAC,gBAAgB,EAAE,YAAY,GAAG,gBAAgB,CAAC,CAAC;AAEnG,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,gBAAgB,EAAE,KAAK,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,KAAG,gBAKtF,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { MessageType } from "../Message.js";
1
2
  export var Operation;
2
3
  (function (Operation) {
3
4
  Operation[Operation["INSERT"] = 0] = "INSERT";
@@ -25,3 +26,9 @@ export function operationToString(op) {
25
26
  return "UNKNOWN_OPERATION";
26
27
  }
27
28
  }
29
+ export const makeFugueMessage = (msg) => {
30
+ return {
31
+ ...msg,
32
+ msgType: MessageType.FUGUE,
33
+ };
34
+ };
@@ -0,0 +1,10 @@
1
+ export declare enum MessageType {
2
+ FUGUE = 0,
3
+ PRESENCE = 1
4
+ }
5
+ export interface BaseMessage<T extends MessageType = MessageType> {
6
+ msgType: T;
7
+ documentID: string;
8
+ userIdentity: string;
9
+ }
10
+ //# sourceMappingURL=Message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../src/types/Message.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACnB,KAAK,IAAA;IACL,QAAQ,IAAA;CACX;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW;IAC5D,OAAO,EAAE,CAAC,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACxB"}
@@ -0,0 +1,5 @@
1
+ export var MessageType;
2
+ (function (MessageType) {
3
+ MessageType[MessageType["FUGUE"] = 0] = "FUGUE";
4
+ MessageType[MessageType["PRESENCE"] = 1] = "PRESENCE";
5
+ })(MessageType || (MessageType = {}));
@@ -0,0 +1,14 @@
1
+ import { BaseMessage, MessageType } from "./Message.js";
2
+ export declare enum PresenceMessageType {
3
+ CURSOR = 0,
4
+ SELECTION = 1
5
+ }
6
+ export interface BasePresenceMessage<T extends PresenceMessageType = PresenceMessageType> extends BaseMessage<MessageType.PRESENCE> {
7
+ type: T;
8
+ }
9
+ export interface PresenceCursorMessage extends BasePresenceMessage<PresenceMessageType.CURSOR> {
10
+ pos: number;
11
+ }
12
+ export type PresenceMessage = PresenceCursorMessage;
13
+ export declare const makePresenceMsg: <T extends PresenceMessage>(msg: Omit<T, "msgType">) => BasePresenceMessage;
14
+ //# sourceMappingURL=Presence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Presence.d.ts","sourceRoot":"","sources":["../../src/types/Presence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAExD,oBAAY,mBAAmB;IAC3B,MAAM,IAAA;IACN,SAAS,IAAA;CACZ;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,mBAAmB,GAAG,mBAAmB,CACpF,SAAQ,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC;CACX;AAED,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB,CAAC,mBAAmB,CAAC,MAAM,CAAC;IAC1F,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAEpD,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,eAAe,EAAE,KAAK,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,KAAG,mBAKpF,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { MessageType } from "./Message.js";
2
+ export var PresenceMessageType;
3
+ (function (PresenceMessageType) {
4
+ PresenceMessageType[PresenceMessageType["CURSOR"] = 0] = "CURSOR";
5
+ PresenceMessageType[PresenceMessageType["SELECTION"] = 1] = "SELECTION";
6
+ })(PresenceMessageType || (PresenceMessageType = {}));
7
+ export const makePresenceMsg = (msg) => {
8
+ return {
9
+ ...msg,
10
+ msgType: MessageType.PRESENCE,
11
+ };
12
+ };
@@ -2,4 +2,6 @@ export * from "./FugueTree/index.js";
2
2
  export * from "./Enums.js";
3
3
  export * from "./Models/index.js";
4
4
  export * from "./Pagination.js";
5
+ export * from "./Presence.js";
6
+ export * from "./Message.js";
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
@@ -3,3 +3,5 @@ export * from "./FugueTree/index.js";
3
3
  export * from "./Enums.js";
4
4
  export * from "./Models/index.js";
5
5
  export * from "./Pagination.js";
6
+ export * from "./Presence.js";
7
+ export * from "./Message.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cr_docs_t/dts",
3
- "version": "0.29.0",
3
+ "version": "0.30.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",