@ztimson/momentum 0.0.0 → 0.13.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,44 +1,45 @@
1
- import { Api } from './api';
2
- import { TypedEmitter, type TypedEvents } from '@ztimson/utils';
3
- import { BehaviorSubject } from 'rxjs';
4
- /** Momentum variable */
5
- export type Setting<T> = {
6
- /** Internal ID */
7
- _id?: string;
8
- /** Variable name */
9
- key: string;
10
- /** Variable value */
11
- value: T;
12
- /** Visible without authenticating */
13
- public?: boolean;
14
- /** Momentum variable, cannot be deleted */
15
- system?: boolean;
16
- };
17
- export type SettingEvents = TypedEvents & {
18
- LIST: (variables: {
19
- [key: string]: any;
20
- }) => any;
21
- DELETE: (key: string) => any;
22
- READ: (variable: Setting<any> | null) => any;
23
- UPDATE: (variable: Setting<any>) => any;
24
- };
25
- export declare class Settings extends TypedEmitter<SettingEvents> {
26
- private readonly api;
27
- $cache: BehaviorSubject<{
28
- [key: string]: any;
29
- }>;
30
- get cache(): {
31
- [key: string]: any;
32
- };
33
- set cache(val: {
34
- [key: string]: any;
35
- });
36
- constructor(api: Api | string);
37
- list(detailed?: boolean): Promise<{
38
- [key: string]: any;
39
- }>;
40
- delete(key: string): Promise<void>;
41
- read(key: string, reload?: boolean): Promise<Setting<any> | null>;
42
- update(variable: Setting<any>): Promise<Setting<any>>;
43
- }
1
+ import { BehaviorSubject } from 'rxjs';
2
+ import { TypedEmitter, TypedEvents } from '@ztimson/utils';
3
+ import { Api } from './api';
4
+
5
+ /** Momentum variable */
6
+ export type Setting<T> = {
7
+ /** Internal ID */
8
+ _id?: string;
9
+ /** Variable name */
10
+ key: string;
11
+ /** Variable value */
12
+ value: T;
13
+ /** Visible without authenticating */
14
+ public?: boolean;
15
+ /** Momentum variable, cannot be deleted */
16
+ system?: boolean;
17
+ };
18
+ export type SettingEvents = TypedEvents & {
19
+ LIST: (variables: {
20
+ [key: string]: any;
21
+ }) => any;
22
+ DELETE: (key: string) => any;
23
+ READ: (variable: Setting<any> | null) => any;
24
+ UPDATE: (variable: Setting<any>) => any;
25
+ };
26
+ export declare class Settings extends TypedEmitter<SettingEvents> {
27
+ private readonly api;
28
+ $cache: BehaviorSubject<{
29
+ [key: string]: any;
30
+ }>;
31
+ get cache(): {
32
+ [key: string]: any;
33
+ };
34
+ set cache(val: {
35
+ [key: string]: any;
36
+ });
37
+ constructor(api: Api | string);
38
+ list(detailed?: boolean): Promise<{
39
+ [key: string]: any;
40
+ }>;
41
+ delete(key: string): Promise<void>;
42
+ read(key: string, reload?: boolean): Promise<Setting<any> | null>;
43
+ update(variable: Setting<any>): Promise<Setting<any>>;
44
+ }
44
45
  //# sourceMappingURL=settings.d.ts.map
package/dist/sockets.d.ts CHANGED
@@ -1,14 +1,15 @@
1
- import { Api } from './api';
2
- export declare class Socket {
3
- static readonly timeout = 10000;
4
- private readonly api;
5
- readonly url: string;
6
- private connection;
7
- open: boolean;
8
- constructor(api: Api | string);
9
- close(): void;
10
- connect(retry?: number): void;
11
- private handle;
12
- send(channel: string, payload?: any): void;
13
- }
1
+ import { Api } from './api';
2
+
3
+ export declare class Socket {
4
+ static readonly timeout = 10000;
5
+ private readonly api;
6
+ readonly url: string;
7
+ private connection;
8
+ open: boolean;
9
+ constructor(api: Api | string);
10
+ close(): void;
11
+ connect(retry?: number): void;
12
+ private handle;
13
+ send(channel: string, payload?: any): void;
14
+ }
14
15
  //# sourceMappingURL=sockets.d.ts.map
