@api-client/core 0.19.17 → 0.19.19
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/src/browser.d.ts +12 -12
- package/build/src/browser.d.ts.map +1 -1
- package/build/src/browser.js +3 -3
- package/build/src/browser.js.map +1 -1
- package/build/src/index.d.ts +12 -12
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +3 -3
- package/build/src/index.js.map +1 -1
- package/build/src/mocking/ProjectMock.d.ts +1 -1
- package/build/src/mocking/ProjectMock.d.ts.map +1 -1
- package/build/src/mocking/ProjectMock.js.map +1 -1
- package/build/src/mocking/lib/File.d.ts +5 -5
- package/build/src/mocking/lib/File.d.ts.map +1 -1
- package/build/src/mocking/lib/File.js.map +1 -1
- package/build/src/mocking/lib/Organization.d.ts +7 -3
- package/build/src/mocking/lib/Organization.d.ts.map +1 -1
- package/build/src/mocking/lib/Organization.js +19 -1
- package/build/src/mocking/lib/Organization.js.map +1 -1
- package/build/src/mocking/lib/Permission.d.ts +6 -6
- package/build/src/mocking/lib/Permission.d.ts.map +1 -1
- package/build/src/mocking/lib/Permission.js.map +1 -1
- package/build/src/mocking/lib/User.d.ts +8 -4
- package/build/src/mocking/lib/User.d.ts.map +1 -1
- package/build/src/mocking/lib/User.js.map +1 -1
- package/build/src/modeling/ApiFile.d.ts +8 -4
- package/build/src/modeling/ApiFile.d.ts.map +1 -1
- package/build/src/modeling/ApiFile.js.map +1 -1
- package/build/src/modeling/ApiModel.d.ts +2 -2
- package/build/src/modeling/ApiModel.d.ts.map +1 -1
- package/build/src/modeling/ApiModel.js.map +1 -1
- package/build/src/modeling/DataDomain.d.ts +2 -2
- package/build/src/modeling/DataDomain.d.ts.map +1 -1
- package/build/src/modeling/DataDomain.js.map +1 -1
- package/build/src/modeling/DomainAssociation.d.ts +2 -2
- package/build/src/modeling/DomainAssociation.d.ts.map +1 -1
- package/build/src/modeling/DomainAssociation.js.map +1 -1
- package/build/src/modeling/DomainEntity.d.ts +2 -2
- package/build/src/modeling/DomainEntity.d.ts.map +1 -1
- package/build/src/modeling/DomainEntity.js.map +1 -1
- package/build/src/modeling/DomainFile.d.ts +8 -4
- package/build/src/modeling/DomainFile.d.ts.map +1 -1
- package/build/src/modeling/DomainFile.js.map +1 -1
- package/build/src/modeling/DomainModel.d.ts +2 -2
- package/build/src/modeling/DomainModel.d.ts.map +1 -1
- package/build/src/modeling/DomainModel.js.map +1 -1
- package/build/src/modeling/DomainNamespace.d.ts +2 -2
- package/build/src/modeling/DomainNamespace.d.ts.map +1 -1
- package/build/src/modeling/DomainNamespace.js.map +1 -1
- package/build/src/modeling/DomainProperty.d.ts +2 -2
- package/build/src/modeling/DomainProperty.d.ts.map +1 -1
- package/build/src/modeling/DomainProperty.js.map +1 -1
- package/build/src/modeling/helpers/Intelisense.d.ts +38 -38
- package/build/src/modeling/helpers/Intelisense.d.ts.map +1 -1
- package/build/src/modeling/helpers/Intelisense.js.map +1 -1
- package/build/src/models/AiMessage.d.ts +3 -3
- package/build/src/models/AiMessage.d.ts.map +1 -1
- package/build/src/models/AiMessage.js.map +1 -1
- package/build/src/models/AiSession.d.ts +3 -3
- package/build/src/models/AiSession.d.ts.map +1 -1
- package/build/src/models/AiSession.js.map +1 -1
- package/build/src/models/CertificateFile.d.ts +2 -2
- package/build/src/models/CertificateFile.d.ts.map +1 -1
- package/build/src/models/CertificateFile.js.map +1 -1
- package/build/src/models/Environment.d.ts +2 -2
- package/build/src/models/Environment.d.ts.map +1 -1
- package/build/src/models/Environment.js.map +1 -1
- package/build/src/models/Folder.d.ts +9 -5
- package/build/src/models/Folder.d.ts.map +1 -1
- package/build/src/models/Folder.js.map +1 -1
- package/build/src/models/HttpProject.d.ts +2 -2
- package/build/src/models/HttpProject.d.ts.map +1 -1
- package/build/src/models/HttpProject.js.map +1 -1
- package/build/src/models/ProjectFolder.d.ts +2 -2
- package/build/src/models/ProjectFolder.d.ts.map +1 -1
- package/build/src/models/ProjectFolder.js.map +1 -1
- package/build/src/models/Request.d.ts +3 -3
- package/build/src/models/Request.d.ts.map +1 -1
- package/build/src/models/Request.js.map +1 -1
- package/build/src/models/Thing.d.ts +9 -5
- package/build/src/models/Thing.d.ts.map +1 -1
- package/build/src/models/Thing.js.map +1 -1
- package/build/src/models/TrashEntry.d.ts +2 -2
- package/build/src/models/TrashEntry.d.ts.map +1 -1
- package/build/src/models/TrashEntry.js.map +1 -1
- package/build/src/models/store/Capabilities.d.ts +5 -1
- package/build/src/models/store/Capabilities.d.ts.map +1 -1
- package/build/src/models/store/Capabilities.js.map +1 -1
- package/build/src/models/store/Deletion.d.ts +5 -1
- package/build/src/models/store/Deletion.d.ts.map +1 -1
- package/build/src/models/store/Deletion.js.map +1 -1
- package/build/src/models/store/File.d.ts +45 -37
- package/build/src/models/store/File.d.ts.map +1 -1
- package/build/src/models/store/File.js +1 -1
- package/build/src/models/store/File.js.map +1 -1
- package/build/src/models/store/Group.d.ts +3 -3
- package/build/src/models/store/Group.d.ts.map +1 -1
- package/build/src/models/store/Group.js.map +1 -1
- package/build/src/models/store/Invitation.d.ts +3 -3
- package/build/src/models/store/Invitation.d.ts.map +1 -1
- package/build/src/models/store/Invitation.js.map +1 -1
- package/build/src/models/store/Modification.d.ts +5 -1
- package/build/src/models/store/Modification.d.ts.map +1 -1
- package/build/src/models/store/Modification.js.map +1 -1
- package/build/src/models/store/Organization.d.ts +31 -13
- package/build/src/models/store/Organization.d.ts.map +1 -1
- package/build/src/models/store/Organization.js +29 -47
- package/build/src/models/store/Organization.js.map +1 -1
- package/build/src/models/store/Permission.d.ts +9 -5
- package/build/src/models/store/Permission.d.ts.map +1 -1
- package/build/src/models/store/Permission.js.map +1 -1
- package/build/src/models/store/User.d.ts +18 -6
- package/build/src/models/store/User.d.ts.map +1 -1
- package/build/src/models/store/User.js.map +1 -1
- package/build/src/models/store/UserIdentity.d.ts +9 -5
- package/build/src/models/store/UserIdentity.d.ts.map +1 -1
- package/build/src/models/store/UserIdentity.js.map +1 -1
- package/build/src/sdk/FilesSdk.d.ts +15 -15
- package/build/src/sdk/FilesSdk.d.ts.map +1 -1
- package/build/src/sdk/FilesSdk.js +1 -1
- package/build/src/sdk/FilesSdk.js.map +1 -1
- package/build/src/sdk/OrganizationsSdk.d.ts +25 -9
- package/build/src/sdk/OrganizationsSdk.d.ts.map +1 -1
- package/build/src/sdk/OrganizationsSdk.js +76 -0
- package/build/src/sdk/OrganizationsSdk.js.map +1 -1
- package/build/src/sdk/RouteBuilder.d.ts +2 -0
- package/build/src/sdk/RouteBuilder.d.ts.map +1 -1
- package/build/src/sdk/RouteBuilder.js +6 -0
- package/build/src/sdk/RouteBuilder.js.map +1 -1
- package/build/src/sdk/SdkMock.d.ts +12 -0
- package/build/src/sdk/SdkMock.d.ts.map +1 -1
- package/build/src/sdk/SdkMock.js +38 -6
- package/build/src/sdk/SdkMock.js.map +1 -1
- package/build/src/sdk/SharedSdk.d.ts +2 -2
- package/build/src/sdk/SharedSdk.d.ts.map +1 -1
- package/build/src/sdk/SharedSdk.js.map +1 -1
- package/build/src/sdk/StoreSdkNode.d.ts +1 -1
- package/build/src/sdk/StoreSdkNode.d.ts.map +1 -1
- package/build/src/sdk/StoreSdkNode.js.map +1 -1
- package/build/src/sdk/StoreSdkWeb.d.ts +1 -1
- package/build/src/sdk/StoreSdkWeb.d.ts.map +1 -1
- package/build/src/sdk/StoreSdkWeb.js.map +1 -1
- package/build/src/sdk/UsersSdk.d.ts +5 -5
- package/build/src/sdk/UsersSdk.d.ts.map +1 -1
- package/build/src/sdk/UsersSdk.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/mocking/ProjectMock.ts +1 -1
- package/src/mocking/lib/File.ts +5 -5
- package/src/mocking/lib/Organization.ts +26 -3
- package/src/mocking/lib/Permission.ts +8 -8
- package/src/mocking/lib/User.ts +11 -6
- package/src/modeling/ApiFile.ts +11 -6
- package/src/modeling/ApiModel.ts +2 -2
- package/src/modeling/DataDomain.ts +2 -2
- package/src/modeling/DomainAssociation.ts +2 -2
- package/src/modeling/DomainEntity.ts +2 -2
- package/src/modeling/DomainFile.ts +11 -6
- package/src/modeling/DomainModel.ts +2 -2
- package/src/modeling/DomainNamespace.ts +2 -2
- package/src/modeling/DomainProperty.ts +2 -2
- package/src/modeling/helpers/Intelisense.ts +41 -38
- package/src/models/AiMessage.ts +3 -3
- package/src/models/AiSession.ts +3 -3
- package/src/models/CertificateFile.ts +2 -2
- package/src/models/Environment.ts +2 -2
- package/src/models/Folder.ts +13 -8
- package/src/models/HttpProject.ts +2 -2
- package/src/models/ProjectFolder.ts +2 -2
- package/src/models/Request.ts +3 -3
- package/src/models/Thing.ts +14 -9
- package/src/models/TrashEntry.ts +2 -2
- package/src/models/store/Capabilities.ts +6 -1
- package/src/models/store/Deletion.ts +6 -1
- package/src/models/store/File.ts +53 -43
- package/src/models/store/Group.ts +3 -3
- package/src/models/store/Invitation.ts +3 -3
- package/src/models/store/Modification.ts +6 -1
- package/src/models/store/Organization.ts +59 -60
- package/src/models/store/Permission.ts +17 -12
- package/src/models/store/User.ts +21 -6
- package/src/models/store/UserIdentity.ts +13 -8
- package/src/sdk/FilesSdk.ts +29 -25
- package/src/sdk/OrganizationsSdk.ts +100 -16
- package/src/sdk/RouteBuilder.ts +8 -0
- package/src/sdk/SdkMock.ts +66 -16
- package/src/sdk/SharedSdk.ts +3 -3
- package/src/sdk/StoreSdkNode.ts +3 -3
- package/src/sdk/StoreSdkWeb.ts +3 -3
- package/src/sdk/UsersSdk.ts +6 -6
- package/tests/unit/mocking/current/File.spec.ts +5 -5
- package/tests/unit/mocking/current/Organization.spec.ts +4 -3
- package/tests/unit/mocking/current/Permission.spec.ts +2 -2
- package/tests/unit/mocking/current/User.spec.ts +2 -2
- package/tests/unit/modeling/domain_file.spec.ts +3 -3
- package/tests/unit/models/File/createFileCapabilities.spec.ts +3 -3
- package/tests/unit/models/File/new.spec.ts +2 -2
- package/tests/unit/models/File/setDeleted.spec.ts +3 -3
- package/tests/unit/models/File/setLastModified.spec.ts +3 -3
- package/tests/unit/models/File/toJSON.spec.ts +2 -2
- package/tests/unit/models/Folder/create.spec.ts +3 -3
- package/tests/unit/models/Permission/all.spec.ts +3 -3
- package/tests/unit/models/store/Invitation.spec.ts +2 -2
- package/tests/unit/models/store/Organization.spec.ts +100 -0
- package/tests/unit/models/store/Permission.spec.ts +16 -6
- package/tests/unit/models/thing.spec.ts +3 -3
package/src/sdk/SdkMock.ts
CHANGED
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
type InterceptOptions,
|
|
7
7
|
type SerializedRequest,
|
|
8
8
|
} from '@jarrodek/amw'
|
|
9
|
-
import type {
|
|
9
|
+
import type { OrganizationSchema } from '../models/store/Organization.js'
|
|
10
10
|
import type { GroupSchema } from '../models/store/Group.js'
|
|
11
|
-
import type {
|
|
11
|
+
import type { UserSchema } from '../models/store/User.js'
|
|
12
12
|
import type { InvitationSchema } from '../models/store/Invitation.js'
|
|
13
|
-
import { type
|
|
13
|
+
import { type FileSchema, type FileBreadcrumb } from '../models/store/File.js'
|
|
14
14
|
import type { ContextChangeRecord, ContextListResult, IBulkOperationResult } from '../events/BaseEvents.js'
|
|
15
15
|
import type { TrashEntry } from '../models/TrashEntry.js'
|
|
16
16
|
import { RouteBuilder } from './RouteBuilder.js'
|
|
@@ -208,7 +208,7 @@ export class SdkMock {
|
|
|
208
208
|
// body: JSON.stringify({
|
|
209
209
|
// items: this.gen.organization.organizations(init?.size ?? 5),
|
|
210
210
|
// cursor: this.createCursorOption(init),
|
|
211
|
-
// } as ContextListResult<
|
|
211
|
+
// } as ContextListResult<OrganizationSchema>),
|
|
212
212
|
// }
|
|
213
213
|
const respond = this.createDefaultResponse(
|
|
214
214
|
200,
|
|
@@ -217,7 +217,7 @@ export class SdkMock {
|
|
|
217
217
|
JSON.stringify({
|
|
218
218
|
items: this.gen.organization.organizations(init?.size ?? 5),
|
|
219
219
|
cursor: this.createCursorOption(init),
|
|
220
|
-
} as ContextListResult<
|
|
220
|
+
} as ContextListResult<OrganizationSchema>),
|
|
221
221
|
init
|
|
222
222
|
)
|
|
223
223
|
await mock.add(
|
|
@@ -454,13 +454,13 @@ export class SdkMock {
|
|
|
454
454
|
// body: JSON.stringify({
|
|
455
455
|
// items: this.gen.users.users(init?.size ?? 5),
|
|
456
456
|
// cursor: this.createCursorOption(init),
|
|
457
|
-
// } as ContextListResult<
|
|
457
|
+
// } as ContextListResult<UserSchema>),
|
|
458
458
|
// }
|
|
459
459
|
const respond = this.createDefaultResponse(
|
|
460
460
|
200,
|
|
461
461
|
{ 'content-type': 'application/json' },
|
|
462
462
|
() => {
|
|
463
|
-
const obj: ContextListResult<
|
|
463
|
+
const obj: ContextListResult<UserSchema> = {
|
|
464
464
|
items: this.gen.users.users(init?.size ?? 5),
|
|
465
465
|
cursor: this.createCursorOption(init),
|
|
466
466
|
}
|
|
@@ -512,7 +512,7 @@ export class SdkMock {
|
|
|
512
512
|
body: JSON.stringify({
|
|
513
513
|
items: this.gen.users.users(init?.size ?? 5),
|
|
514
514
|
cursor: this.createCursorOption(init),
|
|
515
|
-
} as ContextListResult<
|
|
515
|
+
} as ContextListResult<UserSchema>),
|
|
516
516
|
}
|
|
517
517
|
await mock.add(
|
|
518
518
|
{
|
|
@@ -591,6 +591,56 @@ export class SdkMock {
|
|
|
591
591
|
)
|
|
592
592
|
},
|
|
593
593
|
},
|
|
594
|
+
|
|
595
|
+
slugs: {
|
|
596
|
+
/**
|
|
597
|
+
* Mocks the `slugs.validate()` method.
|
|
598
|
+
* @param options Optional response customization.
|
|
599
|
+
*/
|
|
600
|
+
validate: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
601
|
+
const { mock } = this
|
|
602
|
+
const respond = this.createDefaultResponse(
|
|
603
|
+
200,
|
|
604
|
+
{ 'content-type': 'application/json' },
|
|
605
|
+
() => JSON.stringify(this.gen.organization.organizationSlugValidateResponse()),
|
|
606
|
+
init
|
|
607
|
+
)
|
|
608
|
+
await mock.add(
|
|
609
|
+
{
|
|
610
|
+
match: {
|
|
611
|
+
uri: RouteBuilder.orgSlugValidate(),
|
|
612
|
+
methods: ['POST'],
|
|
613
|
+
},
|
|
614
|
+
respond,
|
|
615
|
+
},
|
|
616
|
+
options
|
|
617
|
+
)
|
|
618
|
+
},
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Mocks the `slugs.generate()` method.
|
|
622
|
+
* @param options Optional response customization.
|
|
623
|
+
*/
|
|
624
|
+
generate: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
625
|
+
const { mock } = this
|
|
626
|
+
const respond = this.createDefaultResponse(
|
|
627
|
+
200,
|
|
628
|
+
{ 'content-type': 'application/json' },
|
|
629
|
+
() => JSON.stringify(this.gen.organization.organizationSlugGenerateResponse()),
|
|
630
|
+
init
|
|
631
|
+
)
|
|
632
|
+
await mock.add(
|
|
633
|
+
{
|
|
634
|
+
match: {
|
|
635
|
+
uri: RouteBuilder.orgSlugGenerate(),
|
|
636
|
+
methods: ['POST'],
|
|
637
|
+
},
|
|
638
|
+
respond,
|
|
639
|
+
},
|
|
640
|
+
options
|
|
641
|
+
)
|
|
642
|
+
},
|
|
643
|
+
},
|
|
594
644
|
}
|
|
595
645
|
|
|
596
646
|
/**
|
|
@@ -1004,13 +1054,13 @@ export class SdkMock {
|
|
|
1004
1054
|
// body: JSON.stringify({
|
|
1005
1055
|
// items: this.gen.files.files(init?.size ?? 5),
|
|
1006
1056
|
// cursor: this.createCursorOption(init),
|
|
1007
|
-
// } as ContextListResult<
|
|
1057
|
+
// } as ContextListResult<FileSchema>),
|
|
1008
1058
|
// }
|
|
1009
1059
|
const respond = this.createDefaultResponse(
|
|
1010
1060
|
200,
|
|
1011
1061
|
{ 'content-type': 'application/json' },
|
|
1012
1062
|
() => {
|
|
1013
|
-
const obj: ContextListResult<
|
|
1063
|
+
const obj: ContextListResult<FileSchema> = {
|
|
1014
1064
|
items: this.gen.files.files(init?.size ?? 5),
|
|
1015
1065
|
cursor: this.createCursorOption(init),
|
|
1016
1066
|
}
|
|
@@ -1190,13 +1240,13 @@ export class SdkMock {
|
|
|
1190
1240
|
// headers: { 'content-type': 'application/json' },
|
|
1191
1241
|
// body: JSON.stringify({
|
|
1192
1242
|
// items: this.gen.files.files(init?.size ?? 5),
|
|
1193
|
-
// } as IBulkOperationResult<
|
|
1243
|
+
// } as IBulkOperationResult<FileSchema>),
|
|
1194
1244
|
// }
|
|
1195
1245
|
const respond = this.createDefaultResponse(
|
|
1196
1246
|
200,
|
|
1197
1247
|
{ 'content-type': 'application/json' },
|
|
1198
1248
|
() => {
|
|
1199
|
-
const obj: IBulkOperationResult<
|
|
1249
|
+
const obj: IBulkOperationResult<FileSchema> = {
|
|
1200
1250
|
items: this.gen.files.files(init?.size ?? 5),
|
|
1201
1251
|
}
|
|
1202
1252
|
return JSON.stringify(obj)
|
|
@@ -1366,13 +1416,13 @@ export class SdkMock {
|
|
|
1366
1416
|
// body: JSON.stringify({
|
|
1367
1417
|
// items: this.gen.users.users(init?.size ?? 5),
|
|
1368
1418
|
// cursor: this.createCursorOption(init),
|
|
1369
|
-
// } as ContextListResult<
|
|
1419
|
+
// } as ContextListResult<UserSchema>),
|
|
1370
1420
|
// }
|
|
1371
1421
|
const respond = this.createDefaultResponse(
|
|
1372
1422
|
200,
|
|
1373
1423
|
{ 'content-type': 'application/json' },
|
|
1374
1424
|
() => {
|
|
1375
|
-
const obj: ContextListResult<
|
|
1425
|
+
const obj: ContextListResult<UserSchema> = {
|
|
1376
1426
|
items: this.gen.users.users(init?.size ?? 5),
|
|
1377
1427
|
cursor: this.createCursorOption(init),
|
|
1378
1428
|
}
|
|
@@ -1447,13 +1497,13 @@ export class SdkMock {
|
|
|
1447
1497
|
// body: JSON.stringify({
|
|
1448
1498
|
// items: this.gen.files.files(init?.size ?? 5),
|
|
1449
1499
|
// cursor: this.createCursorOption(init),
|
|
1450
|
-
// } as ContextListResult<
|
|
1500
|
+
// } as ContextListResult<FileSchema>),
|
|
1451
1501
|
// }
|
|
1452
1502
|
const respond = this.createDefaultResponse(
|
|
1453
1503
|
200,
|
|
1454
1504
|
{ 'content-type': 'application/json' },
|
|
1455
1505
|
() => {
|
|
1456
|
-
const obj: ContextListResult<
|
|
1506
|
+
const obj: ContextListResult<FileSchema> = {
|
|
1457
1507
|
items: this.gen.files.files(init?.size ?? 5),
|
|
1458
1508
|
cursor: this.createCursorOption(init),
|
|
1459
1509
|
}
|
package/src/sdk/SharedSdk.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
SdkOptions,
|
|
8
8
|
} from './SdkBase.js'
|
|
9
9
|
import { RouteBuilder } from './RouteBuilder.js'
|
|
10
|
-
import {
|
|
10
|
+
import { FileSchema } from '../models/store/File.js'
|
|
11
11
|
import { ContextListOptions, ContextListResult } from '../events/BaseEvents.js'
|
|
12
12
|
import { Exception } from '../exceptions/exception.js'
|
|
13
13
|
|
|
@@ -23,7 +23,7 @@ export class SharedSdk extends SdkBase {
|
|
|
23
23
|
organization: string,
|
|
24
24
|
options?: ContextListOptions,
|
|
25
25
|
request: SdkOptions = {}
|
|
26
|
-
): Promise<ContextListResult<
|
|
26
|
+
): Promise<ContextListResult<FileSchema>> {
|
|
27
27
|
const { token } = request
|
|
28
28
|
const url = this.sdk.getUrl(RouteBuilder.shared(organization))
|
|
29
29
|
this.sdk.appendListOptions(url, options)
|
|
@@ -37,7 +37,7 @@ export class SharedSdk extends SdkBase {
|
|
|
37
37
|
if (!result.body) {
|
|
38
38
|
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
39
39
|
}
|
|
40
|
-
let data: ContextListResult<
|
|
40
|
+
let data: ContextListResult<FileSchema>
|
|
41
41
|
try {
|
|
42
42
|
data = JSON.parse(result.body)
|
|
43
43
|
} catch {
|
package/src/sdk/StoreSdkNode.ts
CHANGED
|
@@ -9,9 +9,9 @@ export type { IMetaCreateOptions, IMediaCreateOptions, IFileCreateOptions, ListF
|
|
|
9
9
|
export type {
|
|
10
10
|
IJwtInfo,
|
|
11
11
|
IJwtUser,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
RegistrationInfoSchema,
|
|
13
|
+
OrganizationRegistrationInfoSchema,
|
|
14
|
+
OrganizationAddUserInfoSchema,
|
|
15
15
|
} from './UsersSdk.js'
|
|
16
16
|
export type { DataCatalogListOptions } from './DataCatalogSdk.js'
|
|
17
17
|
|
package/src/sdk/StoreSdkWeb.ts
CHANGED
|
@@ -9,9 +9,9 @@ export type { IMetaCreateOptions, IMediaCreateOptions, IFileCreateOptions, ListF
|
|
|
9
9
|
export type {
|
|
10
10
|
IJwtInfo,
|
|
11
11
|
IJwtUser,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
RegistrationInfoSchema,
|
|
13
|
+
OrganizationRegistrationInfoSchema,
|
|
14
|
+
OrganizationAddUserInfoSchema,
|
|
15
15
|
} from './UsersSdk.js'
|
|
16
16
|
export type { DataCatalogListOptions } from './DataCatalogSdk.js'
|
|
17
17
|
|
package/src/sdk/UsersSdk.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
SdkOptions,
|
|
8
8
|
} from './SdkBase.js'
|
|
9
9
|
import { RouteBuilder } from './RouteBuilder.js'
|
|
10
|
-
import {
|
|
10
|
+
import { UserSchema } from '../models/store/User.js'
|
|
11
11
|
import { Exception } from '../exceptions/exception.js'
|
|
12
12
|
|
|
13
13
|
export interface IJwtInfo {
|
|
@@ -51,7 +51,7 @@ export interface IJwtUser {
|
|
|
51
51
|
hd?: string
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
export interface
|
|
54
|
+
export interface RegistrationInfoSchema {
|
|
55
55
|
reason: 'new-organization' | 'existing-organization'
|
|
56
56
|
/**
|
|
57
57
|
* The decoded JWT user information.
|
|
@@ -60,7 +60,7 @@ export interface IRegistrationInfo {
|
|
|
60
60
|
user: IJwtInfo
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export interface
|
|
63
|
+
export interface OrganizationRegistrationInfoSchema extends RegistrationInfoSchema {
|
|
64
64
|
reason: 'new-organization'
|
|
65
65
|
/**
|
|
66
66
|
* The name of the organization to create for the user.
|
|
@@ -68,7 +68,7 @@ export interface IOrganizationRegistrationInfo extends IRegistrationInfo {
|
|
|
68
68
|
organizationName: string
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
export interface
|
|
71
|
+
export interface OrganizationAddUserInfoSchema extends RegistrationInfoSchema {
|
|
72
72
|
reason: 'existing-organization'
|
|
73
73
|
/**
|
|
74
74
|
* Set when adding a user to an existing organization.
|
|
@@ -85,7 +85,7 @@ export class UsersSdk extends SdkBase {
|
|
|
85
85
|
* Reads the current user.
|
|
86
86
|
* @param request Optional request options.
|
|
87
87
|
*/
|
|
88
|
-
async me(request: SdkOptions = {}): Promise<
|
|
88
|
+
async me(request: SdkOptions = {}): Promise<UserSchema> {
|
|
89
89
|
const { token } = request
|
|
90
90
|
const url = this.sdk.getUrl(RouteBuilder.usersMe())
|
|
91
91
|
const result = await this.sdk.http.get(url.toString(), { token })
|
|
@@ -98,7 +98,7 @@ export class UsersSdk extends SdkBase {
|
|
|
98
98
|
if (!result.body) {
|
|
99
99
|
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
100
100
|
}
|
|
101
|
-
let data:
|
|
101
|
+
let data: UserSchema
|
|
102
102
|
try {
|
|
103
103
|
data = JSON.parse(result.body)
|
|
104
104
|
} catch {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { test } from '@japa/runner'
|
|
2
2
|
import { File } from '../../../../src/mocking/lib/File.js'
|
|
3
3
|
import { FolderKind, ProjectKind } from '../../../../src/models/kinds.js'
|
|
4
|
-
import type {
|
|
4
|
+
import type { FileSchema } from '../../../../src/models/store/File.js'
|
|
5
5
|
|
|
6
6
|
test.group('File', (group) => {
|
|
7
7
|
let fileMock: File
|
|
@@ -18,7 +18,7 @@ test.group('File', (group) => {
|
|
|
18
18
|
})
|
|
19
19
|
|
|
20
20
|
test('file(init) allows overriding properties', ({ assert }) => {
|
|
21
|
-
const init: Partial<
|
|
21
|
+
const init: Partial<FileSchema> = {
|
|
22
22
|
kind: ProjectKind,
|
|
23
23
|
info: { name: 'My Project' },
|
|
24
24
|
}
|
|
@@ -34,7 +34,7 @@ test.group('File', (group) => {
|
|
|
34
34
|
})
|
|
35
35
|
|
|
36
36
|
test('files(size, init) allows overriding properties', ({ assert }) => {
|
|
37
|
-
const init: Partial<
|
|
37
|
+
const init: Partial<FileSchema> = {
|
|
38
38
|
kind: ProjectKind,
|
|
39
39
|
}
|
|
40
40
|
const result = fileMock.files(3, init)
|
|
@@ -51,7 +51,7 @@ test.group('File', (group) => {
|
|
|
51
51
|
})
|
|
52
52
|
|
|
53
53
|
test('folder(init) allows overriding properties', ({ assert }) => {
|
|
54
|
-
const init: Partial<
|
|
54
|
+
const init: Partial<FileSchema> = {
|
|
55
55
|
key: 'custom-folder-key',
|
|
56
56
|
}
|
|
57
57
|
const result = fileMock.folder(init)
|
|
@@ -66,7 +66,7 @@ test.group('File', (group) => {
|
|
|
66
66
|
})
|
|
67
67
|
|
|
68
68
|
test('folders(size, init) allows overriding properties', ({ assert }) => {
|
|
69
|
-
const init: Partial<
|
|
69
|
+
const init: Partial<FileSchema> = {
|
|
70
70
|
key: 'batch-key',
|
|
71
71
|
}
|
|
72
72
|
const result = fileMock.folders(3, init)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { test } from '@japa/runner'
|
|
2
2
|
import { Organization } from '../../../../src/mocking/lib/Organization.js'
|
|
3
3
|
import { OrganizationKind } from '../../../../src/models/kinds.js'
|
|
4
|
-
import type {
|
|
4
|
+
import type { OrganizationSchema } from '../../../../src/models/store/Organization.js'
|
|
5
5
|
|
|
6
6
|
test.group('Organization', (group) => {
|
|
7
7
|
let organization: Organization
|
|
@@ -19,10 +19,11 @@ test.group('Organization', (group) => {
|
|
|
19
19
|
assert.property(result, 'createdBy')
|
|
20
20
|
assert.property(result, 'createdDate')
|
|
21
21
|
assert.property(result, 'grantType')
|
|
22
|
+
assert.property(result, 'slug')
|
|
22
23
|
})
|
|
23
24
|
|
|
24
25
|
test('organization(init) allows overriding properties', ({ assert }) => {
|
|
25
|
-
const init: Partial<
|
|
26
|
+
const init: Partial<OrganizationSchema> = {
|
|
26
27
|
key: 'custom-org-key',
|
|
27
28
|
name: 'Custom Org',
|
|
28
29
|
}
|
|
@@ -38,7 +39,7 @@ test.group('Organization', (group) => {
|
|
|
38
39
|
})
|
|
39
40
|
|
|
40
41
|
test('organizations(size, init) allows overriding properties', ({ assert }) => {
|
|
41
|
-
const init: Partial<
|
|
42
|
+
const init: Partial<OrganizationSchema> = {
|
|
42
43
|
name: 'Batch Org',
|
|
43
44
|
}
|
|
44
45
|
const result = organization.organizations(3, init)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { test } from '@japa/runner'
|
|
2
2
|
import { Permission } from '../../../../src/mocking/lib/Permission.js'
|
|
3
3
|
import { Kind as PermissionKind } from '../../../../src/models/store/Permission.js'
|
|
4
|
-
import type {
|
|
4
|
+
import type { PermissionSchema } from '../../../../src/models/store/Permission.js'
|
|
5
5
|
|
|
6
6
|
test.group('permission()', (group) => {
|
|
7
7
|
let permission: Permission
|
|
@@ -29,7 +29,7 @@ test.group('permission()', (group) => {
|
|
|
29
29
|
])
|
|
30
30
|
.run(({ assert }, { property, type }) => {
|
|
31
31
|
const result = permission.permission()
|
|
32
|
-
assert.typeOf(result[property as keyof
|
|
32
|
+
assert.typeOf(result[property as keyof PermissionSchema], type)
|
|
33
33
|
})
|
|
34
34
|
|
|
35
35
|
test('has the correct kind', ({ assert }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { test } from '@japa/runner'
|
|
2
2
|
import { User } from '../../../../src/mocking/lib/User.js'
|
|
3
3
|
import { Kind as UserKind } from '../../../../src/models/store/User.js'
|
|
4
|
-
import type {
|
|
4
|
+
import type { UserSchema } from '../../../../src/index.js'
|
|
5
5
|
|
|
6
6
|
test.group('user()', (group) => {
|
|
7
7
|
let user: User
|
|
@@ -25,7 +25,7 @@ test.group('user()', (group) => {
|
|
|
25
25
|
])
|
|
26
26
|
.run(({ assert }, { property, type }) => {
|
|
27
27
|
const result = user.user()
|
|
28
|
-
assert.typeOf(result[property as keyof
|
|
28
|
+
assert.typeOf(result[property as keyof UserSchema], type)
|
|
29
29
|
})
|
|
30
30
|
|
|
31
31
|
test('has the kind', ({ assert }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { test } from '@japa/runner'
|
|
2
|
-
import { DomainFile,
|
|
2
|
+
import { DomainFile, type DomainFileSchema, ThingKind, DomainFileKind, DataDomain } from '../../../src/index.js'
|
|
3
3
|
|
|
4
4
|
test.group('DomainFile.fromDataDomain()', () => {
|
|
5
5
|
test('sets the kind', ({ assert }) => {
|
|
@@ -36,7 +36,7 @@ test.group('constructor()', () => {
|
|
|
36
36
|
})
|
|
37
37
|
|
|
38
38
|
test('creates a data file from the schema values', ({ assert }) => {
|
|
39
|
-
const schema:
|
|
39
|
+
const schema: DomainFileSchema = {
|
|
40
40
|
kind: DomainFileKind,
|
|
41
41
|
info: {
|
|
42
42
|
kind: ThingKind,
|
|
@@ -74,7 +74,7 @@ test.group('constructor()', () => {
|
|
|
74
74
|
})
|
|
75
75
|
|
|
76
76
|
test('creates a data file from the JSON schema string', ({ assert }) => {
|
|
77
|
-
const schema:
|
|
77
|
+
const schema: DomainFileSchema = {
|
|
78
78
|
kind: DomainFileKind,
|
|
79
79
|
info: {
|
|
80
80
|
kind: ThingKind,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { test } from '@japa/runner'
|
|
2
|
-
import { File, Folder,
|
|
2
|
+
import { File, Folder, CapabilitiesSchema, PermissionRole, Project } from '../../../../src/index.js'
|
|
3
3
|
|
|
4
4
|
test.group('File.createFileCapabilities()', () => {
|
|
5
5
|
test('{$i} correctly sets file capabilities')
|
|
@@ -68,7 +68,7 @@ test.group('File.createFileCapabilities()', () => {
|
|
|
68
68
|
.run(({ assert }, row) => {
|
|
69
69
|
const file = new Project()
|
|
70
70
|
const result = File.createFileCapabilities(file, row[1] as PermissionRole)
|
|
71
|
-
const key = row[0] as keyof
|
|
71
|
+
const key = row[0] as keyof CapabilitiesSchema
|
|
72
72
|
assert.strictEqual(result[key], row[2])
|
|
73
73
|
})
|
|
74
74
|
|
|
@@ -138,7 +138,7 @@ test.group('File.createFileCapabilities()', () => {
|
|
|
138
138
|
.run(({ assert }, row) => {
|
|
139
139
|
const file = new Folder()
|
|
140
140
|
const result = File.createFileCapabilities(file, row[1] as PermissionRole)
|
|
141
|
-
const key = row[0] as keyof
|
|
141
|
+
const key = row[0] as keyof CapabilitiesSchema
|
|
142
142
|
assert.strictEqual(result[key], row[2])
|
|
143
143
|
})
|
|
144
144
|
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { test } from '@japa/runner'
|
|
2
|
-
import { File, ThingKind,
|
|
2
|
+
import { File, ThingKind, FileSchema } from '../../../../src/index.js'
|
|
3
3
|
|
|
4
4
|
test.group('File.new()', (group) => {
|
|
5
5
|
let file: File
|
|
6
|
-
let base:
|
|
6
|
+
let base: FileSchema
|
|
7
7
|
group.each.setup(async () => {
|
|
8
8
|
file = new File()
|
|
9
9
|
base = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { test } from '@japa/runner'
|
|
2
|
-
import { File,
|
|
2
|
+
import { File, UserSchema } from '../../../../src/index.js'
|
|
3
3
|
|
|
4
4
|
test.group('File.setDeleted()', () => {
|
|
5
|
-
const user:
|
|
5
|
+
const user: UserSchema = {
|
|
6
6
|
key: '123',
|
|
7
7
|
kind: 'Core#User',
|
|
8
8
|
name: 'a1',
|
|
@@ -59,7 +59,7 @@ test.group('File.setDeleted()', () => {
|
|
|
59
59
|
})
|
|
60
60
|
|
|
61
61
|
test.group('File::setDeleted()', () => {
|
|
62
|
-
const user:
|
|
62
|
+
const user: UserSchema = {
|
|
63
63
|
key: '123',
|
|
64
64
|
kind: 'Core#User',
|
|
65
65
|
name: 'a1',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { test } from '@japa/runner'
|
|
2
|
-
import { File,
|
|
2
|
+
import { File, UserSchema } from '../../../../src/index.js'
|
|
3
3
|
|
|
4
4
|
test.group('File.setLastModified()', () => {
|
|
5
|
-
const user:
|
|
5
|
+
const user: UserSchema = {
|
|
6
6
|
key: '123',
|
|
7
7
|
kind: 'Core#User',
|
|
8
8
|
name: 'a1',
|
|
@@ -53,7 +53,7 @@ test.group('File.setLastModified()', () => {
|
|
|
53
53
|
})
|
|
54
54
|
|
|
55
55
|
test.group('File::setLastModified()', () => {
|
|
56
|
-
const user:
|
|
56
|
+
const user: UserSchema = {
|
|
57
57
|
key: '123',
|
|
58
58
|
kind: 'Core#User',
|
|
59
59
|
name: 'a1',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { test } from '@japa/runner'
|
|
2
|
-
import { File, ThingKind,
|
|
2
|
+
import { File, ThingKind, FileSchema } from '../../../../src/index.js'
|
|
3
3
|
|
|
4
4
|
test.group('File.toJSON()', (group) => {
|
|
5
5
|
let file: File
|
|
6
|
-
let base:
|
|
6
|
+
let base: FileSchema
|
|
7
7
|
|
|
8
8
|
group.each.setup(() => {
|
|
9
9
|
file = new File()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { test } from '@japa/runner'
|
|
2
|
-
import { Folder, FolderKind,
|
|
2
|
+
import { Folder, FolderKind, FolderSchema, ThingKind } from '../../../../src/index.js'
|
|
3
3
|
|
|
4
4
|
test.group('Folder.fromName()', () => {
|
|
5
5
|
test('sets the kind', ({ assert }) => {
|
|
@@ -22,7 +22,7 @@ test.group('Folder.constructor()', () => {
|
|
|
22
22
|
})
|
|
23
23
|
|
|
24
24
|
test('creates a Folder from the schema values', ({ assert }) => {
|
|
25
|
-
const schema:
|
|
25
|
+
const schema: FolderSchema = {
|
|
26
26
|
kind: FolderKind,
|
|
27
27
|
info: {
|
|
28
28
|
kind: ThingKind,
|
|
@@ -60,7 +60,7 @@ test.group('Folder.constructor()', () => {
|
|
|
60
60
|
})
|
|
61
61
|
|
|
62
62
|
test('creates a Folder from the JSON schema string', ({ assert }) => {
|
|
63
|
-
const schema:
|
|
63
|
+
const schema: FolderSchema = {
|
|
64
64
|
kind: FolderKind,
|
|
65
65
|
info: {
|
|
66
66
|
kind: ThingKind,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { test } from '@japa/runner'
|
|
2
|
-
import {
|
|
2
|
+
import { PermissionSchema, Permission, PermissionKind, PermissionRole } from '../../../../src/index.js'
|
|
3
3
|
|
|
4
4
|
test.group('Permission', () => {
|
|
5
5
|
test('creates a default Permission', ({ assert }) => {
|
|
@@ -16,7 +16,7 @@ test.group('Permission', () => {
|
|
|
16
16
|
})
|
|
17
17
|
|
|
18
18
|
test('creates permissions from the schema', ({ assert }) => {
|
|
19
|
-
const schema:
|
|
19
|
+
const schema: PermissionSchema = {
|
|
20
20
|
kind: PermissionKind,
|
|
21
21
|
key: '1',
|
|
22
22
|
addingUser: '2',
|
|
@@ -44,7 +44,7 @@ test.group('Permission', () => {
|
|
|
44
44
|
})
|
|
45
45
|
|
|
46
46
|
test('creates permissions from the JSON schema', ({ assert }) => {
|
|
47
|
-
const schema:
|
|
47
|
+
const schema: PermissionSchema = {
|
|
48
48
|
kind: PermissionKind,
|
|
49
49
|
key: '1',
|
|
50
50
|
addingUser: '2',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { test } from '@japa/runner'
|
|
2
|
-
import { Invitation, InvitationKind, type InvitationSchema, type
|
|
2
|
+
import { Invitation, InvitationKind, type InvitationSchema, type DeletionSchema } from '../../../../src/index.js'
|
|
3
3
|
import { OperationType } from '@api-client/json/patch/types.js'
|
|
4
4
|
|
|
5
5
|
const baseInput: Partial<InvitationSchema> = {
|
|
@@ -56,7 +56,7 @@ test.group('Invitation', (group) => {
|
|
|
56
56
|
})
|
|
57
57
|
|
|
58
58
|
test('toJSON() serializes all properties correctly', ({ assert }) => {
|
|
59
|
-
const deletionInfo:
|
|
59
|
+
const deletionInfo: DeletionSchema = { time: Date.now(), user: 'deleter-id', byMe: false, name: 'Deleter' }
|
|
60
60
|
const input: Partial<InvitationSchema> = {
|
|
61
61
|
...baseInput,
|
|
62
62
|
key: 'inv-key-json',
|