@openeld/openeld 0.1.0 → 0.1.1

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 (102) hide show
  1. package/README.md +166 -24
  2. package/dist/index.d.ts +8045 -0
  3. package/dist/index.js +2072 -0
  4. package/docs/README.md +71 -0
  5. package/docs/architecture/README.md +4 -0
  6. package/docs/concepts/schema-and-generated-bindings.md +74 -0
  7. package/docs/decisions/README.md +4 -0
  8. package/docs/getting-started/quickstart.md +62 -0
  9. package/docs/guides/normalization.md +106 -0
  10. package/docs/guides/query-and-sync.md +59 -0
  11. package/docs/guides/transports-and-remote-services.md +79 -0
  12. package/docs/protobuf/README.md +15 -11
  13. package/docs/providers/README.md +35 -54
  14. package/docs/providers/capability-matrix.md +2 -0
  15. package/docs/providers/geotab.md +55 -23
  16. package/docs/providers/keeptruckin.md +32 -22
  17. package/docs/providers/motive.md +52 -21
  18. package/docs/providers/provider-template.md +2 -0
  19. package/docs/providers/samsara.md +57 -25
  20. package/docs/providers/verification-matrix.md +2 -0
  21. package/docs/services/README.md +4 -0
  22. package/examples/ts/README.md +67 -1
  23. package/gen/README.md +8 -0
  24. package/gen/ts/common/metadata/audit_pb.d.ts +84 -0
  25. package/gen/ts/common/metadata/audit_pb.js +27 -0
  26. package/gen/ts/common/metadata/source_pb.d.ts +128 -0
  27. package/gen/ts/common/metadata/source_pb.js +34 -0
  28. package/gen/ts/common/primitives/ids_pb.d.ts +81 -0
  29. package/gen/ts/common/primitives/ids_pb.js +33 -0
  30. package/gen/ts/common/primitives/location_pb.d.ts +91 -0
  31. package/gen/ts/common/primitives/location_pb.js +33 -0
  32. package/gen/ts/common/primitives/time_pb.d.ts +82 -0
  33. package/gen/ts/common/primitives/time_pb.js +34 -0
  34. package/gen/ts/common/units/measurements_pb.d.ts +102 -0
  35. package/gen/ts/common/units/measurements_pb.js +47 -0
  36. package/gen/ts/logistics/asset_location_pb.d.ts +64 -0
  37. package/gen/ts/logistics/asset_location_pb.js +23 -0
  38. package/gen/ts/logistics/asset_pb.d.ts +93 -0
  39. package/gen/ts/logistics/asset_pb.js +22 -0
  40. package/gen/ts/logistics/carrier_pb.d.ts +67 -0
  41. package/gen/ts/logistics/carrier_pb.js +21 -0
  42. package/gen/ts/logistics/data_consent_pb.d.ts +89 -0
  43. package/gen/ts/logistics/data_consent_pb.js +23 -0
  44. package/gen/ts/logistics/driver_pb.d.ts +109 -0
  45. package/gen/ts/logistics/driver_pb.js +23 -0
  46. package/gen/ts/logistics/dvir_pb.d.ts +132 -0
  47. package/gen/ts/logistics/dvir_pb.js +30 -0
  48. package/gen/ts/logistics/enums_pb.d.ts +837 -0
  49. package/gen/ts/logistics/enums_pb.js +264 -0
  50. package/gen/ts/logistics/gps_location_pb.d.ts +85 -0
  51. package/gen/ts/logistics/gps_location_pb.js +24 -0
  52. package/gen/ts/logistics/hos_daily_summary_pb.d.ts +139 -0
  53. package/gen/ts/logistics/hos_daily_summary_pb.js +32 -0
  54. package/gen/ts/logistics/hos_event_pb.d.ts +159 -0
  55. package/gen/ts/logistics/hos_event_pb.js +32 -0
  56. package/gen/ts/logistics/ifta_trip_pb.d.ts +85 -0
  57. package/gen/ts/logistics/ifta_trip_pb.js +24 -0
  58. package/gen/ts/logistics/safety_event_pb.d.ts +96 -0
  59. package/gen/ts/logistics/safety_event_pb.js +25 -0
  60. package/gen/ts/logistics/vehicle_assignment_pb.d.ts +91 -0
  61. package/gen/ts/logistics/vehicle_assignment_pb.js +29 -0
  62. package/gen/ts/logistics/vehicle_pb.d.ts +98 -0
  63. package/gen/ts/logistics/vehicle_pb.js +22 -0
  64. package/gen/ts/providers/eld/geotab/contracts_pb.d.ts +453 -0
  65. package/gen/ts/providers/eld/geotab/contracts_pb.js +70 -0
  66. package/gen/ts/providers/eld/keeptruckin/contracts_pb.d.ts +443 -0
  67. package/gen/ts/providers/eld/keeptruckin/contracts_pb.js +70 -0
  68. package/gen/ts/providers/eld/motive/contracts_pb.d.ts +468 -0
  69. package/gen/ts/providers/eld/motive/contracts_pb.js +70 -0
  70. package/gen/ts/providers/eld/samsara/contracts_pb.d.ts +474 -0
  71. package/gen/ts/providers/eld/samsara/contracts_pb.js +71 -0
  72. package/gen/ts/providers/eld/shared/common_pb.d.ts +752 -0
  73. package/gen/ts/providers/eld/shared/common_pb.js +113 -0
  74. package/gen/ts/providers/telematics/fleet_complete/contracts_pb.d.ts +46 -0
  75. package/gen/ts/providers/telematics/fleet_complete/contracts_pb.js +20 -0
  76. package/gen/ts/providers/telematics/fourkites/contracts_pb.d.ts +46 -0
  77. package/gen/ts/providers/telematics/fourkites/contracts_pb.js +20 -0
  78. package/gen/ts/providers/telematics/project44/contracts_pb.d.ts +46 -0
  79. package/gen/ts/providers/telematics/project44/contracts_pb.js +20 -0
  80. package/gen/ts/providers/telematics/shared/common_pb.d.ts +192 -0
  81. package/gen/ts/providers/telematics/shared/common_pb.js +43 -0
  82. package/gen/ts/providers/telematics/verizon_connect/contracts_pb.d.ts +46 -0
  83. package/gen/ts/providers/telematics/verizon_connect/contracts_pb.js +20 -0
  84. package/gen/ts/services/ingestion/service_pb.d.ts +128 -0
  85. package/gen/ts/services/ingestion/service_pb.js +40 -0
  86. package/gen/ts/services/normalization/service_pb.d.ts +201 -0
  87. package/gen/ts/services/normalization/service_pb.js +53 -0
  88. package/gen/ts/services/query/service_pb.d.ts +1018 -0
  89. package/gen/ts/services/query/service_pb.js +278 -0
  90. package/gen/ts/services/sync/service_pb.d.ts +361 -0
  91. package/gen/ts/services/sync/service_pb.js +97 -0
  92. package/gen/ts/v1/openeld_pb.d.ts +11 -0
  93. package/gen/ts/v1/openeld_pb.js +46 -0
  94. package/package.json +45 -11
  95. package/src/clients/.gitkeep +0 -0
  96. package/src/fixture-normalization.ts +0 -471
  97. package/src/generated/README.md +0 -3
  98. package/src/generated/ts/.gitkeep +0 -0
  99. package/src/index.ts +0 -1
  100. package/src/mappers/.gitkeep +0 -0
  101. package/src/registry/.gitkeep +0 -0
  102. /package/{src/adapters/providers → gen/ts}/.gitkeep +0 -0
