bc-minecraft-bedrock-types 1.2.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.
Files changed (144) hide show
  1. package/LICENSE +29 -0
  2. package/README.md +7 -0
  3. package/lib/src/General/Boolean.d.ts +11 -0
  4. package/lib/src/General/Boolean.js +37 -0
  5. package/lib/src/General/Boolean.js.map +1 -0
  6. package/lib/src/General/Float.d.ts +11 -0
  7. package/lib/src/General/Float.js +19 -0
  8. package/lib/src/General/Float.js.map +1 -0
  9. package/lib/src/General/Integer.d.ts +9 -0
  10. package/lib/src/General/Integer.js +17 -0
  11. package/lib/src/General/Integer.js.map +1 -0
  12. package/lib/src/General/Json.d.ts +11 -0
  13. package/lib/src/General/Json.js +26 -0
  14. package/lib/src/General/Json.js.map +1 -0
  15. package/lib/src/General/String.d.ts +7 -0
  16. package/lib/src/General/String.js +20 -0
  17. package/lib/src/General/String.js.map +1 -0
  18. package/lib/src/General/include.d.ts +5 -0
  19. package/lib/src/General/include.js +19 -0
  20. package/lib/src/General/include.js.map +1 -0
  21. package/lib/src/Minecraft/Block.d.ts +70 -0
  22. package/lib/src/Minecraft/Block.js +126 -0
  23. package/lib/src/Minecraft/Block.js.map +1 -0
  24. package/lib/src/Minecraft/Coordinate.d.ts +9 -0
  25. package/lib/src/Minecraft/Coordinate.js +17 -0
  26. package/lib/src/Minecraft/Coordinate.js.map +1 -0
  27. package/lib/src/Minecraft/Selector.d.ts +126 -0
  28. package/lib/src/Minecraft/Selector.js +278 -0
  29. package/lib/src/Minecraft/Selector.js.map +1 -0
  30. package/lib/src/Minecraft/Xp.d.ts +16 -0
  31. package/lib/src/Minecraft/Xp.js +33 -0
  32. package/lib/src/Minecraft/Xp.js.map +1 -0
  33. package/lib/src/Minecraft/include.d.ts +4 -0
  34. package/lib/src/Minecraft/include.js +18 -0
  35. package/lib/src/Minecraft/include.js.map +1 -0
  36. package/lib/src/Modes/CameraShake.d.ts +3 -0
  37. package/lib/src/Modes/CameraShake.js +12 -0
  38. package/lib/src/Modes/CameraShake.js.map +1 -0
  39. package/lib/src/Modes/Clone.d.ts +3 -0
  40. package/lib/src/Modes/Clone.js +16 -0
  41. package/lib/src/Modes/Clone.js.map +1 -0
  42. package/lib/src/Modes/Difficulty.d.ts +3 -0
  43. package/lib/src/Modes/Difficulty.js +22 -0
  44. package/lib/src/Modes/Difficulty.js.map +1 -0
  45. package/lib/src/Modes/Fill.d.ts +3 -0
  46. package/lib/src/Modes/Fill.js +15 -0
  47. package/lib/src/Modes/Fill.js.map +1 -0
  48. package/lib/src/Modes/GameMode.d.ts +3 -0
  49. package/lib/src/Modes/GameMode.js +19 -0
  50. package/lib/src/Modes/GameMode.js.map +1 -0
  51. package/lib/src/Modes/LocateFeature.d.ts +3 -0
  52. package/lib/src/Modes/LocateFeature.js +24 -0
  53. package/lib/src/Modes/LocateFeature.js.map +1 -0
  54. package/lib/src/Modes/Mask.d.ts +3 -0
  55. package/lib/src/Modes/Mask.js +13 -0
  56. package/lib/src/Modes/Mask.js.map +1 -0
  57. package/lib/src/Modes/Mirror.d.ts +3 -0
  58. package/lib/src/Modes/Mirror.js +14 -0
  59. package/lib/src/Modes/Mirror.js.map +1 -0
  60. package/lib/src/Modes/ModeCollection.d.ts +44 -0
  61. package/lib/src/Modes/ModeCollection.js +71 -0
  62. package/lib/src/Modes/ModeCollection.js.map +1 -0
  63. package/lib/src/Modes/ModeHandler.d.ts +30 -0
  64. package/lib/src/Modes/ModeHandler.js +40 -0
  65. package/lib/src/Modes/ModeHandler.js.map +1 -0
  66. package/lib/src/Modes/Modes.d.ts +46 -0
  67. package/lib/src/Modes/Modes.js +72 -0
  68. package/lib/src/Modes/Modes.js.map +1 -0
  69. package/lib/src/Modes/MusicRepeat.d.ts +3 -0
  70. package/lib/src/Modes/MusicRepeat.js +12 -0
  71. package/lib/src/Modes/MusicRepeat.js.map +1 -0
  72. package/lib/src/Modes/OldBlock.d.ts +3 -0
  73. package/lib/src/Modes/OldBlock.js +13 -0
  74. package/lib/src/Modes/OldBlock.js.map +1 -0
  75. package/lib/src/Modes/Operation.d.ts +3 -0
  76. package/lib/src/Modes/Operation.js +19 -0
  77. package/lib/src/Modes/Operation.js.map +1 -0
  78. package/lib/src/Modes/Replace.d.ts +3 -0
  79. package/lib/src/Modes/Replace.js +12 -0
  80. package/lib/src/Modes/Replace.js.map +1 -0
  81. package/lib/src/Modes/RideFill.d.ts +3 -0
  82. package/lib/src/Modes/RideFill.js +12 -0
  83. package/lib/src/Modes/RideFill.js.map +1 -0
  84. package/lib/src/Modes/RideRules.d.ts +3 -0
  85. package/lib/src/Modes/RideRules.js +13 -0
  86. package/lib/src/Modes/RideRules.js.map +1 -0
  87. package/lib/src/Modes/Rotation.d.ts +3 -0
  88. package/lib/src/Modes/Rotation.js +14 -0
  89. package/lib/src/Modes/Rotation.js.map +1 -0
  90. package/lib/src/Modes/Save.d.ts +3 -0
  91. package/lib/src/Modes/Save.js +12 -0
  92. package/lib/src/Modes/Save.js.map +1 -0
  93. package/lib/src/Modes/SelectorAttribute.d.ts +3 -0
  94. package/lib/src/Modes/SelectorAttribute.js +30 -0
  95. package/lib/src/Modes/SelectorAttribute.js.map +1 -0
  96. package/lib/src/Modes/SelectorType.d.ts +3 -0
  97. package/lib/src/Modes/SelectorType.js +18 -0
  98. package/lib/src/Modes/SelectorType.js.map +1 -0
  99. package/lib/src/Modes/SlotType.d.ts +18 -0
  100. package/lib/src/Modes/SlotType.js +22 -0
  101. package/lib/src/Modes/SlotType.js.map +1 -0
  102. package/lib/src/Modes/StructureAnimation.d.ts +3 -0
  103. package/lib/src/Modes/StructureAnimation.js +12 -0
  104. package/lib/src/Modes/StructureAnimation.js.map +1 -0
  105. package/lib/src/Modes/TeleportRules.d.ts +3 -0
  106. package/lib/src/Modes/TeleportRules.js +12 -0
  107. package/lib/src/Modes/TeleportRules.js.map +1 -0
  108. package/lib/src/Types/Conditional.d.ts +28 -0
  109. package/lib/src/Types/Conditional.js +58 -0
  110. package/lib/src/Types/Conditional.js.map +1 -0
  111. package/lib/src/Types/Definition.d.ts +42 -0
  112. package/lib/src/Types/Definition.js +73 -0
  113. package/lib/src/Types/Definition.js.map +1 -0
  114. package/lib/src/Types/DocumentLocation.d.ts +36 -0
  115. package/lib/src/Types/DocumentLocation.js +73 -0
  116. package/lib/src/Types/DocumentLocation.js.map +1 -0
  117. package/lib/src/Types/Documentated.d.ts +16 -0
  118. package/lib/src/Types/Documentated.js +30 -0
  119. package/lib/src/Types/Documentated.js.map +1 -0
  120. package/lib/src/Types/Identifiable.d.ts +34 -0
  121. package/lib/src/Types/Identifiable.js +60 -0
  122. package/lib/src/Types/Identifiable.js.map +1 -0
  123. package/lib/src/Types/JsonPath.d.ts +26 -0
  124. package/lib/src/Types/JsonPath.js +48 -0
  125. package/lib/src/Types/JsonPath.js.map +1 -0
  126. package/lib/src/Types/Locatable.d.ts +20 -0
  127. package/lib/src/Types/Locatable.js +31 -0
  128. package/lib/src/Types/Locatable.js.map +1 -0
  129. package/lib/src/Types/Location.d.ts +29 -0
  130. package/lib/src/Types/Location.js +39 -0
  131. package/lib/src/Types/Location.js.map +1 -0
  132. package/lib/src/Types/Position.d.ts +40 -0
  133. package/lib/src/Types/Position.js +78 -0
  134. package/lib/src/Types/Position.js.map +1 -0
  135. package/lib/src/Types/Range.d.ts +31 -0
  136. package/lib/src/Types/Range.js +40 -0
  137. package/lib/src/Types/Range.js.map +1 -0
  138. package/lib/src/Types/include.d.ts +10 -0
  139. package/lib/src/Types/include.js +24 -0
  140. package/lib/src/Types/include.js.map +1 -0
  141. package/lib/src/main.d.ts +4 -0
  142. package/lib/src/main.js +18 -0
  143. package/lib/src/main.js.map +1 -0
  144. package/package.json +50 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TeleportRules.js","sourceRoot":"","sources":["../../../src/Modes/TeleportRules.ts"],"names":[],"mappings":";;;AAEA,MAAM;AACO,QAAA,iBAAiB,GAAmB;IAC/C,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE;QACL,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,EAAE,iCAAiC,EAAE;QAC3E,EAAE,IAAI,EAAE,gBAAgB,EAAE,aAAa,EAAE,iCAAiC,EAAE;KAC7E;CACF,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**A conditional object
