@ai-matrx/records 0.20.0 → 0.24.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 +125 -2
- package/dist/core/index.cjs +179 -17
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +151 -17
- package/dist/core/index.d.ts +151 -17
- package/dist/core/index.js +179 -17
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +302 -1
- package/dist/index.d.ts +302 -1
- package/dist/react/index.cjs +167 -0
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +410 -1
- package/dist/react/index.d.ts +410 -1
- package/dist/react/index.js +167 -0
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/core/index.js
CHANGED
|
@@ -1973,6 +1973,22 @@ var DOORS = {
|
|
|
1973
1973
|
dashboardRun: "dashboard_run",
|
|
1974
1974
|
dashboardStuck: "dashboard_stuck",
|
|
1975
1975
|
dashboardDelete: "dashboard_delete",
|
|
1976
|
+
// PRODUCTS row 10 — "fill in each company's industry and headcount, and keep
|
|
1977
|
+
// it fresh". An Enrichment is not an object of its own: it is a Field saying
|
|
1978
|
+
// `source = agent`, with its instruction, inputs, model, confidence floor and
|
|
1979
|
+
// freshness in `source_config` (AGT-6). `enrichCells` is the one a GRID calls —
|
|
1980
|
+
// the badge data for a whole page in one round trip, because a badge asked per
|
|
1981
|
+
// cell is fifty round trips to draw fifty badges. `enrichPin` is the half of
|
|
1982
|
+
// this product that decides whether anybody ever trusts it: the moment a
|
|
1983
|
+
// person types over an agent-owned cell the store pins it, and the next run
|
|
1984
|
+
// leaves it exactly as they left it.
|
|
1985
|
+
enrichments: "enrichments",
|
|
1986
|
+
enrichDeclare: "enrich_declare",
|
|
1987
|
+
enrichDue: "enrich_due",
|
|
1988
|
+
enrichCells: "enrich_cells",
|
|
1989
|
+
enrichLand: "enrich_land",
|
|
1990
|
+
enrichPin: "enrich_pin",
|
|
1991
|
+
enrichRuns: "enrich_runs",
|
|
1976
1992
|
// PRODUCTS row 4 — "Who changed this price, and can I put it back?" The
|
|
1977
1993
|
// history has been in the store since W3-HIST; until 2026-09-20 the only way
|
|
1978
1994
|
// to ask for it was `io_revisions`, which answers a raw uuid for the author
|
|
@@ -2102,6 +2118,16 @@ var DOORS = {
|
|
|
2102
2118
|
workApprovalMayDecide: "work_approval_may_decide",
|
|
2103
2119
|
workApprovalDecide: "work_approval_decide",
|
|
2104
2120
|
workApprovalRead: "work_approval_read",
|
|
2121
|
+
// PRODUCTS row 13 — checklists and SOP runs.
|
|
2122
|
+
checklistRefusal: "checklist_refusal",
|
|
2123
|
+
checklistDeclare: "checklist_declare",
|
|
2124
|
+
checklistTemplates: "checklist_templates",
|
|
2125
|
+
checklistTemplateShape: "checklist_template_shape",
|
|
2126
|
+
checklistStart: "checklist_start",
|
|
2127
|
+
checklistRun: "checklist_run",
|
|
2128
|
+
checklistRuns: "checklist_runs",
|
|
2129
|
+
checklistStepComplete: "checklist_step_complete",
|
|
2130
|
+
checklistStepRefusal: "checklist_step_refusal",
|
|
2105
2131
|
// Declared here BECAUSE they do not exist yet: naming them is what makes the
|
|
2106
2132
|
// absence visible to `pnpm check:store-registry` and to the suite.
|
|
2107
2133
|
metadataSearch: "metadata_search",
|
|
@@ -2880,6 +2906,67 @@ function createRecordsClient(config) {
|
|
|
2880
2906
|
"ruleEval"
|
|
2881
2907
|
);
|
|
2882
2908
|
},
|
|
2909
|
+
async enrichments(args) {
|
|
2910
|
+
return callDoor(
|
|
2911
|
+
DOORS.enrichments,
|
|
2912
|
+
{ p_organization_id: org, p_table_id: args?.table_id ?? null },
|
|
2913
|
+
"enrichments"
|
|
2914
|
+
);
|
|
2915
|
+
},
|
|
2916
|
+
async enrichDeclare(args) {
|
|
2917
|
+
return callDoor(
|
|
2918
|
+
DOORS.enrichDeclare,
|
|
2919
|
+
{ p_organization_id: org, p_field_id: args.field_id, p_spec: args.spec },
|
|
2920
|
+
"enrichDeclare"
|
|
2921
|
+
);
|
|
2922
|
+
},
|
|
2923
|
+
async enrichDue(args) {
|
|
2924
|
+
return callDoor(
|
|
2925
|
+
DOORS.enrichDue,
|
|
2926
|
+
{
|
|
2927
|
+
p_organization_id: org,
|
|
2928
|
+
p_field_id: args.field_id,
|
|
2929
|
+
p_limit: args.limit ?? 50,
|
|
2930
|
+
p_include_fresh: args.include_fresh ?? false
|
|
2931
|
+
},
|
|
2932
|
+
"enrichDue"
|
|
2933
|
+
);
|
|
2934
|
+
},
|
|
2935
|
+
async enrichCells(args) {
|
|
2936
|
+
return callDoor(
|
|
2937
|
+
DOORS.enrichCells,
|
|
2938
|
+
{
|
|
2939
|
+
p_organization_id: org,
|
|
2940
|
+
p_table_id: args.table_id,
|
|
2941
|
+
p_field_keys: args.field_keys ?? null,
|
|
2942
|
+
p_record_ids: args.record_ids ?? null
|
|
2943
|
+
},
|
|
2944
|
+
"enrichCells"
|
|
2945
|
+
);
|
|
2946
|
+
},
|
|
2947
|
+
async enrichPin(args) {
|
|
2948
|
+
return callDoor(
|
|
2949
|
+
DOORS.enrichPin,
|
|
2950
|
+
{
|
|
2951
|
+
p_organization_id: org,
|
|
2952
|
+
p_record_id: args.record_id,
|
|
2953
|
+
p_field_key: args.field_key,
|
|
2954
|
+
p_pinned: args.pinned ?? true
|
|
2955
|
+
},
|
|
2956
|
+
"enrichPin"
|
|
2957
|
+
);
|
|
2958
|
+
},
|
|
2959
|
+
async enrichRuns(args) {
|
|
2960
|
+
return callDoor(
|
|
2961
|
+
DOORS.enrichRuns,
|
|
2962
|
+
{
|
|
2963
|
+
p_organization_id: org,
|
|
2964
|
+
p_field_id: args?.field_id ?? null,
|
|
2965
|
+
p_limit: args?.limit ?? 50
|
|
2966
|
+
},
|
|
2967
|
+
"enrichRuns"
|
|
2968
|
+
);
|
|
2969
|
+
},
|
|
2883
2970
|
async dashboards(args) {
|
|
2884
2971
|
return callDoor(
|
|
2885
2972
|
DOORS.dashboards,
|
|
@@ -3440,6 +3527,86 @@ function createRecordsClient(config) {
|
|
|
3440
3527
|
"workSlotExpire"
|
|
3441
3528
|
);
|
|
3442
3529
|
},
|
|
3530
|
+
// ── checklists and SOP runs ──────────────────────────────────────────
|
|
3531
|
+
async checklistRefusal({ spec }) {
|
|
3532
|
+
return callDoor(
|
|
3533
|
+
DOORS.checklistRefusal,
|
|
3534
|
+
{ p_spec: spec },
|
|
3535
|
+
"checklistRefusal"
|
|
3536
|
+
);
|
|
3537
|
+
},
|
|
3538
|
+
async checklistDeclare({ spec, template_id = null }) {
|
|
3539
|
+
return callDoor(
|
|
3540
|
+
DOORS.checklistDeclare,
|
|
3541
|
+
{ p_organization_id: org, p_spec: spec, p_template_id: template_id },
|
|
3542
|
+
"checklistDeclare"
|
|
3543
|
+
);
|
|
3544
|
+
},
|
|
3545
|
+
async checklistTemplates(args) {
|
|
3546
|
+
return callDoor(
|
|
3547
|
+
DOORS.checklistTemplates,
|
|
3548
|
+
{
|
|
3549
|
+
p_organization_id: org,
|
|
3550
|
+
p_about_table_id: args?.about_table_id ?? null,
|
|
3551
|
+
p_limit: args?.limit ?? 100
|
|
3552
|
+
},
|
|
3553
|
+
"checklistTemplates"
|
|
3554
|
+
);
|
|
3555
|
+
},
|
|
3556
|
+
async checklistTemplateShape({ template_id }) {
|
|
3557
|
+
return callDoor(
|
|
3558
|
+
DOORS.checklistTemplateShape,
|
|
3559
|
+
{ p_organization_id: org, p_template_id: template_id },
|
|
3560
|
+
"checklistTemplateShape"
|
|
3561
|
+
);
|
|
3562
|
+
},
|
|
3563
|
+
async checklistStart({ template_id, about_record_id = null, roles = {}, startingAt = null }) {
|
|
3564
|
+
return callDoor(
|
|
3565
|
+
DOORS.checklistStart,
|
|
3566
|
+
{
|
|
3567
|
+
p_organization_id: org,
|
|
3568
|
+
p_template_id: template_id,
|
|
3569
|
+
p_about_record_id: about_record_id,
|
|
3570
|
+
p_roles: roles,
|
|
3571
|
+
p_starting_at: startingAt
|
|
3572
|
+
},
|
|
3573
|
+
"checklistStart"
|
|
3574
|
+
);
|
|
3575
|
+
},
|
|
3576
|
+
async checklistRun({ run_id }) {
|
|
3577
|
+
return callDoor(
|
|
3578
|
+
DOORS.checklistRun,
|
|
3579
|
+
{ p_organization_id: org, p_run_id: run_id },
|
|
3580
|
+
"checklistRun"
|
|
3581
|
+
);
|
|
3582
|
+
},
|
|
3583
|
+
async checklistRuns(args) {
|
|
3584
|
+
return callDoor(
|
|
3585
|
+
DOORS.checklistRuns,
|
|
3586
|
+
{
|
|
3587
|
+
p_organization_id: org,
|
|
3588
|
+
p_about_table_id: args?.about_table_id ?? null,
|
|
3589
|
+
p_about_record_id: args?.about_record_id ?? null,
|
|
3590
|
+
p_include_closed: args?.includeClosed ?? true,
|
|
3591
|
+
p_limit: args?.limit ?? 100
|
|
3592
|
+
},
|
|
3593
|
+
"checklistRuns"
|
|
3594
|
+
);
|
|
3595
|
+
},
|
|
3596
|
+
async checklistStepComplete({ step_id, evidence = {} }) {
|
|
3597
|
+
return callDoor(
|
|
3598
|
+
DOORS.checklistStepComplete,
|
|
3599
|
+
{ p_organization_id: org, p_step_id: step_id, p_evidence: evidence },
|
|
3600
|
+
"checklistStepComplete"
|
|
3601
|
+
);
|
|
3602
|
+
},
|
|
3603
|
+
async checklistStepRefusal({ step_id }) {
|
|
3604
|
+
return callDoor(
|
|
3605
|
+
DOORS.checklistStepRefusal,
|
|
3606
|
+
{ p_organization_id: org, p_step_id: step_id },
|
|
3607
|
+
"checklistStepRefusal"
|
|
3608
|
+
);
|
|
3609
|
+
},
|
|
3443
3610
|
// ── the work layer a person actually uses ────────────────────────────
|
|
3444
3611
|
async workInbox(args) {
|
|
3445
3612
|
return callDoor(
|
|
@@ -4098,10 +4265,6 @@ async function exportXlsx(fields, rows, sheetLabel = "Records") {
|
|
|
4098
4265
|
XLSX.utils.book_append_sheet(workbook, worksheet, name);
|
|
4099
4266
|
return XLSX.write(workbook, { type: "array", bookType: "xlsx", compression: true });
|
|
4100
4267
|
}
|
|
4101
|
-
function matchField(header, fields) {
|
|
4102
|
-
const wanted = header.trim().toLowerCase();
|
|
4103
|
-
return fields.find((f) => f.key.toLowerCase() === wanted) ?? fields.find((f) => (f.label ?? "").toLowerCase() === wanted) ?? null;
|
|
4104
|
-
}
|
|
4105
4268
|
function parseCsv(text) {
|
|
4106
4269
|
const rows = [];
|
|
4107
4270
|
let row = [];
|
|
@@ -4136,32 +4299,31 @@ function parseCsv(text) {
|
|
|
4136
4299
|
}
|
|
4137
4300
|
return rows;
|
|
4138
4301
|
}
|
|
4139
|
-
function importCsv(
|
|
4140
|
-
return fromMatrix(
|
|
4302
|
+
function importCsv(text) {
|
|
4303
|
+
return fromMatrix(parseCsv(text));
|
|
4141
4304
|
}
|
|
4142
|
-
async function importXlsx(
|
|
4305
|
+
async function importXlsx(bytes) {
|
|
4143
4306
|
const XLSX = await import("xlsx");
|
|
4144
4307
|
const workbook = XLSX.read(bytes, { type: "array" });
|
|
4145
4308
|
const first = workbook.SheetNames[0];
|
|
4146
|
-
if (!first) return {
|
|
4309
|
+
if (!first) return { headers: [], rows: [] };
|
|
4147
4310
|
const sheet = workbook.Sheets[first];
|
|
4148
|
-
if (!sheet) return {
|
|
4311
|
+
if (!sheet) return { headers: [], rows: [] };
|
|
4149
4312
|
const matrix = XLSX.utils.sheet_to_json(sheet, { header: 1, raw: false, defval: "" });
|
|
4150
|
-
return fromMatrix(
|
|
4313
|
+
return fromMatrix(matrix);
|
|
4151
4314
|
}
|
|
4152
|
-
function fromMatrix(
|
|
4315
|
+
function fromMatrix(matrix) {
|
|
4153
4316
|
const [header, ...body] = matrix;
|
|
4154
|
-
if (!header) return {
|
|
4155
|
-
const
|
|
4156
|
-
const unmapped = columns.filter((c) => c.field === null).map((c) => c.header).filter((h) => h.trim().length > 0);
|
|
4317
|
+
if (!header) return { headers: [], rows: [] };
|
|
4318
|
+
const headers = header.map((text) => String(text ?? ""));
|
|
4157
4319
|
const rows = body.filter((line) => line.some((cell) => String(cell ?? "").trim().length > 0)).map((line) => {
|
|
4158
4320
|
const record = {};
|
|
4159
|
-
|
|
4160
|
-
if (
|
|
4321
|
+
headers.forEach((heading, index) => {
|
|
4322
|
+
if (heading.trim().length > 0) record[heading] = String(line[index] ?? "");
|
|
4161
4323
|
});
|
|
4162
4324
|
return record;
|
|
4163
4325
|
});
|
|
4164
|
-
return {
|
|
4326
|
+
return { headers, rows };
|
|
4165
4327
|
}
|
|
4166
4328
|
export {
|
|
4167
4329
|
ABSENCE_REASONS,
|