diff --git a/src/api/v2/ontology/ontologies-endpoint.spec.ts b/src/api/v2/ontology/ontologies-endpoint.spec.ts index 4d8d06968..931e47cfc 100644 --- a/src/api/v2/ontology/ontologies-endpoint.spec.ts +++ b/src/api/v2/ontology/ontologies-endpoint.spec.ts @@ -1,7 +1,6 @@ import { MockAjaxCall } from "../../../../test/mockajaxcall"; import { KnoraApiConfig } from "../../../knora-api-config"; import { KnoraApiConnection } from "../../../knora-api-connection"; -import { ApiResponseError } from "../../../models/api-response-error"; import { Constants } from "../../../models/v2/Constants"; import { Cardinality } from "../../../models/v2/ontologies/class-definition"; import { CreateOntology } from "../../../models/v2/ontologies/create/create-ontology"; @@ -16,11 +15,11 @@ import { CanDoResponse } from "../../../models/v2/ontologies/read/can-do-respons import { ReadOntology } from "../../../models/v2/ontologies/read/read-ontology"; import { ResourceClassDefinition, - ResourceClassDefinitionWithAllLanguages + ResourceClassDefinitionWithAllLanguages, } from "../../../models/v2/ontologies/resource-class-definition"; import { ResourcePropertyDefinition, - ResourcePropertyDefinitionWithAllLanguages + ResourcePropertyDefinitionWithAllLanguages, } from "../../../models/v2/ontologies/resource-property-definition"; import { StandoffClassDefinition } from "../../../models/v2/ontologies/standoff-class-definition"; import { SystemPropertyDefinition } from "../../../models/v2/ontologies/system-property-definition"; @@ -865,7 +864,7 @@ describe("OntologiesEndpoint", () => { "http://schema.org/name" ]; - newResProp.objectType = Constants.TextValue; + newResProp.objectType = Constants.UnformattedTextValue; newResProp.subjectType = "http://0.0.0.0:3333/ontology/0001/anything/v2#Thing"; diff --git a/src/api/v2/resource/resources-endpoint.spec.ts b/src/api/v2/resource/resources-endpoint.spec.ts index 9eec19a96..7b4f086da 100644 --- a/src/api/v2/resource/resources-endpoint.spec.ts +++ b/src/api/v2/resource/resources-endpoint.spec.ts @@ -24,8 +24,8 @@ import { CreateIntervalValue } from "../../../models/v2/resources/values/create/ import { CreateLinkValue } from "../../../models/v2/resources/values/create/create-link-value"; import { CreateListValue } from "../../../models/v2/resources/values/create/create-list-value"; import { - CreateTextValueAsString, - CreateTextValueAsXml + CreateFormattedTextValue, + CreateUnformattedTextValue, } from "../../../models/v2/resources/values/create/create-text-value"; import { CreateTimeValue } from "../../../models/v2/resources/values/create/create-time-value"; import { CreateUriValue } from "../../../models/v2/resources/values/create/create-uri-value"; @@ -237,11 +237,11 @@ describe("ResourcesEndpoint", () => { const linkVal = new CreateLinkValue(); linkVal.linkedResourceIri = "http://rdfh.ch/0001/a-thing"; - const textValStandoff = new CreateTextValueAsXml(); + const textValStandoff = new CreateFormattedTextValue(); textValStandoff.xml = "\n

this is text

