@ztimson/momentum 0.28.1 → 0.28.3

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <br />
4
4
 
5
5
  <!-- Logo -->
6
- <img src="server/public/favicon.svg" alt="Logo" width="200" height="200">
6
+ <img src="server/public/favicon.png" alt="Logo" width="200" height="200">
7
7
 
8
8
  <!-- Title -->
9
9
  ### Momentum
package/dist/api.d.ts CHANGED
@@ -5,6 +5,16 @@ export type ApiEvents = TypedEvents & {
5
5
  REJECTED: (response: Error, options: HttpRequestOptions) => any;
6
6
  TOKEN: (token: string | null) => any;
7
7
  };
8
+ export type Health = {
9
+ status: 'ok' | 'degraded' | 'failing';
10
+ database: boolean;
11
+ email: boolean;
12
+ payments: boolean;
13
+ server: boolean;
14
+ sockets: boolean;
15
+ version: string;
16
+ commit: string;
17
+ };
8
18
  export declare class Api extends Http {
9
19
  readonly url: string;
10
20
  readonly opts: HttpDefaults;
@@ -17,6 +27,7 @@ export declare class Api extends Http {
17
27
  off: <K extends string | symbol = string>(event: K, listener: ApiEvents[K]) => void;
18
28
  on: <K extends string | symbol = string>(event: K, listener: ApiEvents[K]) => () => void;
19
29
  once: <K extends string | symbol = string>(event: K, listener?: ApiEvents[K] | undefined) => Promise<any>;
30
+ healthcheck(): PromiseProgress<Health>;
20
31
  request<T>(options: HttpRequestOptions): PromiseProgress<T>;
21
32
  }
22
33
  //# sourceMappingURL=api.d.ts.map
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,IAAI,EAAE,YAAY,EAClB,kBAAkB,EAClB,eAAe,EAEf,KAAK,WAAW,EAChB,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG;IACrC,OAAO,EAAE,CAAC,OAAO,EAAE,O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QAAQ,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAkB,KAAK,GAAG,CAAC;IAChE,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,GAAG,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,MAAM,GAAG;IACpB,MAAM,EAAE,IAAI,GAAG,UAAU,GAAG,SAAS,CAAC;IACtC,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CACf,CAAA;AAED,qBAAa,GAAI,SAAQ,IAAI;aAYA,GAAG,EAAE,MAAM;aAAoC,IAAI,EAAE,YAAY;IAX7F,OAAO,CAAC,OAAO,CAAiC;IAEhD,OAAO,CAAC,MAAM,CAAuB;IACrC,IAAI,KAAK,IAAI,MAAM,GAAG,IAAI,CAAwB;IAClD,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAK7B;gBAE2B,GAAG,GAAE,MAAwB,EAAkB,IAAI,GAAE,YAAiB;IAKlG,IAAI,mFAAwC;IAC5C,GAAG,iFAAuC;IAC1C,EAAE,uFAAsC;IACxC,IAAI,sGAAwC;IAE5C,WAAW;IAIX,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,kBAAkB,GAAG,eAAe,CAAC,CAAC,CAAC;CAa3D"}
package/dist/index.cjs CHANGED
@@ -357,6 +357,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
357
357
  this.headers["Authorization"] = token ? `Bearer ${token}` : void 0;
358
358
  this.emit("TOKEN", token);
359
359
  }
360
+ healthcheck() {
361
+ return this.request({ url: "/api/healthcheck" });
362
+ }
360
363
  request(options) {
361
364
  const req = super.request(options).then((resp) => {
362
365
  this.emit("RESPONSE", resp, options);
@@ -1625,6 +1628,51 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1625
1628
  });
1626
1629
  }
1627
1630
  }