package/dist/static.d.ts CHANGED
@@ -1,16 +1,17 @@
1
- import { Api } from './api';
2
- import { TypedEmitter, type TypedEvents } from '@ztimson/utils';
3
- import { type FileMeta } from './storage';
4
- export type StaticEvents = TypedEvents & {
5
- LIST: (path: string, response: string[] | FileMeta) => any;
6
- DELETE: (path: string) => any;
7
- UPLOAD: (files: FileMeta[]) => any;
8
- };
9
- export declare class Static extends TypedEmitter<StaticEvents> {
10
- private readonly api;
11
- constructor(api: Api | string);
12
- delete(path: string): Promise<void>;
13
- list(path: string): Promise<string[] | FileMeta>;
14
- upload(files: File | File[], path?: string): Promise<FileMeta[]>;
15
- }
1
+ import { FileMeta } from './storage';
2
+ import { TypedEmitter, TypedEvents } from '@ztimson/utils';
3
+ import { Api } from './api';
4
+
5
+ export type StaticEvents = TypedEvents & {
6
+ LIST: (path: string, response: string[] | FileMeta) => any;
7
+ DELETE: (path: string) => any;
8
+ UPLOAD: (files: FileMeta[]) => any;
9
+ };
10
+ export declare class Static extends TypedEmitter<StaticEvents> {
11
+ private readonly api;
12
+ constructor(api: Api | string);
13
+ delete(path: string): Promise<void>;
14
+ list(path: string): Promise<string[] | FileMeta>;
15
+ upload(files: File | File[], path?: string): Promise<FileMeta[]>;
16
+ }
16
17
  //# sourceMappingURL=static.d.ts.map
package/dist/storage.d.ts CHANGED
@@ -1,39 +1,40 @@
1
- import { Api } from './api';
2
- import { type Meta } from './core';
3
- import { PromiseProgress, type RequestOptions, TypedEmitter, type TypedEvents } from '@ztimson/utils';
4
- export type DirMeta = {
5
- children: (DirMeta | FileMeta)[];
6
- path: string;
7
- name: string;
8
- mime: 'directory';
9
- size: number;
10
- };
11
- export type FileMeta = Meta & {
12
- path: string;
13
- name: string;
14
- mime: string;
15
- size: number;
16
- };
17
- export type StorageEvents = TypedEvents & {
18
- LIST: (path: string, response: DirMeta | FileMeta) => any;
19
- DELETE: (path: string) => any;
20
- DOWNLOAD: (path: string, data: Blob) => any;
21
- OPEN: (path: string) => any;
22
- UPLOAD: (files: FileMeta[]) => any;
23
- };
24
- export declare class Storage extends TypedEmitter<StorageEvents> {
25
- readonly api: Api;
26
- constructor(api: Api | string);
27
- delete(path: string): Promise<void>;
28
- list(path: string): Promise<DirMeta | FileMeta>;
29
- open(path: string, target: false): string;
30
- open(path: string, target?: '_blank' | '_self'): Window | null;
31
- mkdir(path: string): Promise<DirMeta>;
32
- download(path: string, opts?: RequestOptions): PromiseProgress<Blob>;
33
- upload(files?: File | File[] | null, opts?: string | {
34
- path?: string;
35
- accept?: string;
36
- multiple?: boolean;
37
- }): Promise<FileMeta[]>;
38
- }
1
+ import { PromiseProgress, RequestOptions, TypedEmitter, TypedEvents } from '@ztimson/utils';
2
+ import { Meta } from './core';
3
+ import { Api } from './api';
4
+
5
+ export type DirMeta = {
6
+ children: (DirMeta | FileMeta)[];
7
+ path: string;
8
+ name: string;
9
+ mime: 'directory';
10
+ size: number;
11
+ };
12
+ export type FileMeta = Meta & {
13
+ path: string;
14
+ name: string;
15
+ mime: string;
16
+ size: number;
17
+ };
18
+ export type StorageEvents = TypedEvents & {
19
+ LIST: (path: string, response: DirMeta | FileMeta) => any;
20
+ DELETE: (path: string) => any;
21
+ DOWNLOAD: (path: string, data: Blob) => any;
22
+ OPEN: (path: string) => any;
23
+ UPLOAD: (files: FileMeta[]) => any;
24
+ };
25
+ export declare class Storage extends TypedEmitter<StorageEvents> {
26
+ readonly api: Api;
27
+ constructor(api: Api | string);
28
+ delete(path: string): Promise<void>;
29
+ list(path: string): Promise<DirMeta | FileMeta>;
30
+ open(path: string, target: false): string;
31
+ open(path: string, target?: '_blank' | '_self'): Window | null;
32
+ mkdir(path: string): Promise<DirMeta>;
33
+ download(path: string, opts?: RequestOptions): PromiseProgress<Blob>;
34
+ upload(files?: File | File[] | null, opts?: string | {
35
+ path?: string;
36
+ accept?: string;
37
+ multiple?: boolean;
38
+ }): Promise<FileMeta[]>;
39
+ }
39
40
  //# sourceMappingURL=storage.d.ts.map
