@molecule/api-resource-article 1.1.1 → 1.1.3
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 +9 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/service.d.ts +8 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +8 -0
- package/package.json +5 -5
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-
|
|
6
|
+
Generated: 2026-10-21T18:17:13.272Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/api-resource-article
|
|
@@ -387,6 +387,14 @@ function listArticles(options?: ListArticlesOptions): Promise<PaginatedArticles>
|
|
|
387
387
|
|
|
388
388
|
Articles by the users `userId` follows, newest first.
|
|
389
389
|
|
|
390
|
+
Reads the reader's `follows` rows where `targetType` is `'user'` and matches
|
|
391
|
+
each row's `targetId` against `articles.authorId`, so the two sides must use
|
|
392
|
+
the SAME user identity: **`targetId` is the target user's `id` — the value
|
|
393
|
+
`createArticle` stored in `article.authorId`** — never a username or display
|
|
394
|
+
handle. A route or handler that receives a username resolves it to that id
|
|
395
|
+
before calling `follow`; `@molecule/api-resource-follow` stores the identifier
|
|
396
|
+
it is given unchanged, so a username-keyed follow contributes no articles.
|
|
397
|
+
|
|
390
398
|
```typescript
|
|
391
399
|
function getFeed(
|
|
392
400
|
userId: string,
|
package/dist/index.d.ts
CHANGED
|
@@ -57,8 +57,10 @@
|
|
|
57
57
|
* ```
|
|
58
58
|
*
|
|
59
59
|
* @remarks
|
|
60
|
-
* - **
|
|
61
|
-
*
|
|
60
|
+
* - **A scaffold that lists this package already has these tables** — its `__setup__` SQL is
|
|
61
|
+
* copied into the app at create time and replayed on every boot, so do not copy it into
|
|
62
|
+
* `api/migrations/` yourself. This package ships every table it reads, four in
|
|
63
|
+
* all. `src/__setup__/articles.sql` creates the `articles` and `article_tags` tables;
|
|
62
64
|
* `src/__setup__/articles_position.sql` adds the `position` column to a database whose
|
|
63
65
|
* `article_tags` predates it; `src/__setup__/reactions.sql` and `src/__setup__/follows.sql` create the
|
|
64
66
|
* `reactions` and `follows` tables, which this package reads directly by name
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoHG;AAEH,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -57,8 +57,10 @@
|
|
|
57
57
|
* ```
|
|
58
58
|
*
|
|
59
59
|
* @remarks
|
|
60
|
-
* - **
|
|
61
|
-
*
|
|
60
|
+
* - **A scaffold that lists this package already has these tables** — its `__setup__` SQL is
|
|
61
|
+
* copied into the app at create time and replayed on every boot, so do not copy it into
|
|
62
|
+
* `api/migrations/` yourself. This package ships every table it reads, four in
|
|
63
|
+
* all. `src/__setup__/articles.sql` creates the `articles` and `article_tags` tables;
|
|
62
64
|
* `src/__setup__/articles_position.sql` adds the `position` column to a database whose
|
|
63
65
|
* `article_tags` predates it; `src/__setup__/reactions.sql` and `src/__setup__/follows.sql` create the
|
|
64
66
|
* `reactions` and `follows` tables, which this package reads directly by name
|
package/dist/service.d.ts
CHANGED
|
@@ -64,6 +64,14 @@ export declare function listArticles(options?: ListArticlesOptions): Promise<Pag
|
|
|
64
64
|
/**
|
|
65
65
|
* Articles by the users `userId` follows, newest first.
|
|
66
66
|
*
|
|
67
|
+
* Reads the reader's `follows` rows where `targetType` is `'user'` and matches
|
|
68
|
+
* each row's `targetId` against `articles.authorId`, so the two sides must use
|
|
69
|
+
* the SAME user identity: **`targetId` is the target user's `id` — the value
|
|
70
|
+
* `createArticle` stored in `article.authorId`** — never a username or display
|
|
71
|
+
* handle. A route or handler that receives a username resolves it to that id
|
|
72
|
+
* before calling `follow`; `@molecule/api-resource-follow` stores the identifier
|
|
73
|
+
* it is given unchanged, so a username-keyed follow contributes no articles.
|
|
74
|
+
*
|
|
67
75
|
* @param userId - The reader.
|
|
68
76
|
* @param options - Paging.
|
|
69
77
|
* @returns A page of articles and the total.
|
package/dist/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAeH,OAAO,KAAK,EACV,OAAO,EACP,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,EACnB,MAAM,YAAY,CAAA;AAOnB,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,YAAY,CAAA;AAE9C,iDAAiD;AACjD,eAAO,MAAM,iBAAiB,aAAa,CAAA;AAE3C;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,MAAM,CAA6B,CAAA;AA0CpF,mCAAmC;AACnC,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAyBpC;;;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;;;;GAOG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAOzB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,CAEnD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAAC,KAAK,SAAK,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAEjE"}
|
package/dist/service.js
CHANGED
|
@@ -251,6 +251,14 @@ export async function listArticles(options = {}) {
|
|
|
251
251
|
/**
|
|
252
252
|
* Articles by the users `userId` follows, newest first.
|
|
253
253
|
*
|
|
254
|
+
* Reads the reader's `follows` rows where `targetType` is `'user'` and matches
|
|
255
|
+
* each row's `targetId` against `articles.authorId`, so the two sides must use
|
|
256
|
+
* the SAME user identity: **`targetId` is the target user's `id` — the value
|
|
257
|
+
* `createArticle` stored in `article.authorId`** — never a username or display
|
|
258
|
+
* handle. A route or handler that receives a username resolves it to that id
|
|
259
|
+
* before calling `follow`; `@molecule/api-resource-follow` stores the identifier
|
|
260
|
+
* it is given unchanged, so a username-keyed follow contributes no articles.
|
|
261
|
+
*
|
|
254
262
|
* @param userId - The reader.
|
|
255
263
|
* @param options - Paging.
|
|
256
264
|
* @returns A page of articles and the total.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/api-resource-article",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Articles and blog posts: unique slugs, tags, favorites, a followed-authors feed, and filtered, paginated lists",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
],
|
|
34
34
|
"license": "Apache-2.0",
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@molecule/api-database": "1.1.
|
|
37
|
-
"@molecule/api-database-sqlite": "1.2
|
|
38
|
-
"@molecule/api-resource-follow": "1.0.
|
|
39
|
-
"@molecule/api-resource-reaction": "1.0.
|
|
36
|
+
"@molecule/api-database": "1.1.4",
|
|
37
|
+
"@molecule/api-database-sqlite": "1.3.2",
|
|
38
|
+
"@molecule/api-resource-follow": "1.0.9",
|
|
39
|
+
"@molecule/api-resource-reaction": "1.0.5",
|
|
40
40
|
"@molecule/api-slug": "1.0.1",
|
|
41
41
|
"@types/node": "26.1.2",
|
|
42
42
|
"typescript": "6.0.3",
|