with standoff
"; textValStandoff.mapping = "http://rdfh.ch/standoff/mappings/StandardMapping"; - const textValString = new CreateTextValueAsString(); + const textValString = new CreateUnformattedTextValue(); textValString.text = "this is text without standoff"; const uriVal = new CreateUriValue(); diff --git a/src/api/v2/values/values-endpoint.spec.ts b/src/api/v2/values/values-endpoint.spec.ts index a3b40aafb..e23a0c301 100644 --- a/src/api/v2/values/values-endpoint.spec.ts +++ b/src/api/v2/values/values-endpoint.spec.ts @@ -19,8 +19,8 @@ import { CreateIntervalValue } from "../../../models/v2/resources/values/create/ import { CreateLinkValue } from "../../../models/v2/resources/values/create/create-link-value"; import { CreateListValue } from "../../../models/v2/resources/values/create/create-list-value"; import { - CreateTextValueAsString, - CreateTextValueAsXml + CreateFormattedTextValue, + CreateUnformattedTextValue, } from "../../../models/v2/resources/values/create/create-text-value"; import { CreateTimeValue } from "../../../models/v2/resources/values/create/create-time-value"; import { CreateUriValue } from "../../../models/v2/resources/values/create/create-uri-value"; @@ -39,8 +39,8 @@ import { ReadIntervalValue } from "../../../models/v2/resources/values/read/read import { ReadLinkValue } from "../../../models/v2/resources/values/read/read-link-value"; import { ReadListValue } from "../../../models/v2/resources/values/read/read-list-value"; import { - ReadTextValueAsString, - ReadTextValueAsXml + ReadFormattedTextValue, + ReadUnformattedTextValue, } from "../../../models/v2/resources/values/read/read-text-value"; import { ReadTimeValue } from "../../../models/v2/resources/values/read/read-time-value"; import { UpdateBooleanValue } from "../../../models/v2/resources/values/update/update-boolean-value"; @@ -55,8 +55,8 @@ import { UpdateIntervalValue } from "../../../models/v2/resources/values/update/ import { UpdateLinkValue } from "../../../models/v2/resources/values/update/update-link-value"; import { UpdateListValue } from "../../../models/v2/resources/values/update/update-list-value"; import { - UpdateTextValueAsString, - UpdateTextValueAsXml + UpdateFormattedTextValue, + UpdateUnformattedTextValue, } from "../../../models/v2/resources/values/update/update-text-value"; import { UpdateTimeValue } from "../../../models/v2/resources/values/update/update-time-value"; import { UpdateUriValue } from "../../../models/v2/resources/values/update/update-uri-value"; @@ -335,7 +335,7 @@ describe("ValuesEndpoint", () => { knoraApiConnection.v2.values.getValue("http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw", "SZyeLLmOTcCCuS3B0VksHQ").subscribe( (res: ReadResource) => { - const textVal = res.getValuesAs("http://0.0.0.0:3333/ontology/0001/anything/v2#hasText", ReadTextValueAsString); + const textVal = res.getValuesAs("http://0.0.0.0:3333/ontology/0001/anything/v2#hasText", ReadUnformattedTextValue); expect(textVal.length).toEqual(1); expect(textVal[0].text).toEqual("test"); @@ -364,7 +364,7 @@ describe("ValuesEndpoint", () => { knoraApiConnection.v2.values.getValue("http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw", "rvB4eQ5MTF-Qxq0YgkwaDg").subscribe( (res: ReadResource) => { - const textVal = res.getValuesAs("http://0.0.0.0:3333/ontology/0001/anything/v2#hasRichtext", ReadTextValueAsXml); + const textVal = res.getValuesAs("http://0.0.0.0:3333/ontology/0001/anything/v2#hasRichtext", ReadFormattedTextValue); expect(textVal.length).toEqual(1); expect(textVal[0].xml).toEqual("\n

test with markup

