@ai-matrx/records 0.87.32 → 0.92.1

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.
Files changed (107) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/README.md +115 -0
  3. package/dist/{client-E0VQ0NPO.d.ts → client-Cn3odIIB.d.cts} +10 -5
  4. package/dist/{client-C3ZZNfGH.d.cts → client-Dzd8gtAo.d.ts} +10 -5
  5. package/dist/core/index.cjs +28 -10
  6. package/dist/core/index.cjs.map +1 -1
  7. package/dist/core/index.d.cts +23 -12
  8. package/dist/core/index.d.ts +23 -12
  9. package/dist/core/index.js +28 -10
  10. package/dist/core/index.js.map +1 -1
  11. package/dist/data/index.cjs +22 -10
  12. package/dist/data/index.cjs.map +1 -1
  13. package/dist/data/index.d.cts +12 -142
  14. package/dist/data/index.d.ts +12 -142
  15. package/dist/data/index.js +22 -10
  16. package/dist/data/index.js.map +1 -1
  17. package/dist/{declareTable-BK3zufr7.d.cts → declareTable-CrL6AZKB.d.cts} +4 -4
  18. package/dist/{declareTable-B12XybRp.d.ts → declareTable-ZRW5EsTQ.d.ts} +4 -4
  19. package/dist/entity/index.cjs +984 -0
  20. package/dist/entity/index.cjs.map +1 -0
  21. package/dist/entity/index.d.cts +36 -0
  22. package/dist/entity/index.d.ts +36 -0
  23. package/dist/entity/index.js +964 -0
  24. package/dist/entity/index.js.map +1 -0
  25. package/dist/entity/react.cjs +1024 -0
  26. package/dist/entity/react.cjs.map +1 -0
  27. package/dist/entity/react.d.cts +511 -0
  28. package/dist/entity/react.d.ts +511 -0
  29. package/dist/entity/react.js +1015 -0
  30. package/dist/entity/react.js.map +1 -0
  31. package/dist/{field-BanTVGK2.d.cts → field-CCY1rG9l.d.cts} +1 -1
  32. package/dist/{field-BPABOJ2Y.d.ts → field-enufS5ry.d.ts} +1 -1
  33. package/dist/forms/index.cjs +984 -0
  34. package/dist/forms/index.cjs.map +1 -0
  35. package/dist/forms/index.d.cts +333 -0
  36. package/dist/forms/index.d.ts +333 -0
  37. package/dist/forms/index.js +961 -0
  38. package/dist/forms/index.js.map +1 -0
  39. package/dist/index.cjs +10 -1
  40. package/dist/index.cjs.map +1 -1
  41. package/dist/index.d.cts +11 -8
  42. package/dist/index.d.ts +11 -8
  43. package/dist/index.js +10 -1
  44. package/dist/index.js.map +1 -1
  45. package/dist/memory/index.d.cts +7 -6
  46. package/dist/memory/index.d.ts +7 -6
  47. package/dist/port-C54ykAOv.d.ts +301 -0
  48. package/dist/port-Drioh9al.d.cts +301 -0
  49. package/dist/portal-DRdmZ-xv.d.cts +331 -0
  50. package/dist/portal-or_f7BkT.d.ts +331 -0
  51. package/dist/{ports-TMWX-t9l.d.ts → ports-BeOgjwYl.d.ts} +2 -2
  52. package/dist/{ports-D8-iuY1P.d.cts → ports-s0D2jvqn.d.cts} +2 -2
  53. package/dist/react/index.cjs +58 -526
  54. package/dist/react/index.cjs.map +1 -1
  55. package/dist/react/index.d.cts +16 -1
  56. package/dist/react/index.d.ts +16 -1
  57. package/dist/react/index.js +55 -530
  58. package/dist/react/index.js.map +1 -1
  59. package/dist/realtime/index.d.cts +2 -2
  60. package/dist/realtime/index.d.ts +2 -2
  61. package/dist/{record-DpB2QgAZ.d.cts → record-BwCf9wKW.d.cts} +7 -1
  62. package/dist/{record-DpB2QgAZ.d.ts → record-BwCf9wKW.d.ts} +7 -1
  63. package/dist/relation-8vAWCa67.d.cts +230 -0
  64. package/dist/relation-eLMgv_dV.d.ts +230 -0
  65. package/dist/rule-D9yNiorf.d.ts +250 -0
  66. package/dist/rule-wHI5B0Ka.d.cts +250 -0
  67. package/dist/search/index.cjs +283 -0
  68. package/dist/search/index.cjs.map +1 -0
  69. package/dist/search/index.d.cts +44 -0
  70. package/dist/search/index.d.ts +44 -0
  71. package/dist/search/index.js +260 -0
  72. package/dist/search/index.js.map +1 -0
  73. package/dist/setup/index.cjs +6854 -0
  74. package/dist/setup/index.cjs.map +1 -0
  75. package/dist/setup/index.d.cts +87 -0
  76. package/dist/setup/index.d.ts +87 -0
  77. package/dist/setup/index.js +6829 -0
  78. package/dist/setup/index.js.map +1 -0
  79. package/dist/{subscription-D7KQBHXN.d.ts → subscription-BynsG1K6.d.ts} +3 -249
  80. package/dist/{subscription-BD9DnJxX.d.cts → subscription-CdoI-UaB.d.cts} +3 -249
  81. package/dist/{table-kind-BZu8mtND.d.cts → table-kind-DzctQ7dO.d.cts} +3 -558
  82. package/dist/{table-kind-xKxTHtrV.d.ts → table-kind-i3lZJa3f.d.ts} +3 -558
  83. package/dist/templates/index.d.cts +10 -9
  84. package/dist/templates/index.d.ts +10 -9
  85. package/dist/typed-table/index.cjs +22 -10
  86. package/dist/typed-table/index.cjs.map +1 -1
  87. package/dist/typed-table/index.d.cts +10 -7
  88. package/dist/typed-table/index.d.ts +10 -7
  89. package/dist/typed-table/index.js +22 -10
  90. package/dist/typed-table/index.js.map +1 -1
  91. package/dist/types-BKYEeFt4.d.cts +139 -0
  92. package/dist/{types-Dv61jStB.d.ts → types-BvL_oKFl.d.ts} +2 -2
  93. package/dist/{types-CLP5H4Wk.d.cts → types-D8qdG3Lg.d.cts} +2 -2
  94. package/dist/{types-C2uspRtf.d.cts → types-DAFP6XFe.d.cts} +2 -2
  95. package/dist/{types-DmPkWQic.d.ts → types-DYzXhD7j.d.ts} +2 -2
  96. package/dist/types-cpKY7Pjb.d.ts +139 -0
  97. package/dist/use-cases/index.d.cts +5 -5
  98. package/dist/use-cases/index.d.ts +5 -5
  99. package/dist/{validate-CWVToe1T.d.ts → validate-DbvAParj.d.ts} +1 -1
  100. package/dist/{validate-DEB_mn4Y.d.cts → validate-DfNMxjmU.d.cts} +1 -1
  101. package/dist/versions/index.cjs +375 -0
  102. package/dist/versions/index.cjs.map +1 -0
  103. package/dist/versions/index.d.cts +160 -0
  104. package/dist/versions/index.d.ts +160 -0
  105. package/dist/versions/index.js +353 -0
  106. package/dist/versions/index.js.map +1 -0
  107. package/package.json +62 -2
