@syncmatters/connector-sdk 1.0.43 → 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.
|
@@ -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"
|
|
351
|
-
|
|
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
|
|
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
|
|
487
|
-
|
|
488
|
-
|
|
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.
|
|
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": "
|
|
15
|
+
"typesContentHash": "79b191c22a5a3bde8d16df135ddc5db08977a9d47afa877e5a058a019c7f81a1",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@types/node": "*",
|
|
18
18
|
"@syncmatters/script-api": "^1.0.46"
|