helpers.d.ts 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. import type { Encryption, ObjectMetaData, RequestHeaders } from "./internal/type.js";
  2. import { RETENTION_MODES } from "./internal/type.js";
  3. export { ENCRYPTION_TYPES, LEGAL_HOLD_STATUS, RETENTION_MODES, RETENTION_VALIDITY_UNITS } from "./internal/type.js";
  4. export declare const DEFAULT_REGION = "us-east-1";
  5. export declare const PRESIGN_EXPIRY_DAYS_MAX: number;
  6. export interface ICopySourceOptions {
  7. Bucket: string;
  8. Object: string;
  9. /**
  10. * Valid versionId
  11. */
  12. VersionID?: string;
  13. /**
  14. * Etag to match
  15. */
  16. MatchETag?: string;
  17. /**
  18. * Etag to exclude
  19. */
  20. NoMatchETag?: string;
  21. /**
  22. * Modified Date of the object/part. UTC Date in string format
  23. */
  24. MatchModifiedSince?: string | null;
  25. /**
  26. * Modified Date of the object/part to exclude UTC Date in string format
  27. */
  28. MatchUnmodifiedSince?: string | null;
  29. /**
  30. * true or false Object range to match
  31. */
  32. MatchRange?: boolean;
  33. Start?: number;
  34. End?: number;
  35. Encryption?: Encryption;
  36. }
  37. export declare class CopySourceOptions {
  38. readonly Bucket: string;
  39. readonly Object: string;
  40. readonly VersionID: string;
  41. MatchETag: string;
  42. private readonly NoMatchETag;
  43. private readonly MatchModifiedSince;
  44. private readonly MatchUnmodifiedSince;
  45. readonly MatchRange: boolean;
  46. readonly Start: number;
  47. readonly End: number;
  48. private readonly Encryption?;
  49. constructor({
  50. Bucket,
  51. Object,
  52. VersionID,
  53. MatchETag,
  54. NoMatchETag,
  55. MatchModifiedSince,
  56. MatchUnmodifiedSince,
  57. MatchRange,
  58. Start,
  59. End,
  60. Encryption
  61. }: ICopySourceOptions);
  62. validate(): boolean;
  63. getHeaders(): RequestHeaders;
  64. }
  65. /**
  66. * @deprecated use nodejs fs module
  67. */
  68. export declare function removeDirAndFiles(dirPath: string, removeSelf?: boolean): void;
  69. export interface ICopyDestinationOptions {
  70. /**
  71. * Bucket name
  72. */
  73. Bucket: string;
  74. /**
  75. * Object Name for the destination (composed/copied) object defaults
  76. */
  77. Object: string;
  78. /**
  79. * Encryption configuration defaults to {}
  80. * @default {}
  81. */
  82. Encryption?: Encryption;
  83. UserMetadata?: ObjectMetaData;
  84. /**
  85. * query-string encoded string or Record<string, string> Object
  86. */
  87. UserTags?: Record<string, string> | string;
  88. LegalHold?: 'on' | 'off';
  89. /**
  90. * UTC Date String
  91. */
  92. RetainUntilDate?: string;
  93. Mode?: RETENTION_MODES;
  94. MetadataDirective?: 'COPY' | 'REPLACE';
  95. /**
  96. * Extra headers for the target object
  97. */
  98. Headers?: Record<string, string>;
  99. }
  100. export declare class CopyDestinationOptions {
  101. readonly Bucket: string;
  102. readonly Object: string;
  103. private readonly Encryption?;
  104. private readonly UserMetadata?;
  105. private readonly UserTags?;
  106. private readonly LegalHold?;
  107. private readonly RetainUntilDate?;
  108. private readonly Mode?;
  109. private readonly MetadataDirective?;
  110. private readonly Headers?;
  111. constructor({
  112. Bucket,
  113. Object,
  114. Encryption,
  115. UserMetadata,
  116. UserTags,
  117. LegalHold,
  118. RetainUntilDate,
  119. Mode,
  120. MetadataDirective,
  121. Headers
  122. }: ICopyDestinationOptions);
  123. getHeaders(): RequestHeaders;
  124. validate(): boolean;
  125. }
  126. /**
  127. * maybe this should be a generic type for Records, leave it for later refactor
  128. */
  129. export declare class SelectResults {
  130. private records?;
  131. private response?;
  132. private stats?;
  133. private progress?;
  134. constructor({
  135. records,
  136. // parsed data as stream
  137. response,
  138. // original response stream
  139. stats,
  140. // stats as xml
  141. progress
  142. }: {
  143. records?: unknown;
  144. response?: unknown;
  145. stats?: string;
  146. progress?: unknown;
  147. });
  148. setStats(stats: string): void;
  149. getStats(): string | undefined;
  150. setProgress(progress: unknown): void;
  151. getProgress(): unknown;
  152. setResponse(response: unknown): void;
  153. getResponse(): unknown;
  154. setRecords(records: unknown): void;
  155. getRecords(): unknown;
  156. }