"); expect(textVal[0].mapping).toEqual("http://rdfh.ch/standoff/mappings/StandardMapping"); @@ -947,7 +947,7 @@ describe("ValuesEndpoint", () => { it("should update a text value as string", done => { - const updateTextVal = new UpdateTextValueAsString(); + const updateTextVal = new UpdateUnformattedTextValue(); updateTextVal.id = "http://rdfh.ch/0001/a-thing/values/pHuFhBelROGexp2IhaLQAg"; updateTextVal.text = "text without standoff updated"; @@ -962,7 +962,7 @@ describe("ValuesEndpoint", () => { knoraApiConnection.v2.values.updateValue(updateResource).subscribe( (res: WriteValueResponse) => { expect(res.id).toEqual("http://rdfh.ch/0001/a-thing/values/updated"); - expect(res.type).toEqual(Constants.TextValue); + expect(res.type).toEqual(Constants.UnformattedTextValue); done(); } ); @@ -971,7 +971,7 @@ describe("ValuesEndpoint", () => { request.respondWith(MockAjaxCall.mockResponse(WriteValueMocks.mockUpdateValueResponse( "http://rdfh.ch/0001/a-thing/values/updated", - Constants.TextValue, + Constants.UnformattedTextValue, "uuid"))); expect(request.url).toBe("http://0.0.0.0:3333/v2/values"); @@ -990,7 +990,7 @@ describe("ValuesEndpoint", () => { it("should update a text value as XML", done => { - const updateTextVal = new UpdateTextValueAsXml(); + const updateTextVal = new UpdateFormattedTextValue(); updateTextVal.id = "http://rdfh.ch/0001/a-thing/values/I4OWMilwQwaYvaN5wlUIqg"; updateTextVal.xml = "\n\n This updated text links to another resource.\n"; @@ -1006,7 +1006,7 @@ describe("ValuesEndpoint", () => { knoraApiConnection.v2.values.updateValue(updateResource).subscribe( (res: WriteValueResponse) => { expect(res.id).toEqual("http://rdfh.ch/0001/a-thing/values/updated"); - expect(res.type).toEqual(Constants.TextValue); + expect(res.type).toEqual(Constants.FormattedTextValue); done(); } ); @@ -1015,7 +1015,7 @@ describe("ValuesEndpoint", () => { request.respondWith(MockAjaxCall.mockResponse(WriteValueMocks.mockUpdateValueResponse( "http://rdfh.ch/0001/a-thing/values/updated", - Constants.TextValue, + Constants.FormattedTextValue, "uuid"))); expect(request.url).toBe("http://0.0.0.0:3333/v2/values"); @@ -1353,7 +1353,7 @@ describe("ValuesEndpoint", () => { it("should update an integer value with a comment", done => { - const updateTextVal = new UpdateTextValueAsString(); + const updateTextVal = new UpdateUnformattedTextValue(); updateTextVal.id = "http://rdfh.ch/0001/a-thing/values/NVRw0-VkQL2YdI_kgkV33Q"; updateTextVal.text = "text without standoff updated"; @@ -1832,7 +1832,7 @@ describe("ValuesEndpoint", () => { it("should create a text value as string", done => { - const updateTextVal = new CreateTextValueAsString(); + const updateTextVal = new CreateUnformattedTextValue(); updateTextVal.text = "text without standoff"; @@ -1846,7 +1846,7 @@ describe("ValuesEndpoint", () => { knoraApiConnection.v2.values.createValue(createResource).subscribe( (res: WriteValueResponse) => { expect(res.id).toEqual("http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/created"); - expect(res.type).toEqual(Constants.TextValue); + expect(res.type).toEqual(Constants.UnformattedTextValue); done(); } ); @@ -1855,7 +1855,7 @@ describe("ValuesEndpoint", () => { request.respondWith(MockAjaxCall.mockResponse(WriteValueMocks.mockCreateValueResponse( "http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/created", - Constants.TextValue, + Constants.UnformattedTextValue, "uuid", "2019-01-09T15:45:54.502951Z"))); @@ -1872,7 +1872,7 @@ describe("ValuesEndpoint", () => { it("should create a text value as XML", done => { - const createTextVal = new CreateTextValueAsXml(); + const createTextVal = new CreateFormattedTextValue(); createTextVal.xml = "\n\n This text links to another resource.\n And this strong value is linked by this link\n"; createTextVal.mapping = "http://rdfh.ch/standoff/mappings/StandardMapping"; @@ -1887,7 +1887,7 @@ describe("ValuesEndpoint", () => { knoraApiConnection.v2.values.createValue(updateResource).subscribe( (res: WriteValueResponse) => { expect(res.id).toEqual("http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/created"); - expect(res.type).toEqual(Constants.TextValue); + expect(res.type).toEqual(Constants.FormattedTextValue); done(); } ); @@ -1896,7 +1896,7 @@ describe("ValuesEndpoint", () => { request.respondWith(MockAjaxCall.mockResponse(WriteValueMocks.mockCreateValueResponse( "http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/created", - Constants.TextValue, + Constants.FormattedTextValue, "uuid", "2019-01-09T15:45:54.502951Z"))); @@ -2193,7 +2193,7 @@ describe("ValuesEndpoint", () => { it("should create a text value with a comment", done => { - const createTextVal = new CreateTextValueAsString(); + const createTextVal = new CreateUnformattedTextValue(); createTextVal.text = "this is a text value that has a comment"; createTextVal.valueHasComment = "this is a comment"; @@ -2208,7 +2208,7 @@ describe("ValuesEndpoint", () => { knoraApiConnection.v2.values.createValue(updateResource).subscribe( (res: WriteValueResponse) => { expect(res.id).toEqual("http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/created"); - expect(res.type).toEqual(Constants.TextValue); + expect(res.type).toEqual(Constants.UnformattedTextValue); done(); } ); @@ -2217,7 +2217,7 @@ describe("ValuesEndpoint", () => { request.respondWith(MockAjaxCall.mockResponse(WriteValueMocks.mockCreateValueResponse( "http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/created", - Constants.TextValue, + Constants.UnformattedTextValue, "uuid", "2019-01-09T15:45:54.502951Z"))); diff --git a/src/index.ts b/src/index.ts index 3e271ec12..f632cf3ca 100644 --- a/src/index.ts +++ b/src/index.ts @@ -182,12 +182,9 @@ export { ReadIntervalValue } from "./models/v2/resources/values/read/read-interv export { ReadLinkValue } from "./models/v2/resources/values/read/read-link-value"; export { ReadListValue } from "./models/v2/resources/values/read/read-list-value"; export { - ReadTextValue, - ReadTextValueAsString, - ReadTextValueAsHtml, - ReadTextValueAsXml, + ReadTextValue, ReadUnformattedTextValue, - ReadFormattedTextValue + ReadFormattedTextValue, } from "./models/v2/resources/values/read/read-text-value"; export { ReadUriValue } from "./models/v2/resources/values/read/read-uri-value"; export { ReadTimeValue } from "./models/v2/resources/values/read/read-time-value"; @@ -213,12 +210,9 @@ export { UpdateIntValue } from "./models/v2/resources/values/update/update-int-v export { UpdateIntervalValue } from "./models/v2/resources/values/update/update-interval-value"; export { UpdateLinkValue } from "./models/v2/resources/values/update/update-link-value"; export { UpdateListValue } from "./models/v2/resources/values/update/update-list-value"; -export { - UpdateTextValueAsString, - UpdateTextValueAsXml, - UpdateTextValueAsHtml, +export { + UpdateFormattedTextValue, UpdateUnformattedTextValue, - UpdateFormattedTextValue } from "./models/v2/resources/values/update/update-text-value"; export { UpdateUriValue } from "./models/v2/resources/values/update/update-uri-value"; export { UpdateTimeValue } from "./models/v2/resources/values/update/update-time-value"; @@ -243,11 +237,9 @@ export { CreateIntValue } from "./models/v2/resources/values/create/create-int-v export { CreateIntervalValue } from "./models/v2/resources/values/create/create-interval-value"; export { CreateLinkValue } from "./models/v2/resources/values/create/create-link-value"; export { CreateListValue } from "./models/v2/resources/values/create/create-list-value"; -export { - CreateTextValueAsString, - CreateTextValueAsXml, +export { + CreateFormattedTextValue, CreateUnformattedTextValue, - CreateFormattedTextValue } from "./models/v2/resources/values/create/create-text-value"; export { CreateUriValue } from "./models/v2/resources/values/create/create-uri-value"; export { CreateTimeValue } from "./models/v2/resources/values/create/create-time-value"; diff --git a/src/models/v2/Constants.ts b/src/models/v2/Constants.ts index cbc29f9f3..b94ba8e3f 100644 --- a/src/models/v2/Constants.ts +++ b/src/models/v2/Constants.ts @@ -38,7 +38,6 @@ export class Constants { static IntervalValue = Constants.KnoraApiV2 + Constants.HashDelimiter + "IntervalValue"; static ListValue = Constants.KnoraApiV2 + Constants.HashDelimiter + "ListValue"; static ListNode = Constants.KnoraApiV2 + Constants.HashDelimiter + "ListNode"; - static TextValue = Constants.KnoraApiV2 + Constants.HashDelimiter + "TextValue"; static FormattedTextValue = Constants.KnoraApiV2 + Constants.HashDelimiter + "FormattedTextValue"; static UnformattedTextValue = Constants.KnoraApiV2 + Constants.HashDelimiter + "UnformattedTextValue"; static CustomFormattedTextValue = Constants.KnoraApiV2 + Constants.HashDelimiter + "CustomFormattedTextValue"; diff --git a/src/models/v2/resources/ResourcesConversionUtil.spec.ts b/src/models/v2/resources/ResourcesConversionUtil.spec.ts index 116a48561..d8bca42f2 100644 --- a/src/models/v2/resources/ResourcesConversionUtil.spec.ts +++ b/src/models/v2/resources/ResourcesConversionUtil.spec.ts @@ -19,7 +19,10 @@ import { ReadIntValue } from "./values/read/read-int-value"; import { ReadIntervalValue } from "./values/read/read-interval-value"; import { ReadLinkValue } from "./values/read/read-link-value"; import { ReadListValue } from "./values/read/read-list-value"; -import { ReadTextValueAsString, ReadTextValueAsXml } from "./values/read/read-text-value"; +import { + ReadFormattedTextValue, + ReadUnformattedTextValue, +} from "./values/read/read-text-value"; import { ReadTimeValue } from "./values/read/read-time-value"; import { ReadUriValue } from "./values/read/read-uri-value"; @@ -190,11 +193,11 @@ describe("ResourcesConversionUtil", () => { // const rtextVals = resSeq.resources[0].getValues("http://0.0.0.0:3333/ontology/0001/anything/v2#hasRichtext"); expect(rtextVals.length).toEqual(1); - expect(rtextVals[0].type).toEqual("http://api.knora.org/ontology/knora-api/v2#TextValue"); + expect(rtextVals[0].type).toEqual("http://api.knora.org/ontology/knora-api/v2#FormattedTextValue"); expect(rtextVals[0].strval).toEqual("\n

