@syncmatters/connector-sdk 1.0.14 → 1.0.16

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.
@@ -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,28 @@ 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
+ /**
95
+ * DiscoverOptions are passed to the discover function.
96
+ */
97
+ export interface DiscoverOptions {
98
+ /** log can record to the platform event store */
99
+ log: Logger;
100
+ }
101
+ /** MetaOptions are passed to the meta function. */
102
+ export interface MetaOptions {
103
+ /** log can record to the platform event store */
104
+ log: Logger;
105
+ /** objects the connection has selected; undefined = all */
106
+ selectedObjectIds?: string[];
107
+ /** subset of selectedObjectIds to refresh; undefined = all selected objects */
108
+ refreshObjectIds?: string[];
109
+ /** cached ObjectMeta for any object - returns undefined when nothing cached */
110
+ objectMeta(id: string): Promise<ObjectMeta | undefined>;
111
+ /** cached event types - returns undefined when nothing cached */
112
+ events(): Promise<ConnectorMeta["events"] | undefined>;
113
+ /** the cached discovery result - returns undefined when discover() is not implemented or nothing is cached */
114
+ discovery(): Promise<DiscoverResult | undefined>;
115
+ }
87
116
  /** QueryOptions are passed to the query function. */
88
117
  export interface QueryOptions {
89
118
  /** 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.14",
3
+ "version": "1.0.16",
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": "09f69999930df0f8199bfd417a03cfa1bb882d929614b96a26f8f52e7acab0f9",
15
+ "typesContentHash": "07fac99bb193fe5a9bff764336c8de1815d3729720589c2d893dd45a987e6eab",
16
16
  "dependencies": {
17
17
  "@types/node": "*",
18
- "@syncmatters/script-api": "^1.0.15"
18
+ "@syncmatters/script-api": "^1.0.17"
19
19
  }
20
20
  }