@api-client/core 0.19.16 → 0.19.18
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/exceptions/exception.d.ts +56 -0
- package/build/src/exceptions/exception.d.ts.map +1 -1
- package/build/src/exceptions/exception.js +111 -14
- package/build/src/exceptions/exception.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 +3 -3
- package/build/src/mocking/lib/Organization.d.ts.map +1 -1
- package/build/src/mocking/lib/Organization.js +2 -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 +18 -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 +9 -9
- package/build/src/sdk/OrganizationsSdk.d.ts.map +1 -1
- package/build/src/sdk/OrganizationsSdk.js.map +1 -1
- package/build/src/sdk/SdkMock.js +6 -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/exceptions/exception.ts +119 -15
- package/src/mocking/ProjectMock.ts +1 -1
- package/src/mocking/lib/File.ts +5 -5
- package/src/mocking/lib/Organization.ts +5 -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 +45 -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 +20 -16
- package/src/sdk/SdkMock.ts +16 -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/exceptions/exception.spec.ts +261 -0
- 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
|
@@ -2,7 +2,7 @@ import type { DomainEntity } from '../DomainEntity.js'
|
|
|
2
2
|
import type { DomainElement } from '../DomainElement.js'
|
|
3
3
|
import type { DomainProperty } from '../DomainProperty.js'
|
|
4
4
|
import type { DomainAssociation } from '../DomainAssociation.js'
|
|
5
|
-
import type {
|
|
5
|
+
import type { ThingSchema } from '../../models/Thing.js'
|
|
6
6
|
import { SemanticType } from '../Semantics.js'
|
|
7
7
|
import { createEmailSemantic, DEFAULT_EMAIL_CONFIG } from '../definitions/Email.js'
|
|
8
8
|
import { createPasswordSemantic, DEFAULT_PASSWORD_CONFIG } from '../definitions/Password.js'
|
|
@@ -117,7 +117,7 @@ export function addAutoField(entity: DomainEntity, autoField: string): DomainEle
|
|
|
117
117
|
* @param entity The entity to which the ID field will be added.
|
|
118
118
|
* @returns The added primary field property.
|
|
119
119
|
*/
|
|
120
|
-
export function addIdField(entity: DomainEntity, info: Partial<
|
|
120
|
+
export function addIdField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
121
121
|
const existing = findIdField(entity, true)
|
|
122
122
|
if (existing) {
|
|
123
123
|
// If the ID field already exists, return it.
|
|
@@ -143,7 +143,7 @@ export function addIdField(entity: DomainEntity, info: Partial<IThing> = {}): Do
|
|
|
143
143
|
* @param entity The entity to which the email field will be added.
|
|
144
144
|
* @returns The added email field property.
|
|
145
145
|
*/
|
|
146
|
-
export function addEmailField(entity: DomainEntity, info: Partial<
|
|
146
|
+
export function addEmailField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
147
147
|
const existing = findEmailField(entity, true)
|
|
148
148
|
if (existing) {
|
|
149
149
|
return existing
|
|
@@ -166,7 +166,7 @@ export function addEmailField(entity: DomainEntity, info: Partial<IThing> = {}):
|
|
|
166
166
|
* @param info Additional information for the password field.
|
|
167
167
|
* @returns The added password field property.
|
|
168
168
|
*/
|
|
169
|
-
export function addPasswordField(entity: DomainEntity, info: Partial<
|
|
169
|
+
export function addPasswordField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
170
170
|
const existing = findPasswordField(entity, true)
|
|
171
171
|
if (existing) {
|
|
172
172
|
return existing
|
|
@@ -186,7 +186,7 @@ export function addPasswordField(entity: DomainEntity, info: Partial<IThing> = {
|
|
|
186
186
|
* The version field is used to track the version of the entity.
|
|
187
187
|
* @returns The added version field property.
|
|
188
188
|
*/
|
|
189
|
-
export function addVersionField(entity: DomainEntity, info: Partial<
|
|
189
|
+
export function addVersionField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
190
190
|
const existing = findVersionField(entity, true)
|
|
191
191
|
if (existing) {
|
|
192
192
|
// If the version field already exists, return it.
|
|
@@ -205,7 +205,7 @@ export function addVersionField(entity: DomainEntity, info: Partial<IThing> = {}
|
|
|
205
205
|
return prop
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
export function addNameField(entity: DomainEntity, info: Partial<
|
|
208
|
+
export function addNameField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
209
209
|
const existing = findNameField(entity, true)
|
|
210
210
|
if (existing) {
|
|
211
211
|
return existing
|
|
@@ -220,7 +220,7 @@ export function addNameField(entity: DomainEntity, info: Partial<IThing> = {}):
|
|
|
220
220
|
return prop
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
export function addDisplayNameField(entity: DomainEntity, info: Partial<
|
|
223
|
+
export function addDisplayNameField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
224
224
|
const existing = findDisplayNameField(entity, true)
|
|
225
225
|
if (existing) {
|
|
226
226
|
return existing
|
|
@@ -251,7 +251,7 @@ export function addDisplayNameField(entity: DomainEntity, info: Partial<IThing>
|
|
|
251
251
|
* @param entity The entity to which the description field will be added.
|
|
252
252
|
* @returns The added description field property.
|
|
253
253
|
*/
|
|
254
|
-
export function addDescriptionField(entity: DomainEntity, info: Partial<
|
|
254
|
+
export function addDescriptionField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
255
255
|
const existing = findDescriptionField(entity, true)
|
|
256
256
|
if (existing) {
|
|
257
257
|
return existing
|
|
@@ -283,7 +283,7 @@ export function addDescriptionField(entity: DomainEntity, info: Partial<IThing>
|
|
|
283
283
|
* @param info Additional information about the field.
|
|
284
284
|
* @returns The added status field property.
|
|
285
285
|
*/
|
|
286
|
-
export function addStatusField(entity: DomainEntity, info: Partial<
|
|
286
|
+
export function addStatusField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
287
287
|
const existing = findStatusField(entity, true)
|
|
288
288
|
if (existing) {
|
|
289
289
|
return existing
|
|
@@ -320,7 +320,7 @@ export function addStatusField(entity: DomainEntity, info: Partial<IThing> = {})
|
|
|
320
320
|
* @param info Additional information about the field.
|
|
321
321
|
* @returns The added owner field property.
|
|
322
322
|
*/
|
|
323
|
-
export function addOwnerField(entity: DomainEntity, info: Partial<
|
|
323
|
+
export function addOwnerField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainAssociation {
|
|
324
324
|
const existing = findOwnerField(entity, true)
|
|
325
325
|
if (existing) {
|
|
326
326
|
return existing
|
|
@@ -370,7 +370,7 @@ export function addOwnerField(entity: DomainEntity, info: Partial<IThing> = {}):
|
|
|
370
370
|
* @param info Additional information about the field.
|
|
371
371
|
* @returns The added updated by field property.
|
|
372
372
|
*/
|
|
373
|
-
export function addUpdatedByField(entity: DomainEntity, info: Partial<
|
|
373
|
+
export function addUpdatedByField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainAssociation {
|
|
374
374
|
const existing = findUpdatedByField(entity, true)
|
|
375
375
|
if (existing) {
|
|
376
376
|
return existing
|
|
@@ -405,7 +405,7 @@ export function addUpdatedByField(entity: DomainEntity, info: Partial<IThing> =
|
|
|
405
405
|
* @param info Additional information about the field.
|
|
406
406
|
* @returns The created created at field.
|
|
407
407
|
*/
|
|
408
|
-
export function addCreatedAtField(entity: DomainEntity, info: Partial<
|
|
408
|
+
export function addCreatedAtField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
409
409
|
const existing = findCreatedAtField(entity, true)
|
|
410
410
|
if (existing) {
|
|
411
411
|
// If the created_at field already exists, return it.
|
|
@@ -444,7 +444,7 @@ export function addCreatedAtField(entity: DomainEntity, info: Partial<IThing> =
|
|
|
444
444
|
* @param info Additional information about the field.
|
|
445
445
|
* @returns The created updated at field.
|
|
446
446
|
*/
|
|
447
|
-
export function addUpdatedAtField(entity: DomainEntity, info: Partial<
|
|
447
|
+
export function addUpdatedAtField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
448
448
|
const existing = findUpdatedAtField(entity, true)
|
|
449
449
|
if (existing) {
|
|
450
450
|
// If the updated_at field already exists, return it.
|
|
@@ -484,7 +484,7 @@ export function addUpdatedAtField(entity: DomainEntity, info: Partial<IThing> =
|
|
|
484
484
|
* @param info Additional information about the field.
|
|
485
485
|
* @returns The added deleted at field property.
|
|
486
486
|
*/
|
|
487
|
-
export function addDeletedAtField(entity: DomainEntity, info: Partial<
|
|
487
|
+
export function addDeletedAtField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
488
488
|
const existing = findDeletedAtField(entity, true)
|
|
489
489
|
if (existing) {
|
|
490
490
|
// If the deleted_at field already exists, return it.
|
|
@@ -503,7 +503,7 @@ export function addDeletedAtField(entity: DomainEntity, info: Partial<IThing> =
|
|
|
503
503
|
return prop
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
-
export function addRoleField(entity: DomainEntity, info: Partial<
|
|
506
|
+
export function addRoleField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
507
507
|
const existing = findRoleField(entity, true)
|
|
508
508
|
if (existing) {
|
|
509
509
|
return existing
|
|
@@ -541,7 +541,7 @@ export function addRoleField(entity: DomainEntity, info: Partial<IThing> = {}):
|
|
|
541
541
|
* @param info Additional information about the field.
|
|
542
542
|
* @returns The added is_deleted field property.
|
|
543
543
|
*/
|
|
544
|
-
export function addIsDeletedField(entity: DomainEntity, info: Partial<
|
|
544
|
+
export function addIsDeletedField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
545
545
|
const existing = findIsDeletedField(entity, true)
|
|
546
546
|
if (existing) {
|
|
547
547
|
// If the is_deleted field already exists, return it.
|
|
@@ -574,7 +574,7 @@ export function addIsDeletedField(entity: DomainEntity, info: Partial<IThing> =
|
|
|
574
574
|
* @param info Additional information about the field.
|
|
575
575
|
* @returns The created first name field.
|
|
576
576
|
*/
|
|
577
|
-
export function addFirstNameField(entity: DomainEntity, info: Partial<
|
|
577
|
+
export function addFirstNameField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
578
578
|
const existing = findFirstNameField(entity)
|
|
579
579
|
if (existing) {
|
|
580
580
|
return existing
|
|
@@ -600,7 +600,7 @@ export function addFirstNameField(entity: DomainEntity, info: Partial<IThing> =
|
|
|
600
600
|
* @param info Additional information about the field.
|
|
601
601
|
* @returns The created first name field.
|
|
602
602
|
*/
|
|
603
|
-
export function addLastNameField(entity: DomainEntity, info: Partial<
|
|
603
|
+
export function addLastNameField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
604
604
|
const existing = findLastNameField(entity)
|
|
605
605
|
if (existing) {
|
|
606
606
|
return existing
|
|
@@ -630,7 +630,7 @@ export function addLastNameField(entity: DomainEntity, info: Partial<IThing> = {
|
|
|
630
630
|
* @param info Additional information about the field.
|
|
631
631
|
* @returns The created phone field.
|
|
632
632
|
*/
|
|
633
|
-
export function addPhoneField(entity: DomainEntity, info: Partial<
|
|
633
|
+
export function addPhoneField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
634
634
|
const existing = findPhoneField(entity, true)
|
|
635
635
|
if (existing) {
|
|
636
636
|
return existing
|
|
@@ -668,7 +668,7 @@ export function addPhoneField(entity: DomainEntity, info: Partial<IThing> = {}):
|
|
|
668
668
|
* @param info Additional information about the field.
|
|
669
669
|
* @returns The created avatar URL field.
|
|
670
670
|
*/
|
|
671
|
-
export function addAvatarUrlField(entity: DomainEntity, info: Partial<
|
|
671
|
+
export function addAvatarUrlField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
672
672
|
const existing = findAvatarUrlField(entity, true)
|
|
673
673
|
if (existing) {
|
|
674
674
|
return existing
|
|
@@ -701,7 +701,7 @@ export function addAvatarUrlField(entity: DomainEntity, info: Partial<IThing> =
|
|
|
701
701
|
* @param info Additional information about the field.
|
|
702
702
|
* @returns The created public unique name field.
|
|
703
703
|
*/
|
|
704
|
-
export function addPublicUniqueNameField(entity: DomainEntity, info: Partial<
|
|
704
|
+
export function addPublicUniqueNameField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
705
705
|
const existing = findPublicUniqueNameField(entity, true)
|
|
706
706
|
if (existing) {
|
|
707
707
|
return existing
|
|
@@ -733,7 +733,7 @@ export function addPublicUniqueNameField(entity: DomainEntity, info: Partial<ITh
|
|
|
733
733
|
* @param info Additional information about the field.
|
|
734
734
|
* @returns The created SKU field.
|
|
735
735
|
*/
|
|
736
|
-
export function addSkuField(entity: DomainEntity, info: Partial<
|
|
736
|
+
export function addSkuField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
737
737
|
const existing = findSkuField(entity, true)
|
|
738
738
|
if (existing) {
|
|
739
739
|
return existing
|
|
@@ -764,7 +764,7 @@ export function addSkuField(entity: DomainEntity, info: Partial<IThing> = {}): D
|
|
|
764
764
|
* @param info Additional information about the field.
|
|
765
765
|
* @returns The created price field.
|
|
766
766
|
*/
|
|
767
|
-
export function addPriceField(entity: DomainEntity, info: Partial<
|
|
767
|
+
export function addPriceField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
768
768
|
const existing = findPriceField(entity, true)
|
|
769
769
|
if (existing) {
|
|
770
770
|
return existing
|
|
@@ -805,7 +805,7 @@ export function addPriceField(entity: DomainEntity, info: Partial<IThing> = {}):
|
|
|
805
805
|
* @param info Additional information about the field.
|
|
806
806
|
* @returns The created quantity field.
|
|
807
807
|
*/
|
|
808
|
-
export function addQuantityField(entity: DomainEntity, info: Partial<
|
|
808
|
+
export function addQuantityField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
809
809
|
const existing = findQuantityField(entity, true)
|
|
810
810
|
if (existing) {
|
|
811
811
|
return existing
|
|
@@ -835,7 +835,7 @@ export function addQuantityField(entity: DomainEntity, info: Partial<IThing> = {
|
|
|
835
835
|
* @param info Additional information about the field.
|
|
836
836
|
* @returns The created weight field.
|
|
837
837
|
*/
|
|
838
|
-
export function addWeightField(entity: DomainEntity, info: Partial<
|
|
838
|
+
export function addWeightField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
839
839
|
const existing = findWeightField(entity, true)
|
|
840
840
|
if (existing) {
|
|
841
841
|
return existing
|
|
@@ -862,7 +862,7 @@ export function addWeightField(entity: DomainEntity, info: Partial<IThing> = {})
|
|
|
862
862
|
* @param info Additional information about the field.
|
|
863
863
|
* @returns The created images field.
|
|
864
864
|
*/
|
|
865
|
-
export function addImagesField(entity: DomainEntity, info: Partial<
|
|
865
|
+
export function addImagesField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
866
866
|
const existing = findImagesField(entity, true)
|
|
867
867
|
if (existing) {
|
|
868
868
|
return existing
|
|
@@ -900,7 +900,7 @@ export function addImagesField(entity: DomainEntity, info: Partial<IThing> = {})
|
|
|
900
900
|
export function addCustomStatusField(
|
|
901
901
|
entity: DomainEntity,
|
|
902
902
|
enumValues: string[],
|
|
903
|
-
info: Partial<
|
|
903
|
+
info: Partial<ThingSchema> = {}
|
|
904
904
|
): DomainProperty {
|
|
905
905
|
const existing = findStatusField(entity, true)
|
|
906
906
|
if (existing) {
|
|
@@ -942,7 +942,7 @@ export function addBooleanField(
|
|
|
942
942
|
entity: DomainEntity,
|
|
943
943
|
fieldName: string,
|
|
944
944
|
defaultValue = 'false',
|
|
945
|
-
info: Partial<
|
|
945
|
+
info: Partial<ThingSchema> = {}
|
|
946
946
|
): DomainProperty {
|
|
947
947
|
const existing = findBooleanField(entity, fieldName, true)
|
|
948
948
|
if (existing) {
|
|
@@ -976,7 +976,7 @@ export function addBooleanField(
|
|
|
976
976
|
* @param info Additional information about the field.
|
|
977
977
|
* @returns The created session ID field.
|
|
978
978
|
*/
|
|
979
|
-
export function addSessionIdField(entity: DomainEntity, info: Partial<
|
|
979
|
+
export function addSessionIdField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
980
980
|
const existing = findSessionIdField(entity, true)
|
|
981
981
|
if (existing) {
|
|
982
982
|
return existing
|
|
@@ -1002,7 +1002,7 @@ export function addSessionIdField(entity: DomainEntity, info: Partial<IThing> =
|
|
|
1002
1002
|
* @param info Additional information about the field.
|
|
1003
1003
|
* @returns The created expiration field.
|
|
1004
1004
|
*/
|
|
1005
|
-
export function addExpiresAtField(entity: DomainEntity, info: Partial<
|
|
1005
|
+
export function addExpiresAtField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
1006
1006
|
const existing = findExpiresAtField(entity, true)
|
|
1007
1007
|
if (existing) {
|
|
1008
1008
|
return existing
|
|
@@ -1029,7 +1029,7 @@ export function addExpiresAtField(entity: DomainEntity, info: Partial<IThing> =
|
|
|
1029
1029
|
* @param info Additional information about the field.
|
|
1030
1030
|
* @returns The created unit price field.
|
|
1031
1031
|
*/
|
|
1032
|
-
export function addUnitPriceField(entity: DomainEntity, info: Partial<
|
|
1032
|
+
export function addUnitPriceField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
1033
1033
|
const existing = findUnitPriceField(entity, true)
|
|
1034
1034
|
if (existing) {
|
|
1035
1035
|
return existing
|
|
@@ -1050,7 +1050,7 @@ export function addCurrencyAmountField(
|
|
|
1050
1050
|
entity: DomainEntity,
|
|
1051
1051
|
fieldName: string,
|
|
1052
1052
|
displayName: string,
|
|
1053
|
-
info: Partial<
|
|
1053
|
+
info: Partial<ThingSchema> = {}
|
|
1054
1054
|
): DomainProperty {
|
|
1055
1055
|
const prop = entity.addProperty({
|
|
1056
1056
|
info: {
|
|
@@ -1371,7 +1371,7 @@ function findExpiresAtField(entity: DomainEntity, direct = false): DomainPropert
|
|
|
1371
1371
|
)
|
|
1372
1372
|
}
|
|
1373
1373
|
|
|
1374
|
-
export function addStreetAddressField(entity: DomainEntity, info: Partial<
|
|
1374
|
+
export function addStreetAddressField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
1375
1375
|
const existing = findStreetAddressField(entity, true)
|
|
1376
1376
|
if (existing) return existing
|
|
1377
1377
|
const prop = entity.addProperty({
|
|
@@ -1387,7 +1387,10 @@ function findStreetAddressField(entity: DomainEntity, direct = false): DomainPro
|
|
|
1387
1387
|
return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.StreetAddress), direct)
|
|
1388
1388
|
}
|
|
1389
1389
|
|
|
1390
|
-
export function addStreetAddressSupplementalField(
|
|
1390
|
+
export function addStreetAddressSupplementalField(
|
|
1391
|
+
entity: DomainEntity,
|
|
1392
|
+
info: Partial<ThingSchema> = {}
|
|
1393
|
+
): DomainProperty {
|
|
1391
1394
|
// we do not look for duplicates here, because the address can have multiple supplements (like line2, line3, etc.)
|
|
1392
1395
|
let latest = 0
|
|
1393
1396
|
for (const prop of entity.properties) {
|
|
@@ -1408,7 +1411,7 @@ export function addStreetAddressSupplementalField(entity: DomainEntity, info: Pa
|
|
|
1408
1411
|
return prop
|
|
1409
1412
|
}
|
|
1410
1413
|
|
|
1411
|
-
export function addCityField(entity: DomainEntity, info: Partial<
|
|
1414
|
+
export function addCityField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
1412
1415
|
const existing = findCityField(entity, true)
|
|
1413
1416
|
if (existing) return existing
|
|
1414
1417
|
const prop = entity.addProperty({
|
|
@@ -1425,7 +1428,7 @@ function findCityField(entity: DomainEntity, direct = false): DomainProperty | u
|
|
|
1425
1428
|
return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.City), direct)
|
|
1426
1429
|
}
|
|
1427
1430
|
|
|
1428
|
-
export function addPostalCodeField(entity: DomainEntity, info: Partial<
|
|
1431
|
+
export function addPostalCodeField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
1429
1432
|
const existing = findPostalCodeField(entity, true)
|
|
1430
1433
|
if (existing) return existing
|
|
1431
1434
|
const prop = entity.addProperty({
|
|
@@ -1442,7 +1445,7 @@ function findPostalCodeField(entity: DomainEntity, direct = false): DomainProper
|
|
|
1442
1445
|
return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.PostalCode), direct)
|
|
1443
1446
|
}
|
|
1444
1447
|
|
|
1445
|
-
export function addCountryField(entity: DomainEntity, info: Partial<
|
|
1448
|
+
export function addCountryField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
1446
1449
|
const existing = findCountryField(entity, true)
|
|
1447
1450
|
if (existing) return existing
|
|
1448
1451
|
const prop = entity.addProperty({
|
|
@@ -1459,7 +1462,7 @@ function findCountryField(entity: DomainEntity, direct = false): DomainProperty
|
|
|
1459
1462
|
return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Country), direct)
|
|
1460
1463
|
}
|
|
1461
1464
|
|
|
1462
|
-
export function addRegionField(entity: DomainEntity, info: Partial<
|
|
1465
|
+
export function addRegionField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {
|
|
1463
1466
|
const existing = findRegionField(entity, true)
|
|
1464
1467
|
if (existing) return existing
|
|
1465
1468
|
const prop = entity.addProperty({
|
package/src/models/AiMessage.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DeletionSchema } from './store/Deletion.js'
|
|
2
2
|
import { AiMessageKind } from './kinds.js'
|
|
3
3
|
import { nanoid } from '../nanoid.js'
|
|
4
4
|
import type { AiDomainDelta } from '../modeling/ai/types.js'
|
|
@@ -47,7 +47,7 @@ export interface AiMessageSchemaBase {
|
|
|
47
47
|
* The information about the delete information.
|
|
48
48
|
* Always set when the `deleted` is true.
|
|
49
49
|
*/
|
|
50
|
-
deletedInfo?:
|
|
50
|
+
deletedInfo?: DeletionSchema
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
@@ -137,7 +137,7 @@ export abstract class AiMessageBase<
|
|
|
137
137
|
session: string
|
|
138
138
|
text: string
|
|
139
139
|
deleted: boolean
|
|
140
|
-
deletedInfo?:
|
|
140
|
+
deletedInfo?: DeletionSchema
|
|
141
141
|
|
|
142
142
|
protected static createBaseSchema(input: Partial<AiMessageSchemaBase>): Omit<AiMessageSchemaBase, 'role'> {
|
|
143
143
|
const { key = nanoid(), session, text = '', createdAt = 0, updatedAt = 0 } = input
|
package/src/models/AiSession.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DeletionSchema } from './store/Deletion.js'
|
|
2
2
|
import { AiSessionKind } from './kinds.js'
|
|
3
3
|
import { nanoid } from '../nanoid.js'
|
|
4
4
|
import type { AiModelMessage } from './AiMessage.js'
|
|
@@ -57,7 +57,7 @@ export interface AiSessionSchema {
|
|
|
57
57
|
* The information about the delete information.
|
|
58
58
|
* Always set when the `delete` is true.
|
|
59
59
|
*/
|
|
60
|
-
deletedInfo?:
|
|
60
|
+
deletedInfo?: DeletionSchema
|
|
61
61
|
/**
|
|
62
62
|
* If the session is related to a file (data domain, API model, etc.), this is the key of the file.
|
|
63
63
|
* It is useful to filter session by specific object.
|
|
@@ -82,7 +82,7 @@ export class AiSession implements AiSessionSchema {
|
|
|
82
82
|
createdAt: number
|
|
83
83
|
updatedAt: number
|
|
84
84
|
deleted: boolean
|
|
85
|
-
deletedInfo?:
|
|
85
|
+
deletedInfo?: DeletionSchema
|
|
86
86
|
fileKey?: string
|
|
87
87
|
|
|
88
88
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { nanoid } from '../nanoid.js'
|
|
2
2
|
import { Certificate, ICertificate } from './ClientCertificate.js'
|
|
3
3
|
import { CertificateFileKind } from './kinds.js'
|
|
4
|
-
import {
|
|
4
|
+
import { FileSchema, File } from './store/File.js'
|
|
5
5
|
import { Thing } from './Thing.js'
|
|
6
6
|
|
|
7
|
-
export interface ICertificateFile extends
|
|
7
|
+
export interface ICertificateFile extends FileSchema {
|
|
8
8
|
kind: typeof CertificateFileKind
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Property, IProperty } from './Property.js'
|
|
2
2
|
import { Server, IServer } from './Server.js'
|
|
3
|
-
import {
|
|
3
|
+
import { ThingSchema, Thing } from './Thing.js'
|
|
4
4
|
import { nanoid } from '../nanoid.js'
|
|
5
5
|
import { ARCVariable } from './legacy/models/Variable.js'
|
|
6
6
|
import { IRequestAuthorization, RequestAuthorization } from './RequestAuthorization.js'
|
|
@@ -27,7 +27,7 @@ export interface IEnvironment {
|
|
|
27
27
|
/**
|
|
28
28
|
* The environment's meta info.
|
|
29
29
|
*/
|
|
30
|
-
info:
|
|
30
|
+
info: ThingSchema
|
|
31
31
|
/**
|
|
32
32
|
* The server's definition for the environment.
|
|
33
33
|
* When a server is defined for the environment then all request that have no
|
package/src/models/Folder.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FileSchema, File } from './store/File.js'
|
|
2
2
|
import { nanoid } from '../nanoid.js'
|
|
3
3
|
import { Thing } from './Thing.js'
|
|
4
4
|
import { FolderKind } from './kinds.js'
|
|
@@ -6,10 +6,15 @@ import { FolderKind } from './kinds.js'
|
|
|
6
6
|
/**
|
|
7
7
|
* A definition of a folder.
|
|
8
8
|
*/
|
|
9
|
-
export interface
|
|
9
|
+
export interface FolderSchema extends FileSchema {
|
|
10
10
|
kind: typeof FolderKind
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Use {@link FolderSchema} instead.
|
|
15
|
+
*/
|
|
16
|
+
export type IFolder = FolderSchema
|
|
17
|
+
|
|
13
18
|
/**
|
|
14
19
|
* A definition of a folder.
|
|
15
20
|
*/
|
|
@@ -28,9 +33,9 @@ export class Folder extends File {
|
|
|
28
33
|
/**
|
|
29
34
|
* @param input The environment definition used to restore the state.
|
|
30
35
|
*/
|
|
31
|
-
constructor(input?: string |
|
|
36
|
+
constructor(input?: string | FolderSchema) {
|
|
32
37
|
super()
|
|
33
|
-
let init:
|
|
38
|
+
let init: FolderSchema
|
|
34
39
|
if (typeof input === 'string') {
|
|
35
40
|
init = JSON.parse(input)
|
|
36
41
|
} else if (typeof input === 'object') {
|
|
@@ -52,7 +57,7 @@ export class Folder extends File {
|
|
|
52
57
|
/**
|
|
53
58
|
* Creates a new environment clearing anything that is so far defined.
|
|
54
59
|
*/
|
|
55
|
-
override new(init:
|
|
60
|
+
override new(init: FolderSchema): this {
|
|
56
61
|
if (!Folder.isFolder(init)) {
|
|
57
62
|
throw new Error(`Not a folder.`)
|
|
58
63
|
}
|
|
@@ -65,15 +70,15 @@ export class Folder extends File {
|
|
|
65
70
|
* Checks whether the input is a definition of a folder.
|
|
66
71
|
*/
|
|
67
72
|
static isFolder(input: unknown): boolean {
|
|
68
|
-
const typed = input as
|
|
73
|
+
const typed = input as FolderSchema
|
|
69
74
|
if (!input || typed.kind !== FolderKind) {
|
|
70
75
|
return false
|
|
71
76
|
}
|
|
72
77
|
return true
|
|
73
78
|
}
|
|
74
79
|
|
|
75
|
-
override toJSON():
|
|
76
|
-
const result:
|
|
80
|
+
override toJSON(): FolderSchema {
|
|
81
|
+
const result: FolderSchema = {
|
|
77
82
|
...super.toJSON(),
|
|
78
83
|
kind: FolderKind,
|
|
79
84
|
}
|
|
@@ -6,7 +6,7 @@ import { IProjectDefinitionProperty } from './ProjectDefinitionProperty.js'
|
|
|
6
6
|
import { Environment, IEnvironment, Kind as EnvironmentKind } from './Environment.js'
|
|
7
7
|
import { License, ILicense } from './License.js'
|
|
8
8
|
import { Provider, IProvider } from './Provider.js'
|
|
9
|
-
import {
|
|
9
|
+
import { ThingSchema, Thing } from './Thing.js'
|
|
10
10
|
import { ProjectItem, IProjectItem } from './ProjectItem.js'
|
|
11
11
|
import { IProjectFolder, ProjectFolder } from './ProjectFolder.js'
|
|
12
12
|
import { IProjectRequest, ProjectRequest, Kind as ProjectRequestKind } from './ProjectRequest.js'
|
|
@@ -229,7 +229,7 @@ export interface IHttpProject extends IProjectDefinitionProperty {
|
|
|
229
229
|
/**
|
|
230
230
|
* The basic information about the project.
|
|
231
231
|
*/
|
|
232
|
-
info:
|
|
232
|
+
info: ThingSchema
|
|
233
233
|
/**
|
|
234
234
|
* Information about project provider.
|
|
235
235
|
*/
|
|
@@ -4,7 +4,7 @@ import { type IProjectDefinitionProperty } from './ProjectDefinitionProperty.js'
|
|
|
4
4
|
import { ProjectItem, type IProjectItem } from './ProjectItem.js'
|
|
5
5
|
import { type ProjectRequest, Kind as ProjectRequestKind, type IProjectRequest } from './ProjectRequest.js'
|
|
6
6
|
import { type HttpProject, type IEnvironmentCreateOptions } from './HttpProject.js'
|
|
7
|
-
import { type
|
|
7
|
+
import { type ThingSchema, Thing } from './Thing.js'
|
|
8
8
|
import { Environment, type IEnvironment } from './Environment.js'
|
|
9
9
|
import { ProjectFolderKind } from './kinds.js'
|
|
10
10
|
|
|
@@ -53,7 +53,7 @@ export interface IProjectFolder extends IProjectDefinitionProperty {
|
|
|
53
53
|
/**
|
|
54
54
|
* Folder meta
|
|
55
55
|
*/
|
|
56
|
-
info:
|
|
56
|
+
info: ThingSchema
|
|
57
57
|
/**
|
|
58
58
|
* The ordered list of HTTP requests / folders in the projects.
|
|
59
59
|
* The UI uses this to manipulate the view without changing the definitions.
|
package/src/models/Request.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IRequestConfig, RequestConfig } from './RequestConfig.js'
|
|
2
|
-
import { Thing,
|
|
2
|
+
import { Thing, ThingSchema } from './Thing.js'
|
|
3
3
|
import { HttpCertificate, Certificate } from './ClientCertificate.js'
|
|
4
4
|
import { IRequestAuthorization, RequestAuthorization } from './RequestAuthorization.js'
|
|
5
5
|
import { IRequestLog, RequestLog, Kind as LogKind } from './RequestLog.js'
|
|
@@ -30,7 +30,7 @@ export interface IRequest {
|
|
|
30
30
|
/**
|
|
31
31
|
* The basic information about the request.
|
|
32
32
|
*/
|
|
33
|
-
info:
|
|
33
|
+
info: ThingSchema
|
|
34
34
|
/**
|
|
35
35
|
* The HTTP definition of the request.
|
|
36
36
|
*/
|
|
@@ -432,7 +432,7 @@ export class Request {
|
|
|
432
432
|
/**
|
|
433
433
|
* Sets the basic information about a project.
|
|
434
434
|
*/
|
|
435
|
-
setInfo(info:
|
|
435
|
+
setInfo(info: ThingSchema): void {
|
|
436
436
|
this.info = new Thing(info)
|
|
437
437
|
this.updated = Date.now()
|
|
438
438
|
}
|
package/src/models/Thing.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { observed } from '../decorators/observed.js'
|
|
|
5
5
|
/**
|
|
6
6
|
* An interface describing a base metadata of a thing.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export interface ThingSchema {
|
|
9
9
|
/**
|
|
10
10
|
* The data kind. The application ignores the input with an unknown `kind`, unless
|
|
11
11
|
* it can be determined from the context.
|
|
@@ -30,6 +30,11 @@ export declare interface IThing {
|
|
|
30
30
|
version?: string
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Use {@link ThingSchema} instead.
|
|
35
|
+
*/
|
|
36
|
+
export type IThing = ThingSchema
|
|
37
|
+
|
|
33
38
|
export class Thing extends EventTarget {
|
|
34
39
|
kind = ThingKind
|
|
35
40
|
/**
|
|
@@ -78,7 +83,7 @@ export class Thing extends EventTarget {
|
|
|
78
83
|
*
|
|
79
84
|
* @param input The thing definition used to restore the state.
|
|
80
85
|
*/
|
|
81
|
-
static fromJSON(input: Partial<
|
|
86
|
+
static fromJSON(input: Partial<ThingSchema> = {}, defaults: Partial<ThingSchema> = {}): Thing {
|
|
82
87
|
const result = new Thing()
|
|
83
88
|
const { name, displayName, description, version } = input || {}
|
|
84
89
|
if (typeof name === 'string') {
|
|
@@ -107,9 +112,9 @@ export class Thing extends EventTarget {
|
|
|
107
112
|
/**
|
|
108
113
|
* @param input The thing definition used to restore the state.
|
|
109
114
|
*/
|
|
110
|
-
constructor(input?: string |
|
|
115
|
+
constructor(input?: string | ThingSchema) {
|
|
111
116
|
super()
|
|
112
|
-
let init:
|
|
117
|
+
let init: ThingSchema
|
|
113
118
|
if (typeof input === 'string') {
|
|
114
119
|
init = JSON.parse(input)
|
|
115
120
|
} else if (typeof input === 'object') {
|
|
@@ -127,7 +132,7 @@ export class Thing extends EventTarget {
|
|
|
127
132
|
*
|
|
128
133
|
* Note, this throws an error when the server is not a thing.
|
|
129
134
|
*/
|
|
130
|
-
new(init:
|
|
135
|
+
new(init: ThingSchema): void {
|
|
131
136
|
if (!Thing.isThing(init)) {
|
|
132
137
|
throw new Error(`Not a thing.`)
|
|
133
138
|
}
|
|
@@ -146,7 +151,7 @@ export class Thing extends EventTarget {
|
|
|
146
151
|
static validate(input: unknown, options: ModelValidationOptions = {}): boolean {
|
|
147
152
|
const { strict } = options
|
|
148
153
|
if (input && typeof input === 'object') {
|
|
149
|
-
const typed = input as
|
|
154
|
+
const typed = input as ThingSchema
|
|
150
155
|
if (strict && typed.kind !== ThingKind) {
|
|
151
156
|
return false
|
|
152
157
|
}
|
|
@@ -159,15 +164,15 @@ export class Thing extends EventTarget {
|
|
|
159
164
|
* Checks whether the input is a definition of a server.
|
|
160
165
|
*/
|
|
161
166
|
static isThing(input: unknown): boolean {
|
|
162
|
-
const typed = input as
|
|
167
|
+
const typed = input as ThingSchema
|
|
163
168
|
if (input && typed.kind === ThingKind) {
|
|
164
169
|
return true
|
|
165
170
|
}
|
|
166
171
|
return false
|
|
167
172
|
}
|
|
168
173
|
|
|
169
|
-
toJSON():
|
|
170
|
-
const result:
|
|
174
|
+
toJSON(): ThingSchema {
|
|
175
|
+
const result: ThingSchema = {
|
|
171
176
|
kind: ThingKind,
|
|
172
177
|
}
|
|
173
178
|
if (typeof this.name === 'string') {
|
package/src/models/TrashEntry.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DeletionSchema } from './store/Deletion.js'
|
|
2
2
|
|
|
3
3
|
export interface TrashEntryCreate {
|
|
4
4
|
/**
|
|
@@ -41,7 +41,7 @@ export interface TrashEntry extends TrashEntryCreate {
|
|
|
41
41
|
/**
|
|
42
42
|
* The delete info.
|
|
43
43
|
*/
|
|
44
|
-
info:
|
|
44
|
+
info: DeletionSchema
|
|
45
45
|
/**
|
|
46
46
|
* Trash entry capabilities for the user.
|
|
47
47
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* This is populated by the store each time the user requests
|
|
4
4
|
* a file.
|
|
5
5
|
*/
|
|
6
|
-
export interface
|
|
6
|
+
export interface CapabilitiesSchema {
|
|
7
7
|
/**
|
|
8
8
|
* Whether the user can edit the content of the file.
|
|
9
9
|
* This is always false for folders.
|
|
@@ -55,3 +55,8 @@ export interface ICapabilities {
|
|
|
55
55
|
*/
|
|
56
56
|
canMove: boolean
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated Use {@link CapabilitiesSchema} instead.
|
|
61
|
+
*/
|
|
62
|
+
export type ICapabilities = CapabilitiesSchema
|
|
@@ -2,7 +2,7 @@ import { DeletionKind } from '../kinds.js'
|
|
|
2
2
|
/**
|
|
3
3
|
* A schema describing the delete action performed on an entity.
|
|
4
4
|
*/
|
|
5
|
-
export interface
|
|
5
|
+
export interface DeletionSchema {
|
|
6
6
|
/**
|
|
7
7
|
* The deletion kind
|
|
8
8
|
*/
|
|
@@ -31,3 +31,8 @@ export interface IDeletion {
|
|
|
31
31
|
*/
|
|
32
32
|
byMe: boolean
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Use DeletionSchema instead.
|
|
37
|
+
*/
|
|
38
|
+
export type IDeletion = DeletionSchema
|