@patrickdk77/office-defuse 0.1.1 → 0.2.0

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.
Files changed (75) hide show
  1. package/README.md +197 -42
  2. package/dist/cfb-writer.d.ts +25 -0
  3. package/dist/cfb-writer.js +314 -0
  4. package/dist/cli.d.ts +2 -0
  5. package/dist/cli.js +357 -0
  6. package/dist/contained.d.ts +46 -0
  7. package/dist/contained.js +152 -0
  8. package/dist/context.d.ts +107 -12
  9. package/dist/context.js +101 -24
  10. package/dist/engine.d.ts +12 -1
  11. package/dist/engine.js +276 -31
  12. package/dist/errors.d.ts +17 -0
  13. package/dist/errors.js +27 -1
  14. package/dist/fields.d.ts +20 -13
  15. package/dist/fields.js +65 -23
  16. package/dist/findings.d.ts +2 -1
  17. package/dist/findings.js +17 -1
  18. package/dist/flat.d.ts +33 -0
  19. package/dist/flat.js +486 -0
  20. package/dist/formats.d.ts +7 -0
  21. package/dist/formats.js +5 -1
  22. package/dist/formulas.d.ts +27 -0
  23. package/dist/formulas.js +157 -1
  24. package/dist/index.d.ts +3 -2
  25. package/dist/index.js +8 -1
  26. package/dist/index.mjs +1 -1
  27. package/dist/io.d.ts +62 -1
  28. package/dist/io.js +245 -1
  29. package/dist/links.d.ts +27 -0
  30. package/dist/links.js +106 -1
  31. package/dist/msg.d.ts +3 -2
  32. package/dist/msg.js +172 -18
  33. package/dist/objects.d.ts +8 -5
  34. package/dist/objects.js +90 -20
  35. package/dist/odf.d.ts +65 -1
  36. package/dist/odf.js +181 -64
  37. package/dist/offcrypto.d.ts +24 -1
  38. package/dist/offcrypto.js +308 -69
  39. package/dist/ole.js +17 -5
  40. package/dist/oleobj.d.ts +11 -0
  41. package/dist/oleobj.js +20 -3
  42. package/dist/ooxml.d.ts +81 -0
  43. package/dist/ooxml.js +342 -81
  44. package/dist/plan.d.ts +104 -0
  45. package/dist/plan.js +73 -0
  46. package/dist/plugins.d.ts +8 -0
  47. package/dist/plugins.js +60 -0
  48. package/dist/ppt.js +45 -5
  49. package/dist/rewrite-cfb.d.ts +14 -0
  50. package/dist/rewrite-cfb.js +52 -0
  51. package/dist/rewrite-rtf.d.ts +9 -0
  52. package/dist/rewrite-rtf.js +45 -0
  53. package/dist/rewrite-xml.d.ts +36 -0
  54. package/dist/rewrite-xml.js +341 -0
  55. package/dist/rewrite-zip.d.ts +8 -0
  56. package/dist/rewrite-zip.js +498 -0
  57. package/dist/rtf.js +214 -41
  58. package/dist/rtfcomp.d.ts +7 -0
  59. package/dist/rtfcomp.js +80 -0
  60. package/dist/score.js +1 -1
  61. package/dist/sniff.d.ts +5 -0
  62. package/dist/sniff.js +38 -0
  63. package/dist/types.d.ts +43 -6
  64. package/dist/types.js +14 -0
  65. package/dist/vsd.d.ts +13 -0
  66. package/dist/vsd.js +689 -0
  67. package/dist/word.js +51 -17
  68. package/dist/xls.js +38 -4
  69. package/dist/xml.d.ts +30 -0
  70. package/dist/xml.js +45 -23
  71. package/dist/zip-writer.d.ts +4 -0
  72. package/dist/zip-writer.js +20 -7
  73. package/dist/zip.d.ts +9 -2
  74. package/dist/zip.js +61 -4
  75. package/package.json +4 -1
package/dist/ooxml.d.ts CHANGED
@@ -1,5 +1,86 @@
1
1
  import { type ZipContext } from './context';
2
+ import { type XmlElement } from './xml';
2
3
  import { type ZipEntry } from './zip';
