@jd-data-limited/easy-fm 0.0.1

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.
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="inheritedJdk" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ </module>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptLibraryMappings">
4
+ <includedPredefinedLibrary name="Node.js Core" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/easy-fm.iml" filepath="$PROJECT_DIR$/.idea/easy-fm.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 JD-Data-Limited
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # easy-fm
2
+
3
+ easy-fm is a Node.js module that allows you to interact with
4
+ a [FileMaker database stored](https://www.claris.com/filemaker/) on
5
+ a [FileMaker server](https://www.claris.com/filemaker/server/). This module interacts with your server using the
6
+ [FileMaker Data API](https://help.claris.com/en/data-api-guide/content/index.html).
7
+
8
+ ## FileMaker setup instructions
9
+
10
+ 1. Enable the FileMaker Data API from the server's admin console. This setting is located
11
+ in `Connectors > FileMaker Data API`.
12
+ 2. Create a FileMaker database account for easy-fm to use. This account must have the 'Access via FileMaker Data API (
13
+ fmrest)' extended privilege
14
+
15
+
16
+ ## Usage examples
17
+
18
+ 1. Get the first record on the 'table1' layout
19
+ ```javascript
20
+ import fm, {FMError} from "easy-fm"; // Import the module
21
+ const connection = new fm(); // This variable will be used for interacting with the server
22
+
23
+ connection.login(hostname, database, username, password).then(async token => { // Login
24
+ let layout = connection.getLayout("layout1")
25
+ let record = layout.getRecord(1)
26
+ await record.get() // Fetch the data for that record
27
+ console.log(record)
28
+ })
29
+ ```
30
+
31
+ 2. Get all related portal records
32
+ ```javascript
33
+ await record.get() // Fetch the record's data
34
+ let portal = record.getPortal("portal1") // 'portal1' should be the name you assigned the portal object, when creating the layout
35
+ console.log(portal.records)
36
+ ```
37
+
38
+ 3. Run a script
39
+ ```javascript
40
+ let script = connection.script("script_name", "this is a parameter") // Create a new script object using the script name and parameter (optional)
41
+
42
+ // Get the layout we want to run the script on
43
+ let layout = connection.getLayout("layout1")
44
+
45
+ // Run the script on the layout
46
+ let result = await layout.runScript(script)
47
+ console.log(result)
48
+ ```
49
+
50
+ 4. Perform a find
51
+ ```javascript
52
+ let find = layout.newFind() // Create a new find operation
53
+
54
+ find.addRequests( // Specify the find criteria
55
+ {"PrimaryKey": "AAAAA", "ModifiedBy": "BBBB"},
56
+ {"CreatedBy": "BBBB"}
57
+ )
58
+
59
+ find.addSort("CratedBy", "ascend") // Sort the results in ascending order
60
+ let records = await find.find() // Perform the find
61
+ console.log(records)
62
+ ```
63
+ This is the same as the following find request in FileMaker:
64
+ ![img.png](img.png)
package/decs.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ declare module "fs"
2
+ declare module "events"
3
+ declare module "path"
4
+ declare module "url"