@syncmatters/connector-sdk 1.0.32 → 1.0.34

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.
@@ -260,8 +260,9 @@ publishing happens in the web UI as for any connector.
260
260
  Merge rules: a key present overrides the source, absent inherits, `null` clears; `settings` merge
261
261
  per setting id and, inside a setting, per attribute; arrays (`default_objects`, `scope_groups`,
262
262
  `categories`) replace whole. A setting's contract with the code (`type`, `control`, `options`,
263
- `template`, `secret`, `readonly`, `staticonly`, `connector_managed`, `mandatory`,
264
- `defines_version`, `prerequisite`, `affects_meta`) cannot be overridden, a child may only touch
263
+ `template`, `secret`, `readonly`, `staticonly`, `connector_managed`,
264
+ `defines_version`, `prerequisite`, `affects_meta`) cannot be overridden (`mandatory` can, either
265
+ way, except on a setting the source marks `connector_managed`), a child may only touch
265
266
  settings the source declares, and the source must be a published, non-deprecated connector that
266
267
  is not itself derived (one level only). A source sidecar may opt out with `"overrides": false`
267
268
  beside `connector_metadata`. A child never inherits a secret: the source's OAuth client id and
@@ -141,7 +141,7 @@ same as "no list support". See [the query capability bar](#the-query-capability-
141
141
  | `canUpdateOptions: true` | new picklist options may be added via `upsertFieldOptions()` |
142
142
  | `objectFields` | child fields when `type: "object"` |
143
143
  | `arrayType` / `arrayObjectFields` | element type / element fields when `type: "array"` |
144
- | `constraints` | validation: `mandatory` (`"always"` · `"add"` · `"update"`; array children only when parent array is non-empty), `max/min/maxLen/minLen`, `regex`, `email`, `integer`, `decimals`, `trim`, `dt: { format: "iso8601", "unix", ... }` |
144
+ | `constraints` | validation: `mandatory` (`"always"` · `"add"` · `"update"`; array children only when parent array is non-empty), `max/min/maxLen/minLen`, `regex`, `email`, `integer`, `decimals`, `trim`, `dt: { format: "iso8601", "unix", ..., tz?, dateOnly? }` (see [Date fields](#date-fields-dt)) |
145
145
  | `isCustom` | the field, and everything below it, is account-specific: a field the account created, or a vendor field with no meaning of its own that only holds an attribute each account defines (a user-defined-value slot, a generic custom-field array, `Custom1..N`). Put it on the container, not only on its leaves. A tenant-defined picklist or a notes field is not custom: the vendor defines what it holds. See below |
146
146
  | `data` | connector-private payload, echoed back in metadata |
147
147
 
@@ -301,6 +301,41 @@ Deduplicate anything the API can duplicate (e.g. `[...new Set(referenceTo)]`) an
301
301
  capability flags from evidence, not optimism — e.g. `canQueryByCheckpoint` only when a
302
302
  last-modified filter actually exists on that object.
303
303
 
304
+ ## Date fields (`dt`)
305
+
306
+ `constraints.dt` says how a date field's values are written, so the sync's automatic date
307
+ conversion, filters, `verifyFieldConstraints` and the connector test harness can read and write
308
+ them:
309
+
310
+ - `format`: `unix`, `unix_ms`, `iso8601`, `yyyy-MM-dd`, `M/d/yyyy`, `dd/MM/yyyy`,
311
+ `yyyy-MM-dd HH:mm:ss`, `yyyy-MM-dd'T'HH:mm:ss` (ISO date and time, no offset, no fractional
312
+ seconds: `2026-10-05T01:11:21`), or `custom` with a Luxon `pattern`.
313
+ - `tz`: the IANA zone (`"America/New_York"`, `"UTC"`) of the field's **zone-less** values. Text
314
+ with no offset is wall-clock time in `tz`, and values written to the field are rendered as
315
+ wall-clock time in `tz`; a value that carries its own offset or `Z` keeps it. It describes the
316
+ value, so declare it on query fields as well as upsert fields. Absent means unknown: there is
317
+ no default and nothing is inherited from the connection or object. When the API's zone is a
318
+ connection setting (RentManager's `time_zone`, see [05](./05-query.md#time-zones)), **stamp it
319
+ into `dt.tz` from that setting when you build `meta()`**.
320
+ - `dateOnly: true`: the field holds a calendar date even though its format is an instant format
321
+ (old HubSpot date properties are `unix_ms` at midnight UTC; many APIs send
322
+ `2026-10-05T00:00:00Z`).
323
+
324
+ What the field holds is decided from the declared format, never from a value:
325
+
326
+ | Kind | Formats | `tz` |
327
+ | ---- | ------- | ---- |
328
+ | instant | `unix`, `unix_ms`, `iso8601`, `yyyy-MM-dd HH:mm:ss`, `yyyy-MM-dd'T'HH:mm:ss`, patterns with date and time tokens | used (`unix`/`unix_ms` ignore it: an epoch is absolute) |
329
+ | date | `yyyy-MM-dd`, `M/d/yyyy`, `dd/MM/yyyy`, patterns with only date tokens (quoted literals and digits ignored, so `yyyy-MM-dd'T'00:00:00` is a date), or `dateOnly: true` | ignored, except for `dateOnly` in an instant format: the zone whose midnight encodes the day (UTC when absent) |
330
+ | time | patterns with only time tokens (`HH:mm`) | ignored |
331
+
332
+ Dates convert by calendar day, never by instant: date to date copies the day; date to instant
333
+ writes midnight wall-clock in the destination's `tz` (UTC when absent); an instant from a source
334
+ that declares `tz` lands on a date destination as its day in that zone (23:00 New York on the
335
+ 30th is the 30th), otherwise as its UTC day. Writing to a `dateOnly` field always produces an exact
336
+ midnight. DST gaps and repeated hours follow Luxon: a wall-clock time inside a spring-forward gap
337
+ moves forward by the gap, and a repeated hour resolves to the standard-time (later) instant.
338
+
304
339
  ## How `constraints` are enforced (what `verifyFieldConstraints` does)
305
340
 
306
341
  `upsertClean`'s `verifyFieldConstraints` (06) doesn't just report — several constraints
@@ -311,8 +346,12 @@ last-modified filter actually exists on that object.
311
346
  - `integer` / `decimals`: `Number(v)` then `Math.round` / `toFixed(decimals)`.
312
347
  - `email`: removed when malformed or the TLD is unknown.
313
348
  - `trim`: whitespace-trimmed.
314
- - `dt`: validated/normalized per `format` (`unix`, `unix_ms`, `iso8601`, `yyyy-MM-dd`, ...,
315
- or `custom` + `pattern`), plus `future`/`past`/`weekday`/`from`/`to`/`rangeYears` checks.
349
+ - `dt`: **validated only, never rewritten**. A value that does not parse per `format` (`unix`,
350
+ `unix_ms`, `iso8601`, `yyyy-MM-dd`, ..., or `custom` + `pattern`) is removed with a
351
+ `DateTimeFormat` issue; then `future`/`past`/`weekday`/`from`/`to`/`rangeYears` are checked.
352
+ Zone-less text is read in the field's `dt.tz` when it declares one, else in the
353
+ `verifyFieldConstraints({ timeZone })` argument, else UTC; an unrecognised `dt.tz` throws,
354
+ naming the field.
316
355
  - `mandatory` (`"always" | "add" | "update"`) raises a `ValueRequired` issue — and
317
356
  `mandatoryAccepts: ["null" | "blank_string"]` lets a mandatory field treat `null`/`""` as a
318
357
  satisfying value (for APIs where "explicitly blank" is meaningful).
package/docs/05-query.md CHANGED
@@ -174,6 +174,13 @@ const localSince = SDK.utilities.dateTransform({
174
174
  });
175
175
  ```
176
176
 
177
+ Values the API returns in that zone are zone-less too (`2026-10-30T08:44:02`). Tell the platform by
178
+ stamping the zone into each such field's `constraints.dt.tz` when you build `meta()` (e.g.
179
+ `dt: { format: "yyyy-MM-dd'T'HH:mm:ss", tz: this.#timeZone }`), so sync date conversion, filters,
180
+ `verifyFieldConstraints` and the test harness read them as instants instead of guessing UTC. See
181
+ [04](./04-meta-objects-fields.md#date-fields-dt). `tz` describes values only; your checkpoint
182
+ filter conversion above stays yours.
183
+
177
184
  `dateTransform` also carries `inputTimeZone` (parse a zone-less API timestamp as wall clock),
178
185
  `dateTimeMath` (the overlap subtraction: `[{ count: -5, interval: "minutes" }]`) and
179
186
  truncation; `dateFormat(date, { format, tz })` is the light variant for rendering a `Date`.
@@ -110,6 +110,10 @@ async upsertClean(options) {
110
110
  fleet does, without exception.
111
111
  - `verifyFieldConstraints` enforces your `ObjectField.constraints` (including `mandatory` on
112
112
  array item fields — only when the parent array is non-empty; see [04](./04-meta-objects-fields.md)).
113
+ Its `timeZone` argument is the zone for zone-less date text in fields that do not declare
114
+ `constraints.dt.tz`; a field's own `dt.tz` wins over it (date-only, time-only and epoch fields
115
+ ignore `dt.tz` and keep using the argument). A `dateOnly` field in an instant format reads its day
116
+ in its own `dt.tz`, or UTC when it has none, never in the argument.
113
117
  - Issues are `{ type, fatal?, fieldPath?, value?, option? }`; `fatal: true` blocks the row.
114
118
  - Returning `hasChanges` with no fatal issues queues the row; the platform batches queued rows
115
119
  and calls your `upsert()` with them later (clean order = write order; `upsertClean` calls
@@ -209,9 +209,12 @@ Each assertion is one of:
209
209
  structurally (key order ignored, element order kept).
210
210
  - A date: a field with `constraints.dt`, or a `format` naming a date (`date`, `date-time`,
211
211
  `datetime`, `iso8601`, `unix`, `unix_ms`, a `yyyy-MM-dd`-style pattern), compares as an
212
- instant at the precision its format implies: days for date-only formats, seconds for
213
- `unix` and `yyyy-MM-dd HH:mm:ss`, milliseconds otherwise. So `"2026-09-27T10:00:00+02:00"`
214
- equals `"2026-09-27T08:00:00Z"`.
212
+ instant at the precision its format implies: days for date-only formats (including custom
213
+ patterns with only date tokens and `dt.dateOnly`), seconds for `unix`, `yyyy-MM-dd HH:mm:ss` and
214
+ `yyyy-MM-dd'T'HH:mm:ss`, milliseconds otherwise. So `"2026-09-27T10:00:00+02:00"` equals
215
+ `"2026-09-27T08:00:00Z"`. Zone-less text in a field with `constraints.dt.tz` is read in that
216
+ zone (an explicit offset still wins); a `dateOnly` field in an instant format compares the day it
217
+ encodes; an unrecognised `dt.tz` fails the assertion, saying so.
215
218
  - A path with no declared field compares structurally.
216
219
 
217
220
  The details say which comparison each assertion used (`number`, `instant (seconds)`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncmatters/connector-sdk",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "TypeScript type definitions for the SyncMatters connector SDK (types only - connectors execute on the SyncMatters platform)",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -12,9 +12,9 @@
12
12
  "license": "MIT",
13
13
  "author": "SyncMatters",
14
14
  "homepage": "https://syncmatters.com",
15
- "typesContentHash": "8f33da0577fafd35ce34e6334b774a5a2ce75365411fc731cacedae9bf822e87",
15
+ "typesContentHash": "17cd06537fafbbd520f5c69d01657aee664d22fdf18ab5541214b59336e2c73b",
16
16
  "dependencies": {
17
17
  "@types/node": "*",
18
- "@syncmatters/script-api": "^1.0.36"
18
+ "@syncmatters/script-api": "^1.0.37"
19
19
  }
20
20
  }