emdash-emit 0.1.10 → 0.1.12

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 (68) hide show
  1. package/CHANGELOG.md +135 -0
  2. package/README.md +24 -4
  3. package/dist/cli/commands/conflicts.d.ts.map +1 -1
  4. package/dist/cli/commands/conflicts.js +45 -1
  5. package/dist/cli/commands/conflicts.js.map +1 -1
  6. package/dist/cli/commands/pull.d.ts.map +1 -1
  7. package/dist/cli/commands/pull.js +5 -4
  8. package/dist/cli/commands/pull.js.map +1 -1
  9. package/dist/cli/commands/push.d.ts.map +1 -1
  10. package/dist/cli/commands/push.js +46 -3
  11. package/dist/cli/commands/push.js.map +1 -1
  12. package/dist/cli/commands/status.d.ts.map +1 -1
  13. package/dist/cli/commands/status.js +18 -4
  14. package/dist/cli/commands/status.js.map +1 -1
  15. package/dist/client/api.d.ts +6 -0
  16. package/dist/client/api.d.ts.map +1 -1
  17. package/dist/client/api.js +36 -0
  18. package/dist/client/api.js.map +1 -1
  19. package/dist/db/cache.d.ts +11 -0
  20. package/dist/db/cache.d.ts.map +1 -1
  21. package/dist/db/cache.js +136 -7
  22. package/dist/db/cache.js.map +1 -1
  23. package/dist/mcp/heartbeat.d.ts +29 -0
  24. package/dist/mcp/heartbeat.d.ts.map +1 -0
  25. package/dist/mcp/heartbeat.js +132 -0
  26. package/dist/mcp/heartbeat.js.map +1 -0
  27. package/dist/mcp/server.d.ts.map +1 -1
  28. package/dist/mcp/server.js +2 -0
  29. package/dist/mcp/server.js.map +1 -1
  30. package/dist/mcp/tools/sync-push.d.ts.map +1 -1
  31. package/dist/mcp/tools/sync-push.js +38 -5
  32. package/dist/mcp/tools/sync-push.js.map +1 -1
  33. package/dist/sync/conflicts.d.ts +24 -0
  34. package/dist/sync/conflicts.d.ts.map +1 -1
  35. package/dist/sync/conflicts.js +111 -0
  36. package/dist/sync/conflicts.js.map +1 -1
  37. package/dist/sync/delete.d.ts.map +1 -1
  38. package/dist/sync/delete.js +66 -3
  39. package/dist/sync/delete.js.map +1 -1
  40. package/dist/sync/doctor.d.ts +10 -0
  41. package/dist/sync/doctor.d.ts.map +1 -1
  42. package/dist/sync/doctor.js +197 -6
  43. package/dist/sync/doctor.js.map +1 -1
  44. package/dist/sync/merge.d.ts +59 -3
  45. package/dist/sync/merge.d.ts.map +1 -1
  46. package/dist/sync/merge.js +177 -5
  47. package/dist/sync/merge.js.map +1 -1
  48. package/dist/sync/orchestrator.d.ts +6 -1
  49. package/dist/sync/orchestrator.d.ts.map +1 -1
  50. package/dist/sync/orchestrator.js +15 -2
  51. package/dist/sync/orchestrator.js.map +1 -1
  52. package/dist/sync/pull.d.ts +5 -1
  53. package/dist/sync/pull.d.ts.map +1 -1
  54. package/dist/sync/pull.js +174 -148
  55. package/dist/sync/pull.js.map +1 -1
  56. package/dist/sync/push.d.ts +6 -0
  57. package/dist/sync/push.d.ts.map +1 -1
  58. package/dist/sync/push.js +155 -5
  59. package/dist/sync/push.js.map +1 -1
  60. package/dist/sync/status.d.ts +9 -0
  61. package/dist/sync/status.d.ts.map +1 -1
  62. package/dist/sync/status.js +10 -1
  63. package/dist/sync/status.js.map +1 -1
  64. package/dist/sync/terms.d.ts +32 -0
  65. package/dist/sync/terms.d.ts.map +1 -0
  66. package/dist/sync/terms.js +62 -0
  67. package/dist/sync/terms.js.map +1 -0
  68. package/package.json +2 -1
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Fetches the terms currently assigned to an article for one taxonomy.
3
+ *
4
+ * EmDash does NOT embed taxonomy assignments in `GET /_emdash/api/content/{collection}/{id}`;
5
+ * they live only behind `/terms/{taxonomy}`. Every code path that needs the *remote* taxonomy
6
+ * state (pull, and the push-side 3-way merge) must read it from here, otherwise the remote side
7
+ * looks like "no terms" and a merge silently drops the author's assignments.
8
+ *
9
+ * Returns `null` when the request fails so callers can distinguish "unknown" from "none" (`[]`).
10
+ */
11
+ export declare function fetchAssignedTerms(options: {
12
+ origin: string;
13
+ token: string;
14
+ collection: string;
15
+ id: string;
16
+ taxonomy: 'category' | 'tag';
17
+ fetchFn: typeof fetch;
18
+ }): Promise<string[] | null>;
19
+ /**
20
+ * Fetches both category and tag assignments. Each entry is `null` when that request failed.
21
+ */
22
+ export declare function fetchAssignedTaxonomies(options: {
23
+ origin: string;
24
+ token: string;
25
+ collection: string;
26
+ id: string;
27
+ fetchFn: typeof fetch;
28
+ }): Promise<{
29
+ categories: string[] | null;
30
+ tags: string[] | null;
31
+ }>;
32
+ //# sourceMappingURL=terms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terms.d.ts","sourceRoot":"","sources":["../../src/sync/terms.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,UAAU,GAAG,KAAK,CAAC;IAC7B,OAAO,EAAE,OAAO,KAAK,CAAC;CACvB,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAsB3B;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,EAAE;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,KAAK,CAAC;CACvB,GAAG,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;CAAE,CAAC,CAMlE"}
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Copyright (C) 2026 SPORT-SERVICE RS★R
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ /**
23
+ * Fetches the terms currently assigned to an article for one taxonomy.
24
+ *
25
+ * EmDash does NOT embed taxonomy assignments in `GET /_emdash/api/content/{collection}/{id}`;
26
+ * they live only behind `/terms/{taxonomy}`. Every code path that needs the *remote* taxonomy
27
+ * state (pull, and the push-side 3-way merge) must read it from here, otherwise the remote side
28
+ * looks like "no terms" and a merge silently drops the author's assignments.
29
+ *
30
+ * Returns `null` when the request fails so callers can distinguish "unknown" from "none" (`[]`).
31
+ */
32
+ export async function fetchAssignedTerms(options) {
33
+ try {
34
+ const termsUrl = new URL(`/_emdash/api/content/${options.collection}/${options.id}/terms/${options.taxonomy}`, options.origin).toString();
35
+ const termsRes = await options.fetchFn(termsUrl, {
36
+ method: 'GET',
37
+ headers: {
38
+ Authorization: `Bearer ${options.token}`,
39
+ Accept: 'application/json',
40
+ },
41
+ });
42
+ if (!termsRes.ok)
43
+ return null;
44
+ const termsJson = (await termsRes.json());
45
+ const assigned = termsJson.data?.terms || [];
46
+ return assigned.map((t) => t.slug || t.id).filter((s) => Boolean(s));
47
+ }
48
+ catch {
49
+ return null;
50
+ }
51
+ }
52
+ /**
53
+ * Fetches both category and tag assignments. Each entry is `null` when that request failed.
54
+ */
55
+ export async function fetchAssignedTaxonomies(options) {
56
+ const [categories, tags] = await Promise.all([
57
+ fetchAssignedTerms({ ...options, taxonomy: 'category' }),
58
+ fetchAssignedTerms({ ...options, taxonomy: 'tag' }),
59
+ ]);
60
+ return { categories, tags };
61
+ }
62
+ //# sourceMappingURL=terms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terms.js","sourceRoot":"","sources":["../../src/sync/terms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAOxC;IACC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,IAAI,GAAG,CACtB,wBAAwB,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,EAAE,UAAU,OAAO,CAAC,QAAQ,EAAE,EACpF,OAAO,CAAC,MAAM,CACf,CAAC,QAAQ,EAAE,CAAC;QACb,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE;YAC/C,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,OAAO,CAAC,KAAK,EAAE;gBACxC,MAAM,EAAE,kBAAkB;aAC3B;SACF,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,OAAO,IAAI,CAAC;QAC9B,MAAM,SAAS,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAEvC,CAAC;QACF,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;QAC7C,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACpF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,OAM7C;IACC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC3C,kBAAkB,CAAC,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;QACxD,kBAAkB,CAAC,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;KACpD,CAAC,CAAC;IACH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;AAC9B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emdash-emit",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "AI-First Local Workspace & Sync Tool for EmDash (Cloudflare Workers + D1)",
5
5
  "author": "hiroaki <45134003+aroooy@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -35,6 +35,7 @@
35
35
  "files": [
36
36
  "dist",
37
37
  "README.md",
38
+ "CHANGELOG.md",
38
39
  "LICENSE"
39
40
  ],
40
41
  "publishConfig": {