@@ -1,12 +1,13 @@
1
- import { A as AgentSnapshotRow, T as TemplateSpec, a as TemplateTable, S as SharedBlockId, C as CapabilityWord, b as TemplateField, c as TemplateAgent, d as TemplateAutomation, e as TemplateBooking, f as TemplateChecklist, g as TemplateDashboard, h as TemplateDigest, i as TemplateDocument, j as TemplateDrillDown, k as TemplateDimensions, l as TemplateForm, m as TemplateNotification, n as TemplatePortal, o as TemplateRowAction, p as TemplateStageRules, q as TemplateView, r as TemplateMergeBinding, s as TemplateTryIt, t as TemplateWorkflow, u as TemplateFootprint, I as IndustryGroup, v as TemplateJob, w as TeachesFeature, x as TemplateViewKind, y as TemplateBookingWindow } from '../types-DmPkWQic.js';
2
- export { z as CAPABILITY_WORDS, B as CATALOGUE_QUOTAS, D as CATALOGUE_STATUSES, E as CHOICE_COLORS, F as CHOICE_COLORS_DISTINCT_UP_TO, G as CatalogueRow, H as CatalogueStatus, J as ChoiceColor, K as ConfidentialLevel, L as ConfidentialRequest, M as DEFAULT_TEMPLATE_AGENT, N as ENTITY_REFERENCE_KINDS, O as INDUSTRY_GROUPS, R as RELATIVE_DATE, P as RetiredId, Q as SHARED_BLOCKS, U as SHARED_BLOCK_IDS, V as STRENGTHS, W as SharedBlock, X as SharedBlockField, Y as SharedBlockUse, Z as Strength, _ as TABLE_KERNEL_ID, $ as TEACHES_FEATURES, a0 as TEMPLATE_AUDIENCES, a1 as TEMPLATE_EXTRA_KINDS, a2 as TEMPLATE_JOBS, a3 as TEMPLATE_REFERENCE_DATE, a4 as TEMPLATE_SPEC_VERSION, a5 as TEMPLATE_VIEW_KINDS, a6 as TemplateAgentQuestion, a7 as TemplateAgentVariable, a8 as TemplateAudience, a9 as TemplateCalendarView, aa as TemplateChecklistStep, ab as TemplateConfidential, ac as TemplateConfidentialReader, ad as TemplateDashboardBlock, ae as TemplateDimensionOverride, af as TemplateDrillPath, ag as TemplateExtra, ah as TemplateExtraAgent, ai as TemplateExtraAgentVariable, aj as TemplateExtraKind, ak as TemplateFormField, al as TemplateFoundation, am as TemplateGalleryView, an as TemplateGridView, ao as TemplateGuideStep, ap as TemplateKanbanView, aq as TemplateMeasureOverride, ar as TemplatePortalTable, as as TemplateProvenance, at as TemplateSource, au as TemplateTableSettings, av as TemplateTimelineView, aw as TemplateViewSort, ax as UseCaseSingulars, ay as WalkAction, az as WalkAssertion, aA as WalkImport, aB as WalkMove, aC as WalkStep, aD as confidentialPending, aE as confidentialRequests, aF as footprintOf, aG as membersAddRowsSteps, aH as tableSettingsProblems, aI as whenRule } from '../types-DmPkWQic.js';
3
- import { b as AggregateMeasure, a as AggregateFilter } from '../subscription-D7KQBHXN.js';
4
- import { U as UseCase, o as UseCaseRelationship } from '../types-Dv61jStB.js';
5
- import { U as UseCaseProblem } from '../validate-CWVToe1T.js';
6
- export { R as RESOLVABLE_FIELD_TYPE_WORDS } from '../validate-CWVToe1T.js';
7
- import { b as RecordsDataSource } from '../ports-TMWX-t9l.js';
8
- import '../record-DpB2QgAZ.js';
9
- import '../field-BPABOJ2Y.js';
1
+ import { A as AgentSnapshotRow, T as TemplateSpec, a as TemplateTable, S as SharedBlockId, C as CapabilityWord, b as TemplateField, c as TemplateAgent, d as TemplateAutomation, e as TemplateBooking, f as TemplateChecklist, g as TemplateDashboard, h as TemplateDigest, i as TemplateDocument, j as TemplateDrillDown, k as TemplateDimensions, l as TemplateForm, m as TemplateNotification, n as TemplatePortal, o as TemplateRowAction, p as TemplateStageRules, q as TemplateView, r as TemplateMergeBinding, s as TemplateTryIt, t as TemplateWorkflow, u as TemplateFootprint, I as IndustryGroup, v as TemplateJob, w as TeachesFeature, x as TemplateViewKind, y as TemplateBookingWindow } from '../types-DYzXhD7j.js';
2
+ export { z as CAPABILITY_WORDS, B as CATALOGUE_QUOTAS, D as CATALOGUE_STATUSES, E as CHOICE_COLORS, F as CHOICE_COLORS_DISTINCT_UP_TO, G as CatalogueRow, H as CatalogueStatus, J as ChoiceColor, K as ConfidentialLevel, L as ConfidentialRequest, M as DEFAULT_TEMPLATE_AGENT, N as ENTITY_REFERENCE_KINDS, O as INDUSTRY_GROUPS, R as RELATIVE_DATE, P as RetiredId, Q as SHARED_BLOCKS, U as SHARED_BLOCK_IDS, V as STRENGTHS, W as SharedBlock, X as SharedBlockField, Y as SharedBlockUse, Z as Strength, _ as TABLE_KERNEL_ID, $ as TEACHES_FEATURES, a0 as TEMPLATE_AUDIENCES, a1 as TEMPLATE_EXTRA_KINDS, a2 as TEMPLATE_JOBS, a3 as TEMPLATE_REFERENCE_DATE, a4 as TEMPLATE_SPEC_VERSION, a5 as TEMPLATE_VIEW_KINDS, a6 as TemplateAgentQuestion, a7 as TemplateAgentVariable, a8 as TemplateAudience, a9 as TemplateCalendarView, aa as TemplateChecklistStep, ab as TemplateConfidential, ac as TemplateConfidentialReader, ad as TemplateDashboardBlock, ae as TemplateDimensionOverride, af as TemplateDrillPath, ag as TemplateExtra, ah as TemplateExtraAgent, ai as TemplateExtraAgentVariable, aj as TemplateExtraKind, ak as TemplateFormField, al as TemplateFoundation, am as TemplateGalleryView, an as TemplateGridView, ao as TemplateGuideStep, ap as TemplateKanbanView, aq as TemplateMeasureOverride, ar as TemplatePortalTable, as as TemplateProvenance, at as TemplateSource, au as TemplateTableSettings, av as TemplateTimelineView, aw as TemplateViewSort, ax as UseCaseSingulars, ay as WalkAction, az as WalkAssertion, aA as WalkImport, aB as WalkMove, aC as WalkStep, aD as confidentialPending, aE as confidentialRequests, aF as footprintOf, aG as membersAddRowsSteps, aH as tableSettingsProblems, aI as whenRule } from '../types-DYzXhD7j.js';
3
+ import { b as AggregateMeasure, a as AggregateFilter } from '../subscription-BynsG1K6.js';
4
+ import { U as UseCase, o as UseCaseRelationship } from '../types-BvL_oKFl.js';
5
+ import { U as UseCaseProblem } from '../validate-DbvAParj.js';
6
+ export { R as RESOLVABLE_FIELD_TYPE_WORDS } from '../validate-DbvAParj.js';
7
+ import { c as RecordsDataSource } from '../ports-BeOgjwYl.js';
8
+ import '../record-BwCf9wKW.js';
9
+ import '../rule-D9yNiorf.js';
10
+ import '../field-enufS5ry.js';
10
11
 
