Skip to content

Commit

Permalink
DEV-22783 Update enums to handle glossary and coreProperty files
Browse files Browse the repository at this point in the history
  • Loading branch information
jogawebb authored Sep 19, 2024
1 parent 80499fe commit e71d217
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ export enum RelationshipType {
commentIds = 'http://schemas.microsoft.com/office/2016/09/relationships/commentsIds',
comments = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments',
commentsExtended = 'http://schemas.microsoft.com/office/2011/relationships/commentsExtended',
coreProperties = 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties',
corePropertiesAlternative = 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties',
coreProperties = 'http://schemas.openxmlformats.org/officedocument/2006/relationships/metadata/core-properties',
customProperties = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties',
customXml = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml',
endnotes = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes',
extendedProperties = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties',
fontTable = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable',
footer = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer',
footnotes = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes',
glossary = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument',
header = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/header',
image = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
numbering = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering',
Expand All @@ -68,7 +70,7 @@ export enum RelationshipType {
webSettings = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings',
hyperlink = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink',
attachedTemplate = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/attachedTemplate',
// For dotx created with office 2020
// For dotx created with office 2020
classificationlabels = 'http://schemas.microsoft.com/office/2020/02/relationships/classificationlabels',
// Legacy template (.dot)
downRev = "http://schemas.microsoft.com/office/2006/relationships/downRev",
Expand Down
4 changes: 3 additions & 1 deletion src/files/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function castRelationshipToClass(
case RelationshipType.customProperties:
return CustomPropertiesXml.fromArchive(archive, meta.target);
case RelationshipType.coreProperties:
case RelationshipType.corePropertiesAlternative:
return CorePropertiesXml.fromArchive(archive, meta.target);
case RelationshipType.endnotes:
return EndnotesXml.fromArchive(archive, meta.target);
Expand Down Expand Up @@ -66,11 +67,12 @@ export function castRelationshipToClass(
case RelationshipType.classificationlabels:
case RelationshipType.downRev:
case RelationshipType.graphicFrameDoc:
case RelationshipType.glossary:
return UnhandledXmlFile.fromArchive(archive, meta.target);

case RelationshipType.attachedTemplate:
default:
// Code intelligence should tell you that `meta.type` is `never` by now:
throw new Error(`Unhandled relation ship type "${meta.type}"`);
throw new Error(`Unhandled relationship type "${meta.type}"`);
}
}

0 comments on commit e71d217

Please sign in to comment.