Filemaker

Filemaker

The class used to integrate with the FileMaker server Data API

Constructor

new Filemaker()

Source:

Members

application :String

The client application name.

Source:
Type:
  • String

connection :Object

The client application connection object.

Source:
Type:
  • Object

data :Object

The client data logger.

Source:
Type:
  • Object

server :String

The client application server.

Source:
Type:
  • String

version :String

The version of Data API to use.

Source:
Type:
  • String

Methods

(private, static) _filterResponse() → {Object}

This method filters the FileMaker DAPI response by testing if a script was triggered with the request, then either selecting the response, script error, and script result from the response or selecting just the response.

Source:
Returns:
Type:
Object

a json object containing the selected data from the Data API Response.

(private, static) _isJson() → {Boolean}

This is a helper method for the _filterResponse method.

Source:
Returns:
Type:
Boolean

a boolean result if the data passed to it is json

(private, static) _namespace() → {Object}

This method filters the FileMaker DAPI response by testing if a script was triggered with the request, then either selecting the response, script error, and script result from the response or selecting just the response.

Source:
Returns:
Type:
Object

a json object containing the selected data from the Data API Response.

(private, static) _sanitizeParameters() → {Object}

stringifys all values for an object. This is used to ensure that find requests and list requests can use either strings or numbers when setting options.

Source:
Returns:
Type:
Object

returns an object with all values mapped to strings.

(private, static) _stringify(The) → {Object}

_stringify is a helper method that converts numbers and objects / arrays to strings.

Source:
Parameters:
Name Type Description
The Object | Array

data being used to create or update a record.

Returns:
Type:
Object

a json object containing stringified data.

(private, static) _toArray(data) → {Object}

_toArray is a helper method that converts an object into an array. This is used

Source:
Parameters:
Name Type Description
data Object | Array

the raw data returned from a filemaker. This can be an array or an object.

Returns:
Type:
Object

a json object containing stringified data.

(static) authenticate() → {Promise}

Checks the private connection schema for a token and if the current time is between when that token was issued and when it will expire. If the connection token is not a string (its empty) or the current time is not between when the token is issued and the time it will expire this method calls the private is returned this promise method will reject.

Source:
See:
  • {@method Connnection#generate}
Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) create(layout, data, parameters) → {Promise}

Creates a record in FileMaker. This method accepts a layout variable and a data variable.

Source:
Parameters:
Name Type Description
layout String

The layout to use when creating a record.

data Object

The data to use when creating a record.

parameters Object

The request parameters to use when creating the record.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) delete(layout, recordId) → {Promise}

Deletes a filemaker record.

Source:
Parameters:
Name Type Description
layout String

The layout to use when deleting the record.

recordId String

The FileMaker internal record ID to use when editing the record.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) edit(layout, recordId, data, parameters) → {Promise}

Edits a filemaker record.

Source:
Parameters:
Name Type Description
layout String

The layout to use when editing the record.

recordId String

The FileMaker internal record ID to use when editing the record.

data Object

The data to use when editing a record.

parameters Object

parameters to use when performing the query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) fieldData(data) → {Object}

fieldData is a helper method that strips the filemaker structural layout and portal information from a record. It returns only the data contained in the fieldData key and the recordId.

Source:
Parameters:
Name Type Description
data Object | Array

the raw data returned from a filemaker. This can be an array or an object.

Returns:
Type:
Object

a json object containing fieldData from the record.

(static) find(layout, query, parameters) → {Promise}

performs a FileMaker find.

Source:
Parameters:
Name Type Description
layout String

The layout to use when performing the find.

query Object

to use in the find request.

parameters Object

the parameters to use to modify the query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) get(layout, recordId, parameters) → {Promise}

Retrieves a filemaker record based upon the layout and recordId.

Source:
Parameters:
Name Type Description
layout String

The layout to use when retrieving the record.

recordId String

The FileMaker internal record ID to use when retrieving the record.

parameters Object

Parameters to add for the get query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) globals(data) → {Promise}

Sets global fields for the current session.

