@auxilium/datalynk-client 1.0.20 → 1.1.0-rc1
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/bin/datalynk-models.mjs +33 -84
- package/dist/api.d.ts +42 -18
- package/dist/api.d.ts.map +1 -1
- package/dist/auth.d.ts +48 -15
- package/dist/auth.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3513 -0
- package/dist/index.mjs +681 -103
- package/dist/login-prompt.d.ts +14 -8
- package/dist/login-prompt.d.ts.map +1 -1
- package/dist/meta.d.ts +464 -0
- package/dist/meta.d.ts.map +1 -0
- package/dist/service.worker.d.ts +2 -0
- package/dist/service.worker.d.ts.map +1 -0
- package/dist/service.worker.js +15 -0
- package/dist/service.worker.mjs +14 -0
- package/dist/slice.d.ts +92 -49
- package/dist/slice.d.ts.map +1 -1
- package/dist/themes.d.ts +24 -0
- package/dist/themes.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/index.cjs +0 -2939
package/bin/datalynk-models.mjs
CHANGED
|
@@ -4,54 +4,23 @@ import fs from 'fs';
|
|
|
4
4
|
import {join} from 'path';
|
|
5
5
|
import {Api} from '../dist/index.mjs';
|
|
6
6
|
import {ask} from '@ztimson/node-utils';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
'control_checkbox': 'checkbox',
|
|
10
|
-
'control_dropdown': 'select',
|
|
11
|
-
'control_new_date': 'Date',
|
|
12
|
-
'control_new_datetime': 'Date',
|
|
13
|
-
'control_new_time': 'Date',
|
|
14
|
-
'control_number': 'number',
|
|
15
|
-
'control_radio': 'radio',
|
|
16
|
-
'control_textbox': 'string',
|
|
17
|
-
'control_textarea': 'string',
|
|
18
|
-
'Date': 'Date',
|
|
19
|
-
'number': 'number',
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Fields that everything have
|
|
23
|
-
const universalFields = [
|
|
24
|
-
{id: 'id', readonly: true, type: 'number'},
|
|
25
|
-
{id: 'created', readonly: true, type: 'Date'},
|
|
26
|
-
{id: 'creatorRef', readonly: true, type: 'number'},
|
|
27
|
-
{id: 'modified', readonly: true, type: 'Date'},
|
|
28
|
-
{id: 'modifierRef', readonly: true, type: 'number'}
|
|
29
|
-
]
|
|
7
|
+
import packageFile from '../package.json' with { type: 'json' };
|
|
8
|
+
import {kebabCase, pascalCase} from '@ztimson/utils';
|
|
30
9
|
|
|
31
10
|
// Shorthand for getting spoke credentials
|
|
32
|
-
async function getCredentials(
|
|
33
|
-
if(!out) out = await ask('Output (src/models): ') || 'src/models';
|
|
11
|
+
async function getCredentials(spoke, login, password) {
|
|
34
12
|
while(!spoke) spoke = await ask('Spoke: ');
|
|
35
13
|
while(!login) login = await ask('Login: ');
|
|
36
14
|
while(!password) password = await ask('Password: ', true);
|
|
37
|
-
return [
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Check type, if unknown mark it as any, if its a selector change the type to its equivalent enum
|
|
41
|
-
function checkType(field) {
|
|
42
|
-
if(field.type == 'checkbox' || field.type == 'radio' || field.type == 'select') {
|
|
43
|
-
return `${field.id.replace(/\W/g, '')}Options${field.type == 'checkbox' ? '[]' : ''}`;
|
|
44
|
-
}
|
|
45
|
-
return !!field.type ? field.type : 'any';
|
|
15
|
+
return [spoke, login, password];
|
|
46
16
|
}
|
|
47
17
|
|
|
48
18
|
// Main loop
|
|
49
19
|
(async () => {
|
|
50
20
|
try {
|
|
51
21
|
// Arguments
|
|
52
|
-
let [,, spoke, login, password
|
|
53
|
-
[
|
|
54
|
-
const packageFile = await import('../package.json', {with: { type: 'json' }});
|
|
22
|
+
let [,, output, spoke, login, password] = process.argv.filter(arg => !arg.startsWith('--'));
|
|
23
|
+
[spoke, login, password] = await getCredentials(spoke, login, password);
|
|
55
24
|
|
|
56
25
|
// Log in
|
|
57
26
|
let api = new Api(`https://${spoke}.auxiliumgroup.com`, {
|
|
@@ -59,70 +28,50 @@ function checkType(field) {
|
|
|
59
28
|
socket: false,
|
|
60
29
|
});
|
|
61
30
|
await api.auth.login(spoke, login, password);
|
|
62
|
-
console.log('Login Succeeded
|
|
63
|
-
|
|
64
|
-
// Get list of slices
|
|
65
|
-
let slices = await api.request({"$/tools/action_chain": [
|
|
66
|
-
{"!/env/me":{}},
|
|
67
|
-
{"!/slice/permissionsLite": {}},
|
|
68
|
-
{"!/tools/column": {"col": "id", "rows": {"$_": "1:rows"}}}
|
|
69
|
-
]});
|
|
70
|
-
console.log(`Found ${slices.length} slices`);
|
|
31
|
+
console.log('Login Succeeded!\n');
|
|
71
32
|
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
let
|
|
75
|
-
|
|
76
|
-
// Organize all the data
|
|
77
|
-
console.log('Processing...');
|
|
78
|
-
slices = metadata.filter(slice => slice.meta.presentation && slice.meta.presentation.fields)
|
|
79
|
-
.map(slice => ({name: slice.name.replace(/^\d+/gm, '').replace(/\W/g, ''), id: slice.id}))
|
|
80
|
-
.map(slice => Object.assign(slice, {name: slice.name.replace(/[\W|_]/g, '')}));
|
|
81
|
-
let sliceFields = metadata.filter(slice => slice.meta.presentation && slice.meta.presentation.fields)
|
|
82
|
-
.map(slice => slice.meta.presentation.fields);
|
|
83
|
-
sliceFields = sliceFields.map(fields => Object.keys(fields).filter(key => fields[key].id).map(key => {
|
|
84
|
-
let field = {id: fields[key].id, readonly: !!fields[key].readonly, type: FieldType[fields[key].type], required: fields[key].required == 'Yes'};
|
|
85
|
-
if(fields[key].options) field.options = fields[key].options.split('|');
|
|
86
|
-
return field;
|
|
87
|
-
}));
|
|
88
|
-
slices = slices.map((slice, i) => Object.assign(slice, {fields: universalFields.concat(sliceFields[i])}));
|
|
89
|
-
|
|
90
|
-
// Create models directory
|
|
91
|
-
console.log('Writing files...');
|
|
33
|
+
// Setup directory
|
|
34
|
+
if(!output) output = await ask('Output (src/models): ') || 'src/models';
|
|
35
|
+
let existingOnly = process.argv.includes('--all') ? false : process.argv.includes('--existing') || null;
|
|
92
36
|
let path = join(process.cwd(), output);
|
|
93
37
|
if(!fs.existsSync(path)) fs.mkdirSync(path);
|
|
38
|
+
|
|
39
|
+
// Collect metadata
|
|
40
|
+
let slices = await api.getSlices();
|
|
41
|
+
slices = (await Promise.all(slices.map(id => api.slice(id).getInfo())))
|
|
42
|
+
.filter(s => s.types?.length)
|
|
43
|
+
.map(s => ({
|
|
44
|
+
...s,
|
|
45
|
+
filename: `${kebabCase(s.name.toLowerCase())}.model.ts`,
|
|
46
|
+
symbol: pascalCase(s.name)
|
|
47
|
+
}))
|
|
48
|
+
.filter(s => !existingOnly || fs.existsSync(`${path}/${s.filename}`));
|
|
49
|
+
|
|
50
|
+
// Start creating files ----
|
|
51
|
+
console.log(`Creating models for ${slices.length} slices...`);
|
|
94
52
|
let writingPromises = [];
|
|
95
|
-
const header = `/* Generated by the Datalynk Client Library v${packageFile.version}\n * Date: ${new Date().toLocaleString()}
|
|
53
|
+
const header = (slice) => `/* Generated by the Datalynk Client Library v${packageFile.version}\n * Date: ${new Date().toLocaleString()}${slice ? `\n * Slice: ${slice} (${spoke})` : ''}\n */`;
|
|
96
54
|
|
|
97
55
|
// Create slice enum
|
|
98
|
-
let body = header;
|
|
99
56
|
let props = [];
|
|
100
|
-
body
|
|
57
|
+
let body = `${header()}\n\nexport enum Slices {\n\t${slices.filter(slice => {
|
|
101
58
|
if(props.indexOf(slice.name) == -1) {
|
|
102
59
|
props.push(slice.name);
|
|
103
60
|
return true;
|
|
104
61
|
}
|
|
105
62
|
return false;
|
|
106
|
-
}).map(slice => `${slice.
|
|
63
|
+
}).map(slice => `${slice.symbol} = ${slice.id},`).join('\n\t')}\n}`;
|
|
107
64
|
writingPromises.push(new Promise(res => fs.writeFile(`${path}/slices.ts`, body, () => res())));
|
|
108
65
|
|
|
109
|
-
|
|
110
|
-
// Create individual slice enums and interfaces
|
|
66
|
+
// Create slice interfaces
|
|
111
67
|
slices.forEach(slice => {
|
|
112
|
-
|
|
113
|
-
let body = header;
|
|
114
|
-
|
|
115
|
-
// Imports
|
|
116
|
-
body += `import {SliceMeta} from '@auxilium/datalynk-client'\n\n`
|
|
117
|
-
|
|
118
|
-
// Enums
|
|
119
|
-
body += slice.fields.filter(field => field.options).map(field => {
|
|
120
|
-
return `export enum ${field.id}Options {\n\t${field.options.map(option => `${option.replace(/^\d+/gm, '').replace(/\W/g, '')} = '${option}',`).join('\n\t')}\n}`
|
|
121
|
-
}).join('\n\n') + '\n\n';
|
|
68
|
+
writingPromises.push(new Promise(res => fs.writeFile(`${path}/${slice.filename}`, `${header(slice.id)}
|
|
122
69
|
|
|
123
|
-
|
|
70
|
+
import {Meta} from '@auxilium/datalynk-client';
|
|
124
71
|
|
|
125
|
-
|
|
72
|
+
export interface ${slice.symbol} extends Meta {
|
|
73
|
+
${slice.types.map(field => `${field.readonly ? 'readonly ' : ''}'${field.key}'${!field.required ? '?' : ''}: ${field.options?.length ? field.options?.map(o => `'${o}'`).join(' | ') : field.type};`).join('\n\t')}
|
|
74
|
+
}`, () => res())));
|
|
126
75
|
});
|
|
127
76
|
|
|
128
77
|
await Promise.all(writingPromises);
|
package/dist/api.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { Database } from '@ztimson/utils';
|
|
1
2
|
import { BehaviorSubject } from 'rxjs';
|
|
2
3
|
import { Auth } from './auth';
|
|
3
4
|
import { Files } from './files';
|
|
5
|
+
import { Meta } from './meta';
|
|
4
6
|
import { Pdf } from './pdf';
|
|
5
|
-
import { Slice } from './slice';
|
|
7
|
+
import { ApiCall, Slice } from './slice';
|
|
6
8
|
import { Socket } from './socket';
|
|
7
9
|
import { Superuser } from './superuser';
|
|
8
10
|
export type JwtPayload = {
|
|
@@ -25,10 +27,14 @@ export type ApiOptions = {
|
|
|
25
27
|
bundleTime?: number;
|
|
26
28
|
/** Use legacy dates by default */
|
|
27
29
|
legacyDates?: boolean;
|
|
28
|
-
/**
|
|
30
|
+
/** List of slices to use offline */
|
|
31
|
+
offline?: number[];
|
|
32
|
+
/** App name for logging */
|
|
29
33
|
origin?: string;
|
|
30
34
|
/** Save session token to localStorage to persist logins */
|
|
31
35
|
saveSession?: boolean;
|
|
36
|
+
/** Service worker URL */
|
|
37
|
+
serviceWorker?: string;
|
|
32
38
|
/** Disable sockets with false or override socket URL */
|
|
33
39
|
socket?: false | string;
|
|
34
40
|
};
|
|
@@ -58,7 +64,9 @@ export interface ApiError {
|
|
|
58
64
|
* Connect to Datalynk & send requests
|
|
59
65
|
*/
|
|
60
66
|
export declare class Api {
|
|
61
|
-
readonly
|
|
67
|
+
readonly origin: string;
|
|
68
|
+
/** Client library version */
|
|
69
|
+
static version: string;
|
|
62
70
|
/** Current requests bundle */
|
|
63
71
|
private bundle;
|
|
64
72
|
/** Bundle lifecycle tracking */
|
|
@@ -67,16 +75,6 @@ export declare class Api {
|
|
|
67
75
|
private localStorageKey;
|
|
68
76
|
/** Pending requests cache */
|
|
69
77
|
private pending;
|
|
70
|
-
/** API URL */
|
|
71
|
-
readonly url: string;
|
|
72
|
-
/** Package version */
|
|
73
|
-
version: string;
|
|
74
|
-
/** API Session token */
|
|
75
|
-
token$: BehaviorSubject<string | null>;
|
|
76
|
-
get token(): string | null;
|
|
77
|
-
set token(token: string | null);
|
|
78
|
-
/** Get session info from JWT payload */
|
|
79
|
-
get jwtPayload(): JwtPayload | null;
|
|
80
78
|
/** Helpers */
|
|
81
79
|
/** Authentication */
|
|
82
80
|
readonly auth: Auth;
|
|
@@ -88,6 +86,26 @@ export declare class Api {
|
|
|
88
86
|
readonly socket: Socket;
|
|
89
87
|
/** Superuser */
|
|
90
88
|
readonly superuser: Superuser;
|
|
89
|
+
/** Offline database */
|
|
90
|
+
database?: Database;
|
|
91
|
+
/** Options */
|
|
92
|
+
options: ApiOptions;
|
|
93
|
+
/** Created slices */
|
|
94
|
+
sliceCache: Map<number, Slice<any>>;
|
|
95
|
+
/** API URL */
|
|
96
|
+
url: string;
|
|
97
|
+
/** Client library version */
|
|
98
|
+
version: string;
|
|
99
|
+
/** Get session info from JWT payload */
|
|
100
|
+
get jwtPayload(): JwtPayload | null;
|
|
101
|
+
/** Is token expired */
|
|
102
|
+
get expired(): boolean;
|
|
103
|
+
/** Logged in spoke */
|
|
104
|
+
get spoke(): string;
|
|
105
|
+
/** API Session token */
|
|
106
|
+
token$: BehaviorSubject<string | null>;
|
|
107
|
+
get token(): string | null;
|
|
108
|
+
set token(token: string | null);
|
|
91
109
|
/**
|
|
92
110
|
* Connect to Datalynk & send requests
|
|
93
111
|
*
|
|
@@ -96,11 +114,17 @@ export declare class Api {
|
|
|
96
114
|
* const api = new Api('https://spoke.auxiliumgroup.com');
|
|
97
115
|
* ```
|
|
98
116
|
*
|
|
99
|
-
* @param {string}
|
|
117
|
+
* @param {string} origin API URL
|
|
100
118
|
* @param {ApiOptions} options
|
|
101
119
|
*/
|
|
102
|
-
constructor(
|
|
120
|
+
constructor(origin: string, options?: ApiOptions);
|
|
103
121
|
private _request;
|
|
122
|
+
private cacheUrl;
|
|
123
|
+
/**
|
|
124
|
+
* Get list of slices
|
|
125
|
+
* @return {Promise<number[]>}
|
|
126
|
+
*/
|
|
127
|
+
getSlices(): Promise<number[]>;
|
|
104
128
|
/**
|
|
105
129
|
* Parses API request/response object for special Datalynk tokens & converts them to native JS objects
|
|
106
130
|
*
|
|
@@ -114,7 +138,7 @@ export declare class Api {
|
|
|
114
138
|
* @param {Slice<any>} requests List of requests to chain
|
|
115
139
|
* @return {Promise<any>} API Response
|
|
116
140
|
*/
|
|
117
|
-
chain(...requests: (any |
|
|
141
|
+
chain(...requests: (any | ApiCall<any>)[]): Promise<any>;
|
|
118
142
|
/**
|
|
119
143
|
* Organize multiple requests into a single mapped request
|
|
120
144
|
* @param {{[p: string]: any}} request Map of requests
|
|
@@ -154,9 +178,9 @@ export declare class Api {
|
|
|
154
178
|
* const unsubscribe = contactsSlice.sync().subscribe(rows => console.log(rows));
|
|
155
179
|
* ```
|
|
156
180
|
*
|
|
157
|
-
* @param {number}
|
|
181
|
+
* @param {number} id Slice ID the object will target
|
|
158
182
|
* @returns {Slice<T = any>} Object for making requests & caching rows
|
|
159
183
|
*/
|
|
160
|
-
slice<T = any>(
|
|
184
|
+
slice<T extends Meta = any>(id: number | string): Slice<T>;
|
|
161
185
|
}
|
|
162
186
|
//# 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":"
|
|
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,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;AAGtC,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;;GAEG;AACH,MAAM,MAAM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,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
CHANGED
|
@@ -1,36 +1,69 @@
|
|
|
1
|
-
import { BehaviorSubject } from 'rxjs';
|
|
2
1
|
import { Api } from './api';
|
|
2
|
+
import { BehaviorSubject } from 'rxjs';
|
|
3
3
|
import { LoginPrompt, LoginPromptOptions } from './login-prompt';
|
|
4
4
|
/** User Account */
|
|
5
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;
|
|
6
12
|
/** User ID */
|
|
7
|
-
id:
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
/**
|
|
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 */
|
|
15
27
|
first_name: string;
|
|
16
|
-
/**
|
|
28
|
+
/** Last time this user was reported (optional) */
|
|
29
|
+
lastreported?: string | null;
|
|
30
|
+
/** Account holder's last name */
|
|
17
31
|
last_name: string;
|
|
18
|
-
/**
|
|
19
|
-
|
|
32
|
+
/** Link to user's landing page (optional) */
|
|
33
|
+
landingpage?: string;
|
|
20
34
|
/** Username for logging in */
|
|
21
35
|
login: string;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/**
|
|
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) */
|
|
25
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;
|
|
26
52
|
/** Spoke user comes from */
|
|
27
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;
|
|
28
60
|
};
|
|
29
61
|
/**
|
|
30
62
|
* Authentication requests
|
|
31
63
|
*/
|
|
32
64
|
export declare class Auth {
|
|
33
65
|
private readonly api;
|
|
66
|
+
private onlinePrompt?;
|
|
34
67
|
/** Current user as an observable */
|
|
35
68
|
user$: BehaviorSubject<User | null | undefined>;
|
|
36
69
|
/** Current user */
|
package/dist/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
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,UAAU,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,GAAG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OAAO,CAAC;IAOpC;;;;OAIG;IACG,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC;IAOtC;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAOrC;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;KACtB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBjB;;;;OAIG;IACH,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAS3B;;;;;;OAMG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,WAAW;IAIrE;;;;OAIG;IACH,MAAM;gBAE6B,MAAM;aAAO,MAAM;;IAMtD;;;;;;;OAOG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;IAavD;;;;;;OAMG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,KAAK,GAAG,OAAO;CAI3D"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,11 @@ export * from './api';
|
|
|
2
2
|
export * from './auth';
|
|
3
3
|
export * from './files';
|
|
4
4
|
export * from './login-prompt';
|
|
5
|
+
export * from './meta';
|
|
5
6
|
export * from './pdf';
|
|
6
7
|
export * from './serializer';
|
|
7
8
|
export * from './slice';
|
|
8
9
|
export * from './socket';
|
|
9
10
|
export * from './superuser';
|
|
11
|
+
export * from './themes';
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
|
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,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|