@syncmatters/script-api 1.0.46 → 1.0.48
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/package.json +2 -2
- package/sdk-test/sdk-test.d.ts +63 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncmatters/script-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.48",
|
|
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": "3b3f9a1819ead36e76339d125e5cee98c7a95c5a4a2acc308d1b849be72b9f46",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@types/node": "*"
|
|
34
34
|
}
|
package/sdk-test/sdk-test.d.ts
CHANGED
|
@@ -248,7 +248,8 @@ export interface ObjectFeatures {
|
|
|
248
248
|
/**
|
|
249
249
|
* The object's create-field form (upsertFieldsMeta), as generated from cached metadata. The fieldMetadata feature
|
|
250
250
|
* checks the object's form against it, and flags a form the platform would drop (more than one key or name input,
|
|
251
|
-
* or neither) and more than one field tagged isName. Fields are
|
|
251
|
+
* or neither) and more than one field tagged isName. Fields are created in the system under test only when `test`
|
|
252
|
+
* is set.
|
|
252
253
|
*/
|
|
253
254
|
upsertFields?: {
|
|
254
255
|
/** ids of the form's inputs, sorted */
|
|
@@ -261,10 +262,35 @@ export interface ObjectFeatures {
|
|
|
261
262
|
nameInputId?: string;
|
|
262
263
|
/** ids of the form's presets, sorted */
|
|
263
264
|
presetIds?: string[];
|
|
265
|
+
/**
|
|
266
|
+
* Opt in to a live round trip, which changes the connected account's schema: the harness creates a field through
|
|
267
|
+
* Connection.upsertFields with `row`, checks the cached metadata has it, sends the same row again and expects a
|
|
268
|
+
* row error with code "already_exists", then deletes the field through Connection.deleteFields (when
|
|
269
|
+
* deleteFields.canDeleteFields is true) and checks it is gone. The results are the object's upsertFields and
|
|
270
|
+
* deleteFields features (ObjectTestResult.upsertFields / deleteFields). It runs when the run tests every feature,
|
|
271
|
+
* upsertFields or deleteFields; either value runs the whole round trip, since the delete needs the field the create
|
|
272
|
+
* made. Never generated: set it in the test module.
|
|
273
|
+
*/
|
|
274
|
+
test?: {
|
|
275
|
+
/**
|
|
276
|
+
* The field to create, keyed by the form's input ids as an upsertFields row (a user key as
|
|
277
|
+
* `{ operation: "add", value }`, or as a plain string). The harness appends a per-run suffix to the key value
|
|
278
|
+
* and the name, within the inputs' regex and maxLen, so each run creates a new field. On a form whose key is
|
|
279
|
+
* assigned by the system the row must hold the name input and must not hold the key input.
|
|
280
|
+
*/
|
|
281
|
+
row: API.UpsertFieldRow;
|
|
282
|
+
/**
|
|
283
|
+
* Create the field even though it cannot be deleted (deleteFields.canDeleteFields is not true, or the connection
|
|
284
|
+
* has no deleteFields for the object): each run leaves a field behind in the account, and the deleteFields
|
|
285
|
+
* feature reads Not tested naming it. Without this flag both features read Not tested and nothing is created.
|
|
286
|
+
*/
|
|
287
|
+
leaveFieldBehind?: boolean;
|
|
288
|
+
};
|
|
264
289
|
};
|
|
265
290
|
/**
|
|
266
291
|
* Field deletion, as generated from cached metadata. The fieldMetadata feature checks that the object's
|
|
267
|
-
* canDeleteFields matches. Fields are
|
|
292
|
+
* canDeleteFields matches. Fields are deleted in the system under test only by the round trip that
|
|
293
|
+
* upsertFields.test opts in to, which deletes the field it created.
|
|
268
294
|
*/
|
|
269
295
|
deleteFields?: {
|
|
270
296
|
/** does the object declare canDeleteFields? */
|
|
@@ -272,12 +298,28 @@ export interface ObjectFeatures {
|
|
|
272
298
|
};
|
|
273
299
|
}
|
|
274
300
|
/** List of features that can be tested for an object. */
|
|
275
|
-
export type ObjectFeature = "all" | "list" | "idsFilter" | "fieldMetadata" | "checkpointFilter" | "relatedFilter" | "matchFilter" | "upsert" | "upsertClean" | "delete" | "rowFilter";
|
|
301
|
+
export type ObjectFeature = "all" | "list" | "idsFilter" | "fieldMetadata" | "checkpointFilter" | "relatedFilter" | "matchFilter" | "upsert" | "upsertClean" | "delete" | "rowFilter" | "upsertFields" | "deleteFields";
|
|
276
302
|
export interface BeforeOptions {
|
|
277
303
|
/** Connection that will be used to test the connector logic, as selected by the user. */
|
|
278
304
|
connection: unknown;
|
|
279
305
|
/** Logger to use for logging. */
|
|
280
306
|
log: API.Logger;
|
|
307
|
+
/**
|
|
308
|
+
* What this run was narrowed to, so before() can clean up and seed only what the run will use. Absent on a
|
|
309
|
+
* runner that predates it: treat absent as a full run.
|
|
310
|
+
*/
|
|
311
|
+
selection?: BeforeSelection;
|
|
312
|
+
}
|
|
313
|
+
/** What a run was narrowed to (sm connector test --object / --check / --only, or the web UI's choices). */
|
|
314
|
+
export interface BeforeSelection {
|
|
315
|
+
/** "all": every object of the suite; "selected": only objectIds; "none": no object features run. */
|
|
316
|
+
objects: "all" | "selected" | "none";
|
|
317
|
+
/** Native ids of the objects to test when objects is "selected", otherwise empty. */
|
|
318
|
+
objectIds: string[];
|
|
319
|
+
/** The object features the run tests; ["all"] when it is not restricted to some. */
|
|
320
|
+
features: ObjectFeature[];
|
|
321
|
+
/** Ids of the custom checks the run was narrowed to; empty when it was not narrowed to named checks. */
|
|
322
|
+
checkIds: string[];
|
|
281
323
|
}
|
|
282
324
|
/** Result of testing a connector. */
|
|
283
325
|
export interface ConnectorTestResult {
|
|
@@ -339,11 +381,28 @@ export interface ObjectTestResult {
|
|
|
339
381
|
rowFilter?: "Passed" | "Not tested" | "Not supported" | "Failed: Fatal error during testing" | "Failed: Test data invalid, no expected row ids" | "Failed: Row not returned" | "Failed: Returned unexpected row" | "Failed: Expected values did not match" | "Failed: Expected error did not occur";
|
|
340
382
|
rowFilterNotTestedReason?: string;
|
|
341
383
|
rowFilterFatalError?: CaughtError;
|
|
384
|
+
/**
|
|
385
|
+
* The upsertFields round trip (ObjectFeatures.upsertFields.test): a test field is created, found in the cached
|
|
386
|
+
* metadata, and a repeated add of it is refused with "already_exists". The first step that fails decides the
|
|
387
|
+
* status; the "Repeated add" statuses name the repeated add. Absent when the spec does not opt in or the run does not
|
|
388
|
+
* select the feature. The error behind a failure is in upsertFieldsFatalError.
|
|
389
|
+
*/
|
|
390
|
+
upsertFields?: "Passed" | "Not tested" | "Failed: upsertFields not available on the connection" | "Failed: Test row invalid" | "Failed: Fatal error during testing" | "Failed: Create returned an error" | "Failed: No id returned for the created field" | "Failed: Field not in cached metadata after create" | "Failed: Repeated add threw an error" | "Failed: Repeated add was not refused" | "Failed: Repeated add was not refused with already_exists";
|
|
391
|
+
upsertFieldsNotTestedReason?: string;
|
|
392
|
+
upsertFieldsFatalError?: CaughtError;
|
|
393
|
+
/**
|
|
394
|
+
* The delete half of the round trip: the fields the upsertFields test created are deleted and are gone from the
|
|
395
|
+
* cached metadata. Present exactly when upsertFields is. Not tested when no field was created, or when the object
|
|
396
|
+
* cannot delete fields and the spec set leaveFieldBehind (the reason names the field left behind).
|
|
397
|
+
*/
|
|
398
|
+
deleteFields?: "Passed" | "Not tested" | "Failed: Fatal error during testing" | "Failed: Delete returned an error" | "Failed: Field still in cached metadata after delete";
|
|
399
|
+
deleteFieldsNotTestedReason?: string;
|
|
400
|
+
deleteFieldsFatalError?: CaughtError;
|
|
342
401
|
/** Custom checks with this objectId, in declaration order. */
|
|
343
402
|
customChecks?: CustomCheckResult[];
|
|
344
403
|
/**
|
|
345
404
|
* Diagnostic details keyed by feature (list, idsFilter, checkpointFilter, rowFilter, upsert, upsertClean, delete,
|
|
346
|
-
* fieldMetadata) and check:<id>.
|
|
405
|
+
* fieldMetadata, upsertFields, deleteFields) and check:<id>.
|
|
347
406
|
*/
|
|
348
407
|
details?: {
|
|
349
408
|
[feature: string]: TestDetail[];
|