@syncmatters/connector-sdk 1.0.13 → 1.0.15

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/docs/05-query.md CHANGED
@@ -242,6 +242,16 @@ candidates }])` — the platform reserves un-mapped matches and returns the sele
242
242
  - **field_value_equals[ci]** - inspect the `match.custom` value and search in the selected `destFieldPath` (path to the field on the target system) to find rows holding this value (case insensitive) in this field.
243
243
  - **field_values_equal[ci]** - `destFieldPaths[k]` pairs with `match.customs[k]` (1-5 pairs); find rows where **every** pair is equal (case insensitive), i.e. `destFieldPaths[0] = customs[0] AND destFieldPaths[1] = customs[1] ...`. A `""` entry in `customs` means that destination field must be empty/absent: filter for "empty" (e.g. HubSpot `NOT_HAS_PROPERTY`, SOQL `= null`), never drop the filter, because dropping it widens the search. The platform only sends a blank when the user enabled "match blank values" for that pair, and never sends a row whose values are all blank.
244
244
 
245
+ `destFieldPath` is set only for `id` and `field_value_equals[ci]`; `destFieldPaths` only for
246
+ `field_values_equal[ci]`. Nested fields use the same path shape as `fields` (e.g.
247
+ `[{ path: "custom_fields" }, { path: "tax_id" }]`). `srcData` is a batch — search them
248
+ together where the API allows it. `match.id` already includes the user's source-id prefix when
249
+ they configured one.
250
+
251
+ The in-app Help article *Calling a connection from a script* has copy-paste `matchFilter`
252
+ objects for every rule (same `rule` / `srcData` / `destFieldPath(s)` the platform sends here,
253
+ plus `canUse` on this path). Do not duplicate that catalog in this file.
254
+
245
255
  ### relatedFilter
246
256
 
247
257
  Receives rows from a source object (`otherObjectId`) that has a defined relationship to this object, and collect the related rows from this object.
@@ -1,4 +1,4 @@
1
- import { EventTypeMeta, Logger, ObjectField, UpsertIssue, ObjectIndex, ObjectMeta, ObjectMetaUpsert, Row, TestResult, ScriptType, UpsertFieldOptionMeta, QueryMatchFilter, QueryCheckpointFilter, JsonValuePathPart, SyncSession, ObjectFieldOption, RowMatchRuleType, SyncOptimalBatchSizeOperation, SyncOptimalBatchSizeBatchType } from "@syncmatters/script-api";
1
+ import { EventTypeMeta, Logger, ObjectField, UpsertIssue, ObjectIndex, ObjectMeta, ObjectMetaUpsert, Row, TestResult, ScriptType, UpsertFieldOptionMeta, QueryMatchFilter, QueryCheckpointFilter, JsonValuePathPart, SyncSession, ObjectFieldOption, RowMatchRuleType, SyncOptimalBatchSizeOperation, SyncOptimalBatchSizeBatchType, DiscoverResult } from "@syncmatters/script-api";
2
2
  import SDK from "../index.js";
3
3
  /**
4
4
  * InitArgs are passed as the only argument to the connector init() function.
@@ -35,8 +35,15 @@ export interface Connector {
35
35
  init?(args: InitArgs): Promise<void>;
36
36
  /** test attempts to connect to the system, so validating credentials and basic settings. */
37
37
  test(): Promise<TestResult>;
38
- /** meta connects to the system to retrieve system, object and field definitions (metadata). */
39
- meta(): Promise<ConnectorMeta>;
38
+ /**
39
+ * [optional] discover returns the catalogue of objects present in the system, without field detail. Called after init() once the settings
40
+ * tagged as 'prerequisite' are entered by a user setting up the connection.
41
+ */
42
+ discover?(options: DiscoverOptions): Promise<DiscoverResult>;
43
+ /**
44
+ * meta connects to the system to retrieve system, object and field definitions (metadata).
45
+ */
46
+ meta(options?: MetaOptions): Promise<ConnectorMeta>;
40
47
  /**
41
48
  * query connects to the system to retrieve data from the object with the given id. The connector manages
42
49
  * state needed for multi-page quesies using parameter 'queryState'. On the first call to query() 'queryState'
@@ -84,6 +91,30 @@ export interface Connector {
84
91
  }
85
92
  /** verifyType may be used to check whether the connector class correctly impliments Connector */
86
93
  export declare function verifyType(_connector: Connector): void;
94
+ /** DiscoverOptions are passed to the discover function. */
95
+ export interface DiscoverOptions {
96
+ /** log can record to the platform event store */
97
+ log: Logger;
98
+ /** first setup ("newConnection"), or a re-collect of an existing result ("refresh") */
99
+ reason: "newConnection" | "refresh";
100
+ /** the previous discovery result from this connection, if any */
101
+ previous?: DiscoverResult;
102
+ }
103
+ /** MetaOptions are passed to the meta function. */
104
+ export interface MetaOptions {
105
+ /** log can record to the platform event store */
106
+ log: Logger;
107
+ /** objects the connection has selected; undefined = all */
108
+ selectedObjectIds?: string[];
109
+ /** subset of selectedObjectIds to refresh; undefined = all selected objects */
110
+ refreshObjectIds?: string[];
111
+ /** cached ObjectMeta for any object - returns undefined when nothing cached */
112
+ objectMeta(id: string): Promise<ObjectMeta | undefined>;
113
+ /** cached event types - returns undefined when nothing cached */
114
+ events(): Promise<ConnectorMeta["events"] | undefined>;
115
+ /** the cached discovery result - undefined discover() not implimented or when nothing cached */
116
+ discovery?: DiscoverResult;
117
+ }
87
118
  /** QueryOptions are passed to the query function. */
88
119
  export interface QueryOptions {
89
120
  /** log can record to the platform event store */
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 } from "@syncmatters/script-api";
6
- export type { Cache, FileProvider, HttpRequest, HttpClientOptions, KvCollection, KvIterator, Logger, EventContext, TestResult, Row, ObjectMeta, ObjectField, ObjectFieldOption, RateLimiterOptions, ScriptType, JsonValuePath, JsonValuePathPart, QueryMatchFilter, QueryCheckpointFilter, EventTypeMeta, ObjectIndex, ObjectMetaUpsert, ObjectRowFilter, ObjectRelationship, ObjectFieldConstraints, ObjectSettingMeta, UpsertIssue, UpsertFieldOptionMeta, RowMatchRuleType, RowMatchData, RowMatchRuleOrder, SyncSession, SyncOptimalBatchSizeOperation, SyncOptimalBatchSizeBatchType, } from "@syncmatters/script-api";
6
+ export type { Cache, FileProvider, HttpRequest, HttpClientOptions, KvCollection, KvIterator, Logger, EventContext, TestResult, Row, ObjectMeta, ObjectField, ObjectFieldOption, RateLimiterOptions, ScriptType, JsonValuePath, JsonValuePathPart, QueryMatchFilter, QueryCheckpointFilter, EventTypeMeta, ObjectIndex, ObjectMetaUpsert, ObjectRowFilter, ObjectRelationship, ObjectFieldConstraints, ObjectSettingMeta, ObjectUnavailableReason, DiscoverResult, DiscoveredObject, MetaState, MetaStateObject, UpsertIssue, UpsertFieldOptionMeta, RowMatchRuleType, 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.13",
3
+ "version": "1.0.15",
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": "b08f55c29df514e6a627b6c4fe49634d4c563c235420642189e63de96fe7af5c",
15
+ "typesContentHash": "c428bbb8ebc48254d9a04ea22755a73f6579fcccfc31d639633a935688655fd3",
16
16
  "dependencies": {
17
17
  "@types/node": "*",
18
- "@syncmatters/script-api": "^1.0.15"
18
+ "@syncmatters/script-api": "^1.0.16"
19
19
  }
20
20
  }