@c4a/extract 0.7.4 → 0.7.8
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/bin/c4a-extract-code.js +1 -0
- package/index.js +46 -6
- package/package.json +1 -1
package/bin/c4a-extract-code.js
CHANGED
|
@@ -14220,6 +14220,7 @@ var buildEdgeHashId = (edge2, packageName, modulePath, versionLabel) => hashStab
|
|
|
14220
14220
|
isExternal: edge2.isExternal,
|
|
14221
14221
|
grounding: edge2.grounding,
|
|
14222
14222
|
source: edge2.source,
|
|
14223
|
+
file: edge2.file ?? null,
|
|
14223
14224
|
line: edge2.line ?? null,
|
|
14224
14225
|
versionLabel
|
|
14225
14226
|
});
|
package/index.js
CHANGED
|
@@ -14059,7 +14059,17 @@ var relationSourceSchema = exports_external.enum([
|
|
|
14059
14059
|
var packageKindSchema2 = exports_external.enum(Object.values(PackageKind));
|
|
14060
14060
|
var symbolParamSchema = exports_external.object({
|
|
14061
14061
|
name: exports_external.string().min(1),
|
|
14062
|
-
type: exports_external.string().min(1).nullable()
|
|
14062
|
+
type: exports_external.string().min(1).nullable(),
|
|
14063
|
+
optional: exports_external.boolean().optional(),
|
|
14064
|
+
rest: exports_external.boolean().optional(),
|
|
14065
|
+
defaultValue: exports_external.string().optional()
|
|
14066
|
+
});
|
|
14067
|
+
var registrationSchema = exports_external.object({
|
|
14068
|
+
kind: exports_external.enum(["http", "schedule", "event"]),
|
|
14069
|
+
key: exports_external.string(),
|
|
14070
|
+
handler: exports_external.string(),
|
|
14071
|
+
method: exports_external.string().optional(),
|
|
14072
|
+
middleware: exports_external.array(exports_external.string())
|
|
14063
14073
|
});
|
|
14064
14074
|
var symbolInfoSchema = exports_external.lazy(() => exports_external.object({
|
|
14065
14075
|
name: exports_external.string().min(1),
|
|
@@ -14070,6 +14080,14 @@ var symbolInfoSchema = exports_external.lazy(() => exports_external.object({
|
|
|
14070
14080
|
endLine: exports_external.number().int().positive(),
|
|
14071
14081
|
members: exports_external.array(symbolInfoSchema).optional(),
|
|
14072
14082
|
params: exports_external.array(symbolParamSchema).optional(),
|
|
14083
|
+
optional: exports_external.boolean().optional(),
|
|
14084
|
+
readonly: exports_external.boolean().optional(),
|
|
14085
|
+
defaultValue: exports_external.string().optional(),
|
|
14086
|
+
typeParameters: exports_external.string().optional(),
|
|
14087
|
+
overloads: exports_external.array(exports_external.string()).optional(),
|
|
14088
|
+
publicEntrypoints: exports_external.array(exports_external.string()).optional(),
|
|
14089
|
+
contractResolution: exports_external.enum(["resolved", "declaration-only"]).optional(),
|
|
14090
|
+
registration: registrationSchema.optional(),
|
|
14073
14091
|
returnType: exports_external.string().min(1).nullable().optional(),
|
|
14074
14092
|
typeAnnotation: exports_external.string().min(1).nullable().optional(),
|
|
14075
14093
|
extends: exports_external.string().min(1).nullable().optional(),
|
|
@@ -14084,6 +14102,7 @@ var relationInfoSchema = exports_external.object({
|
|
|
14084
14102
|
type: relationTypeSchema,
|
|
14085
14103
|
from: exports_external.string().min(1),
|
|
14086
14104
|
to: exports_external.string().min(1),
|
|
14105
|
+
file: exports_external.string().min(1).optional(),
|
|
14087
14106
|
isExternal: exports_external.boolean(),
|
|
14088
14107
|
grounding: groundingSchema,
|
|
14089
14108
|
confidence: exports_external.number().min(0).max(1),
|
|
@@ -14490,7 +14509,7 @@ var BOM = "\uFEFF";
|
|
|
14490
14509
|
var HASH_ID_RE = /^(?:sha256:)?[a-f0-9]{64}$/u;
|
|
14491
14510
|
var SOURCE_SPAN_HASH_RE = /^[a-f0-9]{8,64}$/u;
|
|
14492
14511
|
var DOCUMENT_SOURCE_SLUG_RE = /^[a-z0-9][a-z0-9._-]*$/u;
|
|
14493
|
-
var DOCUMENT_SOURCE_BATCH_RE = /^\d{8}\/[
|
|
14512
|
+
var DOCUMENT_SOURCE_BATCH_RE = /^\d{8}\/[^/\\\x00-\x1f:#?]+$/u;
|
|
14494
14513
|
function isRecord2(value) {
|
|
14495
14514
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
14496
14515
|
}
|
|
@@ -14509,8 +14528,8 @@ function normalizeHashId(value) {
|
|
|
14509
14528
|
return `sha256:${hex}`;
|
|
14510
14529
|
}
|
|
14511
14530
|
function assertDocumentSourceType(value) {
|
|
14512
|
-
if (value !== "file" && value !== "lark") {
|
|
14513
|
-
throw new TypeError(`document source_type must be file or
|
|
14531
|
+
if (value !== "file" && value !== "lark" && value !== "note" && value !== "sessions") {
|
|
14532
|
+
throw new TypeError(`document source_type must be file, lark, note or sessions: ${value}`);
|
|
14514
14533
|
}
|
|
14515
14534
|
}
|
|
14516
14535
|
function normalizeDocumentSourceName(name) {
|
|
@@ -14558,9 +14577,19 @@ function decodeSnapshotLocatorPath(path3) {
|
|
|
14558
14577
|
}
|
|
14559
14578
|
}
|
|
14560
14579
|
function parseDocumentSourceLocator(source) {
|
|
14561
|
-
const match = /^(file|lark):(.+)$/u.exec(source);
|
|
14580
|
+
const match = /^(file|lark|note|sessions):(.+)$/u.exec(source);
|
|
14562
14581
|
if (match?.[1] === undefined || match[2] === undefined)
|
|
14563
14582
|
return null;
|
|
14583
|
+
if (match[1] === "note" || match[1] === "sessions") {
|
|
14584
|
+
try {
|
|
14585
|
+
const sourceName2 = normalizeDocumentSourceName(match[2]);
|
|
14586
|
+
if (!sourceName2.endsWith(".md") || !/^\d{8}\//u.test(sourceName2))
|
|
14587
|
+
return null;
|
|
14588
|
+
return { sourceType: match[1], sourceName: sourceName2, documentPath: sourceName2.slice(9) };
|
|
14589
|
+
} catch {
|
|
14590
|
+
return null;
|
|
14591
|
+
}
|
|
14592
|
+
}
|
|
14564
14593
|
const segments = match[2].split("/");
|
|
14565
14594
|
const batched = /^\d{8}$/u.test(segments[0] ?? "") && segments.length >= 3;
|
|
14566
14595
|
const sourceName = batched ? `${segments[0]}/${segments[1]}` : segments[0];
|
|
@@ -15929,6 +15958,7 @@ var buildEdgeHashId = (edge2, packageName, modulePath, versionLabel) => hashStab
|
|
|
15929
15958
|
isExternal: edge2.isExternal,
|
|
15930
15959
|
grounding: edge2.grounding,
|
|
15931
15960
|
source: edge2.source,
|
|
15961
|
+
file: edge2.file ?? null,
|
|
15932
15962
|
line: edge2.line ?? null,
|
|
15933
15963
|
versionLabel
|
|
15934
15964
|
});
|
|
@@ -16305,6 +16335,8 @@ function semanticExtractionPayload(extraction) {
|
|
|
16305
16335
|
};
|
|
16306
16336
|
}
|
|
16307
16337
|
function relationSourceFile(relation, symbols, filePaths) {
|
|
16338
|
+
if (relation.file !== undefined)
|
|
16339
|
+
return filePaths.has(relation.file) ? relation.file : null;
|
|
16308
16340
|
if (filePaths.has(relation.from))
|
|
16309
16341
|
return relation.from;
|
|
16310
16342
|
const candidates = symbols.filter((symbol) => symbol.name === relation.from);
|
|
@@ -16386,6 +16418,10 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
16386
16418
|
}
|
|
16387
16419
|
const facts = [];
|
|
16388
16420
|
if (coverageFile.disposition === "analyzed" && fileInfo) {
|
|
16421
|
+
const source = invocation.source_files?.[normalizedPath];
|
|
16422
|
+
if (invocation.source_files !== undefined && source === undefined) {
|
|
16423
|
+
throw new TypeError(`Analyzed file ${normalizedPath} has no scoped source text`);
|
|
16424
|
+
}
|
|
16389
16425
|
facts.push(fact2({
|
|
16390
16426
|
sourceRef: invocation.authorized_scope.source_ref,
|
|
16391
16427
|
moduleRef: invocation.module_ref,
|
|
@@ -16393,7 +16429,11 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
16393
16429
|
qualifiedItemPath: "file",
|
|
16394
16430
|
kind: "source-file",
|
|
16395
16431
|
signature: { path: normalizedPath, language: fileInfo.language },
|
|
16396
|
-
payload: fileInfo
|
|
16432
|
+
payload: source === undefined ? fileInfo : {
|
|
16433
|
+
...fileInfo,
|
|
16434
|
+
line: 1,
|
|
16435
|
+
endLine: source.split(/\r\n|\r|\n/u).length
|
|
16436
|
+
},
|
|
16397
16437
|
denominator: ownsDenominators ? "eligible-file" : "none"
|
|
16398
16438
|
}));
|
|
16399
16439
|
facts.push(fact2({
|