@knapsack/adapter-core 4.92.2--canary.77d16bf.0 → 4.92.2--canary.7350.f533e0d.0
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/dist/index.d.ts +1 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -5
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +43 -85
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -6
- package/tsconfig.json +1 -1
- package/dist/entity-filename.d.ts +0 -30
- package/dist/entity-filename.d.ts.map +0 -1
- package/dist/entity-filename.js +0 -42
- package/dist/entity-filename.js.map +0 -1
- package/dist/entity-frontmatter.d.ts +0 -25
- package/dist/entity-frontmatter.d.ts.map +0 -1
- package/dist/entity-frontmatter.js +0 -25
- package/dist/entity-frontmatter.js.map +0 -1
- package/dist/entity-hash.d.ts +0 -6
- package/dist/entity-hash.d.ts.map +0 -1
- package/dist/entity-hash.js +0 -12
- package/dist/entity-hash.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,15 +4,11 @@
|
|
|
4
4
|
* Core types, interfaces, and utilities for PCIF ingestion.
|
|
5
5
|
* All ingestion pipelines depend on this package for shared infrastructure.
|
|
6
6
|
*/
|
|
7
|
-
export type { SourceType, EntityKind, IngestSourceType, ContextEntity, Manifest, ManifestItem, ValidationResult, PipelineStage,
|
|
7
|
+
export type { SourceType, EntityKind, IngestSourceType, ContextEntity, Manifest, ManifestItem, ValidationResult, PipelineStage, StageInfo, MdxConfig, StorybookConfig, KnapsackConfig, FigmaConfig, ParserConfig, AdapterMessage, } from './types.js';
|
|
8
8
|
export { SOURCE_TYPE_TO_EVT } from './types.js';
|
|
9
9
|
export type { Validator, Parser, Transformer, Analyzer, ContextSrcAdapter, } from './interface.js';
|
|
10
10
|
export type { RuntimeDeps } from './runtime-deps.js';
|
|
11
11
|
export type { Logger, IngestEvt, LogContext } from './log.js';
|
|
12
12
|
export { buildLogContext } from './log.js';
|
|
13
13
|
export { writeFile } from './fs.js';
|
|
14
|
-
export { sourceTag, tagFilenameForEntity } from './entity-filename.js';
|
|
15
|
-
export { contentHash } from './entity-hash.js';
|
|
16
|
-
export type { ComponentEntityFrontmatter, DocumentEntityFrontmatter, EntityFrontmatter, } from './entity-frontmatter.js';
|
|
17
|
-
export { buildEntityFrontmatter } from './entity-frontmatter.js';
|
|
18
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EAEV,UAAU,EACV,UAAU,EACV,gBAAgB,EAEhB,aAAa,EAEb,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAEhB,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EAEV,UAAU,EACV,UAAU,EACV,gBAAgB,EAEhB,aAAa,EAEb,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAEhB,aAAa,EACb,SAAS,EAET,SAAS,EACT,eAAe,EACf,cAAc,EACd,WAAW,EACX,YAAY,EAEZ,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGhD,YAAY,EACV,SAAS,EACT,MAAM,EACN,WAAW,EACX,QAAQ,EACR,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,9 +8,4 @@ export { SOURCE_TYPE_TO_EVT } from './types.js';
|
|
|
8
8
|
export { buildLogContext } from './log.js';
|
|
9
9
|
// Filesystem utilities
|
|
10
10
|
export { writeFile } from './fs.js';
|
|
11
|
-
// Entity filename utilities (PCIF entities/ stage naming)
|
|
12
|
-
export { sourceTag, tagFilenameForEntity } from './entity-filename.js';
|
|
13
|
-
// Entity content hashing
|
|
14
|
-
export { contentHash } from './entity-hash.js';
|
|
15
|
-
export { buildEntityFrontmatter } from './entity-frontmatter.js';
|
|
16
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA0BH,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAgBhD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,uBAAuB;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -37,44 +37,23 @@ export interface ContextEntity {
|
|
|
37
37
|
sourceKey: string;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* Pipeline stages — the ordered lifecycle stages an adapter runs through
|
|
41
|
-
*
|
|
42
|
-
* Source operator (slurp): validate → parse → transform
|
|
43
|
-
* Distro operator (distro): mount → detect → build
|
|
40
|
+
* Pipeline stages — the ordered lifecycle stages an adapter runs through
|
|
44
41
|
*/
|
|
45
|
-
export type PipelineStage = '
|
|
42
|
+
export type PipelineStage = 'parse' | 'transform' | 'validate';
|
|
46
43
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* - success: completed normally, produced expected output
|
|
50
|
-
* - failure: completed but result is bad (data problem, retry won't help)
|
|
51
|
-
* - error: didn't complete (infra/code problem, retry may help)
|
|
52
|
-
* - skipped: didn't run (precondition not met, intentionally bypassed)
|
|
53
|
-
*/
|
|
54
|
-
export type StageStatus = 'success' | 'failure' | 'error' | 'skipped';
|
|
55
|
-
/**
|
|
56
|
-
* Metadata recorded when a stage completes.
|
|
57
|
-
*
|
|
58
|
-
* Modeled after dbt run_results.json per-node shape:
|
|
59
|
-
* every stage produces a uniform result with status, timing, and counts.
|
|
44
|
+
* Metadata recorded when a stage completes
|
|
60
45
|
*/
|
|
61
46
|
export interface StageInfo {
|
|
62
|
-
/** Outcome of this stage */
|
|
63
|
-
status: StageStatus;
|
|
64
47
|
/** Number of items processed in this stage */
|
|
65
48
|
itemCount: number;
|
|
66
49
|
/** Number of errors in this stage */
|
|
67
50
|
errors: number;
|
|
68
51
|
/** Duration of this stage in milliseconds */
|
|
69
52
|
durationMs: number;
|
|
70
|
-
/** ISO-8601 timestamp when this stage started */
|
|
71
|
-
startedAt: string;
|
|
72
53
|
/** ISO-8601 timestamp when this stage completed */
|
|
73
54
|
completedAt: string;
|
|
74
|
-
/** Number of items discovered (parse stage
|
|
55
|
+
/** Number of items discovered in source (parse stage only) */
|
|
75
56
|
discoveredItemCount?: number;
|
|
76
|
-
/** Human-readable message (error detail, skip reason, summary) */
|
|
77
|
-
message?: string;
|
|
78
57
|
}
|
|
79
58
|
/**
|
|
80
59
|
* A single item in the manifest
|
|
@@ -163,25 +142,17 @@ export interface StorybookConfig {
|
|
|
163
142
|
limit?: number;
|
|
164
143
|
}
|
|
165
144
|
/**
|
|
166
|
-
* Knapsack
|
|
167
|
-
*
|
|
168
|
-
* The adapter reads a pre-staged appClientData.json from Storage.
|
|
169
|
-
* Auth is handled by the GraphQL API before the adapter runs —
|
|
170
|
-
* the adapter never authenticates.
|
|
171
|
-
*
|
|
172
|
-
* @see libs/ingest-pipeline/adapters/knapsack/docs/SPEC.md
|
|
145
|
+
* TBD: Knapsack parser configuration
|
|
173
146
|
*/
|
|
174
147
|
export interface KnapsackConfig {
|
|
175
|
-
/**
|
|
148
|
+
/** Stable identifier for this source */
|
|
176
149
|
sourceKey: string;
|
|
177
|
-
/**
|
|
178
|
-
siteId: string;
|
|
179
|
-
/** Branch name ('latest' for production, or branch name for drafts) */
|
|
150
|
+
/** Branch name */
|
|
180
151
|
branchName: string;
|
|
181
|
-
/**
|
|
152
|
+
/** Input path to raw sitemeta schema.json */
|
|
182
153
|
inputPath: string;
|
|
183
|
-
/**
|
|
184
|
-
|
|
154
|
+
/** Optional explicit site ID (defaults to auto-detection from filename) */
|
|
155
|
+
siteId?: string;
|
|
185
156
|
}
|
|
186
157
|
/**
|
|
187
158
|
* TBD: Figma parser configuration
|
|
@@ -209,61 +180,48 @@ export type ParserConfig = ({
|
|
|
209
180
|
type: 'figma';
|
|
210
181
|
} & FigmaConfig);
|
|
211
182
|
/**
|
|
212
|
-
*
|
|
213
|
-
* channelKey is derived from channel.name in DB — url-safe, durable.
|
|
214
|
-
*/
|
|
215
|
-
export interface ChannelConfig {
|
|
216
|
-
/** Channel key — url-safe slug, folder name, durable id */
|
|
217
|
-
readonly channelKey: string;
|
|
218
|
-
/** Site identifier */
|
|
219
|
-
readonly siteId: string;
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Structured messages emitted by operators and the controller.
|
|
183
|
+
* Structured messages the parser sends to the application layer.
|
|
223
184
|
* The handler wires these to SQS, webhooks, or direct callbacks.
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
* - stage.started: stage announces scope of work
|
|
227
|
-
* - item.ok: per-item success with domain-specific metadata
|
|
228
|
-
* - item.error: per-item failure
|
|
229
|
-
* - item.skip: per-item intentional bypass
|
|
230
|
-
* - stage.complete: stage finished with aggregate StageInfo + status
|
|
185
|
+
* These are all TBD, we need to define them later.
|
|
186
|
+
* TODO: needs input from what the ui and db WANT from parsers
|
|
231
187
|
*/
|
|
232
188
|
export type AdapterMessage = {
|
|
233
|
-
stage:
|
|
234
|
-
type: '
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
/** Channel identity — set by distro stages (mount, detect, build) */
|
|
238
|
-
channelKey?: string;
|
|
189
|
+
stage: 'parse';
|
|
190
|
+
type: 'progress';
|
|
191
|
+
itemsComplete: number;
|
|
192
|
+
itemsTotal: number;
|
|
239
193
|
} | {
|
|
240
|
-
stage:
|
|
241
|
-
type: '
|
|
242
|
-
stageInfo: StageInfo;
|
|
243
|
-
/** Source identity — set by source stages (parse, transform) */
|
|
244
|
-
sourceKey?: string;
|
|
245
|
-
/** Channel identity — set by distro stages (mount, detect, build) */
|
|
246
|
-
channelKey?: string;
|
|
247
|
-
} | {
|
|
248
|
-
stage: PipelineStage;
|
|
249
|
-
type: 'item.ok';
|
|
250
|
-
/** Item identity — ref for source stages, canonical key for distro stages */
|
|
194
|
+
stage: 'parse';
|
|
195
|
+
type: 'item.extracted';
|
|
251
196
|
ref: string;
|
|
252
|
-
/** Domain-specific metadata (entityCounts, conflictCount, files, etc.) */
|
|
253
|
-
metadata?: Record<string, unknown>;
|
|
254
197
|
} | {
|
|
255
|
-
stage:
|
|
256
|
-
type: 'item.
|
|
198
|
+
stage: 'parse';
|
|
199
|
+
type: 'item.failed';
|
|
257
200
|
ref: string;
|
|
258
201
|
error: string;
|
|
259
|
-
/** Domain-specific context about the failure */
|
|
260
|
-
metadata?: Record<string, unknown>;
|
|
261
202
|
} | {
|
|
262
|
-
stage:
|
|
263
|
-
type: '
|
|
203
|
+
stage: 'transform';
|
|
204
|
+
type: 'progress';
|
|
205
|
+
itemsComplete: number;
|
|
206
|
+
itemsTotal: number;
|
|
207
|
+
} | {
|
|
208
|
+
stage: 'transform';
|
|
209
|
+
type: 'item.extracted';
|
|
210
|
+
ref: string;
|
|
211
|
+
} | {
|
|
212
|
+
stage: 'transform';
|
|
213
|
+
type: 'item.failed';
|
|
264
214
|
ref: string;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
215
|
+
error: string;
|
|
216
|
+
} | {
|
|
217
|
+
stage: 'parse';
|
|
218
|
+
type: 'stage.complete';
|
|
219
|
+
stageInfo: StageInfo;
|
|
220
|
+
sourceKey: string;
|
|
221
|
+
} | {
|
|
222
|
+
stage: 'transform';
|
|
223
|
+
type: 'stage.complete';
|
|
224
|
+
stageInfo: StageInfo;
|
|
225
|
+
sourceKey: string;
|
|
268
226
|
};
|
|
269
227
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,GAAG,KAAK,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;CAKgB,CAAC;AAEhD,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,UAAU,CAAC,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,CAAC;AAMhE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,GAAG,KAAK,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;CAKgB,CAAC;AAEhD,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,UAAU,CAAC,CAAC;AAEvE;;;;;G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MAAM,CAAA;CAAE,GAEvE;IACE,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,gBAAgB,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,GACD;IACE,KAAK,EAAE,WAAW,CAAC;IACnB,IAAI,EAAE,gBAAgB,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knapsack/adapter-core",
|
|
3
3
|
"description": "Core types, interfaces, and logging for ContextSrcAdapters",
|
|
4
|
-
"version": "4.92.2--canary.
|
|
4
|
+
"version": "4.92.2--canary.7350.f533e0d.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -22,12 +22,11 @@
|
|
|
22
22
|
},
|
|
23
23
|
"author": "Knapsack (https://www.knapsack.cloud)",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@knapsack/logger": "4.92.2--canary.
|
|
26
|
-
"yaml": "^2.7.0"
|
|
25
|
+
"@knapsack/logger": "4.92.2--canary.7350.f533e0d.0"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
29
|
-
"@knapsack/eslint-config-starter": "4.92.2--canary.
|
|
30
|
-
"@knapsack/typescript-config-starter": "4.92.2--canary.
|
|
28
|
+
"@knapsack/eslint-config-starter": "4.92.2--canary.7350.f533e0d.0",
|
|
29
|
+
"@knapsack/typescript-config-starter": "4.92.2--canary.7350.f533e0d.0",
|
|
31
30
|
"@types/node": "^22.19.11",
|
|
32
31
|
"eslint": "^9.20.0",
|
|
33
32
|
"typescript": "^5.9.3"
|
|
@@ -41,5 +40,5 @@
|
|
|
41
40
|
"directory": "libs/ingest-pipeline/adapters/core",
|
|
42
41
|
"type": "git"
|
|
43
42
|
},
|
|
44
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "f533e0d6f2ef88d0612238c96301637025db36d8"
|
|
45
44
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Source tagging — the single identity for a source on disk.
|
|
3
|
-
*
|
|
4
|
-
* A sourceTag is `{sourceEvt}-{hash}` — used as both the folder name
|
|
5
|
-
* and the filename tag for PCIF entities. Readable (you know the source type)
|
|
6
|
-
* and unique (hash of sourceKey).
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* sourceTag('KNAPSACK', { sourceKey: 'accutech@latest' })
|
|
10
|
-
* // → 'knapsack-6d33514'
|
|
11
|
-
*
|
|
12
|
-
* // Same tag everywhere:
|
|
13
|
-
* // sources/knapsack-6d33514/ ← folder
|
|
14
|
-
* // sources/knapsack-6d33514/component/button.vue.knapsack-6d33514.mdx ← filename
|
|
15
|
-
* */
|
|
16
|
-
import { type SourceType } from './types.js';
|
|
17
|
-
/**
|
|
18
|
-
* Compute the source tag — the readable, filesystem-safe, deterministic
|
|
19
|
-
* identity of a source. Used as folder name and filename tag.
|
|
20
|
-
*/
|
|
21
|
-
export declare function sourceTag(source: {
|
|
22
|
-
readonly sourceType: SourceType;
|
|
23
|
-
readonly sourceKey: string;
|
|
24
|
-
}): string;
|
|
25
|
-
/**
|
|
26
|
-
* Tag a bare filename for entity-stage naming.
|
|
27
|
-
* Inserts the sourceTag before the file extension.
|
|
28
|
-
*/
|
|
29
|
-
export declare function tagFilenameForEntity(filename: string, tag: ReturnType<typeof sourceTag>): string;
|
|
30
|
-
//# sourceMappingURL=entity-filename.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity-filename.d.ts","sourceRoot":"","sources":["../src/entity-filename.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;KAcK;AAGL,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAEjE;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE;IAChC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,GAAG,MAAM,CAOT;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,GAChC,MAAM,CAMR"}
|
package/dist/entity-filename.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Source tagging — the single identity for a source on disk.
|
|
3
|
-
*
|
|
4
|
-
* A sourceTag is `{sourceEvt}-{hash}` — used as both the folder name
|
|
5
|
-
* and the filename tag for PCIF entities. Readable (you know the source type)
|
|
6
|
-
* and unique (hash of sourceKey).
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* sourceTag('KNAPSACK', { sourceKey: 'accutech@latest' })
|
|
10
|
-
* // → 'knapsack-6d33514'
|
|
11
|
-
*
|
|
12
|
-
* // Same tag everywhere:
|
|
13
|
-
* // sources/knapsack-6d33514/ ← folder
|
|
14
|
-
* // sources/knapsack-6d33514/component/button.vue.knapsack-6d33514.mdx ← filename
|
|
15
|
-
* */
|
|
16
|
-
import { createHash } from 'node:crypto';
|
|
17
|
-
import { SOURCE_TYPE_TO_EVT } from './types.js';
|
|
18
|
-
/**
|
|
19
|
-
* Compute the source tag — the readable, filesystem-safe, deterministic
|
|
20
|
-
* identity of a source. Used as folder name and filename tag.
|
|
21
|
-
*/
|
|
22
|
-
export function sourceTag(source) {
|
|
23
|
-
const evt = SOURCE_TYPE_TO_EVT[source.sourceType];
|
|
24
|
-
const hash = createHash('sha256')
|
|
25
|
-
.update(source.sourceKey)
|
|
26
|
-
.digest('hex')
|
|
27
|
-
.slice(0, 7);
|
|
28
|
-
return `${evt}-${hash}`;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Tag a bare filename for entity-stage naming.
|
|
32
|
-
* Inserts the sourceTag before the file extension.
|
|
33
|
-
*/
|
|
34
|
-
export function tagFilenameForEntity(filename, tag) {
|
|
35
|
-
const lastDot = filename.lastIndexOf('.');
|
|
36
|
-
if (lastDot === -1)
|
|
37
|
-
return `${filename}.${tag}`;
|
|
38
|
-
const base = filename.slice(0, lastDot);
|
|
39
|
-
const ext = filename.slice(lastDot + 1);
|
|
40
|
-
return `${base}.${tag}.${ext}`;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=entity-filename.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity-filename.js","sourceRoot":"","sources":["../src/entity-filename.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;KAcK;AAEL,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAmB,MAAM,YAAY,CAAC;AAEjE;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,MAGzB;IACC,MAAM,GAAG,GAAG,kBAAkB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC;SAC9B,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;SACxB,MAAM,CAAC,KAAK,CAAC;SACb,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACf,OAAO,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;AAC1B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAgB,EAChB,GAAiC;IAEjC,MAAM,OAAO,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC1C,IAAI,OAAO,KAAK,CAAC,CAAC;QAAE,OAAO,GAAG,QAAQ,IAAI,GAAG,EAAE,CAAC;IAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACxC,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;IACxC,OAAO,GAAG,IAAI,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
type BaseEntityFrontmatter = {
|
|
2
|
-
key: string;
|
|
3
|
-
sourceKey: string;
|
|
4
|
-
source: string;
|
|
5
|
-
lastIngested: string;
|
|
6
|
-
contentHash: string;
|
|
7
|
-
extraFields?: Record<string, unknown>;
|
|
8
|
-
};
|
|
9
|
-
export type ComponentEntityFrontmatter = BaseEntityFrontmatter & {
|
|
10
|
-
entityKind: 'COMPONENT';
|
|
11
|
-
platform: string;
|
|
12
|
-
import?: string | string[];
|
|
13
|
-
};
|
|
14
|
-
export type DocumentEntityFrontmatter = BaseEntityFrontmatter & {
|
|
15
|
-
entityKind: 'DOCUMENT';
|
|
16
|
-
platform?: string;
|
|
17
|
-
};
|
|
18
|
-
export type EntityFrontmatter = ComponentEntityFrontmatter | DocumentEntityFrontmatter;
|
|
19
|
-
/**
|
|
20
|
-
* Shared PCIF frontmatter serializer for MDX entities at the sources/entities stages.
|
|
21
|
-
* Keeps common provenance consistent while still allowing component/document fields.
|
|
22
|
-
*/
|
|
23
|
-
export declare function buildEntityFrontmatter(frontmatter: EntityFrontmatter): string;
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=entity-frontmatter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity-frontmatter.d.ts","sourceRoot":"","sources":["../src/entity-frontmatter.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,qBAAqB,GAAG;IAC/D,UAAU,EAAE,WAAW,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,qBAAqB,GAAG;IAC9D,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB,0BAA0B,GAC1B,yBAAyB,CAAC;AAE9B;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,iBAAiB,GAAG,MAAM,CAuB7E"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { stringify as stringifyYaml } from 'yaml';
|
|
2
|
-
/**
|
|
3
|
-
* Shared PCIF frontmatter serializer for MDX entities at the sources/entities stages.
|
|
4
|
-
* Keeps common provenance consistent while still allowing component/document fields.
|
|
5
|
-
*/
|
|
6
|
-
export function buildEntityFrontmatter(frontmatter) {
|
|
7
|
-
const fields = {
|
|
8
|
-
key: frontmatter.key,
|
|
9
|
-
sourceKey: frontmatter.sourceKey,
|
|
10
|
-
source: frontmatter.source,
|
|
11
|
-
};
|
|
12
|
-
if (frontmatter.platform) {
|
|
13
|
-
fields.platform = frontmatter.platform;
|
|
14
|
-
}
|
|
15
|
-
if (frontmatter.entityKind === 'COMPONENT' && frontmatter.import) {
|
|
16
|
-
fields.import = frontmatter.import;
|
|
17
|
-
}
|
|
18
|
-
if (frontmatter.extraFields) {
|
|
19
|
-
Object.assign(fields, frontmatter.extraFields);
|
|
20
|
-
}
|
|
21
|
-
fields.lastIngested = frontmatter.lastIngested;
|
|
22
|
-
fields.contentHash = frontmatter.contentHash;
|
|
23
|
-
return `---\n${stringifyYaml(fields, { lineWidth: 0 }).trimEnd()}\n---`;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=entity-frontmatter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity-frontmatter.js","sourceRoot":"","sources":["../src/entity-frontmatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AA0BlD;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,WAA8B;IACnE,MAAM,MAAM,GAA4B;QACtC,GAAG,EAAE,WAAW,CAAC,GAAG;QACpB,SAAS,EAAE,WAAW,CAAC,SAAS;QAChC,MAAM,EAAE,WAAW,CAAC,MAAM;KAC3B,CAAC;IAEF,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC;QACzB,MAAM,CAAC,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;IACzC,CAAC;IAED,IAAI,WAAW,CAAC,UAAU,KAAK,WAAW,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;QACjE,MAAM,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IACrC,CAAC;IAED,IAAI,WAAW,CAAC,WAAW,EAAE,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,CAAC,YAAY,GAAG,WAAW,CAAC,YAAY,CAAC;IAC/C,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC;IAE7C,OAAO,QAAQ,aAAa,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC;AAC1E,CAAC"}
|
package/dist/entity-hash.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compute a content hash for MDX entity bodies (first 12 hex chars of SHA-256).
|
|
3
|
-
* Used in frontmatter to track entity content changes across ingests.
|
|
4
|
-
*/
|
|
5
|
-
export declare function contentHash(content: string): string;
|
|
6
|
-
//# sourceMappingURL=entity-hash.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity-hash.d.ts","sourceRoot":"","sources":["../src/entity-hash.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKnD"}
|
package/dist/entity-hash.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createHash } from 'node:crypto';
|
|
2
|
-
/**
|
|
3
|
-
* Compute a content hash for MDX entity bodies (first 12 hex chars of SHA-256).
|
|
4
|
-
* Used in frontmatter to track entity content changes across ingests.
|
|
5
|
-
*/
|
|
6
|
-
export function contentHash(content) {
|
|
7
|
-
return createHash('sha256')
|
|
8
|
-
.update(content, 'utf-8')
|
|
9
|
-
.digest('hex')
|
|
10
|
-
.slice(0, 12);
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=entity-hash.js.map
|
package/dist/entity-hash.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity-hash.js","sourceRoot":"","sources":["../src/entity-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,UAAU,CAAC,QAAQ,CAAC;SACxB,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;SACxB,MAAM,CAAC,KAAK,CAAC;SACb,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAClB,CAAC"}
|