@ai-matrx/records 0.4.1 → 0.5.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.
@@ -467,6 +467,16 @@ declare const STORE_DOORS: readonly [{
467
467
  readonly args: "";
468
468
  readonly returns: "TABLE(function_name text, identity_args text, why text)";
469
469
  readonly security: "invoker";
470
+ }, {
471
+ readonly name: "doors_not_on_one_ladder";
472
+ readonly args: "";
473
+ readonly returns: "TABLE(function_name text, identity_args text, why text)";
474
+ readonly security: "invoker";
475
+ }, {
476
+ readonly name: "effective_level";
477
+ readonly args: "p_user_id uuid, p_organization_id uuid, p_id uuid, p_type text DEFAULT 'record'::text";
478
+ readonly returns: "permission_level";
479
+ readonly security: "definer";
470
480
  }, {
471
481
  readonly name: "export_records";
472
482
  readonly args: "p_organization_id uuid, p_table_id uuid, p_limit integer DEFAULT 1000";
@@ -2540,7 +2550,12 @@ type RecordsErrorCode =
2540
2550
  | "door"
2541
2551
  /** `23514` — a Rule, a shape guard, or a validation the store enforces refused it. */
2542
2552
  | "refused_by_rule"
2543
- /** `22004` / `22023` — the call itself was malformed: a missing id, a patch that is not an object. */
2553
+ /**
2554
+ * `22004` / `22023` / `22P02` — the call itself was malformed: a missing id, a
2555
+ * patch that is not an object, or a value that does not fit the type the
2556
+ * store holds for that Field. The store's own message names the value and the
2557
+ * type it could not be read as.
2558
+ */
2544
2559
  | "invalid_argument"
2545
2560
  /** `02000` — the record is not here (deleted, never existed, or another organization's). */
2546
2561
  | "not_found"
@@ -2559,6 +2574,13 @@ type RecordsErrorCode =
2559
2574
  * connection; it is the one refusal in this list that is worth repeating.
2560
2575
  */
2561
2576
  | "stale_read"
2577
+ /**
2578
+ * `57014` — the store cancelled the statement at its own timeout. Nothing was
2579
+ * refused on its merits and nothing was written; the same call can succeed on
2580
+ * a smaller page or a quieter moment. With `stale_read`, one of the only two
2581
+ * refusals in this list worth repeating.
2582
+ */
2583
+ | "timed_out"
2562
2584
  /**
2563
2585
  * THE DOOR THAT DOES NOT EXIST YET. Not an error condition in the database —
2564
2586
  * this package asked for a door that is not in the live catalogue, so it
@@ -467,6 +467,16 @@ declare const STORE_DOORS: readonly [{
467
467
  readonly args: "";
468
468
  readonly returns: "TABLE(function_name text, identity_args text, why text)";
469
469
  readonly security: "invoker";
470
+ }, {
471
+ readonly name: "doors_not_on_one_ladder";
472
+ readonly args: "";
473
+ readonly returns: "TABLE(function_name text, identity_args text, why text)";
474
+ readonly security: "invoker";
475
+ }, {
476
+ readonly name: "effective_level";
477
+ readonly args: "p_user_id uuid, p_organization_id uuid, p_id uuid, p_type text DEFAULT 'record'::text";
478
+ readonly returns: "permission_level";
479
+ readonly security: "definer";
470
480
  }, {
471
481
  readonly name: "export_records";
472
482
  readonly args: "p_organization_id uuid, p_table_id uuid, p_limit integer DEFAULT 1000";
@@ -2540,7 +2550,12 @@ type RecordsErrorCode =
2540
2550
  | "door"
2541
2551
  /** `23514` — a Rule, a shape guard, or a validation the store enforces refused it. */
2542
2552
  | "refused_by_rule"
2543
- /** `22004` / `22023` — the call itself was malformed: a missing id, a patch that is not an object. */
2553
+ /**
2554
+ * `22004` / `22023` / `22P02` — the call itself was malformed: a missing id, a
2555
+ * patch that is not an object, or a value that does not fit the type the
2556
+ * store holds for that Field. The store's own message names the value and the
2557
+ * type it could not be read as.
2558
+ */
2544
2559
  | "invalid_argument"
2545
2560
  /** `02000` — the record is not here (deleted, never existed, or another organization's). */
2546
2561
  | "not_found"
@@ -2559,6 +2574,13 @@ type RecordsErrorCode =
2559
2574
  * connection; it is the one refusal in this list that is worth repeating.
2560
2575
  */
2561
2576
  | "stale_read"
2577
+ /**
2578
+ * `57014` — the store cancelled the statement at its own timeout. Nothing was
2579
+ * refused on its merits and nothing was written; the same call can succeed on
2580
+ * a smaller page or a quieter moment. With `stale_read`, one of the only two
2581
+ * refusals in this list worth repeating.
2582
+ */
2583
+ | "timed_out"
2562
2584
  /**
2563
2585
  * THE DOOR THAT DOES NOT EXIST YET. Not an error condition in the database —
2564
2586
  * this package asked for a door that is not in the live catalogue, so it
@@ -135,6 +135,8 @@ var STORE_DOORS = [
135
135
  { name: "doc_unresolved_tokens", args: "p_organization_id uuid, p_table_id uuid, p_body text", returns: "TABLE(raw text, field_id uuid, why text)", security: "invoker" },
136
136
  { name: "doors_not_deciding_the_caller", args: "", returns: "TABLE(function_name text, identity_args text)", security: "invoker" },
137
137
  { name: "doors_not_deciding_the_record", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
138
+ { name: "doors_not_on_one_ladder", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
139
+ { name: "effective_level", args: "p_user_id uuid, p_organization_id uuid, p_id uuid, p_type text DEFAULT 'record'::text", returns: "permission_level", security: "definer" },
138
140
  { name: "export_records", args: "p_organization_id uuid, p_table_id uuid, p_limit integer DEFAULT 1000", returns: "TABLE(id uuid, document jsonb)", security: "invoker" },
139
141
  { name: "external_foreign_table_findings", args: "", returns: "SETOF text", security: "definer" },
140
142
  { name: "external_history_event", args: "p_organization_id uuid, p_link_id uuid, p_operation text", returns: "bigint", security: "definer" },
@@ -1558,6 +1560,13 @@ var BY_SQLSTATE = {
1558
1560
  "23514": "refused_by_rule",
1559
1561
  "22004": "invalid_argument",
1560
1562
  "22023": "invalid_argument",
1563
+ // 22P02 — a value does not fit the type the store holds for it. The class is
1564
+ // real and was hit live: an organization whose copy of a package table grew
1565
+ // `status` as a uuid-valued Field was sent the text "open", and the store
1566
+ // answered `invalid input syntax for type uuid: "open"`. It is the CALL that
1567
+ // is wrong for the shape the store holds, which is what `invalid_argument`
1568
+ // already means — the store's own sentence names the value and the type.
1569
+ "22P02": "invalid_argument",
1561
1570
  "02000": "not_found",
1562
1571
  "23503": "missing_reference",
1563
1572
  "23505": "already_exists",
@@ -1569,6 +1578,13 @@ var BY_SQLSTATE = {
1569
1578
  // they just lost access to. It is retryable on a fresher connection, which is
1570
1579
  // a different instruction from every other refusal here.
1571
1580
  "40001": "stale_read",
1581
+ // 57014 — the store cancelled the statement at its own timeout. Like
1582
+ // `stale_read` and unlike every other refusal here, the call was never
1583
+ // refused on its merits: the same call on a smaller page, or once the
1584
+ // organization's kernel is not being rewritten, can succeed. It gets its own
1585
+ // code so a screen can offer "try again" honestly instead of showing a
1586
+ // failure sentence the caller cannot act on.
1587
+ "57014": "timed_out",
1572
1588
  // PostgREST's own two: the store is not being SERVED, which is a different
1573
1589
  // thing from the store refusing. `custom` absent from `pgrst.db_schemas`, or
1574
1590
  // the grants not copied, land here.