@molecule/api-resource-comment 1.1.2 → 1.1.4

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,20 +3,25 @@ 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-16T00:32:13.746Z
6
+ Generated: 2026-10-17T20:52:27.537Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-resource-comment
10
10
 
11
- > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
12
- > It is written to be read by coding agents as much as by people, and is generated from this
13
- > package's source — edit `src/index.ts` JSDoc, not this file.
14
-
15
11
  Threaded comments resource for molecule.dev.
16
12
 
17
13
  Polymorphic comments that attach to any resource type. Supports threaded
18
14
  replies, pagination, and ownership-based authorization.
19
15
 
16
+ **Tables this package owns: `comments` and `comment_numbers`.** A comment row is found by its
17
+ `comments.id` (a UUID); `comment_numbers` gives it the sequential integer many clients address it
18
+ by, and the join between the two is `comment_numbers.commentId` = `comments.id` (declared FK,
19
+ `ON DELETE CASCADE`) — one row per numbered comment, never a mapping table of your own.
20
+
21
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
22
+ > It is written to be read by coding agents as much as by people, and is generated from this
23
+ > package's source — edit `src/index.ts` JSDoc, not this file.
24
+
20
25
  ## Quick Start
21
26
 
22
27
  ```typescript
@@ -493,9 +498,12 @@ Peer dependencies:
493
498
  from `@molecule/app-http` normalizes this envelope (pass it the whole HttpResponse), so
494
499
  the rows come back; reading the response as a bare array — or `res.data` alone (which is
495
500
  the envelope) — yields an EMPTY list.
496
- - **Migration required.** `src/__setup__/comments.sql` ships with this package
497
- and must exist in the target database before use (scaffolded apps apply it
498
- automatically; existing apps must apply it first).
501
+ - **A scaffold that lists this package already has these tables** — its `__setup__` SQL is
502
+ copied into the app at create time and replayed on every boot, so do not copy it into
503
+ `api/migrations/` yourself; only a package added after the scaffold needs that.
504
+ `src/__setup__/comments.sql` ships with this package and must exist in the target
505
+ database before use (scaffolded apps apply it automatically; existing apps must apply it
506
+ first).
499
507
  - **Integer comment ids (RealWorld's `comment.id`, most public API specs):** keep the
500
508
  UUID and give each comment a sequential number — `createNumberedComment()` creates both
501
509
  in one transaction, `getCommentByNumber(n)` finds it, `commentNumbers(ids)` maps a list.
package/dist/index.d.ts CHANGED
@@ -4,6 +4,11 @@
4
4
  * Polymorphic comments that attach to any resource type. Supports threaded
5
5
  * replies, pagination, and ownership-based authorization.
6
6
  *
7
+ * **Tables this package owns: `comments` and `comment_numbers`.** A comment row is found by its
8
+ * `comments.id` (a UUID); `comment_numbers` gives it the sequential integer many clients address it
9
+ * by, and the join between the two is `comment_numbers.commentId` = `comments.id` (declared FK,
10
+ * `ON DELETE CASCADE`) — one row per numbered comment, never a mapping table of your own.
11
+ *
7
12
  * @module
8
13
  * @example
9
14
  * ```typescript
@@ -25,9 +30,12 @@
25
30
  * from `@molecule/app-http` normalizes this envelope (pass it the whole HttpResponse), so
26
31
  * the rows come back; reading the response as a bare array — or `res.data` alone (which is
27
32
  * the envelope) — yields an EMPTY list.
28
- * - **Migration required.** `src/__setup__/comments.sql` ships with this package
29
- * and must exist in the target database before use (scaffolded apps apply it
30
- * automatically; existing apps must apply it first).
33
+ * - **A scaffold that lists this package already has these tables** — its `__setup__` SQL is
34
+ * copied into the app at create time and replayed on every boot, so do not copy it into
35
+ * `api/migrations/` yourself; only a package added after the scaffold needs that.
36
+ * `src/__setup__/comments.sql` ships with this package and must exist in the target
37
+ * database before use (scaffolded apps apply it automatically; existing apps must apply it
38
+ * first).
31
39
  * - **Integer comment ids (RealWorld's `comment.id`, most public API specs):** keep the
32
40
  * UUID and give each comment a sequential number — `createNumberedComment()` creates both
33
41
  * in one transaction, `getCommentByNumber(n)` finds it, `commentNumbers(ids)` maps a list.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAEH,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,wBAAwB,CAAA;AACtC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AAEH,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,wBAAwB,CAAA;AACtC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA"}
package/dist/index.js CHANGED
@@ -4,6 +4,11 @@
4
4
  * Polymorphic comments that attach to any resource type. Supports threaded
5
5
  * replies, pagination, and ownership-based authorization.
6
6
  *
7
+ * **Tables this package owns: `comments` and `comment_numbers`.** A comment row is found by its
8
+ * `comments.id` (a UUID); `comment_numbers` gives it the sequential integer many clients address it
9
+ * by, and the join between the two is `comment_numbers.commentId` = `comments.id` (declared FK,
10
+ * `ON DELETE CASCADE`) — one row per numbered comment, never a mapping table of your own.
11
+ *
7
12
  * @module
8
13
  * @example
9
14
  * ```typescript
@@ -25,9 +30,12 @@
25
30
  * from `@molecule/app-http` normalizes this envelope (pass it the whole HttpResponse), so
26
31
  * the rows come back; reading the response as a bare array — or `res.data` alone (which is
27
32
  * the envelope) — yields an EMPTY list.
28
- * - **Migration required.** `src/__setup__/comments.sql` ships with this package
29
- * and must exist in the target database before use (scaffolded apps apply it
30
- * automatically; existing apps must apply it first).
33
+ * - **A scaffold that lists this package already has these tables** — its `__setup__` SQL is
34
+ * copied into the app at create time and replayed on every boot, so do not copy it into
35
+ * `api/migrations/` yourself; only a package added after the scaffold needs that.
36
+ * `src/__setup__/comments.sql` ships with this package and must exist in the target
37
+ * database before use (scaffolded apps apply it automatically; existing apps must apply it
38
+ * first).
31
39
  * - **Integer comment ids (RealWorld's `comment.id`, most public API specs):** keep the
32
40
  * UUID and give each comment a sequential number — `createNumberedComment()` creates both
33
41
  * in one transaction, `getCommentByNumber(n)` finds it, `commentNumbers(ids)` maps a list.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-resource-comment",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Threaded comments on any resource with polymorphic attachment and pagination",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,8 +29,8 @@
29
29
  ],
30
30
  "license": "Apache-2.0",
31
31
  "devDependencies": {
32
- "@molecule/api-database": "1.1.1",
33
- "@molecule/api-database-sqlite": "1.2.2",
32
+ "@molecule/api-database": "1.1.3",
33
+ "@molecule/api-database-sqlite": "1.2.6",
34
34
  "@types/node": "26.1.2",
35
35
  "typescript": "6.0.3",
36
36
  "vitest": "4.1.11",