Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tomáš Peterka
jio
Commits
1228bfd5
Commit
1228bfd5
authored
Mar 18, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into erp5storage
parents
250fa61a
2bac7b8a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
78 additions
and
32 deletions
+78
-32
docs/available_storages.rst
docs/available_storages.rst
+1
-1
docs/getting_started.rst
docs/getting_started.rst
+1
-1
docs/keys.rst
docs/keys.rst
+4
-4
docs/manage_documents.rst
docs/manage_documents.rst
+18
-18
docs/metadata.rst
docs/metadata.rst
+6
-6
src/jio.date/jiodate.js
src/jio.date/jiodate.js
+6
-0
src/jio.storage/querystorage.js
src/jio.storage/querystorage.js
+30
-0
test/queries/jiodate.tests.js
test/queries/jiodate.tests.js
+12
-2
No files found.
docs/available_storages.rst
View file @
1228bfd5
...
@@ -96,7 +96,7 @@ Descriptions:
...
@@ -96,7 +96,7 @@ Descriptions:
// Digest authentication is not implemented
// Digest authentication is not implemented
**Be careful**: The generated description never contains a readable password, but
**Be careful**: The generated description never contains a readable password, but
for basic authentication, the password
will just be
base64 encoded.
for basic authentication, the password
is just
base64 encoded.
S3Storage
S3Storage
^^^^^^^^^
^^^^^^^^^
...
...
docs/getting_started.rst
View file @
1228bfd5
...
@@ -21,7 +21,7 @@ Getting started
...
@@ -21,7 +21,7 @@ Getting started
<script ...>
<script ...>
With `RequireJS <http://requirejs.org/>`_, the main.js
will
look like:
With `RequireJS <http://requirejs.org/>`_, the main.js
should
look like:
.. code-block:: javascript
.. code-block:: javascript
...
...
docs/keys.rst
View file @
1228bfd5
...
@@ -244,12 +244,12 @@ A key_schema object can have three properties:
...
@@ -244,12 +244,12 @@ A key_schema object can have three properties:
* ``key_set`` - required.
* ``key_set`` - required.
* ``cast_lookup`` - optional, a
mapping of name: function that will
* ``cast_lookup`` - optional, a
n object of the form ``{name: function}`` that is
be
used if cast_to is a string. If cast_lookup is not provided,
used if cast_to is a string. If cast_lookup is not provided,
then cast_to must be a function.
then cast_to must be a function.
* ``match_lookup`` - optional, a
mapping of name: function that will
* ``match_lookup`` - optional, a
n object of the form ``{name: function}`` that is
be
used if ``equal_match`` is a string. If match_lookup is not provided,
used if ``equal_match`` is a string. If match_lookup is not provided,
then ``equal_match`` must be a function.
then ``equal_match`` must be a function.
...
...
docs/manage_documents.rst
View file @
1228bfd5
...
@@ -124,7 +124,7 @@ see how method calls should be made with either of these storages.
...
@@ -124,7 +124,7 @@ see how method calls should be made with either of these storages.
Promises
Promises
--------
--------
Each jIO method returns a Promise object, which allows us to get responses into
Each jIO method
(with the exception of ``.createJIO()``)
returns a Promise object, which allows us to get responses into
callback parameters and to chain callbacks with other returned values.
callback parameters and to chain callbacks with other returned values.
jIO uses a custom version of `RSVP.js <https://github.com/tildeio/rsvp.js>`_, adding canceler and progression features.
jIO uses a custom version of `RSVP.js <https://github.com/tildeio/rsvp.js>`_, adding canceler and progression features.
...
@@ -154,11 +154,11 @@ To retrieve jIO responses, you have to provide callbacks like this:
...
@@ -154,11 +154,11 @@ To retrieve jIO responses, you have to provide callbacks like this:
Here is a list of responses returned by jIO according to methods and options:
Here is a list of responses returned by jIO according to methods and options:
==================
============================
================== ===============================================
==================
============================
================== ===============================================
Option Available for
Response (Callback first parameter)
Available for Option
Response (Callback first parameter)
==================
============================
================== ===============================================
==================
============================
================== ===============================================
No options ``.post()``, ``.put()``, ``.remove()``
.. code-block:: javascript
``.post()``, ``.put()``, ``.remove()`` Any
.. code-block:: javascript
{
{
result: 'success',
result: 'success',
method: 'post',
method: 'post',
...
@@ -167,8 +167,8 @@ No options ``.post()``, ``.put()``, ``.remove()`` .. code-bl
...
@@ -167,8 +167,8 @@ No options ``.post()``, ``.put()``, ``.remove()`` .. code-bl
status: 204,
status: 204,
statusText: 'No Content'
statusText: 'No Content'
}
}
No options ``.putAttachment()``, ``.removeAttachment()``
.. code-block:: javascript
``.putAttachment()``, ``.removeAttachment()`` Any
.. code-block:: javascript
{
{
result: 'success',
result: 'success',
method: 'putAttachment',
method: 'putAttachment',
...
@@ -178,8 +178,8 @@ No options ``.putAttachment()``, ``.removeAttachment()`` .. code-bl
...
@@ -178,8 +178,8 @@ No options ``.putAttachment()``, ``.removeAttachment()`` .. code-bl
status: 204,
status: 204,
statusText: 'No Content'
statusText: 'No Content'
}
}
No options ``.get()``
.. code-block:: javascript
``.get()`` Any
.. code-block:: javascript
{
{
result: 'success',
result: 'success',
method: 'get',
method: 'get',
...
@@ -190,8 +190,8 @@ No options ``.get()`` .. code-bl
...
@@ -190,8 +190,8 @@ No options ``.get()`` .. code-bl
// Here, the document metadata
// Here, the document metadata
}
}
}
}
No options ``.getAttachment()``
.. code-block:: javascript
``.getAttachment()`` Any
.. code-block:: javascript
{
{
result: 'success',
result: 'success',
method: 'getAttachment',
method: 'getAttachment',
...
@@ -201,8 +201,8 @@ No options ``.getAttachment()`` .. code-bl
...
@@ -201,8 +201,8 @@ No options ``.getAttachment()`` .. code-bl
statusText: 'Ok',
statusText: 'Ok',
data: Blob // Here, the attachment content
data: Blob // Here, the attachment content
}
}
No option ``.allDocs()``
.. code-block:: javascript
``.allDocs()`` No option
.. code-block:: javascript
{
{
result: 'success',
result: 'success',
method: 'allDocs',
method: 'allDocs',
...
@@ -218,8 +218,8 @@ No option ``.allDocs()`` .. code-bl
...
@@ -218,8 +218,8 @@ No option ``.allDocs()`` .. code-bl
}]
}]
}
}
}
}
include_docs: true ``.allDocs()``
.. code-block:: javascript
``.allDocs()`` include_docs: true
.. code-block:: javascript
{
{
result: 'success',
result: 'success',
method: 'allDocs',
method: 'allDocs',
...
@@ -238,12 +238,12 @@ include_docs: true ``.allDocs()`` .. code-bl
...
@@ -238,12 +238,12 @@ include_docs: true ``.allDocs()`` .. code-bl
}]
}]
}
}
}
}
==================
============================
================== ===============================================
==================
============================
================== ===============================================
In case of error, the ``errorCallback`` first parameter
will look
like:
In case of error, the ``errorCallback`` first parameter
looks
like:
.. code-block:: javascript
.. code-block:: javascript
...
...
docs/metadata.rst
View file @
1228bfd5
...
@@ -93,7 +93,7 @@ Identification
...
@@ -93,7 +93,7 @@ Identification
| ``{"date": {"scheme": "DCTERMS.W3CDTF", "content": "2011-12-13"}}``
| ``{"date": {"scheme": "DCTERMS.W3CDTF", "content": "2011-12-13"}}``
A date associated with an event in the life cycle of the resource. Typically,
A date associated with an event in the life cycle of the resource. Typically,
Date
will be
associated with the creation or availability of the resource.
Date
is
associated with the creation or availability of the resource.
Recommended best practice for encoding the date value is defined in a profile
Recommended best practice for encoding the date value is defined in a profile
of ISO 8601 `Date and Time Formats, W3C Note <http://www.w3.org/TR/NOTE-datetime>`_
of ISO 8601 `Date and Time Formats, W3C Note <http://www.w3.org/TR/NOTE-datetime>`_
and follows the YYYY-MM-DD format.
and follows the YYYY-MM-DD format.
...
@@ -107,7 +107,7 @@ Identification
...
@@ -107,7 +107,7 @@ Identification
The nature or genre of the content of the resource. Type includes terms describing
The nature or genre of the content of the resource. Type includes terms describing
general categories, functions, genres, or aggregation levels for content.
general categories, functions, genres, or aggregation levels for content.
Recommended best practice is to select a value from a controlled vocabulary.
Recommended best practice is to select a value from a controlled vocabulary.
**Th
e
type is not a MIME Type!**
**Th
is
type is not a MIME Type!**
Intellectual property
Intellectual property
...
@@ -145,7 +145,7 @@ Intellectual property
...
@@ -145,7 +145,7 @@ Intellectual property
| ``{"rights": "https://www.j-io.org/documentation/jio-documentation/#copyright-and-license"}``
| ``{"rights": "https://www.j-io.org/documentation/jio-documentation/#copyright-and-license"}``
Information about rights held in and over the resource. Typically a Rights
Information about rights held in and over the resource. Typically a Rights
element
will
contain a rights management statement for the resource, or
element
should
contain a rights management statement for the resource, or
reference a service providing such information. Rights information often
reference a service providing such information. Rights information often
encompasses Intellectual Property Rights (IPR), Copyright, and various Property
encompasses Intellectual Property Rights (IPR), Copyright, and various Property
Rights. If the rights element is absent, no assumptions can be made about the
Rights. If the rights element is absent, no assumptions can be made about the
...
@@ -159,14 +159,14 @@ Content
...
@@ -159,14 +159,14 @@ Content
| ``{"title": "jIO Home Page"}``
| ``{"title": "jIO Home Page"}``
The name given to the resource. Typically, a Title
will be
a name by which the resource is formally known.
The name given to the resource. Typically, a Title
is
a name by which the resource is formally known.
* **subject**
* **subject**
| ``{"subject": "jIO"}``
| ``{"subject": "jIO"}``
| ``{"subject": ["jIO", "basics"]}``
| ``{"subject": ["jIO", "basics"]}``
The topic of the content of the resource. Typically, a Subject
will be
The topic of the content of the resource. Typically, a Subject
is
expressed as keywords or key phrases or classification codes that describe the
expressed as keywords or key phrases or classification codes that describe the
topic of the resource. Recommended best practice is to select a value from a
topic of the resource. Recommended best practice is to select a value from a
controlled vocabulary or formal classification scheme.
controlled vocabulary or formal classification scheme.
...
@@ -212,7 +212,7 @@ Content
...
@@ -212,7 +212,7 @@ Content
| ``{"coverage": "France"}``
| ``{"coverage": "France"}``
The extent or scope of the content of the resource. Coverage w
ill
typically
The extent or scope of the content of the resource. Coverage w
ould
typically
include spatial location (a place name or geographic co-ordinates), temporal
include spatial location (a place name or geographic co-ordinates), temporal
period (a period label, date, or date range) or jurisdiction (such as a named
period (a period label, date, or date range) or jurisdiction (such as a named
administrative entity). Recommended best practice is to select a value from a
administrative entity). Recommended best practice is to select a value from a
...
...
src/jio.date/jiodate.js
View file @
1228bfd5
...
@@ -72,6 +72,7 @@
...
@@ -72,6 +72,7 @@
}
}
this
.
mom
=
null
;
this
.
mom
=
null
;
this
.
_str
=
str
;
// http://www.w3.org/TR/NOTE-datetime
// http://www.w3.org/TR/NOTE-datetime
// http://dotat.at/tmp/ISO_8601-2004_E.pdf
// http://dotat.at/tmp/ISO_8601-2004_E.pdf
...
@@ -155,6 +156,11 @@
...
@@ -155,6 +156,11 @@
};
};
JIODate
.
prototype
.
toString
=
function
()
{
return
this
.
_str
;
};
_export
(
'
JIODate
'
,
JIODate
);
_export
(
'
JIODate
'
,
JIODate
);
_export
(
'
YEAR
'
,
YEAR
);
_export
(
'
YEAR
'
,
YEAR
);
...
...
src/jio.storage/querystorage.js
View file @
1228bfd5
...
@@ -182,6 +182,36 @@
...
@@ -182,6 +182,36 @@
};
};
/**
* Check a document
* Parameters are passed through to the sub storage.
*
* @method check
* @param {Object} command The JIO command
*/
QueryStorage
.
prototype
.
check
=
function
(
command
)
{
var
args
=
[].
slice
.
call
(
arguments
,
1
),
substorage
;
substorage
=
command
.
storage
(
this
.
_sub_storage
);
substorage
.
check
.
apply
(
substorage
,
args
).
then
(
command
.
success
,
command
.
error
,
command
.
notify
);
};
/**
* Repair a document
* Parameters are passed through to the sub storage.
*
* @method repair
* @param {Object} command The JIO command
*/
QueryStorage
.
prototype
.
repair
=
function
(
command
)
{
var
args
=
[].
slice
.
call
(
arguments
,
1
),
substorage
;
substorage
=
command
.
storage
(
this
.
_sub_storage
);
substorage
.
repair
.
apply
(
substorage
,
args
).
then
(
command
.
success
,
command
.
error
,
command
.
notify
);
};
jIO
.
addStorage
(
'
query
'
,
QueryStorage
);
jIO
.
addStorage
(
'
query
'
,
QueryStorage
);
}));
}));
test/queries/jiodate.tests.js
View file @
1228bfd5
...
@@ -170,6 +170,18 @@
...
@@ -170,6 +170,18 @@
});
});
test
(
"
The toString() method should retain the precision
"
,
function
()
{
var
d
;
d
=
JIODate
(
'
2012-05-08
'
);
strictEqual
(
d
.
toString
(),
'
2012-05-08
'
);
d
=
JIODate
(
'
2012-05
'
);
strictEqual
(
d
.
toString
(),
'
2012-05
'
);
d
=
JIODate
(
'
2012
'
);
strictEqual
(
d
.
toString
(),
'
2012
'
);
});
test
(
"
Parsing of partial timestamp values with any precision
"
,
function
()
{
test
(
"
Parsing of partial timestamp values with any precision
"
,
function
()
{
var
d
;
var
d
;
...
@@ -207,7 +219,6 @@
...
@@ -207,7 +219,6 @@
strictEqual
(
d
.
getPrecision
(),
'
year
'
);
strictEqual
(
d
.
getPrecision
(),
'
year
'
);
strictEqual
(
d
.
toPrecisionString
(),
'
2012
'
);
strictEqual
(
d
.
toPrecisionString
(),
'
2012
'
);
strictEqual
(
d
.
mom
.
toISOString
(),
'
2012-01-01T00:00:00.000Z
'
);
strictEqual
(
d
.
mom
.
toISOString
(),
'
2012-01-01T00:00:00.000Z
'
);
});
});
...
@@ -272,7 +283,6 @@
...
@@ -272,7 +283,6 @@
strictEqual
(
dmsec
.
cmp
(
JIODate
(
'
2012-05-02 06:07:07
'
)),
+
1
);
strictEqual
(
dmsec
.
cmp
(
JIODate
(
'
2012-05-02 06:07:07
'
)),
+
1
);
strictEqual
(
dmsec
.
cmp
(
JIODate
(
'
2012-05-02 06:07:08
'
)),
0
);
strictEqual
(
dmsec
.
cmp
(
JIODate
(
'
2012-05-02 06:07:08
'
)),
0
);
strictEqual
(
dmsec
.
cmp
(
JIODate
(
'
2012-05-02 06:07:09
'
)),
-
1
);
strictEqual
(
dmsec
.
cmp
(
JIODate
(
'
2012-05-02 06:07:09
'
)),
-
1
);
});
});
...
...
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