
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@jd-data-limited/easy-fm
Advanced tools
easy-fm is a Node.js module that allows you to interact with a [FileMaker database stored](https://www.claris.com/filemaker/) on a [FileMaker server](https://www.claris.com/filemaker/server/). This module interacts with your server using the [FileMaker
A FileMaker Data API client for NodeJS
easy-fm is a Node.js module that allows you to interact with a FileMaker database stored on a FileMaker server or FileMaker Cloud. This module interacts with your server using the FileMaker Data API.
npm install @jd-data-limited/easy-fm --save
easy-fm also requires the following to be configured within your FileMaker enviroment:
Connectors > FileMaker Data API
.import FMHost from "easy-fm"; // Import the module
const host = new FMHost("https://<your-servers-address>")
const database = host.database({
database: "your_database.fmp12",
credentials: {
method: "filemaker",
username: "<username>",
password: "<password>"
},
externalSources: []
})
// OPTIONAL - EasyFM will automatically attempt a login anyway when you perform your first operation
database.login().then(() => {
})
NOTE: A connection will only give you access to the layouts in the database you are connected to, and not the layouts in any external sources that you have specified.
If you need to interact with layouts on multiple databases, you need to open a separate connection for each.
Although it is recommended, timestamps in FileMaker databases are not always stored in UTC time. To account for this, EasyFM allows you to specify a function/method that determines the server's current timezone. EasyFM will use this timezone offset to convert timestamps to and from JavaScript Date objects.
import FMHost from "easy-fm";
import {type Moment} from 'moment'
const host = new FMHost("https://<your-servers-address>", (moment: Moment) => {
})
One of (if not the) most common interactions you'll need to use is fetching records.
let layout = database.getLayout("Your layout name")
let query = layout.records.list({
portals: {
test: {limit: 10, offset: 1} // Include results from the 'test' portal
},
limit: 10, // Limit result set to 10 records...
offset: 30 // ...starting from the 30th record
})
let records = await query.fetch()
console.log(records)
Searching for records uses the same syntax as above, but with additional steps to add your search parameters.
let layout = database.getLayout("Your layout name")
let query = layout.records.list({
portals: {
test: {limit: 10, offset: 1} // Include results from the 'test' portal
},
limit: 10, // Limit result set to 10 records...
offset: 30 // ...starting from the 30th record
})
query.addRequest({"GroupID": "=abc"}) // Add a filter
let records = await query.fetch()
console.log(records)
Please note: When in FileMaker Pro, a record's ID is returned when using Get(RecordID). If you need to fetch a record using a different ID, use the search method above.
let layout = database.getLayout("Your layout name")
let record = await layout.records.get(164)
console.log(record)
let layout = database.getLayout("Your layout name")
let record = await layout.records.create()
record.fields["Field1"].value = "Value here"
record.fields["Field2"].value = "Value here"
record.fields["Field3"].value = "Value here"
await record.commit()
let layout = database.getLayout("Your layout name")
let record = await layout.records.get(164)
record.fields["Field1"].value = "Value here"
record.fields["Field2"].value = "Value here"
record.fields["Field3"].value = "Value here"
await record.commit()
When interacting with FileMaker, it is important to remember how FileMaker field names work.
Field name format | Use when.... |
---|---|
FieldName | Use this when the field you are accessing is in the same table that the layout has been assigned to |
RelatedTableName::FieldName | Use this when the field is not in the same table that the layout has been assigned to |
NOTE: You will not be able to access any fields that are not on the layout.
Please read this section carefully if you are working with portals
It is important to note that a portal's name is not the same as the name of the table that it links to. The name of a portal matches the object name it was assigned in FileMaker's layout editor.
NOTE: When no name has been manually assigned to it, it will default to the name of the related table.
easy-fm
supports the use of TypeScript. Here's an example of how this works with easy-fm
:
import FMHost, {Portal, Field, Container} from "@jd-data-limited/easy-fm";
interface UsersLayout {
fields: {
// Map each field on the layout to a field type.
first_name: Field<string>
age: Field<number>
birthdate: Field<Date>
profile_picture: Field<Container>
"MyRelatedTable::MyRelatedField": Field<string>
},
portals: {
Files: {
"Files::Field1": Field<string>
}
}
}
interface DatabaseStructure {
layouts: {
users: UsersLayout
}
}
const host = new FMHost("https://example_filemaker_server.com")
const database = host.database<DatabaseStructure>({
database: "ExampleDatabase.fmp12",
credentials: {method: "filemaker", username: "test", passsword: "test"},
externalSources: []
})
await database.login()
const layout = database.getLayout("users") // The UsersLayout interface will be automatically applied to all records within this layout
const record = await layout.records.create()
record.fields["first_name"].value = "Joe"
record.fields["age"].value = 38
FAQs
easy-fm is a Node.js module that allows you to interact with a [FileMaker database stored](https://www.claris.com/filemaker/) on a [FileMaker server](https://www.claris.com/filemaker/server/). This module interacts with your server using the [FileMaker
We found that @jd-data-limited/easy-fm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.