@syncmatters/connector-sdk 1.0.41 → 1.0.42

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.
@@ -408,8 +408,8 @@ upsertFieldsMeta: {
408
408
 
409
409
  A form has at most one key input (`isUserKey` or `isKey`, never both), at most one name input,
410
410
  and at least one of the two. The platform drops a form that breaks this rule, has an input
411
- without a `type`, or has an unusable `generateFromSetting` / `generateFromMode` (below), and logs
412
- why; the connector test harness flags it.
411
+ without a `type`, or has an unusable `generateFromSetting` / `generateFromMode` or copy preset
412
+ (below), and logs why; the connector test harness flags it.
413
413
 
414
414
  - **`option_array`** holds a picklist's options as `[{ id?, name }]`, in option order. An omitted
415
415
  `id` means the name: apply that when you create the options. Set `userOptionIds: true` only where
@@ -425,6 +425,42 @@ upsertFieldsMeta: {
425
425
  setting) may carry them, and on a create-field form anything else drops the form.
426
426
  - **Presets** are prefilled rows. `external_id` is the well-known one: the UI offers it as "Id of
427
427
  the <other system> record".
428
+ - **Copy presets** (`copyPresets`) prefill a new field from the field being copied, such as when a
429
+ user creates several destination fields from source fields on the mapping screen. Each entry is
430
+ a set of conditions on the copied field plus the form `values` to start from:
431
+
432
+ ```js
433
+ upsertFieldsMeta: {
434
+ // ... operations, fields, presets as above
435
+ copyPresets: [
436
+ { matchPortableType: "picklist:multi", values: { fieldType: "multiselect" } },
437
+ { matchType: "boolean", values: { fieldType: "checkbox" } },
438
+ { matchType: "string", matchHasOptions: true, matchMultiple: true, values: { fieldType: "multiselect" } },
439
+ { matchType: "string", matchHasOptions: true, values: { fieldType: "select" } },
440
+ { matchType: "date", values: { fieldType: "date" } },
441
+ { matchType: "datetime", values: { fieldType: "datetime" } },
442
+ { matchType: "number", values: { fieldType: "number" } },
443
+ { values: { fieldType: "text" } }, // catch-all, last
444
+ ],
445
+ }
446
+ ```
447
+
448
+ - **First match wins**: the UI uses the first entry whose conditions all hold. An absent
449
+ condition is not tested, so an entry with none matches every field: put one last as the
450
+ catch-all.
451
+ - **`matchPortableType`** compares the copied field's `portableType`, and holds only when the
452
+ copied field comes from the same connector or a child of the same parent: the string means
453
+ nothing to another connector, and a field without `portableType` never matches. List these
454
+ entries first.
455
+ - **`matchType`** is derived by the platform from the copied field, since field meta has no date
456
+ type: `"string"`, `"number"`, `"boolean"`, or `"date"` / `"datetime"` for a string with
457
+ date/time constraints (`dateOnly` decides which). An array is read by its element type, with
458
+ `matchMultiple: true`.
459
+ - **`matchHasOptions`** / **`matchMultiple`**: the copied field has option values / holds an
460
+ array. `false` is a condition too (no options, a single value).
461
+ - Every id in `values` must be an input of the form, and `matchType` a known type, or the platform
462
+ drops the form.
463
+
428
464
  - **Advertise the form only where the connection may use it.** Set `upsertFieldsMeta` (and
429
465
  `canDeleteFields`) on an object only when your connector implements `upsertFields()` (and
430
466
  `deleteFields()`) and the connection's grant lets it change that object's fields, as you would hide
package/module.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * SDK specific elements that would be of no interest to users of the API.
4
4
  */
5
5
  export { EventScriptComplete, defaultRedactKeys } from "@syncmatters/script-api";
6
- export type { Cache, FileProvider, HttpRequest, HttpClientOptions, Redactor, RedactorOptions, KvCollection, KvIterator, Logger, EventContext, TestResult, Row, ObjectMeta, ObjectField, ObjectFieldOption, RateLimiterOptions, ScriptType, JsonValuePath, JsonValuePathPart, QueryMatchFilter, QueryCheckpointFilter, EventTypeMeta, ObjectIndex, ObjectMetaUpsert, ObjectRowFilter, ObjectRelationship, ObjectFieldConstraints, FormInput, FormInputOption, ObjectSettingMeta, UpsertFieldsMeta, UpsertFieldInputMeta, UpsertFieldOperation, UpsertFieldPreset, UpsertFieldRow, UpsertFieldOption, UpsertFieldResult, DeleteFieldRow, DeleteFieldResult, ObjectUnavailableReason, DiscoverResult, DiscoveredObject, MetaState, MetaStateObject, UpsertIssue, UpsertFieldOptionMeta, RowMatchRuleType, ObjectSemanticType, RowMatchData, RowMatchRuleOrder, SyncSession, SyncOptimalBatchSizeOperation, SyncOptimalBatchSizeBatchType, } from "@syncmatters/script-api";
6
+ export type { Cache, FileProvider, HttpRequest, HttpClientOptions, Redactor, RedactorOptions, KvCollection, KvIterator, Logger, EventContext, TestResult, Row, ObjectMeta, ObjectField, ObjectFieldOption, RateLimiterOptions, ScriptType, JsonValuePath, JsonValuePathPart, QueryMatchFilter, QueryCheckpointFilter, EventTypeMeta, ObjectIndex, ObjectMetaUpsert, ObjectRowFilter, ObjectRelationship, ObjectFieldConstraints, FormInput, FormInputOption, ObjectSettingMeta, UpsertFieldsMeta, UpsertFieldInputMeta, UpsertFieldOperation, UpsertFieldPreset, UpsertFieldCopyPreset, UpsertFieldRow, UpsertFieldOption, UpsertFieldResult, DeleteFieldRow, DeleteFieldResult, ObjectUnavailableReason, DiscoverResult, DiscoveredObject, MetaState, MetaStateObject, UpsertIssue, UpsertFieldOptionMeta, RowMatchRuleType, ObjectSemanticType, RowMatchData, RowMatchRuleOrder, SyncSession, SyncOptimalBatchSizeOperation, SyncOptimalBatchSizeBatchType, } from "@syncmatters/script-api";
7
7
  export * from "./lib/connector.js";
8
8
  export * from "./lib/connector-error.js";
9
9
  export { envSet } from "./lib/environment.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncmatters/connector-sdk",
3
- "version": "1.0.41",
3
+ "version": "1.0.42",
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": "a560ef075fb4d6cf2fdb83690dbc1d3e2374b4abdf88aa4ff81fee6d0fc56bd1",
15
+ "typesContentHash": "0d29d38f3a11e36c7a03864f8034183d1a15c68fe66facf5b8404f0e829915ca",
16
16
  "dependencies": {
17
17
  "@types/node": "*",
18
- "@syncmatters/script-api": "^1.0.45"
18
+ "@syncmatters/script-api": "^1.0.46"
19
19
  }
20
20
  }