Source:
Parameters:
Name Type Description
data Object | Array

a json object containing the name value pairs to set.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) list(layout, parameters) → {Promise}

Retrieves a list of FileMaker records based upon a layout.

Source:
Parameters:
Name Type Description
layout String

The layout to use when retrieving the record.

parameters Object

the parameters to use to modify the query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) recordId(data) → {Object}

returns record ids for the data parameters passed to it. This can be an array of ids or an object. from a record. It returns only the data contained in the fieldData key adn the recordId.

Source:
Parameters:
Name Type Description
data Object | Array

the raw data returned from a filemaker. This can be an array or an object.

Returns:
Type:
Object

a json object containing fieldData from the record.

(private, static) saveState(response) → {Any}

Triggers a save and returns the response. This is responsible for ensuring the documents are up to date.

Source:
Parameters:
Name Type Description
response Any

The response data from the data api request.

Returns:
Type:
Any

Returns the umodified response.

(static) script(name, layout, parameters) → {Promise}

A public method to make triggering a script easier. This method uses the list method with a limit of 1. This is the lightest weight query possible while still allowing for a script to be triggered. For a more robust query with scripts use the find method.

Source:
Parameters:
Name Type Description
name String

The name of the script

layout String

The layout to use for the list request

parameters Object

Parameters to pass to the script

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) upload(file, layout, containerFieldName, recordId, fieldRepetition) → {Promise}

Allows you to upload a file to a FileMaker record container field. This method currently creates a record for each upload. This method will use fs to read the file at the given path to a stream. If a record Id is not passed to this method a new record will be created.

Source:
Parameters:
Name Type Description
file String

The path to the file to upload.

layout String

The layout to use when performing the find.

containerFieldName String

The field name to insert the data into. It must be a container field.

recordId Number | String

the recordId to use when uploading the file.

fieldRepetition Number

The field repetition to use when inserting into a container field. by default this is 1.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(private) _createURL(layout) → {String}

Generates a url for use when creating a record.

Source:
Parameters:
Name Type Description
layout String

The layout to use when creating a record.

Returns:
Type:
String

A URL

(private) _deleteURL(layout, recordId) → {String}

Generates a url for use when deleting a record.

Source:
Parameters:
Name Type Description
layout String

The layout to use when creating a record.

recordId String

The FileMaker internal record id to use.

Returns:
Type:
String

A URL

(private) _findURL(layout) → {String}

Generates a url for use when performing a find request.

Source:
Parameters:
Name Type Description
layout String

The layout to use when listing records.

Returns:
Type:
String

A URL

(private) _getURL(layout, recordId) → {String}

Generates a url to access a record.

Source:
Parameters:
Name Type Description
layout String

The layout to use when acessing a record.

recordId String

The FileMaker internal record id to use.

Returns:
Type:
String

A URL

(private) _globalsURL(layout) → {String}

Generates a url for use when setting globals.

Source:
Parameters:
Name Type Description
layout String

The layout to use when setting globals.

Returns:
Type:
String

A URL

(private) _listURL(layout) → {String}

Generates a url for use when listing records.

Source:
Parameters:
Name Type Description
layout String

The layout to use when listing records.

Returns:
Type:
String

A URL

(private) _updateURL(layout, recordId) → {String}

Generates a url for use when updating a record.

Source:
Parameters:
Name Type Description
layout String

The layout to use when updating a record.

recordId String

The FileMaker internal record id to use.

Returns:
Type:
String

A URL

(private) _uploadURL(layout, recordId, fieldName, fieldRepetition) → {String}

Generates a url for use when uploading files to FileMaker containers.

Source:
Parameters:
Name Type Default Description
layout String

The layout to use when setting globals.

recordId String

the record id to use when inserting the file.

fieldName String

the field to use when inserting a file.

fieldRepetition String 1

The repetition to use when inserting the file. default is 1.

Returns:
Type:
String

A URL

preInit() → {null}

preInit is a hook

Source:
Returns:
Type:
null

The preInit hook does not return anything