@typemf/core 0.5.0 → 0.6.0

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/index.cjs CHANGED
@@ -47,7 +47,6 @@ __export(index_exports, {
47
47
  EcoreFactoryImpl: () => EcoreFactoryImpl,
48
48
  EcorePackageImpl: () => EcorePackageImpl,
49
49
  Ids: () => Ids,
50
- ProxyEObjectImpl: () => ProxyEObjectImpl,
51
50
  ResourceFactoryRegistryImpl: () => ResourceFactoryRegistryImpl,
52
51
  ResourceImpl: () => ResourceImpl,
53
52
  ResourceSetImpl: () => ResourceSetImpl,
@@ -56,8 +55,10 @@ __export(index_exports, {
56
55
  associateRoot: () => associateRoot,
57
56
  computeFragment: () => computeFragment,
58
57
  createInstanceOf: () => createInstanceOf,
58
+ createProxy: () => createProxy,
59
59
  detailValue: () => detailValue,
60
60
  dissociateRoot: () => dissociateRoot,
61
+ getProxyURI: () => getProxyURI,
61
62
  getResourceOf: () => getResourceOf,
62
63
  isEAnnotation: () => isEAnnotation,
63
64
  isEAttribute: () => isEAttribute,
@@ -232,6 +233,7 @@ var fallbackIdCounter = 0;
232
233
  var EObjectImpl = class _EObjectImpl {
233
234
  _eContainer;
234
235
  _eContainingFeature;
236
+ _eProxy = false;
235
237
  frozen = false;
236
238
  /**
237
239
  * Marks this object (and, recursively, everything it contains) as no longer intended to be
@@ -463,7 +465,17 @@ var EObjectImpl = class _EObjectImpl {
463
465
  return result;
464
466
  }
465
467
  eIsProxy() {
466
- return false;
468
+ return this._eProxy;
469
+ }
470
+ /**
471
+ * Internal - flips the proxy flag. Not part of the public EObject interface, same as
472
+ * eBasicSetContainer/eBasicSetValue; only `resource/proxy.ts`'s createProxy() calls this, right
473
+ * after constructing a real instance of the target EClass through its own factory - a proxy is
474
+ * not a separate class, just an ordinary, freshly-constructed instance flagged as a stand-in
475
+ * until something resolves it.
476
+ */
477
+ eSetProxy(flag) {
478
+ this._eProxy = flag;
467
479
  }
468
480
  fullId() {
469
481
  const className = this.eClass().getName();
@@ -525,7 +537,7 @@ var EStringToStringMapEntryImpl = class extends EObjectImpl {
525
537
  case 1:
526
538
  return this._value;
527
539
  default:
528
- throw new Error(`EStringToStringMapEntry has no feature with id ${feature.getFeatureID()}`);
540
+ throw new Error(`EStringToStringMapEntry has no feature with id ${String(feature.getFeatureID())}`);
529
541
  }
530
542
  }
531
543
  eSet(feature, value) {
@@ -567,7 +579,7 @@ var EStringToStringMapEntryImpl = class extends EObjectImpl {
567
579
  return;
568
580
  }
569
581
  default:
570
- throw new Error(`EStringToStringMapEntry has no feature with id ${feature.getFeatureID()}`);
582
+ throw new Error(`EStringToStringMapEntry has no feature with id ${String(feature.getFeatureID())}`);
571
583
  }
572
584
  }
573
585
  eBasicSetValue(feature, value) {
@@ -580,14 +592,13 @@ var EStringToStringMapEntryImpl = class extends EObjectImpl {
580
592
  this._value = value;
581
593
  return;
582
594
  default:
583
- void value;
584
- throw new Error(`Feature ${featureId} on EStringToStringMapEntry is many-valued or unknown.`);
595
+ throw new Error(`Feature ${String(featureId)} on EStringToStringMapEntry is many-valued or unknown.`);
585
596
  }
586
597
  }
587
598
  eBootstrapList(featureId) {
588
599
  switch (featureId) {
589
600
  default:
590
- throw new Error(`Feature ${featureId} on EStringToStringMapEntry is single-valued or unknown.`);
601
+ throw new Error(`Feature ${String(featureId)} on EStringToStringMapEntry is single-valued or unknown.`);
591
602
  }
592
603
  }
593
604
  eIsSet(feature) {
@@ -597,7 +608,7 @@ var EStringToStringMapEntryImpl = class extends EObjectImpl {
597
608
  case 1:
598
609
  return this._value !== void 0;
599
610
  default:
600
- throw new Error(`EStringToStringMapEntry has no feature with id ${feature.getFeatureID()}`);
611
+ throw new Error(`EStringToStringMapEntry has no feature with id ${String(feature.getFeatureID())}`);
601
612
  }
602
613
  }
603
614
  eUnset(feature) {
@@ -635,7 +646,7 @@ var EStringToStringMapEntryImpl = class extends EObjectImpl {
635
646
  return;
636
647
  }
637
648
  default:
638
- throw new Error(`EStringToStringMapEntry has no feature with id ${feature.getFeatureID()}`);
649
+ throw new Error(`EStringToStringMapEntry has no feature with id ${String(feature.getFeatureID())}`);
639
650
  }
640
651
  }
641
652
  };
@@ -751,9 +762,7 @@ var DynamicEObjectImpl = class extends EObjectImpl {
751
762
  var EModelElementImpl = class extends EObjectImpl {
752
763
  _eAnnotationsCache;
753
764
  get _eAnnotations() {
754
- if (!this._eAnnotationsCache) {
755
- this._eAnnotationsCache = new BasicEList(this, getEcorePackageRef().getEModelElement_EAnnotations());
756
- }
765
+ this._eAnnotationsCache ??= new BasicEList(this, getEcorePackageRef().getEModelElement_EAnnotations());
757
766
  return this._eAnnotationsCache;
758
767
  }
759
768
  eClass() {
@@ -770,7 +779,7 @@ var EModelElementImpl = class extends EObjectImpl {
770
779
  case 0:
771
780
  return this._eAnnotations;
772
781
  default:
773
- throw new Error(`EModelElement has no feature with id ${feature.getFeatureID()}`);
782
+ throw new Error(`EModelElement has no feature with id ${String(feature.getFeatureID())}`);
774
783
  }
775
784
  }
776
785
  eSet(feature, value) {
@@ -783,24 +792,23 @@ var EModelElementImpl = class extends EObjectImpl {
783
792
  return;
784
793
  }
785
794
  default:
786
- throw new Error(`EModelElement has no feature with id ${feature.getFeatureID()}`);
795
+ throw new Error(`EModelElement has no feature with id ${String(feature.getFeatureID())}`);
787
796
  }
788
797
  }
789
- eBasicSetValue(feature, value) {
798
+ eBasicSetValue(feature, _value) {
790
799
  const featureId = typeof feature === "number" ? feature : feature.getFeatureID();
791
800
  switch (featureId) {
792
801
  default:
793
- void value;
794
- throw new Error(`Feature ${featureId} on EModelElement is many-valued or unknown.`);
802
+ throw new Error(`Feature ${String(featureId)} on EModelElement is many-valued or unknown.`);
795
803
  }
796
804
  }
797
805
  eBootstrapList(featureId) {
798
806
  switch (featureId) {
799
807
  case 0:
800
- if (!this._eAnnotationsCache) this._eAnnotationsCache = new BasicEList(this);
808
+ this._eAnnotationsCache ??= new BasicEList(this);
801
809
  return this._eAnnotationsCache;
802
810
  default:
803
- throw new Error(`Feature ${featureId} on EModelElement is single-valued or unknown.`);
811
+ throw new Error(`Feature ${String(featureId)} on EModelElement is single-valued or unknown.`);
804
812
  }
805
813
  }
806
814
  eIsSet(feature) {
@@ -808,7 +816,7 @@ var EModelElementImpl = class extends EObjectImpl {
808
816
  case 0:
809
817
  return this._eAnnotationsCache !== void 0 && this._eAnnotationsCache.size() !== 0;
810
818
  default:
811
- throw new Error(`EModelElement has no feature with id ${feature.getFeatureID()}`);
819
+ throw new Error(`EModelElement has no feature with id ${String(feature.getFeatureID())}`);
812
820
  }
813
821
  }
814
822
  eUnset(feature) {
@@ -817,7 +825,7 @@ var EModelElementImpl = class extends EObjectImpl {
817
825
  this._eAnnotationsCache?.clear();
818
826
  return;
819
827
  default:
820
- throw new Error(`EModelElement has no feature with id ${feature.getFeatureID()}`);
828
+ throw new Error(`EModelElement has no feature with id ${String(feature.getFeatureID())}`);
821
829
  }
822
830
  }
823
831
  };
@@ -984,24 +992,18 @@ var EAnnotationImpl = class extends EModelElementImpl {
984
992
  _source;
985
993
  _detailsCache;
986
994
  get _details() {
987
- if (!this._detailsCache) {
988
- this._detailsCache = new BasicEList(this, getEcorePackageRef().getEAnnotation_Details());
989
- }
995
+ this._detailsCache ??= new BasicEList(this, getEcorePackageRef().getEAnnotation_Details());
990
996
  return this._detailsCache;
991
997
  }
992
998
  _eModelElement;
993
999
  _contentsCache;
994
1000
  get _contents() {
995
- if (!this._contentsCache) {
996
- this._contentsCache = new BasicEList(this, getEcorePackageRef().getEAnnotation_Contents());
997
- }
1001
+ this._contentsCache ??= new BasicEList(this, getEcorePackageRef().getEAnnotation_Contents());
998
1002
  return this._contentsCache;
999
1003
  }
1000
1004
  _referencesCache;
1001
1005
  get _references() {
1002
- if (!this._referencesCache) {
1003
- this._referencesCache = new BasicEList(this, getEcorePackageRef().getEAnnotation_References());
1004
- }
1006
+ this._referencesCache ??= new BasicEList(this, getEcorePackageRef().getEAnnotation_References());
1005
1007
  return this._referencesCache;
1006
1008
  }
1007
1009
  eClass() {
@@ -1125,13 +1127,13 @@ var EAnnotationImpl = class extends EModelElementImpl {
1125
1127
  eBootstrapList(featureId) {
1126
1128
  switch (featureId) {
1127
1129
  case 2:
1128
- if (!this._detailsCache) this._detailsCache = new BasicEList(this);
1130
+ this._detailsCache ??= new BasicEList(this);
1129
1131
  return this._detailsCache;
1130
1132
  case 4:
1131
- if (!this._contentsCache) this._contentsCache = new BasicEList(this);
1133
+ this._contentsCache ??= new BasicEList(this);
1132
1134
  return this._contentsCache;
1133
1135
  case 5:
1134
- if (!this._referencesCache) this._referencesCache = new BasicEList(this);
1136
+ this._referencesCache ??= new BasicEList(this);
1135
1137
  return this._referencesCache;
1136
1138
  default:
1137
1139
  return super.eBootstrapList(featureId);
@@ -2224,12 +2226,10 @@ var EClassifierImpl = class extends ENamedElementImpl {
2224
2226
  _ePackage;
2225
2227
  _eTypeParametersCache;
2226
2228
  get _eTypeParameters() {
2227
- if (!this._eTypeParametersCache) {
2228
- this._eTypeParametersCache = new BasicEList(
2229
- this,
2230
- getEcorePackageRef().getEClassifier_ETypeParameters()
2231
- );
2232
- }
2229
+ this._eTypeParametersCache ??= new BasicEList(
2230
+ this,
2231
+ getEcorePackageRef().getEClassifier_ETypeParameters()
2232
+ );
2233
2233
  return this._eTypeParametersCache;
2234
2234
  }
2235
2235
  classifierId = -1;
@@ -2372,7 +2372,7 @@ var EClassifierImpl = class extends ENamedElementImpl {
2372
2372
  eBootstrapList(featureId) {
2373
2373
  switch (featureId) {
2374
2374
  case 7:
2375
- if (!this._eTypeParametersCache) this._eTypeParametersCache = new BasicEList(this);
2375
+ this._eTypeParametersCache ??= new BasicEList(this);
2376
2376
  return this._eTypeParametersCache;
2377
2377
  default:
2378
2378
  return super.eBootstrapList(featureId);
@@ -2555,12 +2555,10 @@ var EGenericTypeImpl = class extends EObjectImpl {
2555
2555
  _eUpperBound;
2556
2556
  _eTypeArgumentsCache;
2557
2557
  get _eTypeArguments() {
2558
- if (!this._eTypeArgumentsCache) {
2559
- this._eTypeArgumentsCache = new BasicEList(
2560
- this,
2561
- getEcorePackageRef().getEGenericType_ETypeArguments()
2562
- );
2563
- }
2558
+ this._eTypeArgumentsCache ??= new BasicEList(
2559
+ this,
2560
+ getEcorePackageRef().getEGenericType_ETypeArguments()
2561
+ );
2564
2562
  return this._eTypeArgumentsCache;
2565
2563
  }
2566
2564
  _eRawTypeCache;
@@ -2630,7 +2628,7 @@ var EGenericTypeImpl = class extends EObjectImpl {
2630
2628
  case 5:
2631
2629
  return this._eClassifier;
2632
2630
  default:
2633
- throw new Error(`EGenericType has no feature with id ${feature.getFeatureID()}`);
2631
+ throw new Error(`EGenericType has no feature with id ${String(feature.getFeatureID())}`);
2634
2632
  }
2635
2633
  }
2636
2634
  eSet(feature, value) {
@@ -2715,7 +2713,7 @@ var EGenericTypeImpl = class extends EObjectImpl {
2715
2713
  return;
2716
2714
  }
2717
2715
  default:
2718
- throw new Error(`EGenericType has no feature with id ${feature.getFeatureID()}`);
2716
+ throw new Error(`EGenericType has no feature with id ${String(feature.getFeatureID())}`);
2719
2717
  }
2720
2718
  }
2721
2719
  eBasicSetValue(feature, value) {
@@ -2734,17 +2732,16 @@ var EGenericTypeImpl = class extends EObjectImpl {
2734
2732
  this._eClassifier = value;
2735
2733
  return;
2736
2734
  default:
2737
- void value;
2738
- throw new Error(`Feature ${featureId} on EGenericType is many-valued or unknown.`);
2735
+ throw new Error(`Feature ${String(featureId)} on EGenericType is many-valued or unknown.`);
2739
2736
  }
2740
2737
  }
2741
2738
  eBootstrapList(featureId) {
2742
2739
  switch (featureId) {
2743
2740
  case 1:
2744
- if (!this._eTypeArgumentsCache) this._eTypeArgumentsCache = new BasicEList(this);
2741
+ this._eTypeArgumentsCache ??= new BasicEList(this);
2745
2742
  return this._eTypeArgumentsCache;
2746
2743
  default:
2747
- throw new Error(`Feature ${featureId} on EGenericType is single-valued or unknown.`);
2744
+ throw new Error(`Feature ${String(featureId)} on EGenericType is single-valued or unknown.`);
2748
2745
  }
2749
2746
  }
2750
2747
  eIsSet(feature) {
@@ -2762,7 +2759,7 @@ var EGenericTypeImpl = class extends EObjectImpl {
2762
2759
  case 5:
2763
2760
  return this._eClassifier !== void 0;
2764
2761
  default:
2765
- throw new Error(`EGenericType has no feature with id ${feature.getFeatureID()}`);
2762
+ throw new Error(`EGenericType has no feature with id ${String(feature.getFeatureID())}`);
2766
2763
  }
2767
2764
  }
2768
2765
  eUnset(feature) {
@@ -2835,7 +2832,7 @@ var EGenericTypeImpl = class extends EObjectImpl {
2835
2832
  return;
2836
2833
  }
2837
2834
  default:
2838
- throw new Error(`EGenericType has no feature with id ${feature.getFeatureID()}`);
2835
+ throw new Error(`EGenericType has no feature with id ${String(feature.getFeatureID())}`);
2839
2836
  }
2840
2837
  }
2841
2838
  };
@@ -2846,16 +2843,12 @@ var EClassImpl = class extends EClassifierImpl {
2846
2843
  _interface = false;
2847
2844
  _eSuperTypesCache;
2848
2845
  get _eSuperTypes() {
2849
- if (!this._eSuperTypesCache) {
2850
- this._eSuperTypesCache = new BasicEList(this, getEcorePackageRef().getEClass_ESuperTypes());
2851
- }
2846
+ this._eSuperTypesCache ??= new BasicEList(this, getEcorePackageRef().getEClass_ESuperTypes());
2852
2847
  return this._eSuperTypesCache;
2853
2848
  }
2854
2849
  _eOperationsCache;
2855
2850
  get _eOperations() {
2856
- if (!this._eOperationsCache) {
2857
- this._eOperationsCache = new BasicEList(this, getEcorePackageRef().getEClass_EOperations());
2858
- }
2851
+ this._eOperationsCache ??= new BasicEList(this, getEcorePackageRef().getEClass_EOperations());
2859
2852
  return this._eOperationsCache;
2860
2853
  }
2861
2854
  _eAllAttributesCache;
@@ -2878,22 +2871,18 @@ var EClassImpl = class extends EClassifierImpl {
2878
2871
  _eIDAttributeCacheGeneration = -1;
2879
2872
  _eStructuralFeaturesCache;
2880
2873
  get _eStructuralFeatures() {
2881
- if (!this._eStructuralFeaturesCache) {
2882
- this._eStructuralFeaturesCache = new BasicEList(
2883
- this,
2884
- getEcorePackageRef().getEClass_EStructuralFeatures()
2885
- );
2886
- }
2874
+ this._eStructuralFeaturesCache ??= new BasicEList(
2875
+ this,
2876
+ getEcorePackageRef().getEClass_EStructuralFeatures()
2877
+ );
2887
2878
  return this._eStructuralFeaturesCache;
2888
2879
  }
2889
2880
  _eGenericSuperTypesCache;
2890
2881
  get _eGenericSuperTypes() {
2891
- if (!this._eGenericSuperTypesCache) {
2892
- this._eGenericSuperTypesCache = new BasicEList(
2893
- this,
2894
- getEcorePackageRef().getEClass_EGenericSuperTypes()
2895
- );
2896
- }
2882
+ this._eGenericSuperTypesCache ??= new BasicEList(
2883
+ this,
2884
+ getEcorePackageRef().getEClass_EGenericSuperTypes()
2885
+ );
2897
2886
  return this._eGenericSuperTypesCache;
2898
2887
  }
2899
2888
  _eAllGenericSuperTypesCache;
@@ -3273,16 +3262,16 @@ var EClassImpl = class extends EClassifierImpl {
3273
3262
  eBootstrapList(featureId) {
3274
3263
  switch (featureId) {
3275
3264
  case 10:
3276
- if (!this._eSuperTypesCache) this._eSuperTypesCache = new BasicEList(this);
3265
+ this._eSuperTypesCache ??= new BasicEList(this);
3277
3266
  return this._eSuperTypesCache;
3278
3267
  case 11:
3279
- if (!this._eOperationsCache) this._eOperationsCache = new BasicEList(this);
3268
+ this._eOperationsCache ??= new BasicEList(this);
3280
3269
  return this._eOperationsCache;
3281
3270
  case 21:
3282
- if (!this._eStructuralFeaturesCache) this._eStructuralFeaturesCache = new BasicEList(this);
3271
+ this._eStructuralFeaturesCache ??= new BasicEList(this);
3283
3272
  return this._eStructuralFeaturesCache;
3284
3273
  case 22:
3285
- if (!this._eGenericSuperTypesCache) this._eGenericSuperTypesCache = new BasicEList(this);
3274
+ this._eGenericSuperTypesCache ??= new BasicEList(this);
3286
3275
  return this._eGenericSuperTypesCache;
3287
3276
  default:
3288
3277
  return super.eBootstrapList(featureId);
@@ -3478,9 +3467,7 @@ var EDataTypeImpl = class extends EClassifierImpl {
3478
3467
  var EEnumImpl = class extends EDataTypeImpl {
3479
3468
  _eLiteralsCache;
3480
3469
  get _eLiterals() {
3481
- if (!this._eLiteralsCache) {
3482
- this._eLiteralsCache = new BasicEList(this, getEcorePackageRef().getEEnum_ELiterals());
3483
- }
3470
+ this._eLiteralsCache ??= new BasicEList(this, getEcorePackageRef().getEEnum_ELiterals());
3484
3471
  return this._eLiteralsCache;
3485
3472
  }
3486
3473
  eClass() {
@@ -3536,7 +3523,7 @@ var EEnumImpl = class extends EDataTypeImpl {
3536
3523
  eBootstrapList(featureId) {
3537
3524
  switch (featureId) {
3538
3525
  case 9:
3539
- if (!this._eLiteralsCache) this._eLiteralsCache = new BasicEList(this);
3526
+ this._eLiteralsCache ??= new BasicEList(this);
3540
3527
  return this._eLiteralsCache;
3541
3528
  default:
3542
3529
  return super.eBootstrapList(featureId);
@@ -3778,36 +3765,28 @@ var EOperationImpl = class extends ETypedElementImpl {
3778
3765
  _eContainingClass;
3779
3766
  _eTypeParametersCache;
3780
3767
  get _eTypeParameters() {
3781
- if (!this._eTypeParametersCache) {
3782
- this._eTypeParametersCache = new BasicEList(
3783
- this,
3784
- getEcorePackageRef().getEOperation_ETypeParameters()
3785
- );
3786
- }
3768
+ this._eTypeParametersCache ??= new BasicEList(
3769
+ this,
3770
+ getEcorePackageRef().getEOperation_ETypeParameters()
3771
+ );
3787
3772
  return this._eTypeParametersCache;
3788
3773
  }
3789
3774
  _eParametersCache;
3790
3775
  get _eParameters() {
3791
- if (!this._eParametersCache) {
3792
- this._eParametersCache = new BasicEList(this, getEcorePackageRef().getEOperation_EParameters());
3793
- }
3776
+ this._eParametersCache ??= new BasicEList(this, getEcorePackageRef().getEOperation_EParameters());
3794
3777
  return this._eParametersCache;
3795
3778
  }
3796
3779
  _eExceptionsCache;
3797
3780
  get _eExceptions() {
3798
- if (!this._eExceptionsCache) {
3799
- this._eExceptionsCache = new BasicEList(this, getEcorePackageRef().getEOperation_EExceptions());
3800
- }
3781
+ this._eExceptionsCache ??= new BasicEList(this, getEcorePackageRef().getEOperation_EExceptions());
3801
3782
  return this._eExceptionsCache;
3802
3783
  }
3803
3784
  _eGenericExceptionsCache;
3804
3785
  get _eGenericExceptions() {
3805
- if (!this._eGenericExceptionsCache) {
3806
- this._eGenericExceptionsCache = new BasicEList(
3807
- this,
3808
- getEcorePackageRef().getEOperation_EGenericExceptions()
3809
- );
3810
- }
3786
+ this._eGenericExceptionsCache ??= new BasicEList(
3787
+ this,
3788
+ getEcorePackageRef().getEOperation_EGenericExceptions()
3789
+ );
3811
3790
  return this._eGenericExceptionsCache;
3812
3791
  }
3813
3792
  operationId = -1;
@@ -3919,16 +3898,16 @@ var EOperationImpl = class extends ETypedElementImpl {
3919
3898
  eBootstrapList(featureId) {
3920
3899
  switch (featureId) {
3921
3900
  case 11:
3922
- if (!this._eTypeParametersCache) this._eTypeParametersCache = new BasicEList(this);
3901
+ this._eTypeParametersCache ??= new BasicEList(this);
3923
3902
  return this._eTypeParametersCache;
3924
3903
  case 12:
3925
- if (!this._eParametersCache) this._eParametersCache = new BasicEList(this);
3904
+ this._eParametersCache ??= new BasicEList(this);
3926
3905
  return this._eParametersCache;
3927
3906
  case 13:
3928
- if (!this._eExceptionsCache) this._eExceptionsCache = new BasicEList(this);
3907
+ this._eExceptionsCache ??= new BasicEList(this);
3929
3908
  return this._eExceptionsCache;
3930
3909
  case 14:
3931
- if (!this._eGenericExceptionsCache) this._eGenericExceptionsCache = new BasicEList(this);
3910
+ this._eGenericExceptionsCache ??= new BasicEList(this);
3932
3911
  return this._eGenericExceptionsCache;
3933
3912
  default:
3934
3913
  return super.eBootstrapList(featureId);
@@ -3994,16 +3973,12 @@ var EPackageImpl = class extends ENamedElementImpl {
3994
3973
  _eFactoryInstance;
3995
3974
  _eClassifiersCache;
3996
3975
  get _eClassifiers() {
3997
- if (!this._eClassifiersCache) {
3998
- this._eClassifiersCache = new BasicEList(this, getEcorePackageRef().getEPackage_EClassifiers());
3999
- }
3976
+ this._eClassifiersCache ??= new BasicEList(this, getEcorePackageRef().getEPackage_EClassifiers());
4000
3977
  return this._eClassifiersCache;
4001
3978
  }
4002
3979
  _eSubpackagesCache;
4003
3980
  get _eSubpackages() {
4004
- if (!this._eSubpackagesCache) {
4005
- this._eSubpackagesCache = new BasicEList(this, getEcorePackageRef().getEPackage_ESubpackages());
4006
- }
3981
+ this._eSubpackagesCache ??= new BasicEList(this, getEcorePackageRef().getEPackage_ESubpackages());
4007
3982
  return this._eSubpackagesCache;
4008
3983
  }
4009
3984
  _eSuperPackage;
@@ -4159,10 +4134,10 @@ var EPackageImpl = class extends ENamedElementImpl {
4159
4134
  eBootstrapList(featureId) {
4160
4135
  switch (featureId) {
4161
4136
  case 5:
4162
- if (!this._eClassifiersCache) this._eClassifiersCache = new BasicEList(this);
4137
+ this._eClassifiersCache ??= new BasicEList(this);
4163
4138
  return this._eClassifiersCache;
4164
4139
  case 6:
4165
- if (!this._eSubpackagesCache) this._eSubpackagesCache = new BasicEList(this);
4140
+ this._eSubpackagesCache ??= new BasicEList(this);
4166
4141
  return this._eSubpackagesCache;
4167
4142
  default:
4168
4143
  return super.eBootstrapList(featureId);
@@ -4351,9 +4326,7 @@ var EReferenceImpl = class extends EStructuralFeatureImpl {
4351
4326
  _eReferenceType;
4352
4327
  _eKeysCache;
4353
4328
  get _eKeys() {
4354
- if (!this._eKeysCache) {
4355
- this._eKeysCache = new BasicEList(this, getEcorePackageRef().getEReference_EKeys());
4356
- }
4329
+ this._eKeysCache ??= new BasicEList(this, getEcorePackageRef().getEReference_EKeys());
4357
4330
  return this._eKeysCache;
4358
4331
  }
4359
4332
  eClass() {
@@ -4498,7 +4471,7 @@ var EReferenceImpl = class extends EStructuralFeatureImpl {
4498
4471
  eBootstrapList(featureId) {
4499
4472
  switch (featureId) {
4500
4473
  case 23:
4501
- if (!this._eKeysCache) this._eKeysCache = new BasicEList(this);
4474
+ this._eKeysCache ??= new BasicEList(this);
4502
4475
  return this._eKeysCache;
4503
4476
  default:
4504
4477
  return super.eBootstrapList(featureId);
@@ -4618,9 +4591,7 @@ var EReferenceImpl = class extends EStructuralFeatureImpl {
4618
4591
  var ETypeParameterImpl = class extends ENamedElementImpl {
4619
4592
  _eBoundsCache;
4620
4593
  get _eBounds() {
4621
- if (!this._eBoundsCache) {
4622
- this._eBoundsCache = new BasicEList(this, getEcorePackageRef().getETypeParameter_EBounds());
4623
- }
4594
+ this._eBoundsCache ??= new BasicEList(this, getEcorePackageRef().getETypeParameter_EBounds());
4624
4595
  return this._eBoundsCache;
4625
4596
  }
4626
4597
  eClass() {
@@ -4662,7 +4633,7 @@ var ETypeParameterImpl = class extends ENamedElementImpl {
4662
4633
  eBootstrapList(featureId) {
4663
4634
  switch (featureId) {
4664
4635
  case 2:
4665
- if (!this._eBoundsCache) this._eBoundsCache = new BasicEList(this);
4636
+ this._eBoundsCache ??= new BasicEList(this);
4666
4637
  return this._eBoundsCache;
4667
4638
  default:
4668
4639
  return super.eBootstrapList(featureId);
@@ -4820,59 +4791,23 @@ function resolvePositionalPath(path, roots) {
4820
4791
  return current;
4821
4792
  }
4822
4793
 
4823
- // src/resource/proxy-eobject-impl.ts
4824
- var ProxyEObjectImpl = class extends EObjectImpl {
4825
- constructor(proxyEClass, proxyURI) {
4826
- super();
4827
- this.proxyEClass = proxyEClass;
4828
- this.proxyURI = proxyURI;
4829
- }
4830
- proxyEClass;
4831
- proxyURI;
4832
- eClass() {
4833
- return this.proxyEClass;
4834
- }
4835
- eIsProxy() {
4836
- return true;
4837
- }
4838
- getProxyURI() {
4839
- return this.proxyURI;
4840
- }
4841
- eContents() {
4842
- return new BasicEList();
4843
- }
4844
- eAllContents() {
4845
- return [];
4846
- }
4847
- fullId() {
4848
- return `Proxy(${this.proxyEClass.getName()}, ${this.proxyURI.toString()})`;
4849
- }
4850
- eGet(_feature) {
4851
- throw new Error(
4852
- `Cannot read a feature of an unresolved proxy (${this.fullId()}) - resolve it via ResourceSet.resolve() first.`
4853
- );
4854
- }
4855
- eSet(_feature, _value) {
4856
- throw new Error(
4857
- `Cannot set a feature of an unresolved proxy (${this.fullId()}) - resolve it via ResourceSet.resolve() first.`
4858
- );
4859
- }
4860
- eBasicSetValue(_feature, _value) {
4861
- throw new Error(
4862
- `Cannot set a feature of an unresolved proxy (${this.fullId()}) - resolve it via ResourceSet.resolve() first.`
4863
- );
4864
- }
4865
- eIsSet(_feature) {
4866
- throw new Error(
4867
- `Cannot check a feature of an unresolved proxy (${this.fullId()}) - resolve it via ResourceSet.resolve() first.`
4868
- );
4869
- }
4870
- eUnset(_feature) {
4871
- throw new Error(
4872
- `Cannot unset a feature of an unresolved proxy (${this.fullId()}) - resolve it via ResourceSet.resolve() first.`
4873
- );
4874
- }
4875
- };
4794
+ // src/resource/proxy.ts
4795
+ var proxyURIs = /* @__PURE__ */ new WeakMap();
4796
+ function createProxy(eClass, uri) {
4797
+ const factory = eClass.getEPackage()?.getEFactoryInstance();
4798
+ let obj;
4799
+ try {
4800
+ obj = factory ? factory.create(eClass) : new DynamicEObjectImpl(eClass);
4801
+ } catch {
4802
+ obj = new DynamicEObjectImpl(eClass);
4803
+ }
4804
+ obj.eSetProxy(true);
4805
+ proxyURIs.set(obj, uri);
4806
+ return obj;
4807
+ }
4808
+ function getProxyURI(obj) {
4809
+ return proxyURIs.get(obj);
4810
+ }
4876
4811
 
4877
4812
  // src/resource/resource-factory-registry-impl.ts
4878
4813
  var ResourceFactoryRegistryImpl = class {
@@ -5119,24 +5054,27 @@ var ResourceSetImpl = class {
5119
5054
  }
5120
5055
  async resolve(proxy) {
5121
5056
  if (!proxy.eIsProxy()) return proxy;
5122
- if (!(proxy instanceof ProxyEObjectImpl)) {
5123
- throw new Error("eIsProxy() is true but the object is not a ProxyEObjectImpl - cannot resolve it.");
5057
+ const proxyURI = getProxyURI(proxy);
5058
+ if (!proxyURI) {
5059
+ throw new Error(
5060
+ `eIsProxy() is true but no proxy URI is on record for this ${proxy.eClass().getName()} - it was not created via createProxy().`
5061
+ );
5124
5062
  }
5125
- const proxyURI = proxy.getProxyURI();
5063
+ const proxyLabel = `${proxy.eClass().getName()} (${proxyURI.toString()})`;
5126
5064
  const registeredPackage = this.packageRegistry.getPackage(proxyURI.trimFragment().toString());
5127
5065
  if (registeredPackage) {
5128
5066
  const fragment2 = proxyURI.getFragment();
5129
5067
  const resolved = fragment2 ? resolveAgainstPackage(registeredPackage, fragment2) : void 0;
5130
5068
  if (!resolved) {
5131
5069
  throw new Error(
5132
- `Could not resolve proxy '${proxy.fullId()}': fragment '${fragment2 ?? "<none>"}' did not match anything in the registered package '${registeredPackage.getNsURI() ?? "<no nsURI>"}'.`
5070
+ `Could not resolve proxy '${proxyLabel}': fragment '${fragment2 ?? "<none>"}' did not match anything in the registered package '${registeredPackage.getNsURI() ?? "<no nsURI>"}'.`
5133
5071
  );
5134
5072
  }
5135
5073
  return resolved;
5136
5074
  }
5137
5075
  const targetResource = await this.getResource(proxyURI.trimFragment(), true);
5138
5076
  if (!targetResource) {
5139
- throw new Error(`Could not resolve proxy '${proxy.fullId()}': its resource could not be loaded.`);
5077
+ throw new Error(`Could not resolve proxy '${proxyLabel}': its resource could not be loaded.`);
5140
5078
  }
5141
5079
  const fragment = proxyURI.getFragment();
5142
5080
  const roots = targetResource.getContents().toArray();
@@ -5145,12 +5083,33 @@ var ResourceSetImpl = class {
5145
5083
  const found = fragment ? resolver(fragment, roots) : void 0;
5146
5084
  if (!found) {
5147
5085
  throw new Error(
5148
- `Could not resolve proxy '${proxy.fullId()}': fragment '${fragment ?? "<none>"}' did not match any object in '${targetResource.getURI().toString()}'.`
5086
+ `Could not resolve proxy '${proxyLabel}': fragment '${fragment ?? "<none>"}' did not match any object in '${targetResource.getURI().toString()}'.`
5149
5087
  );
5150
5088
  }
5151
5089
  return found;
5152
5090
  }
5091
+ async resolveFeature(container, feature) {
5092
+ const current = container.eGet(feature);
5093
+ if (!isUnresolvedProxy(current)) return current;
5094
+ const resolved = await this.resolve(current);
5095
+ if (resolved !== current) {
5096
+ container.eBasicSetValue(feature, resolved);
5097
+ container.eNotify({
5098
+ eventType: "RESOLVE",
5099
+ notifier: container,
5100
+ feature,
5101
+ oldValue: current,
5102
+ newValue: resolved,
5103
+ position: void 0,
5104
+ wasSet: true
5105
+ });
5106
+ }
5107
+ return resolved;
5108
+ }
5153
5109
  };
5110
+ function isUnresolvedProxy(value) {
5111
+ return typeof value === "object" && value !== null && typeof value.eIsProxy === "function" && value.eIsProxy();
5112
+ }
5154
5113
  function resolveAgainstPackage(pkg, fragment) {
5155
5114
  const segments = fragment.replace(/^\/+/, "").split("/").filter((s) => s.length > 0);
5156
5115
  if (segments.length === 0) return void 0;
@@ -9999,7 +9958,6 @@ var EcorePackageImpl = class _EcorePackageImpl extends EPackageImpl {
9999
9958
  EcoreFactoryImpl,
10000
9959
  EcorePackageImpl,
10001
9960
  Ids,
10002
- ProxyEObjectImpl,
10003
9961
  ResourceFactoryRegistryImpl,
10004
9962
  ResourceImpl,
10005
9963
  ResourceSetImpl,
@@ -10008,8 +9966,10 @@ var EcorePackageImpl = class _EcorePackageImpl extends EPackageImpl {
10008
9966
  associateRoot,
10009
9967
  computeFragment,
10010
9968
  createInstanceOf,
9969
+ createProxy,
10011
9970
  detailValue,
10012
9971
  dissociateRoot,
9972
+ getProxyURI,
10013
9973
  getResourceOf,
10014
9974
  isEAnnotation,
10015
9975
  isEAttribute,