@auxilium/datalynk-client 1.2.2 → 1.2.4
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/package.json +1 -1
- package/dist/api.d.ts +0 -206
- package/dist/api.d.ts.map +0 -1
- package/dist/auth.d.ts +0 -174
- package/dist/auth.d.ts.map +0 -1
- package/dist/files.d.ts +0 -65
- package/dist/files.d.ts.map +0 -1
- package/dist/index.d.ts +0 -13
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -3752
- package/dist/index.mjs +0 -3752
- package/dist/login-prompt.d.ts +0 -62
- package/dist/login-prompt.d.ts.map +0 -1
- package/dist/meta.d.ts +0 -464
- package/dist/meta.d.ts.map +0 -1
- package/dist/pdf.d.ts +0 -42
- package/dist/pdf.d.ts.map +0 -1
- package/dist/pwa.d.ts +0 -14
- package/dist/pwa.d.ts.map +0 -1
- package/dist/serializer.d.ts +0 -55
- package/dist/serializer.d.ts.map +0 -1
- package/dist/service.worker.d.ts +0 -2
- package/dist/service.worker.d.ts.map +0 -1
- package/dist/service.worker.js +0 -15
- package/dist/service.worker.mjs +0 -14
- package/dist/slice.d.ts +0 -299
- package/dist/slice.d.ts.map +0 -1
- package/dist/socket.d.ts +0 -95
- package/dist/socket.d.ts.map +0 -1
- package/dist/superuser.d.ts +0 -24
- package/dist/superuser.d.ts.map +0 -1
- package/dist/themes.d.ts +0 -41
- package/dist/themes.d.ts.map +0 -1
- package/dist/webrtc.d.ts +0 -50
- package/dist/webrtc.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@auxilium/datalynk-client",
|
|
3
3
|
"description": "Datalynk client library",
|
|
4
4
|
"repository": "https://gitlab.auxiliumgroup.com/auxilium/datalynk/datalynk-client",
|
|
5
|
-
"version": "1.2.
|
|
5
|
+
"version": "1.2.4",
|
|
6
6
|
"author": "Zak Timson <zaktimson@gmail.com>",
|
|
7
7
|
"private": false,
|
|
8
8
|
"main": "./dist/index.cjs",
|
package/dist/api.d.ts
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { Database } from '@ztimson/utils';
|
|
2
|
-
import { BehaviorSubject } from 'rxjs';
|
|
3
|
-
import { Auth } from './auth';
|
|
4
|
-
import { PWA } from './pwa';
|
|
5
|
-
import { Files } from './files';
|
|
6
|
-
import { Meta } from './meta';
|
|
7
|
-
import { Pdf } from './pdf';
|
|
8
|
-
import { ApiCall, Slice } from './slice';
|
|
9
|
-
import { Socket } from './socket';
|
|
10
|
-
import { Superuser } from './superuser';
|
|
11
|
-
import { WebRtc } from './webrtc';
|
|
12
|
-
export type JwtPayload = {
|
|
13
|
-
aud: string;
|
|
14
|
-
email: string;
|
|
15
|
-
exp: number;
|
|
16
|
-
iat: number;
|
|
17
|
-
iss: string;
|
|
18
|
-
jti: string;
|
|
19
|
-
payload: any;
|
|
20
|
-
realm: string;
|
|
21
|
-
timezone: string;
|
|
22
|
-
uid: number;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Api connection options
|
|
26
|
-
*/
|
|
27
|
-
export type ApiOptions = {
|
|
28
|
-
/** Bundle requests together that happen in quick succession */
|
|
29
|
-
bundleTime?: number;
|
|
30
|
-
/** Use legacy dates by default */
|
|
31
|
-
legacyDates?: boolean;
|
|
32
|
-
/** PWA manifest overrides */
|
|
33
|
-
manifest?: any;
|
|
34
|
-
/** Name of application */
|
|
35
|
-
name?: string;
|
|
36
|
-
/** List of slices to use offline */
|
|
37
|
-
offline?: number[];
|
|
38
|
-
/** Website hostname */
|
|
39
|
-
origin?: string;
|
|
40
|
-
/** Save session token to localStorage to persist logins */
|
|
41
|
-
saveSession?: boolean;
|
|
42
|
-
/** Service worker URL */
|
|
43
|
-
serviceWorker?: string;
|
|
44
|
-
/** Disable sockets with false or override socket URL */
|
|
45
|
-
socket?: false | string;
|
|
46
|
-
/** WebRTC TURN server URL */
|
|
47
|
-
webrtc?: {
|
|
48
|
-
/** Additional ICE servers */
|
|
49
|
-
ice?: RTCIceServer[];
|
|
50
|
-
/** Auxilium WebRTC STUN/TURN server URL override */
|
|
51
|
-
url: string;
|
|
52
|
-
/** TURN server username */
|
|
53
|
-
username?: string;
|
|
54
|
-
/** TURN server password */
|
|
55
|
-
password?: string;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Possible options for API calls
|
|
60
|
-
*/
|
|
61
|
-
export interface ApiRequestOptions {
|
|
62
|
-
/** Skip bundling & caching */
|
|
63
|
-
noOptimize?: boolean;
|
|
64
|
-
/** Skip the token translating step */
|
|
65
|
-
raw?: boolean;
|
|
66
|
-
/** Set request token */
|
|
67
|
-
token?: string;
|
|
68
|
-
}
|
|
69
|
-
/** API error response */
|
|
70
|
-
export interface ApiError {
|
|
71
|
-
/** Error message */
|
|
72
|
-
message: string;
|
|
73
|
-
/** Source of error */
|
|
74
|
-
request: any;
|
|
75
|
-
/** Extra debugging information */
|
|
76
|
-
debug?: any;
|
|
77
|
-
/** Stack trace */
|
|
78
|
-
trace?: any;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Connect to Datalynk & send requests
|
|
82
|
-
*/
|
|
83
|
-
export declare class Api {
|
|
84
|
-
readonly origin: string;
|
|
85
|
-
/** Client library version */
|
|
86
|
-
static version: string;
|
|
87
|
-
/** Current requests bundle */
|
|
88
|
-
private bundle;
|
|
89
|
-
/** Bundle lifecycle tracking */
|
|
90
|
-
private bundleOngoing;
|
|
91
|
-
/** LocalStorage key for persisting logins */
|
|
92
|
-
private localStorageKey;
|
|
93
|
-
/** Pending requests cache */
|
|
94
|
-
private pending;
|
|
95
|
-
/** Helpers */
|
|
96
|
-
/** Authentication */
|
|
97
|
-
readonly auth: Auth;
|
|
98
|
-
/** File */
|
|
99
|
-
readonly files: Files;
|
|
100
|
-
/** PDF */
|
|
101
|
-
readonly pdf: Pdf;
|
|
102
|
-
/** PWA setup & prompt */
|
|
103
|
-
readonly pwa: PWA;
|
|
104
|
-
/** Socket */
|
|
105
|
-
readonly socket: Socket;
|
|
106
|
-
/** Superuser */
|
|
107
|
-
readonly superuser: Superuser;
|
|
108
|
-
/** WebRTC */
|
|
109
|
-
readonly webrtc: WebRtc;
|
|
110
|
-
/** Offline database */
|
|
111
|
-
database?: Database;
|
|
112
|
-
/** Options */
|
|
113
|
-
options: ApiOptions;
|
|
114
|
-
/** Created slices */
|
|
115
|
-
sliceCache: Map<number, Slice<any>>;
|
|
116
|
-
/** API URL */
|
|
117
|
-
url: string;
|
|
118
|
-
/** Client library version */
|
|
119
|
-
version: string;
|
|
120
|
-
/** Get session info from JWT payload */
|
|
121
|
-
get jwtPayload(): JwtPayload | null;
|
|
122
|
-
/** Is token expired */
|
|
123
|
-
get expired(): boolean;
|
|
124
|
-
/** Logged in spoke */
|
|
125
|
-
get spoke(): string;
|
|
126
|
-
/** API Session token */
|
|
127
|
-
token$: BehaviorSubject<string | null>;
|
|
128
|
-
get token(): string | null;
|
|
129
|
-
set token(token: string | null);
|
|
130
|
-
/**
|
|
131
|
-
* Connect to Datalynk & send requests
|
|
132
|
-
*
|
|
133
|
-
* @example
|
|
134
|
-
* ```ts
|
|
135
|
-
* const api = new Api('https://spoke.auxiliumgroup.com');
|
|
136
|
-
* ```
|
|
137
|
-
*
|
|
138
|
-
* @param {string} origin API URL
|
|
139
|
-
* @param {ApiOptions} options
|
|
140
|
-
*/
|
|
141
|
-
constructor(origin: string, options?: ApiOptions);
|
|
142
|
-
private _request;
|
|
143
|
-
/**
|
|
144
|
-
* Get list of slices
|
|
145
|
-
* @return {Promise<number[]>}
|
|
146
|
-
*/
|
|
147
|
-
getSlices(): Promise<number[]>;
|
|
148
|
-
/**
|
|
149
|
-
* Parses API request/response object for special Datalynk tokens & converts them to native JS objects
|
|
150
|
-
*
|
|
151
|
-
* @param obj An API request or response
|
|
152
|
-
* @return {Object} Api request or response with translated tokens
|
|
153
|
-
* @private
|
|
154
|
-
*/
|
|
155
|
-
private static translateTokens;
|
|
156
|
-
/**
|
|
157
|
-
* Chain multiple requests to execute together
|
|
158
|
-
* @param {Slice<any>} requests List of requests to chain
|
|
159
|
-
* @return {Promise<any>} API Response
|
|
160
|
-
*/
|
|
161
|
-
chain(...requests: (any | ApiCall<any>)[]): Promise<any>;
|
|
162
|
-
/**
|
|
163
|
-
* Organize multiple requests into a single mapped request
|
|
164
|
-
* @param {{[p: string]: any}} request Map of requests
|
|
165
|
-
* @return {Promise<any>} Map of API Responses
|
|
166
|
-
*/
|
|
167
|
-
chainMap(request: {
|
|
168
|
-
[key: string]: any;
|
|
169
|
-
}): Promise<any>;
|
|
170
|
-
/**
|
|
171
|
-
* Exact same as `request` method, but logs the response in the console automatically
|
|
172
|
-
*
|
|
173
|
-
* @param {object | string} data Datalynk request as object or string
|
|
174
|
-
* @param {ApiRequestOptions} options
|
|
175
|
-
* @returns {Promise<any>} Datalynk response
|
|
176
|
-
*/
|
|
177
|
-
debug<T = any>(data: any, options?: ApiRequestOptions): Promise<T>;
|
|
178
|
-
/**
|
|
179
|
-
* Send a request to Datalynk
|
|
180
|
-
*
|
|
181
|
-
* @example
|
|
182
|
-
* ```ts
|
|
183
|
-
* const response = await api.request('$/auth/current');
|
|
184
|
-
* ```
|
|
185
|
-
*
|
|
186
|
-
* @param {object} data Request using Datalynk API syntax. Strings will be converted: '$/auth/current' -> {'$/auth/current': {}}
|
|
187
|
-
* @param {ApiRequestOptions} options
|
|
188
|
-
* @returns {Promise<any>} Datalynk response or error
|
|
189
|
-
*/
|
|
190
|
-
request<T = any>(data: any, options?: ApiRequestOptions): Promise<T>;
|
|
191
|
-
/**
|
|
192
|
-
* Create a slice object using the API
|
|
193
|
-
*
|
|
194
|
-
* @example
|
|
195
|
-
* ```ts
|
|
196
|
-
* const contactsSlice = api.slice<Contacts>(12345);
|
|
197
|
-
* const allContacts = await contactsSlice.select().exec().rows();
|
|
198
|
-
* const unsubscribe = contactsSlice.sync().subscribe(rows => console.log(rows));
|
|
199
|
-
* ```
|
|
200
|
-
*
|
|
201
|
-
* @param {number} id Slice ID the object will target
|
|
202
|
-
* @returns {Slice<T = any>} Object for making requests & caching rows
|
|
203
|
-
*/
|
|
204
|
-
slice<T extends Meta = any>(id: number | string): Slice<T>;
|
|
205
|
-
}
|
|
206
|
-
//# sourceMappingURL=api.d.ts.map
|
package/dist/api.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAC,eAAe,EAAuB,MAAM,MAAM,CAAC;AAC3D,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,OAAO,EAAE,KAAK,EAAC,MAAM,SAAS,CAAC;AACvC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,MAAM,MAAM,UAAU,GAAG;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACZ,CAAA;AAED;;G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,EAA8B;IAE5D;;;;;;;;;;OAUG;gBACyB,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe;IAmDpE,OAAO,CAAC,QAAQ;IAqBhB;;;OAGG;IACH,SAAS,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAQ9B;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IA0B9B;;;;OAIG;IACI,KAAK,CAAC,GAAG,QAAQ,EAAE,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE;IAehD;;;;OAIG;IACI,QAAQ,CAAC,OAAO,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC;IAiB7C;;;;;;OAMG;IACI,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,CAAC,CAAC;IAU7E;;;;;;;;;;;OAWG;IACI,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,CAAC,CAAC;IAqC/E;;;;;;;;;;;;OAYG;IACI,KAAK,CAAC,CAAC,SAAS,IAAI,GAAG,GAAG,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC;CAIjE"}
|
package/dist/auth.d.ts
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { Api } from './api';
|
|
2
|
-
import { BehaviorSubject } from 'rxjs';
|
|
3
|
-
import { LoginPrompt, LoginPromptOptions } from './login-prompt';
|
|
4
|
-
/** User Account */
|
|
5
|
-
export type User = {
|
|
6
|
-
/** Whether user is active */
|
|
7
|
-
active: number;
|
|
8
|
-
/** User's authentication reference */
|
|
9
|
-
auth_ref: number;
|
|
10
|
-
/** Contact email address */
|
|
11
|
-
email: string;
|
|
12
|
-
/** User ID */
|
|
13
|
-
id: number;
|
|
14
|
-
/** 2-Factor authentication type (optional) */
|
|
15
|
-
"2FA"?: string;
|
|
16
|
-
/** 2-Factor authentication code (optional) */
|
|
17
|
-
"2FA_code"?: string;
|
|
18
|
-
/** Current user ID if available (optional) */
|
|
19
|
-
CurrentUserID?: number | null;
|
|
20
|
-
/** Reference to the user that created this user */
|
|
21
|
-
creatorRef: number;
|
|
22
|
-
/** Date when the user was created (ISO 8601) */
|
|
23
|
-
created: string;
|
|
24
|
-
/** Communication ID (optional) */
|
|
25
|
-
communicationid?: number | null;
|
|
26
|
-
/** Account holder's first name */
|
|
27
|
-
first_name: string;
|
|
28
|
-
/** Last time this user was reported (optional) */
|
|
29
|
-
lastreported?: string | null;
|
|
30
|
-
/** Account holder's last name */
|
|
31
|
-
last_name: string;
|
|
32
|
-
/** Link to user's landing page (optional) */
|
|
33
|
-
landingpage?: string;
|
|
34
|
-
/** Username for logging in */
|
|
35
|
-
login: string;
|
|
36
|
-
/** Mobile info or alternate format (optional) */
|
|
37
|
-
mobile?: string;
|
|
38
|
-
/** Name of user's mobile app (optional) */
|
|
39
|
-
mobileappname?: string | null;
|
|
40
|
-
/** Color theme of user's mobile app (optional) */
|
|
41
|
-
mobileappcolor?: string | null;
|
|
42
|
-
/** Contact mobile phone number (optional) */
|
|
43
|
-
mobile_phone?: string;
|
|
44
|
-
/** Date when the user was last modified (ISO 8601) */
|
|
45
|
-
modified: string;
|
|
46
|
-
/** Reference to the user that last modified this user (optional) */
|
|
47
|
-
modifierRef?: number | null;
|
|
48
|
-
/** Phone number (optional) */
|
|
49
|
-
Phone?: string;
|
|
50
|
-
/** Type of phone (optional) */
|
|
51
|
-
phonetype?: string | null;
|
|
52
|
-
/** Spoke user comes from */
|
|
53
|
-
spoke: string;
|
|
54
|
-
/** Whether account is considered a guest */
|
|
55
|
-
guest: boolean;
|
|
56
|
-
/** Whether account is an admin */
|
|
57
|
-
sysadmin: boolean;
|
|
58
|
-
/** Current session token */
|
|
59
|
-
token: string;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Authentication requests
|
|
63
|
-
*/
|
|
64
|
-
export declare class Auth {
|
|
65
|
-
private readonly api;
|
|
66
|
-
private onlinePrompt?;
|
|
67
|
-
/** Current user as an observable */
|
|
68
|
-
user$: BehaviorSubject<User | null | undefined>;
|
|
69
|
-
/** Current user */
|
|
70
|
-
get user(): User | null | undefined;
|
|
71
|
-
/** Set current user info */
|
|
72
|
-
set user(user: User | null | undefined);
|
|
73
|
-
get spoke(): string | null;
|
|
74
|
-
constructor(api: Api);
|
|
75
|
-
/**
|
|
76
|
-
* Get current user associated with API token
|
|
77
|
-
*
|
|
78
|
-
* @return {Promise<User | null>}
|
|
79
|
-
*/
|
|
80
|
-
current(token?: string | null): Promise<null | User>;
|
|
81
|
-
/**
|
|
82
|
-
* Automatically handle sessions by checking localStorage & URL parameters for a token & prompting
|
|
83
|
-
* user with a login screen if required
|
|
84
|
-
*
|
|
85
|
-
* @param {string} spoke Desired spoke
|
|
86
|
-
* @param {LoginPromptOptions} options Aesthetic options
|
|
87
|
-
* @return {Promise<void>} Login complete
|
|
88
|
-
*/
|
|
89
|
-
handleLogin(spoke: string, options?: LoginPromptOptions): Promise<void>;
|
|
90
|
-
/**
|
|
91
|
-
* Check whether user has a token
|
|
92
|
-
*
|
|
93
|
-
* @return {boolean} True if session token authenticated
|
|
94
|
-
*/
|
|
95
|
-
isAuthenticated(): boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Check if the current user is a guest
|
|
98
|
-
*
|
|
99
|
-
* @return {boolean} True if guest
|
|
100
|
-
*/
|
|
101
|
-
isGuest(): boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Check if user is a system administrator
|
|
104
|
-
*
|
|
105
|
-
* @return {Promise<boolean>} True if system administrator
|
|
106
|
-
*/
|
|
107
|
-
isSysAdmin(): Promise<boolean>;
|
|
108
|
-
/**
|
|
109
|
-
* Check if user is a table administrator
|
|
110
|
-
*
|
|
111
|
-
* @return {Promise<boolean>} True if table administrator
|
|
112
|
-
*/
|
|
113
|
-
isTableAdmin(): Promise<boolean>;
|
|
114
|
-
/**
|
|
115
|
-
* Check if user is a user administrator
|
|
116
|
-
*
|
|
117
|
-
* @return {Promise<boolean>} True if user administrator
|
|
118
|
-
*/
|
|
119
|
-
isUserAdmin(): Promise<boolean>;
|
|
120
|
-
/**
|
|
121
|
-
* Perform login and save the session token
|
|
122
|
-
*
|
|
123
|
-
* @param {string} login Login username or email
|
|
124
|
-
* @param {string} password Password for account
|
|
125
|
-
* @param {string} spoke Override login spoke
|
|
126
|
-
* @param {twoFactor?: string, expire?: string} opts 2FA code & expire date (YYYY-MM-DD)
|
|
127
|
-
* @returns {Promise<User>} User account
|
|
128
|
-
*/
|
|
129
|
-
login(spoke: string, login: string, password: string, opts?: {
|
|
130
|
-
twoFactor?: string;
|
|
131
|
-
expire?: null | string;
|
|
132
|
-
}): Promise<User>;
|
|
133
|
-
/**
|
|
134
|
-
* Login as guest user
|
|
135
|
-
*
|
|
136
|
-
* @return {Promise<User>} Guest account
|
|
137
|
-
*/
|
|
138
|
-
loginGuest(): Promise<User>;
|
|
139
|
-
/**
|
|
140
|
-
* Create Login UI
|
|
141
|
-
*
|
|
142
|
-
* @param {string} spoke Desired spoke
|
|
143
|
-
* @param {LoginPromptOptions} options Aesthetic options
|
|
144
|
-
* @return {LoginPrompt} Login prompt
|
|
145
|
-
*/
|
|
146
|
-
loginPrompt(spoke: string, options?: LoginPromptOptions): LoginPrompt;
|
|
147
|
-
/**
|
|
148
|
-
* Logout current user
|
|
149
|
-
*
|
|
150
|
-
* @return {Promise<{closed: string, new: string}>}
|
|
151
|
-
*/
|
|
152
|
-
logout(reload?: boolean): Promise<{
|
|
153
|
-
closed: string;
|
|
154
|
-
new: string;
|
|
155
|
-
}>;
|
|
156
|
-
/**
|
|
157
|
-
* Reset user account password
|
|
158
|
-
*
|
|
159
|
-
* @param {string} login User login
|
|
160
|
-
* @param {string} newPassword New password
|
|
161
|
-
* @param {string} code Reset code sent with `resetRequest`
|
|
162
|
-
* @return {Promise<any>} New session
|
|
163
|
-
*/
|
|
164
|
-
reset(login: string, newPassword: string, code?: string): Promise<any>;
|
|
165
|
-
/**
|
|
166
|
-
* Request reset code for user
|
|
167
|
-
*
|
|
168
|
-
* @param {string} login User to reset
|
|
169
|
-
* @param {"email" | "sms" | "voice"} mode Method of sending reset code
|
|
170
|
-
* @return {Promise<any>} Unknown
|
|
171
|
-
*/
|
|
172
|
-
resetRequest(login: string, mode: 'email' | 'sms' | 'voice'): Promise<any>;
|
|
173
|
-
}
|
|
174
|
-
//# sourceMappingURL=auth.d.ts.map
|
package/dist/auth.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,eAAe,EAAS,MAAM,MAAM,CAAC;AAE7C,OAAO,EAAC,WAAW,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAE/D,mBAAmB;AACnB,MAAM,MAAM,IAAI,GAAG;IAClB,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,cAAc;IACd,EAAE,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,kCAAkC;IAClC,U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
2
|
-
/**
|
|
3
|
-
* Metadata for an uploaded file in Datalynk
|
|
4
|
-
*/
|
|
5
|
-
export interface UploadedFile {
|
|
6
|
-
/** File ID used to reference file in Datalynk */
|
|
7
|
-
id: number;
|
|
8
|
-
/** Filename */
|
|
9
|
-
name: string;
|
|
10
|
-
/** Size of file on disk */
|
|
11
|
-
size: number;
|
|
12
|
-
/** Filename extension */
|
|
13
|
-
extension: string;
|
|
14
|
-
/** Mimetype */
|
|
15
|
-
mime: string;
|
|
16
|
-
/** URL to open file */
|
|
17
|
-
url?: string;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Handle uploading & fetching files from Datalynk
|
|
21
|
-
*/
|
|
22
|
-
export declare class Files {
|
|
23
|
-
private readonly api;
|
|
24
|
-
constructor(api: Api);
|
|
25
|
-
/**
|
|
26
|
-
* Associate an existing file with an existing row
|
|
27
|
-
*
|
|
28
|
-
* @param {number | number[]} fileIds Existing files to associate
|
|
29
|
-
* @param {number} slice Target slice
|
|
30
|
-
* @param {number} row Target slice record
|
|
31
|
-
* @param {string} field Record filed file should be added to
|
|
32
|
-
* @param {boolean} execute Will run request by default, passing false will return the API request instead
|
|
33
|
-
* @return {any} The API response by default, or the raw API request if execute is false
|
|
34
|
-
*/
|
|
35
|
-
associate(fileIds: number | number[], slice: number, row: number, field: string, execute?: true): Promise<any>;
|
|
36
|
-
associate(fileIds: number | number[], slice: number, row: number, field: string, execute: false): {
|
|
37
|
-
'!/tools/file/update': {
|
|
38
|
-
slice: number;
|
|
39
|
-
row: number;
|
|
40
|
-
field: string;
|
|
41
|
-
ids: number[];
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Get an authenticated URL to fetch files from
|
|
46
|
-
*
|
|
47
|
-
* @param {number} id File ID
|
|
48
|
-
* @param {boolean} ignoreToken Ignore authentication
|
|
49
|
-
* @return {string} URL file can be viewed at
|
|
50
|
-
*/
|
|
51
|
-
get(id: number, ignoreToken?: boolean): string;
|
|
52
|
-
/**
|
|
53
|
-
* Upload file(s) to the API & optionally associate them with a row
|
|
54
|
-
*
|
|
55
|
-
* @param {FileList | File | File[]} files Files to be uploaded
|
|
56
|
-
* @param {{slice: number, row: any, field: string, pk?: string}} associate Row to associate with
|
|
57
|
-
*/
|
|
58
|
-
upload(files: FileList | File | File[], associate?: {
|
|
59
|
-
slice: number;
|
|
60
|
-
row: number | any;
|
|
61
|
-
field: string;
|
|
62
|
-
pk?: string;
|
|
63
|
-
}): Promise<UploadedFile[]>;
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=files.d.ts.map
|
package/dist/files.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,iDAAiD;IACjD,EAAE,EAAE,MAAM,CAAC;IACX,eAAe;IACf,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe;IACf,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,qBAAa,KAAK;IACL,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,GAAG;IAErC;;;;;;;;;OASG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;IAC9G,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG;QAAC,qBAAqB,EAAE;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,EAAE,CAAA;SAAC,CAAA;KAAC;IAOrL;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM;IAI9C;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,EAAE,EAAE,SAAS,CAAC,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;CAuB5I"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from './api';
|
|
2
|
-
export * from './auth';
|
|
3
|
-
export * from './files';
|
|
4
|
-
export * from './login-prompt';
|
|
5
|
-
export * from './meta';
|
|
6
|
-
export * from './pdf';
|
|
7
|
-
export * from './pwa';
|
|
8
|
-
export * from './serializer';
|
|
9
|
-
export * from './slice';
|
|
10
|
-
export * from './socket';
|
|
11
|
-
export * from './superuser';
|
|
12
|
-
export * from './themes';
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|