@ai-matrx/records 0.92.0 → 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 (80) hide show
  1. package/CHANGELOG.md +11 -3
  2. package/dist/{client-DE9Mq6YX.d.cts → client-Cn3odIIB.d.cts} +10 -8
  3. package/dist/{client-vJAb7g9r.d.ts → client-Dzd8gtAo.d.ts} +10 -8
  4. package/dist/core/index.cjs +6 -6
  5. package/dist/core/index.cjs.map +1 -1
  6. package/dist/core/index.d.cts +14 -14
  7. package/dist/core/index.d.ts +14 -14
  8. package/dist/core/index.js +6 -6
  9. package/dist/core/index.js.map +1 -1
  10. package/dist/data/index.cjs +6 -6
  11. package/dist/data/index.cjs.map +1 -1
  12. package/dist/data/index.d.cts +11 -11
  13. package/dist/data/index.d.ts +11 -11
  14. package/dist/data/index.js +6 -6
  15. package/dist/data/index.js.map +1 -1
  16. package/dist/{declareTable-Btg5bql1.d.cts → declareTable-CrL6AZKB.d.cts} +4 -4
  17. package/dist/{declareTable-JKt2q34d.d.ts → declareTable-ZRW5EsTQ.d.ts} +4 -4
  18. package/dist/entity/index.d.cts +6 -6
  19. package/dist/entity/index.d.ts +6 -6
  20. package/dist/{field-BJBnTyJ0.d.cts → field-CCY1rG9l.d.cts} +1 -1
  21. package/dist/{field-Ti5iAxFr.d.ts → field-enufS5ry.d.ts} +1 -1
  22. package/dist/forms/index.d.cts +3 -3
  23. package/dist/forms/index.d.ts +3 -3
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +11 -11
  26. package/dist/index.d.ts +11 -11
  27. package/dist/index.js.map +1 -1
  28. package/dist/memory/index.d.cts +7 -7
  29. package/dist/memory/index.d.ts +7 -7
  30. package/dist/{port-D2i2o7Lg.d.ts → port-C54ykAOv.d.ts} +2 -2
  31. package/dist/{port-CPVBfDxS.d.cts → port-Drioh9al.d.cts} +2 -2
  32. package/dist/{portal-DfeY2Boy.d.cts → portal-DRdmZ-xv.d.cts} +1 -1
  33. package/dist/{portal-Db4CYyHe.d.ts → portal-or_f7BkT.d.ts} +1 -1
  34. package/dist/{ports-BWtxAnXh.d.ts → ports-BeOgjwYl.d.ts} +1 -1
  35. package/dist/{ports-DSU2RsR6.d.cts → ports-s0D2jvqn.d.cts} +1 -1
  36. package/dist/react/index.cjs +6 -6
  37. package/dist/react/index.cjs.map +1 -1
  38. package/dist/react/index.d.cts +3 -1
  39. package/dist/react/index.d.ts +3 -1
  40. package/dist/react/index.js +6 -6
  41. package/dist/react/index.js.map +1 -1
  42. package/dist/realtime/index.d.cts +2 -2
  43. package/dist/realtime/index.d.ts +2 -2
  44. package/dist/{record-BQi92d4-.d.cts → record-BwCf9wKW.d.cts} +1 -1
  45. package/dist/{record-BQi92d4-.d.ts → record-BwCf9wKW.d.ts} +1 -1
  46. package/dist/{relation-DMwkmzgN.d.cts → relation-8vAWCa67.d.cts} +2 -2
  47. package/dist/{relation-DlcqV_W5.d.ts → relation-eLMgv_dV.d.ts} +2 -2
  48. package/dist/{rule-B8kR0l01.d.ts → rule-D9yNiorf.d.ts} +1 -1
  49. package/dist/{rule-BMViCLmW.d.cts → rule-wHI5B0Ka.d.cts} +1 -1
  50. package/dist/search/index.d.cts +1 -1
  51. package/dist/search/index.d.ts +1 -1
  52. package/dist/setup/index.cjs +6 -6
  53. package/dist/setup/index.cjs.map +1 -1
  54. package/dist/setup/index.d.cts +11 -11
  55. package/dist/setup/index.d.ts +11 -11
  56. package/dist/setup/index.js +6 -6
  57. package/dist/setup/index.js.map +1 -1
  58. package/dist/{subscription-5CLN3Jug.d.ts → subscription-BynsG1K6.d.ts} +2 -2
  59. package/dist/{subscription-D-VEzvyy.d.cts → subscription-CdoI-UaB.d.cts} +2 -2
  60. package/dist/{table-kind-Cm6PXkWx.d.cts → table-kind-DzctQ7dO.d.cts} +2 -2
  61. package/dist/{table-kind-CVp43g6h.d.ts → table-kind-i3lZJa3f.d.ts} +2 -2
  62. package/dist/templates/index.d.cts +10 -10
  63. package/dist/templates/index.d.ts +10 -10
  64. package/dist/typed-table/index.cjs +6 -6
  65. package/dist/typed-table/index.cjs.map +1 -1
  66. package/dist/typed-table/index.d.cts +10 -10
  67. package/dist/typed-table/index.d.ts +10 -10
  68. package/dist/typed-table/index.js +6 -6
  69. package/dist/typed-table/index.js.map +1 -1
  70. package/dist/{types-DTEGaxso.d.cts → types-BKYEeFt4.d.cts} +2 -2
  71. package/dist/{types-DF-dxB_l.d.ts → types-BvL_oKFl.d.ts} +2 -2
  72. package/dist/{types-9Q5SHRDJ.d.cts → types-D8qdG3Lg.d.cts} +2 -2
  73. package/dist/{types-Cs2MyE3u.d.cts → types-DAFP6XFe.d.cts} +2 -2
  74. package/dist/{types-CfYy-vdV.d.ts → types-DYzXhD7j.d.ts} +2 -2
  75. package/dist/{types-Dji5SpFS.d.ts → types-cpKY7Pjb.d.ts} +2 -2
  76. package/dist/use-cases/index.d.cts +5 -5
  77. package/dist/use-cases/index.d.ts +5 -5
  78. package/dist/{validate-BydKd-Le.d.ts → validate-DbvAParj.d.ts} +1 -1
  79. package/dist/{validate-CqJakTKk.d.cts → validate-DfNMxjmU.d.cts} +1 -1
  80. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  import * as _ai_matrx_realtime from '@ai-matrx/realtime';