1631
+ class UI {
1632
+ constructor(settings) {
1633
+ this.settings = settings;
1634
+ }
1635
+ async inject(reload = false) {
1636
+ if (!Object.keys(this.settings.cache).length || reload) await this.settings.list();
1637
+ window.document.body.classList.add(this.settings.cache.theme.darkMode ? "theme-dark" : "theme-light");
1638
+ window.document.body.classList.remove(this.settings.cache.theme.darkMode ? "theme-light" : "theme-dark");
1639
+ if (this.settings.cache.title)
1640
+ window.document.querySelectorAll(".momentum-title").forEach((el) => el.innerText = this.settings.cache.title);
1641
+ if (this.settings.cache.description)
1642
+ window.document.querySelectorAll(".momentum-description").forEach((el) => el.innerText = this.settings.cache.description);
1643
+ if (this.settings.cache.version)
1644
+ window.document.querySelectorAll(".momentum-version").forEach((el) => el.innerText = this.settings.cache.version);
1645
+ if (this.settings.cache.logo) {
1646
+ window.document.querySelectorAll(".momentum-logo").forEach((el) => {
1647
+ el.src = this.settings.cache.logo;
1648
+ el.href = this.settings.cache.logo;
1649
+ });
1650
+ }
1651
+ if (this.settings.cache.theme) {
1652
+ let style = window.document.querySelector("#momentum-theme");
1653
+ if (!style) {
1654
+ style = window.document.createElement("style");
1655
+ style.id = "momentum-theme";
1656
+ window.document.head.append(style);
1657
+ }
1658
+ style.innerHTML = `
1659
+ :root {
1660
+ --theme-bg-primary: ${this.settings.cache.theme.background};
1661
+ --theme-bg-secondary: ${this.settings.cache.theme.darkMode ? "#2e2e2e" : "#ffffff"};
1662
+ --theme-primary: ${this.settings.cache.theme.primary};
1663
+ --theme-secondary: ${this.settings.cache.theme.secondary};
1664
+ --theme-text: ${this.settings.cache.theme.darkMode ? "#ffffff" : "#000000"};
1665
+ --theme-muted: ${this.settings.cache.theme.darkMode ? "#cccccc" : "#6c757d"};
1666
+ }`;
1667
+ }
1668
+ if (this.settings.cache.pwa) {
1669
+ const link = window.document.createElement("link");
1670
+ link.setAttribute("rel", "manifest");
1671
+ link.setAttribute("href", this.settings.api.url + "/manifest.json");
1672
+ window.document.head.append(link);
1673
+ }
1674
+ }
1675
+ }
1628
1676
  class Users extends P {
1629
1677
  constructor(api) {
1630
1678
  super();
@@ -1761,11 +1809,17 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1761
1809
  });
1762
1810
  }
1763
1811
  upload(files, path = "/") {
1764
- const data = new FormData();
1765
- (Array.isArray(files) ? files : [files]).forEach((f) => data.append("file", f));
1766
- return this.api.request({ url: "/api/static" + path, body: data }).then((resp) => {
1767
- this.emit("UPLOAD", resp || []);
1768
- return resp;
1812
+ return new E(async (res, rej, prog) => {
1813
+ return At({
1814
+ url: this.api.url + ("/api/static/" + path).replaceAll("//", "/"),
1815
+ files: Array.isArray(files) ? files : [files],
1816
+ headers: this.api.headers
1817
+ }).onProgress((p2) => {
1818
+ prog(p2);
1819
+ }).then((resp) => {
1820
+ this.emit("UPLOAD", resp);
1821
+ res(resp);
1822
+ }).catch((err) => rej(err));
1769
1823
  });
1770
1824
  }
1771
1825
  }
@@ -1785,6 +1839,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1785
1839
  __publicField(this, "socket");
1786
1840
  __publicField(this, "static");
1787
1841
  __publicField(this, "storage");
1842
+ __publicField(this, "ui");
1788
1843
  __publicField(this, "users");
1789
1844
  this.api = new Api(url, opts == null ? void 0 : opts.api);
1790
1845
  this.actions = new Actions(this.api);
@@ -1799,10 +1854,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1799
1854
  if (opts == null ? void 0 : opts.stripeSecret) this.payments = new Payments(this.api, opts.stripeSecret);
1800
1855
  this.pdf = new Pdf(this.api);
1801
1856
  this.settings = new Settings(this.api);
1857
+ if (opts == null ? void 0 : opts.socket) this.socket = new Socket(this.api);
1802
1858
  this.static = new Static(this.api);
1803
1859
  this.storage = new Storage(this.api);
1860
+ this.ui = new UI(this.settings);
1804
1861
  this.users = new Users(this.api);
1805
- if (opts == null ? void 0 : opts.socket) this.socket = new Socket(this.api);
1806
1862
  this.api.on("*", (event, ...args) => this.emit(`API::${event}`, ...args));
1807
1863
  this.actions.on("*", (event, ...args) => this.emit(`ACTIONS::${event}`, ...args));
1808
1864
  this.auth.on("*", (event, ...args) => this.emit(`AUTH::${event}`, ...args));
@@ -1845,6 +1901,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1845
1901
  exports2.Static = Static;
1846
1902
  exports2.Storage = Storage;
1847
1903
  exports2.Totp = Totp;
1904
+ exports2.UI = UI;
1848
1905
  exports2.Users = Users;
1849
1906
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
1850
1907
  });
