diff --git a/docs/client/api.html b/docs/client/api.html index 4156ed39bb..9be906c381 100644 --- a/docs/client/api.html +++ b/docs/client/api.html @@ -2905,19 +2905,19 @@ and a binary buffer would be serialized in EJSON as: Meteor supports all built-in EJSON data types in publishers, method arguments and results, Mongo databases, and [`Session`](#session) variables. -{{> api_box ejsonParse}} +{{> autoApiBox "EJSON.parse"}} -{{> api_box ejsonStringify}} +{{> autoApiBox "EJSON.stringify"}} -{{> api_box ejsonFromJSONValue}} +{{> autoApiBox "EJSON.fromJSONValue"}} -{{> api_box ejsonToJSONValue}} +{{> autoApiBox "EJSON.toJSONValue"}} -{{> api_box ejsonEquals}} +{{> autoApiBox "EJSON.equals"}} -{{> api_box ejsonClone}} +{{> autoApiBox "EJSON.clone"}} -{{> api_box ejsonNewBinary}} +{{> autoApiBox "EJSON.newBinary"}} Buffers of binary data are represented by `Uint8Array` instances on JavaScript platforms that support them. On implementations of JavaScript that do not @@ -2925,9 +2925,9 @@ support `Uint8Array`, binary data buffers are represented by standard arrays containing numbers ranging from 0 to 255, and the `$Uint8ArrayPolyfill` key set to `true`. -{{> api_box ejsonIsBinary}} +{{> autoApiBox "EJSON.isBinary"}} -{{> api_box ejsonAddType}} +{{> autoApiBox "EJSON.addType"}} When you add a type to EJSON, Meteor will be able to use that type in: @@ -2985,7 +2985,7 @@ result of calling [`toJSONValue`](#ejson_type_toJSONValue) instead. `HTTP` provides an HTTP request API on the client and server. To use these functions, add the HTTP package to your project with `$ meteor add http`. -{{> api_box httpcall}} +{{> autoApiBox "HTTP.call"}} This function initiates an HTTP request to a remote server. diff --git a/docs/client/data.js b/docs/client/data.js index 5fd4562abb..2149ba7d2d 100644 --- a/docs/client/data.js +++ b/docs/client/data.js @@ -2042,6 +2042,725 @@ DocsData = { "locus": "Client" } }, + "EJSON": { + "newBinary": { + "meta": { + "range": [ + 1470, + 1769 + ], + "filename": "base64.js", + "lineno": 70, + "path": "/Users/sashko/git/meteor/packages/ejson", + "code": { + "id": "astnode100269628", + "name": "EJSON.newBinary", + "type": "FunctionExpression", + "value": "function", + "paramnames": [ + "len" + ] + }, + "vars": { + "ret": null, + "i": null, + "ret.$Uint8ArrayPolyfill": null + } + }, + "summary": "Allocate a new buffer of binary data that EJSON can serialize.", + "tags": [ + { + "originalTitle": "locus", + "title": "locus", + "text": "Anywhere", + "value": "Anywhere" + } + ], + "params": [ + { + "type": { + "names": [ + "Number" + ] + }, + "description": "
The number of bytes of binary data to allocate.
", + "name": "size" + } + ], + "name": "newBinary", + "longname": "EJSON.newBinary", + "kind": "function", + "memberof": "EJSON", + "scope": "static", + "___id": "T000002R050894", + "___s": true, + "options": [], + "locus": "Anywhere" + }, + "addType": { + "meta": { + "range": [ + 1156, + 1321 + ], + "filename": "ejson.js", + "lineno": 24, + "path": "/Users/sashko/git/meteor/packages/ejson", + "code": { + "id": "astnode100270478", + "name": "EJSON.addType", + "type": "FunctionExpression", + "value": "function", + "paramnames": [ + "name", + "factory" + ] + }, + "vars": { + "customTypes[undefined]": null + } + }, + "summary": "Add a custom datatype to EJSON.", + "tags": [ + { + "originalTitle": "locus", + "title": "locus", + "text": "Anywhere", + "value": "Anywhere" + } + ], + "params": [ + { + "type": { + "names": [ + "String" + ] + }, + "description": "A tag for your custom type; must be unique among custom data types defined in your project, and must match the result of your type's typeName method.
A function that deserializes a JSON-compatible value into an instance of your type. This should match the serialization performed by your type's toJSONValue method.
A value to serialize to plain JSON.
", + "name": "val" + } + ], + "name": "toJSONValue", + "longname": "EJSON.toJSONValue", + "kind": "function", + "memberof": "EJSON", + "scope": "static", + "___id": "T000002R051025", + "___s": true, + "options": [], + "locus": "Anywhere" + }, + "fromJSONValue": { + "meta": { + "range": [ + 7902, + 8158 + ], + "filename": "ejson.js", + "lineno": 262, + "path": "/Users/sashko/git/meteor/packages/ejson", + "code": { + "id": "astnode100271293", + "name": "EJSON.fromJSONValue", + "type": "FunctionExpression", + "value": "function", + "paramnames": [ + "item" + ] + }, + "vars": { + "changed": null, + "item": null + } + }, + "summary": "Deserialize an EJSON value from its plain JSON representation.", + "tags": [ + { + "originalTitle": "locus", + "title": "locus", + "text": "Anywhere", + "value": "Anywhere" + } + ], + "params": [ + { + "type": { + "names": [ + "Object" + ] + }, + "description": "A value to deserialize into EJSON.
", + "name": "val" + } + ], + "name": "fromJSONValue", + "longname": "EJSON.fromJSONValue", + "kind": "function", + "memberof": "EJSON", + "scope": "static", + "___id": "T000002R051036", + "___s": true, + "options": [], + "locus": "Anywhere" + }, + "stringify": { + "meta": { + "range": [ + 8786, + 9029 + ], + "filename": "ejson.js", + "lineno": 283, + "path": "/Users/sashko/git/meteor/packages/ejson", + "code": { + "id": "astnode100271334", + "name": "EJSON.stringify", + "type": "FunctionExpression", + "value": "function", + "paramnames": [ + "item", + "options" + ] + }, + "vars": { + "json": null + } + }, + "summary": "Serialize a value to a string.\n\nFor EJSON values, the serialization fully represents the value. For non-EJSON values, serializes the same way as `JSON.stringify`.", + "tags": [ + { + "originalTitle": "locus", + "title": "locus", + "text": "Anywhere", + "value": "Anywhere" + } + ], + "params": [ + { + "type": { + "names": [ + "EJSON" + ] + }, + "description": "A value to stringify.
", + "name": "val" + }, + { + "type": { + "names": [ + "Object" + ] + }, + "optional": true, + "name": "options" + } + ], + "name": "stringify", + "longname": "EJSON.stringify", + "kind": "function", + "memberof": "EJSON", + "scope": "static", + "___id": "T000002R051039", + "___s": true, + "options": [ + { + "type": { + "names": [ + "Boolean", + "Integer", + "String" + ] + }, + "description": "Indents objects and arrays for easy readability. When true, indents by 2 spaces; when an integer, indents by that number of spaces; and when a string, uses the string as the indentation pattern.
When true, stringifies keys in an object in sorted order.
A string to parse into an EJSON value.
", + "name": "str" + } + ], + "name": "parse", + "longname": "EJSON.parse", + "kind": "function", + "memberof": "EJSON", + "scope": "static", + "___id": "T000002R051041", + "___s": true, + "options": [], + "locus": "Anywhere" + }, + "isBinary": { + "meta": { + "range": [ + 9587, + 9741 + ], + "filename": "ejson.js", + "lineno": 308, + "path": "/Users/sashko/git/meteor/packages/ejson", + "code": { + "id": "astnode100271403", + "name": "EJSON.isBinary", + "type": "FunctionExpression", + "value": "function", + "paramnames": [ + "obj" + ] + } + }, + "summary": "Returns true if `x` is a buffer of binary data, as returned from [`EJSON.newBinary`](#ejson_new_binary).", + "params": [ + { + "type": { + "names": [ + "Object" + ] + }, + "description": "The variable to check.
", + "name": "x" + } + ], + "tags": [ + { + "originalTitle": "locus", + "title": "locus", + "text": "Anywhere", + "value": "Anywhere" + } + ], + "name": "isBinary", + "longname": "EJSON.isBinary", + "kind": "function", + "memberof": "EJSON", + "scope": "static", + "___id": "T000002R051042", + "___s": true, + "options": [], + "locus": "Anywhere" + }, + "equals": { + "meta": { + "range": [ + 10260, + 12514 + ], + "filename": "ejson.js", + "lineno": 321, + "path": "/Users/sashko/git/meteor/packages/ejson", + "code": { + "id": "astnode100271428", + "name": "EJSON.equals", + "type": "FunctionExpression", + "value": "function", + "paramnames": [ + "a", + "b", + "options" + ] + }, + "vars": { + "i": null, + "keyOrderSensitive": null, + "ret": null, + "bKeys": null, + "": null + } + }, + "summary": "Return true if `a` and `b` are equal to each other. Return false otherwise. Uses the `equals` method on `a` if present, otherwise performs a deep comparison.", + "tags": [ + { + "originalTitle": "locus", + "title": "locus", + "text": "Anywhere", + "value": "Anywhere" + } + ], + "params": [ + { + "type": { + "names": [ + "EJSON" + ] + }, + "name": "a" + }, + { + "type": { + "names": [ + "EJSON" + ] + }, + "name": "b" + }, + { + "type": { + "names": [ + "Object" + ] + }, + "optional": true, + "name": "options" + } + ], + "name": "equals", + "longname": "EJSON.equals", + "kind": "function", + "memberof": "EJSON", + "scope": "static", + "___id": "T000002R051043", + "___s": true, + "options": [ + { + "type": { + "names": [ + "Boolean" + ] + }, + "description": "Compare in key sensitive order, if supported by the JavaScript implementation. For example, {a: 1, b: 2} is equal to {b: 2, a: 1} only when keyOrderSensitive is false. The default is false.
A value to copy.
", + "name": "val" + } + ], + "name": "clone", + "longname": "EJSON.clone", + "kind": "function", + "memberof": "EJSON", + "scope": "static", + "___id": "T000002R051054", + "___s": true, + "options": [], + "locus": "Anywhere" + } + }, + "HTTP": { + "call": { + "meta": { + "range": [ + 1469, + 6302 + ], + "filename": "httpcall_client.js", + "lineno": 17, + "path": "/Users/sashko/git/meteor/packages/http", + "code": { + "id": "astnode100308171", + "name": "HTTP.call", + "type": "FunctionExpression", + "value": "function", + "paramnames": [ + "method", + "url", + "options", + "callback" + ] + }, + "vars": { + "callback": null, + "options": null, + "method": null, + "headers": null, + "content": null, + "headers['Content-Type']": null, + "params_for_url": null, + "params_for_body": null, + "query_match": null, + "url": null, + "username": null, + "password": null, + "colonLoc": null, + "": null, + "xhr": null, + "k": null, + "timed_out": null, + "timer": null, + "xhr.onreadystatechange": null + } + }, + "summary": "Perform an outbound HTTP request.", + "tags": [ + { + "originalTitle": "locus", + "title": "locus", + "text": "Anywhere", + "value": "Anywhere" + } + ], + "params": [ + { + "type": { + "names": [ + "String" + ] + }, + "description": "The HTTP method to use, such as "GET", "POST", or "HEAD".
The URL to retrieve.
", + "name": "url" + }, + { + "type": { + "names": [ + "function" + ] + }, + "description": "Optional callback. If passed, the method runs asynchronously, instead of synchronously, and calls asyncCallback. On the client, this callback is required.
", + "name": "asyncCallback" + }, + { + "type": { + "names": [ + "Object" + ] + }, + "optional": true, + "name": "options" + } + ], + "name": "call", + "longname": "HTTP.call", + "kind": "function", + "memberof": "HTTP", + "scope": "static", + "___id": "T000002R059489", + "___s": true, + "options": [ + { + "type": { + "names": [ + "String" + ] + }, + "description": "String to use as the HTTP request body.
", + "name": "content" + }, + { + "type": { + "names": [ + "Object" + ] + }, + "description": "JSON-able object to stringify and use as the HTTP request body. Overwrites content.
Query string to go in the URL. Overwrites any query string in url.
Dictionary of request parameters to be encoded and placed in the URL (for GETs) or request body (for POSTs). If content or data is specified, params will always be placed in the URL.
HTTP basic authentication string of the form "username:password"
Dictionary of strings, headers to add to the HTTP request.
", + "name": "headers" + }, + { + "type": { + "names": [ + "Number" + ] + }, + "description": "Maximum time in milliseconds to wait for the request before failing. There is no timeout by default.
", + "name": "timeout" + }, + { + "type": { + "names": [ + "Boolean" + ] + }, + "description": "If true, transparently follow HTTP redirects. Cannot be set to false on the client. Default true.