telos-server 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +60 -10
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -9,15 +9,16 @@ which operates on a declarative file system based CMS.
9
9
 
10
10
  ## 2 - Contents
11
11
 
12
- ### 2.1 - Content
12
+ ### 2.1 - Telos Folder
13
13
 
14
- The Telos Server shall source its content and endpoints from a folder on disk, which by default
15
- shall be called "telos", and shall be stored in the same directory the server process runs from.
14
+ Telos Server shall source its content and endpoints from a Telos folder, stored on disk, which by
15
+ default shall be called "telos", and shall be stored in the same directory the server process runs
16
+ from.
16
17
 
17
18
  File names in the telos folder shall have their names segmented into chunks by periods, with the
18
19
  first chunk specifying the name of the file, the last chunk specifying the extension, and each
19
20
  intermediate chunk specifying a property. If a property chunk contains a hyphen, the part preceding
20
- the hyphen shall specify the name of the property, and the part following the hypen shall specify
21
+ the hyphen shall specify the name of the property, and the part following the hyphen shall specify
21
22
  the value of the property.
22
23
 
23
24
  Folder names may be split the same way, though in folders the final chunk will also be a property
@@ -57,15 +58,41 @@ blank response.
57
58
 
58
59
  If a file has the property "private", it shall be inaccessible from the client.
59
60
 
60
- ##### 2.1.2.3 - Universal Preprocessor
61
+ ##### 2.1.2.3 - Task
62
+
63
+ If a JS file has the property "task", it shall serve as a script in a persistent background
64
+ process. It shall use Common JS to assign as the module exports a single function which, at regular
65
+ intervals, shall be invoked by an event handler responsive to the Telos engine.
66
+
67
+ ##### 2.1.2.4 - Universal Preprocessor
61
68
 
62
69
  If a file has the property "pup", it will be processed by the
63
70
  [Universal Preprocessor](https://github.com/Telos-Project/Universal-Preprocessor) before being
64
71
  fetched.
65
72
 
66
- ### 2.2 - Usage
73
+ ### 2.2 - Telos Engine
74
+
75
+ The Telos engine is a background process embedded in an associated bus module, which is integrated
76
+ into, but may be used independently of, Telos Server.
77
+
78
+ The Telos engine, at regular intervals, calls the bus net of Telos Origin with the following
79
+ object:
80
+
81
+ { tags: ["telos-engine"] }
82
+
83
+ The Telos engine also stores a reference to the initialization call object of Telos Origin, which
84
+ shall be returned from the Telos engine bus module query function if the following object is passed
85
+ to it:
86
+
87
+ { tags: ["telos-configuration"] }
67
88
 
68
- #### 2.2.1 - Setup
89
+ The default interval for the Telos engine is 60 times per second. This may be altered using a
90
+ number assigned to the content.options.options.engineInterval field in the initialization call
91
+ object of Telos Origin specifying how long in seconds to wait between each interval.
92
+
93
+ ### 2.3 - Usage
94
+
95
+ #### 2.3.1 - Setup
69
96
 
70
97
  First, create a folder for your project. Within this folder, create your "telos" folder, and
71
98
  populate it with the content you intend to serve.
@@ -83,7 +110,30 @@ the following command before uploading your project:
83
110
 
84
111
  npx telos-origin -m wrap
85
112
 
86
- #### 2.2.2 - Configuration
113
+ #### 2.3.2 - Configuration
114
+
115
+ The default port can be reconfigured with a Telos Config utility with the desired port specified as
116
+ a numerical field in the properties with the alias "port".
117
+
118
+ #### 2.3.3 - Middleware
119
+
120
+ Telos Server may be extended through middleware referenced in the Telos Origin APInt.
121
+
122
+ The utilities which reference such middleware shall have the "type" property specified as
123
+ "telos-server-middleware", and shall reference as their source a CommonJS module which exports an
124
+ object with a "middleware" field containing a list of middleware functions.
125
+
126
+ A middleware function shall take two arguments, the first being the HTTP request which invoked it
127
+ it the form of an HTTP JSON object, and the second being a file metadata object specifying
128
+ information about the file on disk which matches the request URI. Said metadata object shall have
129
+ the fields "file", containing a string specifying the full file path, "meta", containing an object
130
+ specifying the properties derived from the file path as shown in section 2.1.1, and "type",
131
+ containing a string specifying the file type.
87
132
 
88
- The defualt port can be reconfigured with a Telos Config utility with the desired port specified as
89
- a numerical field in the properties with the alias "port".
133
+ The function may return an HTTP JSON response object representing the response to be returned to
134
+ the client. Additional fields may be added to the response object for certain behaviors. Ideally,
135
+ only one middleware function should return a response for each request, but in the event that there
136
+ are multiple responses, a "priority" field containing a number may be added to indicate how the
137
+ response should be weighed relative to others. If the response is to return a filestream rather
138
+ than a text response, the body of the response shall be set to the path to the streamed resource,
139
+ and the response object shall have the field "file", containing a boolean value of true.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "telos-server",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "An Extensible CMS Server for Telos Origin.",
5
5
  "main": "telosServer.json",
6
6
  "dependencies": {