@azure/ai-language-text 1.1.0-alpha.20221102.2 → 1.1.0-alpha.20221107.2

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/dist/index.js CHANGED
@@ -1158,6 +1158,20 @@ const HealthcareRelationEntity = {
1158
1158
  }
1159
1159
  }
1160
1160
  };
1161
+ const DocumentDetectedLanguageForHealthcare = {
1162
+ type: {
1163
+ name: "Composite",
1164
+ className: "DocumentDetectedLanguageForHealthcare",
1165
+ modelProperties: {
1166
+ detectedLanguage: {
1167
+ serializedName: "detectedLanguage",
1168
+ type: {
1169
+ name: "String"
1170
+ }
1171
+ }
1172
+ }
1173
+ }
1174
+ };
1161
1175
  const PreBuiltResult = {
1162
1176
  type: {
1163
1177
  name: "Composite",
@@ -2688,13 +2702,6 @@ const CustomLabelClassificationResultDocumentsItem = {
2688
2702
  modelProperties: Object.assign(Object.assign({}, ClassificationDocumentResult.type.modelProperties), DocumentDetectedLanguage.type.modelProperties)
2689
2703
  }
2690
2704
  };
2691
- const HealthcareResultDocumentsItem = {
2692
- type: {
2693
- name: "Composite",
2694
- className: "HealthcareResultDocumentsItem",
2695
- modelProperties: Object.assign(Object.assign({}, HealthcareEntitiesDocumentResult.type.modelProperties), DocumentDetectedLanguage.type.modelProperties)
2696
- }
2697
- };
2698
2705
  const SentimentResponseDocumentsItem = {
2699
2706
  type: {
2700
2707
  name: "Composite",
@@ -2744,6 +2751,13 @@ const AbstractiveSummaryDocumentResultWithDetectedLanguage = {
2744
2751
  modelProperties: Object.assign(Object.assign({}, AbstractiveSummaryDocumentResult.type.modelProperties), DocumentDetectedLanguage.type.modelProperties)
2745
2752
  }
2746
2753
  };
2754
+ const HealthcareResultDocumentsItem = {
2755
+ type: {
2756
+ name: "Composite",
2757
+ className: "HealthcareResultDocumentsItem",
2758
+ modelProperties: Object.assign(Object.assign({}, HealthcareEntitiesDocumentResult.type.modelProperties), DocumentDetectedLanguageForHealthcare.type.modelProperties)
2759
+ }
2760
+ };
2747
2761
  const HealthcareResult = {
2748
2762
  type: {
2749
2763
  name: "Composite",
@@ -3600,6 +3614,7 @@ var Mappers = /*#__PURE__*/Object.freeze({
3600
3614
  EntityDataSource: EntityDataSource,
3601
3615
  HealthcareRelation: HealthcareRelation,
3602
3616
  HealthcareRelationEntity: HealthcareRelationEntity,
3617
+ DocumentDetectedLanguageForHealthcare: DocumentDetectedLanguageForHealthcare,
3603
3618
  PreBuiltResult: PreBuiltResult,
3604
3619
  InputError: InputError,
3605
3620
  SentimentConfidenceScores: SentimentConfidenceScores,
@@ -3667,7 +3682,6 @@ var Mappers = /*#__PURE__*/Object.freeze({
3667
3682
  AbstractiveSummaryDocumentResult: AbstractiveSummaryDocumentResult,
3668
3683
  CustomEntitiesResultDocumentsItem: CustomEntitiesResultDocumentsItem,
3669
3684
  CustomLabelClassificationResultDocumentsItem: CustomLabelClassificationResultDocumentsItem,
3670
- HealthcareResultDocumentsItem: HealthcareResultDocumentsItem,
3671
3685
  SentimentResponseDocumentsItem: SentimentResponseDocumentsItem,
3672
3686
  EntitiesResultDocumentsItem: EntitiesResultDocumentsItem,
3673
3687
  EntityLinkingResultDocumentsItem: EntityLinkingResultDocumentsItem,
@@ -3675,6 +3689,7 @@ var Mappers = /*#__PURE__*/Object.freeze({
3675
3689
  ExtractedSummaryDocumentResultWithDetectedLanguage: ExtractedSummaryDocumentResultWithDetectedLanguage,
3676
3690
  KeyPhraseResultDocumentsItem: KeyPhraseResultDocumentsItem,
3677
3691
  AbstractiveSummaryDocumentResultWithDetectedLanguage: AbstractiveSummaryDocumentResultWithDetectedLanguage,
3692
+ HealthcareResultDocumentsItem: HealthcareResultDocumentsItem,
3678
3693
  HealthcareResult: HealthcareResult,
3679
3694
  SentimentResponse: SentimentResponse,
3680
3695
  EntitiesResult: EntitiesResult,
@@ -4019,6 +4034,18 @@ async function throwError(p) {
4019
4034
  throw transformError(e);
4020
4035
  }
4021
4036
  }
4037
+ function deserializeDetectedLanguage(input) {
4038
+ function helper(str) {
4039
+ try {
4040
+ return JSON.parse(str);
4041
+ }
4042
+ catch (e) {
4043
+ return undefined;
4044
+ }
4045
+ }
4046
+ const obj = helper(input);
4047
+ return obj !== undefined ? obj : { iso6391Name: input };
4048
+ }
4022
4049
  function toHealthcareResult(docIds, results) {
4023
4050
  function makeHealthcareEntity(entity) {
4024
4051
  const { dataSources } = entity, rest = tslib.__rest(entity, ["dataSources"]);
@@ -4036,9 +4063,11 @@ function toHealthcareResult(docIds, results) {
4036
4063
  }
4037
4064
  return transformDocumentResults(docIds, results, {
4038
4065
  processSuccess: (_a) => {
4039
- var { entities, relations } = _a, rest = tslib.__rest(_a, ["entities", "relations"]);
4066
+ var { entities, relations, detectedLanguage } = _a, rest = tslib.__rest(_a, ["entities", "relations", "detectedLanguage"]);
4040
4067
  const newEntities = entities.map(makeHealthcareEntity);
4041
- return Object.assign({ entities: newEntities, entityRelations: relations.map(makeHealthcareRelation(newEntities)) }, rest);
4068
+ return Object.assign(Object.assign({ entities: newEntities, entityRelations: relations.map(makeHealthcareRelation(newEntities)) }, (detectedLanguage
4069
+ ? { detectedLanguage: deserializeDetectedLanguage(detectedLanguage) }
4070
+ : {})), rest);
4042
4071
  },
4043
4072
  });
4044
4073
  }
@@ -4263,10 +4292,11 @@ function processAnalyzeResult(options) {
4263
4292
  */
4264
4293
  function createUpdateAnalyzeState(docIds) {
4265
4294
  return (state, lastResponse) => {
4266
- const { createdOn, modifiedOn, id, displayName, expiresOn, tasks } = lastResponse.flatResponse;
4295
+ const { createdOn, modifiedOn, id, displayName, expiresOn, tasks, lastUpdateDateTime } = lastResponse.flatResponse;
4267
4296
  const mutableState = state;
4268
4297
  mutableState.createdOn = createdOn;
4269
- mutableState.modifiedOn = modifiedOn;
4298
+ // FIXME: remove this mitigation when the service API is fixed
4299
+ mutableState.modifiedOn = modifiedOn ? modifiedOn : new Date(lastUpdateDateTime);
4270
4300
  mutableState.expiresOn = expiresOn;
4271
4301
  mutableState.displayName = displayName;
4272
4302
  mutableState.id = id;