@api-client/core 0.13.6 → 0.14.1

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 (174) hide show
  1. package/build/src/amf/AmfTypes.d.ts +1 -1
  2. package/build/src/amf/AmfTypes.js +1 -1
  3. package/build/src/amf/AmfTypes.js.map +1 -1
  4. package/build/src/amf/Utils.d.ts +0 -6
  5. package/build/src/amf/Utils.d.ts.map +1 -1
  6. package/build/src/amf/Utils.js +0 -14
  7. package/build/src/amf/Utils.js.map +1 -1
  8. package/build/src/browser.d.ts +1 -0
  9. package/build/src/browser.d.ts.map +1 -1
  10. package/build/src/browser.js +1 -0
  11. package/build/src/browser.js.map +1 -1
  12. package/build/src/index.d.ts +1 -0
  13. package/build/src/index.d.ts.map +1 -1
  14. package/build/src/index.js +1 -0
  15. package/build/src/index.js.map +1 -1
  16. package/build/src/legacy.d.ts +0 -8
  17. package/build/src/legacy.d.ts.map +1 -1
  18. package/build/src/legacy.js +0 -9
  19. package/build/src/legacy.js.map +1 -1
  20. package/build/src/modeling/Bindings.d.ts +1 -1
  21. package/build/src/modeling/Bindings.js.map +1 -1
  22. package/build/src/modeling/DataDomain.js +2 -2
  23. package/build/src/modeling/DataDomain.js.map +1 -1
  24. package/build/src/modeling/DataFormat.d.ts +0 -40
  25. package/build/src/modeling/DataFormat.d.ts.map +1 -1
  26. package/build/src/modeling/DataFormat.js +0 -27
  27. package/build/src/modeling/DataFormat.js.map +1 -1
  28. package/build/src/modeling/DomainAssociation.d.ts +28 -0
  29. package/build/src/modeling/DomainAssociation.d.ts.map +1 -1
  30. package/build/src/modeling/DomainAssociation.js +73 -4
  31. package/build/src/modeling/DomainAssociation.js.map +1 -1
  32. package/build/src/modeling/DomainEntity.d.ts +25 -9
  33. package/build/src/modeling/DomainEntity.d.ts.map +1 -1
  34. package/build/src/modeling/DomainEntity.js +65 -21
  35. package/build/src/modeling/DomainEntity.js.map +1 -1
  36. package/build/src/modeling/DomainFile.d.ts +3 -4
  37. package/build/src/modeling/DomainFile.d.ts.map +1 -1
  38. package/build/src/modeling/DomainFile.js +5 -9
  39. package/build/src/modeling/DomainFile.js.map +1 -1
  40. package/build/src/modeling/DomainImpactAnalysis.d.ts +1 -1
  41. package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -1
  42. package/build/src/modeling/DomainImpactAnalysis.js +3 -3
  43. package/build/src/modeling/DomainImpactAnalysis.js.map +1 -1
  44. package/build/src/modeling/DomainModel.d.ts +2 -2
  45. package/build/src/modeling/DomainModel.js +2 -2
  46. package/build/src/modeling/DomainModel.js.map +1 -1
  47. package/build/src/modeling/DomainProperty.d.ts +28 -12
  48. package/build/src/modeling/DomainProperty.d.ts.map +1 -1
  49. package/build/src/modeling/DomainProperty.js +61 -26
  50. package/build/src/modeling/DomainProperty.js.map +1 -1
  51. package/build/src/modeling/Semantics.d.ts +109 -0
  52. package/build/src/modeling/Semantics.d.ts.map +1 -0
  53. package/build/src/modeling/Semantics.js +97 -0
  54. package/build/src/modeling/Semantics.js.map +1 -0
  55. package/build/src/models/CertificateFile.d.ts +2 -3
  56. package/build/src/models/CertificateFile.d.ts.map +1 -1
  57. package/build/src/models/CertificateFile.js +4 -8
  58. package/build/src/models/CertificateFile.js.map +1 -1
  59. package/build/src/models/Folder.d.ts +1 -2
  60. package/build/src/models/Folder.d.ts.map +1 -1
  61. package/build/src/models/Folder.js +2 -4
  62. package/build/src/models/Folder.js.map +1 -1
  63. package/build/src/models/Project.d.ts +2 -3
  64. package/build/src/models/Project.d.ts.map +1 -1
  65. package/build/src/models/Project.js +4 -8
  66. package/build/src/models/Project.js.map +1 -1
  67. package/build/src/models/kinds.d.ts +0 -24
  68. package/build/src/models/kinds.d.ts.map +1 -1
  69. package/build/src/models/kinds.js +0 -24
  70. package/build/src/models/kinds.js.map +1 -1
  71. package/build/src/models/store/File.d.ts +1 -21
  72. package/build/src/models/store/File.d.ts.map +1 -1
  73. package/build/src/models/store/File.js +3 -23
  74. package/build/src/models/store/File.js.map +1 -1
  75. package/build/src/models/store/data_catalog.d.ts +1 -1
  76. package/build/src/models/store/data_catalog.js.map +1 -1
  77. package/build/src/sdk/FilesSdk.js +1 -1
  78. package/build/src/sdk/FilesSdk.js.map +1 -1
  79. package/build/tsconfig.tsbuildinfo +1 -1
  80. package/data/models/example-generator-api.json +22 -22
  81. package/eslint.config.js +1 -0
  82. package/package.json +5 -5
  83. package/src/amf/AmfTypes.ts +1 -1
  84. package/src/amf/Utils.ts +0 -15
  85. package/src/modeling/Bindings.ts +1 -1
  86. package/src/modeling/DataDomain.ts +2 -2
  87. package/src/modeling/DataFormat.ts +0 -48
  88. package/src/modeling/DomainAssociation.ts +66 -3
  89. package/src/modeling/DomainEntity.ts +56 -17
  90. package/src/modeling/DomainFile.ts +5 -9
  91. package/src/modeling/DomainImpactAnalysis.ts +3 -3
  92. package/src/modeling/DomainModel.ts +2 -2
  93. package/src/modeling/DomainProperty.ts +60 -21
  94. package/src/modeling/Semantics.ts +178 -0
  95. package/src/modeling/graph.md +14 -14
  96. package/src/modeling/readme.md +29 -29
  97. package/src/models/CertificateFile.ts +4 -12
  98. package/src/models/Folder.ts +2 -4
  99. package/src/models/Project.ts +4 -8
  100. package/src/models/kinds.ts +0 -25
  101. package/src/models/store/File.ts +4 -35
  102. package/src/models/store/data_catalog.ts +1 -1
  103. package/src/sdk/FilesSdk.ts +1 -1
  104. package/tests/unit/modeling/data_domain_change_observers.spec.ts +11 -10
  105. package/tests/unit/modeling/data_domain_entities.spec.ts +129 -1
  106. package/tests/unit/modeling/data_domain_property.spec.ts +1 -1
  107. package/tests/unit/modeling/domain_asociation.spec.ts +177 -0
  108. package/tests/unit/modeling/domain_entity.spec.ts +27 -26
  109. package/tests/unit/modeling/domain_entity_example_generator_json.spec.ts +11 -11
  110. package/tests/unit/modeling/domain_entity_example_generator_xml.spec.ts +10 -10
  111. package/tests/unit/modeling/domain_file.spec.ts +4 -27
  112. package/tests/unit/modeling/{domain.property.spec.ts → domain_property.spec.ts} +139 -23
  113. package/tests/unit/models/Certificate/from_name.spec.ts +3 -15
  114. package/tests/unit/models/File/constructor.spec.ts +0 -1
  115. package/tests/unit/models/File/new.spec.ts +0 -13
  116. package/tests/unit/models/File/shortcutTo.spec.ts +1 -2
  117. package/tests/unit/models/File/toJSON.spec.ts +0 -13
  118. package/tests/unit/models/File/updateByMeMeta.spec.ts +4 -6
  119. package/tests/unit/models/Folder/create.spec.ts +2 -23
  120. package/tests/unit/models/Project/create.spec.ts +6 -32
  121. package/build/src/amf/AmfShapeGenerator.d.ts +0 -103
  122. package/build/src/amf/AmfShapeGenerator.d.ts.map +0 -1
  123. package/build/src/amf/AmfShapeGenerator.js +0 -416
  124. package/build/src/amf/AmfShapeGenerator.js.map +0 -1
  125. package/build/src/modeling/legacy/DataAssociation.d.ts +0 -284
  126. package/build/src/modeling/legacy/DataAssociation.d.ts.map +0 -1
  127. package/build/src/modeling/legacy/DataAssociation.js +0 -443
  128. package/build/src/modeling/legacy/DataAssociation.js.map +0 -1
  129. package/build/src/modeling/legacy/DataEntity.d.ts +0 -358
  130. package/build/src/modeling/legacy/DataEntity.d.ts.map +0 -1
  131. package/build/src/modeling/legacy/DataEntity.js +0 -855
  132. package/build/src/modeling/legacy/DataEntity.js.map +0 -1
  133. package/build/src/modeling/legacy/DataEntityBuilder.d.ts +0 -162
  134. package/build/src/modeling/legacy/DataEntityBuilder.d.ts.map +0 -1
  135. package/build/src/modeling/legacy/DataEntityBuilder.js +0 -221
  136. package/build/src/modeling/legacy/DataEntityBuilder.js.map +0 -1
  137. package/build/src/modeling/legacy/DataImpactAnalysis.d.ts +0 -298
  138. package/build/src/modeling/legacy/DataImpactAnalysis.d.ts.map +0 -1
  139. package/build/src/modeling/legacy/DataImpactAnalysis.js +0 -441
  140. package/build/src/modeling/legacy/DataImpactAnalysis.js.map +0 -1
  141. package/build/src/modeling/legacy/DataModel.d.ts +0 -99
  142. package/build/src/modeling/legacy/DataModel.d.ts.map +0 -1
  143. package/build/src/modeling/legacy/DataModel.js +0 -237
  144. package/build/src/modeling/legacy/DataModel.js.map +0 -1
  145. package/build/src/modeling/legacy/DataNamespace.d.ts +0 -340
  146. package/build/src/modeling/legacy/DataNamespace.d.ts.map +0 -1
  147. package/build/src/modeling/legacy/DataNamespace.js +0 -784
  148. package/build/src/modeling/legacy/DataNamespace.js.map +0 -1
  149. package/build/src/modeling/legacy/DataProperty.d.ts +0 -332
  150. package/build/src/modeling/legacy/DataProperty.d.ts.map +0 -1
  151. package/build/src/modeling/legacy/DataProperty.js +0 -415
  152. package/build/src/modeling/legacy/DataProperty.js.map +0 -1
  153. package/build/src/models/store/DataFile.d.ts +0 -31
  154. package/build/src/models/store/DataFile.d.ts.map +0 -1
  155. package/build/src/models/store/DataFile.js +0 -92
  156. package/build/src/models/store/DataFile.js.map +0 -1
  157. package/src/amf/AmfShapeGenerator.ts +0 -477
  158. package/src/modeling/legacy/DataAssociation.ts +0 -554
  159. package/src/modeling/legacy/DataEntity.ts +0 -1019
  160. package/src/modeling/legacy/DataEntityBuilder.ts +0 -236
  161. package/src/modeling/legacy/DataImpactAnalysis.ts +0 -530
  162. package/src/modeling/legacy/DataModel.ts +0 -276
  163. package/src/modeling/legacy/DataNamespace.ts +0 -929
  164. package/src/modeling/legacy/DataProperty.ts +0 -630
  165. package/src/models/store/DataFile.ts +0 -100
  166. package/tests/unit/modeling/legacy/amf_shape_generator.spec.ts +0 -1041
  167. package/tests/unit/modeling/legacy/data_association.spec.ts +0 -710
  168. package/tests/unit/modeling/legacy/data_entity.spec.ts +0 -2061
  169. package/tests/unit/modeling/legacy/data_entity_generator_json.spec.ts +0 -987
  170. package/tests/unit/modeling/legacy/data_entity_generator_xml.spec.ts +0 -1451
  171. package/tests/unit/modeling/legacy/data_model.spec.ts +0 -395
  172. package/tests/unit/modeling/legacy/data_namespace.spec.ts +0 -1312
  173. package/tests/unit/modeling/legacy/data_property.spec.ts +0 -887
  174. package/tests/unit/modeling/legacy/impact_analysis.spec.ts +0 -373
