File-Exchange on MacOS has limited the access towards files for services. This means for MacOS packages the File-Exchange does not have access to the following folders and it's subfolders:
Documents
Downloads
Pictures
Movies
Music
Folders such as the following still have access:
Applications
User's Home folder (self created folders) with exclusion of the first list
The reason of this restriction from Apple can be found in there release notes here under the section Launch Daemons and Agents
Sample code uses ES6 language features such as arrow functions and promises. For compatibility with IE11, code written with these features must be either transpiled using tools like Babel or refactored accordingly using callbacks.
Introduction
The File Exchange container allows Trust1Connector to upload or download files from the filesystem to the requesting party.
The File Exchange container provides the following functionalities:
selecting a folder based on application type
listing files in selected application type
downloading one or more files into selected application type
uploading one or more files from the selected application type
An application type resolves locally to an absolute file system path.
An application can create additional folders for a given application type, those folders are relative to the absolute path which has been locally mapped on the application type.
The File Exchange container provides additionally:
optional user notification for file transfer completion
copy and move files between application types
The File-exchange payload limit is set to 50 MB. If your needs exceed this please contact support
The File Exchange container allows the application to choose whether to notify the users in the application context, or to delegate notification to the T1C. The T1C uses the underlying operating system to notify users
Context and scope
The context of a type mapping is defined by the following concepts:
applicationid (property of Type class): a string value denoting the application identifier. This is the root context for entity mapping. The application id is dervied from the Origin domain.
entity: a string value denoting the root entity for types mapping
type: a string value denoting a file typing, related to the absolute path mapped by an user, this value abstracts absolute paths from an application perspective
The following image depicts the file exchange object model:
Type Mapping
A 'Type' in the context of the File Exchange container, is a label, used by an application, to abstract the absolute path reference of the local file system. A 'Type' allows the application to perform file transfers, without the notion of the local file system organization. The File Exchange container maps the absolute path, chose by a user, on the application scoped label. We call this action a 'type mapping', this is, an absolute path, in the context of an application, is references by a label.
Type subfolders
Subfolders can be managed by the application. All subfolder are relative paths and when requested can be created, optionally recursively, by the File Exchange API. It's important to understand:
Type mapping : correlates to absolute paths on a local file system
Type subfolders: correlates to relative paths on a local file system
The File Exchange container maintains the mapping for absolute paths. Relative paths will be created when used in the specified use case. Neither absolute paths or relative paths will result in deletion on the local file system! When deleting a 'type' (aka absolute path), the type will be removed from the File Exchange container, but the references directory will still exist on the user's file system.
In the File Exchange API, the parameter relpath refers to an array of strings denoting a directory path.
Responses
The File Exchange API can be integrated using Promises or callbacks. Both are returning the same result.