npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fms-xml-client

v3.1.2

Published

FileMaker Server XML Gateway JS Client

Downloads

16

Readme

fms-xml-client

A Promise based FileMaker Server XML gateway client for node.js. note! Because of CORS issues with FileMaker server this is only useful in node. It will not work in the browser.

Fast XML Parser

Starting with version 3.1.0 we use fast-xml-parser instead of xml2js to parse the XML

Version 3 Makes the simple client the default

if you need the old request object api it is still available as an additional export

const request = require('fas-xml-client').request

Usage

Version 3 and greater.

Using the provided factory functions you create a Layout Object, for the layout you want to target. The Layout Object has a bunch of usefule methods for find, updates, etc. See API below for details.

// get as server factory function
const fms = require('fms-xml-client');

//config options
const options = {    
    server : "<serverURL>",
    auth : {
        user : "admin"
        pass : "pass"
    }
}

//use it to create a server object
const server = fms(options);

//get a DB object
const db = server.db("Test");

//finally get a Layout Object
const People = db.layout("people")

// query can use all the xml gateway options for finding.
// finds all the records where the firstName contains 'joe'

const query = ({firstName : 'joe', "firstName.op" : 'cn' })
People.find(query).then(resultset=>{
    //do stuff
})

// See API below for each method available to a Layout Object

Layout Object API

Each method can take two optional parameters

  • additionalCommands - xml gateway commands to add to the request. Useful for things like adding sorts, running scripts, max and skip etc.
  • auth - lets you change the auth for just this command

Everything returns a Promise. If you care what flavor, we use bluebird Promise.

find

find records using a query People.find(query, additionalCommands, auth)

findAll

find all the records People.findAll(addtionalCommands, auth)

save

Save a record to the db. it will create it if it doesn't exist. People.save(data, additionalCommands, auth)

update

update the first record found with the query People.update(query, data, additionalCommands, auth)

upset

update or the first record found with the query, or insert it if it doesn't exist People.upsert(query, data, additionalCommands, auth)

delete

delete the first record found by the query People.delete(query, additionalCommands, auth)

delete the first record found by the query People.delete(query, additionalCommands, auth)

All off the FileMaker XML Gateway command and parameters are supported in the command object.

All of the query commands are documented in the FileMaker® Server 15 Custom Web Publishing Guide starting on paging 37.

Using The Raw Request Object

const request = require('fms-xml-client').request;
const options = {    
    server : "<serverURL>",
    auth : {
        user : "admin"
        pass : "pass"
    },
    command : {
      '-db' : 'Test',
      '-findall' : true,
      '-lay' : 'people'
    }
}

// make the request
request(options)
    .then(json=>{
        // do stuff with son
    })
    .catch(err=>{
        // do stuff with error
    })

Running the Test

You'll need to put the Test.fmp12 file on a FileMaker Server.

We use dotenv for setting the required ENV variables. You can see the required vars in test/required.en. Copy the file to test/.env and set the vars correctly.

.env is never committed to git

finally run npm test