PipeScript icon indicating copy to clipboard operation
PipeScript copied to clipboard

`PSModuleInfo` .Service(s)

Open StartAutomating opened this issue 1 year ago • 0 comments

A module should be able to define any number of services within it's .PrivateData or .PrivateData.PSData.

In the majority of circumstances, services in a Module would be web services (though technically the description should be protocol agnostic)

A service will be described in a fairly shallow property bag.

Here are three examples of three different types/formats:

@{
    PrivateData = @{
         Services = @{
            Name = 'Markdown Service'
            Command = 'ConvertFrom-Markdown'
        }, @{
            Name = 'Math Service'
            Type = 'Math'
        }, @{
            Name = 'Pid Service'
            Variable = 'pid' 
        }
    }
}

Again, this does not infer a particular protocol, just what will be exposed as a service.

If a module exposed those services, the following would be expected to happen:

  • /ConvertFrom-Markdown/, /ConvertFrom/Markdown and /Markdown/ConvertFrom should map to ConvertFrom-Markdown.
  • If no parameters are passed, and there is nothing to run then ConvertFrom-Markdown should prompt for input.
  • /Math/,/System.Math/,/[Math]/, /[System.Math]/ would expose the static methods and properties of [System.Math]
  • If no member was passed, the reflected type should be displayed
  • If a member was passed, but no arguments, the method should be displayed
  • If a member and arguments were passed, the method should be invoked (if allowed)
  • /Pid/ and /$Pid/ will expose $Pid
  • Method chains and property chains should be available, if allowed. 

To simplify the implementation of services, we will need a few additional pseudotypes.

  • [ ] #1011
  • [ ] #1012

We will also want to define a new command type:

  • [ ] #1013

The following commands will make this possible:

  • [ ] #1034
  • [ ] #1035
  • [ ] #1036
  • [ ] #1037
  • [ ] #1056
  • [ ] #1107

StartAutomating avatar Mar 09 '24 23:03 StartAutomating