@vsaas/remoting 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +202 -0
- package/README.md +78 -0
- package/dist/_virtual/_rolldown/runtime.js +32 -0
- package/dist/ext/meta.d.ts +1 -0
- package/dist/ext/meta.js +39 -0
- package/dist/ext/meta.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/context-base.d.ts +1 -0
- package/dist/lib/context-base.js +30 -0
- package/dist/lib/context-base.js.map +1 -0
- package/dist/lib/deprecate.d.ts +1 -0
- package/dist/lib/deprecate.js +34 -0
- package/dist/lib/deprecate.js.map +1 -0
- package/dist/lib/escape-regexp.d.ts +1 -0
- package/dist/lib/escape-regexp.js +12 -0
- package/dist/lib/escape-regexp.js.map +1 -0
- package/dist/lib/exports-helper.d.ts +1 -0
- package/dist/lib/exports-helper.js +101 -0
- package/dist/lib/exports-helper.js.map +1 -0
- package/dist/lib/http-context.d.ts +1 -0
- package/dist/lib/http-context.js +484 -0
- package/dist/lib/http-context.js.map +1 -0
- package/dist/lib/http-invocation.d.ts +1 -0
- package/dist/lib/http-invocation.js +254 -0
- package/dist/lib/http-invocation.js.map +1 -0
- package/dist/lib/jsonrpc-adapter.d.ts +1 -0
- package/dist/lib/jsonrpc-adapter.js +187 -0
- package/dist/lib/jsonrpc-adapter.js.map +1 -0
- package/dist/lib/looks-like-json.d.ts +1 -0
- package/dist/lib/looks-like-json.js +22 -0
- package/dist/lib/looks-like-json.js.map +1 -0
- package/dist/lib/messages.d.ts +1 -0
- package/dist/lib/messages.js +24 -0
- package/dist/lib/messages.js.map +1 -0
- package/dist/lib/number-checks.d.ts +1 -0
- package/dist/lib/number-checks.js +18 -0
- package/dist/lib/number-checks.js.map +1 -0
- package/dist/lib/phases/merge-phase-name-lists.d.ts +5 -0
- package/dist/lib/phases/merge-phase-name-lists.d.ts.map +1 -0
- package/dist/lib/phases/merge-phase-name-lists.js +39 -0
- package/dist/lib/phases/merge-phase-name-lists.js.map +1 -0
- package/dist/lib/phases/phase-list.d.ts +27 -0
- package/dist/lib/phases/phase-list.d.ts.map +1 -0
- package/dist/lib/phases/phase-list.js +154 -0
- package/dist/lib/phases/phase-list.js.map +1 -0
- package/dist/lib/phases/phase.d.ts +24 -0
- package/dist/lib/phases/phase.d.ts.map +1 -0
- package/dist/lib/phases/phase.js +144 -0
- package/dist/lib/phases/phase.js.map +1 -0
- package/dist/lib/remote-objects.d.ts +1 -0
- package/dist/lib/remote-objects.js +642 -0
- package/dist/lib/remote-objects.js.map +1 -0
- package/dist/lib/rest-adapter-browser.d.ts +1 -0
- package/dist/lib/rest-adapter-browser.js +302 -0
- package/dist/lib/rest-adapter-browser.js.map +1 -0
- package/dist/lib/rest-adapter.d.ts +1 -0
- package/dist/lib/rest-adapter.js +519 -0
- package/dist/lib/rest-adapter.js.map +1 -0
- package/dist/lib/server-sent-events.d.ts +1 -0
- package/dist/lib/server-sent-events.js +61 -0
- package/dist/lib/server-sent-events.js.map +1 -0
- package/dist/lib/shared-class.d.ts +1 -0
- package/dist/lib/shared-class.js +207 -0
- package/dist/lib/shared-class.js.map +1 -0
- package/dist/lib/shared-method.d.ts +1 -0
- package/dist/lib/shared-method.js +469 -0
- package/dist/lib/shared-method.js.map +1 -0
- package/dist/lib/socket-io-adapter.d.ts +1 -0
- package/dist/lib/socket-io-adapter.js +93 -0
- package/dist/lib/socket-io-adapter.js.map +1 -0
- package/dist/lib/socket-io-context.d.ts +1 -0
- package/dist/lib/socket-io-context.js +94 -0
- package/dist/lib/socket-io-context.js.map +1 -0
- package/dist/lib/type-registry.d.ts +1 -0
- package/dist/lib/type-registry.js +99 -0
- package/dist/lib/type-registry.js.map +1 -0
- package/dist/lib/types/any.d.ts +1 -0
- package/dist/lib/types/any.js +44 -0
- package/dist/lib/types/any.js.map +1 -0
- package/dist/lib/types/array.d.ts +1 -0
- package/dist/lib/types/array.js +99 -0
- package/dist/lib/types/array.js.map +1 -0
- package/dist/lib/types/boolean.d.ts +1 -0
- package/dist/lib/types/boolean.js +37 -0
- package/dist/lib/types/boolean.js.map +1 -0
- package/dist/lib/types/date.d.ts +1 -0
- package/dist/lib/types/date.js +37 -0
- package/dist/lib/types/date.js.map +1 -0
- package/dist/lib/types/geopoint.d.ts +1 -0
- package/dist/lib/types/geopoint.js +68 -0
- package/dist/lib/types/geopoint.js.map +1 -0
- package/dist/lib/types/integer.d.ts +1 -0
- package/dist/lib/types/integer.js +36 -0
- package/dist/lib/types/integer.js.map +1 -0
- package/dist/lib/types/number.d.ts +1 -0
- package/dist/lib/types/number.js +30 -0
- package/dist/lib/types/number.js.map +1 -0
- package/dist/lib/types/object.d.ts +1 -0
- package/dist/lib/types/object.js +57 -0
- package/dist/lib/types/object.js.map +1 -0
- package/dist/lib/types/string.d.ts +1 -0
- package/dist/lib/types/string.js +29 -0
- package/dist/lib/types/string.js.map +1 -0
- package/dist/phases.d.ts +4 -0
- package/dist/phases.js +35 -0
- package/dist/phases.js.map +1 -0
- package/package.json +96 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-objects.js","names":["exports"],"sources":["../../src/lib/remote-objects.ts"],"sourcesContent":["// Copyright IBM Corp. 2013,2018. All Rights Reserved.\n// Node module: strong-remoting\n// This file is licensed under the Artistic License 2.0.\n// License text available at https://opensource.org/licenses/Artistic-2.0\n\n// @ts-nocheck\n'use strict';\n\nconst g = require('./messages');\n/*!\n * Expose `RemoteObjects`.\n */\nmodule.exports = RemoteObjects;\n\n/*!\n * Module dependencies.\n */\n\nconst EventEmitter = require('eventemitter2').EventEmitter2;\nconst debug = require('debug')('strong-remoting:remotes');\nconst deprecated = require('./deprecate')('strong-remoting');\nconst util = require('util');\nconst inherits = util.inherits;\nconst assert = require('assert');\nconst SharedClass = require('./shared-class');\nconst SharedMethod = require('./shared-method');\nconst ExportsHelper = require('./exports-helper');\nconst PhaseList = require('../phases').PhaseList;\nconst TypeRegistry = require('./type-registry');\n\n// require the rest adapter for browserification\n// TODO(ritch) remove this somehow...?\nrequire('./rest-adapter');\n\n/**\n * Create a new `RemoteObjects` with the given `options`.\n *\n * ```js\n * var remoteObjects = require('strong-remoting').create();\n * ```\n *\n * @param {Object} options\n * @return {RemoteObjects}\n * @class\n * @property {Object} auth Authentication options used by underlying adapters\n * to set authorization metadata. **The `rest` adapter supports:**\n *\n * - **basic** - `username` and `password` are required.\n * - **digest** - `username` and `password` required and `sendImmediately` must\n * be false.\n * - **bearer** - `bearer` must be set as the bearer token\n *\n * @property {String} auth.username\n * @property {String} auth.password\n * @property {String} auth.bearer The **bearer token**.\n * @property {Boolean} auth.sendImmediately Defaults to `false`.\n */\n\nfunction RemoteObjects(options) {\n EventEmitter.call(this, { wildcard: true });\n // Avoid warning: possible EventEmitter memory leak detected\n this.setMaxListeners(16);\n this.options = options || {};\n this.exports = this.options.exports || {};\n this._typeRegistry = new TypeRegistry(this.options.types);\n this._classes = {};\n\n this._setupPhases();\n}\n\n/*!\n * Inherit from `EventEmitter`.\n */\n\ninherits(RemoteObjects, EventEmitter);\n\n/*!\n * Simplified APIs\n */\n\nRemoteObjects.create = function (options) {\n return new RemoteObjects(options);\n};\n\nRemoteObjects.extend = function (exports) {\n return new ExportsHelper(exports);\n};\n\n/**\n * Create a handler from the given adapter.\n *\n * @param {String} nameOrClass Adapter name or provided adapter class\n * @param {Object} options Adapter options\n * @return {Function}\n */\n\nRemoteObjects.prototype.handler = function (nameOrClass, options) {\n const Adapter = this.adapter(nameOrClass);\n const adapter = new Adapter(this, options);\n const handler = adapter.createHandler();\n\n if (handler) {\n // allow adapter reference from handler\n handler.adapter = adapter;\n }\n\n return handler;\n};\n\n/**\n * Create a connection to a remoting server.\n *\n * @param {String} url Server root\n * @param {String} name Name of the adapter (eg. \"rest\")\n */\n\nRemoteObjects.prototype.connect = function (url, name) {\n // parse URL for auth\n let urlWithoutAuth = url;\n let auth;\n\n const parsedUrl = URL.canParse(url) ? new URL(url) : null;\n // If base parsedUrl contains auth, extract it so we can set it separately\n if (parsedUrl && (parsedUrl.username || parsedUrl.password)) {\n auth = this.auth = {};\n auth.username = parsedUrl.username;\n auth.password = parsedUrl.password;\n // set base without auth so request honours our auth options\n parsedUrl.username = '';\n parsedUrl.password = '';\n urlWithoutAuth = parsedUrl.toString();\n // ensure a \"/\" hasn't been appended where there wasn't one before\n if (url[url.length - 1] !== urlWithoutAuth[urlWithoutAuth.length - 1]) {\n urlWithoutAuth = urlWithoutAuth.slice(0, -1);\n }\n }\n\n const Adapter = this.adapter(name);\n const adapter = new Adapter(this);\n this.serverAdapter = adapter;\n return adapter.connect(urlWithoutAuth);\n};\n\n/**\n * Invoke a method on a remote server using the connected adapter.\n *\n * @param {String} method The remote method string\n * @param {String} [ctorArgs] Constructor arguments (for prototype methods)\n * @param {String} [args] Method arguments\n * @callback {Function} [callback] callback\n * @param {Error} err\n * @param {Any} arg...\n * @end\n */\n\nRemoteObjects.prototype.invoke = function (method, ctorArgs, args, callback) {\n assert(\n this.serverAdapter,\n g.f('Cannot invoke method without an adapter. See {{RemoteObjects#connect().}}'),\n );\n return this.serverAdapter.invoke.apply(this.serverAdapter, arguments, callback);\n};\n\n/**\n * Get an adapter by name.\n * @param {String} nameOrClass The adapter name or provided class\n * @return {Adapter}\n */\n\nRemoteObjects.prototype.adapter = function (nameOrClass) {\n if (typeof nameOrClass === 'function') {\n // Throws an error if the provided adapter doesn't meets the requirements\n this.validateAdapter(nameOrClass);\n\n return nameOrClass;\n } else {\n const adapterModulePath = './' + nameOrClass + '-adapter.js';\n try {\n return require(adapterModulePath);\n } catch (error) {\n if (\n !error ||\n error.code !== 'MODULE_NOT_FOUND' ||\n !String(error.message || '').includes(adapterModulePath)\n ) {\n throw error;\n }\n\n return require('./' + nameOrClass + '-adapter');\n }\n }\n};\n\nRemoteObjects.prototype.getRequiredAdapterMethods = () => ['createHandler'];\n\nRemoteObjects.prototype.validateAdapter = function (Adapter) {\n const requiredMethods = this.getRequiredAdapterMethods();\n\n const notImplementedMethods = requiredMethods.filter(\n (methodString) => typeof Adapter.prototype[methodString] !== 'function',\n );\n\n if (notImplementedMethods.length > 0) {\n throw new Error(\n g.f(\n 'Invalid adapter class. The provided adapter class does not implement' +\n ' the following required methods: %s',\n notImplementedMethods.join(', '),\n ),\n );\n }\n\n return Adapter;\n};\n\n/**\n * Get all classes.\n */\n\nRemoteObjects.prototype.classes = function (options) {\n options = options || {};\n const exports = this.exports;\n const result = [];\n const sharedClasses = this._classes;\n const exportNames = Object.keys(exports);\n const sharedClassNames = Object.keys(sharedClasses);\n\n for (let i = 0; i < exportNames.length; i++) {\n const name = exportNames[i];\n result.push(new SharedClass(name, exports[name], options));\n }\n\n for (let i = 0; i < sharedClassNames.length; i++) {\n result.push(sharedClasses[sharedClassNames[i]]);\n }\n\n return result;\n};\n\n/**\n * Add a shared class.\n *\n * @param {SharedClass} sharedClass\n */\n\nRemoteObjects.prototype.addClass = function (sharedClass) {\n assert(\n sharedClass && sharedClass.constructor.name === 'SharedClass',\n g.f('must provide a valid {{SharedClass}}'),\n );\n this._classes[sharedClass.name] = sharedClass;\n};\n\n/**\n * Remove a previously-registered shared class.\n *\n * @param {string} className The name of the shared class to remove.\n */\nRemoteObjects.prototype.deleteClassByName = function (className) {\n delete this._classes[className];\n Object.keys(this.listenerTree).forEach((hooktype) => {\n delete this.listenerTree[hooktype][className];\n });\n};\n\n/**\n * Find a method by its string name.\n *\n * @param {String} methodString String specifying the method. For example:\n *\n * - `MyClass.prototype.myMethod`\n * - `MyClass.staticMethod`\n * - `obj.method`\n */\n\nRemoteObjects.prototype.findMethod = function (methodString) {\n const classes = this.classes();\n\n for (let i = 0; i < classes.length; i++) {\n const methods = classes[i].methods();\n for (let j = 0; j < methods.length; j++) {\n if (methods[j].stringName === methodString) return methods[j];\n }\n }\n};\n\n/**\n * List all methods.\n */\n\nRemoteObjects.prototype.methods = function () {\n const methods = [];\n const classes = this.classes();\n\n for (let i = 0; i < classes.length; i++) {\n const classMethods = classes[i].methods();\n for (let j = 0; j < classMethods.length; j++) {\n methods.push(classMethods[j]);\n }\n }\n\n return methods;\n};\n\n/**\n * Get as JSON.\n */\n\nRemoteObjects.prototype.toJSON = function () {\n const result = {};\n const methods = this.methods();\n\n for (let i = 0; i < methods.length; i++) {\n const sharedMethod = methods[i];\n result[sharedMethod.stringName] = {\n http: sharedMethod.fn && sharedMethod.fn.http,\n accepts: sharedMethod.accepts,\n returns: sharedMethod.returns,\n errors: sharedMethod.errors,\n };\n }\n\n return result;\n};\n\n/**\n * Execute the given function before the matched method string.\n *\n * @example\n *\n * Do something before the `user.greet` method is called:\n * ```js\n * remotes.before('user.greet', function(ctx, next) {\n * if ((ctx.req.param('password') || '').toString() !== '1234') {\n * next(new Error('Bad password!'));\n * } else {\n * next();\n * }\n * });\n * ```\n *\n * Do something before any `user` method:\n * ```js\n * remotes.before('user.*', function(ctx, next) {\n * console.log('Calling a user method.');\n * next();\n * });\n * ```\n *\n * Do something before a `dog` instance method:\n * ```js\n * remotes.before('dog.prototype.*', function(ctx, next) {\n * var dog = this;\n * console.log('Calling a method on \"%s\".', dog.name);\n * next();\n * });\n * ```\n *\n * @param {String} methodMatch The glob to match a method string\n * @callback {Function} hook\n * @param {Context} ctx The adapter specific context\n * @param {Function} next Call with an optional error object\n * @param {SharedMethod} method The SharedMethod object\n */\n\nRemoteObjects.prototype.before = function (methodMatch, fn) {\n this.on('before.' + methodMatch, fn);\n};\n\n/**\n * Execute the given `hook` function after the matched method string.\n *\n * @example\n *\n * Do something after the `speak` instance method.\n * NOTE: you cannot cancel a method after it has been called.\n * ```js\n * remotes.after('dog.prototype.speak', function(ctx, next) {\n * console.log('After speak!');\n * next();\n * });\n *```\n *\n * Do something before all methods.\n ```js\n * remotes.before('**', function(ctx, next, method) {\n * console.log('Calling:', method.name);\n * next();\n * });\n * ```\n *\n * Modify all returned values named `result`.\n * ```js\n * remotes.after('**', function(ctx, next) {\n * ctx.result += '!!!';\n * next();\n * });\n * ```\n *\n * @param {String} methodMatch The glob to match a method string\n * @callback {Function} hook\n * @param {Context} ctx The adapter specific context\n * @param {Function} next Call with an optional error object\n * @param {SharedMethod} method The SharedMethod object\n */\n\nRemoteObjects.prototype.after = function (methodMatch, fn) {\n this.on('after.' + methodMatch, fn);\n};\n\n/**\n * Execute the given `hook` function after the method matched by the method\n * string failed.\n *\n * @example\n * Do something after the `speak` instance method failed.\n *\n * ```js\n * remotes.afterError('dog.prototype.speak', function(ctx, next) {\n * console.log('Cannot speak!', ctx.error);\n * next();\n * });\n * ```\n *\n * Do something before all methods:\n * ```js\n * remotes.afterError('**', function(ctx, next, method) {\n * console.log('Failed', method.name, ctx.error);\n * next();\n * });\n * ```\n *\n * Modify all returned errors:\n * ```js\n * remotes.after('**', function(ctx, next) {\n * if (!ctx.error.details) ctx.result.details = {};\n * ctx.error.details.info = 'intercepted by a hook';\n * next();\n * });\n * ```\n *\n * Report a different error:\n * ```js\n * remotes.after('dog.prototype.speak', function(ctx, next) {\n * console.error(ctx.error);\n * next(new Error('See server console log for details.'));\n * });\n * ```\n *\n * @param {String} methodMatch The glob to match a method string\n * @callback {Function} hook\n * @param {Context} ctx The adapter specific context\n * @param {Function} next Call with an optional error object\n * @param {SharedMethod} method The SharedMethod object\n */\n\nRemoteObjects.prototype.afterError = function (methodMatch, fn) {\n this.on('afterError.' + methodMatch, fn);\n};\n\nRemoteObjects.prototype.registerPhaseHandler = function (phaseName, methodNameWildcard, handler) {\n const pattern = methodNameWildcard\n .replace(/[.+?^${}()|[\\]\\\\]/g, '\\\\$&')\n // single star matches one segment only\n .replace(/(^|\\.)\\*($|\\.)/g, '$1[^.]*$2')\n // double-start match one or more segments\n .replace(/(^|\\.)\\*\\*($|\\.)/g, '$1.*$2');\n const matcher = new RegExp('^' + pattern + '$');\n\n debug('registerPhaseHandler(%j) -> pattern %j', methodNameWildcard, pattern);\n\n this.phases.registerHandler(phaseName, function matchHandler(ctx, next) {\n if (matcher.test(ctx.method.stringName)) {\n handler(ctx, next);\n } else {\n next();\n }\n });\n};\n\n/*!\n * Create a middleware style emit that supports wildcards.\n */\n\nRemoteObjects.prototype.execHooks = function (when, method, scope, ctx, next) {\n let stack;\n let stackIndex = 0;\n let stackLength = 0;\n const isStatic = method.isStatic || (method.sharedMethod && method.sharedMethod.isStatic);\n let type, handler;\n\n // Commented-out by bajtos: init is not defined.\n // this._events || init.call(this);\n\n // context\n this.objectName =\n (method.sharedClass && method.sharedClass.name) || (method.restClass && method.restClass.name);\n\n this.methodName = method.name;\n\n if (method.fullName) {\n type = when + '.' + method.fullName;\n } else {\n type = when + '.' + this.objectName + (isStatic ? '.' : '.prototype.') + this.methodName;\n }\n\n if (this.wildcard) {\n stack = [];\n const ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();\n searchListenerTree.call(this, stack, ns, this.listenerTree, 0);\n } else {\n handler = this._events[type];\n if (typeof handler === 'function') {\n this.event = type;\n stack = [handler];\n } else if (handler) {\n stack = handler;\n } else {\n return next();\n }\n }\n\n stackLength = stack.length;\n if (stackLength === 0) {\n return next();\n }\n\n function execStack(err) {\n if (err) return next(err);\n\n if (stackIndex >= stackLength) {\n next();\n return;\n }\n\n const cur = stack[stackIndex++];\n if (!cur) {\n execStack();\n return;\n }\n\n let hookCompleted = false;\n try {\n const advance = function (advanceErr) {\n if (hookCompleted) {\n return;\n }\n hookCompleted = true;\n execStack(advanceErr);\n };\n\n const result = cur.call(scope, ctx, advance, method);\n if (result && typeof result.then === 'function') {\n result.then(\n function () {\n advance();\n },\n function (promiseErr) {\n advance(promiseErr);\n },\n );\n }\n } catch (err) {\n if (!hookCompleted) {\n next(err);\n }\n }\n }\n\n return execStack();\n};\n\n// from EventEmitter2\nfunction searchListenerTree(handlers, type, tree, i) {\n if (!tree) {\n return;\n }\n\n let leaf, len, branch, isolatedBranch, endReached;\n const typeLength = type.length;\n const currentType = type[i];\n const nextType = type[i + 1];\n\n if (i === typeLength && tree._listeners) {\n //\n // If at the end of the event(s) list and the tree has listeners\n // invoke those listeners.\n //\n if (typeof tree._listeners === 'function') {\n if (handlers) handlers.push(tree._listeners);\n return;\n } else {\n for (leaf = 0, len = tree._listeners.length; leaf < len; leaf++) {\n if (handlers) handlers.push(tree._listeners[leaf]);\n }\n return;\n }\n }\n\n if (currentType === '*' || currentType === '**' || tree[currentType]) {\n //\n // If the event emitted is '*' at this part\n // or there is a concrete match at this patch\n //\n if (currentType === '*') {\n for (branch in tree) {\n if (branch !== '_listeners' && Object.prototype.hasOwnProperty.call(tree, branch)) {\n searchListenerTree(handlers, type, tree[branch], i + 1);\n }\n }\n return;\n } else if (currentType === '**') {\n endReached = i + 1 === typeLength || (i + 2 === typeLength && nextType === '*');\n if (endReached && tree._listeners) {\n // The next element has a _listeners, add it to the handlers.\n searchListenerTree(handlers, type, tree, typeLength);\n }\n\n for (branch in tree) {\n if (branch !== '_listeners' && Object.prototype.hasOwnProperty.call(tree, branch)) {\n if (branch === '*' || branch === '**') {\n if (tree[branch]._listeners && !endReached) {\n searchListenerTree(handlers, type, tree[branch], typeLength);\n }\n searchListenerTree(handlers, type, tree[branch], i);\n } else if (branch === nextType) {\n searchListenerTree(handlers, type, tree[branch], i + 2);\n } else {\n // No match on this one, shift into the tree but not in the type array.\n searchListenerTree(handlers, type, tree[branch], i);\n }\n }\n }\n return;\n }\n\n searchListenerTree(handlers, type, tree[currentType], i + 1);\n }\n\n const xTree = tree['*'];\n if (xTree) {\n //\n // If the listener tree will allow any match for this part,\n // then recursively explore all branches of the tree\n //\n searchListenerTree(handlers, type, xTree, i + 1);\n }\n\n const xxTree = tree['**'];\n if (xxTree) {\n if (i < typeLength) {\n if (xxTree._listeners) {\n // If we have a listener on a '**', it will catch all, so add its handler.\n searchListenerTree(handlers, type, xxTree, typeLength);\n }\n\n // Build arrays of matching next branches and others.\n for (branch in xxTree) {\n if (branch !== '_listeners' && Object.prototype.hasOwnProperty.call(xxTree, branch)) {\n if (branch === nextType) {\n // We know the next element will match, so jump twice.\n searchListenerTree(handlers, type, xxTree[branch], i + 2);\n } else if (branch === currentType) {\n // Current node matches, move into the tree.\n searchListenerTree(handlers, type, xxTree[branch], i + 1);\n } else {\n isolatedBranch = {};\n isolatedBranch[branch] = xxTree[branch];\n searchListenerTree(handlers, type, { '**': isolatedBranch }, i + 1);\n }\n }\n }\n } else if (xxTree._listeners) {\n // We have reached the end and still on a '**'\n searchListenerTree(handlers, type, xxTree, typeLength);\n } else if (xxTree['*'] && xxTree['*']._listeners) {\n searchListenerTree(handlers, type, xxTree['*'], typeLength);\n }\n }\n}\n\nRemoteObjects.prototype._executeAuthorizationHook = function (ctx, cb) {\n if (typeof this.authorization === 'function') {\n this.authorization(ctx, cb);\n } else {\n process.nextTick(function () {\n cb();\n });\n }\n};\n\nRemoteObjects.prototype._setupPhases = function () {\n const self = this;\n self.phases = new PhaseList();\n const auth = self.phases.add('auth');\n const invoke = self.phases.add('invoke');\n\n auth.use(function phaseAuthorization(ctx, next) {\n self._executeAuthorizationHook(ctx, next);\n });\n\n invoke.before(function reportSharedCtorError(ctx, next) {\n next(ctx.sharedCtorError);\n });\n\n invoke.before(function phaseBeforeInvoke(ctx, next) {\n self.execHooks('before', ctx.method, ctx.getScope(), ctx, next);\n });\n\n invoke.use(function phaseInvoke(ctx, next) {\n ctx.invoke(ctx.getScope(), ctx.method, function (err, result) {\n if (!err) ctx.result = result;\n next(err);\n });\n });\n\n invoke.after(function phaseAfterInvoke(ctx, next) {\n self.execHooks('after', ctx.method, ctx.getScope(), ctx, next);\n });\n};\n\n/**\n * Invoke the given shared method using the supplied context.\n * Execute registered before/after hooks.\n *\n * @param {Object} ctx\n * @param {Object} method\n * @param {function(Error=)} cb\n */\nRemoteObjects.prototype.invokeMethodInContext = function (ctx, method, cb) {\n const self = this;\n const scope = ctx.getScope();\n\n if (cb === undefined && typeof method === 'function') {\n // the new API with two arguments\n cb = method;\n method = ctx.method;\n } else {\n // backwards compatibility: invokeMethodInContext(ctx, method, cb)\n // TODO remove in v3.0\n assert.equal(method, ctx.method);\n deprecated(\n 'invokeMethodInContext(ctx, method, cb) is deprecated.' +\n 'Pass the method as ctx.method instead.',\n );\n }\n\n self.phases.run(ctx, function interceptInvocationErrors(err) {\n if (!err) return cb();\n\n ctx.error = err;\n self.execHooks('afterError', method, scope, ctx, function (hookErr) {\n cb(hookErr || err);\n });\n });\n};\n\n/**\n * Determine what scope object to use when invoking the given remote method in\n * the given context.\n * @private\n */\n\nRemoteObjects.prototype.getScope = function (ctx, method) {\n deprecated('remoteObjects.getScope(ctx, method) is deprecated, ' + 'use ctx.getScope() instead');\n assert.equal(ctx.method, method);\n return ctx.getScope();\n};\n\n/**\n * Define a named type conversion. The conversion is used when a\n * `SharedMethod` argument defines a type with the given `name`.\n *\n * See also `remotes.defineObjectType`.\n *\n * @example\n *\n * ```js\n * remotes.defineType('MyType', {\n * // Convert the raw \"value\" coming typically from JSON.\n * // Use the remoting context in \"ctx\" to access the type registry and\n * // other request-related information.\n * fromTypedValue: function(ctx, value) {\n * if (value === undefined || value === null)\n * return { value: value };\n *\n * value = new MyType(value);\n * var error = this.validate(ctx, value);\n * return error ? { error: error } : { value: value };\n * },\n *\n * // Apply any coercion needed to convert values coming from\n * // string-only sources like HTTP headers and query string.\n * //\n * // A sloppy value is one of:\n * // - a string\n * // - an array containing sloppy values\n * // - an object where property values are sloppy\n * fromSloppyValue: function(ctx, value) {\n * var objectConverter = ctx.typeRegistry.getConverter('object');\n * var result = objectConverter.fromSloppyString(ctx, value);\n * return result.error ? result : this.fromTypedValue(ctx, result.value);\n * },\n *\n * // Perform basic validation of the value. Validations are required to be\n * // synchronous.\n * validate: function(ctx, value) {\n * if (value === undefined || value === null)\n * return null;\n * if (typeof value !== 'object' || !(value instanceof MyType) {\n * return new Error('Value is not an instance of MyType.');\n * }\n * return null;\n * },\n * });\n * ```\n *\n * @param {String} name The type name\n * @param {Object} converter A converter implementing the following methods:\n *\n * - `fromTypedValue(ctx, value) -> { value } or { error }`\n * - `fromSloppyValue(ctx, value) -> { value } or { error }`\n * - `validate(ctx, value) -> error or undefined/null`\n */\n\nRemoteObjects.prototype.defineType = function (name, converter) {\n if (typeof converter === 'function') {\n throw new Error(\n g.f(\n '%s is no longer supported. Use one of the new APIs instead: %s or %s',\n 'remoteObjects.defineType(name, fn)',\n 'remoteObjects.defineObjectType(name, factoryFn)',\n 'remoteObjects.defineType(name, converter)',\n ),\n );\n }\n this._typeRegistry.defineType(name, converter);\n};\n\n/**\n * Define a named type conversion for an object-like type.\n * The conversion is used when a `SharedMethod` argument\n * defines a type with the given `name`.\n *\n * Under the hood, a converter is created that ensures the input data\n * is an object (or sloppy value is coerced to an object) and calls\n * the provided factory function to convert plain data object to\n * a class instance.\n *\n * @example\n *\n * ```js\n * remotes.defineObjectType('MyClass', function(data) {\n * return new MyClass(data);\n * });\n * ```\n *\n * @param {String} name The type name\n * @param {Function(Object)} factoryFn Factory function creating object\n * instance from a plain-data object.\n */\nRemoteObjects.prototype.defineObjectType = function (name, factoryFn) {\n this._typeRegistry.registerObjectType(name, factoryFn);\n};\n\n/**\n * Remove a type registered via `defineType` or `defineObjectType`.\n *\n * @param {String} name The type name.\n */\nRemoteObjects.prototype.deleteTypeByName = function (name) {\n delete this._typeRegistry._types[name.toLowerCase()];\n};\n\nRemoteObjects.convert = RemoteObjects.prototype.convert = function (name, fn) {\n throw new Error(\n g.f(\n 'RemoteObjects.convert(name, fn) is no longer supported. ' +\n 'Use remoteObjects.defineType(name, converter) instead.',\n ),\n );\n};\n\nRemoteObjects.defineType = function (name, fn) {\n throw new Error(\n g.f(\n 'RemoteObjects.defineType(name, fn) is no longer supported. ' +\n 'Use remoteObjects.defineType(name, converter) instead.',\n ),\n );\n};\n"],"mappings":";;;;;;;;;;;;CAQA,MAAM,IAAA;;;;AAIN,QAAO,UAAU;;;;CAMjB,MAAM,eAAe,QAAQ,gBAAgB,CAAC;CAC9C,MAAM,QAAQ,QAAQ,QAAQ,CAAC,0BAA0B;CACzD,MAA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AAI,MACR,EAAE,EACA,oHAED,CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const require_lib_messages = require("./messages.js");
|
|
3
|
+
const require_lib_deprecate = require("./deprecate.js");
|
|
4
|
+
const require_lib_http_invocation = require("./http-invocation.js");
|
|
5
|
+
//#region src/lib/rest-adapter-browser.ts
|
|
6
|
+
const g = require_lib_messages;
|
|
7
|
+
module.exports = RestAdapter;
|
|
8
|
+
RestAdapter.RestClass = RestClass;
|
|
9
|
+
RestAdapter.RestMethod = RestMethod;
|
|
10
|
+
const deprecated = require_lib_deprecate("strong-remoting");
|
|
11
|
+
const EventEmitter = require("events").EventEmitter;
|
|
12
|
+
const debug = require("debug")("strong-remoting:rest-adapter");
|
|
13
|
+
const inherits = require("util").inherits;
|
|
14
|
+
const assert = require("assert");
|
|
15
|
+
const HttpInvocation = require_lib_http_invocation;
|
|
16
|
+
function RestAdapter(remotes, options) {
|
|
17
|
+
EventEmitter.call(this);
|
|
18
|
+
this.remotes = remotes;
|
|
19
|
+
this.options = options || (remotes.options || {}).rest || {};
|
|
20
|
+
this.typeRegistry = remotes._typeRegistry;
|
|
21
|
+
}
|
|
22
|
+
inherits(RestAdapter, EventEmitter);
|
|
23
|
+
RestAdapter.create = RestAdapter.createRestAdapter = function(remotes) {
|
|
24
|
+
return new RestAdapter(remotes);
|
|
25
|
+
};
|
|
26
|
+
RestAdapter.prototype.getRoutes = function(obj) {
|
|
27
|
+
return getRoutes(obj, this.options);
|
|
28
|
+
};
|
|
29
|
+
function getRoutes(obj, options) {
|
|
30
|
+
let routes = obj.http;
|
|
31
|
+
if (routes && !Array.isArray(routes)) routes = [routes];
|
|
32
|
+
const classOptions = (obj.sharedClass || obj).options;
|
|
33
|
+
let normalize = classOptions && classOptions.normalizeHttpPath;
|
|
34
|
+
if (normalize === void 0 && options) normalize = options.normalizeHttpPath;
|
|
35
|
+
const toPath = normalize ? normalizeHttpPath : untransformedPath;
|
|
36
|
+
if (routes) routes.forEach(function(r) {
|
|
37
|
+
r.verb = String(r.verb || "all").toLowerCase();
|
|
38
|
+
r.path = toPath(r.path || "/" + obj.name);
|
|
39
|
+
});
|
|
40
|
+
else if (obj.name === "sharedCtor") routes = [{
|
|
41
|
+
verb: "all",
|
|
42
|
+
path: "/prototype"
|
|
43
|
+
}];
|
|
44
|
+
else routes = [{
|
|
45
|
+
verb: "all",
|
|
46
|
+
path: obj.name ? toPath("/" + obj.name) : ""
|
|
47
|
+
}];
|
|
48
|
+
return routes;
|
|
49
|
+
}
|
|
50
|
+
function normalizeHttpPath(path) {
|
|
51
|
+
if (typeof path !== "string") return;
|
|
52
|
+
return path.replace(/[^\/]+/g, function(match) {
|
|
53
|
+
if (match.indexOf(":") > -1) return match;
|
|
54
|
+
return match.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/[_\s]+/g, "-").toLowerCase();
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function untransformedPath(path) {
|
|
58
|
+
return path;
|
|
59
|
+
}
|
|
60
|
+
RestAdapter.prototype.connect = function(url) {
|
|
61
|
+
this.connection = url;
|
|
62
|
+
};
|
|
63
|
+
RestAdapter.prototype._getInvocationAuth = function(invocationOptions) {
|
|
64
|
+
const auth = this.remotes.auth;
|
|
65
|
+
if (auth || !this.options.passAccessToken) return auth;
|
|
66
|
+
const accessToken = invocationOptions && invocationOptions.accessToken;
|
|
67
|
+
if (accessToken) return { accessToken };
|
|
68
|
+
};
|
|
69
|
+
RestAdapter.prototype.invoke = function(method, ctorArgs, args, callback) {
|
|
70
|
+
assert(this.connection, g.f("Cannot invoke method without a connection. See {{RemoteObjects#connect().}}"));
|
|
71
|
+
assert(typeof method === "string", g.f("method is required when calling {{invoke()}}"));
|
|
72
|
+
const lastArg = arguments[arguments.length - 1];
|
|
73
|
+
callback = typeof lastArg === "function" ? lastArg : void 0;
|
|
74
|
+
ctorArgs = Array.isArray(ctorArgs) ? ctorArgs : [];
|
|
75
|
+
if (!Array.isArray(args)) {
|
|
76
|
+
args = ctorArgs;
|
|
77
|
+
ctorArgs = [];
|
|
78
|
+
}
|
|
79
|
+
const remotes = this.remotes;
|
|
80
|
+
const restMethod = this.getRestMethodByName(method);
|
|
81
|
+
if (!restMethod) return callback(new Error(g.f("Cannot invoke unkown method: %s", method)));
|
|
82
|
+
const invokeOptions = restMethod.getArgByName("options", args);
|
|
83
|
+
const auth = this._getInvocationAuth(invokeOptions);
|
|
84
|
+
const invocation = new HttpInvocation(restMethod, ctorArgs, args, this.connection, auth, this.typeRegistry);
|
|
85
|
+
const ctx = invocation.context;
|
|
86
|
+
ctx.req = invocation.createRequest();
|
|
87
|
+
const scope = ctx.getScope();
|
|
88
|
+
remotes.execHooks("before", restMethod, scope, ctx, function(err) {
|
|
89
|
+
if (err) return callback(err);
|
|
90
|
+
invocation.invoke(function(err) {
|
|
91
|
+
if (err) return callback(err);
|
|
92
|
+
const invokeArgs = Array.prototype.slice.call(arguments);
|
|
93
|
+
ctx.result = invokeArgs.slice(1);
|
|
94
|
+
ctx.res = invocation.getResponse();
|
|
95
|
+
remotes.execHooks("after", restMethod, scope, ctx, function(err) {
|
|
96
|
+
if (err) return callback(err);
|
|
97
|
+
callback.apply(invocation, invokeArgs);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
RestAdapter.prototype._createRestMethodByNameCache = function() {
|
|
103
|
+
const restMethodByNameMap = {};
|
|
104
|
+
const classes = this.getClasses();
|
|
105
|
+
for (let i = 0; i < classes.length; i++) {
|
|
106
|
+
const restClass = classes[i];
|
|
107
|
+
for (let j = 0; j < restClass.methods.length; j++) {
|
|
108
|
+
const restMethod = restClass.methods[j];
|
|
109
|
+
restMethodByNameMap[restMethod.fullName] = restMethod;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return restMethodByNameMap;
|
|
113
|
+
};
|
|
114
|
+
RestAdapter.prototype.getRestMethodByName = function(name) {
|
|
115
|
+
let ret;
|
|
116
|
+
if (this._cachedRestMethodsByName) ret = this._cachedRestMethodsByName[name];
|
|
117
|
+
if (!ret) {
|
|
118
|
+
this._cachedRestMethodsByName = this._createRestMethodByNameCache();
|
|
119
|
+
ret = this._cachedRestMethodsByName[name];
|
|
120
|
+
}
|
|
121
|
+
if (ret && !ret.sharedMethod.sharedClass.isMethodEnabled(ret.sharedMethod)) ret = void 0;
|
|
122
|
+
return ret;
|
|
123
|
+
};
|
|
124
|
+
function sortRoutes(r1, r2) {
|
|
125
|
+
const a = r1.route;
|
|
126
|
+
const b = r2.route;
|
|
127
|
+
let verb1 = a.verb.toLowerCase();
|
|
128
|
+
let verb2 = b.verb.toLowerCase();
|
|
129
|
+
if (verb1 === "del") verb1 = "delete";
|
|
130
|
+
if (verb2 === "del") verb2 = "delete";
|
|
131
|
+
if (verb1 > verb2) return -1;
|
|
132
|
+
if (verb1 < verb2) return 1;
|
|
133
|
+
const p1 = a.path.split("/");
|
|
134
|
+
const p2 = b.path.split("/");
|
|
135
|
+
const len = Math.min(p1.length, p2.length);
|
|
136
|
+
for (let i = 0; i < len; i++) {
|
|
137
|
+
if (p1[i] === "" && p2[i] !== "") return 1;
|
|
138
|
+
if (p1[i] !== "" && p2[i] === "") return -1;
|
|
139
|
+
if (p1[i][0] === ":" && p2[i][0] !== ":") return 1;
|
|
140
|
+
if (p1[i][0] !== ":" && p2[i][0] === ":") return -1;
|
|
141
|
+
if (p1[i] > p2[i]) return 1;
|
|
142
|
+
if (p1[i] < p2[i]) return -1;
|
|
143
|
+
}
|
|
144
|
+
return p2.length - p1.length;
|
|
145
|
+
}
|
|
146
|
+
RestAdapter.sortRoutes = sortRoutes;
|
|
147
|
+
RestAdapter.prototype.createHandler = function() {
|
|
148
|
+
throw new Error(g.f("The browser REST adapter does not support creating server handlers."));
|
|
149
|
+
};
|
|
150
|
+
RestAdapter.prototype.allRoutes = function() {
|
|
151
|
+
const routes = [];
|
|
152
|
+
const adapter = this;
|
|
153
|
+
const classes = this.remotes.classes(this.options);
|
|
154
|
+
let currentRoot = "";
|
|
155
|
+
classes.forEach(function(sc) {
|
|
156
|
+
adapter.getRoutes(sc).forEach(function(classRoute) {
|
|
157
|
+
currentRoot = classRoute.path;
|
|
158
|
+
sc.methods().forEach(function(method) {
|
|
159
|
+
adapter.getRoutes(method).forEach(function(route) {
|
|
160
|
+
if (method.isStatic) addRoute(route.verb, route.path, method);
|
|
161
|
+
else adapter.getRoutes(method.sharedCtor).forEach(function(sharedCtorRoute) {
|
|
162
|
+
addRoute(route.verb, sharedCtorRoute.path + route.path, method);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
return routes;
|
|
169
|
+
function addRoute(verb, path, method) {
|
|
170
|
+
if (path === "/" || path === "//") path = currentRoot;
|
|
171
|
+
else path = currentRoot + path;
|
|
172
|
+
if (path[path.length - 1] === "/") path = path.substr(0, path.length - 1);
|
|
173
|
+
path = path.replace(/\/\//g, "/");
|
|
174
|
+
routes.push({
|
|
175
|
+
verb,
|
|
176
|
+
path,
|
|
177
|
+
description: method.description,
|
|
178
|
+
notes: method.notes,
|
|
179
|
+
documented: method.documented,
|
|
180
|
+
method: method.stringName,
|
|
181
|
+
accepts: method.accepts && method.accepts.length ? method.accepts : void 0,
|
|
182
|
+
returns: method.returns && method.returns.length ? method.returns : void 0,
|
|
183
|
+
errors: method.errors && method.errors.length ? method.errors : void 0,
|
|
184
|
+
http: method.http
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
RestAdapter.prototype.getClasses = function() {
|
|
189
|
+
return this.remotes.classes(this.options).map((c) => new RestClass(c, this.options));
|
|
190
|
+
};
|
|
191
|
+
function RestClass(sharedClass, adapterOptions) {
|
|
192
|
+
nonEnumerableConstPropery(this, "sharedClass", sharedClass);
|
|
193
|
+
this.name = sharedClass.name;
|
|
194
|
+
this.options = adapterOptions;
|
|
195
|
+
this.routes = getRoutes(sharedClass, this.options);
|
|
196
|
+
this.ctor = sharedClass.sharedCtor && new RestMethod(this, sharedClass.sharedCtor);
|
|
197
|
+
this.methods = sharedClass.methods().filter(function(sm) {
|
|
198
|
+
return !sm.isSharedCtor;
|
|
199
|
+
}).map(function(sm) {
|
|
200
|
+
return new RestMethod(this, sm);
|
|
201
|
+
}.bind(this));
|
|
202
|
+
}
|
|
203
|
+
RestClass.prototype.getPath = function() {
|
|
204
|
+
return this.routes[0].path;
|
|
205
|
+
};
|
|
206
|
+
function RestMethod(restClass, sharedMethod) {
|
|
207
|
+
nonEnumerableConstPropery(this, "restClass", restClass);
|
|
208
|
+
nonEnumerableConstPropery(this, "sharedMethod", sharedMethod);
|
|
209
|
+
this.fullName = sharedMethod.stringName;
|
|
210
|
+
this.name = this.fullName.split(".").slice(1).join(".");
|
|
211
|
+
this.accepts = sharedMethod.accepts;
|
|
212
|
+
this.returns = sharedMethod.returns;
|
|
213
|
+
this.errors = sharedMethod.errors;
|
|
214
|
+
this.description = sharedMethod.description;
|
|
215
|
+
this.notes = sharedMethod.notes;
|
|
216
|
+
this.documented = sharedMethod.documented;
|
|
217
|
+
const methodRoutes = getRoutes(sharedMethod, restClass.options);
|
|
218
|
+
if (sharedMethod.isStatic || !restClass.ctor) this.routes = methodRoutes;
|
|
219
|
+
else {
|
|
220
|
+
const routes = this.routes = [];
|
|
221
|
+
methodRoutes.forEach(function(route) {
|
|
222
|
+
restClass.ctor.routes.forEach(function(ctorRoute) {
|
|
223
|
+
const fullRoute = Object.assign({}, route);
|
|
224
|
+
fullRoute.path = joinPaths(ctorRoute.path, route.path);
|
|
225
|
+
routes.push(fullRoute);
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
RestMethod.prototype.getArgByName = function(argName, invokedArgs) {
|
|
231
|
+
let argValue;
|
|
232
|
+
if (!this.accepts || !this.accepts.length) return void 0;
|
|
233
|
+
this.accepts.some(function(argProperty, i) {
|
|
234
|
+
if (argProperty.arg && argProperty.arg.toLowerCase() === argName.toLowerCase()) {
|
|
235
|
+
argValue = invokedArgs[i];
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
return false;
|
|
239
|
+
});
|
|
240
|
+
return argValue;
|
|
241
|
+
};
|
|
242
|
+
RestMethod.prototype.isReturningArray = function() {
|
|
243
|
+
return this.returns.length == 1 && this.returns[0].root && getTypeString(this.returns[0].type) === "array" || false;
|
|
244
|
+
};
|
|
245
|
+
RestMethod.prototype.acceptsSingleBodyArgument = function() {
|
|
246
|
+
if (this.accepts.length != 1) return false;
|
|
247
|
+
const accepts = this.accepts[0];
|
|
248
|
+
return accepts.http && accepts.http.source == "body" && getTypeString(accepts.type) == "object" || false;
|
|
249
|
+
};
|
|
250
|
+
RestMethod.prototype.getEndpoints = function() {
|
|
251
|
+
const self = this;
|
|
252
|
+
return this.routes.map(function(route) {
|
|
253
|
+
let verbResult;
|
|
254
|
+
const verb = route.verb;
|
|
255
|
+
if (verb == "all") verbResult = "POST";
|
|
256
|
+
else if (verb == "del") verbResult = "DELETE";
|
|
257
|
+
else verbResult = verb.toUpperCase();
|
|
258
|
+
return {
|
|
259
|
+
verb: verbResult,
|
|
260
|
+
fullPath: joinPaths(self.restClass.getPath(), route.path)
|
|
261
|
+
};
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
RestMethod.prototype.getHttpMethod = function() {
|
|
265
|
+
deprecated("getHttpMethod() is deprecated, use getEndpoints()[0].verb instead.");
|
|
266
|
+
return this.getEndpoints()[0].verb;
|
|
267
|
+
};
|
|
268
|
+
RestMethod.prototype.getPath = function() {
|
|
269
|
+
return this.routes[0].path;
|
|
270
|
+
};
|
|
271
|
+
RestMethod.prototype.getFullPath = function() {
|
|
272
|
+
deprecated("getFullPath() is deprecated, use getEndpoints()[0].fullPath instead.");
|
|
273
|
+
return this.getEndpoints()[0].fullPath;
|
|
274
|
+
};
|
|
275
|
+
function getTypeString(ctorOrName) {
|
|
276
|
+
if (typeof ctorOrName === "function") ctorOrName = ctorOrName.name;
|
|
277
|
+
if (typeof ctorOrName === "string") return ctorOrName.toLowerCase();
|
|
278
|
+
else if (Array.isArray(ctorOrName)) return "array";
|
|
279
|
+
else {
|
|
280
|
+
debug("WARNING: unkown ctorOrName of type %s: %j", typeof ctorOrName, ctorOrName);
|
|
281
|
+
return "undefined";
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
function nonEnumerableConstPropery(object, name, value) {
|
|
285
|
+
Object.defineProperty(object, name, {
|
|
286
|
+
value,
|
|
287
|
+
enumerable: false,
|
|
288
|
+
writable: false,
|
|
289
|
+
configurable: false
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function joinPaths(left, right) {
|
|
293
|
+
if (!left) return right;
|
|
294
|
+
if (!right || right == "/") return left;
|
|
295
|
+
const glue = left[left.length - 1] + right[0];
|
|
296
|
+
if (glue == "//") return left + right.slice(1);
|
|
297
|
+
else if (glue[0] == "/" || glue[1] == "/") return left + right;
|
|
298
|
+
else return left + "/" + right;
|
|
299
|
+
}
|
|
300
|
+
//#endregion
|
|
301
|
+
|
|
302
|
+
//# sourceMappingURL=rest-adapter-browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rest-adapter-browser.js","names":[],"sources":["../../src/lib/rest-adapter-browser.ts"],"sourcesContent":["// Copyright IBM Corp. 2013,2018. All Rights Reserved.\n// Node module: strong-remoting\n// This file is licensed under the Artistic License 2.0.\n// License text available at https://opensource.org/licenses/Artistic-2.0\n\n// @ts-nocheck\n'use strict';\n\nconst g = require('./messages');\nmodule.exports = RestAdapter;\n\nRestAdapter.RestClass = RestClass;\nRestAdapter.RestMethod = RestMethod;\n\nconst deprecated = require('./deprecate')('strong-remoting');\nconst EventEmitter = require('events').EventEmitter;\nconst debug = require('debug')('strong-remoting:rest-adapter');\nconst util = require('util');\nconst inherits = util.inherits;\nconst assert = require('assert');\nconst HttpInvocation = require('./http-invocation');\n\nfunction RestAdapter(remotes, options) {\n EventEmitter.call(this);\n\n this.remotes = remotes;\n this.options = options || (remotes.options || {}).rest || {};\n this.typeRegistry = remotes._typeRegistry;\n}\n\ninherits(RestAdapter, EventEmitter);\n\nRestAdapter.create = RestAdapter.createRestAdapter = function (remotes) {\n return new RestAdapter(remotes);\n};\n\nRestAdapter.prototype.getRoutes = function (obj) {\n return getRoutes(obj, this.options);\n};\n\nfunction getRoutes(obj, options) {\n let routes = obj.http;\n if (routes && !Array.isArray(routes)) {\n routes = [routes];\n }\n\n const sharedClass = obj.sharedClass || obj;\n const classOptions = sharedClass.options;\n let normalize = classOptions && classOptions.normalizeHttpPath;\n if (normalize === undefined && options) {\n normalize = options.normalizeHttpPath;\n }\n const toPath = normalize ? normalizeHttpPath : untransformedPath;\n\n if (routes) {\n routes.forEach(function (r) {\n r.verb = String(r.verb || 'all').toLowerCase();\n r.path = toPath(r.path || '/' + obj.name);\n });\n } else if (obj.name === 'sharedCtor') {\n routes = [{ verb: 'all', path: '/prototype' }];\n } else {\n routes = [{ verb: 'all', path: obj.name ? toPath('/' + obj.name) : '' }];\n }\n\n return routes;\n}\n\nfunction normalizeHttpPath(path) {\n if (typeof path !== 'string') return;\n return path.replace(/[^\\/]+/g, function (match) {\n if (match.indexOf(':') > -1) return match;\n return match\n .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')\n .replace(/[_\\s]+/g, '-')\n .toLowerCase();\n });\n}\n\nfunction untransformedPath(path) {\n return path;\n}\n\nRestAdapter.prototype.connect = function (url) {\n this.connection = url;\n};\n\nRestAdapter.prototype._getInvocationAuth = function (invocationOptions) {\n const auth = this.remotes.auth;\n if (auth || !this.options.passAccessToken) {\n return auth;\n }\n\n const accessToken = invocationOptions && invocationOptions.accessToken;\n if (accessToken) {\n return { accessToken };\n }\n\n return undefined;\n};\n\nRestAdapter.prototype.invoke = function (method, ctorArgs, args, callback) {\n assert(\n this.connection,\n g.f('Cannot invoke method without a connection. See {{RemoteObjects#connect().}}'),\n );\n assert(typeof method === 'string', g.f('method is required when calling {{invoke()}}'));\n\n const lastArg = arguments[arguments.length - 1];\n callback = typeof lastArg === 'function' ? lastArg : undefined;\n\n ctorArgs = Array.isArray(ctorArgs) ? ctorArgs : [];\n if (!Array.isArray(args)) {\n args = ctorArgs;\n ctorArgs = [];\n }\n\n const remotes = this.remotes;\n const restMethod = this.getRestMethodByName(method);\n if (!restMethod) {\n return callback(new Error(g.f('Cannot invoke unkown method: %s', method)));\n }\n const invokeOptions = restMethod.getArgByName('options', args);\n const auth = this._getInvocationAuth(invokeOptions);\n\n const invocation = new HttpInvocation(\n restMethod,\n ctorArgs,\n args,\n this.connection,\n auth,\n this.typeRegistry,\n );\n const ctx = invocation.context;\n ctx.req = invocation.createRequest();\n const scope = ctx.getScope();\n remotes.execHooks('before', restMethod, scope, ctx, function (err) {\n if (err) return callback(err);\n invocation.invoke(function (err) {\n if (err) return callback(err);\n const invokeArgs = Array.prototype.slice.call(arguments);\n\n ctx.result = invokeArgs.slice(1);\n ctx.res = invocation.getResponse();\n remotes.execHooks('after', restMethod, scope, ctx, function (err) {\n if (err) return callback(err);\n callback.apply(invocation, invokeArgs);\n });\n });\n });\n};\n\nRestAdapter.prototype._createRestMethodByNameCache = function () {\n const restMethodByNameMap = {};\n const classes = this.getClasses();\n for (let i = 0; i < classes.length; i++) {\n const restClass = classes[i];\n for (let j = 0; j < restClass.methods.length; j++) {\n const restMethod = restClass.methods[j];\n restMethodByNameMap[restMethod.fullName] = restMethod;\n }\n }\n return restMethodByNameMap;\n};\n\nRestAdapter.prototype.getRestMethodByName = function (name) {\n let ret;\n if (this._cachedRestMethodsByName) {\n ret = this._cachedRestMethodsByName[name];\n }\n\n if (!ret) {\n this._cachedRestMethodsByName = this._createRestMethodByNameCache();\n ret = this._cachedRestMethodsByName[name];\n }\n\n if (ret && !ret.sharedMethod.sharedClass.isMethodEnabled(ret.sharedMethod)) {\n ret = undefined;\n }\n\n return ret;\n};\n\nfunction sortRoutes(r1, r2) {\n const a = r1.route;\n const b = r2.route;\n let verb1 = a.verb.toLowerCase();\n let verb2 = b.verb.toLowerCase();\n\n if (verb1 === 'del') verb1 = 'delete';\n if (verb2 === 'del') verb2 = 'delete';\n if (verb1 > verb2) return -1;\n if (verb1 < verb2) return 1;\n\n const p1 = a.path.split('/');\n const p2 = b.path.split('/');\n const len = Math.min(p1.length, p2.length);\n\n for (let i = 0; i < len; i++) {\n if (p1[i] === '' && p2[i] !== '') return 1;\n if (p1[i] !== '' && p2[i] === '') return -1;\n if (p1[i][0] === ':' && p2[i][0] !== ':') return 1;\n if (p1[i][0] !== ':' && p2[i][0] === ':') return -1;\n if (p1[i] > p2[i]) return 1;\n if (p1[i] < p2[i]) return -1;\n }\n\n return p2.length - p1.length;\n}\n\nRestAdapter.sortRoutes = sortRoutes;\n\nRestAdapter.prototype.createHandler = function () {\n throw new Error(g.f('The browser REST adapter does not support creating server handlers.'));\n};\n\nRestAdapter.prototype.allRoutes = function () {\n const routes = [];\n const adapter = this;\n const classes = this.remotes.classes(this.options);\n let currentRoot = '';\n\n classes.forEach(function (sc) {\n adapter.getRoutes(sc).forEach(function (classRoute) {\n currentRoot = classRoute.path;\n const methods = sc.methods();\n\n methods.forEach(function (method) {\n adapter.getRoutes(method).forEach(function (route) {\n if (method.isStatic) {\n addRoute(route.verb, route.path, method);\n } else {\n adapter.getRoutes(method.sharedCtor).forEach(function (sharedCtorRoute) {\n addRoute(route.verb, sharedCtorRoute.path + route.path, method);\n });\n }\n });\n });\n });\n });\n\n return routes;\n\n function addRoute(verb, path, method) {\n if (path === '/' || path === '//') {\n path = currentRoot;\n } else {\n path = currentRoot + path;\n }\n\n if (path[path.length - 1] === '/') {\n path = path.substr(0, path.length - 1);\n }\n\n path = path.replace(/\\/\\//g, '/');\n\n routes.push({\n verb: verb,\n path: path,\n description: method.description,\n notes: method.notes,\n documented: method.documented,\n method: method.stringName,\n accepts: method.accepts && method.accepts.length ? method.accepts : undefined,\n returns: method.returns && method.returns.length ? method.returns : undefined,\n errors: method.errors && method.errors.length ? method.errors : undefined,\n http: method.http,\n });\n }\n};\n\nRestAdapter.prototype.getClasses = function () {\n return this.remotes.classes(this.options).map((c) => new RestClass(c, this.options));\n};\n\nfunction RestClass(sharedClass, adapterOptions) {\n nonEnumerableConstPropery(this, 'sharedClass', sharedClass);\n\n this.name = sharedClass.name;\n this.options = adapterOptions;\n this.routes = getRoutes(sharedClass, this.options);\n\n this.ctor = sharedClass.sharedCtor && new RestMethod(this, sharedClass.sharedCtor);\n\n this.methods = sharedClass\n .methods()\n .filter(function (sm) {\n return !sm.isSharedCtor;\n })\n .map(\n function (sm) {\n return new RestMethod(this, sm);\n }.bind(this),\n );\n}\n\nRestClass.prototype.getPath = function () {\n return this.routes[0].path;\n};\n\nfunction RestMethod(restClass, sharedMethod) {\n nonEnumerableConstPropery(this, 'restClass', restClass);\n nonEnumerableConstPropery(this, 'sharedMethod', sharedMethod);\n\n this.fullName = sharedMethod.stringName;\n this.name = this.fullName.split('.').slice(1).join('.');\n this.accepts = sharedMethod.accepts;\n this.returns = sharedMethod.returns;\n this.errors = sharedMethod.errors;\n this.description = sharedMethod.description;\n this.notes = sharedMethod.notes;\n this.documented = sharedMethod.documented;\n\n const methodRoutes = getRoutes(sharedMethod, restClass.options);\n if (sharedMethod.isStatic || !restClass.ctor) {\n this.routes = methodRoutes;\n } else {\n const routes = (this.routes = []);\n methodRoutes.forEach(function (route) {\n restClass.ctor.routes.forEach(function (ctorRoute) {\n const fullRoute = Object.assign({}, route);\n fullRoute.path = joinPaths(ctorRoute.path, route.path);\n routes.push(fullRoute);\n });\n });\n }\n}\n\nRestMethod.prototype.getArgByName = function (argName, invokedArgs) {\n let argValue;\n if (!this.accepts || !this.accepts.length) return undefined;\n this.accepts.some(function (argProperty, i) {\n if (argProperty.arg && argProperty.arg.toLowerCase() === argName.toLowerCase()) {\n argValue = invokedArgs[i];\n return true;\n }\n return false;\n });\n return argValue;\n};\n\nRestMethod.prototype.isReturningArray = function () {\n return (\n (this.returns.length == 1 &&\n this.returns[0].root &&\n getTypeString(this.returns[0].type) === 'array') ||\n false\n );\n};\n\nRestMethod.prototype.acceptsSingleBodyArgument = function () {\n if (this.accepts.length != 1) return false;\n const accepts = this.accepts[0];\n\n return (\n (accepts.http && accepts.http.source == 'body' && getTypeString(accepts.type) == 'object') ||\n false\n );\n};\n\nRestMethod.prototype.getEndpoints = function () {\n const self = this;\n return this.routes.map(function (route) {\n let verbResult;\n const verb = route.verb;\n if (verb == 'all') {\n verbResult = 'POST';\n } else if (verb == 'del') {\n verbResult = 'DELETE';\n } else {\n verbResult = verb.toUpperCase();\n }\n return {\n verb: verbResult,\n fullPath: joinPaths(self.restClass.getPath(), route.path),\n };\n });\n};\n\nRestMethod.prototype.getHttpMethod = function () {\n deprecated('getHttpMethod() is deprecated, use getEndpoints()[0].verb instead.');\n return this.getEndpoints()[0].verb;\n};\n\nRestMethod.prototype.getPath = function () {\n return this.routes[0].path;\n};\n\nRestMethod.prototype.getFullPath = function () {\n deprecated('getFullPath() is deprecated, use getEndpoints()[0].fullPath instead.');\n return this.getEndpoints()[0].fullPath;\n};\n\nfunction getTypeString(ctorOrName) {\n if (typeof ctorOrName === 'function') ctorOrName = ctorOrName.name;\n if (typeof ctorOrName === 'string') {\n return ctorOrName.toLowerCase();\n } else if (Array.isArray(ctorOrName)) {\n return 'array';\n } else {\n debug('WARNING: unkown ctorOrName of type %s: %j', typeof ctorOrName, ctorOrName);\n return typeof undefined;\n }\n}\n\nfunction nonEnumerableConstPropery(object, name, value) {\n Object.defineProperty(object, name, {\n value: value,\n enumerable: false,\n writable: false,\n configurable: false,\n });\n}\n\nfunction joinPaths(left, right) {\n if (!left) return right;\n if (!right || right == '/') return left;\n\n const glue = left[left.length - 1] + right[0];\n if (glue == '//') return left +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