From ae9c3f34133d6e61f03c19c91f8f57f66795846e Mon Sep 17 00:00:00 2001 From: Kenneth Larsen Date: Mon, 27 Aug 2018 15:00:13 +0200 Subject: [PATCH] Grammar fixes --- addon/-legacy-private/system/many-array.js | 2 +- addon/-legacy-private/system/model/states.js | 6 +++--- .../system/references/belongs-to.js | 6 +++--- .../system/references/has-many.js | 6 +++--- addon/-legacy-private/system/store.js | 2 +- addon/-private/adapters/build-url-mixin.js | 20 +++++++++---------- addon/-private/adapters/errors.js | 18 ++++++++--------- addon/-private/system/model/errors.js | 2 +- addon/-private/system/references/record.js | 2 +- .../-record-data-private/system/many-array.js | 2 +- .../system/model/states.js | 6 +++--- .../system/references/belongs-to.js | 2 +- .../system/references/has-many.js | 6 +++--- addon/-record-data-private/system/store.js | 2 +- addon/adapter.js | 14 ++++++------- addon/adapters/json-api.js | 2 +- addon/adapters/rest.js | 6 +++--- addon/serializers/embedded-records-mixin.js | 16 +++++++-------- addon/serializers/rest.js | 2 +- addon/transforms/boolean.js | 2 +- addon/transforms/transform.js | 2 +- 21 files changed, 63 insertions(+), 63 deletions(-) diff --git a/addon/-legacy-private/system/many-array.js b/addon/-legacy-private/system/many-array.js index f5c1ac297fa..47a1ca379a4 100644 --- a/addon/-legacy-private/system/many-array.js +++ b/addon/-legacy-private/system/many-array.js @@ -46,7 +46,7 @@ import diffArray from './diff-array'; property to be set to the post that contained the has-many. - We call the record to which a relationship belongs the + We call the record to which a relationship belongs-to the relationship's _owner_. @class ManyArray diff --git a/addon/-legacy-private/system/model/states.js b/addon/-legacy-private/system/model/states.js index 7697a1f1fd9..893a1680a35 100644 --- a/addon/-legacy-private/system/model/states.js +++ b/addon/-legacy-private/system/model/states.js @@ -16,7 +16,7 @@ import { assert } from '@ember/debug'; it would be in the `root.loaded.created.uncommitted` state. If a record has had local modifications made to it that are in the process of being saved, the record would be in the - `root.loaded.updated.inFlight` state. (This state paths will be + `root.loaded.updated.inFlight` state. (This state path will be explained in more detail below.) Events are sent by the record or its store to the record's @@ -24,9 +24,9 @@ import { assert } from '@ember/debug'; dependent on which state it is in. In some states, certain events will be invalid and will cause an exception to be raised. - States are hierarchical and every state is a substate of the + States are hierarchical and every state is a sub-state of the `RootState`. For example, a record can be in the - `root.deleted.uncommitted` state, then transition into the + `root.deleted.uncommitted` state then transitions into the `root.deleted.inFlight` state. If a child state does not implement an event handler, the state manager will attempt to invoke the event on all parent states until the root state is reached. The state diff --git a/addon/-legacy-private/system/references/belongs-to.js b/addon/-legacy-private/system/references/belongs-to.js index 07368d8ef64..6d836fa0300 100644 --- a/addon/-legacy-private/system/references/belongs-to.js +++ b/addon/-legacy-private/system/references/belongs-to.js @@ -5,7 +5,7 @@ import Reference from './reference'; import { assertPolymorphicType } from 'ember-data/-debug'; /** - A BelongsToReference is a low level API that allows users and + A BelongsToReference is a low-level API that allows users and addon author to perform meta-operations on a belongs-to relationship. @@ -314,7 +314,7 @@ export default class BelongsToReference extends Reference { } /** - Loads a record in a belongs to relationship if it is not already + Loads a record in a belongs to-relationship if it is not already loaded. If the relationship is already loaded this method does not trigger a new load. @@ -366,7 +366,7 @@ export default class BelongsToReference extends Reference { /** Triggers a reload of the value in this relationship. If the remoteType is `"link"` Ember Data will use the relationship link to - reload the relationship. Otherwise it will reload the record by its + reload the relationship. Otherwise, it will reload the record by its id. Example diff --git a/addon/-legacy-private/system/references/has-many.js b/addon/-legacy-private/system/references/has-many.js index 264103708e6..425ae243354 100644 --- a/addon/-legacy-private/system/references/has-many.js +++ b/addon/-legacy-private/system/references/has-many.js @@ -5,7 +5,7 @@ import { DEBUG } from '@glimmer/env'; import { assertPolymorphicType } from 'ember-data/-debug'; /** - A HasManyReference is a low level API that allows users and addon + A HasManyReference is a low-level API that allows users and addon author to perform meta-operations on a has-many relationship. @class HasManyReference @@ -107,7 +107,7 @@ export default class HasManyReference extends Reference { } /** - `ids()` returns an array of the record ids in this relationship. + `ids()` returns an array of the record IDs in this relationship. Example @@ -147,7 +147,7 @@ export default class HasManyReference extends Reference { } /** - The meta data for the has-many relationship. + The metadata for the has-many relationship. Example diff --git a/addon/-legacy-private/system/store.js b/addon/-legacy-private/system/store.js index 56bf66b635e..919e158d39c 100644 --- a/addon/-legacy-private/system/store.js +++ b/addon/-legacy-private/system/store.js @@ -153,7 +153,7 @@ const { [createRecord](#method_createRecord) is used for creating new records on the client side. This will return a new record in the `created.uncommitted` state. In order to persist this record to the - backend you will need to call `record.save()`. + backend, you will need to call `record.save()`. [push](#method_push) is used to notify Ember Data's store of new or updated records that exist in the backend. This will return a record diff --git a/addon/-private/adapters/build-url-mixin.js b/addon/-private/adapters/build-url-mixin.js index d1552ae675f..4fd90fcbd1c 100644 --- a/addon/-private/adapters/build-url-mixin.js +++ b/addon/-private/adapters/build-url-mixin.js @@ -5,11 +5,11 @@ import { pluralize } from 'ember-inflector'; /** - WARNING: This interface is likely to change in order to accomodate https://github.com/emberjs/rfcs/pull/4 + WARNING: This interface is likely to change in order to accommodate [RFC: Ember Data url templates](https://github.com/emberjs/rfcs/pull/4) ## Using BuildURLMixin - To use url building, include the mixin when extending an adapter, and call `buildURL` where needed. + To use URL building, include the mixin when extending an adapter, and call `buildURL` where needed. The default behaviour is designed for RESTAdapter. ### Example @@ -41,7 +41,7 @@ export default Mixin.create({ If an ID is specified, it adds the ID to the path generated for the type, separated by a `/`. - When called by RESTAdapter.findMany() the `id` and `snapshot` parameters + When called by `RESTAdapter.findMany()` the `id` and `snapshot` parameters will be arrays of ids and snapshots. @method buildURL @@ -221,9 +221,9 @@ export default Mixin.create({ }, /** - Builds a URL for coalesceing multiple `store.findRecord(type, id)` + Builds a URL for coalescing multiple `store.findRecord(type, id)` records into 1 request when the adapter's `coalesceFindRequests` - property is true. + property is `true`. Example: @@ -249,7 +249,7 @@ export default Mixin.create({ }, /** - Builds a URL for fetching a async hasMany relationship when a url + Builds a URL for fetching an async `hasMany` relationship when a URL is not provided by the server. Example: @@ -276,7 +276,7 @@ export default Mixin.create({ }, /** - Builds a URL for fetching a async belongsTo relationship when a url + Builds a URL for fetching an async `belongsTo` relationship when a url is not provided by the server. Example: @@ -328,7 +328,7 @@ export default Mixin.create({ }, /** - Builds a URL for a `record.save()` call when the record has been update locally. + Builds a URL for a `record.save()` call when the record has been updated locally. Example: @@ -426,8 +426,8 @@ export default Mixin.create({ ### Pathname customization - For example if you have an object LineItem with an - endpoint of "/line_items/". + For example, if you have an object `LineItem` with an + endpoint of `/line_items/`. ```app/adapters/application.js import DS from 'ember-data'; diff --git a/addon/-private/adapters/errors.js b/addon/-private/adapters/errors.js index 8cfd7b978dd..4591522e587 100644 --- a/addon/-private/adapters/errors.js +++ b/addon/-private/adapters/errors.js @@ -23,7 +23,7 @@ const PRIMARY_ATTRIBUTE_KEY = 'base'; - `DS.ServerError` To create a custom error to signal a specific error state in communicating - with an external API, extend the `DS.AdapterError`. For example if the + with an external API, extend the `DS.AdapterError`. For example, if the external API exclusively used HTTP `503 Service Unavailable` to indicate it was closed for maintenance: @@ -110,16 +110,16 @@ AdapterError.extend = extendFn(AdapterError); /** A `DS.InvalidError` is used by an adapter to signal the external API was unable to process a request because the content was not - semantically correct or meaningful per the API. Usually this means a - record failed some form of server side validation. When a promise + semantically correct or meaningful per the API. Usually, this means a + record failed some form of server-side validation. When a promise from an adapter is rejected with a `DS.InvalidError` the record will transition to the `invalid` state and the errors will be set to the `errors` property on the record. For Ember Data to correctly map errors to their corresponding properties on the model, Ember Data expects each error to be - a valid json-api error object with a `source/pointer` that matches - the property name. For example if you had a Post model that + a valid JSON-API error object with a `source/pointer` that matches + the property name. For example, if you had a Post model that looked like this. ```app/models/post.js @@ -157,9 +157,9 @@ AdapterError.extend = extendFn(AdapterError); ``` Your backend may use different property names for your records the - store will attempt extract and normalize the errors using the + store will attempt to extract and normalize the errors using the serializer's `extractErrors` method before the errors get added to - the the model. As a result, it is safe for the `InvalidError` to + the model. As a result, it is safe for the `InvalidError` to wrap the error payload unaltered. @class InvalidError @@ -221,7 +221,7 @@ export const AbortError = extend(AdapterError, 'The adapter operation was aborte API was rejected because authorization is required and has failed or has not yet been provided. - An example use case would be to redirect the user to a log in route if a + An example use case would be to redirect the user to a login route if a request is unauthorized: ```app/routes/application.js @@ -304,7 +304,7 @@ export const NotFoundError = extend(AdapterError, 'The adapter could not find th A `DS.ConflictError` equates to a HTTP `409 Conflict` response status. It is used by an adapter to indicate that the request could not be processed because of a conflict in the request. An example scenario would be when - creating a record with a client generated id but that id is already known + creating a record with a client-generated ID but that ID is already known to the external API. @class ConflictError diff --git a/addon/-private/system/model/errors.js b/addon/-private/system/model/errors.js index 005fb9ec7ca..e718fc06168 100644 --- a/addon/-private/system/model/errors.js +++ b/addon/-private/system/model/errors.js @@ -390,7 +390,7 @@ export default ArrayProxy.extend(Evented, { }, /** - Checks if there is error messages for the given attribute. + Checks if there are error messages for the given attribute. ```app/routes/user/edit.js import Route from '@ember/routing/route'; diff --git a/addon/-private/system/references/record.js b/addon/-private/system/references/record.js index 56bb3338192..ebc08a5680c 100644 --- a/addon/-private/system/references/record.js +++ b/addon/-private/system/references/record.js @@ -2,7 +2,7 @@ import { resolve } from 'rsvp'; import Reference from './reference'; /** - An RecordReference is a low level API that allows users and + An RecordReference is a low-level API that allows users and addon author to perform meta-operations on a record. @class RecordReference diff --git a/addon/-record-data-private/system/many-array.js b/addon/-record-data-private/system/many-array.js index 24e75beae59..a7ee046030b 100644 --- a/addon/-record-data-private/system/many-array.js +++ b/addon/-record-data-private/system/many-array.js @@ -46,7 +46,7 @@ import diffArray from './diff-array'; property to be set to the post that contained the has-many. - We call the record to which a relationship belongs the + We call the record to which a relationship belongs-to the relationship's _owner_. @class ManyArray diff --git a/addon/-record-data-private/system/model/states.js b/addon/-record-data-private/system/model/states.js index 98cf914167e..64af14ba330 100644 --- a/addon/-record-data-private/system/model/states.js +++ b/addon/-record-data-private/system/model/states.js @@ -16,7 +16,7 @@ import { assert } from '@ember/debug'; it would be in the `root.loaded.created.uncommitted` state. If a record has had local modifications made to it that are in the process of being saved, the record would be in the - `root.loaded.updated.inFlight` state. (This state paths will be + `root.loaded.updated.inFlight` state. (This state path will be explained in more detail below.) Events are sent by the record or its store to the record's @@ -24,9 +24,9 @@ import { assert } from '@ember/debug'; dependent on which state it is in. In some states, certain events will be invalid and will cause an exception to be raised. - States are hierarchical and every state is a substate of the + States are hierarchical and every state is a sub-state of the `RootState`. For example, a record can be in the - `root.deleted.uncommitted` state, then transition into the + `root.deleted.uncommitted` state then transitions into the `root.deleted.inFlight` state. If a child state does not implement an event handler, the state manager will attempt to invoke the event on all parent states until the root state is reached. The state diff --git a/addon/-record-data-private/system/references/belongs-to.js b/addon/-record-data-private/system/references/belongs-to.js index 29a679eea92..2a20eb3d6a0 100644 --- a/addon/-record-data-private/system/references/belongs-to.js +++ b/addon/-record-data-private/system/references/belongs-to.js @@ -7,7 +7,7 @@ import { deprecate } from '@ember/debug'; import { assertPolymorphicType } from 'ember-data/-debug'; /** - A BelongsToReference is a low level API that allows users and + A BelongsToReference is a low-level API that allows users and addon author to perform meta-operations on a belongs-to relationship. diff --git a/addon/-record-data-private/system/references/has-many.js b/addon/-record-data-private/system/references/has-many.js index d74fe7871dc..7ac204b993c 100644 --- a/addon/-record-data-private/system/references/has-many.js +++ b/addon/-record-data-private/system/references/has-many.js @@ -5,7 +5,7 @@ import { DEBUG } from '@glimmer/env'; import { assertPolymorphicType } from 'ember-data/-debug'; /** - A HasManyReference is a low level API that allows users and addon + A HasManyReference is a low-level API that allows users and addon author to perform meta-operations on a has-many relationship. @class HasManyReference @@ -64,7 +64,7 @@ export default class HasManyReference extends Reference { ``` @method remoteType - @return {String} The name of the remote type. This should either be "link" or "ids" + @return {String} The name of the remote type. This should either be `link` or `ids` */ remoteType() { let value = this._resource(); @@ -76,7 +76,7 @@ export default class HasManyReference extends Reference { } /** - `ids()` returns an array of the record ids in this relationship. + `ids()` returns an array of the record IDs in this relationship. Example diff --git a/addon/-record-data-private/system/store.js b/addon/-record-data-private/system/store.js index 0717d5decfb..a6afccd6c46 100644 --- a/addon/-record-data-private/system/store.js +++ b/addon/-record-data-private/system/store.js @@ -154,7 +154,7 @@ const { [createRecord](#method_createRecord) is used for creating new records on the client side. This will return a new record in the `created.uncommitted` state. In order to persist this record to the - backend you will need to call `record.save()`. + backend, you will need to call `record.save()`. [push](#method_push) is used to notify Ember Data's store of new or updated records that exist in the backend. This will return a record diff --git a/addon/adapter.js b/addon/adapter.js index fec86b72db6..f6560223268 100644 --- a/addon/adapter.js +++ b/addon/adapter.js @@ -7,7 +7,7 @@ import EmberObject from '@ember/object'; /** An adapter is an object that receives requests from a store and translates them into the appropriate action to take against your - persistence layer. The persistence layer is usually an HTTP API, but + persistence layer. The persistence layer is usually an HTTP API but may be anything, such as the browser's local storage. Typically the adapter is not invoked directly instead its functionality is accessed through the `store`. @@ -52,7 +52,7 @@ import EmberObject from '@ember/object'; * `findMany()` - For an example implementation, see `DS.RESTAdapter`, the + For an example of the implementation, see `DS.RESTAdapter`, the included REST adapter. @class Adapter @@ -90,7 +90,7 @@ export default EmberObject.extend({ method should return a promise that will resolve to a JavaScript object that will be normalized by the serializer. - Here is an example `findRecord` implementation: + Here is an example of the `findRecord` implementation: ```app/adapters/application.js import DS from 'ember-data'; @@ -477,7 +477,7 @@ export default EmberObject.extend({ Organize records into groups, each of which is to be passed to separate calls to `findMany`. - For example, if your api has nested URLs that depend on the parent, you will + For example, if your API has nested URLs that depend on the parent, you will want to group records by their parent. The default implementation returns the records as a single group. @@ -578,9 +578,9 @@ export default EmberObject.extend({ case a cached version is more than 20 minutes old, `findAll` will not resolve until you fetched the latest versions. - By default this methods returns `true` if the passed `snapshotRecordArray` + By default, this method returns `true` if the passed `snapshotRecordArray` is empty (meaning that there are no records locally available yet), - otherwise it returns `false`. + otherwise, it returns `false`. Note that, with default settings, `shouldBackgroundReloadAll` will always re-fetch all the records in the background even if `shouldReloadAll` returns @@ -624,7 +624,7 @@ export default EmberObject.extend({ } ``` - By default this hook returns `true` so the data for the record is updated + By default, this hook returns `true` so the data for the record is updated in the background. @since 1.13.0 diff --git a/addon/adapters/json-api.js b/addon/adapters/json-api.js index f23aa34eb20..7b5f2e8b1ed 100644 --- a/addon/adapters/json-api.js +++ b/addon/adapters/json-api.js @@ -15,7 +15,7 @@ import { pluralize } from 'ember-inflector'; ## JSON API Conventions - The JSONAPIAdapter uses JSON API conventions for building the url + The JSONAPIAdapter uses JSON API conventions for building the URL for a record and selecting the HTTP verb to use with a request. The actions you can take on a record map onto the following URLs in the JSON API adapter: diff --git a/addon/adapters/rest.js b/addon/adapters/rest.js index a8cd88d2532..ee69443b110 100644 --- a/addon/adapters/rest.js +++ b/addon/adapters/rest.js @@ -161,9 +161,9 @@ const Promise = EmberPromise; ``` If the records in the relationship are not known when the response - is serialized its also possible to represent the relationship as a - url using the `links` key in the response. Ember Data will fetch - this url to resolve the relationship when it is accessed for the + is serialized it's also possible to represent the relationship as a + URL using the `links` key in the response. Ember Data will fetch + this URL to resolve the relationship when it is accessed for the first time. ```js diff --git a/addon/serializers/embedded-records-mixin.js b/addon/serializers/embedded-records-mixin.js index bbc21faa7a6..f8b4e66a228 100644 --- a/addon/serializers/embedded-records-mixin.js +++ b/addon/serializers/embedded-records-mixin.js @@ -30,7 +30,7 @@ import { warn } from '@ember/debug'; Note that this use of `{ embedded: 'always' }` is unrelated to the `{ embedded: 'always' }` that is defined as an option on `DS.attr` as part of defining a model while working with the `ActiveModelSerializer`. Nevertheless, - using `{ embedded: 'always' }` as an option to `DS.attr` is not a valid way to setup + using `{ embedded: 'always' }` as an option to `DS.attr` is not a valid way to set up embedded records. The `attrs` option for a resource `{ embedded: 'always' }` is shorthand for: @@ -52,7 +52,7 @@ import { warn } from '@ember/debug'; In the case where embedded JSON is expected while extracting a payload (reading) the setting is `deserialize: 'records'`, there is no need to use `ids` when - extracting as that is the default behavior without this mixin if you are using + extracting as that is the default behaviour without this mixin if you are using the vanilla `EmbeddedRecordsMixin`. Likewise, to embed JSON in the payload while serializing `serialize: 'records'` is the setting to use. There is an option of not embedding JSON in the serialized payload by using `serialize: 'ids'`. If you @@ -76,8 +76,8 @@ import { warn } from '@ember/debug'; then do not use `async: true`. To successfully extract and serialize embedded records the model relationships - must be setup correcty. See the - [defining relationships](/guides/models/relationships) + must be set up correctly. See the + [defining relationships](/guides/models/defining-models/#toc_defining-relationships) section of the **Defining Models** guide page. Records without an `id` property are not considered embedded records, model @@ -89,7 +89,7 @@ import { warn } from '@ember/debug'; are. Please read the docs for the methods this mixin provides, in case you need to modify it to fit your specific needs.** - For example review the docs for each method of this mixin: + For example, review the docs for each method of this mixin: * [normalize](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_normalize) * [serializeBelongsTo](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeBelongsTo) * [serializeHasMany](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeHasMany) @@ -326,7 +326,7 @@ export default Mixin.create({ This is particularly useful for polymorphic relationships where records don't share the same table and the `id` is not enough information. - By example having a user that has many pets: + For example having a user that has many pets: ```js User = DS.Model.extend({ @@ -455,8 +455,8 @@ export default Mixin.create({ }, /** - When serializing an embedded record, modify the property (in the json payload) - that refers to the parent record (foreign key for relationship). + When serializing an embedded record, modify the property (in the `JSON` payload) + that refers to the parent record (foreign key for the relationship). Serializing a `belongsTo` relationship removes the property that refers to the parent record diff --git a/addon/serializers/rest.js b/addon/serializers/rest.js index 8987067e4f7..cda13a82dd2 100644 --- a/addon/serializers/rest.js +++ b/addon/serializers/rest.js @@ -21,7 +21,7 @@ import { Normally, applications will use the `RESTSerializer` by implementing the `normalize` method. - This allows you to do whatever kind of munging you need, and is + This allows you to do whatever kind of munging you need and is especially useful if your server is inconsistent and you need to do munging differently for many different kinds of responses. diff --git a/addon/transforms/boolean.js b/addon/transforms/boolean.js index 241084ba3a0..28268fa4c18 100644 --- a/addon/transforms/boolean.js +++ b/addon/transforms/boolean.js @@ -19,7 +19,7 @@ import Transform from './transform'; }); ``` - By default the boolean transform only allows for values of `true` or + By default, the boolean transform only allows for values of `true` or `false`. You can opt into allowing `null` values for boolean attributes via `DS.attr('boolean', { allowNull: true })` diff --git a/addon/transforms/transform.js b/addon/transforms/transform.js index 5cbdb20a1ce..7a87f0256e1 100644 --- a/addon/transforms/transform.js +++ b/addon/transforms/transform.js @@ -90,7 +90,7 @@ export default EmberObject.extend({ serialize: null, /** - When given a serialize value from a JSON object this method must + When given a serialized value from a JSON object this method must return the deserialized value for the record attribute. Example