package/README.md CHANGED
@@ -1,40 +1,182 @@
1
1
  # openeld
2
2
 
3
- `openeld` is a protobuf-first package for a universal logistics data interface across ELD and telematics providers.
3
+ `@openeld/openeld` is a protobuf-first SDK for normalizing ELD and telematics data into a shared logistics model.
4
4
 
5
- ## Repository Shape
5
+ It is designed for teams that want:
6
6
 
7
- - `proto/` contains the canonical message and service definitions.
8
- - `src/` contains the thin TypeScript package surface and hand-written integration scaffolding.
9
- - `gen/` is reserved for generated language bindings.
10
- - `buf/` contains protobuf linting and generation configuration.
11
- - `docs/`, `examples/`, and `tests/fixtures/` support schema evolution and provider onboarding.
7
+ - one canonical schema across providers
8
+ - a pleasant TypeScript SDK for day-to-day integration work
9
+ - generated protobuf bindings as the source of truth for runtime types
10
+ - a path toward transport-backed query and sync APIs without changing the package shape later
12
11
 
13
- ## Source Of Truth
12
+ ## Install
13
+
14
+ ```sh
15
+ npm install @openeld/openeld
16
+ ```
17
+
18
+ ```sh
19
+ bun add @openeld/openeld
20
+ ```
21
+
22
+ ## Quickstart
23
+
24
+ The fastest way to get value from OpenELD today is local provider normalization through the OO SDK:
25
+
26
+ ```ts
27
+ import { createOpenEldClient } from "@openeld/openeld";
28
+
29
+ const client = createOpenEldClient();
30
+
31
+ const result = await client.providers.samsara.normalize({
32
+ drivers,
33
+ vehicles,
34
+ hosLogs,
35
+ hosClocks,
36
+ vehicleLocations,
37
+ dvirs,
38
+ feedCursor,
39
+ });
40
+
41
+ console.log(result.response.drivers);
42
+ console.log(result.response.vehicles);
43
+ console.log(result.warnings);
44
+ ```
45
+
46
+ The provider method returns:
47
+
48
+ - `payload`: the generated provider payload message
49
+ - `request`: the generated normalization request
50
+ - `response`: the generated canonical normalization response
51
+ - `warnings`: provider-specific caveats and staging notes
52
+
53
+ ## Choose Your Path
54
+
55
+ ### Recommended: OO SDK
56
+
57
+ Use `createOpenEldClient()` when you want the cleanest consumer experience.
58
+
59
+ - `client.providers.samsara.normalize(...)`
60
+ - `client.providers.motive.normalize(...)`
61
+ - `client.providers.geotab.normalize(...)`
62
+ - `client.providers.supported()`
63
+
64
+ ### Advanced: Protobuf-First Normalization
65
+
66
+ Use the normalization namespace when you want to stay closer to generated request and response types:
67
+
68
+ ```ts
69
+ import {
70
+ createOpenEldClient,
71
+ buildSamsaraPayload,
72
+ } from "@openeld/openeld";
73
+
74
+ const client = createOpenEldClient();
75
+ const payload = buildSamsaraPayload({
76
+ drivers,
77
+ vehicles,
78
+ hosLogs,
79
+ hosClocks,
80
+ vehicleLocations,
81
+ dvirs,
82
+ feedCursor,
83
+ });
84
+
85
+ const request = client.normalization.toRequest("samsara", payload, {
86
+ tenantId: "tenant-123",
87
+ });
88
+
89
+ const response = await client.normalization.normalize(request);
90
+ ```
91
+
92
+ ### Staged: Query And Sync
93
+
94
+ `client.query` and `client.sync` already match the intended protobuf service boundaries, but they require a configured transport invoker.
14
95
 
