tachyon-protocol 0.3.4 → 1.0.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/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { EmptyObject } from 'type-fest';
1
+ import { EmptyObject, KeysOfUnion } from 'type-fest';
2
2
  import { ValidateFunction } from 'ajv';
3
3
 
4
4
  declare const tachyonMeta: {
5
- readonly version: "0.3.4";
5
+ readonly version: "1.0.0";
6
6
  readonly ids: {
7
7
  readonly autohost: {
8
8
  readonly slave: readonly ["request", "response"];
@@ -69,6 +69,11 @@ type ResponseOnlyEndpointId<S extends ServiceId> = {
69
69
  type RequestData<S extends ServiceId, E extends EndpointId<S>> = RequestCommand<S, E> extends {
70
70
  data: infer Data;
71
71
  } ? Data : never;
72
+ type DistributiveOmit<T, K extends keyof T> = T extends T ? Omit<T, K> : never;
73
+ type ResponseData<S extends ServiceId, E extends EndpointId<S>> = ResponseCommand<S, E> extends {
74
+ commandId: string;
75
+ messageId: string;
76
+ } ? DistributiveOmit<ResponseCommand<S, E>, "commandId" | "messageId"> : never;
72
77
  type SuccessResponseData<S extends ServiceId, E extends EndpointId<S>> = ResponseCommand<S, E> & {
73
78
  status: "success";
74
79
  } extends {
@@ -80,6 +85,22 @@ type EmptyRequestId<S extends ServiceId> = {
80
85
  type DataRequestId<S extends ServiceId> = {
81
86
  [K in EndpointId<S>]: RequestData<S, K> extends EmptyObject ? never : K;
82
87
  }[EndpointId<S>];
88
+ type RequestType = {
89
+ [S in keyof Tachyon]: {
90
+ [E in keyof Tachyon[S]]: Tachyon[S][E] extends {
91
+ request: unknown;
92
+ } ? Tachyon[S][E]["request"] : never;
93
+ }[KeysOfUnion<Tachyon[S]>];
94
+ }[KeysOfUnion<Tachyon>];
95
+ type ResponseType = {
96
+ [S in keyof Tachyon]: {
97
+ [E in keyof Tachyon[S]]: Tachyon[S][E] extends {
98
+ response: unknown;
99
+ } ? Tachyon[S][E]["response"] : never;
100
+ }[KeysOfUnion<Tachyon[S]>];
101
+ }[KeysOfUnion<Tachyon>];
102
+ type RequestCommandId = Pick<RequestType, "commandId">;
103
+ type ResponseCommandId = Pick<ResponseType, "commandId">;
83
104
  type GenericRequestCommand = {
84
105
  commandId: string;
85
106
  messageId: string;
@@ -100,7 +121,7 @@ declare function getValidator<T extends {
100
121
  commandId: string;
101
122
  }>(command: T): ValidateFunction<T>;
102
123
 
103
- export { Command, DataRequestId, EmptyRequestId, EndpointId, GenericRequestCommand, GenericResponseCommand, RequestCommand, RequestData, RequestEndpointId, ResponseCommand, ResponseEndpointId, ResponseOnlyEndpointId, ServiceId, SuccessResponseData, getValidator, tachyonMeta };
124
+ export { Command, DataRequestId, EmptyRequestId, EndpointId, GenericRequestCommand, GenericResponseCommand, RequestCommand, RequestCommandId, RequestData, RequestEndpointId, RequestType, ResponseCommand, ResponseCommandId, ResponseData, ResponseEndpointId, ResponseOnlyEndpointId, ResponseType, ServiceId, SuccessResponseData, getValidator, tachyonMeta };
104
125
 
105
126
  export type AutohostSlaveResponse =
106
127
  | {
@@ -362,7 +383,7 @@ export type LobbyJoinedResponse =
362
383
  userId: string;
363
384
  username: string;
364
385
  displayName: string;
365
- avatarUrl: string;
386
+ avatarUrl: string | null;
366
387
  clanId: string | null;
367
388
  partyId: string | null;
368
389
  roles: string[];
@@ -529,7 +550,7 @@ export type LobbyListResponse =
529
550
  userId: string;
530
551
  username: string;
531
552
  displayName: string;
532
- avatarUrl: string;
553
+ avatarUrl: string | null;
533
554
  clanId: string | null;
534
555
  partyId: string | null;
535
556
  roles: string[];
@@ -773,7 +794,7 @@ export type LobbyUpdatedResponse =
773
794
  userId: string;
774
795
  username: string;
775
796
  displayName: string;
776
- avatarUrl: string;
797
+ avatarUrl: string | null;
777
798
  clanId: string | null;
778
799
  partyId: string | null;
779
800
  roles: string[];
@@ -1082,7 +1103,7 @@ export type SystemConnectedResponse =
1082
1103
  userId: string;
1083
1104
  username: string;
1084
1105
  displayName: string;
1085
- avatarUrl: string;
1106
+ avatarUrl: string | null;
1086
1107
  clanId: string | null;
1087
1108
  partyId: string | null;
1088
1109
  roles: string[];
@@ -1199,7 +1220,7 @@ export type UserSubscribeResponse =
1199
1220
  userId: string;
1200
1221
  username: string;
1201
1222
  displayName: string;
1202
- avatarUrl: string;
1223
+ avatarUrl: string | null;
1203
1224
  clanId: string | null;
1204
1225
  partyId: string | null;
1205
1226
  roles: string[];
@@ -1292,7 +1313,7 @@ export type UserUpdatedResponse =
1292
1313
  userId?: string;
1293
1314
  username?: string;
1294
1315
  displayName?: string;
1295
- avatarUrl?: string;
1316
+ avatarUrl?: string | null;
1296
1317
  clanId?: string | null;
1297
1318
  partyId?: string | null;
1298
1319
  roles?: string[];
@@ -1666,173 +1687,8 @@ export interface UserUnsubscribeRequest {
1666
1687
  userIds: string[];
1667
1688
  };
1668
1689
  }
1669
- export type TachyonUnixTime = number | null;
1670
-
1671
- export interface TachyonBattleContender {
1672
- playerId: number;
1673
- teamId: number;
1674
- color: string;
1675
- bonus: number;
1676
- inGame: boolean;
1677
- }
1678
-
1679
- export type TachyonBattlePlayer = {
1680
- playerId: number;
1681
- teamId: number;
1682
- color: string;
1683
- bonus: number;
1684
- inGame: boolean;
1685
- } & {
1686
- isSpectator: false;
1687
- isBot: false;
1688
- ready: boolean;
1689
- sync: {
1690
- engine: number;
1691
- game: number;
1692
- map: number;
1693
- };
1694
- };
1695
-
1696
- export interface TachyonBattleSpectator {
1697
- isSpectator: true;
1698
- isBot: false;
1699
- }
1700
-
1701
- export interface TachyonBot {
1702
- playerId: number;
1703
- teamId: number;
1704
- color: string;
1705
- bonus: number;
1706
- inGame: boolean;
1707
- isSpectator: false;
1708
- isBot: true;
1709
- ownerId: string;
1710
- aiShortName: string;
1711
- name: string;
1712
- aiOptions: {
1713
- /**
1714
- * This interface was referenced by `undefined`'s JSON-Schema definition
1715
- * via the `patternProperty` "^(.*)$".
1716
- */
1717
- [k: string]: unknown;
1718
- };
1719
- faction: string;
1720
- }
1721
-
1722
- export type TachyonBattleStatus =
1723
- | ({
1724
- battleId: string;
1725
- } & (
1726
- | ({
1727
- playerId: number;
1728
- teamId: number;
1729
- color: string;
1730
- bonus: number;
1731
- inGame: boolean;
1732
- } & {
1733
- isSpectator: false;
1734
- isBot: false;
1735
- ready: boolean;
1736
- sync: {
1737
- engine: number;
1738
- game: number;
1739
- map: number;
1740
- };
1741
- })
1742
- | {
1743
- isSpectator: true;
1744
- isBot: false;
1745
- }
1746
- ))
1747
- | null;
1748
-
1749
- export type TachyonUserStatus = "offline" | "menu" | "playing" | "lobby";
1750
-
1751
- export interface TachyonUser {
1752
- userId: string;
1753
- username: string;
1754
- displayName: string;
1755
- avatarUrl: string;
1756
- clanId: string | null;
1757
- partyId: string | null;
1758
- roles: string[];
1759
- countryCode?: string;
1760
- status: "offline" | "menu" | "playing" | "lobby";
1761
- battleStatus:
1762
- | ({
1763
- battleId: string;
1764
- } & (
1765
- | ({
1766
- playerId: number;
1767
- teamId: number;
1768
- color: string;
1769
- bonus: number;
1770
- inGame: boolean;
1771
- } & {
1772
- isSpectator: false;
1773
- isBot: false;
1774
- ready: boolean;
1775
- sync: {
1776
- engine: number;
1777
- game: number;
1778
- map: number;
1779
- };
1780
- })
1781
- | {
1782
- isSpectator: true;
1783
- isBot: false;
1784
- }
1785
- ))
1786
- | null;
1787
- }
1788
-
1789
- export interface TachyonPrivateUser {
1790
- userId: string;
1791
- username: string;
1792
- displayName: string;
1793
- avatarUrl: string;
1794
- clanId: string | null;
1795
- partyId: string | null;
1796
- roles: string[];
1797
- countryCode?: string;
1798
- status: "offline" | "menu" | "playing" | "lobby";
1799
- battleStatus:
1800
- | ({
1801
- battleId: string;
1802
- } & (
1803
- | ({
1804
- playerId: number;
1805
- teamId: number;
1806
- color: string;
1807
- bonus: number;
1808
- inGame: boolean;
1809
- } & {
1810
- isSpectator: false;
1811
- isBot: false;
1812
- ready: boolean;
1813
- sync: {
1814
- engine: number;
1815
- game: number;
1816
- map: number;
1817
- };
1818
- })
1819
- | {
1820
- isSpectator: true;
1821
- isBot: false;
1822
- }
1823
- ))
1824
- | null;
1825
- friendIds: string[];
1826
- outgoingFriendRequestIds: string[];
1827
- incomingFriendRequestIds: string[];
1828
- ignoreIds: string[];
1829
- }
1830
-
1831
- export interface TachyonRect {
1832
- x: number;
1833
- y: number;
1834
- width: number;
1835
- height: number;
1690
+ export interface TachyonAutohostStatus {
1691
+ gameStartTime: number | null;
1836
1692
  }
1837
1693
 
1838
1694
  export interface TachyonBattle {
@@ -1889,7 +1745,7 @@ export interface TachyonBattle {
1889
1745
  userId: string;
1890
1746
  username: string;
1891
1747
  displayName: string;
1892
- avatarUrl: string;
1748
+ avatarUrl: string | null;
1893
1749
  clanId: string | null;
1894
1750
  partyId: string | null;
1895
1751
  roles: string[];
@@ -1924,6 +1780,84 @@ export interface TachyonBattle {
1924
1780
  }[];
1925
1781
  }
1926
1782
 
1783
+ export interface TachyonBattleContender {
1784
+ playerId: number;
1785
+ teamId: number;
1786
+ color: string;
1787
+ bonus: number;
1788
+ inGame: boolean;
1789
+ }
1790
+
1791
+ export type TachyonBattlePlayer = {
1792
+ playerId: number;
1793
+ teamId: number;
1794
+ color: string;
1795
+ bonus: number;
1796
+ inGame: boolean;
1797
+ } & {
1798
+ isSpectator: false;
1799
+ isBot: false;
1800
+ ready: boolean;
1801
+ sync: {
1802
+ engine: number;
1803
+ game: number;
1804
+ map: number;
1805
+ };
1806
+ };
1807
+
1808
+ export interface TachyonBattleSpectator {
1809
+ isSpectator: true;
1810
+ isBot: false;
1811
+ }
1812
+
1813
+ export type TachyonBattleStatus =
1814
+ | ({
1815
+ battleId: string;
1816
+ } & (
1817
+ | ({
1818
+ playerId: number;
1819
+ teamId: number;
1820
+ color: string;
1821
+ bonus: number;
1822
+ inGame: boolean;
1823
+ } & {
1824
+ isSpectator: false;
1825
+ isBot: false;
1826
+ ready: boolean;
1827
+ sync: {
1828
+ engine: number;
1829
+ game: number;
1830
+ map: number;
1831
+ };
1832
+ })
1833
+ | {
1834
+ isSpectator: true;
1835
+ isBot: false;
1836
+ }
1837
+ ))
1838
+ | null;
1839
+
1840
+ export interface TachyonBot {
1841
+ playerId: number;
1842
+ teamId: number;
1843
+ color: string;
1844
+ bonus: number;
1845
+ inGame: boolean;
1846
+ isSpectator: false;
1847
+ isBot: true;
1848
+ ownerId: string;
1849
+ aiShortName: string;
1850
+ name: string;
1851
+ aiOptions: {
1852
+ /**
1853
+ * This interface was referenced by `undefined`'s JSON-Schema definition
1854
+ * via the `patternProperty` "^(.*)$".
1855
+ */
1856
+ [k: string]: unknown;
1857
+ };
1858
+ faction: string;
1859
+ }
1860
+
1927
1861
  export type TachyonCustomBattle = {
1928
1862
  battleId: string;
1929
1863
  hostId: string;
@@ -1978,7 +1912,7 @@ export type TachyonCustomBattle = {
1978
1912
  userId: string;
1979
1913
  username: string;
1980
1914
  displayName: string;
1981
- avatarUrl: string;
1915
+ avatarUrl: string | null;
1982
1916
  clanId: string | null;
1983
1917
  partyId: string | null;
1984
1918
  roles: string[];
@@ -2025,7 +1959,94 @@ export type TachyonCustomBattle = {
2025
1959
  };
2026
1960
  };
2027
1961
 
2028
- export interface TachyonAutohostStatus {
2029
- gameStartTime: number | null;
1962
+ export interface TachyonPrivateUser {
1963
+ userId: string;
1964
+ username: string;
1965
+ displayName: string;
1966
+ avatarUrl: string | null;
1967
+ clanId: string | null;
1968
+ partyId: string | null;
1969
+ roles: string[];
1970
+ countryCode?: string;
1971
+ status: "offline" | "menu" | "playing" | "lobby";
1972
+ battleStatus:
1973
+ | ({
1974
+ battleId: string;
1975
+ } & (
1976
+ | ({
1977
+ playerId: number;
1978
+ teamId: number;
1979
+ color: string;
1980
+ bonus: number;
1981
+ inGame: boolean;
1982
+ } & {
1983
+ isSpectator: false;
1984
+ isBot: false;
1985
+ ready: boolean;
1986
+ sync: {
1987
+ engine: number;
1988
+ game: number;
1989
+ map: number;
1990
+ };
1991
+ })
1992
+ | {
1993
+ isSpectator: true;
1994
+ isBot: false;
1995
+ }
1996
+ ))
1997
+ | null;
1998
+ friendIds: string[];
1999
+ outgoingFriendRequestIds: string[];
2000
+ incomingFriendRequestIds: string[];
2001
+ ignoreIds: string[];
2002
+ }
2003
+
2004
+ export interface TachyonRect {
2005
+ x: number;
2006
+ y: number;
2007
+ width: number;
2008
+ height: number;
2009
+ }
2010
+
2011
+ export type TachyonUnixTime = number | null;
2012
+
2013
+ export interface TachyonUser {
2014
+ userId: string;
2015
+ username: string;
2016
+ displayName: string;
2017
+ avatarUrl: string | null;
2018
+ clanId: string | null;
2019
+ partyId: string | null;
2020
+ roles: string[];
2021
+ countryCode?: string;
2022
+ status: "offline" | "menu" | "playing" | "lobby";
2023
+ battleStatus:
2024
+ | ({
2025
+ battleId: string;
2026
+ } & (
2027
+ | ({
2028
+ playerId: number;
2029
+ teamId: number;
2030
+ color: string;
2031
+ bonus: number;
2032
+ inGame: boolean;
2033
+ } & {
2034
+ isSpectator: false;
2035
+ isBot: false;
2036
+ ready: boolean;
2037
+ sync: {
2038
+ engine: number;
2039
+ game: number;
2040
+ map: number;
2041
+ };
2042
+ })
2043
+ | {
2044
+ isSpectator: true;
2045
+ isBot: false;
2046
+ }
2047
+ ))
2048
+ | null;
2030
2049
  }
2031
2050
 
2051
+ export type TachyonUserStatus = "offline" | "menu" | "playing" | "lobby";
2052
+
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -8,10 +7,6 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
7
  var __commonJS = (cb, mod) => function __require() {
9
8
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
9
  };
11
- var __export = (target, all) => {
12
- for (var name in all)
13
- __defProp(target, name, { get: all[name], enumerable: true });
14
- };
15
10
  var __copyProps = (to, from, except, desc) => {
16
11
  if (from && typeof from === "object" || typeof from === "function") {
17
12
  for (let key of __getOwnPropNames(from))
@@ -28,7 +23,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
23
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
24
  mod
30
25
  ));
31
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
26
 
33
27
  // node_modules/ajv/dist/compile/codegen/code.js
34
28
  var require_code = __commonJS({
@@ -2032,9 +2026,9 @@ var require_subschema = __commonJS({
2032
2026
 
2033
2027
  // node_modules/fast-deep-equal/index.js
2034
2028
  var require_fast_deep_equal = __commonJS({
2035
- "node_modules/fast-deep-equal/index.js"(exports, module2) {
2029
+ "node_modules/fast-deep-equal/index.js"(exports, module) {
2036
2030
  "use strict";
2037
- module2.exports = function equal(a, b) {
2031
+ module.exports = function equal(a, b) {
2038
2032
  if (a === b)
2039
2033
  return true;
2040
2034
  if (a && b && typeof a == "object" && typeof b == "object") {
@@ -2077,9 +2071,9 @@ var require_fast_deep_equal = __commonJS({
2077
2071
 
2078
2072
  // node_modules/json-schema-traverse/index.js
2079
2073
  var require_json_schema_traverse = __commonJS({
2080
- "node_modules/json-schema-traverse/index.js"(exports, module2) {
2074
+ "node_modules/json-schema-traverse/index.js"(exports, module) {
2081
2075
  "use strict";
2082
- var traverse = module2.exports = function(schema, opts, cb) {
2076
+ var traverse = module.exports = function(schema, opts, cb) {
2083
2077
  if (typeof opts == "function") {
2084
2078
  cb = opts;
2085
2079
  opts = {};
@@ -3085,8 +3079,8 @@ var require_compile = __commonJS({
3085
3079
 
3086
3080
  // node_modules/ajv/dist/refs/data.json
3087
3081
  var require_data = __commonJS({
3088
- "node_modules/ajv/dist/refs/data.json"(exports, module2) {
3089
- module2.exports = {
3082
+ "node_modules/ajv/dist/refs/data.json"(exports, module) {
3083
+ module.exports = {
3090
3084
  $id: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",
3091
3085
  description: "Meta-schema for $data reference (JSON AnySchema extension proposal)",
3092
3086
  type: "object",
@@ -3104,10 +3098,10 @@ var require_data = __commonJS({
3104
3098
 
3105
3099
  // node_modules/uri-js/dist/es5/uri.all.js
3106
3100
  var require_uri_all = __commonJS({
3107
- "node_modules/uri-js/dist/es5/uri.all.js"(exports, module2) {
3101
+ "node_modules/uri-js/dist/es5/uri.all.js"(exports, module) {
3108
3102
  "use strict";
3109
3103
  (function(global, factory) {
3110
- typeof exports === "object" && typeof module2 !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : factory(global.URI = global.URI || {});
3104
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : factory(global.URI = global.URI || {});
3111
3105
  })(exports, function(exports2) {
3112
3106
  "use strict";
3113
3107
  function merge() {
@@ -6561,8 +6555,8 @@ var require_discriminator = __commonJS({
6561
6555
 
6562
6556
  // node_modules/ajv/dist/refs/json-schema-draft-07.json
6563
6557
  var require_json_schema_draft_07 = __commonJS({
6564
- "node_modules/ajv/dist/refs/json-schema-draft-07.json"(exports, module2) {
6565
- module2.exports = {
6558
+ "node_modules/ajv/dist/refs/json-schema-draft-07.json"(exports, module) {
6559
+ module.exports = {
6566
6560
  $schema: "http://json-schema.org/draft-07/schema#",
6567
6561
  $id: "http://json-schema.org/draft-07/schema#",
6568
6562
  title: "Core schema meta-schema",
@@ -6718,7 +6712,7 @@ var require_json_schema_draft_07 = __commonJS({
6718
6712
 
6719
6713
  // node_modules/ajv/dist/ajv.js
6720
6714
  var require_ajv = __commonJS({
6721
- "node_modules/ajv/dist/ajv.js"(exports, module2) {
6715
+ "node_modules/ajv/dist/ajv.js"(exports, module) {
6722
6716
  "use strict";
6723
6717
  Object.defineProperty(exports, "__esModule", { value: true });
6724
6718
  exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
@@ -6747,7 +6741,7 @@ var require_ajv = __commonJS({
6747
6741
  return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : void 0);
6748
6742
  }
6749
6743
  };
6750
- module2.exports = exports = Ajv2;
6744
+ module.exports = exports = Ajv2;
6751
6745
  Object.defineProperty(exports, "__esModule", { value: true });
6752
6746
  exports.default = Ajv2;
6753
6747
  var validate_1 = require_validate();
@@ -7025,7 +7019,7 @@ var require_limit = __commonJS({
7025
7019
 
7026
7020
  // node_modules/ajv-formats/dist/index.js
7027
7021
  var require_dist = __commonJS({
7028
- "node_modules/ajv-formats/dist/index.js"(exports, module2) {
7022
+ "node_modules/ajv-formats/dist/index.js"(exports, module) {
7029
7023
  "use strict";
7030
7024
  Object.defineProperty(exports, "__esModule", { value: true });
7031
7025
  var formats_1 = require_formats();
@@ -7059,23 +7053,15 @@ var require_dist = __commonJS({
7059
7053
  for (const f of list)
7060
7054
  ajv2.addFormat(f, fs2[f]);
7061
7055
  }
7062
- module2.exports = exports = formatsPlugin;
7056
+ module.exports = exports = formatsPlugin;
7063
7057
  Object.defineProperty(exports, "__esModule", { value: true });
7064
7058
  exports.default = formatsPlugin;
7065
7059
  }
7066
7060
  });
7067
7061
 
7068
- // src/compiled.ts
7069
- var compiled_exports = {};
7070
- __export(compiled_exports, {
7071
- getValidator: () => getValidator,
7072
- tachyonMeta: () => tachyonMeta
7073
- });
7074
- module.exports = __toCommonJS(compiled_exports);
7075
-
7076
7062
  // src/meta.ts
7077
7063
  var tachyonMeta = {
7078
- "version": "0.3.4",
7064
+ "version": "1.0.0",
7079
7065
  "ids": {
7080
7066
  "autohost": {
7081
7067
  "slave": [
@@ -7198,25 +7184,27 @@ var tachyonMeta = {
7198
7184
  };
7199
7185
 
7200
7186
  // src/validator.ts
7201
- var import_ajv = __toESM(require_ajv());
7202
- var import_ajv_formats = __toESM(require_dist());
7203
- var import_fs = __toESM(require("fs"));
7204
- var import_path = __toESM(require("path"));
7187
+ var import_ajv = __toESM(require_ajv(), 1);
7188
+ var import_ajv_formats = __toESM(require_dist(), 1);
7189
+ import fs from "node:fs";
7190
+ import path, { dirname } from "node:path";
7191
+ import { fileURLToPath } from "url";
7192
+ var __filename = fileURLToPath(import.meta.url);
7193
+ var __dirname = dirname(__filename);
7205
7194
  var meta = tachyonMeta;
7206
7195
  var validators = /* @__PURE__ */ new Map();
7207
- var ajv = new import_ajv.default();
7196
+ var ajv = new import_ajv.default.default();
7208
7197
  var initialised = false;
7209
7198
  function init() {
7210
7199
  initialised = true;
7211
7200
  import_ajv_formats.default.default(ajv);
7212
- ajv.addKeyword("requiresLogin");
7213
- ajv.addKeyword("requiresRole");
7201
+ ajv.addKeyword("roles");
7214
7202
  for (const serviceId in meta.ids) {
7215
7203
  for (const endpointId in meta.ids[serviceId]) {
7216
7204
  for (const commandType of meta.ids[serviceId][endpointId]) {
7217
7205
  const commandId = `${serviceId}/${endpointId}/${commandType}`;
7218
- const commandSchemaStr = import_fs.default.readFileSync(
7219
- import_path.default.join(__dirname, `./${serviceId}/${endpointId}/${commandType}.json`),
7206
+ const commandSchemaStr = fs.readFileSync(
7207
+ path.join(__dirname, `./${serviceId}/${endpointId}/${commandType}.json`),
7220
7208
  { encoding: "utf-8" }
7221
7209
  );
7222
7210
  const commandSchema = JSON.parse(commandSchemaStr);
@@ -7242,11 +7230,10 @@ function getValidator(command) {
7242
7230
  }
7243
7231
  return validator;
7244
7232
  }
7245
- // Annotate the CommonJS export names for ESM import in node:
7246
- 0 && (module.exports = {
7233
+ export {
7247
7234
  getValidator,
7248
7235
  tachyonMeta
7249
- });
7236
+ };
7250
7237
  /*! Bundled license information:
7251
7238
 
7252
7239
  uri-js/dist/es5/uri.all.js:
@@ -251,8 +251,15 @@
251
251
  "type": "string"
252
252
  },
253
253
  "avatarUrl": {
254
- "format": "uri",
255
- "type": "string"
254
+ "anyOf": [
255
+ {
256
+ "format": "uri",
257
+ "type": "string"
258
+ },
259
+ {
260
+ "type": "null"
261
+ }
262
+ ]
256
263
  },
257
264
  "clanId": {
258
265
  "anyOf": [
@@ -308,8 +308,15 @@
308
308
  "type": "string"
309
309
  },
310
310
  "avatarUrl": {
311
- "format": "uri",
312
- "type": "string"
311
+ "anyOf": [
312
+ {
313
+ "format": "uri",
314
+ "type": "string"
315
+ },
316
+ {
317
+ "type": "null"
318
+ }
319
+ ]
313
320
  },
314
321
  "clanId": {
315
322
  "anyOf": [
@@ -237,8 +237,15 @@
237
237
  "type": "string"
238
238
  },
239
239
  "avatarUrl": {
240
- "format": "uri",
241
- "type": "string"
240
+ "anyOf": [
241
+ {
242
+ "format": "uri",
243
+ "type": "string"
244
+ },
245
+ {
246
+ "type": "null"
247
+ }
248
+ ]
242
249
  },
243
250
  "clanId": {
244
251
  "anyOf": [
@@ -29,8 +29,15 @@
29
29
  "type": "string"
30
30
  },
31
31
  "avatarUrl": {
32
- "format": "uri",
33
- "type": "string"
32
+ "anyOf": [
33
+ {
34
+ "format": "uri",
35
+ "type": "string"
36
+ },
37
+ {
38
+ "type": "null"
39
+ }
40
+ ]
34
41
  },
35
42
  "clanId": {
36
43
  "anyOf": [
@@ -34,8 +34,15 @@
34
34
  "type": "string"
35
35
  },
36
36
  "avatarUrl": {
37
- "format": "uri",
38
- "type": "string"
37
+ "anyOf": [
38
+ {
39
+ "format": "uri",
40
+ "type": "string"
41
+ },
42
+ {
43
+ "type": "null"
44
+ }
45
+ ]
39
46
  },
40
47
  "clanId": {
41
48
  "anyOf": [
@@ -34,8 +34,15 @@
34
34
  "type": "string"
35
35
  },
36
36
  "avatarUrl": {
37
- "format": "uri",
38
- "type": "string"
37
+ "anyOf": [
38
+ {
39
+ "format": "uri",
40
+ "type": "string"
41
+ },
42
+ {
43
+ "type": "null"
44
+ }
45
+ ]
39
46
  },
40
47
  "clanId": {
41
48
  "anyOf": [
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "tachyon-protocol",
3
- "version": "0.3.4",
3
+ "version": "1.0.0",
4
4
  "description": "",
5
+ "type": "module",
5
6
  "scripts": {
6
7
  "dev": "nodemon --watch src/** --ext ts --ignore src/meta.ts --exec npm run build",
7
- "build": "ts-node src/index.ts",
8
+ "build": "npx tsx src/index.ts",
8
9
  "tidy": "npm run lint && npm run format",
9
10
  "lint": "eslint . --ext .ts --fix",
10
11
  "format": "prettier --write src/**/*.ts",
@@ -29,8 +30,7 @@
29
30
  },
30
31
  "homepage": "https://github.com/beyond-all-reason/tachyon#readme",
31
32
  "dependencies": {
32
- "jaz-ts-utils": "^7.10.0",
33
- "type-fest": "^4.9.0"
33
+ "jaz-ts-utils": "^7.10.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@sinclair/typebox": "^0.32.9",
@@ -54,6 +54,7 @@
54
54
  "ts-node": "^10.9.1",
55
55
  "tsconfig-paths": "^4.2.0",
56
56
  "tsup": "^7.2.0",
57
+ "type-fest": "^4.14.0",
57
58
  "typescript": "^5.1.6"
58
59
  },
59
60
  "overrides": {