Skip to content

Commit

Permalink
feat(platform): add wildcard support for unregistering capabilities a…
Browse files Browse the repository at this point in the history
…nd intentions

closes #61
  • Loading branch information
danielwiehl committed Apr 12, 2021
1 parent 26bb891 commit 549d636
Show file tree
Hide file tree
Showing 26 changed files with 3,046 additions and 4,288 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ a| `string`
a| `Dictionary`
| no
a|
The qualifier is a dictionary of arbitrary key-value pairs to differentiate capabilities of the same _type_ and is like an abstract description of the capability. It should include enough information for the platform to uniquely resolve the capability.
The qualifier is a dictionary of arbitrary key-value pairs to differentiate capabilities of the same _type_ and is like an abstract description of the capability. It should include enough information to uniquely identify the capability.

The qualifier allows using wildcards (such as `*` or `?`) to match multiple intents simultaneously.
Intents must exactly match the qualifier of the capability, if any. The capability qualifier allows using wildcards (such as `*` or `?`) to match multiple intents simultaneously.

* *Asterisk wildcard character (`{asterisk}`):* +
Is allowed as qualifier property value only and requires intents to contain that property, but with any value allowed (except for `null` or `undefined` values).
Intents must contain such a property, but any value is allowed (except `null` or `undefined`). Use it like this: `{property: '{asterisk}'}`
* *Optional wildcard character (`?`):* +
Is allowed as qualifier property value only and matches intents regardless of having or not having that property.
Intents can contain such a property. Use it like this: `{property: '?'}`.

| requiredParams
a| `string[]`
Expand Down Expand Up @@ -204,14 +204,17 @@ a| `Dictionary`
a|
Qualifies the capability which to interact with.

The qualifier is a dictionary of arbitrary key-value pairs to differentiate capabilities of the same _type_. It can be either exact or contain wildcards to declare multiple intentions simultaneously.
The qualifier is a dictionary of arbitrary key-value pairs to differentiate capabilities of the same _type_.

The intention must exactly match the qualifier of the capability, if any. The intention qualifier allows using wildcards (such as `*` or `?`) to match multiple capabilities simultaneously.

* *Asterisk wildcard character (`{asterisk}`):* +
** If used as qualifier property key, matches capabilities even if having additional properties.
Use it like this: `{'{asterisk}': '{asterisk}'}` +
** If used as qualifier property value, requires capabilities to contain that property, but with any value allowed (except for `null` or `undefined` values).
Matches capabilities with such a qualifier property no matter of its value (except `null` or `undefined`). Use it like this: `{property: '{asterisk}'}`.
* *Optional wildcard character (`?`):* +
Is allowed as qualifier property value only and matches capabilities regardless of having or not having that property.
Matches capabilities regardless of having or not having such a property. Use it like this: `{property: '?'}`.
* *Partial wildcard (`{asterisk}{asterisk}`):* +
Matches capabilities even if having additional properties. Use it like this: `{'{asterisk}': '{asterisk}'}`.

|===

[[chapter:intention-api:intent]]
Expand Down Expand Up @@ -281,14 +284,9 @@ a| `string`
a| `Dictionary`
| no
a|
Observes capabilities matching the qualifier. The qualifier can be either exact or contain wildcards.
Observes capabilities that exactly match the qualifier. The qualifier can be either exact or contain wildcards.

* *Asterisk wildcard character (`{asterisk}`):* +
** If used as qualifier property key, matches capabilities even if having additional properties.
Use it like this: `{'{asterisk}': '{asterisk}'}` +
** If used as qualifier property value, requires capabilities to contain that property, but with any value allowed.
* *Optional wildcard character (`?`):* +
Is allowed as qualifier property value only and matches capabilities regardless of having or not having that property.
You can use the asterisk wildcard (`{property: '{asterisk}'}`) to find all capabilities with a given qualifier property name. Filtering also supports partial matching to find capabilities with at least the specified properties. Partial matching is enabled by appending the any-more entry (`{'{asterisk}': '{asterisk}'}`) to the qualifier.

| appSymbolicName
a| `string`
Expand Down Expand Up @@ -323,14 +321,9 @@ a| `string`
a| `Dictionary`
| no
a|
Observes intentions matching the qualifier. The qualifier can be either exact or contain wildcards.
Observes intentions that exactly match the qualifier. The qualifier can be either exact or contain wildcards.

* *Asterisk wildcard character (`{asterisk}`):* +
** If used as qualifier property key, matches intentions even if having additional properties.
Use it like this: `{'{asterisk}': '{asterisk}'}` +
** If used as qualifier property value, requires intentions to contain that property, but with any value allowed.
* *Optional wildcard character (`?`):* +
Is allowed as qualifier property value only and matches intentions regardless of having or not having that property.
You can use the asterisk wildcard (`{property: '{asterisk}'}`) to find all intentions with a given qualifier property name. Filtering also supports partial matching to find intentions with at least the specified properties. Partial matching is enabled by appending the any-more entry (`{'{asterisk}': '{asterisk}'}`) to the qualifier.

| appSymbolicName
a| `string`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ include::start-platform-via-initializer.snippets.ts[tags=host-app:register-initi
<2> Instructs Angular to pass the `PlatformInitializer` to the higher order function.
<3> Returns the initializer function. When Angular invokes the initializer function, we delegate platform startup to the `PlatformInitializer` service.

IMPORTANT: Angular is very strict when compiling module definitions ahead-of-time (if enabled the AOT compilation). Therefore, you may need to replace the lamdas with the ES5 function syntax. Also, do not forget to export all functions that you reference in the module metadata definition.
IMPORTANT: Angular is very strict when compiling module definitions ahead-of-time (if enabled the AOT compilation). Therefore, you may need to replace the lambdas with the ES5 function syntax. Also, do not forget to export all functions that you reference in the module metadata definition.

Next, we implement the `PlatformInitializer` to start the platform.

Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
"@angular/platform-browser": "11.0.2",
"@angular/platform-browser-dynamic": "11.0.2",
"@angular/router": "11.0.2",
"@scion/toolkit": "11.0.0-beta.8",
"@scion/toolkit.internal": "11.0.0-beta.8",
"@scion/toolkit": "11.0.0-beta.10",
"@scion/toolkit.internal": "11.0.0-beta.10",
"js-sha256": "0.9.0",
"rxjs": "6.6.3",
"tslib": "2.0.3",
Expand Down
Loading

0 comments on commit 549d636

Please sign in to comment.