15
- All shared types are intended to be defined in Protocol Buffers so TypeScript and Python bindings can be generated from the same contracts.
96
+ They are useful when you are:
16
97
 
17
- ## Current Schema Coverage
98
+ - calling a remote service that implements the protobuf contracts
99
+ - standardizing your own transport layer around OpenELD request and response types
18
100
 
19
- The `v1` schema currently includes:
101
+ They are not local in-process data stores or built-in hosted APIs.
20
102
 
21
- - common primitives for IDs, dates, time ranges, locations, measurements, source metadata, and audit metadata
22
- - normalized logistics entities for carriers, drivers, vehicles, vehicle assignments, HOS events, HOS daily summaries, GPS locations, DVIRs, data consents, safety events, IFTA trips, assets, and asset locations
23
- - provider payload contracts for Samsara, Motive, Geotab, KeepTruckin, Project44, FourKites, Verizon Connect, and Fleet Complete
24
- - service definitions for ingestion, normalization, query, and sync workflows
103
+ ## SDK Scope Today
104
+
105
+ What works locally right now:
106
+
107
+ - provider payload building and normalization for `samsara`, `motive`, and `geotab`
108
+ - advanced in-process normalization through `client.normalization`
109
+ - generated protobuf bindings through the root package, `client.schemas`, and `@openeld/openeld/generated`
110
+
111
+ What is transport-ready but not locally implemented:
112
+
113
+ - `client.query.*`
114
+ - `client.sync.*`
115
+
116
+ ## Supported Providers
117
+
118
+ Current consumer-ready local normalization support:
119
+
120
+ - Samsara
121
+ - Motive
122
+ - Geotab
123
+
124
+ Limited or staged provider support:
125
+
126
+ - KeepTruckin is documented as a legacy compatibility path
127
+ - additional provider contracts exist in the protobuf surface, but not all are wired into the local runtime yet
128
+
129
+ See the provider guides in [`docs/providers/README.md`](docs/providers/README.md).
130
+
131
+ ## Documentation
132
+
133
+ Start here:
134
+
135
+ - [Documentation Home](docs/README.md)
136
+ - [Quickstart](docs/getting-started/quickstart.md)
137
+ - [Normalization Guide](docs/guides/normalization.md)
138
+ - [Transport And Remote Services](docs/guides/transports-and-remote-services.md)
139
+ - [Query And Sync Guide](docs/guides/query-and-sync.md)
140
+ - [Schema And Generated Bindings](docs/concepts/schema-and-generated-bindings.md)
141
+ - [Provider Guides](docs/providers/README.md)
142
+
143
+ ## Source Of Truth
144
+
145
+ `proto/` is the only source of structural types.
146
+
147
+ That means:
148
+
149
+ - canonical logistics entities are defined in protobuf
150
+ - provider-native payload contracts are defined in protobuf
151
+ - generated TypeScript bindings in `gen/ts` are the runtime type surface
152
+ - handwritten TypeScript in `src/` focuses on behavior, orchestration, and transport boundaries
25
153
 
