@ai-matrx/records 0.93.6 → 0.94.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/data/index.cjs +17 -0
  3. package/dist/data/index.cjs.map +1 -1
  4. package/dist/data/index.d.cts +2 -2
  5. package/dist/data/index.d.ts +2 -2
  6. package/dist/data/index.js +17 -0
  7. package/dist/data/index.js.map +1 -1
  8. package/dist/data/react.cjs +16 -3
  9. package/dist/data/react.cjs.map +1 -1
  10. package/dist/data/react.d.cts +10 -0
  11. package/dist/data/react.d.ts +10 -0
  12. package/dist/data/react.js +16 -3
  13. package/dist/data/react.js.map +1 -1
  14. package/dist/entity/index.cjs +1 -1
  15. package/dist/entity/index.cjs.map +1 -1
  16. package/dist/entity/index.d.cts +3 -3
  17. package/dist/entity/index.d.ts +3 -3
  18. package/dist/entity/index.js +1 -1
  19. package/dist/entity/index.js.map +1 -1
  20. package/dist/entity/react.cjs +1 -1
  21. package/dist/entity/react.cjs.map +1 -1
  22. package/dist/entity/react.d.cts +10 -0
  23. package/dist/entity/react.d.ts +10 -0
  24. package/dist/entity/react.js +1 -1
  25. package/dist/entity/react.js.map +1 -1
  26. package/dist/first-page/index.d.cts +6 -0
  27. package/dist/first-page/index.d.ts +6 -0
  28. package/dist/{port-DyZ0GfxE.d.ts → port-BNXXJINy.d.ts} +1 -1
  29. package/dist/{port-B3UeC536.d.cts → port-CEf9hsW4.d.cts} +1 -1
  30. package/dist/react/index.cjs +17 -0
  31. package/dist/react/index.cjs.map +1 -1
  32. package/dist/react/index.js +17 -0
  33. package/dist/react/index.js.map +1 -1
  34. package/dist/setup/index.cjs +1 -1
  35. package/dist/setup/index.cjs.map +1 -1
  36. package/dist/setup/index.d.cts +2 -2
  37. package/dist/setup/index.d.ts +2 -2
  38. package/dist/setup/index.js +1 -1
  39. package/dist/setup/index.js.map +1 -1
  40. package/dist/{types-DB4J-zIt.d.ts → types-Du4Q9Rvi.d.ts} +10 -0
  41. package/dist/{types-Bg1q6qwq.d.cts → types-Dxc8Pt7Y.d.cts} +10 -0
  42. package/package.json +4 -4
@@ -1036,6 +1036,12 @@ interface Query {
1036
1036
  lane?: Lane;
1037
1037
  /** A filter, never a lock. Default "all". */
1038
1038
  org?: Uuid | "all";
1039
+ /**
1040
+ * THE ARCHIVE (the archived-items law): `true` answers the rows that were archived instead of the live
1041
+ * ones, newest-archived first, each carrying `_archived_at` and `_archived_by_name`, so a screen can offer
1042
+ * Restore. The archive door takes no `where` / `search` / `sort`: they are not applied to it.
1043
+ */
1044
+ archived?: boolean;
1039
1045
  }
1040
1046
 
1041
1047
  /** A view's look as the store keeps it: one JSON object under `definition.presentation`. */
@@ -1,4 +1,4 @@
1
- import { L as Lane, H as HostDataPort, V as Values } from './types-DB4J-zIt.js';
1
+ import { L as Lane, H as HostDataPort, V as Values } from './types-Du4Q9Rvi.js';
2
2
  import { U as Uuid, R as RecordsResult } from './record-zwSBU5PQ.js';
3
3
  import { O as OpLedger } from './ports-YOhD5T7h.js';
4
4
  import * as _ai_matrx_realtime from '@ai-matrx/realtime';
@@ -1,4 +1,4 @@
1
- import { L as Lane, H as HostDataPort, V as Values } from './types-Bg1q6qwq.cjs';
1
+ import { L as Lane, H as HostDataPort, V as Values } from './types-Dxc8Pt7Y.cjs';
2
2
  import { U as Uuid, R as RecordsResult } from './record-zwSBU5PQ.cjs';
3
3
  import { O as OpLedger } from './ports-DEkN-WfA.cjs';
4
4
  import * as _ai_matrx_realtime from '@ai-matrx/realtime';
@@ -11021,6 +11021,7 @@ var CUSTOM_ROW_TOKEN = "record";
11021
11021
  // src/data/table-port.ts
11022
11022
  var DATA_PAGE_CEILING = 500;
11023
11023
  var DATA_PAGE_DEFAULT = 50;
11024
+ var ARCHIVED_CURSOR = "archived:";
11024
11025
  function refuse2(code, message, hint) {
11025
11026
  return { ok: false, error: { code, message, ...hint ? { hint } : {} } };
11026
11027
  }
@@ -11159,6 +11160,21 @@ function createTableDataPort({ client, aliases }) {
11159
11160
  if (!got.data) return refuse2("not_found", "The change was saved, but this row can no longer be read with your access.", "Ask the table's owner if you should still see it.");
11160
11161
  return { ok: true, data: got.data };
11161
11162
  }
11163
+ async function listArchived(binding, shape, q, cursor) {
11164
+ const limit = Math.max(1, Math.min(Math.floor(q.pageSize ?? DATA_PAGE_DEFAULT), DATA_PAGE_CEILING));
11165
+ const at = cursor?.startsWith(ARCHIVED_CURSOR) ? Number(cursor.slice(ARCHIVED_CURSOR.length)) : 0;
11166
+ const offset = Number.isInteger(at) && at > 0 ? at : 0;
11167
+ const page2 = await seat(binding).listArchived({ table_id: binding.tableId, lane: "org", limit, offset });
11168
+ if (!page2.ok) return page2;
11169
+ const read = page2.data.rows.map((r) => ({ ...r, version: 0, organization_id: binding.organizationId }));
11170
+ const rows = await toRows(binding, shape, read);
11171
+ page2.data.rows.forEach((r, i) => {
11172
+ rows[i]._archived_at = r.archivedAt;
11173
+ rows[i]._archived_by_name = r.archivedByName;
11174
+ });
11175
+ const cursorOut = page2.data.rows.length < limit ? null : `${ARCHIVED_CURSOR}${offset + page2.data.rows.length}`;
11176
+ return { ok: true, data: { rows, total: page2.data.total, cursor: cursorOut } };
11177
+ }
11162
11178
  return {
11163
11179
  async sources() {
11164
11180
  const out = [];
@@ -11200,6 +11216,7 @@ function createTableDataPort({ client, aliases }) {
11200
11216
  }
11201
11217
  const shape = await shapeOf(alias, binding);
11202
11218
  if (!shape.ok) return shape;
11219
+ if (q.archived === true) return listArchived(binding, shape.data, q, cursor);
11203
11220
  const filter = compileWhere(q.where, shape.data);
11204
11221
  if (!filter.ok) return filter;
11205
11222
  const sort = compileSort(q.sort, shape.data);