-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloned-resource.js.map
1 lines (1 loc) · 2.76 KB
/
cloned-resource.js.map
1
{"version":3,"file":"cloned-resource.js","sourceRoot":"","sources":["../src/cloned-resource.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;;;;;AAGnC,MAAM,qBAA0C,SAAQ,QAAQ;;;;gBAKzC,QAAW;QAC1B,KAAK,EAAE,CAAC;;QAER,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QAC7B,OAAO,IAAI,CAAC,aAAa,CAAC;;QAC1B,IAAI,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACrD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;QACtD,IAAI,CAAC,oBAAoB,EAAE,CAAC;;;;;;IAGzB,QAAQ,CAAC,MAAwB;QACpC,OAAO,IAAI,sBAAsB,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,iBAAiB,EAAE,CAAC;;;;;;IAG9E,aAAa,CAAC,MAAwB;QACzC,OAAO,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;;;;;IAG1B,oBAAoB;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QACjC,KAAK,IAAI,YAAY,IAAI,IAAI,CAAC,aAAa,EAAE;YACzC,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC;SAC5F;;CAER","sourcesContent":["import { Resource } from './resource';\nimport { IParamsResource } from './interfaces';\nimport { IDocumentResource } from './interfaces/data-object';\nimport { ClonedDocumentResource } from './cloned-document-resource';\nimport { cloneDeep } from 'lodash';\nimport { IClonedResource } from './interfaces/cloned-resource';\n\nexport class ClonedResource<T extends Resource> extends Resource implements IClonedResource {\n private parent: Resource;\n public attributes: T['attributes'];\n public relationships: T['relationships'];\n\n public constructor(resource: T) {\n super();\n // @note using cloneDeep because the parent may have changed since clone (example: data received from socket while editing clone)\n this.parent = cloneDeep(resource);\n this.type = this.parent.type; // this line should go to fill method?\n delete this.relationships; // remove empty relationships object so fill method creates them... how can we improve inheritance to remove this?\n let include = Object.keys(this.parent.relationships);\n this.fill(this.parent.toObject({ include: include }));\n this.copySourceFromParent();\n }\n\n public toObject(params?: IParamsResource): IDocumentResource {\n return new ClonedDocumentResource(this, this.parent, params).getResourceObject();\n }\n\n public superToObject(params?: IParamsResource) {\n return super.toObject(params);\n }\n\n private copySourceFromParent() {\n this.source = this.parent.source;\n for (let relationship in this.relationships) {\n this.relationships[relationship].source = this.parent.relationships[relationship].source;\n }\n }\n}\n"]}