@fulmenhq/tsfulmen 0.2.0 → 0.2.2
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 +42 -0
- package/README.md +60 -7
- package/config/crucible-ts/agentic/roles/README.md +3 -3
- package/config/crucible-ts/library/fulencode/fixtures/README.md +18 -0
- package/config/crucible-ts/library/fulencode/fixtures/bom/bom.yaml +14 -0
- package/config/crucible-ts/library/fulencode/fixtures/detection/detection.yaml +12 -0
- package/config/crucible-ts/library/fulencode/fixtures/invalid-encodings/base64.yaml +10 -0
- package/config/crucible-ts/library/fulencode/fixtures/normalization/text-safe.yaml +10 -0
- package/config/crucible-ts/library/fulencode/fixtures/telemetry/telemetry-test-cases.yaml +24 -0
- package/config/crucible-ts/library/fulencode/fixtures/valid-encodings/base64.yaml +11 -0
- package/config/crucible-ts/taxonomy/library/platform-modules/v1.0.0/modules.yaml +2 -2
- package/config/crucible-ts/taxonomy/metrics.yaml +79 -1
- package/dist/appidentity/index.d.ts +1 -1
- package/dist/appidentity/index.js +122 -56
- package/dist/appidentity/index.js.map +1 -1
- package/dist/config/index.js +122 -56
- package/dist/config/index.js.map +1 -1
- package/dist/crucible/index.js +122 -56
- package/dist/crucible/index.js.map +1 -1
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +122 -56
- package/dist/errors/index.js.map +1 -1
- package/dist/foundry/index.js +122 -56
- package/dist/foundry/index.js.map +1 -1
- package/dist/fulencode/index.d.ts +102 -0
- package/dist/fulencode/index.js +806 -0
- package/dist/fulencode/index.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +123 -57
- package/dist/index.js.map +1 -1
- package/dist/pathfinder/index.d.ts +1 -1
- package/dist/pathfinder/index.js +122 -56
- package/dist/pathfinder/index.js.map +1 -1
- package/dist/reports/license-inventory.csv +7 -6
- package/dist/schema/index.d.ts +2 -2
- package/dist/schema/index.js +122 -56
- package/dist/schema/index.js.map +1 -1
- package/dist/signals/index.js +122 -56
- package/dist/signals/index.js.map +1 -1
- package/dist/telemetry/http/index.js +122 -56
- package/dist/telemetry/http/index.js.map +1 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.js +122 -56
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/prometheus/index.d.ts +1 -1
- package/dist/telemetry/prometheus/index.js +122 -56
- package/dist/telemetry/prometheus/index.js.map +1 -1
- package/dist/{types-BJswWpQC.d.ts → types-DdoeE7F5.d.ts} +1 -1
- package/package.json +7 -2
- package/schemas/crucible-ts/library/fulencode/v1.0.0/README.md +37 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/bom-result.schema.json +48 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/decode-options.schema.json +60 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/decoding-result.schema.json +70 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/detect-options.schema.json +25 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/detection-result.schema.json +57 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/encode-options.schema.json +71 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/encoding-result.schema.json +57 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/fulencode-config.schema.json +8 -4
- package/schemas/crucible-ts/library/fulencode/v1.0.0/fulencode-error.schema.json +66 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/normalization-result.schema.json +73 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/normalize-options.schema.json +44 -0
- package/schemas/crucible-ts/meta/README.md +38 -2
- package/schemas/crucible-ts/meta/draft-04/schema.json +222 -0
- package/schemas/crucible-ts/meta/draft-06/schema.json +218 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/applicator.json +93 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/content.json +21 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/core.json +58 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/format.json +15 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/meta-data.json +35 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/validation.json +119 -0
- package/schemas/crucible-ts/meta/draft-2019-09/offline.schema.json +148 -0
- package/schemas/crucible-ts/meta/draft-2019-09/schema.json +62 -0
- package/schemas/crucible-ts/meta/fixtures/draft-04-sample.json +16 -0
- package/schemas/crucible-ts/meta/fixtures/draft-06-sample.json +16 -0
- package/schemas/crucible-ts/meta/fixtures/draft-07-sample.json +34 -0
- package/schemas/crucible-ts/meta/fixtures/draft-2019-09-sample.json +21 -0
- package/schemas/crucible-ts/meta/fixtures/draft-2020-12-sample.json +21 -0
- package/schemas/crucible-ts/taxonomy/library/fulencode/normalization-profiles/v1.0.0/profiles.yaml +16 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/PROVENANCE.md +64 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/access-tier.dimension.json +103 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/retention-lifecycle.dimension.json +103 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/schema-stability.dimension.json +100 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/sensitivity.dimension.json +130 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/velocity-mode.dimension.json +79 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/volatility.dimension.json +72 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/volume-tier.dimension.json +66 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/catalog/classifiers/README.md +29 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/access-tier-classification.md +163 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/classifiers-framework.md +157 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/data-sensitivity-classification.md +259 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/retention-lifecycle-classification.md +200 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/schema-stability-classification.md +205 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/velocity-mode-classification.md +222 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/volatility-classification.md +209 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/volume-tier-classification.md +200 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/ailink/v0/README.md +48 -0
- package/schemas/crucible-ts/upstream/3leaps/{ailink → crucible/schemas/ailink}/v0/prompt.schema.json +4 -18
- package/schemas/crucible-ts/upstream/3leaps/{ailink → crucible/schemas/ailink}/v0/search-response.schema.json +7 -37
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/classifiers/v0/dimension-definition.schema.json +247 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/classifiers/v0/sensitivity-level.schema.json +67 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/foundation/v0/error-response.schema.json +59 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/foundation/v0/lifecycle-phases.data.json +102 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/foundation/v0/lifecycle-phases.schema.json +101 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/foundation/v0/release-phase.schema.json +18 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/foundation/v0/types.schema.json +177 -0
- package/schemas/crucible-ts/upstream/3leaps/PROVENANCE.md +0 -43
- /package/schemas/crucible-ts/upstream/3leaps/{agentic → crucible/schemas/agentic}/v0/role-prompt.schema.json +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { b as FulmenErrorOptions, F as FulmenError } from '../fulmen-error-B_kX8jSC.js';
|
|
2
2
|
import { L as Logger } from '../logger-Eycya5Mz.js';
|
|
3
3
|
import { b as MetricsRegistry } from '../registry-_yEKhTTl.js';
|
|
4
|
-
import { C as CompiledValidator, S as SchemaValidationResult } from '../types-
|
|
4
|
+
import { C as CompiledValidator, S as SchemaValidationResult } from '../types-DdoeE7F5.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Pathfinder types - Core type definitions for filesystem traversal
|
package/dist/pathfinder/index.js
CHANGED
|
@@ -7,6 +7,9 @@ import path3, { dirname, join, relative, extname, resolve } from 'path';
|
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
8
|
import glob from 'fast-glob';
|
|
9
9
|
import Ajv from 'ajv';
|
|
10
|
+
import Ajv2019 from 'ajv/dist/2019';
|
|
11
|
+
import Ajv2020 from 'ajv/dist/2020';
|
|
12
|
+
import AjvDraft04 from 'ajv-draft-04';
|
|
10
13
|
import addFormats from 'ajv-formats';
|
|
11
14
|
import { Readable } from 'stream';
|
|
12
15
|
import picomatch from 'picomatch';
|
|
@@ -1858,20 +1861,14 @@ async function loadMetaSchema(draft) {
|
|
|
1858
1861
|
const content = await readFile(metaSchemaPath, "utf-8");
|
|
1859
1862
|
return JSON.parse(content);
|
|
1860
1863
|
}
|
|
1861
|
-
async function loadVocabularySchemas() {
|
|
1864
|
+
async function loadVocabularySchemas(draft) {
|
|
1865
|
+
if (draft !== "draft-2019-09" && draft !== "draft-2020-12") {
|
|
1866
|
+
return [];
|
|
1867
|
+
}
|
|
1862
1868
|
const __filename3 = fileURLToPath(import.meta.url);
|
|
1863
1869
|
const __dirname4 = dirname(__filename3);
|
|
1864
|
-
const vocabDir = join(
|
|
1865
|
-
|
|
1866
|
-
"..",
|
|
1867
|
-
"..",
|
|
1868
|
-
"schemas",
|
|
1869
|
-
"crucible-ts",
|
|
1870
|
-
"meta",
|
|
1871
|
-
"draft-2020-12",
|
|
1872
|
-
"meta"
|
|
1873
|
-
);
|
|
1874
|
-
const vocabFiles = [
|
|
1870
|
+
const vocabDir = join(__dirname4, "..", "..", "schemas", "crucible-ts", "meta", draft, "meta");
|
|
1871
|
+
const vocabFiles = draft === "draft-2020-12" ? [
|
|
1875
1872
|
"core.json",
|
|
1876
1873
|
"applicator.json",
|
|
1877
1874
|
"unevaluated.json",
|
|
@@ -1879,6 +1876,13 @@ async function loadVocabularySchemas() {
|
|
|
1879
1876
|
"meta-data.json",
|
|
1880
1877
|
"format-annotation.json",
|
|
1881
1878
|
"content.json"
|
|
1879
|
+
] : [
|
|
1880
|
+
"core.json",
|
|
1881
|
+
"applicator.json",
|
|
1882
|
+
"validation.json",
|
|
1883
|
+
"meta-data.json",
|
|
1884
|
+
"format.json",
|
|
1885
|
+
"content.json"
|
|
1882
1886
|
];
|
|
1883
1887
|
const schemas = [];
|
|
1884
1888
|
for (const file of vocabFiles) {
|
|
@@ -1933,47 +1937,68 @@ async function loadReferencedSchema(uri) {
|
|
|
1933
1937
|
}
|
|
1934
1938
|
return JSON.parse(content);
|
|
1935
1939
|
}
|
|
1936
|
-
function
|
|
1937
|
-
if (!
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1940
|
+
function detectDialect(schema) {
|
|
1941
|
+
if (schema && typeof schema === "object" && !Array.isArray(schema)) {
|
|
1942
|
+
const maybeSchema = schema;
|
|
1943
|
+
const declared = maybeSchema.$schema;
|
|
1944
|
+
if (typeof declared === "string") {
|
|
1945
|
+
if (declared.includes("draft-04")) return "draft-04";
|
|
1946
|
+
if (declared.includes("draft-06")) return "draft-06";
|
|
1947
|
+
if (declared.includes("draft-07")) return "draft-07";
|
|
1948
|
+
if (declared.includes("draft/2019-09")) return "draft-2019-09";
|
|
1949
|
+
if (declared.includes("draft/2020-12")) return "draft-2020-12";
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
return "draft-2020-12";
|
|
1953
|
+
}
|
|
1954
|
+
function createAjv(dialect) {
|
|
1955
|
+
const AjvCtor = dialect === "draft-2020-12" ? Ajv2020 : dialect === "draft-2019-09" ? Ajv2019 : dialect === "draft-04" ? AjvDraft04 : Ajv;
|
|
1956
|
+
const ajv = new AjvCtor({
|
|
1957
|
+
strict: false,
|
|
1958
|
+
allErrors: true,
|
|
1959
|
+
verbose: true,
|
|
1960
|
+
// Allow schemas with $id to be added without replacing existing ones
|
|
1961
|
+
addUsedSchema: false,
|
|
1962
|
+
// draft-04 uses "id"; later drafts use "$id"
|
|
1963
|
+
schemaId: dialect === "draft-04" ? "id" : "$id",
|
|
1964
|
+
// Enable async schema loading for YAML references
|
|
1965
|
+
loadSchema: loadReferencedSchema
|
|
1966
|
+
});
|
|
1967
|
+
addFormats(ajv, {
|
|
1968
|
+
mode: "fast",
|
|
1969
|
+
formats: ["date-time", "email", "hostname", "ipv4", "ipv6", "uri", "uri-reference"]
|
|
1970
|
+
});
|
|
1971
|
+
return ajv;
|
|
1972
|
+
}
|
|
1973
|
+
async function getAjv(dialect) {
|
|
1974
|
+
const existing = ajvInstances.get(dialect);
|
|
1975
|
+
if (existing) {
|
|
1976
|
+
const ready = metaschemaReady.get(dialect);
|
|
1977
|
+
if (ready) await ready;
|
|
1978
|
+
return existing;
|
|
1979
|
+
}
|
|
1980
|
+
const ajv = createAjv(dialect);
|
|
1981
|
+
ajvInstances.set(dialect, ajv);
|
|
1982
|
+
const readyPromise = Promise.all([loadVocabularySchemas(dialect), loadMetaSchema(dialect)]).then(([vocabSchemas, metaSchema]) => {
|
|
1983
|
+
for (const vocabSchema of vocabSchemas) {
|
|
1984
|
+
try {
|
|
1985
|
+
ajv.addMetaSchema(vocabSchema);
|
|
1986
|
+
} catch {
|
|
1960
1987
|
}
|
|
1961
|
-
}
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1988
|
+
}
|
|
1989
|
+
try {
|
|
1990
|
+
ajv.addMetaSchema(metaSchema);
|
|
1991
|
+
} catch {
|
|
1992
|
+
}
|
|
1993
|
+
}).catch((error) => {
|
|
1994
|
+
throw new Error(`Failed to load metaschemas (${dialect}): ${error}`);
|
|
1995
|
+
});
|
|
1996
|
+
metaschemaReady.set(dialect, readyPromise);
|
|
1997
|
+
await readyPromise;
|
|
1998
|
+
return ajv;
|
|
1966
1999
|
}
|
|
1967
2000
|
async function compileSchema(schema, options = {}) {
|
|
1968
|
-
const
|
|
1969
|
-
if (metaschemaReady) {
|
|
1970
|
-
await metaschemaReady;
|
|
1971
|
-
}
|
|
1972
|
-
const cacheKey = typeof schema === "string" ? schema : JSON.stringify(schema);
|
|
1973
|
-
const cached = schemaCache.get(cacheKey);
|
|
1974
|
-
if (cached !== void 0) {
|
|
1975
|
-
return cached;
|
|
1976
|
-
}
|
|
2001
|
+
const baseKey = typeof schema === "string" ? schema : JSON.stringify(schema);
|
|
1977
2002
|
let parsedSchema;
|
|
1978
2003
|
if (typeof schema === "string") {
|
|
1979
2004
|
try {
|
|
@@ -1991,18 +2016,27 @@ async function compileSchema(schema, options = {}) {
|
|
|
1991
2016
|
} else {
|
|
1992
2017
|
parsedSchema = schema;
|
|
1993
2018
|
}
|
|
2019
|
+
const dialect = detectDialect(parsedSchema);
|
|
2020
|
+
const ajv = await getAjv(dialect);
|
|
2021
|
+
const cacheKey = `${dialect}:${baseKey}`;
|
|
2022
|
+
const cached = schemaCache.get(cacheKey);
|
|
2023
|
+
if (cached !== void 0) {
|
|
2024
|
+
return cached;
|
|
2025
|
+
}
|
|
1994
2026
|
try {
|
|
1995
2027
|
if (options.aliases && options.aliases.length > 0) {
|
|
1996
2028
|
for (const alias of options.aliases) {
|
|
1997
2029
|
if (alias && ajv.getSchema(alias) === void 0) {
|
|
1998
2030
|
try {
|
|
1999
|
-
|
|
2031
|
+
if (typeof parsedSchema === "object" && parsedSchema !== null) {
|
|
2032
|
+
ajv.addSchema(parsedSchema, alias);
|
|
2033
|
+
}
|
|
2000
2034
|
} catch {
|
|
2001
2035
|
}
|
|
2002
2036
|
}
|
|
2003
2037
|
}
|
|
2004
2038
|
}
|
|
2005
|
-
const validator = await ajv.compileAsync(parsedSchema);
|
|
2039
|
+
const validator = typeof parsedSchema === "boolean" ? ajv.compile(parsedSchema) : await ajv.compileAsync(parsedSchema);
|
|
2006
2040
|
schemaCache.set(cacheKey, validator);
|
|
2007
2041
|
return validator;
|
|
2008
2042
|
} catch (error) {
|
|
@@ -2072,8 +2106,39 @@ async function validateFile(filePath, validator) {
|
|
|
2072
2106
|
}
|
|
2073
2107
|
async function validateSchema(schema) {
|
|
2074
2108
|
try {
|
|
2075
|
-
|
|
2076
|
-
|
|
2109
|
+
let parsedSchema;
|
|
2110
|
+
if (typeof schema === "string") {
|
|
2111
|
+
try {
|
|
2112
|
+
parsedSchema = JSON.parse(schema);
|
|
2113
|
+
} catch {
|
|
2114
|
+
parsedSchema = parse(schema);
|
|
2115
|
+
}
|
|
2116
|
+
} else if (Buffer.isBuffer(schema)) {
|
|
2117
|
+
const content = schema.toString("utf-8");
|
|
2118
|
+
try {
|
|
2119
|
+
parsedSchema = JSON.parse(content);
|
|
2120
|
+
} catch {
|
|
2121
|
+
parsedSchema = parse(content);
|
|
2122
|
+
}
|
|
2123
|
+
} else {
|
|
2124
|
+
parsedSchema = schema;
|
|
2125
|
+
}
|
|
2126
|
+
const dialect = detectDialect(parsedSchema);
|
|
2127
|
+
const ajv = await getAjv(dialect);
|
|
2128
|
+
const metaValid = ajv.validateSchema(parsedSchema);
|
|
2129
|
+
if (!metaValid && ajv.errors) {
|
|
2130
|
+
const diagnostics = ajv.errors.map(
|
|
2131
|
+
(error) => createDiagnostic(
|
|
2132
|
+
error.instancePath || "",
|
|
2133
|
+
error.message || "Schema meta-validation failed",
|
|
2134
|
+
error.keyword || "unknown",
|
|
2135
|
+
"ERROR",
|
|
2136
|
+
"ajv"
|
|
2137
|
+
)
|
|
2138
|
+
);
|
|
2139
|
+
return { valid: false, diagnostics, source: "ajv" };
|
|
2140
|
+
}
|
|
2141
|
+
await compileSchema(parsedSchema);
|
|
2077
2142
|
return {
|
|
2078
2143
|
valid: true,
|
|
2079
2144
|
diagnostics: [],
|
|
@@ -2144,14 +2209,15 @@ async function validateFileBySchemaId(filePath, schemaId, registryOptions) {
|
|
|
2144
2209
|
throw error;
|
|
2145
2210
|
}
|
|
2146
2211
|
}
|
|
2147
|
-
var
|
|
2212
|
+
var ajvInstances, metaschemaReady, schemaCache;
|
|
2148
2213
|
var init_validator = __esm({
|
|
2149
2214
|
"src/schema/validator.ts"() {
|
|
2150
2215
|
init_telemetry();
|
|
2151
2216
|
init_errors2();
|
|
2152
2217
|
init_registry();
|
|
2153
2218
|
init_utils();
|
|
2154
|
-
|
|
2219
|
+
ajvInstances = /* @__PURE__ */ new Map();
|
|
2220
|
+
metaschemaReady = /* @__PURE__ */ new Map();
|
|
2155
2221
|
schemaCache = /* @__PURE__ */ new Map();
|
|
2156
2222
|
}
|
|
2157
2223
|
});
|