prostgles-server 2.0.177 → 2.0.180
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/dist/AuthHandler.d.ts +4 -4
- package/dist/AuthHandler.d.ts.map +1 -1
- package/dist/DBSchemaBuilder.d.ts +6 -6
- package/dist/DBSchemaBuilder.d.ts.map +1 -1
- package/dist/DBSchemaBuilder.js +45 -7
- package/dist/DBSchemaBuilder.js.map +1 -1
- package/dist/DboBuilder.d.ts +20 -21
- package/dist/DboBuilder.d.ts.map +1 -1
- package/dist/DboBuilder.js +1 -1
- package/dist/DboBuilder.js.map +1 -1
- package/dist/Prostgles.d.ts +8 -10
- package/dist/Prostgles.d.ts.map +1 -1
- package/dist/Prostgles.js.map +1 -1
- package/dist/PubSubManager.js +1 -1
- package/dist/PubSubManager.js.map +1 -1
- package/dist/PublishParser.d.ts +37 -37
- package/dist/PublishParser.d.ts.map +1 -1
- package/dist/PublishParser.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/lib/AuthHandler.d.ts +148 -0
- package/lib/AuthHandler.d.ts.map +1 -0
- package/lib/AuthHandler.js +411 -0
- package/lib/AuthHandler.ts +3 -3
- package/lib/DBEventsManager.d.ts +38 -0
- package/lib/DBEventsManager.d.ts.map +1 -0
- package/lib/DBEventsManager.js +136 -0
- package/lib/DBSchemaBuilder.d.ts +11 -0
- package/lib/DBSchemaBuilder.d.ts.map +1 -0
- package/lib/DBSchemaBuilder.js +102 -0
- package/lib/DBSchemaBuilder.ts +83 -26
- package/lib/DboBuilder.d.ts +428 -0
- package/lib/DboBuilder.d.ts.map +1 -0
- package/lib/DboBuilder.js +3078 -0
- package/lib/DboBuilder.ts +25 -25
- package/lib/FileManager.d.ts +168 -0
- package/lib/FileManager.d.ts.map +1 -0
- package/lib/FileManager.js +474 -0
- package/lib/Filtering.d.ts +15 -0
- package/lib/Filtering.d.ts.map +1 -0
- package/lib/Filtering.js +299 -0
- package/lib/PostgresNotifListenManager.d.ts +27 -0
- package/lib/PostgresNotifListenManager.d.ts.map +1 -0
- package/lib/PostgresNotifListenManager.js +122 -0
- package/lib/Prostgles.d.ts +193 -0
- package/lib/Prostgles.d.ts.map +1 -0
- package/lib/Prostgles.js +579 -0
- package/lib/Prostgles.ts +6 -6
- package/lib/PubSubManager.d.ts +157 -0
- package/lib/PubSubManager.d.ts.map +1 -0
- package/lib/PubSubManager.js +1400 -0
- package/lib/PubSubManager.ts +1 -1
- package/lib/PublishParser.d.ts +262 -0
- package/lib/PublishParser.d.ts.map +1 -0
- package/lib/PublishParser.js +390 -0
- package/lib/PublishParser.ts +39 -38
- package/lib/QueryBuilder.d.ts +124 -0
- package/lib/QueryBuilder.d.ts.map +1 -0
- package/lib/QueryBuilder.js +1349 -0
- package/lib/SyncReplication.d.ts +34 -0
- package/lib/SyncReplication.d.ts.map +1 -0
- package/lib/SyncReplication.js +411 -0
- package/lib/TableConfig.d.ts +175 -0
- package/lib/TableConfig.d.ts.map +1 -0
- package/lib/TableConfig.js +231 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +45 -0
- package/lib/index.ts +3 -4
- package/lib/shortestPath.d.ts +10 -0
- package/lib/shortestPath.d.ts.map +1 -0
- package/lib/shortestPath.js +111 -0
- package/lib/utils.d.ts +2 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +5 -0
- package/package.json +3 -3
- package/tests/client/PID.txt +1 -1
- package/tests/client/index.d.ts +1 -1
- package/tests/client/index.d.ts.map +1 -1
- package/tests/client_only_queries.d.ts +4 -0
- package/tests/client_only_queries.d.ts.map +1 -0
- package/tests/isomorphic_queries.d.ts +6 -0
- package/tests/isomorphic_queries.d.ts.map +1 -0
- package/tests/server/DBoGenerated.d.ts +97 -193
- package/tests/server/dboTypeCheck.d.ts +2 -0
- package/tests/server/dboTypeCheck.d.ts.map +1 -0
- package/tests/server/dboTypeCheck.js +16 -0
- package/tests/server/dboTypeCheck.ts +20 -0
- package/tests/server/index.d.ts +2 -0
- package/tests/server/index.d.ts.map +1 -0
- package/tests/server/index.js +11 -11
- package/tests/server/index.ts +23 -16
- package/tests/server/package-lock.json +5 -5
- package/tests/server/publishTypeCheck.d.ts +2 -0
- package/tests/server/publishTypeCheck.d.ts.map +1 -0
- package/tests/server/publishTypeCheck.js +120 -0
- package/tests/server/publishTypeCheck.ts +129 -0
- package/tests/server/tsconfig.json +4 -5
- package/tests/server_only_queries.d.ts +2 -0
- package/tests/server_only_queries.d.ts.map +1 -0
package/lib/DboBuilder.ts
CHANGED
|
@@ -42,23 +42,23 @@ export type Media = {
|
|
|
42
42
|
"etag"?: string;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export type
|
|
46
|
-
|
|
47
|
-
(t: DBO, _t: pgPromise.ITask<{}>): (any | void);
|
|
45
|
+
export type TxCB = {
|
|
46
|
+
(t: TableHandlers, _t: pgPromise.ITask<{}>): (any | void);
|
|
48
47
|
}
|
|
49
|
-
export type TX
|
|
50
|
-
(t: TxCB
|
|
48
|
+
export type TX = {
|
|
49
|
+
(t: TxCB): Promise<(any | void)>;
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
type
|
|
52
|
+
type TableHandlers = {
|
|
54
53
|
[key: string]: Partial<TableHandler>;
|
|
55
54
|
}
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
|
|
56
|
+
export type DBHandlerServer =
|
|
57
|
+
TableHandlers &
|
|
58
58
|
DbJoinMaker & {
|
|
59
59
|
sql?: SQLHandler
|
|
60
60
|
} & {
|
|
61
|
-
tx?: TX
|
|
61
|
+
tx?: TX
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export const getUpdateFilter = (args: { filter?: AnyObject; forcedFilter?: AnyObject; $and_key: string }): AnyObject => {
|
|
@@ -146,7 +146,7 @@ export type LocalParams = {
|
|
|
146
146
|
testRule?: boolean;
|
|
147
147
|
tableAlias?: string;
|
|
148
148
|
// subOne?: boolean;
|
|
149
|
-
dbTX?:
|
|
149
|
+
dbTX?: TableHandlers;
|
|
150
150
|
|
|
151
151
|
// localTX?: pgPromise.ITask<{}>;
|
|
152
152
|
localDBTX?: DBHandlerServer;
|
|
@@ -482,14 +482,14 @@ export class ViewHandler {
|
|
|
482
482
|
dboBuilder: DboBuilder;
|
|
483
483
|
|
|
484
484
|
t?: pgPromise.ITask<{}>;
|
|
485
|
-
dbTX?:
|
|
485
|
+
dbTX?: TableHandlers;
|
|
486
486
|
|
|
487
487
|
is_view: boolean = true;
|
|
488
488
|
filterDef: string = "";
|
|
489
489
|
|
|
490
490
|
// pubSubManager: PubSubManager;
|
|
491
491
|
is_media: boolean = false;
|
|
492
|
-
constructor(db: DB, tableOrViewInfo: TableSchema, dboBuilder: DboBuilder, t?: pgPromise.ITask<{}>, dbTX?:
|
|
492
|
+
constructor(db: DB, tableOrViewInfo: TableSchema, dboBuilder: DboBuilder, t?: pgPromise.ITask<{}>, dbTX?: TableHandlers, joinPaths?: JoinPaths){
|
|
493
493
|
if(!db || !tableOrViewInfo) throw "";
|
|
494
494
|
|
|
495
495
|
this.db = db;
|
|
@@ -774,7 +774,7 @@ export class ViewHandler {
|
|
|
774
774
|
async getColumns(
|
|
775
775
|
lang?: string,
|
|
776
776
|
params?: { rule: "update", filter: AnyObject, data: AnyObject },
|
|
777
|
-
_param3?:
|
|
777
|
+
_param3?: undefined,
|
|
778
778
|
tableRules?: TableRule,
|
|
779
779
|
localParams?: LocalParams
|
|
780
780
|
): Promise<ValidatedColumnInfo[]> {
|
|
@@ -997,7 +997,7 @@ export class ViewHandler {
|
|
|
997
997
|
|
|
998
998
|
}
|
|
999
999
|
|
|
1000
|
-
async find(filter?: Filter, selectParams?: SelectParams , param3_unused?:
|
|
1000
|
+
async find(filter?: Filter, selectParams?: SelectParams , param3_unused?: undefined, tableRules?: TableRule, localParams?: LocalParams): Promise<any[]>{
|
|
1001
1001
|
try {
|
|
1002
1002
|
filter = filter || {};
|
|
1003
1003
|
const allowedReturnTypes: Array<SelectParams["returnType"]> = ["row", "value", "values"]
|
|
@@ -1068,7 +1068,7 @@ export class ViewHandler {
|
|
|
1068
1068
|
}
|
|
1069
1069
|
}
|
|
1070
1070
|
|
|
1071
|
-
findOne(filter?: Filter, selectParams?: SelectParams, param3_unused?:
|
|
1071
|
+
findOne(filter?: Filter, selectParams?: SelectParams, param3_unused?: undefined, table_rules?: TableRule, localParams?: LocalParams): Promise<any>{
|
|
1072
1072
|
|
|
1073
1073
|
try {
|
|
1074
1074
|
const { select = "*", orderBy, offset = 0 } = selectParams || {};
|
|
@@ -1084,7 +1084,7 @@ export class ViewHandler {
|
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
1086
1086
|
|
|
1087
|
-
async count(filter?: Filter, param2_unused?:
|
|
1087
|
+
async count(filter?: Filter, param2_unused?: undefined, param3_unused?: undefined, table_rules?: TableRule, localParams: any = {}): Promise<number>{
|
|
1088
1088
|
filter = filter || {};
|
|
1089
1089
|
try {
|
|
1090
1090
|
return await this.find(filter, { select: "", limit: 0 }, undefined, table_rules, localParams)
|
|
@@ -1100,7 +1100,7 @@ export class ViewHandler {
|
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
1102
|
|
|
1103
|
-
async size(filter?: Filter, selectParams?: SelectParams, param3_unused?:
|
|
1103
|
+
async size(filter?: Filter, selectParams?: SelectParams, param3_unused?: undefined, table_rules?: TableRule, localParams: any = {}): Promise<string>{
|
|
1104
1104
|
filter = filter || {};
|
|
1105
1105
|
try {
|
|
1106
1106
|
return await this.find(filter, { ...selectParams, limit: 2 }, undefined, table_rules, localParams)
|
|
@@ -1685,7 +1685,7 @@ export class ViewHandler {
|
|
|
1685
1685
|
return (excludeOrder? "" : " ORDER BY ") + (_ob.map(({ key, asc, nulls, nullEmpty = false }) => {
|
|
1686
1686
|
|
|
1687
1687
|
/* Order by column index when possible to bypass name collision when ordering by a computed column.
|
|
1688
|
-
(Postgres will sort by existing columns
|
|
1688
|
+
(Postgres will sort by existing columns wheundefined possible)
|
|
1689
1689
|
*/
|
|
1690
1690
|
const orderType = asc? " ASC " : " DESC ";
|
|
1691
1691
|
const index = selectedAliases.indexOf(key) + 1;
|
|
@@ -1930,7 +1930,7 @@ export class TableHandler extends ViewHandler {
|
|
|
1930
1930
|
batching: string[] | null
|
|
1931
1931
|
}
|
|
1932
1932
|
|
|
1933
|
-
constructor(db: DB, tableOrViewInfo: TableSchema, dboBuilder: DboBuilder, t?: pgPromise.ITask<{}>, dbTX?:
|
|
1933
|
+
constructor(db: DB, tableOrViewInfo: TableSchema, dboBuilder: DboBuilder, t?: pgPromise.ITask<{}>, dbTX?: TableHandlers, joinPaths?: JoinPaths){
|
|
1934
1934
|
super(db, tableOrViewInfo, dboBuilder, t, dbTX, joinPaths);
|
|
1935
1935
|
|
|
1936
1936
|
this.remove = this.delete;
|
|
@@ -2305,7 +2305,7 @@ export class TableHandler extends ViewHandler {
|
|
|
2305
2305
|
}
|
|
2306
2306
|
|
|
2307
2307
|
|
|
2308
|
-
private async insertDataParse(data: (AnyObject | AnyObject[]), param2?: InsertParams, param3_unused?:
|
|
2308
|
+
private async insertDataParse(data: (AnyObject | AnyObject[]), param2?: InsertParams, param3_unused?: undefined, tableRules?: TableRule, _localParams?: LocalParams): Promise<{
|
|
2309
2309
|
data?: AnyObject | AnyObject[];
|
|
2310
2310
|
insertResult?: AnyObject | AnyObject[];
|
|
2311
2311
|
}>{
|
|
@@ -2551,7 +2551,7 @@ export class TableHandler extends ViewHandler {
|
|
|
2551
2551
|
return res;
|
|
2552
2552
|
}
|
|
2553
2553
|
|
|
2554
|
-
async insert(rowOrRows: (AnyObject | AnyObject[]), param2?: InsertParams, param3_unused?:
|
|
2554
|
+
async insert(rowOrRows: (AnyObject | AnyObject[]), param2?: InsertParams, param3_unused?: undefined, tableRules?: TableRule, _localParams?: LocalParams): Promise<any | any[] | boolean>{
|
|
2555
2555
|
const localParams = _localParams || {};
|
|
2556
2556
|
const {dbTX} = localParams
|
|
2557
2557
|
try {
|
|
@@ -2703,7 +2703,7 @@ export class TableHandler extends ViewHandler {
|
|
|
2703
2703
|
return "";
|
|
2704
2704
|
}
|
|
2705
2705
|
|
|
2706
|
-
async delete(filter?: Filter, params?: DeleteParams, param3_unused?:
|
|
2706
|
+
async delete(filter?: Filter, params?: DeleteParams, param3_unused?: undefined, table_rules?: TableRule, localParams?: LocalParams): Promise<any> { //{ socket, func, has_rules = false, socketDb } = {}
|
|
2707
2707
|
try {
|
|
2708
2708
|
const { returning } = params || {};
|
|
2709
2709
|
filter = filter || {};
|
|
@@ -2769,7 +2769,7 @@ export class TableHandler extends ViewHandler {
|
|
|
2769
2769
|
}
|
|
2770
2770
|
};
|
|
2771
2771
|
|
|
2772
|
-
remove(filter: Filter, params?: UpdateParams, param3_unused?:
|
|
2772
|
+
remove(filter: Filter, params?: UpdateParams, param3_unused?: undefined, tableRules?: TableRule, localParams?: LocalParams){
|
|
2773
2773
|
return this.delete(filter, params, param3_unused , tableRules, localParams);
|
|
2774
2774
|
}
|
|
2775
2775
|
|
|
@@ -2799,7 +2799,7 @@ export class TableHandler extends ViewHandler {
|
|
|
2799
2799
|
};
|
|
2800
2800
|
|
|
2801
2801
|
/* External request. Cannot sync from server */
|
|
2802
|
-
async sync(filter: Filter, params: SelectParams, param3_unused:
|
|
2802
|
+
async sync(filter: Filter, params: SelectParams, param3_unused: undefined, table_rules: TableRule, localParams: LocalParams){
|
|
2803
2803
|
if(!localParams) throw "Sync not allowed within the same server code";
|
|
2804
2804
|
const { socket } = localParams;
|
|
2805
2805
|
if(!socket) throw "INTERNAL ERROR: socket missing";
|
|
@@ -3340,7 +3340,7 @@ export class DboBuilder {
|
|
|
3340
3340
|
|
|
3341
3341
|
getTX = (cb: TxCB) => {
|
|
3342
3342
|
return this.db.tx((t) => {
|
|
3343
|
-
let dbTX:
|
|
3343
|
+
let dbTX: TableHandlers = {};
|
|
3344
3344
|
this.tablesOrViews?.map(tov => {
|
|
3345
3345
|
if(tov.is_view){
|
|
3346
3346
|
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { S3 } from 'aws-sdk';
|
|
3
|
+
import { DB, DBHandlerServer, Prostgles } from './Prostgles';
|
|
4
|
+
export declare const asSQLIdentifier: (name: string, db: DB) => Promise<string>;
|
|
5
|
+
export declare type ImageOptions = {
|
|
6
|
+
keepMetadata?: boolean;
|
|
7
|
+
compression?:
|
|
8
|
+
/**
|
|
9
|
+
* Will resize image maintaing scale ratio
|
|
10
|
+
*/
|
|
11
|
+
{
|
|
12
|
+
inside: {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
16
|
+
} | {
|
|
17
|
+
contain: {
|
|
18
|
+
width: number;
|
|
19
|
+
} | {
|
|
20
|
+
height: number;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare type S3Config = {
|
|
25
|
+
region: string;
|
|
26
|
+
bucket: string;
|
|
27
|
+
accessKeyId: string;
|
|
28
|
+
secretAccessKey: string;
|
|
29
|
+
};
|
|
30
|
+
export declare type LocalConfig = {
|
|
31
|
+
/**
|
|
32
|
+
* example: path.join(__dirname+'/media')
|
|
33
|
+
* note that this location will be relative to the compiled file location
|
|
34
|
+
*/
|
|
35
|
+
localFolderPath: string;
|
|
36
|
+
};
|
|
37
|
+
export declare type UploadItem = {
|
|
38
|
+
name: string;
|
|
39
|
+
content_type: string;
|
|
40
|
+
data: Buffer;
|
|
41
|
+
};
|
|
42
|
+
export declare type UploadedItem = {
|
|
43
|
+
/**
|
|
44
|
+
* Url that is passed to client
|
|
45
|
+
*/
|
|
46
|
+
url: string;
|
|
47
|
+
etag: string;
|
|
48
|
+
/**
|
|
49
|
+
* S3 url of the resource
|
|
50
|
+
*/
|
|
51
|
+
s3_url?: string;
|
|
52
|
+
};
|
|
53
|
+
export default class FileManager {
|
|
54
|
+
s3Client?: S3;
|
|
55
|
+
config: S3Config | LocalConfig;
|
|
56
|
+
imageOptions?: ImageOptions;
|
|
57
|
+
prostgles?: Prostgles;
|
|
58
|
+
get dbo(): DBHandlerServer;
|
|
59
|
+
get db(): DB;
|
|
60
|
+
tableName?: string;
|
|
61
|
+
private fileRoute?;
|
|
62
|
+
constructor(config: FileManager["config"], imageOptions?: ImageOptions);
|
|
63
|
+
getMIME(file: Buffer | String, fileName: string, allowedExtensions?: Array<ALLOWED_EXTENSION>, dissallowedExtensions?: Array<ALLOWED_EXTENSION>, onlyFromName?: boolean): Promise<{
|
|
64
|
+
mime: string;
|
|
65
|
+
ext: string | ALLOWED_EXTENSION;
|
|
66
|
+
fileName: string;
|
|
67
|
+
}>;
|
|
68
|
+
private upload;
|
|
69
|
+
uploadAsMedia: (params: {
|
|
70
|
+
item: UploadItem;
|
|
71
|
+
allowedExtensions?: Array<ALLOWED_EXTENSION>;
|
|
72
|
+
dissallowedExtensions?: Array<ALLOWED_EXTENSION>;
|
|
73
|
+
imageOptions?: ImageOptions;
|
|
74
|
+
}) => Promise<UploadedItem>;
|
|
75
|
+
private getFileURL;
|
|
76
|
+
private parseSQLIdentifier;
|
|
77
|
+
init: (prg: Prostgles) => Promise<void>;
|
|
78
|
+
}
|
|
79
|
+
declare const CONTENT_TYPE_TO_EXT: {
|
|
80
|
+
readonly "text/html": readonly ["html", "htm", "shtml"];
|
|
81
|
+
readonly "text/css": readonly ["css"];
|
|
82
|
+
readonly "text/xml": readonly ["xml"];
|
|
83
|
+
readonly "text/mathml": readonly ["mml"];
|
|
84
|
+
readonly "text/plain": readonly ["txt"];
|
|
85
|
+
readonly "text/vnd.sun.j2me.app-descriptor": readonly ["jad"];
|
|
86
|
+
readonly "text/vnd.wap.wml": readonly ["wml"];
|
|
87
|
+
readonly "text/x-component": readonly ["htc"];
|
|
88
|
+
readonly "image/gif": readonly ["gif"];
|
|
89
|
+
readonly "image/jpeg": readonly ["jpeg", "jpg"];
|
|
90
|
+
readonly "image/png": readonly ["png"];
|
|
91
|
+
readonly "image/tiff": readonly ["tif", "tiff"];
|
|
92
|
+
readonly "image/vnd.wap.wbmp": readonly ["wbmp"];
|
|
93
|
+
readonly "image/x-icon": readonly ["ico"];
|
|
94
|
+
readonly "image/x-jng": readonly ["jng"];
|
|
95
|
+
readonly "image/x-ms-bmp": readonly ["bmp"];
|
|
96
|
+
readonly "image/svg+xml": readonly ["svg"];
|
|
97
|
+
readonly "image/webp": readonly ["webp"];
|
|
98
|
+
readonly "application/x-javascript": readonly ["js"];
|
|
99
|
+
readonly "application/atom+xml": readonly ["atom"];
|
|
100
|
+
readonly "application/rss+xml": readonly ["rss"];
|
|
101
|
+
readonly "application/java-archive": readonly ["jar", "war", "ear"];
|
|
102
|
+
readonly "application/mac-binhex40": readonly ["hqx"];
|
|
103
|
+
readonly "application/msword": readonly ["doc", "docx"];
|
|
104
|
+
readonly "application/pdf": readonly ["pdf"];
|
|
105
|
+
readonly "application/postscript": readonly ["ps", "eps", "ai"];
|
|
106
|
+
readonly "application/rtf": readonly ["rtf"];
|
|
107
|
+
readonly "application/vnd.ms-excel": readonly ["xls", "xlsx"];
|
|
108
|
+
readonly "application/vnd.ms-powerpoint": readonly ["ppt", "pptx"];
|
|
109
|
+
readonly "application/vnd.wap.wmlc": readonly ["wmlc"];
|
|
110
|
+
readonly "application/vnd.google-earth.kml+xml": readonly ["kml"];
|
|
111
|
+
readonly "application/vnd.google-earth.kmz": readonly ["kmz"];
|
|
112
|
+
readonly "application/x-7z-compressed": readonly ["7z"];
|
|
113
|
+
readonly "application/x-cocoa": readonly ["cco"];
|
|
114
|
+
readonly "application/x-java-archive-diff": readonly ["jardiff"];
|
|
115
|
+
readonly "application/x-java-jnlp-file": readonly ["jnlp"];
|
|
116
|
+
readonly "application/x-makeself": readonly ["run"];
|
|
117
|
+
readonly "application/x-perl": readonly ["pl", "pm"];
|
|
118
|
+
readonly "application/x-pilot": readonly ["prc", "pdb"];
|
|
119
|
+
readonly "application/x-rar-compressed": readonly ["rar"];
|
|
120
|
+
readonly "application/x-redhat-package-manager": readonly ["rpm"];
|
|
121
|
+
readonly "application/x-sea": readonly ["sea"];
|
|
122
|
+
readonly "application/x-shockwave-flash": readonly ["swf"];
|
|
123
|
+
readonly "application/x-stuffit": readonly ["sit"];
|
|
124
|
+
readonly "application/x-tcl": readonly ["tcl", "tk"];
|
|
125
|
+
readonly "application/x-x509-ca-cert": readonly ["der", "pem", "crt"];
|
|
126
|
+
readonly "application/x-xpinstall": readonly ["xpi"];
|
|
127
|
+
readonly "application/xhtml+xml": readonly ["xhtml"];
|
|
128
|
+
readonly "application/zip": readonly ["zip"];
|
|
129
|
+
readonly "application/octet-stream": readonly ["bin", "exe", "dll", "deb", "dmg", "eot", "iso", "img", "msi", "msp", "msm"];
|
|
130
|
+
readonly "audio/midi": readonly ["mid", "midi", "kar"];
|
|
131
|
+
readonly "audio/mpeg": readonly ["mp3"];
|
|
132
|
+
readonly "audio/ogg": readonly ["ogg"];
|
|
133
|
+
readonly "audio/x-realaudio": readonly ["ra"];
|
|
134
|
+
readonly "video/3gpp": readonly ["3gpp", "3gp"];
|
|
135
|
+
readonly "video/mpeg": readonly ["mpeg", "mpg"];
|
|
136
|
+
readonly "video/quicktime": readonly ["mov"];
|
|
137
|
+
readonly "video/x-flv": readonly ["flv"];
|
|
138
|
+
readonly "video/x-mng": readonly ["mng"];
|
|
139
|
+
readonly "video/x-ms-asf": readonly ["asx", "asf"];
|
|
140
|
+
readonly "video/x-ms-wmv": readonly ["wmv"];
|
|
141
|
+
readonly "video/x-msvideo": readonly ["avi"];
|
|
142
|
+
readonly "video/mp4": readonly ["m4v", "mp4"];
|
|
143
|
+
readonly "video/webm": readonly ["webm"];
|
|
144
|
+
};
|
|
145
|
+
export declare type ALLOWED_CONTENT_TYPE = keyof typeof CONTENT_TYPE_TO_EXT;
|
|
146
|
+
export declare type ALLOWED_EXTENSION = (typeof CONTENT_TYPE_TO_EXT)[ALLOWED_CONTENT_TYPE][number];
|
|
147
|
+
export {};
|
|
148
|
+
/**
|
|
149
|
+
*
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
// if(content_type && typeof content_type !== "string") throw "Invalid content_type provided";
|
|
153
|
+
// if(title && typeof title !== "string") throw "Invalid title provided";
|
|
154
|
+
// let fExt = name.split(".").pop()
|
|
155
|
+
// if(content_type && name.split(".").length > 1 && fExt && fExt.length <= 4){
|
|
156
|
+
// type = {
|
|
157
|
+
// mime: content_type,
|
|
158
|
+
// ext: fExt,
|
|
159
|
+
// fileName: name,
|
|
160
|
+
// }
|
|
161
|
+
// } else {
|
|
162
|
+
// type = await this.getMIME(data, name);//, ["png", "jpg", "ogg", "webm", "pdf", "doc"]);
|
|
163
|
+
// }
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
*/
|
|
168
|
+
//# sourceMappingURL=FileManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileManager.d.ts","sourceRoot":"","sources":["FileManager.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAO7B,OAAO,EAAE,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAM7D,eAAO,MAAM,eAAe,SAAgB,MAAM,aAAW,QAAQ,MAAM,CAE1E,CAAA;AAED,oBAAY,YAAY,GAAG;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC;IACV;;OAEG;IACD;QAAE,MAAM,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,GAC7C;QAAE,OAAO,EACL;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,GACjB;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,CAAA;KACrB,CAAA;CACN,CAAA;AAED,oBAAY,QAAQ,GAAG;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM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