@syncmatters/connector-sdk 1.0.45 → 1.0.46

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.
Files changed (2) hide show
  1. package/docs/09-testing.md +14 -0
  2. package/package.json +3 -3
@@ -87,6 +87,20 @@ Established conventions:
87
87
  - **Test-data hygiene**: prefix every created record (`const testRecordPrefix = "sm_test";`)
88
88
  and have `before()` sweep and delete `sm_test*` leftovers, so crashed runs never pollute the
89
89
  sandbox account.
90
+ - **Clean up only what the run uses**: `before()` receives `selection` — what the run was
91
+ narrowed to: `objects` (`"all"`, `"selected"` or `"none"`), `objectIds` (the `--object` ids
92
+ when selected), `features` (`["all"]` unless restricted, e.g. `--only query`) and `checkIds`
93
+ (the `--check` ids). A suite whose sweep is slow or touches many objects limits it to the
94
+ objects the run tests **plus the objects those depend on** (a Contacts run that associates
95
+ companies still needs Companies swept), and skips write cleanup when nothing selected writes.
96
+ `selection` is absent on an older runner: treat absent as a full run.
97
+
98
+ ```js
99
+ async before({ connection, selection }) {
100
+ const wanted = !selection || selection.objects === "all" ? undefined : new Set(selection.objectIds);
101
+ if (!wanted || wanted.has("contacts") || wanted.has("companies")) await this.#sweepCrm();
102
+ }
103
+ ```
90
104
  - **Scoping out an object**: set `features.cannotTestReason = "<why>"` on an object's features
91
105
  instead of deleting it from the generated file.
92
106
  - `expectedIdentity` pins the account: if the sandbox credentials get re-pointed, the suite
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncmatters/connector-sdk",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
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": "b7824973f26c6a656f1ec55fb456f957e89bdfd93310e6792f07b74df65291ea",
15
+ "typesContentHash": "68b1eba052b8a26ee11cdecc81796e2f921819c36e808a2a091bf7d6e9def32b",
16
16
  "dependencies": {
17
17
  "@types/node": "*",
18
- "@syncmatters/script-api": "^1.0.47"
18
+ "@syncmatters/script-api": "^1.0.48"
19
19
  }
20
20
  }