Skip to content

fmodata: support alternate-key record lookup like table(ROWID=2) #213

@eluce2

Description

@eluce2

Summary

@proofkit/fmodata cannot express valid FileMaker OData alternate-key record lookups like:

/customersTO(ROWID=2)

This is a problem because FileMaker OData supports fetching records by ROWID even when the table has another primary key, and this is a strong generic hydrate path for sparse webhook payloads (ROWID, ROWMODID).

What works in raw OData

Against a table with a primary key (customersTO), this works:

GET /fmi/odata/v4/Foxtail_Demo/customersTO(ROWID=2)?$select=ROWID,nameFirst,nameLast

I verified this both:

  • direct against FileMaker OData
  • through Otto proxy

This does not require ROWID to be the table's primary key.

What fmodata does today

Using @proofkit/fmodata@0.1.0-beta.38:

const builder = db.from(customersTO).get(2)

emits:

/Foxtail_Demo/customersTO('2')?... 

Using:

const builder = db.from(customersTO).get('ROWID=2')

emits:

/Foxtail_Demo/customersTO('ROWID=2')?... 

which is not valid alternate-key syntax.

Runtime repro

const builder = db
  .from(customersTO)
  .get('ROWID=2')
  .select({ id: customersTO.id, nameFirst: customersTO.nameFirst }, { ROWID: true })

console.log(builder.getRequestConfig())

Current output:

{
  "method": "GET",
  "url": "/Foxtail_Demo/customersTO('ROWID=2')?$select=\"id\",nameFirst,ROWID"
}

Source location

The current URL builder hardcodes record URLs as:

/${databaseName}/${tableId}('${recordId}')

in:

  • src/client/query/url-builder.ts
  • src/client/record-builder.ts

So there is no way to express:

/tableName(ROWID=2)

Requested support

One of:

  1. Add first-class alternate-key record lookup, e.g.
db.from(customersTO).getByKey({ ROWID: 2 })

or

db.from(customersTO).getByAlternateKey('ROWID', 2)
  1. Or extend .get(...) to accept a typed alternate-key object.

Why this matters

For webhook-driven sync, a very good FileMaker pattern is:

  • webhook payload only includes ROWID,ROWMODID
  • backend hydrates latest row via /tableName(ROWID=<n>)
  • dedupe on (table, ROWID, ROWMODID)

Without alternate-key lookup support, fmodata cannot implement that cleanly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions