@syncmatters/connector-sdk 1.0.31 → 1.0.33
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.
|
@@ -231,8 +231,9 @@ sets `delete`.
|
|
|
231
231
|
|
|
232
232
|
## Connector overrides
|
|
233
233
|
|
|
234
|
-
A
|
|
235
|
-
an on-premise edition) without copying the code. The variant is a
|
|
234
|
+
A variant of an existing connector (its own OAuth app, a sandbox with other URLs and credentials,
|
|
235
|
+
different defaults, an on-premise edition) is made without copying the code. The variant is a
|
|
236
|
+
`connector_overrides` file:
|
|
236
237
|
`files/Connectors/<Name>/<Name>.json` (contents `{}`) with a connector sidecar whose
|
|
237
238
|
`connector_metadata` is **sparse** and names the source bundle. The CLI writes the pair with
|
|
238
239
|
`sm connector overrides init <Name> --source <connector>`; `sm files push` creates it, and
|
|
@@ -249,7 +250,7 @@ publishing happens in the web UI as for any connector.
|
|
|
249
250
|
"agent_mode": "always",
|
|
250
251
|
"default_objects": ["Contacts", "Companies"],
|
|
251
252
|
"settings": {
|
|
252
|
-
"
|
|
253
|
+
"event_types_include": { "default": { "type": "string", "expression": "deal,contact.creation" } },
|
|
253
254
|
"url": { "hidden": true, "default": { "type": "string", "expression": "https://..." } }
|
|
254
255
|
}
|
|
255
256
|
}
|
|
@@ -263,7 +264,11 @@ per setting id and, inside a setting, per attribute; arrays (`default_objects`,
|
|
|
263
264
|
`defines_version`, `prerequisite`, `affects_meta`) cannot be overridden, a child may only touch
|
|
264
265
|
settings the source declares, and the source must be a published, non-deprecated connector that
|
|
265
266
|
is not itself derived (one level only). A source sidecar may opt out with `"overrides": false`
|
|
266
|
-
beside `connector_metadata`.
|
|
267
|
+
beside `connector_metadata`. A child never inherits a secret: the source's OAuth client id and
|
|
268
|
+
secret and the default of every secret setting are dropped from the merged view, so a child whose
|
|
269
|
+
`oauth2_mode` is `"connector"` carries its own `client_id` and `client_secret` (publishing is
|
|
270
|
+
refused without them) and sets its own value for any secret setting it needs. The child's own
|
|
271
|
+
secrets round-trip as for any connector: after the first push the
|
|
267
272
|
platform withholds `client_secret` and a secret setting's default, and pushing the sidecar back
|
|
268
273
|
without them keeps the stored values. `sm pull` returns the sparse document, never the merged one;
|
|
269
274
|
`sm connector overrides show <Name>` prints the merged view with each key tagged inherited or
|
|
@@ -272,8 +277,18 @@ need the source).
|
|
|
272
277
|
|
|
273
278
|
The connector code is unchanged and never sees the difference: `args.connectorMetadata`, the
|
|
274
279
|
settings form, `discover()` pre-selection (`default_objects`) and the OAuth token all come from the
|
|
275
|
-
merged document at run time.
|
|
276
|
-
|
|
280
|
+
merged document at run time. Each time the source is published the child picks up the new code and
|
|
281
|
+
settings with no publish of its own; an override for a setting the source has since removed is
|
|
282
|
+
ignored and reported as a warning on the file. Publish the child only after changing its overrides.
|
|
283
|
+
|
|
284
|
+
In the account that owns it, a child can be used before it is published: it is offered in the
|
|
285
|
+
connection picker beside the account's other unpublished connectors, and a connection made that way
|
|
286
|
+
runs the source's latest published code with the child's current overrides. A connector test runs
|
|
287
|
+
on such a connection from the web UI, with test modules taken from the child's own folder. The CLI's
|
|
288
|
+
`sm connector test` and `sm connector features` take a connector file, not a child: point them at
|
|
289
|
+
the source. Feature generation belongs to the source in the web UI too. Field types are shared with
|
|
290
|
+
the source: classifying them through the child's connection fills the source's catalog, when the
|
|
291
|
+
source is published from the same account.
|
|
277
292
|
|
|
278
293
|
## Do not edit
|
|
279
294
|
|
|
@@ -148,7 +148,10 @@ Also available: `oauth2Provider.scope` (granted scopes — normalize with
|
|
|
148
148
|
|
|
149
149
|
`oauth2_mode` in the sidecar decides who owns the OAuth app: `"connector"` (one shared app) or
|
|
150
150
|
`"connection"` (each connection brings its own client id/secret) — see
|
|
151
|
-
[01-workspace-and-meta-json.md](./01-workspace-and-meta-json.md).
|
|
151
|
+
[01-workspace-and-meta-json.md](./01-workspace-and-meta-json.md). In `"connector"` mode the client
|
|
152
|
+
id and secret may be those of a derived connector (a
|
|
153
|
+
[connector overrides](./01-workspace-and-meta-json.md#connector-overrides) file) rather than this
|
|
154
|
+
sidecar's; the code sees no difference.
|
|
152
155
|
|
|
153
156
|
### Self-managed auth (when the managed OAuth2 provider doesn't fit)
|
|
154
157
|
|
|
@@ -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
|
|
315
|
-
or `custom` + `pattern`)
|
|
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`.
|
package/docs/06-upsert-delete.md
CHANGED
|
@@ -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
|
package/docs/09-testing.md
CHANGED
|
@@ -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
|
|
213
|
-
`
|
|
214
|
-
|
|
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.
|
|
3
|
+
"version": "1.0.33",
|
|
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": "
|
|
15
|
+
"typesContentHash": "525bcc40b9d3b894b0e4501d4bf962b15091f5d6cbf907cf12f8f0f78c5eba2f",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@types/node": "*",
|
|
18
|
-
"@syncmatters/script-api": "^1.0.
|
|
18
|
+
"@syncmatters/script-api": "^1.0.37"
|
|
19
19
|
}
|
|
20
20
|
}
|