package/dist/index.d.ts CHANGED
@@ -13,5 +13,6 @@ export * from './settings';
13
13
  export * from './sockets';
14
14
  export * from './static';
15
15
  export * from './storage';
16
+ export * from './ui';
16
17
  export * from './users';
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC"}
package/dist/index.mjs CHANGED
@@ -353,6 +353,9 @@ class Api extends M {
353
353
  this.headers["Authorization"] = token ? `Bearer ${token}` : void 0;
354
354
  this.emit("TOKEN", token);
355
355
  }
356
+ healthcheck() {
357
+ return this.request({ url: "/api/healthcheck" });
358
+ }
356
359
  request(options) {
357
360
  const req = super.request(options).then((resp) => {
358
361
  this.emit("RESPONSE", resp, options);
@@ -1621,6 +1624,51 @@ class Storage extends P {
1621
1624
  });
1622
1625
  }
1623
1626
  }
1627
+ class UI {
1628
+ constructor(settings) {
1629
+ this.settings = settings;
1630
+ }
1631
+ async inject(reload = false) {
1632
+ if (!Object.keys(this.settings.cache).length || reload) await this.settings.list();
1633
+ window.document.body.classList.add(this.settings.cache.theme.darkMode ? "theme-dark" : "theme-light");
1634
+ window.document.body.classList.remove(this.settings.cache.theme.darkMode ? "theme-light" : "theme-dark");
1635
+ if (this.settings.cache.title)
1636
+ window.document.querySelectorAll(".momentum-title").forEach((el) => el.innerText = this.settings.cache.title);
1637
+ if (this.settings.cache.description)
1638
+ window.document.querySelectorAll(".momentum-description").forEach((el) => el.innerText = this.settings.cache.description);
1639
+ if (this.settings.cache.version)
1640
+ window.document.querySelectorAll(".momentum-version").forEach((el) => el.innerText = this.settings.cache.version);
1641
+ if (this.settings.cache.logo) {
1642
+ window.document.querySelectorAll(".momentum-logo").forEach((el) => {
1643
+ el.src = this.settings.cache.logo;
1644
+ el.href = this.settings.cache.logo;
1645
+ });
1646
+ }
1647
+ if (this.settings.cache.theme) {
1648
+ let style = window.document.querySelector("#momentum-theme");
1649
+ if (!style) {
1650
+ style = window.document.createElement("style");
1651
+ style.id = "momentum-theme";
1652
+ window.document.head.append(style);
1653
+ }
1654
+ style.innerHTML = `
1655
+ :root {
1656
+ --theme-bg-primary: ${this.settings.cache.theme.background};
1657
+ --theme-bg-secondary: ${this.settings.cache.theme.darkMode ? "#2e2e2e" : "#ffffff"};
1658
+ --theme-primary: ${this.settings.cache.theme.primary};
1659
+ --theme-secondary: ${this.settings.cache.theme.secondary};
1660
+ --theme-text: ${this.settings.cache.theme.darkMode ? "#ffffff" : "#000000"};
1661
+ --theme-muted: ${this.settings.cache.theme.darkMode ? "#cccccc" : "#6c757d"};
1662
+ }`;
1663
+ }
1664
+ if (this.settings.cache.pwa) {
1665
+ const link = window.document.createElement("link");
1666
+ link.setAttribute("rel", "manifest");
1667
+ link.setAttribute("href", this.settings.api.url + "/manifest.json");
1668
+ window.document.head.append(link);
1669
+ }
1670
+ }
1671
+ }
1624
1672
  class Users extends P {
1625
1673
  constructor(api) {
1626
1674
  super();
@@ -1757,11 +1805,17 @@ class Static extends P {
1757
1805
  });
1758
1806
  }
