{"action":"created","issue":{"url":"https://api.github.com/repos/Netflix/pollyjs/issues/21","repository_url":"https://api.github.com/repos/Netflix/pollyjs","labels_url":"https://api.github.com/repos/Netflix/pollyjs/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/Netflix/pollyjs/issues/21/comments","events_url":"https://api.github.com/repos/Netflix/pollyjs/issues/21/events","html_url":"https://github.com/Netflix/pollyjs/issues/21","id":332867069,"node_id":"MDU6SXNzdWUzMzI4NjcwNjk=","number":21,"title":"Custom Persister Support","user":{"login":"indieisaconcept","id":640613,"node_id":"MDQ6VXNlcjY0MDYxMw==","avatar_url":"https://avatars3.githubusercontent.com/u/640613?v=4","gravatar_id":"","url":"https://api.github.com/users/indieisaconcept","html_url":"https://github.com/indieisaconcept","followers_url":"https://api.github.com/users/indieisaconcept/followers","following_url":"https://api.github.com/users/indieisaconcept/following{/other_user}","gists_url":"https://api.github.com/users/indieisaconcept/gists{/gist_id}","starred_url":"https://api.github.com/users/indieisaconcept/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indieisaconcept/subscriptions","organizations_url":"https://api.github.com/users/indieisaconcept/orgs","repos_url":"https://api.github.com/users/indieisaconcept/repos","events_url":"https://api.github.com/users/indieisaconcept/events{/privacy}","received_events_url":"https://api.github.com/users/indieisaconcept/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-15T18:04:45Z","updated_at":"2018-06-15T18:20:47Z","closed_at":null,"author_association":"NONE","body":"Hi pollyjs team,\r\n\r\nI'd like to suggest adding support for specifying a custom persister in a similar fashion to adapters.\r\n\r\n```\r\n{\r\n    persister: ['<myCustomPersisterName>', myCustomPersister],\r\n}\r\n```\r\n\r\nI've managed to get this working and was wondering if you would be open to accepting a PR for this. \r\n\r\nIt would require a minor change to `@pollyjs/core` to support registering custom persisters with the container and ideally `@pollyjs/core/src/persisters/persister` would be promoted to its own package so that it is more accessible i.e `@pollyjs/persister` similar to adapters.\r\n\r\n```javascript\r\nconst persisterConfig = this.config.persister;\r\nlet persisterName = persisterConfig;\r\n\r\nif(isArray(persisterConfig)) {\r\n    const [, PersisterType] = persisterConfig;\r\n    persisterName = persisterConfig[0];\r\n    this._container.set(`persister:${persisterName}`, PersisterType);\r\n}\r\n\r\nthis.persister = new (this._container.get(\r\n  `persister:${persisterName}`\r\n))(this);\r\n```\r\n\r\nThe context for this suggestion is that with these minor changes its possible for `pollyjs` to support recording within Node directly meaning I can use `pollyjs` for both my client & server tests.\r\n\r\nI've this working end-to-end and plan on polishing it further.\r\n\r\nCheers,\r\n\r\nJon"},"comment":{"url":"https://api.github.com/repos/Netflix/pollyjs/issues/comments/397703873","html_url":"https://github.com/Netflix/pollyjs/issues/21#issuecomment-397703873","issue_url":"https://api.github.com/repos/Netflix/pollyjs/issues/21","id":397703873,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzcwMzg3Mw==","user":{"login":"jasonmit","id":3108309,"node_id":"MDQ6VXNlcjMxMDgzMDk=","avatar_url":"https://avatars1.githubusercontent.com/u/3108309?v=4","gravatar_id":"","url":"https://api.github.com/users/jasonmit","html_url":"https://github.com/jasonmit","followers_url":"https://api.github.com/users/jasonmit/followers","following_url":"https://api.github.com/users/jasonmit/following{/other_user}","gists_url":"https://api.github.com/users/jasonmit/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonmit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonmit/subscriptions","organizations_url":"https://api.github.com/users/jasonmit/orgs","repos_url":"https://api.github.com/users/jasonmit/repos","events_url":"https://api.github.com/users/jasonmit/events{/privacy}","received_events_url":"https://api.github.com/users/jasonmit/received_events","type":"User","site_admin":false},"created_at":"2018-06-15T18:20:47Z","updated_at":"2018-06-15T18:20:47Z","author_association":"MEMBER","body":"> I've managed to get this working and was wondering if you would be open to accepting a PR for this.\r\n\r\n> It would require a minor change to @pollyjs/core to support registering custom persisters with the container and ideally @pollyjs/core/src/persisters/persister would be promoted to its own package so that it is more accessible i.e @pollyjs/persister similar to adapters.\r\n\r\nAbsolutely!  Would appreciate this contribution."}}
{"actor":{"display_login":"jasonmit"}}