26
154
  The aggregate import surface is `proto/v1/openeld.proto`.
27
155
 
28
- ## Generation
156
+ ## Package Layout
157
+
158
+ - `src/` contains the SDK, runtime services, adapters, and client facades
159
+ - `proto/` contains canonical and provider-native protobuf definitions
160
+ - `gen/ts` contains generated TypeScript bindings that ship with the package
161
+ - `docs/` contains consumer and contributor documentation
162
+ - `examples/` contains focused usage examples
163
+
164
+ ## Packaging
165
+
166
+ - `bun run build` emits the ESM bundle and `.d.ts` types
167
+ - `@openeld/openeld/client` and `@openeld/openeld/generated` provide clearer import intent while resolving to the published bundle
168
+ - `npm pack --dry-run` validates publish contents locally
169
+
170
+ ## Versioning And Release
29
171
 
30
- The default Buf generation template produces:
172
+ This repository uses Changesets for semantic versioning, changelog entries, and release tagging.
31
173
 
32
- - TypeScript output in `gen/ts`
33
- - Python output in `gen/py`
174
+ - run `bun run changeset` when a change should affect the published package version
175
+ - commit the generated file under `.changeset/`
176
+ - merge to `main` to let the release workflow open or update the version PR
177
+ - merging the version PR publishes to npm and creates the corresponding release tag
34
178
 
35
- ## Next Steps
179
+ GitHub Actions handles validation and release automation:
36
180
 
37
- - Refine provider-native record coverage as more provider field mappings are confirmed.
38
- - Widen normalization outputs for consent, safety, IFTA, and asset tracking once provider mappings for those domains are mature.
39
- - Add validation and contract tests around the `v1` schema.
40
- - Decide whether query and sync service APIs should remain generic or split further by domain area.
181
+ - `.github/workflows/ci.yml` runs build, tests, and package validation
182
+ - `.github/workflows/publish.yml` opens version PRs and publishes tagged releases through Changesets