diff --git a/happyview-modules/lua/endpoints/getAcknowledgement.lua b/happyview-modules/lua/endpoints/getAcknowledgement.lua index 753566ae..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,10 +48,43 @@ 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) + 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 + +-- 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" -local NULL = json.decode("null") local function acknowledgement_query(sql, values) if db.backend() ~= "postgres" then @@ -55,16 +97,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 +125,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 +145,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/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 d6fc972f..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,10 +68,26 @@ 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" -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 +109,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 6973b374..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +end + local NULL = json.decode("null") local function record_view(row) @@ -94,10 +156,26 @@ 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" -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 @@ -119,31 +197,9 @@ 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 - --- 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 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") + 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 - 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 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])$" @@ -183,13 +239,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 +312,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/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 84fb24ed..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +end + local NULL = json.decode("null") local function record_view(row) @@ -94,10 +156,26 @@ 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" -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 @@ -119,31 +197,9 @@ 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 - --- 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 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") + 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 - 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 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])$" @@ -183,13 +239,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 +312,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/getActors.lua b/happyview-modules/lua/endpoints/getActors.lua index 2f94c956..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,10 +68,26 @@ 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" -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 +109,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..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,10 +68,26 @@ 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" -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 +109,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..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,10 +68,26 @@ 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" -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 +109,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..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,10 +75,26 @@ 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" -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 +116,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..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,10 +68,26 @@ 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" -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 +109,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 06511fcb..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,17 +48,46 @@ 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) + 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 + +-- 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" 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) @@ -61,16 +99,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 @@ -127,7 +155,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) @@ -193,8 +221,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 @@ -204,7 +232,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 @@ -218,7 +246,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 @@ -229,11 +257,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 +279,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/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 27d505f9..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,10 +68,26 @@ 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" -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 +109,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..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,10 +76,26 @@ 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" -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 +117,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..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,40 @@ 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) + 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 + +-- 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") @@ -53,18 +96,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 +122,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..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 @@ -54,6 +71,32 @@ 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 + +-- 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") @@ -68,18 +111,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 +251,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..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,10 +68,26 @@ 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" -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 +109,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 9f8e759e..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,20 +68,26 @@ 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) 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) -end - -local function evm_link_record_view(row) - local view = record_view(row) - if view.indexedAt == nil then view.indexedAt = NULL end - return view + return valid and collection == EVMLINK_COLLECTION end local function normalize_evm_actor_indexed_at(actors) @@ -81,7 +104,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 @@ -103,8 +128,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 @@ -132,7 +157,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..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) @@ -48,6 +65,32 @@ 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 + +-- 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") @@ -79,16 +122,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 +146,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/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 81d7fa6f..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +end + local NULL = json.decode("null") local function record_view(row) @@ -94,10 +156,26 @@ 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" -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 @@ -119,31 +197,9 @@ 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 - --- 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 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") + 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 - 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 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])$" @@ -183,13 +239,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 +312,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/getLocation.lua b/happyview-modules/lua/endpoints/getLocation.lua index b11a3b23..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,10 +68,26 @@ 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" -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 +109,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 4513a0ef..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,10 +68,26 @@ 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" -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,18 +109,14 @@ 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 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 +155,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/getOrganization.lua b/happyview-modules/lua/endpoints/getOrganization.lua index cbe59f26..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,10 +68,26 @@ 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" -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 +109,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..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,10 +68,26 @@ 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" -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 +109,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/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 a5fec131..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,10 +68,26 @@ 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" -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 +109,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 +128,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 98eed4e1..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +end + local NULL = json.decode("null") local function record_view(row) @@ -94,10 +156,26 @@ 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" -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 @@ -119,31 +197,9 @@ 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 - --- 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 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") + 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 - 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 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])$" @@ -183,13 +239,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 +312,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/getRights.lua b/happyview-modules/lua/endpoints/getRights.lua index ddf40e19..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,9 +48,13 @@ local function valid_record_uri(value) return true, collection, authority end -local function rights_valid_record_uri(value) +-- 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") @@ -55,10 +68,26 @@ 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" -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 @@ -80,27 +109,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 @@ -118,7 +128,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 @@ -129,8 +139,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..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,10 +68,26 @@ 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" -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 +109,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 @@ -89,15 +122,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 +149,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 a8b9cd9c..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,10 +48,30 @@ 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. +-- 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) + 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 + +-- 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, @@ -51,11 +80,14 @@ local function record_view(row) record = json.decode(row.record), } end +-- luacheck: pop 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,18 +109,14 @@ 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 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 +141,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 @@ -125,7 +153,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 0e43d197..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( @@ -71,10 +88,35 @@ 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 + +-- 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" -local NULL = json.decode("null") local function acknowledgement_query(sql, values) if db.backend() ~= "postgres" then @@ -87,16 +129,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 +157,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 @@ -148,27 +180,30 @@ local function valid_nsid(value) return #name <= 63 and name:match("^[A-Za-z][A-Za-z0-9]*$") ~= nil 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 +-- 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 - 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 +216,26 @@ 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 +-- 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) if #items == 0 then @@ -245,13 +300,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,11 +351,11 @@ 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 - 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/listActivities.lua b/happyview-modules/lua/endpoints/listActivities.lua index c4d88543..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,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) @@ -283,27 +300,30 @@ local function created_at_sort(alias) "::timestamptz, " .. created_at .. "::timestamptz) 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 +-- 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 - 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 @@ -316,6 +336,26 @@ 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 +-- 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) if #items == 0 then @@ -340,13 +380,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 @@ -389,13 +422,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 @@ -518,7 +544,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 @@ -542,7 +568,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..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +end + local NULL = json.decode("null") local function record_view(row) @@ -94,10 +156,26 @@ 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" -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 @@ -119,8 +197,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 5ca40982..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +end + local NULL = json.decode("null") local function record_view(row) @@ -94,10 +156,26 @@ 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" -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 @@ -119,8 +197,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 e4349b60..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +end + local NULL = json.decode("null") local function record_view(row) @@ -94,10 +156,26 @@ 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" -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 @@ -119,8 +197,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 @@ -158,28 +236,6 @@ local function hydrate_attachment_views(views) hydrate_actor_views(authors, attachment_query) 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 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 - -- 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 +317,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 +380,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 d57d0cb9..40c9e5fb 100644 --- a/happyview-modules/lua/endpoints/listBadgeAwards.lua +++ b/happyview-modules/lua/endpoints/listBadgeAwards.lua @@ -19,6 +19,25 @@ 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 + 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]+):(.+)$") @@ -39,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( @@ -71,17 +98,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +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 @@ -109,10 +181,26 @@ 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" -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 @@ -134,8 +222,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 @@ -332,16 +420,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 +549,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/listBadgeDefinitions.lua b/happyview-modules/lua/endpoints/listBadgeDefinitions.lua index 13c6383e..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,17 +95,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +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 @@ -116,10 +178,26 @@ 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" -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 @@ -141,8 +219,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 fdf71f02..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +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 @@ -109,10 +171,26 @@ 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" -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 @@ -134,8 +212,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 06d1f5b9..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" @@ -217,6 +234,32 @@ 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 + +-- 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") @@ -248,16 +291,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 +315,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 @@ -295,42 +328,99 @@ local function parse_list_limit(params) return limit end -local ITEM_COLLECTION = "org.hypercerts.collection" -local ITEM_ACTIVITY = "org.hypercerts.claim.activity" -local ITEM_FEATURE = "org.hypercerts.entity.feature" -local ITEM_NULL = json.decode("null") +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 -local function collection_items_invalid(message) - error("InvalidRequest: " .. message, 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 -local function collection_items_keys_only(values, allowed) - keys_only(values, allowed, "unknown query parameter: ") +-- 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 collection_items_cursor_decode(token, collection_uri) +-- 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 - if #token == 0 or #token > 8192 or #token % 2 ~= 0 or token:find("[^0-9a-f]") then - collection_items_invalid("cursor is malformed") + 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 - local decoded = token:gsub("..", function(pair) return string.char(tonumber(pair, 16)) 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" +local ITEM_NULL = json.decode("null") + +local function collection_items_cursor_decode(token, collection_uri) + 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.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 -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) @@ -445,11 +535,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) @@ -491,7 +581,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 f667e39f..72965e98 100644 --- a/happyview-modules/lua/endpoints/listCollections.lua +++ b/happyview-modules/lua/endpoints/listCollections.lua @@ -18,17 +18,46 @@ 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) + 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 + +-- 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" 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) @@ -40,16 +69,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 @@ -106,7 +125,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) @@ -172,8 +191,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 @@ -183,7 +202,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 @@ -197,7 +216,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 @@ -208,11 +227,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) @@ -292,6 +306,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_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 @@ -300,27 +323,30 @@ local function parse_list_limit(params) return limit 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 +-- 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 - 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 @@ -333,6 +359,26 @@ 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 +-- 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) if #items == 0 then @@ -357,11 +403,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 @@ -392,16 +433,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 @@ -416,13 +457,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 = collection_valid_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 @@ -556,7 +590,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 @@ -581,7 +615,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..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +end + local NULL = json.decode("null") local function record_view(row) @@ -94,10 +156,26 @@ 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" -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 @@ -119,8 +197,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 @@ -151,28 +229,6 @@ local function contribution_view(row) return view 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 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 - -- 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 +279,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 +326,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..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,10 +76,26 @@ 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" -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 +117,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,27 +154,30 @@ local function parse_list_limit(params) return limit 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 +-- 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 - 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 +190,26 @@ 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 +-- 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) if #items == 0 then @@ -233,12 +289,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 +355,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..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,17 +88,88 @@ 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 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)) +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 +-- 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") @@ -96,44 +184,12 @@ 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 --- 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 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 - 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 +205,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 @@ -241,8 +290,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 @@ -252,7 +301,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) @@ -268,7 +317,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 8e91ea3a..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,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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +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" @@ -260,17 +322,38 @@ 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 + +-- 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" 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) @@ -282,16 +365,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 @@ -348,7 +421,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) @@ -414,8 +487,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 @@ -425,7 +498,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 @@ -439,7 +512,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 @@ -479,16 +552,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", @@ -513,8 +576,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 @@ -532,44 +595,12 @@ 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 --- 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 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 - 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 @@ -585,13 +616,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 @@ -728,7 +752,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 @@ -751,7 +775,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 = {} @@ -775,7 +799,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..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +end + local NULL = json.decode("null") local function record_view(row) @@ -94,10 +156,26 @@ 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" -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 @@ -119,8 +197,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 @@ -220,28 +298,6 @@ local function valid_nsid(value) return #name <= 63 and name:match("^[A-Za-z][A-Za-z0-9]*$") ~= nil 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 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 - -- 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 +387,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 +479,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 cccce77b..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +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 @@ -109,20 +171,26 @@ 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) 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) -end - -local function evm_link_record_view(row) - local view = record_view(row) - if view.indexedAt == nil then view.indexedAt = NULL end - return view + return valid and collection == EVMLINK_COLLECTION end local function normalize_evm_actor_indexed_at(actors) @@ -139,7 +207,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 @@ -161,8 +231,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 @@ -274,7 +344,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 1c0b6cd8..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +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 @@ -105,6 +167,32 @@ 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 + +-- 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") @@ -136,16 +224,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", @@ -170,8 +248,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 b1921f7d..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +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 @@ -109,10 +171,26 @@ 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" -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 @@ -134,8 +212,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 0e4454ef..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +end + local NULL = json.decode("null") local function record_view(row) @@ -94,10 +156,26 @@ 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" -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 @@ -119,18 +197,14 @@ 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 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) @@ -183,28 +257,6 @@ local function valid_nsid(value) return #name <= 63 and name:match("^[A-Za-z][A-Za-z0-9]*$") ~= nil 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 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 - -- 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 @@ -264,7 +316,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 @@ -286,13 +338,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 = measurement_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 @@ -357,7 +402,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 1d379391..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +end + local NULL = json.decode("null") local function record_view(row) @@ -94,10 +156,26 @@ 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" -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 @@ -119,8 +197,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 @@ -233,9 +311,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..bfa7168e 100644 --- a/happyview-modules/lua/endpoints/listProfiles.lua +++ b/happyview-modules/lua/endpoints/listProfiles.lua @@ -27,6 +27,35 @@ 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_~%.:%-]") +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 + +-- 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( @@ -59,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +end + local NULL = json.decode("null") local function record_view(row) @@ -82,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) @@ -121,9 +209,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/listReceipts.lua b/happyview-modules/lua/endpoints/listReceipts.lua index 97585d4e..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,10 +100,26 @@ 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" -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 +141,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 +160,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) @@ -165,27 +193,30 @@ local function valid_nsid(value) return #name <= 63 and name:match("^[A-Za-z][A-Za-z0-9]*$") ~= nil 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 +-- 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 - 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 +229,26 @@ 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 +-- 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) if #items == 0 then @@ -299,13 +350,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 +468,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 4a4bfeab..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,6 +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 @@ -91,18 +158,13 @@ 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 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 @@ -116,7 +178,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 @@ -195,7 +257,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 499fc669..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,9 +48,13 @@ local function valid_record_uri(value) return true, collection, authority end -local function rights_valid_record_uri(value) +-- 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") @@ -55,10 +68,26 @@ 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" -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 @@ -80,27 +109,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 @@ -136,27 +146,30 @@ local function parse_list_limit(params) return limit 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 +-- 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 - 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 @@ -169,6 +182,26 @@ 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 +-- 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) if #items == 0 then @@ -241,13 +274,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 = rights_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 } @@ -277,12 +303,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 @@ -297,7 +323,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..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +end + local NULL = json.decode("null") local function record_view(row) @@ -94,10 +156,26 @@ 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" -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 @@ -119,8 +197,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 @@ -132,15 +210,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) @@ -199,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) @@ -263,7 +332,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 @@ -284,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 90a04ba0..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,21 +88,78 @@ local function parse_list_limit(params) return limit 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 +-- 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 --- Workscope sidecars omit missing indexedAt; the work-scope tag view encodes it as JSON null separately. +-- 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 + 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 + +-- 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, @@ -94,11 +168,14 @@ local function record_view(row) record = json.decode(row.record), } end +-- luacheck: pop 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,18 +197,14 @@ 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 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) @@ -154,28 +227,6 @@ local function workscope_tag_view(row) } 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 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 - -- 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 @@ -228,19 +279,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 = workscope_tag_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 @@ -283,7 +327,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/searchActivities.lua b/happyview-modules/lua/endpoints/searchActivities.lua index b2981ff0..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,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) @@ -283,27 +300,30 @@ local function created_at_sort(alias) "::timestamptz, " .. created_at .. "::timestamptz) 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 +-- 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 - 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 @@ -316,6 +336,26 @@ 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 +-- 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) if #items == 0 then @@ -340,13 +380,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 @@ -389,13 +422,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 @@ -518,7 +544,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 @@ -542,7 +568,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..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,17 +95,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +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 @@ -116,10 +178,26 @@ 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" -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 @@ -141,8 +219,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 a33a70ee..00f64ca2 100644 --- a/happyview-modules/lua/endpoints/searchCollections.lua +++ b/happyview-modules/lua/endpoints/searchCollections.lua @@ -18,17 +18,46 @@ 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) + 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 + +-- 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" 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) @@ -40,16 +69,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 @@ -106,7 +125,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) @@ -172,8 +191,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 @@ -183,7 +202,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 @@ -197,7 +216,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 @@ -208,11 +227,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) @@ -292,6 +306,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_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 @@ -300,27 +323,30 @@ local function parse_list_limit(params) return limit 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 +-- 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 - 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 @@ -333,6 +359,26 @@ 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 +-- 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) if #items == 0 then @@ -357,11 +403,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 @@ -392,16 +433,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 @@ -416,13 +457,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 = collection_valid_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 @@ -556,7 +590,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 @@ -581,7 +615,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 68523609..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,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +end + local NULL = json.decode("null") local function record_view(row) @@ -94,10 +156,26 @@ 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" -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 @@ -119,8 +197,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 @@ -233,9 +311,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..fbe38300 100644 --- a/happyview-modules/lua/endpoints/searchProfiles.lua +++ b/happyview-modules/lua/endpoints/searchProfiles.lua @@ -27,6 +27,35 @@ 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_~%.:%-]") +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 + +-- 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( @@ -59,17 +88,62 @@ local function parse_list_limit(params) return limit 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 +-- 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 + return direction +end + local NULL = json.decode("null") local function record_view(row) @@ -82,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) @@ -121,9 +209,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/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 fe8ae8db..53c72682 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,11 +99,11 @@ 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 - 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/activityList.lua b/happyview-modules/lua/shared/activityList.lua index 451c9581..54a01dab 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 @@ -47,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 @@ -176,7 +162,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 @@ -200,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/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/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/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/collectionItems.lua b/happyview-modules/lua/shared/collectionItems.lua index 6375399e..68faeac6 100644 --- a/happyview-modules/lua/shared/collectionItems.lua +++ b/happyview-modules/lua/shared/collectionItems.lua @@ -3,37 +3,20 @@ 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") - 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 - 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 -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) @@ -148,11 +131,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) @@ -194,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 da24acd4..a4229712 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 @@ -33,16 +28,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 @@ -57,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 = collection_valid_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 @@ -197,7 +185,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 @@ -222,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/collectionProjection.lua b/happyview-modules/lua/shared/collectionProjection.lua index 074c5dc1..f36784bd 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) @@ -20,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 @@ -86,7 +71,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) @@ -152,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 @@ -163,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 @@ -177,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/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/evmLinkIdentifier.lua b/happyview-modules/lua/shared/evmLinkIdentifier.lua index 89cd72a7..8b8aa893 100644 --- a/happyview-modules/lua/shared/evmLinkIdentifier.lua +++ b/happyview-modules/lua/shared/evmLinkIdentifier.lua @@ -3,15 +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) -end - -local function evm_link_record_view(row) - local view = record_view(row) - if view.indexedAt == nil then view.indexedAt = NULL end - return view + return valid and collection == EVMLINK_COLLECTION end local function normalize_evm_actor_indexed_at(actors) 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/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/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/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..faf118cf 100644 --- a/happyview-modules/lua/shared/listCursor.lua +++ b/happyview-modules/lua/shared/listCursor.lua @@ -1,13 +1,27 @@ +-- 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 - 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 +33,17 @@ 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 +-- luacheck: pop 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/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/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/recentFollows.lua b/happyview-modules/lua/shared/recentFollows.lua index f2bcc035..4dbb1508 100644 --- a/happyview-modules/lua/shared/recentFollows.lua +++ b/happyview-modules/lua/shared/recentFollows.lua @@ -2,18 +2,13 @@ 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 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 @@ -27,7 +22,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 @@ -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/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/rightsIdentifier.lua b/happyview-modules/lua/shared/rightsIdentifier.lua deleted file mode 100644 index e2dd2d12..00000000 --- a/happyview-modules/lua/shared/rightsIdentifier.lua +++ /dev/null @@ -1,3 +0,0 @@ -local function rights_valid_record_uri(value) - return valid_record_uri(value) -end diff --git a/happyview-modules/lua/shared/rightsView.lua b/happyview-modules/lua/shared/rightsView.lua deleted file mode 100644 index 768bbe2a..00000000 --- a/happyview-modules/lua/shared/rightsView.lua +++ /dev/null @@ -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/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..e29d5103 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 = workscope_tag_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 @@ -91,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/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/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/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..f2e3d63e 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 @@ -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 00ff7671..80d7edc7 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 @@ -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/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/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/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/listMeasurements.lua b/happyview-modules/lua/src/listMeasurements.lua index d20be61b..29d79eab 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 @@ -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 = measurement_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 fdddd392..82f960ec 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 = rights_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 } @@ -77,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 @@ -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/lua/src/listVocabTags.lua b/happyview-modules/lua/src/listVocabTags.lua index 287cac96..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) @@ -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 @@ -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 0e965ee9..935e1f16 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,10 +67,11 @@ "../../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/listQuery.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 7e6d5216..eab0df97 100644 --- a/happyview-modules/modules/activity/manifest.json +++ b/happyview-modules/modules/activity/manifest.json @@ -52,8 +52,8 @@ "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", "../../lua/shared/createdAtSort.lua", - "../../lua/shared/listQuery.lua", "../../lua/shared/listCursor.lua", + "../../lua/shared/listQuery.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/includeTotal.lua", "../../lua/shared/activityList.lua" @@ -78,8 +78,8 @@ "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", "../../lua/shared/createdAtSort.lua", - "../../lua/shared/listQuery.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 a6be14ea..f0a3c41f 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/listCursor.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/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 4c5d7369..dd30d201 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/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 bec7aa3e..4bb02420 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/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/recordView.lua", @@ -103,10 +104,12 @@ "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", "../../lua/shared/listValidation.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/recordView.lua", @@ -148,6 +151,7 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.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 e5a7440a..e3c2c243 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/recordView.lua", "../../lua/shared/collectionProjection.lua", "../../lua/shared/collection.lua" ], @@ -36,14 +37,15 @@ "sharedSourcePaths": [ "../../lua/shared/didValidation.lua", "../../lua/shared/recordIdentifier.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/listValidation.lua", - "../../lua/shared/listQuery.lua", "../../lua/shared/listCursor.lua", + "../../lua/shared/listQuery.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/includeTotal.lua", "../../lua/shared/collectionList.lua" @@ -72,14 +74,15 @@ "sharedSourcePaths": [ "../../lua/shared/didValidation.lua", "../../lua/shared/recordIdentifier.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/listValidation.lua", - "../../lua/shared/listQuery.lua", "../../lua/shared/listCursor.lua", + "../../lua/shared/listQuery.lua", "../../lua/shared/listWhere.lua", "../../lua/shared/includeTotal.lua", "../../lua/shared/collectionList.lua" @@ -100,8 +103,11 @@ "../../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/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 047e6233..74360220 100644 --- a/happyview-modules/modules/context-attachments/manifest.json +++ b/happyview-modules/modules/context-attachments/manifest.json @@ -50,11 +50,11 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", "../../lua/shared/attachment.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 4268ea60..e417f4aa 100644 --- a/happyview-modules/modules/context-evaluation/manifest.json +++ b/happyview-modules/modules/context-evaluation/manifest.json @@ -50,12 +50,12 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.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/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 20704d1c..b3cbfa3c 100644 --- a/happyview-modules/modules/context-measurements/manifest.json +++ b/happyview-modules/modules/context-measurements/manifest.json @@ -50,12 +50,12 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.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/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..8c8b8e00 100644 --- a/happyview-modules/modules/contribution/manifest.json +++ b/happyview-modules/modules/contribution/manifest.json @@ -41,11 +41,11 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", "../../lua/shared/contribution.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 9ad5d784..bb1b33db 100644 --- a/happyview-modules/modules/contributor-information/manifest.json +++ b/happyview-modules/modules/contributor-information/manifest.json @@ -57,8 +57,8 @@ "../../lua/shared/actorView.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/listQuery.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 d5c40dd0..c901a08d 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", @@ -97,9 +99,10 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", + "../../lua/shared/recordView.lua", "../../lua/shared/entityFollow.lua", - "../../lua/shared/listCursor.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/entityFollowPagination.lua", "../../lua/shared/entityFollowFollowers.lua" @@ -121,12 +124,13 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.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/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 4d5bbd81..c4e7944f 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/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 00ca2c24..b524da52 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" }, @@ -47,9 +48,11 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/listCursor.lua", "../../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/feed-reactions/manifest.json b/happyview-modules/modules/feed-reactions/manifest.json index c32594bf..779c41d2 100644 --- a/happyview-modules/modules/feed-reactions/manifest.json +++ b/happyview-modules/modules/feed-reactions/manifest.json @@ -67,10 +67,10 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", - "../../lua/shared/listCursor.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/feedReaction.lua" ], @@ -88,10 +88,10 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", - "../../lua/shared/listCursor.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/feedReaction.lua" ], @@ -109,10 +109,10 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", - "../../lua/shared/listCursor.lua", "../../lua/shared/createdAtSort.lua", "../../lua/shared/feedReaction.lua" ], @@ -130,10 +130,10 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/actorView.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..35c2826c 100644 --- a/happyview-modules/modules/funding/manifest.json +++ b/happyview-modules/modules/funding/manifest.json @@ -54,8 +54,8 @@ "../../lua/shared/actorView.lua", "../../lua/shared/fundingReceipt.lua", "../../lua/shared/nsidValidation.lua", - "../../lua/shared/listQuery.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 cdf1ab5d..f9253566 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/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 4c5c7ffa..beebbbdf 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/listCursor.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/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 8d1689fa..d6f9b966 100644 --- a/happyview-modules/modules/profile/manifest.json +++ b/happyview-modules/modules/profile/manifest.json @@ -84,8 +84,10 @@ "sharedSourcePaths": [ "../../lua/shared/didValidation.lua", "../../lua/shared/query.lua", + "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", "../../lua/shared/recordView.lua", "../../lua/shared/profile.lua", @@ -107,8 +109,10 @@ "sharedSourcePaths": [ "../../lua/shared/didValidation.lua", "../../lua/shared/query.lua", + "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.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 0fe4ae04..87811fc8 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/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 fa6d52cd..e66b5b97 100644 --- a/happyview-modules/modules/rights/manifest.json +++ b/happyview-modules/modules/rights/manifest.json @@ -16,10 +16,8 @@ "../../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" + "../../lua/shared/actorView.lua" ], "config": { "script_type": "lua", "description": "Look up one rights record" }, "dependsOn": ["org.hypercerts.claim.getRights"] @@ -40,14 +38,12 @@ "../../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", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", - "../../lua/shared/listQuery.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 bba7c3e9..264ec225 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/listCursor.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..7098015a 100644 --- a/happyview-modules/modules/workscope-tags/manifest.json +++ b/happyview-modules/modules/workscope-tags/manifest.json @@ -19,7 +19,7 @@ "../../lua/shared/didValidation.lua", "../../lua/shared/query.lua", "../../lua/shared/recordIdentifier.lua", - "../../lua/shared/workscopeRecordView.lua", + "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", "../../lua/shared/workscopeTag.lua" ], @@ -50,11 +50,11 @@ "../../lua/shared/recordIdentifier.lua", "../../lua/shared/datetimeValidation.lua", "../../lua/shared/listValidation.lua", + "../../lua/shared/listCursor.lua", "../../lua/shared/listQuery.lua", - "../../lua/shared/workscopeRecordView.lua", + "../../lua/shared/recordView.lua", "../../lua/shared/actorView.lua", "../../lua/shared/workscopeTag.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..5b606cfe 100644 --- a/happyview-modules/tests/unit/endpoints/rights-edge-lua.test.js +++ b/happyview-modules/tests/unit/endpoints/rights-edge-lua.test.js @@ -12,17 +12,15 @@ 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( "lua/shared/datetimeValidation.lua", "lua/shared/listValidation.lua", - "lua/shared/listQuery.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 92e00aff..1628aa99 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,14 +87,12 @@ 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/listQuery.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 ba08b923..12c546b6 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/listCursor.lua", "lua/shared/listQuery.lua", "lua/shared/listWhere.lua", "lua/shared/featureValidation.lua", 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..8b79d905 100644 --- a/happyview-modules/tests/unit/list-golden/harness.js +++ b/happyview-modules/tests/unit/list-golden/harness.js @@ -7,8 +7,22 @@ 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) { + 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); 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'"}} diff --git a/happyview-modules/tests/unit/lua/recentFollows.test.lua b/happyview-modules/tests/unit/lua/recentFollows.test.lua index ef70ec81..b725cc15 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/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 57b4f032..d7e89c57 100644 --- a/happyview-modules/tests/unit/tooling/listContributorInformation.test.js +++ b/happyview-modules/tests/unit/tooling/listContributorInformation.test.js @@ -18,8 +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/listQuery.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 7e00f17a..b558511a 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/listCursor.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 4cc0731a..97d9e36f 100644 --- a/happyview-modules/tooling/shared-helpers.registry.json +++ b/happyview-modules/tooling/shared-helpers.registry.json @@ -136,42 +136,18 @@ } ], "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", "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": "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", @@ -203,192 +179,54 @@ "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", "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", "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/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", "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", - "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/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", "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", - "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/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", "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 +239,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", @@ -419,60 +251,12 @@ "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-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", - "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/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", - "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", @@ -491,12 +275,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", @@ -533,18 +311,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", @@ -599,24 +365,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", @@ -689,12 +443,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", @@ -731,12 +479,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", @@ -781,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",