forked from angular/in-memory-web-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
in-memory-backend.service.js.map
1 lines (1 loc) · 44.2 KB
/
in-memory-backend.service.js.map
1
{"version":3,"file":"in-memory-backend.service.js","sourceRoot":"","sources":["in-memory-backend.service.ts"],"names":[],"mappings":"OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe;OAE/D,EAAE,mBAAmB,EAAE,UAAU,EAC/B,OAAO,EAAE,UAAU,EAAW,aAAa,EAC3C,QAAQ,EAAE,eAAe,EAAE,eAAe,EAC1C,UAAU,EAAE,YAAY,EAAE,MAAM,eAAe;OAEjD,EAAE,UAAU,EAAE,MAAM,iBAAiB;OAErC,yBAAyB;OAEzB,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,qBAAqB;AAE9D,iCAAiC;AAGjC;;GAEG;AACH,oCAAoC,GAAY,EAAE,MAAc,EAAE,OAAe;IAC/E,MAAM,CAAC,IAAI,eAAe,CAAC;QACzB,IAAI,EAAE,EAAE,OAAO,EAAE,KAAG,OAAS,EAAE;QAC/B,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,OAAO,EAAE,IAAI,OAAO,CAAC,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC;QAC5D,MAAM,EAAE,MAAM;KACf,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,yCAAyC,GAAY,EAAE,UAA2B;IAC9E,MAAM,CAAC,IAAI,UAAU,CAAW,UAAC,gBAAoC;QACnE,YAAY,CAAC,gBAAgB,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;QAChD,MAAM,CAAC,cAAQ,CAAC,CAAC,CAAC,uBAAuB;IAC3C,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;GAIG;AACH,6BAA6B,gBAAoC,EAAE,GAAY,EAAE,UAA2B;IAC1G,UAAU,CAAC,GAAG,GAAG,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,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qeC","sourcesContent":["import { Inject, Injectable, Injector, Optional } from '@angular/core';\n\nimport { BaseResponseOptions, BrowserXhr, Connection, ConnectionBackend,\n Headers, ReadyState, Request, RequestMethod,\n Response, ResponseOptions, URLSearchParams,\n XHRBackend, XSRFStrategy } from '@angular/http';\n\nimport { Observable } from 'rxjs/Observable';\nimport { Observer } from 'rxjs/Observer';\nimport 'rxjs/add/operator/delay';\n\nimport { STATUS, STATUS_CODE_INFO } from './http-status-codes';\n\n//////////// HELPERS ///////////\n\n\n/**\n * Create an error Response from an HTTP status code and error message\n */\nexport function createErrorResponse(req: Request, status: number, message: string): ResponseOptions {\n return new ResponseOptions({\n body: { 'error': `${message}` },\n url: req.url,\n headers: new Headers({ 'Content-Type': 'application/json' }),\n status: status\n });\n}\n\n/**\n * Create an Observable response from response options.\n */\nexport function createObservableResponse(req: Request, resOptions: ResponseOptions): Observable<Response> {\n return new Observable<Response>((responseObserver: Observer<Response>) => {\n emitResponse(responseObserver, req, resOptions);\n return () => { }; // unsubscribe function\n });\n}\n\n/**\n * Create a response from response options\n * and tell \"ResponseObserver\" (an `Observer<Response>`) to emit it.\n * The observer's observable is either completed or in error state after call.\n */\nexport function emitResponse(responseObserver: Observer<Response>, req: Request, resOptions: ResponseOptions) {\n resOptions.url = resOptions.url || req.url; // make sure url is set\n resOptions = setStatusText(resOptions);\n\n const res = new Response(resOptions);\n\n if (isSuccess(res.status)) {\n responseObserver.next(res);\n responseObserver.complete();\n } else {\n responseObserver.error(res);\n }\n}\n\n/**\n* Interface for object passed to an HTTP method override method\n*/\nexport interface HttpMethodInterceptorArgs {\n requestInfo: RequestInfo; // parsed request\n db: Object; // the current in-mem database collections\n config: InMemoryBackendConfigArgs; // the current config\n passThruBackend: ConnectionBackend; // pass through backend, if it exists\n}\n\n/**\n* Interface for a class that creates an in-memory database\n*\n* Its `createDb` method creates a hash of named collections that represents the database\n*\n* For maximum flexibility, the service may define HTTP method overrides.\n* Such methods must match the spelling of an HTTP method in lower case (e.g, \"get\").\n* If a request has a matching method, it will be called as in\n* `get(info: requestInfo, db: {})` where `db` is the database object described above.\n*/\nexport abstract class InMemoryDbService {\n /**\n * Creates a \"database\" hash whose keys are collection names\n * and whose values are arrays of collection objects to return or update.\n *\n * This method must be safe to call repeatedly.\n * Each time it should return a new object with new arrays containing new item objects.\n * This condition allows InMemoryBackendService to morph the arrays and objects\n * without touching the original source data.\n */\n abstract createDb(): {};\n}\n\n/**\n* Interface for InMemoryBackend configuration options\n*/\nexport abstract class InMemoryBackendConfigArgs {\n /**\n * false (default) if search match should be case insensitive\n */\n caseSensitiveSearch?: boolean;\n /**\n * default response options\n */\n defaultResponseOptions?: ResponseOptions;\n /**\n * delay (in ms) to simulate latency\n */\n delay?: number;\n /**\n * false (default) if ok when object-to-delete not found; else 404\n */\n delete404?: boolean;\n /**\n * false (default) if should pass unrecognized request URL through to original backend; else 404\n */\n passThruUnknownUrl?: boolean;\n /**\n * true (default) should NOT return the entity (204) after a POST. false: return the entity (200).\n */\n post204?: boolean;\n /**\n * true (default) should NOT return the entity (204) after a PUT. false: return the entity (200).\n */\n put204?: boolean;\n /**\n * The base path to the api, e.g, 'api/'.\n * If not specified than `parseUrl` assumes it is the first path segment in the request.\n */\n apiBase?: string;\n /**\n * host for this service, e.g., 'localhost'\n */\n host?: string;\n /**\n * root path _before_ any API call, e.g., ''\n */\n rootPath?: string;\n}\n\nexport function removeTrailingSlash(path: string) {\n return path.replace(/\\/$/, '');\n}\n\n/////////////////////////////////\n/**\n* InMemoryBackendService configuration options\n* Usage:\n* InMemoryWebApiModule.forRoot(InMemHeroService, {delay: 600})\n*\n* or if providing separately:\n* provide(InMemoryBackendConfig, {useValue: {delay: 600}}),\n*/\n\nexport class InMemoryBackendConfig implements InMemoryBackendConfigArgs {\n constructor(config: InMemoryBackendConfigArgs = {}) {\n Object.assign(this, {\n // default config:\n caseSensitiveSearch: false,\n defaultResponseOptions: new BaseResponseOptions(),\n delay: 500, // simulate latency by delaying response\n delete404: false, // don't complain if can't find entity to delete\n passThruUnknownUrl: false, // 404 if can't process URL\n post204: true, // don't return the item after a POST\n put204: true, // don't return the item after a PUT\n apiBase: undefined, // assumed to be the first path segment\n host: undefined, // default value is actually set in InMemoryBackendService ctor\n rootPath: undefined // default value is actually set in InMemoryBackendService ctor\n }, config);\n }\nstatic decorators: DecoratorInvocation[] = [\n{ type: Injectable },\n];\n/** @nocollapse */\nstatic ctorParameters: () => ({type: any, decorators?: DecoratorInvocation[]}|null)[] = () => [\n{type: InMemoryBackendConfigArgs, },\n];\n}\n\n/**\n * Returns true if the the Http Status Code is 200-299 (success)\n */\nexport function isSuccess(status: number): boolean { return status >= 200 && status < 300; };\n\n/**\n* Interface for object w/ info about the current request url\n* extracted from an Http Request\n*/\nexport interface RequestInfo {\n req: Request;\n base: string;\n collection: any[];\n collectionName: string;\n headers: Headers;\n id: any;\n query: URLSearchParams;\n resourceUrl: string;\n}\n\n/**\n * Provide a `responseInterceptor` method of this type in your `inMemDbService` to\n * morph the response options created in the `collectionHandler`.\n */\nexport type ResponseInterceptor = (res: ResponseOptions, ri: RequestInfo) => ResponseOptions;\n\n/**\n * Set the status text in a response:\n */\nexport function setStatusText(options: ResponseOptions) {\n try {\n const statusCode = STATUS_CODE_INFO[options.status];\n options['statusText'] = statusCode ? statusCode.text : 'Unknown Status';\n return options;\n } catch (err) {\n return new ResponseOptions({\n status: STATUS.INTERNAL_SERVER_ERROR,\n statusText: 'Invalid Server Operation'\n });\n }\n}\n\n/**\n *\n * Interface for the result of the parseUrl method:\n * Given URL \"http://localhost:8080/api/customers/42?foo=1 the default implementation returns\n * base: 'api/'\n * collectionName: 'customers'\n * id: '42'\n * query: new URLSearchParams('foo=1')\n * resourceUrl: 'http://localhost/api/customers/'\n */\nexport interface ParsedUrl {\n base: string; // the slash-terminated \"base\" for api requests (e.g. `api/`)\n collectionName: string; // the name of the collection of data items (e.g.,`customers`)\n id: string; // the (optional) id of the item in the collection (e.g., `42`)\n query: URLSearchParams; // the query as an Angular `Http` client request's URLSearchParams object\n resourceUrl: string; // the effective URL for the resource (e.g., 'http://localhost/api/customers/')\n}\n\n//////////// InMemoryBackendService ///////////\n/**\n * Simulate the behavior of a RESTy web api\n * backed by the simple in-memory data store provided by the injected InMemoryDataService service.\n * Conforms mostly to behavior described here:\n * http://www.restapitutorial.com/lessons/httpmethods.html\n *\n * ### Usage\n *\n * Create `InMemoryDataService` class that implements `InMemoryDataService`.\n * Call `forRoot` static method with this service class and optional configuration object:\n * ```\n * // other imports\n * import { HttpModule } from '@angular/http';\n * import { InMemoryWebApiModule } from 'angular-in-memory-web-api';\n *\n * import { InMemHeroService, inMemConfig } from '../api/in-memory-hero.service';\n * @NgModule({\n * imports: [\n * HttpModule,\n * InMemoryWebApiModule.forRoot(InMemHeroService, inMemConfig),\n * ...\n * ],\n * ...\n * })\n * export class AppModule { ... }\n * ```\n */\n\nexport class InMemoryBackendService {\n protected passThruBackend: ConnectionBackend;\n protected config: InMemoryBackendConfigArgs = new InMemoryBackendConfig();\n protected db: Object;\n\n constructor(\n private injector: Injector,\n private inMemDbService: InMemoryDbService,\n config: InMemoryBackendConfigArgs\n ) {\n this.resetDb();\n\n const loc = this.getLocation('/');\n this.config.host = loc.host; // default to app web server host\n this.config.rootPath = loc.pathname; // default to path when app is served (e.g.'/')\n Object.assign(this.config, config || {});\n this.setPassThruBackend();\n }\n\n createConnection(req: Request): Connection {\n let response: Observable<Response>;\n try {\n response = this.handleRequest(req);\n } catch (error) {\n const err = error.message || error;\n const options = createErrorResponse(req, STATUS.INTERNAL_SERVER_ERROR, `${err}`);\n response = this.addDelay(createObservableResponse(req, options));\n }\n return {\n readyState: ReadyState.Done,\n request: req,\n response\n };\n }\n\n //// protected /////\n\n /**\n * Process Request and return an Observable of Http Response object\n * in the manner of a RESTy web api.\n *\n * Expect URI pattern in the form :base/:collectionName/:id?\n * Examples:\n * // for store with a 'customers' collection\n * GET api/customers // all customers\n * GET api/customers/42 // the character with id=42\n * GET api/customers?name=^j // 'j' is a regex; returns customers whose name starts with 'j' or 'J'\n * GET api/customers.json/42 // ignores the \".json\"\n *\n * Also accepts direct commands to the service in which the last segment of the apiBase is the word \"commands\"\n * Examples:\n * POST commands/resetDb,\n * GET/POST commands/config - get or (re)set the config\n *\n * HTTP overrides:\n * If the injected inMemDbService defines an HTTP method (lowercase)\n * The request is forwarded to that method as in\n * `inMemDbService.get(httpMethodInterceptorArgs)`\n * which must return an `Observable<Response>`\n */\n protected handleRequest(req: Request): Observable<Response> {\n\n const parsed = this.inMemDbService['parseUrl'] ?\n // parse with override method\n this.inMemDbService['parseUrl'](req.url) as ParsedUrl :\n // parse with default url parser\n this.parseUrl(req.url);\n\n const { base, collectionName, id, query, resourceUrl } = parsed;\n const collection = this.db[collectionName];\n const reqInfo: RequestInfo = {\n req: req,\n base: base,\n collection: collection,\n collectionName: collectionName,\n headers: new Headers({ 'Content-Type': 'application/json' }),\n id: this.parseId(collection, id),\n query: query,\n resourceUrl: resourceUrl\n };\n\n const reqMethodName = RequestMethod[req.method || 0].toLowerCase();\n let resOptions: ResponseOptions;\n\n if (/commands\\/$/i.test(reqInfo.base)) {\n return this.commands(reqInfo);\n\n } else if (this.inMemDbService[reqMethodName]) {\n // InMemoryDbService has an overriding interceptor for this HTTP method; call it\n // The interceptor result must be an Observable<Response>\n const interceptorArgs: HttpMethodInterceptorArgs = {\n requestInfo: reqInfo,\n db: this.db,\n config: this.config,\n passThruBackend: this.passThruBackend\n };\n const interceptorResponse = this.inMemDbService[reqMethodName](interceptorArgs) as Observable<Response>;\n return this.addDelay(interceptorResponse);\n\n } else if (reqInfo.collection) {\n // request is for a collection created by the InMemoryDbService\n return this.addDelay(this.collectionHandler(reqInfo));\n\n } else if (this.passThruBackend) {\n // Passes request thru to a \"real\" backend which returns an Observable<Response>\n // BAIL OUT with this Observable<Response>\n return this.passThruBackend.createConnection(req).response;\n\n } else {\n // can't handle this request\n resOptions = createErrorResponse(req, STATUS.NOT_FOUND, `Collection '${collectionName}' not found`);\n return this.addDelay(createObservableResponse(req, resOptions));\n }\n }\n\n /**\n * Add configured delay to response observable unless delay === 0\n */\n protected addDelay(response: Observable<Response>): Observable<Response> {\n const delay = this.config.delay;\n return delay === 0 ? response : response.delay(delay || 500);\n }\n\n /**\n * Apply query/search parameters as a filter over the collection\n * This impl only supports RegExp queries on string properties of the collection\n * ANDs the conditions together\n */\n protected applyQuery(collection: any[], query: URLSearchParams): any[] {\n // extract filtering conditions - {propertyName, RegExps) - from query/search parameters\n const conditions: { name: string, rx: RegExp }[] = [];\n const caseSensitive = this.config.caseSensitiveSearch ? undefined : 'i';\n query.paramsMap.forEach((value: string[], name: string) => {\n value.forEach(v => conditions.push({ name, rx: new RegExp(decodeURI(v), caseSensitive) }));\n });\n\n const len = conditions.length;\n if (!len) { return collection; }\n\n // AND the RegExp conditions\n return collection.filter(row => {\n let ok = true;\n let i = len;\n while (ok && i) {\n i -= 1;\n const cond = conditions[i];\n ok = cond.rx.test(row[cond.name]);\n }\n return ok;\n });\n }\n\n protected clone(data: any) {\n return JSON.parse(JSON.stringify(data));\n }\n\n protected collectionHandler(reqInfo: RequestInfo): Observable<Response> {\n const req = reqInfo.req;\n return new Observable<Response>((responseObserver: Observer<Response>) => {\n let resOptions: ResponseOptions;\n switch (req.method) {\n case RequestMethod.Get:\n resOptions = this.get(reqInfo);\n break;\n case RequestMethod.Post:\n resOptions = this.post(reqInfo);\n break;\n case RequestMethod.Put:\n resOptions = this.put(reqInfo);\n break;\n case RequestMethod.Delete:\n resOptions = this.delete(reqInfo);\n break;\n default:\n resOptions = createErrorResponse(req, STATUS.METHOD_NOT_ALLOWED, 'Method not allowed');\n break;\n }\n\n // If `inMemDbService.responseInterceptor` exists, let it morph the response options\n if (this.inMemDbService['responseInterceptor']) {\n resOptions = (this.inMemDbService['responseInterceptor'] as ResponseInterceptor)(resOptions, reqInfo);\n }\n\n emitResponse(responseObserver, reqInfo.req, resOptions);\n return () => { }; // unsubscribe function\n });\n }\n\n /**\n * When the last segment of the `base` path is \"commands\", the `collectionName` is the command\n * Example URLs:\n * commands/resetdb // Reset the \"database\" to its original state\n * commands/config (GET) // Return this service's config object\n * commands/config (!GET) // Update the config (e.g. delay)\n *\n * Commands are \"hot\", meaning they are always executed immediately\n * whether or not someone subscribes to the returned observable\n *\n * Usage:\n * http.post('commands/resetdb', undefined);\n * http.get('commands/config');\n * http.post('commands/config', '{\"delay\":1000}');\n */\n protected commands(reqInfo: RequestInfo): Observable<Response> {\n const command = reqInfo.collectionName.toLowerCase();\n const method = reqInfo.req.method;\n let resOptions: ResponseOptions;\n\n switch (command) {\n case 'resetdb':\n this.resetDb();\n resOptions = new ResponseOptions({ status: STATUS.OK });\n break;\n case 'config':\n if (method === RequestMethod.Get) {\n resOptions = new ResponseOptions({\n body: this.clone(this.config),\n status: STATUS.OK\n });\n } else {\n // Be nice ... any other method is a config update\n const body = JSON.parse(<string>reqInfo.req.text() || '{}');\n Object.assign(this.config, body);\n this.setPassThruBackend();\n resOptions = new ResponseOptions({ status: STATUS.NO_CONTENT });\n }\n break;\n default:\n resOptions = createErrorResponse(reqInfo.req, STATUS.INTERNAL_SERVER_ERROR, `Unknown command \"${command}\"`);\n }\n\n return createObservableResponse(reqInfo.req, resOptions);\n }\n\n protected delete({ id, collection, collectionName, headers, req }: RequestInfo) {\n if (!id) {\n return createErrorResponse(req, STATUS.NOT_FOUND, `Missing \"${collectionName}\" id`);\n }\n const exists = this.removeById(collection, id);\n return new ResponseOptions({\n headers: headers,\n status: (exists || !this.config.delete404) ? STATUS.NO_CONTENT : STATUS.NOT_FOUND\n });\n }\n\n protected findById(collection: any[], id: number | string) {\n return collection.find((item: any) => item.id === id);\n }\n\n protected genId(collection: any): any {\n // assumes numeric ids\n let maxId = 0;\n collection.reduce((prev: any, item: any) => {\n maxId = Math.max(maxId, typeof item.id === 'number' ? item.id : maxId);\n }, undefined);\n return maxId + 1;\n }\n\n protected get({ id, query, collection, collectionName, headers, req }: RequestInfo) {\n let data = collection;\n\n if (id) {\n data = this.findById(collection, id);\n } else if (query) {\n data = this.applyQuery(collection, query);\n }\n\n if (!data) {\n return createErrorResponse(req, STATUS.NOT_FOUND, `'${collectionName}' with id='${id}' not found`);\n }\n return new ResponseOptions({\n body: { data: this.clone(data) },\n headers: headers,\n status: STATUS.OK\n });\n }\n\n protected getLocation(href: string) {\n if (!href.startsWith('http')) {\n // get the document iff running in browser\n let doc: Document = (typeof document === 'undefined') ? undefined : document;\n // add host info to url before parsing. Use a fake host when not in browser.\n let base = doc ? doc.location.protocol + '//' + doc.location.host : 'http://fake';\n href = href.startsWith('/') ? base + href : base + '/' + href;\n }\n let uri = this.parseuri(href);\n let loc = {\n host: uri.host,\n protocol: uri.protocol,\n port: uri.port,\n pathname: uri.path,\n search: uri.query ? '?' + uri.query : ''\n };\n return loc;\n };\n\n\n // Adapted from parseuri package - http://blog.stevenlevithan.com/archives/parseuri\n protected parseuri(str: string): any {\n // tslint:disable-next-line:max-line-length\n const URL_REGEX = /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/;\n const key = ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port',\n 'relative', 'path', 'directory', 'file', 'query', 'anchor'];\n let m = URL_REGEX.exec(str);\n let uri = {};\n let i = 14;\n\n while (i--) { uri[key[i]] = m[i] || ''; }\n return uri;\n }\n\n protected indexOf(collection: any[], id: number) {\n return collection.findIndex((item: any) => item.id === id);\n }\n\n // tries to parse id as number if collection item.id is a number.\n // returns the original param id otherwise.\n protected parseId(collection: { id: any }[], id: string): any {\n // tslint:disable-next-line:triple-equals\n if (!collection || id == undefined) { return undefined; }\n const isNumberId = collection[0] && typeof collection[0].id === 'number';\n if (isNumberId) {\n const idNum = parseFloat(id);\n return isNaN(idNum) ? id : idNum;\n }\n return id;\n }\n\n /**\n * Parses the request URL into a `ParsedUrl` object.\n * Parsing depends upon certain values of `config`: `apiBase`, `host`, and `urlRoot`.\n *\n * Configuring the `apiBase` yields the most interesting changes to `parseUrl` behavior:\n * When apiBase=undefined and url='http://localhost/api/collection/42'\n * {base: 'api/', collectionName: 'collection', id: '42', ...}\n * When apiBase='some/api/root/' and url='http://localhost/some/api/root/collection'\n * {base: 'some/api/root/', collectionName: 'collection', id: undefined, ...}\n * When apiBase='/' and url='http://localhost/collection'\n * {base: '/', collectionName: 'collection', id: undefined, ...}\n *\n * The actual api base segment values are ignored. Only the number of segments matters.\n * The following api base strings are considered identical: 'a/b' ~ 'some/api/' ~ `two/segments'\n *\n * To replace this default method, assign your alternative to your InMemDbService['parseUrl']\n */\n protected parseUrl(url: string): ParsedUrl {\n try {\n const loc = this.getLocation(url);\n let drop = this.config.rootPath.length;\n let urlRoot = '';\n if (loc.host !== this.config.host) {\n // url for a server on a different host!\n // assume it's collection is actually here too.\n drop = 1; // the leading slash\n urlRoot = loc.protocol + '//' + loc.host + '/';\n }\n const path = loc.pathname.substring(drop);\n const pathSegments = path.split('/');\n let segmentIx = 0;\n\n // apiBase: the front part of the path devoted to getting to the api route\n // Assumes first path segment if no config.apiBase\n // else ignores as many path segments as are in config.apiBase\n // Does NOT care what the api base chars actually are.\n let apiBase: string;\n // tslint:disable-next-line:triple-equals\n if (this.config.apiBase == undefined) {\n apiBase = pathSegments[segmentIx++];\n } else {\n apiBase = removeTrailingSlash(this.config.apiBase.trim());\n if (apiBase) {\n segmentIx = apiBase.split('/').length;\n } else {\n segmentIx = 0; // no api base at all; unwise but allowed.\n }\n }\n apiBase = apiBase + '/';\n\n let collectionName = pathSegments[segmentIx++];\n // ignore anything after a '.' (e.g.,the \"json\" in \"customers.json\")\n collectionName = collectionName && collectionName.split('.')[0];\n\n const id = pathSegments[segmentIx++];\n const query = loc.search && new URLSearchParams(loc.search.substr(1));\n const resourceUrl = urlRoot + apiBase + collectionName + '/';\n return { base: apiBase, collectionName, id, query, resourceUrl };\n } catch (err) {\n const msg = `unable to parse url '${url}'; original error: ${err.message}`;\n throw new Error(msg);\n }\n }\n\n protected post({ collection, /* collectionName, */ headers, id, req, resourceUrl }: RequestInfo) {\n const item = JSON.parse(<string>req.text());\n // tslint:disable-next-line:triple-equals\n if (item.id == undefined) {\n item.id = id || this.genId(collection);\n }\n // ignore the request id, if any. Alternatively,\n // could reject request if id differs from item.id\n id = item.id;\n const existingIx = this.indexOf(collection, id);\n const body = { data: this.clone(item) };\n\n if (existingIx > -1) {\n collection[existingIx] = item;\n const res =\n this.config.post204 ?\n { headers, status: STATUS.NO_CONTENT } : // successful; no content\n { headers, body, status: STATUS.OK }; // successful; return entity\n return new ResponseOptions(res);\n } else {\n collection.push(item);\n headers.set('Location', resourceUrl + '/' + id);\n return new ResponseOptions({ headers, body, status: STATUS.CREATED });\n }\n }\n\n protected put({ id, collection, collectionName, headers, req }: RequestInfo) {\n const item = JSON.parse(<string>req.text());\n // tslint:disable-next-line:triple-equals\n if (item.id == undefined) {\n return createErrorResponse(req, STATUS.NOT_FOUND, `Missing '${collectionName}' id`);\n }\n // tslint:disable-next-line:triple-equals\n if (id != item.id) {\n return createErrorResponse(req, STATUS.BAD_REQUEST, `\"${collectionName}\" id does not match item.id`);\n }\n const existingIx = this.indexOf(collection, id);\n const body = { data: this.clone(item) };\n\n if (existingIx > -1) {\n collection[existingIx] = item;\n const res =\n this.config.put204 ?\n { headers, status: STATUS.NO_CONTENT } : // successful; no content\n { headers, body, status: STATUS.OK }; // successful; return entity\n return new ResponseOptions(res);\n } else {\n collection.push(item);\n return new ResponseOptions({ headers, body, status: STATUS.CREATED });\n }\n }\n\n protected removeById(collection: any[], id: number) {\n const ix = this.indexOf(collection, id);\n if (ix > -1) {\n collection.splice(ix, 1);\n return true;\n }\n return false;\n }\n\n /**\n * Reset the \"database\" to its original state\n */\n protected resetDb() {\n this.db = this.inMemDbService.createDb();\n }\n\n protected setPassThruBackend() {\n this.passThruBackend = undefined;\n if (this.config.passThruUnknownUrl) {\n try {\n // copied from @angular/http/backends/xhr_backend\n const browserXhr = this.injector.get(BrowserXhr);\n const baseResponseOptions = this.injector.get(ResponseOptions);\n const xsrfStrategy = this.injector.get(XSRFStrategy);\n this.passThruBackend = new XHRBackend(browserXhr, baseResponseOptions, xsrfStrategy);\n } catch (ex) {\n ex.message = 'Cannot create passThru404 backend; ' + (ex.message || '');\n throw ex;\n }\n }\n }\n\nstatic decorators: DecoratorInvocation[] = [\n{ type: Injectable },\n];\n/** @nocollapse */\nstatic ctorParameters: () => ({type: any, decorators?: DecoratorInvocation[]}|null)[] = () => [\n{type: Injector, },\n{type: InMemoryDbService, },\n{type: InMemoryBackendConfigArgs, decorators: [{ type: Inject, args: [InMemoryBackendConfig, ] }, { type: Optional }, ]},\n];\n}\n\ninterface DecoratorInvocation {\n type: Function;\n args?: any[];\n}\n"]}