5.3.9 • Published 8 months ago

@ember-data-mirror/model v5.3.9

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Installation

Install using your javascript package manager of choice. For instance with pnpm

pnpm add @ember-data-mirror/model

Tagged Releases

  • NPM Canary Version
  • NPM Beta Version
  • NPM Stable Version
  • NPM LTS Version
  • NPM LTS 4.12 Version

This package implements the EmberData Store's instantiateRecord and teardownRecord hooks as well as configures an associated SchemaService implementation.

Models are defined as classes extending from import Model from '@ember-data-mirror/model'; and the attributes and relationships on these classes are parsed at runtime to supply static "schema" to EmberData's SchemaService.

Resource data for individual resources fetched from your API is presented to the UI via instances of the Models you define. An instantiated Model is referred to as a record.

When we refer to the ModelClass as opposed to a Model or Record we are referring specifically to the class definition and the static schema methods present on it.

When we refer to a record we refer to a specific class instance presenting the resource data for a given type and id.

Defining a Model

app/models/person.js

import Model, { attr, belongsTo, hasMany } from '@ember-data-mirror/model';

export default class PersonModel extends Model {
  @attr name;

  @belongsTo('pet', { inverse: 'owners', async: false }) dog;

  @hasMany('person', { inverse: 'friends', async: true }) friends;
}

modelName convention

By convention, the name of a given model (its type) matches the name of the file in the app/models folder and should be lowercase, singular and dasherized.

5.4.0-beta.12

8 months ago

5.4.0-alpha.113

8 months ago

5.3.9

8 months ago

5.4.0-alpha.112

8 months ago

5.4.0-alpha.111

8 months ago

5.4.0-alpha.108

10 months ago

5.4.0-alpha.107

10 months ago

5.4.0-alpha.109

9 months ago

5.4.0-alpha.100

10 months ago

5.4.0-alpha.87

12 months ago

5.4.0-alpha.86

12 months ago

5.4.0-alpha.102

10 months ago

5.4.0-alpha.85

1 year ago

5.4.0-alpha.101

10 months ago

5.4.0-alpha.84

1 year ago

5.4.0-alpha.104

10 months ago

5.4.0-alpha.83

1 year ago

5.4.0-alpha.103

10 months ago

5.4.0-alpha.82

1 year ago

5.4.0-alpha.106

10 months ago

5.4.0-alpha.81

1 year ago

5.4.0-alpha.105

10 months ago

5.4.0-alpha.80

1 year ago

5.4.0-beta.10

12 months ago

5.4.0-alpha.79

1 year ago

5.4.0-beta.11

12 months ago

5.4.0-alpha.78

1 year ago

5.4.0-alpha.77

1 year ago

5.4.0-alpha.90

12 months ago

5.4.0-alpha.98

11 months ago

5.4.0-alpha.110

8 months ago

5.4.0-alpha.97

11 months ago

5.4.0-alpha.94

11 months ago

5.4.0-alpha.92

11 months ago

5.4.0-alpha.91

12 months ago

5.4.0-alpha.89

12 months ago

5.4.0-alpha.88

12 months ago

5.4.0-alpha.99

10 months ago

5.4.0-alpha.76

1 year ago

5.4.0-alpha.75

1 year ago

5.4.0-alpha.74

1 year ago

5.4.0-alpha.73

1 year ago

5.4.0-alpha.72

1 year ago

5.4.0-alpha.71

1 year ago

5.4.0-alpha.70

1 year ago

5.4.0-beta.6

1 year ago

5.4.0-beta.7

1 year ago

5.4.0-beta.8

12 months ago

5.4.0-beta.9

12 months ago

5.3.8

12 months ago

5.3.7

12 months ago

5.3.6

12 months ago

5.3.5

12 months ago

5.3.4

1 year ago

5.4.0-beta.5

1 year ago

5.4.0-alpha.64

1 year ago

5.4.0-alpha.63

1 year ago

5.4.0-alpha.61

1 year ago

5.4.0-alpha.60

1 year ago

5.4.0-alpha.59

1 year ago

5.4.0-alpha.58

1 year ago

5.4.0-alpha.57

1 year ago

5.4.0-alpha.56

1 year ago

5.4.0-alpha.55

1 year ago

5.4.0-alpha.54

1 year ago

5.4.0-alpha.53

1 year ago

5.4.0-alpha.52

1 year ago

5.4.0-alpha.51

1 year ago

5.4.0-alpha.50

1 year ago

5.4.0-alpha.49

1 year ago