From f9105a3ddcc833bf23de505be1f7d5df94d7a0b3 Mon Sep 17 00:00:00 2001 From: kzoeps Date: Thu, 26 Nov 2026 17:59:12 +0600 Subject: [PATCH 1/8] list-golden: pin array parameter shapes and null indexed_at rows Adds per-array-filter cases (100 and 101 values, invalid, non-string, oversize and nested items, keyed and sparse tables) and a null indexed_at row for every list endpoint with a record view. Tests and regenerated golden only; no Lua change. This golden is the baseline for the helper consolidation commits. --- .../tests/unit/list-golden/fixtures.js | 56 +- .../tests/unit/list-golden/harness.js | 13 + .../list-golden/list-endpoints.golden.jsonl | 647 ++++++++++++++++++ 3 files changed, 715 insertions(+), 1 deletion(-) diff --git a/happyview-modules/tests/unit/list-golden/fixtures.js b/happyview-modules/tests/unit/list-golden/fixtures.js index 79ac1f66..be5b1a9b 100644 --- a/happyview-modules/tests/unit/list-golden/fixtures.js +++ b/happyview-modules/tests/unit/list-golden/fixtures.js @@ -1,4 +1,4 @@ -import { hexCursor } from "./harness.js"; +import { hexCursor, LuaTable } from "./harness.js"; const DID = "did:plc:abcdefghijklmnopqrstuvwx"; const TIMESTAMP = "2025-01-01T00:00:00Z"; @@ -222,6 +222,47 @@ function mixedIdentifierCase(name, base) { }; } +/** Longest repeated query parameter every array filter is documented to accept. */ +const ARRAY_MAX_VALUES = 100; + +/** + * Repeated-parameter shape and size cases. They record how each endpoint's own + * parser treats counts, item types, oversize items and the keyed or sparse + * tables that only a lenient parser walks past; the golden + * records whichever outcome each endpoint has. + */ +function arrayShapeCases(name, values, base) { + const withValue = (suffix, value) => ({ + name: `array:${name}:${suffix}`, + params: { ...base, [name]: value }, + }); + const repeat = (count) => Array.from({ length: count }, () => values[0]); + return [ + withValue("100-duplicates", repeat(ARRAY_MAX_VALUES)), + withValue("101-values", repeat(ARRAY_MAX_VALUES + 1)), + withValue("invalid-item", [values[0], "not a valid value"]), + withValue("non-string-item", [values[0], 7]), + withValue("oversize-item", [values[0], "a".repeat(5000)]), + withValue("nested-array-item", [values[0], [values[1]]]), + withValue( + "keyed-table", + new LuaTable([ + [1, values[0]], + ["x", values[1]], + ]), + ), + withValue("string-keyed-table", new LuaTable([["x", values[0]]])), + withValue( + "sparse-table", + new LuaTable([ + [1, values[0]], + [3, values[1]], + ]), + ), + withValue("sparse-table-from-2", new LuaTable([[2, values[0]]])), + ]; +} + function arrayFilterCases(endpoint, name, property, base, index) { const values = [0, 1, 2].map((n) => filterValue(endpoint, name, property, n)); const cases = [ @@ -243,6 +284,7 @@ function arrayFilterCases(endpoint, name, property, base, index) { if (MIXED_IDENTIFIERS.has(name) && MIXED_LIST_ENDPOINTS.has(endpoint.id)) { cases.push(mixedIdentifierCase(name, base)); } + cases.push(...arrayShapeCases(name, values, base)); // Alternate the window so adjacent array filters get different value sets in // filter:all and a swap of their inputs changes the recorded binds. const start = index % 2; @@ -754,6 +796,18 @@ export function casesFor(endpoint) { params: { ...base, includeTotal: true }, }); } + if (endpoint.id !== "org.hypercerts.collection.listCollectionItems") { + // A row whose indexed_at is SQL NULL (the key is absent from the Lua row). Every + // query, including actor hydration, sees it, so record and sidecar views are both + // exercised: it pins whether indexedAt comes out as JSON null or is omitted. + // The explicit rowsByCall keeps the count-row substitution below from replacing it. + cases.push({ + name: "row:indexed-at-null", + params: base, + rows: [{ ...pageRow(endpoint, 0), indexed_at: undefined }], + rowsByCall: [], + }); + } if (endpoint.id === "org.hypercerts.collection.listCollectionItems") { // More items than the default page size, no limit: pins the default limit (25) and its cursor. cases.push({ diff --git a/happyview-modules/tests/unit/list-golden/harness.js b/happyview-modules/tests/unit/list-golden/harness.js index 0817c28d..85d9f9cc 100644 --- a/happyview-modules/tests/unit/list-golden/harness.js +++ b/happyview-modules/tests/unit/list-golden/harness.js @@ -7,8 +7,21 @@ import { loadAssets } from "../../../tooling/installer.js"; const root = fileURLToPath(new URL("../../../", import.meta.url)); +/** + * A Lua table with explicit keys, for shapes JS arrays and objects cannot express: + * integer keys that are sparse or mixed with string keys. Numeric keys stay integers. + */ +export class LuaTable { + constructor(entries) { + this.entries = entries; + } +} + /** Encodes a JS value as a Lua table/literal for the runner program. */ export function lua(value) { + if (value instanceof LuaTable) { + return `{${value.entries.map(([key, item]) => `[${lua(key)}]=${lua(item)}`).join(",")}}`; + } if (typeof value === "string") return JSON.stringify(value); if (typeof value === "number" || typeof value === "boolean") return String(value); if (Array.isArray(value)) return `{${value.map(lua).join(",")}}`; diff --git a/happyview-modules/tests/unit/list-golden/list-endpoints.golden.jsonl b/happyview-modules/tests/unit/list-golden/list-endpoints.golden.jsonl index edfaab04..6856a03c 100644 --- a/happyview-modules/tests/unit/list-golden/list-endpoints.golden.jsonl +++ b/happyview-modules/tests/unit/list-golden/list-endpoints.golden.jsonl @@ -35,6 +35,7 @@ {"sql":"1b8c5a6a7c","text":"SELECT DISTINCT ON (uri) uri, did, cid, indexed_at::text AS indexed_at, record::text AS record FROM happyview_records WHERE collection = $1 AND uri IN ($2, $3) ORDER BY uri, COALESCE(indexed_at::timestamptz, created_at::timestamptz) DESC, cid DESC"} {"sql":"1bebe37cb6","text":"SELECT contribution.uri, contribution.did, contribution.cid, contribution.indexed_at::text AS indexed_at, contribution.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS contribution CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(contribution.record::jsonb->'createdAt') = 'string' AND contribution.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND contribution.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(contribution.record::jsonb->>'createdAt', 'timestamptz') THEN (contribution.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(contribution.indexed_at::timestamptz, contribution.created_at::timestamptz, 'epoch'::timestamptz) END AS sort_at) AS sorted WHERE contribution.collection = $1 ORDER BY sorted.sort_at ASC, contribution.uri ASC LIMIT $2"} {"sql":"1c9c2867bb","text":"SELECT attachment.uri, attachment.did, attachment.cid, attachment.indexed_at::text AS indexed_at, attachment.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS attachment CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(attachment.record::jsonb->'createdAt') = 'string' AND attachment.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND attachment.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(attachment.record::jsonb->>'createdAt', 'timestamptz') THEN (attachment.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(attachment.indexed_at::timestamptz, attachment.created_at::timestamptz) END AS sort_at) AS sorted WHERE attachment.collection = $1 AND (sorted.sort_at, attachment.uri) > (($2)::timestamptz, $3) ORDER BY sorted.sort_at ASC, attachment.uri ASC LIMIT $4"} +{"sql":"1ccbf162ea","text":"SELECT award.uri, award.did, award.cid, award.indexed_at::text AS indexed_at, award.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp, badge.uri AS badge_uri, badge.cid AS badge_cid, badge.indexed_at::text AS badge_indexed_at, badge.did AS badge_did, badge.record::text AS badge_record, recipient_response.uri AS recipient_response_uri, recipient_response.cid AS recipient_response_cid, recipient_response.indexed_at::text AS recipient_response_indexed_at, recipient_response.did AS recipient_response_did, recipient_response.record::text AS recipient_response_record FROM happyview_records AS award CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(award.record::jsonb->'createdAt') = 'string' AND award.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND award.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(award.record::jsonb->>'createdAt', 'timestamptz') THEN (award.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(award.indexed_at::timestamptz, award.created_at::timestamptz) END AS sort_at) sorted LEFT JOIN happyview_records AS badge ON badge.collection = 'app.certified.badge.definition' AND badge.uri = award.record::jsonb->'badge'->>'uri' AND badge.cid = award.record::jsonb->'badge'->>'cid' LEFT JOIN LATERAL (SELECT response.uri, response.cid, response.indexed_at, response.did, response.record FROM happyview_records AS response WHERE response.collection = 'app.certified.badge.response' AND response.did = CASE WHEN jsonb_typeof(award.record::jsonb->'subject') = 'string' THEN award.record::jsonb->>'subject' WHEN jsonb_typeof(award.record::jsonb->'subject') = 'object' AND award.record::jsonb->'subject'->>'$type' = 'app.certified.defs#did' AND jsonb_typeof(award.record::jsonb->'subject'->'did') = 'string' THEN award.record::jsonb->'subject'->>'did' ELSE split_part(award.record::jsonb->'subject'->>'uri', '/', 3) END AND response.record::jsonb->'badgeAward'->>'uri' = award.uri AND response.record::jsonb->'badgeAward'->>'cid' = award.cid AND response.record::jsonb->>'response' IN ('accepted', 'rejected') ORDER BY response.indexed_at DESC NULLS LAST, response.uri DESC LIMIT 1) AS recipient_response ON TRUE WHERE award.collection = $1 AND badge.record::jsonb->>'badgeType' IN ($2,$3) ORDER BY sorted.sort_at DESC, award.uri DESC LIMIT $4"} {"sql":"1d0659e810","text":"SELECT link.uri, link.did, link.cid, link.indexed_at::text AS indexed_at, link.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS link CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(link.record::jsonb->'createdAt') = 'string' AND link.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND link.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(link.record::jsonb->>'createdAt', 'timestamptz') THEN (link.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(link.indexed_at::timestamptz, link.created_at::timestamptz) END AS sort_at) sorted WHERE link.collection = $1 AND FALSE ORDER BY sorted.sort_at DESC, link.uri DESC LIMIT $2"} {"sql":"1df3d14bb5","text":"SELECT activity.uri, activity.did, activity.cid, activity.indexed_at::text AS indexed_at, activity.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS activity CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(activity.record::jsonb->'createdAt') = 'string' AND activity.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND activity.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(activity.record::jsonb->>'createdAt', 'timestamptz') THEN (activity.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(activity.indexed_at::timestamptz, activity.created_at::timestamptz) END AS sort_at) AS sorted WHERE activity.collection = $1 AND (sorted.sort_at, activity.uri) < (($2)::timestamptz, $3) ORDER BY sorted.sort_at DESC, activity.uri DESC LIMIT $4"} {"sql":"1f264cba3c","text":"SELECT feature.uri, feature.did, feature.cid, feature.indexed_at::text AS indexed_at, feature.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS feature CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(feature.record::jsonb -> 'createdAt') = 'string' AND feature.record::jsonb ->> 'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND feature.record::jsonb ->> 'createdAt' !~ '-00:00$' AND pg_input_is_valid(feature.record::jsonb ->> 'createdAt', 'timestamptz') THEN (feature.record::jsonb ->> 'createdAt')::timestamptz ELSE COALESCE(feature.indexed_at::timestamptz, feature.created_at::timestamptz) END AS sort_at) AS sorted WHERE feature.collection = $1 AND EXISTS (SELECT 1 FROM happyview_records AS organization WHERE organization.collection = 'app.certified.actor.organization' AND organization.rkey = 'self' AND organization.did = feature.did) ORDER BY sorted.sort_at DESC, feature.uri DESC LIMIT $2"} @@ -64,7 +65,9 @@ {"sql":"305030aa27","text":"SELECT collection.uri, collection.did, collection.cid, collection.indexed_at::text AS indexed_at, collection.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS collection CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(collection.record::jsonb->'createdAt') = 'string' AND collection.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND collection.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(collection.record::jsonb->>'createdAt', 'timestamptz') THEN (collection.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(collection.indexed_at::timestamptz, collection.created_at::timestamptz) END AS sort_at) AS sorted WHERE collection.collection = $1 AND EXISTS (SELECT 1 FROM jsonb_array_elements(CASE WHEN jsonb_typeof(collection.record::jsonb->'tags') = 'array' THEN collection.record::jsonb->'tags' ELSE '[]'::jsonb END) AS tag(value) WHERE tag.value->>'uri' = $2) ORDER BY sorted.sort_at DESC, collection.uri DESC LIMIT $3"} {"sql":"3292022713","text":"SELECT attachment.uri, attachment.did, attachment.cid, attachment.indexed_at::text AS indexed_at, attachment.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS attachment CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(attachment.record::jsonb->'createdAt') = 'string' AND attachment.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND attachment.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(attachment.record::jsonb->>'createdAt', 'timestamptz') THEN (attachment.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(attachment.indexed_at::timestamptz, attachment.created_at::timestamptz) END AS sort_at) AS sorted WHERE attachment.collection = $1 AND EXISTS (SELECT 1 FROM jsonb_array_elements(CASE WHEN jsonb_typeof(attachment.record::jsonb->'subjects') = 'array' THEN attachment.record::jsonb->'subjects' ELSE '[]'::jsonb END) AS subject(value) WHERE subject.value->>'uri' IN ($2)) ORDER BY sorted.sort_at DESC, attachment.uri DESC LIMIT $3"} {"sql":"3579ec0f41","text":"SELECT evaluation.uri, evaluation.did, evaluation.cid, evaluation.indexed_at::text AS indexed_at, evaluation.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS evaluation CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(evaluation.record::jsonb->'createdAt') = 'string' AND evaluation.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND evaluation.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(evaluation.record::jsonb->>'createdAt', 'timestamptz') THEN (evaluation.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(evaluation.indexed_at::timestamptz, evaluation.created_at::timestamptz) END AS sort_at) AS sorted WHERE evaluation.collection = $1 AND (sorted.sort_at, evaluation.uri) > (($2)::timestamptz, $3) ORDER BY sorted.sort_at ASC, evaluation.uri ASC LIMIT $4"} +{"sql":"3595567315","text":"SELECT attachment.uri, attachment.did, attachment.cid, attachment.indexed_at::text AS indexed_at, attachment.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS attachment CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(attachment.record::jsonb->'createdAt') = 'string' AND attachment.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND attachment.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(attachment.record::jsonb->>'createdAt', 'timestamptz') THEN (attachment.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(attachment.indexed_at::timestamptz, attachment.created_at::timestamptz) END AS sort_at) AS sorted WHERE attachment.collection = $1 AND attachment.record::jsonb->>'contentType' IN ($2, $3) ORDER BY sorted.sort_at DESC, attachment.uri DESC LIMIT $4"} {"sql":"36e6f96de2","text":"SELECT award.uri, award.did, award.cid, award.indexed_at::text AS indexed_at, award.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp, badge.uri AS badge_uri, badge.cid AS badge_cid, badge.indexed_at::text AS badge_indexed_at, badge.did AS badge_did, badge.record::text AS badge_record, recipient_response.uri AS recipient_response_uri, recipient_response.cid AS recipient_response_cid, recipient_response.indexed_at::text AS recipient_response_indexed_at, recipient_response.did AS recipient_response_did, recipient_response.record::text AS recipient_response_record FROM happyview_records AS award CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(award.record::jsonb->'createdAt') = 'string' AND award.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND award.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(award.record::jsonb->>'createdAt', 'timestamptz') THEN (award.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(award.indexed_at::timestamptz, award.created_at::timestamptz) END AS sort_at) sorted LEFT JOIN happyview_records AS badge ON badge.collection = 'app.certified.badge.definition' AND badge.uri = award.record::jsonb->'badge'->>'uri' AND badge.cid = award.record::jsonb->'badge'->>'cid' LEFT JOIN LATERAL (SELECT response.uri, response.cid, response.indexed_at, response.did, response.record FROM happyview_records AS response WHERE response.collection = 'app.certified.badge.response' AND response.did = CASE WHEN jsonb_typeof(award.record::jsonb->'subject') = 'string' THEN award.record::jsonb->>'subject' WHEN jsonb_typeof(award.record::jsonb->'subject') = 'object' AND award.record::jsonb->'subject'->>'$type' = 'app.certified.defs#did' AND jsonb_typeof(award.record::jsonb->'subject'->'did') = 'string' THEN award.record::jsonb->'subject'->>'did' ELSE split_part(award.record::jsonb->'subject'->>'uri', '/', 3) END AND response.record::jsonb->'badgeAward'->>'uri' = award.uri AND response.record::jsonb->'badgeAward'->>'cid' = award.cid AND response.record::jsonb->>'response' IN ('accepted', 'rejected') ORDER BY response.indexed_at DESC NULLS LAST, response.uri DESC LIMIT 1) AS recipient_response ON TRUE WHERE award.collection = $1 AND COALESCE(recipient_response.record::jsonb->>'response', 'unanswered') IN ($2,$3,$4) ORDER BY sorted.sort_at DESC, award.uri DESC LIMIT $5"} +{"sql":"3731fb2cc3","text":"SELECT organization.uri, organization.did, organization.cid, organization.indexed_at::text AS indexed_at, organization.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS organization CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(organization.record::jsonb->'createdAt') = 'string' AND organization.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND organization.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(organization.record::jsonb->>'createdAt', 'timestamptz') THEN (organization.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(organization.indexed_at::timestamptz, organization.created_at::timestamptz) END AS sort_at) AS sorted WHERE organization.collection = $1 AND organization.rkey = 'self' AND EXISTS (SELECT 1 FROM jsonb_array_elements_text(CASE WHEN jsonb_typeof(organization.record::jsonb->'organizationType') = 'array' THEN organization.record::jsonb->'organizationType' ELSE '[]'::jsonb END) AS organization_type(value) WHERE organization_type.value IN ($2, $3)) ORDER BY sorted.sort_at DESC, uri DESC LIMIT $4"} {"sql":"38a6653b6f","text":"SELECT collection.uri, collection.did, collection.cid, collection.indexed_at::text AS indexed_at, collection.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS collection CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(collection.record::jsonb->'createdAt') = 'string' AND collection.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND collection.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(collection.record::jsonb->>'createdAt', 'timestamptz') THEN (collection.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(collection.indexed_at::timestamptz, collection.created_at::timestamptz) END AS sort_at) AS sorted WHERE collection.collection = $1 AND collection.uri IN ($2) ORDER BY sorted.sort_at DESC, collection.uri DESC LIMIT $3"} {"sql":"39b32463ae","text":"WITH matched AS (SELECT sorted.sort_at, award.uri, award.did, award.cid, award.indexed_at::text AS indexed_at, award.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp, badge.uri AS badge_uri, badge.cid AS badge_cid, badge.indexed_at::text AS badge_indexed_at, badge.did AS badge_did, badge.record::text AS badge_record, recipient_response.uri AS recipient_response_uri, recipient_response.cid AS recipient_response_cid, recipient_response.indexed_at::text AS recipient_response_indexed_at, recipient_response.did AS recipient_response_did, recipient_response.record::text AS recipient_response_record FROM happyview_records AS award CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(award.record::jsonb->'createdAt') = 'string' AND award.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND award.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(award.record::jsonb->>'createdAt', 'timestamptz') THEN (award.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(award.indexed_at::timestamptz, award.created_at::timestamptz) END AS sort_at) sorted LEFT JOIN happyview_records AS badge ON badge.collection = 'app.certified.badge.definition' AND badge.uri = award.record::jsonb->'badge'->>'uri' AND badge.cid = award.record::jsonb->'badge'->>'cid' LEFT JOIN LATERAL (SELECT response.uri, response.cid, response.indexed_at, response.did, response.record FROM happyview_records AS response WHERE response.collection = 'app.certified.badge.response' AND response.did = CASE WHEN jsonb_typeof(award.record::jsonb->'subject') = 'string' THEN award.record::jsonb->>'subject' WHEN jsonb_typeof(award.record::jsonb->'subject') = 'object' AND award.record::jsonb->'subject'->>'$type' = 'app.certified.defs#did' AND jsonb_typeof(award.record::jsonb->'subject'->'did') = 'string' THEN award.record::jsonb->'subject'->>'did' ELSE split_part(award.record::jsonb->'subject'->>'uri', '/', 3) END AND response.record::jsonb->'badgeAward'->>'uri' = award.uri AND response.record::jsonb->'badgeAward'->>'cid' = award.cid AND response.record::jsonb->>'response' IN ('accepted', 'rejected') ORDER BY response.indexed_at DESC NULLS LAST, response.uri DESC LIMIT 1) AS recipient_response ON TRUE WHERE award.collection = $1 AND award.did IN ($2,$3) AND award.record::jsonb->'badge'->>'uri' IN ($4,$5) AND ((jsonb_typeof(award.record::jsonb->'subject') = 'string' AND award.record::jsonb->>'subject' IN ($6)) OR (jsonb_typeof(award.record::jsonb->'subject') = 'object' AND award.record::jsonb->'subject'->>'$type' = 'app.certified.defs#did' AND jsonb_typeof(award.record::jsonb->'subject'->'did') = 'string' AND award.record::jsonb->'subject'->>'did' IN ($6)) OR (jsonb_typeof(award.record::jsonb->'subject') = 'object' AND award.record::jsonb->'subject'->>'uri' IN ($7))) AND badge.record::jsonb->>'badgeType' IN ($8,$9) AND COALESCE(recipient_response.record::jsonb->>'response', 'unanswered') IN ($10,$11)), total AS (SELECT COUNT(*) AS total_count FROM matched), page AS (SELECT * FROM matched ORDER BY sort_at DESC, uri DESC LIMIT $12) SELECT page.uri, page.did, page.cid, page.indexed_at, page.record, page.sort_timestamp, page.badge_uri, page.badge_cid, page.badge_indexed_at, page.badge_did, page.badge_record, page.recipient_response_uri, page.recipient_response_cid, page.recipient_response_indexed_at, page.recipient_response_did, page.recipient_response_record, total.total_count FROM total LEFT JOIN page ON TRUE ORDER BY page.sort_at DESC, page.uri DESC"} {"sql":"39d1ecf7da","text":"SELECT uri, did, cid, indexed_at::text AS indexed_at, record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(record::jsonb->'createdAt') = 'string' AND record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(record::jsonb->>'createdAt', 'timestamptz') THEN (record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(indexed_at::timestamptz, created_at::timestamptz) END AS sort_at) sorted WHERE collection = $1 AND did IN ($2,$3) AND uri IN ($4,$5) AND (record::jsonb)->>'locationType' IN ($6,$7) ORDER BY sorted.sort_at DESC, uri DESC LIMIT $8"} @@ -104,6 +107,7 @@ {"sql":"56eaf46105","text":"SELECT evaluation.uri, evaluation.did, evaluation.cid, evaluation.indexed_at::text AS indexed_at, evaluation.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS evaluation CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(evaluation.record::jsonb->'createdAt') = 'string' AND evaluation.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND evaluation.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(evaluation.record::jsonb->>'createdAt', 'timestamptz') THEN (evaluation.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(evaluation.indexed_at::timestamptz, evaluation.created_at::timestamptz) END AS sort_at) AS sorted WHERE evaluation.collection = $1 AND evaluation.did IN ($2) ORDER BY sorted.sort_at DESC, evaluation.uri DESC LIMIT $3"} {"sql":"58a6e2c916","text":"SELECT workscope_tag.uri, workscope_tag.did, workscope_tag.cid, workscope_tag.indexed_at::text AS indexed_at, workscope_tag.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS workscope_tag CROSS JOIN LATERAL (SELECT COALESCE(CASE WHEN workscope_tag.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]+)?(Z|[+-][0-9]{2}:[0-9]{2})$' AND workscope_tag.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(workscope_tag.record::jsonb->>'createdAt', 'timestamp with time zone') THEN (workscope_tag.record::jsonb->>'createdAt')::timestamptz END, CASE WHEN pg_input_is_valid(workscope_tag.indexed_at, 'timestamp with time zone') THEN workscope_tag.indexed_at::timestamptz END, CASE WHEN pg_input_is_valid(workscope_tag.created_at, 'timestamp with time zone') THEN workscope_tag.created_at::timestamptz END) AS sort_at) AS sorted WHERE workscope_tag.collection = $1 AND workscope_tag.did IN ($2, $3, $4) ORDER BY sorted.sort_at DESC, workscope_tag.uri DESC LIMIT $5"} {"sql":"598df7d2c2","text":"SELECT uri, did, cid, indexed_at::text AS indexed_at, record::text AS record FROM happyview_records WHERE collection = $1 AND uri IN ($2, $3)"} +{"sql":"5a1dffb2b2","text":"SELECT uri, did, cid, indexed_at::text AS indexed_at, record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(record::jsonb->'createdAt') = 'string' AND record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(record::jsonb->>'createdAt', 'timestamptz') THEN (record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(indexed_at::timestamptz, created_at::timestamptz) END AS sort_at) sorted WHERE collection = $1 AND record::jsonb->>'badgeType' IN ($2,$3) ORDER BY sorted.sort_at DESC, uri DESC LIMIT $4"} {"sql":"5acf26e440","text":"WITH total AS (SELECT COUNT(*) AS total_count FROM happyview_records AS receipt WHERE receipt.collection = $1 AND receipt.did IN ($2, $3) AND receipt.uri IN ($4, $5) AND ((receipt.record::jsonb->'from'->>'$type' = 'app.certified.defs#did' AND receipt.record::jsonb->'from'->>'did' IN ($6)) OR (receipt.record::jsonb->'from'->>'$type' = 'com.atproto.repo.strongRef' AND receipt.record::jsonb->'from'->>'uri' IN ($7))) AND ((receipt.record::jsonb->'to'->>'$type' = 'app.certified.defs#did' AND receipt.record::jsonb->'to'->>'did' IN ($8)) OR (receipt.record::jsonb->'to'->>'$type' = 'com.atproto.repo.strongRef' AND receipt.record::jsonb->'to'->>'uri' IN ($9))) AND receipt.record::jsonb->'for'->>'uri' IN ($10, $11) AND receipt.record::jsonb->>'transactionId' IN ($12, $13)), page AS (SELECT sorted.sort_at AS sort_at, receipt.uri, receipt.did, receipt.cid, receipt.indexed_at::text AS indexed_at, receipt.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS receipt CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(receipt.record::jsonb->'createdAt') = 'string' AND receipt.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND receipt.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(receipt.record::jsonb->>'createdAt', 'timestamptz') THEN (receipt.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(receipt.indexed_at::timestamptz, receipt.created_at::timestamptz) END AS sort_at) AS sorted WHERE receipt.collection = $1 AND receipt.did IN ($2, $3) AND receipt.uri IN ($4, $5) AND ((receipt.record::jsonb->'from'->>'$type' = 'app.certified.defs#did' AND receipt.record::jsonb->'from'->>'did' IN ($6)) OR (receipt.record::jsonb->'from'->>'$type' = 'com.atproto.repo.strongRef' AND receipt.record::jsonb->'from'->>'uri' IN ($7))) AND ((receipt.record::jsonb->'to'->>'$type' = 'app.certified.defs#did' AND receipt.record::jsonb->'to'->>'did' IN ($8)) OR (receipt.record::jsonb->'to'->>'$type' = 'com.atproto.repo.strongRef' AND receipt.record::jsonb->'to'->>'uri' IN ($9))) AND receipt.record::jsonb->'for'->>'uri' IN ($10, $11) AND receipt.record::jsonb->>'transactionId' IN ($12, $13) ORDER BY sorted.sort_at DESC, receipt.uri DESC LIMIT $14) SELECT page.uri, page.did, page.cid, page.indexed_at, page.record, page.sort_timestamp, total.total_count FROM total LEFT JOIN page ON TRUE ORDER BY page.sort_at DESC, page.uri DESC"} {"sql":"5b97334acb","text":"SELECT evaluation.uri, evaluation.did, evaluation.cid, evaluation.indexed_at::text AS indexed_at, evaluation.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS evaluation CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(evaluation.record::jsonb->'createdAt') = 'string' AND evaluation.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND evaluation.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(evaluation.record::jsonb->>'createdAt', 'timestamptz') THEN (evaluation.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(evaluation.indexed_at::timestamptz, evaluation.created_at::timestamptz) END AS sort_at) AS sorted WHERE evaluation.collection = $1 AND EXISTS (SELECT 1 FROM jsonb_array_elements(CASE WHEN jsonb_typeof(evaluation.record::jsonb->'evaluators') = 'array' THEN evaluation.record::jsonb->'evaluators' ELSE '[]'::jsonb END) AS evaluator(value) WHERE evaluator.value->>'did' IN ($2, $3, $4)) ORDER BY sorted.sort_at DESC, evaluation.uri DESC LIMIT $5"} {"sql":"5c2951cb59","text":"SELECT contribution.uri, contribution.did, contribution.cid, contribution.indexed_at::text AS indexed_at, contribution.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS contribution CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(contribution.record::jsonb->'createdAt') = 'string' AND contribution.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND contribution.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(contribution.record::jsonb->>'createdAt', 'timestamptz') THEN (contribution.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(contribution.indexed_at::timestamptz, contribution.created_at::timestamptz, 'epoch'::timestamptz) END AS sort_at) AS sorted WHERE contribution.collection = $1 AND contribution.did IN ($2) ORDER BY sorted.sort_at DESC, contribution.uri DESC LIMIT $3"} @@ -115,15 +119,18 @@ {"sql":"60f03b42b4","text":"SELECT acknowledgement.uri, acknowledgement.did, acknowledgement.cid, acknowledgement.indexed_at::text AS indexed_at, acknowledgement.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS acknowledgement CROSS JOIN LATERAL (SELECT COALESCE(CASE WHEN jsonb_typeof(acknowledgement.record::jsonb->'createdAt') = 'string' AND acknowledgement.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND acknowledgement.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(acknowledgement.record::jsonb->>'createdAt', 'timestamptz') THEN (acknowledgement.record::jsonb->>'createdAt')::timestamptz ELSE NULL END, acknowledgement.indexed_at::timestamptz, acknowledgement.created_at::timestamptz) AS sort_at) AS sorted WHERE acknowledgement.collection = $1 AND acknowledgement.did IN ($2, $3) AND acknowledgement.record::jsonb->'subject'->>'uri' IN ($4, $5) ORDER BY sorted.sort_at DESC, acknowledgement.uri DESC LIMIT $6"} {"sql":"63e9f57c41","text":"SELECT organization.uri, organization.did, organization.cid, organization.indexed_at::text AS indexed_at, organization.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS organization CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(organization.record::jsonb->'createdAt') = 'string' AND organization.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND organization.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(organization.record::jsonb->>'createdAt', 'timestamptz') THEN (organization.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(organization.indexed_at::timestamptz, organization.created_at::timestamptz) END AS sort_at) AS sorted WHERE organization.collection = $1 AND organization.rkey = 'self' AND organization.did IN ($2, $3, $4) AND (strpos(lower(COALESCE(organization.record::jsonb->>'legalName', '')), lower($5)) > 0 OR EXISTS (SELECT 1 FROM happyview_records AS profile WHERE profile.collection = $6 AND profile.did = organization.did AND profile.rkey = 'self' AND (strpos(lower(COALESCE(profile.record::jsonb->>'displayName', '')), lower($5)) > 0 OR strpos(lower(COALESCE(profile.record::jsonb->>'description', '')), lower($5)) > 0))) ORDER BY sorted.sort_at DESC, uri DESC LIMIT $7"} {"sql":"641d03e31b","text":"SELECT receipt.uri, receipt.did, receipt.cid, receipt.indexed_at::text AS indexed_at, receipt.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS receipt CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(receipt.record::jsonb->'createdAt') = 'string' AND receipt.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND receipt.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(receipt.record::jsonb->>'createdAt', 'timestamptz') THEN (receipt.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(receipt.indexed_at::timestamptz, receipt.created_at::timestamptz) END AS sort_at) AS sorted WHERE receipt.collection = $1 AND receipt.record::jsonb->'for'->>'uri' IN ($2) ORDER BY sorted.sort_at DESC, receipt.uri DESC LIMIT $3"} +{"sql":"6430698e9f","text":"SELECT uri, did, cid, indexed_at::text AS indexed_at, record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(record::jsonb->'createdAt') = 'string' AND record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(record::jsonb->>'createdAt', 'timestamptz') THEN (record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(indexed_at::timestamptz, created_at::timestamptz) END AS sort_at) sorted WHERE collection = $1 AND record::jsonb->>'badgeType' IN ($2,$3) AND (strpos(lower(COALESCE(record::jsonb->>'title', '')), lower($4)) > 0 OR strpos(lower(COALESCE(record::jsonb->>'description', '')), lower($4)) > 0) ORDER BY sorted.sort_at DESC, uri DESC LIMIT $5"} {"sql":"6505727280","text":"SELECT collection.uri, collection.did, collection.cid, collection.indexed_at::text AS indexed_at, collection.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS collection CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(collection.record::jsonb->'createdAt') = 'string' AND collection.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND collection.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(collection.record::jsonb->>'createdAt', 'timestamptz') THEN (collection.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(collection.indexed_at::timestamptz, collection.created_at::timestamptz) END AS sort_at) AS sorted WHERE collection.collection = $1 AND collection.uri IN ($2, $3, $4) AND (strpos(lower(COALESCE(collection.record::jsonb->>'title', '')), lower($5)) > 0 OR strpos(lower(COALESCE(collection.record::jsonb->>'shortDescription', '')), lower($5)) > 0) ORDER BY sorted.sort_at DESC, collection.uri DESC LIMIT $6"} {"sql":"659e7408ff","text":"SELECT attachment.uri, attachment.did, attachment.cid, attachment.indexed_at::text AS indexed_at, attachment.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS attachment CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(attachment.record::jsonb->'createdAt') = 'string' AND attachment.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND attachment.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(attachment.record::jsonb->>'createdAt', 'timestamptz') THEN (attachment.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(attachment.indexed_at::timestamptz, attachment.created_at::timestamptz) END AS sort_at) AS sorted WHERE attachment.collection = $1 ORDER BY sorted.sort_at ASC, attachment.uri ASC LIMIT $2"} {"sql":"667b351197","text":"SELECT measurement.uri, measurement.did, measurement.cid, measurement.indexed_at::text AS indexed_at, measurement.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS measurement CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(measurement.record::jsonb->'createdAt') = 'string' AND measurement.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND measurement.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(measurement.record::jsonb->>'createdAt', 'timestamptz') THEN (measurement.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(measurement.indexed_at::timestamptz, measurement.created_at::timestamptz) END AS sort_at) AS sorted WHERE measurement.collection = $1 AND measurement.did IN ($2, $3, $4) ORDER BY sorted.sort_at DESC, measurement.uri DESC LIMIT $5"} {"sql":"66b024f84a","text":"SELECT collection.uri, collection.did, collection.cid, collection.indexed_at::text AS indexed_at, collection.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS collection CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(collection.record::jsonb->'createdAt') = 'string' AND collection.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND collection.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(collection.record::jsonb->>'createdAt', 'timestamptz') THEN (collection.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(collection.indexed_at::timestamptz, collection.created_at::timestamptz) END AS sort_at) AS sorted WHERE collection.collection = $1 AND (sorted.sort_at, collection.uri) > (($2)::timestamptz, $3) ORDER BY sorted.sort_at ASC, collection.uri ASC LIMIT $4"} {"sql":"670611fb64","text":"SELECT measurement.uri, measurement.did, measurement.cid, measurement.indexed_at::text AS indexed_at, measurement.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS measurement CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(measurement.record::jsonb->'createdAt') = 'string' AND measurement.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND measurement.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(measurement.record::jsonb->>'createdAt', 'timestamptz') THEN (measurement.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(measurement.indexed_at::timestamptz, measurement.created_at::timestamptz) END AS sort_at) AS sorted WHERE measurement.collection = $1 AND (sorted.sort_at, measurement.uri) > (($2)::timestamptz, $3) ORDER BY sorted.sort_at ASC, measurement.uri ASC LIMIT $4"} +{"sql":"69226c63d4","text":"SELECT feature.uri, feature.did, feature.cid, feature.indexed_at::text AS indexed_at, feature.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS feature CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(feature.record::jsonb -> 'createdAt') = 'string' AND feature.record::jsonb ->> 'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND feature.record::jsonb ->> 'createdAt' !~ '-00:00$' AND pg_input_is_valid(feature.record::jsonb ->> 'createdAt', 'timestamptz') THEN (feature.record::jsonb ->> 'createdAt')::timestamptz ELSE COALESCE(feature.indexed_at::timestamptz, feature.created_at::timestamptz) END AS sort_at) AS sorted WHERE feature.collection = $1 AND (jsonb_typeof(feature.record::jsonb -> 'type') = 'string' AND feature.record::jsonb ->> 'type' IN ($2, $3)) ORDER BY sorted.sort_at DESC, feature.uri DESC LIMIT $4"} {"sql":"69fc88161b","text":"SELECT activity.uri, activity.did, activity.cid, activity.indexed_at::text AS indexed_at, activity.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS activity CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(activity.record::jsonb->'createdAt') = 'string' AND activity.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND activity.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(activity.record::jsonb->>'createdAt', 'timestamptz') THEN (activity.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(activity.indexed_at::timestamptz, activity.created_at::timestamptz) END AS sort_at) AS sorted WHERE activity.collection = $1 AND (strpos(lower(COALESCE(activity.record::jsonb->>'title', '')), lower($2)) > 0 OR strpos(lower(COALESCE(activity.record::jsonb->>'shortDescription', '')), lower($2)) > 0) ORDER BY sorted.sort_at DESC, activity.uri DESC LIMIT $3"} {"sql":"6a0e1152da","text":"SELECT contribution.uri, contribution.did, contribution.cid, contribution.indexed_at::text AS indexed_at, contribution.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS contribution CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(contribution.record::jsonb->'createdAt') = 'string' AND contribution.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND contribution.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(contribution.record::jsonb->>'createdAt', 'timestamptz') THEN (contribution.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(contribution.indexed_at::timestamptz, contribution.created_at::timestamptz, 'epoch'::timestamptz) END AS sort_at) AS sorted WHERE contribution.collection = $1 ORDER BY sorted.sort_at DESC, contribution.uri DESC LIMIT $2"} {"sql":"6ae42317e4","text":"SELECT collection.uri, collection.did, collection.cid, collection.indexed_at::text AS indexed_at, collection.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS collection CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(collection.record::jsonb->'createdAt') = 'string' AND collection.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND collection.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(collection.record::jsonb->>'createdAt', 'timestamptz') THEN (collection.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(collection.indexed_at::timestamptz, collection.created_at::timestamptz) END AS sort_at) AS sorted WHERE collection.collection = $1 AND (strpos(lower(COALESCE(collection.record::jsonb->>'title', '')), lower($2)) > 0 OR strpos(lower(COALESCE(collection.record::jsonb->>'shortDescription', '')), lower($2)) > 0) AND (sorted.sort_at, collection.uri) < (($3)::timestamptz, $4) ORDER BY sorted.sort_at DESC, collection.uri DESC LIMIT $5"} {"sql":"6c1a25fc34","text":"SELECT feature.uri, feature.did, feature.cid, feature.indexed_at::text AS indexed_at, feature.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS feature CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(feature.record::jsonb -> 'createdAt') = 'string' AND feature.record::jsonb ->> 'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND feature.record::jsonb ->> 'createdAt' !~ '-00:00$' AND pg_input_is_valid(feature.record::jsonb ->> 'createdAt', 'timestamptz') THEN (feature.record::jsonb ->> 'createdAt')::timestamptz ELSE COALESCE(feature.indexed_at::timestamptz, feature.created_at::timestamptz) END AS sort_at) AS sorted WHERE feature.collection = $1 AND (jsonb_typeof(feature.record::jsonb -> 'type') = 'string' AND feature.record::jsonb ->> 'type' IN ($2)) ORDER BY sorted.sort_at DESC, feature.uri DESC LIMIT $3"} +{"sql":"6c47c018fb","text":"SELECT collection.uri, collection.did, collection.cid, collection.indexed_at::text AS indexed_at, collection.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS collection CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(collection.record::jsonb->'createdAt') = 'string' AND collection.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND collection.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(collection.record::jsonb->>'createdAt', 'timestamptz') THEN (collection.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(collection.indexed_at::timestamptz, collection.created_at::timestamptz) END AS sort_at) AS sorted WHERE collection.collection = $1 AND collection.record::jsonb->>'type' IN ($2, $3) ORDER BY sorted.sort_at DESC, collection.uri DESC LIMIT $4"} {"sql":"6d1dd77a51","text":"SELECT award.uri, award.did, award.cid, award.indexed_at::text AS indexed_at, award.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp, badge.uri AS badge_uri, badge.cid AS badge_cid, badge.indexed_at::text AS badge_indexed_at, badge.did AS badge_did, badge.record::text AS badge_record, recipient_response.uri AS recipient_response_uri, recipient_response.cid AS recipient_response_cid, recipient_response.indexed_at::text AS recipient_response_indexed_at, recipient_response.did AS recipient_response_did, recipient_response.record::text AS recipient_response_record FROM happyview_records AS award CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(award.record::jsonb->'createdAt') = 'string' AND award.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND award.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(award.record::jsonb->>'createdAt', 'timestamptz') THEN (award.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(award.indexed_at::timestamptz, award.created_at::timestamptz) END AS sort_at) sorted LEFT JOIN happyview_records AS badge ON badge.collection = 'app.certified.badge.definition' AND badge.uri = award.record::jsonb->'badge'->>'uri' AND badge.cid = award.record::jsonb->'badge'->>'cid' LEFT JOIN LATERAL (SELECT response.uri, response.cid, response.indexed_at, response.did, response.record FROM happyview_records AS response WHERE response.collection = 'app.certified.badge.response' AND response.did = CASE WHEN jsonb_typeof(award.record::jsonb->'subject') = 'string' THEN award.record::jsonb->>'subject' WHEN jsonb_typeof(award.record::jsonb->'subject') = 'object' AND award.record::jsonb->'subject'->>'$type' = 'app.certified.defs#did' AND jsonb_typeof(award.record::jsonb->'subject'->'did') = 'string' THEN award.record::jsonb->'subject'->>'did' ELSE split_part(award.record::jsonb->'subject'->>'uri', '/', 3) END AND response.record::jsonb->'badgeAward'->>'uri' = award.uri AND response.record::jsonb->'badgeAward'->>'cid' = award.cid AND response.record::jsonb->>'response' IN ('accepted', 'rejected') ORDER BY response.indexed_at DESC NULLS LAST, response.uri DESC LIMIT 1) AS recipient_response ON TRUE WHERE award.collection = $1 AND (sorted.sort_at, award.uri) > (($2)::timestamptz, $3) ORDER BY sorted.sort_at ASC, award.uri ASC LIMIT $4"} {"sql":"6d354b8027","text":"WITH total AS (SELECT COUNT(*) AS total_count FROM happyview_records AS collection WHERE collection.collection = $1), page AS (SELECT sorted.sort_at AS sort_at, collection.uri, collection.did, collection.cid, collection.indexed_at::text AS indexed_at, collection.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS collection CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(collection.record::jsonb->'createdAt') = 'string' AND collection.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND collection.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(collection.record::jsonb->>'createdAt', 'timestamptz') THEN (collection.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(collection.indexed_at::timestamptz, collection.created_at::timestamptz) END AS sort_at) AS sorted WHERE collection.collection = $1 ORDER BY sorted.sort_at DESC, collection.uri DESC LIMIT $2) SELECT page.uri, page.did, page.cid, page.indexed_at, page.record, page.sort_timestamp, total.total_count FROM total LEFT JOIN page ON TRUE ORDER BY page.sort_at DESC, page.uri DESC"} {"sql":"6d867ad058","text":"SELECT collection.uri, collection.did, collection.cid, collection.indexed_at::text AS indexed_at, collection.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS collection CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(collection.record::jsonb->'createdAt') = 'string' AND collection.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND collection.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(collection.record::jsonb->>'createdAt', 'timestamptz') THEN (collection.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(collection.indexed_at::timestamptz, collection.created_at::timestamptz) END AS sort_at) AS sorted WHERE collection.collection = $1 AND EXISTS (SELECT 1 FROM jsonb_array_elements(CASE WHEN jsonb_typeof(collection.record::jsonb->'tags') = 'array' THEN collection.record::jsonb->'tags' ELSE '[]'::jsonb END) AS tag(value) WHERE tag.value->>'uri' = $2) AND (strpos(lower(COALESCE(collection.record::jsonb->>'title', '')), lower($3)) > 0 OR strpos(lower(COALESCE(collection.record::jsonb->>'shortDescription', '')), lower($3)) > 0) ORDER BY sorted.sort_at DESC, collection.uri DESC LIMIT $4"} @@ -147,6 +154,7 @@ {"sql":"78c6a3f3ba","text":"SELECT award.uri, award.did, award.cid, award.indexed_at::text AS indexed_at, award.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp, badge.uri AS badge_uri, badge.cid AS badge_cid, badge.indexed_at::text AS badge_indexed_at, badge.did AS badge_did, badge.record::text AS badge_record, recipient_response.uri AS recipient_response_uri, recipient_response.cid AS recipient_response_cid, recipient_response.indexed_at::text AS recipient_response_indexed_at, recipient_response.did AS recipient_response_did, recipient_response.record::text AS recipient_response_record FROM happyview_records AS award CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(award.record::jsonb->'createdAt') = 'string' AND award.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND award.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(award.record::jsonb->>'createdAt', 'timestamptz') THEN (award.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(award.indexed_at::timestamptz, award.created_at::timestamptz) END AS sort_at) sorted LEFT JOIN happyview_records AS badge ON badge.collection = 'app.certified.badge.definition' AND badge.uri = award.record::jsonb->'badge'->>'uri' AND badge.cid = award.record::jsonb->'badge'->>'cid' LEFT JOIN LATERAL (SELECT response.uri, response.cid, response.indexed_at, response.did, response.record FROM happyview_records AS response WHERE response.collection = 'app.certified.badge.response' AND response.did = CASE WHEN jsonb_typeof(award.record::jsonb->'subject') = 'string' THEN award.record::jsonb->>'subject' WHEN jsonb_typeof(award.record::jsonb->'subject') = 'object' AND award.record::jsonb->'subject'->>'$type' = 'app.certified.defs#did' AND jsonb_typeof(award.record::jsonb->'subject'->'did') = 'string' THEN award.record::jsonb->'subject'->>'did' ELSE split_part(award.record::jsonb->'subject'->>'uri', '/', 3) END AND response.record::jsonb->'badgeAward'->>'uri' = award.uri AND response.record::jsonb->'badgeAward'->>'cid' = award.cid AND response.record::jsonb->>'response' IN ('accepted', 'rejected') ORDER BY response.indexed_at DESC NULLS LAST, response.uri DESC LIMIT 1) AS recipient_response ON TRUE WHERE award.collection = $1 AND ((jsonb_typeof(award.record::jsonb->'subject') = 'string' AND award.record::jsonb->>'subject' IN ($2,$3)) OR (jsonb_typeof(award.record::jsonb->'subject') = 'object' AND award.record::jsonb->'subject'->>'$type' = 'app.certified.defs#did' AND jsonb_typeof(award.record::jsonb->'subject'->'did') = 'string' AND award.record::jsonb->'subject'->>'did' IN ($2,$3)) OR (jsonb_typeof(award.record::jsonb->'subject') = 'object' AND award.record::jsonb->'subject'->>'uri' IN ($4,$5))) ORDER BY sorted.sort_at DESC, award.uri DESC LIMIT $6"} {"sql":"78f494786e","text":"SELECT collection.uri, collection.did, collection.cid, collection.indexed_at::text AS indexed_at, collection.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS collection CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(collection.record::jsonb->'createdAt') = 'string' AND collection.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND collection.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(collection.record::jsonb->>'createdAt', 'timestamptz') THEN (collection.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(collection.indexed_at::timestamptz, collection.created_at::timestamptz) END AS sort_at) AS sorted WHERE collection.collection = $1 AND (strpos(lower(COALESCE(collection.record::jsonb->>'title', '')), lower($2)) > 0 OR strpos(lower(COALESCE(collection.record::jsonb->>'shortDescription', '')), lower($2)) > 0) ORDER BY sorted.sort_at ASC, collection.uri ASC LIMIT $3"} {"sql":"792870ea3b","text":"SELECT award.uri, award.did, award.cid, award.indexed_at::text AS indexed_at, award.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp, badge.uri AS badge_uri, badge.cid AS badge_cid, badge.indexed_at::text AS badge_indexed_at, badge.did AS badge_did, badge.record::text AS badge_record, recipient_response.uri AS recipient_response_uri, recipient_response.cid AS recipient_response_cid, recipient_response.indexed_at::text AS recipient_response_indexed_at, recipient_response.did AS recipient_response_did, recipient_response.record::text AS recipient_response_record FROM happyview_records AS award CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(award.record::jsonb->'createdAt') = 'string' AND award.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND award.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(award.record::jsonb->>'createdAt', 'timestamptz') THEN (award.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(award.indexed_at::timestamptz, award.created_at::timestamptz) END AS sort_at) sorted LEFT JOIN happyview_records AS badge ON badge.collection = 'app.certified.badge.definition' AND badge.uri = award.record::jsonb->'badge'->>'uri' AND badge.cid = award.record::jsonb->'badge'->>'cid' LEFT JOIN LATERAL (SELECT response.uri, response.cid, response.indexed_at, response.did, response.record FROM happyview_records AS response WHERE response.collection = 'app.certified.badge.response' AND response.did = CASE WHEN jsonb_typeof(award.record::jsonb->'subject') = 'string' THEN award.record::jsonb->>'subject' WHEN jsonb_typeof(award.record::jsonb->'subject') = 'object' AND award.record::jsonb->'subject'->>'$type' = 'app.certified.defs#did' AND jsonb_typeof(award.record::jsonb->'subject'->'did') = 'string' THEN award.record::jsonb->'subject'->>'did' ELSE split_part(award.record::jsonb->'subject'->>'uri', '/', 3) END AND response.record::jsonb->'badgeAward'->>'uri' = award.uri AND response.record::jsonb->'badgeAward'->>'cid' = award.cid AND response.record::jsonb->>'response' IN ('accepted', 'rejected') ORDER BY response.indexed_at DESC NULLS LAST, response.uri DESC LIMIT 1) AS recipient_response ON TRUE WHERE award.collection = $1 AND award.record::jsonb->'badge'->>'uri' IN ($2) ORDER BY sorted.sort_at DESC, award.uri DESC LIMIT $3"} +{"sql":"79b14e011b","text":"SELECT organization.uri, organization.did, organization.cid, organization.indexed_at::text AS indexed_at, organization.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS organization CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(organization.record::jsonb->'createdAt') = 'string' AND organization.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND organization.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(organization.record::jsonb->>'createdAt', 'timestamptz') THEN (organization.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(organization.indexed_at::timestamptz, organization.created_at::timestamptz) END AS sort_at) AS sorted WHERE organization.collection = $1 AND organization.rkey = 'self' AND EXISTS (SELECT 1 FROM jsonb_array_elements_text(CASE WHEN jsonb_typeof(organization.record::jsonb->'organizationType') = 'array' THEN organization.record::jsonb->'organizationType' ELSE '[]'::jsonb END) AS organization_type(value) WHERE organization_type.value IN ($2, $3)) AND (strpos(lower(COALESCE(organization.record::jsonb->>'legalName', '')), lower($4)) > 0 OR EXISTS (SELECT 1 FROM happyview_records AS profile WHERE profile.collection = $5 AND profile.did = organization.did AND profile.rkey = 'self' AND (strpos(lower(COALESCE(profile.record::jsonb->>'displayName', '')), lower($4)) > 0 OR strpos(lower(COALESCE(profile.record::jsonb->>'description', '')), lower($4)) > 0))) ORDER BY sorted.sort_at DESC, uri DESC LIMIT $6"} {"sql":"79c0ea89fc","text":"SELECT activity.uri, activity.did, activity.cid, activity.indexed_at::text AS indexed_at, activity.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS activity CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(activity.record::jsonb->'createdAt') = 'string' AND activity.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND activity.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(activity.record::jsonb->>'createdAt', 'timestamptz') THEN (activity.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(activity.indexed_at::timestamptz, activity.created_at::timestamptz) END AS sort_at) AS sorted WHERE activity.collection = $1 AND (sorted.sort_at, activity.uri) > (($2)::timestamptz, $3) ORDER BY sorted.sort_at ASC, activity.uri ASC LIMIT $4"} {"sql":"7a3a9df1b7","text":"SELECT receipt.uri, receipt.did, receipt.cid, receipt.indexed_at::text AS indexed_at, receipt.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS receipt CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(receipt.record::jsonb->'createdAt') = 'string' AND receipt.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND receipt.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(receipt.record::jsonb->>'createdAt', 'timestamptz') THEN (receipt.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(receipt.indexed_at::timestamptz, receipt.created_at::timestamptz) END AS sort_at) AS sorted WHERE receipt.collection = $1 ORDER BY sorted.sort_at DESC, receipt.uri DESC LIMIT $2"} {"sql":"7ab962c0bf","text":"SELECT collection.uri, collection.did, collection.cid, collection.indexed_at::text AS indexed_at, collection.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS collection CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(collection.record::jsonb->'createdAt') = 'string' AND collection.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND collection.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(collection.record::jsonb->>'createdAt', 'timestamptz') THEN (collection.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(collection.indexed_at::timestamptz, collection.created_at::timestamptz) END AS sort_at) AS sorted WHERE collection.collection = $1 AND EXISTS (SELECT 1 FROM jsonb_array_elements(CASE WHEN jsonb_typeof(collection.record::jsonb->'items') = 'array' THEN collection.record::jsonb->'items' ELSE '[]'::jsonb END) AS item(value) WHERE item.value->'itemIdentifier'->>'uri' IN ($2, $3, $4)) AND (strpos(lower(COALESCE(collection.record::jsonb->>'title', '')), lower($5)) > 0 OR strpos(lower(COALESCE(collection.record::jsonb->>'shortDescription', '')), lower($5)) > 0) ORDER BY sorted.sort_at DESC, collection.uri DESC LIMIT $6"} @@ -177,6 +185,7 @@ {"sql":"93d47a9512","text":"SELECT contributor.uri, contributor.did, contributor.cid, contributor.indexed_at::text AS indexed_at, contributor.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS contributor CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(contributor.record::jsonb->'createdAt') = 'string' AND contributor.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND contributor.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(contributor.record::jsonb->>'createdAt', 'timestamptz') THEN (contributor.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(contributor.indexed_at::timestamptz, contributor.created_at::timestamptz) END AS sort_at) AS sorted WHERE contributor.collection = $1 AND FALSE ORDER BY sorted.sort_at DESC, contributor.uri DESC LIMIT $2"} {"sql":"94b8231885","text":"SELECT attachment.uri, attachment.did, attachment.cid, attachment.indexed_at::text AS indexed_at, attachment.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS attachment CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(attachment.record::jsonb->'createdAt') = 'string' AND attachment.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND attachment.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(attachment.record::jsonb->>'createdAt', 'timestamptz') THEN (attachment.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(attachment.indexed_at::timestamptz, attachment.created_at::timestamptz) END AS sort_at) AS sorted WHERE attachment.collection = $1 AND attachment.record::jsonb->>'contentType' IN ($2) ORDER BY sorted.sort_at DESC, attachment.uri DESC LIMIT $3"} {"sql":"958119e969","text":"WITH ranked_reactions AS (SELECT uri, did, cid, indexed_at::text AS indexed_at, record::text AS record, sorted.sort_at, ROW_NUMBER() OVER (PARTITION BY did, record::jsonb->'subject'->>'uri' ORDER BY sorted.sort_at ASC, uri ASC) AS relationship_rank FROM happyview_records CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(record::jsonb->'createdAt') = 'string' AND record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(record::jsonb->>'createdAt', 'timestamptz') THEN (record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(indexed_at::timestamptz, created_at::timestamptz) END AS sort_at) sorted WHERE collection = $1 AND did = $2), representatives AS (SELECT uri, did, cid, indexed_at, record, sort_at FROM ranked_reactions WHERE relationship_rank = 1), page AS (SELECT uri, did, cid, indexed_at, record, sort_at FROM representatives ORDER BY sort_at DESC, uri DESC LIMIT $3) SELECT page.uri, page.did, page.cid, page.indexed_at, page.record, to_char(page.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM page ORDER BY page.sort_at DESC, page.uri DESC"} +{"sql":"9635564fbe","text":"SELECT collection.uri, collection.did, collection.cid, collection.indexed_at::text AS indexed_at, collection.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS collection CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(collection.record::jsonb->'createdAt') = 'string' AND collection.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND collection.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(collection.record::jsonb->>'createdAt', 'timestamptz') THEN (collection.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(collection.indexed_at::timestamptz, collection.created_at::timestamptz) END AS sort_at) AS sorted WHERE collection.collection = $1 AND collection.record::jsonb->>'type' IN ($2, $3) AND (strpos(lower(COALESCE(collection.record::jsonb->>'title', '')), lower($4)) > 0 OR strpos(lower(COALESCE(collection.record::jsonb->>'shortDescription', '')), lower($4)) > 0) ORDER BY sorted.sort_at DESC, collection.uri DESC LIMIT $5"} {"sql":"963e68375d","text":"SELECT rights.uri, rights.did, rights.cid, rights.indexed_at::text AS indexed_at, rights.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS rights CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(rights.record::jsonb->'createdAt') = 'string' AND rights.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND rights.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(rights.record::jsonb->>'createdAt', 'timestamptz') THEN (rights.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(rights.indexed_at::timestamptz, rights.created_at::timestamptz) END AS sort_at) AS sorted WHERE rights.collection = $1 AND rights.did IN ($2, $3, $4) ORDER BY sorted.sort_at DESC, rights.uri DESC LIMIT $5"} {"sql":"966cd6b22a","text":"SELECT activity.uri, activity.did, activity.cid, activity.indexed_at::text AS indexed_at, activity.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS activity CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(activity.record::jsonb->'createdAt') = 'string' AND activity.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND activity.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(activity.record::jsonb->>'createdAt', 'timestamptz') THEN (activity.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(activity.indexed_at::timestamptz, activity.created_at::timestamptz) END AS sort_at) AS sorted WHERE activity.collection = $1 AND (strpos(lower(COALESCE(activity.record::jsonb->>'title', '')), lower($2)) > 0 OR strpos(lower(COALESCE(activity.record::jsonb->>'shortDescription', '')), lower($2)) > 0) AND (sorted.sort_at, activity.uri) > (($3)::timestamptz, $4) ORDER BY sorted.sort_at ASC, activity.uri ASC LIMIT $5"} {"sql":"9774bdb4af","text":"SELECT receipt.uri, receipt.did, receipt.cid, receipt.indexed_at::text AS indexed_at, receipt.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS receipt CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(receipt.record::jsonb->'createdAt') = 'string' AND receipt.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND receipt.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(receipt.record::jsonb->>'createdAt', 'timestamptz') THEN (receipt.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(receipt.indexed_at::timestamptz, receipt.created_at::timestamptz) END AS sort_at) AS sorted WHERE receipt.collection = $1 AND receipt.uri IN ($2) ORDER BY sorted.sort_at DESC, receipt.uri DESC LIMIT $3"} @@ -194,6 +203,7 @@ {"sql":"a0200581e8","text":"SELECT workscope_tag.uri, workscope_tag.did, workscope_tag.cid, workscope_tag.indexed_at::text AS indexed_at, workscope_tag.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS workscope_tag CROSS JOIN LATERAL (SELECT COALESCE(CASE WHEN workscope_tag.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]+)?(Z|[+-][0-9]{2}:[0-9]{2})$' AND workscope_tag.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(workscope_tag.record::jsonb->>'createdAt', 'timestamp with time zone') THEN (workscope_tag.record::jsonb->>'createdAt')::timestamptz END, CASE WHEN pg_input_is_valid(workscope_tag.indexed_at, 'timestamp with time zone') THEN workscope_tag.indexed_at::timestamptz END, CASE WHEN pg_input_is_valid(workscope_tag.created_at, 'timestamp with time zone') THEN workscope_tag.created_at::timestamptz END) AS sort_at) AS sorted WHERE workscope_tag.collection = $1 AND workscope_tag.did IN ($2) ORDER BY sorted.sort_at DESC, workscope_tag.uri DESC LIMIT $3"} {"sql":"a03dd453be","text":"SELECT link.uri, link.did, link.cid, link.indexed_at::text AS indexed_at, link.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS link CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(link.record::jsonb->'createdAt') = 'string' AND link.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND link.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(link.record::jsonb->>'createdAt', 'timestamptz') THEN (link.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(link.indexed_at::timestamptz, link.created_at::timestamptz) END AS sort_at) sorted WHERE link.collection = $1 ORDER BY sorted.sort_at ASC, link.uri ASC LIMIT $2"} {"sql":"a2202a1f0d","text":"WITH total AS (SELECT COUNT(*) AS total_count FROM happyview_records AS activity WHERE activity.collection = $1), page AS (SELECT sorted.sort_at AS sort_at, activity.uri, activity.did, activity.cid, activity.indexed_at::text AS indexed_at, activity.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS activity CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(activity.record::jsonb->'createdAt') = 'string' AND activity.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND activity.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(activity.record::jsonb->>'createdAt', 'timestamptz') THEN (activity.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(activity.indexed_at::timestamptz, activity.created_at::timestamptz) END AS sort_at) AS sorted WHERE activity.collection = $1 ORDER BY sorted.sort_at DESC, activity.uri DESC LIMIT $2) SELECT page.uri, page.did, page.cid, page.indexed_at, page.record, page.sort_timestamp, total.total_count FROM total LEFT JOIN page ON TRUE ORDER BY page.sort_at DESC, page.uri DESC"} +{"sql":"a2aa38dba8","text":"SELECT DISTINCT ON (uri) uri, did, cid, indexed_at::text AS indexed_at, record::text AS record FROM happyview_records WHERE collection = $1 AND uri IN ($2) ORDER BY uri, COALESCE(indexed_at::timestamptz, created_at::timestamptz) DESC, cid DESC"} {"sql":"a3ed0d16fb","text":"SELECT activity.uri, activity.did, activity.cid, activity.indexed_at::text AS indexed_at, activity.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS activity CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(activity.record::jsonb->'createdAt') = 'string' AND activity.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND activity.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(activity.record::jsonb->>'createdAt', 'timestamptz') THEN (activity.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(activity.indexed_at::timestamptz, activity.created_at::timestamptz) END AS sort_at) AS sorted WHERE activity.collection = $1 AND activity.uri IN ($2, $3, $4) AND (strpos(lower(COALESCE(activity.record::jsonb->>'title', '')), lower($5)) > 0 OR strpos(lower(COALESCE(activity.record::jsonb->>'shortDescription', '')), lower($5)) > 0) ORDER BY sorted.sort_at DESC, activity.uri DESC LIMIT $6"} {"sql":"a4737487ed","text":"SELECT activity.uri, activity.did, activity.cid, activity.indexed_at::text AS indexed_at, activity.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS activity CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(activity.record::jsonb->'createdAt') = 'string' AND activity.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND activity.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(activity.record::jsonb->>'createdAt', 'timestamptz') THEN (activity.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(activity.indexed_at::timestamptz, activity.created_at::timestamptz) END AS sort_at) AS sorted WHERE activity.collection = $1 AND (activity.did IN ($2, $3, $4) OR EXISTS (SELECT 1 FROM jsonb_array_elements(CASE WHEN jsonb_typeof(activity.record::jsonb->'contributors') = 'array' THEN activity.record::jsonb->'contributors' ELSE '[]'::jsonb END) AS contributor(value) LEFT JOIN happyview_records AS ci ON ci.collection = 'org.hypercerts.claim.contributorInformation' AND ci.uri = (contributor.value->'contributorIdentity'->>'uri') AND ci.cid = (contributor.value->'contributorIdentity'->>'cid') WHERE (contributor.value->'contributorIdentity'->>'identity' IN ($5, $6, $7) OR substring(contributor.value->'contributorIdentity'->>'identity' from '^at://([^/]+)/') IN ($5, $6, $7) OR ci.record::jsonb->>'identifier' IN ($5, $6, $7) OR substring(ci.record::jsonb->>'identifier' from '^at://([^/]+)/') IN ($5, $6, $7)))) ORDER BY sorted.sort_at DESC, activity.uri DESC LIMIT $8"} {"sql":"a4a6ef4bdf","text":"SELECT uri, did, cid, indexed_at::text AS indexed_at, record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(record::jsonb->'createdAt') = 'string' AND record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(record::jsonb->>'createdAt', 'timestamptz') THEN (record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(indexed_at::timestamptz, created_at::timestamptz) END AS sort_at) sorted WHERE collection = $1 AND rkey = 'self' AND did IN ($2) AND (strpos(lower(COALESCE(record::jsonb->>'displayName', '')), lower($3)) > 0 OR strpos(lower(COALESCE(record::jsonb->>'description', '')), lower($3)) > 0) ORDER BY sorted.sort_at DESC, uri DESC LIMIT $4"} @@ -232,14 +242,17 @@ {"sql":"bb876ae83d","text":"WITH total AS (SELECT COUNT(*) AS total_count FROM happyview_records AS collection WHERE collection.collection = $1), page AS (SELECT sorted.sort_at AS sort_at, collection.uri, collection.did, collection.cid, collection.indexed_at::text AS indexed_at, collection.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS collection CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(collection.record::jsonb->'createdAt') = 'string' AND collection.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND collection.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(collection.record::jsonb->>'createdAt', 'timestamptz') THEN (collection.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(collection.indexed_at::timestamptz, collection.created_at::timestamptz) END AS sort_at) AS sorted WHERE collection.collection = $1 AND (sorted.sort_at, collection.uri) < (($2)::timestamptz, $3) ORDER BY sorted.sort_at DESC, collection.uri DESC LIMIT $4) SELECT page.uri, page.did, page.cid, page.indexed_at, page.record, page.sort_timestamp, total.total_count FROM total LEFT JOIN page ON TRUE ORDER BY page.sort_at DESC, page.uri DESC"} {"sql":"bc0b02e384","text":"SELECT activity.uri, activity.did, activity.cid, activity.indexed_at::text AS indexed_at, activity.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS activity CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(activity.record::jsonb->'createdAt') = 'string' AND activity.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND activity.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(activity.record::jsonb->>'createdAt', 'timestamptz') THEN (activity.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(activity.indexed_at::timestamptz, activity.created_at::timestamptz) END AS sort_at) AS sorted WHERE activity.collection = $1 AND (strpos(lower(COALESCE(activity.record::jsonb->>'title', '')), lower($2)) > 0 OR strpos(lower(COALESCE(activity.record::jsonb->>'shortDescription', '')), lower($2)) > 0) AND (sorted.sort_at, activity.uri) < (($3)::timestamptz, $4) ORDER BY sorted.sort_at DESC, activity.uri DESC LIMIT $5"} {"sql":"bc4dedfbb8","text":"SELECT collection.uri, collection.did, collection.cid, collection.indexed_at::text AS indexed_at, collection.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS collection CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(collection.record::jsonb->'createdAt') = 'string' AND collection.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND collection.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(collection.record::jsonb->>'createdAt', 'timestamptz') THEN (collection.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(collection.indexed_at::timestamptz, collection.created_at::timestamptz) END AS sort_at) AS sorted WHERE collection.collection = $1 AND (strpos(lower(COALESCE(collection.record::jsonb->>'title', '')), lower($2)) > 0 OR strpos(lower(COALESCE(collection.record::jsonb->>'shortDescription', '')), lower($2)) > 0) AND (sorted.sort_at, collection.uri) > (($3)::timestamptz, $4) ORDER BY sorted.sort_at ASC, collection.uri ASC LIMIT $5"} +{"sql":"be6e2712a7","text":"SELECT uri, did, cid, indexed_at::text AS indexed_at, record::text AS record FROM happyview_records WHERE collection = $1 AND uri IN ($2)"} {"sql":"bea8db93b7","text":"SELECT rights.uri, rights.did, rights.cid, rights.indexed_at::text AS indexed_at, rights.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS rights CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(rights.record::jsonb->'createdAt') = 'string' AND rights.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND rights.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(rights.record::jsonb->>'createdAt', 'timestamptz') THEN (rights.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(rights.indexed_at::timestamptz, rights.created_at::timestamptz) END AS sort_at) AS sorted WHERE rights.collection = $1 AND (sorted.sort_at, rights.uri) > (($2)::timestamptz, $3) ORDER BY sorted.sort_at ASC, rights.uri ASC LIMIT $4"} {"sql":"bec466bdba","text":"SELECT organization.uri, organization.did, organization.cid, organization.indexed_at::text AS indexed_at, organization.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS organization CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(organization.record::jsonb->'createdAt') = 'string' AND organization.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND organization.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(organization.record::jsonb->>'createdAt', 'timestamptz') THEN (organization.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(organization.indexed_at::timestamptz, organization.created_at::timestamptz) END AS sort_at) AS sorted WHERE organization.collection = $1 AND organization.rkey = 'self' AND EXISTS (SELECT 1 FROM jsonb_array_elements_text(CASE WHEN jsonb_typeof(organization.record::jsonb->'organizationType') = 'array' THEN organization.record::jsonb->'organizationType' ELSE '[]'::jsonb END) AS organization_type(value) WHERE organization_type.value IN ($2)) ORDER BY sorted.sort_at DESC, uri DESC LIMIT $3"} {"sql":"bf198ae94a","text":"SELECT uri, did, cid, indexed_at::text AS indexed_at, record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(record::jsonb->'createdAt') = 'string' AND record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(record::jsonb->>'createdAt', 'timestamptz') THEN (record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(indexed_at::timestamptz, created_at::timestamptz) END AS sort_at) sorted WHERE collection = $1 AND FALSE AND (strpos(lower(COALESCE(record::jsonb->>'title', '')), lower($2)) > 0 OR strpos(lower(COALESCE(record::jsonb->>'description', '')), lower($2)) > 0) ORDER BY sorted.sort_at DESC, uri DESC LIMIT $3"} {"sql":"bf4fe3b608","text":"SELECT response.uri, response.did, response.cid, response.indexed_at::text AS indexed_at, response.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS response CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(response.record::jsonb->'createdAt') = 'string' AND response.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND response.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(response.record::jsonb->>'createdAt', 'timestamptz') THEN (response.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(response.indexed_at::timestamptz, response.created_at::timestamptz) END AS sort_at) sorted WHERE response.collection = $1 AND (sorted.sort_at, response.uri) < (($2)::timestamptz, $3) ORDER BY sorted.sort_at DESC, response.uri DESC LIMIT $4"} {"sql":"c165186104","text":"SELECT response.uri, response.did, response.cid, response.indexed_at::text AS indexed_at, response.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS response CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(response.record::jsonb->'createdAt') = 'string' AND response.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND response.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(response.record::jsonb->>'createdAt', 'timestamptz') THEN (response.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(response.indexed_at::timestamptz, response.created_at::timestamptz) END AS sort_at) sorted WHERE response.collection = $1 ORDER BY sorted.sort_at DESC, response.uri DESC LIMIT $2"} +{"sql":"c23dcd86ca","text":"SELECT receipt.uri, receipt.did, receipt.cid, receipt.indexed_at::text AS indexed_at, receipt.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS receipt CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(receipt.record::jsonb->'createdAt') = 'string' AND receipt.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND receipt.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(receipt.record::jsonb->>'createdAt', 'timestamptz') THEN (receipt.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(receipt.indexed_at::timestamptz, receipt.created_at::timestamptz) END AS sort_at) AS sorted WHERE receipt.collection = $1 AND receipt.record::jsonb->>'transactionId' IN ($2, $3) ORDER BY sorted.sort_at DESC, receipt.uri DESC LIMIT $4"} {"sql":"c339a78b2e","text":"SELECT activity.uri, activity.did, activity.cid, activity.indexed_at::text AS indexed_at, activity.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS activity CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(activity.record::jsonb->'createdAt') = 'string' AND activity.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND activity.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(activity.record::jsonb->>'createdAt', 'timestamptz') THEN (activity.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(activity.indexed_at::timestamptz, activity.created_at::timestamptz) END AS sort_at) AS sorted WHERE activity.collection = $1 AND activity.did IN ($2, $3, $4) AND (strpos(lower(COALESCE(activity.record::jsonb->>'title', '')), lower($5)) > 0 OR strpos(lower(COALESCE(activity.record::jsonb->>'shortDescription', '')), lower($5)) > 0) ORDER BY sorted.sort_at DESC, activity.uri DESC LIMIT $6"} {"sql":"c37b75815c","text":"SELECT measurement.uri, measurement.did, measurement.cid, measurement.indexed_at::text AS indexed_at, measurement.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS measurement CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(measurement.record::jsonb->'createdAt') = 'string' AND measurement.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND measurement.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(measurement.record::jsonb->>'createdAt', 'timestamptz') THEN (measurement.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(measurement.indexed_at::timestamptz, measurement.created_at::timestamptz) END AS sort_at) AS sorted WHERE measurement.collection = $1 AND EXISTS (SELECT 1 FROM jsonb_array_elements(CASE WHEN jsonb_typeof(measurement.record::jsonb->'subjects') = 'array' THEN measurement.record::jsonb->'subjects' ELSE '[]'::jsonb END) AS subject(value) WHERE subject.value->>'uri' IN ($2)) ORDER BY sorted.sort_at DESC, measurement.uri DESC LIMIT $3"} {"sql":"c57e6b1416","text":"SELECT organization.uri, organization.did, organization.cid, organization.indexed_at::text AS indexed_at, organization.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS organization CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(organization.record::jsonb->'createdAt') = 'string' AND organization.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND organization.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(organization.record::jsonb->>'createdAt', 'timestamptz') THEN (organization.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(organization.indexed_at::timestamptz, organization.created_at::timestamptz) END AS sort_at) AS sorted WHERE organization.collection = $1 AND organization.rkey = 'self' AND organization.record::jsonb->>'visibility' = $2 AND (strpos(lower(COALESCE(organization.record::jsonb->>'legalName', '')), lower($3)) > 0 OR EXISTS (SELECT 1 FROM happyview_records AS profile WHERE profile.collection = $4 AND profile.did = organization.did AND profile.rkey = 'self' AND (strpos(lower(COALESCE(profile.record::jsonb->>'displayName', '')), lower($3)) > 0 OR strpos(lower(COALESCE(profile.record::jsonb->>'description', '')), lower($3)) > 0))) ORDER BY sorted.sort_at DESC, uri DESC LIMIT $5"} +{"sql":"c6f393b29d","text":"SELECT uri, did, cid, indexed_at::text AS indexed_at, record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(record::jsonb->'createdAt') = 'string' AND record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(record::jsonb->>'createdAt', 'timestamptz') THEN (record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(indexed_at::timestamptz, created_at::timestamptz) END AS sort_at) sorted WHERE collection = $1 AND (record::jsonb)->>'locationType' IN ($2,$3) ORDER BY sorted.sort_at DESC, uri DESC LIMIT $4"} {"sql":"c8876d3546","text":"SELECT collection.uri, collection.did, collection.cid, collection.indexed_at::text AS indexed_at, collection.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS collection CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(collection.record::jsonb->'createdAt') = 'string' AND collection.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND collection.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(collection.record::jsonb->>'createdAt', 'timestamptz') THEN (collection.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(collection.indexed_at::timestamptz, collection.created_at::timestamptz) END AS sort_at) AS sorted WHERE collection.collection = $1 AND collection.did IN ($2, $3, $4) ORDER BY sorted.sort_at DESC, collection.uri DESC LIMIT $5"} {"sql":"c93c12651c","text":"SELECT receipt.uri, receipt.did, receipt.cid, receipt.indexed_at::text AS indexed_at, receipt.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS receipt CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(receipt.record::jsonb->'createdAt') = 'string' AND receipt.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND receipt.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(receipt.record::jsonb->>'createdAt', 'timestamptz') THEN (receipt.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(receipt.indexed_at::timestamptz, receipt.created_at::timestamptz) END AS sort_at) AS sorted WHERE receipt.collection = $1 AND ((receipt.record::jsonb->'to'->>'$type' = 'app.certified.defs#did' AND receipt.record::jsonb->'to'->>'did' IN ($2)) OR (receipt.record::jsonb->'to'->>'$type' = 'com.atproto.repo.strongRef' AND receipt.record::jsonb->'to'->>'uri' IN ($3, $4))) ORDER BY sorted.sort_at DESC, receipt.uri DESC LIMIT $5"} {"sql":"c95b404fea","text":"SELECT collection.uri, collection.did, collection.cid, collection.indexed_at::text AS indexed_at, collection.record::text AS record, to_char(sorted.sort_at AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') AS sort_timestamp FROM happyview_records AS collection CROSS JOIN LATERAL (SELECT CASE WHEN jsonb_typeof(collection.record::jsonb->'createdAt') = 'string' AND collection.record::jsonb->>'createdAt' ~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$' AND collection.record::jsonb->>'createdAt' !~ '-00:00$' AND pg_input_is_valid(collection.record::jsonb->>'createdAt', 'timestamptz') THEN (collection.record::jsonb->>'createdAt')::timestamptz ELSE COALESCE(collection.indexed_at::timestamptz, collection.created_at::timestamptz) END AS sort_at) AS sorted WHERE collection.collection = $1 AND collection.record::jsonb->>'type' IN ($2, $3, $4) AND (strpos(lower(COALESCE(collection.record::jsonb->>'title', '')), lower($5)) > 0 OR strpos(lower(COALESCE(collection.record::jsonb->>'shortDescription', '')), lower($5)) > 0) ORDER BY sorted.sort_at DESC, collection.uri DESC LIMIT $6"} @@ -323,11 +336,22 @@ {"endpoint":"app.certified.actor.listOrganizations","case":"cursor:valid:asc","calls":[{"binds":["app.certified.actor.organization","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.actor.organization/self",26],"sql":"fd0f96ef32"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.listOrganizations","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.actor.organization","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.actor.organization/self",8],"sql":"fd0f96ef32"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.listOrganizations","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.actor.listOrganizations","case":"row:indexed-at-null","calls":[{"binds":["app.certified.actor.organization",26],"sql":"22e0220699"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.location","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3klocation0"],"sql":"be6e2712a7"}],"outcome":{"result":{"actors":[{"did":"did:plc:abcdefghijklmnopqrstuvwx","location":null,"organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.actor.organization","createdAt":"2025-01-01T00:00:00Z","location":{"cid":"bafylocation0","uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3klocation0"}},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.actor.organization/self"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.actor.organization","createdAt":"2025-01-01T00:00:00Z","location":{"cid":"bafylocation0","uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3klocation0"}},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.actor.organization/self"}}]}}} {"endpoint":"app.certified.actor.listOrganizations","case":"filter:organizationTypes:many","calls":[{"binds":["app.certified.actor.organization","nonprofit","company","dao",26],"sql":"74bec3e87a"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.listOrganizations","case":"filter:organizationTypes:one","calls":[{"binds":["app.certified.actor.organization","nonprofit",26],"sql":"bec466bdba"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.listOrganizations","case":"filter:organizationTypes:one-scalar","calls":[{"binds":["app.certified.actor.organization","nonprofit",26],"sql":"bec466bdba"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.listOrganizations","case":"filter:organizationTypes:duplicate","calls":[{"binds":["app.certified.actor.organization","nonprofit",26],"sql":"bec466bdba"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.listOrganizations","case":"filter:organizationTypes:empty","calls":[{"binds":["app.certified.actor.organization",26],"sql":"b895e4df3f"}],"outcome":{"result":{"actors":[]}}} +{"endpoint":"app.certified.actor.listOrganizations","case":"array:organizationTypes:100-duplicates","calls":[{"binds":["app.certified.actor.organization","nonprofit",26],"sql":"bec466bdba"}],"outcome":{"result":{"actors":[]}}} +{"endpoint":"app.certified.actor.listOrganizations","case":"array:organizationTypes:101-values","calls":[],"outcome":{"error":"InvalidRequest: organizationTypes accepts at most 100 values"}} +{"endpoint":"app.certified.actor.listOrganizations","case":"array:organizationTypes:invalid-item","calls":[{"binds":["app.certified.actor.organization","nonprofit","not a valid value",26],"sql":"3731fb2cc3"}],"outcome":{"result":{"actors":[]}}} +{"endpoint":"app.certified.actor.listOrganizations","case":"array:organizationTypes:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: organizationTypes entries must be strings"}} +{"endpoint":"app.certified.actor.listOrganizations","case":"array:organizationTypes:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each organizationTypes value must be at most 128 characters"}} +{"endpoint":"app.certified.actor.listOrganizations","case":"array:organizationTypes:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: organizationTypes entries must be strings"}} +{"endpoint":"app.certified.actor.listOrganizations","case":"array:organizationTypes:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: organizationTypes must use repeated query values"}} +{"endpoint":"app.certified.actor.listOrganizations","case":"array:organizationTypes:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: organizationTypes must use repeated query values"}} +{"endpoint":"app.certified.actor.listOrganizations","case":"array:organizationTypes:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: organizationTypes must use repeated query values"}} +{"endpoint":"app.certified.actor.listOrganizations","case":"array:organizationTypes:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: organizationTypes must use repeated query values"}} {"endpoint":"app.certified.actor.listOrganizations","case":"filter:visibility=public","calls":[{"binds":["app.certified.actor.organization","public",26],"sql":"4698c54ba8"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.listOrganizations","case":"filter:visibility=unlisted","calls":[{"binds":["app.certified.actor.organization","unlisted",26],"sql":"4698c54ba8"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.listOrganizations","case":"filter:visibility=private","calls":[{"binds":["app.certified.actor.organization","private",26],"sql":"4698c54ba8"}],"outcome":{"result":{"actors":[]}}} @@ -441,6 +465,7 @@ {"endpoint":"app.certified.actor.listProfiles","case":"cursor:valid:asc","calls":[{"binds":["app.certified.actor.profile","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.actor.profile/self",26],"sql":"536c6066fd"}],"outcome":{"result":{"profiles":[]}}} {"endpoint":"app.certified.actor.listProfiles","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.actor.profile","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.actor.profile/self",8],"sql":"536c6066fd"}],"outcome":{"result":{"profiles":[]}}} {"endpoint":"app.certified.actor.listProfiles","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.actor.listProfiles","case":"row:indexed-at-null","calls":[{"binds":["app.certified.actor.profile",26],"sql":"259d5b6011"}],"outcome":{"result":{"profiles":[{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.actor.profile","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.actor.profile/self"}]}}} {"endpoint":"app.certified.actor.listProfiles","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.actor.listProfiles","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.actor.listProfiles","case":"error:sortDirection=empty","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -550,16 +575,37 @@ {"endpoint":"app.certified.actor.searchOrganizations","case":"cursor:valid:asc","calls":[{"binds":["app.certified.actor.organization","test","app.certified.actor.profile","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.actor.organization/self",26],"sql":"aed3d6f7c0"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.searchOrganizations","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.actor.organization","test","app.certified.actor.profile","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.actor.organization/self",8],"sql":"aed3d6f7c0"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.searchOrganizations","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"row:indexed-at-null","calls":[{"binds":["app.certified.actor.organization","test","app.certified.actor.profile",26],"sql":"0af04d2949"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.location","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3klocation0"],"sql":"be6e2712a7"}],"outcome":{"result":{"actors":[{"did":"did:plc:abcdefghijklmnopqrstuvwx","location":null,"organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.actor.organization","createdAt":"2025-01-01T00:00:00Z","location":{"cid":"bafylocation0","uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3klocation0"}},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.actor.organization/self"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.actor.organization","createdAt":"2025-01-01T00:00:00Z","location":{"cid":"bafylocation0","uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3klocation0"}},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.actor.organization/self"}}]}}} {"endpoint":"app.certified.actor.searchOrganizations","case":"filter:actors:many","calls":[{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz","test","app.certified.actor.profile",26],"sql":"63e9f57c41"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.searchOrganizations","case":"filter:actors:one","calls":[{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx","test","app.certified.actor.profile",26],"sql":"51a1308039"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.searchOrganizations","case":"filter:actors:one-scalar","calls":[{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx","test","app.certified.actor.profile",26],"sql":"51a1308039"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.searchOrganizations","case":"filter:actors:duplicate","calls":[{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx","test","app.certified.actor.profile",26],"sql":"51a1308039"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.searchOrganizations","case":"filter:actors:empty","calls":[{"binds":["app.certified.actor.organization","test","app.certified.actor.profile",26],"sql":"0000751407"}],"outcome":{"result":{"actors":[]}}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:actors:100-duplicates","calls":[{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx","test","app.certified.actor.profile",26],"sql":"51a1308039"}],"outcome":{"result":{"actors":[]}}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:actors:101-values","calls":[],"outcome":{"error":"InvalidRequest: actors accepts at most 100 values"}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:actors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each actors value must be a valid DID"}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:actors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: actors entries must be strings"}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:actors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each actors value must be a valid DID"}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:actors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: actors entries must be strings"}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:actors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: actors must use repeated query values"}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:actors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: actors must use repeated query values"}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:actors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: actors must use repeated query values"}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:actors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: actors must use repeated query values"}} {"endpoint":"app.certified.actor.searchOrganizations","case":"filter:organizationTypes:many","calls":[{"binds":["app.certified.actor.organization","nonprofit","company","dao","test","app.certified.actor.profile",26],"sql":"7131766d40"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.searchOrganizations","case":"filter:organizationTypes:one","calls":[{"binds":["app.certified.actor.organization","nonprofit","test","app.certified.actor.profile",26],"sql":"ed0c344839"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.searchOrganizations","case":"filter:organizationTypes:one-scalar","calls":[{"binds":["app.certified.actor.organization","nonprofit","test","app.certified.actor.profile",26],"sql":"ed0c344839"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.searchOrganizations","case":"filter:organizationTypes:duplicate","calls":[{"binds":["app.certified.actor.organization","nonprofit","test","app.certified.actor.profile",26],"sql":"ed0c344839"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.searchOrganizations","case":"filter:organizationTypes:empty","calls":[{"binds":["app.certified.actor.organization","test","app.certified.actor.profile",26],"sql":"0000751407"}],"outcome":{"result":{"actors":[]}}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:organizationTypes:100-duplicates","calls":[{"binds":["app.certified.actor.organization","nonprofit","test","app.certified.actor.profile",26],"sql":"ed0c344839"}],"outcome":{"result":{"actors":[]}}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:organizationTypes:101-values","calls":[],"outcome":{"error":"InvalidRequest: organizationTypes accepts at most 100 values"}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:organizationTypes:invalid-item","calls":[{"binds":["app.certified.actor.organization","nonprofit","not a valid value","test","app.certified.actor.profile",26],"sql":"79b14e011b"}],"outcome":{"result":{"actors":[]}}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:organizationTypes:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: organizationTypes entries must be strings"}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:organizationTypes:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each organizationTypes value must be at most 128 characters"}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:organizationTypes:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: organizationTypes entries must be strings"}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:organizationTypes:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: organizationTypes must use repeated query values"}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:organizationTypes:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: organizationTypes must use repeated query values"}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:organizationTypes:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: organizationTypes must use repeated query values"}} +{"endpoint":"app.certified.actor.searchOrganizations","case":"array:organizationTypes:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: organizationTypes must use repeated query values"}} {"endpoint":"app.certified.actor.searchOrganizations","case":"filter:visibility=public","calls":[{"binds":["app.certified.actor.organization","public","test","app.certified.actor.profile",26],"sql":"c57e6b1416"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.searchOrganizations","case":"filter:visibility=unlisted","calls":[{"binds":["app.certified.actor.organization","unlisted","test","app.certified.actor.profile",26],"sql":"c57e6b1416"}],"outcome":{"result":{"actors":[]}}} {"endpoint":"app.certified.actor.searchOrganizations","case":"filter:visibility=private","calls":[{"binds":["app.certified.actor.organization","private","test","app.certified.actor.profile",26],"sql":"c57e6b1416"}],"outcome":{"result":{"actors":[]}}} @@ -673,11 +719,22 @@ {"endpoint":"app.certified.actor.searchProfiles","case":"cursor:valid:asc","calls":[{"binds":["app.certified.actor.profile","test","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.actor.profile/self",26],"sql":"2cd52c5f03"}],"outcome":{"result":{"profiles":[]}}} {"endpoint":"app.certified.actor.searchProfiles","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.actor.profile","test","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.actor.profile/self",8],"sql":"2cd52c5f03"}],"outcome":{"result":{"profiles":[]}}} {"endpoint":"app.certified.actor.searchProfiles","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.actor.searchProfiles","case":"row:indexed-at-null","calls":[{"binds":["app.certified.actor.profile","test",26],"sql":"238b55a03a"}],"outcome":{"result":{"profiles":[{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.actor.profile","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.actor.profile/self"}]}}} {"endpoint":"app.certified.actor.searchProfiles","case":"filter:actors:many","calls":[{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz","test",26],"sql":"921d3f3c56"}],"outcome":{"result":{"profiles":[]}}} {"endpoint":"app.certified.actor.searchProfiles","case":"filter:actors:one","calls":[{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"a4a6ef4bdf"}],"outcome":{"result":{"profiles":[]}}} {"endpoint":"app.certified.actor.searchProfiles","case":"filter:actors:one-scalar","calls":[{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"a4a6ef4bdf"}],"outcome":{"result":{"profiles":[]}}} {"endpoint":"app.certified.actor.searchProfiles","case":"filter:actors:duplicate","calls":[{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"a4a6ef4bdf"}],"outcome":{"result":{"profiles":[]}}} {"endpoint":"app.certified.actor.searchProfiles","case":"filter:actors:empty","calls":[{"binds":["app.certified.actor.profile","test",26],"sql":"d62f1fff4b"}],"outcome":{"result":{"profiles":[]}}} +{"endpoint":"app.certified.actor.searchProfiles","case":"array:actors:100-duplicates","calls":[{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"a4a6ef4bdf"}],"outcome":{"result":{"profiles":[]}}} +{"endpoint":"app.certified.actor.searchProfiles","case":"array:actors:101-values","calls":[],"outcome":{"error":"InvalidRequest: actors accepts at most 100 values"}} +{"endpoint":"app.certified.actor.searchProfiles","case":"array:actors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each actors value must be a valid DID"}} +{"endpoint":"app.certified.actor.searchProfiles","case":"array:actors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: actors entries must be strings"}} +{"endpoint":"app.certified.actor.searchProfiles","case":"array:actors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each actors value must be a valid DID"}} +{"endpoint":"app.certified.actor.searchProfiles","case":"array:actors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: actors entries must be strings"}} +{"endpoint":"app.certified.actor.searchProfiles","case":"array:actors:keyed-table","calls":[{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"a4a6ef4bdf"}],"outcome":{"result":{"profiles":[]}}} +{"endpoint":"app.certified.actor.searchProfiles","case":"array:actors:string-keyed-table","calls":[{"binds":["app.certified.actor.profile","test",26],"sql":"d62f1fff4b"}],"outcome":{"result":{"profiles":[]}}} +{"endpoint":"app.certified.actor.searchProfiles","case":"array:actors:sparse-table","calls":[{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"a4a6ef4bdf"}],"outcome":{"result":{"profiles":[]}}} +{"endpoint":"app.certified.actor.searchProfiles","case":"array:actors:sparse-table-from-2","calls":[{"binds":["app.certified.actor.profile","test",26],"sql":"d62f1fff4b"}],"outcome":{"result":{"profiles":[]}}} {"endpoint":"app.certified.actor.searchProfiles","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.actor.searchProfiles","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.actor.searchProfiles","case":"error:sortDirection=empty","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -794,6 +851,7 @@ {"endpoint":"app.certified.badge.listBadgeAwards","case":"error:includeTotal-count-fractional","calls":[{"binds":["app.certified.badge.award",26],"sql":"3dfa9c7309"}],"outcome":{"error":"BadgeAwardQueryFailed: badge award count unavailable"}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"error:includeTotal-count-unsafe","calls":[{"binds":["app.certified.badge.award",26],"sql":"3dfa9c7309"}],"outcome":{"result":{"badgeAwards":[],"totalCount":9007199254740992}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"error:includeTotal-count-invalid","calls":[{"binds":["app.certified.badge.award",26],"sql":"3dfa9c7309"}],"outcome":{"error":"BadgeAwardQueryFailed: badge award count unavailable"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"row:indexed-at-null","calls":[{"binds":["app.certified.badge.award",26],"sql":"eb4293ef0a"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"badgeAwards":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.badge.award","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.award/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.badge.award","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.award/3kabcdefghija"}},"badge":null,"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"recipientResponse":null,"record":{"$type":"app.certified.badge.award","createdAt":"2025-01-01T00:00:00Z"},"responseStatus":"unanswered","uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.award/3kabcdefghija"}]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"error:includeTotal-invalid","calls":[],"outcome":{"error":"InvalidRequest: includeTotal must be true or false"}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"error:includeTotal-repeated","calls":[],"outcome":{"error":"InvalidRequest: includeTotal must occur once"}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:authors:many","calls":[{"binds":["app.certified.badge.award","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"b64d798d72"}],"outcome":{"result":{"badgeAwards":[]}}} @@ -801,27 +859,77 @@ {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:authors:one-scalar","calls":[{"binds":["app.certified.badge.award","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"03c5ffce2b"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:authors:duplicate","calls":[{"binds":["app.certified.badge.award","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"03c5ffce2b"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:authors:empty","calls":[{"binds":["app.certified.badge.award",26],"sql":"b54d166028"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:authors:100-duplicates","calls":[{"binds":["app.certified.badge.award","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"03c5ffce2b"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be valid DIDs"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be valid DIDs"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:authors:keyed-table","calls":[{"binds":["app.certified.badge.award","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"03c5ffce2b"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:authors:string-keyed-table","calls":[{"binds":["app.certified.badge.award",26],"sql":"b54d166028"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:authors:sparse-table","calls":[{"binds":["app.certified.badge.award","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"03c5ffce2b"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:authors:sparse-table-from-2","calls":[{"binds":["app.certified.badge.award",26],"sql":"b54d166028"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:badgeUris:many","calls":[{"binds":["app.certified.badge.award","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghijc",26],"sql":"dd9ca50998"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:badgeUris:one","calls":[{"binds":["app.certified.badge.award","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghija",26],"sql":"792870ea3b"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:badgeUris:one-scalar","calls":[{"binds":["app.certified.badge.award","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghija",26],"sql":"792870ea3b"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:badgeUris:duplicate","calls":[{"binds":["app.certified.badge.award","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghija",26],"sql":"792870ea3b"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:badgeUris:empty","calls":[{"binds":["app.certified.badge.award",26],"sql":"b54d166028"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeUris:100-duplicates","calls":[{"binds":["app.certified.badge.award","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghija",26],"sql":"792870ea3b"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeUris:101-values","calls":[],"outcome":{"error":"InvalidRequest: badgeUris accepts at most 100 values"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeUris:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each badgeUris value must be badge-definition AT-URIs"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeUris:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: badgeUris entries must be strings"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeUris:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each badgeUris value must be badge-definition AT-URIs"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeUris:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: badgeUris entries must be strings"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeUris:keyed-table","calls":[{"binds":["app.certified.badge.award","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghija",26],"sql":"792870ea3b"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeUris:string-keyed-table","calls":[{"binds":["app.certified.badge.award",26],"sql":"b54d166028"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeUris:sparse-table","calls":[{"binds":["app.certified.badge.award","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghija",26],"sql":"792870ea3b"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeUris:sparse-table-from-2","calls":[{"binds":["app.certified.badge.award",26],"sql":"b54d166028"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:badgeTypes:many","calls":[{"binds":["app.certified.badge.award","volunteer","contributor","steward",26],"sql":"de8e448a07"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:badgeTypes:one","calls":[{"binds":["app.certified.badge.award","volunteer",26],"sql":"49f2ff18af"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:badgeTypes:one-scalar","calls":[{"binds":["app.certified.badge.award","volunteer",26],"sql":"49f2ff18af"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:badgeTypes:duplicate","calls":[{"binds":["app.certified.badge.award","volunteer",26],"sql":"49f2ff18af"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:badgeTypes:empty","calls":[{"binds":["app.certified.badge.award",26],"sql":"b54d166028"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeTypes:100-duplicates","calls":[{"binds":["app.certified.badge.award","volunteer",26],"sql":"49f2ff18af"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeTypes:101-values","calls":[],"outcome":{"error":"InvalidRequest: badgeTypes accepts at most 100 values"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeTypes:invalid-item","calls":[{"binds":["app.certified.badge.award","volunteer","not a valid value",26],"sql":"1ccbf162ea"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeTypes:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: badgeTypes entries must be strings"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeTypes:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: badgeTypes entries must be at most 100 UTF-8 bytes"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeTypes:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: badgeTypes entries must be strings"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeTypes:keyed-table","calls":[{"binds":["app.certified.badge.award","volunteer",26],"sql":"49f2ff18af"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeTypes:string-keyed-table","calls":[{"binds":["app.certified.badge.award",26],"sql":"b54d166028"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeTypes:sparse-table","calls":[{"binds":["app.certified.badge.award","volunteer",26],"sql":"49f2ff18af"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:badgeTypes:sparse-table-from-2","calls":[{"binds":["app.certified.badge.award",26],"sql":"b54d166028"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:subjects:many","calls":[{"binds":["app.certified.badge.award","did:plc:abcdefghijklmnopqrstuvwy","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijc",26],"sql":"ec5769b06c"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:subjects:one","calls":[{"binds":["app.certified.badge.award","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"07a40fe161"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:subjects:one-scalar","calls":[{"binds":["app.certified.badge.award","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"07a40fe161"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:subjects:duplicate","calls":[{"binds":["app.certified.badge.award","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"07a40fe161"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:subjects:empty","calls":[{"binds":["app.certified.badge.award",26],"sql":"b54d166028"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:subjects:mixed-many","calls":[{"binds":["app.certified.badge.award","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb",26],"sql":"78c6a3f3ba"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:subjects:100-duplicates","calls":[{"binds":["app.certified.badge.award","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"07a40fe161"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:subjects:101-values","calls":[],"outcome":{"error":"InvalidRequest: subjects accepts at most 100 values"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:subjects:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: subjects[2] must be a valid DID or full record AT-URI with a valid collection NSID"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:subjects:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: subjects[2] must be a valid DID or full record AT-URI"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:subjects:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: subjects[2] must be a valid DID or full record AT-URI with a valid collection NSID"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:subjects:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: subjects[2] must be a valid DID or full record AT-URI"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:subjects:keyed-table","calls":[{"binds":["app.certified.badge.award","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"07a40fe161"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:subjects:string-keyed-table","calls":[{"binds":["app.certified.badge.award",26],"sql":"b54d166028"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:subjects:sparse-table","calls":[{"binds":["app.certified.badge.award","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"07a40fe161"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:subjects:sparse-table-from-2","calls":[{"binds":["app.certified.badge.award",26],"sql":"b54d166028"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:responses:many","calls":[{"binds":["app.certified.badge.award","accepted","rejected","unanswered",26],"sql":"36e6f96de2"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:responses:one","calls":[{"binds":["app.certified.badge.award","accepted",26],"sql":"fac78ac0ee"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:responses:one-scalar","calls":[{"binds":["app.certified.badge.award","accepted",26],"sql":"fac78ac0ee"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:responses:duplicate","calls":[{"binds":["app.certified.badge.award","accepted",26],"sql":"fac78ac0ee"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:responses:empty","calls":[{"binds":["app.certified.badge.award",26],"sql":"b54d166028"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:responses:100-duplicates","calls":[{"binds":["app.certified.badge.award","accepted",26],"sql":"fac78ac0ee"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:responses:101-values","calls":[],"outcome":{"error":"InvalidRequest: responses accepts at most 100 values"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:responses:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each responses value must be accepted, rejected, or unanswered statuses"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:responses:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: responses entries must be strings"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:responses:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each responses value must be accepted, rejected, or unanswered statuses"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:responses:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: responses entries must be strings"}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:responses:keyed-table","calls":[{"binds":["app.certified.badge.award","accepted",26],"sql":"fac78ac0ee"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:responses:string-keyed-table","calls":[{"binds":["app.certified.badge.award",26],"sql":"b54d166028"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:responses:sparse-table","calls":[{"binds":["app.certified.badge.award","accepted",26],"sql":"fac78ac0ee"}],"outcome":{"result":{"badgeAwards":[]}}} +{"endpoint":"app.certified.badge.listBadgeAwards","case":"array:responses:sparse-table-from-2","calls":[{"binds":["app.certified.badge.award",26],"sql":"b54d166028"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:includeTotal=boolean:true","calls":[{"binds":["app.certified.badge.award",26],"sql":"3dfa9c7309"}],"outcome":{"result":{"badgeAwards":[],"totalCount":0}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:includeTotal=boolean:false","calls":[{"binds":["app.certified.badge.award",26],"sql":"eb4293ef0a"}],"outcome":{"result":{"badgeAwards":[]}}} {"endpoint":"app.certified.badge.listBadgeAwards","case":"filter:includeTotal=string:true","calls":[{"binds":["app.certified.badge.award",26],"sql":"3dfa9c7309"}],"outcome":{"result":{"badgeAwards":[],"totalCount":0}}} @@ -935,16 +1043,37 @@ {"endpoint":"app.certified.badge.listBadgeDefinitions","case":"cursor:valid:asc","calls":[{"binds":["app.certified.badge.definition","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghijk",26],"sql":"f415ca0b71"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.listBadgeDefinitions","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.badge.definition","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghijk",8],"sql":"f415ca0b71"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.listBadgeDefinitions","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"row:indexed-at-null","calls":[{"binds":["app.certified.badge.definition",26],"sql":"fdd374e87e"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"badgeDefinitions":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.badge.definition","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.badge.definition","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.badge.definition","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghija"}]}}} {"endpoint":"app.certified.badge.listBadgeDefinitions","case":"filter:authors:many","calls":[{"binds":["app.certified.badge.definition","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"056193581d"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.listBadgeDefinitions","case":"filter:authors:one","calls":[{"binds":["app.certified.badge.definition","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"cf715d2ab7"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.listBadgeDefinitions","case":"filter:authors:one-scalar","calls":[{"binds":["app.certified.badge.definition","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"cf715d2ab7"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.listBadgeDefinitions","case":"filter:authors:duplicate","calls":[{"binds":["app.certified.badge.definition","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"cf715d2ab7"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.listBadgeDefinitions","case":"filter:authors:empty","calls":[{"binds":["app.certified.badge.definition",26],"sql":"089df365a0"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:authors:100-duplicates","calls":[{"binds":["app.certified.badge.definition","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"cf715d2ab7"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be valid DIDs"}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be valid DIDs"}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:authors:keyed-table","calls":[{"binds":["app.certified.badge.definition","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"cf715d2ab7"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:authors:string-keyed-table","calls":[{"binds":["app.certified.badge.definition",26],"sql":"089df365a0"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:authors:sparse-table","calls":[{"binds":["app.certified.badge.definition","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"cf715d2ab7"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:authors:sparse-table-from-2","calls":[{"binds":["app.certified.badge.definition",26],"sql":"089df365a0"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.listBadgeDefinitions","case":"filter:badgeTypes:many","calls":[{"binds":["app.certified.badge.definition","volunteer","contributor","steward",26],"sql":"55bc2f4a15"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.listBadgeDefinitions","case":"filter:badgeTypes:one","calls":[{"binds":["app.certified.badge.definition","volunteer",26],"sql":"887630231f"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.listBadgeDefinitions","case":"filter:badgeTypes:one-scalar","calls":[{"binds":["app.certified.badge.definition","volunteer",26],"sql":"887630231f"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.listBadgeDefinitions","case":"filter:badgeTypes:duplicate","calls":[{"binds":["app.certified.badge.definition","volunteer",26],"sql":"887630231f"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.listBadgeDefinitions","case":"filter:badgeTypes:empty","calls":[{"binds":["app.certified.badge.definition",26],"sql":"089df365a0"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:badgeTypes:100-duplicates","calls":[{"binds":["app.certified.badge.definition","volunteer",26],"sql":"887630231f"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:badgeTypes:101-values","calls":[],"outcome":{"error":"InvalidRequest: badgeTypes accepts at most 100 values"}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:badgeTypes:invalid-item","calls":[{"binds":["app.certified.badge.definition","volunteer","not a valid value",26],"sql":"5a1dffb2b2"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:badgeTypes:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: badgeTypes entries must be strings"}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:badgeTypes:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: badgeTypes entries must be at most 100 UTF-8 bytes"}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:badgeTypes:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: badgeTypes entries must be strings"}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:badgeTypes:keyed-table","calls":[{"binds":["app.certified.badge.definition","volunteer",26],"sql":"887630231f"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:badgeTypes:string-keyed-table","calls":[{"binds":["app.certified.badge.definition",26],"sql":"089df365a0"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:badgeTypes:sparse-table","calls":[{"binds":["app.certified.badge.definition","volunteer",26],"sql":"887630231f"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.listBadgeDefinitions","case":"array:badgeTypes:sparse-table-from-2","calls":[{"binds":["app.certified.badge.definition",26],"sql":"089df365a0"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.listBadgeDefinitions","case":"filter:all","calls":[{"binds":["app.certified.badge.definition","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","contributor","steward",26],"sql":"39e951d2e6"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.listBadgeDefinitions","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.badge.listBadgeDefinitions","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -1054,6 +1183,7 @@ {"endpoint":"app.certified.badge.listBadgeResponses","case":"cursor:valid:asc","calls":[{"binds":["app.certified.badge.response","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.response/3kabcdefghijk",26],"sql":"22bccf85c3"}],"outcome":{"result":{"badgeResponses":[]}}} {"endpoint":"app.certified.badge.listBadgeResponses","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.badge.response","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.response/3kabcdefghijk",8],"sql":"22bccf85c3"}],"outcome":{"result":{"badgeResponses":[]}}} {"endpoint":"app.certified.badge.listBadgeResponses","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.badge.listBadgeResponses","case":"row:indexed-at-null","calls":[{"binds":["app.certified.badge.response",26],"sql":"c165186104"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"badgeResponses":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.badge.response","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.response/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.badge.response","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.response/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.badge.response","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.response/3kabcdefghija"}]}}} {"endpoint":"app.certified.badge.listBadgeResponses","case":"filter:badgeAward=at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.award/3kabcdefghija","calls":[{"binds":["app.certified.badge.response","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.award/3kabcdefghija",26],"sql":"dd9a4311b1"}],"outcome":{"result":{"badgeResponses":[]}}} {"endpoint":"app.certified.badge.listBadgeResponses","case":"filter:badgeAward=at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.award/3kabcdefghijb","calls":[{"binds":["app.certified.badge.response","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.award/3kabcdefghijb",26],"sql":"dd9a4311b1"}],"outcome":{"result":{"badgeResponses":[]}}} {"endpoint":"app.certified.badge.listBadgeResponses","case":"filter:badgeAward=at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.award/3kabcdefghijc","calls":[{"binds":["app.certified.badge.response","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.award/3kabcdefghijc",26],"sql":"dd9a4311b1"}],"outcome":{"result":{"badgeResponses":[]}}} @@ -1165,16 +1295,37 @@ {"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"cursor:valid:asc","calls":[{"binds":["app.certified.badge.definition","test","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghijk",26],"sql":"2bb21188b6"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.badge.definition","test","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghijk",8],"sql":"2bb21188b6"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"row:indexed-at-null","calls":[{"binds":["app.certified.badge.definition","test",26],"sql":"4ce821995f"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"badgeDefinitions":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.badge.definition","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.badge.definition","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.badge.definition","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.badge.definition/3kabcdefghija"}]}}} {"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"filter:authors:many","calls":[{"binds":["app.certified.badge.definition","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz","test",26],"sql":"e956f87416"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"filter:authors:one","calls":[{"binds":["app.certified.badge.definition","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"7705bb084a"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"filter:authors:one-scalar","calls":[{"binds":["app.certified.badge.definition","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"7705bb084a"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"filter:authors:duplicate","calls":[{"binds":["app.certified.badge.definition","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"7705bb084a"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"filter:authors:empty","calls":[{"binds":["app.certified.badge.definition","test",26],"sql":"bf198ae94a"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:authors:100-duplicates","calls":[{"binds":["app.certified.badge.definition","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"7705bb084a"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be valid DIDs"}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be valid DIDs"}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:authors:keyed-table","calls":[{"binds":["app.certified.badge.definition","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"7705bb084a"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:authors:string-keyed-table","calls":[{"binds":["app.certified.badge.definition","test",26],"sql":"bf198ae94a"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:authors:sparse-table","calls":[{"binds":["app.certified.badge.definition","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"7705bb084a"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:authors:sparse-table-from-2","calls":[{"binds":["app.certified.badge.definition","test",26],"sql":"bf198ae94a"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"filter:badgeTypes:many","calls":[{"binds":["app.certified.badge.definition","volunteer","contributor","steward","test",26],"sql":"04e237168d"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"filter:badgeTypes:one","calls":[{"binds":["app.certified.badge.definition","volunteer","test",26],"sql":"f144453bcf"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"filter:badgeTypes:one-scalar","calls":[{"binds":["app.certified.badge.definition","volunteer","test",26],"sql":"f144453bcf"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"filter:badgeTypes:duplicate","calls":[{"binds":["app.certified.badge.definition","volunteer","test",26],"sql":"f144453bcf"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"filter:badgeTypes:empty","calls":[{"binds":["app.certified.badge.definition","test",26],"sql":"bf198ae94a"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:badgeTypes:100-duplicates","calls":[{"binds":["app.certified.badge.definition","volunteer","test",26],"sql":"f144453bcf"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:badgeTypes:101-values","calls":[],"outcome":{"error":"InvalidRequest: badgeTypes accepts at most 100 values"}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:badgeTypes:invalid-item","calls":[{"binds":["app.certified.badge.definition","volunteer","not a valid value","test",26],"sql":"6430698e9f"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:badgeTypes:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: badgeTypes entries must be strings"}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:badgeTypes:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: badgeTypes entries must be at most 100 UTF-8 bytes"}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:badgeTypes:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: badgeTypes entries must be strings"}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:badgeTypes:keyed-table","calls":[{"binds":["app.certified.badge.definition","volunteer","test",26],"sql":"f144453bcf"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:badgeTypes:string-keyed-table","calls":[{"binds":["app.certified.badge.definition","test",26],"sql":"bf198ae94a"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:badgeTypes:sparse-table","calls":[{"binds":["app.certified.badge.definition","volunteer","test",26],"sql":"f144453bcf"}],"outcome":{"result":{"badgeDefinitions":[]}}} +{"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"array:badgeTypes:sparse-table-from-2","calls":[{"binds":["app.certified.badge.definition","test",26],"sql":"bf198ae94a"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"filter:all","calls":[{"binds":["app.certified.badge.definition","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","contributor","steward","test",26],"sql":"8e6d1e6347"}],"outcome":{"result":{"badgeDefinitions":[]}}} {"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.badge.searchBadgeDefinitions","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -1285,6 +1436,7 @@ {"endpoint":"app.certified.feed.getActorLikes","case":"cursor:valid:asc","calls":[{"binds":["app.certified.feed.like","did:plc:abcdefghijklmnopqrstuvwx","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.feed.like/3kabcdefghijk",26],"sql":"060c0aac20"}],"outcome":{"result":{"likes":[]}}} {"endpoint":"app.certified.feed.getActorLikes","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.feed.like","did:plc:abcdefghijklmnopqrstuvwx","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.feed.like/3kabcdefghijk",8],"sql":"060c0aac20"}],"outcome":{"result":{"likes":[]}}} {"endpoint":"app.certified.feed.getActorLikes","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.feed.getActorLikes","case":"row:indexed-at-null","calls":[{"binds":["app.certified.feed.like","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"958119e969"}],"outcome":{"result":{"likes":[{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.feed.like","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.feed.like/3kabcdefghija"}]}}} {"endpoint":"app.certified.feed.getActorLikes","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.feed.getActorLikes","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.feed.getActorLikes","case":"error:sortDirection=empty","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -1393,6 +1545,7 @@ {"endpoint":"app.certified.feed.getActorReposts","case":"cursor:valid:asc","calls":[{"binds":["app.certified.feed.repost","did:plc:abcdefghijklmnopqrstuvwx","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.feed.repost/3kabcdefghijk",26],"sql":"060c0aac20"}],"outcome":{"result":{"reposts":[]}}} {"endpoint":"app.certified.feed.getActorReposts","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.feed.repost","did:plc:abcdefghijklmnopqrstuvwx","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.feed.repost/3kabcdefghijk",8],"sql":"060c0aac20"}],"outcome":{"result":{"reposts":[]}}} {"endpoint":"app.certified.feed.getActorReposts","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.feed.getActorReposts","case":"row:indexed-at-null","calls":[{"binds":["app.certified.feed.repost","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"958119e969"}],"outcome":{"result":{"reposts":[{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.feed.repost","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.feed.repost/3kabcdefghija"}]}}} {"endpoint":"app.certified.feed.getActorReposts","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.feed.getActorReposts","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.feed.getActorReposts","case":"error:sortDirection=empty","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -1501,6 +1654,7 @@ {"endpoint":"app.certified.feed.getLikes","case":"cursor:valid:asc","calls":[{"binds":["app.certified.feed.like","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.feed.like/3kabcdefghijk",26],"sql":"9d26dac464"}],"outcome":{"result":{"likeCount":0,"likes":[]}}} {"endpoint":"app.certified.feed.getLikes","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.feed.like","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.feed.like/3kabcdefghijk",8],"sql":"9d26dac464"}],"outcome":{"result":{"likeCount":0,"likes":[]}}} {"endpoint":"app.certified.feed.getLikes","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.feed.getLikes","case":"row:indexed-at-null","calls":[{"binds":["app.certified.feed.like","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk",26],"sql":"235652cf2d"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"likeCount":12,"likes":[{"did":"did:plc:abcdefghijklmnopqrstuvwx","like":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.feed.like","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.feed.like/3kabcdefghija"},"organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.feed.like","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.feed.like/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.feed.like","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.feed.like/3kabcdefghija"}}]}}} {"endpoint":"app.certified.feed.getLikes","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.feed.getLikes","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.feed.getLikes","case":"error:sortDirection=empty","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -1609,6 +1763,7 @@ {"endpoint":"app.certified.feed.getReposts","case":"cursor:valid:asc","calls":[{"binds":["app.certified.feed.repost","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.feed.repost/3kabcdefghijk",26],"sql":"9d26dac464"}],"outcome":{"result":{"repostCount":0,"reposts":[]}}} {"endpoint":"app.certified.feed.getReposts","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.feed.repost","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.feed.repost/3kabcdefghijk",8],"sql":"9d26dac464"}],"outcome":{"result":{"repostCount":0,"reposts":[]}}} {"endpoint":"app.certified.feed.getReposts","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.feed.getReposts","case":"row:indexed-at-null","calls":[{"binds":["app.certified.feed.repost","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk",26],"sql":"235652cf2d"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"repostCount":12,"reposts":[{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.feed.repost","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.feed.repost/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.feed.repost","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.feed.repost/3kabcdefghija"},"repost":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.feed.repost","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.feed.repost/3kabcdefghija"}}]}}} {"endpoint":"app.certified.feed.getReposts","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.feed.getReposts","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.feed.getReposts","case":"error:sortDirection=empty","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -1717,6 +1872,7 @@ {"endpoint":"app.certified.graph.listActorFollowers","case":"cursor:valid:asc","calls":[{"binds":["app.certified.graph.follow","did:plc:abcdefghijklmnopqrstuvwx","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.follow/3kabcdefghijk",26],"sql":"81d1f27eb3"}],"outcome":{"result":{"followers":[],"totalCount":0}}} {"endpoint":"app.certified.graph.listActorFollowers","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.graph.follow","did:plc:abcdefghijklmnopqrstuvwx","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.follow/3kabcdefghijk",8],"sql":"81d1f27eb3"}],"outcome":{"result":{"followers":[],"totalCount":0}}} {"endpoint":"app.certified.graph.listActorFollowers","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.graph.listActorFollowers","case":"row:indexed-at-null","calls":[{"binds":["app.certified.graph.follow","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"107d3663f6"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"followers":[{"did":"did:plc:abcdefghijklmnopqrstuvwx","follow":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.graph.follow","createdAt":"2025-01-01T00:00:00Z","subject":"did:plc:abcdefghijklmnopqrstuvwx"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.follow/3kabcdefghija"},"organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.graph.follow","createdAt":"2025-01-01T00:00:00Z","subject":"did:plc:abcdefghijklmnopqrstuvwx"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.follow/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.graph.follow","createdAt":"2025-01-01T00:00:00Z","subject":"did:plc:abcdefghijklmnopqrstuvwx"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.follow/3kabcdefghija"}}],"totalCount":12}}} {"endpoint":"app.certified.graph.listActorFollowers","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.graph.listActorFollowers","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.graph.listActorFollowers","case":"error:sortDirection=empty","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -1825,6 +1981,7 @@ {"endpoint":"app.certified.graph.listActorFollowing","case":"cursor:valid:asc","calls":[{"binds":["app.certified.graph.follow","did:plc:abcdefghijklmnopqrstuvwx","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.follow/3kabcdefghijk",26],"sql":"ceeb1a63af"}],"outcome":{"result":{"following":[],"totalCount":0}}} {"endpoint":"app.certified.graph.listActorFollowing","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.graph.follow","did:plc:abcdefghijklmnopqrstuvwx","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.follow/3kabcdefghijk",8],"sql":"ceeb1a63af"}],"outcome":{"result":{"following":[],"totalCount":0}}} {"endpoint":"app.certified.graph.listActorFollowing","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.graph.listActorFollowing","case":"row:indexed-at-null","calls":[{"binds":["app.certified.graph.follow","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"f3857e8ed7"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"following":[{"did":"did:plc:abcdefghijklmnopqrstuvwx","follow":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.graph.follow","createdAt":"2025-01-01T00:00:00Z","subject":"did:plc:abcdefghijklmnopqrstuvwx"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.follow/3kabcdefghija"},"organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.graph.follow","createdAt":"2025-01-01T00:00:00Z","subject":"did:plc:abcdefghijklmnopqrstuvwx"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.follow/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.graph.follow","createdAt":"2025-01-01T00:00:00Z","subject":"did:plc:abcdefghijklmnopqrstuvwx"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.follow/3kabcdefghija"}}],"totalCount":12}}} {"endpoint":"app.certified.graph.listActorFollowing","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.graph.listActorFollowing","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.graph.listActorFollowing","case":"error:sortDirection=empty","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -1933,6 +2090,7 @@ {"endpoint":"app.certified.graph.listEntityFollowers","case":"cursor:valid:asc","calls":[{"binds":["app.certified.graph.entityFollow","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.entityFollow/3kabcdefghijk",26],"sql":"ca6fa49a9a"}],"outcome":{"result":{"followers":[],"totalCount":0}}} {"endpoint":"app.certified.graph.listEntityFollowers","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.graph.entityFollow","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.entityFollow/3kabcdefghijk",8],"sql":"ca6fa49a9a"}],"outcome":{"result":{"followers":[],"totalCount":0}}} {"endpoint":"app.certified.graph.listEntityFollowers","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.graph.listEntityFollowers","case":"row:indexed-at-null","calls":[{"binds":["app.certified.graph.entityFollow","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk",26],"sql":"dc37a02dda"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"followers":[{"$type":"app.certified.graph.listEntityFollowers#entityFollowerView","did":"did:plc:abcdefghijklmnopqrstuvwx","follow":{"$type":"app.certified.graph.getEntityFollow#entityFollowRecordView","cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.graph.entityFollow","createdAt":"2025-01-01T00:00:00Z","subject":{"cid":"bafyactivity0","uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk"}},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.entityFollow/3kabcdefghija"},"organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.graph.entityFollow","createdAt":"2025-01-01T00:00:00Z","subject":{"cid":"bafyactivity0","uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk"}},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.entityFollow/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.graph.entityFollow","createdAt":"2025-01-01T00:00:00Z","subject":{"cid":"bafyactivity0","uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk"}},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.entityFollow/3kabcdefghija"}}],"totalCount":12}}} {"endpoint":"app.certified.graph.listEntityFollowers","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.graph.listEntityFollowers","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.graph.listEntityFollowers","case":"error:sortDirection=empty","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -2041,6 +2199,7 @@ {"endpoint":"app.certified.graph.listEntityFollowing","case":"cursor:valid:asc","calls":[{"binds":["app.certified.graph.entityFollow","did:plc:abcdefghijklmnopqrstuvwx","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.entityFollow/3kabcdefghijk",27],"sql":"935a7082cc"}],"outcome":{"result":{"entities":[]}}} {"endpoint":"app.certified.graph.listEntityFollowing","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.graph.entityFollow","did:plc:abcdefghijklmnopqrstuvwx","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.entityFollow/3kabcdefghijk",9],"sql":"935a7082cc"}],"outcome":{"result":{"entities":[]}}} {"endpoint":"app.certified.graph.listEntityFollowing","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.graph.listEntityFollowing","case":"row:indexed-at-null","calls":[{"binds":["app.certified.graph.entityFollow","did:plc:abcdefghijklmnopqrstuvwx",27],"sql":"47811ad6f2"},{"binds":["org.hypercerts.claim.activity","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk"],"sql":"a2aa38dba8"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"entities":[{"$type":"app.certified.graph.listEntityFollowing#entityFollowingItem","entity":null,"follow":{"$type":"app.certified.graph.getEntityFollow#entityFollowRecordView","cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.graph.entityFollow","createdAt":"2025-01-01T00:00:00Z","subject":{"cid":"bafyactivity0","uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk"}},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.entityFollow/3kabcdefghija"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk"}]}}} {"endpoint":"app.certified.graph.listEntityFollowing","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.graph.listEntityFollowing","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.graph.listEntityFollowing","case":"error:sortDirection=empty","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -2143,6 +2302,7 @@ {"endpoint":"app.certified.graph.listRecentFollows","case":"cursor:valid:default","calls":[{"binds":["app.certified.graph.follow","app.certified.graph.entityFollow","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.entityFollow/3kabcdefghijk",26],"sql":"a97172131c"}],"outcome":{"result":{"follows":[]}}} {"endpoint":"app.certified.graph.listRecentFollows","case":"cursor:valid+limit=7:default","calls":[{"binds":["app.certified.graph.follow","app.certified.graph.entityFollow","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.entityFollow/3kabcdefghijk",8],"sql":"a97172131c"}],"outcome":{"result":{"follows":[]}}} {"endpoint":"app.certified.graph.listRecentFollows","case":"year0000:cursor:default","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed or belongs to another before value"}} +{"endpoint":"app.certified.graph.listRecentFollows","case":"row:indexed-at-null","calls":[{"binds":["app.certified.graph.follow","app.certified.graph.entityFollow",26],"sql":"04564cc9e7"}],"outcome":{"result":{"follows":[{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.graph.entityFollow","createdAt":"2025-01-01T00:00:00Z","subject":{"cid":"bafyactivity0","uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk"}},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.graph.entityFollow/3kabcdefghija"}]}}} {"endpoint":"app.certified.graph.listRecentFollows","case":"filter:before=2025-06-01T00:00:00Z","calls":[{"binds":["app.certified.graph.follow","app.certified.graph.entityFollow","2025-06-01T00:00:00Z",26],"sql":"b1eb0cc1f8"}],"outcome":{"result":{"follows":[]}}} {"endpoint":"app.certified.graph.listRecentFollows","case":"filter:before=2025-06-01T00:00:00Z","calls":[{"binds":["app.certified.graph.follow","app.certified.graph.entityFollow","2025-06-01T00:00:00Z",26],"sql":"b1eb0cc1f8"}],"outcome":{"result":{"follows":[]}}} {"endpoint":"app.certified.graph.listRecentFollows","case":"filter:before=2025-06-01T00:00:00Z","calls":[{"binds":["app.certified.graph.follow","app.certified.graph.entityFollow","2025-06-01T00:00:00Z",26],"sql":"b1eb0cc1f8"}],"outcome":{"result":{"follows":[]}}} @@ -2249,16 +2409,37 @@ {"endpoint":"app.certified.link.listEvmLinks","case":"cursor:valid:asc","calls":[{"binds":["app.certified.link.evm","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.link.evm/3kabcdefghijk",26],"sql":"deb4345aab"}],"outcome":{"result":{"evmLinks":[]}}} {"endpoint":"app.certified.link.listEvmLinks","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.link.evm","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.link.evm/3kabcdefghijk",8],"sql":"deb4345aab"}],"outcome":{"result":{"evmLinks":[]}}} {"endpoint":"app.certified.link.listEvmLinks","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.link.listEvmLinks","case":"row:indexed-at-null","calls":[{"binds":["app.certified.link.evm",26],"sql":"7054b0a493"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"evmLinks":[{"actor":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.link.evm","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.link.evm/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.link.evm","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.link.evm/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.link.evm","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.link.evm/3kabcdefghija"}]}}} {"endpoint":"app.certified.link.listEvmLinks","case":"filter:actors:many","calls":[{"binds":["app.certified.link.evm","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"cf034f3460"}],"outcome":{"result":{"evmLinks":[]}}} {"endpoint":"app.certified.link.listEvmLinks","case":"filter:actors:one","calls":[{"binds":["app.certified.link.evm","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"269699e131"}],"outcome":{"result":{"evmLinks":[]}}} {"endpoint":"app.certified.link.listEvmLinks","case":"filter:actors:one-scalar","calls":[{"binds":["app.certified.link.evm","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"269699e131"}],"outcome":{"result":{"evmLinks":[]}}} {"endpoint":"app.certified.link.listEvmLinks","case":"filter:actors:duplicate","calls":[{"binds":["app.certified.link.evm","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"269699e131"}],"outcome":{"result":{"evmLinks":[]}}} {"endpoint":"app.certified.link.listEvmLinks","case":"filter:actors:empty","calls":[{"binds":["app.certified.link.evm",26],"sql":"1d0659e810"}],"outcome":{"result":{"evmLinks":[]}}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:actors:100-duplicates","calls":[{"binds":["app.certified.link.evm","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"269699e131"}],"outcome":{"result":{"evmLinks":[]}}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:actors:101-values","calls":[],"outcome":{"error":"InvalidRequest: actors accepts at most 100 values"}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:actors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: actors[2] must be valid DIDs"}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:actors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: actors entries must be strings"}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:actors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: actors[2] must be valid DIDs"}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:actors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: actors entries must be strings"}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:actors:keyed-table","calls":[{"binds":["app.certified.link.evm","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"269699e131"}],"outcome":{"result":{"evmLinks":[]}}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:actors:string-keyed-table","calls":[{"binds":["app.certified.link.evm",26],"sql":"1d0659e810"}],"outcome":{"result":{"evmLinks":[]}}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:actors:sparse-table","calls":[{"binds":["app.certified.link.evm","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"269699e131"}],"outcome":{"result":{"evmLinks":[]}}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:actors:sparse-table-from-2","calls":[{"binds":["app.certified.link.evm",26],"sql":"1d0659e810"}],"outcome":{"result":{"evmLinks":[]}}} {"endpoint":"app.certified.link.listEvmLinks","case":"filter:addresses:many","calls":[{"binds":["app.certified.link.evm","0x1111111111111111111111111111111111111111","0x2222222222222222222222222222222222222222","0x3333333333333333333333333333333333333333",26],"sql":"7f03b386ae"}],"outcome":{"result":{"evmLinks":[]}}} {"endpoint":"app.certified.link.listEvmLinks","case":"filter:addresses:one","calls":[{"binds":["app.certified.link.evm","0x1111111111111111111111111111111111111111",26],"sql":"99c5929723"}],"outcome":{"result":{"evmLinks":[]}}} {"endpoint":"app.certified.link.listEvmLinks","case":"filter:addresses:one-scalar","calls":[{"binds":["app.certified.link.evm","0x1111111111111111111111111111111111111111",26],"sql":"99c5929723"}],"outcome":{"result":{"evmLinks":[]}}} {"endpoint":"app.certified.link.listEvmLinks","case":"filter:addresses:duplicate","calls":[{"binds":["app.certified.link.evm","0x1111111111111111111111111111111111111111",26],"sql":"99c5929723"}],"outcome":{"result":{"evmLinks":[]}}} {"endpoint":"app.certified.link.listEvmLinks","case":"filter:addresses:empty","calls":[{"binds":["app.certified.link.evm",26],"sql":"1d0659e810"}],"outcome":{"result":{"evmLinks":[]}}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:addresses:100-duplicates","calls":[{"binds":["app.certified.link.evm","0x1111111111111111111111111111111111111111",26],"sql":"99c5929723"}],"outcome":{"result":{"evmLinks":[]}}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:addresses:101-values","calls":[],"outcome":{"error":"InvalidRequest: addresses accepts at most 100 values"}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:addresses:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: addresses[2] must be a 0x-prefixed 40-digit hexadecimal EVM address"}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:addresses:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: addresses entries must be strings"}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:addresses:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: addresses[2] must be a 0x-prefixed 40-digit hexadecimal EVM address"}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:addresses:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: addresses entries must be strings"}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:addresses:keyed-table","calls":[{"binds":["app.certified.link.evm","0x1111111111111111111111111111111111111111",26],"sql":"99c5929723"}],"outcome":{"result":{"evmLinks":[]}}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:addresses:string-keyed-table","calls":[{"binds":["app.certified.link.evm",26],"sql":"1d0659e810"}],"outcome":{"result":{"evmLinks":[]}}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:addresses:sparse-table","calls":[{"binds":["app.certified.link.evm","0x1111111111111111111111111111111111111111",26],"sql":"99c5929723"}],"outcome":{"result":{"evmLinks":[]}}} +{"endpoint":"app.certified.link.listEvmLinks","case":"array:addresses:sparse-table-from-2","calls":[{"binds":["app.certified.link.evm",26],"sql":"1d0659e810"}],"outcome":{"result":{"evmLinks":[]}}} {"endpoint":"app.certified.link.listEvmLinks","case":"filter:all","calls":[{"binds":["app.certified.link.evm","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","0x2222222222222222222222222222222222222222","0x3333333333333333333333333333333333333333",26],"sql":"c9e349830f"}],"outcome":{"result":{"evmLinks":[]}}} {"endpoint":"app.certified.link.listEvmLinks","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.link.listEvmLinks","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -2368,21 +2549,52 @@ {"endpoint":"app.certified.location.listLocations","case":"cursor:valid:asc","calls":[{"binds":["app.certified.location","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3kabcdefghijk",26],"sql":"f415ca0b71"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"cursor:valid+limit=7:asc","calls":[{"binds":["app.certified.location","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3kabcdefghijk",8],"sql":"f415ca0b71"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"app.certified.location.listLocations","case":"row:indexed-at-null","calls":[{"binds":["app.certified.location",26],"sql":"fdd374e87e"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"locations":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.location","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.location","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"app.certified.location","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3kabcdefghija"}]}}} {"endpoint":"app.certified.location.listLocations","case":"filter:authors:many","calls":[{"binds":["app.certified.location","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"056193581d"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"filter:authors:one","calls":[{"binds":["app.certified.location","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"cf715d2ab7"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"filter:authors:one-scalar","calls":[{"binds":["app.certified.location","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"cf715d2ab7"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"filter:authors:duplicate","calls":[{"binds":["app.certified.location","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"cf715d2ab7"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"filter:authors:empty","calls":[{"binds":["app.certified.location",26],"sql":"089df365a0"}],"outcome":{"result":{"locations":[]}}} +{"endpoint":"app.certified.location.listLocations","case":"array:authors:100-duplicates","calls":[{"binds":["app.certified.location","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"cf715d2ab7"}],"outcome":{"result":{"locations":[]}}} +{"endpoint":"app.certified.location.listLocations","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"app.certified.location.listLocations","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be valid DIDs"}} +{"endpoint":"app.certified.location.listLocations","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"app.certified.location.listLocations","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be valid DIDs"}} +{"endpoint":"app.certified.location.listLocations","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"app.certified.location.listLocations","case":"array:authors:keyed-table","calls":[{"binds":["app.certified.location","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"cf715d2ab7"}],"outcome":{"result":{"locations":[]}}} +{"endpoint":"app.certified.location.listLocations","case":"array:authors:string-keyed-table","calls":[{"binds":["app.certified.location",26],"sql":"089df365a0"}],"outcome":{"result":{"locations":[]}}} +{"endpoint":"app.certified.location.listLocations","case":"array:authors:sparse-table","calls":[{"binds":["app.certified.location","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"cf715d2ab7"}],"outcome":{"result":{"locations":[]}}} +{"endpoint":"app.certified.location.listLocations","case":"array:authors:sparse-table-from-2","calls":[{"binds":["app.certified.location",26],"sql":"089df365a0"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"filter:uris:many","calls":[{"binds":["app.certified.location","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3kabcdefghijc",26],"sql":"ca16d794fb"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"filter:uris:one","calls":[{"binds":["app.certified.location","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3kabcdefghija",26],"sql":"8d97cb081a"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"filter:uris:one-scalar","calls":[{"binds":["app.certified.location","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3kabcdefghija",26],"sql":"8d97cb081a"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"filter:uris:duplicate","calls":[{"binds":["app.certified.location","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3kabcdefghija",26],"sql":"8d97cb081a"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"filter:uris:empty","calls":[{"binds":["app.certified.location",26],"sql":"089df365a0"}],"outcome":{"result":{"locations":[]}}} +{"endpoint":"app.certified.location.listLocations","case":"array:uris:100-duplicates","calls":[{"binds":["app.certified.location","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3kabcdefghija",26],"sql":"8d97cb081a"}],"outcome":{"result":{"locations":[]}}} +{"endpoint":"app.certified.location.listLocations","case":"array:uris:101-values","calls":[],"outcome":{"error":"InvalidRequest: uris accepts at most 100 values"}} +{"endpoint":"app.certified.location.listLocations","case":"array:uris:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each uris value must be full app.certified.location AT-URIs with DID authorities"}} +{"endpoint":"app.certified.location.listLocations","case":"array:uris:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: uris entries must be strings"}} +{"endpoint":"app.certified.location.listLocations","case":"array:uris:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each uris value must be full app.certified.location AT-URIs with DID authorities"}} +{"endpoint":"app.certified.location.listLocations","case":"array:uris:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: uris entries must be strings"}} +{"endpoint":"app.certified.location.listLocations","case":"array:uris:keyed-table","calls":[{"binds":["app.certified.location","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3kabcdefghija",26],"sql":"8d97cb081a"}],"outcome":{"result":{"locations":[]}}} +{"endpoint":"app.certified.location.listLocations","case":"array:uris:string-keyed-table","calls":[{"binds":["app.certified.location",26],"sql":"089df365a0"}],"outcome":{"result":{"locations":[]}}} +{"endpoint":"app.certified.location.listLocations","case":"array:uris:sparse-table","calls":[{"binds":["app.certified.location","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3kabcdefghija",26],"sql":"8d97cb081a"}],"outcome":{"result":{"locations":[]}}} +{"endpoint":"app.certified.location.listLocations","case":"array:uris:sparse-table-from-2","calls":[{"binds":["app.certified.location",26],"sql":"089df365a0"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"filter:locationTypes:many","calls":[{"binds":["app.certified.location","coordinate-decimal","geojson","address",26],"sql":"03715b3085"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"filter:locationTypes:one","calls":[{"binds":["app.certified.location","coordinate-decimal",26],"sql":"bb7a1812ec"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"filter:locationTypes:one-scalar","calls":[{"binds":["app.certified.location","coordinate-decimal",26],"sql":"bb7a1812ec"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"filter:locationTypes:duplicate","calls":[{"binds":["app.certified.location","coordinate-decimal",26],"sql":"bb7a1812ec"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"filter:locationTypes:empty","calls":[{"binds":["app.certified.location",26],"sql":"089df365a0"}],"outcome":{"result":{"locations":[]}}} +{"endpoint":"app.certified.location.listLocations","case":"array:locationTypes:100-duplicates","calls":[{"binds":["app.certified.location","coordinate-decimal",26],"sql":"bb7a1812ec"}],"outcome":{"result":{"locations":[]}}} +{"endpoint":"app.certified.location.listLocations","case":"array:locationTypes:101-values","calls":[],"outcome":{"error":"InvalidRequest: locationTypes accepts at most 100 values"}} +{"endpoint":"app.certified.location.listLocations","case":"array:locationTypes:invalid-item","calls":[{"binds":["app.certified.location","coordinate-decimal","not a valid value",26],"sql":"c6f393b29d"}],"outcome":{"result":{"locations":[]}}} +{"endpoint":"app.certified.location.listLocations","case":"array:locationTypes:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: locationTypes entries must be strings"}} +{"endpoint":"app.certified.location.listLocations","case":"array:locationTypes:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: locationTypes entries must be at most 20 UTF-8 bytes"}} +{"endpoint":"app.certified.location.listLocations","case":"array:locationTypes:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: locationTypes entries must be strings"}} +{"endpoint":"app.certified.location.listLocations","case":"array:locationTypes:keyed-table","calls":[{"binds":["app.certified.location","coordinate-decimal",26],"sql":"bb7a1812ec"}],"outcome":{"result":{"locations":[]}}} +{"endpoint":"app.certified.location.listLocations","case":"array:locationTypes:string-keyed-table","calls":[{"binds":["app.certified.location",26],"sql":"089df365a0"}],"outcome":{"result":{"locations":[]}}} +{"endpoint":"app.certified.location.listLocations","case":"array:locationTypes:sparse-table","calls":[{"binds":["app.certified.location","coordinate-decimal",26],"sql":"bb7a1812ec"}],"outcome":{"result":{"locations":[]}}} +{"endpoint":"app.certified.location.listLocations","case":"array:locationTypes:sparse-table-from-2","calls":[{"binds":["app.certified.location",26],"sql":"089df365a0"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"filter:all","calls":[{"binds":["app.certified.location","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/app.certified.location/3kabcdefghijc","coordinate-decimal","geojson",26],"sql":"39d1ecf7da"}],"outcome":{"result":{"locations":[]}}} {"endpoint":"app.certified.location.listLocations","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"app.certified.location.listLocations","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -2499,6 +2711,7 @@ {"endpoint":"org.hypercerts.claim.listActivities","case":"error:includeTotal-count-fractional","calls":[{"binds":["org.hypercerts.claim.activity",26],"sql":"a2202a1f0d"}],"outcome":{"error":"ActivityQueryFailed: activity count unavailable"}} {"endpoint":"org.hypercerts.claim.listActivities","case":"error:includeTotal-count-unsafe","calls":[{"binds":["org.hypercerts.claim.activity",26],"sql":"a2202a1f0d"}],"outcome":{"error":"ActivityQueryFailed: activity count unavailable"}} {"endpoint":"org.hypercerts.claim.listActivities","case":"error:includeTotal-count-invalid","calls":[{"binds":["org.hypercerts.claim.activity",26],"sql":"a2202a1f0d"}],"outcome":{"error":"ActivityQueryFailed: activity count unavailable"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"row:indexed-at-null","calls":[{"binds":["org.hypercerts.claim.activity",26],"sql":"d1229757a9"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"activities":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","record":{"$type":"org.hypercerts.claim.activity","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","record":{"$type":"org.hypercerts.claim.activity","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.claim.activity","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija"}]}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"error:includeTotal-invalid","calls":[],"outcome":{"error":"InvalidRequest: includeTotal must be true or false"}} {"endpoint":"org.hypercerts.claim.listActivities","case":"error:includeTotal-repeated","calls":[],"outcome":{"error":"InvalidRequest: includeTotal must occur once"}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:authors:many","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"3d578b7933"}],"outcome":{"result":{"activities":[]}}} @@ -2506,6 +2719,16 @@ {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:authors:one-scalar","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"80efd5c186"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:authors:duplicate","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"80efd5c186"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:authors:empty","calls":[{"binds":["org.hypercerts.claim.activity",26],"sql":"cea068549c"}],"outcome":{"result":{"activities":[]}}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:authors:100-duplicates","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"80efd5c186"}],"outcome":{"result":{"activities":[]}}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:authors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:authors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:authors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:authors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:hasOrganizationRecord=boolean:true","calls":[{"binds":["org.hypercerts.claim.activity",26],"sql":"8476426abd"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:hasOrganizationRecord=boolean:false","calls":[{"binds":["org.hypercerts.claim.activity",26],"sql":"9f1015cbbe"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:hasOrganizationRecord=string:true","calls":[{"binds":["org.hypercerts.claim.activity",26],"sql":"8476426abd"}],"outcome":{"result":{"activities":[]}}} @@ -2515,16 +2738,46 @@ {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:contributors:one-scalar","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"17c8e5bc72"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:contributors:duplicate","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"17c8e5bc72"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:contributors:empty","calls":[{"binds":["org.hypercerts.claim.activity",26],"sql":"cea068549c"}],"outcome":{"result":{"activities":[]}}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:contributors:100-duplicates","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"17c8e5bc72"}],"outcome":{"result":{"activities":[]}}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:contributors:101-values","calls":[],"outcome":{"error":"InvalidRequest: contributors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:contributors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each contributors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:contributors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: contributors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:contributors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each contributors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:contributors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: contributors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:contributors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: contributors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:contributors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: contributors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:contributors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: contributors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:contributors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: contributors must use repeated query values"}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:involvedActors:many","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"a4737487ed"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:involvedActors:one","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"eb2ff4e9da"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:involvedActors:one-scalar","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"eb2ff4e9da"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:involvedActors:duplicate","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"eb2ff4e9da"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:involvedActors:empty","calls":[{"binds":["org.hypercerts.claim.activity",26],"sql":"cea068549c"}],"outcome":{"result":{"activities":[]}}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:involvedActors:100-duplicates","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"eb2ff4e9da"}],"outcome":{"result":{"activities":[]}}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:involvedActors:101-values","calls":[],"outcome":{"error":"InvalidRequest: involvedActors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:involvedActors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each involvedActors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:involvedActors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: involvedActors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:involvedActors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each involvedActors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:involvedActors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: involvedActors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:involvedActors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: involvedActors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:involvedActors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: involvedActors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:involvedActors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: involvedActors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:involvedActors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: involvedActors must use repeated query values"}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:uris:many","calls":[{"binds":["org.hypercerts.claim.activity","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijc",26],"sql":"b69127d8e5"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:uris:one","calls":[{"binds":["org.hypercerts.claim.activity","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"a924fe0ac0"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:uris:one-scalar","calls":[{"binds":["org.hypercerts.claim.activity","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"a924fe0ac0"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:uris:duplicate","calls":[{"binds":["org.hypercerts.claim.activity","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"a924fe0ac0"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:uris:empty","calls":[{"binds":["org.hypercerts.claim.activity",26],"sql":"cea068549c"}],"outcome":{"result":{"activities":[]}}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:uris:100-duplicates","calls":[{"binds":["org.hypercerts.claim.activity","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"a924fe0ac0"}],"outcome":{"result":{"activities":[]}}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:uris:101-values","calls":[],"outcome":{"error":"InvalidRequest: uris accepts at most 100 values"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:uris:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each uris value must be a full org.hypercerts.claim.activity AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:uris:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: uris entries must be strings"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:uris:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each uris value must be a full org.hypercerts.claim.activity AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:uris:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: uris entries must be strings"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:uris:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:uris:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:uris:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listActivities","case":"array:uris:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:includeTotal=boolean:true","calls":[{"binds":["org.hypercerts.claim.activity",26],"sql":"a2202a1f0d"}],"outcome":{"result":{"activities":[],"totalCount":0}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:includeTotal=boolean:false","calls":[{"binds":["org.hypercerts.claim.activity",26],"sql":"d1229757a9"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.listActivities","case":"filter:includeTotal=string:true","calls":[{"binds":["org.hypercerts.claim.activity",26],"sql":"a2202a1f0d"}],"outcome":{"result":{"activities":[],"totalCount":0}}} @@ -2638,11 +2891,22 @@ {"endpoint":"org.hypercerts.claim.listContributions","case":"cursor:valid:asc","calls":[{"binds":["org.hypercerts.claim.contribution","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.contribution/3kabcdefghijk",26],"sql":"ea7b9d6728"}],"outcome":{"result":{"contributions":[]}}} {"endpoint":"org.hypercerts.claim.listContributions","case":"cursor:valid+limit=7:asc","calls":[{"binds":["org.hypercerts.claim.contribution","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.contribution/3kabcdefghijk",8],"sql":"ea7b9d6728"}],"outcome":{"result":{"contributions":[]}}} {"endpoint":"org.hypercerts.claim.listContributions","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"org.hypercerts.claim.listContributions","case":"row:indexed-at-null","calls":[{"binds":["org.hypercerts.claim.contribution",26],"sql":"6a0e1152da"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"contributions":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.claim.contribution","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.contribution/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.claim.contribution","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.contribution/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.claim.contribution","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.contribution/3kabcdefghija"}]}}} {"endpoint":"org.hypercerts.claim.listContributions","case":"filter:authors:many","calls":[{"binds":["org.hypercerts.claim.contribution","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"f56f61aad1"}],"outcome":{"result":{"contributions":[]}}} {"endpoint":"org.hypercerts.claim.listContributions","case":"filter:authors:one","calls":[{"binds":["org.hypercerts.claim.contribution","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"5c2951cb59"}],"outcome":{"result":{"contributions":[]}}} {"endpoint":"org.hypercerts.claim.listContributions","case":"filter:authors:one-scalar","calls":[{"binds":["org.hypercerts.claim.contribution","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"5c2951cb59"}],"outcome":{"result":{"contributions":[]}}} {"endpoint":"org.hypercerts.claim.listContributions","case":"filter:authors:duplicate","calls":[{"binds":["org.hypercerts.claim.contribution","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"5c2951cb59"}],"outcome":{"result":{"contributions":[]}}} {"endpoint":"org.hypercerts.claim.listContributions","case":"filter:authors:empty","calls":[{"binds":["org.hypercerts.claim.contribution",26],"sql":"6f939d06b4"}],"outcome":{"result":{"contributions":[]}}} +{"endpoint":"org.hypercerts.claim.listContributions","case":"array:authors:100-duplicates","calls":[{"binds":["org.hypercerts.claim.contribution","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"5c2951cb59"}],"outcome":{"result":{"contributions":[]}}} +{"endpoint":"org.hypercerts.claim.listContributions","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.claim.listContributions","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.claim.listContributions","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.listContributions","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.claim.listContributions","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.listContributions","case":"array:authors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listContributions","case":"array:authors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listContributions","case":"array:authors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listContributions","case":"array:authors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} {"endpoint":"org.hypercerts.claim.listContributions","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.claim.listContributions","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.claim.listContributions","case":"error:sortDirection=empty","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -2751,11 +3015,22 @@ {"endpoint":"org.hypercerts.claim.listContributorInformation","case":"cursor:valid:asc","calls":[{"binds":["org.hypercerts.claim.contributorInformation","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.contributorInformation/3kabcdefghijk",26],"sql":"0026cd53dc"}],"outcome":{"result":{"contributorInformation":[]}}} {"endpoint":"org.hypercerts.claim.listContributorInformation","case":"cursor:valid+limit=7:asc","calls":[{"binds":["org.hypercerts.claim.contributorInformation","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.contributorInformation/3kabcdefghijk",8],"sql":"0026cd53dc"}],"outcome":{"result":{"contributorInformation":[]}}} {"endpoint":"org.hypercerts.claim.listContributorInformation","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"org.hypercerts.claim.listContributorInformation","case":"row:indexed-at-null","calls":[{"binds":["org.hypercerts.claim.contributorInformation",26],"sql":"988c9b344e"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"contributorInformation":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.claim.contributorInformation","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.contributorInformation/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.claim.contributorInformation","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.contributorInformation/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.claim.contributorInformation","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.contributorInformation/3kabcdefghija"}]}}} {"endpoint":"org.hypercerts.claim.listContributorInformation","case":"filter:authors:many","calls":[{"binds":["org.hypercerts.claim.contributorInformation","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"e6d269af8e"}],"outcome":{"result":{"contributorInformation":[]}}} {"endpoint":"org.hypercerts.claim.listContributorInformation","case":"filter:authors:one","calls":[{"binds":["org.hypercerts.claim.contributorInformation","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"75c0e1f2f8"}],"outcome":{"result":{"contributorInformation":[]}}} {"endpoint":"org.hypercerts.claim.listContributorInformation","case":"filter:authors:one-scalar","calls":[{"binds":["org.hypercerts.claim.contributorInformation","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"75c0e1f2f8"}],"outcome":{"result":{"contributorInformation":[]}}} {"endpoint":"org.hypercerts.claim.listContributorInformation","case":"filter:authors:duplicate","calls":[{"binds":["org.hypercerts.claim.contributorInformation","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"75c0e1f2f8"}],"outcome":{"result":{"contributorInformation":[]}}} {"endpoint":"org.hypercerts.claim.listContributorInformation","case":"filter:authors:empty","calls":[{"binds":["org.hypercerts.claim.contributorInformation",26],"sql":"93d47a9512"}],"outcome":{"result":{"contributorInformation":[]}}} +{"endpoint":"org.hypercerts.claim.listContributorInformation","case":"array:authors:100-duplicates","calls":[{"binds":["org.hypercerts.claim.contributorInformation","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"75c0e1f2f8"}],"outcome":{"result":{"contributorInformation":[]}}} +{"endpoint":"org.hypercerts.claim.listContributorInformation","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.claim.listContributorInformation","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be valid DIDs; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.claim.listContributorInformation","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.listContributorInformation","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be valid DIDs; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.claim.listContributorInformation","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.listContributorInformation","case":"array:authors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listContributorInformation","case":"array:authors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listContributorInformation","case":"array:authors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listContributorInformation","case":"array:authors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} {"endpoint":"org.hypercerts.claim.listContributorInformation","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.claim.listContributorInformation","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.claim.listContributorInformation","case":"error:sortDirection=empty","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -2864,11 +3139,22 @@ {"endpoint":"org.hypercerts.claim.listRights","case":"cursor:valid:asc","calls":[{"binds":["org.hypercerts.claim.rights","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.rights/3kabcdefghijk",26],"sql":"bea8db93b7"}],"outcome":{"result":{"rights":[]}}} {"endpoint":"org.hypercerts.claim.listRights","case":"cursor:valid+limit=7:asc","calls":[{"binds":["org.hypercerts.claim.rights","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.rights/3kabcdefghijk",8],"sql":"bea8db93b7"}],"outcome":{"result":{"rights":[]}}} {"endpoint":"org.hypercerts.claim.listRights","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"org.hypercerts.claim.listRights","case":"row:indexed-at-null","calls":[{"binds":["org.hypercerts.claim.rights",26],"sql":"deb35c0d37"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"rights":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.claim.rights","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.rights/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.claim.rights","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.rights/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.claim.rights","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.rights/3kabcdefghija"}]}}} {"endpoint":"org.hypercerts.claim.listRights","case":"filter:authors:many","calls":[{"binds":["org.hypercerts.claim.rights","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"963e68375d"}],"outcome":{"result":{"rights":[]}}} {"endpoint":"org.hypercerts.claim.listRights","case":"filter:authors:one","calls":[{"binds":["org.hypercerts.claim.rights","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"09d6d1b616"}],"outcome":{"result":{"rights":[]}}} {"endpoint":"org.hypercerts.claim.listRights","case":"filter:authors:one-scalar","calls":[{"binds":["org.hypercerts.claim.rights","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"09d6d1b616"}],"outcome":{"result":{"rights":[]}}} {"endpoint":"org.hypercerts.claim.listRights","case":"filter:authors:duplicate","calls":[{"binds":["org.hypercerts.claim.rights","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"09d6d1b616"}],"outcome":{"result":{"rights":[]}}} {"endpoint":"org.hypercerts.claim.listRights","case":"filter:authors:empty","calls":[{"binds":["org.hypercerts.claim.rights",26],"sql":"81914bd684"}],"outcome":{"result":{"rights":[]}}} +{"endpoint":"org.hypercerts.claim.listRights","case":"array:authors:100-duplicates","calls":[{"binds":["org.hypercerts.claim.rights","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"09d6d1b616"}],"outcome":{"result":{"rights":[]}}} +{"endpoint":"org.hypercerts.claim.listRights","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.claim.listRights","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID"}} +{"endpoint":"org.hypercerts.claim.listRights","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.listRights","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID"}} +{"endpoint":"org.hypercerts.claim.listRights","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.listRights","case":"array:authors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listRights","case":"array:authors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listRights","case":"array:authors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.listRights","case":"array:authors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} {"endpoint":"org.hypercerts.claim.listRights","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.claim.listRights","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.claim.listRights","case":"error:sortDirection=empty","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -2978,11 +3264,22 @@ {"endpoint":"org.hypercerts.claim.searchActivities","case":"cursor:valid+limit=7:asc","calls":[{"binds":["org.hypercerts.claim.activity","test","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijk",8],"sql":"966cd6b22a"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"error:includeTotal-on-search","calls":[],"outcome":{"error":"InvalidRequest: unknown query parameter: includeTotal"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"row:indexed-at-null","calls":[{"binds":["org.hypercerts.claim.activity","test",26],"sql":"69fc88161b"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"activities":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","record":{"$type":"org.hypercerts.claim.activity","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","record":{"$type":"org.hypercerts.claim.activity","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.claim.activity","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija"}]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:authors:many","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz","test",26],"sql":"c339a78b2e"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:authors:one","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"d384922db1"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:authors:one-scalar","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"d384922db1"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:authors:duplicate","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"d384922db1"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:authors:empty","calls":[{"binds":["org.hypercerts.claim.activity","test",26],"sql":"a899f0d903"}],"outcome":{"result":{"activities":[]}}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:authors:100-duplicates","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"d384922db1"}],"outcome":{"result":{"activities":[]}}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:authors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:authors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:authors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:authors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:hasOrganizationRecord=boolean:true","calls":[{"binds":["org.hypercerts.claim.activity","test",26],"sql":"a629886768"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:hasOrganizationRecord=boolean:false","calls":[{"binds":["org.hypercerts.claim.activity","test",26],"sql":"439aaf85ad"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:hasOrganizationRecord=string:true","calls":[{"binds":["org.hypercerts.claim.activity","test",26],"sql":"a629886768"}],"outcome":{"result":{"activities":[]}}} @@ -2992,16 +3289,46 @@ {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:contributors:one-scalar","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"2a35c20591"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:contributors:duplicate","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"2a35c20591"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:contributors:empty","calls":[{"binds":["org.hypercerts.claim.activity","test",26],"sql":"a899f0d903"}],"outcome":{"result":{"activities":[]}}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:contributors:100-duplicates","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"2a35c20591"}],"outcome":{"result":{"activities":[]}}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:contributors:101-values","calls":[],"outcome":{"error":"InvalidRequest: contributors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:contributors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each contributors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:contributors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: contributors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:contributors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each contributors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:contributors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: contributors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:contributors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: contributors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:contributors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: contributors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:contributors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: contributors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:contributors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: contributors must use repeated query values"}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:involvedActors:many","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz","test",26],"sql":"e4fff6086b"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:involvedActors:one","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"8c5185f17d"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:involvedActors:one-scalar","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"8c5185f17d"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:involvedActors:duplicate","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"8c5185f17d"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:involvedActors:empty","calls":[{"binds":["org.hypercerts.claim.activity","test",26],"sql":"a899f0d903"}],"outcome":{"result":{"activities":[]}}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:involvedActors:100-duplicates","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"8c5185f17d"}],"outcome":{"result":{"activities":[]}}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:involvedActors:101-values","calls":[],"outcome":{"error":"InvalidRequest: involvedActors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:involvedActors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each involvedActors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:involvedActors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: involvedActors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:involvedActors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each involvedActors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:involvedActors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: involvedActors entries must be strings"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:involvedActors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: involvedActors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:involvedActors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: involvedActors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:involvedActors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: involvedActors must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:involvedActors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: involvedActors must use repeated query values"}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:uris:many","calls":[{"binds":["org.hypercerts.claim.activity","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijc","test",26],"sql":"a3ed0d16fb"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:uris:one","calls":[{"binds":["org.hypercerts.claim.activity","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","test",26],"sql":"8ba107c973"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:uris:one-scalar","calls":[{"binds":["org.hypercerts.claim.activity","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","test",26],"sql":"8ba107c973"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:uris:duplicate","calls":[{"binds":["org.hypercerts.claim.activity","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","test",26],"sql":"8ba107c973"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:uris:empty","calls":[{"binds":["org.hypercerts.claim.activity","test",26],"sql":"a899f0d903"}],"outcome":{"result":{"activities":[]}}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:uris:100-duplicates","calls":[{"binds":["org.hypercerts.claim.activity","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","test",26],"sql":"8ba107c973"}],"outcome":{"result":{"activities":[]}}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:uris:101-values","calls":[],"outcome":{"error":"InvalidRequest: uris accepts at most 100 values"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:uris:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each uris value must be a full org.hypercerts.claim.activity AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:uris:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: uris entries must be strings"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:uris:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each uris value must be a full org.hypercerts.claim.activity AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:uris:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: uris entries must be strings"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:uris:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:uris:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:uris:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.claim.searchActivities","case":"array:uris:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"filter:all","calls":[{"binds":["org.hypercerts.claim.activity","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb","test",26],"sql":"b16ebab61c"}],"outcome":{"result":{"activities":[]}}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.claim.searchActivities","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -3155,6 +3482,7 @@ {"endpoint":"org.hypercerts.collection.listCollections","case":"error:includeTotal-count-fractional","calls":[{"binds":["org.hypercerts.collection",26],"sql":"6d354b8027"}],"outcome":{"error":"CollectionQueryFailed: collection count unavailable"}} {"endpoint":"org.hypercerts.collection.listCollections","case":"error:includeTotal-count-unsafe","calls":[{"binds":["org.hypercerts.collection",26],"sql":"6d354b8027"}],"outcome":{"error":"CollectionQueryFailed: collection count unavailable"}} {"endpoint":"org.hypercerts.collection.listCollections","case":"error:includeTotal-count-invalid","calls":[{"binds":["org.hypercerts.collection",26],"sql":"6d354b8027"}],"outcome":{"error":"CollectionQueryFailed: collection count unavailable"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"row:indexed-at-null","calls":[{"binds":["org.hypercerts.collection",26],"sql":"3f156e9653"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"collections":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.collection","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.collection","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.collection","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghija"}]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"error:includeTotal-invalid","calls":[],"outcome":{"error":"InvalidRequest: includeTotal must be true or false"}} {"endpoint":"org.hypercerts.collection.listCollections","case":"error:includeTotal-repeated","calls":[],"outcome":{"error":"InvalidRequest: includeTotal must occur once"}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:authors:many","calls":[{"binds":["org.hypercerts.collection","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"c8876d3546"}],"outcome":{"result":{"collections":[]}}} @@ -3162,6 +3490,16 @@ {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:authors:one-scalar","calls":[{"binds":["org.hypercerts.collection","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"2888f75ed0"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:authors:duplicate","calls":[{"binds":["org.hypercerts.collection","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"2888f75ed0"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:authors:empty","calls":[{"binds":["org.hypercerts.collection",26],"sql":"1a0a4d92bf"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:authors:100-duplicates","calls":[{"binds":["org.hypercerts.collection","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"2888f75ed0"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:authors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:authors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:authors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:authors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:hasOrganizationRecord=boolean:true","calls":[{"binds":["org.hypercerts.collection",26],"sql":"768ba84080"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:hasOrganizationRecord=boolean:false","calls":[{"binds":["org.hypercerts.collection",26],"sql":"0974e3d21e"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:hasOrganizationRecord=string:true","calls":[{"binds":["org.hypercerts.collection",26],"sql":"768ba84080"}],"outcome":{"result":{"collections":[]}}} @@ -3171,21 +3509,61 @@ {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:types:one-scalar","calls":[{"binds":["org.hypercerts.collection","project",26],"sql":"3f008a1b2f"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:types:duplicate","calls":[{"binds":["org.hypercerts.collection","project",26],"sql":"3f008a1b2f"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:types:empty","calls":[{"binds":["org.hypercerts.collection",26],"sql":"1a0a4d92bf"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:types:100-duplicates","calls":[{"binds":["org.hypercerts.collection","project",26],"sql":"3f008a1b2f"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:types:101-values","calls":[],"outcome":{"error":"InvalidRequest: types accepts at most 100 values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:types:invalid-item","calls":[{"binds":["org.hypercerts.collection","project","not a valid value",26],"sql":"6c47c018fb"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:types:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: types entries must be strings"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:types:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: types entries must be at most 64 UTF-8 bytes"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:types:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: types entries must be strings"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:types:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: types must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:types:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: types must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:types:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: types must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:types:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: types must use repeated query values"}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:uris:many","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghijc",26],"sql":"b87da4b57f"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:uris:one","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghija",26],"sql":"38a6653b6f"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:uris:one-scalar","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghija",26],"sql":"38a6653b6f"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:uris:duplicate","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghija",26],"sql":"38a6653b6f"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:uris:empty","calls":[{"binds":["org.hypercerts.collection",26],"sql":"1a0a4d92bf"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:uris:100-duplicates","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghija",26],"sql":"38a6653b6f"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:uris:101-values","calls":[],"outcome":{"error":"InvalidRequest: uris accepts at most 100 values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:uris:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each uris value must be a full org.hypercerts.collection AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:uris:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: uris entries must be strings"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:uris:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each uris value must be a full org.hypercerts.collection AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:uris:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: uris entries must be strings"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:uris:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:uris:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:uris:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:uris:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:itemUris:many","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijc",26],"sql":"f0cc9e6828"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:itemUris:one","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"fa73adf4ae"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:itemUris:one-scalar","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"fa73adf4ae"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:itemUris:duplicate","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"fa73adf4ae"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:itemUris:empty","calls":[{"binds":["org.hypercerts.collection",26],"sql":"1a0a4d92bf"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:itemUris:100-duplicates","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"fa73adf4ae"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:itemUris:101-values","calls":[],"outcome":{"error":"InvalidRequest: itemUris accepts at most 100 values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:itemUris:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each itemUris value must be a full AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:itemUris:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: itemUris entries must be strings"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:itemUris:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each itemUris value must be a full AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:itemUris:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: itemUris entries must be strings"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:itemUris:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: itemUris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:itemUris:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: itemUris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:itemUris:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: itemUris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:itemUris:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: itemUris must use repeated query values"}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:tagUris:many","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghijc",26],"sql":"19725c9990"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:tagUris:one","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghija",26],"sql":"305030aa27"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:tagUris:one-scalar","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghija",26],"sql":"305030aa27"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:tagUris:duplicate","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghija",26],"sql":"305030aa27"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:tagUris:empty","calls":[{"binds":["org.hypercerts.collection",26],"sql":"3f156e9653"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:tagUris:100-duplicates","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghija",26],"sql":"305030aa27"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:tagUris:101-values","calls":[],"outcome":{"error":"InvalidRequest: tagUris accepts at most 100 values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:tagUris:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each tagUris value must be a full org.hypercerts.vocab.tag AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:tagUris:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: tagUris entries must be strings"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:tagUris:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each tagUris value must be a full org.hypercerts.vocab.tag AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:tagUris:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: tagUris entries must be strings"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:tagUris:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: tagUris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:tagUris:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: tagUris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:tagUris:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: tagUris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.listCollections","case":"array:tagUris:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: tagUris must use repeated query values"}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:includeTotal=boolean:true","calls":[{"binds":["org.hypercerts.collection",26],"sql":"6d354b8027"}],"outcome":{"result":{"collections":[],"totalCount":0}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:includeTotal=boolean:false","calls":[{"binds":["org.hypercerts.collection",26],"sql":"3f156e9653"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.listCollections","case":"filter:includeTotal=string:true","calls":[{"binds":["org.hypercerts.collection",26],"sql":"6d354b8027"}],"outcome":{"result":{"collections":[],"totalCount":0}}} @@ -3300,11 +3678,22 @@ {"endpoint":"org.hypercerts.collection.searchCollections","case":"cursor:valid+limit=7:asc","calls":[{"binds":["org.hypercerts.collection","test","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghijk",8],"sql":"bc4dedfbb8"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"error:includeTotal-on-search","calls":[],"outcome":{"error":"InvalidRequest: unknown query parameter: includeTotal"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"row:indexed-at-null","calls":[{"binds":["org.hypercerts.collection","test",26],"sql":"b69842f8a9"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"collections":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.collection","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.collection","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.collection","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghija"}]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:authors:many","calls":[{"binds":["org.hypercerts.collection","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz","test",26],"sql":"4e7d5b3238"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:authors:one","calls":[{"binds":["org.hypercerts.collection","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"acdeba05c5"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:authors:one-scalar","calls":[{"binds":["org.hypercerts.collection","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"acdeba05c5"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:authors:duplicate","calls":[{"binds":["org.hypercerts.collection","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"acdeba05c5"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:authors:empty","calls":[{"binds":["org.hypercerts.collection","test",26],"sql":"14e47d934d"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:authors:100-duplicates","calls":[{"binds":["org.hypercerts.collection","did:plc:abcdefghijklmnopqrstuvwx","test",26],"sql":"acdeba05c5"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:authors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:authors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:authors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:authors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:hasOrganizationRecord=boolean:true","calls":[{"binds":["org.hypercerts.collection","test",26],"sql":"5151965637"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:hasOrganizationRecord=boolean:false","calls":[{"binds":["org.hypercerts.collection","test",26],"sql":"77db50661f"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:hasOrganizationRecord=string:true","calls":[{"binds":["org.hypercerts.collection","test",26],"sql":"5151965637"}],"outcome":{"result":{"collections":[]}}} @@ -3314,21 +3703,61 @@ {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:types:one-scalar","calls":[{"binds":["org.hypercerts.collection","project","test",26],"sql":"5e533a7996"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:types:duplicate","calls":[{"binds":["org.hypercerts.collection","project","test",26],"sql":"5e533a7996"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:types:empty","calls":[{"binds":["org.hypercerts.collection","test",26],"sql":"14e47d934d"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:types:100-duplicates","calls":[{"binds":["org.hypercerts.collection","project","test",26],"sql":"5e533a7996"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:types:101-values","calls":[],"outcome":{"error":"InvalidRequest: types accepts at most 100 values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:types:invalid-item","calls":[{"binds":["org.hypercerts.collection","project","not a valid value","test",26],"sql":"9635564fbe"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:types:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: types entries must be strings"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:types:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: types entries must be at most 64 UTF-8 bytes"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:types:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: types entries must be strings"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:types:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: types must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:types:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: types must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:types:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: types must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:types:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: types must use repeated query values"}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:uris:many","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghijc","test",26],"sql":"6505727280"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:uris:one","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghija","test",26],"sql":"86a9017a0e"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:uris:one-scalar","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghija","test",26],"sql":"86a9017a0e"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:uris:duplicate","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghija","test",26],"sql":"86a9017a0e"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:uris:empty","calls":[{"binds":["org.hypercerts.collection","test",26],"sql":"14e47d934d"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:uris:100-duplicates","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghija","test",26],"sql":"86a9017a0e"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:uris:101-values","calls":[],"outcome":{"error":"InvalidRequest: uris accepts at most 100 values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:uris:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each uris value must be a full org.hypercerts.collection AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:uris:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: uris entries must be strings"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:uris:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each uris value must be a full org.hypercerts.collection AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:uris:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: uris entries must be strings"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:uris:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:uris:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:uris:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:uris:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:itemUris:many","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijc","test",26],"sql":"7ab962c0bf"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:itemUris:one","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","test",26],"sql":"73b274acb6"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:itemUris:one-scalar","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","test",26],"sql":"73b274acb6"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:itemUris:duplicate","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","test",26],"sql":"73b274acb6"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:itemUris:empty","calls":[{"binds":["org.hypercerts.collection","test",26],"sql":"14e47d934d"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:itemUris:100-duplicates","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","test",26],"sql":"73b274acb6"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:itemUris:101-values","calls":[],"outcome":{"error":"InvalidRequest: itemUris accepts at most 100 values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:itemUris:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each itemUris value must be a full AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:itemUris:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: itemUris entries must be strings"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:itemUris:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each itemUris value must be a full AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:itemUris:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: itemUris entries must be strings"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:itemUris:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: itemUris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:itemUris:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: itemUris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:itemUris:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: itemUris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:itemUris:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: itemUris must use repeated query values"}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:tagUris:many","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghijc","test",26],"sql":"ddd82804cb"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:tagUris:one","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghija","test",26],"sql":"6d867ad058"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:tagUris:one-scalar","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghija","test",26],"sql":"6d867ad058"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:tagUris:duplicate","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghija","test",26],"sql":"6d867ad058"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:tagUris:empty","calls":[{"binds":["org.hypercerts.collection","test",26],"sql":"b69842f8a9"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:tagUris:100-duplicates","calls":[{"binds":["org.hypercerts.collection","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghija","test",26],"sql":"6d867ad058"}],"outcome":{"result":{"collections":[]}}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:tagUris:101-values","calls":[],"outcome":{"error":"InvalidRequest: tagUris accepts at most 100 values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:tagUris:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each tagUris value must be a full org.hypercerts.vocab.tag AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:tagUris:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: tagUris entries must be strings"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:tagUris:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each tagUris value must be a full org.hypercerts.vocab.tag AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:tagUris:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: tagUris entries must be strings"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:tagUris:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: tagUris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:tagUris:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: tagUris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:tagUris:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: tagUris must use repeated query values"}} +{"endpoint":"org.hypercerts.collection.searchCollections","case":"array:tagUris:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: tagUris must use repeated query values"}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"filter:all","calls":[{"binds":["org.hypercerts.collection","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","project","portfolio","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.collection/3kabcdefghijc","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghijc","test",26],"sql":"c97cffbea7"}],"outcome":{"result":{"collections":[]}}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.collection.searchCollections","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -3438,16 +3867,37 @@ {"endpoint":"org.hypercerts.context.listAcknowledgements","case":"cursor:valid:asc","calls":[{"binds":["org.hypercerts.context.acknowledgement","2025-01-01T00:00:00.000000Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.acknowledgement/3kabcdefghijk",26],"sql":"74c456cea7"}],"outcome":{"result":{"acknowledgements":[]}}} {"endpoint":"org.hypercerts.context.listAcknowledgements","case":"cursor:valid+limit=7:asc","calls":[{"binds":["org.hypercerts.context.acknowledgement","2025-01-01T00:00:00.000000Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.acknowledgement/3kabcdefghijk",8],"sql":"74c456cea7"}],"outcome":{"result":{"acknowledgements":[]}}} {"endpoint":"org.hypercerts.context.listAcknowledgements","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"row:indexed-at-null","calls":[{"binds":["org.hypercerts.context.acknowledgement",26],"sql":"06606f4591"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"acknowledgements":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.context.acknowledgement","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.acknowledgement/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.context.acknowledgement","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.acknowledgement/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.context.acknowledgement","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.acknowledgement/3kabcdefghija"}]}}} {"endpoint":"org.hypercerts.context.listAcknowledgements","case":"filter:authors:many","calls":[{"binds":["org.hypercerts.context.acknowledgement","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"411b2a5736"}],"outcome":{"result":{"acknowledgements":[]}}} {"endpoint":"org.hypercerts.context.listAcknowledgements","case":"filter:authors:one","calls":[{"binds":["org.hypercerts.context.acknowledgement","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"21615a0aef"}],"outcome":{"result":{"acknowledgements":[]}}} {"endpoint":"org.hypercerts.context.listAcknowledgements","case":"filter:authors:one-scalar","calls":[{"binds":["org.hypercerts.context.acknowledgement","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"21615a0aef"}],"outcome":{"result":{"acknowledgements":[]}}} {"endpoint":"org.hypercerts.context.listAcknowledgements","case":"filter:authors:duplicate","calls":[{"binds":["org.hypercerts.context.acknowledgement","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"21615a0aef"}],"outcome":{"result":{"acknowledgements":[]}}} {"endpoint":"org.hypercerts.context.listAcknowledgements","case":"filter:authors:empty","calls":[{"binds":["org.hypercerts.context.acknowledgement",26],"sql":"2078d19ad6"}],"outcome":{"result":{"acknowledgements":[]}}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:authors:100-duplicates","calls":[{"binds":["org.hypercerts.context.acknowledgement","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"21615a0aef"}],"outcome":{"result":{"acknowledgements":[]}}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:authors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:authors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:authors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:authors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} {"endpoint":"org.hypercerts.context.listAcknowledgements","case":"filter:subjects:many","calls":[{"binds":["org.hypercerts.context.acknowledgement","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijc",26],"sql":"b6e25ddc09"}],"outcome":{"result":{"acknowledgements":[]}}} {"endpoint":"org.hypercerts.context.listAcknowledgements","case":"filter:subjects:one","calls":[{"binds":["org.hypercerts.context.acknowledgement","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"4d4d402cd2"}],"outcome":{"result":{"acknowledgements":[]}}} {"endpoint":"org.hypercerts.context.listAcknowledgements","case":"filter:subjects:one-scalar","calls":[{"binds":["org.hypercerts.context.acknowledgement","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"4d4d402cd2"}],"outcome":{"result":{"acknowledgements":[]}}} {"endpoint":"org.hypercerts.context.listAcknowledgements","case":"filter:subjects:duplicate","calls":[{"binds":["org.hypercerts.context.acknowledgement","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"4d4d402cd2"}],"outcome":{"result":{"acknowledgements":[]}}} {"endpoint":"org.hypercerts.context.listAcknowledgements","case":"filter:subjects:empty","calls":[{"binds":["org.hypercerts.context.acknowledgement",26],"sql":"2078d19ad6"}],"outcome":{"result":{"acknowledgements":[]}}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:subjects:100-duplicates","calls":[{"binds":["org.hypercerts.context.acknowledgement","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"4d4d402cd2"}],"outcome":{"result":{"acknowledgements":[]}}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:subjects:101-values","calls":[],"outcome":{"error":"InvalidRequest: subjects accepts at most 100 values"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:subjects:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each subjects value must be a full AT-URI with a DID authority and valid collection NSID"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:subjects:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: subjects entries must be strings"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:subjects:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each subjects value must be a full AT-URI with a DID authority and valid collection NSID"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:subjects:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: subjects entries must be strings"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:subjects:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: subjects must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:subjects:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: subjects must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:subjects:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: subjects must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAcknowledgements","case":"array:subjects:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: subjects must use repeated query values"}} {"endpoint":"org.hypercerts.context.listAcknowledgements","case":"filter:all","calls":[{"binds":["org.hypercerts.context.acknowledgement","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijc",26],"sql":"60f03b42b4"}],"outcome":{"result":{"acknowledgements":[]}}} {"endpoint":"org.hypercerts.context.listAcknowledgements","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.context.listAcknowledgements","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -3597,26 +4047,67 @@ {"endpoint":"org.hypercerts.context.listAttachments","case":"cursor:valid:asc","calls":[{"binds":["org.hypercerts.context.attachment","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.attachment/3kabcdefghijk",26],"sql":"1c9c2867bb"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"cursor:valid+limit=7:asc","calls":[{"binds":["org.hypercerts.context.attachment","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.attachment/3kabcdefghijk",8],"sql":"1c9c2867bb"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"row:indexed-at-null","calls":[{"binds":["org.hypercerts.context.attachment",26],"sql":"7d4bb27bf2"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"attachments":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.context.attachment","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.attachment/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.context.attachment","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.attachment/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.context.attachment","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.attachment/3kabcdefghija"}]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:authors:many","calls":[{"binds":["org.hypercerts.context.attachment","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"5d8073cadf"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:authors:one","calls":[{"binds":["org.hypercerts.context.attachment","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"e918e80b8b"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:authors:one-scalar","calls":[{"binds":["org.hypercerts.context.attachment","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"e918e80b8b"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:authors:duplicate","calls":[{"binds":["org.hypercerts.context.attachment","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"e918e80b8b"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:authors:empty","calls":[{"binds":["org.hypercerts.context.attachment",26],"sql":"9a71769be1"}],"outcome":{"result":{"attachments":[]}}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:authors:100-duplicates","calls":[{"binds":["org.hypercerts.context.attachment","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"e918e80b8b"}],"outcome":{"result":{"attachments":[]}}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be valid DIDs"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be valid DIDs"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:authors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:authors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:authors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:authors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:uris:many","calls":[{"binds":["org.hypercerts.context.attachment","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.attachment/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.attachment/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.attachment/3kabcdefghijc",26],"sql":"cb72947a76"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:uris:one","calls":[{"binds":["org.hypercerts.context.attachment","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.attachment/3kabcdefghija",26],"sql":"217da8ce90"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:uris:one-scalar","calls":[{"binds":["org.hypercerts.context.attachment","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.attachment/3kabcdefghija",26],"sql":"217da8ce90"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:uris:duplicate","calls":[{"binds":["org.hypercerts.context.attachment","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.attachment/3kabcdefghija",26],"sql":"217da8ce90"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:uris:empty","calls":[{"binds":["org.hypercerts.context.attachment",26],"sql":"9a71769be1"}],"outcome":{"result":{"attachments":[]}}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:uris:100-duplicates","calls":[{"binds":["org.hypercerts.context.attachment","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.attachment/3kabcdefghija",26],"sql":"217da8ce90"}],"outcome":{"result":{"attachments":[]}}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:uris:101-values","calls":[],"outcome":{"error":"InvalidRequest: uris accepts at most 100 values"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:uris:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each uris value must be full org.hypercerts.context.attachment AT-URIs with DID authorities"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:uris:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: uris entries must be strings"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:uris:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each uris value must be full org.hypercerts.context.attachment AT-URIs with DID authorities"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:uris:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: uris entries must be strings"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:uris:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:uris:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:uris:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:uris:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:subjects:many","calls":[{"binds":["org.hypercerts.context.attachment","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijc",26],"sql":"60c7592388"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:subjects:one","calls":[{"binds":["org.hypercerts.context.attachment","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"3292022713"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:subjects:one-scalar","calls":[{"binds":["org.hypercerts.context.attachment","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"3292022713"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:subjects:duplicate","calls":[{"binds":["org.hypercerts.context.attachment","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"3292022713"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:subjects:empty","calls":[{"binds":["org.hypercerts.context.attachment",26],"sql":"9a71769be1"}],"outcome":{"result":{"attachments":[]}}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:subjects:100-duplicates","calls":[{"binds":["org.hypercerts.context.attachment","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"3292022713"}],"outcome":{"result":{"attachments":[]}}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:subjects:101-values","calls":[],"outcome":{"error":"InvalidRequest: subjects accepts at most 100 values"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:subjects:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each subjects value must be full AT-URIs with DID authorities"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:subjects:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: subjects entries must be strings"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:subjects:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each subjects value must be full AT-URIs with DID authorities"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:subjects:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: subjects entries must be strings"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:subjects:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: subjects must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:subjects:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: subjects must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:subjects:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: subjects must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:subjects:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: subjects must use repeated query values"}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:contentTypes:many","calls":[{"binds":["org.hypercerts.context.attachment","image/png","application/pdf","text/plain",26],"sql":"e7f96450ef"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:contentTypes:one","calls":[{"binds":["org.hypercerts.context.attachment","image/png",26],"sql":"94b8231885"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:contentTypes:one-scalar","calls":[{"binds":["org.hypercerts.context.attachment","image/png",26],"sql":"94b8231885"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:contentTypes:duplicate","calls":[{"binds":["org.hypercerts.context.attachment","image/png",26],"sql":"94b8231885"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:contentTypes:empty","calls":[{"binds":["org.hypercerts.context.attachment",26],"sql":"9a71769be1"}],"outcome":{"result":{"attachments":[]}}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:contentTypes:100-duplicates","calls":[{"binds":["org.hypercerts.context.attachment","image/png",26],"sql":"94b8231885"}],"outcome":{"result":{"attachments":[]}}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:contentTypes:101-values","calls":[],"outcome":{"error":"InvalidRequest: contentTypes accepts at most 100 values"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:contentTypes:invalid-item","calls":[{"binds":["org.hypercerts.context.attachment","image/png","not a valid value",26],"sql":"3595567315"}],"outcome":{"result":{"attachments":[]}}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:contentTypes:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: contentTypes entries must be strings"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:contentTypes:oversize-item","calls":[{"binds":["org.hypercerts.context.attachment","image/png","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",26],"sql":"3595567315"}],"outcome":{"result":{"attachments":[]}}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:contentTypes:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: contentTypes entries must be strings"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:contentTypes:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: contentTypes must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:contentTypes:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: contentTypes must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:contentTypes:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: contentTypes must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listAttachments","case":"array:contentTypes:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: contentTypes must use repeated query values"}} {"endpoint":"org.hypercerts.context.listAttachments","case":"filter:all","calls":[{"binds":["org.hypercerts.context.attachment","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.attachment/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.attachment/3kabcdefghijc","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb","application/pdf","text/plain",26],"sql":"7e9ede407d"}],"outcome":{"result":{"attachments":[]}}} {"endpoint":"org.hypercerts.context.listAttachments","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.context.listAttachments","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -3726,21 +4217,52 @@ {"endpoint":"org.hypercerts.context.listEvaluations","case":"cursor:valid:asc","calls":[{"binds":["org.hypercerts.context.evaluation","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.evaluation/3kabcdefghijk",26],"sql":"3579ec0f41"}],"outcome":{"result":{"evaluations":[]}}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"cursor:valid+limit=7:asc","calls":[{"binds":["org.hypercerts.context.evaluation","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.evaluation/3kabcdefghijk",8],"sql":"3579ec0f41"}],"outcome":{"result":{"evaluations":[]}}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"row:indexed-at-null","calls":[{"binds":["org.hypercerts.context.evaluation",26],"sql":"6d8c64ef3d"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"evaluations":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.context.evaluation","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.evaluation/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.context.evaluation","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.evaluation/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","evaluators":[],"indexedAt":null,"record":{"$type":"org.hypercerts.context.evaluation","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.evaluation/3kabcdefghija"}]}}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"filter:authors:many","calls":[{"binds":["org.hypercerts.context.evaluation","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"9b7df21f2c"}],"outcome":{"result":{"evaluations":[]}}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"filter:authors:one","calls":[{"binds":["org.hypercerts.context.evaluation","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"56eaf46105"}],"outcome":{"result":{"evaluations":[]}}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"filter:authors:one-scalar","calls":[{"binds":["org.hypercerts.context.evaluation","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"56eaf46105"}],"outcome":{"result":{"evaluations":[]}}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"filter:authors:duplicate","calls":[{"binds":["org.hypercerts.context.evaluation","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"56eaf46105"}],"outcome":{"result":{"evaluations":[]}}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"filter:authors:empty","calls":[{"binds":["org.hypercerts.context.evaluation",26],"sql":"75a34c60e8"}],"outcome":{"result":{"evaluations":[]}}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:authors:100-duplicates","calls":[{"binds":["org.hypercerts.context.evaluation","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"56eaf46105"}],"outcome":{"result":{"evaluations":[]}}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:authors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:authors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:authors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:authors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"filter:evaluators:many","calls":[{"binds":["org.hypercerts.context.evaluation","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"5b97334acb"}],"outcome":{"result":{"evaluations":[]}}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"filter:evaluators:one","calls":[{"binds":["org.hypercerts.context.evaluation","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"29d082424e"}],"outcome":{"result":{"evaluations":[]}}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"filter:evaluators:one-scalar","calls":[{"binds":["org.hypercerts.context.evaluation","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"29d082424e"}],"outcome":{"result":{"evaluations":[]}}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"filter:evaluators:duplicate","calls":[{"binds":["org.hypercerts.context.evaluation","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"29d082424e"}],"outcome":{"result":{"evaluations":[]}}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"filter:evaluators:empty","calls":[{"binds":["org.hypercerts.context.evaluation",26],"sql":"75a34c60e8"}],"outcome":{"result":{"evaluations":[]}}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:evaluators:100-duplicates","calls":[{"binds":["org.hypercerts.context.evaluation","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"29d082424e"}],"outcome":{"result":{"evaluations":[]}}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:evaluators:101-values","calls":[],"outcome":{"error":"InvalidRequest: evaluators accepts at most 100 values"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:evaluators:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each evaluators value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:evaluators:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: evaluators entries must be strings"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:evaluators:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each evaluators value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:evaluators:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: evaluators entries must be strings"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:evaluators:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: evaluators must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:evaluators:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: evaluators must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:evaluators:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: evaluators must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:evaluators:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: evaluators must use repeated query values"}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"filter:subjects:many","calls":[{"binds":["org.hypercerts.context.evaluation","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijc",26],"sql":"0677ccea57"}],"outcome":{"result":{"evaluations":[]}}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"filter:subjects:one","calls":[{"binds":["org.hypercerts.context.evaluation","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"bb4b288339"}],"outcome":{"result":{"evaluations":[]}}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"filter:subjects:one-scalar","calls":[{"binds":["org.hypercerts.context.evaluation","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"bb4b288339"}],"outcome":{"result":{"evaluations":[]}}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"filter:subjects:duplicate","calls":[{"binds":["org.hypercerts.context.evaluation","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"bb4b288339"}],"outcome":{"result":{"evaluations":[]}}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"filter:subjects:empty","calls":[{"binds":["org.hypercerts.context.evaluation",26],"sql":"75a34c60e8"}],"outcome":{"result":{"evaluations":[]}}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:subjects:100-duplicates","calls":[{"binds":["org.hypercerts.context.evaluation","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"bb4b288339"}],"outcome":{"result":{"evaluations":[]}}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:subjects:101-values","calls":[],"outcome":{"error":"InvalidRequest: subjects accepts at most 100 values"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:subjects:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each subjects value must be a full AT-URI with a DID authority and valid collection NSID"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:subjects:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: subjects entries must be strings"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:subjects:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each subjects value must be a full AT-URI with a DID authority and valid collection NSID"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:subjects:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: subjects entries must be strings"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:subjects:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: subjects must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:subjects:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: subjects must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:subjects:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: subjects must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listEvaluations","case":"array:subjects:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: subjects must use repeated query values"}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"filter:all","calls":[{"binds":["org.hypercerts.context.evaluation","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb",26],"sql":"fd62cfd14e"}],"outcome":{"result":{"evaluations":[]}}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.context.listEvaluations","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -3850,16 +4372,37 @@ {"endpoint":"org.hypercerts.context.listMeasurements","case":"cursor:valid:asc","calls":[{"binds":["org.hypercerts.context.measurement","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.measurement/3kabcdefghijk",26],"sql":"670611fb64"}],"outcome":{"result":{"measurements":[]}}} {"endpoint":"org.hypercerts.context.listMeasurements","case":"cursor:valid+limit=7:asc","calls":[{"binds":["org.hypercerts.context.measurement","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.measurement/3kabcdefghijk",8],"sql":"670611fb64"}],"outcome":{"result":{"measurements":[]}}} {"endpoint":"org.hypercerts.context.listMeasurements","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"row:indexed-at-null","calls":[{"binds":["org.hypercerts.context.measurement",26],"sql":"de2f5ba134"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"measurements":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","record":{"$type":"org.hypercerts.context.measurement","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.measurement/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","record":{"$type":"org.hypercerts.context.measurement","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.measurement/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.context.measurement","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.context.measurement/3kabcdefghija"}]}}} {"endpoint":"org.hypercerts.context.listMeasurements","case":"filter:authors:many","calls":[{"binds":["org.hypercerts.context.measurement","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"667b351197"}],"outcome":{"result":{"measurements":[]}}} {"endpoint":"org.hypercerts.context.listMeasurements","case":"filter:authors:one","calls":[{"binds":["org.hypercerts.context.measurement","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"fee0b5414b"}],"outcome":{"result":{"measurements":[]}}} {"endpoint":"org.hypercerts.context.listMeasurements","case":"filter:authors:one-scalar","calls":[{"binds":["org.hypercerts.context.measurement","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"fee0b5414b"}],"outcome":{"result":{"measurements":[]}}} {"endpoint":"org.hypercerts.context.listMeasurements","case":"filter:authors:duplicate","calls":[{"binds":["org.hypercerts.context.measurement","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"fee0b5414b"}],"outcome":{"result":{"measurements":[]}}} {"endpoint":"org.hypercerts.context.listMeasurements","case":"filter:authors:empty","calls":[{"binds":["org.hypercerts.context.measurement",26],"sql":"d7232ab4cf"}],"outcome":{"result":{"measurements":[]}}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:authors:100-duplicates","calls":[{"binds":["org.hypercerts.context.measurement","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"fee0b5414b"}],"outcome":{"result":{"measurements":[]}}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:authors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:authors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:authors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:authors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} {"endpoint":"org.hypercerts.context.listMeasurements","case":"filter:subjects:many","calls":[{"binds":["org.hypercerts.context.measurement","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijc",26],"sql":"ac33fe3268"}],"outcome":{"result":{"measurements":[]}}} {"endpoint":"org.hypercerts.context.listMeasurements","case":"filter:subjects:one","calls":[{"binds":["org.hypercerts.context.measurement","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"c37b75815c"}],"outcome":{"result":{"measurements":[]}}} {"endpoint":"org.hypercerts.context.listMeasurements","case":"filter:subjects:one-scalar","calls":[{"binds":["org.hypercerts.context.measurement","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"c37b75815c"}],"outcome":{"result":{"measurements":[]}}} {"endpoint":"org.hypercerts.context.listMeasurements","case":"filter:subjects:duplicate","calls":[{"binds":["org.hypercerts.context.measurement","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"c37b75815c"}],"outcome":{"result":{"measurements":[]}}} {"endpoint":"org.hypercerts.context.listMeasurements","case":"filter:subjects:empty","calls":[{"binds":["org.hypercerts.context.measurement",26],"sql":"d7232ab4cf"}],"outcome":{"result":{"measurements":[]}}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:subjects:100-duplicates","calls":[{"binds":["org.hypercerts.context.measurement","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"c37b75815c"}],"outcome":{"result":{"measurements":[]}}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:subjects:101-values","calls":[],"outcome":{"error":"InvalidRequest: subjects accepts at most 100 values"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:subjects:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each subjects value must be a full AT-URI with a DID authority and valid collection NSID"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:subjects:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: subjects entries must be strings"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:subjects:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each subjects value must be a full AT-URI with a DID authority and valid collection NSID"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:subjects:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: subjects entries must be strings"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:subjects:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: subjects must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:subjects:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: subjects must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:subjects:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: subjects must use repeated query values"}} +{"endpoint":"org.hypercerts.context.listMeasurements","case":"array:subjects:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: subjects must use repeated query values"}} {"endpoint":"org.hypercerts.context.listMeasurements","case":"filter:all","calls":[{"binds":["org.hypercerts.context.measurement","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijc",26],"sql":"a8fc854d42"}],"outcome":{"result":{"measurements":[]}}} {"endpoint":"org.hypercerts.context.listMeasurements","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.context.listMeasurements","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -3969,11 +4512,22 @@ {"endpoint":"org.hypercerts.entity.listFeatures","case":"cursor:valid:asc","calls":[{"binds":["org.hypercerts.entity.feature","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.entity.feature/3kabcdefghijk",26],"sql":"2125462720"}],"outcome":{"result":{"features":[]}}} {"endpoint":"org.hypercerts.entity.listFeatures","case":"cursor:valid+limit=7:asc","calls":[{"binds":["org.hypercerts.entity.feature","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.entity.feature/3kabcdefghijk",8],"sql":"2125462720"}],"outcome":{"result":{"features":[]}}} {"endpoint":"org.hypercerts.entity.listFeatures","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"row:indexed-at-null","calls":[{"binds":["org.hypercerts.entity.feature",26],"sql":"5f1a04a6f6"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"features":[{"$type":"org.hypercerts.entity.defs#featureView","author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.entity.feature","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.entity.feature/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.entity.feature","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.entity.feature/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.entity.feature","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.entity.feature/3kabcdefghija"}]}}} {"endpoint":"org.hypercerts.entity.listFeatures","case":"filter:authors:many","calls":[{"binds":["org.hypercerts.entity.feature","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"cbc411b34a"}],"outcome":{"result":{"features":[]}}} {"endpoint":"org.hypercerts.entity.listFeatures","case":"filter:authors:one","calls":[{"binds":["org.hypercerts.entity.feature","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"2e4b9a5ce8"}],"outcome":{"result":{"features":[]}}} {"endpoint":"org.hypercerts.entity.listFeatures","case":"filter:authors:one-scalar","calls":[{"binds":["org.hypercerts.entity.feature","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"2e4b9a5ce8"}],"outcome":{"result":{"features":[]}}} {"endpoint":"org.hypercerts.entity.listFeatures","case":"filter:authors:duplicate","calls":[{"binds":["org.hypercerts.entity.feature","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"2e4b9a5ce8"}],"outcome":{"result":{"features":[]}}} {"endpoint":"org.hypercerts.entity.listFeatures","case":"filter:authors:empty","calls":[{"binds":["org.hypercerts.entity.feature",26],"sql":"fe4a9479a5"}],"outcome":{"result":{"features":[]}}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:authors:100-duplicates","calls":[{"binds":["org.hypercerts.entity.feature","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"2e4b9a5ce8"}],"outcome":{"result":{"features":[]}}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be valid DIDs"}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be valid DIDs"}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:authors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated string query parameters"}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:authors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated string query parameters"}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:authors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated string query parameters"}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:authors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated string query parameters"}} {"endpoint":"org.hypercerts.entity.listFeatures","case":"filter:hasOrganizationRecord=boolean:true","calls":[{"binds":["org.hypercerts.entity.feature",26],"sql":"1f264cba3c"}],"outcome":{"result":{"features":[]}}} {"endpoint":"org.hypercerts.entity.listFeatures","case":"filter:hasOrganizationRecord=boolean:false","calls":[{"binds":["org.hypercerts.entity.feature",26],"sql":"92fa39766a"}],"outcome":{"result":{"features":[]}}} {"endpoint":"org.hypercerts.entity.listFeatures","case":"filter:hasOrganizationRecord=string:true","calls":[{"binds":["org.hypercerts.entity.feature",26],"sql":"1f264cba3c"}],"outcome":{"result":{"features":[]}}} @@ -3983,6 +4537,16 @@ {"endpoint":"org.hypercerts.entity.listFeatures","case":"filter:types:one-scalar","calls":[{"binds":["org.hypercerts.entity.feature","project",26],"sql":"6c1a25fc34"}],"outcome":{"result":{"features":[]}}} {"endpoint":"org.hypercerts.entity.listFeatures","case":"filter:types:duplicate","calls":[{"binds":["org.hypercerts.entity.feature","project",26],"sql":"6c1a25fc34"}],"outcome":{"result":{"features":[]}}} {"endpoint":"org.hypercerts.entity.listFeatures","case":"filter:types:empty","calls":[{"binds":["org.hypercerts.entity.feature",26],"sql":"fe4a9479a5"}],"outcome":{"result":{"features":[]}}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:types:100-duplicates","calls":[{"binds":["org.hypercerts.entity.feature","project",26],"sql":"6c1a25fc34"}],"outcome":{"result":{"features":[]}}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:types:101-values","calls":[],"outcome":{"error":"InvalidRequest: types accepts at most 100 values"}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:types:invalid-item","calls":[{"binds":["org.hypercerts.entity.feature","project","not a valid value",26],"sql":"69226c63d4"}],"outcome":{"result":{"features":[]}}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:types:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: types entries must be strings"}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:types:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: types entries must be at most 64 UTF-8 bytes"}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:types:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: types entries must be strings"}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:types:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: types must use repeated string query parameters"}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:types:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: types must use repeated string query parameters"}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:types:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: types must use repeated string query parameters"}} +{"endpoint":"org.hypercerts.entity.listFeatures","case":"array:types:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: types must use repeated string query parameters"}} {"endpoint":"org.hypercerts.entity.listFeatures","case":"filter:all","calls":[{"binds":["org.hypercerts.entity.feature","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","project","portfolio",26],"sql":"1a4336693f"}],"outcome":{"result":{"features":[]}}} {"endpoint":"org.hypercerts.entity.listFeatures","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.entity.listFeatures","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -4099,6 +4663,7 @@ {"endpoint":"org.hypercerts.funding.listReceipts","case":"error:includeTotal-count-fractional","calls":[{"binds":["org.hypercerts.funding.receipt",26],"sql":"ed71ce4c7f"}],"outcome":{"error":"ReceiptQueryFailed: receipt count unavailable"}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"error:includeTotal-count-unsafe","calls":[{"binds":["org.hypercerts.funding.receipt",26],"sql":"ed71ce4c7f"}],"outcome":{"error":"ReceiptQueryFailed: receipt count unavailable"}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"error:includeTotal-count-invalid","calls":[{"binds":["org.hypercerts.funding.receipt",26],"sql":"ed71ce4c7f"}],"outcome":{"error":"ReceiptQueryFailed: receipt count unavailable"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"row:indexed-at-null","calls":[{"binds":["org.hypercerts.funding.receipt",26],"sql":"7a3a9df1b7"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"receipts":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.funding.receipt","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.funding.receipt/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.funding.receipt","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.funding.receipt/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.funding.receipt","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.funding.receipt/3kabcdefghija"}]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"error:includeTotal-invalid","calls":[],"outcome":{"error":"InvalidRequest: includeTotal must be true or false"}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"error:includeTotal-repeated","calls":[],"outcome":{"error":"InvalidRequest: includeTotal must occur once"}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:authors:many","calls":[{"binds":["org.hypercerts.funding.receipt","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"18e7a85675"}],"outcome":{"result":{"receipts":[]}}} @@ -4106,33 +4671,93 @@ {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:authors:one-scalar","calls":[{"binds":["org.hypercerts.funding.receipt","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"032ae5b6b1"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:authors:duplicate","calls":[{"binds":["org.hypercerts.funding.receipt","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"032ae5b6b1"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:authors:empty","calls":[{"binds":["org.hypercerts.funding.receipt",26],"sql":"1179b6a5dd"}],"outcome":{"result":{"receipts":[]}}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:authors:100-duplicates","calls":[{"binds":["org.hypercerts.funding.receipt","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"032ae5b6b1"}],"outcome":{"result":{"receipts":[]}}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: authors entry \"not a valid value\" must be a valid DID"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: authors entry \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" must be a valid DID"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:authors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:authors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:authors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:authors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:uris:many","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.funding.receipt/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.funding.receipt/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.funding.receipt/3kabcdefghijc",26],"sql":"7509a18685"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:uris:one","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.funding.receipt/3kabcdefghija",26],"sql":"9774bdb4af"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:uris:one-scalar","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.funding.receipt/3kabcdefghija",26],"sql":"9774bdb4af"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:uris:duplicate","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.funding.receipt/3kabcdefghija",26],"sql":"9774bdb4af"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:uris:empty","calls":[{"binds":["org.hypercerts.funding.receipt",26],"sql":"1179b6a5dd"}],"outcome":{"result":{"receipts":[]}}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:uris:100-duplicates","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.funding.receipt/3kabcdefghija",26],"sql":"9774bdb4af"}],"outcome":{"result":{"receipts":[]}}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:uris:101-values","calls":[],"outcome":{"error":"InvalidRequest: uris accepts at most 100 values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:uris:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: uris entry \"not a valid value\" must be a full org.hypercerts.funding.receipt AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:uris:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: uris entries must be strings"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:uris:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: uris entry \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" must be a full org.hypercerts.funding.receipt AT-URI with a DID authority"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:uris:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: uris entries must be strings"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:uris:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:uris:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:uris:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:uris:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: uris must use repeated query values"}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:from:many","calls":[{"binds":["org.hypercerts.funding.receipt","did:plc:abcdefghijklmnopqrstuvwy","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijc",26],"sql":"7754ca267f"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:from:one","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"8770b97353"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:from:one-scalar","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"8770b97353"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:from:duplicate","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"8770b97353"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:from:empty","calls":[{"binds":["org.hypercerts.funding.receipt",26],"sql":"1179b6a5dd"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:from:mixed-many","calls":[{"binds":["org.hypercerts.funding.receipt","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb",26],"sql":"f46a8471ac"}],"outcome":{"result":{"receipts":[]}}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:from:100-duplicates","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"8770b97353"}],"outcome":{"result":{"receipts":[]}}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:from:101-values","calls":[],"outcome":{"error":"InvalidRequest: from accepts at most 100 values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:from:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: from entry \"not a valid value\" must be a valid DID or full record AT-URI; resolve handles to DIDs before querying"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:from:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: from entries must be strings"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:from:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: from entry \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" must be a valid DID or full record AT-URI; resolve handles to DIDs before querying"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:from:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: from entries must be strings"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:from:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: from must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:from:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: from must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:from:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: from must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:from:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: from must use repeated query values"}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:to:many","calls":[{"binds":["org.hypercerts.funding.receipt","did:plc:abcdefghijklmnopqrstuvwy","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijc",26],"sql":"c93c12651c"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:to:one","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"84232a2660"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:to:one-scalar","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"84232a2660"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:to:duplicate","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"84232a2660"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:to:empty","calls":[{"binds":["org.hypercerts.funding.receipt",26],"sql":"1179b6a5dd"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:to:mixed-many","calls":[{"binds":["org.hypercerts.funding.receipt","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb",26],"sql":"f1d764afaa"}],"outcome":{"result":{"receipts":[]}}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:to:100-duplicates","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"84232a2660"}],"outcome":{"result":{"receipts":[]}}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:to:101-values","calls":[],"outcome":{"error":"InvalidRequest: to accepts at most 100 values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:to:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: to entry \"not a valid value\" must be a valid DID or full record AT-URI; resolve handles to DIDs before querying"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:to:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: to entries must be strings"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:to:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: to entry \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" must be a valid DID or full record AT-URI; resolve handles to DIDs before querying"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:to:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: to entries must be strings"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:to:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: to must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:to:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: to must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:to:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: to must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:to:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: to must use repeated query values"}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:forUris:many","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijb","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghijc",26],"sql":"aeb346d897"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:forUris:one","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"641d03e31b"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:forUris:one-scalar","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"641d03e31b"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:forUris:duplicate","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"641d03e31b"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:forUris:empty","calls":[{"binds":["org.hypercerts.funding.receipt",26],"sql":"1179b6a5dd"}],"outcome":{"result":{"receipts":[]}}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:forUris:100-duplicates","calls":[{"binds":["org.hypercerts.funding.receipt","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.claim.activity/3kabcdefghija",26],"sql":"641d03e31b"}],"outcome":{"result":{"receipts":[]}}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:forUris:101-values","calls":[],"outcome":{"error":"InvalidRequest: forUris accepts at most 100 values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:forUris:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: forUris entry \"not a valid value\" must be a full record AT-URI with a valid NSID collection and DID authority"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:forUris:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: forUris entries must be strings"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:forUris:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: forUris entry \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" must be a full record AT-URI with a valid NSID collection and DID authority"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:forUris:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: forUris entries must be strings"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:forUris:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: forUris must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:forUris:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: forUris must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:forUris:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: forUris must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:forUris:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: forUris must use repeated query values"}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:transactionIds:many","calls":[{"binds":["org.hypercerts.funding.receipt","0x1111111111111111111111111111111111111111111111111111111111111111","0x2222222222222222222222222222222222222222222222222222222222222222","0x3333333333333333333333333333333333333333333333333333333333333333",26],"sql":"b5829b39fd"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:transactionIds:one","calls":[{"binds":["org.hypercerts.funding.receipt","0x1111111111111111111111111111111111111111111111111111111111111111",26],"sql":"5413d88dea"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:transactionIds:one-scalar","calls":[{"binds":["org.hypercerts.funding.receipt","0x1111111111111111111111111111111111111111111111111111111111111111",26],"sql":"5413d88dea"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:transactionIds:duplicate","calls":[{"binds":["org.hypercerts.funding.receipt","0x1111111111111111111111111111111111111111111111111111111111111111",26],"sql":"5413d88dea"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:transactionIds:empty","calls":[{"binds":["org.hypercerts.funding.receipt",26],"sql":"1179b6a5dd"}],"outcome":{"result":{"receipts":[]}}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:transactionIds:100-duplicates","calls":[{"binds":["org.hypercerts.funding.receipt","0x1111111111111111111111111111111111111111111111111111111111111111",26],"sql":"5413d88dea"}],"outcome":{"result":{"receipts":[]}}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:transactionIds:101-values","calls":[],"outcome":{"error":"InvalidRequest: transactionIds accepts at most 100 values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:transactionIds:invalid-item","calls":[{"binds":["org.hypercerts.funding.receipt","0x1111111111111111111111111111111111111111111111111111111111111111","not a valid value",26],"sql":"c23dcd86ca"}],"outcome":{"result":{"receipts":[]}}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:transactionIds:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: transactionIds entries must be strings"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:transactionIds:oversize-item","calls":[{"binds":["org.hypercerts.funding.receipt","0x1111111111111111111111111111111111111111111111111111111111111111","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",26],"sql":"c23dcd86ca"}],"outcome":{"result":{"receipts":[]}}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:transactionIds:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: transactionIds entries must be strings"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:transactionIds:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: transactionIds must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:transactionIds:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: transactionIds must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:transactionIds:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: transactionIds must use repeated query values"}} +{"endpoint":"org.hypercerts.funding.listReceipts","case":"array:transactionIds:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: transactionIds must use repeated query values"}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:includeTotal=boolean:true","calls":[{"binds":["org.hypercerts.funding.receipt",26],"sql":"ed71ce4c7f"}],"outcome":{"result":{"receipts":[],"totalCount":0}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:includeTotal=boolean:false","calls":[{"binds":["org.hypercerts.funding.receipt",26],"sql":"7a3a9df1b7"}],"outcome":{"result":{"receipts":[]}}} {"endpoint":"org.hypercerts.funding.listReceipts","case":"filter:includeTotal=string:true","calls":[{"binds":["org.hypercerts.funding.receipt",26],"sql":"ed71ce4c7f"}],"outcome":{"result":{"receipts":[],"totalCount":0}}} @@ -4246,11 +4871,22 @@ {"endpoint":"org.hypercerts.vocab.listVocabTags","case":"cursor:valid:asc","calls":[{"binds":["org.hypercerts.vocab.tag","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghijk",26],"sql":"f415ca0b71"}],"outcome":{"result":{"vocabTags":[]}}} {"endpoint":"org.hypercerts.vocab.listVocabTags","case":"cursor:valid+limit=7:asc","calls":[{"binds":["org.hypercerts.vocab.tag","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghijk",8],"sql":"f415ca0b71"}],"outcome":{"result":{"vocabTags":[]}}} {"endpoint":"org.hypercerts.vocab.listVocabTags","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"org.hypercerts.vocab.listVocabTags","case":"row:indexed-at-null","calls":[{"binds":["org.hypercerts.vocab.tag",26],"sql":"fdd374e87e"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"vocabTags":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","record":{"$type":"org.hypercerts.vocab.tag","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","record":{"$type":"org.hypercerts.vocab.tag","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.vocab.tag","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.vocab.tag/3kabcdefghija"}]}}} {"endpoint":"org.hypercerts.vocab.listVocabTags","case":"filter:authors:many","calls":[{"binds":["org.hypercerts.vocab.tag","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"056193581d"}],"outcome":{"result":{"vocabTags":[]}}} {"endpoint":"org.hypercerts.vocab.listVocabTags","case":"filter:authors:one","calls":[{"binds":["org.hypercerts.vocab.tag","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"cf715d2ab7"}],"outcome":{"result":{"vocabTags":[]}}} {"endpoint":"org.hypercerts.vocab.listVocabTags","case":"filter:authors:one-scalar","calls":[{"binds":["org.hypercerts.vocab.tag","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"cf715d2ab7"}],"outcome":{"result":{"vocabTags":[]}}} {"endpoint":"org.hypercerts.vocab.listVocabTags","case":"filter:authors:duplicate","calls":[{"binds":["org.hypercerts.vocab.tag","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"cf715d2ab7"}],"outcome":{"result":{"vocabTags":[]}}} {"endpoint":"org.hypercerts.vocab.listVocabTags","case":"filter:authors:empty","calls":[{"binds":["org.hypercerts.vocab.tag",26],"sql":"fdd374e87e"}],"outcome":{"result":{"vocabTags":[]}}} +{"endpoint":"org.hypercerts.vocab.listVocabTags","case":"array:authors:100-duplicates","calls":[{"binds":["org.hypercerts.vocab.tag","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"cf715d2ab7"}],"outcome":{"result":{"vocabTags":[]}}} +{"endpoint":"org.hypercerts.vocab.listVocabTags","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.vocab.listVocabTags","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID"}} +{"endpoint":"org.hypercerts.vocab.listVocabTags","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.vocab.listVocabTags","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID"}} +{"endpoint":"org.hypercerts.vocab.listVocabTags","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.vocab.listVocabTags","case":"array:authors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must be repeated string values"}} +{"endpoint":"org.hypercerts.vocab.listVocabTags","case":"array:authors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must be repeated string values"}} +{"endpoint":"org.hypercerts.vocab.listVocabTags","case":"array:authors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: authors must be repeated string values"}} +{"endpoint":"org.hypercerts.vocab.listVocabTags","case":"array:authors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: authors must be repeated string values"}} {"endpoint":"org.hypercerts.vocab.listVocabTags","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.vocab.listVocabTags","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.vocab.listVocabTags","case":"error:sortDirection=empty","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} @@ -4359,11 +4995,22 @@ {"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"cursor:valid:asc","calls":[{"binds":["org.hypercerts.workscope.tag","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.workscope.tag/3kabcdefghijk",26],"sql":"7deb402ddc"}],"outcome":{"result":{"workscopeTags":[]}}} {"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"cursor:valid+limit=7:asc","calls":[{"binds":["org.hypercerts.workscope.tag","2025-01-01T00:00:00Z","at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.workscope.tag/3kabcdefghijk",8],"sql":"7deb402ddc"}],"outcome":{"result":{"workscopeTags":[]}}} {"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"year0000:cursor:asc","calls":[],"outcome":{"error":"InvalidRequest: cursor is malformed"}} +{"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"row:indexed-at-null","calls":[{"binds":["org.hypercerts.workscope.tag",26],"sql":"e710ed7137"},{"binds":["app.certified.actor.profile","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"},{"binds":["app.certified.actor.organization","did:plc:abcdefghijklmnopqrstuvwx"],"sql":"d4529026b3"}],"outcome":{"result":{"workscopeTags":[{"author":{"did":"did:plc:abcdefghijklmnopqrstuvwx","organization":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","record":{"$type":"org.hypercerts.workscope.tag","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.workscope.tag/3kabcdefghija"},"profile":{"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","record":{"$type":"org.hypercerts.workscope.tag","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.workscope.tag/3kabcdefghija"}},"cid":"bafyfixture0","did":"did:plc:abcdefghijklmnopqrstuvwx","indexedAt":null,"record":{"$type":"org.hypercerts.workscope.tag","createdAt":"2025-01-01T00:00:00Z"},"uri":"at://did:plc:abcdefghijklmnopqrstuvwx/org.hypercerts.workscope.tag/3kabcdefghija"}]}}} {"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"filter:authors:many","calls":[{"binds":["org.hypercerts.workscope.tag","did:plc:abcdefghijklmnopqrstuvwx","did:plc:abcdefghijklmnopqrstuvwy","did:plc:abcdefghijklmnopqrstuvwz",26],"sql":"58a6e2c916"}],"outcome":{"result":{"workscopeTags":[]}}} {"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"filter:authors:one","calls":[{"binds":["org.hypercerts.workscope.tag","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"a0200581e8"}],"outcome":{"result":{"workscopeTags":[]}}} {"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"filter:authors:one-scalar","calls":[{"binds":["org.hypercerts.workscope.tag","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"a0200581e8"}],"outcome":{"result":{"workscopeTags":[]}}} {"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"filter:authors:duplicate","calls":[{"binds":["org.hypercerts.workscope.tag","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"a0200581e8"}],"outcome":{"result":{"workscopeTags":[]}}} {"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"filter:authors:empty","calls":[{"binds":["org.hypercerts.workscope.tag",26],"sql":"e04b3f0ec2"}],"outcome":{"result":{"workscopeTags":[]}}} +{"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"array:authors:100-duplicates","calls":[{"binds":["org.hypercerts.workscope.tag","did:plc:abcdefghijklmnopqrstuvwx",26],"sql":"a0200581e8"}],"outcome":{"result":{"workscopeTags":[]}}} +{"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"array:authors:101-values","calls":[],"outcome":{"error":"InvalidRequest: authors accepts at most 100 values"}} +{"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"array:authors:invalid-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"array:authors:non-string-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"array:authors:oversize-item","calls":[],"outcome":{"error":"InvalidRequest: each authors value must be a valid DID; resolve handles to DIDs first"}} +{"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"array:authors:nested-array-item","calls":[],"outcome":{"error":"InvalidRequest: authors entries must be strings"}} +{"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"array:authors:keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"array:authors:string-keyed-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"array:authors:sparse-table","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} +{"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"array:authors:sparse-table-from-2","calls":[],"outcome":{"error":"InvalidRequest: authors must use repeated query values"}} {"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"error:sortDirection=bad","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"error:sortDirection=ASC","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} {"endpoint":"org.hypercerts.workscope.listWorkscopeTags","case":"error:sortDirection=empty","calls":[],"outcome":{"error":"InvalidRequest: sortDirection must be 'asc' or 'desc'"}} From ae8fc4087f591d36f138925401bd139f94666347 Mon Sep 17 00:00:00 2001 From: kzoeps Date: Thu, 26 Nov 2026 18:02:13 +0600 Subject: [PATCH 2/8] lua: share record URI validation Collection and collection-projection filters use one bounded shared helper; measurement, rights and work-scope wrappers, the organization/profile cursor URI parsers and the redundant EVM-link authority check call valid_record_uri. recent_valid_record_uri becomes is_recent_follow_uri, a follow-collection predicate. No behavior change: list golden is byte-identical. rightsIdentifier.lua is now empty and no bundle includes it. --- .../lua/endpoints/getCollection.lua | 20 +++---- .../lua/endpoints/getEvmLink.lua | 4 +- .../lua/endpoints/getMeasurement.lua | 6 +- happyview-modules/lua/endpoints/getRights.lua | 6 +- .../lua/endpoints/getWorkscopeTag.lua | 6 +- .../lua/endpoints/listCollections.lua | 26 ++++----- .../lua/endpoints/listEntityFollowing.lua | 13 +++-- .../lua/endpoints/listEvmLinks.lua | 4 +- .../lua/endpoints/listMeasurements.lua | 8 +-- .../lua/endpoints/listOrganizations.lua | 6 +- .../lua/endpoints/listProfiles.lua | 18 +++++- .../lua/endpoints/listRecentFollows.lua | 4 +- .../lua/endpoints/listRights.lua | 6 +- .../lua/endpoints/listWorkscopeTags.lua | 6 +- .../lua/endpoints/searchCollections.lua | 26 ++++----- .../lua/endpoints/searchOrganizations.lua | 6 +- .../lua/endpoints/searchProfiles.lua | 18 +++++- .../lua/shared/boundedRecordIdentifier.lua | 5 ++ happyview-modules/lua/shared/collection.lua | 5 -- .../lua/shared/collectionList.lua | 8 +-- .../lua/shared/collectionProjection.lua | 7 +-- .../lua/shared/evmLinkIdentifier.lua | 4 +- .../lua/shared/measurementQuery.lua | 4 -- .../lua/shared/organizationList.lua | 6 +- happyview-modules/lua/shared/profileList.lua | 6 +- .../lua/shared/recentFollows.lua | 4 +- .../lua/shared/rightsIdentifier.lua | 3 - happyview-modules/lua/shared/workscopeTag.lua | 4 -- .../lua/shared/workscopeTagList.lua | 2 +- happyview-modules/lua/src/getCollection.lua | 2 +- happyview-modules/lua/src/getMeasurement.lua | 2 +- happyview-modules/lua/src/getRights.lua | 2 +- happyview-modules/lua/src/getWorkscopeTag.lua | 2 +- .../lua/src/listMeasurements.lua | 4 +- happyview-modules/lua/src/listRights.lua | 2 +- .../modules/collection/manifest.json | 3 + .../modules/entity-follow/manifest.json | 1 + .../modules/profile/manifest.json | 2 + .../modules/rights/manifest.json | 2 - .../tooling/shared-helpers.registry.json | 56 +------------------ 40 files changed, 118 insertions(+), 201 deletions(-) create mode 100644 happyview-modules/lua/shared/boundedRecordIdentifier.lua diff --git a/happyview-modules/lua/endpoints/getCollection.lua b/happyview-modules/lua/endpoints/getCollection.lua index 06511fcb..bf498296 100644 --- a/happyview-modules/lua/endpoints/getCollection.lua +++ b/happyview-modules/lua/endpoints/getCollection.lua @@ -39,17 +39,18 @@ local function valid_record_uri(value) return true, collection, authority end +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end + local COLLECTION_PROJECTION_PROFILE = "app.certified.actor.profile" local COLLECTION_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local COLLECTION_PROJECTION_LOCATION = "app.certified.location" local COLLECTION_PROJECTION_TAG = "org.hypercerts.vocab.tag" local COLLECTION_PROJECTION_NULL = json.decode("null") -local function collection_projection_valid_record_uri(value) - if type(value) ~= "string" or #value > 8192 then return false end - return valid_record_uri(value) -end - local function collection_projection_query(sql, values) if db.backend() ~= "postgres" then error("CollectionQueryFailed: collection API requires PostgreSQL", 0) @@ -127,7 +128,7 @@ local function collection_projection_reference(value, field, expected_collection if omit_invalid then return nil end error("CollectionQueryFailed: indexed collection has an invalid " .. field .. " reference", 0) end - local valid, collection = collection_projection_valid_record_uri(value.uri) + local valid, collection = valid_bounded_record_uri(value.uri) if not valid then if omit_invalid then return nil end error("CollectionQueryFailed: indexed collection has an invalid " .. field .. " reference", 0) @@ -229,11 +230,6 @@ end local COLLECTION = "org.hypercerts.collection" -local function collection_valid_record_uri(value) - if type(value) ~= "string" or #value > 8192 then return false end - return valid_record_uri(value) -end - local function collection_query(sql, values) if db.backend() ~= "postgres" then error("CollectionQueryFailed: collection API requires PostgreSQL", 0) @@ -256,7 +252,7 @@ end function handle() keys_only(params, { uri = true }, "unknown query parameter: ") local uri = scalar(params, "uri") - local valid, collection = collection_valid_record_uri(uri) + local valid, collection = valid_bounded_record_uri(uri) if not uri or not valid or collection ~= COLLECTION then invalid("uri must be a full org.hypercerts.collection AT-URI with a DID authority") end diff --git a/happyview-modules/lua/endpoints/getEvmLink.lua b/happyview-modules/lua/endpoints/getEvmLink.lua index 9f8e759e..88cd7933 100644 --- a/happyview-modules/lua/endpoints/getEvmLink.lua +++ b/happyview-modules/lua/endpoints/getEvmLink.lua @@ -56,9 +56,7 @@ local EVMLINK_COLLECTION = "app.certified.link.evm" local function valid_evm_link_uri(value) if type(value) ~= "string" or value:find("[?#]") then return false end local valid, collection = valid_record_uri(value) - if not valid or collection ~= EVMLINK_COLLECTION then return false end - local authority = value:match("^at://([^/]+)/") - return valid_did(authority) + return valid and collection == EVMLINK_COLLECTION end local function evm_link_record_view(row) diff --git a/happyview-modules/lua/endpoints/getMeasurement.lua b/happyview-modules/lua/endpoints/getMeasurement.lua index 4513a0ef..bd5a0221 100644 --- a/happyview-modules/lua/endpoints/getMeasurement.lua +++ b/happyview-modules/lua/endpoints/getMeasurement.lua @@ -84,10 +84,6 @@ end local MEASUREMENT = "org.hypercerts.context.measurement" local MEASUREMENT_NULL = json.decode("null") -local function measurement_valid_record_uri(value) - return valid_record_uri(value) -end - local function measurement_query(sql, values) if db.backend() ~= "postgres" then error("MeasurementQueryFailed: measurement queries require PostgreSQL", 0) @@ -126,7 +122,7 @@ end function handle() keys_only(params, { uri = true }) local uri = scalar(params, "uri") - local valid, collection = measurement_valid_record_uri(uri) + local valid, collection = valid_record_uri(uri) if not uri or not valid or collection ~= MEASUREMENT then invalid("uri must be a full " .. MEASUREMENT .. " AT-URI with a DID authority") end diff --git a/happyview-modules/lua/endpoints/getRights.lua b/happyview-modules/lua/endpoints/getRights.lua index ddf40e19..5f6266c4 100644 --- a/happyview-modules/lua/endpoints/getRights.lua +++ b/happyview-modules/lua/endpoints/getRights.lua @@ -39,10 +39,6 @@ local function valid_record_uri(value) return true, collection, authority end -local function rights_valid_record_uri(value) - return valid_record_uri(value) -end - local NULL = json.decode("null") local function record_view(row) @@ -118,7 +114,7 @@ end function handle() keys_only(params, { uri = true }) local uri = scalar(params, "uri") - local valid, collection = rights_valid_record_uri(uri) + local valid, collection = valid_record_uri(uri) if not uri or not valid or collection ~= RIGHTS then invalid("uri must be a full org.hypercerts.claim.rights AT-URI with a DID authority") end diff --git a/happyview-modules/lua/endpoints/getWorkscopeTag.lua b/happyview-modules/lua/endpoints/getWorkscopeTag.lua index a8b9cd9c..a4c327bc 100644 --- a/happyview-modules/lua/endpoints/getWorkscopeTag.lua +++ b/happyview-modules/lua/endpoints/getWorkscopeTag.lua @@ -85,10 +85,6 @@ end local WORKSCOPE_TAG = "org.hypercerts.workscope.tag" local WORKSCOPE_TAG_NULL = json.decode("null") -local function workscope_tag_valid_record_uri(value) - return valid_record_uri(value) -end - local function workscope_tag_query(sql, values) if db.backend() ~= "postgres" then error("WorkscopeTagQueryFailed: workscope-tag API requires PostgreSQL", 0) @@ -113,7 +109,7 @@ end local function workscope_tag_get(uri) keys_only(params, { uri = true }) - local valid, collection = workscope_tag_valid_record_uri(uri) + local valid, collection = valid_record_uri(uri) if not uri or not valid or collection ~= WORKSCOPE_TAG then invalid("uri must be a full org.hypercerts.workscope.tag AT-URI with a DID authority") end diff --git a/happyview-modules/lua/endpoints/listCollections.lua b/happyview-modules/lua/endpoints/listCollections.lua index f667e39f..91947ed6 100644 --- a/happyview-modules/lua/endpoints/listCollections.lua +++ b/happyview-modules/lua/endpoints/listCollections.lua @@ -18,17 +18,18 @@ local function valid_record_uri(value) return true, collection, authority end +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end + local COLLECTION_PROJECTION_PROFILE = "app.certified.actor.profile" local COLLECTION_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local COLLECTION_PROJECTION_LOCATION = "app.certified.location" local COLLECTION_PROJECTION_TAG = "org.hypercerts.vocab.tag" local COLLECTION_PROJECTION_NULL = json.decode("null") -local function collection_projection_valid_record_uri(value) - if type(value) ~= "string" or #value > 8192 then return false end - return valid_record_uri(value) -end - local function collection_projection_query(sql, values) if db.backend() ~= "postgres" then error("CollectionQueryFailed: collection API requires PostgreSQL", 0) @@ -106,7 +107,7 @@ local function collection_projection_reference(value, field, expected_collection if omit_invalid then return nil end error("CollectionQueryFailed: indexed collection has an invalid " .. field .. " reference", 0) end - local valid, collection = collection_projection_valid_record_uri(value.uri) + local valid, collection = valid_bounded_record_uri(value.uri) if not valid then if omit_invalid then return nil end error("CollectionQueryFailed: indexed collection has an invalid " .. field .. " reference", 0) @@ -208,11 +209,6 @@ end local COLLECTION = "org.hypercerts.collection" -local function collection_valid_record_uri(value) - if type(value) ~= "string" or #value > 8192 then return false end - return valid_record_uri(value) -end - local function collection_query(sql, values) if db.backend() ~= "postgres" then error("CollectionQueryFailed: collection API requires PostgreSQL", 0) @@ -392,16 +388,16 @@ local function collection_array(key, kind) if kind == "did" and not valid_did(item) then invalid("each authors value must be a valid DID; resolve handles to DIDs first") elseif kind == "collectionUri" then - local valid, collection = collection_valid_record_uri(item) + local valid, collection = valid_bounded_record_uri(item) if not valid or collection ~= COLLECTION then invalid("each uris value must be a full org.hypercerts.collection AT-URI with a DID authority") end elseif kind == "recordUri" then - if not collection_valid_record_uri(item) then + if not valid_bounded_record_uri(item) then invalid("each " .. key .. " value must be a full AT-URI with a DID authority") end elseif kind == "tagUri" then - local valid, collection = collection_valid_record_uri(item) + local valid, collection = valid_bounded_record_uri(item) if not valid or collection ~= "org.hypercerts.vocab.tag" then invalid("each tagUris value must be a full org.hypercerts.vocab.tag AT-URI with a DID authority") end @@ -418,7 +414,7 @@ end local function collection_list_cursor_decode(token, direction) return decode_cursor(token, direction, function(value) - local valid, collection = collection_valid_record_uri(value.u) + local valid, collection = valid_bounded_record_uri(value.u) return valid_datetime(value.t) and valid and collection == COLLECTION end) end diff --git a/happyview-modules/lua/endpoints/listEntityFollowing.lua b/happyview-modules/lua/endpoints/listEntityFollowing.lua index 8e91ea3a..8a861d46 100644 --- a/happyview-modules/lua/endpoints/listEntityFollowing.lua +++ b/happyview-modules/lua/endpoints/listEntityFollowing.lua @@ -39,6 +39,12 @@ local function valid_record_uri(value) return true, collection, authority end +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -266,11 +272,6 @@ local COLLECTION_PROJECTION_LOCATION = "app.certified.location" local COLLECTION_PROJECTION_TAG = "org.hypercerts.vocab.tag" local COLLECTION_PROJECTION_NULL = json.decode("null") -local function collection_projection_valid_record_uri(value) - if type(value) ~= "string" or #value > 8192 then return false end - return valid_record_uri(value) -end - local function collection_projection_query(sql, values) if db.backend() ~= "postgres" then error("CollectionQueryFailed: collection API requires PostgreSQL", 0) @@ -348,7 +349,7 @@ local function collection_projection_reference(value, field, expected_collection if omit_invalid then return nil end error("CollectionQueryFailed: indexed collection has an invalid " .. field .. " reference", 0) end - local valid, collection = collection_projection_valid_record_uri(value.uri) + local valid, collection = valid_bounded_record_uri(value.uri) if not valid then if omit_invalid then return nil end error("CollectionQueryFailed: indexed collection has an invalid " .. field .. " reference", 0) diff --git a/happyview-modules/lua/endpoints/listEvmLinks.lua b/happyview-modules/lua/endpoints/listEvmLinks.lua index cccce77b..fed4690e 100644 --- a/happyview-modules/lua/endpoints/listEvmLinks.lua +++ b/happyview-modules/lua/endpoints/listEvmLinks.lua @@ -114,9 +114,7 @@ local EVMLINK_COLLECTION = "app.certified.link.evm" local function valid_evm_link_uri(value) if type(value) ~= "string" or value:find("[?#]") then return false end local valid, collection = valid_record_uri(value) - if not valid or collection ~= EVMLINK_COLLECTION then return false end - local authority = value:match("^at://([^/]+)/") - return valid_did(authority) + return valid and collection == EVMLINK_COLLECTION end local function evm_link_record_view(row) diff --git a/happyview-modules/lua/endpoints/listMeasurements.lua b/happyview-modules/lua/endpoints/listMeasurements.lua index 0e4454ef..96aa081a 100644 --- a/happyview-modules/lua/endpoints/listMeasurements.lua +++ b/happyview-modules/lua/endpoints/listMeasurements.lua @@ -127,10 +127,6 @@ end local MEASUREMENT = "org.hypercerts.context.measurement" local MEASUREMENT_NULL = json.decode("null") -local function measurement_valid_record_uri(value) - return valid_record_uri(value) -end - local function measurement_query(sql, values) if db.backend() ~= "postgres" then error("MeasurementQueryFailed: measurement queries require PostgreSQL", 0) @@ -264,7 +260,7 @@ local function measurement_array(key, format) if format == "did" and not valid_did(item) then invalid("each " .. key .. " value must be a valid DID") elseif format == "at-uri" then - local valid, collection = measurement_valid_record_uri(item) + local valid, collection = valid_record_uri(item) if not valid or not valid_nsid(collection) then invalid("each " .. key .. " value must be a full AT-URI with a DID authority and valid collection NSID") end @@ -288,7 +284,7 @@ end local function decode_measurement_cursor(token, direction) return decode_cursor(token, direction, function(value) - local valid, collection = measurement_valid_record_uri(value.u) + local valid, collection = valid_record_uri(value.u) return valid_datetime(value.t) and valid and collection == MEASUREMENT end) end diff --git a/happyview-modules/lua/endpoints/listOrganizations.lua b/happyview-modules/lua/endpoints/listOrganizations.lua index 1d379391..5b4726b1 100644 --- a/happyview-modules/lua/endpoints/listOrganizations.lua +++ b/happyview-modules/lua/endpoints/listOrganizations.lua @@ -233,9 +233,9 @@ local function organization_actors(rows) end local function valid_organization_uri(value) - if type(value) ~= "string" or value:find("[?#]") then return false end - local authority, collection, rkey = value:match("^at://([^/]+)/([^/]+)/([^/]+)$") - return authority ~= nil and valid_did(authority) and collection == ORGANIZATION and rkey == "self" + local valid, collection = valid_record_uri(value) + -- The record key is the last path segment, so this suffix means rkey == "self". + return valid and collection == ORGANIZATION and value:sub(-5) == "/self" end local function array(params, key) diff --git a/happyview-modules/lua/endpoints/listProfiles.lua b/happyview-modules/lua/endpoints/listProfiles.lua index 15ad948e..fe2e792f 100644 --- a/happyview-modules/lua/endpoints/listProfiles.lua +++ b/happyview-modules/lua/endpoints/listProfiles.lua @@ -27,6 +27,18 @@ local function scalar(params, key) return tostring(value) end +local function valid_record_key(value) + return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." + and not value:find("[^%w_~%.:%-]") +end + +local function valid_record_uri(value) + if type(value) ~= "string" or value:find("[?#]") then return false end + local authority, collection, rkey = value:match("^at://([^/]+)/([^/]+)/([^/]+)$") + if not authority or not valid_did(authority) or not valid_record_key(rkey) then return false end + return true, collection, authority +end + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -121,9 +133,9 @@ local function add_in(where, binds, column, items) end local function valid_profile_uri(value) - if type(value) ~= "string" or value:find("[?#]") then return false end - local authority, collection, rkey = value:match("^at://([^/]+)/([^/]+)/([^/]+)$") - return authority ~= nil and valid_did(authority) and collection == PROFILE and rkey == "self" + local valid, collection = valid_record_uri(value) + -- The record key is the last path segment, so this suffix means rkey == "self". + return valid and collection == PROFILE and value:sub(-5) == "/self" end local function array(params, key) diff --git a/happyview-modules/lua/endpoints/listRecentFollows.lua b/happyview-modules/lua/endpoints/listRecentFollows.lua index 4a4bfeab..1389f3bc 100644 --- a/happyview-modules/lua/endpoints/listRecentFollows.lua +++ b/happyview-modules/lua/endpoints/listRecentFollows.lua @@ -91,7 +91,7 @@ local ACCOUNT_FOLLOW = "app.certified.graph.follow" local ENTITY_FOLLOW = "app.certified.graph.entityFollow" local NULL = json.decode("null") -local function recent_valid_record_uri(value) +local function is_recent_follow_uri(value) local valid, collection = valid_record_uri(value) return valid and (collection == ACCOUNT_FOLLOW or collection == ENTITY_FOLLOW) end @@ -116,7 +116,7 @@ local function recent_cursor_decode(token, before) for key in pairs(value) do if key ~= "v" and key ~= "t" and key ~= "u" and key ~= "b" then invalid("cursor is malformed") end end - if not recent_valid_datetime(value.t) or not recent_valid_record_uri(value.u) + if not recent_valid_datetime(value.t) or not is_recent_follow_uri(value.u) or value.b ~= (before or false) then invalid("cursor is malformed or belongs to another before value") end diff --git a/happyview-modules/lua/endpoints/listRights.lua b/happyview-modules/lua/endpoints/listRights.lua index 499fc669..62b4f3a9 100644 --- a/happyview-modules/lua/endpoints/listRights.lua +++ b/happyview-modules/lua/endpoints/listRights.lua @@ -39,10 +39,6 @@ local function valid_record_uri(value) return true, collection, authority end -local function rights_valid_record_uri(value) - return valid_record_uri(value) -end - local NULL = json.decode("null") local function record_view(row) @@ -243,7 +239,7 @@ end local function rights_list_cursor_decode(token, direction) return decode_cursor(token, direction, function(value) - local valid, collection = rights_valid_record_uri(value.u) + local valid, collection = valid_record_uri(value.u) return valid_datetime(value.t) and valid and collection == RIGHTS end) end diff --git a/happyview-modules/lua/endpoints/listWorkscopeTags.lua b/happyview-modules/lua/endpoints/listWorkscopeTags.lua index 90a04ba0..526b8e2b 100644 --- a/happyview-modules/lua/endpoints/listWorkscopeTags.lua +++ b/happyview-modules/lua/endpoints/listWorkscopeTags.lua @@ -128,10 +128,6 @@ end local WORKSCOPE_TAG = "org.hypercerts.workscope.tag" local WORKSCOPE_TAG_NULL = json.decode("null") -local function workscope_tag_valid_record_uri(value) - return valid_record_uri(value) -end - local function workscope_tag_query(sql, values) if db.backend() ~= "postgres" then error("WorkscopeTagQueryFailed: workscope-tag API requires PostgreSQL", 0) @@ -230,7 +226,7 @@ end local function workscope_tag_decode_cursor(token, direction) return decode_cursor(token, direction, function(value) - local valid, collection = workscope_tag_valid_record_uri(value.u) + local valid, collection = valid_record_uri(value.u) return valid_datetime(value.t) and valid and collection == WORKSCOPE_TAG end) end diff --git a/happyview-modules/lua/endpoints/searchCollections.lua b/happyview-modules/lua/endpoints/searchCollections.lua index a33a70ee..57e05574 100644 --- a/happyview-modules/lua/endpoints/searchCollections.lua +++ b/happyview-modules/lua/endpoints/searchCollections.lua @@ -18,17 +18,18 @@ local function valid_record_uri(value) return true, collection, authority end +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end + local COLLECTION_PROJECTION_PROFILE = "app.certified.actor.profile" local COLLECTION_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local COLLECTION_PROJECTION_LOCATION = "app.certified.location" local COLLECTION_PROJECTION_TAG = "org.hypercerts.vocab.tag" local COLLECTION_PROJECTION_NULL = json.decode("null") -local function collection_projection_valid_record_uri(value) - if type(value) ~= "string" or #value > 8192 then return false end - return valid_record_uri(value) -end - local function collection_projection_query(sql, values) if db.backend() ~= "postgres" then error("CollectionQueryFailed: collection API requires PostgreSQL", 0) @@ -106,7 +107,7 @@ local function collection_projection_reference(value, field, expected_collection if omit_invalid then return nil end error("CollectionQueryFailed: indexed collection has an invalid " .. field .. " reference", 0) end - local valid, collection = collection_projection_valid_record_uri(value.uri) + local valid, collection = valid_bounded_record_uri(value.uri) if not valid then if omit_invalid then return nil end error("CollectionQueryFailed: indexed collection has an invalid " .. field .. " reference", 0) @@ -208,11 +209,6 @@ end local COLLECTION = "org.hypercerts.collection" -local function collection_valid_record_uri(value) - if type(value) ~= "string" or #value > 8192 then return false end - return valid_record_uri(value) -end - local function collection_query(sql, values) if db.backend() ~= "postgres" then error("CollectionQueryFailed: collection API requires PostgreSQL", 0) @@ -392,16 +388,16 @@ local function collection_array(key, kind) if kind == "did" and not valid_did(item) then invalid("each authors value must be a valid DID; resolve handles to DIDs first") elseif kind == "collectionUri" then - local valid, collection = collection_valid_record_uri(item) + local valid, collection = valid_bounded_record_uri(item) if not valid or collection ~= COLLECTION then invalid("each uris value must be a full org.hypercerts.collection AT-URI with a DID authority") end elseif kind == "recordUri" then - if not collection_valid_record_uri(item) then + if not valid_bounded_record_uri(item) then invalid("each " .. key .. " value must be a full AT-URI with a DID authority") end elseif kind == "tagUri" then - local valid, collection = collection_valid_record_uri(item) + local valid, collection = valid_bounded_record_uri(item) if not valid or collection ~= "org.hypercerts.vocab.tag" then invalid("each tagUris value must be a full org.hypercerts.vocab.tag AT-URI with a DID authority") end @@ -418,7 +414,7 @@ end local function collection_list_cursor_decode(token, direction) return decode_cursor(token, direction, function(value) - local valid, collection = collection_valid_record_uri(value.u) + local valid, collection = valid_bounded_record_uri(value.u) return valid_datetime(value.t) and valid and collection == COLLECTION end) end diff --git a/happyview-modules/lua/endpoints/searchOrganizations.lua b/happyview-modules/lua/endpoints/searchOrganizations.lua index 68523609..0118eb69 100644 --- a/happyview-modules/lua/endpoints/searchOrganizations.lua +++ b/happyview-modules/lua/endpoints/searchOrganizations.lua @@ -233,9 +233,9 @@ local function organization_actors(rows) end local function valid_organization_uri(value) - if type(value) ~= "string" or value:find("[?#]") then return false end - local authority, collection, rkey = value:match("^at://([^/]+)/([^/]+)/([^/]+)$") - return authority ~= nil and valid_did(authority) and collection == ORGANIZATION and rkey == "self" + local valid, collection = valid_record_uri(value) + -- The record key is the last path segment, so this suffix means rkey == "self". + return valid and collection == ORGANIZATION and value:sub(-5) == "/self" end local function array(params, key) diff --git a/happyview-modules/lua/endpoints/searchProfiles.lua b/happyview-modules/lua/endpoints/searchProfiles.lua index bdf6c7d6..be40a4fc 100644 --- a/happyview-modules/lua/endpoints/searchProfiles.lua +++ b/happyview-modules/lua/endpoints/searchProfiles.lua @@ -27,6 +27,18 @@ local function scalar(params, key) return tostring(value) end +local function valid_record_key(value) + return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." + and not value:find("[^%w_~%.:%-]") +end + +local function valid_record_uri(value) + if type(value) ~= "string" or value:find("[?#]") then return false end + local authority, collection, rkey = value:match("^at://([^/]+)/([^/]+)/([^/]+)$") + if not authority or not valid_did(authority) or not valid_record_key(rkey) then return false end + return true, collection, authority +end + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -121,9 +133,9 @@ local function add_in(where, binds, column, items) end local function valid_profile_uri(value) - if type(value) ~= "string" or value:find("[?#]") then return false end - local authority, collection, rkey = value:match("^at://([^/]+)/([^/]+)/([^/]+)$") - return authority ~= nil and valid_did(authority) and collection == PROFILE and rkey == "self" + local valid, collection = valid_record_uri(value) + -- The record key is the last path segment, so this suffix means rkey == "self". + return valid and collection == PROFILE and value:sub(-5) == "/self" end local function array(params, key) diff --git a/happyview-modules/lua/shared/boundedRecordIdentifier.lua b/happyview-modules/lua/shared/boundedRecordIdentifier.lua new file mode 100644 index 00000000..21a8fcf0 --- /dev/null +++ b/happyview-modules/lua/shared/boundedRecordIdentifier.lua @@ -0,0 +1,5 @@ +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end diff --git a/happyview-modules/lua/shared/collection.lua b/happyview-modules/lua/shared/collection.lua index 03280698..e84afd27 100644 --- a/happyview-modules/lua/shared/collection.lua +++ b/happyview-modules/lua/shared/collection.lua @@ -1,10 +1,5 @@ local COLLECTION = "org.hypercerts.collection" -local function collection_valid_record_uri(value) - if type(value) ~= "string" or #value > 8192 then return false end - return valid_record_uri(value) -end - local function collection_query(sql, values) if db.backend() ~= "postgres" then error("CollectionQueryFailed: collection API requires PostgreSQL", 0) diff --git a/happyview-modules/lua/shared/collectionList.lua b/happyview-modules/lua/shared/collectionList.lua index da24acd4..698f1017 100644 --- a/happyview-modules/lua/shared/collectionList.lua +++ b/happyview-modules/lua/shared/collectionList.lua @@ -33,16 +33,16 @@ local function collection_array(key, kind) if kind == "did" and not valid_did(item) then invalid("each authors value must be a valid DID; resolve handles to DIDs first") elseif kind == "collectionUri" then - local valid, collection = collection_valid_record_uri(item) + local valid, collection = valid_bounded_record_uri(item) if not valid or collection ~= COLLECTION then invalid("each uris value must be a full org.hypercerts.collection AT-URI with a DID authority") end elseif kind == "recordUri" then - if not collection_valid_record_uri(item) then + if not valid_bounded_record_uri(item) then invalid("each " .. key .. " value must be a full AT-URI with a DID authority") end elseif kind == "tagUri" then - local valid, collection = collection_valid_record_uri(item) + local valid, collection = valid_bounded_record_uri(item) if not valid or collection ~= "org.hypercerts.vocab.tag" then invalid("each tagUris value must be a full org.hypercerts.vocab.tag AT-URI with a DID authority") end @@ -59,7 +59,7 @@ end local function collection_list_cursor_decode(token, direction) return decode_cursor(token, direction, function(value) - local valid, collection = collection_valid_record_uri(value.u) + local valid, collection = valid_bounded_record_uri(value.u) return valid_datetime(value.t) and valid and collection == COLLECTION end) end diff --git a/happyview-modules/lua/shared/collectionProjection.lua b/happyview-modules/lua/shared/collectionProjection.lua index 074c5dc1..58cf17e3 100644 --- a/happyview-modules/lua/shared/collectionProjection.lua +++ b/happyview-modules/lua/shared/collectionProjection.lua @@ -4,11 +4,6 @@ local COLLECTION_PROJECTION_LOCATION = "app.certified.location" local COLLECTION_PROJECTION_TAG = "org.hypercerts.vocab.tag" local COLLECTION_PROJECTION_NULL = json.decode("null") -local function collection_projection_valid_record_uri(value) - if type(value) ~= "string" or #value > 8192 then return false end - return valid_record_uri(value) -end - local function collection_projection_query(sql, values) if db.backend() ~= "postgres" then error("CollectionQueryFailed: collection API requires PostgreSQL", 0) @@ -86,7 +81,7 @@ local function collection_projection_reference(value, field, expected_collection if omit_invalid then return nil end error("CollectionQueryFailed: indexed collection has an invalid " .. field .. " reference", 0) end - local valid, collection = collection_projection_valid_record_uri(value.uri) + local valid, collection = valid_bounded_record_uri(value.uri) if not valid then if omit_invalid then return nil end error("CollectionQueryFailed: indexed collection has an invalid " .. field .. " reference", 0) diff --git a/happyview-modules/lua/shared/evmLinkIdentifier.lua b/happyview-modules/lua/shared/evmLinkIdentifier.lua index 89cd72a7..37a13c10 100644 --- a/happyview-modules/lua/shared/evmLinkIdentifier.lua +++ b/happyview-modules/lua/shared/evmLinkIdentifier.lua @@ -3,9 +3,7 @@ local EVMLINK_COLLECTION = "app.certified.link.evm" local function valid_evm_link_uri(value) if type(value) ~= "string" or value:find("[?#]") then return false end local valid, collection = valid_record_uri(value) - if not valid or collection ~= EVMLINK_COLLECTION then return false end - local authority = value:match("^at://([^/]+)/") - return valid_did(authority) + return valid and collection == EVMLINK_COLLECTION end local function evm_link_record_view(row) diff --git a/happyview-modules/lua/shared/measurementQuery.lua b/happyview-modules/lua/shared/measurementQuery.lua index 3408b7b9..93187afd 100644 --- a/happyview-modules/lua/shared/measurementQuery.lua +++ b/happyview-modules/lua/shared/measurementQuery.lua @@ -1,10 +1,6 @@ local MEASUREMENT = "org.hypercerts.context.measurement" local MEASUREMENT_NULL = json.decode("null") -local function measurement_valid_record_uri(value) - return valid_record_uri(value) -end - local function measurement_query(sql, values) if db.backend() ~= "postgres" then error("MeasurementQueryFailed: measurement queries require PostgreSQL", 0) diff --git a/happyview-modules/lua/shared/organizationList.lua b/happyview-modules/lua/shared/organizationList.lua index 0ee48c4f..338f1625 100644 --- a/happyview-modules/lua/shared/organizationList.lua +++ b/happyview-modules/lua/shared/organizationList.lua @@ -7,9 +7,9 @@ local function organization_actors(rows) end local function valid_organization_uri(value) - if type(value) ~= "string" or value:find("[?#]") then return false end - local authority, collection, rkey = value:match("^at://([^/]+)/([^/]+)/([^/]+)$") - return authority ~= nil and valid_did(authority) and collection == ORGANIZATION and rkey == "self" + local valid, collection = valid_record_uri(value) + -- The record key is the last path segment, so this suffix means rkey == "self". + return valid and collection == ORGANIZATION and value:sub(-5) == "/self" end local function array(params, key) diff --git a/happyview-modules/lua/shared/profileList.lua b/happyview-modules/lua/shared/profileList.lua index b2af0734..de57432a 100644 --- a/happyview-modules/lua/shared/profileList.lua +++ b/happyview-modules/lua/shared/profileList.lua @@ -1,7 +1,7 @@ local function valid_profile_uri(value) - if type(value) ~= "string" or value:find("[?#]") then return false end - local authority, collection, rkey = value:match("^at://([^/]+)/([^/]+)/([^/]+)$") - return authority ~= nil and valid_did(authority) and collection == PROFILE and rkey == "self" + local valid, collection = valid_record_uri(value) + -- The record key is the last path segment, so this suffix means rkey == "self". + return valid and collection == PROFILE and value:sub(-5) == "/self" end local function array(params, key) diff --git a/happyview-modules/lua/shared/recentFollows.lua b/happyview-modules/lua/shared/recentFollows.lua index f2bcc035..4df9d9c4 100644 --- a/happyview-modules/lua/shared/recentFollows.lua +++ b/happyview-modules/lua/shared/recentFollows.lua @@ -2,7 +2,7 @@ local ACCOUNT_FOLLOW = "app.certified.graph.follow" local ENTITY_FOLLOW = "app.certified.graph.entityFollow" local NULL = json.decode("null") -local function recent_valid_record_uri(value) +local function is_recent_follow_uri(value) local valid, collection = valid_record_uri(value) return valid and (collection == ACCOUNT_FOLLOW or collection == ENTITY_FOLLOW) end @@ -27,7 +27,7 @@ local function recent_cursor_decode(token, before) for key in pairs(value) do if key ~= "v" and key ~= "t" and key ~= "u" and key ~= "b" then invalid("cursor is malformed") end end - if not recent_valid_datetime(value.t) or not recent_valid_record_uri(value.u) + if not recent_valid_datetime(value.t) or not is_recent_follow_uri(value.u) or value.b ~= (before or false) then invalid("cursor is malformed or belongs to another before value") end diff --git a/happyview-modules/lua/shared/rightsIdentifier.lua b/happyview-modules/lua/shared/rightsIdentifier.lua index e2dd2d12..e69de29b 100644 --- a/happyview-modules/lua/shared/rightsIdentifier.lua +++ b/happyview-modules/lua/shared/rightsIdentifier.lua @@ -1,3 +0,0 @@ -local function rights_valid_record_uri(value) - return valid_record_uri(value) -end diff --git a/happyview-modules/lua/shared/workscopeTag.lua b/happyview-modules/lua/shared/workscopeTag.lua index 3063ab76..6a09711f 100644 --- a/happyview-modules/lua/shared/workscopeTag.lua +++ b/happyview-modules/lua/shared/workscopeTag.lua @@ -1,10 +1,6 @@ local WORKSCOPE_TAG = "org.hypercerts.workscope.tag" local WORKSCOPE_TAG_NULL = json.decode("null") -local function workscope_tag_valid_record_uri(value) - return valid_record_uri(value) -end - local function workscope_tag_query(sql, values) if db.backend() ~= "postgres" then error("WorkscopeTagQueryFailed: workscope-tag API requires PostgreSQL", 0) diff --git a/happyview-modules/lua/shared/workscopeTagList.lua b/happyview-modules/lua/shared/workscopeTagList.lua index 7b5a553f..a4be7767 100644 --- a/happyview-modules/lua/shared/workscopeTagList.lua +++ b/happyview-modules/lua/shared/workscopeTagList.lua @@ -38,7 +38,7 @@ end local function workscope_tag_decode_cursor(token, direction) return decode_cursor(token, direction, function(value) - local valid, collection = workscope_tag_valid_record_uri(value.u) + local valid, collection = valid_record_uri(value.u) return valid_datetime(value.t) and valid and collection == WORKSCOPE_TAG end) end diff --git a/happyview-modules/lua/src/getCollection.lua b/happyview-modules/lua/src/getCollection.lua index 98d5dd48..27472ed7 100644 --- a/happyview-modules/lua/src/getCollection.lua +++ b/happyview-modules/lua/src/getCollection.lua @@ -1,7 +1,7 @@ function handle() keys_only(params, { uri = true }, "unknown query parameter: ") local uri = scalar(params, "uri") - local valid, collection = collection_valid_record_uri(uri) + local valid, collection = valid_bounded_record_uri(uri) if not uri or not valid or collection ~= COLLECTION then invalid("uri must be a full org.hypercerts.collection AT-URI with a DID authority") end diff --git a/happyview-modules/lua/src/getMeasurement.lua b/happyview-modules/lua/src/getMeasurement.lua index bee7ec29..d39af7fe 100644 --- a/happyview-modules/lua/src/getMeasurement.lua +++ b/happyview-modules/lua/src/getMeasurement.lua @@ -1,7 +1,7 @@ function handle() keys_only(params, { uri = true }) local uri = scalar(params, "uri") - local valid, collection = measurement_valid_record_uri(uri) + local valid, collection = valid_record_uri(uri) if not uri or not valid or collection ~= MEASUREMENT then invalid("uri must be a full " .. MEASUREMENT .. " AT-URI with a DID authority") end diff --git a/happyview-modules/lua/src/getRights.lua b/happyview-modules/lua/src/getRights.lua index 5f1d5836..e09cf980 100644 --- a/happyview-modules/lua/src/getRights.lua +++ b/happyview-modules/lua/src/getRights.lua @@ -12,7 +12,7 @@ end function handle() keys_only(params, { uri = true }) local uri = scalar(params, "uri") - local valid, collection = rights_valid_record_uri(uri) + local valid, collection = valid_record_uri(uri) if not uri or not valid or collection ~= RIGHTS then invalid("uri must be a full org.hypercerts.claim.rights AT-URI with a DID authority") end diff --git a/happyview-modules/lua/src/getWorkscopeTag.lua b/happyview-modules/lua/src/getWorkscopeTag.lua index 00ff7671..67304bbe 100644 --- a/happyview-modules/lua/src/getWorkscopeTag.lua +++ b/happyview-modules/lua/src/getWorkscopeTag.lua @@ -1,6 +1,6 @@ local function workscope_tag_get(uri) keys_only(params, { uri = true }) - local valid, collection = workscope_tag_valid_record_uri(uri) + local valid, collection = valid_record_uri(uri) if not uri or not valid or collection ~= WORKSCOPE_TAG then invalid("uri must be a full org.hypercerts.workscope.tag AT-URI with a DID authority") end diff --git a/happyview-modules/lua/src/listMeasurements.lua b/happyview-modules/lua/src/listMeasurements.lua index d20be61b..82172e59 100644 --- a/happyview-modules/lua/src/listMeasurements.lua +++ b/happyview-modules/lua/src/listMeasurements.lua @@ -28,7 +28,7 @@ local function measurement_array(key, format) if format == "did" and not valid_did(item) then invalid("each " .. key .. " value must be a valid DID") elseif format == "at-uri" then - local valid, collection = measurement_valid_record_uri(item) + local valid, collection = valid_record_uri(item) if not valid or not valid_nsid(collection) then invalid("each " .. key .. " value must be a full AT-URI with a DID authority and valid collection NSID") end @@ -52,7 +52,7 @@ end local function decode_measurement_cursor(token, direction) return decode_cursor(token, direction, function(value) - local valid, collection = measurement_valid_record_uri(value.u) + local valid, collection = valid_record_uri(value.u) return valid_datetime(value.t) and valid and collection == MEASUREMENT end) end diff --git a/happyview-modules/lua/src/listRights.lua b/happyview-modules/lua/src/listRights.lua index fdddd392..985665b9 100644 --- a/happyview-modules/lua/src/listRights.lua +++ b/happyview-modules/lua/src/listRights.lua @@ -43,7 +43,7 @@ end local function rights_list_cursor_decode(token, direction) return decode_cursor(token, direction, function(value) - local valid, collection = rights_valid_record_uri(value.u) + local valid, collection = valid_record_uri(value.u) return valid_datetime(value.t) and valid and collection == RIGHTS end) end diff --git a/happyview-modules/modules/collection/manifest.json b/happyview-modules/modules/collection/manifest.json index e5a7440a..554104ad 100644 --- a/happyview-modules/modules/collection/manifest.json +++ b/happyview-modules/modules/collection/manifest.json @@ -9,6 +9,7 @@ "../../lua/shared/didValidation.lua", "../../lua/shared/query.lua", "../../lua/shared/recordIdentifier.lua", + "../../lua/shared/boundedRecordIdentifier.lua", "../../lua/shared/collectionProjection.lua", "../../lua/shared/collection.lua" ], @@ -36,6 +37,7 @@ "sharedSourcePaths": [ "../../lua/shared/didValidation.lua", "../../lua/shared/recordIdentifier.lua", + "../../lua/shared/boundedRecordIdentifier.lua", "../../lua/shared/collectionProjection.lua", "../../lua/shared/collection.lua", "../../lua/shared/datetimeValidation.lua", @@ -72,6 +74,7 @@ "sharedSourcePaths": [ "../../lua/shared/didValidation.lua", "../../lua/shared/recordIdentifier.lua", + "../../lua/shared/boundedRecordIdentifier.lua", "../../lua/shared/collectionProjection.lua", "../../lua/shared/collection.lua", "../../lua/shared/datetimeValidation.lua", diff --git a/happyview-modules/modules/entity-follow/manifest.json b/happyview-modules/modules/entity-follow/manifest.json index d5c40dd0..1df9ac0b 100644 --- a/happyview-modules/modules/entity-follow/manifest.json +++ b/happyview-modules/modules/entity-follow/manifest.json @@ -119,6 +119,7 @@ "../../lua/shared/didValidation.lua", "../../lua/shared/query.lua", "../../lua/shared/recordIdentifier.lua", + "../../lua/shared/boundedRecordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", "../../lua/shared/listQuery.lua", diff --git a/happyview-modules/modules/profile/manifest.json b/happyview-modules/modules/profile/manifest.json index 8d1689fa..6b830209 100644 --- a/happyview-modules/modules/profile/manifest.json +++ b/happyview-modules/modules/profile/manifest.json @@ -84,6 +84,7 @@ "sharedSourcePaths": [ "../../lua/shared/didValidation.lua", "../../lua/shared/query.lua", + "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", "../../lua/shared/listQuery.lua", @@ -107,6 +108,7 @@ "sharedSourcePaths": [ "../../lua/shared/didValidation.lua", "../../lua/shared/query.lua", + "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", "../../lua/shared/listQuery.lua", diff --git a/happyview-modules/modules/rights/manifest.json b/happyview-modules/modules/rights/manifest.json index fa6d52cd..a307fa40 100644 --- a/happyview-modules/modules/rights/manifest.json +++ b/happyview-modules/modules/rights/manifest.json @@ -16,7 +16,6 @@ "../../lua/shared/didValidation.lua", "../../lua/shared/query.lua", "../../lua/shared/recordIdentifier.lua", - "../../lua/shared/rightsIdentifier.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", "../../lua/shared/rightsView.lua" @@ -40,7 +39,6 @@ "../../lua/shared/didValidation.lua", "../../lua/shared/query.lua", "../../lua/shared/recordIdentifier.lua", - "../../lua/shared/rightsIdentifier.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", "../../lua/shared/rightsView.lua", diff --git a/happyview-modules/tooling/shared-helpers.registry.json b/happyview-modules/tooling/shared-helpers.registry.json index 4cc0731a..0698ef16 100644 --- a/happyview-modules/tooling/shared-helpers.registry.json +++ b/happyview-modules/tooling/shared-helpers.registry.json @@ -30,7 +30,7 @@ "description": "the AT-URI parsing pattern" } ], - "homes": ["lua/shared/recordIdentifier.lua"] + "homes": ["lua/shared/recordIdentifier.lua", "lua/shared/boundedRecordIdentifier.lua"] }, { "id": "datetime-validation", @@ -215,12 +215,6 @@ "symbol": "attachment_array", "reason": "Existing endpoint-local repeated-parameter parser; no shared parser exists yet. Kept to avoid a behavior change." }, - { - "file": "lua/shared/collection.lua", - "family": "record-identifier", - "symbol": "collection_valid_record_uri", - "reason": "Existing record-URI check that predates the registry; kept to avoid a behavior change. Build on valid_record_uri where the shape allows." - }, { "file": "lua/shared/collectionItems.lua", "family": "list-cursor", @@ -275,12 +269,6 @@ "symbol": "collection_array", "reason": "Existing endpoint-local repeated-parameter parser; no shared parser exists yet. Kept to avoid a behavior change." }, - { - "file": "lua/shared/collectionProjection.lua", - "family": "record-identifier", - "symbol": "collection_projection_valid_record_uri", - "reason": "Existing record-URI check that predates the registry; kept to avoid a behavior change. Build on valid_record_uri where the shape allows." - }, { "file": "lua/shared/collectionProjection.lua", "family": "record-view", @@ -323,12 +311,6 @@ "symbol": "evaluation_array", "reason": "Existing endpoint-local repeated-parameter parser; no shared parser exists yet. Kept to avoid a behavior change." }, - { - "file": "lua/shared/evmLinkIdentifier.lua", - "family": "record-identifier", - "symbol": "at-uri-pattern", - "reason": "Existing record-URI check that predates the registry; kept to avoid a behavior change. Build on valid_record_uri where the shape allows." - }, { "file": "lua/shared/evmLinkIdentifier.lua", "family": "record-view", @@ -371,24 +353,12 @@ "symbol": "funding_receipt_array", "reason": "Existing endpoint-local repeated-parameter parser; no shared parser exists yet. Kept to avoid a behavior change." }, - { - "file": "lua/shared/measurementQuery.lua", - "family": "record-identifier", - "symbol": "measurement_valid_record_uri", - "reason": "Existing record-URI check that predates the registry; kept to avoid a behavior change. Build on valid_record_uri where the shape allows." - }, { "file": "lua/shared/organizationList.lua", "family": "list-cursor", "symbol": "cursor-hex-decode", "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." }, - { - "file": "lua/shared/organizationList.lua", - "family": "record-identifier", - "symbol": "at-uri-pattern", - "reason": "Existing record-URI check that predates the registry; kept to avoid a behavior change. Build on valid_record_uri where the shape allows." - }, { "file": "lua/shared/organizationList.lua", "family": "repeated-query-array", @@ -401,12 +371,6 @@ "symbol": "cursor-hex-decode", "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." }, - { - "file": "lua/shared/profileList.lua", - "family": "record-identifier", - "symbol": "at-uri-pattern", - "reason": "Existing record-URI check that predates the registry; kept to avoid a behavior change. Build on valid_record_uri where the shape allows." - }, { "file": "lua/shared/recentFollows.lua", "family": "list-cursor", @@ -425,24 +389,12 @@ "symbol": "recent_cursor_encode", "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." }, - { - "file": "lua/shared/recentFollows.lua", - "family": "record-identifier", - "symbol": "recent_valid_record_uri", - "reason": "Existing record-URI check that predates the registry; kept to avoid a behavior change. Build on valid_record_uri where the shape allows." - }, { "file": "lua/shared/recentFollows.lua", "family": "record-view", "symbol": "recent_record_view", "reason": "Existing record view with endpoint-specific fields; kept to avoid a behavior change. Build on record_view where the shape allows." }, - { - "file": "lua/shared/rightsIdentifier.lua", - "family": "record-identifier", - "symbol": "rights_valid_record_uri", - "reason": "Existing record-URI check that predates the registry; kept to avoid a behavior change. Build on valid_record_uri where the shape allows." - }, { "file": "lua/shared/rightsView.lua", "family": "actor-view", @@ -461,12 +413,6 @@ "symbol": "hydrate_vocab_actor_views", "reason": "Existing actor hydration variant; kept to avoid a behavior change. Build on hydrate_actor_views where the shape allows." }, - { - "file": "lua/shared/workscopeTag.lua", - "family": "record-identifier", - "symbol": "workscope_tag_valid_record_uri", - "reason": "Existing record-URI check that predates the registry; kept to avoid a behavior change. Build on valid_record_uri where the shape allows." - }, { "file": "lua/shared/workscopeTagList.lua", "family": "list-cursor", From 7210634d45f950ab3e35afedbd2461c46c4bda58 Mon Sep 17 00:00:00 2001 From: kzoeps Date: Thu, 26 Nov 2026 18:03:12 +0600 Subject: [PATCH 3/8] lua: share boolean-tolerant scalar and includeTotal parsing The activity and collection hasOrganizationRecord twins become one shared scalar_or_boolean. listBadgeAwards uses the shared parse_include_total, and listCollectionItems calls invalid and keys_only directly. No behavior change: list golden is byte-identical. --- .../lua/endpoints/listActivities.lua | 16 ++++---- .../lua/endpoints/listBadgeAwards.lua | 22 +++++------ .../lua/endpoints/listCollectionItems.lua | 18 +++------ .../lua/endpoints/listCollections.lua | 14 ++++--- .../lua/endpoints/searchActivities.lua | 16 ++++---- .../lua/endpoints/searchCollections.lua | 14 ++++--- happyview-modules/lua/shared/activityList.lua | 9 +---- .../lua/shared/collectionItems.lua | 18 +++------ .../lua/shared/collectionList.lua | 7 +--- .../lua/shared/scalarOrBoolean.lua | 6 +++ happyview-modules/lua/src/listBadgeAwards.lua | 12 +----- .../modules/activity/manifest.json | 2 + .../modules/badge-queries/manifest.json | 1 + .../modules/collection/manifest.json | 2 + .../tooling/shared-helpers.registry.json | 38 +------------------ 15 files changed, 68 insertions(+), 127 deletions(-) create mode 100644 happyview-modules/lua/shared/scalarOrBoolean.lua diff --git a/happyview-modules/lua/endpoints/listActivities.lua b/happyview-modules/lua/endpoints/listActivities.lua index c4d88543..c7cf22da 100644 --- a/happyview-modules/lua/endpoints/listActivities.lua +++ b/happyview-modules/lua/endpoints/listActivities.lua @@ -217,6 +217,13 @@ local function scalar(params, key) return tostring(value) end +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end + local ACTIVITY = "org.hypercerts.claim.activity" local function query(sql, values) @@ -340,13 +347,6 @@ local function parse_include_total(values) invalid("includeTotal must be true or false") end -local function activity_scalar(values, key) - if key == "hasOrganizationRecord" and type(values[key]) == "boolean" then - return tostring(values[key]) - end - return scalar(values, key) -end - local function activity_array(key, format) local value = params[key] if value == nil then return nil end @@ -518,7 +518,7 @@ local function activity_list_response(search_enabled) keys_only(params, allowed, "unknown query parameter: ") local authors = activity_array("authors", "did") - local has_organization_record = activity_scalar(params, "hasOrganizationRecord") + local has_organization_record = scalar_or_boolean(params, "hasOrganizationRecord") if has_organization_record ~= nil then if has_organization_record == "true" then has_organization_record = true diff --git a/happyview-modules/lua/endpoints/listBadgeAwards.lua b/happyview-modules/lua/endpoints/listBadgeAwards.lua index d57d0cb9..b5ce5f7e 100644 --- a/happyview-modules/lua/endpoints/listBadgeAwards.lua +++ b/happyview-modules/lua/endpoints/listBadgeAwards.lua @@ -19,6 +19,16 @@ local function scalar(params, key) return tostring(value) end +local function parse_include_total(values) + local value = values.includeTotal + if value == nil then return false end + if type(value) == "boolean" then return value end + value = scalar(values, "includeTotal") + if value == "true" then return true end + if value == "false" then return false end + invalid("includeTotal must be true or false") +end + local function valid_did(value) if type(value) ~= "string" or #value > 2048 then return false end local method, specific = value:match("^did:([a-z]+):(.+)$") @@ -332,16 +342,6 @@ local function badge_award_view(row) return view end -local function parse_include_total() - local value = params.includeTotal - if value == nil then return false end - if type(value) == "boolean" then return value end - value = scalar(params, "includeTotal") - if value == "true" then return true end - if value == "false" then return false end - invalid("includeTotal must be true or false") -end - local function list_badge_awards(authors, badge_uris, badge_types, subjects, responses, limit, cursor, direction, include_total) local where, values = { "award.collection = $1" }, { AWARD } @@ -471,7 +471,7 @@ local function handle_list_badge_awards() local limit = parse_list_limit(params) local direction = parse_sort_direction(params) local cursor = decode_badge_award_cursor(scalar(params, "cursor"), direction) - local include_total = parse_include_total() + local include_total = parse_include_total(params) local views, next_cursor, total_count = list_badge_awards(authors, badge_uris, badge_types, subjects, responses, limit, cursor, direction, include_total) local response = { badgeAwards = toarray(views) } diff --git a/happyview-modules/lua/endpoints/listCollectionItems.lua b/happyview-modules/lua/endpoints/listCollectionItems.lua index 06d1f5b9..17ac3514 100644 --- a/happyview-modules/lua/endpoints/listCollectionItems.lua +++ b/happyview-modules/lua/endpoints/listCollectionItems.lua @@ -300,27 +300,19 @@ local ITEM_ACTIVITY = "org.hypercerts.claim.activity" local ITEM_FEATURE = "org.hypercerts.entity.feature" local ITEM_NULL = json.decode("null") -local function collection_items_invalid(message) - error("InvalidRequest: " .. message, 0) -end - -local function collection_items_keys_only(values, allowed) - keys_only(values, allowed, "unknown query parameter: ") -end - local function collection_items_cursor_decode(token, collection_uri) if token == nil then return nil end if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - collection_items_invalid("cursor is malformed") + invalid("cursor is malformed") end local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.u ~= collection_uri or type(value.i) ~= "number" or value.i < 1 or value.i % 1 ~= 0 then - collection_items_invalid("cursor is malformed or belongs to another collection") + invalid("cursor is malformed or belongs to another collection") end for key in pairs(value) do - if key ~= "v" and key ~= "u" and key ~= "i" then collection_items_invalid("cursor is malformed") end + if key ~= "v" and key ~= "u" and key ~= "i" then invalid("cursor is malformed") end end return value end @@ -445,11 +437,11 @@ local function collection_items_resolve(items) end local function collection_items_response() - collection_items_keys_only(params, { collection = true, limit = true, cursor = true }) + keys_only(params, { collection = true, limit = true, cursor = true }, "unknown query parameter: ") local collection_uri = scalar(params, "collection") local valid, collection = valid_record_uri(collection_uri) if not collection_uri or not valid or collection ~= ITEM_COLLECTION then - collection_items_invalid("collection must be a full org.hypercerts.collection AT-URI with a DID authority") + invalid("collection must be a full org.hypercerts.collection AT-URI with a DID authority") end local limit = parse_list_limit(params) local cursor = collection_items_cursor_decode(scalar(params, "cursor"), collection_uri) diff --git a/happyview-modules/lua/endpoints/listCollections.lua b/happyview-modules/lua/endpoints/listCollections.lua index 91947ed6..b9860919 100644 --- a/happyview-modules/lua/endpoints/listCollections.lua +++ b/happyview-modules/lua/endpoints/listCollections.lua @@ -288,6 +288,13 @@ local function scalar(params, key) return tostring(value) end +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end + local function parse_list_limit(params) local limit_value = scalar(params, "limit") if limit_value and not limit_value:match("^%d+$") then invalid("limit must be an integer from 1 through 100") end @@ -353,11 +360,6 @@ local function parse_include_total(values) invalid("includeTotal must be true or false") end -local function collection_scalar(values, key) - if key == "hasOrganizationRecord" and type(values[key]) == "boolean" then return tostring(values[key]) end - return scalar(values, key) -end - local function collection_array(key, kind) local value = params[key] if value == nil then return nil end @@ -552,7 +554,7 @@ local function collection_list_response(search_enabled) keys_only(params, allowed, "unknown query parameter: ") local authors = collection_array("authors", "did") - local has_organization_record = collection_scalar(params, "hasOrganizationRecord") + local has_organization_record = scalar_or_boolean(params, "hasOrganizationRecord") if has_organization_record ~= nil then if has_organization_record == "true" then has_organization_record = true diff --git a/happyview-modules/lua/endpoints/searchActivities.lua b/happyview-modules/lua/endpoints/searchActivities.lua index b2981ff0..505a0102 100644 --- a/happyview-modules/lua/endpoints/searchActivities.lua +++ b/happyview-modules/lua/endpoints/searchActivities.lua @@ -217,6 +217,13 @@ local function scalar(params, key) return tostring(value) end +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end + local ACTIVITY = "org.hypercerts.claim.activity" local function query(sql, values) @@ -340,13 +347,6 @@ local function parse_include_total(values) invalid("includeTotal must be true or false") end -local function activity_scalar(values, key) - if key == "hasOrganizationRecord" and type(values[key]) == "boolean" then - return tostring(values[key]) - end - return scalar(values, key) -end - local function activity_array(key, format) local value = params[key] if value == nil then return nil end @@ -518,7 +518,7 @@ local function activity_list_response(search_enabled) keys_only(params, allowed, "unknown query parameter: ") local authors = activity_array("authors", "did") - local has_organization_record = activity_scalar(params, "hasOrganizationRecord") + local has_organization_record = scalar_or_boolean(params, "hasOrganizationRecord") if has_organization_record ~= nil then if has_organization_record == "true" then has_organization_record = true diff --git a/happyview-modules/lua/endpoints/searchCollections.lua b/happyview-modules/lua/endpoints/searchCollections.lua index 57e05574..93001ba9 100644 --- a/happyview-modules/lua/endpoints/searchCollections.lua +++ b/happyview-modules/lua/endpoints/searchCollections.lua @@ -288,6 +288,13 @@ local function scalar(params, key) return tostring(value) end +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end + local function parse_list_limit(params) local limit_value = scalar(params, "limit") if limit_value and not limit_value:match("^%d+$") then invalid("limit must be an integer from 1 through 100") end @@ -353,11 +360,6 @@ local function parse_include_total(values) invalid("includeTotal must be true or false") end -local function collection_scalar(values, key) - if key == "hasOrganizationRecord" and type(values[key]) == "boolean" then return tostring(values[key]) end - return scalar(values, key) -end - local function collection_array(key, kind) local value = params[key] if value == nil then return nil end @@ -552,7 +554,7 @@ local function collection_list_response(search_enabled) keys_only(params, allowed, "unknown query parameter: ") local authors = collection_array("authors", "did") - local has_organization_record = collection_scalar(params, "hasOrganizationRecord") + local has_organization_record = scalar_or_boolean(params, "hasOrganizationRecord") if has_organization_record ~= nil then if has_organization_record == "true" then has_organization_record = true diff --git a/happyview-modules/lua/shared/activityList.lua b/happyview-modules/lua/shared/activityList.lua index 451c9581..23d02fc8 100644 --- a/happyview-modules/lua/shared/activityList.lua +++ b/happyview-modules/lua/shared/activityList.lua @@ -1,10 +1,3 @@ -local function activity_scalar(values, key) - if key == "hasOrganizationRecord" and type(values[key]) == "boolean" then - return tostring(values[key]) - end - return scalar(values, key) -end - local function activity_array(key, format) local value = params[key] if value == nil then return nil end @@ -176,7 +169,7 @@ local function activity_list_response(search_enabled) keys_only(params, allowed, "unknown query parameter: ") local authors = activity_array("authors", "did") - local has_organization_record = activity_scalar(params, "hasOrganizationRecord") + local has_organization_record = scalar_or_boolean(params, "hasOrganizationRecord") if has_organization_record ~= nil then if has_organization_record == "true" then has_organization_record = true diff --git a/happyview-modules/lua/shared/collectionItems.lua b/happyview-modules/lua/shared/collectionItems.lua index 6375399e..6a68ab24 100644 --- a/happyview-modules/lua/shared/collectionItems.lua +++ b/happyview-modules/lua/shared/collectionItems.lua @@ -3,27 +3,19 @@ local ITEM_ACTIVITY = "org.hypercerts.claim.activity" local ITEM_FEATURE = "org.hypercerts.entity.feature" local ITEM_NULL = json.decode("null") -local function collection_items_invalid(message) - error("InvalidRequest: " .. message, 0) -end - -local function collection_items_keys_only(values, allowed) - keys_only(values, allowed, "unknown query parameter: ") -end - local function collection_items_cursor_decode(token, collection_uri) if token == nil then return nil end if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - collection_items_invalid("cursor is malformed") + invalid("cursor is malformed") end local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.u ~= collection_uri or type(value.i) ~= "number" or value.i < 1 or value.i % 1 ~= 0 then - collection_items_invalid("cursor is malformed or belongs to another collection") + invalid("cursor is malformed or belongs to another collection") end for key in pairs(value) do - if key ~= "v" and key ~= "u" and key ~= "i" then collection_items_invalid("cursor is malformed") end + if key ~= "v" and key ~= "u" and key ~= "i" then invalid("cursor is malformed") end end return value end @@ -148,11 +140,11 @@ local function collection_items_resolve(items) end local function collection_items_response() - collection_items_keys_only(params, { collection = true, limit = true, cursor = true }) + keys_only(params, { collection = true, limit = true, cursor = true }, "unknown query parameter: ") local collection_uri = scalar(params, "collection") local valid, collection = valid_record_uri(collection_uri) if not collection_uri or not valid or collection ~= ITEM_COLLECTION then - collection_items_invalid("collection must be a full org.hypercerts.collection AT-URI with a DID authority") + invalid("collection must be a full org.hypercerts.collection AT-URI with a DID authority") end local limit = parse_list_limit(params) local cursor = collection_items_cursor_decode(scalar(params, "cursor"), collection_uri) diff --git a/happyview-modules/lua/shared/collectionList.lua b/happyview-modules/lua/shared/collectionList.lua index 698f1017..ac9e74dc 100644 --- a/happyview-modules/lua/shared/collectionList.lua +++ b/happyview-modules/lua/shared/collectionList.lua @@ -1,8 +1,3 @@ -local function collection_scalar(values, key) - if key == "hasOrganizationRecord" and type(values[key]) == "boolean" then return tostring(values[key]) end - return scalar(values, key) -end - local function collection_array(key, kind) local value = params[key] if value == nil then return nil end @@ -197,7 +192,7 @@ local function collection_list_response(search_enabled) keys_only(params, allowed, "unknown query parameter: ") local authors = collection_array("authors", "did") - local has_organization_record = collection_scalar(params, "hasOrganizationRecord") + local has_organization_record = scalar_or_boolean(params, "hasOrganizationRecord") if has_organization_record ~= nil then if has_organization_record == "true" then has_organization_record = true diff --git a/happyview-modules/lua/shared/scalarOrBoolean.lua b/happyview-modules/lua/shared/scalarOrBoolean.lua new file mode 100644 index 00000000..fa285b3d --- /dev/null +++ b/happyview-modules/lua/shared/scalarOrBoolean.lua @@ -0,0 +1,6 @@ +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end diff --git a/happyview-modules/lua/src/listBadgeAwards.lua b/happyview-modules/lua/src/listBadgeAwards.lua index cb2c291b..8915e043 100644 --- a/happyview-modules/lua/src/listBadgeAwards.lua +++ b/happyview-modules/lua/src/listBadgeAwards.lua @@ -174,16 +174,6 @@ local function badge_award_view(row) return view end -local function parse_include_total() - local value = params.includeTotal - if value == nil then return false end - if type(value) == "boolean" then return value end - value = scalar(params, "includeTotal") - if value == "true" then return true end - if value == "false" then return false end - invalid("includeTotal must be true or false") -end - local function list_badge_awards(authors, badge_uris, badge_types, subjects, responses, limit, cursor, direction, include_total) local where, values = { "award.collection = $1" }, { AWARD } @@ -313,7 +303,7 @@ local function handle_list_badge_awards() local limit = parse_list_limit(params) local direction = parse_sort_direction(params) local cursor = decode_badge_award_cursor(scalar(params, "cursor"), direction) - local include_total = parse_include_total() + local include_total = parse_include_total(params) local views, next_cursor, total_count = list_badge_awards(authors, badge_uris, badge_types, subjects, responses, limit, cursor, direction, include_total) local response = { badgeAwards = toarray(views) } diff --git a/happyview-modules/modules/activity/manifest.json b/happyview-modules/modules/activity/manifest.json index 7e6d5216..d5e3c759 100644 --- a/happyview-modules/modules/activity/manifest.json +++ b/happyview-modules/modules/activity/manifest.json @@ -48,6 +48,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/activityProjection.lua", "../../lua/shared/query.lua", + "../../lua/shared/scalarOrBoolean.lua", "../../lua/shared/activity.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", @@ -74,6 +75,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/activityProjection.lua", "../../lua/shared/query.lua", + "../../lua/shared/scalarOrBoolean.lua", "../../lua/shared/activity.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", diff --git a/happyview-modules/modules/badge-queries/manifest.json b/happyview-modules/modules/badge-queries/manifest.json index bec7aa3e..10b94b9f 100644 --- a/happyview-modules/modules/badge-queries/manifest.json +++ b/happyview-modules/modules/badge-queries/manifest.json @@ -103,6 +103,7 @@ "sourcePath": "../../lua/src/listBadgeAwards.lua", "sharedSourcePaths": [ "../../lua/shared/query.lua", + "../../lua/shared/includeTotal.lua", "../../lua/shared/didValidation.lua", "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", diff --git a/happyview-modules/modules/collection/manifest.json b/happyview-modules/modules/collection/manifest.json index 554104ad..39546cff 100644 --- a/happyview-modules/modules/collection/manifest.json +++ b/happyview-modules/modules/collection/manifest.json @@ -43,6 +43,7 @@ "../../lua/shared/datetimeValidation.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/query.lua", + "../../lua/shared/scalarOrBoolean.lua", "../../lua/shared/listValidation.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/listCursor.lua", @@ -80,6 +81,7 @@ "../../lua/shared/datetimeValidation.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/query.lua", + "../../lua/shared/scalarOrBoolean.lua", "../../lua/shared/listValidation.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/listCursor.lua", diff --git a/happyview-modules/tooling/shared-helpers.registry.json b/happyview-modules/tooling/shared-helpers.registry.json index 0698ef16..30958433 100644 --- a/happyview-modules/tooling/shared-helpers.registry.json +++ b/happyview-modules/tooling/shared-helpers.registry.json @@ -100,7 +100,7 @@ "description": "single-value parameter parsing" } ], - "homes": ["lua/shared/query.lua"] + "homes": ["lua/shared/query.lua", "lua/shared/scalarOrBoolean.lua"] }, { "id": "repeated-query-array", @@ -166,12 +166,6 @@ "symbol": "decode_activity_cursor", "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." }, - { - "file": "lua/shared/activityList.lua", - "family": "query-params", - "symbol": "activity_scalar", - "reason": "Existing endpoint-local copy of the shared query helpers; kept to avoid a behavior change. Use query.lua helpers instead." - }, { "file": "lua/shared/activityList.lua", "family": "record-identifier", @@ -239,30 +233,12 @@ "symbol": "cursor-length-cap", "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." }, - { - "file": "lua/shared/collectionItems.lua", - "family": "query-params", - "symbol": "collection_items_invalid", - "reason": "Existing endpoint-local copy of the shared query helpers; kept to avoid a behavior change. Use query.lua helpers instead." - }, - { - "file": "lua/shared/collectionItems.lua", - "family": "query-params", - "symbol": "collection_items_keys_only", - "reason": "Existing endpoint-local copy of the shared query helpers; kept to avoid a behavior change. Use query.lua helpers instead." - }, { "file": "lua/shared/collectionList.lua", "family": "list-cursor", "symbol": "collection_list_cursor_decode", "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." }, - { - "file": "lua/shared/collectionList.lua", - "family": "query-params", - "symbol": "collection_scalar", - "reason": "Existing endpoint-local copy of the shared query helpers; kept to avoid a behavior change. Use query.lua helpers instead." - }, { "file": "lua/shared/collectionList.lua", "family": "repeated-query-array", @@ -437,12 +413,6 @@ "symbol": "decode_badge_award_cursor", "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." }, - { - "file": "lua/src/listBadgeAwards.lua", - "family": "list-params", - "symbol": "include-total-message", - "reason": "Existing endpoint-local list parameter parsing; kept to avoid a behavior change. Use includeTotal.lua instead." - }, { "file": "lua/src/listBadgeAwards.lua", "family": "repeated-query-array", @@ -677,12 +647,6 @@ "symbol": "query", "reason": "Per-module query entry point that shares a name; not a reusable helper." }, - { - "file": "lua/src/listBadgeAwards.lua", - "family": "shared-helper", - "symbol": "parse_include_total", - "reason": "Existing duplicate of a lua/shared helper; baseline until the consolidation PRs land." - }, { "file": "lua/src/listBadgeDefinitions.lua", "family": "shared-helper", From 1db9b4301738ba2288b3f6b732ad8820ddac9650 Mon Sep 17 00:00:00 2001 From: kzoeps Date: Thu, 26 Nov 2026 18:06:22 +0600 Subject: [PATCH 4/8] lua: share record cursor decoding and cursor encoding Adds decode_record_cursor (collection or URI predicate, optional timestamp check) and splits the hex prologue into cursorToken.lua and cursor_encode into cursorEncode.lua so bundles that only need one do not carry unused helpers. The per-endpoint decode wrappers and the collection-items and recent-follows encoders are deleted. Hand-rolled decoders are untouched. No behavior change: list golden is byte-identical. --- .../lua/endpoints/getActorLikes.lua | 48 +++++--- .../lua/endpoints/getActorReposts.lua | 48 +++++--- happyview-modules/lua/endpoints/getLikes.lua | 48 +++++--- .../lua/endpoints/getReposts.lua | 48 +++++--- .../lua/endpoints/listAcknowledgements.lua | 44 ++++--- .../lua/endpoints/listActivities.lua | 44 ++++--- .../lua/endpoints/listActorFollowers.lua | 11 +- .../lua/endpoints/listActorFollowing.lua | 11 +- .../lua/endpoints/listAttachments.lua | 47 +++++--- .../lua/endpoints/listBadgeAwards.lua | 11 +- .../lua/endpoints/listBadgeDefinitions.lua | 11 +- .../lua/endpoints/listBadgeResponses.lua | 11 +- .../lua/endpoints/listCollectionItems.lua | 29 +++-- .../lua/endpoints/listCollections.lua | 44 ++++--- .../lua/endpoints/listContributions.lua | 48 +++++--- .../endpoints/listContributorInformation.lua | 43 ++++--- .../lua/endpoints/listEntityFollowers.lua | 48 +++++--- .../lua/endpoints/listEntityFollowing.lua | 50 +++++--- .../lua/endpoints/listEvaluations.lua | 48 +++++--- .../lua/endpoints/listEvmLinks.lua | 11 +- .../lua/endpoints/listFeatures.lua | 11 +- .../lua/endpoints/listLocations.lua | 11 +- .../lua/endpoints/listMeasurements.lua | 48 +++++--- .../lua/endpoints/listOrganizations.lua | 11 +- .../lua/endpoints/listProfiles.lua | 11 +- .../lua/endpoints/listReceipts.lua | 44 ++++--- .../lua/endpoints/listRecentFollows.lua | 13 ++- .../lua/endpoints/listRights.lua | 44 ++++--- .../lua/endpoints/listVocabTags.lua | 11 +- .../lua/endpoints/listWorkscopeTags.lua | 48 +++++--- .../lua/endpoints/searchActivities.lua | 44 ++++--- .../lua/endpoints/searchBadgeDefinitions.lua | 11 +- .../lua/endpoints/searchCollections.lua | 44 ++++--- .../lua/endpoints/searchOrganizations.lua | 11 +- .../lua/endpoints/searchProfiles.lua | 11 +- .../lua/shared/acknowledgementList.lua | 9 +- happyview-modules/lua/shared/activityList.lua | 9 +- .../lua/shared/attachmentList.lua | 8 +- .../lua/shared/collectionItems.lua | 13 +-- .../lua/shared/collectionList.lua | 9 +- happyview-modules/lua/shared/cursorEncode.lua | 5 + happyview-modules/lua/shared/cursorToken.lua | 9 ++ .../lua/shared/entityFollowPagination.lua | 7 -- .../lua/shared/evaluationList.lua | 9 +- happyview-modules/lua/shared/feedReaction.lua | 9 +- .../lua/shared/fundingReceiptList.lua | 9 +- happyview-modules/lua/shared/listCursor.lua | 18 ++- happyview-modules/lua/shared/listQuery.lua | 5 - .../lua/shared/recentFollows.lua | 7 +- .../lua/shared/workscopeTagList.lua | 9 +- .../lua/src/listContributions.lua | 9 +- .../lua/src/listContributorInformation.lua | 8 +- .../lua/src/listEntityFollowers.lua | 2 +- .../lua/src/listEntityFollowing.lua | 4 +- .../lua/src/listMeasurements.lua | 9 +- happyview-modules/lua/src/listRights.lua | 9 +- .../modules/acknowledgements/manifest.json | 2 + .../modules/activity/manifest.json | 4 + .../modules/actor-follow/manifest.json | 2 + .../modules/badge-definitions/manifest.json | 1 + .../modules/badge-queries/manifest.json | 3 + .../modules/collection/manifest.json | 6 + .../modules/context-attachments/manifest.json | 2 + .../modules/context-evaluation/manifest.json | 2 + .../context-measurements/manifest.json | 2 + .../modules/contribution/manifest.json | 2 + .../contributor-information/manifest.json | 2 + .../modules/entity-follow/manifest.json | 4 + .../modules/evm-links/manifest.json | 1 + .../modules/features/manifest.json | 1 + .../modules/feed-reactions/manifest.json | 8 ++ .../modules/funding/manifest.json | 2 + .../modules/location/manifest.json | 1 + .../modules/organization/manifest.json | 2 + .../modules/profile/manifest.json | 2 + .../modules/recent-follows/manifest.json | 1 + .../modules/rights/manifest.json | 2 + happyview-modules/modules/vocab/manifest.json | 1 + .../modules/workscope-tags/manifest.json | 2 + .../unit/endpoints/rights-edge-lua.test.js | 2 + .../tests/unit/endpoints/rights-lua.test.js | 2 + happyview-modules/tests/unit/feature.test.js | 1 + .../tests/unit/lua/recentFollows.test.lua | 1 + .../listContributorInformation.test.js | 2 + .../tests/unit/tooling/vocab-tags.test.js | 1 + .../tooling/shared-helpers.registry.json | 109 +----------------- 86 files changed, 799 insertions(+), 626 deletions(-) create mode 100644 happyview-modules/lua/shared/cursorEncode.lua create mode 100644 happyview-modules/lua/shared/cursorToken.lua diff --git a/happyview-modules/lua/endpoints/getActorLikes.lua b/happyview-modules/lua/endpoints/getActorLikes.lua index 6973b374..fd9f8147 100644 --- a/happyview-modules/lua/endpoints/getActorLikes.lua +++ b/happyview-modules/lua/endpoints/getActorLikes.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local NULL = json.decode("null") local function record_view(row) @@ -124,16 +125,23 @@ local function hydrate_actor_views(actors, run_query) end end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -146,6 +154,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a @@ -183,13 +204,6 @@ local function feed_reaction_query(reaction, sql, values) return result end -local function feed_reaction_decode_cursor(token, direction, collection) - return decode_cursor(token, direction, function(value) - local valid, cursor_collection = valid_record_uri(value.u) - return valid and cursor_collection == collection and valid_datetime(value.t) - end) -end - local function feed_reaction_query_page(reaction, mode, identity, limit, cursor, direction) local filters, values = { "collection = $1" }, { reaction.collection, identity } if mode == "subject" then @@ -263,7 +277,7 @@ local function feed_reaction_list(reaction_name, mode) local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = feed_reaction_decode_cursor(scalar(params, "cursor"), direction, reaction.collection) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, reaction.collection) local sql, values = feed_reaction_query_page(reaction, mode, identity, limit, cursor, direction) local rows = feed_reaction_query(reaction, sql, values) diff --git a/happyview-modules/lua/endpoints/getActorReposts.lua b/happyview-modules/lua/endpoints/getActorReposts.lua index 84fb24ed..8a3f6574 100644 --- a/happyview-modules/lua/endpoints/getActorReposts.lua +++ b/happyview-modules/lua/endpoints/getActorReposts.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local NULL = json.decode("null") local function record_view(row) @@ -124,16 +125,23 @@ local function hydrate_actor_views(actors, run_query) end end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -146,6 +154,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a @@ -183,13 +204,6 @@ local function feed_reaction_query(reaction, sql, values) return result end -local function feed_reaction_decode_cursor(token, direction, collection) - return decode_cursor(token, direction, function(value) - local valid, cursor_collection = valid_record_uri(value.u) - return valid and cursor_collection == collection and valid_datetime(value.t) - end) -end - local function feed_reaction_query_page(reaction, mode, identity, limit, cursor, direction) local filters, values = { "collection = $1" }, { reaction.collection, identity } if mode == "subject" then @@ -263,7 +277,7 @@ local function feed_reaction_list(reaction_name, mode) local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = feed_reaction_decode_cursor(scalar(params, "cursor"), direction, reaction.collection) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, reaction.collection) local sql, values = feed_reaction_query_page(reaction, mode, identity, limit, cursor, direction) local rows = feed_reaction_query(reaction, sql, values) diff --git a/happyview-modules/lua/endpoints/getLikes.lua b/happyview-modules/lua/endpoints/getLikes.lua index 81d7fa6f..2714bb94 100644 --- a/happyview-modules/lua/endpoints/getLikes.lua +++ b/happyview-modules/lua/endpoints/getLikes.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local NULL = json.decode("null") local function record_view(row) @@ -124,16 +125,23 @@ local function hydrate_actor_views(actors, run_query) end end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -146,6 +154,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a @@ -183,13 +204,6 @@ local function feed_reaction_query(reaction, sql, values) return result end -local function feed_reaction_decode_cursor(token, direction, collection) - return decode_cursor(token, direction, function(value) - local valid, cursor_collection = valid_record_uri(value.u) - return valid and cursor_collection == collection and valid_datetime(value.t) - end) -end - local function feed_reaction_query_page(reaction, mode, identity, limit, cursor, direction) local filters, values = { "collection = $1" }, { reaction.collection, identity } if mode == "subject" then @@ -263,7 +277,7 @@ local function feed_reaction_list(reaction_name, mode) local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = feed_reaction_decode_cursor(scalar(params, "cursor"), direction, reaction.collection) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, reaction.collection) local sql, values = feed_reaction_query_page(reaction, mode, identity, limit, cursor, direction) local rows = feed_reaction_query(reaction, sql, values) diff --git a/happyview-modules/lua/endpoints/getReposts.lua b/happyview-modules/lua/endpoints/getReposts.lua index 98eed4e1..be481a2e 100644 --- a/happyview-modules/lua/endpoints/getReposts.lua +++ b/happyview-modules/lua/endpoints/getReposts.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local NULL = json.decode("null") local function record_view(row) @@ -124,16 +125,23 @@ local function hydrate_actor_views(actors, run_query) end end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -146,6 +154,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a @@ -183,13 +204,6 @@ local function feed_reaction_query(reaction, sql, values) return result end -local function feed_reaction_decode_cursor(token, direction, collection) - return decode_cursor(token, direction, function(value) - local valid, cursor_collection = valid_record_uri(value.u) - return valid and cursor_collection == collection and valid_datetime(value.t) - end) -end - local function feed_reaction_query_page(reaction, mode, identity, limit, cursor, direction) local filters, values = { "collection = $1" }, { reaction.collection, identity } if mode == "subject" then @@ -263,7 +277,7 @@ local function feed_reaction_list(reaction_name, mode) local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = feed_reaction_decode_cursor(scalar(params, "cursor"), direction, reaction.collection) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, reaction.collection) local sql, values = feed_reaction_query_page(reaction, mode, identity, limit, cursor, direction) local rows = feed_reaction_query(reaction, sql, values) diff --git a/happyview-modules/lua/endpoints/listAcknowledgements.lua b/happyview-modules/lua/endpoints/listAcknowledgements.lua index 0e43d197..f7bfc40c 100644 --- a/happyview-modules/lua/endpoints/listAcknowledgements.lua +++ b/happyview-modules/lua/endpoints/listAcknowledgements.lua @@ -148,15 +148,26 @@ local function valid_nsid(value) return #name <= 63 and name:match("^[A-Za-z][A-Za-z0-9]*$") ~= nil end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other @@ -165,10 +176,7 @@ end -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -181,6 +189,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then @@ -245,13 +266,6 @@ local function acknowledgement_array(key, format) return unique end -local function decode_acknowledgement_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid_cursor_timestamp(value.t) and valid and collection == ACKNOWLEDGEMENT - end) -end - local function acknowledgement_sort_expression() local created = "acknowledgement.record::jsonb->>'createdAt'" local pattern = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" @@ -303,7 +317,7 @@ local function list_acknowledgements() local subjects = acknowledgement_array("subjects", "at-uri") local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = decode_acknowledgement_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, ACKNOWLEDGEMENT, valid_cursor_timestamp) local rows = acknowledgement_list_query(authors, subjects, limit, cursor, direction) local acknowledgements = {} for index = 1, math.min(#rows, limit) do diff --git a/happyview-modules/lua/endpoints/listActivities.lua b/happyview-modules/lua/endpoints/listActivities.lua index c7cf22da..2ae45d20 100644 --- a/happyview-modules/lua/endpoints/listActivities.lua +++ b/happyview-modules/lua/endpoints/listActivities.lua @@ -290,15 +290,26 @@ local function created_at_sort(alias) "::timestamptz, " .. created_at .. "::timestamptz) END" end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other @@ -307,10 +318,7 @@ end -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -323,6 +331,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then @@ -389,13 +410,6 @@ local function activity_array(key, format) return unique end -local function decode_activity_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid_datetime(value.t) and valid and collection == ACTIVITY - end) -end - local function bind_values(values, items) local placeholders = {} for _, item in ipairs(items) do @@ -542,7 +556,7 @@ local function activity_list_response(search_enabled) if not search_enabled then include_total = parse_include_total(params) end local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = decode_activity_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, ACTIVITY) local activities, next_cursor, total_count = activity_query( authors, has_organization_record, contributors, involved_actors, uris, search, limit, cursor, direction, include_total) local response = { activities = toarray(activities) } diff --git a/happyview-modules/lua/endpoints/listActorFollowers.lua b/happyview-modules/lua/endpoints/listActorFollowers.lua index ccd58823..b40290d5 100644 --- a/happyview-modules/lua/endpoints/listActorFollowers.lua +++ b/happyview-modules/lua/endpoints/listActorFollowers.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local NULL = json.decode("null") local function record_view(row) diff --git a/happyview-modules/lua/endpoints/listActorFollowing.lua b/happyview-modules/lua/endpoints/listActorFollowing.lua index 5ca40982..fd101e0d 100644 --- a/happyview-modules/lua/endpoints/listActorFollowing.lua +++ b/happyview-modules/lua/endpoints/listActorFollowing.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local NULL = json.decode("null") local function record_view(row) diff --git a/happyview-modules/lua/endpoints/listAttachments.lua b/happyview-modules/lua/endpoints/listAttachments.lua index e4349b60..cd33c051 100644 --- a/happyview-modules/lua/endpoints/listAttachments.lua +++ b/happyview-modules/lua/endpoints/listAttachments.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local NULL = json.decode("null") local function record_view(row) @@ -158,16 +159,23 @@ local function hydrate_attachment_views(views) hydrate_actor_views(authors, attachment_query) end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -180,6 +188,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then @@ -261,12 +282,6 @@ local function attachment_subject_filter(where, values, subjects) "WHERE subject.value->>'uri' IN (" .. table.concat(placeholders, ", ") .. "))" end -local function attachment_cursor_decode(token, direction) - return decode_cursor(token, direction, function(value) - return valid_datetime(value.t) and valid_attachment_uri(value.u) - end) -end - local function query_attachments(filters, limit, cursor, direction) local where, values = { "attachment.collection = $1" }, { ATTACHMENT_COLLECTION } if filters.authors then add_in(where, values, "attachment.did", filters.authors) end @@ -330,7 +345,7 @@ local function list_attachments() local content_types = attachment_array(params, "contentTypes") local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = attachment_cursor_decode(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, valid_attachment_uri) local attachments, next_cursor = query_attachments({ authors = authors, uris = uris, diff --git a/happyview-modules/lua/endpoints/listBadgeAwards.lua b/happyview-modules/lua/endpoints/listBadgeAwards.lua index b5ce5f7e..5b48207c 100644 --- a/happyview-modules/lua/endpoints/listBadgeAwards.lua +++ b/happyview-modules/lua/endpoints/listBadgeAwards.lua @@ -81,17 +81,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a diff --git a/happyview-modules/lua/endpoints/listBadgeDefinitions.lua b/happyview-modules/lua/endpoints/listBadgeDefinitions.lua index 13c6383e..52dfd585 100644 --- a/happyview-modules/lua/endpoints/listBadgeDefinitions.lua +++ b/happyview-modules/lua/endpoints/listBadgeDefinitions.lua @@ -78,17 +78,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a diff --git a/happyview-modules/lua/endpoints/listBadgeResponses.lua b/happyview-modules/lua/endpoints/listBadgeResponses.lua index fdf71f02..de43aa2f 100644 --- a/happyview-modules/lua/endpoints/listBadgeResponses.lua +++ b/happyview-modules/lua/endpoints/listBadgeResponses.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a diff --git a/happyview-modules/lua/endpoints/listCollectionItems.lua b/happyview-modules/lua/endpoints/listCollectionItems.lua index 17ac3514..96ebe856 100644 --- a/happyview-modules/lua/endpoints/listCollectionItems.lua +++ b/happyview-modules/lua/endpoints/listCollectionItems.lua @@ -295,6 +295,22 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + local ITEM_COLLECTION = "org.hypercerts.collection" local ITEM_ACTIVITY = "org.hypercerts.claim.activity" local ITEM_FEATURE = "org.hypercerts.entity.feature" @@ -302,10 +318,7 @@ local ITEM_NULL = json.decode("null") local function collection_items_cursor_decode(token, collection_uri) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.u ~= collection_uri or type(value.i) ~= "number" or value.i < 1 or value.i % 1 ~= 0 then @@ -317,12 +330,6 @@ local function collection_items_cursor_decode(token, collection_uri) return value end -local function collection_items_cursor_encode(value) - return (json.encode(value):gsub(".", function(char) - return string.format("%02x", string.byte(char)) - end)) -end - local function collection_items_query(sql, values) if db.backend() ~= "postgres" then error("CollectionQueryFailed: collection API requires PostgreSQL", 0) @@ -483,7 +490,7 @@ local function collection_items_response() local response = { items = toarray(page) } if finish < #source_items then - response.cursor = collection_items_cursor_encode({ v = 1, u = collection_uri, i = finish }) + response.cursor = cursor_encode({ v = 1, u = collection_uri, i = finish }) end return response end diff --git a/happyview-modules/lua/endpoints/listCollections.lua b/happyview-modules/lua/endpoints/listCollections.lua index b9860919..221fd06b 100644 --- a/happyview-modules/lua/endpoints/listCollections.lua +++ b/happyview-modules/lua/endpoints/listCollections.lua @@ -303,15 +303,26 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other @@ -320,10 +331,7 @@ end -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -336,6 +344,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then @@ -414,13 +435,6 @@ local function collection_array(key, kind) return unique end -local function collection_list_cursor_decode(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_bounded_record_uri(value.u) - return valid_datetime(value.t) and valid and collection == COLLECTION - end) -end - local function collection_bind_values(values, items) local placeholders = {} for _, item in ipairs(items) do @@ -579,7 +593,7 @@ local function collection_list_response(search_enabled) if not search_enabled then include_total = parse_include_total(params) end local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = collection_list_cursor_decode(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, COLLECTION) local collections, next_cursor, total_count = collection_list_query({ authors = authors, hasOrganizationRecord = has_organization_record, diff --git a/happyview-modules/lua/endpoints/listContributions.lua b/happyview-modules/lua/endpoints/listContributions.lua index a05e1754..93652ac0 100644 --- a/happyview-modules/lua/endpoints/listContributions.lua +++ b/happyview-modules/lua/endpoints/listContributions.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local NULL = json.decode("null") local function record_view(row) @@ -151,16 +152,23 @@ local function contribution_view(row) return view end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -173,6 +181,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then @@ -223,13 +244,6 @@ local function contribution_authors() return authors end -local function decode_contribution_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid = valid_contribution_uri(value.u) - return valid and valid_datetime(value.t) - end) -end - local function contribution_sort_key() local created = "contribution.record::jsonb->>'createdAt'" local zoned = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" @@ -277,7 +291,7 @@ function handle() local authors = contribution_authors() local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = decode_contribution_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, valid_contribution_uri) local contributions, next_cursor = query_contributions(authors, limit, cursor, direction) local response = { contributions = toarray(contributions) } if next_cursor then response.cursor = next_cursor end diff --git a/happyview-modules/lua/endpoints/listContributorInformation.lua b/happyview-modules/lua/endpoints/listContributorInformation.lua index 2909a7a8..24560e27 100644 --- a/happyview-modules/lua/endpoints/listContributorInformation.lua +++ b/happyview-modules/lua/endpoints/listContributorInformation.lua @@ -121,15 +121,26 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other @@ -138,10 +149,7 @@ end -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -154,6 +162,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then @@ -233,12 +254,6 @@ local function contributor_information_array(params, key, validate, description) return unique end -local function contributor_information_cursor_decode(token, direction) - return decode_cursor(token, direction, function(value) - return contributor_information_uri(value.u) and valid_datetime(value.t) - end) -end - local function preserve_contributor_author_timestamps(author) local null = json.decode("null") for _, field in ipairs({ "profile", "organization" }) do @@ -305,7 +320,7 @@ function handle() local authors = contributor_information_array(params, "authors", valid_did, "valid DIDs") local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = contributor_information_cursor_decode(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, contributor_information_uri) local views, next_cursor = query_contributor_information(authors, limit, cursor, direction) local response = { contributorInformation = toarray(views) } if next_cursor then response.cursor = next_cursor end diff --git a/happyview-modules/lua/endpoints/listEntityFollowers.lua b/happyview-modules/lua/endpoints/listEntityFollowers.lua index 1a7e3620..344bd2eb 100644 --- a/happyview-modules/lua/endpoints/listEntityFollowers.lua +++ b/happyview-modules/lua/endpoints/listEntityFollowers.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local ENTITY_FOLLOW = "app.certified.graph.entityFollow" local ENTITY_FOLLOW_NULL = json.decode("null") @@ -112,16 +113,23 @@ local function entity_follow_record_view(row) return view end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -134,6 +142,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a @@ -149,13 +170,6 @@ local function created_at_sort(alias) "::timestamptz, " .. created_at .. "::timestamptz) END" end -local function entity_follow_decode_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid and collection == ENTITY_FOLLOW and valid_datetime(value.t) - end) -end - local function entity_follow_query_page(mode, identity, limit, cursor, direction) local filters, values = { "collection = $1" }, { ENTITY_FOLLOW, identity } if mode == "followers" then @@ -268,7 +282,7 @@ local function list_entity_followers() local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = entity_follow_decode_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, ENTITY_FOLLOW) local rows, next_cursor, total_count = entity_follow_query_page("followers", entity_uri, limit, cursor, direction) local response = { followers = toarray(entity_follow_follower_views(rows)), totalCount = total_count } if next_cursor then response.cursor = next_cursor end diff --git a/happyview-modules/lua/endpoints/listEntityFollowing.lua b/happyview-modules/lua/endpoints/listEntityFollowing.lua index 8a861d46..c47ca69a 100644 --- a/happyview-modules/lua/endpoints/listEntityFollowing.lua +++ b/happyview-modules/lua/endpoints/listEntityFollowing.lua @@ -77,17 +77,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local ACTIVITY_PROJECTION_CONTRIBUTOR_INFORMATION = "org.hypercerts.claim.contributorInformation" local ACTIVITY_PROJECTION_PROFILE = "app.certified.actor.profile" local ACTIVITY_PROJECTION_ORGANIZATION = "app.certified.actor.organization" @@ -549,16 +550,23 @@ local function entity_follow_record_view(row) return view end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -571,6 +579,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a @@ -586,13 +607,6 @@ local function created_at_sort(alias) "::timestamptz, " .. created_at .. "::timestamptz) END" end -local function entity_follow_decode_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid and collection == ENTITY_FOLLOW and valid_datetime(value.t) - end) -end - local function entity_follow_query_page(mode, identity, limit, cursor, direction) local filters, values = { "collection = $1" }, { ENTITY_FOLLOW, identity } if mode == "followers" then @@ -752,7 +766,7 @@ local function list_entity_following_page(actor, limit, cursor, direction) end if #candidates == limit + 1 or not batch_cursor then break end - scan_cursor = entity_follow_decode_cursor(batch_cursor, direction) + scan_cursor = decode_record_cursor(batch_cursor, direction, ENTITY_FOLLOW) end local rows = {} @@ -776,7 +790,7 @@ local function list_entity_following() local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = entity_follow_decode_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, ENTITY_FOLLOW) local rows, next_cursor, subjects_by_row = list_entity_following_page(actor, limit, cursor, direction) local response = { entities = toarray(entity_follow_resolve_entities(rows, subjects_by_row)) } if next_cursor then response.cursor = next_cursor end diff --git a/happyview-modules/lua/endpoints/listEvaluations.lua b/happyview-modules/lua/endpoints/listEvaluations.lua index eac07546..f6b7c9b9 100644 --- a/happyview-modules/lua/endpoints/listEvaluations.lua +++ b/happyview-modules/lua/endpoints/listEvaluations.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local NULL = json.decode("null") local function record_view(row) @@ -220,16 +221,23 @@ local function valid_nsid(value) return #name <= 63 and name:match("^[A-Za-z][A-Za-z0-9]*$") ~= nil end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -242,6 +250,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then @@ -331,13 +352,6 @@ local function evaluation_evaluator_match(values, dids) "WHERE evaluator.value->>'did' IN (" .. table.concat(marks, ", ") .. "))" end -local function decode_evaluation_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid_datetime(value.t) and valid and collection == EVALUATION - end) -end - local function evaluation_list_filters(authors, evaluators, subjects) local where, values = { "evaluation.collection = $1" }, { EVALUATION } if authors then add_in(where, values, "evaluation.did", authors) end @@ -430,7 +444,7 @@ local function list_evaluations() local subjects = evaluation_array("subjects", "at-uri") local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = decode_evaluation_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, EVALUATION) local evaluations, next_cursor = evaluation_list_query(authors, evaluators, subjects, limit, cursor, direction) local response = { evaluations = toarray(evaluations) } diff --git a/happyview-modules/lua/endpoints/listEvmLinks.lua b/happyview-modules/lua/endpoints/listEvmLinks.lua index fed4690e..60b4029d 100644 --- a/happyview-modules/lua/endpoints/listEvmLinks.lua +++ b/happyview-modules/lua/endpoints/listEvmLinks.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a diff --git a/happyview-modules/lua/endpoints/listFeatures.lua b/happyview-modules/lua/endpoints/listFeatures.lua index 1c0b6cd8..75ea7ab2 100644 --- a/happyview-modules/lua/endpoints/listFeatures.lua +++ b/happyview-modules/lua/endpoints/listFeatures.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then diff --git a/happyview-modules/lua/endpoints/listLocations.lua b/happyview-modules/lua/endpoints/listLocations.lua index b1921f7d..f90e4c8e 100644 --- a/happyview-modules/lua/endpoints/listLocations.lua +++ b/happyview-modules/lua/endpoints/listLocations.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a diff --git a/happyview-modules/lua/endpoints/listMeasurements.lua b/happyview-modules/lua/endpoints/listMeasurements.lua index 96aa081a..ed348e3b 100644 --- a/happyview-modules/lua/endpoints/listMeasurements.lua +++ b/happyview-modules/lua/endpoints/listMeasurements.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local NULL = json.decode("null") local function record_view(row) @@ -179,16 +180,23 @@ local function valid_nsid(value) return #name <= 63 and name:match("^[A-Za-z][A-Za-z0-9]*$") ~= nil end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -201,6 +209,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then @@ -282,13 +303,6 @@ local function bind_values(values, items) return placeholders end -local function decode_measurement_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid_datetime(value.t) and valid and collection == MEASUREMENT - end) -end - local function measurement_list_query(authors, subjects, limit, cursor, direction) local where, values = { "measurement.collection = $1" }, { MEASUREMENT } if authors then add_in(where, values, "measurement.did", authors) end @@ -353,7 +367,7 @@ function handle() local subjects = measurement_array("subjects", "at-uri") local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = decode_measurement_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, MEASUREMENT) local measurements, next_cursor = measurement_list_query(authors, subjects, limit, cursor, direction) local response = { measurements = toarray(measurements) } diff --git a/happyview-modules/lua/endpoints/listOrganizations.lua b/happyview-modules/lua/endpoints/listOrganizations.lua index 5b4726b1..ff0455d2 100644 --- a/happyview-modules/lua/endpoints/listOrganizations.lua +++ b/happyview-modules/lua/endpoints/listOrganizations.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local NULL = json.decode("null") local function record_view(row) diff --git a/happyview-modules/lua/endpoints/listProfiles.lua b/happyview-modules/lua/endpoints/listProfiles.lua index fe2e792f..e9f44243 100644 --- a/happyview-modules/lua/endpoints/listProfiles.lua +++ b/happyview-modules/lua/endpoints/listProfiles.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local NULL = json.decode("null") local function record_view(row) diff --git a/happyview-modules/lua/endpoints/listReceipts.lua b/happyview-modules/lua/endpoints/listReceipts.lua index 97585d4e..5ac8fd88 100644 --- a/happyview-modules/lua/endpoints/listReceipts.lua +++ b/happyview-modules/lua/endpoints/listReceipts.lua @@ -165,15 +165,26 @@ local function valid_nsid(value) return #name <= 63 and name:match("^[A-Za-z][A-Za-z0-9]*$") ~= nil end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other @@ -182,10 +193,7 @@ end -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -198,6 +206,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then @@ -299,13 +320,6 @@ local function funding_receipt_array(key, format) return unique end -local function decode_funding_receipt_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid_datetime(value.t) and valid and collection == RECEIPT - end) -end - local function bind_funding_receipt_values(values, items) local placeholders = {} for _, item in ipairs(items) do @@ -424,7 +438,7 @@ local function funding_receipts_response() local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = decode_funding_receipt_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, RECEIPT) local include_total = parse_include_total(params) local receipts, next_cursor, total_count = query_funding_receipts( authors, uris, from_values, to_values, for_uris, transaction_ids, limit, cursor, direction, include_total) diff --git a/happyview-modules/lua/endpoints/listRecentFollows.lua b/happyview-modules/lua/endpoints/listRecentFollows.lua index 1389f3bc..d5ec9d19 100644 --- a/happyview-modules/lua/endpoints/listRecentFollows.lua +++ b/happyview-modules/lua/endpoints/listRecentFollows.lua @@ -71,6 +71,12 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + -- Some clients wrote account follows whose `via` points at the followed -- account's own org.hypercerts.collection, using the account follow as a -- project follow. Those records stay indexed but are not account follows, so @@ -98,11 +104,6 @@ end local recent_valid_datetime = valid_datetime -local function recent_cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local function recent_cursor_decode(token, before) if not token then return nil end if #token % 2 ~= 0 or token:find("[^0-9a-f]") then invalid("cursor is malformed") end @@ -195,7 +196,7 @@ local function recent_follows_response() local response = { follows = toarray(follows) } if has_more then local last = rows[#rows] - response.cursor = recent_cursor_encode({ v = 1, t = last.sort_timestamp, u = last.uri, b = before or false }) + response.cursor = cursor_encode({ v = 1, t = last.sort_timestamp, u = last.uri, b = before or false }) end return response end diff --git a/happyview-modules/lua/endpoints/listRights.lua b/happyview-modules/lua/endpoints/listRights.lua index 62b4f3a9..aaffd793 100644 --- a/happyview-modules/lua/endpoints/listRights.lua +++ b/happyview-modules/lua/endpoints/listRights.lua @@ -132,15 +132,26 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other @@ -149,10 +160,7 @@ end -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -165,6 +173,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then @@ -237,13 +258,6 @@ local function rights_list_array(value) return unique end -local function rights_list_cursor_decode(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid_datetime(value.t) and valid and collection == RIGHTS - end) -end - local function rights_list_query(authors, limit, cursor, direction) local where, values = { "rights.collection = $1" }, { RIGHTS } @@ -293,7 +307,7 @@ local function rights_list_response() local authors = rights_list_array(params.authors) local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = rights_list_cursor_decode(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, RIGHTS) local rights, next_cursor = rights_list_query(authors, limit, cursor, direction) local response = { rights = toarray(rights) } if next_cursor then response.cursor = next_cursor end diff --git a/happyview-modules/lua/endpoints/listVocabTags.lua b/happyview-modules/lua/endpoints/listVocabTags.lua index 089f8f3a..881a49f9 100644 --- a/happyview-modules/lua/endpoints/listVocabTags.lua +++ b/happyview-modules/lua/endpoints/listVocabTags.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local NULL = json.decode("null") local function record_view(row) diff --git a/happyview-modules/lua/endpoints/listWorkscopeTags.lua b/happyview-modules/lua/endpoints/listWorkscopeTags.lua index 526b8e2b..946ab0db 100644 --- a/happyview-modules/lua/endpoints/listWorkscopeTags.lua +++ b/happyview-modules/lua/endpoints/listWorkscopeTags.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - -- Workscope sidecars omit missing indexedAt; the work-scope tag view encodes it as JSON null separately. local NULL = json.decode("null") @@ -150,16 +151,23 @@ local function workscope_tag_view(row) } end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -172,6 +180,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then @@ -224,19 +245,12 @@ local function workscope_tag_array(key) return unique end -local function workscope_tag_decode_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid_datetime(value.t) and valid and collection == WORKSCOPE_TAG - end) -end - local function workscope_tag_list() keys_only(params, { authors = true, sortDirection = true, limit = true, cursor = true }) local authors = workscope_tag_array("authors") local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = workscope_tag_decode_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, WORKSCOPE_TAG) local where, values = { "workscope_tag.collection = $1" }, { WORKSCOPE_TAG } if authors then add_in(where, values, "workscope_tag.did", authors) end diff --git a/happyview-modules/lua/endpoints/searchActivities.lua b/happyview-modules/lua/endpoints/searchActivities.lua index 505a0102..d29d4f3a 100644 --- a/happyview-modules/lua/endpoints/searchActivities.lua +++ b/happyview-modules/lua/endpoints/searchActivities.lua @@ -290,15 +290,26 @@ local function created_at_sort(alias) "::timestamptz, " .. created_at .. "::timestamptz) END" end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other @@ -307,10 +318,7 @@ end -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -323,6 +331,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then @@ -389,13 +410,6 @@ local function activity_array(key, format) return unique end -local function decode_activity_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid_datetime(value.t) and valid and collection == ACTIVITY - end) -end - local function bind_values(values, items) local placeholders = {} for _, item in ipairs(items) do @@ -542,7 +556,7 @@ local function activity_list_response(search_enabled) if not search_enabled then include_total = parse_include_total(params) end local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = decode_activity_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, ACTIVITY) local activities, next_cursor, total_count = activity_query( authors, has_organization_record, contributors, involved_actors, uris, search, limit, cursor, direction, include_total) local response = { activities = toarray(activities) } diff --git a/happyview-modules/lua/endpoints/searchBadgeDefinitions.lua b/happyview-modules/lua/endpoints/searchBadgeDefinitions.lua index 96d4cca9..3aafacc6 100644 --- a/happyview-modules/lua/endpoints/searchBadgeDefinitions.lua +++ b/happyview-modules/lua/endpoints/searchBadgeDefinitions.lua @@ -78,17 +78,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a diff --git a/happyview-modules/lua/endpoints/searchCollections.lua b/happyview-modules/lua/endpoints/searchCollections.lua index 93001ba9..c60c230f 100644 --- a/happyview-modules/lua/endpoints/searchCollections.lua +++ b/happyview-modules/lua/endpoints/searchCollections.lua @@ -303,15 +303,26 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other @@ -320,10 +331,7 @@ end -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -336,6 +344,19 @@ local function decode_cursor(token, direction, validate_value) return value end +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end + -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then @@ -414,13 +435,6 @@ local function collection_array(key, kind) return unique end -local function collection_list_cursor_decode(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_bounded_record_uri(value.u) - return valid_datetime(value.t) and valid and collection == COLLECTION - end) -end - local function collection_bind_values(values, items) local placeholders = {} for _, item in ipairs(items) do @@ -579,7 +593,7 @@ local function collection_list_response(search_enabled) if not search_enabled then include_total = parse_include_total(params) end local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = collection_list_cursor_decode(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, COLLECTION) local collections, next_cursor, total_count = collection_list_query({ authors = authors, hasOrganizationRecord = has_organization_record, diff --git a/happyview-modules/lua/endpoints/searchOrganizations.lua b/happyview-modules/lua/endpoints/searchOrganizations.lua index 0118eb69..de8c5d8a 100644 --- a/happyview-modules/lua/endpoints/searchOrganizations.lua +++ b/happyview-modules/lua/endpoints/searchOrganizations.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local NULL = json.decode("null") local function record_view(row) diff --git a/happyview-modules/lua/endpoints/searchProfiles.lua b/happyview-modules/lua/endpoints/searchProfiles.lua index be40a4fc..72cf3eb7 100644 --- a/happyview-modules/lua/endpoints/searchProfiles.lua +++ b/happyview-modules/lua/endpoints/searchProfiles.lua @@ -71,17 +71,18 @@ local function parse_list_limit(params) return limit end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local NULL = json.decode("null") local function record_view(row) diff --git a/happyview-modules/lua/shared/acknowledgementList.lua b/happyview-modules/lua/shared/acknowledgementList.lua index fe8ae8db..a1c2fb43 100644 --- a/happyview-modules/lua/shared/acknowledgementList.lua +++ b/happyview-modules/lua/shared/acknowledgementList.lua @@ -48,13 +48,6 @@ local function acknowledgement_array(key, format) return unique end -local function decode_acknowledgement_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid_cursor_timestamp(value.t) and valid and collection == ACKNOWLEDGEMENT - end) -end - local function acknowledgement_sort_expression() local created = "acknowledgement.record::jsonb->>'createdAt'" local pattern = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" @@ -106,7 +99,7 @@ local function list_acknowledgements() local subjects = acknowledgement_array("subjects", "at-uri") local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = decode_acknowledgement_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, ACKNOWLEDGEMENT, valid_cursor_timestamp) local rows = acknowledgement_list_query(authors, subjects, limit, cursor, direction) local acknowledgements = {} for index = 1, math.min(#rows, limit) do diff --git a/happyview-modules/lua/shared/activityList.lua b/happyview-modules/lua/shared/activityList.lua index 23d02fc8..54a01dab 100644 --- a/happyview-modules/lua/shared/activityList.lua +++ b/happyview-modules/lua/shared/activityList.lua @@ -40,13 +40,6 @@ local function activity_array(key, format) return unique end -local function decode_activity_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid_datetime(value.t) and valid and collection == ACTIVITY - end) -end - local function bind_values(values, items) local placeholders = {} for _, item in ipairs(items) do @@ -193,7 +186,7 @@ local function activity_list_response(search_enabled) if not search_enabled then include_total = parse_include_total(params) end local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = decode_activity_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, ACTIVITY) local activities, next_cursor, total_count = activity_query( authors, has_organization_record, contributors, involved_actors, uris, search, limit, cursor, direction, include_total) local response = { activities = toarray(activities) } diff --git a/happyview-modules/lua/shared/attachmentList.lua b/happyview-modules/lua/shared/attachmentList.lua index aaaa6145..5cf9b229 100644 --- a/happyview-modules/lua/shared/attachmentList.lua +++ b/happyview-modules/lua/shared/attachmentList.lua @@ -50,12 +50,6 @@ local function attachment_subject_filter(where, values, subjects) "WHERE subject.value->>'uri' IN (" .. table.concat(placeholders, ", ") .. "))" end -local function attachment_cursor_decode(token, direction) - return decode_cursor(token, direction, function(value) - return valid_datetime(value.t) and valid_attachment_uri(value.u) - end) -end - local function query_attachments(filters, limit, cursor, direction) local where, values = { "attachment.collection = $1" }, { ATTACHMENT_COLLECTION } if filters.authors then add_in(where, values, "attachment.did", filters.authors) end @@ -119,7 +113,7 @@ local function list_attachments() local content_types = attachment_array(params, "contentTypes") local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = attachment_cursor_decode(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, valid_attachment_uri) local attachments, next_cursor = query_attachments({ authors = authors, uris = uris, diff --git a/happyview-modules/lua/shared/collectionItems.lua b/happyview-modules/lua/shared/collectionItems.lua index 6a68ab24..68faeac6 100644 --- a/happyview-modules/lua/shared/collectionItems.lua +++ b/happyview-modules/lua/shared/collectionItems.lua @@ -5,10 +5,7 @@ local ITEM_NULL = json.decode("null") local function collection_items_cursor_decode(token, collection_uri) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.u ~= collection_uri or type(value.i) ~= "number" or value.i < 1 or value.i % 1 ~= 0 then @@ -20,12 +17,6 @@ local function collection_items_cursor_decode(token, collection_uri) return value end -local function collection_items_cursor_encode(value) - return (json.encode(value):gsub(".", function(char) - return string.format("%02x", string.byte(char)) - end)) -end - local function collection_items_query(sql, values) if db.backend() ~= "postgres" then error("CollectionQueryFailed: collection API requires PostgreSQL", 0) @@ -186,7 +177,7 @@ local function collection_items_response() local response = { items = toarray(page) } if finish < #source_items then - response.cursor = collection_items_cursor_encode({ v = 1, u = collection_uri, i = finish }) + response.cursor = cursor_encode({ v = 1, u = collection_uri, i = finish }) end return response end diff --git a/happyview-modules/lua/shared/collectionList.lua b/happyview-modules/lua/shared/collectionList.lua index ac9e74dc..a4229712 100644 --- a/happyview-modules/lua/shared/collectionList.lua +++ b/happyview-modules/lua/shared/collectionList.lua @@ -52,13 +52,6 @@ local function collection_array(key, kind) return unique end -local function collection_list_cursor_decode(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_bounded_record_uri(value.u) - return valid_datetime(value.t) and valid and collection == COLLECTION - end) -end - local function collection_bind_values(values, items) local placeholders = {} for _, item in ipairs(items) do @@ -217,7 +210,7 @@ local function collection_list_response(search_enabled) if not search_enabled then include_total = parse_include_total(params) end local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = collection_list_cursor_decode(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, COLLECTION) local collections, next_cursor, total_count = collection_list_query({ authors = authors, hasOrganizationRecord = has_organization_record, diff --git a/happyview-modules/lua/shared/cursorEncode.lua b/happyview-modules/lua/shared/cursorEncode.lua new file mode 100644 index 00000000..3e57d475 --- /dev/null +++ b/happyview-modules/lua/shared/cursorEncode.lua @@ -0,0 +1,5 @@ +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end diff --git a/happyview-modules/lua/shared/cursorToken.lua b/happyview-modules/lua/shared/cursorToken.lua new file mode 100644 index 00000000..9c249163 --- /dev/null +++ b/happyview-modules/lua/shared/cursorToken.lua @@ -0,0 +1,9 @@ +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end diff --git a/happyview-modules/lua/shared/entityFollowPagination.lua b/happyview-modules/lua/shared/entityFollowPagination.lua index 84891341..3290b5f3 100644 --- a/happyview-modules/lua/shared/entityFollowPagination.lua +++ b/happyview-modules/lua/shared/entityFollowPagination.lua @@ -1,10 +1,3 @@ -local function entity_follow_decode_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid and collection == ENTITY_FOLLOW and valid_datetime(value.t) - end) -end - local function entity_follow_query_page(mode, identity, limit, cursor, direction) local filters, values = { "collection = $1" }, { ENTITY_FOLLOW, identity } if mode == "followers" then diff --git a/happyview-modules/lua/shared/evaluationList.lua b/happyview-modules/lua/shared/evaluationList.lua index e9ecbc78..b46507c6 100644 --- a/happyview-modules/lua/shared/evaluationList.lua +++ b/happyview-modules/lua/shared/evaluationList.lua @@ -58,13 +58,6 @@ local function evaluation_evaluator_match(values, dids) "WHERE evaluator.value->>'did' IN (" .. table.concat(marks, ", ") .. "))" end -local function decode_evaluation_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid_datetime(value.t) and valid and collection == EVALUATION - end) -end - local function evaluation_list_filters(authors, evaluators, subjects) local where, values = { "evaluation.collection = $1" }, { EVALUATION } if authors then add_in(where, values, "evaluation.did", authors) end @@ -157,7 +150,7 @@ local function list_evaluations() local subjects = evaluation_array("subjects", "at-uri") local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = decode_evaluation_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, EVALUATION) local evaluations, next_cursor = evaluation_list_query(authors, evaluators, subjects, limit, cursor, direction) local response = { evaluations = toarray(evaluations) } diff --git a/happyview-modules/lua/shared/feedReaction.lua b/happyview-modules/lua/shared/feedReaction.lua index 28215b60..8939898e 100644 --- a/happyview-modules/lua/shared/feedReaction.lua +++ b/happyview-modules/lua/shared/feedReaction.lua @@ -20,13 +20,6 @@ local function feed_reaction_query(reaction, sql, values) return result end -local function feed_reaction_decode_cursor(token, direction, collection) - return decode_cursor(token, direction, function(value) - local valid, cursor_collection = valid_record_uri(value.u) - return valid and cursor_collection == collection and valid_datetime(value.t) - end) -end - local function feed_reaction_query_page(reaction, mode, identity, limit, cursor, direction) local filters, values = { "collection = $1" }, { reaction.collection, identity } if mode == "subject" then @@ -100,7 +93,7 @@ local function feed_reaction_list(reaction_name, mode) local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = feed_reaction_decode_cursor(scalar(params, "cursor"), direction, reaction.collection) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, reaction.collection) local sql, values = feed_reaction_query_page(reaction, mode, identity, limit, cursor, direction) local rows = feed_reaction_query(reaction, sql, values) diff --git a/happyview-modules/lua/shared/fundingReceiptList.lua b/happyview-modules/lua/shared/fundingReceiptList.lua index 011c4a66..03cd488c 100644 --- a/happyview-modules/lua/shared/fundingReceiptList.lua +++ b/happyview-modules/lua/shared/fundingReceiptList.lua @@ -60,13 +60,6 @@ local function funding_receipt_array(key, format) return unique end -local function decode_funding_receipt_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid_datetime(value.t) and valid and collection == RECEIPT - end) -end - local function bind_funding_receipt_values(values, items) local placeholders = {} for _, item in ipairs(items) do @@ -185,7 +178,7 @@ local function funding_receipts_response() local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = decode_funding_receipt_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, RECEIPT) local include_total = parse_include_total(params) local receipts, next_cursor, total_count = query_funding_receipts( authors, uris, from_values, to_values, for_uris, transaction_ids, limit, cursor, direction, include_total) diff --git a/happyview-modules/lua/shared/listCursor.lua b/happyview-modules/lua/shared/listCursor.lua index e0a8586e..e037abe6 100644 --- a/happyview-modules/lua/shared/listCursor.lua +++ b/happyview-modules/lua/shared/listCursor.lua @@ -4,10 +4,7 @@ -- cap or accept extra keys. local function decode_cursor(token, direction, validate_value) if token == nil then return nil end - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) + local decoded = decode_hex_cursor_token(token) local ok, value = pcall(json.decode, decoded) if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction or type(value.t) ~= "string" or type(value.u) ~= "string" then @@ -19,3 +16,16 @@ local function decode_cursor(token, direction, validate_value) if not validate_value(value) then invalid("cursor is malformed") end return value end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end diff --git a/happyview-modules/lua/shared/listQuery.lua b/happyview-modules/lua/shared/listQuery.lua index 8250d8a1..32f1a290 100644 --- a/happyview-modules/lua/shared/listQuery.lua +++ b/happyview-modules/lua/shared/listQuery.lua @@ -3,8 +3,3 @@ local function parse_sort_direction(params) if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end return direction end - -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end diff --git a/happyview-modules/lua/shared/recentFollows.lua b/happyview-modules/lua/shared/recentFollows.lua index 4df9d9c4..4dbb1508 100644 --- a/happyview-modules/lua/shared/recentFollows.lua +++ b/happyview-modules/lua/shared/recentFollows.lua @@ -9,11 +9,6 @@ end local recent_valid_datetime = valid_datetime -local function recent_cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - local function recent_cursor_decode(token, before) if not token then return nil end if #token % 2 ~= 0 or token:find("[^0-9a-f]") then invalid("cursor is malformed") end @@ -106,7 +101,7 @@ local function recent_follows_response() local response = { follows = toarray(follows) } if has_more then local last = rows[#rows] - response.cursor = recent_cursor_encode({ v = 1, t = last.sort_timestamp, u = last.uri, b = before or false }) + response.cursor = cursor_encode({ v = 1, t = last.sort_timestamp, u = last.uri, b = before or false }) end return response end diff --git a/happyview-modules/lua/shared/workscopeTagList.lua b/happyview-modules/lua/shared/workscopeTagList.lua index a4be7767..3cd57785 100644 --- a/happyview-modules/lua/shared/workscopeTagList.lua +++ b/happyview-modules/lua/shared/workscopeTagList.lua @@ -36,19 +36,12 @@ local function workscope_tag_array(key) return unique end -local function workscope_tag_decode_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid_datetime(value.t) and valid and collection == WORKSCOPE_TAG - end) -end - local function workscope_tag_list() keys_only(params, { authors = true, sortDirection = true, limit = true, cursor = true }) local authors = workscope_tag_array("authors") local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = workscope_tag_decode_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, WORKSCOPE_TAG) local where, values = { "workscope_tag.collection = $1" }, { WORKSCOPE_TAG } if authors then add_in(where, values, "workscope_tag.did", authors) end diff --git a/happyview-modules/lua/src/listContributions.lua b/happyview-modules/lua/src/listContributions.lua index 09f0cd16..7aa5bb10 100644 --- a/happyview-modules/lua/src/listContributions.lua +++ b/happyview-modules/lua/src/listContributions.lua @@ -34,13 +34,6 @@ local function contribution_authors() return authors end -local function decode_contribution_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid = valid_contribution_uri(value.u) - return valid and valid_datetime(value.t) - end) -end - local function contribution_sort_key() local created = "contribution.record::jsonb->>'createdAt'" local zoned = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" @@ -88,7 +81,7 @@ function handle() local authors = contribution_authors() local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = decode_contribution_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, valid_contribution_uri) local contributions, next_cursor = query_contributions(authors, limit, cursor, direction) local response = { contributions = toarray(contributions) } if next_cursor then response.cursor = next_cursor end diff --git a/happyview-modules/lua/src/listContributorInformation.lua b/happyview-modules/lua/src/listContributorInformation.lua index 1bb77965..d0d15947 100644 --- a/happyview-modules/lua/src/listContributorInformation.lua +++ b/happyview-modules/lua/src/listContributorInformation.lua @@ -48,12 +48,6 @@ local function contributor_information_array(params, key, validate, description) return unique end -local function contributor_information_cursor_decode(token, direction) - return decode_cursor(token, direction, function(value) - return contributor_information_uri(value.u) and valid_datetime(value.t) - end) -end - local function preserve_contributor_author_timestamps(author) local null = json.decode("null") for _, field in ipairs({ "profile", "organization" }) do @@ -120,7 +114,7 @@ function handle() local authors = contributor_information_array(params, "authors", valid_did, "valid DIDs") local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = contributor_information_cursor_decode(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, contributor_information_uri) local views, next_cursor = query_contributor_information(authors, limit, cursor, direction) local response = { contributorInformation = toarray(views) } if next_cursor then response.cursor = next_cursor end diff --git a/happyview-modules/lua/src/listEntityFollowers.lua b/happyview-modules/lua/src/listEntityFollowers.lua index f105941c..4e8928d2 100644 --- a/happyview-modules/lua/src/listEntityFollowers.lua +++ b/happyview-modules/lua/src/listEntityFollowers.lua @@ -7,7 +7,7 @@ local function list_entity_followers() local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = entity_follow_decode_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, ENTITY_FOLLOW) local rows, next_cursor, total_count = entity_follow_query_page("followers", entity_uri, limit, cursor, direction) local response = { followers = toarray(entity_follow_follower_views(rows)), totalCount = total_count } if next_cursor then response.cursor = next_cursor end diff --git a/happyview-modules/lua/src/listEntityFollowing.lua b/happyview-modules/lua/src/listEntityFollowing.lua index ecf59691..fd82f80e 100644 --- a/happyview-modules/lua/src/listEntityFollowing.lua +++ b/happyview-modules/lua/src/listEntityFollowing.lua @@ -15,7 +15,7 @@ local function list_entity_following_page(actor, limit, cursor, direction) end if #candidates == limit + 1 or not batch_cursor then break end - scan_cursor = entity_follow_decode_cursor(batch_cursor, direction) + scan_cursor = decode_record_cursor(batch_cursor, direction, ENTITY_FOLLOW) end local rows = {} @@ -39,7 +39,7 @@ local function list_entity_following() local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = entity_follow_decode_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, ENTITY_FOLLOW) local rows, next_cursor, subjects_by_row = list_entity_following_page(actor, limit, cursor, direction) local response = { entities = toarray(entity_follow_resolve_entities(rows, subjects_by_row)) } if next_cursor then response.cursor = next_cursor end diff --git a/happyview-modules/lua/src/listMeasurements.lua b/happyview-modules/lua/src/listMeasurements.lua index 82172e59..29d79eab 100644 --- a/happyview-modules/lua/src/listMeasurements.lua +++ b/happyview-modules/lua/src/listMeasurements.lua @@ -50,13 +50,6 @@ local function bind_values(values, items) return placeholders end -local function decode_measurement_cursor(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid_datetime(value.t) and valid and collection == MEASUREMENT - end) -end - local function measurement_list_query(authors, subjects, limit, cursor, direction) local where, values = { "measurement.collection = $1" }, { MEASUREMENT } if authors then add_in(where, values, "measurement.did", authors) end @@ -121,7 +114,7 @@ function handle() local subjects = measurement_array("subjects", "at-uri") local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = decode_measurement_cursor(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, MEASUREMENT) local measurements, next_cursor = measurement_list_query(authors, subjects, limit, cursor, direction) local response = { measurements = toarray(measurements) } diff --git a/happyview-modules/lua/src/listRights.lua b/happyview-modules/lua/src/listRights.lua index 985665b9..fe0ce6bb 100644 --- a/happyview-modules/lua/src/listRights.lua +++ b/happyview-modules/lua/src/listRights.lua @@ -41,13 +41,6 @@ local function rights_list_array(value) return unique end -local function rights_list_cursor_decode(token, direction) - return decode_cursor(token, direction, function(value) - local valid, collection = valid_record_uri(value.u) - return valid_datetime(value.t) and valid and collection == RIGHTS - end) -end - local function rights_list_query(authors, limit, cursor, direction) local where, values = { "rights.collection = $1" }, { RIGHTS } @@ -97,7 +90,7 @@ local function rights_list_response() local authors = rights_list_array(params.authors) local direction = parse_sort_direction(params) local limit = parse_list_limit(params) - local cursor = rights_list_cursor_decode(scalar(params, "cursor"), direction) + local cursor = decode_record_cursor(scalar(params, "cursor"), direction, RIGHTS) local rights, next_cursor = rights_list_query(authors, limit, cursor, direction) local response = { rights = toarray(rights) } if next_cursor then response.cursor = next_cursor end diff --git a/happyview-modules/modules/acknowledgements/manifest.json b/happyview-modules/modules/acknowledgements/manifest.json index 0e965ee9..70c655ea 100644 --- a/happyview-modules/modules/acknowledgements/manifest.json +++ b/happyview-modules/modules/acknowledgements/manifest.json @@ -68,7 +68,9 @@ "../../lua/shared/listValidation.lua", "../../lua/shared/acknowledgement.lua", "../../lua/shared/nsidValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/acknowledgementList.lua" diff --git a/happyview-modules/modules/activity/manifest.json b/happyview-modules/modules/activity/manifest.json index d5e3c759..1b152222 100644 --- a/happyview-modules/modules/activity/manifest.json +++ b/happyview-modules/modules/activity/manifest.json @@ -53,7 +53,9 @@ "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", "../../lua/shared/createdAtSort.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/includeTotal.lua", @@ -80,7 +82,9 @@ "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", "../../lua/shared/createdAtSort.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/includeTotal.lua", diff --git a/happyview-modules/modules/actor-follow/manifest.json b/happyview-modules/modules/actor-follow/manifest.json index a6be14ea..500f4508 100644 --- a/happyview-modules/modules/actor-follow/manifest.json +++ b/happyview-modules/modules/actor-follow/manifest.json @@ -92,6 +92,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", @@ -117,6 +118,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", diff --git a/happyview-modules/modules/badge-definitions/manifest.json b/happyview-modules/modules/badge-definitions/manifest.json index 4c5d7369..ce14e8df 100644 --- a/happyview-modules/modules/badge-definitions/manifest.json +++ b/happyview-modules/modules/badge-definitions/manifest.json @@ -56,6 +56,7 @@ "../../lua/shared/badgeDefinitionValidation.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/recordView.lua", diff --git a/happyview-modules/modules/badge-queries/manifest.json b/happyview-modules/modules/badge-queries/manifest.json index 10b94b9f..9f310816 100644 --- a/happyview-modules/modules/badge-queries/manifest.json +++ b/happyview-modules/modules/badge-queries/manifest.json @@ -67,6 +67,7 @@ "../../lua/shared/badgeDefinitionValidation.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/recordView.lua", @@ -108,6 +109,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/recordView.lua", @@ -149,6 +151,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/recordView.lua", diff --git a/happyview-modules/modules/collection/manifest.json b/happyview-modules/modules/collection/manifest.json index 39546cff..bd94dca5 100644 --- a/happyview-modules/modules/collection/manifest.json +++ b/happyview-modules/modules/collection/manifest.json @@ -45,7 +45,9 @@ "../../lua/shared/query.lua", "../../lua/shared/scalarOrBoolean.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/includeTotal.lua", @@ -83,7 +85,9 @@ "../../lua/shared/query.lua", "../../lua/shared/scalarOrBoolean.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/includeTotal.lua", @@ -107,6 +111,8 @@ "../../lua/shared/activityProjection.lua", "../../lua/shared/featureProjection.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/collectionItems.lua" ], "config": { diff --git a/happyview-modules/modules/context-attachments/manifest.json b/happyview-modules/modules/context-attachments/manifest.json index 047e6233..7d48862e 100644 --- a/happyview-modules/modules/context-attachments/manifest.json +++ b/happyview-modules/modules/context-attachments/manifest.json @@ -50,10 +50,12 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", "../../lua/shared/attachment.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/createdAtSort.lua", diff --git a/happyview-modules/modules/context-evaluation/manifest.json b/happyview-modules/modules/context-evaluation/manifest.json index 4268ea60..06bbd75e 100644 --- a/happyview-modules/modules/context-evaluation/manifest.json +++ b/happyview-modules/modules/context-evaluation/manifest.json @@ -50,11 +50,13 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", "../../lua/shared/evaluation.lua", "../../lua/shared/nsidValidation.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/createdAtSort.lua", diff --git a/happyview-modules/modules/context-measurements/manifest.json b/happyview-modules/modules/context-measurements/manifest.json index 20704d1c..d72e9478 100644 --- a/happyview-modules/modules/context-measurements/manifest.json +++ b/happyview-modules/modules/context-measurements/manifest.json @@ -50,11 +50,13 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", "../../lua/shared/measurementQuery.lua", "../../lua/shared/nsidValidation.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/createdAtSort.lua" diff --git a/happyview-modules/modules/contribution/manifest.json b/happyview-modules/modules/contribution/manifest.json index 5d650240..e8e5bf6a 100644 --- a/happyview-modules/modules/contribution/manifest.json +++ b/happyview-modules/modules/contribution/manifest.json @@ -41,10 +41,12 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", "../../lua/shared/contribution.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua" ], diff --git a/happyview-modules/modules/contributor-information/manifest.json b/happyview-modules/modules/contributor-information/manifest.json index 9ad5d784..2e527654 100644 --- a/happyview-modules/modules/contributor-information/manifest.json +++ b/happyview-modules/modules/contributor-information/manifest.json @@ -57,7 +57,9 @@ "../../lua/shared/actorView.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/createdAtSort.lua" diff --git a/happyview-modules/modules/entity-follow/manifest.json b/happyview-modules/modules/entity-follow/manifest.json index 1df9ac0b..90ccc92e 100644 --- a/happyview-modules/modules/entity-follow/manifest.json +++ b/happyview-modules/modules/entity-follow/manifest.json @@ -97,8 +97,10 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/entityFollow.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/entityFollowPagination.lua", @@ -122,11 +124,13 @@ "../../lua/shared/boundedRecordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/activityProjection.lua", "../../lua/shared/collectionProjection.lua", "../../lua/shared/featureProjection.lua", "../../lua/shared/entityFollow.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/entityFollowPagination.lua", diff --git a/happyview-modules/modules/evm-links/manifest.json b/happyview-modules/modules/evm-links/manifest.json index 4d5bbd81..d19c8c8e 100644 --- a/happyview-modules/modules/evm-links/manifest.json +++ b/happyview-modules/modules/evm-links/manifest.json @@ -51,6 +51,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/recordView.lua", diff --git a/happyview-modules/modules/features/manifest.json b/happyview-modules/modules/features/manifest.json index 00ca2c24..6cf1fb93 100644 --- a/happyview-modules/modules/features/manifest.json +++ b/happyview-modules/modules/features/manifest.json @@ -47,6 +47,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/featureValidation.lua", diff --git a/happyview-modules/modules/feed-reactions/manifest.json b/happyview-modules/modules/feed-reactions/manifest.json index c32594bf..9a069cb7 100644 --- a/happyview-modules/modules/feed-reactions/manifest.json +++ b/happyview-modules/modules/feed-reactions/manifest.json @@ -67,9 +67,11 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/feedReaction.lua" @@ -88,9 +90,11 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/feedReaction.lua" @@ -109,9 +113,11 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/feedReaction.lua" @@ -130,9 +136,11 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/feedReaction.lua" diff --git a/happyview-modules/modules/funding/manifest.json b/happyview-modules/modules/funding/manifest.json index a2546c76..04e63d9e 100644 --- a/happyview-modules/modules/funding/manifest.json +++ b/happyview-modules/modules/funding/manifest.json @@ -54,7 +54,9 @@ "../../lua/shared/actorView.lua", "../../lua/shared/fundingReceipt.lua", "../../lua/shared/nsidValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/createdAtSort.lua", diff --git a/happyview-modules/modules/location/manifest.json b/happyview-modules/modules/location/manifest.json index cdf1ab5d..421a2892 100644 --- a/happyview-modules/modules/location/manifest.json +++ b/happyview-modules/modules/location/manifest.json @@ -50,6 +50,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/recordView.lua", diff --git a/happyview-modules/modules/organization/manifest.json b/happyview-modules/modules/organization/manifest.json index 4c5c7ffa..bddde45f 100644 --- a/happyview-modules/modules/organization/manifest.json +++ b/happyview-modules/modules/organization/manifest.json @@ -94,6 +94,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", @@ -121,6 +122,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", diff --git a/happyview-modules/modules/profile/manifest.json b/happyview-modules/modules/profile/manifest.json index 6b830209..f7d75788 100644 --- a/happyview-modules/modules/profile/manifest.json +++ b/happyview-modules/modules/profile/manifest.json @@ -87,6 +87,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/profile.lua", @@ -111,6 +112,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/profile.lua", diff --git a/happyview-modules/modules/recent-follows/manifest.json b/happyview-modules/modules/recent-follows/manifest.json index 0fe4ae04..56fde049 100644 --- a/happyview-modules/modules/recent-follows/manifest.json +++ b/happyview-modules/modules/recent-follows/manifest.json @@ -20,6 +20,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/accountFollowFilter.lua", "../../lua/shared/recentFollows.lua" ], diff --git a/happyview-modules/modules/rights/manifest.json b/happyview-modules/modules/rights/manifest.json index a307fa40..9d5afa2c 100644 --- a/happyview-modules/modules/rights/manifest.json +++ b/happyview-modules/modules/rights/manifest.json @@ -44,7 +44,9 @@ "../../lua/shared/rightsView.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/createdAtSort.lua" diff --git a/happyview-modules/modules/vocab/manifest.json b/happyview-modules/modules/vocab/manifest.json index bba7c3e9..9452ec2b 100644 --- a/happyview-modules/modules/vocab/manifest.json +++ b/happyview-modules/modules/vocab/manifest.json @@ -50,6 +50,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", diff --git a/happyview-modules/modules/workscope-tags/manifest.json b/happyview-modules/modules/workscope-tags/manifest.json index 119e56ee..5893a85f 100644 --- a/happyview-modules/modules/workscope-tags/manifest.json +++ b/happyview-modules/modules/workscope-tags/manifest.json @@ -50,10 +50,12 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/workscopeRecordView.lua", "../../lua/shared/actorView.lua", "../../lua/shared/workscopeTag.lua", + "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/workscopeTagList.lua" diff --git a/happyview-modules/tests/unit/endpoints/rights-edge-lua.test.js b/happyview-modules/tests/unit/endpoints/rights-edge-lua.test.js index baabaff7..91c52015 100644 --- a/happyview-modules/tests/unit/endpoints/rights-edge-lua.test.js +++ b/happyview-modules/tests/unit/endpoints/rights-edge-lua.test.js @@ -21,7 +21,9 @@ async function endpointSources(name) { shared.push( "lua/shared/datetimeValidation.lua", "lua/shared/listValidation.lua", + "lua/shared/cursorEncode.lua", "lua/shared/listQuery.lua", + "lua/shared/cursorToken.lua", "lua/shared/listCursor.lua", "lua/shared/listWhere.lua", "lua/shared/createdAtSort.lua", diff --git a/happyview-modules/tests/unit/endpoints/rights-lua.test.js b/happyview-modules/tests/unit/endpoints/rights-lua.test.js index 92e00aff..94932ea6 100644 --- a/happyview-modules/tests/unit/endpoints/rights-lua.test.js +++ b/happyview-modules/tests/unit/endpoints/rights-lua.test.js @@ -105,7 +105,9 @@ async function listRightsSources() { read("lua/shared/rightsView.lua"), read("lua/shared/datetimeValidation.lua"), read("lua/shared/listValidation.lua"), + read("lua/shared/cursorEncode.lua"), read("lua/shared/listQuery.lua"), + read("lua/shared/cursorToken.lua"), read("lua/shared/listCursor.lua"), read("lua/shared/listWhere.lua"), read("lua/shared/createdAtSort.lua"), diff --git a/happyview-modules/tests/unit/feature.test.js b/happyview-modules/tests/unit/feature.test.js index ba08b923..ff5e4077 100644 --- a/happyview-modules/tests/unit/feature.test.js +++ b/happyview-modules/tests/unit/feature.test.js @@ -138,6 +138,7 @@ async function runListFeatures( "lua/shared/recordIdentifier.lua", "lua/shared/datetimeValidation.lua", "lua/shared/listValidation.lua", + "lua/shared/cursorEncode.lua", "lua/shared/listQuery.lua", "lua/shared/listWhere.lua", "lua/shared/featureValidation.lua", diff --git a/happyview-modules/tests/unit/lua/recentFollows.test.lua b/happyview-modules/tests/unit/lua/recentFollows.test.lua index ef70ec81..07412281 100644 --- a/happyview-modules/tests/unit/lua/recentFollows.test.lua +++ b/happyview-modules/tests/unit/lua/recentFollows.test.lua @@ -95,6 +95,7 @@ local handler = table.concat({ source("lua/shared/recordIdentifier.lua"), source("lua/shared/datetimeValidation.lua"), source("lua/shared/listValidation.lua"), + source("lua/shared/cursorEncode.lua"), source("lua/shared/accountFollowFilter.lua"), source("lua/shared/recentFollows.lua"), source("lua/src/listRecentFollows.lua"), diff --git a/happyview-modules/tests/unit/tooling/listContributorInformation.test.js b/happyview-modules/tests/unit/tooling/listContributorInformation.test.js index 57b4f032..abd9b19a 100644 --- a/happyview-modules/tests/unit/tooling/listContributorInformation.test.js +++ b/happyview-modules/tests/unit/tooling/listContributorInformation.test.js @@ -18,7 +18,9 @@ test("listContributorInformation filters repeated authors and resumes in the sel read("lua/shared/actorView.lua"), read("lua/shared/datetimeValidation.lua"), read("lua/shared/listValidation.lua"), + read("lua/shared/cursorEncode.lua"), read("lua/shared/listQuery.lua"), + read("lua/shared/cursorToken.lua"), read("lua/shared/listCursor.lua"), read("lua/shared/listWhere.lua"), read("lua/shared/createdAtSort.lua"), diff --git a/happyview-modules/tests/unit/tooling/vocab-tags.test.js b/happyview-modules/tests/unit/tooling/vocab-tags.test.js index 7e00f17a..19deea75 100644 --- a/happyview-modules/tests/unit/tooling/vocab-tags.test.js +++ b/happyview-modules/tests/unit/tooling/vocab-tags.test.js @@ -15,6 +15,7 @@ const sharedSources = [ "lua/shared/recordIdentifier.lua", "lua/shared/datetimeValidation.lua", "lua/shared/listValidation.lua", + "lua/shared/cursorEncode.lua", "lua/shared/listQuery.lua", "lua/shared/recordView.lua", "lua/shared/actorView.lua", diff --git a/happyview-modules/tooling/shared-helpers.registry.json b/happyview-modules/tooling/shared-helpers.registry.json index 30958433..2dc6fb7e 100644 --- a/happyview-modules/tooling/shared-helpers.registry.json +++ b/happyview-modules/tooling/shared-helpers.registry.json @@ -60,7 +60,12 @@ "description": "the cursor length cap" } ], - "homes": ["lua/shared/listCursor.lua", "lua/shared/listQuery.lua"] + "homes": [ + "lua/shared/listCursor.lua", + "lua/shared/listQuery.lua", + "lua/shared/cursorEncode.lua", + "lua/shared/cursorToken.lua" + ] }, { "id": "list-params", @@ -148,24 +153,12 @@ "symbol": "valid_cursor_timestamp", "reason": "Existing cursor timestamp check with its own rules; kept to avoid a behavior change." }, - { - "file": "lua/shared/acknowledgementList.lua", - "family": "list-cursor", - "symbol": "decode_acknowledgement_cursor", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, { "file": "lua/shared/acknowledgementList.lua", "family": "repeated-query-array", "symbol": "acknowledgement_array", "reason": "Existing endpoint-local repeated-parameter parser; no shared parser exists yet. Kept to avoid a behavior change." }, - { - "file": "lua/shared/activityList.lua", - "family": "list-cursor", - "symbol": "decode_activity_cursor", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, { "file": "lua/shared/activityList.lua", "family": "record-identifier", @@ -197,12 +190,6 @@ "symbol": "cursor-hex-decode", "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." }, - { - "file": "lua/shared/attachmentList.lua", - "family": "list-cursor", - "symbol": "attachment_cursor_decode", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, { "file": "lua/shared/attachmentList.lua", "family": "repeated-query-array", @@ -215,30 +202,6 @@ "symbol": "collection_items_cursor_decode", "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." }, - { - "file": "lua/shared/collectionItems.lua", - "family": "list-cursor", - "symbol": "collection_items_cursor_encode", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, - { - "file": "lua/shared/collectionItems.lua", - "family": "list-cursor", - "symbol": "cursor-hex-decode", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, - { - "file": "lua/shared/collectionItems.lua", - "family": "list-cursor", - "symbol": "cursor-length-cap", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, - { - "file": "lua/shared/collectionList.lua", - "family": "list-cursor", - "symbol": "collection_list_cursor_decode", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, { "file": "lua/shared/collectionList.lua", "family": "repeated-query-array", @@ -263,24 +226,12 @@ "symbol": "entity_follow_record_view", "reason": "Existing record view with endpoint-specific fields; kept to avoid a behavior change. Build on record_view where the shape allows." }, - { - "file": "lua/shared/entityFollowPagination.lua", - "family": "list-cursor", - "symbol": "entity_follow_decode_cursor", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, { "file": "lua/shared/evaluation.lua", "family": "repeated-query-array", "symbol": "evaluation_evaluator_array", "reason": "Existing endpoint-local repeated-parameter parser; no shared parser exists yet. Kept to avoid a behavior change." }, - { - "file": "lua/shared/evaluationList.lua", - "family": "list-cursor", - "symbol": "decode_evaluation_cursor", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, { "file": "lua/shared/evaluationList.lua", "family": "repeated-query-array", @@ -305,24 +256,12 @@ "symbol": "feed_actor_reaction_record_view", "reason": "Existing record view with endpoint-specific fields; kept to avoid a behavior change. Build on record_view where the shape allows." }, - { - "file": "lua/shared/feedReaction.lua", - "family": "list-cursor", - "symbol": "feed_reaction_decode_cursor", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, { "file": "lua/shared/fundingReceipt.lua", "family": "record-view", "symbol": "indexed-at-null", "reason": "funding_receipt_view repeats the record_view null indexedAt fallback because it also adds author; kept to avoid a behavior change." }, - { - "file": "lua/shared/fundingReceiptList.lua", - "family": "list-cursor", - "symbol": "decode_funding_receipt_cursor", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, { "file": "lua/shared/fundingReceiptList.lua", "family": "repeated-query-array", @@ -359,12 +298,6 @@ "symbol": "recent_cursor_decode", "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." }, - { - "file": "lua/shared/recentFollows.lua", - "family": "list-cursor", - "symbol": "recent_cursor_encode", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, { "file": "lua/shared/recentFollows.lua", "family": "record-view", @@ -389,12 +322,6 @@ "symbol": "hydrate_vocab_actor_views", "reason": "Existing actor hydration variant; kept to avoid a behavior change. Build on hydrate_actor_views where the shape allows." }, - { - "file": "lua/shared/workscopeTagList.lua", - "family": "list-cursor", - "symbol": "workscope_tag_decode_cursor", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, { "file": "lua/shared/workscopeTagList.lua", "family": "repeated-query-array", @@ -449,18 +376,6 @@ "symbol": "decode_badge_response_cursor", "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." }, - { - "file": "lua/src/listContributions.lua", - "family": "list-cursor", - "symbol": "decode_contribution_cursor", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, - { - "file": "lua/src/listContributorInformation.lua", - "family": "list-cursor", - "symbol": "contributor_information_cursor_decode", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, { "file": "lua/src/listContributorInformation.lua", "family": "repeated-query-array", @@ -515,24 +430,12 @@ "symbol": "cursor-hex-decode", "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." }, - { - "file": "lua/src/listMeasurements.lua", - "family": "list-cursor", - "symbol": "decode_measurement_cursor", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, { "file": "lua/src/listMeasurements.lua", "family": "repeated-query-array", "symbol": "measurement_array", "reason": "Existing endpoint-local repeated-parameter parser; no shared parser exists yet. Kept to avoid a behavior change." }, - { - "file": "lua/src/listRights.lua", - "family": "list-cursor", - "symbol": "rights_list_cursor_decode", - "reason": "Existing endpoint-local cursor code that predates the registry; kept to avoid a behavior change. Move onto decode_cursor where the cursor shape allows." - }, { "file": "lua/src/listRights.lua", "family": "repeated-query-array", From ee47e072d8d263754ab6de6053d4c8510e204fc8 Mon Sep 17 00:00:00 2001 From: kzoeps Date: Thu, 26 Nov 2026 18:09:09 +0600 Subject: [PATCH 5/8] lua: share record and actor sidecar views Acknowledgement, collection, feature, entity-follow, EVM-link, rights and funding views build on record_view. hydrate_actor_views takes an optional view builder; the omit-missing-indexedAt builder (record_view_omitting_indexed_at, formerly workscopeRecordView's record_view) replaces the vocab hydrate wrapper and the work-scope global-name override. entity_follow_record_view becomes entity_follow_typed_view. No behavior change: list golden is byte-identical. rightsView.lua is now empty and no bundle includes it. --- .../lua/endpoints/getAcknowledgement.lua | 29 ++++---- happyview-modules/lua/endpoints/getActor.lua | 8 ++- .../lua/endpoints/getActorLikes.lua | 8 ++- .../lua/endpoints/getActorReposts.lua | 8 ++- happyview-modules/lua/endpoints/getActors.lua | 8 ++- .../lua/endpoints/getAttachment.lua | 8 ++- .../lua/endpoints/getBadgeAward.lua | 8 ++- .../lua/endpoints/getBadgeDefinition.lua | 8 ++- .../lua/endpoints/getBadgeResponse.lua | 8 ++- .../lua/endpoints/getCollection.lua | 30 ++++---- .../lua/endpoints/getContribution.lua | 8 ++- .../endpoints/getContributorInformation.lua | 8 ++- .../lua/endpoints/getEntityFollow.lua | 28 ++++---- .../lua/endpoints/getEntityFollows.lua | 28 ++++---- .../lua/endpoints/getEvaluation.lua | 8 ++- .../lua/endpoints/getEvmLink.lua | 16 ++--- .../lua/endpoints/getFeature.lua | 26 +++---- happyview-modules/lua/endpoints/getLikes.lua | 8 ++- .../lua/endpoints/getLocation.lua | 8 ++- .../lua/endpoints/getMeasurement.lua | 8 ++- .../lua/endpoints/getOrganization.lua | 8 ++- .../lua/endpoints/getOrganizations.lua | 8 ++- .../lua/endpoints/getReceipt.lua | 19 +++--- .../lua/endpoints/getReposts.lua | 8 ++- happyview-modules/lua/endpoints/getRights.lua | 31 ++------- .../lua/endpoints/getVocabTag.lua | 31 +++++---- .../lua/endpoints/getWorkscopeTag.lua | 23 +++++-- .../lua/endpoints/listAcknowledgements.lua | 29 ++++---- .../lua/endpoints/listActorFollowers.lua | 8 ++- .../lua/endpoints/listActorFollowing.lua | 8 ++- .../lua/endpoints/listAttachments.lua | 8 ++- .../lua/endpoints/listBadgeAwards.lua | 8 ++- .../lua/endpoints/listBadgeDefinitions.lua | 8 ++- .../lua/endpoints/listBadgeResponses.lua | 8 ++- .../lua/endpoints/listCollectionItems.lua | 26 +++---- .../lua/endpoints/listCollections.lua | 30 ++++---- .../lua/endpoints/listContributions.lua | 8 ++- .../endpoints/listContributorInformation.lua | 8 ++- .../lua/endpoints/listEntityFollowers.lua | 32 +++++---- .../lua/endpoints/listEntityFollowing.lua | 60 ++++++---------- .../lua/endpoints/listEvaluations.lua | 8 ++- .../lua/endpoints/listEvmLinks.lua | 16 ++--- .../lua/endpoints/listFeatures.lua | 26 +++---- .../lua/endpoints/listLocations.lua | 8 ++- .../lua/endpoints/listMeasurements.lua | 8 ++- .../lua/endpoints/listOrganizations.lua | 8 ++- .../lua/endpoints/listReceipts.lua | 19 +++--- .../lua/endpoints/listRights.lua | 31 ++------- .../lua/endpoints/listVocabTags.lua | 31 +++++---- .../lua/endpoints/listWorkscopeTags.lua | 23 +++++-- .../lua/endpoints/searchBadgeDefinitions.lua | 8 ++- .../lua/endpoints/searchCollections.lua | 30 ++++---- .../lua/endpoints/searchOrganizations.lua | 8 ++- .../lua/shared/acknowledgement.lua | 15 +--- .../lua/shared/acknowledgementList.lua | 2 +- happyview-modules/lua/shared/actorView.lua | 8 ++- .../lua/shared/collectionProjection.lua | 18 ++--- happyview-modules/lua/shared/entityFollow.lua | 14 +--- .../lua/shared/entityFollowEntities.lua | 2 +- .../lua/shared/entityFollowFollowers.lua | 6 +- .../lua/shared/entityFollowLookup.lua | 2 +- .../lua/shared/evmLinkIdentifier.lua | 6 -- .../lua/shared/featureProjection.lua | 14 +--- .../lua/shared/fundingReceipt.lua | 11 +-- .../shared/recordViewOmittingIndexedAt.lua | 11 +++ happyview-modules/lua/shared/rightsView.lua | 18 ----- .../lua/shared/vocabTagValidation.lua | 8 --- .../lua/shared/workscopeRecordView.lua | 12 ---- .../lua/shared/workscopeTagList.lua | 2 +- .../lua/src/getAcknowledgement.lua | 2 +- .../lua/src/getEntityFollows.lua | 2 +- happyview-modules/lua/src/getEvmLink.lua | 2 +- happyview-modules/lua/src/getRights.lua | 4 +- happyview-modules/lua/src/getVocabTag.lua | 2 +- happyview-modules/lua/src/getWorkscopeTag.lua | 2 +- happyview-modules/lua/src/listEvmLinks.lua | 2 +- happyview-modules/lua/src/listRights.lua | 4 +- happyview-modules/lua/src/listVocabTags.lua | 2 +- .../modules/acknowledgements/manifest.json | 2 + .../modules/collection/manifest.json | 4 ++ .../modules/entity-follow/manifest.json | 4 ++ .../modules/features/manifest.json | 2 + .../modules/rights/manifest.json | 4 +- happyview-modules/modules/vocab/manifest.json | 2 + .../modules/workscope-tags/manifest.json | 6 +- .../tests/unit/tooling/vocab-tags.test.js | 1 + .../tooling/shared-helpers.registry.json | 68 +------------------ 87 files changed, 525 insertions(+), 601 deletions(-) create mode 100644 happyview-modules/lua/shared/recordViewOmittingIndexedAt.lua delete mode 100644 happyview-modules/lua/shared/workscopeRecordView.lua diff --git a/happyview-modules/lua/endpoints/getAcknowledgement.lua b/happyview-modules/lua/endpoints/getAcknowledgement.lua index 753566ae..215ddc5e 100644 --- a/happyview-modules/lua/endpoints/getAcknowledgement.lua +++ b/happyview-modules/lua/endpoints/getAcknowledgement.lua @@ -39,10 +39,21 @@ local function valid_record_uri(value) return true, collection, authority end +local NULL = json.decode("null") + +local function record_view(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at == nil and NULL or row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end + local ACKNOWLEDGEMENT = "org.hypercerts.context.acknowledgement" local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local NULL = json.decode("null") local function acknowledgement_query(sql, values) if db.backend() ~= "postgres" then @@ -55,16 +66,6 @@ local function acknowledgement_query(sql, values) return result end -local function acknowledgement_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at or NULL, - did = row.did, - record = json.decode(row.record), - } -end - local function hydrate_acknowledgement_authors(views) local dids, seen = {}, {} for _, view in ipairs(views) do @@ -93,8 +94,8 @@ local function hydrate_acknowledgement_authors(views) for _, view in ipairs(views) do view.author = { did = view.did, - profile = profiles[view.did] and acknowledgement_record_view(profiles[view.did]) or NULL, - organization = organizations[view.did] and acknowledgement_record_view(organizations[view.did]) or NULL, + profile = profiles[view.did] and record_view(profiles[view.did]) or NULL, + organization = organizations[view.did] and record_view(organizations[view.did]) or NULL, } end end @@ -113,7 +114,7 @@ function handle() { ACKNOWLEDGEMENT, uri }) if #rows == 0 then error("RecordNotFound: acknowledgement record is not indexed", 0) end - local acknowledgement = acknowledgement_record_view(rows[1]) + local acknowledgement = record_view(rows[1]) hydrate_acknowledgement_authors({ acknowledgement }) return { acknowledgement = acknowledgement } end diff --git a/happyview-modules/lua/endpoints/getActor.lua b/happyview-modules/lua/endpoints/getActor.lua index d6fc972f..e1548fdc 100644 --- a/happyview-modules/lua/endpoints/getActor.lua +++ b/happyview-modules/lua/endpoints/getActor.lua @@ -54,7 +54,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -76,8 +78,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getActorLikes.lua b/happyview-modules/lua/endpoints/getActorLikes.lua index fd9f8147..7f098ce8 100644 --- a/happyview-modules/lua/endpoints/getActorLikes.lua +++ b/happyview-modules/lua/endpoints/getActorLikes.lua @@ -98,7 +98,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -120,8 +122,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getActorReposts.lua b/happyview-modules/lua/endpoints/getActorReposts.lua index 8a3f6574..a487aed2 100644 --- a/happyview-modules/lua/endpoints/getActorReposts.lua +++ b/happyview-modules/lua/endpoints/getActorReposts.lua @@ -98,7 +98,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -120,8 +122,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getActors.lua b/happyview-modules/lua/endpoints/getActors.lua index 2f94c956..8421b3ae 100644 --- a/happyview-modules/lua/endpoints/getActors.lua +++ b/happyview-modules/lua/endpoints/getActors.lua @@ -54,7 +54,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -76,8 +78,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getAttachment.lua b/happyview-modules/lua/endpoints/getAttachment.lua index 68b39d55..1732fbc1 100644 --- a/happyview-modules/lua/endpoints/getAttachment.lua +++ b/happyview-modules/lua/endpoints/getAttachment.lua @@ -54,7 +54,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -76,8 +78,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getBadgeAward.lua b/happyview-modules/lua/endpoints/getBadgeAward.lua index 2810967a..eef340cc 100644 --- a/happyview-modules/lua/endpoints/getBadgeAward.lua +++ b/happyview-modules/lua/endpoints/getBadgeAward.lua @@ -54,7 +54,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -76,8 +78,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getBadgeDefinition.lua b/happyview-modules/lua/endpoints/getBadgeDefinition.lua index f9c5bfec..72416c23 100644 --- a/happyview-modules/lua/endpoints/getBadgeDefinition.lua +++ b/happyview-modules/lua/endpoints/getBadgeDefinition.lua @@ -61,7 +61,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -83,8 +85,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getBadgeResponse.lua b/happyview-modules/lua/endpoints/getBadgeResponse.lua index 9a629103..7255bc8e 100644 --- a/happyview-modules/lua/endpoints/getBadgeResponse.lua +++ b/happyview-modules/lua/endpoints/getBadgeResponse.lua @@ -54,7 +54,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -76,8 +78,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getCollection.lua b/happyview-modules/lua/endpoints/getCollection.lua index bf498296..29ee8bef 100644 --- a/happyview-modules/lua/endpoints/getCollection.lua +++ b/happyview-modules/lua/endpoints/getCollection.lua @@ -45,6 +45,18 @@ local function valid_bounded_record_uri(value) return valid_record_uri(value) end +local NULL = json.decode("null") + +local function record_view(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at == nil and NULL or row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end + local COLLECTION_PROJECTION_PROFILE = "app.certified.actor.profile" local COLLECTION_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local COLLECTION_PROJECTION_LOCATION = "app.certified.location" @@ -62,16 +74,6 @@ local function collection_projection_query(sql, values) return result end -local function collection_projection_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and COLLECTION_PROJECTION_NULL or row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - local function collection_projection_ref_key(uri, cid) return uri .. "\0" .. cid end @@ -194,8 +196,8 @@ local function collection_projection_hydrate(views, omit_invalid) local tags = collection_projection_load_exact_refs(COLLECTION_PROJECTION_TAG, tag_refs) for _, view in ipairs(views) do - view.author.profile = profiles[view.did] and collection_projection_record_view(profiles[view.did]) or COLLECTION_PROJECTION_NULL - view.author.organization = organizations[view.did] and collection_projection_record_view(organizations[view.did]) or COLLECTION_PROJECTION_NULL + view.author.profile = profiles[view.did] and record_view(profiles[view.did]) or COLLECTION_PROJECTION_NULL + view.author.organization = organizations[view.did] and record_view(organizations[view.did]) or COLLECTION_PROJECTION_NULL local source_location = view.record.location ~= nil and collection_projection_reference(view.record.location, "location", COLLECTION_PROJECTION_LOCATION, omit_invalid) or nil @@ -205,7 +207,7 @@ local function collection_projection_hydrate(views, omit_invalid) view.location = { uri = source_location.uri, cid = source_location.cid, - record = row and collection_projection_record_view(row) or COLLECTION_PROJECTION_NULL, + record = row and record_view(row) or COLLECTION_PROJECTION_NULL, } end @@ -219,7 +221,7 @@ local function collection_projection_hydrate(views, omit_invalid) projected_tags[#projected_tags + 1] = { uri = reference.uri, cid = reference.cid, - record = row and collection_projection_record_view(row) or COLLECTION_PROJECTION_NULL, + record = row and record_view(row) or COLLECTION_PROJECTION_NULL, } end end diff --git a/happyview-modules/lua/endpoints/getContribution.lua b/happyview-modules/lua/endpoints/getContribution.lua index 27d505f9..811ba1ba 100644 --- a/happyview-modules/lua/endpoints/getContribution.lua +++ b/happyview-modules/lua/endpoints/getContribution.lua @@ -54,7 +54,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -76,8 +78,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getContributorInformation.lua b/happyview-modules/lua/endpoints/getContributorInformation.lua index f17d8b94..d9068491 100644 --- a/happyview-modules/lua/endpoints/getContributorInformation.lua +++ b/happyview-modules/lua/endpoints/getContributorInformation.lua @@ -62,7 +62,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -84,8 +86,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getEntityFollow.lua b/happyview-modules/lua/endpoints/getEntityFollow.lua index 5ba4bf8d..2d912672 100644 --- a/happyview-modules/lua/endpoints/getEntityFollow.lua +++ b/happyview-modules/lua/endpoints/getEntityFollow.lua @@ -39,6 +39,18 @@ local function valid_record_uri(value) return true, collection, authority end +local NULL = json.decode("null") + +local function record_view(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at == nil and NULL or row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end + local ENTITY_FOLLOW = "app.certified.graph.entityFollow" local ENTITY_FOLLOW_NULL = json.decode("null") @@ -53,18 +65,8 @@ local function entity_follow_query(sql, values) return result end -local function entity_follow_indexed_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and ENTITY_FOLLOW_NULL or row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - -local function entity_follow_record_view(row) - local view = entity_follow_indexed_record_view(row) +local function entity_follow_typed_view(row) + local view = record_view(row) view["$type"] = "app.certified.graph.getEntityFollow#entityFollowRecordView" return view end @@ -89,7 +91,7 @@ local function entity_follow_lookup(actor, entity_uri) "SELECT uri, did, cid, indexed_at::text AS indexed_at, record::text AS record FROM happyview_records CROSS JOIN LATERAL (SELECT " .. created_at_sort() .. " AS sort_at) sorted WHERE collection = $1 AND did = $2 AND record::jsonb->'subject'->>'uri' = $3 ORDER BY sorted.sort_at ASC, uri ASC LIMIT 1", { ENTITY_FOLLOW, actor, entity_uri }) if #rows == 0 then return ENTITY_FOLLOW_NULL end - return entity_follow_record_view(rows[1]) + return entity_follow_typed_view(rows[1]) end local function get_entity_follow() diff --git a/happyview-modules/lua/endpoints/getEntityFollows.lua b/happyview-modules/lua/endpoints/getEntityFollows.lua index 29b021f0..a4290a1c 100644 --- a/happyview-modules/lua/endpoints/getEntityFollows.lua +++ b/happyview-modules/lua/endpoints/getEntityFollows.lua @@ -54,6 +54,18 @@ local function created_at_sort(alias) "::timestamptz, " .. created_at .. "::timestamptz) END" end +local NULL = json.decode("null") + +local function record_view(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at == nil and NULL or row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end + local ENTITY_FOLLOW = "app.certified.graph.entityFollow" local ENTITY_FOLLOW_NULL = json.decode("null") @@ -68,18 +80,8 @@ local function entity_follow_query(sql, values) return result end -local function entity_follow_indexed_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and ENTITY_FOLLOW_NULL or row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - -local function entity_follow_record_view(row) - local view = entity_follow_indexed_record_view(row) +local function entity_follow_typed_view(row) + local view = record_view(row) view["$type"] = "app.certified.graph.getEntityFollow#entityFollowRecordView" return view end @@ -218,7 +220,7 @@ local function get_entity_follows() values) local follows_by_entity = {} - for _, row in ipairs(rows) do follows_by_entity[row.target] = entity_follow_record_view(row) end + for _, row in ipairs(rows) do follows_by_entity[row.target] = entity_follow_typed_view(row) end local results = {} for _, entity_uri in ipairs(entities) do diff --git a/happyview-modules/lua/endpoints/getEvaluation.lua b/happyview-modules/lua/endpoints/getEvaluation.lua index 2b1df083..f6d726e3 100644 --- a/happyview-modules/lua/endpoints/getEvaluation.lua +++ b/happyview-modules/lua/endpoints/getEvaluation.lua @@ -54,7 +54,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -76,8 +78,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getEvmLink.lua b/happyview-modules/lua/endpoints/getEvmLink.lua index 88cd7933..069065fb 100644 --- a/happyview-modules/lua/endpoints/getEvmLink.lua +++ b/happyview-modules/lua/endpoints/getEvmLink.lua @@ -59,12 +59,6 @@ local function valid_evm_link_uri(value) return valid and collection == EVMLINK_COLLECTION end -local function evm_link_record_view(row) - local view = record_view(row) - if view.indexedAt == nil then view.indexedAt = NULL end - return view -end - local function normalize_evm_actor_indexed_at(actors) for _, actor in ipairs(actors) do for _, field in ipairs({ "profile", "organization" }) do @@ -79,7 +73,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -101,8 +97,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end @@ -130,7 +126,7 @@ function handle() { EVMLINK, uri }) if #rows == 0 then error("RecordNotFound: EVM-link record is not indexed", 0) end - local view = evm_link_record_view(rows[1]) + local view = record_view(rows[1]) view.actor = { did = view.did } local hydrated_actors = { view.actor } hydrate_actor_views(hydrated_actors, evm_link_query) diff --git a/happyview-modules/lua/endpoints/getFeature.lua b/happyview-modules/lua/endpoints/getFeature.lua index 0f81b045..d96d8674 100644 --- a/happyview-modules/lua/endpoints/getFeature.lua +++ b/happyview-modules/lua/endpoints/getFeature.lua @@ -48,6 +48,18 @@ local function feature_valid_uri(value) return valid_did(authority) end +local NULL = json.decode("null") + +local function record_view(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at == nil and NULL or row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end + local FEATURE_PROJECTION_PROFILE = "app.certified.actor.profile" local FEATURE_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local FEATURE_PROJECTION_NULL = json.decode("null") @@ -79,16 +91,6 @@ local function feature_projection_load_actor_records(collection, dids) return by_did end -local function feature_projection_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and FEATURE_PROJECTION_NULL or row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - local function feature_projection_view(row) return { ["$type"] = "org.hypercerts.collection.listCollectionItems#featureView", @@ -113,8 +115,8 @@ local function feature_projection_hydrate(views) local profiles = feature_projection_load_actor_records(FEATURE_PROJECTION_PROFILE, dids) local organizations = feature_projection_load_actor_records(FEATURE_PROJECTION_ORGANIZATION, dids) for _, view in ipairs(views) do - view.author.profile = profiles[view.did] and feature_projection_record_view(profiles[view.did]) or FEATURE_PROJECTION_NULL - view.author.organization = organizations[view.did] and feature_projection_record_view(organizations[view.did]) or FEATURE_PROJECTION_NULL + view.author.profile = profiles[view.did] and record_view(profiles[view.did]) or FEATURE_PROJECTION_NULL + view.author.organization = organizations[view.did] and record_view(organizations[view.did]) or FEATURE_PROJECTION_NULL end end diff --git a/happyview-modules/lua/endpoints/getLikes.lua b/happyview-modules/lua/endpoints/getLikes.lua index 2714bb94..580f2e48 100644 --- a/happyview-modules/lua/endpoints/getLikes.lua +++ b/happyview-modules/lua/endpoints/getLikes.lua @@ -98,7 +98,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -120,8 +122,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getLocation.lua b/happyview-modules/lua/endpoints/getLocation.lua index b11a3b23..d9a7359f 100644 --- a/happyview-modules/lua/endpoints/getLocation.lua +++ b/happyview-modules/lua/endpoints/getLocation.lua @@ -54,7 +54,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -76,8 +78,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getMeasurement.lua b/happyview-modules/lua/endpoints/getMeasurement.lua index bd5a0221..73a1e0c4 100644 --- a/happyview-modules/lua/endpoints/getMeasurement.lua +++ b/happyview-modules/lua/endpoints/getMeasurement.lua @@ -54,7 +54,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -76,8 +78,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getOrganization.lua b/happyview-modules/lua/endpoints/getOrganization.lua index cbe59f26..15f9f60b 100644 --- a/happyview-modules/lua/endpoints/getOrganization.lua +++ b/happyview-modules/lua/endpoints/getOrganization.lua @@ -54,7 +54,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -76,8 +78,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getOrganizations.lua b/happyview-modules/lua/endpoints/getOrganizations.lua index eb3831d7..cf40b6c1 100644 --- a/happyview-modules/lua/endpoints/getOrganizations.lua +++ b/happyview-modules/lua/endpoints/getOrganizations.lua @@ -54,7 +54,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -76,8 +78,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getReceipt.lua b/happyview-modules/lua/endpoints/getReceipt.lua index a5fec131..f43009ac 100644 --- a/happyview-modules/lua/endpoints/getReceipt.lua +++ b/happyview-modules/lua/endpoints/getReceipt.lua @@ -54,7 +54,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -76,8 +78,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end @@ -95,14 +97,9 @@ local function receipt_query(sql, values) end local function funding_receipt_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and NULL or row.indexed_at, - did = row.did, - author = { did = row.did }, - record = json.decode(row.record), - } + local view = record_view(row) + view.author = { did = row.did } + return view end local function hydrate_funding_receipt_views(views) diff --git a/happyview-modules/lua/endpoints/getReposts.lua b/happyview-modules/lua/endpoints/getReposts.lua index be481a2e..fe00d066 100644 --- a/happyview-modules/lua/endpoints/getReposts.lua +++ b/happyview-modules/lua/endpoints/getReposts.lua @@ -98,7 +98,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -120,8 +122,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/getRights.lua b/happyview-modules/lua/endpoints/getRights.lua index 5f6266c4..35fa5f79 100644 --- a/happyview-modules/lua/endpoints/getRights.lua +++ b/happyview-modules/lua/endpoints/getRights.lua @@ -54,7 +54,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -76,27 +78,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL - end -end - -local RIGHTS_NULL = json.decode("null") - -local function rights_record_view(row) - local view = record_view(row) - if row.indexed_at == nil then view.indexedAt = RIGHTS_NULL end - return view -end - -local function rights_hydrate_actor_views(actors, run_query) - hydrate_actor_views(actors, run_query) - for _, actor in ipairs(actors) do - for _, sidecar in ipairs({ actor.profile, actor.organization }) do - if type(sidecar) == "table" and sidecar.uri ~= nil and sidecar.indexedAt == nil then - sidecar.indexedAt = RIGHTS_NULL - end - end + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end @@ -125,8 +108,8 @@ function handle() { RIGHTS, uri }) if #rows == 0 then error("RecordNotFound: rights record is not indexed", 0) end - local view = rights_record_view(rows[1]) + local view = record_view(rows[1]) view.author = { did = view.did } - rights_hydrate_actor_views({ view.author }, rights_query) + hydrate_actor_views({ view.author }, rights_query) return { rights = view } end diff --git a/happyview-modules/lua/endpoints/getVocabTag.lua b/happyview-modules/lua/endpoints/getVocabTag.lua index 5bf9c23a..245f6bae 100644 --- a/happyview-modules/lua/endpoints/getVocabTag.lua +++ b/happyview-modules/lua/endpoints/getVocabTag.lua @@ -54,7 +54,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -76,11 +78,23 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end + local VOCAB_TAG = "org.hypercerts.vocab.tag" local function valid_vocab_tag_uri(value) @@ -89,15 +103,6 @@ local function valid_vocab_tag_uri(value) return valid_did(authority) end -local function hydrate_vocab_actor_views(actors, run_query) - hydrate_actor_views(actors, run_query) - -- Vocab sidecars preserve the omission; only the top-level tag emits indexedAt as JSON null. - for _, actor in ipairs(actors) do - if actor.profile ~= NULL and actor.profile.indexedAt == NULL then actor.profile.indexedAt = nil end - if actor.organization ~= NULL and actor.organization.indexedAt == NULL then actor.organization.indexedAt = nil end - end -end - local COLLECTION = VOCAB_TAG local function query(sql, values) @@ -125,7 +130,7 @@ local function get_vocab_tag() local view = record_view(rows[1]) if rows[1].indexed_at == nil then view.indexedAt = json.decode("null") end view.author = { did = view.did } - hydrate_vocab_actor_views({ view.author }, query) + hydrate_actor_views({ view.author }, query, record_view_omitting_indexed_at) return { vocabTag = view } end diff --git a/happyview-modules/lua/endpoints/getWorkscopeTag.lua b/happyview-modules/lua/endpoints/getWorkscopeTag.lua index a4c327bc..47786696 100644 --- a/happyview-modules/lua/endpoints/getWorkscopeTag.lua +++ b/happyview-modules/lua/endpoints/getWorkscopeTag.lua @@ -39,10 +39,21 @@ local function valid_record_uri(value) return true, collection, authority end --- Workscope sidecars omit missing indexedAt; the work-scope tag view encodes it as JSON null separately. local NULL = json.decode("null") local function record_view(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at == nil and NULL or row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end + +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) return { uri = row.uri, cid = row.cid, @@ -55,7 +66,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -77,8 +90,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end @@ -121,7 +134,7 @@ local function workscope_tag_get(uri) if #rows == 0 then error("RecordNotFound: work-scope tag is not indexed", 0) end local view = workscope_tag_view(rows[1]) - hydrate_actor_views({ view.author }, workscope_tag_query) + hydrate_actor_views({ view.author }, workscope_tag_query, record_view_omitting_indexed_at) return { workscopeTag = view } end diff --git a/happyview-modules/lua/endpoints/listAcknowledgements.lua b/happyview-modules/lua/endpoints/listAcknowledgements.lua index f7bfc40c..c87824c4 100644 --- a/happyview-modules/lua/endpoints/listAcknowledgements.lua +++ b/happyview-modules/lua/endpoints/listAcknowledgements.lua @@ -71,10 +71,21 @@ local function parse_list_limit(params) return limit end +local NULL = json.decode("null") + +local function record_view(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at == nil and NULL or row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end + local ACKNOWLEDGEMENT = "org.hypercerts.context.acknowledgement" local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local NULL = json.decode("null") local function acknowledgement_query(sql, values) if db.backend() ~= "postgres" then @@ -87,16 +98,6 @@ local function acknowledgement_query(sql, values) return result end -local function acknowledgement_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at or NULL, - did = row.did, - record = json.decode(row.record), - } -end - local function hydrate_acknowledgement_authors(views) local dids, seen = {}, {} for _, view in ipairs(views) do @@ -125,8 +126,8 @@ local function hydrate_acknowledgement_authors(views) for _, view in ipairs(views) do view.author = { did = view.did, - profile = profiles[view.did] and acknowledgement_record_view(profiles[view.did]) or NULL, - organization = organizations[view.did] and acknowledgement_record_view(organizations[view.did]) or NULL, + profile = profiles[view.did] and record_view(profiles[view.did]) or NULL, + organization = organizations[view.did] and record_view(organizations[view.did]) or NULL, } end end @@ -321,7 +322,7 @@ local function list_acknowledgements() local rows = acknowledgement_list_query(authors, subjects, limit, cursor, direction) local acknowledgements = {} for index = 1, math.min(#rows, limit) do - acknowledgements[#acknowledgements + 1] = acknowledgement_record_view(rows[index]) + acknowledgements[#acknowledgements + 1] = record_view(rows[index]) end if #acknowledgements > 0 then hydrate_acknowledgement_authors(acknowledgements) end diff --git a/happyview-modules/lua/endpoints/listActorFollowers.lua b/happyview-modules/lua/endpoints/listActorFollowers.lua index b40290d5..23419f12 100644 --- a/happyview-modules/lua/endpoints/listActorFollowers.lua +++ b/happyview-modules/lua/endpoints/listActorFollowers.lua @@ -98,7 +98,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -120,8 +122,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/listActorFollowing.lua b/happyview-modules/lua/endpoints/listActorFollowing.lua index fd101e0d..5484d074 100644 --- a/happyview-modules/lua/endpoints/listActorFollowing.lua +++ b/happyview-modules/lua/endpoints/listActorFollowing.lua @@ -98,7 +98,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -120,8 +122,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/listAttachments.lua b/happyview-modules/lua/endpoints/listAttachments.lua index cd33c051..8cd7a4d7 100644 --- a/happyview-modules/lua/endpoints/listAttachments.lua +++ b/happyview-modules/lua/endpoints/listAttachments.lua @@ -98,7 +98,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -120,8 +122,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/listBadgeAwards.lua b/happyview-modules/lua/endpoints/listBadgeAwards.lua index 5b48207c..6625d8b9 100644 --- a/happyview-modules/lua/endpoints/listBadgeAwards.lua +++ b/happyview-modules/lua/endpoints/listBadgeAwards.lua @@ -123,7 +123,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -145,8 +147,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/listBadgeDefinitions.lua b/happyview-modules/lua/endpoints/listBadgeDefinitions.lua index 52dfd585..1adb78b2 100644 --- a/happyview-modules/lua/endpoints/listBadgeDefinitions.lua +++ b/happyview-modules/lua/endpoints/listBadgeDefinitions.lua @@ -120,7 +120,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -142,8 +144,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/listBadgeResponses.lua b/happyview-modules/lua/endpoints/listBadgeResponses.lua index de43aa2f..5557a62f 100644 --- a/happyview-modules/lua/endpoints/listBadgeResponses.lua +++ b/happyview-modules/lua/endpoints/listBadgeResponses.lua @@ -113,7 +113,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -135,8 +137,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/listCollectionItems.lua b/happyview-modules/lua/endpoints/listCollectionItems.lua index 96ebe856..3af023cd 100644 --- a/happyview-modules/lua/endpoints/listCollectionItems.lua +++ b/happyview-modules/lua/endpoints/listCollectionItems.lua @@ -217,6 +217,18 @@ local function activity_projection_hydrate_views(views) end end +local NULL = json.decode("null") + +local function record_view(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at == nil and NULL or row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end + local FEATURE_PROJECTION_PROFILE = "app.certified.actor.profile" local FEATURE_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local FEATURE_PROJECTION_NULL = json.decode("null") @@ -248,16 +260,6 @@ local function feature_projection_load_actor_records(collection, dids) return by_did end -local function feature_projection_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and FEATURE_PROJECTION_NULL or row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - local function feature_projection_view(row) return { ["$type"] = "org.hypercerts.collection.listCollectionItems#featureView", @@ -282,8 +284,8 @@ local function feature_projection_hydrate(views) local profiles = feature_projection_load_actor_records(FEATURE_PROJECTION_PROFILE, dids) local organizations = feature_projection_load_actor_records(FEATURE_PROJECTION_ORGANIZATION, dids) for _, view in ipairs(views) do - view.author.profile = profiles[view.did] and feature_projection_record_view(profiles[view.did]) or FEATURE_PROJECTION_NULL - view.author.organization = organizations[view.did] and feature_projection_record_view(organizations[view.did]) or FEATURE_PROJECTION_NULL + view.author.profile = profiles[view.did] and record_view(profiles[view.did]) or FEATURE_PROJECTION_NULL + view.author.organization = organizations[view.did] and record_view(organizations[view.did]) or FEATURE_PROJECTION_NULL end end diff --git a/happyview-modules/lua/endpoints/listCollections.lua b/happyview-modules/lua/endpoints/listCollections.lua index 221fd06b..716db232 100644 --- a/happyview-modules/lua/endpoints/listCollections.lua +++ b/happyview-modules/lua/endpoints/listCollections.lua @@ -24,6 +24,18 @@ local function valid_bounded_record_uri(value) return valid_record_uri(value) end +local NULL = json.decode("null") + +local function record_view(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at == nil and NULL or row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end + local COLLECTION_PROJECTION_PROFILE = "app.certified.actor.profile" local COLLECTION_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local COLLECTION_PROJECTION_LOCATION = "app.certified.location" @@ -41,16 +53,6 @@ local function collection_projection_query(sql, values) return result end -local function collection_projection_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and COLLECTION_PROJECTION_NULL or row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - local function collection_projection_ref_key(uri, cid) return uri .. "\0" .. cid end @@ -173,8 +175,8 @@ local function collection_projection_hydrate(views, omit_invalid) local tags = collection_projection_load_exact_refs(COLLECTION_PROJECTION_TAG, tag_refs) for _, view in ipairs(views) do - view.author.profile = profiles[view.did] and collection_projection_record_view(profiles[view.did]) or COLLECTION_PROJECTION_NULL - view.author.organization = organizations[view.did] and collection_projection_record_view(organizations[view.did]) or COLLECTION_PROJECTION_NULL + view.author.profile = profiles[view.did] and record_view(profiles[view.did]) or COLLECTION_PROJECTION_NULL + view.author.organization = organizations[view.did] and record_view(organizations[view.did]) or COLLECTION_PROJECTION_NULL local source_location = view.record.location ~= nil and collection_projection_reference(view.record.location, "location", COLLECTION_PROJECTION_LOCATION, omit_invalid) or nil @@ -184,7 +186,7 @@ local function collection_projection_hydrate(views, omit_invalid) view.location = { uri = source_location.uri, cid = source_location.cid, - record = row and collection_projection_record_view(row) or COLLECTION_PROJECTION_NULL, + record = row and record_view(row) or COLLECTION_PROJECTION_NULL, } end @@ -198,7 +200,7 @@ local function collection_projection_hydrate(views, omit_invalid) projected_tags[#projected_tags + 1] = { uri = reference.uri, cid = reference.cid, - record = row and collection_projection_record_view(row) or COLLECTION_PROJECTION_NULL, + record = row and record_view(row) or COLLECTION_PROJECTION_NULL, } end end diff --git a/happyview-modules/lua/endpoints/listContributions.lua b/happyview-modules/lua/endpoints/listContributions.lua index 93652ac0..83c6ed6f 100644 --- a/happyview-modules/lua/endpoints/listContributions.lua +++ b/happyview-modules/lua/endpoints/listContributions.lua @@ -98,7 +98,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -120,8 +122,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/listContributorInformation.lua b/happyview-modules/lua/endpoints/listContributorInformation.lua index 24560e27..2f90aff7 100644 --- a/happyview-modules/lua/endpoints/listContributorInformation.lua +++ b/happyview-modules/lua/endpoints/listContributorInformation.lua @@ -62,7 +62,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -84,8 +86,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/listEntityFollowers.lua b/happyview-modules/lua/endpoints/listEntityFollowers.lua index 344bd2eb..aca42263 100644 --- a/happyview-modules/lua/endpoints/listEntityFollowers.lua +++ b/happyview-modules/lua/endpoints/listEntityFollowers.lua @@ -83,6 +83,18 @@ local function parse_sort_direction(params) return direction end +local NULL = json.decode("null") + +local function record_view(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at == nil and NULL or row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end + local ENTITY_FOLLOW = "app.certified.graph.entityFollow" local ENTITY_FOLLOW_NULL = json.decode("null") @@ -97,18 +109,8 @@ local function entity_follow_query(sql, values) return result end -local function entity_follow_indexed_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and ENTITY_FOLLOW_NULL or row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - -local function entity_follow_record_view(row) - local view = entity_follow_indexed_record_view(row) +local function entity_follow_typed_view(row) + local view = record_view(row) view["$type"] = "app.certified.graph.getEntityFollow#entityFollowRecordView" return view end @@ -255,8 +257,8 @@ local function entity_follow_hydrate_followers(followers) local profiles = entity_follow_load_actor_records(ENTITY_FOLLOW_FOLLOWER_PROFILE, dids) local organizations = entity_follow_load_actor_records(ENTITY_FOLLOW_FOLLOWER_ORGANIZATION, dids) for _, follower in ipairs(followers) do - follower.profile = profiles[follower.did] and entity_follow_indexed_record_view(profiles[follower.did]) or ENTITY_FOLLOW_NULL - follower.organization = organizations[follower.did] and entity_follow_indexed_record_view(organizations[follower.did]) or ENTITY_FOLLOW_NULL + follower.profile = profiles[follower.did] and record_view(profiles[follower.did]) or ENTITY_FOLLOW_NULL + follower.organization = organizations[follower.did] and record_view(organizations[follower.did]) or ENTITY_FOLLOW_NULL end end @@ -266,7 +268,7 @@ local function entity_follow_follower_views(rows) followers[#followers + 1] = { ["$type"] = "app.certified.graph.listEntityFollowers#entityFollowerView", did = row.did, - follow = entity_follow_record_view(row), + follow = entity_follow_typed_view(row), } end entity_follow_hydrate_followers(followers) diff --git a/happyview-modules/lua/endpoints/listEntityFollowing.lua b/happyview-modules/lua/endpoints/listEntityFollowing.lua index c47ca69a..deb0b7d3 100644 --- a/happyview-modules/lua/endpoints/listEntityFollowing.lua +++ b/happyview-modules/lua/endpoints/listEntityFollowing.lua @@ -267,6 +267,18 @@ local function activity_projection_hydrate_views(views) end end +local NULL = json.decode("null") + +local function record_view(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at == nil and NULL or row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end + local COLLECTION_PROJECTION_PROFILE = "app.certified.actor.profile" local COLLECTION_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local COLLECTION_PROJECTION_LOCATION = "app.certified.location" @@ -284,16 +296,6 @@ local function collection_projection_query(sql, values) return result end -local function collection_projection_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and COLLECTION_PROJECTION_NULL or row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - local function collection_projection_ref_key(uri, cid) return uri .. "\0" .. cid end @@ -416,8 +418,8 @@ local function collection_projection_hydrate(views, omit_invalid) local tags = collection_projection_load_exact_refs(COLLECTION_PROJECTION_TAG, tag_refs) for _, view in ipairs(views) do - view.author.profile = profiles[view.did] and collection_projection_record_view(profiles[view.did]) or COLLECTION_PROJECTION_NULL - view.author.organization = organizations[view.did] and collection_projection_record_view(organizations[view.did]) or COLLECTION_PROJECTION_NULL + view.author.profile = profiles[view.did] and record_view(profiles[view.did]) or COLLECTION_PROJECTION_NULL + view.author.organization = organizations[view.did] and record_view(organizations[view.did]) or COLLECTION_PROJECTION_NULL local source_location = view.record.location ~= nil and collection_projection_reference(view.record.location, "location", COLLECTION_PROJECTION_LOCATION, omit_invalid) or nil @@ -427,7 +429,7 @@ local function collection_projection_hydrate(views, omit_invalid) view.location = { uri = source_location.uri, cid = source_location.cid, - record = row and collection_projection_record_view(row) or COLLECTION_PROJECTION_NULL, + record = row and record_view(row) or COLLECTION_PROJECTION_NULL, } end @@ -441,7 +443,7 @@ local function collection_projection_hydrate(views, omit_invalid) projected_tags[#projected_tags + 1] = { uri = reference.uri, cid = reference.cid, - record = row and collection_projection_record_view(row) or COLLECTION_PROJECTION_NULL, + record = row and record_view(row) or COLLECTION_PROJECTION_NULL, } end end @@ -481,16 +483,6 @@ local function feature_projection_load_actor_records(collection, dids) return by_did end -local function feature_projection_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and FEATURE_PROJECTION_NULL or row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - local function feature_projection_view(row) return { ["$type"] = "org.hypercerts.collection.listCollectionItems#featureView", @@ -515,8 +507,8 @@ local function feature_projection_hydrate(views) local profiles = feature_projection_load_actor_records(FEATURE_PROJECTION_PROFILE, dids) local organizations = feature_projection_load_actor_records(FEATURE_PROJECTION_ORGANIZATION, dids) for _, view in ipairs(views) do - view.author.profile = profiles[view.did] and feature_projection_record_view(profiles[view.did]) or FEATURE_PROJECTION_NULL - view.author.organization = organizations[view.did] and feature_projection_record_view(organizations[view.did]) or FEATURE_PROJECTION_NULL + view.author.profile = profiles[view.did] and record_view(profiles[view.did]) or FEATURE_PROJECTION_NULL + view.author.organization = organizations[view.did] and record_view(organizations[view.did]) or FEATURE_PROJECTION_NULL end end @@ -534,18 +526,8 @@ local function entity_follow_query(sql, values) return result end -local function entity_follow_indexed_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and ENTITY_FOLLOW_NULL or row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - -local function entity_follow_record_view(row) - local view = entity_follow_indexed_record_view(row) +local function entity_follow_typed_view(row) + local view = record_view(row) view["$type"] = "app.certified.graph.getEntityFollow#entityFollowRecordView" return view end @@ -743,7 +725,7 @@ local function entity_follow_resolve_entities(rows, subjects_by_row) ["$type"] = "app.certified.graph.listEntityFollowing#entityFollowingItem", uri = uri, entity = views_by_uri[uri] or ENTITY_FOLLOW_NULL, - follow = entity_follow_record_view(row), + follow = entity_follow_typed_view(row), } end return entities diff --git a/happyview-modules/lua/endpoints/listEvaluations.lua b/happyview-modules/lua/endpoints/listEvaluations.lua index f6b7c9b9..723b0aaf 100644 --- a/happyview-modules/lua/endpoints/listEvaluations.lua +++ b/happyview-modules/lua/endpoints/listEvaluations.lua @@ -98,7 +98,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -120,8 +122,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/listEvmLinks.lua b/happyview-modules/lua/endpoints/listEvmLinks.lua index 60b4029d..eb973a60 100644 --- a/happyview-modules/lua/endpoints/listEvmLinks.lua +++ b/happyview-modules/lua/endpoints/listEvmLinks.lua @@ -118,12 +118,6 @@ local function valid_evm_link_uri(value) return valid and collection == EVMLINK_COLLECTION end -local function evm_link_record_view(row) - local view = record_view(row) - if view.indexedAt == nil then view.indexedAt = NULL end - return view -end - local function normalize_evm_actor_indexed_at(actors) for _, actor in ipairs(actors) do for _, field in ipairs({ "profile", "organization" }) do @@ -138,7 +132,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -160,8 +156,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end @@ -273,7 +269,7 @@ local function list_evm_links(actors, addresses, limit, cursor, direction) local views, actors_to_hydrate = {}, {} for _, row in ipairs(rows) do - local view = evm_link_record_view(row) + local view = record_view(row) view.actor = { did = view.did } views[#views + 1] = view actors_to_hydrate[#actors_to_hydrate + 1] = view.actor diff --git a/happyview-modules/lua/endpoints/listFeatures.lua b/happyview-modules/lua/endpoints/listFeatures.lua index 75ea7ab2..62681ded 100644 --- a/happyview-modules/lua/endpoints/listFeatures.lua +++ b/happyview-modules/lua/endpoints/listFeatures.lua @@ -106,6 +106,18 @@ local function feature_valid_uri(value) return valid_did(authority) end +local NULL = json.decode("null") + +local function record_view(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at == nil and NULL or row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end + local FEATURE_PROJECTION_PROFILE = "app.certified.actor.profile" local FEATURE_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local FEATURE_PROJECTION_NULL = json.decode("null") @@ -137,16 +149,6 @@ local function feature_projection_load_actor_records(collection, dids) return by_did end -local function feature_projection_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and FEATURE_PROJECTION_NULL or row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - local function feature_projection_view(row) return { ["$type"] = "org.hypercerts.collection.listCollectionItems#featureView", @@ -171,8 +173,8 @@ local function feature_projection_hydrate(views) local profiles = feature_projection_load_actor_records(FEATURE_PROJECTION_PROFILE, dids) local organizations = feature_projection_load_actor_records(FEATURE_PROJECTION_ORGANIZATION, dids) for _, view in ipairs(views) do - view.author.profile = profiles[view.did] and feature_projection_record_view(profiles[view.did]) or FEATURE_PROJECTION_NULL - view.author.organization = organizations[view.did] and feature_projection_record_view(organizations[view.did]) or FEATURE_PROJECTION_NULL + view.author.profile = profiles[view.did] and record_view(profiles[view.did]) or FEATURE_PROJECTION_NULL + view.author.organization = organizations[view.did] and record_view(organizations[view.did]) or FEATURE_PROJECTION_NULL end end diff --git a/happyview-modules/lua/endpoints/listLocations.lua b/happyview-modules/lua/endpoints/listLocations.lua index f90e4c8e..cf6f6810 100644 --- a/happyview-modules/lua/endpoints/listLocations.lua +++ b/happyview-modules/lua/endpoints/listLocations.lua @@ -113,7 +113,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -135,8 +137,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/listMeasurements.lua b/happyview-modules/lua/endpoints/listMeasurements.lua index ed348e3b..39c51ca3 100644 --- a/happyview-modules/lua/endpoints/listMeasurements.lua +++ b/happyview-modules/lua/endpoints/listMeasurements.lua @@ -98,7 +98,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -120,8 +122,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/listOrganizations.lua b/happyview-modules/lua/endpoints/listOrganizations.lua index ff0455d2..04085b37 100644 --- a/happyview-modules/lua/endpoints/listOrganizations.lua +++ b/happyview-modules/lua/endpoints/listOrganizations.lua @@ -98,7 +98,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -120,8 +122,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/listReceipts.lua b/happyview-modules/lua/endpoints/listReceipts.lua index 5ac8fd88..5f7be7f1 100644 --- a/happyview-modules/lua/endpoints/listReceipts.lua +++ b/happyview-modules/lua/endpoints/listReceipts.lua @@ -86,7 +86,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -108,8 +110,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end @@ -127,14 +129,9 @@ local function receipt_query(sql, values) end local function funding_receipt_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and NULL or row.indexed_at, - did = row.did, - author = { did = row.did }, - record = json.decode(row.record), - } + local view = record_view(row) + view.author = { did = row.did } + return view end local function hydrate_funding_receipt_views(views) diff --git a/happyview-modules/lua/endpoints/listRights.lua b/happyview-modules/lua/endpoints/listRights.lua index aaffd793..7a35f007 100644 --- a/happyview-modules/lua/endpoints/listRights.lua +++ b/happyview-modules/lua/endpoints/listRights.lua @@ -54,7 +54,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -76,27 +78,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL - end -end - -local RIGHTS_NULL = json.decode("null") - -local function rights_record_view(row) - local view = record_view(row) - if row.indexed_at == nil then view.indexedAt = RIGHTS_NULL end - return view -end - -local function rights_hydrate_actor_views(actors, run_query) - hydrate_actor_views(actors, run_query) - for _, actor in ipairs(actors) do - for _, sidecar in ipairs({ actor.profile, actor.organization }) do - if type(sidecar) == "table" and sidecar.uri ~= nil and sidecar.indexedAt == nil then - sidecar.indexedAt = RIGHTS_NULL - end - end + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end @@ -287,12 +270,12 @@ local function rights_list_query(authors, limit, cursor, direction) local views, authors_to_hydrate = {}, {} for _, row in ipairs(rows) do - local view = rights_record_view(row) + local view = record_view(row) view.author = { did = view.did } views[#views + 1] = view authors_to_hydrate[#authors_to_hydrate + 1] = view.author end - rights_hydrate_actor_views(authors_to_hydrate, rights_list_run_query) + hydrate_actor_views(authors_to_hydrate, rights_list_run_query) local next_cursor if more then diff --git a/happyview-modules/lua/endpoints/listVocabTags.lua b/happyview-modules/lua/endpoints/listVocabTags.lua index 881a49f9..2518f6a9 100644 --- a/happyview-modules/lua/endpoints/listVocabTags.lua +++ b/happyview-modules/lua/endpoints/listVocabTags.lua @@ -98,7 +98,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -120,11 +122,23 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end + local VOCAB_TAG = "org.hypercerts.vocab.tag" local function valid_vocab_tag_uri(value) @@ -133,15 +147,6 @@ local function valid_vocab_tag_uri(value) return valid_did(authority) end -local function hydrate_vocab_actor_views(actors, run_query) - hydrate_actor_views(actors, run_query) - -- Vocab sidecars preserve the omission; only the top-level tag emits indexedAt as JSON null. - for _, actor in ipairs(actors) do - if actor.profile ~= NULL and actor.profile.indexedAt == NULL then actor.profile.indexedAt = nil end - if actor.organization ~= NULL and actor.organization.indexedAt == NULL then actor.organization.indexedAt = nil end - end -end - local COLLECTION = VOCAB_TAG local function query(sql, values) @@ -264,7 +269,7 @@ local function list_vocab_tags(authors, limit, cursor, direction) views[#views + 1] = view authors_to_hydrate[#authors_to_hydrate + 1] = view.author end - hydrate_vocab_actor_views(authors_to_hydrate, query) + hydrate_actor_views(authors_to_hydrate, query, record_view_omitting_indexed_at) local next_cursor if more then diff --git a/happyview-modules/lua/endpoints/listWorkscopeTags.lua b/happyview-modules/lua/endpoints/listWorkscopeTags.lua index 946ab0db..5f7d63a9 100644 --- a/happyview-modules/lua/endpoints/listWorkscopeTags.lua +++ b/happyview-modules/lua/endpoints/listWorkscopeTags.lua @@ -83,10 +83,21 @@ local function parse_sort_direction(params) return direction end --- Workscope sidecars omit missing indexedAt; the work-scope tag view encodes it as JSON null separately. local NULL = json.decode("null") local function record_view(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at == nil and NULL or row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end + +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) return { uri = row.uri, cid = row.cid, @@ -99,7 +110,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -121,8 +134,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end @@ -293,7 +306,7 @@ local function workscope_tag_list() views[#views + 1] = view authors_to_hydrate[#authors_to_hydrate + 1] = view.author end - hydrate_actor_views(authors_to_hydrate, workscope_tag_query) + hydrate_actor_views(authors_to_hydrate, workscope_tag_query, record_view_omitting_indexed_at) local next_cursor if more then diff --git a/happyview-modules/lua/endpoints/searchBadgeDefinitions.lua b/happyview-modules/lua/endpoints/searchBadgeDefinitions.lua index 3aafacc6..c1c45dee 100644 --- a/happyview-modules/lua/endpoints/searchBadgeDefinitions.lua +++ b/happyview-modules/lua/endpoints/searchBadgeDefinitions.lua @@ -120,7 +120,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -142,8 +144,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/endpoints/searchCollections.lua b/happyview-modules/lua/endpoints/searchCollections.lua index c60c230f..947ea0e9 100644 --- a/happyview-modules/lua/endpoints/searchCollections.lua +++ b/happyview-modules/lua/endpoints/searchCollections.lua @@ -24,6 +24,18 @@ local function valid_bounded_record_uri(value) return valid_record_uri(value) end +local NULL = json.decode("null") + +local function record_view(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at == nil and NULL or row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end + local COLLECTION_PROJECTION_PROFILE = "app.certified.actor.profile" local COLLECTION_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local COLLECTION_PROJECTION_LOCATION = "app.certified.location" @@ -41,16 +53,6 @@ local function collection_projection_query(sql, values) return result end -local function collection_projection_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and COLLECTION_PROJECTION_NULL or row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - local function collection_projection_ref_key(uri, cid) return uri .. "\0" .. cid end @@ -173,8 +175,8 @@ local function collection_projection_hydrate(views, omit_invalid) local tags = collection_projection_load_exact_refs(COLLECTION_PROJECTION_TAG, tag_refs) for _, view in ipairs(views) do - view.author.profile = profiles[view.did] and collection_projection_record_view(profiles[view.did]) or COLLECTION_PROJECTION_NULL - view.author.organization = organizations[view.did] and collection_projection_record_view(organizations[view.did]) or COLLECTION_PROJECTION_NULL + view.author.profile = profiles[view.did] and record_view(profiles[view.did]) or COLLECTION_PROJECTION_NULL + view.author.organization = organizations[view.did] and record_view(organizations[view.did]) or COLLECTION_PROJECTION_NULL local source_location = view.record.location ~= nil and collection_projection_reference(view.record.location, "location", COLLECTION_PROJECTION_LOCATION, omit_invalid) or nil @@ -184,7 +186,7 @@ local function collection_projection_hydrate(views, omit_invalid) view.location = { uri = source_location.uri, cid = source_location.cid, - record = row and collection_projection_record_view(row) or COLLECTION_PROJECTION_NULL, + record = row and record_view(row) or COLLECTION_PROJECTION_NULL, } end @@ -198,7 +200,7 @@ local function collection_projection_hydrate(views, omit_invalid) projected_tags[#projected_tags + 1] = { uri = reference.uri, cid = reference.cid, - record = row and collection_projection_record_view(row) or COLLECTION_PROJECTION_NULL, + record = row and record_view(row) or COLLECTION_PROJECTION_NULL, } end end diff --git a/happyview-modules/lua/endpoints/searchOrganizations.lua b/happyview-modules/lua/endpoints/searchOrganizations.lua index de8c5d8a..9bf08402 100644 --- a/happyview-modules/lua/endpoints/searchOrganizations.lua +++ b/happyview-modules/lua/endpoints/searchOrganizations.lua @@ -98,7 +98,9 @@ end local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -120,8 +122,8 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/shared/acknowledgement.lua b/happyview-modules/lua/shared/acknowledgement.lua index 361409d8..b29cde48 100644 --- a/happyview-modules/lua/shared/acknowledgement.lua +++ b/happyview-modules/lua/shared/acknowledgement.lua @@ -1,7 +1,6 @@ local ACKNOWLEDGEMENT = "org.hypercerts.context.acknowledgement" local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local NULL = json.decode("null") local function acknowledgement_query(sql, values) if db.backend() ~= "postgres" then @@ -14,16 +13,6 @@ local function acknowledgement_query(sql, values) return result end -local function acknowledgement_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at or NULL, - did = row.did, - record = json.decode(row.record), - } -end - local function hydrate_acknowledgement_authors(views) local dids, seen = {}, {} for _, view in ipairs(views) do @@ -52,8 +41,8 @@ local function hydrate_acknowledgement_authors(views) for _, view in ipairs(views) do view.author = { did = view.did, - profile = profiles[view.did] and acknowledgement_record_view(profiles[view.did]) or NULL, - organization = organizations[view.did] and acknowledgement_record_view(organizations[view.did]) or NULL, + profile = profiles[view.did] and record_view(profiles[view.did]) or NULL, + organization = organizations[view.did] and record_view(organizations[view.did]) or NULL, } end end diff --git a/happyview-modules/lua/shared/acknowledgementList.lua b/happyview-modules/lua/shared/acknowledgementList.lua index a1c2fb43..53c72682 100644 --- a/happyview-modules/lua/shared/acknowledgementList.lua +++ b/happyview-modules/lua/shared/acknowledgementList.lua @@ -103,7 +103,7 @@ local function list_acknowledgements() local rows = acknowledgement_list_query(authors, subjects, limit, cursor, direction) local acknowledgements = {} for index = 1, math.min(#rows, limit) do - acknowledgements[#acknowledgements + 1] = acknowledgement_record_view(rows[index]) + acknowledgements[#acknowledgements + 1] = record_view(rows[index]) end if #acknowledgements > 0 then hydrate_acknowledgement_authors(acknowledgements) end diff --git a/happyview-modules/lua/shared/actorView.lua b/happyview-modules/lua/shared/actorView.lua index 11187d16..7d51a42e 100644 --- a/happyview-modules/lua/shared/actorView.lua +++ b/happyview-modules/lua/shared/actorView.lua @@ -1,7 +1,9 @@ local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" -local function hydrate_actor_views(actors, run_query) +-- view(row) builds each profile/organization sidecar; it defaults to record_view. +local function hydrate_actor_views(actors, run_query, view) + view = view or record_view if #actors == 0 then return end local dids, seen = {}, {} for _, actor in ipairs(actors) do @@ -23,7 +25,7 @@ local function hydrate_actor_views(actors, run_query) load(PROFILE, profiles) load(ORGANIZATION, organizations) for _, actor in ipairs(actors) do - actor.profile = profiles[actor.did] and record_view(profiles[actor.did]) or NULL - actor.organization = organizations[actor.did] and record_view(organizations[actor.did]) or NULL + actor.profile = profiles[actor.did] and view(profiles[actor.did]) or NULL + actor.organization = organizations[actor.did] and view(organizations[actor.did]) or NULL end end diff --git a/happyview-modules/lua/shared/collectionProjection.lua b/happyview-modules/lua/shared/collectionProjection.lua index 58cf17e3..f36784bd 100644 --- a/happyview-modules/lua/shared/collectionProjection.lua +++ b/happyview-modules/lua/shared/collectionProjection.lua @@ -15,16 +15,6 @@ local function collection_projection_query(sql, values) return result end -local function collection_projection_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and COLLECTION_PROJECTION_NULL or row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - local function collection_projection_ref_key(uri, cid) return uri .. "\0" .. cid end @@ -147,8 +137,8 @@ local function collection_projection_hydrate(views, omit_invalid) local tags = collection_projection_load_exact_refs(COLLECTION_PROJECTION_TAG, tag_refs) for _, view in ipairs(views) do - view.author.profile = profiles[view.did] and collection_projection_record_view(profiles[view.did]) or COLLECTION_PROJECTION_NULL - view.author.organization = organizations[view.did] and collection_projection_record_view(organizations[view.did]) or COLLECTION_PROJECTION_NULL + view.author.profile = profiles[view.did] and record_view(profiles[view.did]) or COLLECTION_PROJECTION_NULL + view.author.organization = organizations[view.did] and record_view(organizations[view.did]) or COLLECTION_PROJECTION_NULL local source_location = view.record.location ~= nil and collection_projection_reference(view.record.location, "location", COLLECTION_PROJECTION_LOCATION, omit_invalid) or nil @@ -158,7 +148,7 @@ local function collection_projection_hydrate(views, omit_invalid) view.location = { uri = source_location.uri, cid = source_location.cid, - record = row and collection_projection_record_view(row) or COLLECTION_PROJECTION_NULL, + record = row and record_view(row) or COLLECTION_PROJECTION_NULL, } end @@ -172,7 +162,7 @@ local function collection_projection_hydrate(views, omit_invalid) projected_tags[#projected_tags + 1] = { uri = reference.uri, cid = reference.cid, - record = row and collection_projection_record_view(row) or COLLECTION_PROJECTION_NULL, + record = row and record_view(row) or COLLECTION_PROJECTION_NULL, } end end diff --git a/happyview-modules/lua/shared/entityFollow.lua b/happyview-modules/lua/shared/entityFollow.lua index 64468362..df542be8 100644 --- a/happyview-modules/lua/shared/entityFollow.lua +++ b/happyview-modules/lua/shared/entityFollow.lua @@ -12,18 +12,8 @@ local function entity_follow_query(sql, values) return result end -local function entity_follow_indexed_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and ENTITY_FOLLOW_NULL or row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - -local function entity_follow_record_view(row) - local view = entity_follow_indexed_record_view(row) +local function entity_follow_typed_view(row) + local view = record_view(row) view["$type"] = "app.certified.graph.getEntityFollow#entityFollowRecordView" return view end diff --git a/happyview-modules/lua/shared/entityFollowEntities.lua b/happyview-modules/lua/shared/entityFollowEntities.lua index 5275f310..52280946 100644 --- a/happyview-modules/lua/shared/entityFollowEntities.lua +++ b/happyview-modules/lua/shared/entityFollowEntities.lua @@ -79,7 +79,7 @@ local function entity_follow_resolve_entities(rows, subjects_by_row) ["$type"] = "app.certified.graph.listEntityFollowing#entityFollowingItem", uri = uri, entity = views_by_uri[uri] or ENTITY_FOLLOW_NULL, - follow = entity_follow_record_view(row), + follow = entity_follow_typed_view(row), } end return entities diff --git a/happyview-modules/lua/shared/entityFollowFollowers.lua b/happyview-modules/lua/shared/entityFollowFollowers.lua index be4aada5..43f481d9 100644 --- a/happyview-modules/lua/shared/entityFollowFollowers.lua +++ b/happyview-modules/lua/shared/entityFollowFollowers.lua @@ -28,8 +28,8 @@ local function entity_follow_hydrate_followers(followers) local profiles = entity_follow_load_actor_records(ENTITY_FOLLOW_FOLLOWER_PROFILE, dids) local organizations = entity_follow_load_actor_records(ENTITY_FOLLOW_FOLLOWER_ORGANIZATION, dids) for _, follower in ipairs(followers) do - follower.profile = profiles[follower.did] and entity_follow_indexed_record_view(profiles[follower.did]) or ENTITY_FOLLOW_NULL - follower.organization = organizations[follower.did] and entity_follow_indexed_record_view(organizations[follower.did]) or ENTITY_FOLLOW_NULL + follower.profile = profiles[follower.did] and record_view(profiles[follower.did]) or ENTITY_FOLLOW_NULL + follower.organization = organizations[follower.did] and record_view(organizations[follower.did]) or ENTITY_FOLLOW_NULL end end @@ -39,7 +39,7 @@ local function entity_follow_follower_views(rows) followers[#followers + 1] = { ["$type"] = "app.certified.graph.listEntityFollowers#entityFollowerView", did = row.did, - follow = entity_follow_record_view(row), + follow = entity_follow_typed_view(row), } end entity_follow_hydrate_followers(followers) diff --git a/happyview-modules/lua/shared/entityFollowLookup.lua b/happyview-modules/lua/shared/entityFollowLookup.lua index b811b7c1..7be0b23f 100644 --- a/happyview-modules/lua/shared/entityFollowLookup.lua +++ b/happyview-modules/lua/shared/entityFollowLookup.lua @@ -3,5 +3,5 @@ local function entity_follow_lookup(actor, entity_uri) "SELECT uri, did, cid, indexed_at::text AS indexed_at, record::text AS record FROM happyview_records CROSS JOIN LATERAL (SELECT " .. created_at_sort() .. " AS sort_at) sorted WHERE collection = $1 AND did = $2 AND record::jsonb->'subject'->>'uri' = $3 ORDER BY sorted.sort_at ASC, uri ASC LIMIT 1", { ENTITY_FOLLOW, actor, entity_uri }) if #rows == 0 then return ENTITY_FOLLOW_NULL end - return entity_follow_record_view(rows[1]) + return entity_follow_typed_view(rows[1]) end diff --git a/happyview-modules/lua/shared/evmLinkIdentifier.lua b/happyview-modules/lua/shared/evmLinkIdentifier.lua index 37a13c10..8b8aa893 100644 --- a/happyview-modules/lua/shared/evmLinkIdentifier.lua +++ b/happyview-modules/lua/shared/evmLinkIdentifier.lua @@ -6,12 +6,6 @@ local function valid_evm_link_uri(value) return valid and collection == EVMLINK_COLLECTION end -local function evm_link_record_view(row) - local view = record_view(row) - if view.indexedAt == nil then view.indexedAt = NULL end - return view -end - local function normalize_evm_actor_indexed_at(actors) for _, actor in ipairs(actors) do for _, field in ipairs({ "profile", "organization" }) do diff --git a/happyview-modules/lua/shared/featureProjection.lua b/happyview-modules/lua/shared/featureProjection.lua index 6cf68383..09aa6d3a 100644 --- a/happyview-modules/lua/shared/featureProjection.lua +++ b/happyview-modules/lua/shared/featureProjection.lua @@ -29,16 +29,6 @@ local function feature_projection_load_actor_records(collection, dids) return by_did end -local function feature_projection_record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and FEATURE_PROJECTION_NULL or row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - local function feature_projection_view(row) return { ["$type"] = "org.hypercerts.collection.listCollectionItems#featureView", @@ -63,7 +53,7 @@ local function feature_projection_hydrate(views) local profiles = feature_projection_load_actor_records(FEATURE_PROJECTION_PROFILE, dids) local organizations = feature_projection_load_actor_records(FEATURE_PROJECTION_ORGANIZATION, dids) for _, view in ipairs(views) do - view.author.profile = profiles[view.did] and feature_projection_record_view(profiles[view.did]) or FEATURE_PROJECTION_NULL - view.author.organization = organizations[view.did] and feature_projection_record_view(organizations[view.did]) or FEATURE_PROJECTION_NULL + view.author.profile = profiles[view.did] and record_view(profiles[view.did]) or FEATURE_PROJECTION_NULL + view.author.organization = organizations[view.did] and record_view(organizations[view.did]) or FEATURE_PROJECTION_NULL end end diff --git a/happyview-modules/lua/shared/fundingReceipt.lua b/happyview-modules/lua/shared/fundingReceipt.lua index 44ce7a9e..1f99995b 100644 --- a/happyview-modules/lua/shared/fundingReceipt.lua +++ b/happyview-modules/lua/shared/fundingReceipt.lua @@ -12,14 +12,9 @@ local function receipt_query(sql, values) end local function funding_receipt_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at == nil and NULL or row.indexed_at, - did = row.did, - author = { did = row.did }, - record = json.decode(row.record), - } + local view = record_view(row) + view.author = { did = row.did } + return view end local function hydrate_funding_receipt_views(views) diff --git a/happyview-modules/lua/shared/recordViewOmittingIndexedAt.lua b/happyview-modules/lua/shared/recordViewOmittingIndexedAt.lua new file mode 100644 index 00000000..f269e4a6 --- /dev/null +++ b/happyview-modules/lua/shared/recordViewOmittingIndexedAt.lua @@ -0,0 +1,11 @@ +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end diff --git a/happyview-modules/lua/shared/rightsView.lua b/happyview-modules/lua/shared/rightsView.lua index 768bbe2a..e69de29b 100644 --- a/happyview-modules/lua/shared/rightsView.lua +++ b/happyview-modules/lua/shared/rightsView.lua @@ -1,18 +0,0 @@ -local RIGHTS_NULL = json.decode("null") - -local function rights_record_view(row) - local view = record_view(row) - if row.indexed_at == nil then view.indexedAt = RIGHTS_NULL end - return view -end - -local function rights_hydrate_actor_views(actors, run_query) - hydrate_actor_views(actors, run_query) - for _, actor in ipairs(actors) do - for _, sidecar in ipairs({ actor.profile, actor.organization }) do - if type(sidecar) == "table" and sidecar.uri ~= nil and sidecar.indexedAt == nil then - sidecar.indexedAt = RIGHTS_NULL - end - end - end -end diff --git a/happyview-modules/lua/shared/vocabTagValidation.lua b/happyview-modules/lua/shared/vocabTagValidation.lua index 9864ed06..d4c2dd26 100644 --- a/happyview-modules/lua/shared/vocabTagValidation.lua +++ b/happyview-modules/lua/shared/vocabTagValidation.lua @@ -6,11 +6,3 @@ local function valid_vocab_tag_uri(value) return valid_did(authority) end -local function hydrate_vocab_actor_views(actors, run_query) - hydrate_actor_views(actors, run_query) - -- Vocab sidecars preserve the omission; only the top-level tag emits indexedAt as JSON null. - for _, actor in ipairs(actors) do - if actor.profile ~= NULL and actor.profile.indexedAt == NULL then actor.profile.indexedAt = nil end - if actor.organization ~= NULL and actor.organization.indexedAt == NULL then actor.organization.indexedAt = nil end - end -end diff --git a/happyview-modules/lua/shared/workscopeRecordView.lua b/happyview-modules/lua/shared/workscopeRecordView.lua deleted file mode 100644 index 6ed26231..00000000 --- a/happyview-modules/lua/shared/workscopeRecordView.lua +++ /dev/null @@ -1,12 +0,0 @@ --- Workscope sidecars omit missing indexedAt; the work-scope tag view encodes it as JSON null separately. -local NULL = json.decode("null") - -local function record_view(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end diff --git a/happyview-modules/lua/shared/workscopeTagList.lua b/happyview-modules/lua/shared/workscopeTagList.lua index 3cd57785..e29d5103 100644 --- a/happyview-modules/lua/shared/workscopeTagList.lua +++ b/happyview-modules/lua/shared/workscopeTagList.lua @@ -84,7 +84,7 @@ local function workscope_tag_list() views[#views + 1] = view authors_to_hydrate[#authors_to_hydrate + 1] = view.author end - hydrate_actor_views(authors_to_hydrate, workscope_tag_query) + hydrate_actor_views(authors_to_hydrate, workscope_tag_query, record_view_omitting_indexed_at) local next_cursor if more then diff --git a/happyview-modules/lua/src/getAcknowledgement.lua b/happyview-modules/lua/src/getAcknowledgement.lua index 1608e5f2..abc85e85 100644 --- a/happyview-modules/lua/src/getAcknowledgement.lua +++ b/happyview-modules/lua/src/getAcknowledgement.lua @@ -12,7 +12,7 @@ function handle() { ACKNOWLEDGEMENT, uri }) if #rows == 0 then error("RecordNotFound: acknowledgement record is not indexed", 0) end - local acknowledgement = acknowledgement_record_view(rows[1]) + local acknowledgement = record_view(rows[1]) hydrate_acknowledgement_authors({ acknowledgement }) return { acknowledgement = acknowledgement } end diff --git a/happyview-modules/lua/src/getEntityFollows.lua b/happyview-modules/lua/src/getEntityFollows.lua index ef021259..fc7f8f8b 100644 --- a/happyview-modules/lua/src/getEntityFollows.lua +++ b/happyview-modules/lua/src/getEntityFollows.lua @@ -23,7 +23,7 @@ local function get_entity_follows() values) local follows_by_entity = {} - for _, row in ipairs(rows) do follows_by_entity[row.target] = entity_follow_record_view(row) end + for _, row in ipairs(rows) do follows_by_entity[row.target] = entity_follow_typed_view(row) end local results = {} for _, entity_uri in ipairs(entities) do diff --git a/happyview-modules/lua/src/getEvmLink.lua b/happyview-modules/lua/src/getEvmLink.lua index 026e9f8b..aeb2491a 100644 --- a/happyview-modules/lua/src/getEvmLink.lua +++ b/happyview-modules/lua/src/getEvmLink.lua @@ -22,7 +22,7 @@ function handle() { EVMLINK, uri }) if #rows == 0 then error("RecordNotFound: EVM-link record is not indexed", 0) end - local view = evm_link_record_view(rows[1]) + local view = record_view(rows[1]) view.actor = { did = view.did } local hydrated_actors = { view.actor } hydrate_actor_views(hydrated_actors, evm_link_query) diff --git a/happyview-modules/lua/src/getRights.lua b/happyview-modules/lua/src/getRights.lua index e09cf980..f2e3d63e 100644 --- a/happyview-modules/lua/src/getRights.lua +++ b/happyview-modules/lua/src/getRights.lua @@ -23,8 +23,8 @@ function handle() { RIGHTS, uri }) if #rows == 0 then error("RecordNotFound: rights record is not indexed", 0) end - local view = rights_record_view(rows[1]) + local view = record_view(rows[1]) view.author = { did = view.did } - rights_hydrate_actor_views({ view.author }, rights_query) + hydrate_actor_views({ view.author }, rights_query) return { rights = view } end diff --git a/happyview-modules/lua/src/getVocabTag.lua b/happyview-modules/lua/src/getVocabTag.lua index a73c206d..87c5b9ce 100644 --- a/happyview-modules/lua/src/getVocabTag.lua +++ b/happyview-modules/lua/src/getVocabTag.lua @@ -25,7 +25,7 @@ local function get_vocab_tag() local view = record_view(rows[1]) if rows[1].indexed_at == nil then view.indexedAt = json.decode("null") end view.author = { did = view.did } - hydrate_vocab_actor_views({ view.author }, query) + hydrate_actor_views({ view.author }, query, record_view_omitting_indexed_at) return { vocabTag = view } end diff --git a/happyview-modules/lua/src/getWorkscopeTag.lua b/happyview-modules/lua/src/getWorkscopeTag.lua index 67304bbe..80d7edc7 100644 --- a/happyview-modules/lua/src/getWorkscopeTag.lua +++ b/happyview-modules/lua/src/getWorkscopeTag.lua @@ -12,7 +12,7 @@ local function workscope_tag_get(uri) if #rows == 0 then error("RecordNotFound: work-scope tag is not indexed", 0) end local view = workscope_tag_view(rows[1]) - hydrate_actor_views({ view.author }, workscope_tag_query) + hydrate_actor_views({ view.author }, workscope_tag_query, record_view_omitting_indexed_at) return { workscopeTag = view } end diff --git a/happyview-modules/lua/src/listEvmLinks.lua b/happyview-modules/lua/src/listEvmLinks.lua index ea031da9..745d72f3 100644 --- a/happyview-modules/lua/src/listEvmLinks.lua +++ b/happyview-modules/lua/src/listEvmLinks.lua @@ -106,7 +106,7 @@ local function list_evm_links(actors, addresses, limit, cursor, direction) local views, actors_to_hydrate = {}, {} for _, row in ipairs(rows) do - local view = evm_link_record_view(row) + local view = record_view(row) view.actor = { did = view.did } views[#views + 1] = view actors_to_hydrate[#actors_to_hydrate + 1] = view.actor diff --git a/happyview-modules/lua/src/listRights.lua b/happyview-modules/lua/src/listRights.lua index fe0ce6bb..82f960ec 100644 --- a/happyview-modules/lua/src/listRights.lua +++ b/happyview-modules/lua/src/listRights.lua @@ -70,12 +70,12 @@ local function rights_list_query(authors, limit, cursor, direction) local views, authors_to_hydrate = {}, {} for _, row in ipairs(rows) do - local view = rights_record_view(row) + local view = record_view(row) view.author = { did = view.did } views[#views + 1] = view authors_to_hydrate[#authors_to_hydrate + 1] = view.author end - rights_hydrate_actor_views(authors_to_hydrate, rights_list_run_query) + hydrate_actor_views(authors_to_hydrate, rights_list_run_query) local next_cursor if more then diff --git a/happyview-modules/lua/src/listVocabTags.lua b/happyview-modules/lua/src/listVocabTags.lua index 287cac96..45b71bbc 100644 --- a/happyview-modules/lua/src/listVocabTags.lua +++ b/happyview-modules/lua/src/listVocabTags.lua @@ -120,7 +120,7 @@ local function list_vocab_tags(authors, limit, cursor, direction) views[#views + 1] = view authors_to_hydrate[#authors_to_hydrate + 1] = view.author end - hydrate_vocab_actor_views(authors_to_hydrate, query) + hydrate_actor_views(authors_to_hydrate, query, record_view_omitting_indexed_at) local next_cursor if more then diff --git a/happyview-modules/modules/acknowledgements/manifest.json b/happyview-modules/modules/acknowledgements/manifest.json index 70c655ea..4f5552c7 100644 --- a/happyview-modules/modules/acknowledgements/manifest.json +++ b/happyview-modules/modules/acknowledgements/manifest.json @@ -37,6 +37,7 @@ "../../lua/shared/didValidation.lua", "../../lua/shared/query.lua", "../../lua/shared/recordIdentifier.lua", + "../../lua/shared/recordView.lua", "../../lua/shared/acknowledgement.lua" ], "config": { @@ -66,6 +67,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/recordView.lua", "../../lua/shared/acknowledgement.lua", "../../lua/shared/nsidValidation.lua", "../../lua/shared/cursorEncode.lua", diff --git a/happyview-modules/modules/collection/manifest.json b/happyview-modules/modules/collection/manifest.json index bd94dca5..c7ed48d5 100644 --- a/happyview-modules/modules/collection/manifest.json +++ b/happyview-modules/modules/collection/manifest.json @@ -10,6 +10,7 @@ "../../lua/shared/query.lua", "../../lua/shared/recordIdentifier.lua", "../../lua/shared/boundedRecordIdentifier.lua", + "../../lua/shared/recordView.lua", "../../lua/shared/collectionProjection.lua", "../../lua/shared/collection.lua" ], @@ -38,6 +39,7 @@ "../../lua/shared/didValidation.lua", "../../lua/shared/recordIdentifier.lua", "../../lua/shared/boundedRecordIdentifier.lua", + "../../lua/shared/recordView.lua", "../../lua/shared/collectionProjection.lua", "../../lua/shared/collection.lua", "../../lua/shared/datetimeValidation.lua", @@ -78,6 +80,7 @@ "../../lua/shared/didValidation.lua", "../../lua/shared/recordIdentifier.lua", "../../lua/shared/boundedRecordIdentifier.lua", + "../../lua/shared/recordView.lua", "../../lua/shared/collectionProjection.lua", "../../lua/shared/collection.lua", "../../lua/shared/datetimeValidation.lua", @@ -109,6 +112,7 @@ "../../lua/shared/didValidation.lua", "../../lua/shared/recordIdentifier.lua", "../../lua/shared/activityProjection.lua", + "../../lua/shared/recordView.lua", "../../lua/shared/featureProjection.lua", "../../lua/shared/listValidation.lua", "../../lua/shared/cursorEncode.lua", diff --git a/happyview-modules/modules/entity-follow/manifest.json b/happyview-modules/modules/entity-follow/manifest.json index 90ccc92e..e2dea06e 100644 --- a/happyview-modules/modules/entity-follow/manifest.json +++ b/happyview-modules/modules/entity-follow/manifest.json @@ -54,6 +54,7 @@ "../../lua/shared/didValidation.lua", "../../lua/shared/query.lua", "../../lua/shared/recordIdentifier.lua", + "../../lua/shared/recordView.lua", "../../lua/shared/entityFollow.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/entityFollowLookup.lua" @@ -74,6 +75,7 @@ "../../lua/shared/query.lua", "../../lua/shared/recordIdentifier.lua", "../../lua/shared/createdAtSort.lua", + "../../lua/shared/recordView.lua", "../../lua/shared/entityFollow.lua", "../../lua/shared/batchRequestTarget.lua", "../../lua/shared/followBatch.lua", @@ -99,6 +101,7 @@ "../../lua/shared/listValidation.lua", "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", + "../../lua/shared/recordView.lua", "../../lua/shared/entityFollow.lua", "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", @@ -127,6 +130,7 @@ "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/activityProjection.lua", + "../../lua/shared/recordView.lua", "../../lua/shared/collectionProjection.lua", "../../lua/shared/featureProjection.lua", "../../lua/shared/entityFollow.lua", diff --git a/happyview-modules/modules/features/manifest.json b/happyview-modules/modules/features/manifest.json index 6cf1fb93..cb1227c6 100644 --- a/happyview-modules/modules/features/manifest.json +++ b/happyview-modules/modules/features/manifest.json @@ -31,6 +31,7 @@ "../../lua/shared/query.lua", "../../lua/shared/recordIdentifier.lua", "../../lua/shared/featureValidation.lua", + "../../lua/shared/recordView.lua", "../../lua/shared/featureProjection.lua" ], "config": { "script_type": "lua", "description": "Feature lookup API handler" }, @@ -51,6 +52,7 @@ "../../lua/shared/listQuery.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/featureValidation.lua", + "../../lua/shared/recordView.lua", "../../lua/shared/featureProjection.lua" ], "config": { "script_type": "lua", "description": "Feature listing API handler" }, diff --git a/happyview-modules/modules/rights/manifest.json b/happyview-modules/modules/rights/manifest.json index 9d5afa2c..ed4452ab 100644 --- a/happyview-modules/modules/rights/manifest.json +++ b/happyview-modules/modules/rights/manifest.json @@ -17,8 +17,7 @@ "../../lua/shared/query.lua", "../../lua/shared/recordIdentifier.lua", "../../lua/shared/recordView.lua", - "../../lua/shared/actorView.lua", - "../../lua/shared/rightsView.lua" + "../../lua/shared/actorView.lua" ], "config": { "script_type": "lua", "description": "Look up one rights record" }, "dependsOn": ["org.hypercerts.claim.getRights"] @@ -41,7 +40,6 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", - "../../lua/shared/rightsView.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", "../../lua/shared/cursorEncode.lua", diff --git a/happyview-modules/modules/vocab/manifest.json b/happyview-modules/modules/vocab/manifest.json index 9452ec2b..8409d8db 100644 --- a/happyview-modules/modules/vocab/manifest.json +++ b/happyview-modules/modules/vocab/manifest.json @@ -31,6 +31,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", + "../../lua/shared/recordViewOmittingIndexedAt.lua", "../../lua/shared/vocabTagValidation.lua" ], "config": { @@ -54,6 +55,7 @@ "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", + "../../lua/shared/recordViewOmittingIndexedAt.lua", "../../lua/shared/vocabTagValidation.lua" ], "config": { diff --git a/happyview-modules/modules/workscope-tags/manifest.json b/happyview-modules/modules/workscope-tags/manifest.json index 5893a85f..22633f83 100644 --- a/happyview-modules/modules/workscope-tags/manifest.json +++ b/happyview-modules/modules/workscope-tags/manifest.json @@ -19,7 +19,8 @@ "../../lua/shared/didValidation.lua", "../../lua/shared/query.lua", "../../lua/shared/recordIdentifier.lua", - "../../lua/shared/workscopeRecordView.lua", + "../../lua/shared/recordView.lua", + "../../lua/shared/recordViewOmittingIndexedAt.lua", "../../lua/shared/actorView.lua", "../../lua/shared/workscopeTag.lua" ], @@ -52,7 +53,8 @@ "../../lua/shared/listValidation.lua", "../../lua/shared/cursorEncode.lua", "../../lua/shared/listQuery.lua", - "../../lua/shared/workscopeRecordView.lua", + "../../lua/shared/recordView.lua", + "../../lua/shared/recordViewOmittingIndexedAt.lua", "../../lua/shared/actorView.lua", "../../lua/shared/workscopeTag.lua", "../../lua/shared/cursorToken.lua", diff --git a/happyview-modules/tests/unit/tooling/vocab-tags.test.js b/happyview-modules/tests/unit/tooling/vocab-tags.test.js index 19deea75..5feaa32a 100644 --- a/happyview-modules/tests/unit/tooling/vocab-tags.test.js +++ b/happyview-modules/tests/unit/tooling/vocab-tags.test.js @@ -19,6 +19,7 @@ const sharedSources = [ "lua/shared/listQuery.lua", "lua/shared/recordView.lua", "lua/shared/actorView.lua", + "lua/shared/recordViewOmittingIndexedAt.lua", "lua/shared/vocabTagValidation.lua", ]; diff --git a/happyview-modules/tooling/shared-helpers.registry.json b/happyview-modules/tooling/shared-helpers.registry.json index 2dc6fb7e..fd2707d5 100644 --- a/happyview-modules/tooling/shared-helpers.registry.json +++ b/happyview-modules/tooling/shared-helpers.registry.json @@ -125,7 +125,7 @@ "description": "the indexedAt null fallback" } ], - "homes": ["lua/shared/recordView.lua"] + "homes": ["lua/shared/recordView.lua", "lua/shared/recordViewOmittingIndexedAt.lua"] }, { "id": "actor-view", @@ -141,12 +141,6 @@ } ], "allowlist": [ - { - "file": "lua/shared/acknowledgement.lua", - "family": "record-view", - "symbol": "acknowledgement_record_view", - "reason": "Existing record view with endpoint-specific fields; kept to avoid a behavior change. Build on record_view where the shape allows." - }, { "file": "lua/shared/acknowledgementList.lua", "family": "datetime-validation", @@ -208,24 +202,6 @@ "symbol": "collection_array", "reason": "Existing endpoint-local repeated-parameter parser; no shared parser exists yet. Kept to avoid a behavior change." }, - { - "file": "lua/shared/collectionProjection.lua", - "family": "record-view", - "symbol": "collection_projection_record_view", - "reason": "Existing record view with endpoint-specific fields; kept to avoid a behavior change. Build on record_view where the shape allows." - }, - { - "file": "lua/shared/entityFollow.lua", - "family": "record-view", - "symbol": "entity_follow_indexed_record_view", - "reason": "Existing record view with endpoint-specific fields; kept to avoid a behavior change. Build on record_view where the shape allows." - }, - { - "file": "lua/shared/entityFollow.lua", - "family": "record-view", - "symbol": "entity_follow_record_view", - "reason": "Existing record view with endpoint-specific fields; kept to avoid a behavior change. Build on record_view where the shape allows." - }, { "file": "lua/shared/evaluation.lua", "family": "repeated-query-array", @@ -238,30 +214,12 @@ "symbol": "evaluation_array", "reason": "Existing endpoint-local repeated-parameter parser; no shared parser exists yet. Kept to avoid a behavior change." }, - { - "file": "lua/shared/evmLinkIdentifier.lua", - "family": "record-view", - "symbol": "evm_link_record_view", - "reason": "Existing record view with endpoint-specific fields; kept to avoid a behavior change. Build on record_view where the shape allows." - }, - { - "file": "lua/shared/featureProjection.lua", - "family": "record-view", - "symbol": "feature_projection_record_view", - "reason": "Existing record view with endpoint-specific fields; kept to avoid a behavior change. Build on record_view where the shape allows." - }, { "file": "lua/shared/feedActorReactions.lua", "family": "record-view", "symbol": "feed_actor_reaction_record_view", "reason": "Existing record view with endpoint-specific fields; kept to avoid a behavior change. Build on record_view where the shape allows." }, - { - "file": "lua/shared/fundingReceipt.lua", - "family": "record-view", - "symbol": "indexed-at-null", - "reason": "funding_receipt_view repeats the record_view null indexedAt fallback because it also adds author; kept to avoid a behavior change." - }, { "file": "lua/shared/fundingReceiptList.lua", "family": "repeated-query-array", @@ -304,24 +262,6 @@ "symbol": "recent_record_view", "reason": "Existing record view with endpoint-specific fields; kept to avoid a behavior change. Build on record_view where the shape allows." }, - { - "file": "lua/shared/rightsView.lua", - "family": "actor-view", - "symbol": "rights_hydrate_actor_views", - "reason": "Existing actor hydration variant; kept to avoid a behavior change. Build on hydrate_actor_views where the shape allows." - }, - { - "file": "lua/shared/rightsView.lua", - "family": "record-view", - "symbol": "rights_record_view", - "reason": "Existing record view with endpoint-specific fields; kept to avoid a behavior change. Build on record_view where the shape allows." - }, - { - "file": "lua/shared/vocabTagValidation.lua", - "family": "actor-view", - "symbol": "hydrate_vocab_actor_views", - "reason": "Existing actor hydration variant; kept to avoid a behavior change. Build on hydrate_actor_views where the shape allows." - }, { "file": "lua/shared/workscopeTagList.lua", "family": "repeated-query-array", @@ -508,12 +448,6 @@ "symbol": "cursor_decode", "reason": "Existing duplicate of a lua/shared helper; baseline until the consolidation PRs land." }, - { - "file": "lua/shared/workscopeRecordView.lua", - "family": "shared-helper", - "symbol": "record_view", - "reason": "Existing duplicate of a lua/shared helper; baseline until the consolidation PRs land." - }, { "file": "lua/src/getBadgeAward.lua", "family": "shared-helper", From 8781ca48695fd40b08256f0ab3d70c93aeb1df2b Mon Sep 17 00:00:00 2001 From: kzoeps Date: Thu, 26 Nov 2026 18:14:25 +0600 Subject: [PATCH 6/8] lua: delete empty rightsIdentifier and rightsView shared files Both lost their last function in the record-URI and record-view commits and no bundle includes them. Drops their entries from the two rights unit tests that assembled bundles by path. Generated bundles and list golden unchanged. --- .../lua/shared/rightsIdentifier.lua | 0 happyview-modules/lua/shared/rightsView.lua | 0 .../unit/endpoints/rights-edge-lua.test.js | 2 -- .../tests/unit/endpoints/rights-lua.test.js | 32 ++++++------------- 4 files changed, 9 insertions(+), 25 deletions(-) delete mode 100644 happyview-modules/lua/shared/rightsIdentifier.lua delete mode 100644 happyview-modules/lua/shared/rightsView.lua diff --git a/happyview-modules/lua/shared/rightsIdentifier.lua b/happyview-modules/lua/shared/rightsIdentifier.lua deleted file mode 100644 index e69de29b..00000000 diff --git a/happyview-modules/lua/shared/rightsView.lua b/happyview-modules/lua/shared/rightsView.lua deleted file mode 100644 index e69de29b..00000000 diff --git a/happyview-modules/tests/unit/endpoints/rights-edge-lua.test.js b/happyview-modules/tests/unit/endpoints/rights-edge-lua.test.js index 91c52015..3e9fbbe5 100644 --- a/happyview-modules/tests/unit/endpoints/rights-edge-lua.test.js +++ b/happyview-modules/tests/unit/endpoints/rights-edge-lua.test.js @@ -12,10 +12,8 @@ async function endpointSources(name) { "lua/shared/didValidation.lua", "lua/shared/query.lua", "lua/shared/recordIdentifier.lua", - "lua/shared/rightsIdentifier.lua", "lua/shared/recordView.lua", "lua/shared/actorView.lua", - "lua/shared/rightsView.lua", ]; if (name === "listRights") shared.push( diff --git a/happyview-modules/tests/unit/endpoints/rights-lua.test.js b/happyview-modules/tests/unit/endpoints/rights-lua.test.js index 94932ea6..69190754 100644 --- a/happyview-modules/tests/unit/endpoints/rights-lua.test.js +++ b/happyview-modules/tests/unit/endpoints/rights-lua.test.js @@ -8,25 +8,15 @@ const root = fileURLToPath(new URL("../../../", import.meta.url)); const read = (relative) => readFile(path.resolve(root, relative), "utf8"); test("getRights returns the full indexed record and a nullable hydrated publisher", async () => { - const [ - didValidation, - query, - recordIdentifier, - rightsIdentifier, - recordView, - actorView, - rightsView, - getRights, - ] = await Promise.all([ - read("lua/shared/didValidation.lua"), - read("lua/shared/query.lua"), - read("lua/shared/recordIdentifier.lua"), - read("lua/shared/rightsIdentifier.lua"), - read("lua/shared/recordView.lua"), - read("lua/shared/actorView.lua"), - read("lua/shared/rightsView.lua"), - read("lua/src/getRights.lua"), - ]); + const [didValidation, query, recordIdentifier, recordView, actorView, getRights] = + await Promise.all([ + read("lua/shared/didValidation.lua"), + read("lua/shared/query.lua"), + read("lua/shared/recordIdentifier.lua"), + read("lua/shared/recordView.lua"), + read("lua/shared/actorView.lua"), + read("lua/src/getRights.lua"), + ]); const program = [ `local null_value = {}`, `local rights_record = { @@ -72,10 +62,8 @@ test("getRights returns the full indexed record and a nullable hydrated publishe didValidation, query, recordIdentifier, - rightsIdentifier, recordView, actorView, - rightsView, getRights, `local response = handle() assert(response.rights.uri == params.uri) @@ -99,10 +87,8 @@ async function listRightsSources() { read("lua/shared/didValidation.lua"), read("lua/shared/query.lua"), read("lua/shared/recordIdentifier.lua"), - read("lua/shared/rightsIdentifier.lua"), read("lua/shared/recordView.lua"), read("lua/shared/actorView.lua"), - read("lua/shared/rightsView.lua"), read("lua/shared/datetimeValidation.lua"), read("lua/shared/listValidation.lua"), read("lua/shared/cursorEncode.lua"), From 3cd21710eae57dc263cff901e41ec2b31d6a7060 Mon Sep 17 00:00:00 2001 From: kzoeps Date: Thu, 26 Nov 2026 19:14:34 +0600 Subject: [PATCH 7/8] lua: fold five small shared files into their families recordViewOmittingIndexedAt -> recordView.lua, cursorToken and cursorEncode -> listCursor.lua, scalarOrBoolean -> query.lua, boundedRecordIdentifier -> recordIdentifier.lua. Helpers that only some bundles use sit inside luacheck 'ignore 211' regions so bundles that skip them still lint clean. listVocabTags' local decode_cursor is renamed decode_vocab_tag_cursor because its bundle now carries the shared decode_cursor. Golden byte-identical. --- .../lua/endpoints/getAcknowledgement.lua | 31 +++++ .../lua/endpoints/getActivity.lua | 17 +++ happyview-modules/lua/endpoints/getActor.lua | 31 +++++ .../lua/endpoints/getActorLikes.lua | 117 +++++++++++------- .../lua/endpoints/getActorReactions.lua | 31 +++++ .../lua/endpoints/getActorReposts.lua | 117 +++++++++++------- happyview-modules/lua/endpoints/getActors.lua | 31 +++++ .../lua/endpoints/getAttachment.lua | 31 +++++ .../lua/endpoints/getBadgeAward.lua | 31 +++++ .../lua/endpoints/getBadgeDefinition.lua | 31 +++++ .../lua/endpoints/getBadgeResponse.lua | 31 +++++ .../lua/endpoints/getCollection.lua | 25 ++++ .../lua/endpoints/getCommentCounts.lua | 17 +++ .../lua/endpoints/getContribution.lua | 31 +++++ .../endpoints/getContributorInformation.lua | 31 +++++ .../lua/endpoints/getEntityFollow.lua | 31 +++++ .../lua/endpoints/getEntityFollows.lua | 31 +++++ .../lua/endpoints/getEvaluation.lua | 31 +++++ .../lua/endpoints/getEvmLink.lua | 31 +++++ .../lua/endpoints/getFeature.lua | 31 +++++ happyview-modules/lua/endpoints/getFollow.lua | 23 ++++ .../lua/endpoints/getFollowerCounts.lua | 17 +++ .../lua/endpoints/getFollows.lua | 23 ++++ happyview-modules/lua/endpoints/getLikes.lua | 117 +++++++++++------- .../lua/endpoints/getLocation.lua | 31 +++++ .../lua/endpoints/getMeasurement.lua | 31 +++++ .../lua/endpoints/getOrganization.lua | 31 +++++ .../lua/endpoints/getOrganizations.lua | 31 +++++ .../lua/endpoints/getProfile.lua | 23 ++++ .../lua/endpoints/getProfiles.lua | 23 ++++ .../lua/endpoints/getReactionCounts.lua | 17 +++ .../lua/endpoints/getReceipt.lua | 31 +++++ .../lua/endpoints/getReposts.lua | 117 +++++++++++------- happyview-modules/lua/endpoints/getRights.lua | 31 +++++ .../lua/endpoints/getVocabTag.lua | 43 +++++-- .../lua/endpoints/getWorkscopeTag.lua | 19 +++ .../lua/endpoints/listAcknowledgements.lua | 57 +++++++-- .../lua/endpoints/listActivities.lua | 36 ++++-- .../lua/endpoints/listActorFollowers.lua | 75 +++++++++++ .../lua/endpoints/listActorFollowing.lua | 75 +++++++++++ .../lua/endpoints/listAttachments.lua | 117 +++++++++++------- .../lua/endpoints/listBadgeAwards.lua | 75 +++++++++++ .../lua/endpoints/listBadgeDefinitions.lua | 75 +++++++++++ .../lua/endpoints/listBadgeResponses.lua | 75 +++++++++++ .../lua/endpoints/listCollectionItems.lua | 97 ++++++++++++++- .../lua/endpoints/listCollections.lua | 44 +++++-- .../lua/endpoints/listContributions.lua | 117 +++++++++++------- .../endpoints/listContributorInformation.lua | 57 +++++++-- .../lua/endpoints/listEntityFollowers.lua | 117 +++++++++++------- .../lua/endpoints/listEntityFollowing.lua | 111 ++++++++++------- .../lua/endpoints/listEvaluations.lua | 117 +++++++++++------- .../lua/endpoints/listEvmLinks.lua | 75 +++++++++++ .../lua/endpoints/listFeatures.lua | 75 +++++++++++ .../lua/endpoints/listLocations.lua | 75 +++++++++++ .../lua/endpoints/listMeasurements.lua | 117 +++++++++++------- .../lua/endpoints/listOrganizations.lua | 75 +++++++++++ .../lua/endpoints/listProfiles.lua | 75 +++++++++++ .../lua/endpoints/listReceipts.lua | 57 +++++++-- .../lua/endpoints/listRecentFollows.lua | 61 +++++++++ .../lua/endpoints/listRights.lua | 57 +++++++-- .../lua/endpoints/listVocabTags.lua | 91 +++++++++++--- .../lua/endpoints/listWorkscopeTags.lua | 105 +++++++++------- .../lua/endpoints/searchActivities.lua | 36 ++++-- .../lua/endpoints/searchBadgeDefinitions.lua | 75 +++++++++++ .../lua/endpoints/searchCollections.lua | 44 +++++-- .../lua/endpoints/searchOrganizations.lua | 75 +++++++++++ .../lua/endpoints/searchProfiles.lua | 75 +++++++++++ .../lua/shared/boundedRecordIdentifier.lua | 5 - happyview-modules/lua/shared/cursorEncode.lua | 5 - happyview-modules/lua/shared/cursorToken.lua | 9 -- happyview-modules/lua/shared/listCursor.lua | 18 +++ happyview-modules/lua/shared/query.lua | 9 ++ .../lua/shared/recordIdentifier.lua | 8 ++ happyview-modules/lua/shared/recordView.lua | 14 +++ .../shared/recordViewOmittingIndexedAt.lua | 11 -- .../lua/shared/scalarOrBoolean.lua | 6 - happyview-modules/lua/src/listVocabTags.lua | 4 +- .../modules/acknowledgements/manifest.json | 4 +- .../modules/activity/manifest.json | 10 +- .../modules/actor-follow/manifest.json | 4 +- .../modules/badge-definitions/manifest.json | 2 +- .../modules/badge-queries/manifest.json | 6 +- .../modules/collection/manifest.json | 17 +-- .../modules/context-attachments/manifest.json | 4 +- .../modules/context-evaluation/manifest.json | 4 +- .../context-measurements/manifest.json | 4 +- .../modules/contribution/manifest.json | 4 +- .../contributor-information/manifest.json | 4 +- .../modules/entity-follow/manifest.json | 9 +- .../modules/evm-links/manifest.json | 2 +- .../modules/features/manifest.json | 2 +- .../modules/feed-reactions/manifest.json | 16 +-- .../modules/funding/manifest.json | 4 +- .../modules/location/manifest.json | 2 +- .../modules/organization/manifest.json | 4 +- .../modules/profile/manifest.json | 4 +- .../modules/recent-follows/manifest.json | 2 +- .../modules/rights/manifest.json | 4 +- happyview-modules/modules/vocab/manifest.json | 4 +- .../modules/workscope-tags/manifest.json | 6 +- .../unit/endpoints/rights-edge-lua.test.js | 4 +- .../tests/unit/endpoints/rights-lua.test.js | 4 +- happyview-modules/tests/unit/feature.test.js | 2 +- .../tests/unit/lua/recentFollows.test.lua | 2 +- .../listContributorInformation.test.js | 4 +- .../tests/unit/tooling/vocab-tags.test.js | 3 +- .../tooling/shared-helpers.registry.json | 19 ++- 107 files changed, 3291 insertions(+), 737 deletions(-) delete mode 100644 happyview-modules/lua/shared/boundedRecordIdentifier.lua delete mode 100644 happyview-modules/lua/shared/cursorEncode.lua delete mode 100644 happyview-modules/lua/shared/cursorToken.lua delete mode 100644 happyview-modules/lua/shared/recordViewOmittingIndexedAt.lua delete mode 100644 happyview-modules/lua/shared/scalarOrBoolean.lua diff --git a/happyview-modules/lua/endpoints/getAcknowledgement.lua b/happyview-modules/lua/endpoints/getAcknowledgement.lua index 215ddc5e..db262ecf 100644 --- a/happyview-modules/lua/endpoints/getAcknowledgement.lua +++ b/happyview-modules/lua/endpoints/getAcknowledgement.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local ACKNOWLEDGEMENT = "org.hypercerts.context.acknowledgement" local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/getActivity.lua b/happyview-modules/lua/endpoints/getActivity.lua index 0841bace..cf2d29fa 100644 --- a/happyview-modules/lua/endpoints/getActivity.lua +++ b/happyview-modules/lua/endpoints/getActivity.lua @@ -18,6 +18,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local ACTIVITY_PROJECTION_CONTRIBUTOR_INFORMATION = "org.hypercerts.claim.contributorInformation" local ACTIVITY_PROJECTION_PROFILE = "app.certified.actor.profile" local ACTIVITY_PROJECTION_ORGANIZATION = "app.certified.actor.organization" @@ -217,6 +225,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local ACTIVITY = "org.hypercerts.claim.activity" local function query(sql, values) diff --git a/happyview-modules/lua/endpoints/getActor.lua b/happyview-modules/lua/endpoints/getActor.lua index e1548fdc..03a5c171 100644 --- a/happyview-modules/lua/endpoints/getActor.lua +++ b/happyview-modules/lua/endpoints/getActor.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/getActorLikes.lua b/happyview-modules/lua/endpoints/getActorLikes.lua index 7f098ce8..800befac 100644 --- a/happyview-modules/lua/endpoints/getActorLikes.lua +++ b/happyview-modules/lua/endpoints/getActorLikes.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" @@ -127,48 +202,6 @@ local function hydrate_actor_views(actors, run_query, view) end end --- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), --- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the --- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. -local function decode_hex_cursor_token(token) - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) -end - --- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other --- sort directions and unknown keys; validate_value(value) -> boolean runs the --- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character --- cap or accept extra keys. -local function decode_cursor(token, direction, validate_value) - if token == nil then return nil end - local decoded = decode_hex_cursor_token(token) - local ok, value = pcall(json.decode, decoded) - if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction - or type(value.t) ~= "string" or type(value.u) ~= "string" then - invalid("cursor is malformed or belongs to another sortDirection") - end - for key in pairs(value) do - if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end - end - if not validate_value(value) then invalid("cursor is malformed") end - return value -end - --- decode_cursor for the common case: t is a datetime and u a record URI. --- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean --- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. -local function decode_record_cursor(token, direction, record_uri, valid_t) - valid_t = valid_t or valid_datetime - return decode_cursor(token, direction, function(value) - if not valid_t(value.t) then return false end - if type(record_uri) == "function" then return record_uri(value.u) end - local valid, collection = valid_record_uri(value.u) - return valid and collection == record_uri - end) -end - local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a diff --git a/happyview-modules/lua/endpoints/getActorReactions.lua b/happyview-modules/lua/endpoints/getActorReactions.lua index 9ff8efe1..06728f04 100644 --- a/happyview-modules/lua/endpoints/getActorReactions.lua +++ b/happyview-modules/lua/endpoints/getActorReactions.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + -- An atproto NSID: at least three dot-separated segments, at most 317 characters. local function valid_nsid(value) if type(value) ~= "string" or #value > 317 then return false end diff --git a/happyview-modules/lua/endpoints/getActorReposts.lua b/happyview-modules/lua/endpoints/getActorReposts.lua index a487aed2..eada5567 100644 --- a/happyview-modules/lua/endpoints/getActorReposts.lua +++ b/happyview-modules/lua/endpoints/getActorReposts.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" @@ -127,48 +202,6 @@ local function hydrate_actor_views(actors, run_query, view) end end --- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), --- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the --- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. -local function decode_hex_cursor_token(token) - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) -end - --- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other --- sort directions and unknown keys; validate_value(value) -> boolean runs the --- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character --- cap or accept extra keys. -local function decode_cursor(token, direction, validate_value) - if token == nil then return nil end - local decoded = decode_hex_cursor_token(token) - local ok, value = pcall(json.decode, decoded) - if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction - or type(value.t) ~= "string" or type(value.u) ~= "string" then - invalid("cursor is malformed or belongs to another sortDirection") - end - for key in pairs(value) do - if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end - end - if not validate_value(value) then invalid("cursor is malformed") end - return value -end - --- decode_cursor for the common case: t is a datetime and u a record URI. --- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean --- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. -local function decode_record_cursor(token, direction, record_uri, valid_t) - valid_t = valid_t or valid_datetime - return decode_cursor(token, direction, function(value) - if not valid_t(value.t) then return false end - if type(record_uri) == "function" then return record_uri(value.u) end - local valid, collection = valid_record_uri(value.u) - return valid and collection == record_uri - end) -end - local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a diff --git a/happyview-modules/lua/endpoints/getActors.lua b/happyview-modules/lua/endpoints/getActors.lua index 8421b3ae..34a3fe02 100644 --- a/happyview-modules/lua/endpoints/getActors.lua +++ b/happyview-modules/lua/endpoints/getActors.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/getAttachment.lua b/happyview-modules/lua/endpoints/getAttachment.lua index 1732fbc1..e501125e 100644 --- a/happyview-modules/lua/endpoints/getAttachment.lua +++ b/happyview-modules/lua/endpoints/getAttachment.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/getBadgeAward.lua b/happyview-modules/lua/endpoints/getBadgeAward.lua index eef340cc..559b6ea1 100644 --- a/happyview-modules/lua/endpoints/getBadgeAward.lua +++ b/happyview-modules/lua/endpoints/getBadgeAward.lua @@ -19,6 +19,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_did(value) if type(value) ~= "string" or #value > 2048 then return false end local method, specific = value:match("^did:([a-z]+):(.+)$") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/getBadgeDefinition.lua b/happyview-modules/lua/endpoints/getBadgeDefinition.lua index 72416c23..3d33e72f 100644 --- a/happyview-modules/lua/endpoints/getBadgeDefinition.lua +++ b/happyview-modules/lua/endpoints/getBadgeDefinition.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local BADGE_DEFINITION_COLLECTION = "app.certified.badge.definition" local function valid_badge_definition_uri(value) @@ -58,6 +75,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/getBadgeResponse.lua b/happyview-modules/lua/endpoints/getBadgeResponse.lua index 7255bc8e..14bedb30 100644 --- a/happyview-modules/lua/endpoints/getBadgeResponse.lua +++ b/happyview-modules/lua/endpoints/getBadgeResponse.lua @@ -19,6 +19,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_did(value) if type(value) ~= "string" or #value > 2048 then return false end local method, specific = value:match("^did:([a-z]+):(.+)$") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/getCollection.lua b/happyview-modules/lua/endpoints/getCollection.lua index 29ee8bef..71b50860 100644 --- a/happyview-modules/lua/endpoints/getCollection.lua +++ b/happyview-modules/lua/endpoints/getCollection.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,11 +48,13 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 -- For user-supplied filter values: bounds the size before parsing. local function valid_bounded_record_uri(value) if type(value) ~= "string" or #value > 8192 then return false end return valid_record_uri(value) end +-- luacheck: pop local NULL = json.decode("null") @@ -57,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local COLLECTION_PROJECTION_PROFILE = "app.certified.actor.profile" local COLLECTION_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local COLLECTION_PROJECTION_LOCATION = "app.certified.location" diff --git a/happyview-modules/lua/endpoints/getCommentCounts.lua b/happyview-modules/lua/endpoints/getCommentCounts.lua index 87458d29..ef319a74 100644 --- a/happyview-modules/lua/endpoints/getCommentCounts.lua +++ b/happyview-modules/lua/endpoints/getCommentCounts.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + -- An atproto NSID: at least three dot-separated segments, at most 317 characters. local function valid_nsid(value) if type(value) ~= "string" or #value > 317 then return false end diff --git a/happyview-modules/lua/endpoints/getContribution.lua b/happyview-modules/lua/endpoints/getContribution.lua index 811ba1ba..61c96fcc 100644 --- a/happyview-modules/lua/endpoints/getContribution.lua +++ b/happyview-modules/lua/endpoints/getContribution.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/getContributorInformation.lua b/happyview-modules/lua/endpoints/getContributorInformation.lua index d9068491..15436244 100644 --- a/happyview-modules/lua/endpoints/getContributorInformation.lua +++ b/happyview-modules/lua/endpoints/getContributorInformation.lua @@ -19,6 +19,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_did(value) if type(value) ~= "string" or #value > 2048 then return false end local method, specific = value:match("^did:([a-z]+):(.+)$") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local CONTRIBUTOR_INFORMATION_COLLECTION = "org.hypercerts.claim.contributorInformation" local function contributor_information_uri(value) @@ -59,6 +76,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/getEntityFollow.lua b/happyview-modules/lua/endpoints/getEntityFollow.lua index 2d912672..f5494e5a 100644 --- a/happyview-modules/lua/endpoints/getEntityFollow.lua +++ b/happyview-modules/lua/endpoints/getEntityFollow.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local ENTITY_FOLLOW = "app.certified.graph.entityFollow" local ENTITY_FOLLOW_NULL = json.decode("null") diff --git a/happyview-modules/lua/endpoints/getEntityFollows.lua b/happyview-modules/lua/endpoints/getEntityFollows.lua index a4290a1c..127c33a7 100644 --- a/happyview-modules/lua/endpoints/getEntityFollows.lua +++ b/happyview-modules/lua/endpoints/getEntityFollows.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a @@ -66,6 +83,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local ENTITY_FOLLOW = "app.certified.graph.entityFollow" local ENTITY_FOLLOW_NULL = json.decode("null") diff --git a/happyview-modules/lua/endpoints/getEvaluation.lua b/happyview-modules/lua/endpoints/getEvaluation.lua index f6d726e3..48916737 100644 --- a/happyview-modules/lua/endpoints/getEvaluation.lua +++ b/happyview-modules/lua/endpoints/getEvaluation.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/getEvmLink.lua b/happyview-modules/lua/endpoints/getEvmLink.lua index 069065fb..b2240336 100644 --- a/happyview-modules/lua/endpoints/getEvmLink.lua +++ b/happyview-modules/lua/endpoints/getEvmLink.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local EVMLINK_COLLECTION = "app.certified.link.evm" local function valid_evm_link_uri(value) diff --git a/happyview-modules/lua/endpoints/getFeature.lua b/happyview-modules/lua/endpoints/getFeature.lua index d96d8674..6bece19e 100644 --- a/happyview-modules/lua/endpoints/getFeature.lua +++ b/happyview-modules/lua/endpoints/getFeature.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local FEATURE_COLLECTION = "org.hypercerts.entity.feature" local function feature_valid_uri(value) @@ -60,6 +77,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local FEATURE_PROJECTION_PROFILE = "app.certified.actor.profile" local FEATURE_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local FEATURE_PROJECTION_NULL = json.decode("null") diff --git a/happyview-modules/lua/endpoints/getFollow.lua b/happyview-modules/lua/endpoints/getFollow.lua index b2b5c32d..90c7ca74 100644 --- a/happyview-modules/lua/endpoints/getFollow.lua +++ b/happyview-modules/lua/endpoints/getFollow.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -39,6 +48,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + -- Some clients wrote account follows whose `via` points at the followed -- account's own org.hypercerts.collection, using the account follow as a -- project follow. Those records stay indexed but are not account follows, so diff --git a/happyview-modules/lua/endpoints/getFollowerCounts.lua b/happyview-modules/lua/endpoints/getFollowerCounts.lua index a7f3ce3f..0f110174 100644 --- a/happyview-modules/lua/endpoints/getFollowerCounts.lua +++ b/happyview-modules/lua/endpoints/getFollowerCounts.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + -- An atproto NSID: at least three dot-separated segments, at most 317 characters. local function valid_nsid(value) if type(value) ~= "string" or #value > 317 then return false end diff --git a/happyview-modules/lua/endpoints/getFollows.lua b/happyview-modules/lua/endpoints/getFollows.lua index 11851d35..34d15820 100644 --- a/happyview-modules/lua/endpoints/getFollows.lua +++ b/happyview-modules/lua/endpoints/getFollows.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -39,6 +48,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + -- Some clients wrote account follows whose `via` points at the followed -- account's own org.hypercerts.collection, using the account follow as a -- project follow. Those records stay indexed but are not account follows, so diff --git a/happyview-modules/lua/endpoints/getLikes.lua b/happyview-modules/lua/endpoints/getLikes.lua index 580f2e48..5413be6b 100644 --- a/happyview-modules/lua/endpoints/getLikes.lua +++ b/happyview-modules/lua/endpoints/getLikes.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" @@ -127,48 +202,6 @@ local function hydrate_actor_views(actors, run_query, view) end end --- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), --- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the --- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. -local function decode_hex_cursor_token(token) - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) -end - --- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other --- sort directions and unknown keys; validate_value(value) -> boolean runs the --- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character --- cap or accept extra keys. -local function decode_cursor(token, direction, validate_value) - if token == nil then return nil end - local decoded = decode_hex_cursor_token(token) - local ok, value = pcall(json.decode, decoded) - if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction - or type(value.t) ~= "string" or type(value.u) ~= "string" then - invalid("cursor is malformed or belongs to another sortDirection") - end - for key in pairs(value) do - if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end - end - if not validate_value(value) then invalid("cursor is malformed") end - return value -end - --- decode_cursor for the common case: t is a datetime and u a record URI. --- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean --- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. -local function decode_record_cursor(token, direction, record_uri, valid_t) - valid_t = valid_t or valid_datetime - return decode_cursor(token, direction, function(value) - if not valid_t(value.t) then return false end - if type(record_uri) == "function" then return record_uri(value.u) end - local valid, collection = valid_record_uri(value.u) - return valid and collection == record_uri - end) -end - local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a diff --git a/happyview-modules/lua/endpoints/getLocation.lua b/happyview-modules/lua/endpoints/getLocation.lua index d9a7359f..3c5604d0 100644 --- a/happyview-modules/lua/endpoints/getLocation.lua +++ b/happyview-modules/lua/endpoints/getLocation.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/getMeasurement.lua b/happyview-modules/lua/endpoints/getMeasurement.lua index 73a1e0c4..5ea29e97 100644 --- a/happyview-modules/lua/endpoints/getMeasurement.lua +++ b/happyview-modules/lua/endpoints/getMeasurement.lua @@ -19,6 +19,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_did(value) if type(value) ~= "string" or #value > 2048 then return false end local method, specific = value:match("^did:([a-z]+):(.+)$") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/getOrganization.lua b/happyview-modules/lua/endpoints/getOrganization.lua index 15f9f60b..55c67ebf 100644 --- a/happyview-modules/lua/endpoints/getOrganization.lua +++ b/happyview-modules/lua/endpoints/getOrganization.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/getOrganizations.lua b/happyview-modules/lua/endpoints/getOrganizations.lua index cf40b6c1..4f26414a 100644 --- a/happyview-modules/lua/endpoints/getOrganizations.lua +++ b/happyview-modules/lua/endpoints/getOrganizations.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/getProfile.lua b/happyview-modules/lua/endpoints/getProfile.lua index e4efd50c..beb52e2c 100644 --- a/happyview-modules/lua/endpoints/getProfile.lua +++ b/happyview-modules/lua/endpoints/getProfile.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -39,6 +48,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local function query(sql, values) diff --git a/happyview-modules/lua/endpoints/getProfiles.lua b/happyview-modules/lua/endpoints/getProfiles.lua index 2d1dc784..5b6056db 100644 --- a/happyview-modules/lua/endpoints/getProfiles.lua +++ b/happyview-modules/lua/endpoints/getProfiles.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -39,6 +48,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local function query(sql, values) diff --git a/happyview-modules/lua/endpoints/getReactionCounts.lua b/happyview-modules/lua/endpoints/getReactionCounts.lua index 0f602a3d..beec6883 100644 --- a/happyview-modules/lua/endpoints/getReactionCounts.lua +++ b/happyview-modules/lua/endpoints/getReactionCounts.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + -- An atproto NSID: at least three dot-separated segments, at most 317 characters. local function valid_nsid(value) if type(value) ~= "string" or #value > 317 then return false end diff --git a/happyview-modules/lua/endpoints/getReceipt.lua b/happyview-modules/lua/endpoints/getReceipt.lua index f43009ac..2f80a2a0 100644 --- a/happyview-modules/lua/endpoints/getReceipt.lua +++ b/happyview-modules/lua/endpoints/getReceipt.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/getReposts.lua b/happyview-modules/lua/endpoints/getReposts.lua index fe00d066..f79068b3 100644 --- a/happyview-modules/lua/endpoints/getReposts.lua +++ b/happyview-modules/lua/endpoints/getReposts.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" @@ -127,48 +202,6 @@ local function hydrate_actor_views(actors, run_query, view) end end --- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), --- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the --- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. -local function decode_hex_cursor_token(token) - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) -end - --- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other --- sort directions and unknown keys; validate_value(value) -> boolean runs the --- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character --- cap or accept extra keys. -local function decode_cursor(token, direction, validate_value) - if token == nil then return nil end - local decoded = decode_hex_cursor_token(token) - local ok, value = pcall(json.decode, decoded) - if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction - or type(value.t) ~= "string" or type(value.u) ~= "string" then - invalid("cursor is malformed or belongs to another sortDirection") - end - for key in pairs(value) do - if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end - end - if not validate_value(value) then invalid("cursor is malformed") end - return value -end - --- decode_cursor for the common case: t is a datetime and u a record URI. --- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean --- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. -local function decode_record_cursor(token, direction, record_uri, valid_t) - valid_t = valid_t or valid_datetime - return decode_cursor(token, direction, function(value) - if not valid_t(value.t) then return false end - if type(record_uri) == "function" then return record_uri(value.u) end - local valid, collection = valid_record_uri(value.u) - return valid and collection == record_uri - end) -end - local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a diff --git a/happyview-modules/lua/endpoints/getRights.lua b/happyview-modules/lua/endpoints/getRights.lua index 35fa5f79..5751a33c 100644 --- a/happyview-modules/lua/endpoints/getRights.lua +++ b/happyview-modules/lua/endpoints/getRights.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/getVocabTag.lua b/happyview-modules/lua/endpoints/getVocabTag.lua index 245f6bae..ace12b24 100644 --- a/happyview-modules/lua/endpoints/getVocabTag.lua +++ b/happyview-modules/lua/endpoints/getVocabTag.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" @@ -83,18 +114,6 @@ local function hydrate_actor_views(actors, run_query, view) end end --- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. --- Pass it to hydrate_actor_views for sidecars that preserve the omission. -local function record_view_omitting_indexed_at(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - local VOCAB_TAG = "org.hypercerts.vocab.tag" local function valid_vocab_tag_uri(value) diff --git a/happyview-modules/lua/endpoints/getWorkscopeTag.lua b/happyview-modules/lua/endpoints/getWorkscopeTag.lua index 47786696..5d40eb4b 100644 --- a/happyview-modules/lua/endpoints/getWorkscopeTag.lua +++ b/happyview-modules/lua/endpoints/getWorkscopeTag.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,7 @@ local function record_view(row) } end +-- luacheck: push ignore 211 -- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. -- Pass it to hydrate_actor_views for sidecars that preserve the omission. local function record_view_omitting_indexed_at(row) @@ -62,6 +80,7 @@ local function record_view_omitting_indexed_at(row) record = json.decode(row.record), } end +-- luacheck: pop local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/listAcknowledgements.lua b/happyview-modules/lua/endpoints/listAcknowledgements.lua index c87824c4..34b3f876 100644 --- a/happyview-modules/lua/endpoints/listAcknowledgements.lua +++ b/happyview-modules/lua/endpoints/listAcknowledgements.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -83,6 +100,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local ACKNOWLEDGEMENT = "org.hypercerts.context.acknowledgement" local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" @@ -149,18 +180,6 @@ local function valid_nsid(value) return #name <= 63 and name:match("^[A-Za-z][A-Za-z0-9]*$") ~= nil end --- Hex-encodes the JSON of a cursor table. -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - -local function parse_sort_direction(params) - local direction = scalar(params, "sortDirection") or "desc" - if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end - return direction -end - -- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), -- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the -- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. @@ -171,6 +190,13 @@ local function decode_hex_cursor_token(token) return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + +-- luacheck: push ignore 211 -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character @@ -202,6 +228,13 @@ local function decode_record_cursor(token, direction, record_uri, valid_t) return valid and collection == record_uri end) end +-- luacheck: pop + +local function parse_sort_direction(params) + local direction = scalar(params, "sortDirection") or "desc" + if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end + return direction +end -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) diff --git a/happyview-modules/lua/endpoints/listActivities.lua b/happyview-modules/lua/endpoints/listActivities.lua index 2ae45d20..210bdd03 100644 --- a/happyview-modules/lua/endpoints/listActivities.lua +++ b/happyview-modules/lua/endpoints/listActivities.lua @@ -18,6 +18,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local ACTIVITY_PROJECTION_CONTRIBUTOR_INFORMATION = "org.hypercerts.claim.contributorInformation" local ACTIVITY_PROJECTION_PROFILE = "app.certified.actor.profile" local ACTIVITY_PROJECTION_ORGANIZATION = "app.certified.actor.organization" @@ -217,12 +225,14 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 -- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand -- boolean-typed query parameters to Lua as booleans rather than strings. local function scalar_or_boolean(values, key) if type(values[key]) == "boolean" then return tostring(values[key]) end return scalar(values, key) end +-- luacheck: pop local ACTIVITY = "org.hypercerts.claim.activity" @@ -290,18 +300,6 @@ local function created_at_sort(alias) "::timestamptz, " .. created_at .. "::timestamptz) END" end --- Hex-encodes the JSON of a cursor table. -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - -local function parse_sort_direction(params) - local direction = scalar(params, "sortDirection") or "desc" - if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end - return direction -end - -- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), -- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the -- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. @@ -312,6 +310,13 @@ local function decode_hex_cursor_token(token) return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + +-- luacheck: push ignore 211 -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character @@ -343,6 +348,13 @@ local function decode_record_cursor(token, direction, record_uri, valid_t) return valid and collection == record_uri end) end +-- luacheck: pop + +local function parse_sort_direction(params) + local direction = scalar(params, "sortDirection") or "desc" + if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end + return direction +end -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) diff --git a/happyview-modules/lua/endpoints/listActorFollowers.lua b/happyview-modules/lua/endpoints/listActorFollowers.lua index 23419f12..773b97cd 100644 --- a/happyview-modules/lua/endpoints/listActorFollowers.lua +++ b/happyview-modules/lua/endpoints/listActorFollowers.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/listActorFollowing.lua b/happyview-modules/lua/endpoints/listActorFollowing.lua index 5484d074..b41ada88 100644 --- a/happyview-modules/lua/endpoints/listActorFollowing.lua +++ b/happyview-modules/lua/endpoints/listActorFollowing.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/listAttachments.lua b/happyview-modules/lua/endpoints/listAttachments.lua index 8cd7a4d7..c67facd3 100644 --- a/happyview-modules/lua/endpoints/listAttachments.lua +++ b/happyview-modules/lua/endpoints/listAttachments.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" @@ -161,48 +236,6 @@ local function hydrate_attachment_views(views) hydrate_actor_views(authors, attachment_query) end --- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), --- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the --- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. -local function decode_hex_cursor_token(token) - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) -end - --- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other --- sort directions and unknown keys; validate_value(value) -> boolean runs the --- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character --- cap or accept extra keys. -local function decode_cursor(token, direction, validate_value) - if token == nil then return nil end - local decoded = decode_hex_cursor_token(token) - local ok, value = pcall(json.decode, decoded) - if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction - or type(value.t) ~= "string" or type(value.u) ~= "string" then - invalid("cursor is malformed or belongs to another sortDirection") - end - for key in pairs(value) do - if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end - end - if not validate_value(value) then invalid("cursor is malformed") end - return value -end - --- decode_cursor for the common case: t is a datetime and u a record URI. --- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean --- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. -local function decode_record_cursor(token, direction, record_uri, valid_t) - valid_t = valid_t or valid_datetime - return decode_cursor(token, direction, function(value) - if not valid_t(value.t) then return false end - if type(record_uri) == "function" then return record_uri(value.u) end - local valid, collection = valid_record_uri(value.u) - return valid and collection == record_uri - end) -end - -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then diff --git a/happyview-modules/lua/endpoints/listBadgeAwards.lua b/happyview-modules/lua/endpoints/listBadgeAwards.lua index 6625d8b9..40c9e5fb 100644 --- a/happyview-modules/lua/endpoints/listBadgeAwards.lua +++ b/happyview-modules/lua/endpoints/listBadgeAwards.lua @@ -19,6 +19,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function parse_include_total(values) local value = values.includeTotal if value == nil then return false end @@ -49,6 +58,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -81,12 +98,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -120,6 +181,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/listBadgeDefinitions.lua b/happyview-modules/lua/endpoints/listBadgeDefinitions.lua index 1adb78b2..67c56d49 100644 --- a/happyview-modules/lua/endpoints/listBadgeDefinitions.lua +++ b/happyview-modules/lua/endpoints/listBadgeDefinitions.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local BADGE_DEFINITION_COLLECTION = "app.certified.badge.definition" local function valid_badge_definition_uri(value) @@ -78,12 +95,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -117,6 +178,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/listBadgeResponses.lua b/happyview-modules/lua/endpoints/listBadgeResponses.lua index 5557a62f..6efdf8a7 100644 --- a/happyview-modules/lua/endpoints/listBadgeResponses.lua +++ b/happyview-modules/lua/endpoints/listBadgeResponses.lua @@ -19,6 +19,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_did(value) if type(value) ~= "string" or #value > 2048 then return false end local method, specific = value:match("^did:([a-z]+):(.+)$") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -110,6 +171,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/listCollectionItems.lua b/happyview-modules/lua/endpoints/listCollectionItems.lua index 3af023cd..005b880d 100644 --- a/happyview-modules/lua/endpoints/listCollectionItems.lua +++ b/happyview-modules/lua/endpoints/listCollectionItems.lua @@ -19,6 +19,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_did(value) if type(value) ~= "string" or #value > 2048 then return false end local method, specific = value:match("^did:([a-z]+):(.+)$") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local ACTIVITY_PROJECTION_CONTRIBUTOR_INFORMATION = "org.hypercerts.claim.contributorInformation" local ACTIVITY_PROJECTION_PROFILE = "app.certified.actor.profile" local ACTIVITY_PROJECTION_ORGANIZATION = "app.certified.actor.organization" @@ -229,6 +246,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local FEATURE_PROJECTION_PROFILE = "app.certified.actor.profile" local FEATURE_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local FEATURE_PROJECTION_NULL = json.decode("null") @@ -297,10 +328,28 @@ local function parse_list_limit(params) return limit end --- Hex-encodes the JSON of a cursor table. -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +local function valid_datetime(value) + if type(value) ~= "string" then return false end + local year, month, day, hour, minute, second, suffix = value:match( + "^(%d%d%d%d)%-(%d%d)%-(%d%d)T(%d%d):(%d%d):(%d%d)(.*)$") + if not year then return false end + year, month, day = tonumber(year), tonumber(month), tonumber(day) + if year < 1 then return false end + hour, minute, second = tonumber(hour), tonumber(minute), tonumber(second) + if month < 1 or month > 12 or hour > 23 or minute > 59 or second > 59 then return false end + local leap = year % 4 == 0 and (year % 100 ~= 0 or year % 400 == 0) + local month_days = { 31, leap and 29 or 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } + if day < 1 or day > month_days[month] then return false end + local fraction, zone = suffix:match("^(%.%d+)(Z)$") + if not fraction then fraction, zone = suffix:match("^(%.%d+)([+-]%d%d:%d%d)$") end + if not fraction then zone = suffix:match("^(Z)$") end + if not zone then zone = suffix:match("^([+-]%d%d:%d%d)$") end + if not zone or zone == "-00:00" then return false end + if zone ~= "Z" then + local zh, zm = zone:match("^[+-](%d%d):(%d%d)$") + if not zh or tonumber(zh) > 23 or tonumber(zm) > 59 then return false end + end + return true end -- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), @@ -313,6 +362,46 @@ local function decode_hex_cursor_token(token) return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local ITEM_COLLECTION = "org.hypercerts.collection" local ITEM_ACTIVITY = "org.hypercerts.claim.activity" local ITEM_FEATURE = "org.hypercerts.entity.feature" diff --git a/happyview-modules/lua/endpoints/listCollections.lua b/happyview-modules/lua/endpoints/listCollections.lua index 716db232..72965e98 100644 --- a/happyview-modules/lua/endpoints/listCollections.lua +++ b/happyview-modules/lua/endpoints/listCollections.lua @@ -18,11 +18,13 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 -- For user-supplied filter values: bounds the size before parsing. local function valid_bounded_record_uri(value) if type(value) ~= "string" or #value > 8192 then return false end return valid_record_uri(value) end +-- luacheck: pop local NULL = json.decode("null") @@ -36,6 +38,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local COLLECTION_PROJECTION_PROFILE = "app.certified.actor.profile" local COLLECTION_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local COLLECTION_PROJECTION_LOCATION = "app.certified.location" @@ -290,12 +306,14 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 -- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand -- boolean-typed query parameters to Lua as booleans rather than strings. local function scalar_or_boolean(values, key) if type(values[key]) == "boolean" then return tostring(values[key]) end return scalar(values, key) end +-- luacheck: pop local function parse_list_limit(params) local limit_value = scalar(params, "limit") @@ -305,18 +323,6 @@ local function parse_list_limit(params) return limit end --- Hex-encodes the JSON of a cursor table. -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - -local function parse_sort_direction(params) - local direction = scalar(params, "sortDirection") or "desc" - if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end - return direction -end - -- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), -- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the -- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. @@ -327,6 +333,13 @@ local function decode_hex_cursor_token(token) return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + +-- luacheck: push ignore 211 -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character @@ -358,6 +371,13 @@ local function decode_record_cursor(token, direction, record_uri, valid_t) return valid and collection == record_uri end) end +-- luacheck: pop + +local function parse_sort_direction(params) + local direction = scalar(params, "sortDirection") or "desc" + if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end + return direction +end -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) diff --git a/happyview-modules/lua/endpoints/listContributions.lua b/happyview-modules/lua/endpoints/listContributions.lua index 83c6ed6f..4f97620b 100644 --- a/happyview-modules/lua/endpoints/listContributions.lua +++ b/happyview-modules/lua/endpoints/listContributions.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" @@ -154,48 +229,6 @@ local function contribution_view(row) return view end --- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), --- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the --- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. -local function decode_hex_cursor_token(token) - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) -end - --- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other --- sort directions and unknown keys; validate_value(value) -> boolean runs the --- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character --- cap or accept extra keys. -local function decode_cursor(token, direction, validate_value) - if token == nil then return nil end - local decoded = decode_hex_cursor_token(token) - local ok, value = pcall(json.decode, decoded) - if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction - or type(value.t) ~= "string" or type(value.u) ~= "string" then - invalid("cursor is malformed or belongs to another sortDirection") - end - for key in pairs(value) do - if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end - end - if not validate_value(value) then invalid("cursor is malformed") end - return value -end - --- decode_cursor for the common case: t is a datetime and u a record URI. --- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean --- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. -local function decode_record_cursor(token, direction, record_uri, valid_t) - valid_t = valid_t or valid_datetime - return decode_cursor(token, direction, function(value) - if not valid_t(value.t) then return false end - if type(record_uri) == "function" then return record_uri(value.u) end - local valid, collection = valid_record_uri(value.u) - return valid and collection == record_uri - end) -end - -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then diff --git a/happyview-modules/lua/endpoints/listContributorInformation.lua b/happyview-modules/lua/endpoints/listContributorInformation.lua index 2f90aff7..c275b9e1 100644 --- a/happyview-modules/lua/endpoints/listContributorInformation.lua +++ b/happyview-modules/lua/endpoints/listContributorInformation.lua @@ -19,6 +19,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_did(value) if type(value) ~= "string" or #value > 2048 then return false end local method, specific = value:match("^did:([a-z]+):(.+)$") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local CONTRIBUTOR_INFORMATION_COLLECTION = "org.hypercerts.claim.contributorInformation" local function contributor_information_uri(value) @@ -59,6 +76,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" @@ -123,18 +154,6 @@ local function parse_list_limit(params) return limit end --- Hex-encodes the JSON of a cursor table. -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - -local function parse_sort_direction(params) - local direction = scalar(params, "sortDirection") or "desc" - if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end - return direction -end - -- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), -- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the -- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. @@ -145,6 +164,13 @@ local function decode_hex_cursor_token(token) return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + +-- luacheck: push ignore 211 -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character @@ -176,6 +202,13 @@ local function decode_record_cursor(token, direction, record_uri, valid_t) return valid and collection == record_uri end) end +-- luacheck: pop + +local function parse_sort_direction(params) + local direction = scalar(params, "sortDirection") or "desc" + if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end + return direction +end -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) diff --git a/happyview-modules/lua/endpoints/listEntityFollowers.lua b/happyview-modules/lua/endpoints/listEntityFollowers.lua index aca42263..8c74f9cc 100644 --- a/happyview-modules/lua/endpoints/listEntityFollowers.lua +++ b/happyview-modules/lua/endpoints/listEntityFollowers.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local ENTITY_FOLLOW = "app.certified.graph.entityFollow" local ENTITY_FOLLOW_NULL = json.decode("null") @@ -115,48 +190,6 @@ local function entity_follow_typed_view(row) return view end --- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), --- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the --- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. -local function decode_hex_cursor_token(token) - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) -end - --- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other --- sort directions and unknown keys; validate_value(value) -> boolean runs the --- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character --- cap or accept extra keys. -local function decode_cursor(token, direction, validate_value) - if token == nil then return nil end - local decoded = decode_hex_cursor_token(token) - local ok, value = pcall(json.decode, decoded) - if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction - or type(value.t) ~= "string" or type(value.u) ~= "string" then - invalid("cursor is malformed or belongs to another sortDirection") - end - for key in pairs(value) do - if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end - end - if not validate_value(value) then invalid("cursor is malformed") end - return value -end - --- decode_cursor for the common case: t is a datetime and u a record URI. --- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean --- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. -local function decode_record_cursor(token, direction, record_uri, valid_t) - valid_t = valid_t or valid_datetime - return decode_cursor(token, direction, function(value) - if not valid_t(value.t) then return false end - if type(record_uri) == "function" then return record_uri(value.u) end - local valid, collection = valid_record_uri(value.u) - return valid and collection == record_uri - end) -end - local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a diff --git a/happyview-modules/lua/endpoints/listEntityFollowing.lua b/happyview-modules/lua/endpoints/listEntityFollowing.lua index deb0b7d3..dd7f12e9 100644 --- a/happyview-modules/lua/endpoints/listEntityFollowing.lua +++ b/happyview-modules/lua/endpoints/listEntityFollowing.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,11 +48,13 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 -- For user-supplied filter values: bounds the size before parsing. local function valid_bounded_record_uri(value) if type(value) ~= "string" or #value > 8192 then return false end return valid_record_uri(value) end +-- luacheck: pop local function valid_datetime(value) if type(value) ~= "string" then return false end @@ -77,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -279,6 +334,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local COLLECTION_PROJECTION_PROFILE = "app.certified.actor.profile" local COLLECTION_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local COLLECTION_PROJECTION_LOCATION = "app.certified.location" @@ -532,48 +601,6 @@ local function entity_follow_typed_view(row) return view end --- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), --- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the --- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. -local function decode_hex_cursor_token(token) - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) -end - --- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other --- sort directions and unknown keys; validate_value(value) -> boolean runs the --- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character --- cap or accept extra keys. -local function decode_cursor(token, direction, validate_value) - if token == nil then return nil end - local decoded = decode_hex_cursor_token(token) - local ok, value = pcall(json.decode, decoded) - if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction - or type(value.t) ~= "string" or type(value.u) ~= "string" then - invalid("cursor is malformed or belongs to another sortDirection") - end - for key in pairs(value) do - if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end - end - if not validate_value(value) then invalid("cursor is malformed") end - return value -end - --- decode_cursor for the common case: t is a datetime and u a record URI. --- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean --- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. -local function decode_record_cursor(token, direction, record_uri, valid_t) - valid_t = valid_t or valid_datetime - return decode_cursor(token, direction, function(value) - if not valid_t(value.t) then return false end - if type(record_uri) == "function" then return record_uri(value.u) end - local valid, collection = valid_record_uri(value.u) - return valid and collection == record_uri - end) -end - local CREATED_AT_SORT_PATTERN = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$" -- Sort key for a happyview_records row: the record's own createdAt when it is a diff --git a/happyview-modules/lua/endpoints/listEvaluations.lua b/happyview-modules/lua/endpoints/listEvaluations.lua index 723b0aaf..4e090730 100644 --- a/happyview-modules/lua/endpoints/listEvaluations.lua +++ b/happyview-modules/lua/endpoints/listEvaluations.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" @@ -223,48 +298,6 @@ local function valid_nsid(value) return #name <= 63 and name:match("^[A-Za-z][A-Za-z0-9]*$") ~= nil end --- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), --- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the --- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. -local function decode_hex_cursor_token(token) - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) -end - --- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other --- sort directions and unknown keys; validate_value(value) -> boolean runs the --- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character --- cap or accept extra keys. -local function decode_cursor(token, direction, validate_value) - if token == nil then return nil end - local decoded = decode_hex_cursor_token(token) - local ok, value = pcall(json.decode, decoded) - if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction - or type(value.t) ~= "string" or type(value.u) ~= "string" then - invalid("cursor is malformed or belongs to another sortDirection") - end - for key in pairs(value) do - if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end - end - if not validate_value(value) then invalid("cursor is malformed") end - return value -end - --- decode_cursor for the common case: t is a datetime and u a record URI. --- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean --- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. -local function decode_record_cursor(token, direction, record_uri, valid_t) - valid_t = valid_t or valid_datetime - return decode_cursor(token, direction, function(value) - if not valid_t(value.t) then return false end - if type(record_uri) == "function" then return record_uri(value.u) end - local valid, collection = valid_record_uri(value.u) - return valid and collection == record_uri - end) -end - -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then diff --git a/happyview-modules/lua/endpoints/listEvmLinks.lua b/happyview-modules/lua/endpoints/listEvmLinks.lua index eb973a60..eb58917d 100644 --- a/happyview-modules/lua/endpoints/listEvmLinks.lua +++ b/happyview-modules/lua/endpoints/listEvmLinks.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -110,6 +171,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local EVMLINK_COLLECTION = "app.certified.link.evm" local function valid_evm_link_uri(value) diff --git a/happyview-modules/lua/endpoints/listFeatures.lua b/happyview-modules/lua/endpoints/listFeatures.lua index 62681ded..92d7e8ab 100644 --- a/happyview-modules/lua/endpoints/listFeatures.lua +++ b/happyview-modules/lua/endpoints/listFeatures.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -118,6 +179,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local FEATURE_PROJECTION_PROFILE = "app.certified.actor.profile" local FEATURE_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local FEATURE_PROJECTION_NULL = json.decode("null") diff --git a/happyview-modules/lua/endpoints/listLocations.lua b/happyview-modules/lua/endpoints/listLocations.lua index cf6f6810..a71d50c2 100644 --- a/happyview-modules/lua/endpoints/listLocations.lua +++ b/happyview-modules/lua/endpoints/listLocations.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -110,6 +171,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/listMeasurements.lua b/happyview-modules/lua/endpoints/listMeasurements.lua index 39c51ca3..be6eef7c 100644 --- a/happyview-modules/lua/endpoints/listMeasurements.lua +++ b/happyview-modules/lua/endpoints/listMeasurements.lua @@ -19,6 +19,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_did(value) if type(value) ~= "string" or #value > 2048 then return false end local method, specific = value:match("^did:([a-z]+):(.+)$") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" @@ -182,48 +257,6 @@ local function valid_nsid(value) return #name <= 63 and name:match("^[A-Za-z][A-Za-z0-9]*$") ~= nil end --- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), --- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the --- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. -local function decode_hex_cursor_token(token) - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) -end - --- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other --- sort directions and unknown keys; validate_value(value) -> boolean runs the --- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character --- cap or accept extra keys. -local function decode_cursor(token, direction, validate_value) - if token == nil then return nil end - local decoded = decode_hex_cursor_token(token) - local ok, value = pcall(json.decode, decoded) - if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction - or type(value.t) ~= "string" or type(value.u) ~= "string" then - invalid("cursor is malformed or belongs to another sortDirection") - end - for key in pairs(value) do - if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end - end - if not validate_value(value) then invalid("cursor is malformed") end - return value -end - --- decode_cursor for the common case: t is a datetime and u a record URI. --- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean --- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. -local function decode_record_cursor(token, direction, record_uri, valid_t) - valid_t = valid_t or valid_datetime - return decode_cursor(token, direction, function(value) - if not valid_t(value.t) then return false end - if type(record_uri) == "function" then return record_uri(value.u) end - local valid, collection = valid_record_uri(value.u) - return valid and collection == record_uri - end) -end - -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then diff --git a/happyview-modules/lua/endpoints/listOrganizations.lua b/happyview-modules/lua/endpoints/listOrganizations.lua index 04085b37..8a252893 100644 --- a/happyview-modules/lua/endpoints/listOrganizations.lua +++ b/happyview-modules/lua/endpoints/listOrganizations.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/listProfiles.lua b/happyview-modules/lua/endpoints/listProfiles.lua index e9f44243..bfa7168e 100644 --- a/happyview-modules/lua/endpoints/listProfiles.lua +++ b/happyview-modules/lua/endpoints/listProfiles.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local function query(sql, values) diff --git a/happyview-modules/lua/endpoints/listReceipts.lua b/happyview-modules/lua/endpoints/listReceipts.lua index 5f7be7f1..dfee9c38 100644 --- a/happyview-modules/lua/endpoints/listReceipts.lua +++ b/happyview-modules/lua/endpoints/listReceipts.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -83,6 +100,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" @@ -162,18 +193,6 @@ local function valid_nsid(value) return #name <= 63 and name:match("^[A-Za-z][A-Za-z0-9]*$") ~= nil end --- Hex-encodes the JSON of a cursor table. -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - -local function parse_sort_direction(params) - local direction = scalar(params, "sortDirection") or "desc" - if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end - return direction -end - -- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), -- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the -- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. @@ -184,6 +203,13 @@ local function decode_hex_cursor_token(token) return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + +-- luacheck: push ignore 211 -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character @@ -215,6 +241,13 @@ local function decode_record_cursor(token, direction, record_uri, valid_t) return valid and collection == record_uri end) end +-- luacheck: pop + +local function parse_sort_direction(params) + local direction = scalar(params, "sortDirection") or "desc" + if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end + return direction +end -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) diff --git a/happyview-modules/lua/endpoints/listRecentFollows.lua b/happyview-modules/lua/endpoints/listRecentFollows.lua index d5ec9d19..27fb6109 100644 --- a/happyview-modules/lua/endpoints/listRecentFollows.lua +++ b/happyview-modules/lua/endpoints/listRecentFollows.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + -- Some clients wrote account follows whose `via` points at the followed -- account's own org.hypercerts.collection, using the account follow as a -- project follow. Those records stay indexed but are not account follows, so diff --git a/happyview-modules/lua/endpoints/listRights.lua b/happyview-modules/lua/endpoints/listRights.lua index 7a35f007..173b021a 100644 --- a/happyview-modules/lua/endpoints/listRights.lua +++ b/happyview-modules/lua/endpoints/listRights.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local NULL = json.decode("null") local function record_view(row) @@ -51,6 +68,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" @@ -115,18 +146,6 @@ local function parse_list_limit(params) return limit end --- Hex-encodes the JSON of a cursor table. -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - -local function parse_sort_direction(params) - local direction = scalar(params, "sortDirection") or "desc" - if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end - return direction -end - -- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), -- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the -- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. @@ -137,6 +156,13 @@ local function decode_hex_cursor_token(token) return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + +-- luacheck: push ignore 211 -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character @@ -168,6 +194,13 @@ local function decode_record_cursor(token, direction, record_uri, valid_t) return valid and collection == record_uri end) end +-- luacheck: pop + +local function parse_sort_direction(params) + local direction = scalar(params, "sortDirection") or "desc" + if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end + return direction +end -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) diff --git a/happyview-modules/lua/endpoints/listVocabTags.lua b/happyview-modules/lua/endpoints/listVocabTags.lua index 2518f6a9..2d1181ee 100644 --- a/happyview-modules/lua/endpoints/listVocabTags.lua +++ b/happyview-modules/lua/endpoints/listVocabTags.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" @@ -127,18 +202,6 @@ local function hydrate_actor_views(actors, run_query, view) end end --- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. --- Pass it to hydrate_actor_views for sidecars that preserve the omission. -local function record_view_omitting_indexed_at(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end - local VOCAB_TAG = "org.hypercerts.vocab.tag" local function valid_vocab_tag_uri(value) @@ -205,7 +268,7 @@ local function filter_signature(authors) return table.concat(authors or {}, ",") end -local function decode_cursor(token, direction, authors) +local function decode_vocab_tag_cursor(token, direction, authors) if not token then return nil end if #token % 2 ~= 0 or token:find("[^0-9a-f]") then invalid("cursor is malformed") end local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) @@ -290,7 +353,7 @@ local function handle_list_vocab_tags() local authors = parse_authors(params.authors) local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = decode_cursor(scalar(params, "cursor"), direction, authors) + local cursor = decode_vocab_tag_cursor(scalar(params, "cursor"), direction, authors) local views, next_cursor = list_vocab_tags(authors, limit, cursor, direction) local response = { vocabTags = toarray(views) } if next_cursor then response.cursor = next_cursor end diff --git a/happyview-modules/lua/endpoints/listWorkscopeTags.lua b/happyview-modules/lua/endpoints/listWorkscopeTags.lua index 5f7d63a9..77ad17f5 100644 --- a/happyview-modules/lua/endpoints/listWorkscopeTags.lua +++ b/happyview-modules/lua/endpoints/listWorkscopeTags.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,7 @@ local function record_view(row) } end +-- luacheck: push ignore 211 -- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. -- Pass it to hydrate_actor_views for sidecars that preserve the omission. local function record_view_omitting_indexed_at(row) @@ -106,6 +168,7 @@ local function record_view_omitting_indexed_at(row) record = json.decode(row.record), } end +-- luacheck: pop local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" @@ -164,48 +227,6 @@ local function workscope_tag_view(row) } end --- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), --- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the --- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. -local function decode_hex_cursor_token(token) - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) -end - --- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other --- sort directions and unknown keys; validate_value(value) -> boolean runs the --- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character --- cap or accept extra keys. -local function decode_cursor(token, direction, validate_value) - if token == nil then return nil end - local decoded = decode_hex_cursor_token(token) - local ok, value = pcall(json.decode, decoded) - if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction - or type(value.t) ~= "string" or type(value.u) ~= "string" then - invalid("cursor is malformed or belongs to another sortDirection") - end - for key in pairs(value) do - if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end - end - if not validate_value(value) then invalid("cursor is malformed") end - return value -end - --- decode_cursor for the common case: t is a datetime and u a record URI. --- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean --- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. -local function decode_record_cursor(token, direction, record_uri, valid_t) - valid_t = valid_t or valid_datetime - return decode_cursor(token, direction, function(value) - if not valid_t(value.t) then return false end - if type(record_uri) == "function" then return record_uri(value.u) end - local valid, collection = valid_record_uri(value.u) - return valid and collection == record_uri - end) -end - -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) if #items == 0 then diff --git a/happyview-modules/lua/endpoints/searchActivities.lua b/happyview-modules/lua/endpoints/searchActivities.lua index d29d4f3a..635f0ec2 100644 --- a/happyview-modules/lua/endpoints/searchActivities.lua +++ b/happyview-modules/lua/endpoints/searchActivities.lua @@ -18,6 +18,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local ACTIVITY_PROJECTION_CONTRIBUTOR_INFORMATION = "org.hypercerts.claim.contributorInformation" local ACTIVITY_PROJECTION_PROFILE = "app.certified.actor.profile" local ACTIVITY_PROJECTION_ORGANIZATION = "app.certified.actor.organization" @@ -217,12 +225,14 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 -- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand -- boolean-typed query parameters to Lua as booleans rather than strings. local function scalar_or_boolean(values, key) if type(values[key]) == "boolean" then return tostring(values[key]) end return scalar(values, key) end +-- luacheck: pop local ACTIVITY = "org.hypercerts.claim.activity" @@ -290,18 +300,6 @@ local function created_at_sort(alias) "::timestamptz, " .. created_at .. "::timestamptz) END" end --- Hex-encodes the JSON of a cursor table. -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - -local function parse_sort_direction(params) - local direction = scalar(params, "sortDirection") or "desc" - if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end - return direction -end - -- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), -- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the -- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. @@ -312,6 +310,13 @@ local function decode_hex_cursor_token(token) return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + +-- luacheck: push ignore 211 -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character @@ -343,6 +348,13 @@ local function decode_record_cursor(token, direction, record_uri, valid_t) return valid and collection == record_uri end) end +-- luacheck: pop + +local function parse_sort_direction(params) + local direction = scalar(params, "sortDirection") or "desc" + if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end + return direction +end -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) diff --git a/happyview-modules/lua/endpoints/searchBadgeDefinitions.lua b/happyview-modules/lua/endpoints/searchBadgeDefinitions.lua index c1c45dee..aeb6ff47 100644 --- a/happyview-modules/lua/endpoints/searchBadgeDefinitions.lua +++ b/happyview-modules/lua/endpoints/searchBadgeDefinitions.lua @@ -19,6 +19,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_did(value) if type(value) ~= "string" or #value > 2048 then return false end local method, specific = value:match("^did:([a-z]+):(.+)$") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local BADGE_DEFINITION_COLLECTION = "app.certified.badge.definition" local function valid_badge_definition_uri(value) @@ -78,12 +95,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -117,6 +178,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/searchCollections.lua b/happyview-modules/lua/endpoints/searchCollections.lua index 947ea0e9..00f64ca2 100644 --- a/happyview-modules/lua/endpoints/searchCollections.lua +++ b/happyview-modules/lua/endpoints/searchCollections.lua @@ -18,11 +18,13 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 -- For user-supplied filter values: bounds the size before parsing. local function valid_bounded_record_uri(value) if type(value) ~= "string" or #value > 8192 then return false end return valid_record_uri(value) end +-- luacheck: pop local NULL = json.decode("null") @@ -36,6 +38,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local COLLECTION_PROJECTION_PROFILE = "app.certified.actor.profile" local COLLECTION_PROJECTION_ORGANIZATION = "app.certified.actor.organization" local COLLECTION_PROJECTION_LOCATION = "app.certified.location" @@ -290,12 +306,14 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 -- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand -- boolean-typed query parameters to Lua as booleans rather than strings. local function scalar_or_boolean(values, key) if type(values[key]) == "boolean" then return tostring(values[key]) end return scalar(values, key) end +-- luacheck: pop local function parse_list_limit(params) local limit_value = scalar(params, "limit") @@ -305,18 +323,6 @@ local function parse_list_limit(params) return limit end --- Hex-encodes the JSON of a cursor table. -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end - -local function parse_sort_direction(params) - local direction = scalar(params, "sortDirection") or "desc" - if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end - return direction -end - -- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), -- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the -- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. @@ -327,6 +333,13 @@ local function decode_hex_cursor_token(token) return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) end +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + +-- luacheck: push ignore 211 -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character @@ -358,6 +371,13 @@ local function decode_record_cursor(token, direction, record_uri, valid_t) return valid and collection == record_uri end) end +-- luacheck: pop + +local function parse_sort_direction(params) + local direction = scalar(params, "sortDirection") or "desc" + if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end + return direction +end -- Adds `column IN ($n, ...)` to where, binding items; an empty list matches nothing. local function add_in(where, binds, column, items) diff --git a/happyview-modules/lua/endpoints/searchOrganizations.lua b/happyview-modules/lua/endpoints/searchOrganizations.lua index 9bf08402..123c742f 100644 --- a/happyview-modules/lua/endpoints/searchOrganizations.lua +++ b/happyview-modules/lua/endpoints/searchOrganizations.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local ORGANIZATION = "app.certified.actor.organization" diff --git a/happyview-modules/lua/endpoints/searchProfiles.lua b/happyview-modules/lua/endpoints/searchProfiles.lua index 72cf3eb7..fbe38300 100644 --- a/happyview-modules/lua/endpoints/searchProfiles.lua +++ b/happyview-modules/lua/endpoints/searchProfiles.lua @@ -27,6 +27,15 @@ local function scalar(params, key) return tostring(value) end +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop + local function valid_record_key(value) return #value >= 1 and #value <= 512 and value ~= "." and value ~= ".." and not value:find("[^%w_~%.:%-]") @@ -39,6 +48,14 @@ local function valid_record_uri(value) return true, collection, authority end +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop + local function valid_datetime(value) if type(value) ~= "string" then return false end local year, month, day, hour, minute, second, suffix = value:match( @@ -71,12 +88,56 @@ local function parse_list_limit(params) return limit end +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + -- Hex-encodes the JSON of a cursor table. local function cursor_encode(value) local encoded = json.encode(value) return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) end +-- luacheck: push ignore 211 +-- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other +-- sort directions and unknown keys; validate_value(value) -> boolean runs the +-- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character +-- cap or accept extra keys. +local function decode_cursor(token, direction, validate_value) + if token == nil then return nil end + local decoded = decode_hex_cursor_token(token) + local ok, value = pcall(json.decode, decoded) + if not ok or type(value) ~= "table" or value.v ~= 1 or value.d ~= direction + or type(value.t) ~= "string" or type(value.u) ~= "string" then + invalid("cursor is malformed or belongs to another sortDirection") + end + for key in pairs(value) do + if key ~= "v" and key ~= "d" and key ~= "t" and key ~= "u" then invalid("cursor is malformed") end + end + if not validate_value(value) then invalid("cursor is malformed") end + return value +end + +-- decode_cursor for the common case: t is a datetime and u a record URI. +-- record_uri is the collection NSID u must belong to, or a predicate(uri) -> boolean +-- for endpoints with stricter URI rules. valid_t(t) defaults to valid_datetime. +local function decode_record_cursor(token, direction, record_uri, valid_t) + valid_t = valid_t or valid_datetime + return decode_cursor(token, direction, function(value) + if not valid_t(value.t) then return false end + if type(record_uri) == "function" then return record_uri(value.u) end + local valid, collection = valid_record_uri(value.u) + return valid and collection == record_uri + end) +end +-- luacheck: pop + local function parse_sort_direction(params) local direction = scalar(params, "sortDirection") or "desc" if direction ~= "asc" and direction ~= "desc" then invalid("sortDirection must be 'asc' or 'desc'") end @@ -95,6 +156,20 @@ local function record_view(row) } end +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop + local PROFILE = "app.certified.actor.profile" local function query(sql, values) diff --git a/happyview-modules/lua/shared/boundedRecordIdentifier.lua b/happyview-modules/lua/shared/boundedRecordIdentifier.lua deleted file mode 100644 index 21a8fcf0..00000000 --- a/happyview-modules/lua/shared/boundedRecordIdentifier.lua +++ /dev/null @@ -1,5 +0,0 @@ --- For user-supplied filter values: bounds the size before parsing. -local function valid_bounded_record_uri(value) - if type(value) ~= "string" or #value > 8192 then return false end - return valid_record_uri(value) -end diff --git a/happyview-modules/lua/shared/cursorEncode.lua b/happyview-modules/lua/shared/cursorEncode.lua deleted file mode 100644 index 3e57d475..00000000 --- a/happyview-modules/lua/shared/cursorEncode.lua +++ /dev/null @@ -1,5 +0,0 @@ --- Hex-encodes the JSON of a cursor table. -local function cursor_encode(value) - local encoded = json.encode(value) - return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) -end diff --git a/happyview-modules/lua/shared/cursorToken.lua b/happyview-modules/lua/shared/cursorToken.lua deleted file mode 100644 index 9c249163..00000000 --- a/happyview-modules/lua/shared/cursorToken.lua +++ /dev/null @@ -1,9 +0,0 @@ --- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), --- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the --- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. -local function decode_hex_cursor_token(token) - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - invalid("cursor is malformed") - end - return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) -end diff --git a/happyview-modules/lua/shared/listCursor.lua b/happyview-modules/lua/shared/listCursor.lua index e037abe6..faf118cf 100644 --- a/happyview-modules/lua/shared/listCursor.lua +++ b/happyview-modules/lua/shared/listCursor.lua @@ -1,3 +1,20 @@ +-- The hex prologue every list cursor shape shares: rejects empty, over-long (8192), +-- odd-length and non-lowercase-hex tokens with "cursor is malformed" and returns the +-- decoded JSON text. Shape and JSON checks stay with each cursor's own decoder. +local function decode_hex_cursor_token(token) + if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then + invalid("cursor is malformed") + end + return (token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end)) +end + +-- Hex-encodes the JSON of a cursor table. +local function cursor_encode(value) + local encoded = json.encode(value) + return (encoded:gsub(".", function(char) return string.format("%02x", string.byte(char)) end)) +end + +-- luacheck: push ignore 211 -- Decodes a hex-encoded {v, d, t, u} list cursor. Rejects malformed tokens, other -- sort directions and unknown keys; validate_value(value) -> boolean runs the -- endpoint-specific check on t and u. Not for endpoints that skip the 8192-character @@ -29,3 +46,4 @@ local function decode_record_cursor(token, direction, record_uri, valid_t) return valid and collection == record_uri end) end +-- luacheck: pop diff --git a/happyview-modules/lua/shared/query.lua b/happyview-modules/lua/shared/query.lua index 3af11d76..4163dd10 100644 --- a/happyview-modules/lua/shared/query.lua +++ b/happyview-modules/lua/shared/query.lua @@ -18,3 +18,12 @@ local function scalar(params, key) end return tostring(value) end + +-- luacheck: push ignore 211 +-- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand +-- boolean-typed query parameters to Lua as booleans rather than strings. +local function scalar_or_boolean(values, key) + if type(values[key]) == "boolean" then return tostring(values[key]) end + return scalar(values, key) +end +-- luacheck: pop diff --git a/happyview-modules/lua/shared/recordIdentifier.lua b/happyview-modules/lua/shared/recordIdentifier.lua index 69cab98b..6338aea6 100644 --- a/happyview-modules/lua/shared/recordIdentifier.lua +++ b/happyview-modules/lua/shared/recordIdentifier.lua @@ -9,3 +9,11 @@ local function valid_record_uri(value) if not authority or not valid_did(authority) or not valid_record_key(rkey) then return false end return true, collection, authority end + +-- luacheck: push ignore 211 +-- For user-supplied filter values: bounds the size before parsing. +local function valid_bounded_record_uri(value) + if type(value) ~= "string" or #value > 8192 then return false end + return valid_record_uri(value) +end +-- luacheck: pop diff --git a/happyview-modules/lua/shared/recordView.lua b/happyview-modules/lua/shared/recordView.lua index fcd967db..6b631549 100644 --- a/happyview-modules/lua/shared/recordView.lua +++ b/happyview-modules/lua/shared/recordView.lua @@ -9,3 +9,17 @@ local function record_view(row) record = json.decode(row.record), } end + +-- luacheck: push ignore 211 +-- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. +-- Pass it to hydrate_actor_views for sidecars that preserve the omission. +local function record_view_omitting_indexed_at(row) + return { + uri = row.uri, + cid = row.cid, + indexedAt = row.indexed_at, + did = row.did, + record = json.decode(row.record), + } +end +-- luacheck: pop diff --git a/happyview-modules/lua/shared/recordViewOmittingIndexedAt.lua b/happyview-modules/lua/shared/recordViewOmittingIndexedAt.lua deleted file mode 100644 index f269e4a6..00000000 --- a/happyview-modules/lua/shared/recordViewOmittingIndexedAt.lua +++ /dev/null @@ -1,11 +0,0 @@ --- Like record_view, but a row without indexed_at has no indexedAt key instead of JSON null. --- Pass it to hydrate_actor_views for sidecars that preserve the omission. -local function record_view_omitting_indexed_at(row) - return { - uri = row.uri, - cid = row.cid, - indexedAt = row.indexed_at, - did = row.did, - record = json.decode(row.record), - } -end diff --git a/happyview-modules/lua/shared/scalarOrBoolean.lua b/happyview-modules/lua/shared/scalarOrBoolean.lua deleted file mode 100644 index fa285b3d..00000000 --- a/happyview-modules/lua/shared/scalarOrBoolean.lua +++ /dev/null @@ -1,6 +0,0 @@ --- Like scalar(), but a boolean comes back as "true" or "false": HappyView can hand --- boolean-typed query parameters to Lua as booleans rather than strings. -local function scalar_or_boolean(values, key) - if type(values[key]) == "boolean" then return tostring(values[key]) end - return scalar(values, key) -end diff --git a/happyview-modules/lua/src/listVocabTags.lua b/happyview-modules/lua/src/listVocabTags.lua index 45b71bbc..8fb751a9 100644 --- a/happyview-modules/lua/src/listVocabTags.lua +++ b/happyview-modules/lua/src/listVocabTags.lua @@ -56,7 +56,7 @@ local function filter_signature(authors) return table.concat(authors or {}, ",") end -local function decode_cursor(token, direction, authors) +local function decode_vocab_tag_cursor(token, direction, authors) if not token then return nil end if #token % 2 ~= 0 or token:find("[^0-9a-f]") then invalid("cursor is malformed") end local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) end) @@ -141,7 +141,7 @@ local function handle_list_vocab_tags() local authors = parse_authors(params.authors) local limit = parse_list_limit(params) local direction = parse_sort_direction(params) - local cursor = decode_cursor(scalar(params, "cursor"), direction, authors) + local cursor = decode_vocab_tag_cursor(scalar(params, "cursor"), direction, authors) local views, next_cursor = list_vocab_tags(authors, limit, cursor, direction) local response = { vocabTags = toarray(views) } if next_cursor then response.cursor = next_cursor end diff --git a/happyview-modules/modules/acknowledgements/manifest.json b/happyview-modules/modules/acknowledgements/manifest.json index 4f5552c7..935e1f16 100644 --- a/happyview-modules/modules/acknowledgements/manifest.json +++ b/happyview-modules/modules/acknowledgements/manifest.json @@ -70,10 +70,8 @@ "../../lua/shared/recordView.lua", "../../lua/shared/acknowledgement.lua", "../../lua/shared/nsidValidation.lua", - "../../lua/shared/cursorEncode.lua", - "../../lua/shared/listQuery.lua", - "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", + "../../lua/shared/listQuery.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/acknowledgementList.lua" ], diff --git a/happyview-modules/modules/activity/manifest.json b/happyview-modules/modules/activity/manifest.json index 1b152222..eab0df97 100644 --- a/happyview-modules/modules/activity/manifest.json +++ b/happyview-modules/modules/activity/manifest.json @@ -48,15 +48,12 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/activityProjection.lua", "../../lua/shared/query.lua", - "../../lua/shared/scalarOrBoolean.lua", "../../lua/shared/activity.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", "../../lua/shared/createdAtSort.lua", - "../../lua/shared/cursorEncode.lua", - "../../lua/shared/listQuery.lua", - "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", + "../../lua/shared/listQuery.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/includeTotal.lua", "../../lua/shared/activityList.lua" @@ -77,15 +74,12 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/activityProjection.lua", "../../lua/shared/query.lua", - "../../lua/shared/scalarOrBoolean.lua", "../../lua/shared/activity.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", "../../lua/shared/createdAtSort.lua", - "../../lua/shared/cursorEncode.lua", - "../../lua/shared/listQuery.lua", - "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", + "../../lua/shared/listQuery.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/includeTotal.lua", "../../lua/shared/activityList.lua" diff --git a/happyview-modules/modules/actor-follow/manifest.json b/happyview-modules/modules/actor-follow/manifest.json index 500f4508..f0a3c41f 100644 --- a/happyview-modules/modules/actor-follow/manifest.json +++ b/happyview-modules/modules/actor-follow/manifest.json @@ -92,7 +92,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", @@ -118,7 +118,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", diff --git a/happyview-modules/modules/badge-definitions/manifest.json b/happyview-modules/modules/badge-definitions/manifest.json index ce14e8df..dd30d201 100644 --- a/happyview-modules/modules/badge-definitions/manifest.json +++ b/happyview-modules/modules/badge-definitions/manifest.json @@ -56,7 +56,7 @@ "../../lua/shared/badgeDefinitionValidation.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/recordView.lua", diff --git a/happyview-modules/modules/badge-queries/manifest.json b/happyview-modules/modules/badge-queries/manifest.json index 9f310816..4bb02420 100644 --- a/happyview-modules/modules/badge-queries/manifest.json +++ b/happyview-modules/modules/badge-queries/manifest.json @@ -67,7 +67,7 @@ "../../lua/shared/badgeDefinitionValidation.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/recordView.lua", @@ -109,7 +109,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/recordView.lua", @@ -151,7 +151,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/recordView.lua", diff --git a/happyview-modules/modules/collection/manifest.json b/happyview-modules/modules/collection/manifest.json index c7ed48d5..e3c2c243 100644 --- a/happyview-modules/modules/collection/manifest.json +++ b/happyview-modules/modules/collection/manifest.json @@ -9,7 +9,6 @@ "../../lua/shared/didValidation.lua", "../../lua/shared/query.lua", "../../lua/shared/recordIdentifier.lua", - "../../lua/shared/boundedRecordIdentifier.lua", "../../lua/shared/recordView.lua", "../../lua/shared/collectionProjection.lua", "../../lua/shared/collection.lua" @@ -38,19 +37,15 @@ "sharedSourcePaths": [ "../../lua/shared/didValidation.lua", "../../lua/shared/recordIdentifier.lua", - "../../lua/shared/boundedRecordIdentifier.lua", "../../lua/shared/recordView.lua", "../../lua/shared/collectionProjection.lua", "../../lua/shared/collection.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/query.lua", - "../../lua/shared/scalarOrBoolean.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", - "../../lua/shared/listQuery.lua", - "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", + "../../lua/shared/listQuery.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/includeTotal.lua", "../../lua/shared/collectionList.lua" @@ -79,19 +74,15 @@ "sharedSourcePaths": [ "../../lua/shared/didValidation.lua", "../../lua/shared/recordIdentifier.lua", - "../../lua/shared/boundedRecordIdentifier.lua", "../../lua/shared/recordView.lua", "../../lua/shared/collectionProjection.lua", "../../lua/shared/collection.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/query.lua", - "../../lua/shared/scalarOrBoolean.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", - "../../lua/shared/listQuery.lua", - "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", + "../../lua/shared/listQuery.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/includeTotal.lua", "../../lua/shared/collectionList.lua" @@ -115,8 +106,8 @@ "../../lua/shared/recordView.lua", "../../lua/shared/featureProjection.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", - "../../lua/shared/cursorToken.lua", + "../../lua/shared/datetimeValidation.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/collectionItems.lua" ], "config": { diff --git a/happyview-modules/modules/context-attachments/manifest.json b/happyview-modules/modules/context-attachments/manifest.json index 7d48862e..74360220 100644 --- a/happyview-modules/modules/context-attachments/manifest.json +++ b/happyview-modules/modules/context-attachments/manifest.json @@ -50,13 +50,11 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", "../../lua/shared/attachment.lua", - "../../lua/shared/cursorToken.lua", - "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/attachmentList.lua" diff --git a/happyview-modules/modules/context-evaluation/manifest.json b/happyview-modules/modules/context-evaluation/manifest.json index 06bbd75e..e417f4aa 100644 --- a/happyview-modules/modules/context-evaluation/manifest.json +++ b/happyview-modules/modules/context-evaluation/manifest.json @@ -50,14 +50,12 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", "../../lua/shared/evaluation.lua", "../../lua/shared/nsidValidation.lua", - "../../lua/shared/cursorToken.lua", - "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/evaluationList.lua" diff --git a/happyview-modules/modules/context-measurements/manifest.json b/happyview-modules/modules/context-measurements/manifest.json index d72e9478..b3cbfa3c 100644 --- a/happyview-modules/modules/context-measurements/manifest.json +++ b/happyview-modules/modules/context-measurements/manifest.json @@ -50,14 +50,12 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", "../../lua/shared/measurementQuery.lua", "../../lua/shared/nsidValidation.lua", - "../../lua/shared/cursorToken.lua", - "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/createdAtSort.lua" ], diff --git a/happyview-modules/modules/contribution/manifest.json b/happyview-modules/modules/contribution/manifest.json index e8e5bf6a..8c8b8e00 100644 --- a/happyview-modules/modules/contribution/manifest.json +++ b/happyview-modules/modules/contribution/manifest.json @@ -41,13 +41,11 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", "../../lua/shared/contribution.lua", - "../../lua/shared/cursorToken.lua", - "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua" ], "config": { "script_type": "lua" }, diff --git a/happyview-modules/modules/contributor-information/manifest.json b/happyview-modules/modules/contributor-information/manifest.json index 2e527654..bb1b33db 100644 --- a/happyview-modules/modules/contributor-information/manifest.json +++ b/happyview-modules/modules/contributor-information/manifest.json @@ -57,10 +57,8 @@ "../../lua/shared/actorView.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", - "../../lua/shared/listQuery.lua", - "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", + "../../lua/shared/listQuery.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/createdAtSort.lua" ], diff --git a/happyview-modules/modules/entity-follow/manifest.json b/happyview-modules/modules/entity-follow/manifest.json index e2dea06e..c901a08d 100644 --- a/happyview-modules/modules/entity-follow/manifest.json +++ b/happyview-modules/modules/entity-follow/manifest.json @@ -99,12 +99,10 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/entityFollow.lua", - "../../lua/shared/cursorToken.lua", - "../../lua/shared/listCursor.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/entityFollowPagination.lua", "../../lua/shared/entityFollowFollowers.lua" @@ -124,18 +122,15 @@ "../../lua/shared/didValidation.lua", "../../lua/shared/query.lua", "../../lua/shared/recordIdentifier.lua", - "../../lua/shared/boundedRecordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/activityProjection.lua", "../../lua/shared/recordView.lua", "../../lua/shared/collectionProjection.lua", "../../lua/shared/featureProjection.lua", "../../lua/shared/entityFollow.lua", - "../../lua/shared/cursorToken.lua", - "../../lua/shared/listCursor.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/entityFollowPagination.lua", "../../lua/shared/entityFollowEntities.lua" diff --git a/happyview-modules/modules/evm-links/manifest.json b/happyview-modules/modules/evm-links/manifest.json index d19c8c8e..c4e7944f 100644 --- a/happyview-modules/modules/evm-links/manifest.json +++ b/happyview-modules/modules/evm-links/manifest.json @@ -51,7 +51,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/recordView.lua", diff --git a/happyview-modules/modules/features/manifest.json b/happyview-modules/modules/features/manifest.json index cb1227c6..b524da52 100644 --- a/happyview-modules/modules/features/manifest.json +++ b/happyview-modules/modules/features/manifest.json @@ -48,7 +48,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/featureValidation.lua", diff --git a/happyview-modules/modules/feed-reactions/manifest.json b/happyview-modules/modules/feed-reactions/manifest.json index 9a069cb7..779c41d2 100644 --- a/happyview-modules/modules/feed-reactions/manifest.json +++ b/happyview-modules/modules/feed-reactions/manifest.json @@ -67,12 +67,10 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", - "../../lua/shared/cursorToken.lua", - "../../lua/shared/listCursor.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/feedReaction.lua" ], @@ -90,12 +88,10 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", - "../../lua/shared/cursorToken.lua", - "../../lua/shared/listCursor.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/feedReaction.lua" ], @@ -113,12 +109,10 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", - "../../lua/shared/cursorToken.lua", - "../../lua/shared/listCursor.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/feedReaction.lua" ], @@ -136,12 +130,10 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", - "../../lua/shared/cursorToken.lua", - "../../lua/shared/listCursor.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/feedReaction.lua" ], diff --git a/happyview-modules/modules/funding/manifest.json b/happyview-modules/modules/funding/manifest.json index 04e63d9e..35c2826c 100644 --- a/happyview-modules/modules/funding/manifest.json +++ b/happyview-modules/modules/funding/manifest.json @@ -54,10 +54,8 @@ "../../lua/shared/actorView.lua", "../../lua/shared/fundingReceipt.lua", "../../lua/shared/nsidValidation.lua", - "../../lua/shared/cursorEncode.lua", - "../../lua/shared/listQuery.lua", - "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", + "../../lua/shared/listQuery.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/includeTotal.lua", diff --git a/happyview-modules/modules/location/manifest.json b/happyview-modules/modules/location/manifest.json index 421a2892..f9253566 100644 --- a/happyview-modules/modules/location/manifest.json +++ b/happyview-modules/modules/location/manifest.json @@ -50,7 +50,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/recordView.lua", diff --git a/happyview-modules/modules/organization/manifest.json b/happyview-modules/modules/organization/manifest.json index bddde45f..beebbbdf 100644 --- a/happyview-modules/modules/organization/manifest.json +++ b/happyview-modules/modules/organization/manifest.json @@ -94,7 +94,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", @@ -122,7 +122,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", diff --git a/happyview-modules/modules/profile/manifest.json b/happyview-modules/modules/profile/manifest.json index f7d75788..d6f9b966 100644 --- a/happyview-modules/modules/profile/manifest.json +++ b/happyview-modules/modules/profile/manifest.json @@ -87,7 +87,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/profile.lua", @@ -112,7 +112,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/profile.lua", diff --git a/happyview-modules/modules/recent-follows/manifest.json b/happyview-modules/modules/recent-follows/manifest.json index 56fde049..87811fc8 100644 --- a/happyview-modules/modules/recent-follows/manifest.json +++ b/happyview-modules/modules/recent-follows/manifest.json @@ -20,7 +20,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/accountFollowFilter.lua", "../../lua/shared/recentFollows.lua" ], diff --git a/happyview-modules/modules/rights/manifest.json b/happyview-modules/modules/rights/manifest.json index ed4452ab..e66b5b97 100644 --- a/happyview-modules/modules/rights/manifest.json +++ b/happyview-modules/modules/rights/manifest.json @@ -42,10 +42,8 @@ "../../lua/shared/actorView.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", - "../../lua/shared/listQuery.lua", - "../../lua/shared/cursorToken.lua", "../../lua/shared/listCursor.lua", + "../../lua/shared/listQuery.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/createdAtSort.lua" ], diff --git a/happyview-modules/modules/vocab/manifest.json b/happyview-modules/modules/vocab/manifest.json index 8409d8db..264ec225 100644 --- a/happyview-modules/modules/vocab/manifest.json +++ b/happyview-modules/modules/vocab/manifest.json @@ -31,7 +31,6 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", - "../../lua/shared/recordViewOmittingIndexedAt.lua", "../../lua/shared/vocabTagValidation.lua" ], "config": { @@ -51,11 +50,10 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", - "../../lua/shared/recordViewOmittingIndexedAt.lua", "../../lua/shared/vocabTagValidation.lua" ], "config": { diff --git a/happyview-modules/modules/workscope-tags/manifest.json b/happyview-modules/modules/workscope-tags/manifest.json index 22633f83..7098015a 100644 --- a/happyview-modules/modules/workscope-tags/manifest.json +++ b/happyview-modules/modules/workscope-tags/manifest.json @@ -20,7 +20,6 @@ "../../lua/shared/query.lua", "../../lua/shared/recordIdentifier.lua", "../../lua/shared/recordView.lua", - "../../lua/shared/recordViewOmittingIndexedAt.lua", "../../lua/shared/actorView.lua", "../../lua/shared/workscopeTag.lua" ], @@ -51,14 +50,11 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/cursorEncode.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", - "../../lua/shared/recordViewOmittingIndexedAt.lua", "../../lua/shared/actorView.lua", "../../lua/shared/workscopeTag.lua", - "../../lua/shared/cursorToken.lua", - "../../lua/shared/listCursor.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/workscopeTagList.lua" ], diff --git a/happyview-modules/tests/unit/endpoints/rights-edge-lua.test.js b/happyview-modules/tests/unit/endpoints/rights-edge-lua.test.js index 3e9fbbe5..5b606cfe 100644 --- a/happyview-modules/tests/unit/endpoints/rights-edge-lua.test.js +++ b/happyview-modules/tests/unit/endpoints/rights-edge-lua.test.js @@ -19,10 +19,8 @@ async function endpointSources(name) { shared.push( "lua/shared/datetimeValidation.lua", "lua/shared/listValidation.lua", - "lua/shared/cursorEncode.lua", - "lua/shared/listQuery.lua", - "lua/shared/cursorToken.lua", "lua/shared/listCursor.lua", + "lua/shared/listQuery.lua", "lua/shared/listWhere.lua", "lua/shared/createdAtSort.lua", ); diff --git a/happyview-modules/tests/unit/endpoints/rights-lua.test.js b/happyview-modules/tests/unit/endpoints/rights-lua.test.js index 69190754..1628aa99 100644 --- a/happyview-modules/tests/unit/endpoints/rights-lua.test.js +++ b/happyview-modules/tests/unit/endpoints/rights-lua.test.js @@ -91,10 +91,8 @@ async function listRightsSources() { read("lua/shared/actorView.lua"), read("lua/shared/datetimeValidation.lua"), read("lua/shared/listValidation.lua"), - read("lua/shared/cursorEncode.lua"), - read("lua/shared/listQuery.lua"), - read("lua/shared/cursorToken.lua"), read("lua/shared/listCursor.lua"), + read("lua/shared/listQuery.lua"), read("lua/shared/listWhere.lua"), read("lua/shared/createdAtSort.lua"), read("lua/src/listRights.lua"), diff --git a/happyview-modules/tests/unit/feature.test.js b/happyview-modules/tests/unit/feature.test.js index ff5e4077..12c546b6 100644 --- a/happyview-modules/tests/unit/feature.test.js +++ b/happyview-modules/tests/unit/feature.test.js @@ -138,7 +138,7 @@ async function runListFeatures( "lua/shared/recordIdentifier.lua", "lua/shared/datetimeValidation.lua", "lua/shared/listValidation.lua", - "lua/shared/cursorEncode.lua", + "lua/shared/listCursor.lua", "lua/shared/listQuery.lua", "lua/shared/listWhere.lua", "lua/shared/featureValidation.lua", diff --git a/happyview-modules/tests/unit/lua/recentFollows.test.lua b/happyview-modules/tests/unit/lua/recentFollows.test.lua index 07412281..b725cc15 100644 --- a/happyview-modules/tests/unit/lua/recentFollows.test.lua +++ b/happyview-modules/tests/unit/lua/recentFollows.test.lua @@ -95,7 +95,7 @@ local handler = table.concat({ source("lua/shared/recordIdentifier.lua"), source("lua/shared/datetimeValidation.lua"), source("lua/shared/listValidation.lua"), - source("lua/shared/cursorEncode.lua"), + source("lua/shared/listCursor.lua"), source("lua/shared/accountFollowFilter.lua"), source("lua/shared/recentFollows.lua"), source("lua/src/listRecentFollows.lua"), diff --git a/happyview-modules/tests/unit/tooling/listContributorInformation.test.js b/happyview-modules/tests/unit/tooling/listContributorInformation.test.js index abd9b19a..d7e89c57 100644 --- a/happyview-modules/tests/unit/tooling/listContributorInformation.test.js +++ b/happyview-modules/tests/unit/tooling/listContributorInformation.test.js @@ -18,10 +18,8 @@ test("listContributorInformation filters repeated authors and resumes in the sel read("lua/shared/actorView.lua"), read("lua/shared/datetimeValidation.lua"), read("lua/shared/listValidation.lua"), - read("lua/shared/cursorEncode.lua"), - read("lua/shared/listQuery.lua"), - read("lua/shared/cursorToken.lua"), read("lua/shared/listCursor.lua"), + read("lua/shared/listQuery.lua"), read("lua/shared/listWhere.lua"), read("lua/shared/createdAtSort.lua"), read("lua/src/listContributorInformation.lua"), diff --git a/happyview-modules/tests/unit/tooling/vocab-tags.test.js b/happyview-modules/tests/unit/tooling/vocab-tags.test.js index 5feaa32a..b558511a 100644 --- a/happyview-modules/tests/unit/tooling/vocab-tags.test.js +++ b/happyview-modules/tests/unit/tooling/vocab-tags.test.js @@ -15,11 +15,10 @@ const sharedSources = [ "lua/shared/recordIdentifier.lua", "lua/shared/datetimeValidation.lua", "lua/shared/listValidation.lua", - "lua/shared/cursorEncode.lua", + "lua/shared/listCursor.lua", "lua/shared/listQuery.lua", "lua/shared/recordView.lua", "lua/shared/actorView.lua", - "lua/shared/recordViewOmittingIndexedAt.lua", "lua/shared/vocabTagValidation.lua", ]; diff --git a/happyview-modules/tooling/shared-helpers.registry.json b/happyview-modules/tooling/shared-helpers.registry.json index fd2707d5..97d9e36f 100644 --- a/happyview-modules/tooling/shared-helpers.registry.json +++ b/happyview-modules/tooling/shared-helpers.registry.json @@ -30,7 +30,7 @@ "description": "the AT-URI parsing pattern" } ], - "homes": ["lua/shared/recordIdentifier.lua", "lua/shared/boundedRecordIdentifier.lua"] + "homes": ["lua/shared/recordIdentifier.lua"] }, { "id": "datetime-validation", @@ -60,12 +60,7 @@ "description": "the cursor length cap" } ], - "homes": [ - "lua/shared/listCursor.lua", - "lua/shared/listQuery.lua", - "lua/shared/cursorEncode.lua", - "lua/shared/cursorToken.lua" - ] + "homes": ["lua/shared/listCursor.lua", "lua/shared/listQuery.lua"] }, { "id": "list-params", @@ -105,7 +100,7 @@ "description": "single-value parameter parsing" } ], - "homes": ["lua/shared/query.lua", "lua/shared/scalarOrBoolean.lua"] + "homes": ["lua/shared/query.lua"] }, { "id": "repeated-query-array", @@ -125,7 +120,7 @@ "description": "the indexedAt null fallback" } ], - "homes": ["lua/shared/recordView.lua", "lua/shared/recordViewOmittingIndexedAt.lua"] + "homes": ["lua/shared/recordView.lua"] }, { "id": "actor-view", @@ -528,9 +523,9 @@ }, { "file": "lua/src/listVocabTags.lua", - "family": "shared-helper", - "symbol": "decode_cursor", - "reason": "Existing duplicate of a lua/shared helper; baseline until the consolidation PRs land." + "family": "list-cursor", + "symbol": "decode_vocab_tag_cursor", + "reason": "Pending A1 in the follow-up PR: this decoder has no 8192-character cap and an empty cursor gets a different message; its cursor also carries the author filter. Renamed from decode_cursor so it no longer collides with the shared helper." }, { "file": "lua/src/searchBadgeDefinitions.lua", From 3683aad7c358761c6a76f710b9e144b68188b9aa Mon Sep 17 00:00:00 2001 From: kzoeps Date: Thu, 26 Nov 2026 19:36:42 +0600 Subject: [PATCH 8/8] list-golden: build LuaTable literals without nested template strings --- happyview-modules/tests/unit/list-golden/harness.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/happyview-modules/tests/unit/list-golden/harness.js b/happyview-modules/tests/unit/list-golden/harness.js index 85d9f9cc..8b79d905 100644 --- a/happyview-modules/tests/unit/list-golden/harness.js +++ b/happyview-modules/tests/unit/list-golden/harness.js @@ -20,7 +20,8 @@ export class LuaTable { /** Encodes a JS value as a Lua table/literal for the runner program. */ export function lua(value) { if (value instanceof LuaTable) { - return `{${value.entries.map(([key, item]) => `[${lua(key)}]=${lua(item)}`).join(",")}}`; + const fields = value.entries.map(([key, item]) => "[" + lua(key) + "]=" + lua(item)); + return "{" + fields.join(",") + "}"; } if (typeof value === "string") return JSON.stringify(value); if (typeof value === "number" || typeof value === "boolean") return String(value);