@@ -1,42 +1,28 @@
1
1
  import { test } from '@japa/runner'
2
2
  import { DomainFile, IDomainFile, ThingKind, DomainFileKind, DataDomain } from '../../../src/index.js'
3
3
 
4
- const organization = 'test-organization'
5
-
6
4
  test.group('DomainFile.fromDataDomain()', () => {
7
5
  test('sets the kind', ({ assert }) => {
8
6
  const p1 = new DataDomain({ info: { name: 'p1' } })
9
- const result = DomainFile.fromDataDomain(p1, organization)
7
+ const result = DomainFile.fromDataDomain(p1)
10
8
  assert.equal(result.kind, DomainFileKind)
11
9
  })
12
10
 
13
- test('sets the organization', ({ assert }) => {
14
- const p1 = new DataDomain({ info: { name: 'p1' } })
15
- const result = DomainFile.fromDataDomain(p1, organization)
16
- assert.equal(result.organization, organization)
17
- })
18
-
19
11
  test('sets the name', ({ assert }) => {
20
12
  const p1 = new DataDomain({ info: { name: 'p1' } })
21
- const result = DomainFile.fromDataDomain(p1, organization)
13
+ const result = DomainFile.fromDataDomain(p1)
22
14
  assert.equal(result.info.name, 'p1')
23
15
  })
24
16
 
25
17
  test('sets the key', ({ assert }) => {
26
18
  const p1 = new DataDomain({ info: { name: 'p1' } })
27
- const result = DomainFile.fromDataDomain(p1, organization)
19
+ const result = DomainFile.fromDataDomain(p1)
28
20
  assert.equal(result.key, p1.key)
29
21
  })
30
22
 
31
- test('sets the configured owner', ({ assert }) => {
32
- const p1 = new DataDomain({ info: { name: 'p1' } })
33
- const result = DomainFile.fromDataDomain(p1, organization, 'other')
34
- assert.equal(result.owner, 'other')
35
- })
36
-
37
23
  test('respects schema instead of instance', ({ assert }) => {
38
24
  const p1 = new DataDomain({ info: { name: 'p1' } })
39
- const result = DomainFile.fromDataDomain(p1.toJSON(), organization)
25
+ const result = DomainFile.fromDataDomain(p1.toJSON())
40
26
  assert.equal(result.info.name, 'p1')
41
27
  })
42
28
  })
