@warp-drive-mirror/schema-record 5.4.0-alpha.142 → 5.4.0-alpha.144

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.
package/LICENSE.md CHANGED
@@ -1,12 +1,23 @@
1
- The MIT License (MIT)
1
+ MIT License
2
2
 
3
- Copyright (C) 2023 EmberData and WarpDrive contributors
4
- Copyright (C) 2017-2022 Ember.js contributors
5
- Portions Copyright (C) 2011-2017 Tilde, Inc. and contributors.
6
- 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.
7
6
 
8
- 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:
9
13
 
10
- 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.
11
16
 
12
- 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,13 +1,13 @@
1
1
  <p align="center">
2
2
  <img
3
3
  class="project-logo"
4
- src="./NCC-1701-a-blue.svg#gh-light-mode-only"
4
+ src="./logos/NCC-1701-a-blue.svg#gh-light-mode-only"
5
5
  alt="WarpDrive"
6
6
  width="120px"
7
7
  title="WarpDrive" />
8
8
  <img
9
9
  class="project-logo"
10
- src="./NCC-1701-a.svg#gh-dark-mode-only"
10
+ src="./logos/NCC-1701-a.svg#gh-dark-mode-only"
11
11
  alt="WarpDrive"
12
12
  width="120px"
13
13
  title="WarpDrive" />
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { isResourceSchema } from '@warp-drive-mirror/core-types/schema/fields';
1
2
  import { macroCondition, getGlobalConfig, dependencySatisfies, importSync } from '@embroider/macros';
2
3
  import { SOURCE as SOURCE$1, fastPush, RelatedCollection, setRecordIdentifier, recordIdentifierFor } from '@ember-data-mirror/store/-private';
3
4
  import { createSignal, subscribe, defineSignal, peekSignal, getSignal, Signals, addToTransaction, entangleSignal } from '@ember-data-mirror/tracking/-private';
@@ -1328,7 +1329,13 @@ class SchemaRecord {
1328
1329
  }
1329
1330
  function instantiateRecord(store, identifier, createArgs) {
1330
1331
  const schema = store.schema;
1331
- const isLegacy = schema.resource(identifier)?.legacy ?? false;
1332
+ const resourceSchema = schema.resource(identifier);
1333
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
1334
+ if (!test) {
1335
+ throw new Error(`Expected a resource schema`);
1336
+ }
1337
+ })(isResourceSchema(resourceSchema)) : {};
1338
+ const isLegacy = resourceSchema?.legacy ?? false;
1332
1339
  const isEditable = isLegacy || store.cache.isNew(identifier);
1333
1340
  const record = new SchemaRecord(store, identifier, {
1334
1341
  [Editable]: isEditable,
@@ -1534,7 +1541,7 @@ class SchemaService {
1534
1541
  relationships[field.name] = field;
1535
1542
  }
1536
1543
  });
1537
- const traits = new Set(schema.traits);
1544
+ const traits = new Set(isResourceSchema(schema) ? schema.traits : []);
1538
1545
  traits.forEach(trait => {
1539
1546
  this._traits.add(trait);
1540
1547
  });