2
2
  import { RealtimeManager, ChannelSpec } from '@ai-matrx/realtime';
3
- import { R as RecordsRealtimePort } from '../ports-DSU2RsR6.cjs';
4
- import '../record-BQi92d4-.cjs';
3
+ import { R as RecordsRealtimePort } from '../ports-s0D2jvqn.cjs';
4
+ import '../record-BwCf9wKW.cjs';
5
5
 
6
6
  /**
7
7
  * The topic is a CONTRACT WITH THE DATABASE (a Postgres trigger writes it, an RLS policy parses it),
@@ -1,7 +1,7 @@
1
1
  import * as _ai_matrx_realtime from '@ai-matrx/realtime';
2
2
  import { RealtimeManager, ChannelSpec } from '@ai-matrx/realtime';
3
- import { R as RecordsRealtimePort } from '../ports-BWtxAnXh.js';
4
- import '../record-BQi92d4-.js';
3
+ import { R as RecordsRealtimePort } from '../ports-BeOgjwYl.js';
4
+ import '../record-BwCf9wKW.js';
5
5
 
6
6
  /**
7
7
  * The topic is a CONTRACT WITH THE DATABASE (a Postgres trigger writes it, an RLS policy parses it),
@@ -6181,7 +6181,7 @@ interface RecordRead {
6181
6181
  */
6182
6182
  computedUnavailable?: RecordsError | null;
6183
6183
  /**
6184
- * The version this read saw, so a safe edit (`recordUpdate` with `expected_version`) needs no
6184
+ * Asked with `withVersion: true`: the version this read saw, so a safe edit (`recordUpdate` with `expected_version`) needs no
6185
6185
  * second call. Read beside the document in the same round of requests; `null` when the store
6186
6186
  * could not answer it (a write then refuses as "version unread", never as last-write-wins).
6187
6187
  */
@@ -6181,7 +6181,7 @@ interface RecordRead {
6181
6181
  */
6182
6182
  computedUnavailable?: RecordsError | null;
6183
6183
  /**
6184
- * The version this read saw, so a safe edit (`recordUpdate` with `expected_version`) needs no
6184
+ * Asked with `withVersion: true`: the version this read saw, so a safe edit (`recordUpdate` with `expected_version`) needs no
6185
6185
  * second call. Read beside the document in the same round of requests; `null` when the store
6186
6186
  * could not answer it (a write then refuses as "version unread", never as last-write-wins).
6187
6187
  */
@@ -1,5 +1,5 @@
1
- import { U as Uuid, b as RelationFlavor, O as OnDelete, c as RelationBinding, d as RelationCardinality, T as Timestamp, R as RecordsResult } from './record-BQi92d4-.cjs';
2
- import { c as RecordsDataSource } from './ports-DSU2RsR6.cjs';
1
+ import { U as Uuid, b as RelationFlavor, O as OnDelete, c as RelationBinding, d as RelationCardinality, T as Timestamp, R as RecordsResult } from './record-BwCf9wKW.cjs';
2
+ import { c as RecordsDataSource } from './ports-s0D2jvqn.cjs';
3
3
 
4
4
  /**
5
5
  * REL-6. Whether Visibility flows along this relation and the MAXIMUM access
@@ -1,5 +1,5 @@
1
- import { U as Uuid, b as RelationFlavor, O as OnDelete, c as RelationBinding, d as RelationCardinality, T as Timestamp, R as RecordsResult } from './record-BQi92d4-.js';
2
- import { c as RecordsDataSource } from './ports-BWtxAnXh.js';
1
+ import { U as Uuid, b as RelationFlavor, O as OnDelete, c as RelationBinding, d as RelationCardinality, T as Timestamp, R as RecordsResult } from './record-BwCf9wKW.js';
2
+ import { c as RecordsDataSource } from './ports-BeOgjwYl.js';
3
3
 
4
4
  /**
5
5
  * REL-6. Whether Visibility flows along this relation and the MAXIMUM access
@@ -1,4 +1,4 @@
1
- import { U as Uuid, e as RuleNodeKind, f as RuleUse, T as Timestamp } from './record-BQi92d4-.js';
1
+ import { U as Uuid, e as RuleNodeKind, f as RuleUse, T as Timestamp } from './record-BwCf9wKW.js';
2
2
 
3
3
  /**
4
4
  * A rule expression as `custom.rule_eval` ACTUALLY evaluates it — read off the
@@ -1,4 +1,4 @@
1
- import { U as Uuid, e as RuleNodeKind, f as RuleUse, T as Timestamp } from './record-BQi92d4-.cjs';
1
+ import { U as Uuid, e as RuleNodeKind, f as RuleUse, T as Timestamp } from './record-BwCf9wKW.cjs';
2
2
 
3
3
  /**
4
4
  * A rule expression as `custom.rule_eval` ACTUALLY evaluates it — read off the
@@ -1,4 +1,4 @@
1
- import { U as Uuid, R as RecordsResult } from '../record-BQi92d4-.cjs';
1
+ import { U as Uuid, R as RecordsResult } from '../record-BwCf9wKW.cjs';
2
2
 
3
3
  declare const STORE_RECORD_SEARCH_MIN_CHARS = 2;
4
4
  /** One record the search door found. */
@@ -1,4 +1,4 @@
1
- import { U as Uuid, R as RecordsResult } from '../record-BQi92d4-.js';
1
+ import { U as Uuid, R as RecordsResult } from '../record-BwCf9wKW.js';
2
2
 
3
3
  declare const STORE_RECORD_SEARCH_MIN_CHARS = 2;
4
4
  /** One record the search door found. */
@@ -3071,24 +3071,24 @@ function createRecordsClient(given) {
3071
3071
  if (!pass.ok) return pass;
3072
3072
  return carryOnCopy(pass.data, onProgress);
3073
3073
  },
3074
- async recordRead({ record_id, withComputed = false, organization_id }) {
3074
+ async recordRead({ record_id, withComputed = false, withVersion = false, organization_id }) {
3075
3075
  if (organization_id && organization_id !== org) {
3076
- return clientFor(organization_id).recordRead({ record_id, withComputed, organization_id });
3076
+ return clientFor(organization_id).recordRead({ record_id, withComputed, withVersion, organization_id });
3077
3077
  }
3078
3078
  if (readOrgs(organization_id).length > 1) {
3079
3079
  return openInOwnOrg(
3080
3080
  record_id,
3081
3081
  organization_id,
3082
- (sub) => sub.recordRead({ record_id, withComputed, organization_id: sub.config.organizationId }),
3082
+ (sub) => sub.recordRead({ record_id, withComputed, withVersion, organization_id: sub.config.organizationId }),
3083
3083
  () => true
3084
3084
  );
3085
3085
  }
3086
3086
  const [door, header] = await Promise.all([
3087
3087
  callDoor(DOORS.readRecord, { p_organization_id: org, p_record_id: record_id }, "recordRead"),
3088
3088
  // A version that cannot be read never takes the record away: it comes back as null.
3089
- callDoor(DOORS.recordHeaders, { p_organization_id: org, p_ids: [record_id] }, "recordRead.version").catch(
3089
+ withVersion ? callDoor(DOORS.recordHeaders, { p_organization_id: org, p_ids: [record_id] }, "recordRead.version").catch(
3090
3090
  () => null
3091
- )
3091
+ ) : Promise.resolve(null)
3092
3092
  ]);
3093
3093
  if (!door.ok) return err(door.error);
3094
3094
  const version = header && header.ok ? header.data?.find((h) => h.id === record_id)?.version ?? null : null;
@@ -3104,7 +3104,7 @@ function createRecordsClient(given) {
3104
3104
  if (provenance.ok) computed = provenance.data ?? [];
3105
3105
  else computedUnavailable = provenance.error;
3106
3106
  }
3107
- return ok({ record_id, document, hidden, computed, computedUnavailable, version });
3107
+ return ok({ record_id, document, hidden, computed, computedUnavailable, ...withVersion ? { version } : {} });
3108
3108
  },
3109
3109
  async listByIds({ table_id, ids }) {
3110
3110
  if (ids.length === 0) return ok([]);