@coasys/ad4m 0.12.0-rc1-dev.1 → 0.12.0-rc1-dev.3

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 (124) hide show
  1. package/jest.config.js +8 -1
  2. package/lib/index.cjs +13793 -12854
  3. package/lib/index.js +13782 -12851
  4. package/lib/src/Ad4mClient.test.d.ts +1 -0
  5. package/lib/src/Ad4mClient.test.js +1204 -0
  6. package/lib/src/Literal.test.d.ts +1 -0
  7. package/lib/src/Literal.test.js +41 -0
  8. package/lib/src/model/Ad4mModel.d.ts +528 -101
  9. package/lib/src/model/Ad4mModel.js +1670 -748
  10. package/lib/src/model/Ad4mModel.test.js +140 -156
  11. package/lib/src/model/Subject.d.ts +3 -3
  12. package/lib/src/model/Subject.js +25 -25
  13. package/lib/src/model/decorators.d.ts +259 -247
  14. package/lib/src/model/decorators.js +379 -422
  15. package/lib/src/model/mutation.d.ts +81 -0
  16. package/lib/src/model/mutation.js +317 -0
  17. package/lib/src/model/parentUtils.d.ts +32 -0
  18. package/lib/src/model/parentUtils.js +64 -0
  19. package/lib/src/model/prolog/generatePrologFacts.d.ts +36 -0
  20. package/lib/src/model/prolog/generatePrologFacts.js +139 -0
  21. package/lib/src/model/prolog/index.d.ts +1 -0
  22. package/lib/src/model/prolog/index.js +1 -0
  23. package/lib/src/model/query/ModelQueryBuilder.d.ts +82 -0
  24. package/lib/src/model/query/ModelQueryBuilder.js +115 -0
  25. package/lib/src/model/query/QueryBuilder.d.ts +101 -0
  26. package/lib/src/model/query/QueryBuilder.js +193 -0
  27. package/lib/src/model/query/SurrealQueryBuilder.d.ts +48 -0
  28. package/lib/src/model/query/SurrealQueryBuilder.js +371 -0
  29. package/lib/src/model/query/fetchInstance.d.ts +24 -0
  30. package/lib/src/model/query/fetchInstance.js +144 -0
  31. package/lib/src/model/query/hydration.d.ts +54 -0
  32. package/lib/src/model/query/hydration.js +214 -0
  33. package/lib/src/model/query/operations.d.ts +59 -0
  34. package/lib/src/model/query/operations.js +384 -0
  35. package/lib/src/model/query/snapshot.d.ts +59 -0
  36. package/lib/src/model/query/snapshot.js +106 -0
  37. package/lib/src/model/query/surrealCompiler.d.ts +42 -0
  38. package/lib/src/model/query/surrealCompiler.js +304 -0
  39. package/lib/src/model/schema/fromJSONSchema.d.ts +67 -0
  40. package/lib/src/model/schema/fromJSONSchema.js +264 -0
  41. package/lib/src/model/schema/metadata.d.ts +15 -0
  42. package/lib/src/model/schema/metadata.js +112 -0
  43. package/lib/src/model/subscription.d.ts +47 -0
  44. package/lib/src/model/subscription.js +231 -0
  45. package/lib/src/model/transaction.d.ts +27 -0
  46. package/lib/src/model/transaction.js +32 -0
  47. package/lib/src/model/types.d.ts +195 -0
  48. package/lib/src/model/types.js +8 -0
  49. package/lib/src/model/util.d.ts +6 -6
  50. package/lib/src/model/util.js +22 -22
  51. package/lib/src/neighbourhood/NeighbourhoodClient.js +31 -12
  52. package/lib/src/perspectives/PerspectiveProxy.d.ts +9 -9
  53. package/lib/src/perspectives/PerspectiveProxy.js +63 -51
  54. package/lib/src/shacl/SHACLShape.d.ts +9 -0
  55. package/lib/src/shacl/SHACLShape.js +28 -4
  56. package/lib/src/shims/reflect-metadata.d.ts +0 -0
  57. package/lib/src/shims/type-graphql.d.ts +32 -0
  58. package/lib/src/src/Ad4mClient.d.ts +28 -0
  59. package/lib/src/src/Address.d.ts +1 -0
  60. package/lib/src/src/DID.d.ts +1 -0
  61. package/lib/src/src/Exception.d.ts +7 -0
  62. package/lib/src/src/Literal.d.ts +7 -0
  63. package/lib/src/src/PubSub.d.ts +17 -0
  64. package/lib/src/src/SmartLiteral.d.ts +12 -0
  65. package/lib/src/src/agent/Agent.d.ts +110 -0
  66. package/lib/src/src/agent/AgentClient.d.ts +62 -0
  67. package/lib/src/src/agent/AgentResolver.d.ts +30 -0
  68. package/lib/src/src/agent/AgentStatus.d.ts +8 -0
  69. package/lib/src/src/ai/AIClient.d.ts +32 -0
  70. package/lib/src/src/ai/AIResolver.d.ts +75 -0
  71. package/lib/src/src/ai/Tasks.d.ts +37 -0
  72. package/lib/src/src/buildSchema.d.ts +1 -0
  73. package/lib/src/src/expression/Expression.d.ts +28 -0
  74. package/lib/src/src/expression/ExpressionClient.d.ts +13 -0
  75. package/lib/src/src/expression/ExpressionRef.d.ts +9 -0
  76. package/lib/src/src/expression/ExpressionResolver.d.ts +10 -0
  77. package/lib/src/src/index.d.ts +35 -0
  78. package/lib/src/src/jestSetup.d.ts +1 -0
  79. package/lib/src/src/language/Icon.d.ts +4 -0
  80. package/lib/src/src/language/Language.d.ts +206 -0
  81. package/lib/src/src/language/LanguageClient.d.ts +17 -0
  82. package/lib/src/src/language/LanguageContext.d.ts +37 -0
  83. package/lib/src/src/language/LanguageHandle.d.ts +9 -0
  84. package/lib/src/src/language/LanguageMeta.d.ts +35 -0
  85. package/lib/src/src/language/LanguageRef.d.ts +6 -0
  86. package/lib/src/src/language/LanguageResolver.d.ts +19 -0
  87. package/lib/src/src/links/Links.d.ts +39 -0
  88. package/lib/src/src/links/Links.test.d.ts +1 -0
  89. package/lib/src/src/model/Ad4mModel.d.ts +1438 -0
  90. package/lib/src/src/model/Ad4mModel.test.d.ts +1 -0
  91. package/lib/src/src/model/Subject.d.ts +25 -0
  92. package/lib/src/src/model/decorators.d.ts +545 -0
  93. package/lib/src/src/model/util.d.ts +12 -0
  94. package/lib/src/src/neighbourhood/Neighbourhood.d.ts +10 -0
  95. package/lib/src/src/neighbourhood/NeighbourhoodClient.d.ts +25 -0
  96. package/lib/src/src/neighbourhood/NeighbourhoodProxy.d.ts +19 -0
  97. package/lib/src/src/neighbourhood/NeighbourhoodProxy.test.d.ts +1 -0
  98. package/lib/src/src/neighbourhood/NeighbourhoodResolver.d.ts +24 -0
  99. package/lib/src/src/perspectives/LinkQuery.d.ts +11 -0
  100. package/lib/src/src/perspectives/Perspective.d.ts +38 -0
  101. package/lib/src/src/perspectives/Perspective.test.d.ts +1 -0
  102. package/lib/src/src/perspectives/PerspectiveClient.d.ts +97 -0
  103. package/lib/src/src/perspectives/PerspectiveDiff.d.ts +9 -0
  104. package/lib/src/src/perspectives/PerspectiveHandle.d.ts +18 -0
  105. package/lib/src/src/perspectives/PerspectiveProxy.d.ts +865 -0
  106. package/lib/src/src/perspectives/PerspectiveResolver.d.ts +57 -0
  107. package/lib/src/src/runtime/RuntimeClient.d.ts +56 -0
  108. package/lib/src/src/runtime/RuntimeResolver.d.ts +132 -0
  109. package/lib/src/src/shacl/SHACLFlow.d.ts +171 -0
  110. package/lib/src/src/shacl/SHACLFlow.test.d.ts +1 -0
  111. package/lib/src/src/shacl/SHACLShape.d.ts +117 -0
  112. package/lib/src/src/shacl/SHACLShape.test.d.ts +1 -0
  113. package/lib/src/src/typeDefs.d.ts +1 -0
  114. package/lib/src/src/unwrapApolloResult.d.ts +2 -0
  115. package/lib/src/src/utils.d.ts +25 -0
  116. package/package.json +20 -24
  117. package/src/model/Ad4mModel.test.ts +132 -149
  118. package/src/model/Ad4mModel.ts +1930 -784
  119. package/src/model/Subject.ts +24 -24
  120. package/src/model/decorators.ts +626 -482
  121. package/src/model/util.ts +22 -22
  122. package/src/neighbourhood/NeighbourhoodClient.ts +32 -16
  123. package/src/perspectives/PerspectiveProxy.ts +69 -55
  124. package/src/shacl/SHACLShape.ts +33 -4