1759
1807
  upload(files, path = "/") {
1760
- const data = new FormData();
1761
- (Array.isArray(files) ? files : [files]).forEach((f) => data.append("file", f));
1762
- return this.api.request({ url: "/api/static" + path, body: data }).then((resp) => {
1763
- this.emit("UPLOAD", resp || []);
1764
- return resp;
1808
+ return new E(async (res, rej, prog) => {
1809
+ return At({
1810
+ url: this.api.url + ("/api/static/" + path).replaceAll("//", "/"),
1811
+ files: Array.isArray(files) ? files : [files],
1812
+ headers: this.api.headers
1813
+ }).onProgress((p3) => {
1814
+ prog(p3);
1815
+ }).then((resp) => {
1816
+ this.emit("UPLOAD", resp);
1817
+ res(resp);
1818
+ }).catch((err) => rej(err));
1765
1819
  });
1766
1820
  }
1767
1821
  }
@@ -1781,6 +1835,7 @@ class Momentum extends P {
1781
1835
  __publicField(this, "socket");
1782
1836
  __publicField(this, "static");
1783
1837
  __publicField(this, "storage");
1838
+ __publicField(this, "ui");
1784
1839
  __publicField(this, "users");
1785
1840
  this.api = new Api(url, opts == null ? void 0 : opts.api);
1786
1841
  this.actions = new Actions(this.api);
@@ -1795,10 +1850,11 @@ class Momentum extends P {
1795
1850
  if (opts == null ? void 0 : opts.stripeSecret) this.payments = new Payments(this.api, opts.stripeSecret);
1796
1851
  this.pdf = new Pdf(this.api);
1797
1852
  this.settings = new Settings(this.api);
1853
+ if (opts == null ? void 0 : opts.socket) this.socket = new Socket(this.api);
1798
1854
  this.static = new Static(this.api);
1799
1855
  this.storage = new Storage(this.api);
1856
+ this.ui = new UI(this.settings);
1800
1857
  this.users = new Users(this.api);
1801
- if (opts == null ? void 0 : opts.socket) this.socket = new Socket(this.api);
1802
1858
  this.api.on("*", (event, ...args) => this.emit(`API::${event}`, ...args));
1803
1859
  this.actions.on("*", (event, ...args) => this.emit(`ACTIONS::${event}`, ...args));
1804
1860
  this.auth.on("*", (event, ...args) => this.emit(`AUTH::${event}`, ...args));
@@ -1842,5 +1898,6 @@ export {
1842
1898
  Static,
1843
1899
  Storage,
1844
1900
  Totp,
1901
+ UI,
1845
1902
  Users
1846
1903
  };
@@ -10,6 +10,7 @@ import { Payments } from './payments';
10
10
  import { Pdf, PdfEvents } from './pdf';
11
11
  import { Socket } from './sockets';
12
12
  import { Storage, StorageEvents } from './storage';
13
+ import { UI } from './ui';
13
14
  import { Users } from './users';
14
15
  import { Settings, SettingEvents } from './settings';
15
16
  import { Static, StaticEvents } from './static';
@@ -34,6 +35,7 @@ export declare class Momentum extends TypedEmitter<MomentumEvents> {
34
35
  socket?: Socket;
35
36
  static: Static;
36
37
  storage: Storage;
38
+ ui: UI;
37
39
  users: Users;
38
40
  constructor(url?: string, opts?: MomentumOptions);
39
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"momentum.d.ts","sourceRoot":"","sources":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,OAAO,EAAG,OAAO,CAAC;IAClB,EAAE,EAAG,EAAE,CAAC;IACR,KAAK,EAAG,KAAK,CAAC;gBAEF,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,eAAe;CA2ChD"}
@@ -23,7 +23,7 @@ export type SettingEvents = TypedEvents & {
23
23
  UPDATE: (variable: Setting<any>) => any;
24
24
  };
25
25
  export declare class Settings extends TypedEmitter<SettingEvents> {
26
- private readonly api;
26
+ readonly api: Api;
27
27
  $cache: BehaviorSubject<{
28
28
  [key: string]: any;
29
29
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,YAAY,EAAE,KAAK,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAC,eAAe,EAAC,MAAM,MAAM,CAAC;AAErC,wBAAwB;AACxB,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;IACxB,kBAAkB;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,qBAAqB;IACrB,KAAK,EAAE,CAAC,CAAC;IACT,qCAAqC;IACrC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACzC,IAAI,EAAE,CAAC,SAAS,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,KAAK,GAAG,CAAC;IAC/C,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;IAC7B,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,KAAK,GAAG,CAAC;IAC7C,MAAM,EAAE,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AAC;CACjB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACzC,IAAI,EAAE,CAAC,SAAS,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,KAAK,GAAG,CAAC;IAC/C,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;IAC7B,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,KAAK,GAAG,CAAC;IAC7C,MAAM,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC;CACxC,CAAA;AAED,qBAAa,QAAS,SAAQ,YAAY,CAAC,aAAa,CAAC;IACxD,QAAQ,CAAC,GAAG,EAAG,GAAG,CAAC;IAEnB,MAAM;;OAAiD;IACvD,IAAI,KAAK;;MAAgC;IACzC,IAAI,KAAK,CAAC,GAAG;;KAAA,EAA4B;gBAE7B,GAAG,EAAE,GAAG,GAAG,MAAM;IAK7B,IAAI,CAAC,QAAQ,UAAQ,GAAG,OAAO,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;IAQrD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOlC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,UAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAS7D,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;CAOrD"}
package/dist/static.d.ts CHANGED
@@ -4,13 +4,13 @@ import { FileMeta } from './storage';
4
4
  export type StaticEvents = TypedEvents & {
5
5
  LIST: (path: string, response: string[] | FileMeta) => any;
6
6
  DELETE: (path: string) => any;
7
- UPLOAD: (files: FileMeta[]) => any;
7
+ UPLOAD: (files: string[]) => any;
8
8
  };
9
9
  export declare class Static extends TypedEmitter<StaticEvents> {
10
10
  private readonly api;
11
11
  constructor(api: Api | string);
12
12
  delete(path: string): Promise<void>;
13
13
  list(path: string): Promise<string[] | FileMeta>;
14
- upload(files: File | File[], path?: string): Promise<FileMeta[]>;
14
+ upload(files: File | File[], path?: string): Promise<string[]>;
15
15
  }
16
16
  //# sourceMappingURL=static.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../src/static.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,YAAY,EAAE,KAAK,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAC,KAAK,QAAQ,EAAC,MAAM,WAAW,CAAC;AAExC,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG;IACxC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,QAAQ,KAAK,GAAG,CAAC;IAC3D,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC;IAC9B,MAAM,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,GAAG,CAAC;CACnC,CAAC;AAEF,qBAAa,MAAO,SAAQ,YAAY,CAAC,YAAY,CAAC;IACrD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAO;gBAEf,GAAG,EAAE,GAAG,GAAG,MAAM;IAK7B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMnC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC;IAQhD,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,EAAE,IAAI,SAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;CAQ7D"}
1
+ {"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../src/static.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA+B,YAAY,EAAE,KAAK,WAAW,EAAqB,MAAM,gBAAgB,CAAC;AAChH,OAAO,EAAC,KAAK,QAAQ,EAAC,MAAM,WAAW,CAAC;AAExC,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG;IACxC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,QAAQ,KAAK,GAAG,CAAC;IAC3D,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC;IAC9B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,CAAC;CACjC,CAAC;AAEF,qBAAa,MAAO,SAAQ,YAAY,CAAC,YAAY,CAAC;IACrD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAO;gBAEf,GAAG,EAAE,GAAG,GAAG,MAAM;IAK7B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMnC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC;IAQhD,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,EAAE,IAAI,SAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAc3D"}
package/dist/ui.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { Settings } from './settings';
2
+ export declare class UI {
3
+ private readonly settings;
4
+ constructor(settings: Settings);
5
+ inject(reload?: boolean): Promise<void>;
6
+ }
7
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,qBAAa,EAAE;IAEF,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,QAAQ;IAEzC,MAAM,CAAC,MAAM,UAAQ;CAkD3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ztimson/momentum",
3
- "version": "0.28.1",
3
+ "version": "0.28.3",
4
4
  "description": "Client library for momentum",
5
5
  "keywords": [
6
6
  "Momentum"
@@ -22,7 +22,7 @@
22
22
  "scripts": {
23
23
  "prebuild": "node -e \"const fs=require('fs');fs.cpSync('../README.md','./README.md')\"",
24
24
  "build": "tsc && vite build",
25
- "postbuild": "node -e \"const fs=require('fs');fs.cpSync('dist/index.mjs','../server/public/momentum.mjs')\"",
25
+ "postbuild": "node -e \"const fs=require('fs');fs.cpSync('dist/index.mjs','../server/public/momentum.mjs');fs.cpSync('dist/index.cjs','../server/public/momentum.js')\"",
26
26
  "watch": "vite build --watch"
27
27
  },
28
28
  "dependencies": {