@molecule/api-resource-readings 1.0.5 → 1.0.8

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/README.md CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-10-16T23:31:31.618Z
6
+ Generated: 2026-11-25T20:13:24.167Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-resource-readings
@@ -47,7 +47,7 @@ const hourly = await listAggregatedReadings(userId, { granularity: 'hour', metri
47
47
  ## Installation
48
48
 
49
49
  ```bash
50
- npm install @molecule/api-resource-readings @molecule/api-bonds-default-express @molecule/api-database @molecule/api-i18n @molecule/api-middleware-validation express zod
50
+ npm install @molecule/api-resource-readings @molecule/api-database @molecule/api-i18n @molecule/api-middleware-validation @molecule/api-resource express zod
51
51
  npm install -D @types/express
52
52
  ```
53
53
 
@@ -148,14 +148,14 @@ Persist multiple sensor readings in sequence, returning the number successfully
148
148
  ```typescript
149
149
  function ingestBulk(
150
150
  ownerId: string,
151
- readings: {
151
+ readings: Array<{
152
152
  sensor_id: string
153
153
  metric: string
154
154
  value: number
155
155
  unit?: string | null
156
156
  recorded_at?: string
157
157
  metadata?: Record<string, unknown>
158
- }[],
158
+ }>,
159
159
  ): Promise<number>
160
160
  ```
161
161
 
@@ -166,7 +166,13 @@ Fetch raw, unaggregated reading points for an owner, optionally filtered by sens
166
166
  ```typescript
167
167
  function listRawReadings(
168
168
  ownerId: string,
169
- opts?: { sensor_id?: string; metric?: string; from?: string; to?: string; limit?: number },
169
+ opts?: {
170
+ sensor_id?: string
171
+ metric?: string
172
+ from?: string
173
+ to?: string
174
+ limit?: number
175
+ },
170
176
  ): Promise<ReadingPoint[]>
171
177
  ```
172
178
 
@@ -274,19 +280,19 @@ const readingQuerySchema: z.ZodObject<
274
280
 
275
281
  Peer dependencies:
276
282
 
277
- - `@molecule/api-bonds-default-express` ^1.0.1
278
283
  - `@molecule/api-database` ^1.0.1
279
284
  - `@molecule/api-i18n` ^1.0.1
280
285
  - `@molecule/api-middleware-validation` ^1.0.1
286
+ - `@molecule/api-resource` ^1.2.0
281
287
  - `express` ^5.0.0
282
288
  - `zod` ^4.0.0
283
289
 
284
290
  ### Runtime Dependencies
285
291
 
286
- - `@molecule/api-bonds-default-express`
287
292
  - `@molecule/api-database`
288
293
  - `@molecule/api-i18n`
289
294
  - `@molecule/api-middleware-validation`
295
+ - `@molecule/api-resource`
290
296
  - `express`
291
297
  - `zod`
292
298
 
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,MAAM,EAAE,MAAM,SAAS,CAAA;AAclF,kFAAkF;AAClF,wBAAgB,oBAAoB,IAAI,MAAM,CAkD7C"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,MAAM,EAAE,MAAM,SAAS,CAAA;AAQ7D,kFAAkF;AAClF,wBAAgB,oBAAoB,IAAI,MAAM,CAkD7C"}
package/dist/routes.js CHANGED
@@ -1,10 +1,8 @@
1
1
  import { Router } from 'express';
2
- import { requireUser } from '@molecule/api-bonds-default-express';
3
- import { validateBody as validateBodyRaw, validateQuery as validateQueryRaw, } from '@molecule/api-middleware-validation';
2
+ import { validateBody, validateQuery } from '@molecule/api-middleware-validation';
3
+ import { requireUser } from '@molecule/api-resource';
4
4
  import { ingestBulk, ingestReading, listAggregatedReadings, listRawReadings } from './service.js';
5
5
  import { readingBulkSchema, readingCreateSchema, readingQuerySchema } from './validation.js';
6
- const validateBody = validateBodyRaw;
7
- const validateQuery = validateQueryRaw;
8
6
  /** Creates and returns the Express router for the readings resource endpoints. */
9
7
  export function createReadingsRouter() {
10
8
  const router = Router();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@molecule/api-resource-readings",
3
- "version": "1.0.5",
4
- "description": "Generic time-series sensor readings with on-the-fly aggregation (raw/5min/hour/day rollups)",
3
+ "version": "1.0.8",
4
+ "description": "Generic time-series with on-the-fly aggregation",
5
5
  "homepage": "https://www.molecule.dev/packages/api-resource-readings",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -45,10 +45,10 @@
45
45
  "zod": "4.6.7"
46
46
  },
47
47
  "peerDependencies": {
48
- "@molecule/api-bonds-default-express": "^1.0.1",
49
48
  "@molecule/api-database": "^1.0.1",
50
49
  "@molecule/api-i18n": "^1.0.1",
51
50
  "@molecule/api-middleware-validation": "^1.0.1",
51
+ "@molecule/api-resource": "^1.2.0",
52
52
  "express": "^5.0.0",
53
53
  "zod": "^4.0.0"
54
54
  }