systemlynx 1.1.0 → 1.2.0

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 (3) hide show
  1. package/API.md +5 -5
  2. package/README.md +9 -9
  3. package/package.json +1 -1
package/API.md CHANGED
@@ -73,10 +73,10 @@ Welcome to the docs! Following is a list of the objects used and created when de
73
73
 
74
74
  ## App
75
75
 
76
- **App** combinds the both functionalites of SystemLynx Service and Client into one object, while also providing a module interface and lifecycle events. Access the App instance by deconcatanating from the object return when loading SystemLynx `require("sht-tasks")`.
76
+ **App** combinds the both functionalites of SystemLynx Service and Client into one object, while also providing a module interface and lifecycle events. Access the App instance by deconcatanating from the object return when loading SystemLynx `require("systemlynx")`.
77
77
 
78
78
  ```javascript
79
- const { App } = require("sht-tasks");
79
+ const { App } = require("systemlynx");
80
80
  ```
81
81
 
82
82
  ## App.ServerModule(name, constructor [,reserved_methods])
@@ -108,10 +108,10 @@ Use **App.ServerModule(name, constructor)** function to create or pass an object
108
108
 
109
109
  Service is a SystemLynx abstraction used to server objects that can be loaded by a SystemLynx Client using the `Client.loadService(url)` method.
110
110
 
111
- Call require("sht-tasks") and de-concatenate from the object it returns.
111
+ Call require("systemlynx") and de-concatenate from the object it returns.
112
112
 
113
113
  ```javascript
114
- const { Service } = require("sht-tasks");
114
+ const { Service } = require("systemlynx");
115
115
  ```
116
116
 
117
117
  The Service object has the following methods:
@@ -127,7 +127,7 @@ The Service object has the following methods:
127
127
  Use the `Service.ServerModule(name, constructor, [,options])` method to register an object to be hosted by a _SystemLynx Service_. This will allows you to load an instance of that object onto a client application, and call any methods on that object remotely.
128
128
 
129
129
  ```javascript
130
- const { Service } = require("sht-tasks");
130
+ const { Service } = require("systemlynx");
131
131
 
132
132
  const Users = {};
133
133
 
package/README.md CHANGED
@@ -5,10 +5,10 @@ SystemLynx is a framework for developing modular web APIs. It's a wrapper on top
5
5
  SystemLynx comes with the following objects that are used for web API development:
6
6
 
7
7
  ```javascript
8
- const { App, Service, Client, LoadBalancer } = require("sht-tasks");
8
+ const { App, Service, Client, LoadBalancer } = require("systemlynx");
9
9
  ```
10
10
 
11
- Call `require("sht-tasks")` and de-concatenate from the object it returns. The main abstractions used for client-to-server interactions are the following:
11
+ Call `require("systemlynx")` and de-concatenate from the object it returns. The main abstractions used for client-to-server interactions are the following:
12
12
 
13
13
  - **Service** - Used to create and host objects that can be loaded and used by a SystemLynx Client.
14
14
  - **Client** - Used in a client application to load a _Service_, which contains all the objects added to the _Service_.
@@ -25,7 +25,7 @@ Find the full [API Documentation](https://github.com/Odion100/SystemLynx/blob/ta
25
25
  Use the `Service.ServerModule(name, constructor/object)` method to register an object to be hosted by a _SystemLynx Service_. This will allows you to load an instance of that object onto a client application, and call any methods on that object remotely.
26
26
 
27
27
  ```javascript
28
- const { Service } = require("sht-tasks");
28
+ const { Service } = require("systemlynx");
29
29
 
30
30
  const Users = {};
31
31
 
@@ -43,7 +43,7 @@ Alternatively, you can use a constructor function instead of an object as the se
43
43
  "Orders".
44
44
 
45
45
  ```javascript
46
- const { Service } = require("sht-tasks");
46
+ const { Service } = require("systemlynx");
47
47
 
48
48
  const Users = {};
49
49
 
@@ -71,7 +71,7 @@ In the _ServerModule_ constructor function above, the `this` value is the init
71
71
  Before we can access the objects hosted by this _Service_ from a client application, we need to call the `Service.startService(options)` function. This will start an **ExpressJS** Server and a **Socket.io** WebSocket Server, and set up routing for the _Service_. In the example below we added the `Service.startService(options)` function at the bottom, but the order does not matter.
72
72
 
73
73
  ```javascript
74
- const { Service } = require("sht-tasks");
74
+ const { Service } = require("systemlynx");
75
75
 
76
76
  const Users = {};
77
77
 
@@ -101,7 +101,7 @@ Now lets see how these objects can be loaded into a client application.
101
101
  The `Client.loadService(url)` function can be used to load a SystemLynx _Service_. This method requires the url (string) of the _Service_ you want to load as the first argument, and will return a promise that will resolve into an object that containing all the modules hosted by that service. See below. **NOTE: You must be within an async function in order to use the `await` keyword when returning a promise.**
102
102
 
103
103
  ```javascript
104
- const { Client } = require("sht-tasks");
104
+ const { Client } = require("systemlynx");
105
105
 
106
106
  const { Users, Orders } = await Client.loadService("http://localhost:4400/test/service");
107
107
 
@@ -111,7 +111,7 @@ console.log(Users, Orders);
111
111
  Now that we've loaded the _Service_ that we created in the previous example, and have a handle on the _Users_ and _Orders_ objects hosted by the _Service_, we can now call any method on those objects. In the example below, we demonstrate that when a methods for the ServerModule objects is called from the client, it can optionally take a callback as the last argument or, if a callback is not used, it will return a promise. With the `Users.add(data, callback)` method we used a callback, but with the `Orders.find(arg1, arg2, callback)` method we left out the callback function and used the `await` keyword to return a promise.
112
112
 
113
113
  ```javascript
114
- const { Client } = require("sht-tasks");
114
+ const { Client } = require("systemlynx");
115
115
 
116
116
  const { Users, Orders } = await Client.loadService("http://localhost:4400/test/service");
117
117
 
@@ -132,7 +132,7 @@ console.log(response);
132
132
  We can also receive WebSocket events emitted from the remote objects we've loaded using the `Client.loadService(url)` function. In the example below we're using the `Users.on(event_name, callback)` method to listen for events coming from the "Users" _ServerModule_.
133
133
 
134
134
  ```javascript
135
- const { Client } = require("sht-tasks");
135
+ const { Client } = require("systemlynx");
136
136
 
137
137
  const { Users, Orders } = await Client.loadService("http://localhost:4400/test/service");
138
138
 
@@ -155,7 +155,7 @@ console.log(response);
155
155
  Now let's go to our server application and call the `Users.emit(event_name, data)` method to emit a websocket event that can be received by its corresponding Clients. Below, notice that we've added `Users.emit("new_user", { message:"new_user event test" })` at the end of the `Users.add` method, so the `new_user` event will be emitted every time this method is called.
156
156
 
157
157
  ```javascript
158
- const { Service } = require("sht-tasks");
158
+ const { Service } = require("systemlynx");
159
159
 
160
160
  const Users = {};
161
161
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systemlynx",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {