Kim Alvefur
2ef0e122fd
util.xtemplate: Use same argument order in filters even without 'args'
...
This removes the different argument order used between '{x|foo}' and
'{x|foo(y)}' because the differing order was awkward and confusing.
This util does not seem to be widely used so should not be problematic
to change this part. The only known use is in mod_pubsub, which does not
use the filter function feature.
1 year ago
Kim Alvefur
bb278430cf
util.xtemplate: Fix error on applying each() to zero stanzas
...
Backport of 1f93e4f78c53
2 years ago
Kim Alvefur
8a96854733
util.xtemplate: Fix error on applying each() to zero stanzas
2 years ago
Kim Alvefur
01a44e88db
mod_cron: Fix log format to account for float that was integer before
2 years ago
Kim Alvefur
cef925e9a5
mod_cron: Sync Teal source with 92301fa7a673
...
Yeah, it's weird to have two versions. Needing more build dependencies
is also something we want to avoid, so here we are.
2 years ago
Kim Alvefur
a2b268528d
util.strbitop: Add common_prefix_bits() to Teal interface description
2 years ago
Kim Alvefur
bb081f052f
util.hashes: Add missing entries to Teal interface description
...
Also sorted to match C source
2 years ago
Kim Alvefur
c333519fb2
util.crypto: Update Teal interface description to match C sources
...
Was missing some entries.
Rearranged to match order of entries in the C source Reg table.
2 years ago
Kim Alvefur
89359b70dc
util.datamapper: Improve handling of schemas with non-obvious "type"
...
The JSON Schema specification says that schemas are objects or booleans,
and that the 'type' property is optional and can be an array.
This module previously allowed bare type names as schemas and did not
really handle booleans.
It now handles missing 'type' properties and boolean 'true' as a schema.
Objects and arrays are guessed based on the presence of 'properties' or
'items' field.
4 years ago
Kim Alvefur
e700edc50f
util.jsonschema: Fix validation to not assume presence of "type" field
...
MattJ reported a curious issue where validation did not work as
expected. Primarily that the "type" field was expected to be mandatory,
and thus leaving it out would result in no checks being performed.
This was likely caused by misreading during initial development.
Spent some time testing against
https://github.com/json-schema-org/JSON-Schema-Test-Suite.git and
discovered a multitude of issues, far too many to bother splitting into
separate commits.
More than half of them fail. Many because of features not implemented,
which have been marked NYI. For example, some require deep comparisons
e.g. when objects or arrays are present in enums fields.
Some because of quirks with how Lua differs from JavaScript, e.g. no
distinct array or object types. Tests involving fractional floating
point numbers. We're definitely not going to follow references to remote
resources. Or deal with UTF-16 sillyness. One test asserted that 1.0 is
an integer, where Lua 5.3+ will disagree.
4 years ago
Kim Alvefur
d05af9f2b5
util.jsonpointer: Fix off-by-one in array resolution
...
Fixes #1753
Not known to be used anywhere
4 years ago
Kim Alvefur
38c67064b3
mod_cron: Fix recording last task run time #1751
...
The type checks, they do nothing!
Observed: Tasks that were supposed to run weekly or daily were running
each hour.
4 years ago
Kim Alvefur
43351d2b54
Spelling: Fix various spelling mistakes (thanks timeless)
...
Words, sometimes I wonder how they even work
Maybe I missed something.
4 years ago
Kim Alvefur
af95bb77e6
util.poll: Add support for the poll() API
...
Might be better than select(), more portable than epoll.
4 years ago
Kim Alvefur
04aa101da3
util.poll: Expose API (epoll or select) used
...
Could he handy to know for debugging or decisions
4 years ago
Kim Alvefur
c61c78447b
util.xtemplate: Adopt {-path-} syntax to strip preceding and/or trailing whitespace
...
Seen in some other template languages
2 years ago
Kim Alvefur
e03fe2ebe3
util.jsonschema: Return basic structured validation response
2 years ago
Matthew Wild
56d45091bd
mod_cron: Update Teal source and rebuild
2 years ago
Kim Alvefur
43d1285dbd
moduleapi: Update Teal spec
...
Updates for 65fb0d7a2312::59c3d775c7fa
2 years ago
Kim Alvefur
7b882e4405
mod_cron: Make task frequencies configurable in overly generic manner
...
Requested feature for many modules, notably MAM and file sharing.
2 years ago
Kim Alvefur
76bf26057e
mod_cron: Fix missing restore method in Teal record definition
2 years ago
Kim Alvefur
da4111b997
mod_cron: Remove unused import [luacheck]
...
Use of datetime was removed in 6ac5ad578565
2 years ago
Kim Alvefur
9f21d5487c
mod_cron: Load last task run time inside task runner to fix async
...
This ensures that all interactions with storage happen inside an async
thread, allowing async waiting to be performed in storage drivers.
2 years ago
Kim Alvefur
3a071d87b8
mod_cron: Revert bbd3ac65640d
...
Maybe it is better to run daily and weekly tasks 'now' on the theory
that people set these things up during times that are appropriate for
maintenance already, so the same time next day or next week might be
fine for periodic cleanup.
2 years ago
Kim Alvefur
048b064fcd
util.pposix: Add remove_blocks() for deleting parts of files
...
Allows implementing e.g. a FIFO
Will probably only work on some Linux file systems like ext4.
3 years ago
Kim Alvefur
8ba5e50cc2
util.serialization: Teach Teal about the new "pretty" preset
3 years ago
Kim Alvefur
e9a9633aec
util.jsonpointer: Change function prototype to allow anything
...
But anything that's not a table can't be resolved into, which could
happen in the middle, so eh.
3 years ago
Kim Alvefur
70e4b13d0e
util.jsonpointer: Silence Teal warning
...
It seems to think 'table' never has array items, but we don't know that.
3 years ago
Kim Alvefur
597f3c7f0a
util.jsonschema: Remove wrapper function
...
This was to silence some Teal warning that seems to have gone away.
3 years ago
Kim Alvefur
f0242ae57c
util.jsonschema: Silence Teal warnings about utf8 library
...
Teal worries that we redefine the global.
Also that the fallback was missing type information.
3 years ago
Kim Alvefur
c8b5d7e99a
util.jsonschema: Silence Teal warnings about counting items in tables
...
Teal thinks that these are key-value maps which are always of length
zero, but that is not the case.
3 years ago
Kim Alvefur
3320521129
teal: Describe http_url method
...
It is not part of the "real" module API, but used in various places.
Extending the API seems hard to describe in a type-safe way.
3 years ago
Kim Alvefur
693ac009db
util.jsonschema: Fix UTF-8ness of 'minLength' and 'maxLength'
3 years ago
Kim Alvefur
3621b8ce91
util.jsonschema: Implement 'minContains' and 'maxContains'
3 years ago
Kim Alvefur
d78a32f136
util.jsonschema: Add some comments wrt Lua-specifics
3 years ago
Kim Alvefur
9c7c94ab73
util.jsonschema: Implement 'luaPattern' - Lua variant of 'pattern'
...
Like 'pattern' but uses Lua patterns instead of Regular Expressions,
since only a subset of regex are also valid Lua patterns.
3 years ago
Kim Alvefur
1dad83d28e
util.jsonschema: Implement 'luaPatternProperties' as Lua variant of 'patternProperties'
...
Previous version of this patch used 'patternProperties' but that would
only work with simpler ECMA-262 regular expressions are also valid Lua
patterns.
3 years ago
Kim Alvefur
0e6043ecb6
util.jsonschema: Fix NYI 'patternProperties' definition
...
It's defined as an object mapping regex to schema, not a single schema
3 years ago
Kim Alvefur
aa0d6f297d
util.set: Add missing remove function in Teal spec
3 years ago
Kim Alvefur
10431cfec6
net.http: Rename enum in Teal spec to avoid name clash
3 years ago
Kim Alvefur
9305f47525
teal-src/README: Words on Compiling to Lua
3 years ago
Kim Alvefur
4a78b88efd
teal-src/README: Tweak markdown syntax
3 years ago
Kim Alvefur
0d2a9ef54a
teal-src: Add a README with a few pointers to get started
3 years ago
Matthew Wild
5a831462c3
teal-src: Add keyval+ store type
3 years ago
Kim Alvefur
50058a1e46
util.jsonschema: Reorder type definition by specification, section
...
Also some comment headers and missing properties
3 years ago
Kim Alvefur
8c9ffa25eb
util.jsonschema: Implement 'dependentSchemas'
...
If this object key exists then this schema must validate against the
current object. Seems useful.
3 years ago
Kim Alvefur
4bc62438db
util.jsonschema: Implement 'dependentRequired'
...
If this field exists, then these fields must also exist.
3 years ago
Kim Alvefur
f68336b96e
teal: Move into prosody namespace
3 years ago
Kim Alvefur
adb37b8272
util.ip: Add Teal interface description
3 years ago
Kim Alvefur
b64d6afeab
util.jwt: Import definition of key from util.crypto
...
Turns out we had a definition of that already
3 years ago