spice-js 2.5.8 → 2.5.12
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.
- package/build/bootstrap/map.js +1 -1
- package/build/index.js +10 -11
- package/build/models/SpiceModel.js +1 -2
- package/package.json +2 -1
- package/src/bootstrap/map.js +1 -1
- package/src/index.js +8 -8
- package/src/models/SpiceModel.js +1 -9
package/build/bootstrap/map.js
CHANGED
|
@@ -23,7 +23,7 @@ try {
|
|
|
23
23
|
/*#__PURE__*/
|
|
24
24
|
function () {
|
|
25
25
|
var _ref = _asyncToGenerator(function* (file) {
|
|
26
|
-
spice[resource][file.split(".")[0]] = (yield Promise.resolve("" + _path.default.join(paths, file)).then(s => _interopRequireWildcard(require(s)))).default;
|
|
26
|
+
spice[resource][file.split(".")[0].toLowerCase()] = (yield Promise.resolve("" + _path.default.join(paths, file)).then(s => _interopRequireWildcard(require(s)))).default;
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
return function (_x) {
|
package/build/index.js
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = exports.status = exports.addTask = exports.MapType = exports.MailFile = exports.Storage = exports.LocalStorage = exports.DebugStorage = exports.MailDebug = exports.DataType = exports.Mail = exports.RestHelper = exports.Serializer = exports.Crypt = exports.SpiceModel = exports.SocketEventDriver = exports.SpiceEventDriver = exports.EventDebugger = exports.Event = void 0;
|
|
5
5
|
|
|
6
|
-
var _koaSocket = _interopRequireDefault(require("koa-socket-2"));
|
|
7
|
-
|
|
8
6
|
var _Event = _interopRequireDefault(require("./events/Event"));
|
|
9
7
|
|
|
10
8
|
exports.Event = _Event.default;
|
|
@@ -83,7 +81,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
83
81
|
|
|
84
82
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
85
83
|
|
|
86
|
-
var path = require("path");
|
|
84
|
+
var path = require("path"); //import IO from "koa-socket-2";
|
|
85
|
+
|
|
87
86
|
|
|
88
87
|
var cors = require("kcors");
|
|
89
88
|
|
|
@@ -123,7 +122,7 @@ class Spice {
|
|
|
123
122
|
init(app) {
|
|
124
123
|
return _asyncToGenerator(function* () {
|
|
125
124
|
try {
|
|
126
|
-
|
|
125
|
+
//const io = new IO();
|
|
127
126
|
app.use(cors());
|
|
128
127
|
|
|
129
128
|
require("koa-qs")(app, "extended");
|
|
@@ -137,16 +136,16 @@ class Spice {
|
|
|
137
136
|
}));
|
|
138
137
|
app.use(convert(Validate()));
|
|
139
138
|
spice.app = app;
|
|
140
|
-
spice.config = yield require("./loaders/config")();
|
|
141
|
-
io
|
|
142
|
-
|
|
143
|
-
io.on("message", (ctx, data) => {
|
|
139
|
+
spice.config = yield require("./loaders/config")(); //io.attach(app);
|
|
140
|
+
//spice.io = io; */
|
|
141
|
+
|
|
142
|
+
/* io.on("message", (ctx, data) => {
|
|
144
143
|
console.log("client sent data to message endpoint", data);
|
|
145
|
-
});
|
|
144
|
+
}); */
|
|
146
145
|
|
|
147
|
-
app._io.on("connection", sock => {
|
|
146
|
+
/* app._io.on("connection", (sock) => {
|
|
148
147
|
console.log("Connection Up", sock);
|
|
149
|
-
});
|
|
148
|
+
}); */
|
|
150
149
|
|
|
151
150
|
app.use(koaSwagger({
|
|
152
151
|
hideTopbar: true,
|
|
@@ -179,7 +179,7 @@ class SpiceModel {
|
|
|
179
179
|
complete
|
|
180
180
|
} = _ref;
|
|
181
181
|
var operationExempt = {
|
|
182
|
-
PUT: ["required"]
|
|
182
|
+
PUT: ["required", "unique"]
|
|
183
183
|
};
|
|
184
184
|
var returnVal = [];
|
|
185
185
|
|
|
@@ -877,7 +877,6 @@ class SpiceModel {
|
|
|
877
877
|
when: properties[i].map.when || "read",
|
|
878
878
|
execute: function () {
|
|
879
879
|
var _execute2 = _asyncToGenerator(function* (data) {
|
|
880
|
-
console.log(_.isString(properties[i].map.reference), _.isString(properties[i].map.reference) ? spice.models[properties[i].map.reference] : properties[i].map.reference, spice.models, properties[i].map.reference);
|
|
881
880
|
return yield _this10.mapToObjectArray(data, _.isString(properties[i].map.reference) ? spice.models[properties[i].map.reference] : properties[i].map.reference, i, properties[i].map.destination || i, properties[i]);
|
|
882
881
|
});
|
|
883
882
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spice-js",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.12",
|
|
4
4
|
"description": "spice",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"regenerator-runtime": "^0.13.7",
|
|
39
39
|
"socket.io-client": "^4.0.1",
|
|
40
40
|
"sonover-date": "^1.0.1",
|
|
41
|
+
"spice-couchbase": "^2.0.14",
|
|
41
42
|
"uuid": "^3.3.3",
|
|
42
43
|
"winston": "^3.2.1"
|
|
43
44
|
},
|
package/src/bootstrap/map.js
CHANGED
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var path = require("path");
|
|
3
|
-
import IO from "koa-socket-2";
|
|
3
|
+
//import IO from "koa-socket-2";
|
|
4
4
|
const cors = require("kcors");
|
|
5
5
|
global.spice = {};
|
|
6
6
|
|
|
@@ -55,7 +55,7 @@ export default class Spice {
|
|
|
55
55
|
|
|
56
56
|
async init(app) {
|
|
57
57
|
try {
|
|
58
|
-
const io = new IO();
|
|
58
|
+
//const io = new IO();
|
|
59
59
|
app.use(cors());
|
|
60
60
|
require("koa-qs")(app, "extended");
|
|
61
61
|
|
|
@@ -72,14 +72,14 @@ export default class Spice {
|
|
|
72
72
|
spice.app = app;
|
|
73
73
|
spice.config = await require("./loaders/config")();
|
|
74
74
|
|
|
75
|
-
io.attach(app);
|
|
76
|
-
spice.io = io;
|
|
77
|
-
io.on("message", (ctx, data) => {
|
|
75
|
+
//io.attach(app);
|
|
76
|
+
//spice.io = io; */
|
|
77
|
+
/* io.on("message", (ctx, data) => {
|
|
78
78
|
console.log("client sent data to message endpoint", data);
|
|
79
|
-
});
|
|
80
|
-
app._io.on("connection", (sock) => {
|
|
79
|
+
}); */
|
|
80
|
+
/* app._io.on("connection", (sock) => {
|
|
81
81
|
console.log("Connection Up", sock);
|
|
82
|
-
});
|
|
82
|
+
}); */
|
|
83
83
|
app.use(
|
|
84
84
|
koaSwagger({
|
|
85
85
|
hideTopbar: true,
|
package/src/models/SpiceModel.js
CHANGED
|
@@ -154,7 +154,7 @@ export default class SpiceModel {
|
|
|
154
154
|
|
|
155
155
|
createValidationString({ property_name, props, operation, complete }) {
|
|
156
156
|
let operationExempt = {
|
|
157
|
-
PUT: ["required"],
|
|
157
|
+
PUT: ["required", "unique"],
|
|
158
158
|
};
|
|
159
159
|
let returnVal = [];
|
|
160
160
|
for (let i in props) {
|
|
@@ -765,14 +765,6 @@ export default class SpiceModel {
|
|
|
765
765
|
this.addModifier({
|
|
766
766
|
when: properties[i].map.when || "read",
|
|
767
767
|
execute: async (data) => {
|
|
768
|
-
console.log(
|
|
769
|
-
_.isString(properties[i].map.reference),
|
|
770
|
-
_.isString(properties[i].map.reference)
|
|
771
|
-
? spice.models[properties[i].map.reference]
|
|
772
|
-
: properties[i].map.reference,
|
|
773
|
-
spice.models,
|
|
774
|
-
properties[i].map.reference
|
|
775
|
-
);
|
|
776
768
|
return await this.mapToObjectArray(
|
|
777
769
|
data,
|
|
778
770
|
_.isString(properties[i].map.reference)
|