1 | https://shstefanov.github.io/infrastructure/
|
2 |
|
3 | Changes in 1.4.0
|
4 | ================
|
5 |
|
6 | Added config.callback_timeout option (defaults to 60000 milliseconds)
|
7 | Added config.callback_check_timeout_interval (defaults to 5000 milliseconds)
|
8 |
|
9 | Added lib/ExpireStore.js
|
10 | ```javascript
|
11 |
|
12 | var ExpireStore = require("infrastructure/lib/ExpireStore");
|
13 | var store = new ExpireStore(5000);
|
14 | store.set("some_unique_key", "Some value");
|
15 | store.on("expire", function(key, value){
|
16 | // Do something with expired things
|
17 | });
|
18 | setTimeout(function(){
|
19 | store.get("some_unique_key"); //undefined
|
20 | }, 6000);
|
21 | store.size(); // count elements in store
|
22 | store.has("key"); //true|false
|
23 | store.delete("key"); // remove element from store if key exists
|
24 | var value = store.pull("key") return value and remove element from store
|
25 | store.expire("key"); // force element expiration
|
26 | store.check(); // Validates all elements and drops expired
|
27 | store.start(2000); // Start checking every x milliseconds
|
28 | store.stop(); // Stops checking interval
|
29 |
|
30 | ```
|
31 |
|
32 | Changes in 1.3.0
|
33 | ================
|
34 |
|
35 | Support .hson file format in config ( https://github.com/timjansen/hanson )
|
36 |
|
37 | Adding 'patch' to config root (or mode root)
|
38 | ```json
|
39 | {
|
40 | "structures.pages.config.http.port": 3000,
|
41 | "structures.models.config.mongodb.host": "example.com"
|
42 |
|
43 | }
|
44 | ```
|
45 | Fixing missing repl close on shutdown
|
46 | Try to return better error message on catch in helpers.chain
|
47 |
|
48 | Adding
|
49 | ```javascript
|
50 | env.i.do("master.keep", "key", value); // keeps some data (needed to restore target data on hot reload)
|
51 | env.i.do("master.pull", "key", function(err, data)); // pulls the data from the cache
|
52 | ```
|
53 |
|
54 |
|
55 | Changes in 1.2.0
|
56 | ================
|
57 | Adding config.only = [ ...structure_names ] in test mode
|
58 | Adding test_env.client(url, options, function(err, window){}) for loading and running clientside code with jsdom
|
59 | Adding "callable" as alternative to "methods" whitelist
|
60 | Adding test_env.client(url, function(err, window)) for testing clientside code
|
61 | Adding restart("structure_name") in --repl on master process
|
62 | Adding config.only = ["structure1_name", "structure2_name"] in test mode
|
63 | Cli options can be passed via config.options
|
64 | Instances prototypes can point to resolvable module
|
65 |
|
66 | Fixing config modes issues
|
67 |
|
68 | config.structures
|
69 |
|
70 | Changes in 1.1.0
|
71 | ================
|
72 |
|
73 | Adding command line options. For parsing is used "minimist".
|
74 | "config" will be detached from options and will be used to update main config tree.
|
75 |
|
76 | # For boolean values:
|
77 | # true
|
78 | > node app.js --config.structures.log.options.sys
|
79 | # false
|
80 | > node app.js --config.structures.log.options.sys false
|
81 |
|
82 | #Specific values
|
83 | > node app.js --config.mongodb.port=27018 --config.mongodb.host=example.com
|
84 |
|
85 | The rest of options will be attached to config.options
|
86 |
|
87 |
|
88 | Adding REPL console, available with --repl option. It starts the console in master process and provides env and config variables.
|
89 | If used as --repl=structure_name in cluster process_mode, it will launch the console in the child process that handles the structure.
|
90 |
|
91 |
|
92 | Fixed spawning on exit in cluster process mode.
|
93 |
|
94 | Seed option for DataLayers
|
95 |
|
96 | --seed or --seed.ModelName
|
97 |
|
98 | This will set seed option to string (url, fs path, related to project root or dot notated config resolve path);
|
99 |
|
100 | --seed.ModelName=http:eample.com/resource
|
101 | --seed.ModelName=./seeds/ModelsData.json
|
102 | --seed.ModelName=seeds.ModelsData
|
103 |
|
104 | The last will be resolved from config tree. It can point to object, array or string that will be proceeded too.
|
105 |
|
106 | It also can point to function (DataLayer instance seed property to be function).
|
107 |
|
108 | function seed(cb){
|
109 | // do something async
|
110 | cb(err, [ /* models here */ ]);
|
111 | }
|
112 |
|
113 | Also, for "http" seeds, if parseSeed provided in DataLayer static properties, it will be used to parse the response.
|
114 |
|
115 | parseSeed: function(body, cb){
|
116 | // scrape response
|
117 | cb(null, [ /* your models here */ ])
|
118 | }
|
119 |
|
120 | Otherwise, parseSeed will be called with resoled data (you may want to make some of properties dates, objectID-s or something else)
|
121 |
|
122 | parseSeed: function(resolved_data, cb){
|
123 | // change the data
|
124 | cb(null, [ /* changed models here */ ])
|
125 | } |
\ | No newline at end of file |