Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alexander Emmerich
erp5
Commits
60cc9e35
Commit
60cc9e35
authored
Dec 04, 2015
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Update to jIO 3.6.0
This should speed up IndexedDB.allDocs usage
parent
de8f8942
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1176 additions
and
1097 deletions
+1176
-1097
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_appcache.xml
...TemplateItem/web_page_module/rjs_gadget_erp5_appcache.xml
+3
-3
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_jio_js.xml
...thTemplateItem/web_page_module/rjs_gadget_erp5_jio_js.xml
+8
-7
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_history_js.xml
...eItem/web_page_module/rjs_gadget_erp5_page_history_js.xml
+6
-6
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
...nderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
+1159
-1081
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_appcache.xml
View file @
60cc9e35
...
@@ -102,7 +102,7 @@
...
@@ -102,7 +102,7 @@
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<value>
<string
encoding=
"cdata"
>
<![CDATA[
CACHE MANIFEST\n
CACHE MANIFEST\n
# generated on
Mon, 30 Nov
2015 10:00:00 +0000\n
# generated on
Fri, 04 Dec
2015 10:00:00 +0000\n
# XXX + fonts\n
# XXX + fonts\n
# images/ajax-loader.gif\n
# images/ajax-loader.gif\n
CACHE:\n
CACHE:\n
...
@@ -342,7 +342,7 @@ NETWORK:\n
...
@@ -342,7 +342,7 @@ NETWORK:\n
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
947.
22631.16141.50329
</string>
</value>
<value>
<string>
947.
36771.24081.57838
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -360,7 +360,7 @@ NETWORK:\n
...
@@ -360,7 +360,7 @@ NETWORK:\n
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
144
8650222.45
</float>
<float>
144
9236184.22
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_jio_js.xml
View file @
60cc9e35
...
@@ -101,13 +101,14 @@
...
@@ -101,13 +101,14 @@
<key>
<string>
text_content
</string>
</key>
<key>
<string>
text_content
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<value>
<string
encoding=
"cdata"
>
<![CDATA[
/*global window, rJS, RSVP, UriTemplate, URI,
objectToSearchText
, SimpleQuery, ComplexQuery, jIO */\n
/*global window, rJS, RSVP, UriTemplate, URI,
Query
, SimpleQuery, ComplexQuery, jIO */\n
/*jslint indent: 2, maxerr: 3, nomen: true */\n
/*jslint indent: 2, maxerr: 3, nomen: true */\n
(function (window, rJS, RSVP, UriTemplate, URI,
objectToSearchText
, SimpleQuery, ComplexQuery, jIO) {\n
(function (window, rJS, RSVP, UriTemplate, URI,
Query
, SimpleQuery, ComplexQuery, jIO) {\n
"use strict";\n
"use strict";\n
\n
\n
function wrapJioCall(gadget, method_name, argument_list) {\n
function wrapJioCall(gadget, method_name, argument_list) {\n
var storage = gadget.state_parameter_dict.jio_storage;\n
var storage = gadget.state_parameter_dict.jio_storage;\n
\n
return storage[method_name].apply(storage, argument_list)\n
return storage[method_name].apply(storage, argument_list)\n
.push(undefined, function (error) {\n
.push(undefined, function (error) {\n
if ((error.target !== undefined) && (error.target.status === 401)) {\n
if ((error.target !== undefined) && (error.target.status === 401)) {\n
...
@@ -218,14 +219,14 @@
...
@@ -218,14 +219,14 @@
if (result_list) {\n
if (result_list) {\n
local_roles = result_list;\n
local_roles = result_list;\n
parsed_query.query_list.splice(i, 1);\n
parsed_query.query_list.splice(i, 1);\n
query = objectToSearchText(parsed_query);\n
query =
Query.
objectToSearchText(parsed_query);\n
i = parsed_query.query_list.length;\n
i = parsed_query.query_list.length;\n
} else {\n
} else {\n
result_list = isMultipleLocalRoles(sub_query);\n
result_list = isMultipleLocalRoles(sub_query);\n
if (result_list) {\n
if (result_list) {\n
local_roles = result_list;\n
local_roles = result_list;\n
parsed_query.query_list.splice(i, 1);\n
parsed_query.query_list.splice(i, 1);\n
query = objectToSearchText(parsed_query);\n
query =
Query.
objectToSearchText(parsed_query);\n
i = parsed_query.query_list.length;\n
i = parsed_query.query_list.length;\n
}\n
}\n
}\n
}\n
...
@@ -280,7 +281,7 @@
...
@@ -280,7 +281,7 @@
return wrapJioCall(this, \'putAttachment\', [id, name, JSON.stringify(json)]);\n
return wrapJioCall(this, \'putAttachment\', [id, name, JSON.stringify(json)]);\n
});\n
});\n
\n
\n
}(window, rJS, RSVP, UriTemplate, URI,
objectToSearchText
, SimpleQuery, ComplexQuery, jIO));
}(window, rJS, RSVP, UriTemplate, URI,
Query
, SimpleQuery, ComplexQuery, jIO));
]]>
</string>
</value>
]]>
</string>
</value>
</item>
</item>
...
@@ -417,7 +418,7 @@
...
@@ -417,7 +418,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
947.
15020.24457.52667
</string>
</value>
<value>
<string>
947.
36789.31946.17646
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -435,7 +436,7 @@
...
@@ -435,7 +436,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
144
8016802.0
</float>
<float>
144
9236578.55
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_history_js.xml
View file @
60cc9e35
...
@@ -101,9 +101,9 @@
...
@@ -101,9 +101,9 @@
<key>
<string>
text_content
</string>
</key>
<key>
<string>
text_content
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<value>
<string
encoding=
"cdata"
>
<![CDATA[
/*global window, rJS, RSVP, Handlebars, SimpleQuery, ComplexQuery,
objectToSearchText
*/\n
/*global window, rJS, RSVP, Handlebars, SimpleQuery, ComplexQuery,
Query
*/\n
/*jslint nomen: true, indent: 2, maxerr: 3 */\n
/*jslint nomen: true, indent: 2, maxerr: 3 */\n
(function (window, rJS, RSVP, Handlebars, SimpleQuery, ComplexQuery,
objectToSearchText
) {\n
(function (window, rJS, RSVP, Handlebars, SimpleQuery, ComplexQuery,
Query
) {\n
"use strict";\n
"use strict";\n
\n
\n
/////////////////////////////////////////////////////////////////\n
/////////////////////////////////////////////////////////////////\n
...
@@ -165,7 +165,7 @@
...
@@ -165,7 +165,7 @@
};\n
};\n
}\n
}\n
return gadget.jio_allDocs({\n
return gadget.jio_allDocs({\n
query: objectToSearchText(new ComplexQuery({operator: \'OR\', query_list: query_list})),\n
query:
Query.
objectToSearchText(new ComplexQuery({operator: \'OR\', query_list: query_list})),\n
select_list: ["title", "portal_type"],\n
select_list: ["title", "portal_type"],\n
limit: id_list.length\n
limit: id_list.length\n
});\n
});\n
...
@@ -212,7 +212,7 @@
...
@@ -212,7 +212,7 @@
my_translated_html;\n
my_translated_html;\n
});\n
});\n
});\n
});\n
}(window, rJS, RSVP, Handlebars, SimpleQuery, ComplexQuery,
objectToSearchText
));
}(window, rJS, RSVP, Handlebars, SimpleQuery, ComplexQuery,
Query
));
]]>
</string>
</value>
]]>
</string>
</value>
</item>
</item>
...
@@ -349,7 +349,7 @@
...
@@ -349,7 +349,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
947.22
112.65196.42461
</string>
</value>
<value>
<string>
947.22
494.14742.48810
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -367,7 +367,7 @@
...
@@ -367,7 +367,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
144
8442387.23
</float>
<float>
144
9229724.79
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
View file @
60cc9e35
...
@@ -3998,229 +3998,6 @@ if (typeof define === \'function\' && define.amd) {\n
...
@@ -3998,229 +3998,6 @@ if (typeof define === \'function\' && define.amd) {\n
makeGlobal();\n
makeGlobal();\n
}\n
}\n
}).call(this);\n
}).call(this);\n
;/*jslint
indent:
2,
maxlen:
80,
sloppy:
true
*/\n
\n
var
query_class_dict =
{};\n
;/*jslint
indent:
2,
maxlen:
80,
sloppy:
true,
nomen:
true
*/\n
/*global
parseStringToObject:
true,
emptyFunction:
true,
sortOn:
true,
limit:\n
true,
select:
true,
window,
stringEscapeRegexpCharacters:
true,\n
deepClone,
RSVP*/\n
\n
/**\n
*
The
query
to
use
to
filter
a
list
of
objects.\n
*
This
is
an
abstract
class.\n
*\n
*
@class
Query\n
*
@constructor\n
*/\n
function
Query()
{\n
\n
/**\n
*
Called
before
parsing
the
query.
Must
be
overridden!\n
*\n
*
@method
onParseStart\n
*
@param
{Object}
object
The
object
shared
in
the
parse
process\n
*
@param
{Object}
option
Some
option
gave
in
parse()\n
*/\n
this.onParseStart =
emptyFunction;\n
\n
/**\n
*
Called
when
parsing
a
simple
query.
Must
be
overridden!\n
*\n
*
@method
onParseSimpleQuery\n
*
@param
{Object}
object
The
object
shared
in
the
parse
process\n
*
@param
{Object}
option
Some
option
gave
in
parse()\n
*/\n
this.onParseSimpleQuery =
emptyFunction;\n
\n
/**\n
*
Called
when
parsing
a
complex
query.
Must
be
overridden!\n
*\n
*
@method
onParseComplexQuery\n
*
@param
{Object}
object
The
object
shared
in
the
parse
process\n
*
@param
{Object}
option
Some
option
gave
in
parse()\n
*/\n
this.onParseComplexQuery =
emptyFunction;\n
\n
/**\n
*
Called
after
parsing
the
query.
Must
be
overridden!\n
*\n
*
@method
onParseEnd\n
*
@param
{Object}
object
The
object
shared
in
the
parse
process\n
*
@param
{Object}
option
Some
option
gave
in
parse()\n
*/\n
this.onParseEnd =
emptyFunction;\n
\n
}\n
\n
/**\n
*
Filter
the
item
list
with
matching
item
only\n
*\n
*
@method
exec\n
*
@param
{Array}
item_list
The
list
of
object\n
*
@param
{Object}
[option]
Some
operation
option\n
*
@param
{Array}
[option.select_list]
A
object
keys
to
retrieve\n
*
@param
{Array}
[option.sort_on]
Couples
of
object
keys
and
"ascending"\n
*
or
"descending"\n
*
@param
{Array}
[option.limit]
Couple
of
integer,
first
is
an
index
and\n
*
second
is
the
length.\n
*/\n
Query.prototype.exec =
function
(item_list,
option)
{\n
var
i,
promises =
[];\n
if
(!Array.isArray(item_list))
{\n
throw
new
TypeError("Query().exec():
Argument
1
is
not
of
type
\'array\'");\n
}\n
if
(
option =
==
undefined)
{\n
option =
{};\n
}\n
if
(typeof
option
!==
\'object\')
{\n
throw
new
TypeError("Query().exec():
"
+\n
"Optional
argument
2
is
not
of
type
\'object\'");\n
}\n
for
(
i =
0;
i
<
item_list.length;
i
+=
1)
{\n
if
(!item_list[i])
{\n
promises.push(RSVP.resolve(false));\n
}
else
{\n
promises.push(this.match(item_list[i]));\n
}\n
}\n
return
new
RSVP.Queue()\n
.push(function
()
{\n
return
RSVP.all(promises);\n
})\n
.push(function
(answers)
{\n
var
j;\n
for
(
j =
answers.length
-
1;
j
>
= 0; j -= 1) {\n
if (!answers[j]) {\n
item_list.splice(j, 1);\n
}\n
}\n
if (option.sort_on) {\n
return sortOn(option.sort_on, item_list);\n
}\n
})\n
.push(function () {\n
if (option.limit) {\n
return limit(option.limit, item_list);\n
}\n
})\n
.push(function () {\n
return select(option.select_list || [], item_list);\n
})\n
.push(function () {\n
return item_list;\n
});\n
};\n
\n
/**\n
* Test if an item matches this query\n
*\n
* @method match\n
* @param {Object} item The object to test\n
* @return {Boolean} true if match, false otherwise\n
*/\n
Query.prototype.match = function () {\n
return RSVP.resolve(true);\n
};\n
\n
\n
/**\n
* Browse the Query in deep calling parser method in each step.\n
*\n
* `onParseStart` is called first, on end `onParseEnd` is called.\n
* It starts from the simple queries at the bottom of the tree calling the\n
* parser method `onParseSimpleQuery`, and go up calling the\n
* `onParseComplexQuery` method.\n
*\n
* @method parse\n
* @param {Object} option Any options you want (except \'parsed\')\n
* @return {Any} The parse result\n
*/\n
Query.prototype.parse = function (option) {\n
var that = this,\n
object;\n
/**\n
* The recursive parser.\n
*\n
* @param {Object} object The object shared in the parse process\n
* @param {Object} options Some options usable in the parseMethods\n
* @return {Any} The parser result\n
*/\n
function recParse(object, option) {\n
var query = object.parsed,\n
queue = new RSVP.Queue(),\n
i;\n
\n
function enqueue(j) {\n
queue\n
.push(function () {\n
object.parsed = query.query_list[j];\n
return recParse(object, option);\n
})\n
.push(function () {\n
query.query_list[j] = object.parsed;\n
});\n
}\n
\n
if (query.type === "complex") {\n
\n
\n
for (i = 0; i
< query.query_list.length
;
i
+=
1)
{\n
enqueue(i);\n
}\n
\n
return
queue\n
.push(function
()
{\n
object.parsed =
query;\n
return
that.onParseComplexQuery(object,
option);\n
});\n
\n
}\n
if
(
query.type =
==
"simple")
{\n
return
that.onParseSimpleQuery(object,
option);\n
}\n
}\n
object =
{\n
parsed:
JSON.parse(JSON.stringify(that.serialized()))\n
};\n
return
new
RSVP.Queue()\n
.push(function
()
{\n
return
that.onParseStart(object,
option);\n
})\n
.push(function
()
{\n
return
recParse(object,
option);\n
})\n
.push(function
()
{\n
return
that.onParseEnd(object,
option);\n
})\n
.push(function
()
{\n
return
object.parsed;\n
});\n
\n
};\n
\n
/**\n
*
Convert
this
query
to
a
parsable
string.\n
*\n
*
@method
toString\n
*
@return
{String}
The
string
version
of
this
query\n
*/\n
Query.prototype.toString =
function
()
{\n
return
"";\n
};\n
\n
/**\n
*
Convert
this
query
to
an
jsonable
object
in
order
to
be
remake
thanks
to\n
*
QueryFactory
class.\n
*\n
*
@method
serialized\n
*
@return
{Object}
The
jsonable
object\n
*/\n
Query.prototype.serialized =
function
()
{\n
return
undefined;\n
};\n
\n
window.Query =
Query;\n
;/**\n
;/**\n
*
Parse
a
text
request
to
a
json
query
object
tree\n
*
Parse
a
text
request
to
a
json
query
object
tree\n
*\n
*\n
...
@@ -4924,896 +4701,1010 @@ if ((error_count = __NODEJS_parse(string, error_offsets, error_lookaheads)) > 0)
...
@@ -4924,896 +4701,1010 @@ if ((error_count = __NODEJS_parse(string, error_offsets, error_lookaheads)) > 0)
;
return
result;\n
;
return
result;\n
}
//
parseStringToObject\n
}
//
parseStringToObject\n
\n
\n
Query.parseStringToObject =
parseStringToObject;
\n
;/*global
RSVP,
window,
parseStringToObject*/
\n
;/*jslint
indent:
2,
maxlen:
80,
sloppy:
true,
nomen:
true
*/\n
/*jslint
nomen:
true,
maxlen:
90
*/\n
/*global
Query:
true,
query_class_dict:
true,
inherits:
true,
\n
(function
(RSVP,
window,
parseStringToObject)
{
\n
window,
QueryFactory,
RSVP
*/
\n
"use
strict";
\n
\n
\n
/**\n
var
query_class_dict =
{},\n
*
The
ComplexQuery
inherits
from
Query,
and
compares
one
or
several
metadata\n
regexp_escape =
/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g,\n
*
values.\n
regexp_percent =
/%/g,\n
*\n
regexp_underscore =
/_/g,\n
*
@class
ComplexQuery\n
regexp_operator =
/^(?:AND|OR|NOT)$/i,\n
*
@extends
Query\n
regexp_comparaison =
/^(?:!?=|<=?|
>
=?)$/i;\n
*
@param
{Object}
[
spec=
{}]
The
specifications\n
*
@param
{String}
[
spec.operator=
"AND"
]
The
compare
method
to
use\n
*
@param
{String}
spec.key
The
metadata
key\n
*
@param
{String}
spec.value
The
value
of
the
metadata
to
compare\n
*/\n
function
ComplexQuery(spec,
key_schema)
{\n
Query.call(this);\n
\n
\n
/**\n
/**\n
*
Logical
operator
to
use
to
compare
object
values\n
* Convert metadata values to array of strings. ex:\n
*\n
* "a" -> ["a"],\n
* {"content": "a"} -> ["a"]\n
*\n
*\n
*
@attribute
operator\n
* @param {Any} value The metadata value\n
*
@type
String\n
* @return {Array} The value in string array format\n
*
@default
"AND"\n
*
@optional\n
*/\n
*/\n
this.operator =
spec.operator;\n
function metadataValueToStringArray(value) {\n
var i, new_value = [];\n
if (value === undefined) {\n
return undefined;\n
}\n
if (!Array.isArray(value)) {\n
value = [value];\n
}\n
for (i = 0; i
< value.length
;
i
+=
1)
{\n
if
(typeof
value[i]
===
\'object\')
{\n
new_value[i]
=
value[i].content;\n
}
else
{\n
new_value[i]
=
value[i];\n
}\n
}\n
return
new_value;\n
}\n
\n
\n
/**\n
/**\n
*
The
sub
Query
list
which
are
used
to
query
an
item.
\n
*
A
sort
function
to
sort
items
by
key
\n
*\n
*\n
*
@attribute
query_list\n
*
@param
{String}
key
The
key
to
sort
on\n
*
@type
Array\n
*
@param
{String}
[
way=
"ascending"
]
\'ascending\'
or
\'descending\'\n
*
@default
[]\n
*
@return
{Function}
The
sort
function\n
*
@optional\n
*/\n
*/\n
this.query_list =
spec.query_list
||
[];\n
function
sortFunction(key,
way)
{\n
/*jslint
unparam:
true*/\n
var
result;\n
this.query_list =
this.query_list.map(\n
if
(
way =
==
\'descending\')
{\n
//
decorate
the
map
to
avoid
sending
the
index
as
key_schema
argument\n
result =
1;\n
function
(o,
i)
{
return
QueryFactory.create(o,
key_schema);
}\n
}
else
if
(
way =
==
\'ascending\')
{\n
);\n
result =
-1;\n
/*jslint
unparam:
false*/\n
}
else
{\n
\n
throw
new
TypeError("Query.sortFunction():
"
+\n
}\n
"Argument
2
must
be
\'ascending\'
or
\'descending\'");\n
inherits(ComplexQuery,
Query);\n
}\n
\n
return
function
(a,
b)
{\n
ComplexQuery.prototype.operator =
"AND"
;\n
//
this
comparison
is
5
times
faster
than
json
comparison\n
ComplexQuery.prototype.type =
"complex"
;\n
var
i,
l;\n
\n
a =
metadataValueToStringArray(a[key])
||
[];\n
/**\n
b =
metadataValueToStringArray(b[key])
||
[];\n
*
#crossLink
"Query/match:method"\n
l =
a.length
>
b.length ? a.length : b.length;\n
*/\n
for (i = 0; i
< l
;
i
+=
1)
{\n
ComplexQuery.prototype.match =
function
(item)
{\n
if
(a[i]
===
undefined)
{\n
var
operator =
this.operator;\n
return
result;\n
if
(!(/^(?:AND|OR|NOT)$/i.test(operator)))
{\n
}\n
operator =
"AND"
;\n
if
(b[i]
===
undefined)
{\n
return
-result;\n
}\n
if
(a[i]
>
b[i]) {\n
return -result;\n
}\n
if (a[i]
< b
[i])
{\n
return
result;\n
}\n
}\n
return
0;\n
};\n
}\n
}\n
return
this[operator.toUpperCase()](item);\n
};\n
\n
\n
/**\n
/**\n
*
#crossLink
"Query/toString:method"\n
*
Sort
a
list
of
items,
according
to
keys
and
directions.\n
*/\n
*\n
ComplexQuery.prototype.toString =
function
()
{\n
*
@param
{Array}
sort_on_option
List
of
couples
[key,
direction]\n
var
str_list =
[],
this_operator =
this.operator;\n
*
@param
{Array}
list
The
item
list
to
sort\n
if
(
this.operator =
==
"NOT")
{\n
*
@return
{Array}
The
filtered
list\n
str_list.push("NOT
(");\n
*/\n
str_list.push(this.query_list[0].toString());\n
function
sortOn(sort_on_option,
list)
{\n
str_list.push(")");\n
var
sort_index;\n
return
str_list.join("
");\n
if
(!Array.isArray(sort_on_option))
{\n
throw
new
TypeError("jioquery.sortOn():
"
+\n
"Argument
1
is
not
of
type
\'array\'");\n
}\n
for
(
sort_index =
sort_on_option.length
-
1;
sort_index
>
= 0;\n
sort_index -= 1) {\n
list.sort(sortFunction(\n
sort_on_option[sort_index][0],\n
sort_on_option[sort_index][1]\n
));\n
}\n
return list;\n
}\n
}\n
this.query_list.forEach(function
(query)
{\n
str_list.push("(");\n
str_list.push(query.toString());\n
str_list.push(")");\n
str_list.push(this_operator);\n
});\n
str_list.length
-=
1;\n
return
str_list.join("
");\n
};\n
\n
/**\n
*
#crossLink
"Query/serialized:method"\n
*/\n
ComplexQuery.prototype.serialized =
function
()
{\n
var
s =
{\n
"type":
"complex",\n
"operator":
this.operator,\n
"query_list":
[]\n
};\n
this.query_list.forEach(function
(query)
{\n
s.query_list.push(\n
typeof
query.toJSON =
==
"function"
?
query.toJSON()
:
query\n
);\n
});\n
return
s;\n
};\n
ComplexQuery.prototype.toJSON =
ComplexQuery.prototype.serialized;\n
\n
\n
/**\n
/**\n
*
Comparison
operator,
test
if
all
sub
queries
match
the\n
* Limit a list of items, according to index and length.\n
*
item
value\n
*\n
*\n
* @param {Array} limit_option A couple [from, length]\n
*
@method
AND\n
* @param {Array} list The item list to limit\n
*
@param
{Object}
item
The
item
to
match\n
* @return {Array} The filtered list\n
*
@return
{Boolean}
true
if
all
match,
false
otherwise\n
*/\n
*/\n
function limit(limit_option, list) {\n
ComplexQuery.prototype.AND =
function
(item)
{\n
if (!Array.isArray(limit_option)) {\n
var
queue =
new
RSVP.Queue(),\n
throw new TypeError("jioquery.limit(): " +\n
context =
this,\n
"Argument 1 is not of type \'array\'");\n
i =
0;\n
\n
function
executeNextIfNotFalse(result)
{\n
if
(
result =
==
false)
{\n
//
No
need
to
evaluate
the
other
elements,
as
one
is
false\n
return
result;\n
}\n
}\n
if
(
context.query_list.length =
==
i
)
{\n
if (
!Array.isArray(list)
) {\n
//
No
new
element
to
loop
on
\n
throw new TypeError("jioquery.limit(): " +
\n
return
true
;\n
"Argument 2 is not of type \'array\'")
;\n
}\n
}\n
queue\n
list.splice(0, limit_option[0]);\n
.push(function
()
{\n
if (limit_option[1]) {\n
var
sub_result =
context.query_list[i].match(item);\n
list.splice(limit_option[1]);\n
i
+=
1;\n
}\n
return
sub_result;\n
return list;\n
})\n
.push(executeNextIfNotFalse);\n
}\n
}\n
\n
\n
executeNextIfNotFalse(true);\n
/**\n
return
queue;\n
* Filter a list of items, modifying them to select only wanted keys.\n
};\n
*\n
\n
* @param {Array} select_option Key list to keep\n
/**\n
* @param {Array} list The item list to filter\n
*
Comparison
operator,
test
if
one
of
the
sub
queries
matches
the\n
* @return {Array} The filtered list\n
*
item
value\n
*/\n
*\n
function select(select_option, list) {\n
*
@method
OR\n
var i, j, new_item;\n
*
@param
{Object}
item
The
item
to
match\n
if (!Array.isArray(select_option)) {\n
*
@return
{Boolean}
true
if
one
match,
false
otherwise\n
throw new TypeError("jioquery.select(): " +\n
*/\n
"Argument 1 is not of type Array");\n
ComplexQuery.prototype.OR =
function
(item)
{\n
}\n
var
queue =
new
RSVP.Queue(),\n
if (!Array.isArray(list)) {\n
context =
this,\n
throw new TypeError("jioquery.select(): " +\n
i =
0;\n
"Argument 2 is not of type Array");\n
\n
}\n
function
executeNextIfNotTrue(result)
{\n
for (i = 0; i
< list.length
;
i
+=
1)
{\n
if
(
result =
==
true)
{\n
new_item =
{};\n
//
No
need
to
evaluate
the
other
elements,
as
one
is
true\n
for
(
j =
0;
j
<
select_option.length;
j
+=
1)
{\n
return
result;\n
if
(list[i].hasOwnProperty([select_option[j]]))
{\n
}\n
new_item[select_option[j]]
=
list[i][select_option[j]];\n
if
(
context.query_list.length =
==
i)
{\n
}\n
//
No
new
element
to
loop
on\n
}\n
return
false;\n
for
(j
in
new_item)
{\n
if
(new_item.hasOwnProperty(j))
{\n
list[i]
=
new_item;\n
break;\n
}\n
}\n
}\n
}\n
queue\n
return
list;\n
.push(function
()
{\n
var
sub_result =
context.query_list[i].match(item);\n
i
+=
1;\n
return
sub_result;\n
})\n
.push(executeNextIfNotTrue);\n
}\n
}\n
\n
\n
executeNextIfNotTrue(false);\n
/**\n
return
queue;\n
*
The
query
to
use
to
filter
a
list
of
objects.\n
};\n
*
This
is
an
abstract
class.\n
*\n
*
@class
Query\n
*
@constructor\n
*/\n
function
Query()
{\n
\n
\n
/**\n
/**\n
*
Comparison
operator,
test
if
the
sub
query
does
not
match
the\n
*
Called
before
parsing
the
query.
Must
be
overridden!\n
*
item
value\n
*\n
*\n
*
@method
onParseStart\n
*
@method
NOT\n
*
@param
{Object}
object
The
object
shared
in
the
parse
process\n
*
@param
{Object}
item
The
item
to
match\n
*
@param
{Object}
option
Some
option
gave
in
parse()\n
*
@return
{Boolean}
true
if
one
match,
false
otherwise\n
*/\n
*/\n
//
this.onParseStart =
emptyFunction;\n
ComplexQuery.prototype.NOT =
function
(item)
{\n
return
new
RSVP.Queue()\n
.push(function
()
{\n
return
this.query_list[0].match(item);\n
})\n
.push(function
(answer)
{\n
return
!answer;\n
});\n
};\n
\n
\n
query_class_dict.complex =
ComplexQuery;\n
/**\n
*
Called
when
parsing
a
simple
query.
Must
be
overridden!\n
*\n
*
@method
onParseSimpleQuery\n
*
@param
{Object}
object
The
object
shared
in
the
parse
process\n
*
@param
{Object}
option
Some
option
gave
in
parse()\n
*/\n
//
this.onParseSimpleQuery =
emptyFunction;\n
\n
\n
window.ComplexQuery =
ComplexQuery;\n
/**\n
;/*jslint
indent:
2,
maxlen:
80,
sloppy:
true,
nomen:
true
*/\n
*
Called
when
parsing
a
complex
query.
Must
be
overridden!\n
/*global
window,
ComplexQuery,
SimpleQuery,
Query,
parseStringToObject,\n
*\n
query_class_dict
*/\n
*
@method
onParseComplexQuery\n
*
@param
{Object}
object
The
object
shared
in
the
parse
process\n
*
@param
{Object}
option
Some
option
gave
in
parse()\n
*/\n
//
this.onParseComplexQuery =
emptyFunction;\n
\n
\n
/**\n
/**\n
*
Provides
static
methods
to
create
Query
object
\n
*
Called
after
parsing
the
query.
Must
be
overridden!
\n
*\n
*\n
*
@class
QueryFactory
\n
*
@method
onParseEnd
\n
*/
\n
*
@param
{Object}
object
The
object
shared
in
the
parse
process
\n
function
QueryFactory()
{
\n
*
@param
{Object}
option
Some
option
gave
in
parse()
\n
return;
\n
*/
\n
}
\n
//
this.onParseEnd =
emptyFunction;
\n
\n
\n
/**\n
return;\n
*
Creates
Query
object
from
a
search
text
string
or
a
serialized
version\n
*
of
a
Query.\n
*\n
*
@method
create\n
*
@static\n
*
@param
{Object,String}
object
The
search
text
or
the
serialized
version\n
*
of
a
Query\n
*
@return
{Query}
A
Query
object\n
*/\n
QueryFactory.create =
function
(object,
key_schema)
{\n
if
(
object =
==
"")
{\n
return
new
Query();\n
}\n
}\n
if
(typeof
object =
==
"string")
{\n
object =
parseStringToObject(object);\n
}\n
if
(typeof
(object
||
{})
.type =
==
"string"
&&\n
query_class_dict[object.type])
{\n
return
new
query_class_dict[object.type](object,
key_schema);\n
}\n
throw
new
TypeError("QueryFactory.create():
"
+\n
"Argument
1
is
not
a
search
text
or
a
parsable
object");\n
};\n
\n
window.QueryFactory =
QueryFactory;\n
;/*jslint
indent:
2,
maxlen:
80,
sloppy:
true,
nomen:
true
*/\n
/*global
Query,
exports
*/\n
\n
\n
function
objectToSearchText(query)
{\n
/**\n
var
str_list =
[];\n
*
Filter
the
item
list
with
matching
item
only\n
if
(
query.type =
==
"complex")
{\n
*\n
str_list.push("(");\n
*
@method
exec\n
(query.query_list
||
[]).forEach(function
(sub_query)
{\n
*
@param
{Array}
item_list
The
list
of
object\n
str_list.push(objectToSearchText(sub_query));\n
*
@param
{Object}
[option]
Some
operation
option\n
str_list.push(query.operator);\n
*
@param
{Array}
[option.select_list]
A
object
keys
to
retrieve\n
});\n
*
@param
{Array}
[option.sort_on]
Couples
of
object
keys
and
"ascending"\n
str_list.length
-=
1;\n
*
or
"descending"\n
str_list.push(")");\n
*
@param
{Array}
[option.limit]
Couple
of
integer,
first
is
an
index
and\n
return
str_list.join("
");\n
*
second
is
the
length.\n
}\n
*/\n
if
(
query.type =
==
"simple")
{\n
Query.prototype.exec =
function
(item_list,
option)
{\n
return
(query.key
?
query.key
+
":
"
:
"")
+\n
if
(!Array.isArray(item_list))
{\n
(query.operator
||
"")
+
\'
"\'
+
query.value
+
\'"\';\n
throw
new
TypeError("Query().exec():
Argument
1
is
not
of
type
\'array\'");\n
}\n
}\n
throw
new
TypeError("This
object
is
not
a
query");\n
if
(
option =
==
undefined)
{\n
}\n
option =
{};\n
Query.objectToSearchText =
objectToSearchText;\n
}\n
;/*jslint
indent:
2,
maxlen:
80,
sloppy:
true,
nomen:
true
*/\n
if
(typeof
option
!==
\'object\')
{\n
/*global
Query,
inherits,
query_class_dict,
window,\n
throw
new
TypeError("Query().exec():
"
+\n
searchTextToRegExp,
RSVP
*/\n
"Optional
argument
2
is
not
of
type
\'object\'");\n
\n
}\n
var
checkKeySchema =
function
(key_schema)
{\n
var
context =
this,\n
var
prop;\n
i;\n
\n
for
(
i =
item_list.length
-
1;
i
>
= 0; i -= 1) {\n
if
(key_schema
!==
undefined)
{\n
if (!context.match(item_list[i])) {\n
if
(typeof
key_schema
!==
\'object\')
{\n
item_list.splice(i, 1);\n
throw
new
TypeError("SimpleQuery().create():
"
+\n
"key_schema
is
not
of
type
\'object\'");\n
}\n
//
key_set
is
mandatory\n
if
(
key_schema.key_set =
==
undefined)
{\n
throw
new
TypeError("SimpleQuery().create():
"
+\n
"key_schema
has
no
\'key_set\'
property");\n
}\n
for
(prop
in
key_schema)
{\n
if
(key_schema.hasOwnProperty(prop))
{\n
switch
(prop)
{\n
case
\'key_set\':\n
case
\'cast_lookup\':\n
case
\'match_lookup\':\n
break;\n
default:\n
throw
new
TypeError("SimpleQuery().create():
"
+\n
"key_schema
has
unknown
property
\'"
+
prop
+
"\'");\n
}\n
}\n
}\n
}\n
}\n
}\n
};\n
\n
\n
if (option.sort_on) {\n
sortOn(option.sort_on, item_list);\n
}\n
\n
\n
/**\n
if (option.limit) {\n
*
The
SimpleQuery
inherits
from
Query,
and
compares
one
metadata
value\n
limit(option.limit, item_list);\n
*\n
}\n
*
@class
SimpleQuery\n
*
@extends
Query\n
*
@param
{Object}
[
spec=
{}]
The
specifications\n
*
@param
{String}
[
spec.operator=
"="
]
The
compare
method
to
use\n
*
@param
{String}
spec.key
The
metadata
key\n
*
@param
{String}
spec.value
The
value
of
the
metadata
to
compare\n
*/\n
function
SimpleQuery(spec,
key_schema)
{\n
Query.call(this);\n
\n
\n
checkKeySchema(key_schema
);\n
select(option.select_list || [], item_list
);\n
\n
\n
this._key_schema =
key_schema
||
{};\n
return new RSVP.Queue()\n
.push(function () {\n
return item_list;\n
});\n
};\n
\n
\n
/**\n
/**\n
*
Operator
to
use
to
compare
object
values
\n
*
Test if an item matches this query
\n
*\n
*\n
*
@
attribute
operator
\n
* @
method match
\n
*
@
type
String
\n
* @
param {Object} item The object to test
\n
*
@
optional
\n
* @
return {Boolean} true if match, false otherwise
\n
*/\n
*/\n
this.operator =
spec.operator;\n
Query.prototype.match = function () {\n
return true;\n
};\n
\n
\n
/**\n
/**\n
*
Key
of
the
object
which
refers
to
the
value
to
compare
\n
*
Browse the Query in deep calling parser method in each step.
\n
*\n
*\n
*
@attribute
key\n
* `onParseStart` is called first, on end `onParseEnd` is called.\n
*
@type
String\n
* It starts from the simple queries at the bottom of the tree calling the\n
* parser method `onParseSimpleQuery`, and go up calling the\n
* `onParseComplexQuery` method.\n
*\n
* @method parse\n
* @param {Object} option Any options you want (except \'parsed\')\n
* @return {Any} The parse result\n
*/\n
*/\n
this.key =
spec.key;\n
Query.prototype.parse = function (option) {\n
var that = this,\n
object;\n
/**\n
* The recursive parser.\n
*\n
* @param {Object} object The object shared in the parse process\n
* @param {Object} options Some options usable in the parseMethods\n
* @return {Any} The parser result\n
*/\n
function recParse(object, option) {\n
var query = object.parsed,\n
queue = new RSVP.Queue(),\n
i;\n
\n
function enqueue(j) {\n
queue\n
.push(function () {\n
object.parsed = query.query_list[j];\n
return recParse(object, option);\n
})\n
.push(function () {\n
query.query_list[j] = object.parsed;\n
});\n
}\n
\n
if (query.type === "complex") {\n
\n
\n
for (i = 0; i
< query.query_list.length
;
i
+=
1)
{\n
enqueue(i);\n
}\n
\n
return
queue\n
.push(function
()
{\n
object.parsed =
query;\n
return
that.onParseComplexQuery(object,
option);\n
});\n
\n
}\n
if
(
query.type =
==
"simple")
{\n
return
that.onParseSimpleQuery(object,
option);\n
}\n
}\n
object =
{\n
parsed:
JSON.parse(JSON.stringify(that.serialized()))\n
};\n
return
new
RSVP.Queue()\n
.push(function
()
{\n
return
that.onParseStart(object,
option);\n
})\n
.push(function
()
{\n
return
recParse(object,
option);\n
})\n
.push(function
()
{\n
return
that.onParseEnd(object,
option);\n
})\n
.push(function
()
{\n
return
object.parsed;\n
});\n
\n
};\n
\n
\n
/**\n
/**\n
*
Value
is
used
to
do
the
comparison
with
the
object
value
\n
*
Convert
this
query
to
a
parsable
string.
\n
*\n
*\n
*
@
attribute
value
\n
*
@
method
toString
\n
*
@
type
String
\n
*
@
return
{String}
The
string
version
of
this
query
\n
*/\n
*/\n
this.value =
spec.value;\n
Query.prototype.toString =
function
()
{\n
\n
return
"";\n
}\n
};\n
inherits(SimpleQuery,
Query);\n
\n
\n
SimpleQuery.prototype.type =
"simple"
;\n
/**\n
*
Convert
this
query
to
an
jsonable
object
in
order
to
be
remake
thanks
to\n
*
QueryFactory
class.\n
*\n
*
@method
serialized\n
*
@return
{Object}
The
jsonable
object\n
*/\n
Query.prototype.serialized =
function
()
{\n
return
undefined;\n
};\n
\n
\n
var
checkKey =
function
(key)
{\n
/**\n
var
prop;\n
*
Provides
static
methods
to
create
Query
object\n
*\n
*
@class
QueryFactory\n
*/\n
function
QueryFactory()
{\n
return;\n
}\n
\n
\n
if
(
key.read_from =
==
undefined)
{\n
/**\n
throw
new
TypeError("Custom
key
is
missing
the
read_from
property");\n
*
Escapes
regexp
special
chars
from
a
string.\n
*\n
*
@param
{String}
string
The
string
to
escape\n
*
@return
{String}
The
escaped
string\n
*/\n
function
stringEscapeRegexpCharacters(string)
{\n
return
string.replace(regexp_escape,
"\\\\$&");\n
}\n
}\n
\n
\n
for
(prop
in
key)
{\n
/**\n
if
(key.hasOwnProperty(prop))
{\n
*
Inherits
the
prototype
methods
from
one
constructor
into
another.
The\n
switch
(prop)
{\n
*
prototype
of
`constructor`
will
be
set
to
a
new
object
created
from\n
case
\'read_from\':\n
*
`superConstructor`.\n
case
\'cast_to\':\n
*\n
case
\'equal_match\':\n
*
@param
{Function}
constructor
The
constructor
which
inherits
the
super
one\n
break;\n
*
@param
{Function}
superConstructor
The
super
constructor\n
default:\n
*/\n
throw
new
TypeError("Custom
key
has
unknown
property
\'"
+\n
function
inherits(constructor,
superConstructor)
{\n
prop
+
"\'");\n
constructor.super_ =
superConstructor;\n
constructor.prototype =
Object.create(superConstructor.prototype,
{\n
"constructor":
{\n
"configurable":
true,\n
"enumerable":
false,\n
"writable":
true,\n
"value":
constructor\n
}\n
}\n
}\n
}
);
\n
}\n
}\n
};\n
\n
\n
\n
/**\n
/**\n
*
#crossLink
"Query/match:method"\n
*
Convert
a
search
text
to
a
regexp.\n
*/\n
*\n
SimpleQuery.prototype.match =
function
(item)
{\n
*
@param
{String}
string
The
string
to
convert\n
var
object_value =
null,\n
*
@param
{Boolean}
[
use_wildcard_character=
true]
Use
wildcard
"%"
and
"_"\n
equal_match =
null,\n
*
@return
{RegExp}
The
search
text
regexp\n
cast_to =
null,\n
*/\n
matchMethod =
null,\n
function
searchTextToRegExp(string,
use_wildcard_characters)
{\n
operator =
this.operator,\n
if
(typeof
string
!==
\'string\')
{\n
value =
null,\n
throw
new
TypeError("jioquery.searchTextToRegExp():
"
+\n
key =
this.key;\n
"Argument
1
is
not
of
type
\'string\'");\n
\n
/*jslint
regexp:
true
*/\n
if
(!(/^(?:!?=|<=?|
>
=?)$/i.test(operator))) {\n
// `operator` is not correct, we have to change it to "like" or "="\n
if (/%/.test(this.value)) {\n
// `value` contains a non escaped `%`\n
operator = "like";\n
} else {\n
// `value` does not contain non escaped `%`\n
operator = "=";\n
}\n
}\n
if
(
use_wildcard_characters =
==
false)
{\n
return
new
RegExp("^"
+
stringEscapeRegexpCharacters(string)
+
"$");\n
}\n
return
new
RegExp("^"
+
stringEscapeRegexpCharacters(string)\n
.replace(regexp_percent,
\'.*\')\n
.replace(regexp_underscore,
\'.\')
+
"$");\n
}\n
}\n
\n
\n
matchMethod = this[operator];\n
/**\n
*
The
ComplexQuery
inherits
from
Query,
and
compares
one
or
several
metadata\n
*
values.\n
*\n
*
@class
ComplexQuery\n
*
@extends
Query\n
*
@param
{Object}
[
spec=
{}]
The
specifications\n
*
@param
{String}
[
spec.operator=
"AND"
]
The
compare
method
to
use\n
*
@param
{String}
spec.key
The
metadata
key\n
*
@param
{String}
spec.value
The
value
of
the
metadata
to
compare\n
*/\n
function
ComplexQuery(spec,
key_schema)
{\n
Query.call(this);\n
\n
\n
if (this._key_schema.key_set
&&
this._key_schema.key_set[key] !== undefined) {\n
/**\n
key = this._key_schema.key_set[key];\n
*
Logical
operator
to
use
to
compare
object
values\n
}\n
*\n
*
@attribute
operator\n
*
@type
String\n
*
@default
"AND"\n
*
@optional\n
*/\n
this.operator =
spec.operator;\n
\n
/**\n
*
The
sub
Query
list
which
are
used
to
query
an
item.\n
*\n
*
@attribute
query_list\n
*
@type
Array\n
*
@default
[]\n
*
@optional\n
*/\n
this.query_list =
spec.query_list
||
[];\n
this.query_list =
this.query_list.map(\n
//
decorate
the
map
to
avoid
sending
the
index
as
key_schema
argument\n
function
(o)
{
return
QueryFactory.create(o,
key_schema);
}\n
);\n
\n
\n
if (typeof key === \'object\') {\n
}\n
checkKey(key);\n
inherits(ComplexQuery,
Query);\n
object_value = item[key.read_from];\n
\n
\n
equal_match = key.equal_match;\n
ComplexQuery.prototype.operator =
"AND"
;\n
ComplexQuery.prototype.type =
"complex"
;\n
\n
\n
// equal_match can be a string\n
/**\n
if (typeof equal_match === \'string\') {\n
*
#crossLink
"Query/match:method"\n
// XXX raise error if equal_match not in match_lookup\n
*/\n
equal_match = this._key_schema.match_lookup[equal_match];\n
ComplexQuery.prototype.match =
function
(item)
{\n
var
operator =
this.operator;\n
if
(!(regexp_operator.test(operator)))
{\n
operator =
"AND"
;\n
}\n
}\n
return
this[operator.toUpperCase()](item);\n
};\n
\n
/**\n
*
#crossLink
"Query/toString:method"\n
*/\n
ComplexQuery.prototype.toString =
function
()
{\n
var
str_list =
[],
this_operator =
this.operator;\n
if
(
this.operator =
==
"NOT")
{\n
str_list.push("NOT
(");\n
str_list.push(this.query_list[0].toString());\n
str_list.push(")");\n
return
str_list.join("
");\n
}\n
this.query_list.forEach(function
(query)
{\n
str_list.push("(");\n
str_list.push(query.toString());\n
str_list.push(")");\n
str_list.push(this_operator);\n
});\n
str_list.length
-=
1;\n
return
str_list.join("
");\n
};\n
\n
/**\n
*
#crossLink
"Query/serialized:method"\n
*/\n
ComplexQuery.prototype.serialized =
function
()
{\n
var
s =
{\n
"type":
"complex",\n
"operator":
this.operator,\n
"query_list":
[]\n
};\n
this.query_list.forEach(function
(query)
{\n
s.query_list.push(\n
typeof
query.toJSON =
==
"function"
?
query.toJSON()
:
query\n
);\n
});\n
return
s;\n
};\n
ComplexQuery.prototype.toJSON =
ComplexQuery.prototype.serialized;\n
\n
/**\n
*
Comparison
operator,
test
if
all
sub
queries
match
the\n
*
item
value\n
*\n
*
@method
AND\n
*
@param
{Object}
item
The
item
to
match\n
*
@return
{Boolean}
true
if
all
match,
false
otherwise\n
*/\n
ComplexQuery.prototype.AND =
function
(item)
{\n
var
result =
true,\n
i =
0;\n
\n
\n
// equal_match overrides the default \'=\' operator\n
while
(result
&&
(i
!==
this.query_list.length))
{\n
if (equal_match !== undefined) {\n
result =
this.query_list[i].match(item);\n
matchMethod = (operator === "=" || operator === "like" ?\n
i
+=
1;\n
equal_match : matchMethod);\n
}\n
}\n
return
result;\n
\n
\n
value = this.value;\n
};\n
cast_to = key.cast_to;\n
if (cast_to) {\n
// cast_to can be a string\n
if (typeof cast_to === \'string\') {\n
// XXX raise error if cast_to not in cast_lookup\n
cast_to = this._key_schema.cast_lookup[cast_to];\n
}\n
\n
\n
try {\n
/**\n
value = cast_to(value);\n
*
Comparison
operator,
test
if
one
of
the
sub
queries
matches
the\n
} catch (e) {\n
*
item
value\n
value = undefined;\n
*\n
}\n
*
@method
OR\n
*
@param
{Object}
item
The
item
to
match\n
*
@return
{Boolean}
true
if
one
match,
false
otherwise\n
*/\n
ComplexQuery.prototype.OR =
function
(item)
{\n
var
result =
false,\n
i =
0;\n
\n
\n
try {\n
while
((!result)
&&
(i
!==
this.query_list.length))
{\n
object_value = cast_to(object_value);\n
result =
this.query_list[i].match(item);\n
} catch (e) {\n
i
+=
1;\n
object_value = undefined;\n
}\n
}\n
}\n
} else {\n
object_value = item[key];\n
value = this.value;\n
}\n
if (object_value === undefined || value === undefined) {\n
return RSVP.resolve(false);\n
}\n
return matchMethod(object_value, value);\n
};\n
\n
\n
/**\n
return
result;\n
* #crossLink "Query/toString:method"\n
};\n
*/\n
SimpleQuery.prototype.toString = function () {\n
return (this.key ? this.key + ":" : "") +\n
(this.operator ? " " + this.operator : "") + \' "\' + this.value + \'"\';\n
};\n
\n
\n
/**\n
/**\n
* #crossLink "Query/serialized:method"\n
*
Comparison
operator,
test
if
the
sub
query
does
not
match
the\n
*/\n
*
item
value\n
SimpleQuery.prototype.serialized = function () {\n
*\n
var object = {\n
*
@method
NOT\n
"type": "simple",\n
*
@param
{Object}
item
The
item
to
match\n
"key": this.key,\n
*
@return
{Boolean}
true
if
one
match,
false
otherwise\n
"value": this.value\n
*/\n
};\n
ComplexQuery.prototype.NOT =
function
(item)
{\n
if (this.operator !== undefined) {\n
return
!this.query_list[0].match(item);\n
object.operator = this.operator;\n
};\n
}\n
return object;\n
};\n
SimpleQuery.prototype.toJSON = SimpleQuery.prototype.serialized;\n
\n
\n
/**\n
/**\n
* Comparison operator, test if this query value matches the item value\n
*
Creates
Query
object
from
a
search
text
string
or
a
serialized
version\n
*\n
*
of
a
Query.\n
* @method =\n
*\n
* @param {String} object_value The value to compare\n
*
@method
create\n
* @param {String} comparison_value The comparison value\n
*
@static\n
* @return {Boolean} true if match, false otherwise\n
*
@param
{Object,String}
object
The
search
text
or
the
serialized
version\n
*/\n
*
of
a
Query\n
SimpleQuery.prototype["="] = function (object_value, comparison_value) {\n
*
@return
{Query}
A
Query
object\n
var value, i;\n
*/\n
if (!Array.isArray(object_value)) {\n
QueryFactory.create =
function
(object,
key_schema)
{\n
object_value = [object_value];\n
if
(
object =
==
"")
{\n
}\n
return
new
Query();\n
for (i = 0; i
< object_value.length
;
i
+=
1)
{\n
value =
object_value[i];\n
if
(typeof
value =
==
\'object\'
&&
value.hasOwnProperty(\'content\'))
{\n
value =
value.content;\n
}\n
}\n
if
(typeof
value.cmp =
==
"function
")
{\n
if
(typeof
object =
==
"string
")
{\n
return
RSVP.resolve(value.cmp(comparison_value)
===
0
);\n
object =
parseStringToObject(object
);\n
}\n
}\n
if
(\n
if
(typeof
(object
||
{})
.type =
==
"string"
&&\n
searchTextToRegExp(comparison_value.toString(),
false).\n
query_class_dict[object.type])
{\n
test(value.toString())\n
return
new
query_class_dict[object.type](object,
key_schema);\n
)
{\n
return
RSVP.resolve(true);\n
}\n
}\n
}
\n
throw
new
TypeError("QueryFactory.create():
"
+
\n
return
RSVP.resolve(false
);\n
"Argument
1
is
not
a
search
text
or
a
parsable
object"
);\n
};\n
};\n
\n
\n
/**\n
function
objectToSearchText(query)
{\n
*
Comparison
operator,
test
if
this
query
value
matches
the
item
value\n
var
str_list =
[];\n
*\n
if
(
query.type =
==
"complex")
{\n
*
@method
like\n
str_list.push("(");\n
*
@param
{String}
object_value
The
value
to
compare\n
(query.query_list
||
[]).forEach(function
(sub_query)
{\n
*
@param
{String}
comparison_value
The
comparison
value\n
str_list.push(objectToSearchText(sub_query));\n
*
@return
{Boolean}
true
if
match,
false
otherwise\n
str_list.push(query.operator);\n
*/\n
});\n
SimpleQuery.prototype.like =
function
(object_value,
comparison_value)
{\n
str_list.length
-=
1;\n
var
value,
i;\n
str_list.push(")");\n
if
(!Array.isArray(object_value))
{\n
return
str_list.join("
");\n
object_value =
[object_value];\n
}\n
for
(
i =
0;
i
<
object_value.length;
i
+=
1)
{\n
value =
object_value[i];\n
if
(typeof
value =
==
\'object\'
&&
value.hasOwnProperty(\'content\'))
{\n
value =
value.content;\n
}\n
}\n
if
(typeof
value.cmp =
==
"function")
{\n
if
(
query.type =
==
"simple")
{\n
return
RSVP.resolve(value.cmp(comparison_value)
===
0);\n
return
(query.key
?
query.key
+
":
"
:
"")
+\n
(query.operator
||
"")
+
\'
"\'
+
query.value
+
\'"\';\n
}\n
}\n
if
(\n
throw
new
TypeError("This
object
is
not
a
query");\n
searchTextToRegExp(comparison_value.toString()).test(value.toString())\n
}\n
)
{\n
\n
return
RSVP.resolve(true);\n
function
checkKeySchema(key_schema)
{\n
var
prop;\n
\n
if
(key_schema
!==
undefined)
{\n
if
(typeof
key_schema
!==
\'object\')
{\n
throw
new
TypeError("SimpleQuery().create():
"
+\n
"key_schema
is
not
of
type
\'object\'");\n
}\n
//
key_set
is
mandatory\n
if
(
key_schema.key_set =
==
undefined)
{\n
throw
new
TypeError("SimpleQuery().create():
"
+\n
"key_schema
has
no
\'key_set\'
property");\n
}\n
for
(prop
in
key_schema)
{\n
if
(key_schema.hasOwnProperty(prop))
{\n
switch
(prop)
{\n
case
\'key_set\':\n
case
\'cast_lookup\':\n
case
\'match_lookup\':\n
break;\n
default:\n
throw
new
TypeError("SimpleQuery().create():
"
+\n
"key_schema
has
unknown
property
\'"
+
prop
+
"\'");\n
}\n
}\n
}\n
}\n
}\n
}\n
}\n
return
RSVP.resolve(false);\n
};\n
\n
\n
/**\n
/**\n
*
Comparison
operator,
test
if
this
query
value
does
not
match
the
item
value\n
*
The
SimpleQuery
inherits
from
Query,
and
compares
one
metadata
value\n
*\n
*\n
*
@method
!=\n
*
@class
SimpleQuery\n
*
@param
{String}
object_value
The
value
to
compare\n
*
@extends
Query\n
*
@param
{String}
comparison_value
The
comparison
value\n
*
@param
{Object}
[
spec=
{}]
The
specifications\n
*
@return
{Boolean}
true
if
not
match,
false
otherwise\n
*
@param
{String}
[
spec.operator=
"="
]
The
compare
method
to
use\n
*/\n
*
@param
{String}
spec.key
The
metadata
key\n
SimpleQuery.prototype["!="]
=
function
(object_value,
comparison_value)
{\n
*
@param
{String}
spec.value
The
value
of
the
metadata
to
compare\n
var
value,
i;\n
*/\n
if
(!Array.isArray(object_value))
{\n
function
SimpleQuery(spec,
key_schema)
{\n
object_value =
[object_value];\n
Query.call(this);\n
\n
checkKeySchema(key_schema);\n
\n
this._key_schema =
key_schema
||
{};\n
\n
/**\n
*
Operator
to
use
to
compare
object
values\n
*\n
*
@attribute
operator\n
*
@type
String\n
*
@optional\n
*/\n
this.operator =
spec.operator;\n
\n
/**\n
*
Key
of
the
object
which
refers
to
the
value
to
compare\n
*\n
*
@attribute
key\n
*
@type
String\n
*/\n
this.key =
spec.key;\n
\n
/**\n
*
Value
is
used
to
do
the
comparison
with
the
object
value\n
*\n
*
@attribute
value\n
*
@type
String\n
*/\n
this.value =
spec.value;\n
\n
}\n
}\n
for
(
i =
0;
i
<
object_value.length;
i
+=
1)
{\n
inherits(SimpleQuery,
Query);\n
value =
object_value[i];\n
\n
if
(typeof
value =
==
\'object\'
&&
value.hasOwnProperty(\'content\'))
{\n
SimpleQuery.prototype.type =
"simple"
;\n
value =
value.content;\n
\n
}\n
function
checkKey(key)
{\n
if
(typeof
value.cmp =
==
"function")
{\n
var
prop;\n
return
RSVP.resolve(value.cmp(comparison_value)
!==
0);\n
\n
if
(
key.read_from =
==
undefined)
{\n
throw
new
TypeError("Custom
key
is
missing
the
read_from
property");\n
}\n
}\n
if
(\n
\n
searchTextToRegExp(comparison_value.toString(),
false).\n
for
(prop
in
key)
{\n
test(value.toString())\n
if
(key.hasOwnProperty(prop))
{\n
)
{\n
switch
(prop)
{\n
return
RSVP.resolve(false);\n
case
\'read_from\':\n
case
\'cast_to\':\n
case
\'equal_match\':\n
break;\n
default:\n
throw
new
TypeError("Custom
key
has
unknown
property
\'"
+\n
prop
+
"\'");\n
}\n
}\n
}\n
}\n
}\n
}\n
return
RSVP.resolve(true);\n
};\n
\n
\n
/**\n
/**\n
*
Comparison
operator,
test
if
this
query
value
is
lower
than
the
item
value
\n
*
#crossLink
"Query/match:method"
\n
*
\n
*/
\n
*
@method
<
\n
SimpleQuery.prototype.match =
function
(item)
{
\n
*
@param
{Number,
String}
object_value
The
value
to
compare
\n
var
object_value =
null,
\n
*
@param
{Number,
String}
comparison_value
The
comparison
value
\n
equal_match =
null,
\n
*
@return
{Boolean}
true
if
lower,
false
otherwise
\n
cast_to =
null,
\n
*/
\n
matchMethod =
null,
\n
SimpleQuery.prototype["<"]
=
function
(object_value,
comparison_value)
{
\n
operator =
this.operator,
\n
var
value;
\n
value =
null,
\n
if
(!Array.isArray(object_value))
{
\n
key =
this.key;
\n
object_value =
[object_value];
\n
\n
}
\n
if
(!(regexp_comparaison.test(operator)))
{
\n
value =
object_value[0];
\n
//
`operator`
is
not
correct,
we
have
to
change
it
to
"like"
or
"="
\n
if
(typeof
value =
==
\'object\'
&&
value.hasOwnProperty(\'content\'
))
{\n
if
(regexp_percent.test(this.value
))
{\n
value =
value.content;
\n
//
`value`
contains
a
non
escaped
`%`
\n
}
\n
operator =
"like"
;
\n
if
(typeof
value.cmp =
==
"function")
{\n
}
else
{\n
return
RSVP.resolve(value.cmp(comparison_value)
<
0);
\n
//
`value`
does
not
contain
non
escaped
`%`
\n
}
\n
operator =
"="
;
\n
return
RSVP.resolve(value
<
comparison_value);
\n
}
\n
};
\n
}
\n
\n
\n
/**\n
matchMethod =
this[operator];\n
*
Comparison
operator,
test
if
this
query
value
is
equal
or
lower
than
the\n
*
item
value\n
*\n
*
@method
<=\n
*
@param
{Number,
String}
object_value
The
value
to
compare\n
*
@param
{Number,
String}
comparison_value
The
comparison
value\n
*
@return
{Boolean}
true
if
equal
or
lower,
false
otherwise\n
*/\n
SimpleQuery.prototype["<="]
=
function
(object_value,
comparison_value)
{\n
var
value;\n
if
(!Array.isArray(object_value))
{\n
object_value =
[object_value];\n
}\n
value =
object_value[0];\n
if
(typeof
value =
==
\'object\'
&&
value.hasOwnProperty(\'content\'))
{\n
value =
value.content;\n
}\n
if
(typeof
value.cmp =
==
"function")
{\n
return
RSVP.resolve(value.cmp(comparison_value)
<=
0);\n
}\n
return
RSVP.resolve(value
<=
comparison_value);\n
};\n
\n
\n
/**\n
if
(this._key_schema.key_set
&&
this._key_schema.key_set[key]
!==
undefined)
{\n
*
Comparison
operator,
test
if
this
query
value
is
greater
than
the
item\n
key =
this._key_schema.key_set[key];\n
*
value\n
}\n
*\n
*
@method
>
\n
* @param {Number, String} object_value The value to compare\n
* @param {Number, String} comparison_value The comparison value\n
* @return {Boolean} true if greater, false otherwise\n
*/\n
SimpleQuery.prototype[">"] = function (object_value, comparison_value) {\n
var value;\n
if (!Array.isArray(object_value)) {\n
object_value = [object_value];\n
}\n
value = object_value[0];\n
if (typeof value === \'object\'
&&
value.hasOwnProperty(\'content\')) {\n
value = value.content;\n
}\n
if (typeof value.cmp === "function") {\n
return RSVP.resolve(value.cmp(comparison_value) > 0);\n
}\n
return RSVP.resolve(value > comparison_value);\n
};\n
\n
\n
/**\n
if
(typeof
key =
==
\'object\')
{\n
* Comparison operator, test if this query value is equal or greater than the\n
checkKey(key);\n
* item value\n
object_value =
item[key.read_from];\n
*\n
* @method >=\n
* @param {Number, String} object_value The value to compare\n
* @param {Number, String} comparison_value The comparison value\n
* @return {Boolean} true if equal or greater, false otherwise\n
*/\n
SimpleQuery.prototype[">="] = function (object_value, comparison_value) {\n
var value;\n
if (!Array.isArray(object_value)) {\n
object_value = [object_value];\n
}\n
value = object_value[0];\n
if (typeof value === \'object\'
&&
value.hasOwnProperty(\'content\')) {\n
value = value.content;\n
}\n
if (typeof value.cmp === "function") {\n
return RSVP.resolve(value.cmp(comparison_value) >= 0);\n
}\n
return RSVP.resolve(value >= comparison_value);\n
};\n
\n
\n
query_class_dict.simple = SimpleQuery
;\n
equal_match =
key.equal_match
;\n
\n
\n
window.SimpleQuery = SimpleQuery;\n
//
equal_match
can
be
a
string\n
;/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true */\n
if
(typeof
equal_match =
==
\'string\')
{\n
/*global Query, RSVP, deepClone */\n
//
XXX
raise
error
if
equal_match
not
in
match_lookup\n
equal_match =
this._key_schema.match_lookup[equal_match];\n
}\n
\n
\n
/**\n
//
equal_match
overrides
the
default
\'=\'
operator\n
* Escapes regexp special chars from a string.\n
if
(equal_match
!==
undefined)
{\n
*\n
matchMethod =
(operator
===
"="
||
operator =
==
"like"
?\n
* @param {String} string The string to escape\n
equal_match
:
matchMethod);\n
* @return {String} The escaped string\n
}\n
*/\n
function stringEscapeRegexpCharacters(string) {\n
if (typeof string === "string") {\n
return string.replace(/([\\\\\\.\\$\\[\\]\\(\\)\\{\\}\\^\\?\\*\\+\\-])/g, "\\\\$1");\n
}\n
throw new TypeError("Query.stringEscapeRegexpCharacters(): " +\n
"Argument no 1 is not of type \'string\'");\n
}\n
\n
\n
Query.stringEscapeRegexpCharacters = stringEscapeRegexpCharacters;\n
value =
this.value;\n
cast_to =
key.cast_to;\n
if
(cast_to)
{\n
//
cast_to
can
be
a
string\n
if
(typeof
cast_to =
==
\'string\')
{\n
//
XXX
raise
error
if
cast_to
not
in
cast_lookup\n
cast_to =
this._key_schema.cast_lookup[cast_to];\n
}\n
\n
\n
/**\n
try
{\n
* Convert metadata values to array of strings. ex:\n
value =
cast_to(value);\n
*\n
}
catch
(e)
{\n
* "a" -> ["a"],\n
value =
undefined;\n
* {"content": "a"} -> ["a"]\n
}\n
*\n
\n
* @param {Any} value The metadata value\n
try
{\n
* @return {Array} The value in string array format\n
object_value =
cast_to(object_value);\n
*/\n
}
catch
(e)
{\n
function metadataValueToStringArray(value) {\n
object_value =
undefined;\n
var i, new_value = [];\n
}\n
if (value === undefined) {\n
}\n
return undefined;\n
}\n
if (!Array.isArray(value)) {\n
value = [value];\n
}\n
for (i = 0; i
< value.length
;
i
+=
1)
{\n
if
(typeof
value[i]
===
\'object\')
{\n
new_value[i]
=
value[i].content;\n
}
else
{\n
}
else
{\n
new_value[i]
=
value[i];\n
object_value =
item[key];\n
value =
this.value;\n
}\n
}\n
}\n
if
(
object_value =
==
undefined
||
value =
==
undefined)
{\n
return
new_value;\n
return
false;\n
}\n
}\n
return
matchMethod(object_value,
value);\n
};\n
\n
\n
/**\n
/**\n
*
A
sort
function
to
sort
items
by
key\n
*
#crossLink
"Query/toString:method"\n
*\n
*/\n
*
@param
{String}
key
The
key
to
sort
on\n
SimpleQuery.prototype.toString =
function
()
{\n
*
@param
{String}
[
way=
"ascending"
]
\'ascending\'
or
\'descending\'\n
return
(this.key
?
this.key
+
":"
:
"")
+\n
*
@return
{Function}
The
sort
function\n
(this.operator
?
"
"
+
this.operator
:
"")
+
\'
"\'
+
this.value
+
\'"\';\n
*/\n
};\n
function
sortFunction(key,
way)
{\n
\n
var
result;\n
/**\n
if
(
way =
==
\'descending\')
{\n
*
#crossLink
"Query/serialized:method"\n
result =
1;\n
*/\n
}
else
if
(
way =
==
\'ascending\')
{\n
SimpleQuery.prototype.serialized =
function
()
{\n
result =
-1;\n
var
object =
{\n
}
else
{\n
"type":
"simple",\n
throw
new
TypeError("Query.sortFunction():
"
+\n
"key":
this.key,\n
"Argument
2
must
be
\'ascending\'
or
\'descending\'");\n
"value":
this.value\n
}\n
};\n
return
function
(a,
b)
{\n
if
(this.operator
!==
undefined)
{\n
//
this
comparison
is
5
times
faster
than
json
comparison\n
object.operator =
this.operator;\n
var
i,
l;\n
}\n
a =
metadataValueToStringArray(a[key])
||
[];\n
return
object;\n
b =
metadataValueToStringArray(b[key])
||
[];\n
};\n
l =
a.length
>
b.length ? a.length : b.length;\n
SimpleQuery.prototype.toJSON =
SimpleQuery.prototype.serialized;\n
for (i = 0; i
< l
;
i
+=
1)
{\n
\n
if
(a[i]
===
undefined)
{\n
/**\n
return
result;\n
*
Comparison
operator,
test
if
this
query
value
matches
the
item
value\n
}\n
*\n
if
(b[i]
===
undefined)
{\n
*
@
method =
\n
return
-result;\n
*
@param
{String}
object_value
The
value
to
compare\n
*
@param
{String}
comparison_value
The
comparison
value\n
*
@return
{Boolean}
true
if
match,
false
otherwise\n
*/\n
SimpleQuery.prototype["="]
=
function
(object_value,
comparison_value)
{\n
var
value,
i;\n
if
(!Array.isArray(object_value))
{\n
object_value =
[object_value];\n
}\n
for
(
i =
0;
i
<
object_value.length;
i
+=
1)
{\n
value =
object_value[i];\n
if
(typeof
value =
==
\'object\'
&&
value.hasOwnProperty(\'content\'))
{\n
value =
value.content;\n
}\n
}\n
if
(
a[i]
>
b[i]
) {\n
if
(
typeof
value.cmp =
==
"function"
)
{\n
return
-result
;\n
return
(value.cmp(comparison_value)
===
0)
;\n
}\n
}\n
if (
a[i]
< b
[i]
)
{\n
if
(
comparison_value.toString()
===
value.toString()
)
{\n
return
result
;\n
return
true
;\n
}\n
}\n
}\n
}\n
return
0
;\n
return
false
;\n
};\n
};\n
}\n
\n
\n
/**\n
/**\n
*
Inherits
the
prototype
methods
from
one
constructor
into
another.
The\n
*
Comparison
operator,
test
if
this
query
value
matches
the
item
value\n
*
prototype
of
`constructor`
will
be
set
to
a
new
object
created
from\n
*\n
*
`superConstructor`.\n
*
@method
like\n
*\n
*
@param
{String}
object_value
The
value
to
compare\n
*
@param
{Function}
constructor
The
constructor
which
inherits
the
super
one\n
*
@param
{String}
comparison_value
The
comparison
value\n
*
@param
{Function}
superConstructor
The
super
constructor\n
*
@return
{Boolean}
true
if
match,
false
otherwise\n
*/\n
*/\n
function
inherits(constructor,
superConstructor)
{\n
SimpleQuery.prototype.like =
function
(object_value,
comparison_value)
{\n
constructor.super_ =
superConstructor;\n
var
value,
i;\n
constructor.prototype =
Object.create(superConstructor.prototype,
{\n
if
(!Array.isArray(object_value))
{\n
"constructor":
{\n
object_value =
[object_value];\n
"configurable":
true,\n
}\n
"enumerable":
false,\n
for
(
i =
0;
i
<
object_value.length;
i
+=
1)
{\n
"writable":
true,\n
value =
object_value[i];\n
"value":
constructor\n
if
(typeof
value =
==
\'object\'
&&
value.hasOwnProperty(\'content\'))
{\n
value =
value.content;\n
}\n
if
(typeof
value.cmp =
==
"function")
{\n
return
(value.cmp(comparison_value)
===
0);\n
}\n
if
(\n
searchTextToRegExp(comparison_value.toString()).test(value.toString())\n
)
{\n
return
true;\n
}\n
}\n
}\n
});\n
return
false;\n
}\n
};\n
\n
/**\n
*
Does
nothing\n
*/\n
function
emptyFunction()
{\n
return;\n
}\n
\n
\n
/**\n
/**\n
*
Filter
a
list
of
items,
modifying
them
to
select
only
wanted
keys.
If\n
*
Comparison
operator,
test
if
this
query
value
does
not
match
the
item
value\n
*
`clone`
is
true,
then
the
method
will
act
on
a
cloned
list.\n
*\n
*\n
*
@method
!=\n
*
@param
{Array}
select_option
Key
list
to
keep\n
*
@param
{String}
object_value
The
value
to
compare\n
*
@param
{Array}
list
The
item
list
to
filter\n
*
@param
{String}
comparison_value
The
comparison
value\n
*
@param
{Boolean}
[
clone=
false]
If
true,
modifies
a
clone
of
the
list\n
*
@return
{Boolean}
true
if
not
match,
false
otherwise\n
*
@return
{Array}
The
filtered
list\n
*/\n
*/\n
SimpleQuery.prototype["!="]
=
function
(object_value,
comparison_value)
{\n
function
select(select_option,
list,
clone)
{\n
var
value,
i;\n
var
i,
j,
new_item;\n
if
(!Array.isArray(object_value))
{\n
if
(!Array.isArray(select_option))
{\n
object_value =
[object_value];\n
throw
new
TypeError("jioquery.select():
"
+\n
}\n
"Argument
1
is
not
of
type
Array");\n
for
(
i =
0;
i
<
object_value.length;
i
+=
1)
{\n
}\n
value =
object_value[i];\n
if
(!Array.isArray(list))
{\n
if
(typeof
value =
==
\'object\'
&&
value.hasOwnProperty(\'content\'))
{\n
throw
new
TypeError("jioquery.select():
"
+\n
value =
value.content;\n
"Argument
2
is
not
of
type
Array");\n
}\n
if
(
clone =
==
true)
{\n
list =
deepClone(list);\n
}\n
for
(
i =
0;
i
<
list.length;
i
+=
1)
{\n
new_item =
{};\n
for
(
j =
0;
j
<
select_option.length;
j
+=
1)
{\n
if
(list[i].hasOwnProperty([select_option[j]]))
{\n
new_item[select_option[j]]
=
list[i][select_option[j]];\n
}\n
}\n
}
\n
if
(typeof
value.cmp =
==
"function")
{
\n
for
(j
in
new_item)
{
\n
return
(value.cmp(comparison_value)
!==
0);
\n
if
(new_item.hasOwnProperty(j))
{
\n
}
\n
list[i]
=
new_item;
\n
if
(comparison_value.toString()
===
value.toString())
{
\n
break
;\n
return
false
;\n
}\n
}\n
}\n
}\n
}\n
return
true;\n
return
list;\n
};\n
}\n
\n
\n
Query.select =
select;\n
/**\n
*
Comparison
operator,
test
if
this
query
value
is
lower
than
the
item
value\n
*\n
*
@method
<\n
*
@param
{Number,
String}
object_value
The
value
to
compare\n
*
@param
{Number,
String}
comparison_value
The
comparison
value\n
*
@return
{Boolean}
true
if
lower,
false
otherwise\n
*/\n
SimpleQuery.prototype["<"]
=
function
(object_value,
comparison_value)
{\n
var
value;\n
if
(!Array.isArray(object_value))
{\n
object_value =
[object_value];\n
}\n
value =
object_value[0];\n
if
(typeof
value =
==
\'object\'
&&
value.hasOwnProperty(\'content\'))
{\n
value =
value.content;\n
}\n
if
(typeof
value.cmp =
==
"function")
{\n
return
(value.cmp(comparison_value)
<
0);\n
}\n
return
(value
<
comparison_value);\n
};\n
\n
\n
/**\n
/**\n
*
Sort
a
list
of
items,
according
to
keys
and
directions.
If
`clone`
is
true,\n
*
Comparison
operator,
test
if
this
query
value
is
equal
or
lower
than
the\n
*
then
the
method
will
act
on
a
cloned
list.\n
*
item
value\n
*\n
*\n
*
@param
{Array}
sort_on_option
List
of
couples
[key,
direction]\n
*
@method
<=\n
*
@param
{Array}
list
The
item
list
to
sort\n
*
@param
{Number,
String}
object_value
The
value
to
compare\n
*
@param
{Boolean}
[
clone=
false]
If
true,
modifies
a
clone
of
the
list\n
*
@param
{Number,
String}
comparison_value
The
comparison
value\n
*
@return
{Array}
The
filtered
list\n
*
@return
{Boolean}
true
if
equal
or
lower,
false
otherwise\n
*/\n
*/\n
function
sortOn(sort_on_option,
list,
clone)
{\n
SimpleQuery.prototype["<="]
=
function
(object_value,
comparison_value)
{\n
var
sort_index;\n
var
value;\n
if
(!Array.isArray(sort_on_option))
{\n
if
(!Array.isArray(object_value))
{\n
throw
new
TypeError("jioquery.sortOn():
"
+\n
object_value =
[object_value];\n
"Argument
1
is
not
of
type
\'array\'");\n
}\n
}\n
value =
object_value[0];\n
if
(clone)
{\n
if
(typeof
value =
==
\'object\'
&&
value.hasOwnProperty(\'content\'))
{\n
list =
deepClone(list);\n
value =
value.content;\n
}\n
}\n
for
(
sort_index =
sort_on_option.length
-
1;
sort_index
>
= 0;\n
if
(typeof
value.cmp =
==
"function")
{\n
sort_index -= 1) {\n
return
(value.cmp(comparison_value)
<=
0);\n
list.sort(sortFunction(\n
}\n
sort_on_option[sort_index][0],\n
return
(value
<=
comparison_value);\n
sort_on_option[sort_index][1]\n
};\n
));\n
}\n
return list;\n
}\n
\n
\n
Query.sortOn = sortOn;\n
/**\n
*
Comparison
operator,
test
if
this
query
value
is
greater
than
the
item\n
*
value\n
*\n
*
@method
>
\n
* @param {Number, String} object_value The value to compare\n
* @param {Number, String} comparison_value The comparison value\n
* @return {Boolean} true if greater, false otherwise\n
*/\n
SimpleQuery.prototype[">"] = function (object_value, comparison_value) {\n
var value;\n
if (!Array.isArray(object_value)) {\n
object_value = [object_value];\n
}\n
value = object_value[0];\n
if (typeof value === \'object\'
&&
value.hasOwnProperty(\'content\')) {\n
value = value.content;\n
}\n
if (typeof value.cmp === "function") {\n
return (value.cmp(comparison_value) > 0);\n
}\n
return (value > comparison_value);\n
};\n
\n
\n
/**\n
/**\n
* Limit a list of items, according to index and length. If `clone` is true,\n
* Comparison operator, test if this query value is equal or greater than the\n
* then the method will act on a cloned list.\n
* item value\n
*\n
*\n
* @param {Array} limit_option A couple [from, length]\n
* @method >=\n
* @param {Array} list The item list to limit\n
* @param {Number, String} object_value The value to compare\n
* @param {Boolean} [clone=false] If true, modifies a clone of the list\n
* @param {Number, String} comparison_value The comparison value\n
* @return {Array} The filtered list\n
* @return {Boolean} true if equal or greater, false otherwise\n
*/\n
*/\n
function limit(limit_option, list, clone) {\n
SimpleQuery.prototype[">="] = function (object_value, comparison_value) {\n
if (!Array.isArray(limit_option)) {\n
var value;\n
throw new TypeError("jioquery.limit(): " +\n
if (!Array.isArray(object_value)) {\n
"Argument 1 is not of type \'array\'");\n
object_value = [object_value];\n
}\n
}\n
if (!Array.isArray(list)) {\n
value = object_value[0];\n
throw new TypeError("jioquery.limit(): " +\n
if (typeof value === \'object\'
&&
value.hasOwnProperty(\'content\')) {\n
"Argument 2 is not of type \'array\'");\n
value = value.content;\n
}\n
}\n
if (clone) {\n
if (typeof value.cmp === "function") {\n
list = deepClone(list);\n
return (value.cmp(comparison_value) >= 0);\n
}\n
}\n
list.splice(0, limit_option[0]);\n
return (value >= comparison_value);\n
if (limit_option[1]) {\n
};\n
list.splice(limit_option[1]);\n
}\n
return list;\n
}\n
\n
\n
Query.limit = limit;\n
query_class_dict.simple = SimpleQuery;\n
query_class_dict.complex = ComplexQuery;\n
\n
\n
/**\n
Query.parseStringToObject = parseStringToObject;\n
* Convert a search text to a regexp.\n
Query.objectToSearchText = objectToSearchText;\n
*\n
\n
* @param {String} string The string to convert\n
window.Query = Query;\n
* @param {Boolean} [use_wildcard_character=true] Use wildcard "%" and "_"\n
window.SimpleQuery = SimpleQuery;\n
* @return {RegExp} The search text regexp\n
window.ComplexQuery = ComplexQuery;\n
*/\n
window.QueryFactory = QueryFactory;\n
function searchTextToRegExp(string, use_wildcard_characters) {\n
if (typeof string !== \'string\') {\n
throw new TypeError("jioquery.searchTextToRegExp(): " +\n
"Argument 1 is not of type \'string\'");\n
}\n
if (use_wildcard_characters === false) {\n
return new RegExp("^" + stringEscapeRegexpCharacters(string) + "$");\n
}\n
return new RegExp("^" + stringEscapeRegexpCharacters(string).replace(\n
/%/g,\n
".*"\n
).replace(\n
/_/g,\n
"."\n
) + "$");\n
}\n
\n
\n
Query.searchTextToRegExp = searchTextToRegExp
;\n
}(RSVP, window, parseStringToObject))
;\n
;/*global window, moment */\n
;/*global window, moment */\n
/*jslint nomen: true, maxlen: 200*/\n
/*jslint nomen: true, maxlen: 200*/\n
(function (window, moment) {\n
(function (window, moment) {\n
...
@@ -6058,70 +5949,6 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
...
@@ -6058,70 +5949,6 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
});\n
});\n
}\n
}\n
util.ajax = ajax;\n
util.ajax = ajax;\n
\n
/**\n
* Clones all native object in deep. Managed types: Object, Array, String,\n
* Number, Boolean, Function, null.\n
*\n
* It can also clone object which are serializable, like Date.\n
*\n
* To make a class serializable, you need to implement the `toJSON` function\n
* which returns a JSON representation of the object. The returned value is\n
* used as first parameter of the object constructor.\n
*\n
* @param {A} object The object to clone\n
* @return {A} The cloned object\n
*/\n
function deepClone(object) {\n
var i, cloned;\n
if (Array.isArray(object)) {\n
cloned = [];\n
for (i = 0; i
< object.length
;
i
+=
1)
{\n
cloned[i]
=
deepClone(object[i]);\n
}\n
return
cloned;\n
}\n
if
(
object =
==
null)
{\n
return
null;\n
}\n
if
(typeof
object =
==
\'object\')
{\n
if
(Object.getPrototypeOf(object)
===
Object.prototype)
{\n
cloned =
{};\n
for
(i
in
object)
{\n
if
(object.hasOwnProperty(i))
{\n
cloned[i]
=
deepClone(object[i]);\n
}\n
}\n
return
cloned;\n
}\n
if
(object
instanceof
Date)
{\n
//
XXX
this
block
is
to
enable
phantomjs
and
browsers
compatibility
with\n
//
Date.prototype.toJSON
when
it
is
an
invalid
date.
In
phantomjs,
it\n
//
returns
`"Invalid
Date"`
but
in
browsers
it
returns
`null`.
In\n
//
browsers,
giving
`null`
as
parameter
to
`new
Date()`
doesn\'t
return\n
//
an
invalid
date.\n
\n
//
Cloning
a
date
with
`return
new
Date(object)`
has
problems
on\n
//
Firefox.\n
//
I
don\'t
know
why...
(Tested
on
Firefox
23)\n
\n
if
(isFinite(object.getTime()))
{\n
return
new
Date(object.toJSON());\n
}\n
return
new
Date("Invalid
Date");\n
}\n
//
clone
serializable
objects\n
if
(typeof
object.toJSON =
==
\'function\')
{\n
return
new
(Object.getPrototypeOf(object).constructor)(object.toJSON());\n
}\n
//
cannot
clone\n
return
object;\n
}\n
return
object;\n
}\n
util.deepClone =
deepClone;\n
\n
\n
\n
\n
function readBlobAsText(blob, encoding) {\n
function readBlobAsText(blob, encoding) {\n
var fr = new FileReader();\n
var fr = new FileReader();\n
...
@@ -7634,13 +7461,13 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
...
@@ -7634,13 +7461,13 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
attachments:
{}\n
attachments:
{}\n
};\n
};\n
}\n
}\n
this._database[id]
.doc =
JSON.stringify(metadata)
;\n
this._database[id]
.doc =
metadata
;\n
return
id;\n
return
id;\n
};\n
};\n
\n
\n
MemoryStorage.prototype.get =
function
(id)
{\n
MemoryStorage.prototype.get =
function
(id)
{\n
try
{\n
try
{\n
return
JSON.parse(this._database[id].doc)
;\n
return
this._database[id].doc
;\n
}
catch
(error)
{\n
}
catch
(error)
{\n
if
(error
instanceof
TypeError)
{\n
if
(error
instanceof
TypeError)
{\n
throw
new
jIO.util.jIOError(\n
throw
new
jIO.util.jIOError(\n
...
@@ -7728,18 +7555,26 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
...
@@ -7728,18 +7555,26 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
\n
\n
\n
\n
MemoryStorage.prototype.hasCapacity =
function
(name)
{\n
MemoryStorage.prototype.hasCapacity =
function
(name)
{\n
return
(
name =
==
"list"
);\n
return
(
(
name =
==
"list")
||
(
name =
==
"include")
);\n
};\n
};\n
\n
\n
MemoryStorage.prototype.buildQuery =
function
()
{\n
MemoryStorage.prototype.buildQuery =
function
(
options
)
{\n
var
rows =
[],\n
var
rows =
[],\n
i;\n
i;\n
for
(i
in
this._database)
{\n
for
(i
in
this._database)
{\n
if
(this._database.hasOwnProperty(i))
{\n
if
(this._database.hasOwnProperty(i))
{\n
rows.push({\n
if
(
options.include_docs =
==
true)
{\n
id:
i,\n
rows.push({\n
value:
{}\n
id:
i,\n
});\n
value:
{},\n
doc:
this._database[i]\n
});\n
}
else
{\n
rows.push({\n
id:
i,\n
value:
{}\n
});\n
}\n
\n
\n
}\n
}\n
}\n
}\n
...
@@ -8731,6 +8566,250 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
...
@@ -8731,6 +8566,250 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
jIO.addStorage(\'dav\',
DavStorage);\n
jIO.addStorage(\'dav\',
DavStorage);\n
\n
\n
}(jIO,
RSVP,
DOMParser,
Blob));\n
}(jIO,
RSVP,
DOMParser,
Blob));\n
;/*\n
*
Copyright
2015,
Nexedi
SA\n
*
Released
under
the
LGPL
license.\n
*
http://www.gnu.org/licenses/lgpl.html\n
*/\n
/**\n
*
JIO
Google
Drive
Storage.
Type =
"gdrive"
.\n
*
Google
Drive
"database"
storage.\n
*/\n
/*global
jIO,
Blob,
RSVP,
UriTemplate,
JSON*/\n
/*jslint
nomen:
true*/\n
\n
(function
(jIO,
Blob,
RSVP,
UriTemplate,
JSON)
{\n
"use
strict";\n
\n
var
UPLOAD_URL =
"https://www.googleapis.com{/upload}/drive/v2/files{/id}"
+\n
"{?uploadType,access_token}",\n
upload_template =
UriTemplate.parse(UPLOAD_URL),\n
REMOVE_URL =
"https://www.googleapis.com/drive/v2/"
+\n
"files{/id,trash}{?access_token}",\n
remove_template =
UriTemplate.parse(REMOVE_URL),\n
LIST_URL =
"https://www.googleapis.com/drive/v2/files"
+\n
"?
prettyPrint=
false{&pageToken}&q=trashed=false"
+\n
"&
fields=
nextPageToken,items(id){&access_token}",\n
list_template =
UriTemplate.parse(LIST_URL),\n
GET_URL =
"https://www.googleapis.com/drive/v2/files{/id}{?alt}"
,\n
get_template =
UriTemplate.parse(GET_URL);\n
\n
function
handleError(error,
id)
{\n
if
(
error.target.status =
==
404)
{\n
throw
new
jIO.util.jIOError(\n
"Cannot
find
document:
"
+
id,\n
404\n
);\n
}\n
throw
error;\n
}\n
\n
function
listPage(result,
token)
{\n
var
i,\n
obj;\n
return
new
RSVP.Queue()\n
.push(function
()
{\n
return
jIO.util.ajax({\n
"type":
"GET",\n
"url":
list_template.expand({\n
pageToken
:
(result.nextPageToken
||
""),\n
access_token:
token\n
})\n
});\n
})\n
.push(function
(data)
{\n
obj =
JSON.parse(data.target.response
||
data.target.responseText);\n
for
(
i =
0;
i
<
obj.items.length;
i
+=
1)
{\n
obj.items[i]
.value =
{};\n
result.push(obj.items[i]);\n
}\n
result.nextPageToken =
obj.nextPageToken;\n
return
result;\n
},
handleError);\n
}\n
\n
function
checkName(name)
{\n
if
(name
!==
"enclosure")
{\n
throw
new
jIO.util.jIOError("Only
support
\'enclosure\'
attachment",
400);\n
}\n
}\n
\n
/**\n
*
The
JIO
Google
Drive
Storage
extension\n
*\n
*
@class
GdriveStorage\n
*
@constructor\n
*/\n
function
GdriveStorage(spec)
{\n
if
(
spec =
==
undefined
||
spec.access_token =
==
undefined
||\n
typeof
spec.access_token
!==
\'string\')
{\n
throw
new
TypeError("Access
Token
must
be
a
string
"
+\n
"which
contains
more
than
one
character.");\n
}\n
if
(spec.trashing
!==
undefined
&&\n
(spec.trashing
!==
true
&&
spec.trashing
!==
false))
{\n
throw
new
TypeError("trashing
parameter"
+\n
"
must
be
a
boolean
(true
or
false)");\n
}\n
this._trashing =
spec.trashing
||
true;\n
this._access_token =
spec.access_token;\n
return;\n
}\n
\n
function
recursiveAllDocs(result,
accessToken)
{\n
return
new
RSVP.Queue()\n
.push(function
()
{\n
return
listPage(result,
accessToken);\n
})\n
.push(function
()
{\n
if
(result.nextPageToken)
{\n
return
recursiveAllDocs(result,
accessToken);\n
}\n
return
result;\n
});\n
}\n
\n
GdriveStorage.prototype.hasCapacity =
function
(name)
{\n
return
(
name =
==
"list");\n
};\n
\n
GdriveStorage.prototype.buildQuery =
function
()
{\n
return
recursiveAllDocs([],
this._access_token);\n
};\n
\n
function
sendMetaData(id,
param,
token)
{\n
var
boundary =
"-------314159265358979323846"
;\n
\n
return
new
RSVP.Queue()\n
.push(function
()
{\n
return
jIO.util.ajax({\n
"type":
id
?
"PUT"
:
"POST",\n
"url":
upload_template.expand({\n
access_token:
token,\n
id:
id
||
[],\n
upload:
id
?
[]
:
"upload",\n
uploadType:
"multipart"\n
}),\n
headers:
{\n
"Content-Type"
:
\'multipart/related;
boundary=
"\' + boundary + \'"
\'\n
},\n
data:
\'--\'
+
boundary
+
\'\\n\'
+\n
\'Content-Type:
application/json;
charset=
UTF-8\\n\\n\'
+\n
JSON.stringify(param)
+
\'\\n\\n--\'
+
boundary
+
"--"\n
});\n
})\n
.push(function
(result)
{\n
var
obj =
JSON.parse(result.target.responseText);\n
\n
return
obj.id;\n
},\n
function
(error)
{handleError(error,
id);
});\n
}\n
\n
GdriveStorage.prototype.put =
function
(id,
param)
{\n
return
sendMetaData(id,
param,
this._access_token);\n
};\n
\n
GdriveStorage.prototype.post =
function
(param)
{\n
return
sendMetaData(undefined,
param,
this._access_token);\n
};\n
\n
function
sendData(id,
blob,
token)
{\n
return
new
RSVP.Queue()\n
.push(function
()
{\n
return
jIO.util.ajax({\n
"type":
"PUT",\n
"url":
upload_template.expand({\n
access_token:
token,\n
upload:
"upload",\n
id:
id,\n
uploadType:
"media"\n
}),\n
data:
blob\n
});\n
})\n
.push(function
(data)
{\n
data =
JSON.parse(data.target.responseText);\n
if
(
data.mimeType =
==
"application/vnd.google-apps.folder")
{\n
throw
new
jIO.util.jIOError("cannot
put
attachments
to
folder",
400);\n
}\n
return
data;\n
},
function
(error)
{handleError(error,
id);
});\n
}\n
\n
GdriveStorage.prototype.putAttachment =
function
(id,
name,
blob)
{\n
checkName(name);\n
return
sendData(id,
blob,
this._access_token);\n
};\n
\n
GdriveStorage.prototype.remove =
function
(id)
{\n
var
that =
this;\n
return
new
RSVP.Queue()\n
.push(function
()
{\n
return
jIO.util.ajax({\n
type:
that._trashing
?
"POST"
:
"DELETE",\n
url:
remove_template.expand({\n
id
:
id,\n
access_token
:
that._access_token,\n
trash
:
that._trashing
?
"trash"
:
[]\n
})\n
});\n
})\n
.push(undefined,
function
(error)
{handleError(error,
id);
});\n
};\n
\n
function
getData(id,
attach,
token)
{\n
return
new
RSVP.Queue()\n
.push(function
()
{\n
return
jIO.util.ajax({\n
type:
"GET",\n
dataType:
attach
?
"blob"
:
"json",\n
url:
get_template.expand({\n
id:
id,\n
alt:
attach
?
"media"
:
[],\n
access_token:
token\n
}),\n
headers:
{\n
"Authorization"
:
"Bearer
"
+
token\n
}\n
});\n
})\n
.push(function
(evt)
{\n
return
evt.target.response
||\n
(attach
?
new
Blob([evt.target.responseText],\n
{"type"
:\n
evt.target.responseHeaders["Content-Type"]})
:\n
JSON.parse(evt.target.responseText));\n
},
function
(error)
{handleError(error,
id);
});\n
}\n
\n
GdriveStorage.prototype.get =
function
(id)
{\n
return
getData(id,
false,
this._access_token);\n
};\n
\n
GdriveStorage.prototype.getAttachment =
function
(id,
name)
{\n
checkName(name);\n
return
getData(id,
true,
this._access_token);\n
};\n
\n
GdriveStorage.prototype.allAttachments =
function
(id)
{\n
var
token =
this._access_token;\n
\n
return
new
RSVP.Queue()\n
.push(function
()
{\n
return
getData(id,
false,
token);\n
})\n
.push(function
(data)
{\n
if
(
data.mimeType =
==
"application/vnd.google-apps.folder")
{\n
return
{};\n
}\n
return
{"enclosure":
{}};\n
});\n
};\n
\n
jIO.addStorage(\'gdrive\',
GdriveStorage);\n
\n
}(jIO,
Blob,
RSVP,
UriTemplate,
JSON));\n
;/*jslint
nomen:
true
*/\n
;/*jslint
nomen:
true
*/\n
/*global
RSVP*/\n
/*global
RSVP*/\n
\n
\n
...
@@ -8989,10 +9068,10 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
...
@@ -8989,10 +9068,10 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
//
}\n
//
}\n
\n
\n
/*jslint
nomen:
true,
unparam:
true
*/\n
/*jslint
nomen:
true,
unparam:
true
*/\n
/*global
jIO,
UriTemplate,
FormData,
RSVP,
URI,
Blob,
objectToSearchText,
\n
/*global
jIO,
UriTemplate,
FormData,
RSVP,
URI,
Blob,\n
SimpleQuery,
ComplexQuery*/\n
SimpleQuery,
ComplexQuery*/\n
\n
\n
(function
(jIO,
UriTemplate,
FormData,
RSVP,
URI,
Blob,
objectToSearchText,
\n
(function
(jIO,
UriTemplate,
FormData,
RSVP,
URI,
Blob,\n
SimpleQuery,
ComplexQuery)
{\n
SimpleQuery,
ComplexQuery)
{\n
"use
strict";\n
"use
strict";\n
\n
\n
...
@@ -9449,14 +9528,14 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
...
@@ -9449,14 +9528,14 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
if
(result_list)
{\n
if
(result_list)
{\n
local_roles =
result_list;\n
local_roles =
result_list;\n
parsed_query.query_list.splice(i,
1);\n
parsed_query.query_list.splice(i,
1);\n
query =
objectToSearchText(parsed_query);\n
query =
jIO.Query.
objectToSearchText(parsed_query);\n
i =
parsed_query.query_list.length;\n
i =
parsed_query.query_list.length;\n
}
else
{\n
}
else
{\n
result_list =
isMultipleLocalRoles(sub_query);\n
result_list =
isMultipleLocalRoles(sub_query);\n
if
(result_list)
{\n
if
(result_list)
{\n
local_roles =
result_list;\n
local_roles =
result_list;\n
parsed_query.query_list.splice(i,
1);\n
parsed_query.query_list.splice(i,
1);\n
query =
objectToSearchText(parsed_query);\n
query =
jIO.Query.
objectToSearchText(parsed_query);\n
i =
parsed_query.query_list.length;\n
i =
parsed_query.query_list.length;\n
}\n
}\n
}\n
}\n
...
@@ -9507,7 +9586,7 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
...
@@ -9507,7 +9586,7 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
\n
\n
jIO.addStorage("erp5",
ERP5Storage);\n
jIO.addStorage("erp5",
ERP5Storage);\n
\n
\n
}(jIO,
UriTemplate,
FormData,
RSVP,
URI,
Blob,
objectToSearchText,
\n
}(jIO,
UriTemplate,
FormData,
RSVP,
URI,
Blob,\n
SimpleQuery,
ComplexQuery));\n
SimpleQuery,
ComplexQuery));\n
;/*jslint
nomen:
true*/\n
;/*jslint
nomen:
true*/\n
/*global
RSVP*/\n
/*global
RSVP*/\n
...
@@ -10651,8 +10730,7 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
...
@@ -10651,8 +10730,7 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
};\n
};\n
\n
\n
jIO.addStorage("indexeddb",
IndexedDBStorage);\n
jIO.addStorage("indexeddb",
IndexedDBStorage);\n
}(indexedDB,
jIO,
RSVP,
Blob,
Math,
IDBKeyRange));\n
}(indexedDB,
jIO,
RSVP,
Blob,
Math,
IDBKeyRange));
]]
></string>
</value>
]]
></string>
</value>
</item>
</item>
...
@@ -10789,7 +10867,7 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
...
@@ -10789,7 +10867,7 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
947.
13956.40084.22186
</string>
</value>
<value>
<string>
947.
22494.14742.48810
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -10807,7 +10885,7 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
...
@@ -10807,7 +10885,7 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
144
8293989.05
</float>
<float>
144
9226044.59
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment