@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
|
@@ -3,7 +3,7 @@ import { metrics } from '../index.js';
|
|
|
3
3
|
import { b as MetricsRegistry } from '../../registry-_yEKhTTl.js';
|
|
4
4
|
import { S as SignalManager } from '../../manager-CH3fX7zO.js';
|
|
5
5
|
import { IncomingMessage, ServerResponse, Server } from 'node:http';
|
|
6
|
-
import '../../types-
|
|
6
|
+
import '../../types-DdoeE7F5.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Prometheus exporter constants
|
|
@@ -6,6 +6,9 @@ import { dirname, join, relative, extname } from 'path';
|
|
|
6
6
|
import { fileURLToPath } from 'url';
|
|
7
7
|
import glob from 'fast-glob';
|
|
8
8
|
import Ajv from 'ajv';
|
|
9
|
+
import Ajv2019 from 'ajv/dist/2019';
|
|
10
|
+
import Ajv2020 from 'ajv/dist/2020';
|
|
11
|
+
import AjvDraft04 from 'ajv-draft-04';
|
|
9
12
|
import addFormats from 'ajv-formats';
|
|
10
13
|
import { Readable } from 'stream';
|
|
11
14
|
import picomatch from 'picomatch';
|
|
@@ -1572,20 +1575,14 @@ async function loadMetaSchema(draft) {
|
|
|
1572
1575
|
const content = await readFile(metaSchemaPath, "utf-8");
|
|
1573
1576
|
return JSON.parse(content);
|
|
1574
1577
|
}
|
|
1575
|
-
async function loadVocabularySchemas() {
|
|
1578
|
+
async function loadVocabularySchemas(draft) {
|
|
1579
|
+
if (draft !== "draft-2019-09" && draft !== "draft-2020-12") {
|
|
1580
|
+
return [];
|
|
1581
|
+
}
|
|
1576
1582
|
const __filename3 = fileURLToPath(import.meta.url);
|
|
1577
1583
|
const __dirname4 = dirname(__filename3);
|
|
1578
|
-
const vocabDir = join(
|
|
1579
|
-
|
|
1580
|
-
"..",
|
|
1581
|
-
"..",
|
|
1582
|
-
"schemas",
|
|
1583
|
-
"crucible-ts",
|
|
1584
|
-
"meta",
|
|
1585
|
-
"draft-2020-12",
|
|
1586
|
-
"meta"
|
|
1587
|
-
);
|
|
1588
|
-
const vocabFiles = [
|
|
1584
|
+
const vocabDir = join(__dirname4, "..", "..", "schemas", "crucible-ts", "meta", draft, "meta");
|
|
1585
|
+
const vocabFiles = draft === "draft-2020-12" ? [
|
|
1589
1586
|
"core.json",
|
|
1590
1587
|
"applicator.json",
|
|
1591
1588
|
"unevaluated.json",
|
|
@@ -1593,6 +1590,13 @@ async function loadVocabularySchemas() {
|
|
|
1593
1590
|
"meta-data.json",
|
|
1594
1591
|
"format-annotation.json",
|
|
1595
1592
|
"content.json"
|
|
1593
|
+
] : [
|
|
1594
|
+
"core.json",
|
|
1595
|
+
"applicator.json",
|
|
1596
|
+
"validation.json",
|
|
1597
|
+
"meta-data.json",
|
|
1598
|
+
"format.json",
|
|
1599
|
+
"content.json"
|
|
1596
1600
|
];
|
|
1597
1601
|
const schemas = [];
|
|
1598
1602
|
for (const file of vocabFiles) {
|
|
@@ -1647,47 +1651,68 @@ async function loadReferencedSchema(uri) {
|
|
|
1647
1651
|
}
|
|
1648
1652
|
return JSON.parse(content);
|
|
1649
1653
|
}
|
|
1650
|
-
function
|
|
1651
|
-
if (!
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
}
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1654
|
+
function detectDialect(schema) {
|
|
1655
|
+
if (schema && typeof schema === "object" && !Array.isArray(schema)) {
|
|
1656
|
+
const maybeSchema = schema;
|
|
1657
|
+
const declared = maybeSchema.$schema;
|
|
1658
|
+
if (typeof declared === "string") {
|
|
1659
|
+
if (declared.includes("draft-04")) return "draft-04";
|
|
1660
|
+
if (declared.includes("draft-06")) return "draft-06";
|
|
1661
|
+
if (declared.includes("draft-07")) return "draft-07";
|
|
1662
|
+
if (declared.includes("draft/2019-09")) return "draft-2019-09";
|
|
1663
|
+
if (declared.includes("draft/2020-12")) return "draft-2020-12";
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
return "draft-2020-12";
|
|
1667
|
+
}
|
|
1668
|
+
function createAjv(dialect) {
|
|
1669
|
+
const AjvCtor = dialect === "draft-2020-12" ? Ajv2020 : dialect === "draft-2019-09" ? Ajv2019 : dialect === "draft-04" ? AjvDraft04 : Ajv;
|
|
1670
|
+
const ajv = new AjvCtor({
|
|
1671
|
+
strict: false,
|
|
1672
|
+
allErrors: true,
|
|
1673
|
+
verbose: true,
|
|
1674
|
+
// Allow schemas with $id to be added without replacing existing ones
|
|
1675
|
+
addUsedSchema: false,
|
|
1676
|
+
// draft-04 uses "id"; later drafts use "$id"
|
|
1677
|
+
schemaId: dialect === "draft-04" ? "id" : "$id",
|
|
1678
|
+
// Enable async schema loading for YAML references
|
|
1679
|
+
loadSchema: loadReferencedSchema
|
|
1680
|
+
});
|
|
1681
|
+
addFormats(ajv, {
|
|
1682
|
+
mode: "fast",
|
|
1683
|
+
formats: ["date-time", "email", "hostname", "ipv4", "ipv6", "uri", "uri-reference"]
|
|
1684
|
+
});
|
|
1685
|
+
return ajv;
|
|
1686
|
+
}
|
|
1687
|
+
async function getAjv(dialect) {
|
|
1688
|
+
const existing = ajvInstances.get(dialect);
|
|
1689
|
+
if (existing) {
|
|
1690
|
+
const ready = metaschemaReady.get(dialect);
|
|
1691
|
+
if (ready) await ready;
|
|
1692
|
+
return existing;
|
|
1693
|
+
}
|
|
1694
|
+
const ajv = createAjv(dialect);
|
|
1695
|
+
ajvInstances.set(dialect, ajv);
|
|
1696
|
+
const readyPromise = Promise.all([loadVocabularySchemas(dialect), loadMetaSchema(dialect)]).then(([vocabSchemas, metaSchema]) => {
|
|
1697
|
+
for (const vocabSchema of vocabSchemas) {
|
|
1698
|
+
try {
|
|
1699
|
+
ajv.addMetaSchema(vocabSchema);
|
|
1700
|
+
} catch {
|
|
1674
1701
|
}
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1702
|
+
}
|
|
1703
|
+
try {
|
|
1704
|
+
ajv.addMetaSchema(metaSchema);
|
|
1705
|
+
} catch {
|
|
1706
|
+
}
|
|
1707
|
+
}).catch((error) => {
|
|
1708
|
+
throw new Error(`Failed to load metaschemas (${dialect}): ${error}`);
|
|
1709
|
+
});
|
|
1710
|
+
metaschemaReady.set(dialect, readyPromise);
|
|
1711
|
+
await readyPromise;
|
|
1712
|
+
return ajv;
|
|
1680
1713
|
}
|
|
1681
1714
|
async function compileSchema(schema, options = {}) {
|
|
1682
|
-
const
|
|
1683
|
-
if (metaschemaReady) {
|
|
1684
|
-
await metaschemaReady;
|
|
1685
|
-
}
|
|
1686
|
-
const cacheKey = typeof schema === "string" ? schema : JSON.stringify(schema);
|
|
1687
|
-
const cached = schemaCache.get(cacheKey);
|
|
1688
|
-
if (cached !== void 0) {
|
|
1689
|
-
return cached;
|
|
1690
|
-
}
|
|
1715
|
+
const baseKey = typeof schema === "string" ? schema : JSON.stringify(schema);
|
|
1691
1716
|
let parsedSchema;
|
|
1692
1717
|
if (typeof schema === "string") {
|
|
1693
1718
|
try {
|
|
@@ -1705,18 +1730,27 @@ async function compileSchema(schema, options = {}) {
|
|
|
1705
1730
|
} else {
|
|
1706
1731
|
parsedSchema = schema;
|
|
1707
1732
|
}
|
|
1733
|
+
const dialect = detectDialect(parsedSchema);
|
|
1734
|
+
const ajv = await getAjv(dialect);
|
|
1735
|
+
const cacheKey = `${dialect}:${baseKey}`;
|
|
1736
|
+
const cached = schemaCache.get(cacheKey);
|
|
1737
|
+
if (cached !== void 0) {
|
|
1738
|
+
return cached;
|
|
1739
|
+
}
|
|
1708
1740
|
try {
|
|
1709
1741
|
if (options.aliases && options.aliases.length > 0) {
|
|
1710
1742
|
for (const alias of options.aliases) {
|
|
1711
1743
|
if (alias && ajv.getSchema(alias) === void 0) {
|
|
1712
1744
|
try {
|
|
1713
|
-
|
|
1745
|
+
if (typeof parsedSchema === "object" && parsedSchema !== null) {
|
|
1746
|
+
ajv.addSchema(parsedSchema, alias);
|
|
1747
|
+
}
|
|
1714
1748
|
} catch {
|
|
1715
1749
|
}
|
|
1716
1750
|
}
|
|
1717
1751
|
}
|
|
1718
1752
|
}
|
|
1719
|
-
const validator = await ajv.compileAsync(parsedSchema);
|
|
1753
|
+
const validator = typeof parsedSchema === "boolean" ? ajv.compile(parsedSchema) : await ajv.compileAsync(parsedSchema);
|
|
1720
1754
|
schemaCache.set(cacheKey, validator);
|
|
1721
1755
|
return validator;
|
|
1722
1756
|
} catch (error) {
|
|
@@ -1786,8 +1820,39 @@ async function validateFile(filePath, validator) {
|
|
|
1786
1820
|
}
|
|
1787
1821
|
async function validateSchema(schema) {
|
|
1788
1822
|
try {
|
|
1789
|
-
|
|
1790
|
-
|
|
1823
|
+
let parsedSchema;
|
|
1824
|
+
if (typeof schema === "string") {
|
|
1825
|
+
try {
|
|
1826
|
+
parsedSchema = JSON.parse(schema);
|
|
1827
|
+
} catch {
|
|
1828
|
+
parsedSchema = parse(schema);
|
|
1829
|
+
}
|
|
1830
|
+
} else if (Buffer.isBuffer(schema)) {
|
|
1831
|
+
const content = schema.toString("utf-8");
|
|
1832
|
+
try {
|
|
1833
|
+
parsedSchema = JSON.parse(content);
|
|
1834
|
+
} catch {
|
|
1835
|
+
parsedSchema = parse(content);
|
|
1836
|
+
}
|
|
1837
|
+
} else {
|
|
1838
|
+
parsedSchema = schema;
|
|
1839
|
+
}
|
|
1840
|
+
const dialect = detectDialect(parsedSchema);
|
|
1841
|
+
const ajv = await getAjv(dialect);
|
|
1842
|
+
const metaValid = ajv.validateSchema(parsedSchema);
|
|
1843
|
+
if (!metaValid && ajv.errors) {
|
|
1844
|
+
const diagnostics = ajv.errors.map(
|
|
1845
|
+
(error) => createDiagnostic(
|
|
1846
|
+
error.instancePath || "",
|
|
1847
|
+
error.message || "Schema meta-validation failed",
|
|
1848
|
+
error.keyword || "unknown",
|
|
1849
|
+
"ERROR",
|
|
1850
|
+
"ajv"
|
|
1851
|
+
)
|
|
1852
|
+
);
|
|
1853
|
+
return { valid: false, diagnostics, source: "ajv" };
|
|
1854
|
+
}
|
|
1855
|
+
await compileSchema(parsedSchema);
|
|
1791
1856
|
return {
|
|
1792
1857
|
valid: true,
|
|
1793
1858
|
diagnostics: [],
|
|
@@ -1858,14 +1923,15 @@ async function validateFileBySchemaId(filePath, schemaId, registryOptions) {
|
|
|
1858
1923
|
throw error;
|
|
1859
1924
|
}
|
|
1860
1925
|
}
|
|
1861
|
-
var
|
|
1926
|
+
var ajvInstances, metaschemaReady, schemaCache;
|
|
1862
1927
|
var init_validator = __esm({
|
|
1863
1928
|
"src/schema/validator.ts"() {
|
|
1864
1929
|
init_telemetry();
|
|
1865
1930
|
init_errors();
|
|
1866
1931
|
init_registry();
|
|
1867
1932
|
init_utils();
|
|
1868
|
-
|
|
1933
|
+
ajvInstances = /* @__PURE__ */ new Map();
|
|
1934
|
+
metaschemaReady = /* @__PURE__ */ new Map();
|
|
1869
1935
|
schemaCache = /* @__PURE__ */ new Map();
|
|
1870
1936
|
}
|
|
1871
1937
|
});
|