@transai/connector-runner-control-office 0.0.0-stage → 0.1.0

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 (37) hide show
  1. package/DOCUMENTATION.md +67 -0
  2. package/README.md +32 -2
  3. package/index.cjs +63 -0
  4. package/index.cjs.map +7 -0
  5. package/integrations/connector-runner-control-office/src/index.d.ts +1 -0
  6. package/integrations/connector-runner-control-office/src/lib/actions/action.interface.d.ts +11 -0
  7. package/integrations/connector-runner-control-office/src/lib/actions/odata-resource.action.d.ts +11 -0
  8. package/integrations/connector-runner-control-office/src/lib/actions.service.d.ts +7 -0
  9. package/integrations/connector-runner-control-office/src/lib/connector-runner-control-office.d.ts +6 -0
  10. package/integrations/connector-runner-control-office/src/lib/error/invalid-input.error.d.ts +2 -0
  11. package/integrations/connector-runner-control-office/src/lib/error/record-not-found.error.d.ts +2 -0
  12. package/integrations/connector-runner-control-office/src/lib/error/too-many-records.error.d.ts +2 -0
  13. package/integrations/connector-runner-control-office/src/lib/extractor.service.d.ts +9 -0
  14. package/integrations/connector-runner-control-office/src/lib/helpers.d.ts +6 -0
  15. package/integrations/connector-runner-control-office/src/lib/odata-reader.d.ts +14 -0
  16. package/integrations/connector-runner-control-office/src/lib/resources.d.ts +2 -0
  17. package/integrations/connector-runner-control-office/src/lib/types.d.ts +44 -0
  18. package/libs/connector-runtime-sdk/src/index.d.ts +5 -0
  19. package/libs/connector-runtime-sdk/src/lib/connector-runtime.d.ts +16 -0
  20. package/libs/connector-runtime-sdk/src/lib/connector-runtime.interface.d.ts +5 -0
  21. package/libs/connector-runtime-sdk/src/lib/sdk/files.sdk.interface.d.ts +25 -0
  22. package/libs/connector-runtime-sdk/src/lib/sdk/http-client.interface.d.ts +49 -0
  23. package/libs/connector-runtime-sdk/src/lib/sdk/index.d.ts +10 -0
  24. package/libs/connector-runtime-sdk/src/lib/sdk/logger.sdk.interface.d.ts +7 -0
  25. package/libs/connector-runtime-sdk/src/lib/sdk/offset-store.sdk.interface.d.ts +13 -0
  26. package/libs/connector-runtime-sdk/src/lib/sdk/processing.sdk.interface.d.ts +30 -0
  27. package/libs/connector-runtime-sdk/src/lib/sdk/receiver.sdk.interface.d.ts +14 -0
  28. package/libs/connector-runtime-sdk/src/lib/sdk/sdk.interface.d.ts +31 -0
  29. package/libs/connector-runtime-sdk/src/lib/sdk/sender.sdk.interface.d.ts +26 -0
  30. package/libs/connector-runtime-sdk/src/lib/sdk/telemetry.sdk.interface.d.ts +15 -0
  31. package/libs/connector-runtime-sdk/src/lib/sdk/templating.sdk.interface.d.ts +12 -0
  32. package/libs/connector-runtime-sdk/src/lib/support/index.d.ts +1 -0
  33. package/libs/connector-runtime-sdk/src/lib/support/null-logger.d.ts +8 -0
  34. package/libs/connector-runtime-sdk/src/lib/types/action.d.ts +63 -0
  35. package/libs/connector-runtime-sdk/src/lib/types/kafka.d.ts +41 -0
  36. package/libs/connector-runtime-sdk/src/lib/types.d.ts +26 -0
  37. package/package.json +16 -3