test with markup

"); - expect(rtextVals[0] instanceof ReadTextValueAsXml).toBeTruthy(); - if (rtextVals[0] instanceof ReadTextValueAsXml) { - const rtextValsTyped: ReadTextValueAsXml[] = resSeq.resources[0].getValuesAs("http://0.0.0.0:3333/ontology/0001/anything/v2#hasRichtext", ReadTextValueAsXml); + expect(rtextVals[0] instanceof ReadFormattedTextValue).toBeTruthy(); + if (rtextVals[0] instanceof ReadFormattedTextValue) { + const rtextValsTyped: ReadFormattedTextValue[] = resSeq.resources[0].getValuesAs("http://0.0.0.0:3333/ontology/0001/anything/v2#hasRichtext", ReadFormattedTextValue); expect(rtextValsTyped[0].xml).toEqual("\n

test with markup

"); expect(rtextValsTyped[0].mapping).toEqual("http://rdfh.ch/standoff/mappings/StandardMapping"); } @@ -204,11 +207,11 @@ describe("ResourcesConversionUtil", () => { // const textVals = resSeq.resources[0].getValues("http://0.0.0.0:3333/ontology/0001/anything/v2#hasText"); expect(textVals.length).toEqual(1); - expect(textVals[0].type).toEqual("http://api.knora.org/ontology/knora-api/v2#TextValue"); + expect(textVals[0].type).toEqual("http://api.knora.org/ontology/knora-api/v2#UnformattedTextValue"); expect(textVals[0].strval).toEqual("test"); - expect(textVals[0] instanceof ReadTextValueAsString).toBeTruthy(); - if (textVals[0] instanceof ReadTextValueAsString) { - const textValsTyped: ReadTextValueAsString[] = resSeq.resources[0].getValuesAs("http://0.0.0.0:3333/ontology/0001/anything/v2#hasText", ReadTextValueAsString); + expect(textVals[0] instanceof ReadUnformattedTextValue).toBeTruthy(); + if (textVals[0] instanceof ReadUnformattedTextValue) { + const textValsTyped: ReadUnformattedTextValue[] = resSeq.resources[0].getValuesAs("http://0.0.0.0:3333/ontology/0001/anything/v2#hasText", ReadUnformattedTextValue); expect(textValsTyped[0].text).toEqual("test"); } diff --git a/src/models/v2/resources/ResourcesConversionUtil.ts b/src/models/v2/resources/ResourcesConversionUtil.ts index e3cb0da6e..9815e812e 100644 --- a/src/models/v2/resources/ResourcesConversionUtil.ts +++ b/src/models/v2/resources/ResourcesConversionUtil.ts @@ -18,7 +18,7 @@ import { ReadDocumentFileValue, ReadMovingImageFileValue, ReadStillImageFileValue, - ReadTextFileValue + ReadTextFileValue, } from "./values/read/read-file-value"; import { ParseReadGeomValue, ReadGeomValue } from "./values/read/read-geom-value"; import { ReadGeonameValue } from "./values/read/read-geoname-value"; @@ -28,10 +28,7 @@ import { ReadLinkValue } from "./values/read/read-link-value"; import { ReadListValue } from "./values/read/read-list-value"; import { ReadFormattedTextValue, - ReadTextValue, - ReadTextValueAsHtml, - ReadTextValueAsString, - ReadTextValueAsXml, ReadUnformattedTextValue + ReadUnformattedTextValue, } from "./values/read/read-text-value"; import { ReadTimeValue } from "./values/read/read-time-value"; import { ReadUriValue } from "./values/read/read-uri-value"; @@ -203,32 +200,6 @@ export namespace ResourcesConversionUtil { return of(jsonConvert.deserialize(valueJsonld, dataType) as T); }; - /** - * Converts a text value serialized as JSON-LD to a `ReadTextValue`. - * - * @param valueJsonld text value as JSON-LD to be converted. - * @param jsonConvert jsonConvert the converter to be used. - */ - const handleTextValue = (valueJsonld: object, jsonConvert: JsonConvert): Observable => { - - if (valueJsonld.hasOwnProperty(Constants.ValueAsString)) { - // TODO: query standoff, if any. - const textValue = - jsonConvert.deserialize(valueJsonld, ReadTextValueAsString) as ReadTextValueAsString; - return of(textValue); - } else if (valueJsonld.hasOwnProperty(Constants.TextValueAsHtml)) { - const textValue = - jsonConvert.deserialize(valueJsonld, ReadTextValueAsHtml) as ReadTextValueAsHtml; - return of(textValue); - } else if (valueJsonld.hasOwnProperty(Constants.TextValueAsXml)) { - const textValue = - jsonConvert.deserialize(valueJsonld, ReadTextValueAsXml) as ReadTextValueAsXml; - return of(textValue); - } else { - throw new Error("Invalid Text value"); - } - }; - /** * Converts a link value serialized as JSON-LD to a `ReadTextValue`. * @@ -402,23 +373,6 @@ export namespace ResourcesConversionUtil { break; } - case Constants.TextValue: { - const textVal = handleTextValue(valueJsonld, jsonConvert); - value = textVal.pipe(map((val: ReadTextValue) => { - if (val instanceof ReadTextValueAsString) { - val.strval = val.text; - } else if (val instanceof ReadTextValueAsXml) { - val.strval = val.xml; - } else if (val instanceof ReadTextValueAsHtml) { - val.strval = val.html; - } else { - console.error("String representation for a ReadTextValue could not be constructed for: ", type); - } - return val; - })); - break; - } - case Constants.LinkValue: { const linkVal = handleLinkValue(valueJsonld, ontologyCache, listNodeCache, jsonConvert); value = linkVal.pipe(map((val: ReadLinkValue) => { @@ -548,4 +502,3 @@ export namespace ResourcesConversionUtil { }; } -; diff --git a/src/models/v2/resources/values/create/create-text-value.ts b/src/models/v2/resources/values/create/create-text-value.ts index 0b4c1db29..95ff3a87f 100644 --- a/src/models/v2/resources/values/create/create-text-value.ts +++ b/src/models/v2/resources/values/create/create-text-value.ts @@ -3,45 +3,10 @@ import { Constants } from "../../../Constants"; import { IdConverter } from "../../../custom-converters/id-converter"; import { IBaseFormattedTextValue, - IBaseTextValueAsString, - IBaseTextValueAsXml, - IBaseUnformattedTextValue + IBaseUnformattedTextValue, } from "../type-specific-interfaces/base-text-value"; import { CreateValue } from "./create-value"; -/** - * @category Model V2 - */ -@JsonObject("CreateTextValueAsString") -export class CreateTextValueAsString extends CreateValue implements IBaseTextValueAsString { - - @JsonProperty(Constants.ValueAsString, String) - text: string = ""; - - constructor() { - super(Constants.TextValue); - } - -} - -/** - * @category Model V2 - */ -@JsonObject("CreateTextValueAsXml") -export class CreateTextValueAsXml extends CreateValue implements IBaseTextValueAsXml { - - @JsonProperty(Constants.TextValueAsXml, String) - xml: string = ""; - - @JsonProperty(Constants.TextValueHasMapping, IdConverter) - mapping: string = ""; - - constructor() { - super(Constants.TextValue); - } - -} - /** * @category Model V2 */ diff --git a/src/models/v2/resources/values/read/read-text-value.ts b/src/models/v2/resources/values/read/read-text-value.ts index 972ecb54b..af2d5ff30 100644 --- a/src/models/v2/resources/values/read/read-text-value.ts +++ b/src/models/v2/resources/values/read/read-text-value.ts @@ -3,9 +3,7 @@ import { Constants } from "../../../Constants"; import { IdConverter } from "../../../custom-converters/id-converter"; import { IBaseFormattedTextValue, - IBaseTextValueAsHtml, - IBaseTextValueAsString, - IBaseTextValueAsXml, IBaseUnformattedTextValue + IBaseUnformattedTextValue, } from "../type-specific-interfaces/base-text-value"; import { ReadValue } from "./read-value"; @@ -16,48 +14,6 @@ import { ReadValue } from "./read-value"; export abstract class ReadTextValue extends ReadValue { } -/** - * @category Model V2 - */ -@JsonObject("ReadTextValueAsString") -export class ReadTextValueAsString extends ReadTextValue implements IBaseTextValueAsString { - - // TODO: query standoff, if any. - - @JsonProperty(Constants.ValueAsString, String) - text: string = ""; - -} - -/** - * @category Model V2 - */ -@JsonObject("ReadTextValueAsXml") -export class ReadTextValueAsXml extends ReadTextValue implements IBaseTextValueAsXml { - - @JsonProperty(Constants.TextValueAsXml, String) - xml: string = ""; - - @JsonProperty(Constants.TextValueHasMapping, IdConverter) - mapping: string = ""; - -} - -/** - * @category Model V2 - */ -@JsonObject("ReadTextValueAsHtml") -export class ReadTextValueAsHtml extends ReadTextValue implements IBaseTextValueAsHtml { - - @JsonProperty(Constants.TextValueAsHtml, String) - html: string = ""; - - // set xml value as optional to avoid breaking changes - @JsonProperty(Constants.TextValueAsXml, String, true) - xml: string = ""; - -} - /** * @category Model V2 */ diff --git a/src/models/v2/resources/values/type-specific-interfaces/base-text-value.ts b/src/models/v2/resources/values/type-specific-interfaces/base-text-value.ts index f565c7986..f4fa61775 100644 --- a/src/models/v2/resources/values/type-specific-interfaces/base-text-value.ts +++ b/src/models/v2/resources/values/type-specific-interfaces/base-text-value.ts @@ -1,34 +1,3 @@ -/** - * @category Internal - */ -export interface IBaseTextValueAsString { - - text: string; - -} - -/** - * @category Internal - */ -export interface IBaseTextValueAsXml { - - xml: string; - - mapping: string; - -} - -/** - * @category Internal - */ -export interface IBaseTextValueAsHtml { - - html: string; - - xml?: string; - -} - /** * @category Internal */ diff --git a/src/models/v2/resources/values/update/update-text-value.ts b/src/models/v2/resources/values/update/update-text-value.ts index 51492d935..5e308384d 100644 --- a/src/models/v2/resources/values/update/update-text-value.ts +++ b/src/models/v2/resources/values/update/update-text-value.ts @@ -3,62 +3,10 @@ import { Constants } from "../../../Constants"; import { IdConverter } from "../../../custom-converters/id-converter"; import { IBaseFormattedTextValue, - IBaseTextValueAsHtml, - IBaseTextValueAsString, - IBaseTextValueAsXml, - IBaseUnformattedTextValue + IBaseUnformattedTextValue, } from "../type-specific-interfaces/base-text-value"; import { UpdateValue } from "./update-value"; -/** - * @category Model V2 - */ -@JsonObject("UpdateTextValueAsString") -export class UpdateTextValueAsString extends UpdateValue implements IBaseTextValueAsString { - - @JsonProperty(Constants.ValueAsString, String) - text: string = ""; - - constructor() { - super(Constants.TextValue); - } - -} - -/** - * @category Model V2 - */ -@JsonObject("UpdateTextValueAsXml") -export class UpdateTextValueAsXml extends UpdateValue implements IBaseTextValueAsXml { - - @JsonProperty(Constants.TextValueAsXml, String) - xml: string = ""; - - @JsonProperty(Constants.TextValueHasMapping, IdConverter) - mapping: string = ""; - - constructor() { - super(Constants.TextValue); - } -} - -/** - * @category Model V2 - */ -@JsonObject("UpdateTextValueAsHtml") -export class UpdateTextValueAsHtml extends UpdateValue implements IBaseTextValueAsHtml { - - @JsonProperty(Constants.TextValueAsHtml, String, true) - html: string = ""; - - @JsonProperty(Constants.TextValueAsXml, String) - xml: string = ""; - - constructor() { - super(Constants.TextValue); - } -} - /** * @category Model V2 */