@peacom/core 0.0.6 → 0.0.7

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 CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "@peacom/core",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "type": "commonjs",
5
5
  "dependencies": {
6
6
  "moment": "^2.29.4",
7
- "moment-timezone": "^0.5.40"
7
+ "moment-timezone": "^0.5.40",
8
+ "mime-types": "^2.1.35"
9
+ },
10
+ "devDependencies": {
11
+ "@types/mime-types": "^2.1.1"
8
12
  },
9
13
  "main": "./src/index.js",
10
14
  "types": "./src/index.d.ts",
@@ -40,9 +40,10 @@ export declare enum SuggestionActionType {
40
40
  export interface FileInfo {
41
41
  type: string;
42
42
  name: string;
43
- size: number;
44
43
  url: string;
45
- uuid: string;
44
+ extension?: string;
45
+ size?: number;
46
+ uuid?: string;
46
47
  preview?: string;
47
48
  }
48
49
  export interface RawMessageSuggestion {
@@ -0,0 +1,2 @@
1
+ import { FileInfo } from "../../model/";
2
+ export declare const getFileInfoFromUrl: (url: string, defaultMimeType?: string) => FileInfo;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFileInfoFromUrl = void 0;
4
+ const mime = require("mime-types");
5
+ const getFileInfoFromUrl = (url, defaultMimeType = "application/binary") => {
6
+ const rs = {
7
+ name: "",
8
+ type: defaultMimeType,
9
+ extension: ""
10
+ };
11
+ rs.name = new URL(url).pathname.split("/").pop() || url;
12
+ rs.extension = rs.name.split(".").pop();
13
+ if (rs.extension) {
14
+ rs.type = mime.lookup(rs.extension) || defaultMimeType;
15
+ }
16
+ return rs;
17
+ };
18
+ exports.getFileInfoFromUrl = getFileInfoFromUrl;
19
+ //# sourceMappingURL=file.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.util.js","sourceRoot":"","sources":["../../../../../../../packages/core/src/lib/util/file/file.util.ts"],"names":[],"mappings":";;;AAEA,mCAAoC;AAE7B,MAAM,kBAAkB,GAAG,CAChC,GAAW,EACX,eAAe,GAAG,oBAAoB,EAC5B,EAAE;IACZ,MAAM,EAAE,GAAG;QACT,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,eAAe;QACrB,SAAS,EAAE,EAAE;KACF,CAAC;IAEd,EAAE,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,GAAG,CAAC;IACxD,EAAE,CAAC,SAAS,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IACxC,IAAI,EAAE,CAAC,SAAS,EAAE;QAChB,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,eAAe,CAAC;KACxD;IAED,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAjBW,QAAA,kBAAkB,sBAiB7B"}
@@ -1,3 +1,4 @@
1
1
  export * from './message/message.util';
2
2
  export * from './string.util';
3
3
  export * from './general.util';
4
+ export * from './file/file.util';
@@ -4,4 +4,5 @@ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./message/message.util"), exports);
5
5
  tslib_1.__exportStar(require("./string.util"), exports);
6
6
  tslib_1.__exportStar(require("./general.util"), exports);
7
+ tslib_1.__exportStar(require("./file/file.util"), exports);
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/util/index.ts"],"names":[],"mappings":";;;AAAA,iEAAsC;AACtC,wDAA6B;AAC7B,yDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/util/index.ts"],"names":[],"mappings":";;;AAAA,iEAAsC;AACtC,wDAA6B;AAC7B,yDAA8B;AAC9B,2DAAgC"}