{"id":15537202,"url":"https://github.com/bmac/ember-data-sails-adapter","last_synced_at":"2025-08-21T05:33:00.381Z","repository":{"id":11867539,"uuid":"14427375","full_name":"bmac/ember-data-sails-adapter","owner":"bmac","description":"An Ember data adaptor for the Sails.js sockets","archived":false,"fork":false,"pushed_at":"2024-01-13T20:34:07.000Z","size":53,"stargazers_count":90,"open_issues_count":10,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-12-10T07:11:14.373Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bmac.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2013-11-15T15:11:53.000Z","updated_at":"2024-01-13T20:34:12.000Z","dependencies_parsed_at":"2024-01-31T23:12:13.650Z","dependency_job_id":null,"html_url":"https://github.com/bmac/ember-data-sails-adapter","commit_stats":{"total_commits":76,"total_committers":8,"mean_commits":9.5,"dds":"0.48684210526315785","last_synced_commit":"9c130cc8f4ab2916ba11fd06ecc0f076f827a3fc"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmac%2Fember-data-sails-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmac%2Fember-data-sails-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmac%2Fember-data-sails-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmac%2Fember-data-sails-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bmac","download_url":"https://codeload.github.com/bmac/ember-data-sails-adapter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230494917,"owners_count":18235046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T11:55:26.244Z","updated_at":"2024-12-19T20:07:54.411Z","avatar_url":"https://github.com/bmac.png","language":"JavaScript","readme":"Alternates\n============================\n\nI haven't had much time to maintain this project recently as I am no longer working on a project that uses Sails.js. Here are some alternate projects that you may want to consider instead of this one.\n\nIf you would like to modify your Sails.js backend to work with Ember Data out of the box check out @mphasize's [sails-generate-ember-blueprints](https://github.com/mphasize/sails-generate-ember-blueprints).\n\nIf you would like an adapter/serializer combo for Ember Data that works well with the stock Sails.js API and supports ember-cli check out @huafu's [ember-data-sails](https://github.com/huafu/ember-data-sails)\n\n\nember-data-sails-adapter 2.x\n============================\n\nAn Ember Data adapter for Sails.js v0.10. If you are looking for Sails.js blueprints that work well with Ember Data be sure to check out [sails-generate-ember-blueprints](https://github.com/mphasize/sails-generate-ember-blueprints).\n\n**Note:** If you like to use this adapter with Sails.js v0.9 please use the [1.x line](https://github.com/bmac/ember-data-sails-adapter#ember-data-sails-adapter-1x).\n\nThis package contains 2 Adapters, `DS.SailsSocketAdapter` and `DS.SailsRESTAdapter`. \n\n```bash\nbower install ember-data-sails-adapter\n```\n\n```html\n\u003cscript type=\"text/javascript\" src=\"/bower_components/ember-data-sails-adapter/ember-data-sails-adapter.js\"\u003e\u003c/script\u003e\n```\n\n#### SailsSocketAdapter\n\nThe `SailsSocketAdapter` uses Sails's [websocket support](http://sailsjs.org/#!documentation/sockets) to find, create and delete records. This has the benefit of automatically subscribing to the Sails' `update`, `create` and `delete` events for for the model. To enable these events with Blueprint controllers in Sails v0.10 you will need to set the `autosubscribe` property on your Model. The adapter will add or update records in the store when a Sails emits an `updated`, `created` or `destroyed` event.\n\n```javascript\nApp.ApplicationAdapter = DS.SailsSocketAdapter.extend({\n    namespace: '/api/v1',\n});\n```\n\n#### SailsRESTAdapter\n\nThe `SailsRESTAdapter` works similarly to the Ember [RESTAdapter](http://emberjs.com/api/data/classes/DS.RESTAdapter.html). The main differences are this adapter automatically attempts to use the `JSONSerializer` instead of the `RESTSerializer` because it more closely matches the JSON response from Sails. Additionally it will re-format the error messages returned by Sails to match the format that Ember Data expects. With the `SailsRESTAdapter` you will not get the live updateing that comes with the  `SailsSocketAdapter`. However, because websockets do not support compression using the `SailsRESTAdapter` may be beneficial when you are expecting a large response from the Sails api.\n\n```javascript\nApp.ApplicationAdapter = DS.SailsRESTAdapter.extend({\n    namespace: '/api/v1'\n});\n```\n\n#### Pluralised Routes\n\nBy default Sails does not pluralize the model names when creating urls\nto a model's route. This is different from the normal Ember Data\nconventions. To make it easy to get started the `SailsRESTAdapter` and\n`SailsSocketAdapter` will attempt to singularize the model name when\nrequesting a model's route. If you would like to use a pluralized\nmodel name in the route you can override the default `pathForType`\nmethod.\n\nExample\n\n```js\nApp.ApplicationAdapter = DS.SailsRESTAdapter.example({\n  pathForType: function(type) {\n    var camelized = Ember.String.camelize(type);\n    return Ember.String.pluralize(camelized);\n  }\n});\n```\n\nYou can enable pluralized routes in sails by going to\n`config/blueprints.js` and setting the `pluralize` variable to true.\n\n## SailsSocketAdapter Options\nThe options below are for the SailsSocketAdapter. To see a list of options for the `SailsRESTAdapter` see the [RESTAdapter docs](http://emberjs.com/api/data/classes/DS.RESTAdapter.html).\n\n#### namespace\nType: `String`\nDefault value: `''`\n\nThe prefix to add to the request uris.\n\n#### log\nType: `Boolean`\nDefault value: `false`\n\nSet to true if you would like to see a log of all requests in the command line.\n\n#### useCSRF\nType: `Boolean`\nDefault value: `false`\n\nUsed to map lowercase model names that sails uses to model names that ember can understand.\n\n\nember-data-sails-adapter 1.x\n============================\n\nAn Ember Data adapter for Sails.js v0.9. \n- [latest release](https://github.com/bmac/ember-data-sails-adapter/releases/tag/1.0.0)\n- [github branch](https://github.com/bmac/ember-data-sails-adapter/tree/1.x-master).\n\nThis package contains 2 Adapters, `DS.SailsSocketAdapter` and `DS.SailsRESTAdapter`. \n\n```bash\nbower install ember-data-sails-adapter#1.0.1\n```\n\n```html\n\u003cscript type=\"text/javascript\" src=\"/bower_components/ember-data-sails-adapter/ember-data-sails-adapter.js\"\u003e\u003c/script\u003e\n```\n\n#### SailsSocketAdapter\n\nThe `SailsSocketAdapter` uses Sails's [websocket support](http://sailsjs.org/#!documentation/sockets) to find, create and delete records. This has the benefit of automatically subscribing to the Sails' `update`, `create` and `delete` events for for the model. The adapter will add or update records in the store when a Sails emits an `update`, `create` and `delete` event.\n\n```javascript\nApp.ApplicationAdapter = DS.SailsSocketAdapter.extend({\n    namespace: '/api/v1',\n    log: false,\n    modelNameMap: {\n      userprofile: 'UserProfile'\n    }\n});\n```\n\n#### SailsRESTAdapter\n\nThe `SailsRESTAdapter` works similarly to the Ember [RESTAdapter](http://emberjs.com/api/data/classes/DS.RESTAdapter.html). The main differences are this adapter automatically attempts to use the `JSONSerializer` instead of the `RESTSerializer` because it more closely matches the JSON response from Sails. Additionally it will re-format the error messages returned by Sails to match the format that Ember Data expects. With the `SailsRESTAdapter` you will not get the live updateing that comes with the  `SailsSocketAdapter`. However, because websockets do not support compression using the `SailsRESTAdapter` may be beneficial when you are expecting a large response from the Sails api.\n\n```javascript\nApp.ApplicationAdapter = DS.SailsRESTAdapter.extend({\n    namespace: '/api/v1'\n});\n```\n\n#### ApplicationSerializer\nIn Sails v0.9, the `SailsSocketAdapter` and `SailsRESTAdapter` both work best using the `JSONSerializer`. As a result of a bug in the stock `JSONSerializer` it is recommend that you create an `ApplicationSerializer` by extending the `JSONSerializer` like in the example below.\n\n```javascript\nApp.ApplicationSerializer = DS.JSONSerializer.extend({\n  // Fix broken extractArray see:\n  // https://github.com/emberjs/data/pull/1479\n  extractArray: function(store, type, arrayPayload) {\n    var serializer = this;\n    return Ember.ArrayPolyfills.map.call(arrayPayload, function(singlePayload) {\n      return serializer.extractSingle(store, type, singlePayload);\n    });\n  },\n  // Allow JSONSerializer to work with RESTAdapter\n  // https://github.com/emberjs/data/blob/7e83ed158034cf7fedf2a7113a82de5d5ce67e76/packages/ember-data/lib/adapters/rest_adapter.js#L379\n  serializeIntoHash: function(hash, type, record, options) {\n    Ember.merge(hash, this.serialize(record, options));\n  }\n});\n```\n\n\n## SailsSocketAdapter Options\nThe options below are for the SailsSocketAdapter. To see a list of options for the `SailsRESTAdapter` see the [RESTAdapter docs](http://emberjs.com/api/data/classes/DS.RESTAdapter.html).\n\n#### namespace\nType: `String`\nDefault value: `''`\n\nThe prefix to add to the request uris.\n\n#### log\nType: `Boolean`\nDefault value: `false`\n\nSet to true if you would like to see a log of all requests in the command line.\n\n#### modelNameMap\nType: `Object`\nDefault value: `{}`\n\nUsed to map lowercase model names that sails uses to model names that ember can understand.\n\n## License\n[MIT License](http://en.wikipedia.org/wiki/MIT_License)\n","funding_links":[],"categories":["Tools","Packages"],"sub_categories":["Tools"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmac%2Fember-data-sails-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbmac%2Fember-data-sails-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmac%2Fember-data-sails-adapter/lists"}