@syncmatters/script-api 1.0.4 → 1.0.6

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.
@@ -482,7 +482,14 @@ export interface ObjectFieldOption {
482
482
  }
483
483
  /** ObjectFieldConstraints holds details of expected/allowed values for a field. */
484
484
  export interface ObjectFieldConstraints {
485
+ /**
486
+ * When the field is required on upsert.
487
+ * For fields inside `arrayObjectFields`, mandatory is only enforced when the parent array
488
+ * has at least one element — an empty or absent array does not trigger `ValueRequired`.
489
+ * When the array is non-empty, every element must provide a satisfying value.
490
+ */
485
491
  mandatory?: "always" | "add" | "update";
492
+ /** Values that satisfy a mandatory constraint without raising `ValueRequired`. */
486
493
  mandatoryAccepts?: Array<"null" | "blank_string">;
487
494
  max?: number;
488
495
  min?: number;
@@ -11,4 +11,6 @@ export declare class HttpError extends Error implements HttpErrorType {
11
11
  responseBodyBuffer?: Buffer;
12
12
  responseBodyJson?: unknown;
13
13
  constructor(err: Error | string, statusCode: number | undefined);
14
+ /** Include url in JSON serialization so user-visible error payloads retain the request URL. */
15
+ toJSON(): Pick<HttpErrorType, "name" | "message" | "stack" | "code" | "url" | "statusCode">;
14
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncmatters/script-api",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
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": {
@@ -11,12 +11,16 @@
11
11
  "./sdk-test": {
12
12
  "types": "./sdk-test.d.ts",
13
13
  "default": "./index.js"
14
+ },
15
+ "./api": {
16
+ "types": "./api.d.ts",
17
+ "default": "./index.js"
14
18
  }
15
19
  },
16
20
  "license": "MIT",
17
21
  "author": "SyncMatters",
18
22
  "homepage": "https://syncmatters.com",
19
- "typesContentHash": "ed924bcb7bf03a6b4a1769beacbdf45f9887b21cb6a20f2a434b9fbe1813b4b8",
23
+ "typesContentHash": "87164fc7d9ba4a7b759acaa21737560cfb815a277721adbff4ab10a0ade8f806",
20
24
  "dependencies": {
21
25
  "@types/node": "*"
22
26
  }
@@ -208,6 +208,10 @@ export interface ConnectorTestResult {
208
208
  testConnection?: "Passed" | "Not tested" | "Failed: Fatal error during testing" | "Failed: Test connection response did not report success";
209
209
  objectsStatus?: "Passed" | "Partial: Only selected objects tested" | "Partial: Only selected objects tested, not all features can be tested" | "Partial: Only selected object tests run" | "Partial: Only selected objects tested, only selected object tests run" | "Partial: Not all features/objects can be tested" | "Not tested" | "Failed: Fatal error during testing" | "Failed: One or more objects failed tests";
210
210
  objects: ObjectTestResult[];
211
+ /** Diagnostic details for connection-level stages, keyed by stage (testConnection, metaRefresh). */
212
+ details?: {
213
+ [stage: string]: TestDetail[];
214
+ };
211
215
  }
212
216
  export interface ObjectTestResult {
213
217
  objectId: string;
@@ -251,6 +255,10 @@ export interface ObjectTestResult {
251
255
  deleteFatalError?: CaughtError;
252
256
  fieldMetadata?: "Passed" | "Not tested" | "Failed: One or more fields have metadata issues";
253
257
  fieldMetadataIssues: FieldMetadataIssue[];
258
+ /** Diagnostic details keyed by feature (list, idsFilter, checkpointFilter, upsert, upsertClean, delete, fieldMetadata). */
259
+ details?: {
260
+ [feature: string]: TestDetail[];
261
+ };
254
262
  }
255
263
  export interface FieldMetadataIssue {
256
264
  operation: "query" | "upsert" | "delete";
@@ -264,6 +272,8 @@ export interface MatchRuleTestResult {
264
272
  notTestedReason?: string;
265
273
  errorRowId?: string;
266
274
  fatalError?: CaughtError;
275
+ /** Diagnostic details for this rule. */
276
+ details?: TestDetail[];
267
277
  }
268
278
  export interface RelatedFilterTestResult {
269
279
  relationshipId: string;
@@ -272,12 +282,28 @@ export interface RelatedFilterTestResult {
272
282
  notTestedReason?: string;
273
283
  errorRowId?: string;
274
284
  fatalError?: CaughtError;
285
+ /** Diagnostic details for this relationship. */
286
+ details?: TestDetail[];
275
287
  }
276
288
  /** Details from caught error that blocked test completion */
277
289
  export interface CaughtError {
278
290
  message?: string;
279
291
  stack?: string;
280
292
  }
293
+ /**
294
+ * A diagnostic detail captured while testing; mirrors what the test harness logs (a message plus
295
+ * the inputs/outputs the message relates to). Details are saved with the test result so the
296
+ * harness i/o can be reviewed alongside statuses; the platform scrubs them after a short
297
+ * retention window, statuses remain.
298
+ */
299
+ export interface TestDetail {
300
+ level: "info" | "error";
301
+ message: string;
302
+ /** Inputs/outputs relating to the message (e.g. filter ids used, rows returned). */
303
+ data?: unknown;
304
+ /** Set when the data payload was dropped to honour the capture size budget. */
305
+ truncated?: boolean;
306
+ }
281
307
  /** Options passed when requesting data that will be used for an upsert test. */
282
308
  export interface UpsertOptions {
283
309
  meta: API.ObjectMeta;