@@ -8,18 +8,18 @@ var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  import { Ad4mModel } from "./Ad4mModel";
11
- import { ModelOptions, Property, Optional, ReadOnly, Collection, Flag } from "./decorators";
11
+ import { Model, Property, Optional, ReadOnly, HasMany, Flag } from "./decorators";
12
12
  describe("Ad4mModel.getModelMetadata()", () => {
13
13
  it("should extract basic model metadata with className", () => {
14
14
  let SimpleModel = class SimpleModel extends Ad4mModel {
15
15
  };
16
16
  SimpleModel = __decorate([
17
- ModelOptions({ name: "SimpleModel" })
17
+ Model({ name: "SimpleModel" })
18
18
  ], SimpleModel);
19
19
  const metadata = SimpleModel.getModelMetadata();
20
20
  expect(metadata.className).toBe("SimpleModel");
21
21
  expect(metadata.properties).toEqual({});
22
- expect(metadata.collections).toEqual({});
22
+ expect(metadata.relations).toEqual({});
23
23
  });
24
24
  it("should extract property metadata with all fields", () => {
25
25
  let PropertyModel = class PropertyModel extends Ad4mModel {
@@ -36,7 +36,7 @@ describe("Ad4mModel.getModelMetadata()", () => {
36
36
  __metadata("design:type", String)
37
37
  ], PropertyModel.prototype, "name", void 0);
38
38
  __decorate([
39
- Optional({ through: "test://optional", writable: true }),
39
+ Optional({ through: "test://optional" }),
40
40
  __metadata("design:type", String)
41
41
  ], PropertyModel.prototype, "optional", void 0);
42
42
  __decorate([
@@ -48,67 +48,55 @@ describe("Ad4mModel.getModelMetadata()", () => {
48
48
  __metadata("design:type", String)
49
49
  ], PropertyModel.prototype, "type", void 0);
50
50
  PropertyModel = __decorate([
51
- ModelOptions({ name: "PropertyModel" })
51
+ Model({ name: "PropertyModel" })
52
52
  ], PropertyModel);
53
53
  const metadata = PropertyModel.getModelMetadata();
54
54
  // Should have 4 properties
55
55
  expect(Object.keys(metadata.properties)).toHaveLength(4);
56
56
  // Verify "name" property
57
57
  expect(metadata.properties.name.predicate).toBe("test://name");
58
- expect(metadata.properties.name.required).toBe(true);
59
- expect(metadata.properties.name.writable).toBe(true);
58
+ expect(metadata.properties.name.required).toBe(false);
59
+ expect(metadata.properties.name.readOnly).toBe(false);
60
60
  expect(metadata.properties.name.resolveLanguage).toBe("literal");
61
61
  // Verify "optional" property
62
62
  expect(metadata.properties.optional.predicate).toBe("test://optional");
63
- expect(metadata.properties.optional.writable).toBe(true);
63
+ expect(metadata.properties.optional.readOnly).toBe(false);
64
64
  // Verify "readonly" property
65
65
  expect(metadata.properties.readonly.predicate).toBe("test://readonly");
66
- expect(metadata.properties.readonly.writable).toBe(false);
66
+ expect(metadata.properties.readonly.readOnly).toBe(true);
67
67
  expect(metadata.properties.readonly.prologGetter).toBe("custom_getter");
68
68
  // Verify "type" property (flag)
69
69
  expect(metadata.properties.type.predicate).toBe("test://type");
70
70
  expect(metadata.properties.type.flag).toBe(true);
71
71
  expect(metadata.properties.type.initial).toBe("test://flag");
72
72
  });
73
- it("should extract collection metadata with where clauses", () => {
74
- let CollectionModel = class CollectionModel extends Ad4mModel {
73
+ it("should extract relation metadata with various options", () => {
74
+ let RelationModel = class RelationModel extends Ad4mModel {
75
75
  constructor() {
76
76
  super(...arguments);
77
77
  this.items = [];
78
- this.filtered = [];
79
78
  this.local = [];
80
79
  }
81
80
  };
82
81
  __decorate([
83
- Collection({ through: "test://items" }),
84
- __metadata("design:type", Array)
85
- ], CollectionModel.prototype, "items", void 0);
86
- __decorate([
87
- Collection({
88
- through: "test://filtered",
89
- where: { condition: "triple(Target, 'test://active', 'true')" }
90
- }),
82
+ HasMany({ through: "test://items" }),
91
83
  __metadata("design:type", Array)
92
- ], CollectionModel.prototype, "filtered", void 0);
84
+ ], RelationModel.prototype, "items", void 0);
93
85
  __decorate([
94
- Collection({ through: "test://local", local: true }),
86
+ HasMany({ through: "test://local", local: true }),
95
87
  __metadata("design:type", Array)
96
- ], CollectionModel.prototype, "local", void 0);
97
- CollectionModel = __decorate([
98
- ModelOptions({ name: "CollectionModel" })
99
- ], CollectionModel);
100
- const metadata = CollectionModel.getModelMetadata();
101
- // Should have 3 collections
102
- expect(Object.keys(metadata.collections)).toHaveLength(3);
103
- // Verify "items" collection
104
- expect(metadata.collections.items.predicate).toBe("test://items");
105
- expect(metadata.collections.items.where).toBeUndefined();
106
- // Verify "filtered" collection
107
- expect(metadata.collections.filtered.predicate).toBe("test://filtered");
108
- expect(metadata.collections.filtered.where?.condition).toBe("triple(Target, 'test://active', 'true')");
109
- // Verify "local" collection
110
- expect(metadata.collections.local.predicate).toBe("test://local");
111
- expect(metadata.collections.local.local).toBe(true);
88
+ ], RelationModel.prototype, "local", void 0);
89
+ RelationModel = __decorate([
90
+ Model({ name: "RelationModel" })
91
+ ], RelationModel);
92
+ const metadata = RelationModel.getModelMetadata();
93
+ // Should have 2 relations
94
+ expect(Object.keys(metadata.relations)).toHaveLength(2);
95
+ // Verify "items" relation
96
+ expect(metadata.relations.items.predicate).toBe("test://items");
97
+ // Verify "local" relation
98
+ expect(metadata.relations.local.predicate).toBe("test://local");
99
+ expect(metadata.relations.local.local).toBe(true);
112
100
  });
113
101
  it("should extract transform function from property metadata", () => {
114
102
  let TransformModel = class TransformModel extends Ad4mModel {
@@ -125,7 +113,7 @@ describe("Ad4mModel.getModelMetadata()", () => {
125
113
  __metadata("design:type", String)
126
114
  ], TransformModel.prototype, "data", void 0);
127
115
  TransformModel = __decorate([
128
- ModelOptions({ name: "TransformModel" })
116
+ Model({ name: "TransformModel" })
129
117
  ], TransformModel);
130
118
  const metadata = TransformModel.getModelMetadata();
131
119
  // Assert transform is a function
@@ -150,7 +138,7 @@ describe("Ad4mModel.getModelMetadata()", () => {
150
138
  __metadata("design:type", Number)
151
139
  ], CustomModel.prototype, "computed", void 0);
152
140
  CustomModel = __decorate([
153
- ModelOptions({ name: "CustomModel" })
141
+ Model({ name: "CustomModel" })
154
142
  ], CustomModel);
155
143
  const metadata = CustomModel.getModelMetadata();
156
144
  // Assert prologGetter and prologSetter contain the custom code
@@ -158,11 +146,11 @@ describe("Ad4mModel.getModelMetadata()", () => {
158
146
  expect(metadata.properties.computed.prologSetter).toContain("Value is V / 2");
159
147
  expect(metadata.properties.computed.prologSetter).toContain("setSingleTarget");
160
148
  });
161
- it("should handle collection with isInstance where clause", () => {
149
+ it("should handle relation with typed target relation", () => {
162
150
  let Comment = class Comment extends Ad4mModel {
163
151
  };
164
152
  Comment = __decorate([
165
- ModelOptions({ name: "Comment" })
153
+ Model({ name: "Comment" })
166
154
  ], Comment);
167
155
  let Post = class Post extends Ad4mModel {
168
156
  constructor() {
@@ -171,26 +159,27 @@ describe("Ad4mModel.getModelMetadata()", () => {
171
159
  }
172
160
  };
173
161
  __decorate([
174
- Collection({
162
+ HasMany({
175
163
  through: "post://comment",
176
- where: { isInstance: Comment }
164
+ target: () => Comment
177
165
  }),
178
166
  __metadata("design:type", Array)
179
167
  ], Post.prototype, "comments", void 0);
180
168
  Post = __decorate([
181
- ModelOptions({ name: "Post" })
169
+ Model({ name: "Post" })
182
170
  ], Post);
183
171
  const metadata = Post.getModelMetadata();
184
- // Assert isInstance is defined
185
- expect(metadata.collections.comments.where?.isInstance).toBeDefined();
172
+ // Assert relation exists with correct predicate
173
+ expect(metadata.relations.comments).toBeDefined();
174
+ expect(metadata.relations.comments.predicate).toBe("post://comment");
186
175
  });
187
- it("should throw error for class without @ModelOptions decorator", () => {
176
+ it("should throw error for class without @Model decorator", () => {
188
177
  class NoDecoratorModel extends Ad4mModel {
189
178
  }
190
179
  // Assert that calling getModelMetadata throws an error
191
- expect(() => NoDecoratorModel.getModelMetadata()).toThrow("Model class must be decorated with @ModelOptions");
180
+ expect(() => NoDecoratorModel.getModelMetadata()).toThrow("Model class must be decorated with @Model");
192
181
  });
193
- it("should handle complex model with mixed property and collection types", () => {
182
+ it("should handle complex model with mixed property and relation types", () => {
194
183
  let Recipe = class Recipe extends Ad4mModel {
195
184
  constructor() {
196
185
  super(...arguments);
@@ -214,15 +203,15 @@ describe("Ad4mModel.getModelMetadata()", () => {
214
203
  __metadata("design:type", Number)
215
204
  ], Recipe.prototype, "rating", void 0);
216
205
  __decorate([
217
- Collection({ through: "recipe://ingredient" }),
206
+ HasMany({ through: "recipe://ingredient" }),
218
207
  __metadata("design:type", Array)
219
208
  ], Recipe.prototype, "ingredients", void 0);
220
209
  __decorate([
221
- Collection({ through: "recipe://step", local: true }),
210
+ HasMany({ through: "recipe://step", local: true }),
222
211
  __metadata("design:type", Array)
223
212
  ], Recipe.prototype, "steps", void 0);
224
213
  Recipe = __decorate([
225
- ModelOptions({ name: "Recipe" })
214
+ Model({ name: "Recipe" })
226
215
  ], Recipe);
227
216
  const metadata = Recipe.getModelMetadata();
228
217
  // Assert className
@@ -232,19 +221,19 @@ describe("Ad4mModel.getModelMetadata()", () => {
232
221
  expect(metadata.properties.name).toBeDefined();
233
222
  expect(metadata.properties.description).toBeDefined();
234
223
  expect(metadata.properties.rating).toBeDefined();
235
- // Assert collections has 2 entries
236
- expect(Object.keys(metadata.collections)).toHaveLength(2);
237
- expect(metadata.collections.ingredients).toBeDefined();
238
- expect(metadata.collections.steps).toBeDefined();
224
+ // Assert relations has 2 entries
225
+ expect(Object.keys(metadata.relations)).toHaveLength(2);
226
+ expect(metadata.relations.ingredients).toBeDefined();
227
+ expect(metadata.relations.steps).toBeDefined();
239
228
  // Verify all metadata fields are correctly extracted
240
229
  expect(metadata.properties.name.predicate).toBe("recipe://name");
241
230
  expect(metadata.properties.name.resolveLanguage).toBe("literal");
242
231
  expect(metadata.properties.description.predicate).toBe("recipe://description");
243
232
  expect(metadata.properties.rating.predicate).toBe("recipe://rating");
244
233
  expect(metadata.properties.rating.prologGetter).toBe("avg_rating(Base, Value)");
245
- expect(metadata.collections.ingredients.predicate).toBe("recipe://ingredient");
246
- expect(metadata.collections.steps.predicate).toBe("recipe://step");
247
- expect(metadata.collections.steps.local).toBe(true);
234
+ expect(metadata.relations.ingredients.predicate).toBe("recipe://ingredient");
235
+ expect(metadata.relations.steps.predicate).toBe("recipe://step");
236
+ expect(metadata.relations.steps.local).toBe(true);
248
237
  });
249
238
  });
250
239
  describe("Ad4mModel.fromJSONSchema() with getModelMetadata()", () => {
@@ -272,7 +261,7 @@ describe("Ad4mModel.fromJSONSchema() with getModelMetadata()", () => {
272
261
  expect(metadata.properties.name).toBeDefined();
273
262
  expect(metadata.properties.name.predicate).toBe("product://name");
274
263
  expect(metadata.properties.name.required).toBe(true);
275
- expect(metadata.properties.name.writable).toBe(true);
264
+ expect(metadata.properties.name.readOnly).toBe(false);
276
265
  expect(metadata.properties.name.resolveLanguage).toBe("literal");
277
266
  expect(metadata.properties.price).toBeDefined();
278
267
  expect(metadata.properties.price.predicate).toBe("product://price");
@@ -282,7 +271,7 @@ describe("Ad4mModel.fromJSONSchema() with getModelMetadata()", () => {
282
271
  expect(metadata.properties.description.predicate).toBe("product://description");
283
272
  expect(metadata.properties.description.required).toBe(false);
284
273
  });
285
- it("should extract collections from a model created via fromJSONSchema with arrays", () => {
274
+ it("should extract relations from a model created via fromJSONSchema with arrays", () => {
286
275
  const schema = {
287
276
  title: "Post",
288
277
  type: "object",
@@ -306,12 +295,12 @@ describe("Ad4mModel.fromJSONSchema() with getModelMetadata()", () => {
306
295
  const metadata = PostClass.getModelMetadata();
307
296
  // Verify className
308
297
  expect(metadata.className).toBe("Post");
309
- // Verify collections are extracted
310
- expect(Object.keys(metadata.collections).length).toBeGreaterThan(0);
311
- expect(metadata.collections.tags).toBeDefined();
312
- expect(metadata.collections.tags.predicate).toBe("post://tags");
313
- expect(metadata.collections.comments).toBeDefined();
314
- expect(metadata.collections.comments.predicate).toBe("post://comments");
298
+ // Verify relations are extracted
299
+ expect(Object.keys(metadata.relations).length).toBeGreaterThan(0);
300
+ expect(metadata.relations.tags).toBeDefined();
301
+ expect(metadata.relations.tags.predicate).toBe("post://tags");
302
+ expect(metadata.relations.comments).toBeDefined();
303
+ expect(metadata.relations.comments.predicate).toBe("post://comments");
315
304
  // Verify properties (should include at least title)
316
305
  expect(metadata.properties.title).toBeDefined();
317
306
  expect(metadata.properties.title.predicate).toBe("post://title");
@@ -350,7 +339,7 @@ describe("Ad4mModel.fromJSONSchema() with getModelMetadata()", () => {
350
339
  // Verify x-ad4m metadata is respected
351
340
  expect(metadata.properties.name.predicate).toBe("foaf://name");
352
341
  expect(metadata.properties.name.resolveLanguage).toBe("literal");
353
- expect(metadata.properties.name.writable).toBe(true);
342
+ expect(metadata.properties.name.readOnly).toBe(false);
354
343
  expect(metadata.properties.name.required).toBe(true);
355
344
  expect(metadata.properties.email.predicate).toBe("foaf://mbox");
356
345
  expect(metadata.properties.email.local).toBe(true);
@@ -419,14 +408,14 @@ describe("Ad4mModel.fromJSONSchema() with getModelMetadata()", () => {
419
408
  expect(metadata.properties.published).toBeDefined();
420
409
  expect(metadata.properties.published.predicate).toBe("article://published");
421
410
  expect(metadata.properties.published.required).toBe(true);
422
- // Verify collections
423
- expect(metadata.collections.authors).toBeDefined();
424
- expect(metadata.collections.authors.predicate).toBe("article://authors");
425
- expect(metadata.collections.tags).toBeDefined();
426
- expect(metadata.collections.tags.predicate).toBe("article://tags");
427
- expect(metadata.collections.tags.local).toBe(true);
428
- });
429
- it("should handle models with only an auto-generated type flag", () => {
411
+ // Verify relations
412
+ expect(metadata.relations.authors).toBeDefined();
413
+ expect(metadata.relations.authors.predicate).toBe("article://authors");
414
+ expect(metadata.relations.tags).toBeDefined();
415
+ expect(metadata.relations.tags.predicate).toBe("article://tags");
416
+ expect(metadata.relations.tags.local).toBe(true);
417
+ });
418
+ it("should handle models with no properties (open-world, no auto-flag)", () => {
430
419
  const schema = {
431
420
  title: "EmptyModel",
432
421
  type: "object",
@@ -439,11 +428,13 @@ describe("Ad4mModel.fromJSONSchema() with getModelMetadata()", () => {
439
428
  const metadata = EmptyModelClass.getModelMetadata();
440
429
  // Should have className
441
430
  expect(metadata.className).toBe("EmptyModel");
442
- // Should have the auto-generated __ad4m_type property
443
- expect(metadata.properties.__ad4m_type).toBeDefined();
444
- expect(metadata.properties.__ad4m_type.predicate).toBe("ad4m://type");
445
- expect(metadata.properties.__ad4m_type.initial).toBe("empty://instance");
446
- expect(metadata.properties.__ad4m_type.flag).toBe(true);
431
+ // Should NOT have an auto-generated __ad4m_type property —
432
+ // models with all-optional properties use open-world structural matching.
433
+ expect(metadata.properties.__ad4m_type).toBeUndefined();
434
+ // SHACL shape should still be valid with empty constructor/destructor
435
+ const { shape } = EmptyModelClass.generateSHACL();
436
+ expect(shape.constructor_actions).toEqual([]);
437
+ expect(shape.destructor_actions).toEqual([]);
447
438
  });
448
439
  });
449
440
  describe("Ad4mModel.queryToSurrealQL()", () => {
@@ -453,7 +444,7 @@ describe("Ad4mModel.queryToSurrealQL()", () => {
453
444
  function normalizeQuery(query) {
454
445
  return query.replace(/\s+/g, ' ').trim();
455
446
  }
456
- // Test Recipe model
447
+ // Test Recipe model — explicit required: true to test required-property query filters
457
448
  let Recipe = class Recipe extends Ad4mModel {
458
449
  constructor() {
459
450
  super(...arguments);
@@ -463,26 +454,26 @@ describe("Ad4mModel.queryToSurrealQL()", () => {
463
454
  }
464
455
  };
465
456
  __decorate([
466
- Property({ through: "recipe://name" }),
457
+ Property({ through: "recipe://name", required: true }),
467
458
  __metadata("design:type", String)
468
459
  ], Recipe.prototype, "name", void 0);
469
460
  __decorate([
470
- Property({ through: "recipe://rating" }),
461
+ Property({ through: "recipe://rating", required: true }),
471
462
  __metadata("design:type", Number)
472
463
  ], Recipe.prototype, "rating", void 0);
473
464
  __decorate([
474
- Collection({ through: "recipe://ingredient" }),
465
+ HasMany({ through: "recipe://ingredient" }),
475
466
  __metadata("design:type", Array)
476
467
  ], Recipe.prototype, "ingredients", void 0);
477
468
  Recipe = __decorate([
478
- ModelOptions({ name: "Recipe" })
469
+ Model({ name: "Recipe" })
479
470
  ], Recipe);
480
471
  it("should generate basic query with no filters", async () => {
481
472
  const query = await Recipe.queryToSurrealQL(mockPerspective, {});
482
473
  expect(query).toContain("id AS source");
483
474
  expect(query).toContain("uri AS source_uri");
484
475
  expect(query).toContain("FROM node");
485
- expect(query).toContain("->link[WHERE perspective = $perspective] AS links");
476
+ expect(query).toContain("->link AS links");
486
477
  expect(query).toContain("WHERE");
487
478
  // Should have graph traversal filters for required properties
488
479
  expect(query).toContain("count(->link[WHERE");
@@ -490,15 +481,15 @@ describe("Ad4mModel.queryToSurrealQL()", () => {
490
481
  it("should generate query with simple property filter", async () => {
491
482
  const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { name: "Pasta" } });
492
483
  // Should have graph traversal filters for required properties and user filter
493
- expect(query).toContain("count(->link[WHERE perspective = $perspective AND predicate = 'recipe://name']) > 0");
494
- expect(query).toContain("count(->link[WHERE perspective = $perspective AND predicate = 'recipe://rating']) > 0");
495
- expect(query).toContain("count(->link[WHERE perspective = $perspective AND predicate = 'recipe://name' AND out.uri = 'Pasta']) > 0");
484
+ expect(query).toContain("count(->link[WHERE predicate = 'recipe://name']) > 0");
485
+ expect(query).toContain("count(->link[WHERE predicate = 'recipe://rating']) > 0");
486
+ expect(query).toContain("count(->link[WHERE predicate = 'recipe://name' AND fn::parse_literal(out.uri) = 'Pasta']) > 0");
496
487
  });
497
488
  it("should generate query with multiple property filters", async () => {
498
489
  const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { name: "Pasta", rating: 5 } });
499
490
  expect(query).toContain("WHERE");
500
- expect(query).toContain("count(->link[WHERE perspective = $perspective AND predicate = 'recipe://name' AND out.uri = 'Pasta']) > 0");
501
- expect(query).toContain("count(->link[WHERE perspective = $perspective AND predicate = 'recipe://rating' AND out.uri = 5]) > 0");
491
+ expect(query).toContain("count(->link[WHERE predicate = 'recipe://name' AND fn::parse_literal(out.uri) = 'Pasta']) > 0");
492
+ expect(query).toContain("count(->link[WHERE predicate = 'recipe://rating' AND fn::parse_literal(out.uri) = 5]) > 0");
502
493
  expect(query).toContain("AND");
503
494
  });
504
495
  it("should handle gt operator (filtered in JavaScript, not SQL)", async () => {
@@ -525,12 +516,12 @@ describe("Ad4mModel.queryToSurrealQL()", () => {
525
516
  it("should handle not operator with single value", async () => {
526
517
  const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { name: { not: "Salad" } } });
527
518
  // Not operator uses graph traversal with count = 0
528
- expect(query).toContain("count(->link[WHERE perspective = $perspective AND predicate = 'recipe://name' AND out.uri = 'Salad']) = 0");
519
+ expect(query).toContain("count(->link[WHERE predicate = 'recipe://name' AND fn::parse_literal(out.uri) = 'Salad']) = 0");
529
520
  });
530
521
  it("should handle not operator with array (NOT IN)", async () => {
531
522
  const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { name: { not: ["Salad", "Soup"] } } });
532
523
  // Not operator with array uses graph traversal with count = 0
533
- expect(query).toContain("count(->link[WHERE perspective = $perspective AND predicate = 'recipe://name' AND out.uri IN ['Salad', 'Soup']]) = 0");
524
+ expect(query).toContain("count(->link[WHERE predicate = 'recipe://name' AND fn::parse_literal(out.uri) IN ['Salad', 'Soup']]) = 0");
534
525
  });
535
526
  it("should handle between operator (filtered in JavaScript, not SQL)", async () => {
536
527
  const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { rating: { between: [3, 5] } } });
@@ -557,13 +548,13 @@ describe("Ad4mModel.queryToSurrealQL()", () => {
557
548
  // Should not use a subquery pattern
558
549
  expect(query).not.toContain("SELECT source FROM node");
559
550
  });
560
- it.skip("should handle contains operator on special field (base)", async () => {
561
- const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { base: { contains: "test" } } });
551
+ it.skip("should handle contains operator on special field (id)", async () => {
552
+ const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { id: { contains: "test" } } });
562
553
  expect(query).toContain("WHERE source CONTAINS 'test'");
563
554
  });
564
555
  it("should handle array values (IN clause)", async () => {
565
556
  const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { name: ["Pasta", "Pizza"] } });
566
- expect(query).toContain("count(->link[WHERE perspective = $perspective AND predicate = 'recipe://name' AND out.uri IN ['Pasta', 'Pizza']]) > 0");
557
+ expect(query).toContain("count(->link[WHERE predicate = 'recipe://name' AND fn::parse_literal(out.uri) IN ['Pasta', 'Pizza']]) > 0");
567
558
  });
568
559
  it.skip("should handle special fields (author, timestamp) without subqueries", async () => {
569
560
  const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { author: "did:key:alice" } });
@@ -598,7 +589,7 @@ describe("Ad4mModel.queryToSurrealQL()", () => {
598
589
  });
599
590
  // WHERE clause uses graph traversal filters
600
591
  expect(query).toContain("WHERE");
601
- expect(query).toContain("count(->link[WHERE perspective = $perspective AND predicate = 'recipe://name' AND out.uri = 'Pasta']) > 0");
592
+ expect(query).toContain("count(->link[WHERE predicate = 'recipe://name' AND fn::parse_literal(out.uri) = 'Pasta']) > 0");
602
593
  // Comparison operators (gt) are filtered in JavaScript, not SQL
603
594
  expect(query).not.toContain("out.uri > 4");
604
595
  expect(query).not.toContain("target > 4");
@@ -610,10 +601,10 @@ describe("Ad4mModel.queryToSurrealQL()", () => {
610
601
  it("should only select requested properties", async () => {
611
602
  const query = await Recipe.queryToSurrealQL(mockPerspective, { properties: ["name"] });
612
603
  // With array::group(), all link data is selected, filtering happens in instancesFromSurrealResult
613
- expect(query).toContain("->link[WHERE perspective = $perspective] AS links");
604
+ expect(query).toContain("->link AS links");
614
605
  });
615
- it("should only select requested collections", async () => {
616
- let MultiCollectionModel = class MultiCollectionModel extends Ad4mModel {
606
+ it("should select all link data for relations", async () => {
607
+ let MultiRelationModel = class MultiRelationModel extends Ad4mModel {
617
608
  constructor() {
618
609
  super(...arguments);
619
610
  this.coll1 = [];
@@ -621,19 +612,19 @@ describe("Ad4mModel.queryToSurrealQL()", () => {
621
612
  }
622
613
  };
623
614
  __decorate([
624
- Collection({ through: "test://coll1" }),
615
+ HasMany({ through: "test://coll1" }),
625
616
  __metadata("design:type", Array)
626
- ], MultiCollectionModel.prototype, "coll1", void 0);
617
+ ], MultiRelationModel.prototype, "coll1", void 0);
627
618
  __decorate([
628
- Collection({ through: "test://coll2" }),
619
+ HasMany({ through: "test://coll2" }),
629
620
  __metadata("design:type", Array)
630
- ], MultiCollectionModel.prototype, "coll2", void 0);
631
- MultiCollectionModel = __decorate([
632
- ModelOptions({ name: "MultiCollectionModel" })
633
- ], MultiCollectionModel);
634
- const query = await MultiCollectionModel.queryToSurrealQL(mockPerspective, { collections: ["coll1"] });
635
- // With array::group(), all link data is selected, filtering happens in instancesFromSurrealResult
636
- expect(query).toContain("->link[WHERE perspective = $perspective] AS links");
621
+ ], MultiRelationModel.prototype, "coll2", void 0);
622
+ MultiRelationModel = __decorate([
623
+ Model({ name: "MultiRelationModel" })
624
+ ], MultiRelationModel);
625
+ const query = await MultiRelationModel.queryToSurrealQL(mockPerspective, {});
626
+ // With array::group(), all link data is selected
627
+ expect(query).toContain("->link AS links");
637
628
  });
638
629
  it("should escape single quotes in string values", async () => {
639
630
  const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { name: "O'Brien's Recipe" } });
@@ -643,8 +634,8 @@ describe("Ad4mModel.queryToSurrealQL()", () => {
643
634
  it("should handle numeric values without quotes", async () => {
644
635
  const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { rating: 5 } });
645
636
  // Numeric values should not have quotes around them
646
- expect(query).toContain("out.uri = 5");
647
- expect(query).not.toContain("out.uri = '5'");
637
+ expect(query).toContain("fn::parse_literal(out.uri) = 5");
638
+ expect(query).not.toContain("fn::parse_literal(out.uri) = '5'");
648
639
  });
649
640
  it("should handle complex nested query (comparisons, ORDER BY, LIMIT handled in JS)", async () => {
650
641
  const query = await Recipe.queryToSurrealQL(mockPerspective, {
@@ -658,7 +649,7 @@ describe("Ad4mModel.queryToSurrealQL()", () => {
658
649
  });
659
650
  const normalized = normalizeQuery(query);
660
651
  // Verify graph traversal filters are present
661
- expect(normalized).toContain("count(->link[WHERE perspective = $perspective AND predicate = 'recipe://name' AND out.uri = 'Pasta']) > 0");
652
+ expect(normalized).toContain("count(->link[WHERE predicate = 'recipe://name' AND fn::parse_literal(out.uri) = 'Pasta']) > 0");
662
653
  // Comparison operators (gte, lte) are filtered in JavaScript, not SQL
663
654
  expect(normalized).not.toContain("out.uri >= 4");
664
655
  expect(normalized).not.toContain("target >= 4");
@@ -680,38 +671,38 @@ describe("Ad4mModel.queryToSurrealQL()", () => {
680
671
  expect(query).toContain("FROM node");
681
672
  // Should have WHERE clause filtering for required properties using graph traversal
682
673
  expect(query).toContain("WHERE");
683
- expect(query).toContain("count(->link[WHERE perspective = $perspective AND predicate = 'recipe://name']) > 0");
684
- expect(query).toContain("count(->link[WHERE perspective = $perspective AND predicate = 'recipe://rating']) > 0");
674
+ expect(query).toContain("count(->link[WHERE predicate = 'recipe://name']) > 0");
675
+ expect(query).toContain("count(->link[WHERE predicate = 'recipe://rating']) > 0");
685
676
  expect(query).not.toContain("ORDER BY");
686
677
  expect(query).not.toContain("START");
687
678
  });
688
- it("should handle base special field", async () => {
689
- const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { base: "literal://test" } });
679
+ it("should handle id special field", async () => {
680
+ const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { id: "literal://test" } });
690
681
  expect(query).toContain("uri = 'literal://test'");
691
682
  });
692
- it("should handle base special field with array (IN clause)", async () => {
693
- const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { base: ["literal://test1", "literal://test2"] } });
683
+ it("should handle id special field with array (IN clause)", async () => {
684
+ const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { id: ["literal://test1", "literal://test2"] } });
694
685
  expect(query).toContain("uri IN ['literal://test1', 'literal://test2']");
695
686
  });
696
- it("should handle base special field with not operator", async () => {
697
- const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { base: { not: "literal://test" } } });
687
+ it("should handle id special field with not operator", async () => {
688
+ const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { id: { not: "literal://test" } } });
698
689
  expect(query).toContain("uri != 'literal://test'");
699
690
  });
700
- it("should handle base special field with not operator and array (NOT IN)", async () => {
701
- const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { base: { not: ["literal://test1", "literal://test2"] } } });
691
+ it("should handle id special field with not operator and array (NOT IN)", async () => {
692
+ const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { id: { not: ["literal://test1", "literal://test2"] } } });
702
693
  expect(query).toContain("uri NOT IN ['literal://test1', 'literal://test2']");
703
694
  });
704
- it("should handle base special field with between operator", async () => {
705
- const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { base: { between: ["literal://a", "literal://z"] } } });
695
+ it("should handle id special field with between operator", async () => {
696
+ const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { id: { between: ["literal://a", "literal://z"] } } });
706
697
  const normalized = normalizeQuery(query);
707
698
  expect(normalized).toContain("uri >= 'literal://a' AND uri <= 'literal://z'");
708
699
  });
709
- it("should handle base special field with gt operator", async () => {
710
- const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { base: { gt: "literal://m" } } });
700
+ it("should handle id special field with gt operator", async () => {
701
+ const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { id: { gt: "literal://m" } } });
711
702
  expect(query).toContain("uri > 'literal://m'");
712
703
  });
713
- it("should handle base special field with gte and lte operators", async () => {
714
- const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { base: { gte: "literal://a", lte: "literal://z" } } });
704
+ it("should handle id special field with gte and lte operators", async () => {
705
+ const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { id: { gte: "literal://a", lte: "literal://z" } } });
715
706
  const normalized = normalizeQuery(query);
716
707
  expect(normalized).toContain("uri >= 'literal://a'");
717
708
  expect(normalized).toContain("uri <= 'literal://z'");
@@ -744,7 +735,7 @@ describe("Ad4mModel.queryToSurrealQL()", () => {
744
735
  });
745
736
  const normalized = normalizeQuery(query);
746
737
  // Regular properties use graph traversal filters
747
- expect(normalized).toContain("count(->link[WHERE perspective = $perspective AND predicate = 'recipe://name' AND out.uri = 'Pasta']) > 0");
738
+ expect(normalized).toContain("count(->link[WHERE predicate = 'recipe://name' AND fn::parse_literal(out.uri) = 'Pasta']) > 0");
748
739
  // Comparison operators (gt) are filtered in JavaScript, not SQL
749
740
  expect(normalized).not.toContain("out.uri > 4");
750
741
  expect(normalized).not.toContain("target > 4");
@@ -763,14 +754,14 @@ describe("Ad4mModel.queryToSurrealQL()", () => {
763
754
  __metadata("design:type", Boolean)
764
755
  ], Task.prototype, "completed", void 0);
765
756
  Task = __decorate([
766
- ModelOptions({ name: "Task" })
757
+ Model({ name: "Task" })
767
758
  ], Task);
768
759
  const query = await Task.queryToSurrealQL(mockPerspective, { where: { completed: true } });
769
- expect(query).toContain("out.uri = true");
760
+ expect(query).toContain("fn::parse_literal(out.uri) = true");
770
761
  });
771
762
  it("should handle array of numbers", async () => {
772
763
  const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { rating: [4, 5] } });
773
- expect(query).toContain("count(->link[WHERE perspective = $perspective AND predicate = 'recipe://rating' AND out.uri IN [4, 5]]) > 0");
764
+ expect(query).toContain("count(->link[WHERE predicate = 'recipe://rating' AND fn::parse_literal(out.uri) IN [4, 5]]) > 0");
774
765
  });
775
766
  it("should skip unknown properties in where clause", async () => {
776
767
  const query = await Recipe.queryToSurrealQL(mockPerspective, { where: { unknownProp: "value" } });
@@ -792,15 +783,10 @@ describe("Ad4mModel.queryToSurrealQL()", () => {
792
783
  expect(query).toContain("FROM node");
793
784
  expect(query).not.toContain("ORDER BY");
794
785
  });
795
- it("should generate query with only properties, no collections", async () => {
796
- const query = await Recipe.queryToSurrealQL(mockPerspective, { properties: ["name", "rating"], collections: [] });
797
- // With array::group(), all link data is selected, filtering happens in instancesFromSurrealResult
798
- expect(query).toContain("->link[WHERE perspective = $perspective] AS links");
799
- });
800
- it("should generate query with only collections, no properties", async () => {
801
- const query = await Recipe.queryToSurrealQL(mockPerspective, { properties: [], collections: ["ingredients"] });
786
+ it("should generate query with only properties specified", async () => {
787
+ const query = await Recipe.queryToSurrealQL(mockPerspective, { properties: ["name", "rating"] });
802
788
  // With array::group(), all link data is selected, filtering happens in instancesFromSurrealResult
803
- expect(query).toContain("->link[WHERE perspective = $perspective] AS links");
789
+ expect(query).toContain("->link AS links");
804
790
  });
805
791
  });
806
792
  describe("Ad4mModel.instancesFromSurrealResult() and SurrealDB integration", () => {
@@ -822,11 +808,11 @@ describe("Ad4mModel.instancesFromSurrealResult() and SurrealDB integration", ()
822
808
  __metadata("design:type", Number)
823
809
  ], Recipe.prototype, "rating", void 0);
824
810
  __decorate([
825
- Collection({ through: "recipe://ingredient" }),
811
+ HasMany({ through: "recipe://ingredient" }),
826
812
  __metadata("design:type", Array)
827
813
  ], Recipe.prototype, "ingredients", void 0);
828
814
  Recipe = __decorate([
829
- ModelOptions({ name: "Recipe" })
815
+ Model({ name: "Recipe" })
830
816
  ], Recipe);
831
817
  // Mock perspective with both querySurrealDB and infer methods
832
818
  const mockPerspective = {
@@ -901,12 +887,11 @@ describe("Ad4mModel.instancesFromSurrealResult() and SurrealDB integration", ()
901
887
  // rating and ingredients should be removed since only "name" was requested
902
888
  expect(recipe.rating).toBeUndefined();
903
889
  expect(recipe.ingredients).toBeUndefined();
904
- // author and timestamp should still be present
905
- expect(recipe.author).toBe("did:key:alice");
906
- // Timestamp is converted to Unix epoch (milliseconds)
907
- expect(recipe.timestamp).toBe(new Date("2023-01-01T00:00:00Z").getTime());
890
+ // author, createdAt, updatedAt are also stripped unless explicitly requested
891
+ expect(recipe.author).toBeUndefined();
892
+ expect(recipe.timestamp).toBeUndefined();
908
893
  });
909
- it("should filter collections when query specifies collections", async () => {
894
+ it("should filter properties when query specifies properties", async () => {
910
895
  const surrealResults = [
911
896
  {
912
897
  source: "node:abc123",
@@ -919,12 +904,11 @@ describe("Ad4mModel.instancesFromSurrealResult() and SurrealDB integration", ()
919
904
  ]
920
905
  }
921
906
  ];
922
- const result = await Recipe.instancesFromSurrealResult(mockPerspective, { collections: ["ingredients"] }, surrealResults);
907
+ const result = await Recipe.instancesFromSurrealResult(mockPerspective, { properties: ["name"] }, surrealResults);
923
908
  expect(result.results).toHaveLength(1);
924
909
  const recipe = result.results[0];
925
- expect(recipe.ingredients).toEqual(["pasta", "tomato"]);
926
- // name and rating should be removed since only "ingredients" was requested
927
- expect(recipe.name).toBeUndefined();
910
+ expect(recipe.name).toBe("Pasta");
911
+ // rating and ingredients should be removed since only "name" was requested
928
912
  expect(recipe.rating).toBeUndefined();
929
913
  });
930
914
  it("should handle results missing base field", async () => {
@@ -1135,11 +1119,11 @@ describe("Ad4mModel.count() with advanced where conditions", () => {
1135
1119
  __metadata("design:type", Number)
1136
1120
  ], Recipe.prototype, "rating", void 0);
1137
1121
  __decorate([
1138
- Collection({ through: "recipe://ingredient" }),
1122
+ HasMany({ through: "recipe://ingredient" }),
1139
1123
  __metadata("design:type", Array)
1140
1124
  ], Recipe.prototype, "ingredients", void 0);
1141
1125
  Recipe = __decorate([
1142
- ModelOptions({ name: "Recipe" })
1126
+ Model({ name: "Recipe" })
1143
1127
  ], Recipe);
1144
1128
  // Mock perspective
1145
1129
  const mockPerspective = {