@syncmatters/connector-sdk 1.0.41 → 1.0.43
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,
|
|
228
|
-
Delete and Full columns) and optional `read_mandatory`/`write_mandatory
|
|
229
|
-
`full_mandatory: true` flags.
|
|
230
|
-
|
|
231
|
-
|
|
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
|
|
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
|
|
@@ -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`
|
|
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.
|
|
3
|
+
"version": "1.0.43",
|
|
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": "8e858acf6cf353382d6fcab94b96e8f91bb5109d2749abfcb4189db4c4942c7f",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@types/node": "*",
|
|
18
|
-
"@syncmatters/script-api": "^1.0.
|
|
18
|
+
"@syncmatters/script-api": "^1.0.46"
|
|
19
19
|
}
|
|
20
20
|
}
|