@syncmatters/script-api 1.0.45 → 1.0.46
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.
- package/lib/connection.d.ts +31 -2
- package/package.json +2 -2
package/lib/connection.d.ts
CHANGED
|
@@ -414,8 +414,9 @@ export type UpsertFieldOperation = "add" | "update";
|
|
|
414
414
|
/**
|
|
415
415
|
* UpsertFieldsMeta describes an object's create-field form. A form has at most one key input (flagged `isUserKey` or
|
|
416
416
|
* `isKey`, never both), at most one name input (flagged `isName`), and at least one of the two. An input's
|
|
417
|
-
* `generateFromSetting` and `generateFromMode` are set together, name another input of the form and a known mode.
|
|
418
|
-
*
|
|
417
|
+
* `generateFromSetting` and `generateFromMode` are set together, name another input of the form and a known mode. A
|
|
418
|
+
* copy preset's `values` is an object whose ids are all inputs of the form, and its `matchType`, when set, is a known
|
|
419
|
+
* type. The platform drops a form that breaks these rules.
|
|
419
420
|
*/
|
|
420
421
|
export interface UpsertFieldsMeta {
|
|
421
422
|
/** the operations the connector accepts (default ["add"]); a row whose operation is not listed is refused */
|
|
@@ -424,6 +425,12 @@ export interface UpsertFieldsMeta {
|
|
|
424
425
|
fields: Record<string, UpsertFieldInputMeta>;
|
|
425
426
|
/** prefilled rows offered to the user; `external_id` is the well-known one ("Id of the <other system> record") */
|
|
426
427
|
presets?: UpsertFieldPreset[];
|
|
428
|
+
/**
|
|
429
|
+
* how a field copied from another field (a source field on the mapping screen) is prefilled: the first entry whose
|
|
430
|
+
* conditions all hold is used. List the `matchPortableType` entries first, then the entries for any source system;
|
|
431
|
+
* an entry with no condition, last, is the catch-all.
|
|
432
|
+
*/
|
|
433
|
+
copyPresets?: UpsertFieldCopyPreset[];
|
|
427
434
|
}
|
|
428
435
|
/** UpsertFieldInputMeta is one input of a create-field form: a form input plus what the platform reads it for */
|
|
429
436
|
export interface UpsertFieldInputMeta extends FormInput {
|
|
@@ -443,6 +450,28 @@ export interface UpsertFieldPreset {
|
|
|
443
450
|
/** input values, keyed by input id */
|
|
444
451
|
values: Record<string, unknown>;
|
|
445
452
|
}
|
|
453
|
+
/**
|
|
454
|
+
* UpsertFieldCopyPreset is one rule of {@link UpsertFieldsMeta.copyPresets}: conditions on the copied field and the
|
|
455
|
+
* form values to start from. An absent condition is not tested; an entry with none matches every field.
|
|
456
|
+
*/
|
|
457
|
+
export interface UpsertFieldCopyPreset {
|
|
458
|
+
/**
|
|
459
|
+
* the copied field's `portableType`. Holds only when the copied field comes from the same connector (or a child of
|
|
460
|
+
* the same parent): the string means nothing to another connector, and a field without `portableType` never matches.
|
|
461
|
+
*/
|
|
462
|
+
matchPortableType?: string;
|
|
463
|
+
/**
|
|
464
|
+
* what the copied field holds, derived by the platform: a string with date/time constraints is "date" or "datetime"
|
|
465
|
+
* (`dateOnly` decides which), and an array is read by its element type with `matchMultiple`
|
|
466
|
+
*/
|
|
467
|
+
matchType?: "string" | "number" | "boolean" | "date" | "datetime";
|
|
468
|
+
/** the copied field has option values (false: it has none) */
|
|
469
|
+
matchHasOptions?: boolean;
|
|
470
|
+
/** the copied field holds several values, an array (false: a single value) */
|
|
471
|
+
matchMultiple?: boolean;
|
|
472
|
+
/** input values, keyed by input id, as a preset's; every id must be an input of the form */
|
|
473
|
+
values: Record<string, unknown>;
|
|
474
|
+
}
|
|
446
475
|
/**
|
|
447
476
|
* UpsertFieldRow creates or changes one field. It is keyed by input id, as a data upsert row is keyed by field id:
|
|
448
477
|
* - with an `isUserKey` input, that input holds `{ operation: "add" | "update", value }`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncmatters/script-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.46",
|
|
4
4
|
"description": "TypeScript type definitions for the SyncMatters script API (types only - scripts execute on the SyncMatters platform)",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"author": "SyncMatters",
|
|
30
30
|
"homepage": "https://syncmatters.com",
|
|
31
|
-
"typesContentHash": "
|
|
31
|
+
"typesContentHash": "7daa6b9a71735cba7fac8b5a8bb29bde2b003fab23e29bee1b48bb244f552fb2",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@types/node": "*"
|
|
34
34
|
}
|