@jd-data-limited/easy-fm 4.1.5 → 4.1.6
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 +8 -5
- package/src/records/layoutRecord.js +4 -1
- package/src/records/layoutRecord.ts +2 -1
- package/src/types.d.ts +12 -0
- package/src/types.ts +12 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jd-data-limited/easy-fm",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.6",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@types/follow-redirects": "^1.14.4",
|
|
6
6
|
"follow-redirects": "^1.15.5",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"main": "src/index.js",
|
|
13
13
|
"module": "es2022",
|
|
14
|
-
"homepage": "https://
|
|
14
|
+
"homepage": "https://jd-data.com/project/easyfm/",
|
|
15
15
|
"url": "https://github.com/JD-Data-Limited/easy-fm",
|
|
16
16
|
"license": "SEE LICENSE IN LICENSE",
|
|
17
17
|
"description": "easy-fm is a Node.js module that allows you to interact with\r a [FileMaker database stored](https://www.claris.com/filemaker/) on\r a [FileMaker server](https://www.claris.com/filemaker/server/). This module interacts with your server using the\r [FileMaker Data API](https://help.claris.com/en/data-api-guide/content/index.html).",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"./src/**/*"
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
|
-
"test": "node --test tests/login.js",
|
|
22
|
+
"test": "npx tsc -p . && node --test tests/login.js",
|
|
23
23
|
"build": "webpack"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
@@ -28,8 +28,11 @@
|
|
|
28
28
|
},
|
|
29
29
|
"keywords": [
|
|
30
30
|
"FileMaker",
|
|
31
|
-
"Data
|
|
32
|
-
"
|
|
31
|
+
"Data",
|
|
32
|
+
"API",
|
|
33
|
+
"REST",
|
|
34
|
+
"simplicity",
|
|
35
|
+
"business"
|
|
33
36
|
],
|
|
34
37
|
"author": "JD-Data Limited",
|
|
35
38
|
"bugs": {
|
|
@@ -44,13 +44,16 @@ export class LayoutRecord extends RecordBase {
|
|
|
44
44
|
if (extraBody.scripts.presort.parameter)
|
|
45
45
|
data['script.presort.param'] = extraBody.scripts.presort.parameter;
|
|
46
46
|
}
|
|
47
|
+
if (extraBody.options)
|
|
48
|
+
data.options = extraBody.options;
|
|
49
|
+
if (extraBody.deleteRelatedRecords)
|
|
50
|
+
data.fieldData.deleteRelated = extraBody.deleteRelatedRecords.map(i => `${i.table}.${i.recordId}`);
|
|
47
51
|
if (this.recordId === -1) {
|
|
48
52
|
// This is a new LayoutRecord
|
|
49
53
|
const res = await this.layout.database._apiRequestJSON(`${this.layout.endpoint}/records`, {
|
|
50
54
|
method: 'POST',
|
|
51
55
|
body: JSON.stringify(data)
|
|
52
56
|
});
|
|
53
|
-
console.log(res);
|
|
54
57
|
if (!res.response) {
|
|
55
58
|
throw new FMError(res.messages[0].code, res.httpStatus, res);
|
|
56
59
|
}
|
|
@@ -63,6 +63,8 @@ export class LayoutRecord<LAYOUT extends LayoutInterface> extends RecordBase<LAY
|
|
|
63
63
|
data['script.presort'] = extraBody.scripts.presort.name
|
|
64
64
|
if (extraBody.scripts.presort.parameter) data['script.presort.param'] = extraBody.scripts.presort.parameter
|
|
65
65
|
}
|
|
66
|
+
if (extraBody.options) data.options = extraBody.options
|
|
67
|
+
if (extraBody.deleteRelatedRecords) data.fieldData.deleteRelated = extraBody.deleteRelatedRecords.map(i => `${i.table}.${i.recordId}`)
|
|
66
68
|
|
|
67
69
|
if (this.recordId === -1) {
|
|
68
70
|
// This is a new LayoutRecord
|
|
@@ -70,7 +72,6 @@ export class LayoutRecord<LAYOUT extends LayoutInterface> extends RecordBase<LAY
|
|
|
70
72
|
method: 'POST',
|
|
71
73
|
body: JSON.stringify(data)
|
|
72
74
|
})
|
|
73
|
-
console.log(res)
|
|
74
75
|
|
|
75
76
|
if (!res.response) {
|
|
76
77
|
throw new FMError(res.messages[0].code, res.httpStatus, res)
|
package/src/types.d.ts
CHANGED
|
@@ -51,6 +51,18 @@ export interface ScriptRequestData {
|
|
|
51
51
|
}
|
|
52
52
|
export interface extraBodyOptions {
|
|
53
53
|
scripts?: ScriptRequestData;
|
|
54
|
+
options?: {
|
|
55
|
+
/**
|
|
56
|
+
* Defines what entry mode to use (FileMaker Server 2024 and newer)
|
|
57
|
+
* user (default) - Field validation occurs as per normal. Request is blocked if validation failed.
|
|
58
|
+
* script - Field validation is overridden/ignored when allowed in the database schema.
|
|
59
|
+
*/
|
|
60
|
+
entrymode: 'user' | 'script';
|
|
61
|
+
};
|
|
62
|
+
deleteRelatedRecords?: Array<{
|
|
63
|
+
table: string;
|
|
64
|
+
recordId: number;
|
|
65
|
+
}>;
|
|
54
66
|
}
|
|
55
67
|
export interface Script {
|
|
56
68
|
name: string;
|
package/src/types.ts
CHANGED
|
@@ -63,6 +63,18 @@ export interface ScriptRequestData {
|
|
|
63
63
|
|
|
64
64
|
export interface extraBodyOptions {
|
|
65
65
|
scripts?: ScriptRequestData
|
|
66
|
+
options?: {
|
|
67
|
+
/**
|
|
68
|
+
* Defines what entry mode to use (FileMaker Server 2024 and newer)
|
|
69
|
+
* user (default) - Field validation occurs as per normal. Request is blocked if validation failed.
|
|
70
|
+
* script - Field validation is overridden/ignored when allowed in the database schema.
|
|
71
|
+
*/
|
|
72
|
+
entrymode: 'user' | 'script'
|
|
73
|
+
}
|
|
74
|
+
deleteRelatedRecords?: Array<{
|
|
75
|
+
table: string
|
|
76
|
+
recordId: number
|
|
77
|
+
}>
|
|
66
78
|
}
|
|
67
79
|
|
|
68
80
|
export interface Script {
|