11
12
  /** The UTC offset ("-04:00") of a local wall-clock moment in an IANA zone. */
12
13
  declare function zoneOffset(localIso: string, timeZone: string): string;
@@ -558,9 +558,18 @@ function stableFilterKey(filter) {
558
558
  return `{${parts.join(",")}}`;
559
559
  }
560
560
  function liftWithheld(rows) {
561
+ let shared;
562
+ for (const row of rows) {
563
+ const m = (row.measures ?? {})["_withheld"];
564
+ if (m !== void 0 && m !== null && typeof m === "object") {
565
+ shared = m;
566
+ break;
567
+ }
568
+ }
561
569
  return rows.map((row) => {
562
570
  const measures = row.measures ?? {};
563
- const marker = measures["_withheld"];
571
+ const own = measures["_withheld"];
572
+ const marker = own !== void 0 && own !== null && typeof own === "object" ? own : shared;
564
573
  const rowCount = row.row_count ?? 0;
565
574
  if (marker === void 0 || marker === null || typeof marker !== "object") {
566
575
  return rowCount === row.row_count ? row : { ...row, row_count: rowCount };
@@ -3466,24 +3475,27 @@ function createRecordsClient(given) {
3466
3475
  if (!pass.ok) return pass;
3467
3476
  return carryOnCopy(pass.data, onProgress);
3468
3477
  },
3469
- async recordRead({ record_id, withComputed = false, organization_id }) {
3478
+ async recordRead({ record_id, withComputed = false, withVersion = false, organization_id }) {
3470
3479
  if (organization_id && organization_id !== org) {
3471
- return clientFor(organization_id).recordRead({ record_id, withComputed, organization_id });
3480
+ return clientFor(organization_id).recordRead({ record_id, withComputed, withVersion, organization_id });
3472
3481
  }
3473
3482
  if (readOrgs(organization_id).length > 1) {
3474
3483
  return openInOwnOrg(
3475
3484
  record_id,
3476
3485
  organization_id,
3477
- (sub) => sub.recordRead({ record_id, withComputed, organization_id: sub.config.organizationId }),
3486
+ (sub) => sub.recordRead({ record_id, withComputed, withVersion, organization_id: sub.config.organizationId }),
3478
3487
  () => true
3479
3488
  );
3480
3489
  }
3481
- const door = await callDoor(
3482
- DOORS.readRecord,
3483
- { p_organization_id: org, p_record_id: record_id },
3484
- "recordRead"
3485
- );
3490
+ const [door, header] = await Promise.all([
3491
+ callDoor(DOORS.readRecord, { p_organization_id: org, p_record_id: record_id }, "recordRead"),
3492
+ // A version that cannot be read never takes the record away: it comes back as null.
3493
+ withVersion ? callDoor(DOORS.recordHeaders, { p_organization_id: org, p_ids: [record_id] }, "recordRead.version").catch(
3494
+ () => null
3495
+ ) : Promise.resolve(null)
3496
+ ]);
3486
3497
  if (!door.ok) return err(door.error);
3498
+ const version = header && header.ok ? header.data?.find((h) => h.id === record_id)?.version ?? null : null;
3487
3499
  const { document, hidden } = unfold(door.data);
3488
3500
  let computed = [];
3489
3501
  let computedUnavailable = null;
@@ -3496,7 +3508,7 @@ function createRecordsClient(given) {
3496
3508
  if (provenance.ok) computed = provenance.data ?? [];
3497
3509
  else computedUnavailable = provenance.error;
3498
3510
  }
3499
- return ok({ record_id, document, hidden, computed, computedUnavailable });
3511
+ return ok({ record_id, document, hidden, computed, computedUnavailable, ...withVersion ? { version } : {} });
3500
3512
  },
3501
3513
  async listByIds({ table_id, ids }) {
3502
3514
  if (ids.length === 0) return ok([]);