KintoClient
|
KintoClient |
#constructor
|
KintoClient#constructor |
should check that remote is a string
|
- |
should validate remote arg value
|
- |
should strip any trailing slash
|
- |
should expose a passed events instance option
|
- |
should propagate its events property to child dependencies
|
- |
should assign version value
|
- |
should accept a headers option
|
- |
should validate protocol version
|
- |
should propagate the requestMode option to the child HTTP instance
|
- |
should keep the default timeout in the child HTTP instance
|
- |
should propagate the timeout option to the child HTTP instance
|
- |
should create an event emitter if none is provided
|
- |
should expose provided event emitter as a property
|
- |
should accept a safe option
|
- |
#setHeaders
|
KintoClient#setHeaders |
should override constructor headers
|
- |
get backoff()
|
KintoClient#backoff |
should provide the remaining backoff time in ms if any
|
- |
should provide no remaining backoff time when none is set
|
- |
#bucket()
|
KintoClient#bucket |
should return a Bucket instance
|
- |
should propagate default req options to bucket instance
|
- |
#fetchServerInfo
|
KintoClient#fetchServerInfo |
should retrieve server settings on first request made
|
- |
should store server settings into the serverSettings property
|
- |
should not fetch server settings if they're cached already
|
- |
should refresh server info if headers were changed
|
- |
#fetchServerSettings()
|
KintoClient#fetchServerSettings |
should retrieve server settings
|
- |
#fetchServerCapabilities()
|
KintoClient#fetchServerCapabilities |
should retrieve server capabilities
|
- |
#fetchUser()
|
KintoClient#fetchUser |
should retrieve user information
|
- |
#fetchHTTPApiVersion()
|
KintoClient#fetchHTTPApiVersion |
should retrieve current API version
|
- |
#batch
|
KintoClient#batch |
Batch client setup
|
- |
should skip registering HTTP events
|
- |
server request
|
- |
should ensure server settings are fetched
|
- |
empty request list
|
- |
should not perform request on empty operation list
|
- |
non-empty request list
|
- |
should call the batch endpoint
|
- |
should define main batch request default headers
|
- |
should attach all batch request headers
|
- |
should batch the expected number of requests
|
- |
Safe mode
|
- |
should forward the safe option to resulting requests
|
- |
Retry
|
- |
should retry the request if option is specified
|
- |
server response
|
- |
should reject on HTTP 400
|
- |
should reject on HTTP error status code
|
- |
should expose succesful subrequest responses
|
- |
should expose failing subrequest responses
|
- |
should resolve with encountered HTTP 500
|
- |
should expose encountered HTTP 412
|
- |
Chunked requests
|
- |
should chunk batch requests
|
- |
should not chunk batch requests if setting is falsy
|
- |
should map initial records to conflict objects
|
- |
should chunk batch requests concurrently
|
- |
Aggregate mode
|
- |
should resolve with an aggregated result object
|
- |
#execute()
|
KintoClient#execute |
should ensure passing defined allowed defined request options
|
- |
#paginatedList()
|
KintoClient#paginatedList |
No pagination
|
- |
should execute expected request
|
- |
should sort records
|
- |
should resolve with records list
|
- |
should resolve with number of total records
|
- |
should resolve with a next() function
|
- |
should support the since option
|
- |
should throw if the since option is invalid
|
- |
should resolve with the collection last_modified without quotes
|
- |
should resolve with the hasNextPage being set to false
|
- |
Filtering
|
- |
should generate the expected filtering query string
|
- |
shouldn't need an explicit sort parameter
|
- |
Pagination
|
- |
should issue a request with the specified limit applied
|
- |
should query for next page
|
- |
should aggregate paginated results
|
- |
should resolve with the hasNextPage being set to true
|
- |
should resolve with number of total records
|
- |
Batch mode
|
- |
should not attempt at consumming response headers
|
- |
#listPermissions()
|
KintoClient#listPermissions |
Capability available
|
- |
should execute expected request
|
- |
should support passing custom headers
|
- |
should resolve with a result object
|
- |
Capability unavailable
|
- |
should reject with an error when the capability is not available
|
- |
#listBuckets()
|
KintoClient#listBuckets |
should execute expected request
|
- |
should support passing custom headers
|
- |
should resolve with a result object
|
- |
#createBucket
|
KintoClient#createBucket |
should execute expected request
|
- |
should accept a data option
|
- |
should accept a safe option
|
- |
should extend request headers with optional ones
|
- |
#deleteBucket()
|
KintoClient#deleteBucket |
should execute expected request
|
- |
should accept a bucket object
|
- |
should accept a safe option
|
- |
should extend request headers with optional ones
|
- |
#deleteBuckets()
|
KintoClient#deleteBuckets |
should execute expected request
|
- |
should accept a safe option
|
- |
should extend request headers with optional ones
|
- |
should reject if http_api_version mismatches
|
- |
batch module
|
- |
aggregate()
|
- |
should throw if responses length doesn't match requests one
|
- |
should return an object
|
- |
should return an object with the expected keys
|
- |
should expose HTTP 500 errors in the errors list
|
- |
should expose HTTP 200<=x<400 responses in the published list
|
- |
should expose HTTP 404 responses in the skipped list
|
- |
should expose HTTP 412 responses in the conflicts list
|
- |
Heterogeneous combinations
|
- |
should list errors
|
- |
should list published data
|
- |
should list conflicts
|
- |
should list skips
|
- |
Bucket
|
Bucket |
Options handling
|
- |
should accept options
|
- |
#getData()
|
Bucket#getData |
should execute expected request
|
- |
should resolve with response data
|
- |
#setData()
|
- |
should set the bucket data
|
- |
should handle the patch option
|
- |
should handle the safe option
|
- |
should resolve with json result
|
- |
#collection()
|
Bucket#collection |
should return a Collection instance
|
- |
should return a named collection
|
- |
should propagate bucket options
|
- |
#listCollections()
|
Bucket#listCollections |
should list bucket collections
|
- |
should merge default options
|
- |
should return the list of collections
|
- |
#createCollection()
|
Bucket#createCollection |
should accept a safe option
|
- |
should extend request headers with optional ones
|
- |
Named collection
|
- |
should create a named collection
|
- |
should merge default options
|
- |
Unnamed collection
|
- |
should create an unnamed collection
|
- |
should merge default options
|
- |
#deleteCollection
|
Bucket#deleteCollection |
should delete a collection
|
- |
should merge default options
|
- |
should accept a safe option
|
- |
should rely on the provided last_modified for the safe option
|
- |
should extend request headers with optional ones
|
- |
#listGroups()
|
Bucket#listGroups |
should list bucket groups
|
- |
should merge default options
|
- |
should return the list of groups
|
- |
#getGroup
|
Bucket#getGroup |
should extend request headers with optional ones
|
- |
should return the group
|
- |
#createGroup
|
Bucket#createGroup |
should accept a safe option
|
- |
should extend request headers with optional ones
|
- |
should create a group with empty list of members
|
- |
should create a group with optional data and permissions
|
- |
#updateGroup
|
Bucket#updateGroup |
should throw if record is not an object
|
- |
should throw if id is missing
|
- |
should accept a patch option
|
- |
should extend request headers with optional ones
|
- |
should update the group from first argument
|
- |
should update the group with optional data and permissions
|
- |
#deleteGroup
|
Bucket#updateGroup |
should delete a group
|
- |
should merge default options
|
- |
should accept a safe option
|
- |
should rely on the provided last_modified for the safe option
|
- |
should extend request headers with optional ones
|
- |
#getPermissions()
|
Bucket#getPermissions |
should retrieve permissions
|
- |
should merge default options
|
- |
#setPermissions()
|
Bucket#setPermissions |
should set permissions
|
- |
should merge default options
|
- |
should accept a last_modified option
|
- |
should resolve with response data
|
- |
#addPermissions()
|
Bucket#addPermissions |
should append permissions
|
- |
should merge default options
|
- |
#removePermissions()
|
Bucket#removePermissions |
should pop permissions
|
- |
should merge default options
|
- |
#batch()
|
Bucket#batch |
should batch operations for this bucket
|
- |
should merge default options
|
- |
Collection
|
Collection |
#getTotalRecords()
|
Collection#getTotalRecords |
should execute expected request
|
- |
should resolve with the Total-Records header value
|
- |
#getData()
|
Collection#getData |
should execute expected request
|
- |
should resolve with response data
|
- |
#getPermissions()
|
Collection#getPermissions |
should retrieve permissions
|
- |
#setPermissions()
|
Collection#setPermissions |
should set permissions
|
- |
should handle the safe option
|
- |
should resolve with json result
|
- |
#addPermissions()
|
Collection#addPermissions |
should append permissions
|
- |
should handle the safe option
|
- |
should resolve with json result
|
- |
#removePermissions()
|
Collection#removePermissions |
should pop permissions
|
- |
should handle the safe option
|
- |
should resolve with json result
|
- |
#getData()
|
Collection#getData |
should retrieve data
|
- |
#setData()
|
Collection#setData |
should set the data
|
- |
should handle the safe option
|
- |
should handle the patch option
|
- |
should resolve with json result
|
- |
#createRecord()
|
Collection#createRecord |
should create the expected request
|
- |
should accept a safe option
|
- |
should execute the expected request
|
- |
should resolve with response body
|
- |
#updateRecord()
|
Collection#updateRecord |
should throw if record is not an object
|
- |
should throw if id is missing
|
- |
should create the expected request
|
- |
should accept a safe option
|
- |
should accept a patch option
|
- |
should resolve with response body
|
- |
#deleteRecord()
|
Collection#deleteRecord |
should throw if id is missing
|
- |
should delete a record
|
- |
should accept a safe option
|
- |
should rely on the provided last_modified for the safe option
|
- |
#getRecord()
|
Collection#getRecord |
should execute expected request
|
- |
should retrieve a record
|
- |
#listRecords()
|
Collection#listRecords |
should execute expected request
|
- |
should support passing custom headers
|
- |
should resolve with a result object
|
- |
Retry
|
- |
should retry the request if option is specified
|
- |
#batch()
|
Collection#batch |
should batch operations
|
- |
endpoint()
|
endpoint |
should provide a root endpoint
|
- |
should provide a batch endpoint
|
- |
should provide a bucket endpoint
|
- |
should provide a collection endpoint
|
- |
should provide a records endpoint
|
- |
should provide a record endpoint
|
- |
should provide a permissions endpoint
|
- |
HTTP class
|
HTTP |
#constructor
|
HTTP#constructor |
should expose a passed events instance
|
- |
should accept a requestMode option
|
- |
should complain if an events handler is not provided
|
- |
#request()
|
HTTP#request |
Request headers
|
- |
should set default headers
|
- |
should merge custom headers with default ones
|
- |
should drop custom content-type header for multipart body
|
- |
Request CORS mode
|
- |
should use default CORS mode
|
- |
should use configured custom CORS mode
|
- |
Succesful request
|
- |
should resolve with HTTP status
|
- |
should resolve with JSON body
|
- |
should resolve with headers
|
- |
Request timeout
|
- |
should timeout the request
|
- |
No content response
|
- |
should resolve with null JSON if Content-Length header is missing
|
- |
Malformed JSON response
|
- |
should reject with an appropriate message
|
- |
Business error responses
|
- |
should reject on status code > 400
|
- |
should expose JSON error bodies
|
- |
should reject on status code > 400 even with empty body
|
- |
Deprecation header
|
- |
should handle deprecation header
|
- |
should handle deprecation header parse error
|
- |
should emit a deprecated event on Alert header
|
- |
Backoff header handling
|
- |
should emit a backoff event on set Backoff header
|
- |
should emit a backoff event even on error responses
|
- |
should emit a backoff event on missing Backoff header
|
- |
Retry-After header handling
|
- |
Event
|
- |
should emit a retry-after event when Retry-After is set
|
- |
Retry loop
|
- |
should not retry the request by default
|
- |
should retry the request if specified
|
- |
should error when retries are exhausted
|
- |
Integration tests
|
- |
Default server configuration
|
- |
new batch
|
- |
should support root batch
|
- |
should support bucket batch
|
- |
Server properties
|
- |
should retrieve server settings
|
- |
should retrieve server capabilities
|
- |
should retrieve user information
|
- |
should retrieve current API version
|
- |
#createBucket
|
- |
Default options
|
- |
Autogenerated id
|
- |
should create a bucket
|
- |
Custom id
|
- |
should create a bucket with the passed id
|
- |
should create a bucket having a list of write permissions
|
- |
data option
|
- |
should create bucket data
|
- |
Safe option
|
- |
should not override existing bucket
|
- |
permissions option
|
- |
should create a bucket having a list of write permissions
|
- |
#deleteBucket()
|
- |
should delete a bucket
|
- |
Safe option
|
- |
should raise a conflict error when resource has changed
|
- |
#deleteBuckets()
|
- |
should delete all buckets
|
- |
#listPermissions
|
- |
Single page of permissions
|
- |
should retrieve the list of permissions
|
- |
Paginated list of permissions
|
- |
should retrieve the list of permissions
|
- |
#listBuckets
|
- |
should retrieve the list of buckets
|
- |
should order buckets by field
|
- |
Filtering
|
- |
should filter buckets
|
- |
should resolve with buckets last_modified value
|
- |
should retrieve only buckets after provided timestamp
|
- |
Pagination
|
- |
should not paginate by default
|
- |
should paginate by chunks
|
- |
should expose a hasNextPage boolean prop
|
- |
should provide a next method to load next page
|
- |
#batch
|
- |
No chunked requests
|
- |
should allow batching operations
|
- |
Chunked requests
|
- |
should allow batching by chunks
|
- |
aggregate option
|
- |
Succesful publication
|
- |
No chunking
|
- |
should return an aggregated result object
|
- |
should contain the list of succesful publications
|
- |
Chunked response
|
- |
should return an aggregated result object
|
- |
should contain the list of succesful publications
|
- |
Backed off server
|
- |
should appropriately populate the backoff property
|
- |
Deprecated protocol version
|
- |
Soft EOL
|
- |
should warn when the server sends a deprecation Alert header
|
- |
Hard EOL
|
- |
should reject with a 410 Gone when hard EOL is received
|
- |
Limited pagination
|
- |
Limited configured server pagination
|
- |
should fetch one results page
|
- |
should fetch all available pages
|
- |
Chainable API
|
- |
.bucket()
|
- |
.getData()
|
- |
should retrieve the bucket identifier
|
- |
should retrieve bucket last_modified value
|
- |
.setData()
|
- |
should post data to the bucket
|
- |
should patch existing data for the bucket
|
- |
should post data to the default bucket
|
- |
.getPermissions()
|
- |
should retrieve bucket permissions
|
- |
.setPermissions()
|
- |
should set bucket permissions
|
- |
Safe option
|
- |
should check for concurrency
|
- |
.addPermissions()
|
- |
should append bucket permissions
|
- |
.removePermissions()
|
- |
should pop bucket permissions
|
- |
.listHistory()
|
- |
should retrieve the list of history entries
|
- |
should order entries by field
|
- |
Filtering
|
- |
should filter entries by top-level attributes
|
- |
should filter entries by target attributes
|
- |
should resolve with entries last_modified value
|
- |
should retrieve only entries after provided timestamp
|
- |
Pagination
|
- |
should not paginate by default
|
- |
should paginate by chunks
|
- |
should provide a next method to load next page
|
- |
.listCollections()
|
- |
should retrieve the list of collections
|
- |
should order collections by field
|
- |
should work in a batch
|
- |
Filtering
|
- |
should filter collections
|
- |
should resolve with collections last_modified value
|
- |
should retrieve only collections after provided timestamp
|
- |
Pagination
|
- |
should not paginate by default
|
- |
should paginate by chunks
|
- |
should provide a next method to load next page
|
- |
.createCollection()
|
- |
should create a named collection
|
- |
should create an automatically named collection
|
- |
Safe option
|
- |
should not override existing collection
|
- |
Permissions option
|
- |
should create a collection having a list of write permissions
|
- |
Data option
|
- |
should create a collection having the expected data attached
|
- |
.deleteCollection()
|
- |
should delete a collection
|
- |
Safe option
|
- |
should check for concurrency
|
- |
.listGroups()
|
- |
should retrieve the list of groups
|
- |
should order groups by field
|
- |
Filtering
|
- |
should filter groups
|
- |
should resolve with groups last_modified value
|
- |
should retrieve only groups after provided timestamp
|
- |
Pagination
|
- |
should not paginate by default
|
- |
should paginate by chunks
|
- |
should provide a next method to load next page
|
- |
.createGroup()
|
- |
should create a named group
|
- |
should create an automatically named group
|
- |
Safe option
|
- |
should not override existing group
|
- |
Permissions option
|
- |
should create a collection having a list of write permissions
|
- |
Data option
|
- |
should create a collection having the expected data attached
|
- |
.getGroup()
|
- |
should get a group
|
- |
.updateGroup()
|
- |
should update a group
|
- |
should patch a group
|
- |
Safe option
|
- |
should perform concurrency checks with last_modified
|
- |
should create a non-existent resource when safe is true
|
- |
should not override existing data with no last_modified
|
- |
.deleteGroup()
|
- |
should delete a group
|
- |
Safe option
|
- |
should check for concurrency
|
- |
.batch()
|
- |
should allow batching operations for current bucket
|
- |
Safe option
|
- |
should allow batching operations for current bucket
|
- |
.collection()
|
- |
test/integration_test.js |
- |
.getTotalRecords()
|
- |
should retrieve the initial total number of records
|
- |
should retrieve the updated total number of records
|
- |
.getPermissions()
|
- |
should retrieve permissions
|
- |
.setPermissions()
|
- |
should set typed permissions
|
- |
Safe option
|
- |
should perform concurrency checks
|
- |
.addPermissions()
|
- |
should append collection permissions
|
- |
.removePermissions()
|
- |
should pop collection permissions
|
- |
.getData()
|
- |
should retrieve collection data
|
- |
.setData()
|
- |
should set collection data
|
- |
Safe option
|
- |
should perform concurrency checks
|
- |
.createRecord()
|
- |
No record id provided
|
- |
should create a record
|
- |
Safe option
|
- |
should check for existing record
|
- |
Record id provided
|
- |
should create a record
|
- |
.updateRecord()
|
- |
should update a record
|
- |
should patch a record
|
- |
should create the record if it doesn't exist yet
|
- |
Safe option
|
- |
should perform concurrency checks with last_modified
|
- |
should create a non-existent resource when safe is true
|
- |
should not override existing data with no last_modified
|
- |
.deleteRecord()
|
- |
should delete a record
|
- |
Safe option
|
- |
should perform concurrency checks
|
- |
.addAttachment()
|
- |
With filename
|
- |
should create a record with an attachment
|
- |
should create a record with provided record data
|
- |
should create a record with provided permissions
|
- |
Without filename
|
- |
should default filename to 'untitled' if not specified
|
- |
should allow to specify safe in options
|
- |
should allow to specify a filename in options
|
- |
.removeAttachment()
|
- |
should remove an attachment from a record
|
- |
.getRecord()
|
- |
should retrieve a record by its id
|
- |
.listRecords()
|
- |
should list records
|
- |
should expose the total number of records
|
- |
should order records by field
|
- |
Filtering
|
- |
should filter records
|
- |
should properly escape unicode filters
|
- |
should resolve with collection last_modified value
|
- |
since
|
- |
should retrieve all records modified since provided timestamp
|
- |
should only list changes made after the provided timestamp
|
- |
'at' retrieves a snapshot at a given timestamp
|
- |
should resolve with a regular list result object
|
- |
should handle creations
|
- |
should handle updates
|
- |
should handle deletions
|
- |
should handle long list of changes
|
- |
Mixed CRUD operations
|
- |
should compute snapshot1 as expected
|
- |
should compute snapshot2 as expected
|
- |
should compute snapshot3 as expected
|
- |
should compute snapshot4 as expected
|
- |
Pagination
|
- |
should not paginate by default
|
- |
should paginate by chunks
|
- |
should provide a next method to load next page
|
- |
should resolve with an empty array on exhausted pagination
|
- |
should retrieve all pages
|
- |
should retrieve specified number of pages
|
- |
should allow fetching next page after last page if any
|
- |
should should retrieve all existing pages
|
- |
.batch()
|
- |
should allow batching operations in the current collection
|
- |
requests module
|
- |
createRequest()
|
- |
should return a POST creation request
|
- |
should return a PUT creation request when an id is provided
|
- |
should accept a headers option
|
- |
should accept a permissions option
|
- |
should support a safe option
|
- |
deleteRequest()
|
- |
should return a deletion request
|
- |
should accept a headers option
|
- |
should raise for safe with no last_modified passed
|
- |
should support a safe option with a last_modified option
|
- |
updateRequest()
|
- |
should return a update request
|
- |
should accept a headers option
|
- |
should accept a permissions option
|
- |
should accept a patch option
|
- |
should handle data
|
- |
should support a safe option with no last_modified passed
|
- |
should support a safe option with a last_modified passed
|
- |
should accept a patch option
|
- |
addAttachmentRequest()
|
- |
should return a post request
|
- |
should accept a headers option
|
- |
should support a safe with no last_modified passed
|
- |
should support a safe option with a last_modified option
|
- |
should support a gzipped option passed with true
|
- |
should support a gzipped option passed with false
|
- |
Utils
|
- |
#partition
|
partition |
should chunk array
|
- |
should not chunk array with n<=0
|
- |
#delay
|
delay |
should delay resolution after the specified amount of time
|
- |
#pMap
|
pMap |
should map list to aggregated results
|
- |
should convert sync reducing function to async
|
- |
should preserve order of entries
|
- |
should ensure order of execution
|
- |
#omit
|
omit |
should omit provided a single key
|
- |
should omit multiple keys
|
- |
should return source if no key is specified
|
- |
#qsify
|
qsify |
should generate a query string from an object
|
- |
should strip out undefined values
|
- |
should join comma-separated values
|
- |
should map boolean as lowercase string
|
- |
should escaped values
|
- |
#checkVersion
|
- |
should accept a version within provided range
|
- |
should not accept a version oustide provided range
|
- |
@support
|
- |
should return a function
|
- |
should make decorated method resolve on version match
|
- |
should make decorated method rejecting on version mismatch
|
- |
should check for an attached client instance
|
- |
@capable
|
- |
should return a function
|
- |
should make decorated method checking the capabilities
|
- |
should make decorated method resolve on capability match
|
- |
should make decorated method rejecting on missing capability
|
- |
@nobatch
|
- |
should return a function
|
- |
should make decorated method pass when not in batch
|
- |
should make decorated method to throw if in batch
|
- |
parseDataURL()
|
- |
should extract expected properties
|
- |
should support dataURL without name
|
- |
should throw an error when the data url is invalid
|
- |
extractFileInfo()
|
- |
should extract file information from a data url
|
- |
cleanUndefinedProperties()
|
- |
should remove undefined properties from an object
|
- |