emdash-emit 0.1.16 → 0.1.18
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/CHANGELOG.md +55 -0
- package/README.md +1 -1
- package/dist/cli/commands/new.d.ts.map +1 -1
- package/dist/cli/commands/new.js +1 -13
- package/dist/cli/commands/new.js.map +1 -1
- package/dist/cli/commands/pull.d.ts +2 -10
- package/dist/cli/commands/pull.d.ts.map +1 -1
- package/dist/cli/commands/pull.js +12 -30
- package/dist/cli/commands/pull.js.map +1 -1
- package/dist/client/auth.d.ts.map +1 -1
- package/dist/client/auth.js +2 -1
- package/dist/client/auth.js.map +1 -1
- package/dist/client/endpoints.d.ts +19 -0
- package/dist/client/endpoints.d.ts.map +1 -0
- package/dist/client/endpoints.js +69 -0
- package/dist/client/endpoints.js.map +1 -0
- package/dist/client/http.d.ts +4 -2
- package/dist/client/http.d.ts.map +1 -1
- package/dist/client/http.js.map +1 -1
- package/dist/client/lock.d.ts.map +1 -1
- package/dist/client/lock.js +4 -3
- package/dist/client/lock.js.map +1 -1
- package/dist/client/mapper.d.ts.map +1 -1
- package/dist/client/mapper.js +5 -3
- package/dist/client/mapper.js.map +1 -1
- package/dist/client/media-id.d.ts +2 -0
- package/dist/client/media-id.d.ts.map +1 -0
- package/dist/client/media-id.js +23 -0
- package/dist/client/media-id.js.map +1 -0
- package/dist/client/media.d.ts +8 -7
- package/dist/client/media.d.ts.map +1 -1
- package/dist/client/media.js +58 -17
- package/dist/client/media.js.map +1 -1
- package/dist/db/baseline.d.ts +37 -0
- package/dist/db/baseline.d.ts.map +1 -0
- package/dist/db/baseline.js +74 -0
- package/dist/db/baseline.js.map +1 -0
- package/dist/db/cache.d.ts +3 -2
- package/dist/db/cache.d.ts.map +1 -1
- package/dist/db/cache.js +3 -2
- package/dist/db/cache.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/tools/sync-new.d.ts.map +1 -1
- package/dist/mcp/tools/sync-new.js +1 -13
- package/dist/mcp/tools/sync-new.js.map +1 -1
- package/dist/mcp/tools/sync-pull.d.ts.map +1 -1
- package/dist/mcp/tools/sync-pull.js +15 -2
- package/dist/mcp/tools/sync-pull.js.map +1 -1
- package/dist/presentation/article_report.d.ts +40 -0
- package/dist/presentation/article_report.d.ts.map +1 -0
- package/dist/presentation/article_report.js +80 -0
- package/dist/presentation/article_report.js.map +1 -0
- package/dist/sync/bylines.d.ts.map +1 -1
- package/dist/sync/bylines.js +2 -1
- package/dist/sync/bylines.js.map +1 -1
- package/dist/sync/conflicts.js +1 -1
- package/dist/sync/conflicts.js.map +1 -1
- package/dist/sync/delete.d.ts +0 -5
- package/dist/sync/delete.d.ts.map +1 -1
- package/dist/sync/delete.js +5 -11
- package/dist/sync/delete.js.map +1 -1
- package/dist/sync/diff.d.ts.map +1 -1
- package/dist/sync/diff.js +4 -5
- package/dist/sync/diff.js.map +1 -1
- package/dist/sync/doctor.d.ts.map +1 -1
- package/dist/sync/doctor.js +11 -14
- package/dist/sync/doctor.js.map +1 -1
- package/dist/sync/guards.d.ts +5 -0
- package/dist/sync/guards.d.ts.map +1 -1
- package/dist/sync/guards.js +61 -0
- package/dist/sync/guards.js.map +1 -1
- package/dist/sync/media/body_scan.d.ts.map +1 -1
- package/dist/sync/media/body_scan.js +9 -3
- package/dist/sync/media/body_scan.js.map +1 -1
- package/dist/sync/media/companions.d.ts +2 -9
- package/dist/sync/media/companions.d.ts.map +1 -1
- package/dist/sync/media/companions.js +5 -23
- package/dist/sync/media/companions.js.map +1 -1
- package/dist/sync/media/mirror_item.d.ts.map +1 -1
- package/dist/sync/media/mirror_item.js +33 -21
- package/dist/sync/media/mirror_item.js.map +1 -1
- package/dist/sync/media/pull_article.d.ts.map +1 -1
- package/dist/sync/media/pull_article.js +3 -2
- package/dist/sync/media/pull_article.js.map +1 -1
- package/dist/sync/media/pull_library.d.ts.map +1 -1
- package/dist/sync/media/pull_library.js +16 -11
- package/dist/sync/media/pull_library.js.map +1 -1
- package/dist/sync/media/remote_index.d.ts.map +1 -1
- package/dist/sync/media/remote_index.js +2 -1
- package/dist/sync/media/remote_index.js.map +1 -1
- package/dist/sync/media/types.d.ts +4 -3
- package/dist/sync/media/types.d.ts.map +1 -1
- package/dist/sync/media/types.js.map +1 -1
- package/dist/sync/new.d.ts +1 -12
- package/dist/sync/new.d.ts.map +1 -1
- package/dist/sync/new.js +0 -39
- package/dist/sync/new.js.map +1 -1
- package/dist/sync/preflight.d.ts +3 -2
- package/dist/sync/preflight.d.ts.map +1 -1
- package/dist/sync/preflight.js +19 -10
- package/dist/sync/preflight.js.map +1 -1
- package/dist/sync/pull.d.ts +6 -44
- package/dist/sync/pull.d.ts.map +1 -1
- package/dist/sync/pull.js +37 -145
- package/dist/sync/pull.js.map +1 -1
- package/dist/sync/push/commit.d.ts +60 -0
- package/dist/sync/push/commit.d.ts.map +1 -0
- package/dist/sync/push/commit.js +230 -0
- package/dist/sync/push/commit.js.map +1 -0
- package/dist/sync/push/guards.d.ts +33 -0
- package/dist/sync/push/guards.d.ts.map +1 -0
- package/dist/sync/push/guards.js +110 -0
- package/dist/sync/push/guards.js.map +1 -0
- package/dist/sync/push/index.d.ts +9 -0
- package/dist/sync/push/index.d.ts.map +1 -0
- package/dist/sync/push/index.js +350 -0
- package/dist/sync/push/index.js.map +1 -0
- package/dist/sync/push/media_stage.d.ts +41 -0
- package/dist/sync/push/media_stage.d.ts.map +1 -0
- package/dist/sync/push/media_stage.js +309 -0
- package/dist/sync/push/media_stage.js.map +1 -0
- package/dist/sync/push/merge_stage.d.ts +37 -0
- package/dist/sync/push/merge_stage.d.ts.map +1 -0
- package/dist/sync/push/merge_stage.js +243 -0
- package/dist/sync/push/merge_stage.js.map +1 -0
- package/dist/sync/push/preflight_stage.d.ts +6 -0
- package/dist/sync/push/preflight_stage.d.ts.map +1 -0
- package/dist/sync/push/preflight_stage.js +40 -0
- package/dist/sync/push/preflight_stage.js.map +1 -0
- package/dist/sync/push/tax_audit.d.ts +24 -0
- package/dist/sync/push/tax_audit.d.ts.map +1 -0
- package/dist/sync/push/tax_audit.js +70 -0
- package/dist/sync/push/tax_audit.js.map +1 -0
- package/dist/sync/push/taxonomy_plan.d.ts +36 -0
- package/dist/sync/push/taxonomy_plan.d.ts.map +1 -0
- package/dist/sync/push/taxonomy_plan.js +136 -0
- package/dist/sync/push/taxonomy_plan.js.map +1 -0
- package/dist/sync/push/transport.d.ts +10 -0
- package/dist/sync/push/transport.d.ts.map +1 -0
- package/dist/sync/push/transport.js +74 -0
- package/dist/sync/push/transport.js.map +1 -0
- package/dist/sync/push/types.d.ts +62 -0
- package/dist/sync/push/types.d.ts.map +1 -0
- package/dist/sync/push/types.js +23 -0
- package/dist/sync/push/types.js.map +1 -0
- package/dist/sync/push.d.ts +2 -57
- package/dist/sync/push.d.ts.map +1 -1
- package/dist/sync/push.js +2 -1137
- package/dist/sync/push.js.map +1 -1
- package/dist/sync/status.d.ts.map +1 -1
- package/dist/sync/status.js +5 -4
- package/dist/sync/status.js.map +1 -1
- package/dist/sync/taxonomies.d.ts.map +1 -1
- package/dist/sync/taxonomies.js +2 -1
- package/dist/sync/taxonomies.js.map +1 -1
- package/dist/sync/terms.d.ts.map +1 -1
- package/dist/sync/terms.js +2 -1
- package/dist/sync/terms.js.map +1 -1
- package/dist/sync/workspace/index.d.ts +41 -0
- package/dist/sync/workspace/index.d.ts.map +1 -0
- package/dist/sync/workspace/index.js +124 -0
- package/dist/sync/workspace/index.js.map +1 -0
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js +1 -3
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/media-body-refs.d.ts +24 -0
- package/dist/utils/media-body-refs.d.ts.map +1 -1
- package/dist/utils/media-body-refs.js +51 -0
- package/dist/utils/media-body-refs.js.map +1 -1
- package/dist/utils/media-companion.d.ts +13 -0
- package/dist/utils/media-companion.d.ts.map +1 -0
- package/dist/utils/media-companion.js +42 -0
- package/dist/utils/media-companion.js.map +1 -0
- package/dist/utils/media-id.d.ts +46 -0
- package/dist/utils/media-id.d.ts.map +1 -0
- package/dist/utils/media-id.js +84 -0
- package/dist/utils/media-id.js.map +1 -0
- package/dist/utils/naming.d.ts.map +1 -1
- package/dist/utils/naming.js +3 -2
- package/dist/utils/naming.js.map +1 -1
- package/dist/utils/ulid.d.ts +31 -0
- package/dist/utils/ulid.d.ts.map +1 -0
- package/dist/utils/ulid.js +65 -0
- package/dist/utils/ulid.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
import { runPreflightChecks } from '../preflight.js';
|
|
23
|
+
import { PushValidationError } from './guards.js';
|
|
24
|
+
export function executePreflightStage(targetFilePath, parsed, options, syncState, baseSnapshot, knownTaxonomies) {
|
|
25
|
+
const preflight = runPreflightChecks(targetFilePath, parsed, {
|
|
26
|
+
allowPublish: options.allowPublish,
|
|
27
|
+
knownTaxonomies,
|
|
28
|
+
baseMarkdown: baseSnapshot?.bodyMarkdown,
|
|
29
|
+
previousStatus: syncState?.status || 'draft',
|
|
30
|
+
workspaceRoot: options.workspaceRoot,
|
|
31
|
+
cache: options.cache,
|
|
32
|
+
});
|
|
33
|
+
if (!preflight.valid) {
|
|
34
|
+
throw new PushValidationError(`Push blocked by Preflight Guards (${preflight.errors.length} error(s)).`, preflight.errors);
|
|
35
|
+
}
|
|
36
|
+
// Update parsed with cleaned body (e.g. trimmed duplicate heading)
|
|
37
|
+
parsed.body = preflight.cleanedBody;
|
|
38
|
+
return preflight;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=preflight_stage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight_stage.js","sourceRoot":"","sources":["../../../src/sync/push/preflight_stage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,kBAAkB,EAAwB,MAAM,iBAAiB,CAAC;AAG3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD,MAAM,UAAU,qBAAqB,CACnC,cAAsB,EACtB,MAAsB,EACtB,OAAoB,EACpB,SAAuC,EACvC,YAA6C,EAC7C,eAA0C;IAE1C,MAAM,SAAS,GAAG,kBAAkB,CAAC,cAAc,EAAE,MAAM,EAAE;QAC3D,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,eAAe;QACf,YAAY,EAAE,YAAY,EAAE,YAAY;QACxC,cAAc,EAAG,SAAS,EAAE,MAAgC,IAAI,OAAO;QACvE,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACrB,MAAM,IAAI,mBAAmB,CAC3B,qCAAqC,SAAS,CAAC,MAAM,CAAC,MAAM,aAAa,EACzE,SAAS,CAAC,MAAM,CACjB,CAAC;IACJ,CAAC;IAED,mEAAmE;IACnE,MAAM,CAAC,IAAI,GAAG,SAAS,CAAC,WAAW,CAAC;IAEpC,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { BaseSnapshot, SyncState } from '../../db/cache.js';
|
|
2
|
+
import type { ParsedMarkdown } from '../../utils/frontmatter.js';
|
|
3
|
+
import type { PushOptions } from './types.js';
|
|
4
|
+
export interface TaxonomyAuditResult {
|
|
5
|
+
remoteTaxAudit: {
|
|
6
|
+
categories: string[] | null;
|
|
7
|
+
tags: string[] | null;
|
|
8
|
+
} | null;
|
|
9
|
+
taxonomyDivergenceDetected: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Pre-PUT Taxonomy Audit to detect out-of-band remote taxonomy changes before updating an article.
|
|
13
|
+
*/
|
|
14
|
+
export declare function auditRemoteTaxonomies(params: {
|
|
15
|
+
collection: string;
|
|
16
|
+
id: string;
|
|
17
|
+
parsed: ParsedMarkdown;
|
|
18
|
+
syncState: SyncState | null | undefined;
|
|
19
|
+
baseSnapshot: BaseSnapshot | null | undefined;
|
|
20
|
+
options: PushOptions;
|
|
21
|
+
fetchFn: typeof fetch;
|
|
22
|
+
warnings: string[];
|
|
23
|
+
}): Promise<TaxonomyAuditResult>;
|
|
24
|
+
//# sourceMappingURL=tax_audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tax_audit.d.ts","sourceRoot":"","sources":["../../../src/sync/push/tax_audit.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,mBAAmB;IAClC,cAAc,EAAE;QAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9E,0BAA0B,EAAE,OAAO,CAAC;CACrC;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,YAAY,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9C,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,OAAO,KAAK,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAwD/B"}
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
import { readBaselineFrontmatter } from '../../db/baseline.js';
|
|
23
|
+
import { fetchAssignedTaxonomies, computeTaxonomyHash } from '../terms.js';
|
|
24
|
+
/**
|
|
25
|
+
* Pre-PUT Taxonomy Audit to detect out-of-band remote taxonomy changes before updating an article.
|
|
26
|
+
*/
|
|
27
|
+
export async function auditRemoteTaxonomies(params) {
|
|
28
|
+
const { collection, id, parsed, syncState, baseSnapshot, options, fetchFn, warnings } = params;
|
|
29
|
+
let remoteTaxAudit = null;
|
|
30
|
+
let taxonomyDivergenceDetected = false;
|
|
31
|
+
const baseFm = readBaselineFrontmatter(baseSnapshot);
|
|
32
|
+
const hasLocalTaxonomies = Boolean(parsed.frontmatter.taxonomies &&
|
|
33
|
+
(parsed.frontmatter.taxonomies.categories !== undefined ||
|
|
34
|
+
parsed.frontmatter.taxonomies.tags !== undefined));
|
|
35
|
+
const hasBaseTaxonomies = Boolean(baseFm?.taxonomies && (baseFm.taxonomies.categories || baseFm.taxonomies.tags));
|
|
36
|
+
if ((hasLocalTaxonomies || hasBaseTaxonomies) && !options.noTaxonomyAudit) {
|
|
37
|
+
remoteTaxAudit = await fetchAssignedTaxonomies({
|
|
38
|
+
origin: options.origin,
|
|
39
|
+
token: options.token,
|
|
40
|
+
collection,
|
|
41
|
+
id,
|
|
42
|
+
fetchFn,
|
|
43
|
+
});
|
|
44
|
+
if (remoteTaxAudit.categories === null && remoteTaxAudit.tags === null) {
|
|
45
|
+
warnings.push('⚠️ Remote taxonomy state unknown (could not audit remote terms).');
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
if (remoteTaxAudit.categories === null) {
|
|
49
|
+
warnings.push('⚠️ Remote category taxonomy state unknown (could not audit categories).');
|
|
50
|
+
}
|
|
51
|
+
if (remoteTaxAudit.tags === null) {
|
|
52
|
+
warnings.push('⚠️ Remote tag taxonomy state unknown (could not audit tags).');
|
|
53
|
+
}
|
|
54
|
+
const baselineTaxHash = syncState?.remoteTaxonomyHash ||
|
|
55
|
+
(baseFm?.taxonomies
|
|
56
|
+
? computeTaxonomyHash(baseFm.taxonomies.categories, baseFm.taxonomies.tags)
|
|
57
|
+
: null);
|
|
58
|
+
const currentRemoteCats = remoteTaxAudit.categories !== null
|
|
59
|
+
? remoteTaxAudit.categories
|
|
60
|
+
: baseFm?.taxonomies?.categories || [];
|
|
61
|
+
const currentRemoteTags = remoteTaxAudit.tags !== null ? remoteTaxAudit.tags : baseFm?.taxonomies?.tags || [];
|
|
62
|
+
const currentRemoteTaxHash = computeTaxonomyHash(currentRemoteCats, currentRemoteTags);
|
|
63
|
+
if (baselineTaxHash && currentRemoteTaxHash !== baselineTaxHash) {
|
|
64
|
+
taxonomyDivergenceDetected = true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return { remoteTaxAudit, taxonomyDivergenceDetected };
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=tax_audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tax_audit.js","sourceRoot":"","sources":["../../../src/sync/push/tax_audit.ts"],"names":[],"m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axonomyMaps } from '../taxonomies.js';
|
|
4
|
+
import type { PushOptions, ResolvedTaxonomyItem } from './types.js';
|
|
5
|
+
export interface TaxonomyPlanResult {
|
|
6
|
+
resolvedTaxonomies: {
|
|
7
|
+
categories?: ResolvedTaxonomyItem[];
|
|
8
|
+
tags?: ResolvedTaxonomyItem[];
|
|
9
|
+
[taxonomy: string]: ResolvedTaxonomyItem[] | undefined;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Canonicalizes frontmatter taxonomy terms in-place before preflight and payload creation.
|
|
14
|
+
*/
|
|
15
|
+
export declare function canonicalizeFrontmatterTaxonomies(parsed: ParsedMarkdown, taxonomyMaps: ReturnType<typeof loadLocalTaxonomyMaps>): TaxonomyPlanResult;
|
|
16
|
+
export interface TaxonomySyncFailure {
|
|
17
|
+
taxonomy: string;
|
|
18
|
+
status: number;
|
|
19
|
+
error: string;
|
|
20
|
+
endpoint: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Synchronizes taxonomy assignments for an article via dedicated terms endpoints.
|
|
24
|
+
*/
|
|
25
|
+
export declare function syncArticleTaxonomies(params: {
|
|
26
|
+
articleId: string;
|
|
27
|
+
collection: string;
|
|
28
|
+
parsed: ParsedMarkdown;
|
|
29
|
+
taxonomyMaps: ReturnType<typeof loadLocalTaxonomyMaps>;
|
|
30
|
+
resolvedTaxonomies: TaxonomyPlanResult['resolvedTaxonomies'];
|
|
31
|
+
baseSnapshot: BaseSnapshot | null | undefined;
|
|
32
|
+
options: PushOptions;
|
|
33
|
+
fetchFn: typeof fetch;
|
|
34
|
+
warnings: string[];
|
|
35
|
+
}): Promise<TaxonomySyncFailure[]>;
|
|
36
|
+
//# sourceMappingURL=taxonomy_plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taxonomy_plan.d.ts","sourceRoot":"","sources":["../../../src/sync/push/taxonomy_plan.ts"],"names":[],"mappings":"AAyBA,OAA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@
|
|
|
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
|
+
import { ApiError } from '../../client/error.js';
|
|
23
|
+
import { articleTermsEndpoint } from '../../client/endpoints.js';
|
|
24
|
+
import { readBaselineFrontmatter } from '../../db/baseline.js';
|
|
25
|
+
/**
|
|
26
|
+
* Canonicalizes frontmatter taxonomy terms in-place before preflight and payload creation.
|
|
27
|
+
*/
|
|
28
|
+
export function canonicalizeFrontmatterTaxonomies(parsed, taxonomyMaps) {
|
|
29
|
+
const resolvedTaxonomies = {};
|
|
30
|
+
const canonicalizeTerms = (taxName, terms) => {
|
|
31
|
+
const list = [];
|
|
32
|
+
const canonicalized = terms.map((term) => {
|
|
33
|
+
// 1. If term is a ULID in idToSlug
|
|
34
|
+
if (taxonomyMaps.idToSlug[taxName]?.[term]) {
|
|
35
|
+
const canonicalSlug = taxonomyMaps.idToSlug[taxName][term];
|
|
36
|
+
list.push({ input: term, resolved: canonicalSlug, id: term });
|
|
37
|
+
return canonicalSlug;
|
|
38
|
+
}
|
|
39
|
+
// 2. If term is in slugToId (can be canonical slug, decoded slug, or human name alias)
|
|
40
|
+
const id = taxonomyMaps.slugToId[taxName]?.[term];
|
|
41
|
+
if (id && taxonomyMaps.idToSlug[taxName]?.[id]) {
|
|
42
|
+
const canonicalSlug = taxonomyMaps.idToSlug[taxName][id];
|
|
43
|
+
if (term !== canonicalSlug) {
|
|
44
|
+
list.push({ input: term, resolved: canonicalSlug, id });
|
|
45
|
+
}
|
|
46
|
+
return canonicalSlug;
|
|
47
|
+
}
|
|
48
|
+
return term;
|
|
49
|
+
});
|
|
50
|
+
if (list.length > 0) {
|
|
51
|
+
resolvedTaxonomies[taxName === 'category' ? 'categories' : 'tags'] = list;
|
|
52
|
+
}
|
|
53
|
+
return canonicalized;
|
|
54
|
+
};
|
|
55
|
+
if (parsed.frontmatter.taxonomies) {
|
|
56
|
+
if (parsed.frontmatter.taxonomies.categories) {
|
|
57
|
+
parsed.frontmatter.taxonomies.categories = canonicalizeTerms('category', parsed.frontmatter.taxonomies.categories);
|
|
58
|
+
}
|
|
59
|
+
if (parsed.frontmatter.taxonomies.tags) {
|
|
60
|
+
parsed.frontmatter.taxonomies.tags = canonicalizeTerms('tag', parsed.frontmatter.taxonomies.tags);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return { resolvedTaxonomies };
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Synchronizes taxonomy assignments for an article via dedicated terms endpoints.
|
|
67
|
+
*/
|
|
68
|
+
export async function syncArticleTaxonomies(params) {
|
|
69
|
+
const { articleId, collection, parsed, taxonomyMaps, resolvedTaxonomies, baseSnapshot, options, fetchFn, warnings, } = params;
|
|
70
|
+
const failures = [];
|
|
71
|
+
if (!parsed.frontmatter.taxonomies)
|
|
72
|
+
return failures;
|
|
73
|
+
const taxMaps = taxonomyMaps;
|
|
74
|
+
const updateTaxonomy = async (taxonomyName, termSlugsOrIds) => {
|
|
75
|
+
const slugMap = taxMaps.slugToId[taxonomyName] || {};
|
|
76
|
+
const idMap = taxMaps.idToSlug[taxonomyName] || {};
|
|
77
|
+
const resolvedTermIds = Array.from(new Set(termSlugsOrIds
|
|
78
|
+
.map((item) => {
|
|
79
|
+
// 1. If item is already a known ULID, preserve it directly to avoid silent substitution
|
|
80
|
+
if (idMap[item])
|
|
81
|
+
return item;
|
|
82
|
+
// 2. If item was canonicalized from a specific ULID or alias, preserve the bound term ID
|
|
83
|
+
const tracked = resolvedTaxonomies[taxonomyName === 'category' ? 'categories' : 'tags'];
|
|
84
|
+
const match = tracked?.find((t) => t.resolved === item);
|
|
85
|
+
if (match?.id)
|
|
86
|
+
return match.id;
|
|
87
|
+
// 3. Fallback to slugMap
|
|
88
|
+
return slugMap[item] || item;
|
|
89
|
+
})
|
|
90
|
+
.filter((tid) => Boolean(tid))));
|
|
91
|
+
if (resolvedTermIds.length === 0) {
|
|
92
|
+
// Check if remote previously had assignments in baseline
|
|
93
|
+
const baseFm = readBaselineFrontmatter(baseSnapshot);
|
|
94
|
+
const prevTerms = taxonomyName === 'category' ? baseFm?.taxonomies?.categories : baseFm?.taxonomies?.tags;
|
|
95
|
+
if (prevTerms && prevTerms.length > 0) {
|
|
96
|
+
if (!options.allowWipeTaxonomies && !options.force && !options.resolveTaxonomy) {
|
|
97
|
+
throw new ApiError({
|
|
98
|
+
endpoint: `/_emdash/api/content/${collection}/${articleId}/terms/${taxonomyName}`,
|
|
99
|
+
code: 'DESTRUCTIVE_TAXONOMY_WIPE',
|
|
100
|
+
status: 400,
|
|
101
|
+
message: `Local article specified empty array for ${taxonomyName}, which would remove ${prevTerms.length} existing remote assignment(s).`,
|
|
102
|
+
suggestion: `Pass --allow-wipe-taxonomies (or --force) to confirm wiping all ${taxonomyName} assignments.`,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
warnings.push(`🏷️ Cleared all ${prevTerms.length} ${taxonomyName} assignment(s) from remote (local specified empty array).`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const termsUrl = articleTermsEndpoint(options.origin, collection, articleId, taxonomyName);
|
|
109
|
+
const termRes = await fetchFn(termsUrl, {
|
|
110
|
+
method: 'POST',
|
|
111
|
+
headers: {
|
|
112
|
+
Authorization: `Bearer ${options.token}`,
|
|
113
|
+
'Content-Type': 'application/json',
|
|
114
|
+
},
|
|
115
|
+
body: JSON.stringify({ termIds: resolvedTermIds }),
|
|
116
|
+
});
|
|
117
|
+
if (!termRes.ok) {
|
|
118
|
+
const errBody = await termRes.text().catch(() => '');
|
|
119
|
+
failures.push({
|
|
120
|
+
taxonomy: taxonomyName,
|
|
121
|
+
status: termRes.status,
|
|
122
|
+
error: errBody || termRes.statusText,
|
|
123
|
+
endpoint: termsUrl,
|
|
124
|
+
});
|
|
125
|
+
warnings.push(`Failed to update ${taxonomyName} terms: ${termRes.statusText} ${errBody}`);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
if (parsed.frontmatter.taxonomies.categories) {
|
|
129
|
+
await updateTaxonomy('category', parsed.frontmatter.taxonomies.categories);
|
|
130
|
+
}
|
|
131
|
+
if (parsed.frontmatter.taxonomies.tags) {
|
|
132
|
+
await updateTaxonomy('tag', parsed.frontmatter.taxonomies.tags);
|
|
133
|
+
}
|
|
134
|
+
return failures;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=taxonomy_plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taxonomy_plan.js","sourceRoot":"","sources":["../../../src/sync/push/taxonomy_plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;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EAAE,QAAQ;aACnB,CAAC,CAAC;YACH,QAAQ,CAAC,IAAI,CAAC,oBAAoB,YAAY,WAAW,OAAO,CAAC,UAAU,IAAI,OAAO,EAAE,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QAC7C,MAAM,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC7E,CAAC;IACD,IAAI,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACvC,MAAM,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PushOptions } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Transitions article publish/draft status via dedicated EmDash endpoints.
|
|
4
|
+
*/
|
|
5
|
+
export declare function transitionContentStatus(collection: string, id: string, targetStatus: 'draft' | 'published', currentRev: string, publishedAt: string | null | undefined, options: PushOptions, fetchFn: typeof fetch): Promise<string>;
|
|
6
|
+
/**
|
|
7
|
+
* Standardized error thrower when a remote article 404s or 410s on update.
|
|
8
|
+
*/
|
|
9
|
+
export declare function throwRemoteArticleDeleted(collection: string, id: string, targetFilePath: string, endpoint: string): never;
|
|
10
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/sync/push/transport.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,MAAM,EACV,YAAY,EAAE,OAAO,GAAG,WAAW,EACnC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACtC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,OAAO,KAAK,GACpB,OAAO,CAAC,MAAM,CAAC,CAsCjB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,MAAM,EACV,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,MAAM,GACf,KAAK,CAYP"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
import { ApiError } from '../../client/error.js';
|
|
23
|
+
import { extractRev } from '../../client/api.js';
|
|
24
|
+
import { articleStatusTransitionEndpoint } from '../../client/endpoints.js';
|
|
25
|
+
/**
|
|
26
|
+
* Transitions article publish/draft status via dedicated EmDash endpoints.
|
|
27
|
+
*/
|
|
28
|
+
export async function transitionContentStatus(collection, id, targetStatus, currentRev, publishedAt, options, fetchFn) {
|
|
29
|
+
const isPublishing = targetStatus === 'published';
|
|
30
|
+
const endpoint = articleStatusTransitionEndpoint(options.origin, collection, id, isPublishing ? 'publish' : 'unpublish');
|
|
31
|
+
const body = { _rev: currentRev };
|
|
32
|
+
if (isPublishing && publishedAt) {
|
|
33
|
+
body.publishedAt = publishedAt;
|
|
34
|
+
}
|
|
35
|
+
const res = await fetchFn(endpoint, {
|
|
36
|
+
method: 'POST',
|
|
37
|
+
headers: {
|
|
38
|
+
Authorization: `Bearer ${options.token}`,
|
|
39
|
+
'Content-Type': 'application/json',
|
|
40
|
+
},
|
|
41
|
+
body: JSON.stringify(body),
|
|
42
|
+
});
|
|
43
|
+
if (!res.ok) {
|
|
44
|
+
const errText = await res.text().catch(() => '');
|
|
45
|
+
throw new ApiError({
|
|
46
|
+
message: `Failed to ${isPublishing ? 'publish' : 'unpublish'} content: ${res.statusText}${errText ? ` - ${errText}` : ''}`,
|
|
47
|
+
code: isPublishing ? 'PUBLISH_FAILED' : 'UNPUBLISH_FAILED',
|
|
48
|
+
status: res.status,
|
|
49
|
+
endpoint,
|
|
50
|
+
suggestion: isPublishing
|
|
51
|
+
? 'Verify publish permissions and revision state.'
|
|
52
|
+
: 'Verify unpublish permissions and revision state.',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const json = (await res.json().catch(() => ({})));
|
|
56
|
+
return extractRev(json, currentRev);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Standardized error thrower when a remote article 404s or 410s on update.
|
|
60
|
+
*/
|
|
61
|
+
export function throwRemoteArticleDeleted(collection, id, targetFilePath, endpoint) {
|
|
62
|
+
throw new ApiError({
|
|
63
|
+
endpoint,
|
|
64
|
+
code: 'REMOTE_ARTICLE_DELETED',
|
|
65
|
+
status: 404,
|
|
66
|
+
message: `Article ${id} (${targetFilePath}) was deleted on the remote server.`,
|
|
67
|
+
suggestion: [
|
|
68
|
+
'1. Keep your edits and re-create as a new article: remove the `id:` field from frontmatter, then "emit push <file>".',
|
|
69
|
+
`2. Discard local edits and untrack: "emit pull ${id} --force" (local copy is preserved under posts/conflicts/)`,
|
|
70
|
+
`3. Delete with rescue backup: "emit delete ${targetFilePath} --discard-local-edits"`,
|
|
71
|
+
].join('\n '),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../src/sync/push/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAG5E;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,UAAkB,EAClB,EAAU,EACV,YAAmC,EACnC,UAAkB,EAClB,WAAsC,EACtC,OAAoB,EACpB,OAAqB;IAErB,MAAM,YAAY,GAAG,YAAY,KAAK,WAAW,CAAC;IAClD,MAAM,QAAQ,GAAG,+BAA+B,CAC9C,OAAO,CAAC,MAAM,EACd,UAAU,EACV,EAAE,EACF,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CACvC,CAAC;IAEF,MAAM,IAAI,GAA4B,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAC3D,IAAI,YAAY,IAAI,WAAW,E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AC;QACjB,QAAQ;QACR,IAAI,EAAE,wBAAwB;QAC9B,MAAM,EAAE,GAAG;QACX,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,qCAAqC;QAC9E,UAAU,EAAE;YACV,sHAAsH;YACtH,kDAAkD,EAAE,8DAA8D;YAClH,8CAA8C,cAAc,yBAAyB;SACtF,CAAC,IAAI,CAAC,MAAM,CAAC;KACf,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { MapperOptions } from '../../client/mapper.js';
|
|
2
|
+
import type { CacheDatabase } from '../../db/cache.js';
|
|
3
|
+
import type { TaxonomyCandidates } from '../../utils/frontmatter.js';
|
|
4
|
+
import type { PreflightError } from '../preflight.js';
|
|
5
|
+
export type TaxonomyResolutionStrategy = 'union' | 'local' | 'remote';
|
|
6
|
+
export interface PushOptions extends MapperOptions {
|
|
7
|
+
workspaceRoot: string;
|
|
8
|
+
cache: CacheDatabase;
|
|
9
|
+
origin: string;
|
|
10
|
+
token: string;
|
|
11
|
+
refreshToken?: string;
|
|
12
|
+
fetchFn?: typeof fetch;
|
|
13
|
+
allowPublish?: boolean;
|
|
14
|
+
knownTaxonomies?: Record<string, string[]>;
|
|
15
|
+
candidates?: TaxonomyCandidates;
|
|
16
|
+
resolveTaxonomy?: TaxonomyResolutionStrategy;
|
|
17
|
+
force?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Explicit confirmation required to clear all remote assignments for a taxonomy.
|
|
20
|
+
*/
|
|
21
|
+
allowWipeTaxonomies?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Skip pre-PUT audit of remote taxonomy assignments (defaults to false).
|
|
24
|
+
*/
|
|
25
|
+
noTaxonomyAudit?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Allow push even if unapplied taxonomy updates remain pending in sync_state.
|
|
28
|
+
*/
|
|
29
|
+
allowUnappliedTaxonomies?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Explicit confirmation required to push an article that is marked delete_pending.
|
|
32
|
+
*/
|
|
33
|
+
revive?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Write mirrored body images into the local file as article-relative `../../media/<storageKey>` references,
|
|
36
|
+
* at the depth derived from the article's own path.
|
|
37
|
+
*/
|
|
38
|
+
localMediaRefs?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface ResolvedTaxonomyItem {
|
|
41
|
+
input: string;
|
|
42
|
+
resolved: string;
|
|
43
|
+
id?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface PushResult {
|
|
46
|
+
success: boolean;
|
|
47
|
+
id: string;
|
|
48
|
+
rev: string;
|
|
49
|
+
filePath: string;
|
|
50
|
+
previousId?: string;
|
|
51
|
+
previousFilePath?: string;
|
|
52
|
+
conflict: boolean;
|
|
53
|
+
taxonomyConflict?: boolean;
|
|
54
|
+
warnings: string[];
|
|
55
|
+
errors?: PreflightError[];
|
|
56
|
+
resolvedTaxonomies?: {
|
|
57
|
+
categories?: ResolvedTaxonomyItem[];
|
|
58
|
+
tags?: ResolvedTaxonomyItem[];
|
|
59
|
+
[taxonomy: string]: ResolvedTaxonomyItem[] | undefined;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/sync/push/types.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEtE,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD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,CAAC;QACpC,IAAI,CAAC,EAAE,oBAAoB,EAAE,CAAC;QAC9B,CAAC,QAAQ,EAAE,MAAM,GAAG,oBAAoB,EAAE,GAAG,SAAS,CAAC;KACxD,CAAC;CACH"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/sync/push/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG"}
|
package/dist/sync/push.d.ts
CHANGED
|
@@ -1,60 +1,5 @@
|
|
|
1
|
-
import type { CacheDatabase } from '../db/cache.js';
|
|
2
|
-
import { type MapperOptions } from '../client/mapper.js';
|
|
3
|
-
import { type TaxonomyCandidates } from '../utils/frontmatter.js';
|
|
4
|
-
import { type PreflightError } from './preflight.js';
|
|
5
|
-
export type TaxonomyResolutionStrategy = 'union' | 'local' | 'remote';
|
|
6
|
-
export interface PushOptions extends MapperOptions {
|
|
7
|
-
workspaceRoot: string;
|
|
8
|
-
cache: CacheDatabase;
|
|
9
|
-
origin: string;
|
|
10
|
-
token: string;
|
|
11
|
-
refreshToken?: string;
|
|
12
|
-
fetchFn?: typeof fetch;
|
|
13
|
-
candidates?: TaxonomyCandidates;
|
|
14
|
-
knownTaxonomies?: Record<string, string[]>;
|
|
15
|
-
resolveTaxonomy?: TaxonomyResolutionStrategy;
|
|
16
|
-
allowWipeTaxonomies?: boolean;
|
|
17
|
-
allowUnappliedTaxonomies?: boolean;
|
|
18
|
-
revive?: boolean;
|
|
19
|
-
force?: boolean;
|
|
20
|
-
noTaxonomyAudit?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Accept body images spelled as local mirror references — article-relative `../../media/<storageKey>` or the
|
|
23
|
-
* older depth-free `media/<storageKey>` — and rewrite them to the canonical
|
|
24
|
-
* `/_emdash/api/media/file/<storageKey>` URL before anything reaches EmDash. The cache baseline stores the
|
|
25
|
-
* canonical form too, so a local-ref workspace never reports a phantom diff.
|
|
26
|
-
*/
|
|
27
|
-
localMediaRefs?: boolean;
|
|
28
|
-
}
|
|
29
|
-
export interface ResolvedTaxonomyItem {
|
|
30
|
-
input: string;
|
|
31
|
-
resolved: string;
|
|
32
|
-
id: string;
|
|
33
|
-
}
|
|
34
|
-
export interface PushResult {
|
|
35
|
-
success: boolean;
|
|
36
|
-
id: string;
|
|
37
|
-
rev: string;
|
|
38
|
-
filePath: string;
|
|
39
|
-
previousId?: string;
|
|
40
|
-
previousFilePath?: string;
|
|
41
|
-
conflict: boolean;
|
|
42
|
-
taxonomyConflict?: boolean;
|
|
43
|
-
warnings: string[];
|
|
44
|
-
errors?: PreflightError[];
|
|
45
|
-
resolvedTaxonomies?: {
|
|
46
|
-
categories?: ResolvedTaxonomyItem[];
|
|
47
|
-
tags?: ResolvedTaxonomyItem[];
|
|
48
|
-
[taxonomy: string]: ResolvedTaxonomyItem[] | undefined;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
export declare class PushValidationError extends Error {
|
|
52
|
-
errors: PreflightError[];
|
|
53
|
-
constructor(message: string, errors: PreflightError[]);
|
|
54
|
-
}
|
|
55
1
|
/**
|
|
56
|
-
*
|
|
57
|
-
* two-tier lock lease protection, and automatic 3-way merge on conflict.
|
|
2
|
+
* Re-exports pushArticle and push pipeline stages including [LOCAL_IMAGE_AUTO_UPLOAD] guards.
|
|
58
3
|
*/
|
|
59
|
-
export
|
|
4
|
+
export * from './push/index.js';
|
|
60
5
|
//# sourceMappingURL=push.d.ts.map
|
package/dist/sync/push.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/sync/push.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/sync/push.ts"],"names":[],"mappings":"AAsBA;;GAEG;AACH,cAAc,iBAAiB,CAAC"}
|