foobara-remote-imports 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7aa2f25ca1a975ff58d4452a45020aa69647a52d96e812c2e40011ca6e012ace
4
- data.tar.gz: 0bfe4dab9e3617efd383eaf429f81e4d0ad2ec3050f625cc77383d14cd423704
3
+ metadata.gz: 14960ddd884c70b7da1a13b4bdfca3d279e78a7adfcfac326ac48f1dd7b6d7a0
4
+ data.tar.gz: 9ba3375256447c5011fce6eb3bcbd503715fd35ef472cda52338f9e6c8fc09d5
5
5
  SHA512:
6
- metadata.gz: '08a3e58eb4973a9be709d7a785c91cd283bff3c13f5c928ad4397ace3908ad246046df584e2de7bc7ed308b20ee779eb5afe756fe9cafa3c1edd0e1248ac471f'
7
- data.tar.gz: e3dc654e5286a48687a23516a9b179888296df487a67bdac812ebc8c638194edc8f46705e7c506e501b3bcee8d072c09a1758f87ef98ae76cdd2c2d4577b1298
6
+ metadata.gz: 232acb59d51f451b6213992c42c8295218075ef83803207a1868cff6c44d07a4dc4ca51de9221fa5c7f18aa530bfa1f2f73a722673cfdfc3c696a5803c636295
7
+ data.tar.gz: 2acbfcc7c1e8177f28d244edfdc7fb6c1a73582446f2fdbac25af7272eb7136fb4552ea165e06637012f45473a15387eca6c804903fb1cd3e021ecf32e868a56
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.0.7] - 2024-12-09
2
+
3
+ - Convert entity into detached_entity when importing
4
+
1
5
  ## [0.0.6] - 2024-12-07
2
6
 
3
7
  - Make sure imported entities are immutable
@@ -56,15 +56,26 @@ module Foobara
56
56
  # Warning: cannot desugarize this because unfortunately desugarizing an entity declaration will actually
57
57
  # create the entity class, which should be considered a bug.
58
58
  declaration_data = manifest_to_import.declaration_data
59
- base_type_manifest = manifest_to_import.base_type
60
59
 
61
- if base_type_manifest
62
- base_type = Foobara.foobara_lookup_type(base_type_manifest.reference)
60
+ if declaration_data["type"] == "entity"
61
+ declaration_data = Util.deep_dup(declaration_data)
63
62
 
64
- if base_type.extends?(:entity)
65
- declaration_data = Util.deep_dup(declaration_data)
66
- declaration_data["mutable"] = false
63
+ declaration_data["type"] = "detached_entity"
64
+ declaration_data["mutable"] = false
65
+
66
+ primary_key_attribute = declaration_data["primary_key"]
67
+ required = declaration_data["attributes_declaration"]["required"]
68
+
69
+ required << primary_key_attribute unless required.include?(primary_key_attribute)
70
+
71
+ model_base_class = declaration_data["model_base_class"]
72
+ unless model_base_class == "Foobara::Entity"
73
+ # :nocov:
74
+ raise "Expected model base class to be Foobara::Entity, but was #{model_base_class}"
75
+ # :nocov:
67
76
  end
77
+
78
+ declaration_data["model_base_class"] = "Foobara::DetachedEntity"
68
79
  end
69
80
 
70
81
  type = domain.foobara_type_from_strict_stringified_declaration(declaration_data)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-remote-imports
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-07 00:00:00.000000000 Z
11
+ date: 2024-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foobara