4
+ export declare const CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types";
5
+ export declare const RELS_NS = "http://schemas.openxmlformats.org/package/2006/relationships";
6
+ /** The relationship types that name an XPS package's FixedDocumentSequence, lowercased. */
7
+ export declare const XPS_MAIN: {
8
+ xps: string;
9
+ oxps: string;
10
+ };
11
+ /** The XPS and OpenXPS markup namespaces, lowercased. */
12
+ export declare const XPS_NS: Set<string>;
13
+ /** Relationship types, lowercased, as OPC compares them without regard to case. */
14
+ export declare const REL: {
15
+ main: Set<string>;
16
+ hyperlink: Set<string>;
17
+ template: Set<string>;
18
+ image: Set<string>;
19
+ frame: Set<string>;
20
+ subDocument: Set<string>;
21
+ workbook: Set<string>;
22
+ };
23
+ /** Content types, lowercased. */
24
+ export declare const TYPE: {
25
+ vba: Set<string>;
26
+ macrosheet: Set<string>;
27
+ ole: Set<string>;
28
+ control: Set<string>;
29
+ controlBinary: Set<string>;
30
+ vml: string;
31
+ xlsbExternalLink: string;
32
+ };
33
+ /** Whether the rules read a part of this content type as XML. */
34
+ export declare const isXmlType: (ct: string | undefined) => boolean;
35
+ export declare const WORD_NS: Set<string>;
36
+ export declare const SHEET_NS: Set<string>;
37
+ export declare const R_NS: Set<string>;
38
+ export interface Relationship {
39
+ id: string;
40
+ type: string;
41
+ target: string;
42
+ external: boolean;
43
+ }
44
+ export interface Part {
45
+ entry: ZipEntry;
46
+ contentType?: string;
47
+ /** The AS bits of the relationship types that reach the part. */
48
+ reachedAs: number;
49
+ /** A relationship of an ActiveX control part reaches it, so it is that control's binary. */
50
+ claimed: boolean;
51
+ /** The parts its own relationships reach. */
52
+ targets: Set<Part>;
53
+ ole: boolean;
54
+ }
55
+ /** What the rewrite needs of an OOXML package: its parts, which part each relationships part belongs to, and the roots. */
56
+ export interface OoxmlGraph {
57
+ contentTypes: ZipEntry;
58
+ parts: Map<string, Part>;
59
+ relsOf: Map<string, ZipEntry>;
60
+ /** The parts the package relationships reach. */
61
+ roots: Set<Part>;
62
+ /** The package uses the relationship types of Strict OOXML. */
63
+ strict: boolean;
64
+ /** The package is XPS or OpenXPS, whose parts name the parts they use in attributes. */
65
+ xps: boolean;
66
+ }
67
+ /** The key of the part a relationships part belongs to, '' for the package, or undefined for any other part. */
68
+ export declare const relsSource: (relsName: string) => string | undefined;
69
+ /**
70
+ * Resolves an internal target against the folder of the part it belongs to, as RFC 3986 resolves a relative
71
+ * reference: a ".." at the root of the package stays at the root. LibreOffice writes "../customXml/item1.xml" in the
72
+ * package relationships of workbooks it saves.
73
+ */
74
+ export declare function resolveTarget(relsName: string, target: string): string;
75
+ /** A reference in an XPS part to another part: an absolute part name, or a path relative to the part's folder. */
76
+ export declare function resolvePartRef(part: string, ref: string): string;
77
+ /**
78
+ * The resources an XPS element names in its attributes, as the attribute and the URI: a document, page or resource
79
+ * dictionary's Source, a font's FontUri, an image brush's image and profile, and a ContextColor's profile.
80
+ */
81
+ export declare function xpsResources(el: XmlElement): Array<[string, string]>;
82
+ /** Reads a relationships part and hands each relationship to `each` as it is read. Ids given twice are reported. */
83
+ export declare function readRelationships(ctx: ZipContext, entry: ZipEntry, each: (r: Relationship) => void): Promise<void>;
3
84
  /**
4
85
  * Inspects an OOXML package. The package relationships come first, since they name the main part and so the format.
5
86
  * Then each part is read in archive order, followed by its relationships, which are reported as they are read and