@syncmatters/script-api 1.0.21 → 1.0.22

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.
@@ -3,8 +3,9 @@
3
3
  A workspace pulled by `sm` mirrors platform script files locally and adds editor tooling.
4
4
 
5
5
  ```
6
- files/ # script source (.mjs, .json, …) — EDIT and push via sm push
7
- meta/ # one *.meta.json sidecar per file under files/ — EDIT and push
6
+ files/Scripts/ # integration scripts + sync logic (.mjs, .json, …) — EDIT and push via sm push
7
+ files/Connectors/ # connector source, one folder per connector — EDIT and push
8
+ meta/ # one *.meta.json sidecar per file under files/ (same sub-path) — EDIT and push
8
9
  syncs/<sync_uid>/ # sync.config.json — GENERATED read-only snapshots (sm pull sync)
9
10
  groups/<group_uid>/ # group.config.json — GENERATED read-only snapshots
10
11
  types/ # typed-connection .d.ts — GENERATED (sm types)
@@ -18,7 +19,9 @@ AGENTS.md # CLI-generated agent guide (managed block + your notes belo
18
19
 
19
20
  | Path | Agent may edit? | `sm push`? |
20
21
  | --- | --- | --- |
21
- | `files/**` | Yes (when tasked) | Yes (with sidecar) |
22
+ | `files/Scripts/**` | Yes (when tasked) | Yes (with sidecar) |
23
+ | `files/Connectors/**` | Yes (connector work only) | Yes (with sidecar) |
24
+ | any other top-level folder under `files/` (`Modules/`, `Services/`, …) | **No** — the platform rejects it | **No** |
22
25
  | `meta/**` | Yes | Yes (meta fields) |
23
26
  | `syncs/**/sync.config.json` | **No** | **No** |
24
27
  | `groups/**/group.config.json` | **No** | **No** |
@@ -28,17 +28,21 @@ The **entry** script's sidecar lists every file the platform must stage for that
28
28
 
29
29
  ```json
30
30
  "module_script_file_paths": [
31
- "Services/AcmeSync/acme-filter.mjs",
32
- "Services/AcmeSync/acme-utils.mjs"
31
+ "Scripts/AcmeSync/acme-filter.mjs",
32
+ "Scripts/AcmeSync/acme-utils.mjs"
33
33
  ]
34
34
  ```
35
35
 
36
+ Paths are FullNames — the path under `files/` without the `files/` prefix. Script modules always
37
+ start with `Scripts/`; only connector code lives under `Connectors/`. The platform rejects any
38
+ other top-level folder.
39
+
36
40
  `sm push` maps paths to platform file ids from workspace state. Every referenced path must exist
37
41
  and be tracked — unresolved references block the wiring change for that file.
38
42
 
39
43
  ## Linking sync logic to a sync
40
44
 
41
- 1. Push the module file(s) under `files/` with correct sidecars.
45
+ 1. Push the module file(s) under `files/Scripts/` with correct sidecars.
42
46
  2. In the **web UI**, open the sync configuration and attach the script file as custom logic
43
47
  (sets `script_file_id` on the platform).
44
48
  3. Locally, run `sm pull sync` and read `syncs/<sync_uid>/sync.config.json`:
@@ -53,7 +57,8 @@ not a push payload.
53
57
 
54
58
  A new file under `files/` is created on the platform only when:
55
59
 
56
- 1. It has a `meta/` sidecar, and
57
- 2. You `sm push` it.
60
+ 1. It sits under `files/Scripts/` (or `files/Connectors/<Name>/` for connector code),
61
+ 2. It has a `meta/` sidecar, and
62
+ 3. You `sm push` it.
58
63
 
59
64
  No sidecar → no push.
@@ -5,7 +5,8 @@
5
5
  ```
6
6
  sm pull # scripts + meta pins (+ syncs/groups when scoped)
7
7
  sm pull sync # optional: refresh sync/group snapshots only
8
- → edit files/ and meta/ only
8
+ sm sync fields --source <conn>:<obj> --dest <conn>:<obj> # both connections must resolve — stop and ask if one is missing
9
+ → edit files/Scripts/ and meta/Scripts/ only (files/Connectors/ for connector work)
9
10
  → sm validate
10
11
  → sm status / sm diff
11
12
  → sm push -m "describe change" --yes
@@ -13,8 +14,11 @@ sm pull sync # optional: refresh sync/group snapshots only
13
14
 
14
15
  - **Scripts only:** `sm push` uploads changed files under `files/` (and meta sidecars). It does
15
16
  **not** upload `syncs/` or `groups/`.
16
- - **Sync config changes:** `changes/*.sync-changes.json` → `sm sync draft` → human review →
17
- `sm sync push` (needs `syncs:write`). Agents push only on human instruction.
17
+ - **Sync config changes:** confirm every `connection_uid` with `sm sync fields` first — if it
18
+ reports an unknown connection or object, stop and ask the human to create the connection,
19
+ select objects and refresh metadata; do not author mappings from connector tests, OpenAPI
20
+ specs, another workspace or memory. Then `changes/*.sync-changes.json` → `sm sync draft` →
21
+ human review → `sm sync push` (needs `syncs:write`). Agents push only on human instruction.
18
22
  - **Reading snapshots:** use `syncs/` and `groups/` for context before editing the wired module
19
23
  in `files/`.
20
24
 
@@ -16,6 +16,8 @@
16
16
  | Editing `sync.config.json` to fix mappings | Change sync in web UI; re-pull snapshots |
17
17
  | Pushing `syncs/` or `groups/` | Not supported — push only `files/` + `meta/` |
18
18
  | Plain object default export for sync logic | **Class** default export; platform uses `new` |
19
+ | New file outside `files/Scripts/` (e.g. `files/Modules/…`) | Platform rejects it — script code lives under `files/Scripts/`, connectors under `files/Connectors/` |
20
+ | Authoring mappings for a connection that does not exist yet | Stop; ask the human to create the connection, then map only what `sm sync fields` prints |
19
21
  | Missing meta sidecar on new file | Add `meta/.../*.meta.json` before push |
20
22
  | Unwired `import` | Add path to `module_script_file_paths` in sidecar |
21
23
  | Running sync logic locally | Types check locally; execution is platform-only |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncmatters/script-api",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
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": "3dcf1af8c79b37f9fe75992f52dbbdc70d0f22515d9f65b1123ceb7e4f31de20",
31
+ "typesContentHash": "b96f39108ef358c683102abb6eaeae9b47358feb140dcdc03fea91f41410102a",
32
32
  "dependencies": {
33
33
  "@types/node": "*"
34
34
  }