@ember-data/model 5.4.0-alpha.9 → 5.4.0-alpha.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +19 -0
  2. package/addon-main.cjs +5 -0
  3. package/blueprints/model/index.js +18 -5
  4. package/blueprints/model-test/index.js +16 -10
  5. package/blueprints/model-test/qunit-files/__root__/__path__/__test__.js +4 -5
  6. package/{addon → dist}/-private.js +2 -2
  7. package/dist/has-many-78F2FHCC.js +674 -0
  8. package/dist/has-many-78F2FHCC.js.map +1 -0
  9. package/dist/hooks-BgrTI_ff.js +75 -0
  10. package/dist/hooks-BgrTI_ff.js.map +1 -0
  11. package/dist/hooks.js +2 -0
  12. package/{addon → dist}/hooks.js.map +1 -1
  13. package/dist/index.js +4 -0
  14. package/{addon → dist}/index.js.map +1 -1
  15. package/dist/migration-support.js +210 -0
  16. package/dist/migration-support.js.map +1 -0
  17. package/{addon/model-520a761c.js → dist/model-BFnMMaye.js} +2973 -2356
  18. package/dist/model-BFnMMaye.js.map +1 -0
  19. package/dist/schema-provider-Cgpcwfn7.js +256 -0
  20. package/dist/schema-provider-Cgpcwfn7.js.map +1 -0
  21. package/ember-data-logo-dark.svg +12 -0
  22. package/ember-data-logo-light.svg +12 -0
  23. package/package.json +80 -48
  24. package/unstable-preview-types/-private/attr.d.ts +174 -0
  25. package/unstable-preview-types/-private/attr.d.ts.map +1 -0
  26. package/unstable-preview-types/-private/attr.type-test.d.ts +4 -0
  27. package/unstable-preview-types/-private/attr.type-test.d.ts.map +1 -0
  28. package/unstable-preview-types/-private/belongs-to.d.ts +180 -0
  29. package/unstable-preview-types/-private/belongs-to.d.ts.map +1 -0
  30. package/unstable-preview-types/-private/belongs-to.type-test.d.ts +4 -0
  31. package/unstable-preview-types/-private/belongs-to.type-test.d.ts.map +1 -0
  32. package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts +8 -0
  33. package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts.map +1 -0
  34. package/unstable-preview-types/-private/errors.d.ts +305 -0
  35. package/unstable-preview-types/-private/errors.d.ts.map +1 -0
  36. package/unstable-preview-types/-private/has-many.d.ts +169 -0
  37. package/unstable-preview-types/-private/has-many.d.ts.map +1 -0
  38. package/unstable-preview-types/-private/has-many.type-test.d.ts +4 -0
  39. package/unstable-preview-types/-private/has-many.type-test.d.ts.map +1 -0
  40. package/unstable-preview-types/-private/hooks.d.ts +13 -0
  41. package/unstable-preview-types/-private/hooks.d.ts.map +1 -0
  42. package/unstable-preview-types/-private/legacy-relationships-support.d.ts +60 -0
  43. package/unstable-preview-types/-private/legacy-relationships-support.d.ts.map +1 -0
  44. package/unstable-preview-types/-private/many-array.d.ts +196 -0
  45. package/unstable-preview-types/-private/many-array.d.ts.map +1 -0
  46. package/unstable-preview-types/-private/model-for-mixin.d.ts +6 -0
  47. package/unstable-preview-types/-private/model-for-mixin.d.ts.map +1 -0
  48. package/unstable-preview-types/-private/model-methods.d.ts +37 -0
  49. package/unstable-preview-types/-private/model-methods.d.ts.map +1 -0
  50. package/unstable-preview-types/-private/model.d.ts +1306 -0
  51. package/unstable-preview-types/-private/model.d.ts.map +1 -0
  52. package/unstable-preview-types/-private/model.type-test.d.ts +4 -0
  53. package/unstable-preview-types/-private/model.type-test.d.ts.map +1 -0
  54. package/unstable-preview-types/-private/notify-changes.d.ts +8 -0
  55. package/unstable-preview-types/-private/notify-changes.d.ts.map +1 -0
  56. package/unstable-preview-types/-private/promise-belongs-to.d.ts +48 -0
  57. package/unstable-preview-types/-private/promise-belongs-to.d.ts.map +1 -0
  58. package/unstable-preview-types/-private/promise-many-array.d.ts +131 -0
  59. package/unstable-preview-types/-private/promise-many-array.d.ts.map +1 -0
  60. package/unstable-preview-types/-private/record-state.d.ts +90 -0
  61. package/unstable-preview-types/-private/record-state.d.ts.map +1 -0
  62. package/unstable-preview-types/-private/references/belongs-to.d.ts +503 -0
  63. package/unstable-preview-types/-private/references/belongs-to.d.ts.map +1 -0
  64. package/unstable-preview-types/-private/references/has-many.d.ts +515 -0
  65. package/unstable-preview-types/-private/references/has-many.d.ts.map +1 -0
  66. package/unstable-preview-types/-private/schema-provider.d.ts +64 -0
  67. package/unstable-preview-types/-private/schema-provider.d.ts.map +1 -0
  68. package/unstable-preview-types/-private/type-utils.d.ts +64 -0
  69. package/unstable-preview-types/-private/type-utils.d.ts.map +1 -0
  70. package/unstable-preview-types/-private/util.d.ts +11 -0
  71. package/unstable-preview-types/-private/util.d.ts.map +1 -0
  72. package/unstable-preview-types/-private.d.ts +13 -0
  73. package/unstable-preview-types/-private.d.ts.map +1 -0
  74. package/unstable-preview-types/hooks.d.ts +5 -0
  75. package/unstable-preview-types/hooks.d.ts.map +1 -0
  76. package/unstable-preview-types/index.d.ts +76 -0
  77. package/unstable-preview-types/index.d.ts.map +1 -0
  78. package/unstable-preview-types/migration-support.d.ts +56 -0
  79. package/unstable-preview-types/migration-support.d.ts.map +1 -0
  80. package/addon/has-many-665b8730.js +0 -507
  81. package/addon/has-many-665b8730.js.map +0 -1
  82. package/addon/hooks-7a58334b.js +0 -157
  83. package/addon/hooks-7a58334b.js.map +0 -1
  84. package/addon/hooks.js +0 -1
  85. package/addon/index.js +0 -3
  86. package/addon/model-520a761c.js.map +0 -1
  87. package/addon-main.js +0 -93
  88. /package/{addon → dist}/-private.js.map +0 -0
