@auxilium/datalynk-client 1.0.14 → 1.0.15

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,50 +0,0 @@
1
- import { Api } from './api';
2
- /** Styling options for login prompt */
3
- export type LoginPromptOptions = {
4
- /** Add links to top of page */
5
- addLinks?: {
6
- text: string;
7
- url: string;
8
- }[];
9
- /** Background CSS property: url("...") #fff */
10
- background?: string;
11
- /** Primary color as hex: `#000000` */
12
- color?: string;
13
- /** Change glow color, defaults to color or set to falsy to disable */
14
- glow?: string;
15
- /** Hide app links */
16
- hideApps?: boolean;
17
- /** Allow users to stay logged in */
18
- persist?: boolean;
19
- /** Header string or HTML: <img alt="logo" src="...">*/
20
- title?: string;
21
- /** Color of headers & links */
22
- textColor?: string;
23
- };
24
- /** Create a login prompt */
25
- export declare class LoginPrompt {
26
- private readonly api;
27
- readonly spoke: string;
28
- /** Dynamically create CSS style */
29
- private static css;
30
- /** Dynamically create HTML */
31
- private static template;
32
- private readonly alert;
33
- private readonly button;
34
- private readonly form;
35
- private readonly password;
36
- private readonly persist;
37
- private readonly username;
38
- readonly options: LoginPromptOptions;
39
- private _done;
40
- /** Promise which resolves once login is complete */
41
- done: Promise<void>;
42
- constructor(api: Api, spoke: string, options?: LoginPromptOptions);
43
- /** Close the login prompt */
44
- close(): void;
45
- /** Check if login prompt is still open */
46
- isOpen(): boolean;
47
- /** Login form submit event */
48
- login(event: any): Promise<void | import('./auth').User>;
49
- }
50
- //# sourceMappingURL=login-prompt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"login-prompt.d.ts","sourceRoot":"","sources":["../src/login-prompt.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,uCAAuC;AACvC,MAAM,MAAM,kBAAkB,GAAG;IAChC,+BAA+B;IAC/B,QAAQ,CAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,GAA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 @@
1
- import { Api } from './api';
2
- /** Options when creating a PDF */
3
- export type PdfOptions = {
4
- /** Cookies PDF server should use */
5
- cookies?: {
6
- name: string;
7
- value: string;
8
- domain?: string;
9
- path?: string;
10
- }[];
11
- /** Display page header/footer (The URL, page count, etc) */
12
- displayHeaderFooter?: boolean;
13
- /** Uploaded filename */
14
- filename?: string;
15
- /** Wait for x'ms of idle network traffic before creating PDF */
16
- idleTime?: number;
17
- /** Create the PDF in landscape orientation instead of portrait */
18
- landscape?: boolean;
19
- /** Change the CSS media type */
20
- mediaType?: 'screen' | 'print';
21
- /** Max amount of time request will wait before timing out */
22
- timeout?: number;
23
- /** Wait for the URL to emit a javascript event before creating PDF */
24
- waitForEvent?: string;
25
- };
26
- export declare class Pdf {
27
- private readonly api;
28
- constructor(api: Api);
29
- /**
30
- * Create a PDF from a public URL
31
- * @param {string} url Target URL address
32
- * @param {{slice: number, row: number, field: string} | null} associate Optionally associate PDF with a slice row
33
- * @param {PdfOptions} options PDF options for rendering & uploading
34
- * @return {Promise<any>} Either the PDF file number or the updated slice row response if associated
35
- */
36
- fromUrl(url: string, associate?: {
37
- slice: number;
38
- row: number;
39
- field: string;
40
- } | null, options?: PdfOptions): Promise<any>;
41
- }
42
- //# sourceMappingURL=pdf.d.ts.map
package/dist/pdf.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"pdf.d.ts","sourceRoot":"","sources":["../src/pdf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,kCAAkC;AAClC,MAAM,MAAM,UAAU,GAAG;IACxB,oCAAoC;IACpC,OAAO,CAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;IAC1E,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,wBAAwB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gCAAgC;IAChC,SAAS,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC/B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,CAAA;AAED,qBAAa,GAAG;IACH,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,GAAG;IAErC;;;;;;OAMG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAAG,IAAI,EAAE,OAAO,GAAE,UAAe;CAMnH"}
@@ -1,55 +0,0 @@
1
- /**
2
- * List of functions to handle conversions to and from datalynk syntax
3
- */
4
- export declare const Serializer: {
5
- /**
6
- * From Datalynk syntax to JS
7
- */
8
- deserialize: {
9
- /**
10
- * Convert date time string to javascript date object
11
- *
12
- * @param {string} datetime datetime string (YYYY/MM/DD hh:mm:ss)
13
- * @returns {Date} JS Date object
14
- */
15
- '$/tools/date': (datetime: string) => Date;
16
- /**
17
- * Convert date string to javascript date object
18
- *
19
- * @param {string} date date string (YYYY/MM/DD)
20
- * @returns {Date} JS Date object
21
- */
22
- '$/tools/date_strict': (date: string) => Date;
23
- /**
24
- * Convert time string to javascript date object
25
- *
26
- * @param {string} time time string (YYYY/MM/DD)
27
- * @returns {Date} JS Date object
28
- */
29
- '$/tools/time_strict': (time: string) => Date;
30
- /**
31
- * Convert string to constant
32
- *
33
- * @param {string} constant string to be converted
34
- * @returns {any} the actual constant
35
- */
36
- '$/tools/const': (constant: string) => any;
37
- /**
38
- * Large requests are formatted into parallel arrays
39
- *
40
- * @param {object} obj Object of metadata and data
41
- * @returns {Array} Actual object reconstructed
42
- */
43
- '$/tools/dltable': (obj: any) => never[];
44
- };
45
- /**
46
- * From JS to Datalynk syntax
47
- */
48
- serialize: {
49
- /**
50
- * Convert JS date to datalynk datetime string
51
- */
52
- Date: (date: Date) => Object;
53
- };
54
- };
55
- //# sourceMappingURL=serializer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,UAAU;IAEtB;;OAEG;;QAEF;;;;;WAKG;mCACwB,MAAM,KAAG,IAAI;QAIxC;;;;;WAKG;sCAC2B,MAAM,KAAG,IAAI;QAM3C;;;;;WAKG;sCAC2B,MAAM,KAAG,IAAI;QAS3C;;;;;WAKG;oCACyB,MAAM;QAalC;;;;;WAKG;iCAC8B,GAAG;;IAkErC;;OAEG;;QAEF;;WAEG;qBACY,IAAI,KAAG,MAAM;;CAO7B,CAAC"}
package/dist/slice.d.ts DELETED
@@ -1,250 +0,0 @@
1
- import { BehaviorSubject } from 'rxjs';
2
- import { Api, ApiRequestOptions } from './api';
3
- import { Unsubscribe } from './socket';
4
- /**
5
- * An object to aid in constructing Datalynk requests
6
- */
7
- export declare class Slice<T = any> {
8
- private slice;
9
- private api;
10
- static api: Api;
11
- private operation;
12
- private popField?;
13
- private request;
14
- /** Log response automatically */
15
- debugging?: boolean;
16
- /** Unsubscribe from changes, undefined if not subscribed */
17
- unsubscribe?: Unsubscribe | null;
18
- /** Cached slice data as an observable */
19
- private cache$;
20
- /** Cached slice data */
21
- private get cache();
22
- /** Set cached data & alert subscribers */
23
- private set cache(value);
24
- /** Get raw API request */
25
- get raw(): Partial<{
26
- [x: string]: any;
27
- $pop: string | undefined;
28
- }>;
29
- /**
30
- * An object to aid in constructing requests
31
- *
32
- * @param {number} slice Slice ID to interact with
33
- * @param {Api} api Api to send the requests through
34
- */
35
- constructor(slice: number | string, api: Api);
36
- /**
37
- * Whitelist and alias fields. Alias of `fields()`
38
- * @example
39
- * ```ts
40
- * const id: {id: number, field2: any}[] = await new Slice<T>(12345)
41
- * .select().alias({id: 'id', field1: 'field2'}).exec().keys();
42
- * ```
43
- * @param {object} aliasKeyVals List of properties to whitelist and what to rename them to
44
- * @return {Slice<T>}
45
- */
46
- alias: {
47
- (whitelist: string[]): Slice<T>;
48
- (alias: {
49
- [key: string]: string | object;
50
- }): Slice<T>;
51
- };
52
- /**
53
- * Add an 'AND' condition inside the where argument
54
- * @example
55
- * ```ts
56
- * const rows: T[] = await new Slice<T>(12345).select()
57
- * .where('field1', '>', 1)
58
- * .and()
59
- * .where({field2: 2, field3: 3})
60
- * .exec().rows();
61
- * ```
62
- * @return {Slice<T>}
63
- */
64
- and(): this;
65
- /**
66
- * Count the returned rows
67
- * @example
68
- * ```ts
69
- * const count = await new Slice(12345).count()
70
- * .where({field1: 1})
71
- * .exec().count();
72
- * ```
73
- * @param {object | string} arg Count argument
74
- * @return {Slice<T>}
75
- */
76
- count(arg?: object | string): Slice<T>;
77
- /**
78
- * Output the formed request to the console for inspection
79
- * @param {boolean} enabled Enable/Disable console logging
80
- * @return {Slice<T>}
81
- */
82
- debug(enabled?: boolean): this;
83
- /**
84
- * Set the request type to delete
85
- * @example
86
- * ```ts
87
- * await new Slice(12345).delete(id).exec();
88
- * ```
89
- * @param {number | number[]} id ID(s) to delete
90
- * @return {Slice<T>}
91
- */
92
- delete(id?: number | number[]): Slice<T>;
93
- /**
94
- * Filter rows from slice based on an excel expression
95
- * @example
96
- * ```ts
97
- * const rows: T[] = await new Slice<T>(12345).select()
98
- * .excel('contains({property}, foobar)')
99
- * .exec().rows();
100
- * ```
101
- * @param formula Excel formula to use as where clause
102
- * @return {Slice<T>}
103
- */
104
- excel(formula: string): Slice<T>;
105
- /**
106
- * Compile the request and send it
107
- * @param {ApiRequestOptions} options API Request options
108
- * @return {Promise<T = any>} API response
109
- */
110
- exec<T = any>(options?: ApiRequestOptions): Promise<T>;
111
- /**
112
- * Whitelist fields by passing an array of keys or alias fields by using a map
113
- * @example
114
- * ```ts
115
- * const id: {id: number, field1: any}[] = await new Slice<T>(12345)
116
- * .select().fields(['id', 'field1']).exec().keys();
117
- * ```
118
- * @param {object} whitelist Either a list of keys to whitelist or a map of keys to rename
119
- * @return {Slice<T>}
120
- */
121
- fields(whitelist: string[]): Slice<T>;
122
- fields(alias: {
123
- [key: string]: string | object;
124
- }): Slice<T>;
125
- /**
126
- * Unwrap response returning the first ID
127
- * @return {Slice<T>}
128
- */
129
- id(): Slice<T>;
130
- /**
131
- * Set the request type to insert
132
- * @example
133
- * ```ts
134
- * const id: number = await new Slice<T>(12345).insert([
135
- * {field1: 1},
136
- * {field1: 2}
137
- * ]).exec().keys();
138
- * ```
139
- * @param {T | T[]} rows Rows to be inserted into the slice
140
- * @return {Slice<T>}
141
- */
142
- insert(rows: T | T[]): Slice<T>;
143
- /**
144
- * Limit number of rows returned
145
- * @example
146
- * ```ts
147
- * const rows: T[] = await new Slice<T>(12345).select().limit(10)
148
- * .exec().rows();
149
- * ```
150
- * @param {number} num Number of rows to return
151
- * @return {Slice<T>}
152
- */
153
- limit(num: number): this;
154
- /**
155
- * Add an 'OR' condition inside the where argument
156
- * @example
157
- * ```ts
158
- * const rows: T[] = await new Slice<T>(12345).select()
159
- * .where('field1', '>', 1)
160
- * .or()
161
- * .where({field2: 2, field3: 3})
162
- * .or()
163
- * .where(['$gt', ['$field', field4], 4)
164
- * .exec().rows();
165
- * ```
166
- * @return {Slice<T>}
167
- */
168
- or(): this;
169
- /**
170
- * Order rows by a field
171
- * @example
172
- * ```ts
173
- * const rows: T[] = new Slice<T>(12345).select().order('field1', true) // true = ascending
174
- * .exec().rows();
175
- * ```
176
- * @param {string} field property name
177
- * @param {boolean} ascending Sort in ascending or descending order
178
- * @return {Slice<T>}
179
- */
180
- order(field: string, ascending?: boolean): Slice<T>;
181
- /**
182
- * Unwrap response, returning the field
183
- * @param {string} field Colon seperated path: `rows:0`
184
- * @return {Slice<T>}
185
- */
186
- pop(field: string | null): Slice<T>;
187
- /**
188
- * Unwrap response returning the first row
189
- * @return {Slice<T>}
190
- */
191
- row(): Slice<T>;
192
- /**
193
- * Unwrap response returning the rows
194
- * @return {Slice<T>}
195
- */
196
- rows(): Slice<T>;
197
- /**
198
- * Set the request type to select
199
- * @example
200
- * ```ts
201
- * const rows: T[] = new Slice<T>(12345).select().exec().rows();
202
- * const row: T = new Slice<T>(12345).select(id).exec().row();
203
- * ```
204
- * @param {number | number[]} id ID(s) to select, leaving blank will return all rows
205
- * @return {Slice<T>}
206
- */
207
- select(id?: number | number[]): Slice<T>;
208
- /**
209
- * Synchronize cache with server
210
- * @example
211
- * ```ts
212
- * const slice: Slice = new Slice<T>(Slices.Contact);
213
- * slice.sync().subscribe((rows: T[]) => {});
214
- * ```
215
- * @param {boolean} on Enable/disable events
216
- * @return {BehaviorSubject<T[]>} Cache which can be subscribed to
217
- */
218
- sync(on?: boolean): BehaviorSubject<T[]> | undefined;
219
- /**
220
- * Set the request type to update
221
- * @example
222
- * ```ts
223
- * const ids: number[] = await new Slice<Type>(12345).update([
224
- * {id: 1, field1: 1},
225
- * {id: 2, field1: 1}
226
- * ]).exec().keys();
227
- * ```
228
- * @param {T | T[]} rows Rows to be updated, each row must have an ID
229
- * @return {Slice<T>}
230
- */
231
- update(rows: T | T[]): this;
232
- /**
233
- * Add where condition to request
234
- * @example
235
- * ```ts
236
- * const rows: T[] = await new Slice<T>(12345).select()
237
- * .where('field1', '>', 1)
238
- * .where({field2: 2, field3: 3}) // Automatic AND
239
- * .or()
240
- * .where(['$gt', ['$field', field4], 4)
241
- * .exec().rows();
242
- * ```
243
- * @param {string | object} field property to compare or a map of equality comparisons
244
- * @param {string} operator Operation to compare with. Accepts JS operators (>=, ==, !=, ...) as well as datalynk styax ($gte, $eq, $is, $not, ...)
245
- * @param {any} value value to compare against
246
- * @return {Slice<T>}
247
- */
248
- where(field: string | object, operator?: string, value?: any): Slice<T>;
249
- }
250
- //# sourceMappingURL=slice.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"slice.d.ts","sourceRoot":"","sources":["../src/slice.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,MAAM,CAAC;AACrC,OAAO,EAAC,GAAG,EAAE,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAmB,WAAW,EAAC,MAAM,UAAU,CAAC;AAEvD;;GAEG;AACH,qBAAa,KAAK,CAAC,CAAC,GAAG,GAAG;IAoCb,OAAO,CAAC,KAAK;IAAmB,OAAO,CAAC,GAAG;IAnCvD,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC;IAEhB,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,CAAgB;IACjC,OAAO,CAAC,OAAO,CAAW;IAE1B,iCAAiC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAEjC,yCAAyC;IACzC,OAAO,CAAC,MAAM,CAAgC;IAC9C,wBAAwB;IACxB,OAAO,KAAK,KAAK,GAA0C;IAC3D,0CAA0C;IAC1C,OAAO,KAAK,KAAK,QAAyC;IAE1D,0BAA0B;IAC1B,IAAI,GAAG;;;OAQN;IAED;;;;;OAKG;gBACiB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAU,GAAG,EAAE,GAAG;IAE5D;;;;;;;;;OASG;IACH,KAAK;oBAyGa,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC;gBACvB;YAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;SAAC,GAAG,KAAK,CAAC,CAAC,CAAC;MA1GrC;IAEpB;;;;;;;;;;;OAWG;IACH,GAAG;IAOH;;;;;;;;;;OAUG;IACH,KAAK,CAAC,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H,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC;IASxC;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,UAAO;IAoBd;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE;IAQpB;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC;CA+BvE"}
package/dist/socket.d.ts DELETED
@@ -1,64 +0,0 @@
1
- import { Api } from './api';
2
- export type SocketEvent<T> = {
3
- channel: string;
4
- spoke: string;
5
- type: string;
6
- data: T;
7
- };
8
- export type SocketEventSlice = SocketEvent<{
9
- slice: number;
10
- tx: string;
11
- new: number[];
12
- lost: number[];
13
- changed: number[];
14
- }>;
15
- /** Connection options */
16
- export type SocketOptions = {
17
- /** Set connection URL or disable with false */
18
- url?: string | false;
19
- };
20
- /** Callback shape */
21
- export type SocketListener<T = SocketEvent<any>> = (event: T) => any;
22
- /** Call to unsubscribe callback from event */
23
- export type Unsubscribe = () => void;
24
- /** Datalynk Socket connection */
25
- export declare class Socket {
26
- private readonly api;
27
- readonly options: SocketOptions;
28
- private listeners;
29
- private retry?;
30
- private socket?;
31
- open: boolean;
32
- constructor(api: Api, options?: SocketOptions);
33
- /**
34
- * Add listener for all socket events
35
- *
36
- * @param {SocketListener} fn Callback function
37
- * @return {Unsubscribe} Function to unsubscribe callback
38
- */
39
- addListener(fn: SocketListener, reconnect: () => void): Unsubscribe;
40
- /**
41
- * Close socket connection
42
- */
43
- close(): void;
44
- /**
45
- * Connect socket client to socket server
46
- * @param {number} timeout Retry to connect every x seconds
47
- */
48
- connect(timeout?: number): void;
49
- /**
50
- * Send data to socket server
51
- *
52
- * @param payload Data that will be serialized
53
- */
54
- send(payload: any): void;
55
- /**
56
- * Run callback whenever the server notifies us of slice changes
57
- *
58
- * @param {number | number[]} slice Slice to subscribe to
59
- * @param {SocketListener<SocketEventSlice>} callback Function to run on changes
60
- * @return {Unsubscribe} Run returned function to unsubscribe callback
61
- */
62
- sliceEvents(slice: number | number[] | string | string[], callback: SocketListener<SocketEventSlice>): Unsubscribe;
63
- }
64
- //# sourceMappingURL=socket.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../src/socket.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,CAAA;CACP,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC,CAAC;AAEH,yBAAyB;AACzB,MAAM,MAAM,aAAa,GAAG;IAC3B,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;CACpB,CAAA;AAED,qBAAqB;AACrB,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,CAAC;AACrE,8CAA8C;AAC9C,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC;AAErC,iCAAiC;AACjC,qBAAa,MAAM;IAON,OAAO,CAAC,QAAQ,CAAC,GAAG;aAAuB,OAAO,EAAE,aAAa;IAN7E,OAAO,CAAC,SAAS,CAAoC;IACrD,OAAO,CAAC,KAAK,CAAC,CAAM;IACpB,OAAO,CAAC,MAAM,CAAC,CAAY;IAE3B,IAAI,UAAS;gBAEgB,GAAG,EAAE,GAAG,EAAkB,OAAO,GAAE,aAAkB;IAYlF;;;;;OAKG;IACH,WAAW,CAAC,EAAE,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,IAAI,GAAG,WAAW;IAKnE;;OAEG;IACH,KAAK;IASL;;;OAGG;IACH,OAAO,CAAC,OAAO,GAAE,MAAW;IAgC5B;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,GAAG;IAKjB;;;;;;OAMG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE,EAAE,QAAQ,EAAE,cAAc,CAAC,gBAAgB,CAAC,GAAG,WAAW;CAclH"}
@@ -1,24 +0,0 @@
1
- import { Api } from './api';
2
- /**
3
- * Superuser helpers
4
- */
5
- export declare class Superuser {
6
- private readonly api;
7
- constructor(api: Api);
8
- /**
9
- * Switch to another user by ID
10
- *
11
- * @param {number} userId User ID
12
- * @return {Promise<any>} New session
13
- */
14
- assume(userId: number): Promise<any>;
15
- /**
16
- * Enable the superuser flag, required to make any of the requests in this helper
17
- *
18
- * @param {string} username Superuser account
19
- * @param {string} password Superuser password
20
- * @return {Promise<any>} Unknown
21
- */
22
- enable(username: string, password: string): Promise<any>;
23
- }
24
- //# sourceMappingURL=superuser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"superuser.d.ts","sourceRoot":"","sources":["../src/superuser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B;;GAEG;AACH,qBAAa,SAAS;IAET,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,GAAG;IAErC;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM;IAOrB;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAMzC"}