package/dist/users.d.ts CHANGED
@@ -1,23 +1,24 @@
1
- import { Api } from './api';
2
- import { type User } from './auth';
3
- import { TypedEmitter, type TypedEvents } from '@ztimson/utils';
4
- import { BehaviorSubject } from 'rxjs';
5
- export type UserEvents = TypedEvents & {
6
- LIST: (users: User[]) => any;
7
- READ: (user: User) => any;
8
- UPDATE: (user: User) => any;
9
- DELETE: (username: string) => any;
10
- };
11
- export declare class Users extends TypedEmitter<UserEvents> {
12
- private readonly api;
13
- private listed;
14
- $cache: BehaviorSubject<User[]>;
15
- get cache(): User[];
16
- set cache(val: User[]);
17
- constructor(api: Api | string);
18
- delete(username: string): Promise<void>;
19
- list(reload?: boolean): Promise<User[]>;
20
- read(username: string, reload?: boolean): Promise<User>;
21
- update(user: User): Promise<User>;
22
- }
1
+ import { BehaviorSubject } from 'rxjs';
2
+ import { TypedEmitter, TypedEvents } from '@ztimson/utils';
3
+ import { User } from './auth';
4
+ import { Api } from './api';
5
+
6
+ export type UserEvents = TypedEvents & {
7
+ LIST: (users: User[]) => any;
8
+ READ: (user: User) => any;
9
+ UPDATE: (user: User) => any;
10
+ DELETE: (username: string) => any;
11
+ };
12
+ export declare class Users extends TypedEmitter<UserEvents> {
13
+ private readonly api;
14
+ private listed;
15
+ $cache: BehaviorSubject<User[]>;
16
+ get cache(): User[];
17
+ set cache(val: User[]);
18
+ constructor(api: Api | string);
19
+ delete(username: string): Promise<void>;
20
+ list(reload?: boolean): Promise<User[]>;
21
+ read(username: string, reload?: boolean): Promise<User>;
22
+ update(user: User): Promise<User>;
23
+ }
23
24
  //# sourceMappingURL=users.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ztimson/momentum",
3
- "version": "0.0.0",
3
+ "version": "0.13.0",
4
4
  "description": "Client library for momentum",
5
5
  "keywords": [
6
6
  "Momentum"