new IntentHandlerProviderByDirectory(directory, options)
Provides intents by loading all of the files in a directory as intents
Intents are loaded asynchronously but if an intent is requested before being loaded
it will be immediately loaded and then skipped by the asychronous processing.
If the intent being loaded does not implement IntentHandler~getIntentList then the filename
will be treated as the name of the intent and registered as such.
Parameters:
Name |
Type |
Description |
directory |
String
|
The directory to read all intents from |
options |
Object
|
Options for the was the directory is process
Properties
Name |
Type |
Attributes |
Default |
Description |
filenameFormatter |
FileNameFormatter
|
<optional>
|
DefaultJSONFilenameFormatter
|
The FilenameFormmatter to use to parse the
filenames to determine name as well as how to format the id to become a filename. This object will only
load files that match the formatters isValid() method |
|
- Implements:
- Source:
- See:
-
Methods
processItem(items, itemId, fileName, options)
Parameters:
Name |
Type |
Description |
items |
Map
|
Map of the items being processed |
itemId |
String
|
The Id of the item to process |
fileName |
String
|
The name of the file being processed |
options |
Object
|
Any options that are being passed to the ItemProcessor (can be null) |
- Implements:
- Source:
processItems(items, fileName, options)
Uses node require to load the file. If the intent is not found this method
will favor performance and never look for the file again.
Parameters:
Name |
Type |
Description |
items |
Map
|
Map of the items being processed |
fileName |
String
|
The name of the file being processed |
options |
Object
|
Any options that are being passed to the ItemProcessor (can be null) |
- Implements:
- Source: