@warp-drive-mirror/schema-record 5.4.0-alpha.128 → 5.4.0-alpha.130
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/dist/record.js +34 -34
- package/dist/schema.js +14 -14
- package/package.json +15 -15
package/dist/record.js
CHANGED
|
@@ -32,7 +32,7 @@ function safeForEach(instance, arr, store, callback, target) {
|
|
|
32
32
|
}
|
|
33
33
|
// clone to prevent mutation
|
|
34
34
|
arr = arr.slice();
|
|
35
|
-
macroCondition(getGlobalConfig().
|
|
35
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
36
36
|
if (!test) {
|
|
37
37
|
throw new Error('`forEach` expects a function as first argument.');
|
|
38
38
|
}
|
|
@@ -112,7 +112,7 @@ class ManagedArray {
|
|
|
112
112
|
// the given field does not exist OR
|
|
113
113
|
// the field is anything other than a GenericField or LegacyAttributeField.
|
|
114
114
|
if (mode !== '@identity' && mode !== '@index') {
|
|
115
|
-
macroCondition(getGlobalConfig().
|
|
115
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
116
116
|
if (!test) {
|
|
117
117
|
throw new Error('mode must be a string');
|
|
118
118
|
}
|
|
@@ -120,12 +120,12 @@ class ManagedArray {
|
|
|
120
120
|
const modeField = schema.resource({
|
|
121
121
|
type: field.type
|
|
122
122
|
}).fields.find(f => f.name === mode);
|
|
123
|
-
macroCondition(getGlobalConfig().
|
|
123
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
124
124
|
if (!test) {
|
|
125
125
|
throw new Error('field must exist in schema');
|
|
126
126
|
}
|
|
127
127
|
})(modeField) : {};
|
|
128
|
-
macroCondition(getGlobalConfig().
|
|
128
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
129
129
|
if (!test) {
|
|
130
130
|
throw new Error('field must be a GenericField or LegacyAttributeField');
|
|
131
131
|
}
|
|
@@ -337,7 +337,7 @@ class ManagedObject {
|
|
|
337
337
|
return Reflect.get(target, prop, receiver);
|
|
338
338
|
},
|
|
339
339
|
set(target, prop, value, receiver) {
|
|
340
|
-
macroCondition(getGlobalConfig().
|
|
340
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
341
341
|
if (!test) {
|
|
342
342
|
throw new Error(`Cannot set read-only property '${String(prop)}' on ManagedObject`);
|
|
343
343
|
}
|
|
@@ -489,7 +489,7 @@ class ResourceRelationship {
|
|
|
489
489
|
this.lid = rawValue.lid ?? rawValue.links?.self ?? `relationship:${identifier.lid}.${name}`;
|
|
490
490
|
this.data = rawValue.data ? store.peekRecord(rawValue.data) : null;
|
|
491
491
|
this.name = name;
|
|
492
|
-
if (macroCondition(getGlobalConfig().
|
|
492
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
493
493
|
this.links = Object.freeze(Object.assign({}, rawValue.links));
|
|
494
494
|
this.meta = Object.freeze(Object.assign({}, rawValue.meta));
|
|
495
495
|
} else {
|
|
@@ -652,7 +652,7 @@ class SchemaRecord {
|
|
|
652
652
|
throw new Error(`No field named ${String(prop)} on ${type}`);
|
|
653
653
|
}
|
|
654
654
|
const field = maybeField.kind === 'alias' ? maybeField.options : maybeField;
|
|
655
|
-
macroCondition(getGlobalConfig().
|
|
655
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
656
656
|
if (!test) {
|
|
657
657
|
throw new Error(`Alias fields cannot alias '@id' '@local' '@hash' or 'derived' fields`);
|
|
658
658
|
}
|
|
@@ -677,7 +677,7 @@ class SchemaRecord {
|
|
|
677
677
|
return lastValue;
|
|
678
678
|
}
|
|
679
679
|
case 'field':
|
|
680
|
-
macroCondition(getGlobalConfig().
|
|
680
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
681
681
|
if (!test) {
|
|
682
682
|
throw new Error(`SchemaRecord.${field.name} is not available in legacy mode because it has type '${field.kind}'`);
|
|
683
683
|
}
|
|
@@ -688,7 +688,7 @@ class SchemaRecord {
|
|
|
688
688
|
entangleSignal(signals, receiver, field.name);
|
|
689
689
|
return computeAttribute(cache, identifier, prop);
|
|
690
690
|
case 'resource':
|
|
691
|
-
macroCondition(getGlobalConfig().
|
|
691
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
692
692
|
if (!test) {
|
|
693
693
|
throw new Error(`SchemaRecord.${field.name} is not available in legacy mode because it has type '${field.kind}'`);
|
|
694
694
|
}
|
|
@@ -701,7 +701,7 @@ class SchemaRecord {
|
|
|
701
701
|
entangleSignal(signals, receiver, field.name);
|
|
702
702
|
return computeArray(store, schema, cache, target, identifier, field, propArray, true, Mode[Editable], Mode[Legacy]);
|
|
703
703
|
case 'array':
|
|
704
|
-
macroCondition(getGlobalConfig().
|
|
704
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
705
705
|
if (!test) {
|
|
706
706
|
throw new Error(`SchemaRecord.${field.name} is not available in legacy mode because it has type '${field.kind}'`);
|
|
707
707
|
}
|
|
@@ -709,7 +709,7 @@ class SchemaRecord {
|
|
|
709
709
|
entangleSignal(signals, receiver, field.name);
|
|
710
710
|
return computeArray(store, schema, cache, target, identifier, field, propArray, false, Mode[Editable], Mode[Legacy]);
|
|
711
711
|
case 'object':
|
|
712
|
-
macroCondition(getGlobalConfig().
|
|
712
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
713
713
|
if (!test) {
|
|
714
714
|
throw new Error(`SchemaRecord.${field.name} is not available in legacy mode because it has type '${field.kind}'`);
|
|
715
715
|
}
|
|
@@ -717,7 +717,7 @@ class SchemaRecord {
|
|
|
717
717
|
entangleSignal(signals, receiver, field.name);
|
|
718
718
|
return computeObject(schema, cache, target, identifier, field, propArray, Mode[Editable], Mode[Legacy]);
|
|
719
719
|
case 'schema-object':
|
|
720
|
-
macroCondition(getGlobalConfig().
|
|
720
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
721
721
|
if (!test) {
|
|
722
722
|
throw new Error(`SchemaRecord.${field.name} is not available in legacy mode because it has type '${field.kind}'`);
|
|
723
723
|
}
|
|
@@ -727,18 +727,18 @@ class SchemaRecord {
|
|
|
727
727
|
return computeSchemaObject(store, cache, target, identifier, field, propArray, Mode[Legacy], Mode[Editable]);
|
|
728
728
|
case 'belongsTo':
|
|
729
729
|
if (!HAS_MODEL_PACKAGE) {
|
|
730
|
-
macroCondition(getGlobalConfig().
|
|
730
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
731
731
|
{
|
|
732
732
|
throw new Error(`Cannot use belongsTo fields in your schema unless @ember-data-mirror/model is installed to provide legacy model support. ${field.name} should likely be migrated to be a resource field.`);
|
|
733
733
|
}
|
|
734
734
|
})() : {};
|
|
735
735
|
}
|
|
736
|
-
macroCondition(getGlobalConfig().
|
|
736
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
737
737
|
if (!test) {
|
|
738
738
|
throw new Error(`Expected to have a getLegacySupport function`);
|
|
739
739
|
}
|
|
740
740
|
})(getLegacySupport) : {};
|
|
741
|
-
macroCondition(getGlobalConfig().
|
|
741
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
742
742
|
if (!test) {
|
|
743
743
|
throw new Error(`Can only use belongsTo fields when the resource is in legacy mode`);
|
|
744
744
|
}
|
|
@@ -747,18 +747,18 @@ class SchemaRecord {
|
|
|
747
747
|
return getLegacySupport(receiver).getBelongsTo(field.name);
|
|
748
748
|
case 'hasMany':
|
|
749
749
|
if (!HAS_MODEL_PACKAGE) {
|
|
750
|
-
macroCondition(getGlobalConfig().
|
|
750
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
751
751
|
{
|
|
752
752
|
throw new Error(`Cannot use hasMany fields in your schema unless @ember-data-mirror/model is installed to provide legacy model support. ${field.name} should likely be migrated to be a collection field.`);
|
|
753
753
|
}
|
|
754
754
|
})() : {};
|
|
755
755
|
}
|
|
756
|
-
macroCondition(getGlobalConfig().
|
|
756
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
757
757
|
if (!test) {
|
|
758
758
|
throw new Error(`Expected to have a getLegacySupport function`);
|
|
759
759
|
}
|
|
760
760
|
})(getLegacySupport) : {};
|
|
761
|
-
macroCondition(getGlobalConfig().
|
|
761
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
762
762
|
if (!test) {
|
|
763
763
|
throw new Error(`Can only use hasMany fields when the resource is in legacy mode`);
|
|
764
764
|
}
|
|
@@ -780,7 +780,7 @@ class SchemaRecord {
|
|
|
780
780
|
throw new Error(`There is no field named ${String(prop)} on ${type}`);
|
|
781
781
|
}
|
|
782
782
|
const field = maybeField.kind === 'alias' ? maybeField.options : maybeField;
|
|
783
|
-
macroCondition(getGlobalConfig().
|
|
783
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
784
784
|
if (!test) {
|
|
785
785
|
throw new Error(`Alias fields cannot alias '@id' '@local' '@hash' or 'derived' fields`);
|
|
786
786
|
}
|
|
@@ -794,14 +794,14 @@ class SchemaRecord {
|
|
|
794
794
|
switch (field.kind) {
|
|
795
795
|
case '@id':
|
|
796
796
|
{
|
|
797
|
-
macroCondition(getGlobalConfig().
|
|
797
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
798
798
|
if (!test) {
|
|
799
799
|
throw new Error(`Expected to receive a string id`);
|
|
800
800
|
}
|
|
801
801
|
})(typeof value === 'string' && value.length) : {};
|
|
802
802
|
const normalizedId = String(value);
|
|
803
803
|
const didChange = normalizedId !== identifier.id;
|
|
804
|
-
macroCondition(getGlobalConfig().
|
|
804
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
805
805
|
if (!test) {
|
|
806
806
|
throw new Error(`Cannot set ${identifier.type} record's id to ${normalizedId}, because id is already ${identifier.id}`);
|
|
807
807
|
}
|
|
@@ -913,7 +913,7 @@ class SchemaRecord {
|
|
|
913
913
|
{
|
|
914
914
|
let newValue = value;
|
|
915
915
|
if (value !== null) {
|
|
916
|
-
macroCondition(getGlobalConfig().
|
|
916
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
917
917
|
if (!test) {
|
|
918
918
|
throw new Error(`Expected value to be an object`);
|
|
919
919
|
}
|
|
@@ -946,18 +946,18 @@ class SchemaRecord {
|
|
|
946
946
|
}
|
|
947
947
|
case 'belongsTo':
|
|
948
948
|
if (!HAS_MODEL_PACKAGE) {
|
|
949
|
-
macroCondition(getGlobalConfig().
|
|
949
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
950
950
|
{
|
|
951
951
|
throw new Error(`Cannot use belongsTo fields in your schema unless @ember-data-mirror/model is installed to provide legacy model support. ${field.name} should likely be migrated to be a resource field.`);
|
|
952
952
|
}
|
|
953
953
|
})() : {};
|
|
954
954
|
}
|
|
955
|
-
macroCondition(getGlobalConfig().
|
|
955
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
956
956
|
if (!test) {
|
|
957
957
|
throw new Error(`Expected to have a getLegacySupport function`);
|
|
958
958
|
}
|
|
959
959
|
})(getLegacySupport) : {};
|
|
960
|
-
macroCondition(getGlobalConfig().
|
|
960
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
961
961
|
if (!test) {
|
|
962
962
|
throw new Error(`Can only use belongsTo fields when the resource is in legacy mode`);
|
|
963
963
|
}
|
|
@@ -968,23 +968,23 @@ class SchemaRecord {
|
|
|
968
968
|
return true;
|
|
969
969
|
case 'hasMany':
|
|
970
970
|
if (!HAS_MODEL_PACKAGE) {
|
|
971
|
-
macroCondition(getGlobalConfig().
|
|
971
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
972
972
|
{
|
|
973
973
|
throw new Error(`Cannot use hasMany fields in your schema unless @ember-data-mirror/model is installed to provide legacy model support. ${field.name} should likely be migrated to be a collection field.`);
|
|
974
974
|
}
|
|
975
975
|
})() : {};
|
|
976
976
|
}
|
|
977
|
-
macroCondition(getGlobalConfig().
|
|
977
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
978
978
|
if (!test) {
|
|
979
979
|
throw new Error(`Expected to have a getLegacySupport function`);
|
|
980
980
|
}
|
|
981
981
|
})(getLegacySupport) : {};
|
|
982
|
-
macroCondition(getGlobalConfig().
|
|
982
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
983
983
|
if (!test) {
|
|
984
984
|
throw new Error(`Can only use hasMany fields when the resource is in legacy mode`);
|
|
985
985
|
}
|
|
986
986
|
})(Mode[Legacy]) : {};
|
|
987
|
-
macroCondition(getGlobalConfig().
|
|
987
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
988
988
|
if (!test) {
|
|
989
989
|
throw new Error(`You must pass an array of records to set a hasMany relationship`);
|
|
990
990
|
}
|
|
@@ -1069,7 +1069,7 @@ class SchemaRecord {
|
|
|
1069
1069
|
if (isEmbedded) return; // base paths never apply to embedded records
|
|
1070
1070
|
|
|
1071
1071
|
const field = fields.get(key);
|
|
1072
|
-
macroCondition(getGlobalConfig().
|
|
1072
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1073
1073
|
if (!test) {
|
|
1074
1074
|
throw new Error(`Expected relationshp ${key} to be the name of a field`);
|
|
1075
1075
|
}
|
|
@@ -1083,12 +1083,12 @@ class SchemaRecord {
|
|
|
1083
1083
|
}
|
|
1084
1084
|
// FIXME
|
|
1085
1085
|
} else if (field.kind === 'resource') ;else if (field.kind === 'hasMany') {
|
|
1086
|
-
macroCondition(getGlobalConfig().
|
|
1086
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1087
1087
|
if (!test) {
|
|
1088
1088
|
throw new Error(`Expected to have a getLegacySupport function`);
|
|
1089
1089
|
}
|
|
1090
1090
|
})(getLegacySupport) : {};
|
|
1091
|
-
macroCondition(getGlobalConfig().
|
|
1091
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1092
1092
|
if (!test) {
|
|
1093
1093
|
throw new Error(`Can only use hasMany fields when the resource is in legacy mode`);
|
|
1094
1094
|
}
|
|
@@ -1103,12 +1103,12 @@ class SchemaRecord {
|
|
|
1103
1103
|
}
|
|
1104
1104
|
if (manyArray) {
|
|
1105
1105
|
manyArray.notify();
|
|
1106
|
-
macroCondition(getGlobalConfig().
|
|
1106
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1107
1107
|
if (!test) {
|
|
1108
1108
|
throw new Error(`Expected options to exist on relationship meta`);
|
|
1109
1109
|
}
|
|
1110
1110
|
})(field.options) : {};
|
|
1111
|
-
macroCondition(getGlobalConfig().
|
|
1111
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1112
1112
|
if (!test) {
|
|
1113
1113
|
throw new Error(`Expected async to exist on relationship meta options`);
|
|
1114
1114
|
}
|
package/dist/schema.js
CHANGED
|
@@ -43,12 +43,12 @@ function withDefaults(schema) {
|
|
|
43
43
|
}
|
|
44
44
|
function fromIdentity(record, options, key) {
|
|
45
45
|
const identifier = record[Identifier];
|
|
46
|
-
macroCondition(getGlobalConfig().
|
|
46
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
47
47
|
if (!test) {
|
|
48
48
|
throw new Error(`Cannot compute @identity for a record without an identifier`);
|
|
49
49
|
}
|
|
50
50
|
})(identifier) : {};
|
|
51
|
-
macroCondition(getGlobalConfig().
|
|
51
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
52
52
|
if (!test) {
|
|
53
53
|
throw new Error(`Expected to receive a key to compute @identity, but got ${String(options)}`);
|
|
54
54
|
}
|
|
@@ -101,17 +101,17 @@ class SchemaService {
|
|
|
101
101
|
transformation(field) {
|
|
102
102
|
const kind = 'kind' in field ? field.kind : '<unknown kind>';
|
|
103
103
|
const name = 'name' in field ? field.name : '<unknown name>';
|
|
104
|
-
macroCondition(getGlobalConfig().
|
|
104
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
105
105
|
if (!test) {
|
|
106
106
|
throw new Error(`'${kind}' fields cannot be transformed. Only fields of kind 'field' 'object' or 'array' can specify a transformation. Attempted to find '${field.type ?? '<unknown type>'}' on field '${name}'.`);
|
|
107
107
|
}
|
|
108
108
|
})(!('kind' in field) || ['field', 'object', 'array'].includes(kind)) : {};
|
|
109
|
-
macroCondition(getGlobalConfig().
|
|
109
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
110
110
|
if (!test) {
|
|
111
111
|
throw new Error(`Expected the '${kind}' field '${name}' to specify a transformation via 'field.type', but none was present`);
|
|
112
112
|
}
|
|
113
113
|
})(field.type) : {};
|
|
114
|
-
macroCondition(getGlobalConfig().
|
|
114
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
115
115
|
if (!test) {
|
|
116
116
|
throw new Error(`No transformation registered with name '${field.type}' for '${kind}' field '${name}'`);
|
|
117
117
|
}
|
|
@@ -121,17 +121,17 @@ class SchemaService {
|
|
|
121
121
|
derivation(field) {
|
|
122
122
|
const kind = 'kind' in field ? field.kind : '<unknown kind>';
|
|
123
123
|
const name = 'name' in field ? field.name : '<unknown name>';
|
|
124
|
-
macroCondition(getGlobalConfig().
|
|
124
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
125
125
|
if (!test) {
|
|
126
126
|
throw new Error(`The '${kind}' field '${name}' is not derived and so cannot be used to lookup a derivation`);
|
|
127
127
|
}
|
|
128
128
|
})(!('kind' in field) || kind === 'derived') : {};
|
|
129
|
-
macroCondition(getGlobalConfig().
|
|
129
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
130
130
|
if (!test) {
|
|
131
131
|
throw new Error(`Expected the '${kind}' field '${name}' to specify a derivation via 'field.type', but no value was present`);
|
|
132
132
|
}
|
|
133
133
|
})(field.type) : {};
|
|
134
|
-
macroCondition(getGlobalConfig().
|
|
134
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
135
135
|
if (!test) {
|
|
136
136
|
throw new Error(`No '${field.type}' derivation registered for use by the '${kind}' field '${name}'`);
|
|
137
137
|
}
|
|
@@ -141,17 +141,17 @@ class SchemaService {
|
|
|
141
141
|
hashFn(field) {
|
|
142
142
|
const kind = 'kind' in field ? field.kind : '<unknown kind>';
|
|
143
143
|
const name = 'name' in field ? field.name : '<unknown name>';
|
|
144
|
-
macroCondition(getGlobalConfig().
|
|
144
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
145
145
|
if (!test) {
|
|
146
146
|
throw new Error(`The '${kind}' field '${name}' is not a HashField and so cannot be used to lookup a hash function`);
|
|
147
147
|
}
|
|
148
148
|
})(!('kind' in field) || kind === '@hash') : {};
|
|
149
|
-
macroCondition(getGlobalConfig().
|
|
149
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
150
150
|
if (!test) {
|
|
151
151
|
throw new Error(`Expected the '${kind}' field '${name}' to specify a hash function via 'field.type', but no value was present`);
|
|
152
152
|
}
|
|
153
153
|
})(field.type) : {};
|
|
154
|
-
macroCondition(getGlobalConfig().
|
|
154
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
155
155
|
if (!test) {
|
|
156
156
|
throw new Error(`No '${field.type}' hash function is registered for use by the '${kind}' field '${name}'`);
|
|
157
157
|
}
|
|
@@ -159,7 +159,7 @@ class SchemaService {
|
|
|
159
159
|
return this._hashFns.get(field.type);
|
|
160
160
|
}
|
|
161
161
|
resource(resource) {
|
|
162
|
-
macroCondition(getGlobalConfig().
|
|
162
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
163
163
|
if (!test) {
|
|
164
164
|
throw new Error(`No resource registered with name '${resource.type}'`);
|
|
165
165
|
}
|
|
@@ -176,7 +176,7 @@ class SchemaService {
|
|
|
176
176
|
const relationships = {};
|
|
177
177
|
const attributes = {};
|
|
178
178
|
schema.fields.forEach(field => {
|
|
179
|
-
macroCondition(getGlobalConfig().
|
|
179
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
180
180
|
if (!test) {
|
|
181
181
|
throw new Error(`${field.kind} is not valid inside a ResourceSchema's fields.`);
|
|
182
182
|
}
|
|
@@ -225,7 +225,7 @@ class SchemaService {
|
|
|
225
225
|
return this._schemas.has(resource.type);
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
if (macroCondition(getGlobalConfig().
|
|
228
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_SCHEMA_SERVICE)) {
|
|
229
229
|
SchemaService.prototype.attributesDefinitionFor = function ({
|
|
230
230
|
type
|
|
231
231
|
}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive-mirror/schema-record",
|
|
3
|
-
"version": "5.4.0-alpha.
|
|
3
|
+
"version": "5.4.0-alpha.130",
|
|
4
4
|
"description": "Schema Driven Resource Presentation for WarpDrive and EmberData",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"ember-source": "3.28.12 || ^4.0.4 || ^5.0.0 || ^6.0.0",
|
|
36
|
-
"@ember-data-mirror/request": "5.4.0-alpha.
|
|
37
|
-
"@ember-data-mirror/model": "5.4.0-alpha.
|
|
38
|
-
"@ember-data-mirror/store": "5.4.0-alpha.
|
|
39
|
-
"@ember-data-mirror/tracking": "5.4.0-alpha.
|
|
40
|
-
"@warp-drive-mirror/core-types": "5.4.0-alpha.
|
|
36
|
+
"@ember-data-mirror/request": "5.4.0-alpha.130",
|
|
37
|
+
"@ember-data-mirror/model": "5.4.0-alpha.130",
|
|
38
|
+
"@ember-data-mirror/store": "5.4.0-alpha.130",
|
|
39
|
+
"@ember-data-mirror/tracking": "5.4.0-alpha.130",
|
|
40
|
+
"@warp-drive-mirror/core-types": "5.4.0-alpha.130"
|
|
41
41
|
},
|
|
42
42
|
"peerDependenciesMeta": {
|
|
43
43
|
"@ember-data-mirror/model": {
|
|
@@ -72,23 +72,23 @@
|
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@embroider/macros": "^1.16.6",
|
|
75
|
-
"@warp-drive-mirror/build-config": "5.4.0-alpha.
|
|
75
|
+
"@warp-drive-mirror/build-config": "5.4.0-alpha.130"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@babel/core": "^7.24.5",
|
|
79
79
|
"@babel/plugin-transform-typescript": "^7.24.5",
|
|
80
80
|
"@babel/preset-env": "^7.24.5",
|
|
81
81
|
"@babel/preset-typescript": "^7.24.1",
|
|
82
|
-
"@ember-data-mirror/request": "5.4.0-alpha.
|
|
83
|
-
"@ember-data-mirror/model": "5.4.0-alpha.
|
|
84
|
-
"@ember-data-mirror/store": "5.4.0-alpha.
|
|
85
|
-
"@ember-data-mirror/legacy-compat": "5.4.0-alpha.
|
|
86
|
-
"@ember-data-mirror/tracking": "5.4.0-alpha.
|
|
87
|
-
"@ember-data-mirror/request-utils": "5.4.0-alpha.
|
|
82
|
+
"@ember-data-mirror/request": "5.4.0-alpha.130",
|
|
83
|
+
"@ember-data-mirror/model": "5.4.0-alpha.130",
|
|
84
|
+
"@ember-data-mirror/store": "5.4.0-alpha.130",
|
|
85
|
+
"@ember-data-mirror/legacy-compat": "5.4.0-alpha.130",
|
|
86
|
+
"@ember-data-mirror/tracking": "5.4.0-alpha.130",
|
|
87
|
+
"@ember-data-mirror/request-utils": "5.4.0-alpha.130",
|
|
88
88
|
"@ember/test-waiters": "^3.1.0",
|
|
89
89
|
"@glimmer/component": "^1.1.2",
|
|
90
|
-
"@warp-drive-mirror/core-types": "5.4.0-alpha.
|
|
91
|
-
"@warp-drive/internal-config": "5.4.0-alpha.
|
|
90
|
+
"@warp-drive-mirror/core-types": "5.4.0-alpha.130",
|
|
91
|
+
"@warp-drive/internal-config": "5.4.0-alpha.130",
|
|
92
92
|
"ember-source": "~5.12.0",
|
|
93
93
|
"pnpm-sync-dependencies-meta-injected": "0.0.14",
|
|
94
94
|
"typescript": "^5.7.2",
|