From 086090d4d5c730415ae781a274d076c035d6084a Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 8 Jan 2019 20:56:55 -0400 Subject: Added some service capabilities. --- stdlib/source/lux/world/service/crud.lux | 36 +++++++++++++++++++++++++++ stdlib/source/lux/world/service/inventory.lux | 34 +++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 stdlib/source/lux/world/service/crud.lux create mode 100644 stdlib/source/lux/world/service/inventory.lux (limited to 'stdlib') diff --git a/stdlib/source/lux/world/service/crud.lux b/stdlib/source/lux/world/service/crud.lux new file mode 100644 index 000000000..f27bda2a3 --- /dev/null +++ b/stdlib/source/lux/world/service/crud.lux @@ -0,0 +1,36 @@ +(.module: + [lux #* + [control + [identity (#+ ID)] + [security + [capability (#+ Capability)]]] + [data + ["." error (#+ Error)]] + [time + ["." instant (#+ Instant)]]]) + +(type: #export Time + {#created Instant + #updated Instant}) + +(type: #export (Can-Create ! code entity storage) + (Capability [Instant entity] + (! (Error (ID code entity storage))))) + +(type: #export (Can-Retrieve ! code entity storage) + (Capability (ID code entity storage) + (! (Error [Time entity])))) + +(type: #export (Can-Update ! code entity storage) + (Capability [(ID code entity storage) Instant entity] + (! (Error Any)))) + +(type: #export (Can-Delete ! code entity storage) + (Capability (ID code entity storage) + (! (Error Any)))) + +(type: #export (CRUD ! code entity storage) + [(Can-Create ! code entity storage) + (Can-Retrieve ! code entity storage) + (Can-Update ! code entity storage) + (Can-Delete ! code entity storage)]) diff --git a/stdlib/source/lux/world/service/inventory.lux b/stdlib/source/lux/world/service/inventory.lux new file mode 100644 index 000000000..00b20e71a --- /dev/null +++ b/stdlib/source/lux/world/service/inventory.lux @@ -0,0 +1,34 @@ +(.module: + [lux #* + [control + [identity (#+ ID)] + [security + [capability (#+ Capability)]]] + [data + [error (#+ Error)]]]) + +(with-expansions [ (as-is ! $ @ owner property) + (as-is (ID @ owner $)) + (as-is (ID @ property $))] + (type: #export (Can-Own ) + (Capability [ ] + (! (Error Any)))) + + (type: #export (Can-Disown ) + (Capability [ ] + (! (Error Any)))) + + (type: #export (Can-Check ) + (Capability [ ] + (! (Error Bit)))) + + (type: #export (Can-List ) + (Capability + (! (Error (List ))))) + + (type: #export (Inventory ) + [(Can-Own ) + (Can-Disown ) + (Can-Check ) + (Can-List )]) + ) -- cgit v1.2.3