@ember-data/model 5.5.0-alpha.11 → 5.5.0-alpha.13

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 (102) hide show
  1. package/LICENSE.md +19 -7
  2. package/README.md +21 -2
  3. package/addon-main.cjs +5 -0
  4. package/blueprints/model/index.js +18 -5
  5. package/blueprints/model-test/index.js +16 -10
  6. package/blueprints/model-test/qunit-files/__root__/__path__/__test__.js +4 -5
  7. package/dist/-private.js +3 -0
  8. package/{addon → dist}/-private.js.map +1 -1
  9. package/dist/has-many-DT3JBYYG.js +674 -0
  10. package/dist/has-many-DT3JBYYG.js.map +1 -0
  11. package/dist/hooks-CNY5g4Ab.js +75 -0
  12. package/dist/hooks-CNY5g4Ab.js.map +1 -0
  13. package/dist/hooks.js +2 -0
  14. package/{addon → dist}/hooks.js.map +1 -1
  15. package/dist/index.js +5 -0
  16. package/{addon → dist}/index.js.map +1 -1
  17. package/dist/migration-support.js +213 -0
  18. package/dist/migration-support.js.map +1 -0
  19. package/{addon/model-7d6eaf05.js → dist/model-rk3atPqV.js} +2311 -2033
  20. package/dist/model-rk3atPqV.js.map +1 -0
  21. package/dist/schema-provider-Bvogtzx9.js +259 -0
  22. package/dist/schema-provider-Bvogtzx9.js.map +1 -0
  23. package/logos/NCC-1701-a-blue.svg +4 -0
  24. package/logos/NCC-1701-a-gold.svg +4 -0
  25. package/logos/NCC-1701-a-gold_100.svg +1 -0
  26. package/logos/NCC-1701-a-gold_base-64.txt +1 -0
  27. package/logos/NCC-1701-a.svg +4 -0
  28. package/logos/README.md +4 -0
  29. package/logos/docs-badge.svg +2 -0
  30. package/logos/ember-data-logo-dark.svg +12 -0
  31. package/logos/ember-data-logo-light.svg +12 -0
  32. package/logos/github-header.svg +444 -0
  33. package/logos/social1.png +0 -0
  34. package/logos/social2.png +0 -0
  35. package/logos/warp-drive-logo-dark.svg +4 -0
  36. package/logos/warp-drive-logo-gold.svg +4 -0
  37. package/package.json +64 -69
  38. package/unstable-preview-types/-private/attr.d.ts +175 -0
  39. package/unstable-preview-types/-private/attr.d.ts.map +1 -0
  40. package/unstable-preview-types/-private/attr.type-test.d.ts +4 -0
  41. package/unstable-preview-types/-private/attr.type-test.d.ts.map +1 -0
  42. package/unstable-preview-types/-private/belongs-to.d.ts +181 -0
  43. package/unstable-preview-types/-private/belongs-to.d.ts.map +1 -0
  44. package/unstable-preview-types/-private/belongs-to.type-test.d.ts +4 -0
  45. package/unstable-preview-types/-private/belongs-to.type-test.d.ts.map +1 -0
  46. package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts +8 -0
  47. package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts.map +1 -0
  48. package/unstable-preview-types/-private/errors.d.ts +303 -0
  49. package/unstable-preview-types/-private/errors.d.ts.map +1 -0
  50. package/unstable-preview-types/-private/has-many.d.ts +169 -0
  51. package/unstable-preview-types/-private/has-many.d.ts.map +1 -0
  52. package/unstable-preview-types/-private/has-many.type-test.d.ts +4 -0
  53. package/unstable-preview-types/-private/has-many.type-test.d.ts.map +1 -0
  54. package/unstable-preview-types/-private/hooks.d.ts +13 -0
  55. package/unstable-preview-types/-private/hooks.d.ts.map +1 -0
  56. package/unstable-preview-types/-private/legacy-relationships-support.d.ts +60 -0
  57. package/unstable-preview-types/-private/legacy-relationships-support.d.ts.map +1 -0
  58. package/unstable-preview-types/-private/model-for-mixin.d.ts +6 -0
  59. package/unstable-preview-types/-private/model-for-mixin.d.ts.map +1 -0
  60. package/unstable-preview-types/-private/model-methods.d.ts +37 -0
  61. package/unstable-preview-types/-private/model-methods.d.ts.map +1 -0
  62. package/unstable-preview-types/-private/model.d.ts +1303 -0
  63. package/unstable-preview-types/-private/model.d.ts.map +1 -0
  64. package/unstable-preview-types/-private/model.type-test.d.ts +4 -0
  65. package/unstable-preview-types/-private/model.type-test.d.ts.map +1 -0
  66. package/unstable-preview-types/-private/notify-changes.d.ts +8 -0
  67. package/unstable-preview-types/-private/notify-changes.d.ts.map +1 -0
  68. package/unstable-preview-types/-private/promise-belongs-to.d.ts +46 -0
  69. package/unstable-preview-types/-private/promise-belongs-to.d.ts.map +1 -0
  70. package/unstable-preview-types/-private/promise-many-array.d.ts +131 -0
  71. package/unstable-preview-types/-private/promise-many-array.d.ts.map +1 -0
  72. package/unstable-preview-types/-private/promise-proxy-base.d.ts +5 -0
  73. package/unstable-preview-types/-private/promise-proxy-base.d.ts.map +1 -0
  74. package/unstable-preview-types/-private/record-state.d.ts +80 -0
  75. package/unstable-preview-types/-private/record-state.d.ts.map +1 -0
  76. package/unstable-preview-types/-private/references/belongs-to.d.ts +503 -0
  77. package/unstable-preview-types/-private/references/belongs-to.d.ts.map +1 -0
  78. package/unstable-preview-types/-private/references/has-many.d.ts +515 -0
  79. package/unstable-preview-types/-private/references/has-many.d.ts.map +1 -0
  80. package/unstable-preview-types/-private/schema-provider.d.ts +65 -0
  81. package/unstable-preview-types/-private/schema-provider.d.ts.map +1 -0
  82. package/unstable-preview-types/-private/type-utils.d.ts +64 -0
  83. package/unstable-preview-types/-private/type-utils.d.ts.map +1 -0
  84. package/unstable-preview-types/-private/util.d.ts +8 -0
  85. package/unstable-preview-types/-private/util.d.ts.map +1 -0
  86. package/unstable-preview-types/-private.d.ts +13 -0
  87. package/unstable-preview-types/-private.d.ts.map +1 -0
  88. package/unstable-preview-types/hooks.d.ts +5 -0
  89. package/unstable-preview-types/hooks.d.ts.map +1 -0
  90. package/unstable-preview-types/index.d.ts +76 -0
  91. package/unstable-preview-types/index.d.ts.map +1 -0
  92. package/unstable-preview-types/migration-support.d.ts +64 -0
  93. package/unstable-preview-types/migration-support.d.ts.map +1 -0
  94. package/addon/-private.js +0 -2
  95. package/addon/has-many-3776fded.js +0 -322
  96. package/addon/has-many-3776fded.js.map +0 -1
  97. package/addon/hooks-3bc51bea.js +0 -154
  98. package/addon/hooks-3bc51bea.js.map +0 -1
  99. package/addon/hooks.js +0 -1
  100. package/addon/index.js +0 -3
  101. package/addon/model-7d6eaf05.js.map +0 -1
  102. package/addon-main.js +0 -93