package/README.md CHANGED
@@ -15,6 +15,25 @@
15
15
  />
16
16
  </p>
17
17
 
18
+ <p align="center">Runtime Classes for use as a Schema Source and Resource Presentation for EmberData</p>
19
+
20
+ ## Installation
21
+
22
+ Install using your javascript package manager of choice. For instance with [pnpm](https://pnpm.io/)
23
+
24
+ ```no-highlight
25
+ pnpm add @ember-data/model
26
+ ```
27
+
28
+ **Tagged Releases**
29
+
30
+ - ![NPM Canary Version](https://img.shields.io/npm/v/%40ember-data/model/canary?label=%40canary&color=FFBF00)
31
+ - ![NPM Beta Version](https://img.shields.io/npm/v/%40ember-data/model/beta?label=%40beta&color=ff00ff)
32
+ - ![NPM Stable Version](https://img.shields.io/npm/v/%40ember-data/model/latest?label=%40latest&color=90EE90)
33
+ - ![NPM LTS Version](https://img.shields.io/npm/v/%40ember-data/model/lts?label=%40lts&color=0096FF)
34
+ - ![NPM LTS 4.12 Version](https://img.shields.io/npm/v/%40ember-data/model/lts-4-12?label=%40lts-4-12&color=bbbbbb)
35
+
36
+
18
37
  <p align="center">Provides a Presentation Model for resource data in an EmberData Cache</p>
19
38
 
20
39
  This package implements the EmberData Store's `instantiateRecord` and `teardownRecord` hooks
package/addon-main.cjs ADDED
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ const { addonShim } = require('@warp-drive/build-config/addon-shim.cjs');
4
+
5
+ module.exports = addonShim(__dirname);
@@ -1,17 +1,28 @@
1
+ const path = require('path');
1
2
  const EOL = require('os').EOL;
2
3
 
4
+ const { has } = require('@ember/edition-utils');
5
+
3
6
  const inflection = require('inflection');
4
7
  const stringUtils = require('ember-cli-string-utils');
5
- const useEditionDetector = require('@ember-data/private-build-infra/src/utilities/edition-detector');
6
- const { has } = require('@ember/edition-utils');
7
8
 
8
- module.exports = useEditionDetector({
9
- description: 'Generates an ember-data model.',
9
+ module.exports = {
10
+ description: 'Generates an ember-data Model.',
10
11
 
11
12
  anonymousOptions: ['name', 'attr:type'],
12
13
 
13
14
  root: __dirname,
14
15
 
16
+ filesPath() {
17
+ let hasOctane = has('octane');
18
+ if (hasOctane && process.env.EMBER_EDITION === 'classic') {
19
+ hasOctane = false; //forcible override
20
+ }
21
+ let rootPath = hasOctane ? 'native-files' : 'files';
22
+ return path.join(__dirname, rootPath);
23
+ },
24
+
25
+
15
26
  locals(options) {
16
27
  let attrs = [];
17
28
  let needs = [];
@@ -109,7 +120,7 @@ module.exports = useEditionDetector({
109
120
  needs,
110
121
  };
111
122
  },
112
- });
123
+ }
113
124
 
114
125
  function nativeAttr(attr) {
115
126
  let name = attr.name,
@@ -148,3 +159,5 @@ function classicAttr(attr) {
148
159
  }
149
160
  return propertyName + ': ' + result;
150
161
  }
162
+
163
+
@@ -1,17 +1,17 @@
1
1
  const path = require('path');
2
2
 
3
3
  const testInfo = require('ember-cli-test-info');
4
- const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector');
5
- const modulePrefixForProject = require('@ember-data/private-build-infra/src/utilities/module-prefix-for-project');
4
+ const { dasherize } = require('ember-cli-string-utils');
6
5
 
7
6
  const ModelBlueprint = require('../model');
8
7
 
9
- module.exports = useTestFrameworkDetector({
10
- description: 'Generates a model unit test.',
8
+ module.exports = {
9
+ description: 'Generates an EmberData Model unit test',
10
+ supportsAddon() { return false; },
11
11
 
12
12
  root: __dirname,
13
13
 
14
- fileMapTokens(options) {
14
+ fileMapTokens() {
15
15
  return {
16
16
  __root__() {
17
17
  return 'tests';
@@ -24,10 +24,16 @@ module.exports = useTestFrameworkDetector({
24
24
 
25
25
  locals(options) {
26
26
  const result = ModelBlueprint.locals.apply(this, arguments);
27
+ const modulePrefix = dasherize(options.project.config().modulePrefix);
28
+ return {
29
+ ...result,
30
+ friendlyTestDescription: testInfo.description(options.entity.name, 'Unit', 'Model'),
31
+ modulePrefix,
32
+ };
33
+ },
27
34
 
28
- result.friendlyTestDescription = testInfo.description(options.entity.name, 'Unit', 'Model');
29
- result.modulePrefix = modulePrefixForProject(options.project);
35
+ filesPath() {
36
+ return path.join(__dirname, 'qunit-files')
37
+ }
38
+ };
30
39
 
31
- return result;
32
- },
33
- });
@@ -1,14 +1,13 @@
1
- import { module, test } from 'qunit';
2
-
3
1
  import { setupTest } from '<%= modulePrefix %>/tests/helpers';
2
+ import { module, test } from 'qunit';
4
3
 
5
4
  module('<%= friendlyTestDescription %>', function (hooks) {
6
5
  setupTest(hooks);
7
6
 
8
7
  // Replace this with your real tests.
9
8
  test('it exists', function (assert) {
10
- let store = this.owner.lookup('service:store');
11
- let model = store.createRecord('<%= dasherizedModuleName %>', {});
12
- assert.ok(model);
9
+ const store = this.owner.lookup('service:store');
10
+ const model = store.createRecord('<%= dasherizedModuleName %>', {});
11
+ assert.ok(model, 'model exists');
13
12
  });
14
13
  });
@@ -1,2 +1,2 @@
1
- export { a as attr, b as belongsTo, h as hasMany } from "./has-many-665b8730";
2
- export { E as Errors, L as LEGACY_SUPPORT, R as ManyArray, M as Model, P as PromiseBelongsTo, a as PromiseManyArray } from "./model-520a761c";
1
+ export { a as attr, b as belongsTo, h as hasMany } from "./has-many-78F2FHCC.js";
2
+ export { E as Errors, L as LEGACY_SUPPORT, R as ManyArray, M as Model, P as PromiseBelongsTo, a as PromiseManyArray, l as lookupLegacySupport } from "./model-BFnMMaye.js";