@api-client/core 0.11.4 → 0.11.6
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/build/oauth-popup.html +33 -0
- package/build/src/modeling/DataAssociation.d.ts +5 -1
- package/build/src/modeling/DataAssociation.d.ts.map +1 -1
- package/build/src/modeling/DataAssociation.js +10 -4
- package/build/src/modeling/DataAssociation.js.map +1 -1
- package/build/src/modeling/DataEntity.d.ts +5 -1
- package/build/src/modeling/DataEntity.d.ts.map +1 -1
- package/build/src/modeling/DataEntity.js +15 -8
- package/build/src/modeling/DataEntity.js.map +1 -1
- package/build/src/modeling/DataModel.d.ts +5 -1
- package/build/src/modeling/DataModel.d.ts.map +1 -1
- package/build/src/modeling/DataModel.js +15 -11
- package/build/src/modeling/DataModel.js.map +1 -1
- package/build/src/modeling/DataNamespace.d.ts +12 -1
- package/build/src/modeling/DataNamespace.d.ts.map +1 -1
- package/build/src/modeling/DataNamespace.js +45 -6
- package/build/src/modeling/DataNamespace.js.map +1 -1
- package/build/src/modeling/DataProperty.js +2 -2
- package/build/src/modeling/DataProperty.js.map +1 -1
- package/data/models/example-generator-api.json +18 -18
- package/package.json +1 -1
- package/src/modeling/DataAssociation.ts +11 -4
- package/src/modeling/DataEntity.ts +16 -8
- package/src/modeling/DataModel.ts +16 -11
- package/src/modeling/DataNamespace.ts +46 -6
- package/src/modeling/DataProperty.ts +2 -2
- package/tests/unit/modeling/data_association.spec.ts +2 -2
- package/tests/unit/modeling/data_entity.spec.ts +3 -3
- package/tests/unit/modeling/data_model.spec.ts +3 -3
- package/tests/unit/modeling/data_namespace.spec.ts +72 -3
- package/Local.session.sql +0 -0
|
@@ -1033,7 +1033,7 @@ test.group('getRoot()', (group) => {
|
|
|
1033
1033
|
})
|
|
1034
1034
|
})
|
|
1035
1035
|
|
|
1036
|
-
test.group('
|
|
1036
|
+
test.group('getParentInstance()', (group) => {
|
|
1037
1037
|
let root: DataNamespace
|
|
1038
1038
|
let n1: DataNamespace
|
|
1039
1039
|
let n2: DataNamespace
|
|
@@ -1045,12 +1045,12 @@ test.group('getParent()', (group) => {
|
|
|
1045
1045
|
})
|
|
1046
1046
|
|
|
1047
1047
|
test('returns undefined when called on the root namespace', ({ assert }) => {
|
|
1048
|
-
const result = root.
|
|
1048
|
+
const result = root.getParentInstance()
|
|
1049
1049
|
assert.isUndefined(result)
|
|
1050
1050
|
})
|
|
1051
1051
|
|
|
1052
1052
|
test('returns the parent namespace when called on a sub-namespace', ({ assert }) => {
|
|
1053
|
-
const result = n2.
|
|
1053
|
+
const result = n2.getParentInstance()
|
|
1054
1054
|
assert.deepEqual(result, n1)
|
|
1055
1055
|
})
|
|
1056
1056
|
})
|
|
@@ -1203,3 +1203,72 @@ test.group('adaptNamespace() - Circular Dependency', (group) => {
|
|
|
1203
1203
|
assert.doesNotThrow(() => n5.adaptNamespace(n2))
|
|
1204
1204
|
})
|
|
1205
1205
|
})
|
|
1206
|
+
|
|
1207
|
+
test.group('adaptDataModel()', (group) => {
|
|
1208
|
+
let root: DataNamespace
|
|
1209
|
+
let n1: DataNamespace
|
|
1210
|
+
let n2: DataNamespace
|
|
1211
|
+
let m1: DataModel
|
|
1212
|
+
let m2: DataModel
|
|
1213
|
+
|
|
1214
|
+
group.each.setup(() => {
|
|
1215
|
+
root = new DataNamespace()
|
|
1216
|
+
n1 = root.addNamespace('n1')
|
|
1217
|
+
n2 = root.addNamespace('n2')
|
|
1218
|
+
m1 = n1.addDataModel('m1')
|
|
1219
|
+
m2 = n1.addDataModel('m2')
|
|
1220
|
+
m1.addEntity('e1')
|
|
1221
|
+
})
|
|
1222
|
+
|
|
1223
|
+
test('moves a data model to a new parent', ({ assert }) => {
|
|
1224
|
+
n2.adaptDataModel(m1)
|
|
1225
|
+
const item1 = DataItem.dataModel(root, m1.key)
|
|
1226
|
+
const item2 = DataItem.dataModel(root, m2.key)
|
|
1227
|
+
assert.deepEqual(n1.items, [item2], 'removes from the old parent')
|
|
1228
|
+
assert.deepEqual(n2.items, [item1], 'adds to the new parent')
|
|
1229
|
+
assert.deepEqual(root.definitions.models, [m1, m2], 'keeps the data model in the root definitions')
|
|
1230
|
+
})
|
|
1231
|
+
|
|
1232
|
+
test('moves a data model to a new index', ({ assert }) => {
|
|
1233
|
+
const m3 = n2.addDataModel('m3')
|
|
1234
|
+
n2.adaptDataModel(m1, { index: 0 })
|
|
1235
|
+
const item1 = DataItem.dataModel(root, m1.key)
|
|
1236
|
+
const item2 = DataItem.dataModel(root, m2.key)
|
|
1237
|
+
const item3 = DataItem.dataModel(root, m3.key)
|
|
1238
|
+
assert.deepEqual(n1.items, [item2], 'removes from the old parent')
|
|
1239
|
+
assert.deepEqual(n2.items, [item1, item3], 'adds to the new parent')
|
|
1240
|
+
assert.deepEqual(root.definitions.models, [m1, m2, m3], 'keeps the data model in the root definitions')
|
|
1241
|
+
})
|
|
1242
|
+
|
|
1243
|
+
test('throws when adapting a data model from another root', ({ assert }) => {
|
|
1244
|
+
const otherRoot = new DataNamespace()
|
|
1245
|
+
const otherNs = otherRoot.addNamespace('other')
|
|
1246
|
+
const otherModel = otherNs.addDataModel('Other Data Model')
|
|
1247
|
+
assert.throws(
|
|
1248
|
+
() => n1.adaptDataModel(otherModel),
|
|
1249
|
+
`The data model ${otherModel.key} is not in the same namespace as this data namespace.`
|
|
1250
|
+
)
|
|
1251
|
+
})
|
|
1252
|
+
|
|
1253
|
+
test('throws when adapting a data model that is already adapted', ({ assert }) => {
|
|
1254
|
+
n2.adaptDataModel(m1)
|
|
1255
|
+
assert.throws(() => n2.adaptDataModel(m1), `The data model ${m1.key} is already adapted by this data namespace.`)
|
|
1256
|
+
})
|
|
1257
|
+
|
|
1258
|
+
test('throws when index is out of range (minimum)', ({ assert }) => {
|
|
1259
|
+
assert.throws(() => n2.adaptDataModel(m1, { index: -1 }), `The index -1 cannot be below 0.`)
|
|
1260
|
+
})
|
|
1261
|
+
|
|
1262
|
+
test('throws when index is out of range (maximum)', ({ assert }) => {
|
|
1263
|
+
assert.throws(() => n2.adaptDataModel(m1, { index: 1 }), `The index 1 is not valid.`)
|
|
1264
|
+
})
|
|
1265
|
+
|
|
1266
|
+
test('throws when adapting a data model from another namepsace', ({ assert }) => {
|
|
1267
|
+
const otherRoot = new DataNamespace()
|
|
1268
|
+
const otherModel = new DataModel(otherRoot)
|
|
1269
|
+
assert.throws(
|
|
1270
|
+
() => n1.adaptDataModel(otherModel),
|
|
1271
|
+
`The data model ${otherModel.key} is not in the same namespace as this data namespace.`
|
|
1272
|
+
)
|
|
1273
|
+
})
|
|
1274
|
+
})
|
package/Local.session.sql
DELETED
|
File without changes
|