magic.lambda.slots
10.0.5
See the version list below for details.
dotnet add package magic.lambda.slots --version 10.0.5
NuGet\Install-Package magic.lambda.slots -Version 10.0.5
<PackageReference Include="magic.lambda.slots" Version="10.0.5" />
paket add magic.lambda.slots --version 10.0.5
#r "nuget: magic.lambda.slots, 10.0.5"
// Install magic.lambda.slots as a Cake Addin #addin nuget:?package=magic.lambda.slots&version=10.0.5 // Install magic.lambda.slots as a Cake Tool #tool nuget:?package=magic.lambda.slots&version=10.0.5
Magic Lambda Slots
This project provides the ability to create, modify, inspect, and delete dynamic slots for Magic. More specifically, this project provides the following slots.
- [signal] - Invokes a dynamically create slot that has been created with the [slots.create] slot
- [slots.create] - Creates a dynamic slot, that can be invoked with the [signal] slot
- [slots.get] - Returns the entire lambda object for a slot that has been previously created with the [slots.create] slot
- [slots.delete] - Deletes a slot that has been previously created with the [slots.create] slot
- [slots.exists] - Returns true of the given slot exists
- [return-nodes] - Returns a bunch of nodes to caller from inside of your slot
- [return-value] - Returns a single value to caller from inside of your slot
- [return] - Returns either a list of nodes, or a single value, or both, depending upon the results of its expression, or whether or not it has a static value, or a list of nodes
- [slots.vocabulary] - Returns the names of all dynamically created slots
/*
* First we create a dynamic slot.
*/
slots.create:foo
return-value:int:57
/*
* Then we invoke it.
*/
signal:foo
After evaluation of the above Hyperlambda, the value of the [signal] node will be 57. Notice, if you invoke [slots.create] for a slot that has already been created, the old slot will be overwritten with the new lambda object you pass into it. Also notice that if you try to invoke a slot that doesn't exist, or you try to get its content, an exception will be thrown.
Also realize that when you create a slot, it is not persisted in any ways - Implying if the web server process is restarted, your slot will disappear. To avoid this, put the creation of your slot inside a file in a folder called "magic.startup" in your module's folder, e.g. "/files/modules/foo-module/magic.startup/create-slot.hl". All files inside of modules that exists within a "magic.startup" folder will be executed every time your web server restarts for some reasons.
[slots.create]
Creates a dynamic slot that can be invoked using [signal]. Below is an example.
slots.create:foo
return-value:int:57
Notice, slots aren't serialised in any ways, implying if your web server restarts its process, your previously created dynamic slot is remove. If you want to make sure your slots becomes a permanent part of your application, you need to make sure you are somehow creating it during server startup, which can normally be done on a per module basis, by putting a Hyperlambda file into your module's "magic.startup" folder, which makes sure the code is executed during startup of your web app.
[signal]
Invokes a previously created dynamic slot. Assuming you have executed the above code snippet, you can invoke the slot using the following Hyperlambda.
signal:foo
After evaluating the above Hyperlambda, the [signal] node will end up having a value of "57".
Notice - This slot obeys by the rules of [whitelist] invocations from magic.lambda, allowing you to declare a list of dynamic slots, which are exclusively allowed to be invoked temporarily inside of an invocation to whitelist, allowing you to restrict some piece of potentially unsafe code to only signal a pre-defined list of dynamically created slots. Below is an example.
slots.create:foo1
return-value:Safe
slots.create:foo2
return-value:Unsafe
whitelist
vocabulary
signal
signal:foo1
.lambda
// Assuming you have a [foo1] slot created, this will work
signal:foo1
// This will throw, since [foo2] is not whitelisted
signal:foo2
Basically, only the slots declared in the above [vocabulary] will be allowed to be invoked inside of the above [.lambda] object. You must have your dynamic slots declared as signal:slot-name, such as the above illustrates. And in order to signal dynamic slots at all, you'll need to (obviously) whitelist [signal] itself, as illustrated in the above code. Read more about [whitelist] in the magic.lambda project.
[slots.get]
Returns the entire lambda code for a previously created dynamic slot. Example can be found below.
slots.create:foo
return-value:int:57
slots.get:foo
[slots.delete]
Deletes a previously created dynamic slot. The following example will throw an exception.
slots.create:foo
return-value:int:57
slots.delete:foo
// Throws exception, since [foo] no longer exists.
slots.get:foo
[return-nodes]
Returns a bunch of nodes (lambda) from your slot. Can only be invoked from the inside of a dynamically created slot. Example below.
slots.create:foo
return-nodes
integer-value:int:57
string-value:Foo bar
slots.invoke:foo
[return-value]
Returns a single value from your slot. Can only be invoked from the inside of a dynamically created slot. Example below.
slots.create:foo
return-value:This becomes the returned value from your slot
slots.invoke:foo
[slots.exists]
Returns true if the specified slot exists. Example can be found below.
slots.create:foo
return-value:Blah, blah, blah ...
slots.exists:foo
slots.exists:DOES-NOT-EXISTS
[slots.vocabulary]
Returns the names of all dynamically created slots to caller. Example can be found below.
slots.vocabulary
Project website
The source code for this repository can be found at github.com/polterguy/magic.lambda.slots, and you can provide feedback, provide bug reports, etc at the same place.
Quality gates
License
This project is the copyright(c) 2020-2021 of Aista, Ltd thomas@servergardens.com, and is licensed under the terms of the LGPL version 3, as published by the Free Software Foundation. See the enclosed LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- magic.node.extensions (>= 10.0.5)
- magic.signals.contracts (>= 10.0.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on magic.lambda.slots:
Package | Downloads |
---|---|
magic.library
Helper project for Magic to wire up everything easily by simply adding one package, and invoking two simple methods. When using Magic, this is (probably) the only package you should actually add, since this package pulls in everything else you'll need automatically, and wires up everything sanely by default. To use package go to https://polterguy.github.io |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
17.2.1 | 430 | 1/22/2024 |
17.2.0 | 135 | 1/22/2024 |
17.1.7 | 198 | 1/12/2024 |
17.1.6 | 159 | 1/11/2024 |
17.1.5 | 178 | 1/5/2024 |
17.0.1 | 226 | 1/1/2024 |
17.0.0 | 368 | 12/14/2023 |
16.11.5 | 378 | 11/12/2023 |
16.9.0 | 376 | 10/9/2023 |
16.7.0 | 611 | 7/11/2023 |
16.4.1 | 416 | 7/2/2023 |
16.4.0 | 404 | 6/22/2023 |
16.3.1 | 373 | 6/7/2023 |
16.3.0 | 355 | 5/28/2023 |
16.1.9 | 685 | 4/30/2023 |
15.10.11 | 509 | 4/13/2023 |
15.9.1 | 620 | 3/27/2023 |
15.9.0 | 501 | 3/24/2023 |
15.8.2 | 572 | 3/20/2023 |
15.7.0 | 433 | 3/6/2023 |
15.5.0 | 1,663 | 1/28/2023 |
15.2.0 | 747 | 1/18/2023 |
15.1.0 | 1,193 | 12/28/2022 |
14.5.7 | 758 | 12/13/2022 |
14.5.5 | 841 | 12/6/2022 |
14.5.1 | 701 | 11/23/2022 |
14.5.0 | 642 | 11/18/2022 |
14.4.5 | 741 | 10/22/2022 |
14.4.1 | 766 | 10/22/2022 |
14.4.0 | 678 | 10/17/2022 |
14.3.1 | 1,284 | 9/12/2022 |
14.3.0 | 672 | 9/10/2022 |
14.1.3 | 957 | 8/7/2022 |
14.1.2 | 677 | 8/7/2022 |
14.1.1 | 707 | 8/7/2022 |
14.0.14 | 731 | 7/26/2022 |
14.0.12 | 708 | 7/24/2022 |
14.0.11 | 650 | 7/23/2022 |
14.0.10 | 666 | 7/23/2022 |
14.0.9 | 705 | 7/23/2022 |
14.0.8 | 754 | 7/17/2022 |
14.0.5 | 813 | 7/11/2022 |
14.0.4 | 818 | 7/6/2022 |
14.0.3 | 750 | 7/2/2022 |
14.0.2 | 676 | 7/2/2022 |
14.0.1 | 716 | 7/2/2022 |
14.0.0 | 694 | 6/25/2022 |
13.4.0 | 2,075 | 5/31/2022 |
13.3.4 | 1,461 | 5/9/2022 |
13.3.0 | 952 | 5/1/2022 |
13.2.0 | 1,175 | 4/21/2022 |
13.1.0 | 1,053 | 4/7/2022 |
13.0.0 | 749 | 4/5/2022 |
11.0.7 | 1,161 | 3/10/2022 |
11.0.5 | 844 | 3/2/2022 |
11.0.4 | 775 | 2/22/2022 |
11.0.3 | 823 | 2/9/2022 |
11.0.2 | 796 | 2/6/2022 |
11.0.1 | 811 | 2/5/2022 |
10.0.21 | 787 | 1/28/2022 |
10.0.20 | 763 | 1/27/2022 |
10.0.19 | 786 | 1/23/2022 |
10.0.18 | 748 | 1/17/2022 |
10.0.15 | 1,011 | 12/31/2021 |
10.0.14 | 624 | 12/28/2021 |
10.0.8 | 1,265 | 12/22/2021 |
10.0.7 | 623 | 12/22/2021 |
10.0.5 | 769 | 12/18/2021 |
9.9.9 | 1,684 | 11/29/2021 |
9.9.3 | 955 | 11/9/2021 |
9.9.2 | 652 | 11/4/2021 |
9.9.0 | 828 | 10/30/2021 |
9.8.9 | 725 | 10/29/2021 |
9.8.7 | 675 | 10/27/2021 |
9.8.6 | 671 | 10/27/2021 |
9.8.5 | 695 | 10/26/2021 |
9.8.0 | 1,391 | 10/20/2021 |
9.7.9 | 629 | 10/19/2021 |
9.7.5 | 1,521 | 10/14/2021 |
9.7.0 | 866 | 10/9/2021 |
9.6.6 | 1,267 | 8/14/2021 |
9.2.0 | 6,325 | 5/26/2021 |
9.1.4 | 1,326 | 4/21/2021 |
9.1.0 | 1,051 | 4/14/2021 |
9.0.0 | 934 | 4/5/2021 |
8.9.9 | 1,054 | 3/30/2021 |
8.9.3 | 1,588 | 3/19/2021 |
8.9.2 | 1,088 | 1/29/2021 |
8.9.1 | 1,036 | 1/24/2021 |
8.9.0 | 1,140 | 1/22/2021 |
8.6.9 | 3,116 | 11/8/2020 |
8.6.6 | 2,011 | 11/2/2020 |
8.6.0 | 4,058 | 10/28/2020 |
8.5.0 | 1,932 | 10/23/2020 |
8.4.2 | 3,529 | 10/16/2020 |
8.4.1 | 1,244 | 10/16/2020 |
8.4.0 | 2,040 | 10/13/2020 |
8.3.1 | 2,701 | 10/5/2020 |
8.3.0 | 1,290 | 10/3/2020 |
8.2.2 | 2,060 | 9/26/2020 |
8.2.1 | 1,357 | 9/25/2020 |
8.2.0 | 1,416 | 9/25/2020 |
8.1.17 | 6,850 | 9/13/2020 |
8.1.16 | 577 | 9/13/2020 |
8.1.15 | 1,268 | 9/12/2020 |
8.1.11 | 3,218 | 9/11/2020 |
8.1.10 | 705 | 9/6/2020 |
8.1.9 | 2,025 | 9/3/2020 |
8.1.8 | 1,332 | 9/2/2020 |
8.1.7 | 1,243 | 8/28/2020 |
8.1.4 | 1,234 | 8/25/2020 |
8.1.3 | 1,327 | 8/18/2020 |
8.1.2 | 1,233 | 8/16/2020 |
8.1.1 | 1,282 | 8/15/2020 |
8.1.0 | 602 | 8/15/2020 |
8.0.1 | 2,765 | 8/7/2020 |
8.0.0 | 1,264 | 8/7/2020 |
7.0.1 | 1,333 | 6/28/2020 |
7.0.0 | 1,359 | 6/28/2020 |
5.0.1 | 2,137 | 5/30/2020 |
5.0.0 | 6,129 | 2/25/2020 |
4.0.4 | 8,004 | 1/27/2020 |
4.0.3 | 1,244 | 1/27/2020 |
4.0.2 | 1,380 | 1/16/2020 |
4.0.1 | 1,417 | 1/11/2020 |
4.0.0 | 1,392 | 1/5/2020 |
3.1.1 | 4,252 | 12/4/2019 |
3.1.0 | 2,829 | 11/10/2019 |
3.0.0 | 3,924 | 10/23/2019 |
2.0.3 | 4,454 | 10/18/2019 |
2.0.2 | 1,856 | 10/18/2019 |
2.0.1 | 3,446 | 10/15/2019 |
2.0.0 | 1,670 | 10/13/2019 |
1.1.9 | 1,407 | 10/11/2019 |
1.1.8 | 1,339 | 10/10/2019 |
1.1.7 | 635 | 10/9/2019 |
1.1.6 | 626 | 10/7/2019 |
1.1.5 | 633 | 10/6/2019 |
1.1.4 | 588 | 10/6/2019 |
1.1.2 | 623 | 10/5/2019 |