@syncmatters/connector-sdk 1.0.42 → 1.0.44

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.
@@ -224,11 +224,26 @@ sees the resulting token via `args.oauth2Provider` — see
224
224
  `redirect_uri` (the platform's OAuth callback), `authorize_uri`, `authorize_params`,
225
225
  `token_uri`, `refresh_uri`, `introspect_uri`, `authorized_domains`. URIs may template settings,
226
226
  e.g. `https://{acme_domain}/oauth2/authorize`. An optional `scope_groups` array drives the
227
- consent UI: items carry `label` plus `read`/`write`/`delete`/`full` cells (the Read, Write,
228
- Delete and Full columns) and optional `read_mandatory`/`write_mandatory`/`delete_mandatory`/
229
- `full_mandatory: true` flags. A cell may list several scopes separated by spaces
230
- (`"write": "acme:create acme:update"`), never commas. The Delete column only shows when some item
231
- sets `delete`.
227
+ consent UI: items carry `label` plus `read`/`write`/`fields`/`delete`/`full` cells (the Read,
228
+ Write, Fields, Delete and Full columns) and optional `read_mandatory`/`write_mandatory`/
229
+ `fields_mandatory`/`delete_mandatory`/`full_mandatory: true` flags. `fields` holds the scopes that
230
+ create and delete fields (properties) on the row's object. A cell may list several scopes
231
+ separated by spaces (`"write": "acme:create acme:update"`), never commas. The Fields and Delete
232
+ columns only show when some item sets `fields` or `delete` respectively.
233
+
234
+ An optional `scope_replacements` array, beside `scope_groups`, retires old scope names:
235
+
236
+ ```json
237
+ "scope_replacements": [{ "legacy": "old-scope", "replaced_by": ["new.scope.read", "new.scope.write"] }]
238
+ ```
239
+
240
+ Wherever a connection's selected scopes or `default_scopes` name `legacy`, the `replaced_by`
241
+ scopes are requested instead and `legacy` is not; the entry is the whole switch. Names match
242
+ exactly, before any `{setting}` token in a scope is substituted. Saving refuses an empty `legacy`
243
+ or `replaced_by`, a duplicate `legacy`, a `legacy` that appears in any scope-group cell, and a
244
+ `replaced_by` scope that is itself a `legacy` (no chains). A connection authorised earlier keeps
245
+ its token until it is next authorised; its picker shows the replacement scopes ticked and saves
246
+ the new names on Apply.
232
247
 
233
248
  ## Connector overrides
234
249
 
@@ -260,7 +275,8 @@ publishing happens in the web UI as for any connector.
260
275
 
261
276
  Merge rules: a key present overrides the source, absent inherits, `null` clears; `settings` merge
262
277
  per setting id and, inside a setting, per attribute; arrays (`default_objects`, `scope_groups`,
263
- `categories`) replace whole. A setting's contract with the code (`type`, `control`, `options`,
278
+ `categories`) replace whole; `scope_replacements` always comes from the source and a child cannot
279
+ set it. A setting's contract with the code (`type`, `control`, `options`,
264
280
  `template`, `secret`, `readonly`, `staticonly`, `connector_managed`,
265
281
  `defines_version`, `prerequisite`, `affects_meta`) cannot be overridden (`mandatory` can, either
266
282
  way, except on a setting the source marks `connector_managed`), a child may only touch
@@ -347,9 +347,9 @@ Declaring it on the wrong object doesn't fail here — it fails later, when
347
347
  ## Creating and deleting fields: `upsertFields()` and `deleteFields()`
348
348
 
349
349
  An object may describe a form for creating a field on it in the connected system
350
- (`upsertFieldsMeta`). Users reach it from the mapping screen ("Create field"), and templates and
351
- installs use it to create the fields they map to. The form's presence on an object is the
352
- capability. An object may also allow its fields to be deleted (`canDeleteFields: true`); only
350
+ (`upsertFieldsMeta`). Users reach it from the mapping screen ("Create field" for one field,
351
+ "Create fields from source fields" for several), and scripts call it. The form's presence on an
352
+ object is the capability. An object may also allow its fields to be deleted (`canDeleteFields: true`); only
353
353
  scripts call `deleteFields`: the UI does not, and the connector test harness checks only that
354
354
  `canDeleteFields` matches the test spec.
355
355
 
@@ -368,7 +368,7 @@ Two methods touch field definitions and they do different jobs:
368
368
 
369
369
  | | `upsertFieldOptions()` | `upsertFields()` |
370
370
  | ------- | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
371
- | Called | during a sync run, driven by row values | at design time, by a person, a template apply or an install |
371
+ | Called | during a sync run, driven by row values | at design time, by a person on the mapping screen or by a script |
372
372
  | Does | merges option values into an existing picklist field; options already there are fine | creates a field from the form's values, or updates its definition where `update` is listed; an add of an existing field is an error |
373
373
  | Returns | the resolved id of each option, which the run needs to write the row | the field's id, and its path when it is not a top-level field |
374
374
 
@@ -483,9 +483,10 @@ input, its name), so you receive each field once. Where the system assigns keys
483
483
  fields with the same name, the platform refreshes the object and refuses an add whose name is
484
484
  already there.
485
485
 
486
- **Do not check for an existing field yourself.** The platform checks cached metadata before the
487
- call. An add the system still rejects as a duplicate comes back as a row error with code
488
- `"already_exists"`, and the platform refreshes the object.
486
+ **Do not check for an existing field yourself.** The mapping screen refuses a key that is already
487
+ in cached metadata before it calls you. A script's call is not checked against the cache, so a
488
+ duplicate key reaches your method and the system rejects it. Report an add the system rejects as a
489
+ duplicate as a row error with code `"already_exists"`; the platform then refreshes the object.
489
490
 
490
491
  ```js
491
492
  async upsertFields({ log, id, meta, objectMeta, rows }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncmatters/connector-sdk",
3
- "version": "1.0.42",
3
+ "version": "1.0.44",
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,7 +12,7 @@
12
12
  "license": "MIT",
13
13
  "author": "SyncMatters",
14
14
  "homepage": "https://syncmatters.com",
15
- "typesContentHash": "0d29d38f3a11e36c7a03864f8034183d1a15c68fe66facf5b8404f0e829915ca",
15
+ "typesContentHash": "79b191c22a5a3bde8d16df135ddc5db08977a9d47afa877e5a058a019c7f81a1",
16
16
  "dependencies": {
17
17
  "@types/node": "*",
18
18
  "@syncmatters/script-api": "^1.0.46"