@@ -0,0 +1,67 @@
1
+ # ControlOffice
2
+
3
+ Read maintenance data from ControlOffice into transAI. The integration retrieves records through the ControlOffice OData API and makes the same reads available to workflows.
4
+
5
+ ## Configuration
6
+
7
+ Create a user-bound OData API key in ControlOffice. The user must have permission to read the selected data. Supply the key through your connector's runtime configuration. A key is valid for one year; generating a new key invalidates the previous key, so update the connector configuration when rotating it.
8
+
9
+ | Setting | Description |
10
+ | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
+ | `url` | HTTPS tenant origin, for example `https://example.controloffice.nl`. Do not include `/api/v1`, credentials or query parameters. |
12
+ | `apiKey` | OData API key, sent in the `X-CO-ODATAAPIKEY` header. |
13
+ | `datasourceIdentifier` | Collection prefix. Use `control-office` with the supplied datasets. A different value requires matching dataset collection overrides. |
14
+ | `retrievers` | Optional list of read action identifiers to poll. Omit to poll all available data; use an empty array to disable polling while keeping workflow reads available. |
15
+ | `interval` | Polling interval in seconds; default `300`. |
16
+ | `pageSize` | Requested records per page, from `1` to `1000`; default `100`. |
17
+
18
+ ```json
19
+ {
20
+ "url": "https://example.controloffice.nl",
21
+ "apiKey": "REPLACE_WITH_ODATA_API_KEY",
22
+ "datasourceIdentifier": "control-office",
23
+ "retrievers": ["get-workorders", "get-requests", "get-objects"],
24
+ "interval": 300,
25
+ "pageSize": 100
26
+ }
27
+ ```
28
+
29
+ The first poll reads all available records up to the start of that poll. Subsequent polls select records by their ControlOffice `Modified` timestamp, starting five minutes before the newest timestamp delivered so far, so records saved late by ControlOffice are still picked up. Each selected dataset is polled on its own schedule; a dataset poll that is still running when the next one is due is skipped. Records use their ControlOffice `Id` as their document key.
30
+
31
+ ## Available data
32
+
33
+ | Data | Read action |
34
+ | --------------------------- | -------------------------------- |
35
+ | Workorders | `get-workorders` |
36
+ | Maintenance requests | `get-requests` |
37
+ | Objects | `get-objects` |
38
+ | Meters | `get-meters` |
39
+ | Meter readings | `get-meter-readings` |
40
+ | Hour bookings | `get-hour-bookings` |
41
+ | Workorder activities | `get-workorder-activities` |
42
+ | Workorder employees | `get-workorder-employees` |
43
+ | Workorder objects | `get-workorder-objects` |
44
+ | Request objects | `get-request-objects` |
45
+ | Object-meter links | `get-object-meters` |
46
+ | Employees | `get-employees` |
47
+ | Statuses | `get-statuses` |
48
+ | Priorities | `get-priorities` |
49
+ | Object types | `get-object-types` |
50
+ | Units | `get-units` |
51
+ | Request and workorder types | `get-request-or-workorder-types` |
52
+
53
+ Datasets include scalar fields, record status and relationships between the listed entities. Navigation objects and collections are represented through their separate datasets. ISO 8601 duration fields remain strings; decimal duration fields support numeric totals such as booked hours.
54
+
55
+ ## Workflow actions
56
+
57
+ Each action in the table accepts either an optional `id` containing a ControlOffice GUID, or an optional `modifiedFrom` containing an ISO 8601 timestamp with timezone. Leave both empty to read the collection. Supplying both is invalid. Collection reads return at most 1,000 records; a larger result is refused with a bad-request response, so use a later `modifiedFrom` to narrow it.
58
+
59
+ Successful reads also store their records in the matching transAI collection. A read by `id` returns one object; any other read returns an array, also when it contains zero or one record. Workflow reads do not change polling progress. A test run validates its inputs without calling ControlOffice or storing records.
60
+
61
+ ## Failure behavior
62
+
63
+ Invalid configuration prevents startup. Unknown actions and invalid inputs return a bad-request response. HTTP errors, invalid records or failed ingestion fail that read. Polling progress advances after each page has been delivered successfully, so a failed poll resumes after the last delivered page. Polls can replay records already delivered; stable document keys keep them associated with the same source records.
64
+
65
+ HTTP 401 or 403 requires checking the API key and its user's permissions. The connector sends GET requests only. Record disappearance does not remove data from transAI; the source `RecordStatus` remains available for filtering. Hard deletes without a returned record cannot be detected by incremental polling. Late changes with timestamps older than the saved progress require a full replay. To repeat the initial load, have your platform administrator clear the dataset's stored offset or set it with `id` `0`. To re-read from a point in time, set its `timestamp` (milliseconds since epoch) with any other `id`.
66
+
67
+ Polling requests at most 10,000 pages per read and stops with an error if that limit is exceeded. This guard prevents an indefinitely repeating API response from consuming resources.
package/README.md CHANGED
@@ -1,3 +1,33 @@
1
- # Temporary Holding Version
1
+ # ControlOffice connector runner
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Read-only ControlOffice maintenance integration using the connector runtime SDK. Runtime source lives in `src/lib/` and follows the shared runner layout (`actions/`, `actions.service.ts`, `extractor.service.ts`, `helpers.ts`); the runner is the only public export. See `DOCUMENTATION.md` for configuration, available data, action inputs and failure behavior.
4
+
5
+ ## Contract evidence
6
+
7
+ `assets/odata-metadata.xml` is the OData v4 metadata retrieved from a customer tenant's `/api/v1/$metadata` on 9 November 2026. It contains API definitions and no customer records or credentials. The 17 selected resources have a GUID `Id` and a `Modified` timestamp. `assets/template.json` maps their scalar fields, decimal duration measures and supported foreign-key relationships. Live read probes on 9 November 2026 succeeded on all 17 selected endpoints using `X-CO-ODATAAPIKEY`. Inclusive Modified filters, deterministic ordering, GUID filters and skip pagination were verified on populated collections. Meter, MeterReading, HourBooking, WorkorderObject, RequestObject and ObjectMeter were empty in this tenant. The polymorphic Status dataset also exposes the metadata-defined subtype fields.
8
+
9
+ The reference research is in the sibling `transai-integration-data/control-office` checkout. Authentication uses `X-CO-ODATAAPIKEY`; no bearer login or writes are implemented.
10
+
11
+ ## Runtime behavior
12
+
13
+ Each resource is one `ODataResourceAction` (`src/lib/actions/`), built from the table in `resources.ts`. Every selected action gets its own `ExtractorService` polling interval, like the other runners; an extractor skips a run while its previous run is still going. Initial reads have an upper timestamp bound; later reads use inclusive `Modified` bounds and order by `Modified,Id`. Each next page starts at the last `Modified` seen and `$skip`s only the records already read at that exact timestamp, until an empty page. Server `@odata.nextLink`s are ignored: they `$skip` from the start of the read, so a record edited mid-read shifts every later page and one record is lost. Stopping only on an empty page means a silently capped `$top` cannot end the read early, and a server that ignores `$skip` fails the read instead of looping. Redirects are disabled at the SDK HTTP adapter boundary.
14
+
15
+ Pages are delivered sequentially with `keyField: Id`. The watermark is the newest `Modified` delivered (not the connector clock) and is committed and flushed after each delivered page; pages are ordered by `Modified`, so a failed read keeps the progress of the pages before it. Each read starts five minutes before it to catch records committed late with an earlier timestamp. SDK delivery acknowledgement means Kafka accepted the documents, rather than confirmation that downstream ingestion has completed. Workflow reads ingest their results and return them without modifying polling offsets; collection reads are capped at 1,000 records because the result travels in one Kafka response. Dry runs validate only.
16
+
17
+ Changes to existing records are found through `Modified`; hard deletions and late/backdated changes older than the saved timestamp require operational reconciliation or an offset reset. Keep tenant and datasource identifiers stable for a connector instance. Changing its tenant URL or datasource requires resetting its offsets before polling resumes.
18
+
19
+ ## Validation
20
+
21
+ Run with Node 24 and the repository's pnpm installation:
22
+
23
+ ```sh
24
+ pnpm nx test connector-runner-control-office --runInBand
25
+ pnpm nx lint connector-runner-control-office
26
+ pnpm nx build connector-runner-control-office
27
+ bash .github/skills/template-builder/scripts/validate-template.sh integrations/connector-runner-control-office/assets/template.json
28
+ pnpm nx build documentation
29
+ ```
30
+
31
+ The template is a new local `v1.0.0` candidate. It is not published or activated for any tenant by this implementation. Configure real credentials only through runtime secret configuration. Before the first npm release, follow the repository's trusted-publishing setup for the new package.
32
+
33
+ Metadata discrepancy: `WorkorderActivity.FollowUpWorkorder` incorrectly declares `WorkorderId` as its foreign key. GUID lookups use an OData `Id` filter: the standard parenthesized key route returns HTTP 404 on this tenant. The template uses the explicit scalar `FollowUpWorkorderId` for that relation and keeps a separate reverse relation; it does not overwrite the original-order relationship.