@@ -45,7 +31,6 @@ test.group('constructor()', () => {
45
31
  test('creates a default data file', ({ assert }) => {
46
32
  const result = new DomainFile()
47
33
  assert.equal(result.kind, DomainFileKind)
48
- assert.isUndefined(result.owner)
49
34
  assert.typeOf(result.key, 'string')
50
35
  assert.typeOf(result.lastModified, 'object')
51
36
  })
@@ -53,13 +38,11 @@ test.group('constructor()', () => {
53
38
  test('creates a data file from the schema values', ({ assert }) => {
54
39
  const schema: IDomainFile = {
55
40
  kind: DomainFileKind,
56
- organization,
57
41
  info: {
58
42
  kind: ThingKind,
59
43
  name: 'hello',
60
44
  description: 'a desc',
61
45
  },
62
- owner: 'me',
63
46
  key: '123',
64
47
  parents: ['p1'],
65
48
  permissionIds: ['pr1'],
@@ -81,9 +64,7 @@ test.group('constructor()', () => {
81
64
  }
82
65
  const result = new DomainFile(schema)
83
66
  assert.equal(result.kind, DomainFileKind)
84
- assert.equal(result.organization, organization)
85
67
  assert.equal(result.info.name, 'hello')
86
- assert.equal(result.owner, 'me')
87
68
  assert.equal(result.key, '123')
88
69
  assert.deepEqual(result.parents, ['p1'])
89
70
  assert.deepEqual(result.permissionIds, ['pr1'])
@@ -95,13 +76,11 @@ test.group('constructor()', () => {
95
76
  test('creates a data file from the JSON schema string', ({ assert }) => {
96
77
  const schema: IDomainFile = {
97
78
  kind: DomainFileKind,
98
- organization,
99
79
  info: {
100
80
  kind: ThingKind,
101
81
  name: 'hello',
102
82
  description: 'a desc',
103
83
  },
104
- owner: 'me',
105
84
  key: '123',
106
85
  parents: ['p1'],
107
86
  permissionIds: ['pr1'],
@@ -122,9 +101,7 @@ test.group('constructor()', () => {
122
101
  }
123
102
  const result = new DomainFile(JSON.stringify(schema))
124
103
  assert.equal(result.kind, DomainFileKind)
125
- assert.equal(result.organization, organization)
126
104
  assert.equal(result.info.name, 'hello')
127
- assert.equal(result.owner, 'me')
128
105
  assert.equal(result.key, '123')
129
106
  assert.deepEqual(result.lastModified, schema.lastModified)
130
107
  })
@@ -1,5 +1,6 @@
1
1
  import { test } from '@japa/runner'
2
2
  import { DataDomain, DomainPropertyKind, DomainProperty, Thing, DataFormat } from '../../../src/index.js'
3
+ import { SemanticType } from '../../../src/modeling/Semantics.js'
3
4
 
4
5
  test.group('DomainProperty.createSchema()', () => {
5
6
  test('creates a schema with default values', ({ assert }) => {
@@ -17,7 +18,7 @@ test.group('DomainProperty.createSchema()', () => {
17
18
  assert.isUndefined(schema.writeOnly)
18
19
  assert.isUndefined(schema.deprecated)
19
20
  assert.isUndefined(schema.tags)
20
- assert.isUndefined(schema.taxonomy)
21
+ assert.isUndefined(schema.semantics)
21
22
  assert.isUndefined(schema.schema)
22
23
  assert.deepEqual(schema.bindings, [])
23
24
  })
@@ -34,7 +35,7 @@ test.group('DomainProperty.createSchema()', () => {
34
35
  writeOnly: true,
35
36
  deprecated: true,
36
37
  tags: ['tag1', 'tag2'],
37
- taxonomy: ['tax1', 'tax2'],
38
+ semantics: [{ id: SemanticType.CreatedTimestamp }],
38
39
  type: 'number',
39
40
  schema: { minimum: 0 },
40
41
  bindings: [{ type: 'web', schema: { format: 'float' } }],
@@ -51,7 +52,7 @@ test.group('DomainProperty.createSchema()', () => {
51
52
  assert.isTrue(schema.writeOnly)
52
53
  assert.isTrue(schema.deprecated)
53
54
  assert.deepEqual(schema.tags, ['tag1', 'tag2'])
54
- assert.deepEqual(schema.taxonomy, ['tax1', 'tax2'])
55
+ assert.deepEqual(schema.semantics, [{ id: SemanticType.CreatedTimestamp }])
55
56
  assert.deepEqual(schema.schema, { minimum: 0 })
56
57
  assert.deepEqual(schema.bindings, [{ type: 'web', schema: { format: 'float' } }])
57
58
  })
@@ -87,7 +88,7 @@ test.group('DomainProperty.createSchema()', () => {
87
88
  writeOnly: undefined,
88
89
  deprecated: undefined,
89
90
  tags: undefined,
90
- taxonomy: undefined,
91
+ semantics: undefined,
91
92
  schema: undefined,
92
93
  bindings: undefined,
93
94
  })
@@ -104,7 +105,7 @@ test.group('DomainProperty.createSchema()', () => {
104
105
  assert.isUndefined(schema.writeOnly)
105
106
  assert.isUndefined(schema.deprecated)
106
107
  assert.isUndefined(schema.tags)
107
- assert.isUndefined(schema.taxonomy)
108
+ assert.isUndefined(schema.semantics)
108
109
  assert.isUndefined(schema.schema)
109
110
  assert.deepEqual(schema.bindings, [])
110
111
  })
@@ -128,7 +129,7 @@ test.group('DomainProperty.createSchema()', () => {
128
129
  // @ts-expect-error Testing null values
129
130
  tags: null,
130
131
  // @ts-expect-error Testing null values
131
- taxonomy: null,
132
+ semantics: null,
132
133
  // @ts-expect-error Testing null values
133
134
  schema: null,
134
135
  // @ts-expect-error Testing null values
@@ -142,7 +143,7 @@ test.group('DomainProperty.createSchema()', () => {
142
143
  assert.isUndefined(schema.writeOnly)
143
144
  assert.isUndefined(schema.deprecated)
144
145
  assert.isUndefined(schema.tags)
145
- assert.isUndefined(schema.taxonomy)
146
+ assert.isUndefined(schema.semantics)
146
147
  assert.isUndefined(schema.schema)
147
148
  assert.deepEqual(schema.bindings, [])
148
149
  })
@@ -150,11 +151,11 @@ test.group('DomainProperty.createSchema()', () => {
150
151
  test('creates a schema with all properties empty array', ({ assert }) => {
151
152
  const schema = DomainProperty.createSchema({
152
153
  tags: [],
153
- taxonomy: [],
154
+ semantics: [],
154
155
  bindings: [],
155
156
  })
156
157
  assert.deepEqual(schema.tags, [])
157
- assert.deepEqual(schema.taxonomy, [])
158
+ assert.deepEqual(schema.semantics, [])
158
159
  assert.deepEqual(schema.bindings, [])
159
160
  })
160
161
 
@@ -180,11 +181,11 @@ test.group('DomainProperty.createSchema()', () => {
180
181
  test('creates a schema with all array properties set to empty arrays', ({ assert }) => {
181
182
  const schema = DomainProperty.createSchema({
182
183
  tags: [],
183
- taxonomy: [],
184
+ semantics: [],
184
185
  bindings: [],
185
186
  })
186
187
  assert.deepEqual(schema.tags, [])
187
- assert.deepEqual(schema.taxonomy, [])
188
+ assert.deepEqual(schema.semantics, [])
188
189
  assert.deepEqual(schema.bindings, [])
189
190
  })
190
191
 
@@ -202,12 +203,12 @@ test.group('DomainProperty.createSchema()', () => {
202
203
  // @ts-expect-error Testing null values
203
204
  tags: null,
204
205
  // @ts-expect-error Testing null values
205
- taxonomy: null,
206
+ semantics: null,
206
207
  // @ts-expect-error Testing null values
207
208
  bindings: null,
208
209
  })
209
210
  assert.isUndefined(schema.tags)
210
- assert.isUndefined(schema.taxonomy)
211
+ assert.isUndefined(schema.semantics)
211
212
  assert.deepEqual(schema.bindings, [])
212
213
  })
213
214
 
@@ -242,7 +243,7 @@ test.group('DomainProperty.constructor()', () => {
242
243
  assert.isUndefined(property.writeOnly)
243
244
  assert.isUndefined(property.deprecated)
244
245
  assert.deepEqual(property.tags, [])
245
- assert.deepEqual(property.taxonomy, [])
246
+ assert.deepEqual(property.semantics, [])
246
247
  assert.isUndefined(property.schema)
247
248
  assert.deepEqual(property.bindings, [])
248
249
  assert.equal(property['parent'], parent)
@@ -263,7 +264,7 @@ test.group('DomainProperty.constructor()', () => {
263
264
  writeOnly: true,
264
265
  deprecated: true,
265
266
  tags: ['tag1', 'tag2'],
266
- taxonomy: ['tax1', 'tax2'],
267
+ semantics: [{ id: SemanticType.CreatedTimestamp }],
267
268
  type: 'number',
268
269
  schema: { minimum: 0 },
269
270
  bindings: [{ type: 'web', schema: { format: 'float' } }],
@@ -281,7 +282,7 @@ test.group('DomainProperty.constructor()', () => {
281
282
  assert.isTrue(property.writeOnly)
282
283
  assert.isTrue(property.deprecated)
283
284
  assert.deepEqual(property.tags, ['tag1', 'tag2'])
284
- assert.deepEqual(property.taxonomy, ['tax1', 'tax2'])
285
+ assert.deepEqual(property.semantics, [{ id: SemanticType.CreatedTimestamp }])
285
286
  assert.deepEqual(property.schema, { minimum: 0 })
286
287
  assert.deepEqual(property.bindings, [{ type: 'web', schema: { format: 'float' } }])
287
288
  assert.equal(property['parent'], parent)
@@ -404,7 +405,7 @@ test.group('DomainProperty.toJSON()', () => {
404
405
  assert.isUndefined(json.writeOnly)
405
406
  assert.isUndefined(json.deprecated)
406
407
  assert.isUndefined(json.tags)
407
- assert.isUndefined(json.taxonomy)
408
+ assert.isUndefined(json.semantics)
408
409
  assert.isUndefined(json.schema)
409
410
  assert.isUndefined(json.bindings)
410
411
  })
@@ -423,7 +424,7 @@ test.group('DomainProperty.toJSON()', () => {
423
424
  writeOnly: true,
424
425
  deprecated: true,
425
426
  tags: ['tag1', 'tag2'],
426
- taxonomy: ['tax1', 'tax2'],
427
+ semantics: [{ id: SemanticType.CreatedTimestamp }],
427
428
  type: 'number',
428
429
  schema: { minimum: 0 },
429
430
  bindings: [{ type: 'web', schema: { format: 'float' } }],
@@ -442,7 +443,7 @@ test.group('DomainProperty.toJSON()', () => {
442
443
  assert.isTrue(json.writeOnly)
443
444
  assert.isTrue(json.deprecated)
444
445
  assert.deepEqual(json.tags, ['tag1', 'tag2'])
445
- assert.deepEqual(json.taxonomy, ['tax1', 'tax2'])
446
+ assert.deepEqual(json.semantics, [{ id: SemanticType.CreatedTimestamp }])
446
447
  assert.deepEqual(json.schema, { minimum: 0 })
447
448
  assert.deepEqual(json.bindings, [{ type: 'web', schema: { format: 'float' } }])
448
449
  })
@@ -452,13 +453,13 @@ test.group('DomainProperty.toJSON()', () => {
452
453
  const parent = 'test-parent'
453
454
  const property = new DomainProperty(root, parent, {
454
455
  tags: [],
455
- taxonomy: [],
456
+ semantics: [],
456
457
  bindings: [],
457
458
  })
458
459
  const json = property.toJSON()
459
460
 
460
461
  assert.isUndefined(json.tags)
461
- assert.isUndefined(json.taxonomy)
462
+ assert.isUndefined(json.semantics)
462
463
  assert.isUndefined(json.bindings)
463
464
  })
464
465
 
@@ -474,7 +475,7 @@ test.group('DomainProperty.toJSON()', () => {
474
475
  writeOnly: undefined,
475
476
  deprecated: undefined,
476
477
  tags: undefined,
477
- taxonomy: undefined,
478
+ semantics: undefined,
478
479
  schema: undefined,
479
480
  bindings: undefined,
480
481
  })
@@ -488,7 +489,7 @@ test.group('DomainProperty.toJSON()', () => {
488
489
  assert.isUndefined(json.writeOnly)
489
490
  assert.isUndefined(json.deprecated)
490
491
  assert.isUndefined(json.tags)
491
- assert.isUndefined(json.taxonomy)
492
+ assert.isUndefined(json.semantics)
492
493
  assert.isUndefined(json.schema)
493
494
  assert.isUndefined(json.bindings)
494
495
  })
@@ -820,3 +821,118 @@ test.group('DomainProperty.toApiShape()', () => {
820
821
  assert.isDefined(result)
821
822
  })
822
823
  })
824
+
825
+ test.group('DomainProperty.addSemantic()', () => {
826
+ test('adds a new semantic to the property', ({ assert }) => {
827
+ const dataDomain = new DataDomain()
828
+ const property = new DomainProperty(dataDomain, 'test-parent', { type: 'datetime' })
829
+ const semantic = { id: SemanticType.CreatedTimestamp }
830
+ property.addSemantic(semantic)
831
+ assert.deepInclude(property.semantics, semantic)
832
+ })
833
+
834
+ test('updates an existing semantic', ({ assert }) => {
835
+ const dataDomain = new DataDomain()
836
+ const property = new DomainProperty(dataDomain, 'test-parent', { type: 'datetime' })
837
+ const semantic1 = { id: SemanticType.CreatedTimestamp, config: { value: 'old' } }
838
+ const semantic2 = { id: SemanticType.CreatedTimestamp, config: { value: 'new' } }
839
+ property.addSemantic(semantic1)
840
+ property.addSemantic(semantic2)
841
+ assert.lengthOf(property.semantics, 1)
842
+ assert.deepInclude(property.semantics, semantic2)
843
+ })
844
+
845
+ test('throws an error if the semantic is not a property semantic', ({ assert }) => {
846
+ const dataDomain = new DataDomain()
847
+ const property = new DomainProperty(dataDomain, 'test-parent')
848
+ const semantic = { id: SemanticType.User } // User is an Entity semantic
849
+ assert.throws(() => {
850
+ property.addSemantic(semantic)
851
+ }, `Invalid semantic type: ${SemanticType.User}. Expected a property semantic.`)
852
+ })
853
+
854
+ test('notifies change when adding a new semantic', async ({ assert }) => {
855
+ const dataDomain = new DataDomain()
856
+ const property = new DomainProperty(dataDomain, 'test-parent', { type: 'datetime' })
857
+ const semantic = { id: SemanticType.CreatedTimestamp }
858
+ property.addSemantic(semantic)
859
+ await assert.dispatches(dataDomain, 'change', { timeout: 20 })
860
+ })
861
+
862
+ test('notifies change when updating an existing semantic', async ({ assert }) => {
863
+ const dataDomain = new DataDomain()
864
+ const property = new DomainProperty(dataDomain, 'test-parent', { type: 'datetime' })
865
+ const semantic1 = { id: SemanticType.CreatedTimestamp, config: { value: 'old' } }
866
+ const semantic2 = { id: SemanticType.CreatedTimestamp, config: { value: 'new' } }
867
+ property.addSemantic(semantic1)
868
+ // Clear the event queue before the second add
869
+ await new Promise((resolve) => setTimeout(resolve, 0))
870
+ property.addSemantic(semantic2)
871
+ await assert.dispatches(dataDomain, 'change', { timeout: 20 })
872
+ })
873
+ })
874
+
875
+ test.group('DomainProperty.removeSemantic()', () => {
876
+ test('removes an existing semantic from the property', ({ assert }) => {
877
+ const dataDomain = new DataDomain()
878
+ const property = new DomainProperty(dataDomain, 'test-parent', { type: 'datetime' })
879
+ const semantic = { id: SemanticType.CreatedTimestamp }
880
+ property.addSemantic(semantic)
881
+ assert.deepInclude(property.semantics, semantic)
882
+ property.removeSemantic(SemanticType.CreatedTimestamp)
883
+ assert.notDeepInclude(property.semantics, semantic)
884
+ assert.lengthOf(property.semantics, 0)
885
+ })
886
+
887
+ test('does nothing if the semantic to remove does not exist', ({ assert }) => {
888
+ const dataDomain = new DataDomain()
889
+ const property = new DomainProperty(dataDomain, 'test-parent', { type: 'datetime' })
890
+ const semantic = { id: SemanticType.CreatedTimestamp }
891
+ property.addSemantic(semantic)
892
+ const initialSemantics = [...property.semantics]
893
+ property.removeSemantic('non-existent-semantic-id' as SemanticType)
894
+ assert.deepEqual(property.semantics, initialSemantics)
895
+ })
896
+
897
+ test('notifies change when a semantic is removed', async ({ assert }) => {
898
+ const dataDomain = new DataDomain()
899
+ const property = new DomainProperty(dataDomain, 'test-parent', { type: 'datetime' })
900
+ const semantic = { id: SemanticType.CreatedTimestamp }
901
+ property.addSemantic(semantic)
902
+ // Clear the event queue before removal
903
+ await new Promise((resolve) => setTimeout(resolve, 0))
904
+ property.removeSemantic(SemanticType.CreatedTimestamp)
905
+ await assert.dispatches(dataDomain, 'change', { timeout: 20 })
906
+ })
907
+
908
+ test('does not notify change if the semantic to remove does not exist', async ({ assert }) => {
909
+ const dataDomain = new DataDomain()
910
+ const property = new DomainProperty(dataDomain, 'test-parent')
911
+ // Clear the event queue before removal
912
+ await new Promise((resolve) => setTimeout(resolve, 0))
913
+ property.removeSemantic('non-existent-semantic-id' as SemanticType)
914
+ await assert.notDispatches(dataDomain, 'change', { timeout: 20 })
915
+ })
916
+ })
917
+
918
+ test.group('DomainProperty.hasSemantic()', () => {
919
+ test('returns true if the property has the specified semantic', ({ assert }) => {
920
+ const dataDomain = new DataDomain()
921
+ const property = new DomainProperty(dataDomain, 'test-parent', { type: 'datetime' })
922
+ const semantic = { id: SemanticType.CreatedTimestamp }
923
+ property.addSemantic(semantic)
924
+ assert.isTrue(property.hasSemantic(SemanticType.CreatedTimestamp))
925
+ })
926
+
927
+ test('returns false if the property does not have the specified semantic', ({ assert }) => {
928
+ const dataDomain = new DataDomain()
929
+ const property = new DomainProperty(dataDomain, 'test-parent')
930
+ assert.isFalse(property.hasSemantic(SemanticType.CreatedTimestamp))
931
+ })
932
+
933
+ test('returns false for an empty semantics array', ({ assert }) => {
934
+ const dataDomain = new DataDomain()
935
+ const property = new DomainProperty(dataDomain, 'test-parent')
936
+ assert.isFalse(property.hasSemantic(SemanticType.CreatedTimestamp))
937
+ })
938
+ })
@@ -1,32 +1,20 @@
1
1
  import { test } from '@japa/runner'
2
2
  import { CertificateFile, CertificateFileKind } from '../../../../src/index.js'
3
3
 
4
- const organization = 'test-organization'
5
-
6
4
  test.group('CertificateFile.fromName()', () => {
7
5
  test('sets the kind', ({ assert }) => {
8
- const result = CertificateFile.fromName('name', organization)
6
+ const result = CertificateFile.fromName('name')
9
7
  assert.equal(result.kind, CertificateFileKind)
10
8
  })
11
9
 
12
- test('sets the organization', ({ assert }) => {
13
- const result = CertificateFile.fromName('name', organization)
14
- assert.equal(result.organization, organization)
15
- })
16
-
17
10
  test('sets the name', ({ assert }) => {
18
- const result = CertificateFile.fromName('name', organization)
11
+ const result = CertificateFile.fromName('name')
19
12
  assert.equal(result.info.name, 'name')
20
13
  })
21
14
 
22
15
  test('sets the key', ({ assert }) => {
23
- const result = CertificateFile.fromName('name', organization)
16
+ const result = CertificateFile.fromName('name')
24
17
  assert.typeOf(result.key, 'string')
25
18
  assert.notEqual(result.key, '')
26
19
  })
27
-
28
- test('sets the owner', ({ assert }) => {
29
- const result = CertificateFile.fromName('name', organization, 'other')
30
- assert.equal(result.owner, 'other')
31
- })
32
20
  })
@@ -5,7 +5,6 @@ test.group('File.constructor()', () => {
5
5
  test('creates a default File', ({ assert }) => {
6
6
  const result = new File()
7
7
  assert.equal(result.kind, '')
8
- assert.isUndefined(result.owner)
9
8
  assert.equal(result.key, '')
10
9
  assert.deepEqual(result.info.toJSON(), { kind: ThingKind, name: '' })
11
10
  assert.deepEqual(result.parents, [])
@@ -4,18 +4,15 @@ import { File, ThingKind, IFile } from '../../../../src/index.js'
4
4
  test.group('File.new()', (group) => {
5
5
  let file: File
6
6
  let base: IFile
7
- const organization = 'test123'
8
7
  group.each.setup(async () => {
9
8
  file = new File()
10
9
  base = {
11
10
  kind: 'test-kind',
12
- organization,
13
11
  info: {
14
12
  kind: ThingKind,
15
13
  name: 'hello',
16
14
  description: 'a desc',
17
15
  },
18
- owner: 'me',
19
16
  key: '123',
20
17
  parents: ['p1'],
21
18
  permissionIds: ['pr1'],
@@ -45,11 +42,6 @@ test.group('File.new()', (group) => {
45
42
  assert.equal(file.key, '123')
46
43
  })
47
44
 
48
- test('sets the organization', ({ assert }) => {
49
- file.new({ ...base })
50
- assert.equal(file.organization, organization)
51
- })
52
-
53
45
  test('sets a new key when missing', ({ assert }) => {
54
46
  const iFile = { ...base }
55
47
  Reflect.deleteProperty(iFile, 'key')
@@ -99,11 +91,6 @@ test.group('File.new()', (group) => {
99
91
  assert.deepEqual(file.permissionIds, [])
100
92
  })
101
93
 
102
- test('sets the owner', ({ assert }) => {
103
- file.new({ ...base })
104
- assert.equal(file.owner, 'me')
105
- })
106
-
107
94
  test('sets the lastModified', ({ assert }) => {
108
95
  file.new({ ...base })
109
96
  assert.deepEqual(file.lastModified, base.lastModified)
@@ -46,8 +46,7 @@ test.group('File.shortcutTo()', () => {
46
46
  })
47
47
 
48
48
  test('creates a shortcut from a name with fromName()', ({ assert }) => {
49
- const organization = 'test-org'
50
- const file = File.fromName('test-file', organization)
49
+ const file = File.fromName('test-file')
51
50
  const targetId = 'target-file-id'
52
51
  file.shortcutTo(targetId)
53
52
  assert.equal(file.shortcutTarget, targetId)
@@ -4,19 +4,16 @@ import { File, ThingKind, IFile } from '../../../../src/index.js'
4
4
  test.group('File.toJSON()', (group) => {
5
5
  let file: File
6
6
  let base: IFile
7
- const organization = 'test123'
8
7
 
9
8
  group.each.setup(() => {
10
9
  file = new File()
11
10
  base = {
12
11
  kind: 'test-kind',
13
- organization,
14
12
  info: {
15
13
  kind: ThingKind,
16
14
  name: 'hello',
17
15
  description: 'a desc',
18
16
  },
19
- owner: 'me',
20
17
  key: '123',
21
18
  parents: ['p1'],
22
19
  permissionIds: ['pr1'],
@@ -43,21 +40,11 @@ test.group('File.toJSON()', (group) => {
43
40
  assert.equal(result.key, base.key)
44
41
  })
45
42
 
46
- test('sets the organization', ({ assert }) => {
47
- const result = file.toJSON()
48
- assert.equal(result.organization, organization)
49
- })
50
-
51
43
  test('sets the kind', ({ assert }) => {
52
44
  const result = file.toJSON()
53
45
  assert.equal(result.kind, base.kind)
54
46
  })
55
47
 
56
- test('sets the owner', ({ assert }) => {
57
- const result = file.toJSON()
58
- assert.equal(result.owner, base.owner)
59
- })
60
-
61
48
  test('sets the info', ({ assert }) => {
62
49
  const result = file.toJSON()
63
50
  assert.deepEqual(result.info, base.info)
@@ -2,10 +2,8 @@ import { test } from '@japa/runner'
2
2
  import { File, Folder } from '../../../../src/index.js'
3
3
 
4
4
  test.group('File.updateByMeMeta()', () => {
5
- const organization = 'test123'
6
-
7
5
  test('sets deletedInfo.byMe for the same user', ({ assert }) => {
8
- const schema = Folder.fromName('s1', organization).toJSON()
6
+ const schema = Folder.fromName('s1').toJSON()
9
7
  schema.deletedInfo = {
10
8
  byMe: false,
11
9
  time: 1,
@@ -17,7 +15,7 @@ test.group('File.updateByMeMeta()', () => {
17
15
  })
18
16
 
19
17
  test('sets deletedInfo.byMe for the different user', ({ assert }) => {
20
- const schema = Folder.fromName('s1', organization).toJSON()
18
+ const schema = Folder.fromName('s1').toJSON()
21
19
  schema.deletedInfo = {
22
20
  byMe: false,
23
21
  time: 1,
@@ -29,7 +27,7 @@ test.group('File.updateByMeMeta()', () => {
29
27
  })
30
28
 
31
29
  test('sets lastModified.byMe for the same user', ({ assert }) => {
32
- const schema = Folder.fromName('s1', organization).toJSON()
30
+ const schema = Folder.fromName('s1').toJSON()
33
31
  schema.lastModified = {
34
32
  byMe: false,
35
33
  time: 1,
@@ -41,7 +39,7 @@ test.group('File.updateByMeMeta()', () => {
41
39
  })
42
40
 
43
41
  test('sets lastModified.byMe for the different user', ({ assert }) => {
44
- const schema = Folder.fromName('s1', organization).toJSON()
42
+ const schema = Folder.fromName('s1').toJSON()
45
43
  schema.lastModified = {
46
44
  byMe: false,
47
45
  time: 1,
@@ -1,35 +1,22 @@
1
1
  import { test } from '@japa/runner'
2
2
  import { Folder, FolderKind, IFolder, ThingKind } from '../../../../src/index.js'
3
3
 
4
- const organization = 'test-organization'
5
-
6
4
  test.group('Folder.fromName()', () => {
7
5
  test('sets the kind', ({ assert }) => {
8
- const result = Folder.fromName('name', organization)
6
+ const result = Folder.fromName('name')
9
7
  assert.equal(result.kind, FolderKind)
10
8
  })
11
9
 
12
- test('sets the organization', ({ assert }) => {
13
- const result = Folder.fromName('name', organization)
14
- assert.equal(result.organization, organization)
15
- })
16
-
17
10
  test('sets the name', ({ assert }) => {
18
- const result = Folder.fromName('name', organization)
11
+ const result = Folder.fromName('name')
19
12
  assert.equal(result.info.name, 'name')
20
13
  })
21
-
22
- test('sets the passed owner', ({ assert }) => {
23
- const result = Folder.fromName('name', organization, 'me')
24
- assert.equal(result.owner, 'me')
25
- })
26
14
  })
27
15
 
28
16
  test.group('Folder.constructor()', () => {
29
17
  test('creates a default Folder', ({ assert }) => {
30
18
  const result = new Folder()
31
19
  assert.equal(result.kind, FolderKind)
32
- assert.isUndefined(result.owner)
33
20
  assert.typeOf(result.key, 'string')
34
21
  assert.typeOf(result.lastModified, 'object')
35
22
  })
@@ -37,13 +24,11 @@ test.group('Folder.constructor()', () => {
37
24
  test('creates a Folder from the schema values', ({ assert }) => {
38
25
  const schema: IFolder = {
39
26
  kind: FolderKind,
40
- organization,
41
27
  info: {
42
28
  kind: ThingKind,
43
29
  name: 'hello',
44
30
  description: 'a desc',
45
31
  },
46
- owner: 'me',
47
32
  key: '123',
48
33
  parents: ['p1'],
49
34
  permissionIds: ['pr1'],
@@ -65,9 +50,7 @@ test.group('Folder.constructor()', () => {
65
50
  }
66
51
  const result = new Folder(schema)
67
52
  assert.equal(result.kind, FolderKind)
68
- assert.equal(result.organization, organization)
69
53
  assert.equal(result.info.name, 'hello')
70
- assert.equal(result.owner, 'me')
71
54
  assert.equal(result.key, '123')
72
55
  assert.deepEqual(result.parents, ['p1'])
73
56
  assert.deepEqual(result.permissionIds, ['pr1'])
@@ -79,13 +62,11 @@ test.group('Folder.constructor()', () => {
79
62
  test('creates a Folder from the JSON schema string', ({ assert }) => {
80
63
  const schema: IFolder = {
81
64
  kind: FolderKind,
82
- organization,
83
65
  info: {
84
66
  kind: ThingKind,
85
67
  name: 'hello',
86
68
  description: 'a desc',
87
69
  },
88
- owner: 'me',
89
70
  key: '123',
90
71
  parents: ['p1'],
91
72
  permissionIds: ['pr1'],
@@ -106,9 +87,7 @@ test.group('Folder.constructor()', () => {
106
87
  }
107
88
  const result = new Folder(JSON.stringify(schema))
108
89
  assert.equal(result.kind, FolderKind)
109
- assert.equal(result.organization, organization)
110
90
  assert.equal(result.info.name, 'hello')
111
- assert.equal(result.owner, 'me')
112
91
  assert.equal(result.key, '123')
113
92
  assert.deepEqual(result.lastModified, schema.lastModified)
114
93
  })