xml-parser.d.ts 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /// <reference types="node" />
  2. /// <reference types="node" />
  3. import type * as http from 'node:http';
  4. import { SelectResults } from "../helpers.js";
  5. import type { BucketItemFromList, BucketItemWithMetadata, CopyObjectResultV1, ListObjectV2Res, NotificationConfigResult, ObjectInfo, ObjectLockInfo, ReplicationConfig, Tag } from "./type.js";
  6. export declare function parseBucketRegion(xml: string): string;
  7. export declare function parseError(xml: string, headerInfo: Record<string, unknown>): Record<string, unknown>;
  8. export declare function parseResponseError(response: http.IncomingMessage): Promise<Record<string, string>>;
  9. /**
  10. * parse XML response for list objects v2 with metadata in a bucket
  11. */
  12. export declare function parseListObjectsV2WithMetadata(xml: string): {
  13. objects: Array<BucketItemWithMetadata>;
  14. isTruncated: boolean;
  15. nextContinuationToken: string;
  16. };
  17. export declare function parseListObjectsV2(xml: string): ListObjectV2Res;
  18. export declare function parseBucketNotification(xml: string): NotificationConfigResult;
  19. export type UploadedPart = {
  20. part: number;
  21. lastModified?: Date;
  22. etag: string;
  23. size: number;
  24. };
  25. export declare function parseListParts(xml: string): {
  26. isTruncated: boolean;
  27. marker: number;
  28. parts: UploadedPart[];
  29. };
  30. export declare function parseListBucket(xml: string): BucketItemFromList[];
  31. export declare function parseInitiateMultipart(xml: string): string;
  32. export declare function parseReplicationConfig(xml: string): ReplicationConfig;
  33. export declare function parseObjectLegalHoldConfig(xml: string): any;
  34. export declare function parseTagging(xml: string): Tag[];
  35. export declare function parseCompleteMultipart(xml: string): {
  36. location: any;
  37. bucket: any;
  38. key: any;
  39. etag: any;
  40. errCode?: undefined;
  41. errMessage?: undefined;
  42. } | {
  43. errCode: any;
  44. errMessage: any;
  45. location?: undefined;
  46. bucket?: undefined;
  47. key?: undefined;
  48. etag?: undefined;
  49. } | undefined;
  50. type UploadID = string;
  51. export type ListMultipartResult = {
  52. uploads: {
  53. key: string;
  54. uploadId: UploadID;
  55. initiator?: {
  56. id: string;
  57. displayName: string;
  58. };
  59. owner?: {
  60. id: string;
  61. displayName: string;
  62. };
  63. storageClass: unknown;
  64. initiated: Date;
  65. }[];
  66. prefixes: {
  67. prefix: string;
  68. }[];
  69. isTruncated: boolean;
  70. nextKeyMarker: string;
  71. nextUploadIdMarker: string;
  72. };
  73. export declare function parseListMultipart(xml: string): ListMultipartResult;
  74. export declare function parseObjectLockConfig(xml: string): ObjectLockInfo;
  75. export declare function parseBucketVersioningConfig(xml: string): any;
  76. export declare function parseSelectObjectContentResponse(res: Buffer): SelectResults | undefined;
  77. export declare function parseLifecycleConfig(xml: string): any;
  78. export declare function parseBucketEncryptionConfig(xml: string): any;
  79. export declare function parseObjectRetentionConfig(xml: string): {
  80. mode: any;
  81. retainUntilDate: any;
  82. };
  83. export declare function removeObjectsParser(xml: string): any[];
  84. export declare function parseCopyObject(xml: string): CopyObjectResultV1;
  85. export declare function parseListObjects(xml: string): {
  86. objects: ObjectInfo[];
  87. isTruncated?: boolean | undefined;
  88. nextMarker?: string | undefined;
  89. versionIdMarker?: string | undefined;
  90. keyMarker?: string | undefined;
  91. };
  92. export declare function uploadPartParser(xml: string): any;
  93. export {};