@api-client/core 0.14.2 → 0.14.4

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 (86) hide show
  1. package/build/src/browser.d.ts +1 -1
  2. package/build/src/browser.d.ts.map +1 -1
  3. package/build/src/browser.js +1 -0
  4. package/build/src/browser.js.map +1 -1
  5. package/build/src/events/BaseEvents.d.ts +4 -0
  6. package/build/src/events/BaseEvents.d.ts.map +1 -1
  7. package/build/src/events/BaseEvents.js.map +1 -1
  8. package/build/src/index.d.ts +2 -1
  9. package/build/src/index.d.ts.map +1 -1
  10. package/build/src/index.js +2 -0
  11. package/build/src/index.js.map +1 -1
  12. package/build/src/modeling/ApiFile.d.ts +23 -0
  13. package/build/src/modeling/ApiFile.d.ts.map +1 -0
  14. package/build/src/modeling/ApiFile.js +44 -0
  15. package/build/src/modeling/ApiFile.js.map +1 -0
  16. package/build/src/modeling/ApiModel.d.ts +159 -0
  17. package/build/src/modeling/ApiModel.d.ts.map +1 -0
  18. package/build/src/modeling/ApiModel.js +237 -0
  19. package/build/src/modeling/ApiModel.js.map +1 -0
  20. package/build/src/modeling/DataDomain.d.ts +1 -1
  21. package/build/src/modeling/DataDomain.d.ts.map +1 -1
  22. package/build/src/modeling/DataDomain.js +1 -3
  23. package/build/src/modeling/DataDomain.js.map +1 -1
  24. package/build/src/modeling/DomainEntity.js +1 -1
  25. package/build/src/modeling/DomainEntity.js.map +1 -1
  26. package/build/src/modeling/DomainFile.d.ts +1 -2
  27. package/build/src/modeling/DomainFile.d.ts.map +1 -1
  28. package/build/src/modeling/DomainFile.js +3 -41
  29. package/build/src/modeling/DomainFile.js.map +1 -1
  30. package/build/src/modeling/Semantics.d.ts +55 -8
  31. package/build/src/modeling/Semantics.d.ts.map +1 -1
  32. package/build/src/modeling/Semantics.js +62 -8
  33. package/build/src/modeling/Semantics.js.map +1 -1
  34. package/build/src/modeling/amf/ShapeGenerator.d.ts.map +1 -1
  35. package/build/src/modeling/amf/ShapeGenerator.js.map +1 -1
  36. package/build/src/modeling/types.d.ts +491 -0
  37. package/build/src/modeling/types.d.ts.map +1 -1
  38. package/build/src/modeling/types.js.map +1 -1
  39. package/build/src/models/kinds.d.ts +3 -0
  40. package/build/src/models/kinds.d.ts.map +1 -1
  41. package/build/src/models/kinds.js +3 -0
  42. package/build/src/models/kinds.js.map +1 -1
  43. package/build/src/models/store/File.d.ts +19 -2
  44. package/build/src/models/store/File.d.ts.map +1 -1
  45. package/build/src/models/store/File.js +100 -13
  46. package/build/src/models/store/File.js.map +1 -1
  47. package/build/src/models/store/Group.d.ts +76 -2
  48. package/build/src/models/store/Group.d.ts.map +1 -1
  49. package/build/src/models/store/Group.js +84 -1
  50. package/build/src/models/store/Group.js.map +1 -1
  51. package/build/src/sdk/GroupsSdk.d.ts +41 -0
  52. package/build/src/sdk/GroupsSdk.d.ts.map +1 -0
  53. package/build/src/sdk/GroupsSdk.js +135 -0
  54. package/build/src/sdk/GroupsSdk.js.map +1 -0
  55. package/build/src/sdk/RouteBuilder.d.ts +2 -0
  56. package/build/src/sdk/RouteBuilder.d.ts.map +1 -1
  57. package/build/src/sdk/RouteBuilder.js +6 -0
  58. package/build/src/sdk/RouteBuilder.js.map +1 -1
  59. package/build/src/sdk/Sdk.d.ts +2 -0
  60. package/build/src/sdk/Sdk.d.ts.map +1 -1
  61. package/build/src/sdk/Sdk.js +5 -0
  62. package/build/src/sdk/Sdk.js.map +1 -1
  63. package/build/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +2 -3
  65. package/src/events/BaseEvents.ts +4 -0
  66. package/src/modeling/ApiFile.ts +53 -0
  67. package/src/modeling/ApiModel.ts +327 -0
  68. package/src/modeling/DataDomain.ts +1 -1
  69. package/src/modeling/DomainEntity.ts +1 -1
  70. package/src/modeling/DomainFile.ts +3 -40
  71. package/src/modeling/Semantics.ts +63 -8
  72. package/src/modeling/amf/ShapeGenerator.ts +1 -1
  73. package/src/modeling/types.ts +545 -0
  74. package/src/models/kinds.ts +3 -0
  75. package/src/models/store/File.ts +100 -13
  76. package/src/models/store/Group.ts +148 -2
  77. package/src/sdk/GroupsSdk.ts +150 -0
  78. package/src/sdk/RouteBuilder.ts +8 -0
  79. package/src/sdk/Sdk.ts +6 -0
  80. package/tests/unit/modeling/api_model.spec.ts +291 -0
  81. package/tests/unit/modeling/domain_entity.spec.ts +15 -15
  82. package/tests/unit/modeling/domain_file.spec.ts +1 -11
  83. package/tests/unit/modeling/domain_model_entities.spec.ts +2 -2
  84. package/tests/unit/modeling/semantics.spec.ts +8 -11
  85. package/tests/unit/models/File/constructor.spec.ts +3 -2
  86. package/tests/unit/models/File/shortcutTo.spec.ts +1 -1