package/LICENSE.md CHANGED
@@ -1,11 +1,23 @@
1
- The MIT License (MIT)
1
+ MIT License
2
2
 
3
- Copyright (C) 2017-2023 Ember.js contributors
4
- Portions Copyright (C) 2011-2017 Tilde, Inc. and contributors.
5
- Portions Copyright (C) 2011 LivingSocial Inc.
3
+ Copyright (c) 2017-2025 Ember.js and contributors
4
+ Copyright (c) 2011-2017 Tilde, Inc. and contributors
5
+ Copyright (c) 2011 LivingSocial Inc.
6
6
 
7
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
8
13
 
9
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
10
16
 
11
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
package/README.md CHANGED
@@ -1,20 +1,39 @@
1
1
  <p align="center">
2
2
  <img
3
3
  class="project-logo"
4
- src="./ember-data-logo-dark.svg#gh-dark-mode-only"
4
+ src="./logos/ember-data-logo-dark.svg#gh-dark-mode-only"
5
5
  alt="EmberData Model"
6
6
  width="240px"
7
7
  title="EmberData Model"
8
8
  />
9
9
  <img
10
10
  class="project-logo"
11
- src="./ember-data-logo-light.svg#gh-light-mode-only"
11
+ src="./logos/ember-data-logo-light.svg#gh-light-mode-only"
12
12
  alt="EmberData Model"
13
13
  width="240px"
14
14
  title="EmberData Model"
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
  });
@@ -0,0 +1,3 @@
1
+ export { a as attr, b as belongsTo, h as hasMany } from "./has-many-DT3JBYYG.js";
2
+ export { E as Errors, L as LEGACY_SUPPORT, M as Model, P as PromiseBelongsTo, a as PromiseManyArray, l as lookupLegacySupport } from "./model-rk3atPqV.js";
3
+ export { RelatedCollection as ManyArray } from '@ember-data/store/-private';
@@ -1 +1 @@
1
- {"version":3,"file":"-private.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"-private.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}