@ai-matrx/records 0.58.114 → 0.58.115

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.
@@ -536,6 +536,21 @@ interface RecordsClient {
536
536
  fieldRetire(args: {
537
537
  field_id: Uuid;
538
538
  }): Promise<RecordsResult<boolean>>;
539
+ /**
540
+ * Bring a removed column back (`custom.field_restore`): the set that was retired with it, the
541
+ * Table's declaration of those columns, and the links they made. The values never left.
542
+ */
543
+ fieldRestore(args: {
544
+ field_id: Uuid;
545
+ }): Promise<RecordsResult<boolean>>;
546
+ /**
547
+ * THE COLUMNS THIS TABLE HAD AND NO LONGER HAS (grids review 3): its retired Field records,
548
+ * newest first, through the same archived door the Table archive uses — addressed at the Field
549
+ * kernel (every Field is a record in it) and paged until the door answers short.
550
+ */
551
+ fieldsRetired(args: {
552
+ table_id: Uuid;
553
+ }): Promise<RecordsResult<ArchivedRow[]>>;
539
554
  /** What the registry says about a token, and whether it can hold a value at all. */
540
555
  entityTable(args: {
541
556
  token: string;
@@ -2112,6 +2127,7 @@ declare const DOORS: {
2112
2127
  readonly fieldDeclare: "field_declare";
2113
2128
  readonly fieldUpdate: "field_update";
2114
2129
  readonly fieldRetire: "field_retire";
2130
+ readonly fieldRestore: "field_restore";
2115
2131
  readonly entityTable: "entity_table";
2116
2132
  readonly entityFields: "entity_fields";
2117
2133
  readonly entityFieldDeclare: "entity_field_declare";
@@ -536,6 +536,21 @@ interface RecordsClient {
536
536
  fieldRetire(args: {
537
537
  field_id: Uuid;
538
538
  }): Promise<RecordsResult<boolean>>;
539
+ /**
540
+ * Bring a removed column back (`custom.field_restore`): the set that was retired with it, the
541
+ * Table's declaration of those columns, and the links they made. The values never left.
542
+ */
543
+ fieldRestore(args: {
544
+ field_id: Uuid;
545
+ }): Promise<RecordsResult<boolean>>;
546
+ /**
547
+ * THE COLUMNS THIS TABLE HAD AND NO LONGER HAS (grids review 3): its retired Field records,
548
+ * newest first, through the same archived door the Table archive uses — addressed at the Field
549
+ * kernel (every Field is a record in it) and paged until the door answers short.
550
+ */
551
+ fieldsRetired(args: {
552
+ table_id: Uuid;
553
+ }): Promise<RecordsResult<ArchivedRow[]>>;
539
554
  /** What the registry says about a token, and whether it can hold a value at all. */
540
555
  entityTable(args: {
541
556
  token: string;
@@ -2112,6 +2127,7 @@ declare const DOORS: {
2112
2127
  readonly fieldDeclare: "field_declare";
2113
2128
  readonly fieldUpdate: "field_update";
2114
2129
  readonly fieldRetire: "field_retire";
2130
+ readonly fieldRestore: "field_restore";
2115
2131
  readonly entityTable: "entity_table";
2116
2132
  readonly entityFields: "entity_fields";
2117
2133
  readonly entityFieldDeclare: "entity_field_declare";
@@ -40146,6 +40146,9 @@ var DOORS = {
40146
40146
  fieldDeclare: "field_declare",
40147
40147
  fieldUpdate: "field_update",
40148
40148
  fieldRetire: "field_retire",
40149
+ // THE UNDO OF field_retire (lane STORE-RESTORE-DOORS): the set that went together comes back
40150
+ // whole, the Table declares the columns again, and the values never left the records.
40151
+ fieldRestore: "field_restore",
40149
40152
  // CUSTOM FIELDS ON A STANDARD BUSINESS TABLE. Every door above is keyed by a
40150
40153
  // custom Table's uuid, and a standard table has no Table record - so until
40151
40154
  // 2026-09-20 `custom.applicable_fields(org, 'party', null)` answered `22P02
@@ -41445,6 +41448,28 @@ function createRecordsClient(config) {
41445
41448
  "fieldRetire"
41446
41449
  );
41447
41450
  },
41451
+ async fieldRestore({ field_id }) {
41452
+ return callDoor(
41453
+ DOORS.fieldRestore,
41454
+ { p_organization_id: org, p_field_id: field_id },
41455
+ "fieldRestore"
41456
+ );
41457
+ },
41458
+ async fieldsRetired({ table_id }) {
41459
+ const kernel = await callDoor(DOORS.fieldKernelId, {}, "fieldsRetired.kernel");
41460
+ if (!kernel.ok) return err(kernel.error);
41461
+ const PAGE = 200;
41462
+ const found = [];
41463
+ for (let page = 0; page < 25; page += 1) {
41464
+ const answered = await this.listArchived({ table_id: kernel.data, lane: "org", limit: PAGE, offset: page * PAGE });
41465
+ if (!answered.ok) return err(answered.error);
41466
+ for (const row of answered.data.rows) {
41467
+ if (String(row.document["entity_definition_id"] ?? "") === table_id) found.push(row);
41468
+ }
41469
+ if (answered.data.rows.length < PAGE) break;
41470
+ }
41471
+ return ok(found);
41472
+ },
41448
41473
  async relationWords({ field_id, value }) {
41449
41474
  return callDoor(
41450
41475
  DOORS.relationWords,