@@ -17,7 +17,7 @@ test.group('DomainEntity.createSchema()', () => {
17
17
  assert.equal(schema.kind, DomainEntityKind)
18
18
  assert.typeOf(schema.key, 'string')
19
19
  assert.isNotEmpty(schema.key)
20
- assert.deepInclude(schema.info, { name: 'New entity' })
20
+ assert.deepInclude(schema.info, { name: 'new_entity' })
21
21
  assert.isUndefined(schema.tags)
22
22
  assert.isUndefined(schema.semantics)
23
23
  assert.isUndefined(schema.fields)
@@ -59,7 +59,7 @@ test.group('DomainEntity.createSchema()', () => {
59
59
  assert.equal(schema.kind, DomainEntityKind)
60
60
  assert.typeOf(schema.key, 'string')
61
61
  assert.isNotEmpty(schema.key)
62
- assert.deepInclude(schema.info, { name: 'New entity' })
62
+ assert.deepInclude(schema.info, { name: 'new_entity' })
63
63
  })
64
64
 
65
65
  test('creates a schema with tags', ({ assert }) => {
@@ -69,7 +69,7 @@ test.group('DomainEntity.createSchema()', () => {
69
69
  assert.equal(schema.kind, DomainEntityKind)
70
70
  assert.typeOf(schema.key, 'string')
71
71
  assert.isNotEmpty(schema.key)
72
- assert.deepInclude(schema.info, { name: 'New entity' })
72
+ assert.deepInclude(schema.info, { name: 'new_entity' })
73
73
  assert.deepEqual(schema.tags, ['tag1', 'tag2'])
74
74
  })
75
75
 
@@ -80,7 +80,7 @@ test.group('DomainEntity.createSchema()', () => {
80
80
  assert.equal(schema.kind, DomainEntityKind)
81
81
  assert.typeOf(schema.key, 'string')
82
82
  assert.isNotEmpty(schema.key)
83
- assert.deepInclude(schema.info, { name: 'New entity' })
83
+ assert.deepInclude(schema.info, { name: 'new_entity' })
84
84
  assert.deepEqual(schema.semantics, [{ id: SemanticType.User }])
85
85
  })
86
86
 
@@ -91,7 +91,7 @@ test.group('DomainEntity.createSchema()', () => {
91
91
  assert.equal(schema.kind, DomainEntityKind)
92
92
  assert.typeOf(schema.key, 'string')
93
93
  assert.isNotEmpty(schema.key)
94
- assert.deepInclude(schema.info, { name: 'New entity' })
94
+ assert.deepInclude(schema.info, { name: 'new_entity' })
95
95
  assert.deepEqual(schema.fields, [{ key: 'test-property', type: 'property' }])
96
96
  })
97
97
 
@@ -102,7 +102,7 @@ test.group('DomainEntity.createSchema()', () => {
102
102
  assert.equal(schema.kind, DomainEntityKind)
103
103
  assert.typeOf(schema.key, 'string')
104
104
  assert.isNotEmpty(schema.key)
105
- assert.deepInclude(schema.info, { name: 'New entity' })
105
+ assert.deepInclude(schema.info, { name: 'new_entity' })
106
106
  assert.isTrue(schema.deprecated)
107
107
  })
108
108
 
@@ -113,7 +113,7 @@ test.group('DomainEntity.createSchema()', () => {
113
113
  assert.equal(schema.kind, DomainEntityKind)
114
114
  assert.typeOf(schema.key, 'string')
115
115
  assert.isNotEmpty(schema.key)
116
- assert.deepInclude(schema.info, { name: 'New entity' })
116
+ assert.deepInclude(schema.info, { name: 'new_entity' })
117
117
  assert.isFalse(schema.deprecated)
118
118
  })
119
119
 
@@ -164,7 +164,7 @@ test.group('DomainEntity.constructor()', () => {
164
164
  assert.typeOf(entity.key, 'string')
165
165
  assert.isNotEmpty(entity.key)
166
166
  assert.instanceOf(entity.info, Thing)
167
- assert.equal(entity.info.name, 'New entity')
167
+ assert.equal(entity.info.name, 'new_entity')
168
168
  assert.deepEqual(entity.tags, [])
169
169
  assert.deepEqual(entity.semantics, [])
170
170
  assert.deepEqual(entity.fields, [])
@@ -213,7 +213,7 @@ test.group('DomainEntity.constructor()', () => {
213
213
  assert.typeOf(entity.key, 'string')
214
214
  assert.isNotEmpty(entity.key)
215
215
  assert.instanceOf(entity.info, Thing)
216
- assert.equal(entity.info.name, 'New entity')
216
+ assert.equal(entity.info.name, 'new_entity')
217
217
  })
218
218
 
219
219
  test('creates a new DomainEntity with tags', ({ assert }) => {
@@ -225,7 +225,7 @@ test.group('DomainEntity.constructor()', () => {
225
225
  assert.typeOf(entity.key, 'string')
226
226
  assert.isNotEmpty(entity.key)
227
227
  assert.instanceOf(entity.info, Thing)
228
- assert.equal(entity.info.name, 'New entity')
228
+ assert.equal(entity.info.name, 'new_entity')
229
229
  assert.deepEqual(entity.tags, ['tag1', 'tag2'])
230
230
  })
231
231
 
@@ -238,7 +238,7 @@ test.group('DomainEntity.constructor()', () => {
238
238
  assert.typeOf(entity.key, 'string')
239
239
  assert.isNotEmpty(entity.key)
240
240
  assert.instanceOf(entity.info, Thing)
241
- assert.equal(entity.info.name, 'New entity')
241
+ assert.equal(entity.info.name, 'new_entity')
242
242
  assert.deepEqual(entity.semantics, [{ id: SemanticType.User }])
243
243
  })
244
244
 
@@ -251,7 +251,7 @@ test.group('DomainEntity.constructor()', () => {
251
251
  assert.typeOf(entity.key, 'string')
252
252
  assert.isNotEmpty(entity.key)
253
253
  assert.instanceOf(entity.info, Thing)
254
- assert.equal(entity.info.name, 'New entity')
254
+ assert.equal(entity.info.name, 'new_entity')
255
255
  assert.deepEqual(entity.fields, [{ key: 'test-property', type: 'property' }])
256
256
  })
257
257
 
@@ -264,7 +264,7 @@ test.group('DomainEntity.constructor()', () => {
264
264
  assert.typeOf(entity.key, 'string')
265
265
  assert.isNotEmpty(entity.key)
266
266
  assert.instanceOf(entity.info, Thing)
267
- assert.equal(entity.info.name, 'New entity')
267
+ assert.equal(entity.info.name, 'new_entity')
268
268
  assert.isTrue(entity.deprecated)
269
269
  })
270
270
 
@@ -277,7 +277,7 @@ test.group('DomainEntity.constructor()', () => {
277
277
  assert.typeOf(entity.key, 'string')
278
278
  assert.isNotEmpty(entity.key)
279
279
  assert.instanceOf(entity.info, Thing)
280
- assert.equal(entity.info.name, 'New entity')
280
+ assert.equal(entity.info.name, 'new_entity')
281
281
  assert.isFalse(entity.deprecated)
282
282
  })
283
283
 
@@ -350,7 +350,7 @@ test.group('DomainEntity.toJSON()', () => {
350
350
  const json = entity.toJSON()
351
351
  assert.equal(json.kind, DomainEntityKind)
352
352
  assert.equal(json.key, entity.key)
353
- assert.deepInclude(json.info, { name: 'New entity' })
353
+ assert.deepInclude(json.info, { name: 'new_entity' })
354
354
  assert.isUndefined(json.tags)
355
355
  assert.isUndefined(json.semantics)
356
356
  assert.isUndefined(json.fields)
@@ -99,22 +99,12 @@ test.group('constructor()', () => {
99
99
  ],
100
100
  lastModified: { byMe: false, time: 0, user: 'id', name: 'test' },
101
101
  }
102
- const result = new DomainFile(JSON.stringify(schema))
102
+ const result = new DomainFile(schema)
103
103
  assert.equal(result.kind, DomainFileKind)
104
104
  assert.equal(result.info.name, 'hello')
105
105
  assert.equal(result.key, '123')
106
106
  assert.deepEqual(result.lastModified, schema.lastModified)
107
107
  })
108
-
109
- test('throws when invalid schema', ({ assert }) => {
110
- assert.throws(() => {
111
- new DomainFile(
112
- JSON.stringify({
113
- name: 'a name',
114
- })
115
- )
116
- })
117
- })
118
108
  })
119
109
 
120
110
  test.group('toJSON()', () => {
@@ -9,7 +9,7 @@ test.group('DomainModel.addEntity()', () => {
9
9
  assert.instanceOf(entity, DomainEntity)
10
10
  assert.equal(entity.kind, DomainEntityKind)
11
11
  assert.equal(entity.key, 'test-entity')
12
- assert.deepInclude(entity.info, { name: 'New entity' })
12
+ assert.deepInclude(entity.info, { name: 'new_entity' })
13
13
  assert.isTrue(dataDomain.graph.hasNode(entity.key))
14
14
  assert.equal(dataDomain.graph.parent(entity.key), model.key)
15
15
  })
@@ -22,7 +22,7 @@ test.group('DomainModel.addEntity()', () => {
22
22
  assert.equal(entity.kind, DomainEntityKind)
23
23
  assert.typeOf(entity.key, 'string')
24
24
  assert.isNotEmpty(entity.key)
25
- assert.deepInclude(entity.info, { name: 'New entity' })
25
+ assert.deepInclude(entity.info, { name: 'new_entity' })
26
26
  assert.isTrue(dataDomain.graph.hasNode(entity.key))
27
27
  assert.equal(dataDomain.graph.parent(entity.key), model.key)
28
28
  })
@@ -14,17 +14,14 @@ import {
14
14
 
15
15
  test.group('Semantics', () => {
16
16
  test('SemanticType enum should have correct values', ({ assert }) => {
17
- assert.equal(SemanticType.User, 'https://apinow.app/semantics/entities/#User')
18
- assert.equal(SemanticType.CreatedTimestamp, 'https://apinow.app/semantics/properties/#CreatedTimestamp')
19
- assert.equal(SemanticType.UpdatedTimestamp, 'https://apinow.app/semantics/properties/#UpdatedTimestamp')
20
- assert.equal(SemanticType.DeletedTimestamp, 'https://apinow.app/semantics/properties/#DeletedTimestamp')
21
- assert.equal(SemanticType.DeletedFlag, 'https://apinow.app/semantics/properties/#DeletedFlag')
22
- assert.equal(SemanticType.PublicUniqueName, 'https://apinow.app/semantics/properties/#PublicUniqueName')
23
- assert.equal(SemanticType.UserRole, 'https://apinow.app/semantics/entities/#UserRole')
24
- assert.equal(
25
- SemanticType.ResourceOwnerIdentifier,
26
- 'https://apinow.app/semantics/associations/#ResourceOwnerIdentifier'
27
- )
17
+ assert.equal(SemanticType.User, 'Semantic#User')
18
+ assert.equal(SemanticType.CreatedTimestamp, 'Semantic#CreatedTimestamp')
19
+ assert.equal(SemanticType.UpdatedTimestamp, 'Semantic#UpdatedTimestamp')
20
+ assert.equal(SemanticType.DeletedTimestamp, 'Semantic#DeletedTimestamp')
21
+ assert.equal(SemanticType.DeletedFlag, 'Semantic#DeletedFlag')
22
+ assert.equal(SemanticType.PublicUniqueName, 'Semantic#PublicUniqueName')
23
+ assert.equal(SemanticType.UserRole, 'Semantic#UserRole')
24
+ assert.equal(SemanticType.ResourceOwnerIdentifier, 'Semantic#ResourceOwnerIdentifier')
28
25
  })
29
26
 
30
27
  test('SemanticScope enum should have correct values', ({ assert }) => {
@@ -5,8 +5,9 @@ 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.equal(result.key, '')
9
- assert.deepEqual(result.info.toJSON(), { kind: ThingKind, name: '' })
8
+ assert.isString(result.key, 'has the key')
9
+ assert.isNotEmpty(result.key, 'key is not empty')
10
+ assert.deepEqual(result.info.toJSON(), { kind: ThingKind, name: 'Unnamed file' })
10
11
  assert.deepEqual(result.parents, [])
11
12
  assert.deepEqual(result.permissionIds, [])
12
13
  assert.isFalse(result.deleted, 'deleted')
@@ -46,7 +46,7 @@ test.group('File.shortcutTo()', () => {
46
46
  })
47
47
 
48
48
  test('creates a shortcut from a name with fromName()', ({ assert }) => {
49
- const file = File.fromName('test-file')
49
+ const file = File.fromName('test-file', 'shortcut')
50
50
  const targetId = 'target-file-id'
51
51
  file.shortcutTo(targetId)
52
52
  assert.equal(file.shortcutTarget, targetId)