Commit 786e5f01 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_core/erp5_web_renderjs_ui] Update jIO 3.30.0

parent 516fefb4
......@@ -8195,24 +8195,42 @@ return new Parser;
}
}
function ensurePushableQueue(callback, argument_list, context) {
var result;
try {
result = callback.apply(context, argument_list);
} catch (e) {
return new RSVP.Queue()
.push(function returnPushableError() {
return RSVP.reject(e);
});
}
if (result instanceof RSVP.Queue) {
return result;
}
return new RSVP.Queue()
.push(function returnPushableResult() {
return result;
});
}
function declareMethod(klass, name, precondition_function, post_function) {
klass.prototype[name] = function () {
var argument_list = arguments,
context = this,
precondition_result;
precondition_result,
storage_method,
queue;
return new RSVP.Queue()
.push(function () {
// Precondition function are not asynchronous
if (precondition_function !== undefined) {
return precondition_function.apply(
precondition_result = precondition_function.apply(
context.__storage,
[argument_list, context, name]
);
}
})
.push(function (result) {
var storage_method = context.__storage[name];
precondition_result = result;
storage_method = context.__storage[name];
if (storage_method === undefined) {
throw new jIO.util.jIOError(
"Capacity '" + name + "' is not implemented on '" +
......@@ -8220,22 +8238,21 @@ return new Parser;
501
);
}
return storage_method.apply(
context.__storage,
argument_list
);
})
.push(function (result) {
queue = ensurePushableQueue(storage_method, argument_list,
context.__storage);
if (post_function !== undefined) {
queue
.push(function (result) {
return post_function.call(
context,
argument_list,
result,
precondition_result
);
}
return result;
});
}
return queue;
};
// Allow chain
return this;
......@@ -8267,8 +8284,7 @@ return new Parser;
JioProxyStorage.prototype.post = function () {
var context = this,
argument_list = arguments;
return new RSVP.Queue()
.push(function () {
return ensurePushableQueue(function () {
var storage_method = context.__storage.post;
if (storage_method === undefined) {
throw new jIO.util.jIOError(
......@@ -8395,13 +8411,8 @@ return new Parser;
501
);
}
return new RSVP.Queue()
.push(function () {
return storage_method.apply(
context.__storage,
argument_list
);
});
return ensurePushableQueue(storage_method, argument_list,
context.__storage);
};
JioProxyStorage.prototype.hasCapacity = function (name) {
......@@ -8425,8 +8436,7 @@ return new Parser;
if (options === undefined) {
options = {};
}
return new RSVP.Queue()
.push(function () {
return ensurePushableQueue(function () {
if (context.hasCapacity("list") &&
((options.query === undefined) || context.hasCapacity("query")) &&
((options.sort_on === undefined) || context.hasCapacity("sort")) &&
......@@ -8435,9 +8445,7 @@ return new Parser;
((options.include_docs === undefined) ||
context.hasCapacity("include")) &&
((options.limit === undefined) || context.hasCapacity("limit"))) {
return context.buildQuery(options);
}
})
return context.buildQuery(options)
.push(function (result) {
return {
data: {
......@@ -8446,6 +8454,8 @@ return new Parser;
}
};
});
}
});
};
declareMethod(JioProxyStorage, "allAttachments", checkId);
......@@ -8454,8 +8464,7 @@ return new Parser;
JioProxyStorage.prototype.repair = function () {
var context = this,
argument_list = arguments;
return new RSVP.Queue()
.push(function () {
return ensurePushableQueue(function () {
var storage_method = context.__storage.repair;
if (storage_method !== undefined) {
return context.__storage.repair.apply(context.__storage,
......@@ -12385,8 +12394,6 @@ return new Parser;
};
function extractPropertyFromFormJSON(json) {
return new RSVP.Queue()
.push(function () {
var form = json._embedded._view,
converted_json = {
portal_type: json._links.type.name
......@@ -12437,7 +12444,6 @@ return new Parser;
result.action_href = form._actions.put.href;
}
return result;
});
}
function extractPropertyFromForm(context, id) {
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>966.49875.42877.4590</string> </value>
<value> <string>968.19732.55192.30190</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1528796246.74</float>
<float>1529590411.53</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -8195,24 +8195,42 @@ return new Parser;
}
}
function ensurePushableQueue(callback, argument_list, context) {
var result;
try {
result = callback.apply(context, argument_list);
} catch (e) {
return new RSVP.Queue()
.push(function returnPushableError() {
return RSVP.reject(e);
});
}
if (result instanceof RSVP.Queue) {
return result;
}
return new RSVP.Queue()
.push(function returnPushableResult() {
return result;
});
}
function declareMethod(klass, name, precondition_function, post_function) {
klass.prototype[name] = function () {
var argument_list = arguments,
context = this,
precondition_result;
precondition_result,
storage_method,
queue;
return new RSVP.Queue()
.push(function () {
// Precondition function are not asynchronous
if (precondition_function !== undefined) {
return precondition_function.apply(
precondition_result = precondition_function.apply(
context.__storage,
[argument_list, context, name]
);
}
})
.push(function (result) {
var storage_method = context.__storage[name];
precondition_result = result;
storage_method = context.__storage[name];
if (storage_method === undefined) {
throw new jIO.util.jIOError(
"Capacity '" + name + "' is not implemented on '" +
......@@ -8220,22 +8238,21 @@ return new Parser;
501
);
}
return storage_method.apply(
context.__storage,
argument_list
);
})
.push(function (result) {
queue = ensurePushableQueue(storage_method, argument_list,
context.__storage);
if (post_function !== undefined) {
queue
.push(function (result) {
return post_function.call(
context,
argument_list,
result,
precondition_result
);
}
return result;
});
}
return queue;
};
// Allow chain
return this;
......@@ -8267,8 +8284,7 @@ return new Parser;
JioProxyStorage.prototype.post = function () {
var context = this,
argument_list = arguments;
return new RSVP.Queue()
.push(function () {
return ensurePushableQueue(function () {
var storage_method = context.__storage.post;
if (storage_method === undefined) {
throw new jIO.util.jIOError(
......@@ -8395,13 +8411,8 @@ return new Parser;
501
);
}
return new RSVP.Queue()
.push(function () {
return storage_method.apply(
context.__storage,
argument_list
);
});
return ensurePushableQueue(storage_method, argument_list,
context.__storage);
};
JioProxyStorage.prototype.hasCapacity = function (name) {
......@@ -8425,8 +8436,7 @@ return new Parser;
if (options === undefined) {
options = {};
}
return new RSVP.Queue()
.push(function () {
return ensurePushableQueue(function () {
if (context.hasCapacity("list") &&
((options.query === undefined) || context.hasCapacity("query")) &&
((options.sort_on === undefined) || context.hasCapacity("sort")) &&
......@@ -8435,9 +8445,7 @@ return new Parser;
((options.include_docs === undefined) ||
context.hasCapacity("include")) &&
((options.limit === undefined) || context.hasCapacity("limit"))) {
return context.buildQuery(options);
}
})
return context.buildQuery(options)
.push(function (result) {
return {
data: {
......@@ -8446,6 +8454,8 @@ return new Parser;
}
};
});
}
});
};
declareMethod(JioProxyStorage, "allAttachments", checkId);
......@@ -8454,8 +8464,7 @@ return new Parser;
JioProxyStorage.prototype.repair = function () {
var context = this,
argument_list = arguments;
return new RSVP.Queue()
.push(function () {
return ensurePushableQueue(function () {
var storage_method = context.__storage.repair;
if (storage_method !== undefined) {
return context.__storage.repair.apply(context.__storage,
......@@ -12385,8 +12394,6 @@ return new Parser;
};
function extractPropertyFromFormJSON(json) {
return new RSVP.Queue()
.push(function () {
var form = json._embedded._view,
converted_json = {
portal_type: json._links.type.name
......@@ -12437,7 +12444,6 @@ return new Parser;
result.action_href = form._actions.put.href;
}
return result;
});
}
function extractPropertyFromForm(context, id) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment