@utilix-tech/sdk 0.82.0 → 0.84.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/CHANGELOG.md +8 -0
- package/README.md +8 -3
- package/dist/{ai_agent-DeCy0oZK.d.cts → ai_agent-B9wWLBDf.d.cts} +29 -2
- package/dist/{ai_agent-DeCy0oZK.d.ts → ai_agent-B9wWLBDf.d.ts} +29 -2
- package/dist/{chunk-HJLGUNSO.js → chunk-5VVC7BHS.js} +41 -1
- package/dist/{chunk-IEPWZERQ.js → chunk-6EJVNQSY.js} +38 -1
- package/dist/{chunk-FPFA4ZHC.js → chunk-RMXZMYSG.js} +166 -1
- package/dist/{code-B8yHwP3m.d.cts → code-mkKV7BQ4.d.cts} +73 -2
- package/dist/{code-B8yHwP3m.d.ts → code-mkKV7BQ4.d.ts} +73 -2
- package/dist/index.cjs +242 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{time-KqJjdqII.d.cts → time-VMAy_SrV.d.cts} +22 -2
- package/dist/{time-KqJjdqII.d.ts → time-VMAy_SrV.d.ts} +22 -2
- package/dist/tools/ai_agent.cjs +40 -0
- package/dist/tools/ai_agent.d.cts +1 -1
- package/dist/tools/ai_agent.d.ts +1 -1
- package/dist/tools/ai_agent.js +1 -1
- package/dist/tools/code.cjs +165 -0
- package/dist/tools/code.d.cts +1 -1
- package/dist/tools/code.d.ts +1 -1
- package/dist/tools/code.js +1 -1
- package/dist/tools/time.cjs +37 -0
- package/dist/tools/time.d.cts +1 -1
- package/dist/tools/time.d.ts +1 -1
- package/dist/tools/time.js +1 -1
- package/package.json +1 -1
package/dist/tools/code.cjs
CHANGED
|
@@ -1801,6 +1801,111 @@ function normalizeRef(ref) {
|
|
|
1801
1801
|
const tagPart = parsed.digest ? `@${parsed.digest}` : parsed.tag ? `:${parsed.tag}` : "";
|
|
1802
1802
|
return `${parsed.registry}/${ns}${parsed.repository}${tagPart}`;
|
|
1803
1803
|
}
|
|
1804
|
+
function _parseDockerfileInstructions(content) {
|
|
1805
|
+
const rawLines = content.replace(/\r\n/g, "\n").split("\n");
|
|
1806
|
+
const instructions = [];
|
|
1807
|
+
let buffer = "";
|
|
1808
|
+
let bufferStartLine = 0;
|
|
1809
|
+
for (let i = 0; i < rawLines.length; i++) {
|
|
1810
|
+
const lineNo = i + 1;
|
|
1811
|
+
const line = rawLines[i];
|
|
1812
|
+
const trimmed = line.trim();
|
|
1813
|
+
if (buffer === "") {
|
|
1814
|
+
if (trimmed === "" || trimmed.startsWith("#")) continue;
|
|
1815
|
+
bufferStartLine = lineNo;
|
|
1816
|
+
buffer = line.trimEnd();
|
|
1817
|
+
} else {
|
|
1818
|
+
buffer += "\n" + line.trimEnd();
|
|
1819
|
+
}
|
|
1820
|
+
if (buffer.endsWith("\\")) {
|
|
1821
|
+
buffer = buffer.slice(0, -1);
|
|
1822
|
+
continue;
|
|
1823
|
+
}
|
|
1824
|
+
const match = buffer.trim().match(/^([A-Za-z]+)\s*([\s\S]*)$/);
|
|
1825
|
+
if (match) {
|
|
1826
|
+
instructions.push({ instruction: match[1].toUpperCase(), args: match[2].trim(), line: bufferStartLine });
|
|
1827
|
+
}
|
|
1828
|
+
buffer = "";
|
|
1829
|
+
}
|
|
1830
|
+
return instructions;
|
|
1831
|
+
}
|
|
1832
|
+
var _DOCKERFILE_TAR_RE = /\.(tar(\.(gz|bz2|xz))?|tgz|tbz2|txz)$/i;
|
|
1833
|
+
function lintDockerfile(content) {
|
|
1834
|
+
if (!content || !content.trim()) return { error: "Dockerfile content is required" };
|
|
1835
|
+
const instructions = _parseDockerfileInstructions(content);
|
|
1836
|
+
if (instructions.length === 0) return { error: "No Dockerfile instructions found" };
|
|
1837
|
+
const fromInstructions = instructions.filter((i) => i.instruction === "FROM");
|
|
1838
|
+
if (fromInstructions.length === 0) return { error: "No FROM instruction found; this does not look like a valid Dockerfile" };
|
|
1839
|
+
const stageNames = /* @__PURE__ */ new Set();
|
|
1840
|
+
const stages = fromInstructions.map((inst, idx) => {
|
|
1841
|
+
const asMatch = inst.args.match(/^(\S+)(?:\s+AS\s+(\S+))?/i);
|
|
1842
|
+
const baseImage = asMatch ? asMatch[1] : inst.args.split(/\s+/)[0];
|
|
1843
|
+
const name = asMatch && asMatch[2] ? asMatch[2] : null;
|
|
1844
|
+
if (name) stageNames.add(name.toLowerCase());
|
|
1845
|
+
return { index: idx, name, baseImage, fromLine: inst.line };
|
|
1846
|
+
});
|
|
1847
|
+
const findings = [];
|
|
1848
|
+
for (const stage of stages) {
|
|
1849
|
+
const base = stage.baseImage;
|
|
1850
|
+
if (base.toLowerCase() === "scratch") continue;
|
|
1851
|
+
if (stageNames.has(base.toLowerCase())) continue;
|
|
1852
|
+
const withoutDigest = base.split("@")[0];
|
|
1853
|
+
const hasTag = withoutDigest.includes(":");
|
|
1854
|
+
const tag = hasTag ? withoutDigest.split(":").pop() : null;
|
|
1855
|
+
if (!hasTag) {
|
|
1856
|
+
findings.push({
|
|
1857
|
+
rule: "unpinned-base-image",
|
|
1858
|
+
severity: "warning",
|
|
1859
|
+
line: stage.fromLine,
|
|
1860
|
+
message: `FROM ${base} has no tag, so it resolves to ":latest", which can silently change what gets built on a future run. Pin an explicit version tag instead.`
|
|
1861
|
+
});
|
|
1862
|
+
} else if (tag === "latest") {
|
|
1863
|
+
findings.push({
|
|
1864
|
+
rule: "unpinned-base-image",
|
|
1865
|
+
severity: "warning",
|
|
1866
|
+
line: stage.fromLine,
|
|
1867
|
+
message: `FROM ${base} is explicitly pinned to the "latest" tag, which is a moving target rather than a fixed version. Pin an explicit version tag instead.`
|
|
1868
|
+
});
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
const finalStage = stages[stages.length - 1];
|
|
1872
|
+
const finalStageInstructions = instructions.filter((i) => i.line >= finalStage.fromLine);
|
|
1873
|
+
if (!finalStageInstructions.some((i) => i.instruction === "WORKDIR")) {
|
|
1874
|
+
findings.push({
|
|
1875
|
+
rule: "missing-workdir",
|
|
1876
|
+
severity: "warning",
|
|
1877
|
+
line: finalStage.fromLine,
|
|
1878
|
+
message: 'No WORKDIR instruction in the final stage, so RUN/CMD/ENTRYPOINT execute from "/" by default. Set an explicit WORKDIR.'
|
|
1879
|
+
});
|
|
1880
|
+
}
|
|
1881
|
+
if (!finalStageInstructions.some((i) => i.instruction === "USER")) {
|
|
1882
|
+
findings.push({
|
|
1883
|
+
rule: "running-as-root",
|
|
1884
|
+
severity: "warning",
|
|
1885
|
+
line: finalStage.fromLine,
|
|
1886
|
+
message: "No USER instruction in the final stage, so the container runs as root by default. Add a non-root USER unless root is genuinely required."
|
|
1887
|
+
});
|
|
1888
|
+
}
|
|
1889
|
+
for (const inst of instructions) {
|
|
1890
|
+
if (inst.instruction !== "ADD") continue;
|
|
1891
|
+
const parts = inst.args.split(/\s+/).filter(Boolean).filter((p) => !p.startsWith("--"));
|
|
1892
|
+
if (parts.length < 2) continue;
|
|
1893
|
+
const sources = parts.slice(0, -1);
|
|
1894
|
+
for (const src of sources) {
|
|
1895
|
+
const isUrl = /^https?:\/\//i.test(src);
|
|
1896
|
+
const isTar = _DOCKERFILE_TAR_RE.test(src);
|
|
1897
|
+
if (!isUrl && !isTar) {
|
|
1898
|
+
findings.push({
|
|
1899
|
+
rule: "add-vs-copy",
|
|
1900
|
+
severity: "info",
|
|
1901
|
+
line: inst.line,
|
|
1902
|
+
message: `ADD ${src} copies a local file/directory, not a URL or an auto-extracting archive. Use COPY instead, since ADD's extra behavior (remote fetch, tar auto-extract) doesn't apply here.`
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
return { findings, stages };
|
|
1908
|
+
}
|
|
1804
1909
|
function removeJsComments(code) {
|
|
1805
1910
|
let result = "";
|
|
1806
1911
|
let i = 0;
|
|
@@ -4201,6 +4306,64 @@ function countSqlPlaceholders(sql) {
|
|
|
4201
4306
|
numberedDuplicates
|
|
4202
4307
|
};
|
|
4203
4308
|
}
|
|
4309
|
+
var LINK_REF_DEFINITION_REGEX = /^ {0,3}\[([^\]]+)\]:\s*(\S+)(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?\s*$/;
|
|
4310
|
+
var LINK_REF_USAGE_REGEX = /(!?)\[([^[\]\n]*)\]\[([^[\]\n]*)\]/g;
|
|
4311
|
+
function normalizeLinkLabel(label) {
|
|
4312
|
+
return label.trim().replace(/\s+/g, " ").toLowerCase();
|
|
4313
|
+
}
|
|
4314
|
+
function extractMarkdownLinkReferences(markdown) {
|
|
4315
|
+
const trimmed = markdown.trim();
|
|
4316
|
+
if (!trimmed) return { error: "Empty input" };
|
|
4317
|
+
const lines = markdown.replace(/\r\n/g, "\n").split("\n");
|
|
4318
|
+
const definitions = [];
|
|
4319
|
+
const definitionsByLabel = /* @__PURE__ */ new Map();
|
|
4320
|
+
for (const line of lines) {
|
|
4321
|
+
const match = line.match(LINK_REF_DEFINITION_REGEX);
|
|
4322
|
+
if (!match) continue;
|
|
4323
|
+
const label = match[1];
|
|
4324
|
+
const normalized = normalizeLinkLabel(label);
|
|
4325
|
+
if (definitionsByLabel.has(normalized)) continue;
|
|
4326
|
+
const def = {
|
|
4327
|
+
label,
|
|
4328
|
+
url: match[2],
|
|
4329
|
+
title: match[3] ?? match[4] ?? match[5] ?? void 0
|
|
4330
|
+
};
|
|
4331
|
+
definitionsByLabel.set(normalized, def);
|
|
4332
|
+
definitions.push(def);
|
|
4333
|
+
}
|
|
4334
|
+
const usages = [];
|
|
4335
|
+
for (const m of markdown.matchAll(LINK_REF_USAGE_REGEX)) {
|
|
4336
|
+
const image = m[1] === "!";
|
|
4337
|
+
const text = m[2];
|
|
4338
|
+
const rawRef = m[3];
|
|
4339
|
+
const label = rawRef.trim() === "" ? text : rawRef;
|
|
4340
|
+
usages.push({ text, label, image });
|
|
4341
|
+
}
|
|
4342
|
+
if (definitions.length === 0 && usages.length === 0) {
|
|
4343
|
+
return { error: "No reference-style links or definitions found" };
|
|
4344
|
+
}
|
|
4345
|
+
const usedLabels = /* @__PURE__ */ new Set();
|
|
4346
|
+
const resolved = [];
|
|
4347
|
+
const unresolvedReferences = [];
|
|
4348
|
+
for (const usage of usages) {
|
|
4349
|
+
const normalized = normalizeLinkLabel(usage.label);
|
|
4350
|
+
const def = definitionsByLabel.get(normalized);
|
|
4351
|
+
if (def) {
|
|
4352
|
+
usedLabels.add(normalized);
|
|
4353
|
+
resolved.push({ ...usage, url: def.url, title: def.title });
|
|
4354
|
+
} else {
|
|
4355
|
+
unresolvedReferences.push(usage);
|
|
4356
|
+
}
|
|
4357
|
+
}
|
|
4358
|
+
const unusedDefinitions = definitions.filter((d) => !usedLabels.has(normalizeLinkLabel(d.label)));
|
|
4359
|
+
return {
|
|
4360
|
+
referenceCount: usages.length,
|
|
4361
|
+
definitionCount: definitions.length,
|
|
4362
|
+
resolved,
|
|
4363
|
+
unresolvedReferences,
|
|
4364
|
+
unusedDefinitions
|
|
4365
|
+
};
|
|
4366
|
+
}
|
|
4204
4367
|
|
|
4205
4368
|
exports.ALL_FLAGS = ALL_FLAGS;
|
|
4206
4369
|
exports.CHEATSHEET = CHEATSHEET;
|
|
@@ -4225,6 +4388,7 @@ exports.detectRedos = detectRedos;
|
|
|
4225
4388
|
exports.envToExport = envToExport;
|
|
4226
4389
|
exports.envToJson = envToJson;
|
|
4227
4390
|
exports.extractMarkdownFootnotes = extractMarkdownFootnotes;
|
|
4391
|
+
exports.extractMarkdownLinkReferences = extractMarkdownLinkReferences;
|
|
4228
4392
|
exports.extractSvgSpriteSymbols = extractSvgSpriteSymbols;
|
|
4229
4393
|
exports.formatCss = formatCss;
|
|
4230
4394
|
exports.formatGql = formatGql;
|
|
@@ -4236,6 +4400,7 @@ exports.getJsStats = getJsStats;
|
|
|
4236
4400
|
exports.getMethodColor = getMethodColor;
|
|
4237
4401
|
exports.isValidTag = isValidTag;
|
|
4238
4402
|
exports.lintConventionalCommit = lintConventionalCommit;
|
|
4403
|
+
exports.lintDockerfile = lintDockerfile;
|
|
4239
4404
|
exports.lookupMime = lookupMime;
|
|
4240
4405
|
exports.minifyCss = minifyCss;
|
|
4241
4406
|
exports.minifyGql = minifyGql;
|
package/dist/tools/code.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as ALL_FLAGS, a as ApiEndpoint, b as ApiInfo, d as AriaIssue, e as AriaValidationResult, C as CHEATSHEET, f as CheatsheetEntry, g as CommitTrailer, h as CommitTrailerResult, i as ConnectionStringHost, j as ConnectionStringResult, k as ConventionalCommitFinding, l as ConventionalCommitFooter, m as ConventionalCommitOptions, n as ConventionalCommitParsed, o as ConventionalCommitResult, p as ConventionalCommitSeverity, q as CssResult, D as DEFAULT_COMMIT_TYPES, r as DependencyAuditDuplicate, s as DependencyAuditEntry, t as DependencyAuditIssue, u as DependencyAuditResult, v as DependencyRangeType, w as DependencySection, x as DockerImageRef, E as EditorConfigIssue,
|
|
1
|
+
export { A as ALL_FLAGS, a as ApiEndpoint, b as ApiInfo, d as AriaIssue, e as AriaValidationResult, C as CHEATSHEET, f as CheatsheetEntry, g as CommitTrailer, h as CommitTrailerResult, i as ConnectionStringHost, j as ConnectionStringResult, k as ConventionalCommitFinding, l as ConventionalCommitFooter, m as ConventionalCommitOptions, n as ConventionalCommitParsed, o as ConventionalCommitResult, p as ConventionalCommitSeverity, q as CssResult, D as DEFAULT_COMMIT_TYPES, r as DependencyAuditDuplicate, s as DependencyAuditEntry, t as DependencyAuditIssue, u as DependencyAuditResult, v as DependencyRangeType, w as DependencySection, x as DockerImageRef, y as DockerfileLintFinding, z as DockerfileLintResult, B as DockerfileStage, E as EditorConfigIssue, F as EditorConfigProperty, G as EditorConfigSection, H as EditorConfigValidationResult, I as EnvEntry, J as EnvParseResult, K as ExportsIssue, L as ExportsShape, M as ExportsValidationResult, N as FenceTagIssue, O as FenceTagIssueType, P as FenceValidationResult, Q as GitCommandConfig, R as GitCommandResult, S as GitOperation, T as GithubUrlInfo, U as GithubUrlType, V as GitignoreTestResult, W as GqlFormatResult, X as HtmlFormatResult, Y as HtmlMinifyOptions, Z as HtmlMinifyResult, _ as JsMinifyOptions, $ as JsMinifyResult, a0 as KNOWN_LANGUAGE_TAGS, a1 as LinkReferenceDefinition, a2 as LinkReferenceUsage, a3 as MIME_TABLE, a4 as MarkdownFootnoteDefinition, a5 as MarkdownFootnoteReference, a6 as MarkdownFootnoteResult, a7 as MarkdownLinkReferenceResult, a8 as MatchResult, a9 as MimeEntry, aa as MimeLookupResult, ab as OPERATIONS, ac as ParsedSpec, ad as PlaceholderStyle, ae as RedosFinding, af as RedosResult, ag as RedosSeverity, ah as RegexBackreferenceInfo, ai as RegexError, aj as RegexFlag, ak as RegexGroupAnalysis, al as RegexGroupInfo, am as RegexGroupIssue, an as RegexMatch, ao as RegexResult, ap as RegexSuccess, aq as ResolvedLinkReference, ar as SQL_DEFAULT_OPTIONS, as as Segment, at as SpecVersion, au as SqlDialect, av as SqlFormatOptions, aw as SqlPlaceholder, ax as SqlPlaceholderResult, ay as SvgSpriteResult, az as SvgSpriteSymbol, aA as TestPatternResult, aB as TsconfigIssue, aC as TsconfigValidationResult, aD as analyzeRegexGroups, aE as auditDependencyRanges, aF as buildDockerPull, aG as buildDockerRun, aH as buildGitCommand, aI as collapseHtmlWhitespace, aJ as collapseJsWhitespace, aK as countProperties, aL as countRules, aM as countSqlPlaceholders, aN as detectDialect, aO as detectOperationType, aP as detectRedos, aQ as envToExport, aR as envToJson, aS as extractMarkdownFootnotes, aT as extractMarkdownLinkReferences, aU as extractSvgSpriteSymbols, aV as formatCss, aW as formatGql, aX as formatHtml, aY as formatSql, aZ as getEndpointsByTag, a_ as getHtmlStats, a$ as getJsStats, b0 as getMethodColor, b1 as isValidTag, b2 as lintConventionalCommit, b3 as lintDockerfile, b4 as lookupMime, b5 as minifyCss, b6 as minifyGql, b7 as minifyHtml, b8 as minifyJs, b9 as minifySql, ba as normalizeRef, bb as parseCommitTrailers, bc as parseConnectionString, bd as parseDockerImage, be as parseEnv, bf as parseGitCommand, bg as parseGithubUrl, bh as parseSpec, bi as removeConsoleCalls, bj as removeEmptyAttributes, bk as removeHtmlComments, bl as removeJsComments, bm as removeRedundantAttributes, bn as searchCheatsheet, bo as searchEndpoints, bp as splitStatements, bq as testGitignorePatterns, br as testPattern, bs as testRegex, bt as validateAria, bu as validateEditorConfig, bv as validateEnvKey, bw as validateFenceLanguageTags, bx as validatePackageExports, by as validateTsconfig } from '../code-mkKV7BQ4.cjs';
|
package/dist/tools/code.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as ALL_FLAGS, a as ApiEndpoint, b as ApiInfo, d as AriaIssue, e as AriaValidationResult, C as CHEATSHEET, f as CheatsheetEntry, g as CommitTrailer, h as CommitTrailerResult, i as ConnectionStringHost, j as ConnectionStringResult, k as ConventionalCommitFinding, l as ConventionalCommitFooter, m as ConventionalCommitOptions, n as ConventionalCommitParsed, o as ConventionalCommitResult, p as ConventionalCommitSeverity, q as CssResult, D as DEFAULT_COMMIT_TYPES, r as DependencyAuditDuplicate, s as DependencyAuditEntry, t as DependencyAuditIssue, u as DependencyAuditResult, v as DependencyRangeType, w as DependencySection, x as DockerImageRef, E as EditorConfigIssue,
|
|
1
|
+
export { A as ALL_FLAGS, a as ApiEndpoint, b as ApiInfo, d as AriaIssue, e as AriaValidationResult, C as CHEATSHEET, f as CheatsheetEntry, g as CommitTrailer, h as CommitTrailerResult, i as ConnectionStringHost, j as ConnectionStringResult, k as ConventionalCommitFinding, l as ConventionalCommitFooter, m as ConventionalCommitOptions, n as ConventionalCommitParsed, o as ConventionalCommitResult, p as ConventionalCommitSeverity, q as CssResult, D as DEFAULT_COMMIT_TYPES, r as DependencyAuditDuplicate, s as DependencyAuditEntry, t as DependencyAuditIssue, u as DependencyAuditResult, v as DependencyRangeType, w as DependencySection, x as DockerImageRef, y as DockerfileLintFinding, z as DockerfileLintResult, B as DockerfileStage, E as EditorConfigIssue, F as EditorConfigProperty, G as EditorConfigSection, H as EditorConfigValidationResult, I as EnvEntry, J as EnvParseResult, K as ExportsIssue, L as ExportsShape, M as ExportsValidationResult, N as FenceTagIssue, O as FenceTagIssueType, P as FenceValidationResult, Q as GitCommandConfig, R as GitCommandResult, S as GitOperation, T as GithubUrlInfo, U as GithubUrlType, V as GitignoreTestResult, W as GqlFormatResult, X as HtmlFormatResult, Y as HtmlMinifyOptions, Z as HtmlMinifyResult, _ as JsMinifyOptions, $ as JsMinifyResult, a0 as KNOWN_LANGUAGE_TAGS, a1 as LinkReferenceDefinition, a2 as LinkReferenceUsage, a3 as MIME_TABLE, a4 as MarkdownFootnoteDefinition, a5 as MarkdownFootnoteReference, a6 as MarkdownFootnoteResult, a7 as MarkdownLinkReferenceResult, a8 as MatchResult, a9 as MimeEntry, aa as MimeLookupResult, ab as OPERATIONS, ac as ParsedSpec, ad as PlaceholderStyle, ae as RedosFinding, af as RedosResult, ag as RedosSeverity, ah as RegexBackreferenceInfo, ai as RegexError, aj as RegexFlag, ak as RegexGroupAnalysis, al as RegexGroupInfo, am as RegexGroupIssue, an as RegexMatch, ao as RegexResult, ap as RegexSuccess, aq as ResolvedLinkReference, ar as SQL_DEFAULT_OPTIONS, as as Segment, at as SpecVersion, au as SqlDialect, av as SqlFormatOptions, aw as SqlPlaceholder, ax as SqlPlaceholderResult, ay as SvgSpriteResult, az as SvgSpriteSymbol, aA as TestPatternResult, aB as TsconfigIssue, aC as TsconfigValidationResult, aD as analyzeRegexGroups, aE as auditDependencyRanges, aF as buildDockerPull, aG as buildDockerRun, aH as buildGitCommand, aI as collapseHtmlWhitespace, aJ as collapseJsWhitespace, aK as countProperties, aL as countRules, aM as countSqlPlaceholders, aN as detectDialect, aO as detectOperationType, aP as detectRedos, aQ as envToExport, aR as envToJson, aS as extractMarkdownFootnotes, aT as extractMarkdownLinkReferences, aU as extractSvgSpriteSymbols, aV as formatCss, aW as formatGql, aX as formatHtml, aY as formatSql, aZ as getEndpointsByTag, a_ as getHtmlStats, a$ as getJsStats, b0 as getMethodColor, b1 as isValidTag, b2 as lintConventionalCommit, b3 as lintDockerfile, b4 as lookupMime, b5 as minifyCss, b6 as minifyGql, b7 as minifyHtml, b8 as minifyJs, b9 as minifySql, ba as normalizeRef, bb as parseCommitTrailers, bc as parseConnectionString, bd as parseDockerImage, be as parseEnv, bf as parseGitCommand, bg as parseGithubUrl, bh as parseSpec, bi as removeConsoleCalls, bj as removeEmptyAttributes, bk as removeHtmlComments, bl as removeJsComments, bm as removeRedundantAttributes, bn as searchCheatsheet, bo as searchEndpoints, bp as splitStatements, bq as testGitignorePatterns, br as testPattern, bs as testRegex, bt as validateAria, bu as validateEditorConfig, bv as validateEnvKey, bw as validateFenceLanguageTags, bx as validatePackageExports, by as validateTsconfig } from '../code-mkKV7BQ4.js';
|
package/dist/tools/code.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ALL_FLAGS, CHEATSHEET, DEFAULT_COMMIT_TYPES, KNOWN_LANGUAGE_TAGS, MIME_TABLE, OPERATIONS, SQL_DEFAULT_OPTIONS, analyzeRegexGroups, auditDependencyRanges, buildDockerPull, buildDockerRun, buildGitCommand, collapseHtmlWhitespace, collapseJsWhitespace, countProperties, countRules, countSqlPlaceholders, detectDialect, detectOperationType, detectRedos, envToExport, envToJson, extractMarkdownFootnotes, extractSvgSpriteSymbols, formatCss, formatGql, formatHtml, formatSql, getEndpointsByTag, getHtmlStats, getJsStats, getMethodColor, isValidTag, lintConventionalCommit, lookupMime, minifyCss, minifyGql, minifyHtml, minifyJs, minifySql, normalizeRef, parseCommitTrailers, parseConnectionString, parseDockerImage, parseEnv, parseGitCommand, parseGithubUrl, parseSpec, removeConsoleCalls, removeEmptyAttributes, removeHtmlComments, removeJsComments, removeRedundantAttributes, searchCheatsheet, searchEndpoints, splitStatements, testGitignorePatterns, testPattern, testRegex, validateAria, validateEditorConfig, validateEnvKey, validateFenceLanguageTags, validatePackageExports, validateTsconfig } from '../chunk-
|
|
1
|
+
export { ALL_FLAGS, CHEATSHEET, DEFAULT_COMMIT_TYPES, KNOWN_LANGUAGE_TAGS, MIME_TABLE, OPERATIONS, SQL_DEFAULT_OPTIONS, analyzeRegexGroups, auditDependencyRanges, buildDockerPull, buildDockerRun, buildGitCommand, collapseHtmlWhitespace, collapseJsWhitespace, countProperties, countRules, countSqlPlaceholders, detectDialect, detectOperationType, detectRedos, envToExport, envToJson, extractMarkdownFootnotes, extractMarkdownLinkReferences, extractSvgSpriteSymbols, formatCss, formatGql, formatHtml, formatSql, getEndpointsByTag, getHtmlStats, getJsStats, getMethodColor, isValidTag, lintConventionalCommit, lintDockerfile, lookupMime, minifyCss, minifyGql, minifyHtml, minifyJs, minifySql, normalizeRef, parseCommitTrailers, parseConnectionString, parseDockerImage, parseEnv, parseGitCommand, parseGithubUrl, parseSpec, removeConsoleCalls, removeEmptyAttributes, removeHtmlComments, removeJsComments, removeRedundantAttributes, searchCheatsheet, searchEndpoints, splitStatements, testGitignorePatterns, testPattern, testRegex, validateAria, validateEditorConfig, validateEnvKey, validateFenceLanguageTags, validatePackageExports, validateTsconfig } from '../chunk-RMXZMYSG.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/dist/tools/time.cjs
CHANGED
|
@@ -659,6 +659,42 @@ function getRunInterval(dates) {
|
|
|
659
659
|
const days = Math.round(diffMins / 1440);
|
|
660
660
|
return `Every ${days} days`;
|
|
661
661
|
}
|
|
662
|
+
var MAX_CRON_OVERLAPS = 200;
|
|
663
|
+
function findCronOverlaps(expressions, windowDays = 30, fromDate) {
|
|
664
|
+
if (expressions.length < 2) return { error: "Provide at least two cron expressions to check for overlaps" };
|
|
665
|
+
if (expressions.length > 10) return { error: "Provide 10 or fewer cron expressions" };
|
|
666
|
+
if (windowDays < 1 || windowDays > 365) return { error: "windowDays must be between 1 and 365" };
|
|
667
|
+
const parsedList = [];
|
|
668
|
+
for (let i = 0; i < expressions.length; i++) {
|
|
669
|
+
const parsed = parseCronExpression(expressions[i]);
|
|
670
|
+
if (typeof parsed === "object" && "error" in parsed) {
|
|
671
|
+
return { error: `Expression ${i + 1} ("${expressions[i]}"): ${parsed.error}` };
|
|
672
|
+
}
|
|
673
|
+
parsedList.push(parsed);
|
|
674
|
+
}
|
|
675
|
+
const start = fromDate ? new Date(fromDate) : /* @__PURE__ */ new Date();
|
|
676
|
+
const cursor = new Date(start);
|
|
677
|
+
cursor.setSeconds(0, 0);
|
|
678
|
+
cursor.setMinutes(cursor.getMinutes() + 1);
|
|
679
|
+
const endTime = cursor.getTime() + windowDays * 24 * 60 * 60 * 1e3;
|
|
680
|
+
const overlaps = [];
|
|
681
|
+
let truncated = false;
|
|
682
|
+
while (cursor.getTime() < endTime) {
|
|
683
|
+
const matched = [];
|
|
684
|
+
for (let i = 0; i < parsedList.length; i++) {
|
|
685
|
+
if (matchesCron(cursor, parsedList[i])) matched.push(i);
|
|
686
|
+
}
|
|
687
|
+
if (matched.length >= 2) {
|
|
688
|
+
if (overlaps.length >= MAX_CRON_OVERLAPS) {
|
|
689
|
+
truncated = true;
|
|
690
|
+
break;
|
|
691
|
+
}
|
|
692
|
+
overlaps.push({ date: new Date(cursor), expressionIndexes: matched });
|
|
693
|
+
}
|
|
694
|
+
cursor.setMinutes(cursor.getMinutes() + 1);
|
|
695
|
+
}
|
|
696
|
+
return { overlaps, windowDays, truncated };
|
|
697
|
+
}
|
|
662
698
|
var DURATION_SECONDS_PER_YEAR = 365 * 86400;
|
|
663
699
|
var DURATION_SECONDS_PER_MONTH = 30 * 86400;
|
|
664
700
|
function humanizeDurationParts(parts) {
|
|
@@ -756,6 +792,7 @@ exports.COMMON_DATE_PRESETS = COMMON_DATE_PRESETS;
|
|
|
756
792
|
exports.TIMEZONES = TIMEZONES;
|
|
757
793
|
exports.convertTime = convertTime;
|
|
758
794
|
exports.diffDates = diffDates;
|
|
795
|
+
exports.findCronOverlaps = findCronOverlaps;
|
|
759
796
|
exports.formatInTimezone = formatInTimezone;
|
|
760
797
|
exports.formatIso8601Duration = formatIso8601Duration;
|
|
761
798
|
exports.formatRelative = formatRelative;
|
package/dist/tools/time.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as COMMON_CRONS, a as COMMON_DATE_PRESETS, b as CronField, c as CronNextField, d as CronResult, D as DateDiffResult,
|
|
1
|
+
export { C as COMMON_CRONS, a as COMMON_DATE_PRESETS, b as CronField, c as CronNextField, d as CronOverlap, e as CronOverlapResult, f as CronResult, D as DateDiffResult, g as DurationFormatResult, h as DurationParseResult, P as ParsedCron, T as TIMEZONES, i as TimestampResult, j as TimezoneEntry, k as convertTime, l as diffDates, m as findCronOverlaps, n as formatInTimezone, o as formatIso8601Duration, p as formatRelative, q as formatRunDate, r as fromIsoString, s as fromUnix, u as getAllZonesForTime, v as getNextRuns, w as getNow, x as getRunInterval, y as getTimezoneOffset, z as humanizeDiff, A as parseCron, B as parseCronExpression, E as parseDate, F as parseIso8601Duration } from '../time-VMAy_SrV.cjs';
|
package/dist/tools/time.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as COMMON_CRONS, a as COMMON_DATE_PRESETS, b as CronField, c as CronNextField, d as CronResult, D as DateDiffResult,
|
|
1
|
+
export { C as COMMON_CRONS, a as COMMON_DATE_PRESETS, b as CronField, c as CronNextField, d as CronOverlap, e as CronOverlapResult, f as CronResult, D as DateDiffResult, g as DurationFormatResult, h as DurationParseResult, P as ParsedCron, T as TIMEZONES, i as TimestampResult, j as TimezoneEntry, k as convertTime, l as diffDates, m as findCronOverlaps, n as formatInTimezone, o as formatIso8601Duration, p as formatRelative, q as formatRunDate, r as fromIsoString, s as fromUnix, u as getAllZonesForTime, v as getNextRuns, w as getNow, x as getRunInterval, y as getTimezoneOffset, z as humanizeDiff, A as parseCron, B as parseCronExpression, E as parseDate, F as parseIso8601Duration } from '../time-VMAy_SrV.js';
|
package/dist/tools/time.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { COMMON_CRONS, COMMON_DATE_PRESETS, TIMEZONES, convertTime, diffDates, formatInTimezone, formatIso8601Duration, formatRelative, formatRunDate, fromIsoString, fromUnix, getAllZonesForTime, getNextRuns, getNow, getRunInterval, getTimezoneOffset, humanizeDiff, parseCron, parseCronExpression, parseDate, parseIso8601Duration } from '../chunk-
|
|
1
|
+
export { COMMON_CRONS, COMMON_DATE_PRESETS, TIMEZONES, convertTime, diffDates, findCronOverlaps, formatInTimezone, formatIso8601Duration, formatRelative, formatRunDate, fromIsoString, fromUnix, getAllZonesForTime, getNextRuns, getNow, getRunInterval, getTimezoneOffset, humanizeDiff, parseCron, parseCronExpression, parseDate, parseIso8601Duration } from '../chunk-6EJVNQSY.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utilix-tech/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.84.0",
|
|
4
4
|
"description": "154+ developer utility tools for Node.js: JSON, encoding, hashing, color, CSS, network and more. Runs locally, no API key required.",
|
|
5
5
|
"author": "Utilix <hello@utilix.tech>",
|
|
6
6
|
"license": "MIT",
|