diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..36bd853
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1 @@
+github: [StartAutomating]
diff --git a/.github/workflows/TestAndPublish.yml b/.github/workflows/TestAndPublish.yml
index 1923a77..6c437d8 100644
--- a/.github/workflows/TestAndPublish.yml
+++ b/.github/workflows/TestAndPublish.yml
@@ -576,6 +576,9 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v2
+ - name: GitLogger
+ uses: GitLogging/GitLoggerAction@main
+ id: GitLogger
- name: Use PSSVG Action
uses: StartAutomating/PSSVG@main
id: PSSVG
diff --git a/Assets/Eventful.svg b/Assets/Eventful.svg
index 89979d2..677843d 100644
--- a/Assets/Eventful.svg
+++ b/Assets/Eventful.svg
@@ -1,11 +1,11 @@
-
+
\ No newline at end of file
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index df2e766..e84b81a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,29 +1,42 @@
-## 0.1.7
+## Eventful 0.1.8:
+
+* Eventful Supports Sponsorship (#25)
+* New Commands!
+ * Import-Event (#28)
+ * Export-Event (#27)
+* Send-Event can now send -EventArguments and -MessageData (#26)
+* Watch-Event now supports -MaxTriggerCount and -MessageData (#29)
+* Simplifying event source registration (any `@*` script or function) (#30)
+* Making one-time event sources more efficient (#31)
+
+---
+
+## Eventful 0.1.7:
* Adding On@CommandNotFound event source (Fixes #11)
* Watch-Event now allows eventsources -recursively (Fixes #15)
---
-## 0.1.6
+## Eventful 0.1.6
* Adding LocationChanged event source (Fixes #12)
---
-## 0.1.5
+## Eventful 0.1.5
* Adding On@Event (#2)
* Send-Event support for piping existing events (#4)
* Adding /docs (#5)
---
-## 0.1.4
+## Eventful 0.1.4
* Module Rebranded to Eventful.
* Get-EventHandler added
---
-## 0.1.3
+## Eventful 0.1.3
New Event Source:
* VariableSet
@@ -34,7 +47,7 @@ Bugfix: On@Repeat now actually starts it's timer.
---
-## 0.1.2
+## Eventful 0.1.2
New Event Source:
* UDP
@@ -42,7 +55,7 @@ PowerShellAsync Event Source now allows for a -Parameter dictionaries.
---
-## 0.1.1
+## Eventful 0.1.1
New Event Sources:
* HTTPResponse
* PowerShellAsync
@@ -54,11 +67,13 @@ New Event Source Capabilities:
Event Sources can now return an InitializeEvent property or provide a ComponentModel.InitializationEvent attribute.
This will be called directly after the subscription is created, so as to avoid signalling too soon.
-## 0.1
+---
+
+## Eventful 0.1
+
Initial Module Release.
Fun simple event syntax (e.g. on mysignal {"do this"} or on delay "00:00:01" {"do that"})
Better pipelining support for Sending events.
----
-'@
\ No newline at end of file
+---
\ No newline at end of file
diff --git a/@Delay.ps1 b/EventSources/@Delay.ps1
similarity index 72%
rename from @Delay.ps1
rename to EventSources/@Delay.ps1
index 9993835..7e21aac 100644
--- a/@Delay.ps1
+++ b/EventSources/@Delay.ps1
@@ -16,7 +16,9 @@ $Wait
)
process {
- $timer = New-Object Timers.Timer -Property @{Interval=$Wait.TotalMilliseconds;AutoReset=$false}
+ $timer = New-Object Timers.Timer -Property @{Interval=$Wait.TotalMilliseconds;AutoReset=$false}
+ $timer |
+ Add-Member NoteProperty EventName Elapsed -PassThru |
+ Add-Member NoteProperty MaxTriggerCount 1 -PassThru
$timer.Start()
- $timer | Add-Member NoteProperty EventName Elapsed -PassThru
}
\ No newline at end of file
diff --git a/@FileChange.ps1 b/EventSources/@FileChange.ps1
similarity index 100%
rename from @FileChange.ps1
rename to EventSources/@FileChange.ps1
diff --git a/EventSources/@HttpResponse.ps1 b/EventSources/@HttpResponse.ps1
index f0c09e6..0b86e0b 100644
--- a/EventSources/@HttpResponse.ps1
+++ b/EventSources/@HttpResponse.ps1
@@ -58,7 +58,7 @@ $TransferEncoding = $([Text.Encoding]::UTF8)
process {
# Clear the event subscriber if one exists.
- $eventSubscriber = Get-EventSubscriber -SourceIdentifier "@HttpResponse_Check" -ErrorAction SilentlyContinue
+ $eventSubscriber = Get-EventSubscriber -SourceIdentifier "@HttpResponse_Check" -ErrorAction Ignore
if ($eventSubscriber) {$eventSubscriber | Unregister-Event}
# Create a new subscriber for the request.
@@ -66,6 +66,7 @@ process {
Interval = $PollingInterval.TotalMilliseconds # Every pollinginterval,
AutoReset = $true
}
+
$HttpResponseChecker =
Register-ObjectEvent -InputObject $httpResponseCheckTimer -EventName Elapsed -Action {
$toCallEnd = # check to see if any requests have completed.
diff --git a/EventSources/@PowerShellAsync.ps1 b/EventSources/@PowerShellAsync.ps1
index 8fb26b5..2ac3691 100644
--- a/EventSources/@PowerShellAsync.ps1
+++ b/EventSources/@PowerShellAsync.ps1
@@ -83,7 +83,8 @@ process {
$psAsync |
Add-Member NoteProperty SourceIdentifier @(
"PowerShell.Async.$($psAsync.InstanceID)","PowerShell.Async.Failed.$($psAsync.InstanceID)"
- ) -Force -PassThru
+ ) -Force -PassThru |
+ Add-Member MaxTriggerCount 1 -Force -PassThru
return
}
\ No newline at end of file
diff --git a/EventSources/@Process.ps1 b/EventSources/@Process.ps1
index aaa4386..87d3f2e 100644
--- a/EventSources/@Process.ps1
+++ b/EventSources/@Process.ps1
@@ -1,4 +1,4 @@
-<#
+<#
.Synopsis
Watches a process.
.Description
@@ -48,7 +48,7 @@ process {
Add-Member EventName $eventNames -Force -PassThru
} else {
Get-Process -Id $ProcessID |
- Add-Member EventName "Exited" -Force -PassThru
+ Add-Member EventName "Exited" -Force -PassThru |
+ Add-Member MaxTriggerCount 1 -Force -PassThru
}
-
}
\ No newline at end of file
diff --git a/@Repeat.ps1 b/EventSources/@Repeat.ps1
similarity index 100%
rename from @Repeat.ps1
rename to EventSources/@Repeat.ps1
diff --git a/@Time.ps1 b/EventSources/@Time.ps1
similarity index 82%
rename from @Time.ps1
rename to EventSources/@Time.ps1
index 75ee72a..871a4f9 100644
--- a/@Time.ps1
+++ b/EventSources/@Time.ps1
@@ -8,6 +8,7 @@
#>
[Diagnostics.Tracing.EventSource(Name='Elapsed')]
param(
+# The specific date and time the event will be triggered.
[Parameter(Mandatory,Position=0,ParameterSetName='SpecificTime')]
[DateTime]
$DateTime
@@ -24,5 +25,6 @@ process {
if (-not $timer) { return }
$timer.Start()
- return $timer
+ $timer |
+ Add-Member NoteProperty MaxTriggerCount 1 -PassThru
}
diff --git a/EventSources/README.md b/EventSources/README.md
new file mode 100644
index 0000000..5a60725
--- /dev/null
+++ b/EventSources/README.md
@@ -0,0 +1,30 @@
+This directory contains the built-in EventSources in Eventful.
+
+_Technically speaking_, EventSources can exist in any directory, as long as they are named liked `@*.ps1` and match `^@\w`.
+
+Event sources within Eventful or modules that tag Eventful will be automatically included.
+
+Watch-Event will also check the local directory for event sources.
+
+
+|Name |Synopsis |
+|--------------------------------------------------------|----------------------------------------------|
+|[@CommandNotFound](/docs/CommandNotFound-EventSource.md)|Sends events when a command is not found.
|
+|[@Delay](/docs/Delay-EventSource.md) |Send an event after a delay.
|
+|[@Event](/docs/Event-EventSource.md) |Watches for new events.
|
+|[@FileChange](/docs/FileChange-EventSource.md) |Watches for File Changes.
|
+|[@HttpResponse](/docs/HttpResponse-EventSource.md) |Sends events on HTTP Responses.
|
+|[@Job](/docs/Job-EventSource.md) |Watches a PowerShell Job's State.
|
+|[@LocationChanged](/docs/LocationChanged-EventSource.md)|Sends events when the directory changes.
|
+|[@ModuleChanged](/docs/ModuleChanged-EventSource.md) |Watches for Module loads and unloads.
|
+|[@PowerShellAsync](/docs/PowerShellAsync-EventSource.md)|Runs PowerShell asynchronously
|
+|[@Process](/docs/Process-EventSource.md) |Watches a process.
|
+|[@Repeat](/docs/Repeat-EventSource.md) |Send events on repeat.
|
+|[@Time](/docs/Time-EventSource.md) |Sends an event at a specific time.
|
+|[@UDP](/docs/UDP-EventSource.md) |Signals on UDP
|
+|[@VariableSet](/docs/VariableSet-EventSource.md) |Watches for variable sets.
|
+
+
+
+
+
diff --git a/EventSources/README.ps.md b/EventSources/README.ps.md
new file mode 100644
index 0000000..5b3d9ea
--- /dev/null
+++ b/EventSources/README.ps.md
@@ -0,0 +1,21 @@
+This directory contains the built-in EventSources in Eventful.
+
+_Technically speaking_, EventSources can exist in any directory, as long as they are named liked `@*.ps1` and match `^@\w`.
+
+Event sources within Eventful or modules that tag Eventful will be automatically included.
+
+Watch-Event will also check the local directory for event sources.
+
+~~~PipeScript{
+ $imported = Import-Module ../ -Global -PassThru
+
+ [PSCustomObject]@{
+ Table = Get-EventSource |
+ .Name {
+ "[$($_.Name -replace '\.ps1$')](/docs/$($_.Name -replace '^@' -replace '\.ps1$')-EventSource.md)"
+ } .Synopsis
+ }
+}
+~~~
+
+
diff --git a/Eventful.GithubWorkflow.psdevops.ps1 b/Eventful.GithubWorkflow.psdevops.ps1
index c627594..c2a76d3 100644
--- a/Eventful.GithubWorkflow.psdevops.ps1
+++ b/Eventful.GithubWorkflow.psdevops.ps1
@@ -2,9 +2,11 @@
Import-BuildStep -Module Eventful
New-GitHubWorkflow -Name "Analyze, Test, Tag, and Publish" -On Push, PullRequest, Demand -Job PowerShellStaticAnalysis, TestPowerShellOnLinux, TagReleaseAndPublish, BuildEventful -Environment @{
NoCoverage = $true
-}|
- Set-Content .\.github\workflows\TestAndPublish.yml -Encoding UTF8 -PassThru
+} -OutputPath (
+ Join-Path $PSScriptRoot .github\workflows\TestAndPublish.yml
+)
-New-GitHubWorkflow -On Issue, Demand -Job RunGitPub -Name OnIssueChanged |
- Set-Content (Join-Path $PSScriptRoot .github\workflows\OnIssue.yml) -Encoding UTF8 -PassThru
+New-GitHubWorkflow -On Issue, Demand -Job RunGitPub -Name OnIssueChanged -OutputPath (
+ Join-Path $PSScriptRoot .github\workflows\OnIssue.yml
+)
diff --git a/Eventful.PSSVG.ps1 b/Eventful.PSSVG.ps1
index 56df35b..a720c68 100644
--- a/Eventful.PSSVG.ps1
+++ b/Eventful.PSSVG.ps1
@@ -6,7 +6,7 @@ if (-not (Test-Path $assetsPath)) {
$null = New-Item -ItemType Directory -path $assetsPath -Force
}
=