2
+ * @example { "walk.anim": "query.random" }*/
3
+ export interface Conditional {
4
+ /**The id is an animation / controller that is to be activated if the string value is evualated to be 1.0 or higher*/
5
+ [id: string]: string | number;
6
+ }
7
+ /**
8
+ *
9
+ */
10
+ export declare namespace Conditional {
11
+ /**Returns the idenfitication
12
+ * @param data
13
+ * @returns*/
14
+ function getId(data: Conditional | string): string;
15
+ /**
16
+ *
17
+ * @param data
18
+ * @returns
19
+ */
20
+ function getCondition(data: Conditional | string): string | number;
21
+ /**
22
+ *
23
+ * @param data
24
+ * @param callbackfn
25
+ * @returns
26
+ */
27
+ function forEach(data: (Conditional | string)[] | undefined, callbackfn: (id: string, value: string | number, index: number, data: (Conditional | string)[]) => void): void;
28
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Conditional = void 0;
4
+ /**
5
+ *
6
+ */
7
+ var Conditional;
8
+ (function (Conditional) {
9
+ /**Returns the idenfitication
10
+ * @param data
11
+ * @returns*/
12
+ function getId(data) {
13
+ var _a;
14
+ if (typeof data === "string")
15
+ return data;
16
+ return (_a = Object.getOwnPropertyNames(data)[0]) !== null && _a !== void 0 ? _a : "";
17
+ }
18
+ Conditional.getId = getId;
19
+ /**
20
+ *
21
+ * @param data
22
+ * @returns
23
+ */
24
+ function getCondition(data) {
25
+ var _a;
26
+ if (typeof data === "string")
27
+ return "1.0";
28
+ const id = Object.getOwnPropertyNames(data)[0];
29
+ if (id)
30
+ return (_a = data[id]) !== null && _a !== void 0 ? _a : "1.0";
31
+ return "1.0";
32
+ }
33
+ Conditional.getCondition = getCondition;
34
+ /**
35
+ *
36
+ * @param data
37
+ * @param callbackfn
38
+ * @returns
39
+ */
40
+ function forEach(data, callbackfn) {
41
+ if (!data)
42
+ return;
43
+ data.map;
44
+ data.forEach((item, index) => {
45
+ var _a;
46
+ if (typeof item === "string") {
47
+ callbackfn(item, "1.0", index, data);
48
+ return;
49
+ }
50
+ //Is an conditional
51
+ const id = Object.getOwnPropertyNames(item)[0];
52
+ if (id)
53
+ callbackfn(id, (_a = item[id]) !== null && _a !== void 0 ? _a : "1.0", index, data);
54
+ });
55
+ }
56
+ Conditional.forEach = forEach;
57
+ })(Conditional = exports.Conditional || (exports.Conditional = {}));
58
+ //# sourceMappingURL=Conditional.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Conditional.js","sourceRoot":"","sources":["../../../src/Types/Conditional.ts"],"names":[],"mappings":";;;AAOA;;GAEG;AACH,IAAiB,WAAW,CAkD3B;AAlDD,WAAiB,WAAW;IAC1B;;iBAEa;IACb,SAAgB,KAAK,CAAC,IAA0B;;QAC9C,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAE1C,OAAO,MAAA,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,mCAAI,EAAE,CAAC;IACnD,CAAC;IAJe,iBAAK,QAIpB,CAAA;IAED;;;;OAIG;IACH,SAAgB,YAAY,CAAC,IAA0B;;QACrD,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAE3C,MAAM,EAAE,GAAG,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAE/C,IAAI,EAAE;YAAE,OAAO,MAAA,IAAI,CAAC,EAAE,CAAC,mCAAI,KAAK,CAAC;QAEjC,OAAO,KAAK,CAAC;IACf,CAAC;IARe,wBAAY,eAQ3B,CAAA;IAED;;;;;OAKG;IACH,SAAgB,OAAO,CACrB,IAA0C,EAC1C,UAAuG;QAEvG,IAAI,CAAC,IAAI;YAAE,OAAO;QAElB,IAAI,CAAC,GAAG,CAAC;QACT,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;;YAC3B,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;gBAC5B,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;gBACrC,OAAO;aACR;YAED,mBAAmB;YACnB,MAAM,EAAE,GAAG,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAE/C,IAAI,EAAE;gBAAE,UAAU,CAAC,EAAE,EAAE,MAAA,IAAI,CAAC,EAAE,CAAC,mCAAI,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC;IAlBe,mBAAO,UAkBtB,CAAA;AACH,CAAC,EAlDgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAkD3B"}
@@ -0,0 +1,42 @@
1
+ /**A Definition object
2
+ * @example { "walk.anim": "animation.sheep.walk" }*/
3
+ export interface Definition {
4
+ /**The reference is an internal reference to something that is to be used, such as animations / controllers*/
5
+ [reference: string]: string;
6
+ }
7
+ /**The namespace that provides functionallity to definitions*/
8
+ export declare namespace Definition {
9
+ /**
10
+ *
11
+ * @param data
12
+ * @returns
13
+ */
14
+ function count(data: Definition): number;
15
+ /**Returns the idenfitication used
16
+ * @param data The data to look through
17
+ * @param index The index of the definition
18
+ * @returns*/
19
+ function getId(data: Definition, index: number): string;
20
+ /**Returns the idenfitication used
21
+ * @param data The data to look through
22
+ * @returns*/
23
+ function getIds(data: Definition): string[];
24
+ /**
25
+ * @param data The data to look through
26
+ * @param index The index of the definition
27
+ * @returns
28
+ */
29
+ function getReference(data: Definition, index: number): string;
30
+ /**
31
+ * @param data The data to look through
32
+ * @returns
33
+ */
34
+ function getReferences(data: Definition): string[];
35
+ /**
36
+ *
37
+ * @param data
38
+ * @param callbackfn
39
+ * @returns
40
+ */
41
+ function forEach(data: Definition | undefined, callbackfn: (reference: string, id: string, index: number, data: Definition) => void): void;
42
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Definition = void 0;
4
+ /**The namespace that provides functionallity to definitions*/
5
+ var Definition;
6
+ (function (Definition) {
7
+ /**
8
+ *
9
+ * @param data
10
+ * @returns
11
+ */
12
+ function count(data) {
13
+ return Object.getOwnPropertyNames(data).length;
14
+ }
15
+ Definition.count = count;
16
+ /**Returns the idenfitication used
17
+ * @param data The data to look through
18
+ * @param index The index of the definition
19
+ * @returns*/
20
+ function getId(data, index) {
21
+ const key = Object.getOwnPropertyNames(data)[index];
22
+ return data[key];
23
+ }
24
+ Definition.getId = getId;
25
+ /**Returns the idenfitication used
26
+ * @param data The data to look through
27
+ * @returns*/
28
+ function getIds(data) {
29
+ const out = [];
30
+ const keys = Object.getOwnPropertyNames(data);
31
+ for (let I = 0; I < keys.length; I++) {
32
+ const k = keys[I];
33
+ const value = data[k];
34
+ if (typeof value === "string")
35
+ out.push(value);
36
+ }
37
+ return out;
38
+ }
39
+ Definition.getIds = getIds;
40
+ /**
41
+ * @param data The data to look through
42
+ * @param index The index of the definition
43
+ * @returns
44
+ */
45
+ function getReference(data, index) {
46
+ return Object.getOwnPropertyNames(data)[index];
47
+ }
48
+ Definition.getReference = getReference;
49
+ /**
50
+ * @param data The data to look through
51
+ * @returns
52
+ */
53
+ function getReferences(data) {
54
+ return Object.getOwnPropertyNames(data);
55
+ }
56
+ Definition.getReferences = getReferences;
57
+ /**
58
+ *
59
+ * @param data
60
+ * @param callbackfn
61
+ * @returns
62
+ */
63
+ function forEach(data, callbackfn) {
64
+ if (!data)
65
+ return;
66
+ const keys = Object.getOwnPropertyNames(data);
67
+ keys.forEach((reference, index) => {
68
+ callbackfn(reference, data[reference], index, data);
69
+ });
70
+ }
71
+ Definition.forEach = forEach;
72
+ })(Definition = exports.Definition || (exports.Definition = {}));
73
+ //# sourceMappingURL=Definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Definition.js","sourceRoot":"","sources":["../../../src/Types/Definition.ts"],"names":[],"mappings":";;;AAOA,8DAA8D;AAC9D,IAAiB,UAAU,CAqE1B;AArED,WAAiB,UAAU;IACzB;;;;OAIG;IACH,SAAgB,KAAK,CAAC,IAAgB;QACpC,OAAO,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;IACjD,CAAC;IAFe,gBAAK,QAEpB,CAAA;IAED;;;iBAGa;IACb,SAAgB,KAAK,CAAC,IAAgB,EAAE,KAAa;QACnD,MAAM,GAAG,GAAG,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;QAEpD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;IAJe,gBAAK,QAIpB,CAAA;IAED;;iBAEa;IACb,SAAgB,MAAM,CAAC,IAAgB;QACrC,MAAM,GAAG,GAAa,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAE9C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAEtB,IAAI,OAAO,KAAK,KAAK,QAAQ;gBAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAChD;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAZe,iBAAM,SAYrB,CAAA;IAED;;;;OAIG;IACH,SAAgB,YAAY,CAAC,IAAgB,EAAE,KAAa;QAC1D,OAAO,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IAFe,uBAAY,eAE3B,CAAA;IAED;;;OAGG;IACH,SAAgB,aAAa,CAAC,IAAgB;QAC5C,OAAO,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAFe,wBAAa,gBAE5B,CAAA;IAED;;;;;OAKG;IACH,SAAgB,OAAO,CAAC,IAA4B,EAAE,UAAoF;QACxI,IAAI,CAAC,IAAI;YAAE,OAAO;QAElB,MAAM,IAAI,GAAG,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAE9C,IAAI,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE;YAChC,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACL,CAAC;IARe,kBAAO,UAQtB,CAAA;AACH,CAAC,EArEgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAqE1B"}
@@ -0,0 +1,36 @@
1
+ import { JsonPath } from "./JsonPath";
2
+ import { Position } from "./Position";
3
+ import { Range } from "./Range";
4
+ /**The type of a document location */
5
+ export declare type DocumentLocation = Position | JsonPath | number;
6
+ /** */
7
+ export declare type TextOrDoc = string | {
8
+ getText(): string;
9
+ };
10
+ /**TODO add documentation
11
+ *
12
+ */
13
+ export declare namespace DocumentLocation {
14
+ /**TODO add documentation
15
+ *
16
+ * @param data
17
+ * @param text
18
+ * @returns
19
+ */
20
+ function toOffset(data: DocumentLocation, text: TextOrDoc): number;
21
+ /**TODO add documentation
22
+ *
23
+ * @param data
24
+ * @param text
25
+ * @returns
26
+ */
27
+ function toPosition(data: DocumentLocation, text: TextOrDoc): Position;
28
+ /**TODO add documentation
29
+ *
30
+ * @param data
31
+ * @param text
32
+ * @param length
33
+ * @returns
34
+ */
35
+ function ToRange(data: DocumentLocation, text: TextOrDoc, length: number): Range;
36
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DocumentLocation = void 0;
4
+ const JsonPath_1 = require("./JsonPath");
5
+ const Position_1 = require("./Position");
6
+ const Range_1 = require("./Range");
7
+ function ToText(value) {
8
+ return typeof value === "string" ? value : value.getText();
9
+ }
10
+ /**TODO add documentation
11
+ *
12
+ */
13
+ var DocumentLocation;
14
+ (function (DocumentLocation) {
15
+ /**TODO add documentation
16
+ *
17
+ * @param data
18
+ * @param text
19
+ * @returns
20
+ */
21
+ function toOffset(data, text) {
22
+ switch (typeof data) {
23
+ case "number":
24
+ return data;
25
+ //Json path
26
+ case "string":
27
+ return JsonPath_1.JsonPath.resolve(text, data);
28
+ //Position
29
+ case "object":
30
+ return Position_1.Position.toOffset(data, ToText(text));
31
+ default:
32
+ return 0;
33
+ }
34
+ }
35
+ DocumentLocation.toOffset = toOffset;
36
+ const NewLine = "\n".charCodeAt(0);
37
+ /**TODO add documentation
38
+ *
39
+ * @param data
40
+ * @param text
41
+ * @returns
42
+ */
43
+ function toPosition(data, text) {
44
+ switch (typeof data) {
45
+ case "number":
46
+ return Position_1.Position.toPosition(data, ToText(text));
47
+ //Json path
48
+ case "string":
49
+ return Position_1.Position.toPosition(JsonPath_1.JsonPath.resolve(text, data), ToText(text));
50
+ //Position
51
+ case "object":
52
+ return data;
53
+ default:
54
+ return Position_1.Position.create(0, 0);
55
+ }
56
+ }
57
+ DocumentLocation.toPosition = toPosition;
58
+ /**TODO add documentation
59
+ *
60
+ * @param data
61
+ * @param text
62
+ * @param length
63
+ * @returns
64
+ */
65
+ function ToRange(data, text, length) {
66
+ const startindex = toOffset(data, text);
67
+ const endindex = startindex + length;
68
+ const t = ToText(text);
69
+ return Range_1.Range.create(Position_1.Position.toPosition(startindex, t), Position_1.Position.toPosition(endindex, t));
70
+ }
71
+ DocumentLocation.ToRange = ToRange;
72
+ })(DocumentLocation = exports.DocumentLocation || (exports.DocumentLocation = {}));
73
+ //# sourceMappingURL=DocumentLocation.js.map
@@ -0,0 +1 @@
1
+ {"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BACX,OAAO,IAAI,CAAC;YAEd;gBACE,OAAO,mBAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAChC;IACH,CAAC;IAhBe,2BAAU,aAgBzB,CAAA;IAED;;;;;;OAMG;IACH,SAAgB,OAAO,CAAC,IAAsB,EAAE,IAAe,EAAE,MAAc;QAC7E,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACxC,MAAM,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;QACrC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAEvB,OAAO,aAAK,CAAC,MAAM,CAAC,mBAAQ,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,mBAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5F,CAAC;IANe,wBAAO,UAMtB,CAAA;AACH,CAAC,EAjEgB,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAiEhC"}
@@ -0,0 +1,16 @@
1
+ /**An object that carries documentation in markdown format*/
2
+ export interface Documentated {
3
+ /**The field that stores the documentation*/
4
+ documentation?: string;
5
+ }
6
+ /**The namespace for the documentated object*/
7
+ export declare namespace Documentated {
8
+ /**Checks if the given object implements Documentated interface
9
+ * @param value The value to examinate
10
+ * @returns*/
11
+ function is(value: any): value is Documentated;
12
+ /**Gets the documentation from either the carrier or creates new on and stores it in the carrier
13
+ * @param data The data carrier.
14
+ * @param create The function that creates a documentation*/
15
+ function getOrCreate<T extends Documentated>(data: T, create: (data: T) => string): string;
16
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Documentated = void 0;
4
+ /**The namespace for the documentated object*/
5
+ var Documentated;
6
+ (function (Documentated) {
7
+ /**Checks if the given object implements Documentated interface
8
+ * @param value The value to examinate
9
+ * @returns*/
10
+ function is(value) {
11
+ if (value && typeof value.documentation === "string") {
12
+ return true;
13
+ }
14
+ return false;
15
+ }
16
+ Documentated.is = is;
17
+ /**Gets the documentation from either the carrier or creates new on and stores it in the carrier
18
+ * @param data The data carrier.
19
+ * @param create The function that creates a documentation*/
20
+ function getOrCreate(data, create) {
21
+ if (typeof data.documentation === "string") {
22
+ return data.documentation;
23
+ }
24
+ const doc = create(data);
25
+ data.documentation = doc;
26
+ return doc;
27
+ }
28
+ Documentated.getOrCreate = getOrCreate;
29
+ })(Documentated = exports.Documentated || (exports.Documentated = {}));
30
+ //# sourceMappingURL=Documentated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Documentated.js","sourceRoot":"","sources":["../../../src/Types/Documentated.ts"],"names":[],"mappings":";;;AAMA,8CAA8C;AAC9C,IAAiB,YAAY,CAwB5B;AAxBD,WAAiB,YAAY;IAC3B;;iBAEa;IACb,SAAgB,EAAE,CAAC,KAAU;QAC3B,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,aAAa,KAAK,QAAQ,EAAE;YACpD,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IANe,eAAE,KAMjB,CAAA;IAED;;gEAE4D;IAC5D,SAAgB,WAAW,CAAyB,IAAO,EAAE,MAA2B;QACtF,IAAI,OAAO,IAAI,CAAC,aAAa,KAAK,QAAQ,EAAE;YAC1C,OAAO,IAAI,CAAC,aAAa,CAAC;SAC3B;QAED,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC;QACzB,OAAO,GAAG,CAAC;IACb,CAAC;IARe,wBAAW,cAQ1B,CAAA;AACH,CAAC,EAxBgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAwB5B"}
@@ -0,0 +1,34 @@
1
+ /**The interface that governs if a object is identifiable*/
2
+ export interface Identifiable {
3
+ /**The identifier of this object*/
4
+ id: string;
5
+ }
6
+ /** */
7
+ export declare namespace Identifiable {
8
+ /**TODO add documentation
9
+ *
10
+ * @param value
11
+ * @returns
12
+ */
13
+ function is(value: any): value is Identifiable;
14
+ /**TODO add documentation
15
+ *
16
+ * @param items
17
+ * @param id
18
+ * @returns
19
+ */
20
+ function has<T extends Identifiable>(items: T[], id: string): boolean;
21
+ /**TODO add documentation
22
+ *
23
+ * @param items
24
+ * @param id
25
+ * @returns
26
+ */
27
+ function get<T extends Identifiable>(items: T[], id: string): T | undefined;
28
+ /**TODO add documentation
29
+ *
30
+ * @param carrier
31
+ * @returns
32
+ */
33
+ function getId(carrier: string | Identifiable): string;
34
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Identifiable = void 0;
4
+ /** */
5
+ var Identifiable;
6
+ (function (Identifiable) {
7
+ /**TODO add documentation
8
+ *
9
+ * @param value
10
+ * @returns
11
+ */
12
+ function is(value) {
13
+ if (typeof value === "object" && typeof value.id === "string")
14
+ return true;
15
+ return false;
16
+ }
17
+ Identifiable.is = is;
18
+ /**TODO add documentation
19
+ *
20
+ * @param items
21
+ * @param id
22
+ * @returns
23
+ */
24
+ function has(items, id) {
25
+ for (let I = 0; I < items.length; I++) {
26
+ const elem = items[I];
27
+ if (elem.id == id)
28
+ return true;
29
+ }
30
+ return false;
31
+ }
32
+ Identifiable.has = has;
33
+ /**TODO add documentation
34
+ *
35
+ * @param items
36
+ * @param id
37
+ * @returns
38
+ */
39
+ function get(items, id) {
40
+ for (let I = 0; I < items.length; I++) {
41
+ const elem = items[I];
42
+ if (elem.id === id)
43
+ return elem;
44
+ }
45
+ return undefined;
46
+ }
47
+ Identifiable.get = get;
48
+ /**TODO add documentation
49
+ *
50
+ * @param carrier
51
+ * @returns
52
+ */
53
+ function getId(carrier) {
54
+ if (typeof carrier === "string")
55
+ return carrier;
56
+ return carrier.id;
57
+ }
58
+ Identifiable.getId = getId;
59
+ })(Identifiable = exports.Identifiable || (exports.Identifiable = {}));
60
+ //# sourceMappingURL=Identifiable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Identifiable.js","sourceRoot":"","sources":["../../../src/Types/Identifiable.ts"],"names":[],"mappings":";;;AAMA,MAAM;AACN,IAAiB,YAAY,CAsD5B;AAtDD,WAAiB,YAAY;IAC3B;;;;OAIG;IACH,SAAgB,EAAE,CAAC,KAAU;QAC3B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAE3E,OAAO,KAAK,CAAC;IACf,CAAC;IAJe,eAAE,KAIjB,CAAA;IAED;;;;;OAKG;IACH,SAAgB,GAAG,CAAyB,KAAU,EAAE,EAAU;QAChE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAEtB,IAAI,IAAI,CAAC,EAAE,IAAI,EAAE;gBAAE,OAAO,IAAI,CAAC;SAChC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IARe,gBAAG,MAQlB,CAAA;IAED;;;;;OAKG;IACH,SAAgB,GAAG,CAAyB,KAAU,EAAE,EAAU;QAChE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAEtB,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE;gBAAE,OAAO,IAAI,CAAC;SACjC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IARe,gBAAG,MAQlB,CAAA;IAED;;;;OAIG;IACH,SAAgB,KAAK,CAAC,OAA8B;QAClD,IAAI,OAAO,OAAO,KAAK,QAAQ;YAAE,OAAO,OAAO,CAAC;QAEhD,OAAO,OAAO,CAAC,EAAE,CAAC;IACpB,CAAC;IAJe,kBAAK,QAIpB,CAAA;AACH,CAAC,EAtDgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAsD5B"}
@@ -0,0 +1,26 @@
1
+ /** */
2
+ export declare type JsonPath = string;
3
+ /** */
4
+ export declare namespace JsonPath {
5
+ const seperator = "/";
6
+ /**TODO add documentation
7
+ *
8
+ * @param text
9
+ * @param path
10
+ */
11
+ function resolve(text: string | {
12
+ getText(): string;
13
+ }, path: JsonPath): number;
14
+ /**TODO add documentation
15
+ *
16
+ * @param path
17
+ * @returns
18
+ */
19
+ function create(...path: string[]): JsonPath;
20
+ /**TODO add documentation
21
+ *
22
+ * @param value
23
+ * @returns
24
+ */
25
+ function is(value: any): value is JsonPath;
26
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonPath = void 0;
4
+ /** */
5
+ var JsonPath;
6
+ (function (JsonPath) {
7
+ JsonPath.seperator = "/";
8
+ /**TODO add documentation
9
+ *
10
+ * @param text
11
+ * @param path
12
+ */
13
+ function resolve(text, path) {
14
+ if (typeof text === "object")
15
+ text = text.getText();
16
+ const s = path.split(/[\\/]/);
17
+ let index = 0;
18
+ for (var I = 0; I < s.length; I++) {
19
+ const elem = s[I];
20
+ if (!Number.isInteger(elem) && elem !== "") {
21
+ const t = text.indexOf(elem, index);
22
+ if (t > -1)
23
+ index = t;
24
+ }
25
+ }
26
+ return index;
27
+ }
28
+ JsonPath.resolve = resolve;
29
+ /**TODO add documentation
30
+ *
31
+ * @param path
32
+ * @returns
33
+ */
34
+ function create(...path) {
35
+ return path.join(JsonPath.seperator);
36
+ }
37
+ JsonPath.create = create;
38
+ /**TODO add documentation
39
+ *
40
+ * @param value
41
+ * @returns
42
+ */
43
+ function is(value) {
44
+ return typeof value === "string";
45
+ }
46
+ JsonPath.is = is;
47
+ })(JsonPath = exports.JsonPath || (exports.JsonPath = {}));
48
+ //# sourceMappingURL=JsonPath.js.map
@@ -0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B"}
@@ -0,0 +1,20 @@
1
+ import { Location } from "./Location";
2
+ /**An object that carries a location*/
3
+ export interface Locatable {
4
+ /**The location of the object in memory*/
5
+ location: Location;
6
+ }
7
+ /** */
8
+ export declare namespace Locatable {
9
+ /**TODO add documentation
10
+ *
11
+ * @param value
12
+ * @returns
13
+ */
14
+ function is(value: any): value is Locatable;
15
+ /**TODO add documentation
16
+ *
17
+ * @returns
18
+ */
19
+ function empty(): Locatable;
20
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Locatable = void 0;
4
+ const Location_1 = require("./Location");
5
+ /** */
6
+ var Locatable;
7
+ (function (Locatable) {
8
+ /**TODO add documentation
9
+ *
10
+ * @param value
11
+ * @returns
12
+ */
13
+ function is(value) {
14
+ if (value && Location_1.Location.is(value.location)) {
15
+ return true;
16
+ }
17
+ return false;
18
+ }
19
+ Locatable.is = is;
20
+ /**TODO add documentation
21
+ *
22
+ * @returns
23
+ */
24
+ function empty() {
25
+ return {
26
+ location: { uri: "", position: 0 },
27
+ };
28
+ }
29
+ Locatable.empty = empty;
30
+ })(Locatable = exports.Locatable || (exports.Locatable = {}));
31
+ //# sourceMappingURL=Locatable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Locatable.js","sourceRoot":"","sources":["../../../src/Types/Locatable.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAQtC,MAAM;AACN,IAAiB,SAAS,CAuBzB;AAvBD,WAAiB,SAAS;IACxB;;;;OAIG;IACH,SAAgB,EAAE,CAAC,KAAU;QAC3B,IAAI,KAAK,IAAI,mBAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;YACxC,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IANe,YAAE,KAMjB,CAAA;IAED;;;OAGG;IACH,SAAgB,KAAK;QACnB,OAAO;YACL,QAAQ,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;SACnC,CAAC;IACJ,CAAC;IAJe,eAAK,QAIpB,CAAA;AACH,CAAC,EAvBgB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAuBzB"}
@@ -0,0 +1,29 @@
1
+ import { DocumentLocation } from "./DocumentLocation";
2
+ /**An object that describe a location in a document*/
3
+ export interface Location {
4
+ /**The uri of the document*/
5
+ uri: string;
6
+ /**The position of the in the document*/
7
+ position: DocumentLocation;
8
+ }
9
+ /** */
10
+ export declare namespace Location {
11
+ /**TODO add documentation
12
+ *
13
+ * @param value
14
+ * @returns
15
+ */
16
+ function is(value: any): value is Location;
17
+ /**TODO add documentation
18
+ *
19
+ * @param uri
20
+ * @param position
21
+ * @returns
22
+ */
23
+ function create(uri: string, position?: DocumentLocation): Location;
24
+ /**TODO add documentation
25
+ *
26
+ * @returns
27
+ */
28
+ function empty(): Location;
29
+ }