@jd-data-limited/easy-fm 4.0.12 → 4.0.14
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/src/connection/FMHost.d.ts +2 -1
- package/src/connection/FMHost.js +16 -13
- package/src/connection/FMHost.ts +16 -12
- package/src/index.d.ts +2 -2
- package/src/index.ts +2 -1
package/package.json
CHANGED
|
@@ -6,8 +6,9 @@ export default class FMHost implements HostBase {
|
|
|
6
6
|
readonly hostname: string;
|
|
7
7
|
readonly timezoneOffset: number;
|
|
8
8
|
readonly verify: boolean;
|
|
9
|
-
|
|
9
|
+
_metadata: FMHostMetadata | null;
|
|
10
10
|
constructor(_hostname: string, timezoneOffset?: number, verify?: boolean);
|
|
11
|
+
get metadata(): FMHostMetadata;
|
|
11
12
|
listDatabases(credentials?: loginOptionsOAuth | loginOptionsFileMaker | loginOptionsClaris): Promise<any>;
|
|
12
13
|
database<T extends DatabaseStructure>(data: databaseOptionsWithExternalSources): Database<T>;
|
|
13
14
|
getMetadata(): Promise<FMHostMetadata>;
|
package/src/connection/FMHost.js
CHANGED
|
@@ -8,16 +8,7 @@ export default class FMHost {
|
|
|
8
8
|
hostname;
|
|
9
9
|
timezoneOffset;
|
|
10
10
|
verify;
|
|
11
|
-
|
|
12
|
-
productInfo: {
|
|
13
|
-
buildDate: new Date(),
|
|
14
|
-
name: "",
|
|
15
|
-
version: "",
|
|
16
|
-
dateFormat: "",
|
|
17
|
-
timeFormat: "",
|
|
18
|
-
timeStampFormat: ""
|
|
19
|
-
}
|
|
20
|
-
};
|
|
11
|
+
_metadata = null;
|
|
21
12
|
constructor(_hostname, timezoneOffset = 0 - (new Date()).getTimezoneOffset(), verify = true) {
|
|
22
13
|
if (!(/^https?:\/\//).test(_hostname))
|
|
23
14
|
throw "hostname MUST begin with either http:// or https://";
|
|
@@ -25,6 +16,18 @@ export default class FMHost {
|
|
|
25
16
|
this.timezoneOffset = timezoneOffset;
|
|
26
17
|
this.verify = verify;
|
|
27
18
|
}
|
|
19
|
+
get metadata() {
|
|
20
|
+
return this._metadata || {
|
|
21
|
+
productInfo: {
|
|
22
|
+
buildDate: new Date(),
|
|
23
|
+
name: "",
|
|
24
|
+
version: "",
|
|
25
|
+
dateFormat: "",
|
|
26
|
+
timeFormat: "",
|
|
27
|
+
timeStampFormat: ""
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
28
31
|
async listDatabases(credentials) {
|
|
29
32
|
let headers = {};
|
|
30
33
|
if (credentials) {
|
|
@@ -48,15 +51,15 @@ export default class FMHost {
|
|
|
48
51
|
return new Database(this, data);
|
|
49
52
|
}
|
|
50
53
|
async getMetadata() {
|
|
51
|
-
if (this.
|
|
52
|
-
return this.
|
|
54
|
+
if (this._metadata)
|
|
55
|
+
return this._metadata;
|
|
53
56
|
let _fetch = await fetch(`${this.hostname}/fmi/data/v2/productInfo`, {
|
|
54
57
|
method: "GET",
|
|
55
58
|
});
|
|
56
59
|
let data = await _fetch.json();
|
|
57
60
|
// console.log(data.messages[0])
|
|
58
61
|
if (data.messages[0].code === "0" && data.response) {
|
|
59
|
-
this.
|
|
62
|
+
this._metadata = data.response;
|
|
60
63
|
return data.response;
|
|
61
64
|
}
|
|
62
65
|
else {
|
package/src/connection/FMHost.ts
CHANGED
|
@@ -20,16 +20,7 @@ export default class FMHost implements HostBase {
|
|
|
20
20
|
readonly hostname: string
|
|
21
21
|
readonly timezoneOffset: number
|
|
22
22
|
readonly verify: boolean
|
|
23
|
-
|
|
24
|
-
productInfo: {
|
|
25
|
-
buildDate: new Date(),
|
|
26
|
-
name: "",
|
|
27
|
-
version: "",
|
|
28
|
-
dateFormat: "",
|
|
29
|
-
timeFormat: "",
|
|
30
|
-
timeStampFormat: ""
|
|
31
|
-
}
|
|
32
|
-
}
|
|
23
|
+
_metadata: FMHostMetadata | null = null
|
|
33
24
|
|
|
34
25
|
constructor(_hostname: string, timezoneOffset = 0 - (new Date()).getTimezoneOffset(), verify = true) {
|
|
35
26
|
if (!(/^https?:\/\//).test(_hostname)) throw "hostname MUST begin with either http:// or https://"
|
|
@@ -38,6 +29,19 @@ export default class FMHost implements HostBase {
|
|
|
38
29
|
this.verify = verify
|
|
39
30
|
}
|
|
40
31
|
|
|
32
|
+
get metadata(): FMHostMetadata {
|
|
33
|
+
return this._metadata || {
|
|
34
|
+
productInfo: {
|
|
35
|
+
buildDate: new Date(),
|
|
36
|
+
name: "",
|
|
37
|
+
version: "",
|
|
38
|
+
dateFormat: "",
|
|
39
|
+
timeFormat: "",
|
|
40
|
+
timeStampFormat: ""
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
41
45
|
async listDatabases(credentials?: loginOptionsOAuth | loginOptionsFileMaker | loginOptionsClaris) {
|
|
42
46
|
let headers = {}
|
|
43
47
|
if (credentials) {
|
|
@@ -65,7 +69,7 @@ export default class FMHost implements HostBase {
|
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
async getMetadata() {
|
|
68
|
-
if (this.
|
|
72
|
+
if (this._metadata) return this._metadata
|
|
69
73
|
|
|
70
74
|
let _fetch = await fetch(`${this.hostname}/fmi/data/v2/productInfo`, {
|
|
71
75
|
method: "GET",
|
|
@@ -74,7 +78,7 @@ export default class FMHost implements HostBase {
|
|
|
74
78
|
// console.log(data.messages[0])
|
|
75
79
|
|
|
76
80
|
if (data.messages[0].code === "0" && data.response) {
|
|
77
|
-
this.
|
|
81
|
+
this._metadata = data.response
|
|
78
82
|
return data.response
|
|
79
83
|
}
|
|
80
84
|
else {
|
package/src/index.d.ts
CHANGED
|
@@ -9,10 +9,10 @@ import { LayoutRecord } from "./records/layoutRecord.js";
|
|
|
9
9
|
import { LayoutInterface, PortalInterface } from "./layouts/layoutInterface.js";
|
|
10
10
|
import { PortalRecord } from "./records/portalRecord.js";
|
|
11
11
|
import { Portal } from "./records/portal.js";
|
|
12
|
-
import { FindRequestRaw, RecordGetOperation } from "./records/getOperations/recordGetOperation.js";
|
|
12
|
+
import { FindRequest, FindRequestRaw, RecordGetOperation } from "./records/getOperations/recordGetOperation.js";
|
|
13
13
|
import { LayoutRecordManager } from "./layouts/layoutRecordManager.js";
|
|
14
14
|
import { RecordFieldsMap } from "./layouts/recordFieldsMap.js";
|
|
15
15
|
import { query, queryEscape } from "./utils/query.js";
|
|
16
16
|
import { Container, Field } from "./records/field.js";
|
|
17
17
|
export default FMHost;
|
|
18
|
-
export { FMError, TYPES, Database, Layout, RecordBase, LayoutRecord, LayoutInterface, RecordFieldsMap, PortalInterface, PortalRecord, Portal, Field, RecordGetOperation, LayoutRecordManager, Container, PickPortals, FindRequestRaw, query, queryEscape };
|
|
18
|
+
export { FMError, TYPES, Database, Layout, RecordBase, LayoutRecord, LayoutInterface, RecordFieldsMap, PortalInterface, PortalRecord, Portal, Field, RecordGetOperation, LayoutRecordManager, Container, PickPortals, FindRequestRaw, FindRequest, query, queryEscape };
|
package/src/index.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {LayoutRecord} from "./records/layoutRecord.js";
|
|
|
13
13
|
import {LayoutInterface, PortalInterface} from "./layouts/layoutInterface.js";
|
|
14
14
|
import {PortalRecord} from "./records/portalRecord.js";
|
|
15
15
|
import {Portal} from "./records/portal.js";
|
|
16
|
-
import {FindRequestRaw, RecordGetOperation} from "./records/getOperations/recordGetOperation.js";
|
|
16
|
+
import {FindRequest, FindRequestRaw, RecordGetOperation} from "./records/getOperations/recordGetOperation.js";
|
|
17
17
|
import {LayoutRecordManager} from "./layouts/layoutRecordManager.js";
|
|
18
18
|
import {RecordFieldsMap} from "./layouts/recordFieldsMap.js";
|
|
19
19
|
import {query, queryEscape} from "./utils/query.js";
|
|
@@ -38,6 +38,7 @@ export {
|
|
|
38
38
|
Container,
|
|
39
39
|
PickPortals,
|
|
40
40
|
FindRequestRaw,
|
|
41
|
+
FindRequest,
|
|
41
42
|
query,
|
|
42
43
|
queryEscape
|
|
43
44
|
}
|