@hcmai/sdk 0.3.13 → 0.3.15
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.js +28 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -65,10 +65,11 @@ var manifest = JSON.parse(
|
|
|
65
65
|
var SDK_VERSION = manifest.version;
|
|
66
66
|
|
|
67
67
|
// src/http/client.ts
|
|
68
|
+
var DEFAULT_HTTP_TIMEOUT_MS = 6e4;
|
|
68
69
|
function createHttpClient(opts) {
|
|
69
70
|
const client = axios.create({
|
|
70
71
|
baseURL: opts.endpoint,
|
|
71
|
-
timeout: opts.timeoutMs ??
|
|
72
|
+
timeout: opts.timeoutMs ?? DEFAULT_HTTP_TIMEOUT_MS,
|
|
72
73
|
headers: { "User-Agent": opts.userAgent ?? `hcmai-sdk/${SDK_VERSION}` }
|
|
73
74
|
});
|
|
74
75
|
attachTrace(client);
|
|
@@ -5446,8 +5447,20 @@ function parseSettingAssignment(raw) {
|
|
|
5446
5447
|
}
|
|
5447
5448
|
|
|
5448
5449
|
// src/fde/layout.ts
|
|
5449
|
-
import { createHash as createHash3 } from "crypto";
|
|
5450
|
-
import {
|
|
5450
|
+
import { createHash as createHash3, randomBytes as randomBytes2 } from "crypto";
|
|
5451
|
+
import {
|
|
5452
|
+
closeSync,
|
|
5453
|
+
existsSync as existsSync2,
|
|
5454
|
+
fsyncSync,
|
|
5455
|
+
linkSync,
|
|
5456
|
+
mkdirSync,
|
|
5457
|
+
openSync,
|
|
5458
|
+
readFileSync as readFileSync2,
|
|
5459
|
+
renameSync,
|
|
5460
|
+
unlinkSync,
|
|
5461
|
+
writeFileSync,
|
|
5462
|
+
writeSync
|
|
5463
|
+
} from "fs";
|
|
5451
5464
|
import * as path6 from "path";
|
|
5452
5465
|
var UNSAFE = /[^A-Za-z0-9._-]/g;
|
|
5453
5466
|
function slug(value) {
|
|
@@ -5776,8 +5789,8 @@ function networkOutcome() {
|
|
|
5776
5789
|
}
|
|
5777
5790
|
|
|
5778
5791
|
// src/fde/recon/runner.ts
|
|
5779
|
-
import { randomBytes as
|
|
5780
|
-
import { existsSync as
|
|
5792
|
+
import { randomBytes as randomBytes3 } from "crypto";
|
|
5793
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, readdirSync } from "fs";
|
|
5781
5794
|
import * as path8 from "path";
|
|
5782
5795
|
|
|
5783
5796
|
// src/fde/recon/carry-over.ts
|
|
@@ -6754,7 +6767,7 @@ function writeModelsMd(layout, text) {
|
|
|
6754
6767
|
}
|
|
6755
6768
|
|
|
6756
6769
|
// src/fde/recon/pointer-audit.ts
|
|
6757
|
-
import { existsSync as
|
|
6770
|
+
import { existsSync as existsSync3 } from "fs";
|
|
6758
6771
|
import * as path7 from "path";
|
|
6759
6772
|
function isRecord3(v) {
|
|
6760
6773
|
return Boolean(v) && typeof v === "object" && !Array.isArray(v);
|
|
@@ -6768,7 +6781,7 @@ function auditValueDomainPointers(layout, sheets) {
|
|
|
6768
6781
|
const pointer = isRecord3(ref) ? ref.valueDomain : null;
|
|
6769
6782
|
if (typeof pointer !== "string" || pointer === "") continue;
|
|
6770
6783
|
if (!seen.has(pointer)) {
|
|
6771
|
-
seen.set(pointer,
|
|
6784
|
+
seen.set(pointer, existsSync3(path7.join(layout.dir, pointer)));
|
|
6772
6785
|
}
|
|
6773
6786
|
if (!seen.get(pointer)) {
|
|
6774
6787
|
problems.push(
|
|
@@ -7143,7 +7156,7 @@ function parseRoundStamp(stamp) {
|
|
|
7143
7156
|
return new Date(Date.UTC(+y, +mo - 1, +d, +h, +mi, +s));
|
|
7144
7157
|
}
|
|
7145
7158
|
function newRoundId(started) {
|
|
7146
|
-
return `${roundStamp(started)}-${
|
|
7159
|
+
return `${roundStamp(started)}-${randomBytes3(4).toString("hex")}`;
|
|
7147
7160
|
}
|
|
7148
7161
|
function isRecord5(v) {
|
|
7149
7162
|
return Boolean(v) && typeof v === "object" && !Array.isArray(v);
|
|
@@ -7193,7 +7206,7 @@ function writeCrawledAt(layout, freshKeys, carriedKeys, roundId, started) {
|
|
|
7193
7206
|
return sorted;
|
|
7194
7207
|
}
|
|
7195
7208
|
function finishRound(layout, models, roundId, started, products) {
|
|
7196
|
-
const written = [...new Set(products.filter((rel) => rel &&
|
|
7209
|
+
const written = [...new Set(products.filter((rel) => rel && existsSync4(path8.join(layout.dir, rel))))].sort();
|
|
7197
7210
|
layout.writeJson(KIT_CRAWLED_AT_FILE, {
|
|
7198
7211
|
note: CRAWLED_AT_NOTE,
|
|
7199
7212
|
roundNote: ROUND_NOTE,
|
|
@@ -7211,7 +7224,7 @@ function relOf(layout, p) {
|
|
|
7211
7224
|
}
|
|
7212
7225
|
function productRoundId(root, rel) {
|
|
7213
7226
|
const p = path8.join(root, rel);
|
|
7214
|
-
if (!
|
|
7227
|
+
if (!existsSync4(p)) return ["missing", null];
|
|
7215
7228
|
const body = readJsonSoft(p);
|
|
7216
7229
|
if (body === void 0 || !isRecord5(body)) return ["unreadable", null];
|
|
7217
7230
|
const rid = body.roundId;
|
|
@@ -7227,7 +7240,7 @@ function inspectRound(root) {
|
|
|
7227
7240
|
const written = Array.isArray(rawWritten) ? rawWritten : null;
|
|
7228
7241
|
let ledgerMissing = null;
|
|
7229
7242
|
if (written !== null) {
|
|
7230
|
-
const gone = written.filter((rel) => typeof rel === "string" && !
|
|
7243
|
+
const gone = written.filter((rel) => typeof rel === "string" && !existsSync4(path8.join(root, rel))).sort();
|
|
7231
7244
|
ledgerMissing = { checked: written.length, count: gone.length, files: gone };
|
|
7232
7245
|
}
|
|
7233
7246
|
const products = [];
|
|
@@ -7577,7 +7590,7 @@ async function runRecon(probe, layout, opts = {}) {
|
|
|
7577
7590
|
}
|
|
7578
7591
|
|
|
7579
7592
|
// src/fde/gate0/aclass.ts
|
|
7580
|
-
import { existsSync as
|
|
7593
|
+
import { existsSync as existsSync5, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync2 } from "fs";
|
|
7581
7594
|
import * as path9 from "path";
|
|
7582
7595
|
|
|
7583
7596
|
// src/fde/gate0/mapping-artifact.ts
|
|
@@ -7868,7 +7881,7 @@ function deriveAclass(root, mappingArtifact = null) {
|
|
|
7868
7881
|
}
|
|
7869
7882
|
}
|
|
7870
7883
|
const valueDomain = path9.join(root, VALUE_DOMAIN_DIR);
|
|
7871
|
-
if (
|
|
7884
|
+
if (existsSync5(valueDomain) && statSync2(valueDomain).isDirectory()) {
|
|
7872
7885
|
const tables = readdirSync2(valueDomain).filter((f) => f.endsWith(".json") && !RESERVED_FILENAMES.includes(f)).sort();
|
|
7873
7886
|
for (const name of tables) {
|
|
7874
7887
|
const file = path9.join(valueDomain, name);
|
|
@@ -7937,7 +7950,7 @@ function deriveAclass(root, mappingArtifact = null) {
|
|
|
7937
7950
|
}
|
|
7938
7951
|
|
|
7939
7952
|
// src/fde/gate0/facts.ts
|
|
7940
|
-
import { existsSync as
|
|
7953
|
+
import { existsSync as existsSync6, readFileSync as readFileSync6 } from "fs";
|
|
7941
7954
|
import * as path10 from "path";
|
|
7942
7955
|
var REGISTRY_SCOPE = "registry";
|
|
7943
7956
|
var ENTRY_SCOPE2 = "entry";
|
|
@@ -8022,7 +8035,7 @@ function loadProtocolFacts(entries = PROTOCOL_FACTS, options = {}) {
|
|
|
8022
8035
|
if (probeRoot !== void 0) {
|
|
8023
8036
|
const file = path10.join(probeRoot, shape.groups.file);
|
|
8024
8037
|
const mark = `${PROBE_MARK_PREFIX} ${shape.groups.mark}`;
|
|
8025
|
-
const found =
|
|
8038
|
+
const found = existsSync6(file) && readFileSync6(file, "utf8").includes(mark);
|
|
8026
8039
|
if (!found) {
|
|
8027
8040
|
problems.push({
|
|
8028
8041
|
scope: ENTRY_SCOPE2,
|